public void fireShowJoystickError(final String msg) { final Component owner = this.joyFrm; if ((owner != null) && (msg != null)) { EventQueue.invokeLater( new Runnable() { @Override public void run() { BasicDlg.showErrorDlg(owner, msg); } }); } }
private void updJoystickFrm(final int joyNum) { final JoystickFrm joyFrm = this.joyFrm; if ((joyFrm != null) && (joyNum >= 0) && (joyNum < this.joyThreads.length)) { int nJoys = 0; EmuSys emuSys = this.emuSys; if (emuSys != null) { nJoys = emuSys.getSupportedJoystickCount(); } final boolean emulated = (joyNum < nJoys); final boolean connected = (this.joyThreads[joyNum] != null); EventQueue.invokeLater( new Runnable() { @Override public void run() { joyFrm.setJoystickState(joyNum, emulated, connected); } }); } }
@Override public void run() { this.emuRunning = true; while (this.emuRunning) { try { /* * Pruefen, ob ein Programm geladen oder der Emulator * tatsaechlich zurueckgesetzt werden soll */ LoadData loadData = null; synchronized (this.monitor) { loadData = this.loadData; if (loadData != null) { this.loadData = null; } else { if (this.resetLevel == ResetLevel.POWER_ON) { Arrays.fill(this.ram, (byte) 0); } } } if (loadData != null) { loadData.loadIntoMemory(this); this.z80cpu.setRegPC(loadData.getStartAddr()); if (this.emuSys != null) { int spInitValue = this.emuSys.getAppStartStackInitValue(); if (spInitValue > 0) { this.z80cpu.setRegSP(spInitValue); } } } else { if ((this.resetLevel == ResetLevel.COLD_RESET) || (this.resetLevel == ResetLevel.POWER_ON)) { this.z80cpu.resetCPU(true); } else { this.z80cpu.resetCPU(false); } if (this.emuSys != null) { this.emuSys.reset(this.resetLevel, Main.getProperties()); this.z80cpu.setRegPC(this.emuSys.getResetStartAddress(this.resetLevel)); } } // RAM-Floppies und Druckmanager zuruecksetzen this.printMngr.reset(); this.ramFloppy1.reset(); this.ramFloppy2.reset(); if ((this.emuSys != null) && (this.resetLevel == ResetLevel.POWER_ON) && Main.getBooleanProperty("jkcemu.ramfloppy.clear_on_power_on", false)) { if (this.emuSys.supportsRAMFloppy1() && (this.ramFloppy1.getUsedSize() > 0)) { this.ramFloppy1.clear(); } if (this.emuSys.supportsRAMFloppy2() && (this.ramFloppy2.getUsedSize() > 0)) { this.ramFloppy2.clear(); } } // Fenster informieren final Frame[] frms = Frame.getFrames(); if (frms != null) { EventQueue.invokeLater( new Runnable() { @Override public void run() { for (Frame f : frms) { if (f instanceof BasicFrm) { ((BasicFrm) f).resetFired(); } } } }); } // in die Z80-Emulation verzweigen this.resetLevel = ResetLevel.NO_RESET; this.z80cpu.run(); } catch (Z80ExternalException ex) { } catch (Exception ex) { this.emuRunning = false; EventQueue.invokeLater(new ErrorMsg(this.screenFrm, ex)); } } }