diff --git a/src/main/java/jace/cheat/MemoryCell.java b/src/main/java/jace/cheat/MemoryCell.java index 974b493..9d57818 100644 --- a/src/main/java/jace/cheat/MemoryCell.java +++ b/src/main/java/jace/cheat/MemoryCell.java @@ -30,6 +30,7 @@ public class MemoryCell implements Comparable { public ObservableList readInstructionsDisassembly = FXCollections.observableArrayList(new ArrayList<>()); public ObservableList writeInstructions = FXCollections.observableList(new ArrayList<>()); public ObservableList writeInstructionsDisassembly = FXCollections.observableArrayList(new ArrayList<>()); + public ObservableList execInstructionsDisassembly = FXCollections.observableArrayList(new ArrayList<>()); private int x; private int y; private int width; diff --git a/src/main/java/jace/cheat/MetaCheat.java b/src/main/java/jace/cheat/MetaCheat.java index ebd4bfc..9e9b9ea 100644 --- a/src/main/java/jace/cheat/MetaCheat.java +++ b/src/main/java/jace/cheat/MetaCheat.java @@ -339,11 +339,17 @@ public class MetaCheat extends Cheats { MemoryCell cell = getMemoryCell(e.getAddress()); if (cell != null) { CPU cpu = Emulator.computer.getCpu(); + int pc = cpu.getProgramCounter(); + String trace = cpu.getLastTrace(); if (!cpu.isLogEnabled()) { cpu.traceLength = 1; } switch (e.getType()) { case EXECUTE: + cell.execInstructionsDisassembly.add(trace); + if (cell.execInstructionsDisassembly.size() > historyLength) { + cell.execInstructionsDisassembly.remove(0); + } case READ_OPERAND: cell.execCount.set(Math.min(255, cell.execCount.get() + lightRate)); break; @@ -351,8 +357,6 @@ public class MetaCheat extends Cheats { cell.writeCount.set(Math.min(255, cell.writeCount.get() + lightRate)); if (ui.isInspecting(cell.address)) { if (pendingInspectorUpdates.incrementAndGet() < 5) { - int pc = cpu.getProgramCounter(); - String trace = cpu.getLastTrace(); Platform.runLater(() -> { pendingInspectorUpdates.decrementAndGet(); cell.writeInstructions.add(pc); @@ -376,8 +380,6 @@ public class MetaCheat extends Cheats { cell.readCount.set(Math.min(255, cell.readCount.get() + lightRate)); if (ui.isInspecting(cell.address)) { if (pendingInspectorUpdates.incrementAndGet() < 5) { - int pc = cpu.getProgramCounter(); - String trace = cpu.getLastTrace(); Platform.runLater(() -> { pendingInspectorUpdates.decrementAndGet(); cell.readInstructions.add(pc); diff --git a/src/main/java/jace/ui/MetacheatUI.java b/src/main/java/jace/ui/MetacheatUI.java index a5d790d..c686b99 100644 --- a/src/main/java/jace/ui/MetacheatUI.java +++ b/src/main/java/jace/ui/MetacheatUI.java @@ -310,7 +310,7 @@ public class MetacheatUI { }); memoryViewPane.boundsInParentProperty().addListener((prop, oldVal, newVal) -> redrawMemoryView()); drawScale = isRetina ? 0.5 : 1.0; - memoryViewCanvas.widthProperty().bind(memoryViewPane.widthProperty().multiply(drawScale)); + memoryViewCanvas.widthProperty().bind(memoryViewPane.widthProperty().multiply(drawScale).subtract(8)); watchesPane.setHgap(5); watchesPane.setVgap(5); @@ -471,18 +471,10 @@ public class MetacheatUI { cheatEngine.initMemoryView(); int pixelsPerBlock = 16 * MEMORY_BOX_TOTAL_SIZE; - memoryViewColumns = (int) (memoryViewPane.getWidth() / pixelsPerBlock * 16); + memoryViewColumns = (int) (memoryViewPane.getWidth() / pixelsPerBlock) * 16; memoryViewRows = ((cheatEngine.getEndAddress() - cheatEngine.getStartAddress()) / memoryViewColumns) + 1; double canvasHeight = memoryViewRows * MEMORY_BOX_TOTAL_SIZE * drawScale; - // Guard against asking for a big texture because bad things will happen! - while (canvasHeight >= 16384) { - memoryViewColumns += 16; - memoryViewRows = ((cheatEngine.getEndAddress() - cheatEngine.getStartAddress()) / memoryViewColumns) + 1; - canvasHeight = memoryViewRows * MEMORY_BOX_TOTAL_SIZE * drawScale; - } - double canvasWidth = memoryViewColumns * MEMORY_BOX_TOTAL_SIZE * drawScale; - memoryViewContents.setPrefHeight(canvasHeight); memoryViewCanvas.setHeight(canvasHeight); GraphicsContext context = memoryViewCanvas.getGraphicsContext2D(); @@ -503,7 +495,7 @@ public class MetacheatUI { redrawNodes.add(newCell); }); - setZoom((1/drawScale) - 0.1); + setZoom(1/drawScale); if (resume) { Emulator.computer.resume(); diff --git a/src/main/resources/fxml/Metacheat.fxml b/src/main/resources/fxml/Metacheat.fxml index abedf99..bbbbf0b 100644 --- a/src/main/resources/fxml/Metacheat.fxml +++ b/src/main/resources/fxml/Metacheat.fxml @@ -1,13 +1,17 @@ + + + - - - + + + + @@ -215,12 +219,12 @@ - + - + diff --git a/src/main/resources/styles/style.css b/src/main/resources/styles/style.css index 7530b45..884c262 100644 --- a/src/main/resources/styles/style.css +++ b/src/main/resources/styles/style.css @@ -14,3 +14,8 @@ -fx-graphic: "/jace/data/icon_keyboard.gif"; -fx-graphic-text-gap: 2; } + +.codeInspector .list-cell { + -fx-font-size: 9pt; + -fx-font-family: "Courier New"; +}