mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-06-26 00:29:30 +00:00
Memory handlers should be smarter about I/O page detection even with aux flag specified
This commit is contained in:
parent
0bcd1976f5
commit
3f3a7c83ba
|
@ -60,7 +60,7 @@ public abstract class Cheats extends Device {
|
|||
return addCheat(RAMEvent.TYPE.ANY, (e) -> e.setNewValue(value), address);
|
||||
}
|
||||
|
||||
public RAMListener forceValue(int value, boolean auxFlag, int... address) {
|
||||
public RAMListener forceValue(int value, Boolean auxFlag, int... address) {
|
||||
return addCheat(RAMEvent.TYPE.ANY, auxFlag, (e) -> e.setNewValue(value), address);
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public abstract class Cheats extends Device {
|
|||
return listener;
|
||||
}
|
||||
|
||||
public RAMListener addCheat(RAMEvent.TYPE type, boolean auxFlag, RAMEvent.RAMEventHandler handler, int... address) {
|
||||
public RAMListener addCheat(RAMEvent.TYPE type, Boolean auxFlag, RAMEvent.RAMEventHandler handler, int... address) {
|
||||
RAMListener listener;
|
||||
if (address.length == 1) {
|
||||
listener = computer.getMemory().observe(type, address[0], auxFlag, handler);
|
||||
|
|
|
@ -214,7 +214,7 @@ public abstract class RAM implements Reconfigurable {
|
|||
});
|
||||
}
|
||||
|
||||
public RAMListener observe(RAMEvent.TYPE type, int address, boolean auxFlag, RAMEvent.RAMEventHandler handler) {
|
||||
public RAMListener observe(RAMEvent.TYPE type, int address, Boolean auxFlag, RAMEvent.RAMEventHandler handler) {
|
||||
return addListener(new RAMListener(type, RAMEvent.SCOPE.ADDRESS, RAMEvent.VALUE.ANY) {
|
||||
@Override
|
||||
protected void doConfig() {
|
||||
|
@ -245,7 +245,7 @@ public abstract class RAM implements Reconfigurable {
|
|||
});
|
||||
}
|
||||
|
||||
public RAMListener observe(RAMEvent.TYPE type, int addressStart, int addressEnd, boolean auxFlag, RAMEvent.RAMEventHandler handler) {
|
||||
public RAMListener observe(RAMEvent.TYPE type, int addressStart, int addressEnd, Boolean auxFlag, RAMEvent.RAMEventHandler handler) {
|
||||
return addListener(new RAMListener(type, RAMEvent.SCOPE.RANGE, RAMEvent.VALUE.ANY) {
|
||||
@Override
|
||||
protected void doConfig() {
|
||||
|
@ -262,12 +262,15 @@ public abstract class RAM implements Reconfigurable {
|
|||
});
|
||||
}
|
||||
|
||||
private boolean isAuxFlagCorrect(RAMEvent e, boolean auxFlag) {
|
||||
private boolean isAuxFlagCorrect(RAMEvent e, Boolean auxFlag) {
|
||||
if (e.getAddress() < 0x0100) {
|
||||
if (SoftSwitches.AUXZP.getState() != auxFlag) {
|
||||
return false;
|
||||
}
|
||||
} else if (SoftSwitches.RAMRD.getState() != auxFlag) {
|
||||
} else if (e.getAddress() >= 0x0C000 && e.getAddress() <= 0x0CFFF) {
|
||||
// I/O page doesn't care about the aux flag
|
||||
return true;
|
||||
} else if (auxFlag != null && SoftSwitches.RAMRD.getState() != auxFlag) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user