1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-25 05:33:29 +00:00

Merge branch '827-vice-x64sc-emulator-will-not-start-properly-on-windows' into 'master'

Resolve "Vice x64sc emulator will not start properly on Windows"

Closes #827

See merge request camelot/kickc!50
This commit is contained in:
Jesper Balman Gravgaard 2023-08-27 17:42:18 +00:00
commit c36900a219

View File

@ -499,25 +499,34 @@ public class KickC implements Callable<Integer> {
// Execute the binary file if instructed
if(emulator != null) {
List<String> emulatorCommand = new ArrayList<>();
emulatorCommand.addAll(Arrays.asList(emulator.split(" ")));
// Find commandline options for the emulator
String emuOptions = "";
if(emulator.equals("C64Debugger")) {
if( emulator.equals("C64Debugger") ) {
Path viceSymbolsPath = program.getOutputFileManager().getOutputFile("vs");
emuOptions = "-symbols " + viceSymbolsPath + " -autojmp -prg ";
emulatorCommand.add("-symbol");
emulatorCommand.add(viceSymbolsPath.toString());
emulatorCommand.add("-autojmp");
emulatorCommand.add("-prg");
}
// The program names used by VICE emulators
List<String> viceEmus = Arrays.asList("x64", "x64sc", "x128", "x64dtv", "xcbm2", "xcbm5x0", "xpet", "xplus4", "xscpu64", "xvic");
if(viceEmus.contains(emulator)) {
Path viceSymbolsPath = program.getOutputFileManager().getOutputFile("vs");
emuOptions = "-moncommands " + viceSymbolsPath.toAbsolutePath().toString() + " ";
emulatorCommand.add("-moncommands");
emulatorCommand.add(viceSymbolsPath.toAbsolutePath().toString());
}
emulatorCommand.add(outputBinaryFilePath.toAbsolutePath().toString());
System.out.println("Executing " + outputBinaryFilePath + " using " + emulator);
String executeCommand = emulator + " " + emuOptions + outputBinaryFilePath.toAbsolutePath().toString();
if(verbose) {
System.out.println("Executing command: " + executeCommand);
System.out.println("Executing command: " + String.join(" ", emulatorCommand));
}
try {
Process process = Runtime.getRuntime().exec(executeCommand);
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command(emulatorCommand);
processBuilder.inheritIO();
Process process = processBuilder.start();
process.waitFor();
} catch(Throwable e) {
System.err.println("Executing emulator failed! " + e.getMessage());