mirror of
https://github.com/badvision/jace.git
synced 2024-11-24 15:30:51 +00:00
Commandline arguments are passed in to emulator init again
This commit is contained in:
parent
d5b0e10add
commit
8fc422e0dd
@ -21,19 +21,10 @@ package jace;
|
|||||||
import jace.apple2e.Apple2e;
|
import jace.apple2e.Apple2e;
|
||||||
import jace.config.Configuration;
|
import jace.config.Configuration;
|
||||||
import jace.ui.AbstractEmulatorFrame;
|
import jace.ui.AbstractEmulatorFrame;
|
||||||
import jace.ui.EmulatorFrame;
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.event.ComponentEvent;
|
|
||||||
import java.awt.event.ComponentListener;
|
|
||||||
import java.awt.event.WindowEvent;
|
|
||||||
import java.awt.event.WindowListener;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import javax.swing.JFrame;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created on January 15, 2007, 10:10 PM
|
* Created on January 15, 2007, 10:10 PM
|
||||||
@ -44,10 +35,10 @@ public class Emulator {
|
|||||||
public static Emulator instance;
|
public static Emulator instance;
|
||||||
public static Thread mainThread;
|
public static Thread mainThread;
|
||||||
|
|
||||||
public static void main(String... args) {
|
// public static void main(String... args) {
|
||||||
mainThread = Thread.currentThread();
|
// mainThread = Thread.currentThread();
|
||||||
instance = new Emulator(args);
|
// instance = new Emulator(args);
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static Apple2e computer;
|
public static Apple2e computer;
|
||||||
public AbstractEmulatorFrame theApp;
|
public AbstractEmulatorFrame theApp;
|
||||||
@ -56,16 +47,17 @@ public class Emulator {
|
|||||||
* Creates a new instance of Emulator
|
* Creates a new instance of Emulator
|
||||||
* @param args
|
* @param args
|
||||||
*/
|
*/
|
||||||
public Emulator(String... args) {
|
public Emulator(List<String> args) {
|
||||||
computer = new Apple2e();
|
computer = new Apple2e();
|
||||||
Configuration.loadSettings();
|
Configuration.loadSettings();
|
||||||
|
mainThread = Thread.currentThread();
|
||||||
Map<String, String> settings = new HashMap<>();
|
Map<String, String> settings = new HashMap<>();
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.size(); i++) {
|
||||||
if (args[i].startsWith("-")) {
|
if (args.get(i).startsWith("-")) {
|
||||||
String key = args[i].substring(1);
|
String key = args.get(i).substring(1);
|
||||||
if ((i + 1) < args.length) {
|
if ((i + 1) < args.size()) {
|
||||||
String val = args[i + 1];
|
String val = args.get(i + 1);
|
||||||
if (!val.startsWith("-")) {
|
if (!val.startsWith("-")) {
|
||||||
settings.put(key, val);
|
settings.put(key, val);
|
||||||
i++;
|
i++;
|
||||||
@ -76,7 +68,7 @@ public class Emulator {
|
|||||||
settings.put(key, "true");
|
settings.put(key, "true");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.err.println("Did not understand parameter " + args[i] + ", skipping.");
|
System.err.println("Did not understand parameter " + args.get(i) + ", skipping.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,15 +39,15 @@ public class JaceApplication extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
Emulator e = new Emulator();
|
Emulator emulator = new Emulator(getParameters().getRaw());
|
||||||
javafx.application.Platform.runLater(() -> {
|
javafx.application.Platform.runLater(() -> {
|
||||||
while (Emulator.computer.getVideo() == null || Emulator.computer.getVideo().getFrameBuffer() == null) {
|
while (Emulator.computer.getVideo() == null || Emulator.computer.getVideo().getFrameBuffer() == null) {
|
||||||
Thread.yield();
|
Thread.yield();
|
||||||
}
|
}
|
||||||
controller.connectComputer(Emulator.computer);
|
controller.connectComputer(Emulator.computer);
|
||||||
});
|
});
|
||||||
primaryStage.setOnCloseRequest(value -> {
|
primaryStage.setOnCloseRequest(event->{
|
||||||
Emulator.computer.deactivate();
|
emulator.computer.deactivate();
|
||||||
Platform.exit();
|
Platform.exit();
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package jace.core;
|
package jace.core;
|
||||||
|
|
||||||
import jace.Emulator;
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -46,9 +45,7 @@ import java.util.logging.Level;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JDialog;
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JProgressBar;
|
import javax.swing.JProgressBar;
|
||||||
|
|
||||||
@ -96,7 +93,7 @@ public class Utility {
|
|||||||
try {
|
try {
|
||||||
// Try to create an instance of the object
|
// Try to create an instance of the object
|
||||||
String className = pckgname + "." + classname;
|
String className = pckgname + "." + classname;
|
||||||
System.out.println("Class: " + className);
|
// System.out.println("Class: " + className);
|
||||||
Class c = Class.forName(className);
|
Class c = Class.forName(className);
|
||||||
if (clazz.isAssignableFrom(c)) {
|
if (clazz.isAssignableFrom(c)) {
|
||||||
output.add(c);
|
output.add(c);
|
||||||
|
Loading…
Reference in New Issue
Block a user