diff --git a/src/main/java/jace/cheat/MetaCheat.java b/src/main/java/jace/cheat/MetaCheat.java index 0e76cd4..9cb5faf 100644 --- a/src/main/java/jace/cheat/MetaCheat.java +++ b/src/main/java/jace/cheat/MetaCheat.java @@ -49,6 +49,10 @@ public class MetaCheat extends Cheats { public String toString() { return Integer.toHexString(address) + ": " + lastObservedValue + " (" + Integer.toHexString(lastObservedValue) + ")"; } + + public int getAddress() { + return address; + } } MetacheatUI ui; diff --git a/src/main/java/jace/ui/MetacheatUI.java b/src/main/java/jace/ui/MetacheatUI.java index 87fd646..446fe3f 100644 --- a/src/main/java/jace/ui/MetacheatUI.java +++ b/src/main/java/jace/ui/MetacheatUI.java @@ -6,6 +6,7 @@ import jace.cheat.DynamicCheat; import jace.cheat.MemoryCell; import jace.cheat.MetaCheat; import jace.cheat.MetaCheat.SearchChangeType; +import jace.cheat.MetaCheat.SearchResult; import jace.cheat.MetaCheat.SearchType; import jace.core.RAMListener; import jace.state.State; @@ -125,21 +126,11 @@ public class MetacheatUI { @FXML private TableView cheatsTableView; - @FXML - void addCheat(ActionEvent event) { - cheatEngine.addCheat(new DynamicCheat(0, "?")); - } - @FXML void createSnapshot(ActionEvent event) { } - @FXML - void deleteCheat(ActionEvent event) { - cheatsTableView.getSelectionModel().getSelectedItems().forEach(cheatEngine::removeCheat); - } - @FXML void deleteSnapshot(ActionEvent event) { @@ -150,11 +141,26 @@ public class MetacheatUI { } + @FXML + void addCheat(ActionEvent event) { + cheatEngine.addCheat(new DynamicCheat(0, "?")); + } + + @FXML + void deleteCheat(ActionEvent event) { + cheatsTableView.getSelectionModel().getSelectedItems().forEach(cheatEngine::removeCheat); + } + @FXML void loadCheats(ActionEvent event) { } + @FXML + void saveCheats(ActionEvent event) { + + } + @FXML void newSearch(ActionEvent event) { Platform.runLater(() -> { @@ -174,11 +180,6 @@ public class MetacheatUI { }); } - @FXML - void saveCheats(ActionEvent event) { - - } - @FXML void search(ActionEvent event) { Platform.runLater(() -> { @@ -252,6 +253,13 @@ public class MetacheatUI { } }); + searchResultsListView.setEditable(true); + searchResultsListView.setOnEditStart((editEvent) -> { + editEvent.consume(); + SearchResult result = cheatEngine.getSearchResults().get(editEvent.getIndex()); + addWatch(result.getAddress()); + }); + memoryViewCanvas.setMouseTransparent(false); memoryViewCanvas.addEventFilter(MouseEvent.MOUSE_CLICKED, this::memoryViewClicked); showValuesCheckbox.selectedProperty().addListener((prop, oldVal, newVal) -> { @@ -268,8 +276,6 @@ public class MetacheatUI { searchStartAddressField.textProperty().addListener(addressRangeListener); searchEndAddressField.textProperty().addListener(addressRangeListener); - RAMListener l; - TableColumn activeColumn = (TableColumn) cheatsTableView.getColumns().get(0); activeColumn.setCellValueFactory(new PropertyValueFactory<>("active")); activeColumn.setCellFactory((TableColumn param) -> new CheckBoxTableCell<>()); @@ -326,8 +332,6 @@ public class MetacheatUI { public static Set redrawNodes = new ConcurrentSkipListSet<>(); ScheduledExecutorService animationTimer = null; ScheduledFuture animationFuture = null; - StackPane pane = new StackPane(); - Tooltip memoryWatchTooltip = new Tooltip(); private void memoryViewClicked(MouseEvent e) { @@ -356,7 +360,7 @@ public class MetacheatUI { Label addCheat = new Label("Cheat >>"); addCheat.setOnMouseClicked((mouseEvent) -> { - addCheat(addr, watch.getValue()); + Platform.runLater(() -> addCheat(addr, watch.getValue())); }); watch.getChildren().add(addCheat); @@ -406,7 +410,7 @@ public class MetacheatUI { animationFuture.cancel(false); } - animationFuture = animationTimer.scheduleAtFixedRate(this::processMemoryViewUpdates, FRAME_RATE, 1000 / 60, TimeUnit.MILLISECONDS); + animationFuture = animationTimer.scheduleAtFixedRate(this::processMemoryViewUpdates, FRAME_RATE, FRAME_RATE, TimeUnit.MILLISECONDS); cheatEngine.initMemoryView(); int pixelsPerBlock = 16 * MEMORY_BOX_TOTAL_SIZE; @@ -492,5 +496,4 @@ public class MetacheatUI { private void addCheat(int addr, int val) { cheatEngine.addCheat(new DynamicCheat(addr, String.valueOf(val))); } - } diff --git a/src/main/resources/fxml/Metacheat.fxml b/src/main/resources/fxml/Metacheat.fxml index d524b53..6993f83 100644 --- a/src/main/resources/fxml/Metacheat.fxml +++ b/src/main/resources/fxml/Metacheat.fxml @@ -7,7 +7,7 @@ - + @@ -31,190 +31,191 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - - + - - - - - - - + + + + + + - - - - + + + + + + + - + - - - - + - + - + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -