Пример #1
0
 public static void addIndicator(Object owner, Label icon, long TTL) {
   if (JaceApplication.getApplication() == null) {
     return;
   }
   synchronized (INDICATORS) {
     Set<Label> ind = INDICATORS.get(owner);
     if (ind == null) {
       ind = new HashSet<>();
       INDICATORS.put(owner, ind);
     }
     ind.add(icon);
     JaceApplication.getApplication().controller.addIndicator(icon);
   }
 }
Пример #2
0
 @InvokableAction(
     name = "Save Screenshot",
     category = "general",
     description = "Save image of visible screen",
     alternatives = "Save image,save framebuffer,screenshot",
     defaultKeyMapping = "ctrl+shift+s")
 public static void saveScreenshot() throws IOException {
   FileChooser select = new FileChooser();
   Emulator.computer.pause();
   Image i = Emulator.computer.getVideo().getFrameBuffer();
   //        BufferedImage bufImageARGB = SwingFXUtils.fromFXImage(i, null);
   File targetFile = select.showSaveDialog(JaceApplication.getApplication().primaryStage);
   if (targetFile == null) {
     return;
   }
   String filename = targetFile.getName();
   System.out.println("Writing screenshot to " + filename);
   String extension = filename.substring(filename.lastIndexOf(".") + 1);
   //        BufferedImage bufImageRGB = new BufferedImage(bufImageARGB.getWidth(),
   // bufImageARGB.getHeight(), BufferedImage.OPAQUE);
   //
   //        Graphics2D graphics = bufImageRGB.createGraphics();
   //        graphics.drawImage(bufImageARGB, 0, 0, null);
   //
   //        ImageIO.write(bufImageRGB, extension, targetFile);
   //        graphics.dispose();
 }
Пример #3
0
 @InvokableAction(
     name = "Resize window",
     category = "general",
     description = "Resize the screen to 1x/1.5x/2x/3x video size",
     alternatives =
         "Adjust screen;Adjust window size;Adjust aspect ratio;Fix screen;Fix window size;Fix aspect ratio;Correct aspect ratio;",
     defaultKeyMapping = {"ctrl+shift+a"})
 public static void scaleIntegerRatio() {
   Platform.runLater(
       () -> {
         JaceApplication.getApplication().primaryStage.setFullScreen(false);
         size++;
         if (size > 3) {
           size = 0;
         }
         int width = 0, height = 0;
         switch (size) {
           case 0: // 1x
             width = 560;
             height = 384;
             break;
           case 1: // 1.5x
             width = 840;
             height = 576;
             break;
           case 2: // 2x
             width = 560 * 2;
             height = 384 * 2;
             break;
           case 3: // 3x (retina) 2880x1800
             width = 560 * 3;
             height = 384 * 3;
             break;
           default: // 2x
             width = 560 * 2;
             height = 384 * 2;
         }
         Stage stage = JaceApplication.getApplication().primaryStage;
         double vgap = stage.getScene().getY();
         double hgap = stage.getScene().getX();
         stage.setWidth(hgap * 2 + width);
         stage.setHeight(vgap + height);
       });
 }
Пример #4
0
 @InvokableAction(
     name = "Toggle fullscreen",
     category = "general",
     description = "Activate/deactivate fullscreen mode",
     alternatives = "fullscreen,maximize",
     defaultKeyMapping = "ctrl+shift+f")
 public static void toggleFullscreen() {
   Platform.runLater(
       () -> {
         Stage stage = JaceApplication.getApplication().primaryStage;
         stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH);
         stage.setFullScreen(!stage.isFullScreen());
       });
 }
Пример #5
0
 //    public static void updateWatchList(final DebuggerPanel panel) {
 //        java.awt.EventQueue.invokeLater(() -> {
 //            watches.stream().forEach((oldWatch) -> {
 //                Emulator.computer.getMemory().removeListener(oldWatch);
 //            });
 //            if (panel == null) {
 //                return;
 //            }
 //            addWatch(panel.textW1, panel.valueW1);
 //            addWatch(panel.textW2, panel.valueW2);
 //            addWatch(panel.textW3, panel.valueW3);
 //            addWatch(panel.textW4, panel.valueW4);
 //        });
 //    }
 //
 //    private static void addWatch(JTextField watch, final JLabel watchValue) {
 //        final Integer address = getValidAddress(watch.getText());
 //        if (address != null) {
 //            //System.out.println("Adding watch for "+Integer.toString(address, 16));
 //            RAMListener newListener = new RAMListener(RAMEvent.TYPE.WRITE,
 // RAMEvent.SCOPE.ADDRESS, RAMEvent.VALUE.ANY) {
 //                @Override
 //                protected void doConfig() {
 //                    setScopeStart(address);
 //                }
 //
 //                @Override
 //                protected void doEvent(RAMEvent e) {
 //                    watchValue.setText(Integer.toHexString(e.getNewValue() & 0x0FF));
 //                }
 //            };
 //            Emulator.computer.getMemory().addListener(newListener);
 //            watches.add(newListener);
 //            // Print out the current value right away
 //            byte b = Emulator.computer.getMemory().readRaw(address);
 //            watchValue.setText(Integer.toString(b & 0x0ff, 16));
 //        } else {
 //            watchValue.setText("00");
 //        }
 //    }
 //    public static void updateBreakpointList(final DebuggerPanel panel) {
 //        java.awt.EventQueue.invokeLater(() -> {
 //            Integer address;
 //            debugger.getBreakpoints().clear();
 //            if (panel == null) {
 //                return;
 //            }
 //            address = getValidAddress(panel.textBP1.getText());
 //            if (address != null) {
 //                debugger.getBreakpoints().add(address);
 //            }
 //            address = getValidAddress(panel.textBP2.getText());
 //            if (address != null) {
 //                debugger.getBreakpoints().add(address);
 //            }
 //            address = getValidAddress(panel.textBP3.getText());
 //            if (address != null) {
 //                debugger.getBreakpoints().add(address);
 //            }
 //            address = getValidAddress(panel.textBP4.getText());
 //            if (address != null) {
 //                debugger.getBreakpoints().add(address);
 //            }
 //            debugger.updateBreakpoints();
 //        });
 //    }
 //
 @InvokableAction(
     name = "BRUN file",
     category = "file",
     description =
         "Loads a binary file in memory and executes it. File should end with #06xxxx, where xxxx is the start address in hex",
     alternatives = "Execute program;Load binary;Load program;Load rom;Play single-load game",
     defaultKeyMapping = "ctrl+shift+b")
 public static void runFile() {
   Emulator.computer.pause();
   FileChooser select = new FileChooser();
   File binary = select.showOpenDialog(JaceApplication.getApplication().primaryStage);
   if (binary == null) {
     Emulator.computer.resume();
     return;
   }
   runFileNamed(binary);
 }