(MouseEvent e)
| 390 | Tooltip memoryWatchTooltip = new Tooltip(); |
| 391 | |
| 392 | private void memoryViewClicked(MouseEvent e) { |
| 393 | if (cheatEngine != null) { |
| 394 | Watch currentWatch = (Watch) memoryWatchTooltip.getGraphic(); |
| 395 | if (currentWatch != null) { |
| 396 | currentWatch.disconnect(); |
| 397 | } |
| 398 | |
| 399 | double x = e.getX() / drawScale; |
| 400 | double y = e.getY() / drawScale; |
| 401 | int col = (int) (x / MEMORY_BOX_TOTAL_SIZE); |
| 402 | int row = (int) (y / MEMORY_BOX_TOTAL_SIZE); |
| 403 | int addr = cheatEngine.getStartAddress() + row * memoryViewColumns + col; |
| 404 | Watch watch = new Watch(addr, this); |
| 405 | |
| 406 | Label addWatch = new Label("Watch >>"); |
| 407 | addWatch.setOnMouseClicked((mouseEvent) -> { |
| 408 | Watch newWatch = addWatch(addr); |
| 409 | if (watch.holdingProperty().get()) { |
| 410 | newWatch.holdingProperty().set(true); |
| 411 | } |
| 412 | memoryWatchTooltip.hide(); |
| 413 | }); |
| 414 | watch.getChildren().add(addWatch); |
| 415 | |
| 416 | Label addCheat = new Label("Cheat >>"); |
| 417 | addCheat.setOnMouseClicked((mouseEvent) -> { |
| 418 | Platform.runLater(() -> addCheat("Memory View " + Integer.toHexString(addr), addr, watch.getValue())); |
| 419 | }); |
| 420 | watch.getChildren().add(addCheat); |
| 421 | |
| 422 | memoryWatchTooltip.setStyle("-fx-background-color:NAVY"); |
| 423 | memoryWatchTooltip.onHidingProperty().addListener((prop, oldVal, newVal) -> { |
| 424 | watch.disconnect(); |
| 425 | memoryWatchTooltip.setGraphic(null); |
| 426 | }); |
| 427 | memoryWatchTooltip.setGraphic(watch); |
| 428 | memoryWatchTooltip.show(memoryViewContents, e.getScreenX() + 5, e.getScreenY() - 15); |
| 429 | } |
| 430 | } |
| 431 | |
| 432 | private void processMemoryViewUpdates() { |
| 433 | boolean isRunning = Emulator.withComputer(c->c.getMotherboard().isRunning(), false); |
nothing calls this directly
no test coverage detected