diff --git a/Platform/Apple/tools/jace/src/main/java/jace/LawlessLegends.java b/Platform/Apple/tools/jace/src/main/java/jace/LawlessLegends.java index edb7bac6..c0e0c332 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/LawlessLegends.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/LawlessLegends.java @@ -63,7 +63,7 @@ public class LawlessLegends extends Application { } primaryStage.show(); - Platform.runLater(() -> new Thread(() -> { + new Thread(() -> { Emulator.getInstance(getParameters().getRaw()); Emulator.withComputer(c-> { ((LawlessComputer)c).initLawlessLegendsConfiguration(); @@ -84,7 +84,7 @@ public class LawlessLegends extends Application { Thread.onSpinWait(); } bootWatchdog(); - }).start()); + }).start(); primaryStage.setOnCloseRequest(event -> { Emulator.withComputer(Computer::deactivate); Platform.exit(); @@ -188,6 +188,7 @@ public class LawlessLegends extends Application { private void configureEmulatorForGame() { Emulator.withComputer(c -> { + System.out.println("CONFIUGRE EMULATOR START"); c.enableHints = false; c.clockEnabled = true; c.joy1enabled = false; @@ -207,6 +208,7 @@ public class LawlessLegends extends Application { if (c.PRODUCTION_MODE) { ((LawlessImageTool) c.getUpgradeHandler()).loadGame(); } + System.out.println("CONFIUGRE EMULATOR END"); }); } } diff --git a/Platform/Apple/tools/jace/src/main/java/jace/apple2e/Apple2e.java b/Platform/Apple/tools/jace/src/main/java/jace/apple2e/Apple2e.java index 28a14195..37b08fc1 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/apple2e/Apple2e.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/apple2e/Apple2e.java @@ -63,7 +63,7 @@ public class Apple2e extends Computer { static int IRQ_VECTOR = 0x003F2; @ConfigurableField(name = "Production mode", shortName = "production") - public boolean PRODUCTION_MODE = false; + public boolean PRODUCTION_MODE = true; @ConfigurableField(name = "Slot 1", shortName = "s1card") public DeviceSelection card1 = new DeviceSelection<>(Cards.class, null); @ConfigurableField(name = "Slot 2", shortName = "s2card") diff --git a/Platform/Apple/tools/jace/src/main/java/jace/core/Computer.java b/Platform/Apple/tools/jace/src/main/java/jace/core/Computer.java index b327b55c..40922f86 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/core/Computer.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/core/Computer.java @@ -133,7 +133,6 @@ public abstract class Computer implements Reconfigurable { getMotherboard().addChildDevice(video); video.configureVideoMode(); video.reconfigure(); - video.resume(); } if (LawlessLegends.getApplication() != null) { LawlessLegends.getApplication().reconnectUIHooks(); diff --git a/Platform/Apple/tools/jace/src/main/java/jace/core/Device.java b/Platform/Apple/tools/jace/src/main/java/jace/core/Device.java index 9f995ad1..9fc10aef 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/core/Device.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/core/Device.java @@ -105,10 +105,6 @@ public abstract class Device implements Reconfigurable { newDevices.stream().filter(d-> !children.contains(d)).forEach(this::addChildDevice); } - public boolean getRunningProperty() { - return run; - } - public void addWaitCycles(int wait) { waitCycles += wait; } @@ -170,11 +166,19 @@ public abstract class Device implements Reconfigurable { } public final synchronized void setRun(boolean run) { + // if (this.run != run) { + // System.out.println(getDeviceName() + " " + (run ? "RUN" : "STOP")); + // Thread.dumpStack(); + // } this.run = run; updateTickHandler(); } public synchronized void setPaused(boolean paused) { + // if (this.paused != paused) { + // System.out.println(getDeviceName() + " " + (paused ? "PAUSED" : "UNPAUSED")); + // Thread.dumpStack(); + // } this.paused = paused; updateTickHandler(); } diff --git a/Platform/Apple/tools/jace/src/main/java/jace/hardware/Joystick.java b/Platform/Apple/tools/jace/src/main/java/jace/hardware/Joystick.java index 5174c2b3..0b921f86 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/hardware/Joystick.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/hardware/Joystick.java @@ -336,8 +336,8 @@ public class Joystick extends Device { // We have to let the joystick go a little further in the positive direction // because boulderdash is a little too sensitive! - x = Math.max(-1.0f, Math.min(1.1f, x * sensitivity)); - y = Math.max(-1.0f, Math.min(1.1f, y * sensitivity)); + x = Math.max(-1.0f, Math.min(1.0f, x * sensitivity)); + y = Math.max(-1.0f, Math.min(1.0f, y * sensitivity)); joyX = (int) (x * 128.0 + 128.0); joyY = (int) (y * 128.0 + 128.0); @@ -595,6 +595,14 @@ public class Joystick extends Device { public void initJoystickRead(RAMEvent e) { readJoystick(); xSwitch.setState(true); + // Some games just suck and don't want to read the joystick properly + // Use larger-than-necessary values to try to get around this + if (joyX >= 254) { + joyX = 280; + } + if (joyY >= 255) { + joyY = 280; + } x = 10 + joyX * 11; ySwitch.setState(true); y = 10 + joyY * 11; diff --git a/Platform/Apple/tools/jace/src/main/java/jace/hardware/massStorage/LargeDisk.java b/Platform/Apple/tools/jace/src/main/java/jace/hardware/massStorage/LargeDisk.java index f82fbed1..4147d82d 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/hardware/massStorage/LargeDisk.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/hardware/massStorage/LargeDisk.java @@ -29,6 +29,7 @@ import java.util.logging.Logger; import jace.Emulator; import jace.apple2e.MOS65C02; +import jace.apple2e.SoftSwitches; import jace.core.RAM; import jace.hardware.ProdosDriver.MLI_COMMAND_TYPE; @@ -106,7 +107,7 @@ public class LargeDisk implements IDisk { @Override public void boot0(int slot) { Emulator.withComputer(c-> - c.getCpu().whileSuspended(()->{ + c.getCpu().whilePaused(()->{ try { // System.out.println("Loading boot0 to $800"); mliRead(0, 0x0800); @@ -117,6 +118,16 @@ public class LargeDisk implements IDisk { // System.out.println("X = "+Integer.toHexString(slot16)); ((MOS65C02) c.getCpu()).X = slot16; RAM memory = c.getMemory(); + SoftSwitches.AUXZP.getSwitch().setState(false); + SoftSwitches.LCBANK1.getSwitch().setState(false); + SoftSwitches.LCRAM.getSwitch().setState(false); + SoftSwitches.LCWRITE.getSwitch().setState(true); + SoftSwitches.RAMRD.getSwitch().setState(false); + SoftSwitches.RAMWRT.getSwitch().setState(false); + SoftSwitches.CXROM.getSwitch().setState(false); + SoftSwitches.SLOTC3ROM.getSwitch().setState(false); + SoftSwitches.INTC8ROM.getSwitch().setState(false); + memory.write(CardMassStorage.SLT16, slot16, false, false); memory.write(MLI_COMMAND, (byte) MLI_COMMAND_TYPE.READ.intValue, false, false); memory.write(MLI_UNITNUMBER, slot16, false, false); diff --git a/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessComputer.java b/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessComputer.java index fb945c34..c4684400 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessComputer.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessComputer.java @@ -39,7 +39,7 @@ public class LawlessComputer extends Apple2e { this.cheatEngine.setValue(Cheats.Cheat.LawlessHacks); } blankTextPage1(); - reconfigure(); + reconfigure(); } private void blankTextPage1() { @@ -109,9 +109,8 @@ public class LawlessComputer extends Apple2e { Logger.getLogger(LawlessComputer.class.getName()).log(Level.SEVERE, null, ex); } } - getCpu().setPaused(false); finishColdStart(); - + getCpu().setPaused(false); } private void renderWithMask(int... mask) throws InterruptedException {