mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-06-01 14:41:44 +00:00
Adjust behaviors during boot, also adjust joystick for Boulder Dash bugfix
This commit is contained in:
parent
9a38fe972b
commit
2ca93fc26e
|
@ -63,7 +63,7 @@ public class LawlessLegends extends Application {
|
||||||
}
|
}
|
||||||
|
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
Platform.runLater(() -> new Thread(() -> {
|
new Thread(() -> {
|
||||||
Emulator.getInstance(getParameters().getRaw());
|
Emulator.getInstance(getParameters().getRaw());
|
||||||
Emulator.withComputer(c-> {
|
Emulator.withComputer(c-> {
|
||||||
((LawlessComputer)c).initLawlessLegendsConfiguration();
|
((LawlessComputer)c).initLawlessLegendsConfiguration();
|
||||||
|
@ -84,7 +84,7 @@ public class LawlessLegends extends Application {
|
||||||
Thread.onSpinWait();
|
Thread.onSpinWait();
|
||||||
}
|
}
|
||||||
bootWatchdog();
|
bootWatchdog();
|
||||||
}).start());
|
}).start();
|
||||||
primaryStage.setOnCloseRequest(event -> {
|
primaryStage.setOnCloseRequest(event -> {
|
||||||
Emulator.withComputer(Computer::deactivate);
|
Emulator.withComputer(Computer::deactivate);
|
||||||
Platform.exit();
|
Platform.exit();
|
||||||
|
@ -188,6 +188,7 @@ public class LawlessLegends extends Application {
|
||||||
|
|
||||||
private void configureEmulatorForGame() {
|
private void configureEmulatorForGame() {
|
||||||
Emulator.withComputer(c -> {
|
Emulator.withComputer(c -> {
|
||||||
|
System.out.println("CONFIUGRE EMULATOR START");
|
||||||
c.enableHints = false;
|
c.enableHints = false;
|
||||||
c.clockEnabled = true;
|
c.clockEnabled = true;
|
||||||
c.joy1enabled = false;
|
c.joy1enabled = false;
|
||||||
|
@ -207,6 +208,7 @@ public class LawlessLegends extends Application {
|
||||||
if (c.PRODUCTION_MODE) {
|
if (c.PRODUCTION_MODE) {
|
||||||
((LawlessImageTool) c.getUpgradeHandler()).loadGame();
|
((LawlessImageTool) c.getUpgradeHandler()).loadGame();
|
||||||
}
|
}
|
||||||
|
System.out.println("CONFIUGRE EMULATOR END");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class Apple2e extends Computer {
|
||||||
static int IRQ_VECTOR = 0x003F2;
|
static int IRQ_VECTOR = 0x003F2;
|
||||||
|
|
||||||
@ConfigurableField(name = "Production mode", shortName = "production")
|
@ConfigurableField(name = "Production mode", shortName = "production")
|
||||||
public boolean PRODUCTION_MODE = false;
|
public boolean PRODUCTION_MODE = true;
|
||||||
@ConfigurableField(name = "Slot 1", shortName = "s1card")
|
@ConfigurableField(name = "Slot 1", shortName = "s1card")
|
||||||
public DeviceSelection<Cards> card1 = new DeviceSelection<>(Cards.class, null);
|
public DeviceSelection<Cards> card1 = new DeviceSelection<>(Cards.class, null);
|
||||||
@ConfigurableField(name = "Slot 2", shortName = "s2card")
|
@ConfigurableField(name = "Slot 2", shortName = "s2card")
|
||||||
|
|
|
@ -133,7 +133,6 @@ public abstract class Computer implements Reconfigurable {
|
||||||
getMotherboard().addChildDevice(video);
|
getMotherboard().addChildDevice(video);
|
||||||
video.configureVideoMode();
|
video.configureVideoMode();
|
||||||
video.reconfigure();
|
video.reconfigure();
|
||||||
video.resume();
|
|
||||||
}
|
}
|
||||||
if (LawlessLegends.getApplication() != null) {
|
if (LawlessLegends.getApplication() != null) {
|
||||||
LawlessLegends.getApplication().reconnectUIHooks();
|
LawlessLegends.getApplication().reconnectUIHooks();
|
||||||
|
|
|
@ -105,10 +105,6 @@ public abstract class Device implements Reconfigurable {
|
||||||
newDevices.stream().filter(d-> !children.contains(d)).forEach(this::addChildDevice);
|
newDevices.stream().filter(d-> !children.contains(d)).forEach(this::addChildDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getRunningProperty() {
|
|
||||||
return run;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addWaitCycles(int wait) {
|
public void addWaitCycles(int wait) {
|
||||||
waitCycles += wait;
|
waitCycles += wait;
|
||||||
}
|
}
|
||||||
|
@ -170,11 +166,19 @@ public abstract class Device implements Reconfigurable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public final synchronized void setRun(boolean run) {
|
public final synchronized void setRun(boolean run) {
|
||||||
|
// if (this.run != run) {
|
||||||
|
// System.out.println(getDeviceName() + " " + (run ? "RUN" : "STOP"));
|
||||||
|
// Thread.dumpStack();
|
||||||
|
// }
|
||||||
this.run = run;
|
this.run = run;
|
||||||
updateTickHandler();
|
updateTickHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void setPaused(boolean paused) {
|
public synchronized void setPaused(boolean paused) {
|
||||||
|
// if (this.paused != paused) {
|
||||||
|
// System.out.println(getDeviceName() + " " + (paused ? "PAUSED" : "UNPAUSED"));
|
||||||
|
// Thread.dumpStack();
|
||||||
|
// }
|
||||||
this.paused = paused;
|
this.paused = paused;
|
||||||
updateTickHandler();
|
updateTickHandler();
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,8 +336,8 @@ public class Joystick extends Device {
|
||||||
|
|
||||||
// We have to let the joystick go a little further in the positive direction
|
// We have to let the joystick go a little further in the positive direction
|
||||||
// because boulderdash is a little too sensitive!
|
// because boulderdash is a little too sensitive!
|
||||||
x = Math.max(-1.0f, Math.min(1.1f, x * sensitivity));
|
x = Math.max(-1.0f, Math.min(1.0f, x * sensitivity));
|
||||||
y = Math.max(-1.0f, Math.min(1.1f, y * sensitivity));
|
y = Math.max(-1.0f, Math.min(1.0f, y * sensitivity));
|
||||||
|
|
||||||
joyX = (int) (x * 128.0 + 128.0);
|
joyX = (int) (x * 128.0 + 128.0);
|
||||||
joyY = (int) (y * 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) {
|
public void initJoystickRead(RAMEvent e) {
|
||||||
readJoystick();
|
readJoystick();
|
||||||
xSwitch.setState(true);
|
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;
|
x = 10 + joyX * 11;
|
||||||
ySwitch.setState(true);
|
ySwitch.setState(true);
|
||||||
y = 10 + joyY * 11;
|
y = 10 + joyY * 11;
|
||||||
|
|
|
@ -29,6 +29,7 @@ import java.util.logging.Logger;
|
||||||
|
|
||||||
import jace.Emulator;
|
import jace.Emulator;
|
||||||
import jace.apple2e.MOS65C02;
|
import jace.apple2e.MOS65C02;
|
||||||
|
import jace.apple2e.SoftSwitches;
|
||||||
import jace.core.RAM;
|
import jace.core.RAM;
|
||||||
import jace.hardware.ProdosDriver.MLI_COMMAND_TYPE;
|
import jace.hardware.ProdosDriver.MLI_COMMAND_TYPE;
|
||||||
|
|
||||||
|
@ -106,7 +107,7 @@ public class LargeDisk implements IDisk {
|
||||||
@Override
|
@Override
|
||||||
public void boot0(int slot) {
|
public void boot0(int slot) {
|
||||||
Emulator.withComputer(c->
|
Emulator.withComputer(c->
|
||||||
c.getCpu().whileSuspended(()->{
|
c.getCpu().whilePaused(()->{
|
||||||
try {
|
try {
|
||||||
// System.out.println("Loading boot0 to $800");
|
// System.out.println("Loading boot0 to $800");
|
||||||
mliRead(0, 0x0800);
|
mliRead(0, 0x0800);
|
||||||
|
@ -117,6 +118,16 @@ public class LargeDisk implements IDisk {
|
||||||
// System.out.println("X = "+Integer.toHexString(slot16));
|
// System.out.println("X = "+Integer.toHexString(slot16));
|
||||||
((MOS65C02) c.getCpu()).X = slot16;
|
((MOS65C02) c.getCpu()).X = slot16;
|
||||||
RAM memory = c.getMemory();
|
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(CardMassStorage.SLT16, slot16, false, false);
|
||||||
memory.write(MLI_COMMAND, (byte) MLI_COMMAND_TYPE.READ.intValue, false, false);
|
memory.write(MLI_COMMAND, (byte) MLI_COMMAND_TYPE.READ.intValue, false, false);
|
||||||
memory.write(MLI_UNITNUMBER, slot16, false, false);
|
memory.write(MLI_UNITNUMBER, slot16, false, false);
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class LawlessComputer extends Apple2e {
|
||||||
this.cheatEngine.setValue(Cheats.Cheat.LawlessHacks);
|
this.cheatEngine.setValue(Cheats.Cheat.LawlessHacks);
|
||||||
}
|
}
|
||||||
blankTextPage1();
|
blankTextPage1();
|
||||||
reconfigure();
|
reconfigure();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void blankTextPage1() {
|
private void blankTextPage1() {
|
||||||
|
@ -109,9 +109,8 @@ public class LawlessComputer extends Apple2e {
|
||||||
Logger.getLogger(LawlessComputer.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(LawlessComputer.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getCpu().setPaused(false);
|
|
||||||
finishColdStart();
|
finishColdStart();
|
||||||
|
getCpu().setPaused(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderWithMask(int... mask) throws InterruptedException {
|
private void renderWithMask(int... mask) throws InterruptedException {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user