2 // mainwin.cpp - Qt-based GUI for Virtual Jaguar: Main Application Window
4 // (C) 2009 Underground Software
6 // JLH = James Hammons <jlhamm@acm.org>
7 // JPM = Jean-Paul Mari <djipi.mari@gmail.com>
10 // --- ---------- ------------------------------------------------------------
11 // JLH 12/23/2009 Created this file
12 // JLH 12/20/2010 Added settings, menus & toolbars
13 // JLH 07/05/2011 Added CD BIOS functionality to GUI
14 // JPM 06/06/2016 Visual Studio support
15 // JPM 06/19/2016 Soft debugger integration
16 // JPM 01/11/2017 Added stack browser
17 // JPM 01/02/2017 Added GPU disassembly
18 // JPM 02/02/2017 Added DSP disassembly
19 // JPM 07/12/2017 Added all Watch window
20 // JPM 08/01/2017 Added heap allocator window
21 // JPM 08/07/2017 Added memories window
22 // JPM 08/10/2017 Added a restart feature
23 // JPM 08/31/2017 Added breakpoints window [Not Supported]
24 // JPM 09/01/2017 Save position & visibility windows status in the settings
25 // JPM 09/02/2017 Save size windows in the settings
26 // JPM 09/05/2017 Added Exception Vector Table window
27 // JPM 09/06/2017 Added the 'Rx' word to the emulator window name
28 // JPM 09/12/2017 Added the keybindings in the settings
29 // JPM 11/04/2017 Added the local window
30 // JPM 08/31/2018 Added the call stack window
31 // JPM 09/04/2018 Added the new Models and BIOS handler
32 // JPM 09/17/2018 Added a screenshot feature
37 // - Add dbl click/enter to select in cart list, ESC to dimiss [DONE]
38 // - Autoscan/autoload all available BIOS from 'software' folder [DONE]
39 // - Add 1 key jumping in cartridge list (press 'R', jumps to carts starting
40 // with 'R', etc) [DONE]
41 // - Controller configuration [DONE]
45 // - Fix bug in switching between PAL & NTSC in fullscreen mode.
46 // - Remove SDL dependencies (sound, mainly) from Jaguar core lib
47 // - Fix inconsistency with trailing slashes in paths (eeproms needs one,
50 // SFDX CODE: S1E9T8H5M23YS
52 // Uncomment this for debugging...
54 //#define DEBUGFOO // Various tool debugging... but not used
55 //#define DEBUGTP // Toolpalette debugging... but not used
62 #include "configdialog.h"
63 #include "controllertab.h"
64 #include "keybindingstab.h"
65 #include "filepicker.h"
67 #include "generaltab.h"
73 #include "emustatus.h"
74 #include "debug/cpubrowser.h"
75 #include "debug/m68kdasmbrowser.h"
76 #include "debug/memorybrowser.h"
77 #include "debug/stackbrowser.h"
78 #include "debug/opbrowser.h"
79 #include "debug/riscdasmbrowser.h"
85 #ifndef NEWMODELSBIOSHANDLER
88 #include "jagstub2bios.h"
90 #include "modelsBIOS.h"
92 #include "jagcdbios.h"
94 #include "m68000/m68kinterface.h"
96 //#include "debugger/VideoWin.h"
97 #include "debugger/DasmWin.h"
98 #include "debugger/m68KDasmWin.h"
99 #include "debugger/GPUDasmWin.h"
100 #include "debugger/DSPDasmWin.h"
101 #include "debugger/memory1browser.h"
102 #include "debugger/brkWin.h"
103 #include "debugger/exceptionvectortablebrowser.h"
104 #include "debugger/allwatchbrowser.h"
105 #include "debugger/localbrowser.h"
106 #include "debugger/heapallocatorbrowser.h"
107 #include "debugger/callstackbrowser.h"
110 // According to SebRmv, this header isn't seen on Arch Linux either... :-/
111 //#ifdef __GCCWIN32__
112 // Apparently on win32, usleep() is not pulled in by the usual suspects.
116 #include "_MSC_VER/unistd.h"
120 // The way BSNES controls things is by setting a timer with a zero
121 // timeout, sleeping if not emulating anything. Seems there has to be a
124 // It has a novel approach to plugging-in/using different video/audio/input
125 // methods, can we do something similar or should we just use the built-in
128 // We're going to try to use the built-in OpenGL support and see how it goes.
129 // We'll make the VJ core modular so that it doesn't matter what GUI is in
130 // use, we can drop it in anywhere and use it as-is.
132 MainWin::MainWin(bool autoRun
): running(true), powerButtonOn(false),
133 showUntunedTankCircuit(true), cartridgeLoaded(false), CDActive(false),
134 pauseForFileSelector(false), loadAndGo(autoRun
), scannedSoftwareFolder(false), plzDontKillMyComputer(false)
140 for(int i
=0; i
<8; i
++)
144 for(int i
=0; i
<RING_BUFFER_SIZE
; i
++)
147 ringBufferPointer
= RING_BUFFER_SIZE
- 1;
150 //if (vjs.softTypeDebugger)
152 // mainWindowCentrale = new QMdiArea;
153 // setCentralWidget(mainWindowCentrale);
156 WriteLog("Window creation start\n");
159 videoWidget
= new GLWidget(this);
160 videoWidget
->setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
162 // set central output window
163 if (!vjs
.softTypeDebugger
)
165 setCentralWidget(videoWidget
);
169 mainWindowCentrale
= new QMdiArea(this);
170 setCentralWidget(mainWindowCentrale
);
173 setWindowIcon(QIcon(":/res/vj-icon.png"));
175 QString title
= QString(tr("Virtual Jaguar " VJ_RELEASE_VERSION
" Rx"));
177 if (vjs
.hardwareTypeAlpine
)
178 title
+= QString(tr(" - Alpine Mode"));
180 if (vjs
.softTypeDebugger
)
181 title
+= QString(tr(" - Debugger Mode"));
183 setWindowTitle(title
);
185 aboutWin
= new AboutWindow(this);
186 helpWin
= new HelpWindow(this);
187 filePickWin
= new FilePickerWindow(this);
188 memBrowseWin
= new MemoryBrowserWindow(this);
189 stackBrowseWin
= new StackBrowserWindow(this);
190 emuStatusWin
= new EmuStatusWindow(this);
191 cpuBrowseWin
= new CPUBrowserWindow(this);
192 opBrowseWin
= new OPBrowserWindow(this);
193 m68kDasmBrowseWin
= new M68KDasmBrowserWindow(this);
194 riscDasmBrowseWin
= new RISCDasmBrowserWindow(this);
195 if (vjs
.softTypeDebugger
)
197 //VideoOutputWin = new VideoOutputWindow(this);
198 //VideoOutputWin->setCentralWidget()
199 //DasmWin = new DasmWindow();
200 DasmWin
= new DasmWindow(this);
201 allWatchBrowseWin
= new AllWatchBrowserWindow(this);
202 LocalBrowseWin
= new LocalBrowserWindow(this);
203 heapallocatorBrowseWin
= new HeapAllocatorBrowserWindow(this);
204 brkWin
= new BrkWindow(this);
205 exceptionvectortableBrowseWin
= new ExceptionVectorTableBrowserWindow(this);
206 CallStackBrowseWin
= new CallStackBrowserWindow(this);
208 mem1BrowseWin
= (Memory1BrowserWindow
**)calloc(vjs
.nbrmemory1browserwindow
, sizeof(Memory1BrowserWindow
));
210 #pragma message("Warning: !!! Need to do the memory desalocation for mem1BrowseWin !!!")
212 #warning "!!! Need to do the memory desalocation for mem1BrowseWin !!!"
214 for (size_t i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
216 mem1BrowseWin
[i
] = new Memory1BrowserWindow(this);
219 dasmtabWidget
= new QTabWidget(this);
220 dasmtabWidget
->setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
221 dasmtabWidget
->addTab(m68kDasmWin
= new m68KDasmWindow(this), tr("M68000"));
222 dasmtabWidget
->addTab(GPUDasmWin
= new GPUDasmWindow(this), tr("GPU"));
223 dasmtabWidget
->addTab(DSPDasmWin
= new DSPDasmWindow(this), tr("DSP"));
224 ////dasmtabWidget->addTab(m68kDasmBrowseWin, tr("M68000"));
225 setCentralWidget(dasmtabWidget
);
228 QDockWidget
*shapesDockWidget
= new QDockWidget(tr("Shapes"));
229 shapesDockWidget
->setObjectName("shapesDockWidget");
230 shapesDockWidget
->setWidget(m68kDasmWin
);
231 //shapesDockWidget->setWidget(treeWidget);
232 shapesDockWidget
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
233 addDockWidget(Qt::LeftDockWidgetArea
, shapesDockWidget
);
237 // videoWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
238 setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
240 setUnifiedTitleAndToolBarOnMac(true);
244 quitAppAct
= new QAction(QIcon(":/res/exit.png"), tr("E&xit"), this);
245 // quitAppAct->setShortcuts(QKeySequence::Quit);
246 // quitAppAct->setShortcut(QKeySequence(tr("Alt+x")));
247 //quitAppAct->setShortcut(QKeySequence(tr("Ctrl+q")));
248 quitAppAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBQUIT
].KBSettingValue
)));
249 quitAppAct
->setShortcutContext(Qt::ApplicationShortcut
);
250 quitAppAct
->setStatusTip(tr("Quit Virtual Jaguar"));
251 connect(quitAppAct
, SIGNAL(triggered()), this, SLOT(close()));
253 powerGreen
.addFile(":/res/power-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
254 powerGreen
.addFile(":/res/power-on-green.png", QSize(), QIcon::Normal
, QIcon::On
);
255 powerRed
.addFile(":/res/power-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
256 powerRed
.addFile(":/res/power-on-red.png", QSize(), QIcon::Normal
, QIcon::On
);
258 powerAct
= new QAction(powerGreen
, tr("&Power"), this);
259 powerAct
->setStatusTip(tr("Powers Jaguar on/off"));
260 powerAct
->setCheckable(true);
261 powerAct
->setChecked(false);
262 connect(powerAct
, SIGNAL(triggered()), this, SLOT(TogglePowerState()));
266 pauseIcon
.addFile(":/res/pause-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
267 pauseIcon
.addFile(":/res/pause-on.png", QSize(), QIcon::Normal
, QIcon::On
);
268 pauseAct
= new QAction(pauseIcon
, tr("Pause"), this);
269 pauseAct
->setStatusTip(tr("Toggles the running state"));
270 pauseAct
->setCheckable(true);
271 pauseAct
->setDisabled(true);
272 //pauseAct->setShortcut(QKeySequence(tr("Esc")));
273 pauseAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBPAUSE
].KBSettingValue
)));
274 pauseAct
->setShortcutContext(Qt::ApplicationShortcut
);
275 connect(pauseAct
, SIGNAL(triggered()), this, SLOT(ToggleRunState()));
277 // Screenshot feature
278 screenshotAct
= new QAction(QIcon(":/res/screenshot.png"), tr("&Screenshot"), this);
279 screenshotAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBSCREENSHOT
].KBSettingValue
)));
280 screenshotAct
->setShortcutContext(Qt::ApplicationShortcut
);
281 screenshotAct
->setCheckable(false);
282 screenshotAct
->setDisabled(false);
283 connect(screenshotAct
, SIGNAL(triggered()), this, SLOT(MakeScreenshot()));
285 zoomActs
= new QActionGroup(this);
287 x1Act
= new QAction(QIcon(":/res/zoom100.png"), tr("Zoom 100%"), zoomActs
);
288 x1Act
->setStatusTip(tr("Set window zoom to 100%"));
289 x1Act
->setCheckable(true);
290 connect(x1Act
, SIGNAL(triggered()), this, SLOT(SetZoom100()));
292 x2Act
= new QAction(QIcon(":/res/zoom200.png"), tr("Zoom 200%"), zoomActs
);
293 x2Act
->setStatusTip(tr("Set window zoom to 200%"));
294 x2Act
->setCheckable(true);
295 connect(x2Act
, SIGNAL(triggered()), this, SLOT(SetZoom200()));
297 x3Act
= new QAction(QIcon(":/res/zoom300.png"), tr("Zoom 300%"), zoomActs
);
298 x3Act
->setStatusTip(tr("Set window zoom to 300%"));
299 x3Act
->setCheckable(true);
300 connect(x3Act
, SIGNAL(triggered()), this, SLOT(SetZoom300()));
302 tvTypeActs
= new QActionGroup(this);
304 ntscAct
= new QAction(QIcon(":/res/ntsc.png"), tr("NTSC"), tvTypeActs
);
305 ntscAct
->setStatusTip(tr("Sets Jaguar to NTSC mode"));
306 ntscAct
->setCheckable(true);
307 connect(ntscAct
, SIGNAL(triggered()), this, SLOT(SetNTSC()));
309 palAct
= new QAction(QIcon(":/res/pal.png"), tr("PAL"), tvTypeActs
);
310 palAct
->setStatusTip(tr("Sets Jaguar to PAL mode"));
311 palAct
->setCheckable(true);
312 connect(palAct
, SIGNAL(triggered()), this, SLOT(SetPAL()));
314 blur
.addFile(":/res/blur-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
315 blur
.addFile(":/res/blur-on.png", QSize(), QIcon::Normal
, QIcon::On
);
317 blurAct
= new QAction(blur
, tr("Blur"), this);
318 blurAct
->setStatusTip(tr("Sets OpenGL rendering to GL_NEAREST"));
319 blurAct
->setCheckable(true);
320 connect(blurAct
, SIGNAL(triggered()), this, SLOT(ToggleBlur()));
322 aboutAct
= new QAction(QIcon(":/res/vj-icon.png"), tr("&About..."), this);
323 aboutAct
->setStatusTip(tr("Blatant self-promotion"));
324 connect(aboutAct
, SIGNAL(triggered()), this, SLOT(ShowAboutWin()));
326 helpAct
= new QAction(QIcon(":/res/vj-icon.png"), tr("&Contents..."), this);
327 helpAct
->setStatusTip(tr("Help is available, if you should need it"));
328 connect(helpAct
, SIGNAL(triggered()), this, SLOT(ShowHelpWin()));
330 if (!vjs
.softTypeDebugger
)
332 filePickAct
= new QAction(QIcon(":/res/software.png"), tr("&Insert Cartridge..."), this);
333 filePickAct
->setStatusTip(tr("Insert a cartridge into Virtual Jaguar"));
337 filePickAct
= new QAction(QIcon(":/res/software.png"), tr("&Insert executable file..."), this);
338 filePickAct
->setStatusTip(tr("Insert an executable into Virtual Jaguar"));
340 //filePickAct->setShortcut(QKeySequence(tr("Ctrl+i")));
341 filePickAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBPICKFILE
].KBSettingValue
)));
342 filePickAct
->setShortcutContext(Qt::ApplicationShortcut
);
343 connect(filePickAct
, SIGNAL(triggered()), this, SLOT(InsertCart()));
345 configAct
= new QAction(QIcon(":/res/wrench.png"), tr("&Configure"), this);
346 configAct
->setStatusTip(tr("Configure options for Virtual Jaguar"));
347 //configAct->setShortcut(QKeySequence(tr("Ctrl+c")));
348 configAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBCONFIGURE
].KBSettingValue
)));
349 configAct
->setShortcutContext(Qt::ApplicationShortcut
);
350 connect(configAct
, SIGNAL(triggered()), this, SLOT(Configure()));
352 emustatusAct
= new QAction(QIcon(":/res/status.png"), tr("&Status"), this);
353 emustatusAct
->setStatusTip(tr("Emulator status"));
354 //emustatusAct->setShortcut(QKeySequence(tr("Ctrl+s")));
355 emustatusAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBEMUSTATUS
].KBSettingValue
)));
356 emustatusAct
->setShortcutContext(Qt::ApplicationShortcut
);
357 connect(emustatusAct
, SIGNAL(triggered()), this, SLOT(ShowEmuStatusWin()));
359 useCDAct
= new QAction(QIcon(":/res/compact-disc.png"), tr("&Use CD Unit"), this);
360 useCDAct
->setStatusTip(tr("Use Jaguar Virtual CD unit"));
361 // useCDAct->setShortcut(QKeySequence(tr("Ctrl+c")));
362 useCDAct
->setCheckable(true);
363 connect(useCDAct
, SIGNAL(triggered()), this, SLOT(ToggleCDUsage()));
365 frameAdvanceAct
= new QAction(QIcon(":/res/frame-advance.png"), tr("&Frame Advance"), this);
366 //frameAdvanceAct->setShortcut(QKeySequence(tr("F7")));
367 frameAdvanceAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBFRAMEADVANCE
].KBSettingValue
)));
368 frameAdvanceAct
->setShortcutContext(Qt::ApplicationShortcut
);
369 frameAdvanceAct
->setDisabled(true);
370 connect(frameAdvanceAct
, SIGNAL(triggered()), this, SLOT(FrameAdvance()));
372 if (vjs
.softTypeDebugger
)
374 restartAct
= new QAction(QIcon(":/res/debug-restart.png"), tr("&Restart"), this);
375 //restartAct->setShortcut(QKeySequence(tr("Ctrl+Shift+F5")));
376 restartAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBRESTART
].KBSettingValue
)));
377 restartAct
->setShortcutContext(Qt::ApplicationShortcut
);
378 restartAct
->setCheckable(false);
379 restartAct
->setDisabled(true);
380 connect(restartAct
, SIGNAL(triggered()), this, SLOT(DebuggerRestart()));
382 traceStepOverAct
= new QAction(QIcon(":/res/debug-stepover.png"), tr("&Step Over"), this);
383 //traceStepOverAct->setShortcut(QKeySequence(tr("F10")));
384 traceStepOverAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBSTEPOVER
].KBSettingValue
)));
385 traceStepOverAct
->setShortcutContext(Qt::ApplicationShortcut
);
386 traceStepOverAct
->setCheckable(false);
387 traceStepOverAct
->setDisabled(true);
388 connect(traceStepOverAct
, SIGNAL(triggered()), this, SLOT(DebuggerTraceStepOver()));
390 traceStepIntoAct
= new QAction(QIcon(":/res/debug-stepinto.png"), tr("&Step Into"), this);
391 //traceStepIntoAct->setShortcut(QKeySequence(tr("F11")));
392 traceStepIntoAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBSTEPINTO
].KBSettingValue
)));
393 traceStepIntoAct
->setShortcutContext(Qt::ApplicationShortcut
);
394 traceStepIntoAct
->setCheckable(false);
395 traceStepIntoAct
->setDisabled(true);
396 connect(traceStepIntoAct
, SIGNAL(triggered()), this, SLOT(DebuggerTraceStepInto()));
398 newBreakpointFunctionAct
= new QAction(QIcon(""), tr("&Function Breakpoint"), this);
399 newBreakpointFunctionAct
->setShortcut(QKeySequence(tr("Ctrl+B")));
400 connect(newBreakpointFunctionAct
, SIGNAL(triggered()), this, SLOT(NewBreakpointFunction()));
403 fullScreenAct
= new QAction(QIcon(":/res/fullscreen.png"), tr("F&ull Screen"), this);
404 //fullScreenAct->setShortcut(QKeySequence(tr("F9")));
405 fullScreenAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBFULLSCREEN
].KBSettingValue
)));
406 fullScreenAct
->setShortcutContext(Qt::ApplicationShortcut
);
407 fullScreenAct
->setCheckable(true);
408 connect(fullScreenAct
, SIGNAL(triggered()), this, SLOT(ToggleFullScreen()));
411 if (vjs
.softTypeDebugger
)
413 exceptionVectorTableBrowseAct
= new QAction(QIcon(""), tr("Exception Vector Table"), this);
414 exceptionVectorTableBrowseAct
->setStatusTip(tr("Shows all Exception Vector Table browser window"));
415 connect(exceptionVectorTableBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowExceptionVectorTableBrowserWin()));
417 allWatchBrowseAct
= new QAction(QIcon(":/res/debug-watch.png"), tr("All Watch"), this);
418 allWatchBrowseAct
->setStatusTip(tr("Shows all Watch browser window"));
419 connect(allWatchBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowAllWatchBrowserWin()));
421 LocalBrowseAct
= new QAction(QIcon(":/res/debug-local.png"), tr("Locals"), this);
422 LocalBrowseAct
->setStatusTip(tr("Shows Locals browser window"));
423 connect(LocalBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowLocalBrowserWin()));
425 heapallocatorBrowseAct
= new QAction(QIcon(""), tr("Heap allocator"), this);
426 heapallocatorBrowseAct
->setStatusTip(tr("Shows the heap allocator browser window"));
427 connect(heapallocatorBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowHeapAllocatorBrowserWin()));
429 CallStackBrowseAct
= new QAction(QIcon(":/res/debug-callstack.png"), tr("Call Stack"), this);
430 CallStackBrowseAct
->setStatusTip(tr("Shows Call Stack browser window"));
431 connect(CallStackBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowCallStackBrowserWin()));
433 mem1BrowseAct
= (QAction
**)calloc(vjs
.nbrmemory1browserwindow
, sizeof(QAction
));
434 QSignalMapper
*signalMapper
= new QSignalMapper(this);
436 #pragma message("Warning: !!! Need to do the memory desalocation for mem1BrowseAct !!!")
438 #warning "!!! Need to do the memory desalocation for mem1BrowseAct !!!"
440 for (int i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
443 sprintf(MB
, "Memory %i", (unsigned int)(i
+1));
444 mem1BrowseAct
[i
] = new QAction(QIcon(":/res/debug-memory.png"), tr(MB
), this);
445 mem1BrowseAct
[i
]->setStatusTip(tr("Shows a Jaguar memory browser window"));
447 //connect(mem1BrowseAct[0], SIGNAL(triggered()), this, SLOT(ShowMemory1BrowserWin(size_t(0))));
448 connect(mem1BrowseAct
[i
], SIGNAL(triggered()), signalMapper
, SLOT(map()));
449 signalMapper
->setMapping(mem1BrowseAct
[i
], (int)i
);
450 connect(signalMapper
, SIGNAL(mapped(int)), this, SLOT(ShowMemory1BrowserWin(int)));
454 // Debugger Browser Actions
455 memBrowseAct
= new QAction(QIcon(":/res/tool-memory.png"), tr("Memory Browser"), this);
456 memBrowseAct
->setStatusTip(tr("Shows the Jaguar memory browser window"));
457 // memBrowseAct->setCheckable(true);
458 connect(memBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowMemoryBrowserWin()));
460 stackBrowseAct
= new QAction(QIcon(":/res/tool-stack.png"), tr("Stack Browser"), this);
461 stackBrowseAct
->setStatusTip(tr("Shows the Jaguar stack browser window"));
462 // memBrowseAct->setCheckable(true);
463 connect(stackBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowStackBrowserWin()));
465 cpuBrowseAct
= new QAction(QIcon(":/res/tool-cpu.png"), tr("CPU Browser"), this);
466 cpuBrowseAct
->setStatusTip(tr("Shows the Jaguar CPU browser window"));
467 // memBrowseAct->setCheckable(true);
468 connect(cpuBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowCPUBrowserWin()));
470 opBrowseAct
= new QAction(QIcon(":/res/tool-op.png"), tr("OP Browser"), this);
471 opBrowseAct
->setStatusTip(tr("Shows the Jaguar OP browser window"));
472 // memBrowseAct->setCheckable(true);
473 connect(opBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowOPBrowserWin()));
475 m68kDasmBrowseAct
= new QAction(QIcon(":/res/tool-68k-dis.png"), tr("68K Listing Browser"), this);
476 m68kDasmBrowseAct
->setStatusTip(tr("Shows the 68K disassembly browser window"));
477 // memBrowseAct->setCheckable(true);
478 connect(m68kDasmBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowM68KDasmBrowserWin()));
480 riscDasmBrowseAct
= new QAction(QIcon(":/res/tool-risc-dis.png"), tr("RISC Listing Browser"), this);
481 riscDasmBrowseAct
->setStatusTip(tr("Shows the RISC disassembly browser window"));
482 // memBrowseAct->setCheckable(true);
483 connect(riscDasmBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowRISCDasmBrowserWin()));
485 if (vjs
.softTypeDebugger
)
487 VideoOutputAct
= new QAction(tr("Output Video"), this);
488 VideoOutputAct
->setStatusTip(tr("Shows the output video window"));
489 connect(VideoOutputAct
, SIGNAL(triggered()), this, SLOT(ShowVideoOutputWin()));
491 DasmAct
= new QAction(tr("Disassembly"), this);
492 DasmAct
->setStatusTip(tr("Shows the disassembly window"));
493 connect(DasmAct
, SIGNAL(triggered()), this, SLOT(ShowDasmWin()));
496 // Misc. connections...
497 connect(filePickWin
, SIGNAL(RequestLoad(QString
)), this, SLOT(LoadSoftware(QString
)));
498 connect(filePickWin
, SIGNAL(FilePickerHiding()), this, SLOT(Unpause()));
502 fileMenu
= menuBar()->addMenu(tr("&Jaguar"));
503 fileMenu
->addAction(powerAct
);
504 if (!vjs
.softTypeDebugger
)
506 fileMenu
->addAction(pauseAct
);
507 // fileMenu->addAction(frameAdvanceAct);
509 fileMenu
->addAction(filePickAct
);
510 fileMenu
->addAction(useCDAct
);
511 fileMenu
->addAction(configAct
);
512 fileMenu
->addAction(emustatusAct
);
513 fileMenu
->addSeparator();
514 fileMenu
->addAction(quitAppAct
);
516 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
518 debugMenu
= menuBar()->addMenu(tr("&Debug"));
519 if (vjs
.softTypeDebugger
)
521 debugWindowsMenu
= debugMenu
->addMenu(tr("&Windows"));
522 debugWindowExceptionMenu
= debugWindowsMenu
->addMenu(tr("&Exception"));
523 debugWindowExceptionMenu
->addAction(exceptionVectorTableBrowseAct
);
524 debugWindowsMenu
->addSeparator();
526 debugWindowOutputMenu
= debugWindowsMenu
->addMenu(tr("&Output"));
527 debugWindowOutputMenu
->addAction(VideoOutputAct
);
528 debugWindowsMenu
->addSeparator();
530 debugWindowsWatchMenu
= debugWindowsMenu
->addMenu(tr("&Watch"));
531 debugWindowsWatchMenu
->addAction(allWatchBrowseAct
);
532 debugWindowsMenu
->addAction(LocalBrowseAct
);
533 debugWindowsMenu
->addSeparator();
534 debugWindowsMenu
->addAction(CallStackBrowseAct
);
535 debugWindowsMenu
->addSeparator();
536 debugWindowsMemoryMenu
= debugWindowsMenu
->addMenu(tr("&Memory"));
537 debugWindowsMemoryMenu
->addAction(heapallocatorBrowseAct
);
538 debugWindowsMemoryMenu
->addSeparator();
539 for (int i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
541 debugWindowsMemoryMenu
->addAction(mem1BrowseAct
[i
]);
543 debugWindowsMenu
->addSeparator();
544 debugWindowsBrowsesMenu
= debugWindowsMenu
->addMenu(tr("&Browsers"));
545 debugWindowsBrowsesMenu
->addAction(memBrowseAct
);
546 debugWindowsBrowsesMenu
->addAction(stackBrowseAct
);
547 debugWindowsBrowsesMenu
->addAction(cpuBrowseAct
);
548 debugWindowsBrowsesMenu
->addAction(opBrowseAct
);
549 debugWindowsBrowsesMenu
->addAction(m68kDasmBrowseAct
);
550 debugWindowsBrowsesMenu
->addAction(riscDasmBrowseAct
);
551 debugMenu
->addSeparator();
552 debugMenu
->addAction(pauseAct
);
553 debugMenu
->addAction(frameAdvanceAct
);
554 debugMenu
->addAction(restartAct
);
555 debugMenu
->addSeparator();
556 debugMenu
->addAction(traceStepIntoAct
);
557 debugMenu
->addAction(traceStepOverAct
);
559 debugMenu
->addSeparator();
560 debugNewBreakpointMenu
= debugMenu
->addMenu(tr("&New Breakpoint"));
561 debugNewBreakpointMenu
->addAction(newBreakpointFunctionAct
);
563 //debugMenu->addSeparator();
564 //debugMenu->addAction(DasmAct);
568 debugMenu
->addAction(memBrowseAct
);
569 debugMenu
->addAction(stackBrowseAct
);
570 debugMenu
->addAction(cpuBrowseAct
);
571 debugMenu
->addAction(opBrowseAct
);
572 debugMenu
->addAction(m68kDasmBrowseAct
);
573 debugMenu
->addAction(riscDasmBrowseAct
);
577 helpMenu
= menuBar()->addMenu(tr("&Help"));
578 helpMenu
->addAction(helpAct
);
579 helpMenu
->addAction(aboutAct
);
583 toolbar
= addToolBar(tr("Stuff"));
584 toolbar
->addAction(powerAct
);
585 if (!vjs
.softTypeDebugger
)
587 toolbar
->addAction(pauseAct
);
588 toolbar
->addAction(frameAdvanceAct
);
590 toolbar
->addAction(filePickAct
);
591 toolbar
->addAction(useCDAct
);
592 toolbar
->addSeparator();
593 if (!vjs
.softTypeDebugger
)
595 toolbar
->addAction(screenshotAct
);
596 toolbar
->addSeparator();
597 toolbar
->addAction(x1Act
);
598 toolbar
->addAction(x2Act
);
599 toolbar
->addAction(x3Act
);
600 toolbar
->addSeparator();
601 toolbar
->addAction(ntscAct
);
602 toolbar
->addAction(palAct
);
603 toolbar
->addSeparator();
604 toolbar
->addAction(blurAct
);
605 toolbar
->addAction(fullScreenAct
);
609 debuggerbar
= addToolBar(tr("&Debugger"));
610 debuggerbar
->addAction(pauseAct
);
611 debuggerbar
->addAction(frameAdvanceAct
);
612 debuggerbar
->addAction(restartAct
);
613 debuggerbar
->addSeparator();
614 debuggerbar
->addAction(traceStepIntoAct
);
615 debuggerbar
->addAction(traceStepOverAct
);
618 if (vjs
.hardwareTypeAlpine
)
620 debugbar
= addToolBar(tr("&Debug"));
621 debugbar
->addAction(memBrowseAct
);
622 debugbar
->addAction(stackBrowseAct
);
623 debugbar
->addAction(cpuBrowseAct
);
624 debugbar
->addAction(opBrowseAct
);
625 debugbar
->addAction(m68kDasmBrowseAct
);
626 debugbar
->addAction(riscDasmBrowseAct
);
629 // Add actions to the main window, as hiding widgets with them
631 addAction(fullScreenAct
);
632 addAction(quitAppAct
);
633 addAction(configAct
);
634 addAction(emustatusAct
);
636 addAction(filePickAct
);
637 addAction(frameAdvanceAct
);
640 statusBar()->showMessage(tr("Ready"));
642 // Do this in case original size isn't correct (mostly for the first-run case)
645 WriteLog("Window creation done\n");
647 // Create our test pattern NTSC bitmap
648 WriteLog("Test pattern 1 bitmap\n");
650 QImage
tempImg(":/res/test-pattern.jpg");
651 QImage tempImgScaled
= tempImg
.scaled(VIRTUAL_SCREEN_WIDTH
, VIRTUAL_SCREEN_HEIGHT_PAL
, Qt::IgnoreAspectRatio
, Qt::SmoothTransformation
);
653 for(uint32_t y
=0; y
<VIRTUAL_SCREEN_HEIGHT_PAL
; y
++)
655 const QRgb
* scanline
= (QRgb
*)tempImgScaled
.constScanLine(y
);
657 for(uint32_t x
=0; x
<VIRTUAL_SCREEN_WIDTH
; x
++)
659 uint32_t pixel
= (qRed(scanline
[x
]) << 24) | (qGreen(scanline
[x
]) << 16) | (qBlue(scanline
[x
]) << 8) | 0xFF;
660 testPattern
[(y
* VIRTUAL_SCREEN_WIDTH
) + x
] = pixel
;
664 // Create our test pattern PAL bitmap
665 WriteLog("Test pattern 2 bitmap\n");
667 QImage
tempImg2(":/res/test-pattern-pal.jpg");
668 QImage tempImgScaled2
= tempImg2
.scaled(VIRTUAL_SCREEN_WIDTH
, VIRTUAL_SCREEN_HEIGHT_PAL
, Qt::IgnoreAspectRatio
, Qt::SmoothTransformation
);
670 for(uint32_t y
=0; y
<VIRTUAL_SCREEN_HEIGHT_PAL
; y
++)
672 const QRgb
* scanline
= (QRgb
*)tempImgScaled2
.constScanLine(y
);
674 for(uint32_t x
=0; x
<VIRTUAL_SCREEN_WIDTH
; x
++)
676 uint32_t pixel
= (qRed(scanline
[x
]) << 24) | (qGreen(scanline
[x
]) << 16) | (qBlue(scanline
[x
]) << 8) | 0xFF;
677 testPattern2
[(y
* VIRTUAL_SCREEN_WIDTH
) + x
] = pixel
;
681 // Set up timer based loop for animation...
682 timer
= new QTimer(this);
683 connect(timer
, SIGNAL(timeout()), this, SLOT(Timer()));
685 // This isn't very accurate for NTSC: This is early by 40 msec per frame.
686 // This is because it's discarding the 0.6666... on the end of the fraction.
687 // Alas, 6 doesn't divide cleanly into 10. :-P
688 //Should we defer this until SyncUI? Probably.
689 //No, it doesn't work, because it uses setInterval() instead of start()...
690 // timer->start(vjs.hardwareTypeNTSC ? 16 : 20);
692 // We set this initially, to make VJ behave somewhat as it would if no
693 // cart were inserted and the BIOS was set as active...
694 jaguarCartInserted
= true;
695 WriteLog("Virtual Jaguar %s Rx (Last full build was on %s %s)\n", VJ_RELEASE_VERSION
, __DATE__
, __TIME__
);
696 WriteLog("VJ: Initializing jaguar subsystem...\n");
699 #ifndef NEWMODELSBIOSHANDLER
700 // memcpy(jagMemSpace + 0xE00000, jaguarBootROM, 0x20000); // Use the stock BIOS
701 memcpy(jagMemSpace
+ 0xE00000, (vjs
.biosType
== BT_K_SERIES
? jaguarBootROM
: jaguarBootROM2
), 0x20000); // Use the stock BIOS
703 SelectBIOS(vjs
.biosType
);
706 // Prevent the file scanner from running if filename passed
707 // in on the command line...
711 // Load up the default ROM if in Alpine mode:
712 if (vjs
.hardwareTypeAlpine
)
714 bool romLoaded
= JaguarLoadFile(vjs
.alpineROMPath
);
716 // If regular load failed, try just a straight file load
717 // (Dev only! I don't want people to start getting lazy with their releases again! :-P)
719 romLoaded
= AlpineLoadFile(vjs
.alpineROMPath
);
722 WriteLog("Alpine Mode: Successfully loaded file \"%s\".\n", vjs
.alpineROMPath
);
724 WriteLog("Alpine Mode: Unable to load file \"%s\"!\n", vjs
.alpineROMPath
);
726 // Attempt to load/run the ABS file...
727 LoadSoftware(vjs
.absROMPath
);
728 #ifndef NEWMODELSBIOSHANDLER
729 memcpy(jagMemSpace
+ 0xE00000, jaguarDevBootROM2
, 0x20000); // Use the stub BIOS
731 SelectBIOS(vjs
.biosType
);
733 // Prevent the scanner from running...
737 // Load up the default ROM if in Debugger mode:
738 if (vjs
.softTypeDebugger
)
740 bool romLoaded
= JaguarLoadFile(vjs
.debuggerROMPath
);
742 // If regular load failed, try just a straight file load
743 // (Dev only! I don't want people to start getting lazy with their releases again! :-P)
745 romLoaded
= DebuggerLoadFile(vjs
.debuggerROMPath
);
748 WriteLog("Debugger Mode: Successfully loaded file \"%s\".\n", vjs
.debuggerROMPath
);
750 WriteLog("Debugger Mode: Unable to load file \"%s\"!\n", vjs
.debuggerROMPath
);
752 // Attempt to load/run the ABS file...
753 LoadSoftware(vjs
.absROMPath
);
754 #ifndef NEWMODELSBIOSHANDLER
755 memcpy(jagMemSpace
+ 0xE00000, jaguarDevBootROM2
, 0x20000); // Use the stub BIOS
756 // Prevent the scanner from running...
758 SelectBIOS(vjs
.biosType
);
763 // Run the scanner if nothing passed in and *not* Alpine mode...
764 // NB: Really need to look into caching the info scanned in here...
765 filePickWin
->ScanSoftwareFolder(allowUnknownSoftware
);
766 scannedSoftwareFolder
= true;
770 void MainWin::LoadFile(QString file
)
776 void MainWin::SyncUI(void)
778 // Set toolbar buttons/menus based on settings read in (sync the UI)...
779 // (Really, this is to sync command line options passed in)
780 blurAct
->setChecked(vjs
.glFilter
);
781 x1Act
->setChecked(zoomLevel
== 1);
782 x2Act
->setChecked(zoomLevel
== 2);
783 x3Act
->setChecked(zoomLevel
== 3);
784 // running = powerAct->isChecked();
785 ntscAct
->setChecked(vjs
.hardwareTypeNTSC
);
786 palAct
->setChecked(!vjs
.hardwareTypeNTSC
);
787 powerAct
->setIcon(vjs
.hardwareTypeNTSC
? powerRed
: powerGreen
);
789 fullScreenAct
->setChecked(vjs
.fullscreen
);
790 fullScreen
= vjs
.fullscreen
;
791 SetFullScreen(fullScreen
);
793 // Reset the timer to be what was set in the command line (if any):
794 // timer->setInterval(vjs.hardwareTypeNTSC ? 16 : 20);
795 timer
->start(vjs
.hardwareTypeNTSC
? 16 : 20);
799 void MainWin::closeEvent(QCloseEvent
* event
)
802 // This should only be done by the config dialog
805 event
->accept(); // ignore() if can't close for some reason
809 void MainWin::keyPressEvent(QKeyEvent
* e
)
811 #ifndef VJ_REMOVE_DEV_CODE
813 //extern bool startM68KTracing; // moved to jaguar.h
815 extern int blit_start_log
;
817 extern bool startConciseBlitLogging
;
820 // We ignore the Alt key for now, since it causes problems with the GUI
821 if (e
->key() == Qt::Key_Alt
)
826 // Bar this shite from release versions kthxbai
827 #ifndef VJ_REMOVE_DEV_CODE
828 else if (e
->key() == Qt::Key_F11
)
830 startM68KTracing
= true;
834 else if (e
->key() == Qt::Key_F12
)
836 blit_start_log
= true;
840 else if (e
->key() == Qt::Key_F10
)
842 startConciseBlitLogging
= true;
847 else if (e
->key() == Qt::Key_F8
)
849 // ggn: For extra NYAN pleasure...
850 // ggn: There you go James :P
851 // Shamus: Thanks for the patch! :-D
852 WriteLog(" o + + +\n");
853 WriteLog("+ o o + o\n");
854 WriteLog("-_-_-_-_-_-_-_,------, o \n");
855 WriteLog("_-_-_-_-_-_-_-| /\\_/\\ \n");
856 WriteLog("-_-_-_-_-_-_-~|__( ^ .^) + + \n");
857 WriteLog("_-_-_-_-_-_-_-\"\" \"\" \n");
858 WriteLog("+ o o + o\n");
865 This is done now by a QAction...
866 if (e->key() == Qt::Key_F9)
876 void MainWin::keyReleaseEvent(QKeyEvent
* e
)
878 // We ignore the Alt key for now, since it causes problems with the GUI
879 if (e
->key() == Qt::Key_Alt
)
885 HandleKeys(e
, false);
889 void MainWin::HandleKeys(QKeyEvent
* e
, bool state
)
891 enum { P1LEFT
= 0, P1RIGHT
, P1UP
, P1DOWN
, P2LEFT
, P2RIGHT
, P2UP
, P2DOWN
};
892 // We kill bad key combos here, before they can get to the emulator...
893 // This also kills the illegal instruction problem that cropped up in
896 // First, settle key states...
897 if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_L
])
898 keyHeld
[P1LEFT
] = state
;
899 else if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_R
])
900 keyHeld
[P1RIGHT
] = state
;
901 else if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_U
])
902 keyHeld
[P1UP
] = state
;
903 else if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_D
])
904 keyHeld
[P1DOWN
] = state
;
905 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_L
])
906 keyHeld
[P2LEFT
] = state
;
907 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_R
])
908 keyHeld
[P2RIGHT
] = state
;
909 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_U
])
910 keyHeld
[P2UP
] = state
;
911 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_D
])
912 keyHeld
[P2DOWN
] = state
;
914 // Next, check for conflicts and kill 'em if there are any...
915 if (keyHeld
[P1LEFT
] && keyHeld
[P1RIGHT
])
916 keyHeld
[P1LEFT
] = keyHeld
[P1RIGHT
] = false;
918 if (keyHeld
[P1UP
] && keyHeld
[P1DOWN
])
919 keyHeld
[P1UP
] = keyHeld
[P1DOWN
] = false;
921 if (keyHeld
[P2LEFT
] && keyHeld
[P2RIGHT
])
922 keyHeld
[P2LEFT
] = keyHeld
[P2RIGHT
] = false;
924 if (keyHeld
[P2UP
] && keyHeld
[P2DOWN
])
925 keyHeld
[P2UP
] = keyHeld
[P2DOWN
] = false;
927 // No bad combos exist now, let's stuff the emulator key buffers...!
928 for(int i
=BUTTON_FIRST
; i
<=BUTTON_LAST
; i
++)
930 if (e
->key() == (int)vjs
.p1KeyBindings
[i
])
931 joypad0Buttons
[i
] = (state
? 0x01 : 0x00);
933 if (e
->key() == (int)vjs
.p2KeyBindings
[i
])
934 joypad1Buttons
[i
] = (state
? 0x01 : 0x00);
940 // N.B.: The profile system AutoConnect functionality sets the gamepad IDs here.
942 void MainWin::HandleGamepads(void)
946 for(int i
=BUTTON_FIRST
; i
<=BUTTON_LAST
; i
++)
948 if (vjs
.p1KeyBindings
[i
] & (JOY_BUTTON
| JOY_HAT
| JOY_AXIS
))
949 joypad0Buttons
[i
] = (Gamepad::GetState(gamepadIDSlot1
, vjs
.p1KeyBindings
[i
]) ? 0x01 : 0x00);
951 if (vjs
.p2KeyBindings
[i
] & (JOY_BUTTON
| JOY_HAT
| JOY_AXIS
))
952 joypad1Buttons
[i
] = (Gamepad::GetState(gamepadIDSlot2
, vjs
.p2KeyBindings
[i
]) ? 0x01 : 0x00);
957 void MainWin::Open(void)
962 void MainWin::Configure(void)
964 // Call the configuration dialog and update settings
965 ConfigDialog
dlg(this);
967 dlg
.generalTab
->useUnknownSoftware
->setChecked(allowUnknownSoftware
);
968 dlg
.controllerTab1
->profileNum
= lastEditedProfile
;
969 dlg
.controllerTab1
->SetupLastUsedProfile();
970 // maybe instead of this, we tell the controller tab to work on a copy that gets
971 // written if the user hits 'OK'.
972 SaveProfiles(); // Just in case user cancels
974 if (dlg
.exec() == false)
980 QString before
= vjs
.ROMPath
;
981 QString alpineBefore
= vjs
.alpineROMPath
;
982 QString absBefore
= vjs
.absROMPath
;
983 // bool audioBefore = vjs.audioEnabled;
984 bool audioBefore
= vjs
.DSPEnabled
;
985 dlg
.UpdateVJSettings();
986 QString after
= vjs
.ROMPath
;
987 QString alpineAfter
= vjs
.alpineROMPath
;
988 QString absAfter
= vjs
.absROMPath
;
989 // bool audioAfter = vjs.audioEnabled;
990 bool audioAfter
= vjs
.DSPEnabled
;
992 bool allowOld
= allowUnknownSoftware
;
994 allowUnknownSoftware
= dlg
.generalTab
->useUnknownSoftware
->isChecked();
995 lastEditedProfile
= dlg
.controllerTab1
->profileNum
;
996 AutoConnectProfiles();
998 // We rescan the "software" folder if the user either changed the path or
999 // checked/unchecked the "Allow unknown files" option in the config dialog.
1000 if ((before
!= after
) || (allowOld
!= allowUnknownSoftware
))
1001 filePickWin
->ScanSoftwareFolder(allowUnknownSoftware
);
1003 // If the "Alpine" ROM is changed, then let's load it...
1004 if (alpineBefore
!= alpineAfter
)
1006 if (!JaguarLoadFile(vjs
.alpineROMPath
) && !AlpineLoadFile(vjs
.alpineROMPath
))
1008 // Oh crap, we couldn't get the file! Alert the media!
1010 msg
.setText(QString(tr("Could not load file \"%1\"!")).arg(vjs
.alpineROMPath
));
1011 msg
.setIcon(QMessageBox::Warning
);
1016 // If the "ABS" ROM is changed, then let's load it...
1017 if (absBefore
!= absAfter
)
1019 if (!JaguarLoadFile(vjs
.absROMPath
))
1021 // Oh crap, we couldn't get the file! Alert the media!
1023 msg
.setText(QString(tr("Could not load file \"%1\"!")).arg(vjs
.absROMPath
));
1024 msg
.setIcon(QMessageBox::Warning
);
1029 // If the "Enable DSP" checkbox changed, then we have to re-init the DAC,
1030 // since it's running in the host audio IRQ...
1031 if (audioBefore
!= audioAfter
)
1037 // Just in case we crash before a clean exit...
1040 DebuggerRefreshWindows();
1045 // Here's the main emulator loop
1047 void MainWin::Timer(void)
1050 static uint32_t ntscTickCount
;
1051 if (vjs
.hardwareTypeNTSC
)
1055 timer
->start(16 + (ntscTickCount
== 0 ? 1 : 0));
1062 if (showUntunedTankCircuit
)
1064 // Some machines can't handle this, so we give them the option to disable it. :-)
1065 if (!plzDontKillMyComputer
)
1067 // if (!vjs.softTypeDebugger)
1069 // Random hash & trash
1070 // We try to simulate an untuned tank circuit here... :-)
1071 for (uint32_t x
= 0; x
< videoWidget
->rasterWidth
; x
++)
1073 for (uint32_t y
= 0; y
< videoWidget
->rasterHeight
; y
++)
1075 videoWidget
->buffer
[(y
* videoWidget
->textureWidth
) + x
] = (rand() & 0xFF) << 8 | (rand() & 0xFF) << 16 | (rand() & 0xFF) << 24;
1083 // Otherwise, run the Jaguar simulation
1086 if (!vjs
.softTypeDebugger
)
1087 videoWidget
->HandleMouseHiding();
1089 static uint32_t refresh
= 0;
1090 // Do autorefresh on debug windows
1091 // Have to be careful, too much causes the emulator to slow way down!
1092 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
1094 if (refresh
== vjs
.refresh
)
1096 RefreshAlpineWindows();
1097 //memBrowseWin->RefreshContents();
1098 //cpuBrowseWin->RefreshContents();
1106 //if (!vjs.softTypeDebugger)
1107 videoWidget
->updateGL();
1110 // Approach: We use a ring buffer to store times (in ms) over a given
1111 // amount of frames, then sum them to figure out the FPS.
1112 uint32_t timestamp
= SDL_GetTicks();
1113 // This assumes the ring buffer size is a power of 2
1114 // ringBufferPointer = (ringBufferPointer + 1) & (RING_BUFFER_SIZE - 1);
1115 // Doing it this way is better. Ring buffer size can be arbitrary then.
1116 ringBufferPointer
= (ringBufferPointer
+ 1) % RING_BUFFER_SIZE
;
1117 ringBuffer
[ringBufferPointer
] = timestamp
- oldTimestamp
;
1118 uint32_t elapsedTime
= 0;
1120 for(uint32_t i
=0; i
<RING_BUFFER_SIZE
; i
++)
1121 elapsedTime
+= ringBuffer
[i
];
1123 // elapsedTime must be non-zero
1124 if (elapsedTime
== 0)
1127 // This is in frames per 10 seconds, so we can have 1 decimal
1128 uint32_t framesPerSecond
= (uint32_t)(((float)RING_BUFFER_SIZE
/ (float)elapsedTime
) * 10000.0);
1129 uint32_t fpsIntegerPart
= framesPerSecond
/ 10;
1130 uint32_t fpsDecimalPart
= framesPerSecond
% 10;
1131 // If this is updated too frequently to be useful, we can throttle it down
1132 // so that it only updates every 10th frame or so
1133 statusBar()->showMessage(QString("%1.%2 FPS").arg(fpsIntegerPart
).arg(fpsDecimalPart
));
1134 oldTimestamp
= timestamp
;
1136 if (M68KDebugHaltStatus())
1141 void MainWin::TogglePowerState(void)
1143 powerButtonOn
= !powerButtonOn
;
1146 // With the power off, we simulate white noise on the screen. :-)
1149 // Restore the mouse pointer, if hidden:
1150 if (!vjs
.softTypeDebugger
)
1151 videoWidget
->CheckAndRestoreMouseCursor();
1152 useCDAct
->setDisabled(false);
1153 palAct
->setDisabled(false);
1154 ntscAct
->setDisabled(false);
1155 pauseAct
->setChecked(false);
1156 pauseAct
->setDisabled(true);
1157 showUntunedTankCircuit
= true;
1158 DACPauseAudioThread();
1159 // This is just in case the ROM we were playing was in a narrow or wide
1160 // field mode, so the untuned tank sim doesn't look wrong. :-)
1163 if (plzDontKillMyComputer
)
1165 //if (!vjs.softTypeDebugger)
1167 // We have to do it line by line, because the texture pitch is not
1168 // the same as the picture buffer's pitch.
1169 for (uint32_t y
= 0; y
< videoWidget
->rasterHeight
; y
++)
1171 if (vjs
.hardwareTypeNTSC
)
1172 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1174 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern2
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1181 useCDAct
->setDisabled(true);
1182 palAct
->setDisabled(true);
1183 ntscAct
->setDisabled(true);
1184 pauseAct
->setChecked(false);
1185 pauseAct
->setDisabled(false);
1186 showUntunedTankCircuit
= false;
1188 // Otherwise, we prepare for running regular software...
1191 // Should check for cartridgeLoaded here as well...!
1192 // We can clear it when toggling CDActive on, so that when we power cycle it
1193 // does the expected thing. Otherwise, if we use the file picker to insert a
1194 // cart, we expect to run the cart! Maybe have a RemoveCart function that only
1195 // works if the CD unit is active?
1196 setWindowTitle(QString("Virtual Jaguar " VJ_RELEASE_VERSION
" Rx - Now playing: Jaguar CD"));
1199 WriteLog("GUI: Resetting Jaguar...\n");
1201 DebuggerResetWindows();
1202 DACPauseAudioThread(false);
1207 void MainWin::ToggleRunState(void)
1209 startM68KTracing
= running
;
1214 frameAdvanceAct
->setDisabled(false);
1215 pauseAct
->setChecked(true);
1216 pauseAct
->setDisabled(false);
1217 if (vjs
.softTypeDebugger
)
1219 traceStepIntoAct
->setDisabled(false);
1220 traceStepOverAct
->setDisabled(false);
1221 restartAct
->setDisabled(false);
1222 m68kDasmWin
->Use68KPCAddress();
1223 GPUDasmWin
->UseGPUPCAddress();
1224 DSPDasmWin
->UseDSPPCAddress();
1227 //if (!vjs.softTypeDebugger)
1229 // Restore the mouse pointer, if hidden:
1230 videoWidget
->CheckAndRestoreMouseCursor();
1231 // frameAdvanceAct->setDisabled(false);
1233 for (uint32_t i
= 0; i
< (uint32_t)(videoWidget
->textureWidth
* 256); i
++)
1235 uint32_t pixel
= videoWidget
->buffer
[i
];
1236 uint8_t r
= (pixel
>> 24) & 0xFF, g
= (pixel
>> 16) & 0xFF, b
= (pixel
>> 8) & 0xFF;
1237 pixel
= ((r
+ g
+ b
) / 3) & 0x00FF;
1238 videoWidget
->buffer
[i
] = 0x000000FF | (pixel
<< 16) | (pixel
<< 8);
1241 videoWidget
->updateGL();
1243 cpuBrowseWin
->HoldBPM();
1244 cpuBrowseWin
->HandleBPMContinue();
1245 DebuggerRefreshWindows();
1250 frameAdvanceAct
->setDisabled(true);
1251 pauseAct
->setChecked(false);
1252 pauseAct
->setDisabled(false);
1253 if (vjs
.softTypeDebugger
)
1255 traceStepIntoAct
->setDisabled(true);
1256 traceStepOverAct
->setDisabled(true);
1257 restartAct
->setDisabled(true);
1260 cpuBrowseWin
->UnholdBPM();
1263 // Pause/unpause any running/non-running threads...
1264 DACPauseAudioThread(!running
);
1268 void MainWin::SetZoom100(void)
1275 void MainWin::SetZoom200(void)
1282 void MainWin::SetZoom300(void)
1289 void MainWin::SetNTSC(void)
1291 powerAct
->setIcon(powerRed
);
1292 timer
->setInterval(16);
1293 vjs
.hardwareTypeNTSC
= true;
1299 void MainWin::SetPAL(void)
1301 powerAct
->setIcon(powerGreen
);
1302 timer
->setInterval(20);
1303 vjs
.hardwareTypeNTSC
= false;
1309 void MainWin::ToggleBlur(void)
1311 vjs
.glFilter
= !vjs
.glFilter
;
1316 void MainWin::ShowAboutWin(void)
1322 void MainWin::ShowHelpWin(void)
1328 void MainWin::InsertCart(void)
1330 // Check to see if we did autorun, 'cause we didn't load anything in that
1332 if (!scannedSoftwareFolder
)
1334 filePickWin
->ScanSoftwareFolder(allowUnknownSoftware
);
1335 scannedSoftwareFolder
= true;
1338 // If the emulator is running, we pause it here and unpause it later
1339 // if we dismiss the file selector without choosing anything
1340 if (running
&& powerButtonOn
)
1343 pauseForFileSelector
= true;
1346 filePickWin
->show();
1350 void MainWin::Unpause(void)
1352 // Here we unpause the emulator if it was paused when we went into the file selector
1353 if (pauseForFileSelector
)
1355 pauseForFileSelector
= false;
1357 // Some nutter might have unpaused while in the file selector, so check for that
1364 // Jaguar initialisation and load software file
1365 void MainWin::LoadSoftware(QString file
)
1367 running
= false; // Prevent bad things(TM) from happening...
1368 pauseForFileSelector
= false; // Reset the file selector pause flag
1370 #ifndef NEWMODELSBIOSHANDLER
1371 uint8_t * biosPointer
= jaguarBootROM
;
1373 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
1375 biosPointer
= jaguarDevBootROM2
;
1378 memcpy(jagMemSpace
+ 0xE00000, biosPointer
, 0x20000);
1380 SelectBIOS(vjs
.biosType
);
1383 powerAct
->setDisabled(false);
1384 powerAct
->setChecked(true);
1385 powerButtonOn
= false;
1388 // We have to load our software *after* the Jaguar RESET
1389 cartridgeLoaded
= JaguarLoadFile(file
.toUtf8().data());
1390 SET32(jaguarMainRAM
, 0, vjs
.DRAM_size
); // Set top of stack...
1392 // This is icky because we've already done it
1393 // it gets worse :-P
1394 if (!vjs
.useJaguarBIOS
)
1396 SET32(jaguarMainRAM
, 4, jaguarRunAddress
);
1401 // set the M68K in halt mode in case of a debug mode is used, so control is at user side
1402 if (vjs
.softTypeDebugger
)
1404 m68k_set_reg(M68K_REG_A6
, 0);
1405 m68kDasmWin
->SetAddress(jaguarRunAddress
);
1406 //pauseAct->setDisabled(false);
1407 //pauseAct->setChecked(true);
1413 // Prevent the Alpine mode to crash in case of software without a start address
1414 if (vjs
.hardwareTypeAlpine
&& !jaguarRunAddress
)
1420 if ((!vjs
.hardwareTypeAlpine
|| !vjs
.softTypeDebugger
) && !loadAndGo
&& jaguarRunAddress
)
1422 QString newTitle
= QString("Virtual Jaguar " VJ_RELEASE_VERSION
" Rx - Now playing: %1").arg(filePickWin
->GetSelectedPrettyName());
1423 setWindowTitle(newTitle
);
1428 void MainWin::ToggleCDUsage(void)
1430 CDActive
= !CDActive
;
1432 // Set up the Jaguar CD for execution, otherwise, clear memory
1434 memcpy(jagMemSpace
+ 0x800000, jaguarCDBootROM
, 0x40000);
1436 memset(jagMemSpace
+ 0x800000, 0xFF, 0x40000);
1441 void MainWin::NewBreakpointFunction(void)
1444 brkWin
->RefreshContents();
1449 void MainWin::DebuggerTraceStepInto(void)
1452 videoWidget
->updateGL();
1453 DebuggerRefreshWindows();
1455 #pragma message("Warning: !!! Need to verify the Step Into function !!!")
1457 #warning "!!! Need to verify the Step Into function !!!"
1463 void MainWin::DebuggerRestart(void)
1468 m68k_set_reg(M68K_REG_PC
, jaguarRunAddress
);
1469 m68k_set_reg(M68K_REG_SP
, vjs
.DRAM_size
);
1471 m68k_set_reg(M68K_REG_A6
, 0);
1473 DebuggerResetWindows();
1474 DebuggerRefreshWindows();
1476 #pragma message("Warning: !!! Need to verify the Restart function !!!")
1478 #warning "!!! Need to verify the Restart function !!!"
1484 void MainWin::DebuggerTraceStepOver(void)
1487 videoWidget
->updateGL();
1488 DebuggerRefreshWindows();
1490 #pragma message("Warning: !!! Need to verify the Step Over function !!!")
1492 #warning "!!! Need to verify the Step Over function !!!"
1497 // Advance / Execute for one frame
1498 void MainWin::FrameAdvance(void)
1500 //printf("Frame Advance...\n");
1502 // Execute 1 frame, then exit (only useful in Pause mode)
1504 //if (!vjs.softTypeDebugger)
1505 videoWidget
->updateGL();
1507 // Need to execute 1 frames' worth of DSP thread as well :-/
1509 //m68kDasmWin->Use68KPCAddress();
1512 #pragma message("Warning: !!! Need to execute the DSP thread for 1 frame too !!!")
1514 #warning "!!! Need to execute the DSP thread for 1 frame too !!!"
1519 void MainWin::SetFullScreen(bool state
/*= true*/)
1521 if (!vjs
.softTypeDebugger
)
1525 mainWinPosition
= pos();
1527 statusBar()->hide();
1533 // This is needed because the fullscreen may happen on a different
1534 // screen than screen 0:
1535 int screenNum
= QApplication::desktop()->screenNumber(videoWidget
);
1536 QRect r
= QApplication::desktop()->screenGeometry(screenNum
);
1537 double targetWidth
= (double)VIRTUAL_SCREEN_WIDTH
,
1538 targetHeight
= (double)(vjs
.hardwareTypeNTSC
? VIRTUAL_SCREEN_HEIGHT_NTSC
: VIRTUAL_SCREEN_HEIGHT_PAL
);
1539 double aspectRatio
= targetWidth
/ targetHeight
;
1540 // NOTE: Really should check here to see which dimension constrains the
1541 // other. Right now, we assume that height is the constraint.
1542 int newWidth
= (int)(aspectRatio
* (double)r
.height());
1543 videoWidget
->offset
= (r
.width() - newWidth
) / 2;
1544 videoWidget
->fullscreen
= true;
1545 videoWidget
->outputWidth
= newWidth
;
1546 videoWidget
->setFixedSize(r
.width(), r
.height());
1551 // Seems Qt is fussy about this: showNormal() has to go first, or it
1552 // will keep the window stuck in a psuedo-fullscreen mode with no way
1553 // to get out of it (except closing the app).
1556 // Reset the video widget to windowed mode
1557 videoWidget
->offset
= 0;
1558 videoWidget
->fullscreen
= false;
1560 statusBar()->show();
1567 move(mainWinPosition
);
1573 void MainWin::ToggleFullScreen(void)
1575 fullScreen
= !fullScreen
;
1576 SetFullScreen(fullScreen
);
1581 void MainWin::ShowExceptionVectorTableBrowserWin(void)
1583 exceptionvectortableBrowseWin
->show();
1584 exceptionvectortableBrowseWin
->RefreshContents();
1589 void MainWin::ShowLocalBrowserWin(void)
1591 LocalBrowseWin
->show();
1592 LocalBrowseWin
->RefreshContents();
1597 void MainWin::ShowCallStackBrowserWin(void)
1599 CallStackBrowseWin
->show();
1600 CallStackBrowseWin
->RefreshContents();
1604 void MainWin::ShowAllWatchBrowserWin(void)
1606 allWatchBrowseWin
->show();
1607 allWatchBrowseWin
->RefreshContents();
1611 void MainWin::ShowHeapAllocatorBrowserWin(void)
1613 heapallocatorBrowseWin
->show();
1614 heapallocatorBrowseWin
->RefreshContents();
1618 void MainWin::ShowMemoryBrowserWin(void)
1620 memBrowseWin
->show();
1621 memBrowseWin
->RefreshContents();
1625 void MainWin::ShowMemory1BrowserWin(int NumWin
)
1627 // for (int i = 0; i < vjs.nbrmemory1browserwindow; i++)
1629 mem1BrowseWin
[NumWin
]->show();
1630 mem1BrowseWin
[NumWin
]->RefreshContents(NumWin
);
1635 void MainWin::ShowEmuStatusWin(void)
1637 emuStatusWin
->show();
1638 emuStatusWin
->RefreshContents();
1642 void MainWin::ShowStackBrowserWin(void)
1644 stackBrowseWin
->show();
1645 stackBrowseWin
->RefreshContents();
1649 void MainWin::ShowCPUBrowserWin(void)
1651 cpuBrowseWin
->show();
1652 cpuBrowseWin
->RefreshContents();
1656 void MainWin::ShowOPBrowserWin(void)
1658 opBrowseWin
->show();
1659 opBrowseWin
->RefreshContents();
1663 void MainWin::ShowM68KDasmBrowserWin(void)
1665 m68kDasmBrowseWin
->show();
1666 m68kDasmBrowseWin
->RefreshContents();
1670 void MainWin::ShowRISCDasmBrowserWin(void)
1672 riscDasmBrowseWin
->show();
1673 riscDasmBrowseWin
->RefreshContents();
1677 void MainWin::ShowDasmWin(void)
1680 // DasmWin->RefreshContents();
1684 void MainWin::ShowVideoOutputWin(void)
1686 //VideoOutputWindowCentrale = mainWindowCentrale->addSubWindow(videoWidget);
1687 //VideoOutputWindowCentrale->setWindowTitle(QString(tr("Video output")));
1688 //VideoOutputWindowCentrale->show();
1689 //memBrowseWin->show();
1690 //VideoOutputWin->show();
1691 //VideoOutputWin->RefreshContents(videoWidget);
1695 void MainWin::ResizeMainWindow(void)
1697 if (!vjs
.softTypeDebugger
)
1699 videoWidget
->setFixedSize(zoomLevel
* VIRTUAL_SCREEN_WIDTH
,
1700 zoomLevel
* (vjs
.hardwareTypeNTSC
? VIRTUAL_SCREEN_HEIGHT_NTSC
: VIRTUAL_SCREEN_HEIGHT_PAL
));
1702 // Show the test pattern if user requested plzDontKillMyComputer mode
1703 if (!powerButtonOn
&& plzDontKillMyComputer
)
1705 for (uint32_t y
= 0; y
< videoWidget
->rasterHeight
; y
++)
1707 if (vjs
.hardwareTypeNTSC
)
1708 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1710 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern2
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1720 void MainWin::ReadSettings(void)
1724 QSettings
settings("Underground Software", "Virtual Jaguar");
1726 //zoomLevel = settings.value("zoom", 2).toInt();
1727 allowUnknownSoftware
= settings
.value("showUnknownSoftware", false).toBool();
1728 lastEditedProfile
= settings
.value("lastEditedProfile", 0).toInt();
1730 vjs
.useJoystick
= settings
.value("useJoystick", false).toBool();
1731 vjs
.joyport
= settings
.value("joyport", 0).toInt();
1732 vjs
.hardwareTypeNTSC
= settings
.value("hardwareTypeNTSC", true).toBool();
1733 vjs
.frameSkip
= settings
.value("frameSkip", 0).toInt();
1734 vjs
.useJaguarBIOS
= settings
.value("useJaguarBIOS", false).toBool();
1735 vjs
.useRetailBIOS
= settings
.value("useRetailBIOS", false).toBool();
1736 vjs
.useDevBIOS
= settings
.value("useDevBIOS", false).toBool();
1737 vjs
.GPUEnabled
= settings
.value("GPUEnabled", true).toBool();
1738 vjs
.DSPEnabled
= settings
.value("DSPEnabled", true).toBool();
1739 vjs
.audioEnabled
= settings
.value("audioEnabled", true).toBool();
1740 vjs
.usePipelinedDSP
= settings
.value("usePipelinedDSP", false).toBool();
1741 vjs
.fullscreen
= settings
.value("fullscreen", false).toBool();
1742 vjs
.useOpenGL
= settings
.value("useOpenGL", true).toBool();
1743 vjs
.glFilter
= settings
.value("glFilterType", 1).toInt();
1744 vjs
.renderType
= settings
.value("renderType", 0).toInt();
1745 vjs
.biosType
= settings
.value("biosType", BT_M_SERIES
).toInt();
1746 vjs
.jaguarModel
= settings
.value("jaguarModel", JAG_M_SERIES
).toInt();
1747 vjs
.useFastBlitter
= settings
.value("useFastBlitter", false).toBool();
1748 strcpy(vjs
.EEPROMPath
, settings
.value("EEPROMs", QStandardPaths::writableLocation(QStandardPaths::DataLocation
).append("/eeproms/")).toString().toUtf8().data());
1749 strcpy(vjs
.ROMPath
, settings
.value("ROMs", QStandardPaths::writableLocation(QStandardPaths::DataLocation
).append("/software/")).toString().toUtf8().data());
1750 strcpy(vjs
.screenshotPath
, settings
.value("Screenshots", QStandardPaths::writableLocation(QStandardPaths::DataLocation
).append("/screenshots/")).toString().toUtf8().data());
1752 // Read settings from the Debugger mode
1753 settings
.beginGroup("debugger");
1754 strcpy(vjs
.debuggerROMPath
, settings
.value("DefaultROM", "").toString().toUtf8().data());
1755 vjs
.nbrdisasmlines
= settings
.value("NbrDisasmLines", 32).toUInt();
1756 vjs
.disasmopcodes
= settings
.value("DisasmOpcodes", true).toBool();
1757 vjs
.displayHWlabels
= settings
.value("DisplayHWLabels", true).toBool();
1758 vjs
.displayFullSourceFilename
= settings
.value("displayFullSourceFilename", true).toBool();
1759 vjs
.nbrmemory1browserwindow
= settings
.value("NbrMemory1BrowserWindow", MaxMemory1BrowserWindow
).toUInt();
1760 settings
.endGroup();
1762 // Read settings from the Alpine mode
1763 settings
.beginGroup("alpine");
1764 strcpy(vjs
.alpineROMPath
, settings
.value("DefaultROM", "").toString().toUtf8().data());
1765 strcpy(vjs
.absROMPath
, settings
.value("DefaultABS", "").toString().toUtf8().data());
1766 vjs
.refresh
= settings
.value("refresh", 60).toUInt();
1767 vjs
.allowWritesToROM
= settings
.value("writeROM", false).toBool();
1768 settings
.endGroup();
1770 // Read settings from the Keybindings
1771 settings
.beginGroup("keybindings");
1772 for (i
= 0; i
< KB_END
; i
++)
1774 strcpy(vjs
.KBContent
[i
].KBSettingValue
, settings
.value(KeyBindingsTable
[i
].KBNameSetting
, KeyBindingsTable
[i
].KBDefaultValue
).toString().toUtf8().data());
1776 settings
.endGroup();
1778 // Write important settings to the log file
1779 WriteLog("MainWin: Paths\n");
1780 WriteLog(" EEPROMPath = \"%s\"\n", vjs
.EEPROMPath
);
1781 WriteLog(" ROMPath = \"%s\"\n", vjs
.ROMPath
);
1782 WriteLog(" AlpineROMPath = \"%s\"\n", vjs
.alpineROMPath
);
1783 WriteLog("DebuggerROMPath = \"%s\"\n", vjs
.debuggerROMPath
);
1784 WriteLog(" absROMPath = \"%s\"\n", vjs
.absROMPath
);
1785 WriteLog(" Pipelined DSP = %s\n", (vjs
.usePipelinedDSP
? "ON" : "off"));
1788 // Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, *
1789 vjs
.p1KeyBindings
[BUTTON_U
] = settings
.value("p1k_up", Qt::Key_S
).toInt();
1790 vjs
.p1KeyBindings
[BUTTON_D
] = settings
.value("p1k_down", Qt::Key_X
).toInt();
1791 vjs
.p1KeyBindings
[BUTTON_L
] = settings
.value("p1k_left", Qt::Key_A
).toInt();
1792 vjs
.p1KeyBindings
[BUTTON_R
] = settings
.value("p1k_right", Qt::Key_D
).toInt();
1793 vjs
.p1KeyBindings
[BUTTON_C
] = settings
.value("p1k_c", Qt::Key_J
).toInt();
1794 vjs
.p1KeyBindings
[BUTTON_B
] = settings
.value("p1k_b", Qt::Key_K
).toInt();
1795 vjs
.p1KeyBindings
[BUTTON_A
] = settings
.value("p1k_a", Qt::Key_L
).toInt();
1796 vjs
.p1KeyBindings
[BUTTON_OPTION
] = settings
.value("p1k_option", Qt::Key_O
).toInt();
1797 vjs
.p1KeyBindings
[BUTTON_PAUSE
] = settings
.value("p1k_pause", Qt::Key_P
).toInt();
1798 vjs
.p1KeyBindings
[BUTTON_0
] = settings
.value("p1k_0", Qt::Key_0
).toInt();
1799 vjs
.p1KeyBindings
[BUTTON_1
] = settings
.value("p1k_1", Qt::Key_1
).toInt();
1800 vjs
.p1KeyBindings
[BUTTON_2
] = settings
.value("p1k_2", Qt::Key_2
).toInt();
1801 vjs
.p1KeyBindings
[BUTTON_3
] = settings
.value("p1k_3", Qt::Key_3
).toInt();
1802 vjs
.p1KeyBindings
[BUTTON_4
] = settings
.value("p1k_4", Qt::Key_4
).toInt();
1803 vjs
.p1KeyBindings
[BUTTON_5
] = settings
.value("p1k_5", Qt::Key_5
).toInt();
1804 vjs
.p1KeyBindings
[BUTTON_6
] = settings
.value("p1k_6", Qt::Key_6
).toInt();
1805 vjs
.p1KeyBindings
[BUTTON_7
] = settings
.value("p1k_7", Qt::Key_7
).toInt();
1806 vjs
.p1KeyBindings
[BUTTON_8
] = settings
.value("p1k_8", Qt::Key_8
).toInt();
1807 vjs
.p1KeyBindings
[BUTTON_9
] = settings
.value("p1k_9", Qt::Key_9
).toInt();
1808 vjs
.p1KeyBindings
[BUTTON_d
] = settings
.value("p1k_pound", Qt::Key_Minus
).toInt();
1809 vjs
.p1KeyBindings
[BUTTON_s
] = settings
.value("p1k_star", Qt::Key_Equal
).toInt();
1811 vjs
.p2KeyBindings
[BUTTON_U
] = settings
.value("p2k_up", Qt::Key_Up
).toInt();
1812 vjs
.p2KeyBindings
[BUTTON_D
] = settings
.value("p2k_down", Qt::Key_Down
).toInt();
1813 vjs
.p2KeyBindings
[BUTTON_L
] = settings
.value("p2k_left", Qt::Key_Left
).toInt();
1814 vjs
.p2KeyBindings
[BUTTON_R
] = settings
.value("p2k_right", Qt::Key_Right
).toInt();
1815 vjs
.p2KeyBindings
[BUTTON_C
] = settings
.value("p2k_c", Qt::Key_Z
).toInt();
1816 vjs
.p2KeyBindings
[BUTTON_B
] = settings
.value("p2k_b", Qt::Key_X
).toInt();
1817 vjs
.p2KeyBindings
[BUTTON_A
] = settings
.value("p2k_a", Qt::Key_C
).toInt();
1818 vjs
.p2KeyBindings
[BUTTON_OPTION
] = settings
.value("p2k_option", Qt::Key_Apostrophe
).toInt();
1819 vjs
.p2KeyBindings
[BUTTON_PAUSE
] = settings
.value("p2k_pause", Qt::Key_Return
).toInt();
1820 vjs
.p2KeyBindings
[BUTTON_0
] = settings
.value("p2k_0", Qt::Key_0
).toInt();
1821 vjs
.p2KeyBindings
[BUTTON_1
] = settings
.value("p2k_1", Qt::Key_1
).toInt();
1822 vjs
.p2KeyBindings
[BUTTON_2
] = settings
.value("p2k_2", Qt::Key_2
).toInt();
1823 vjs
.p2KeyBindings
[BUTTON_3
] = settings
.value("p2k_3", Qt::Key_3
).toInt();
1824 vjs
.p2KeyBindings
[BUTTON_4
] = settings
.value("p2k_4", Qt::Key_4
).toInt();
1825 vjs
.p2KeyBindings
[BUTTON_5
] = settings
.value("p2k_5", Qt::Key_5
).toInt();
1826 vjs
.p2KeyBindings
[BUTTON_6
] = settings
.value("p2k_6", Qt::Key_6
).toInt();
1827 vjs
.p2KeyBindings
[BUTTON_7
] = settings
.value("p2k_7", Qt::Key_7
).toInt();
1828 vjs
.p2KeyBindings
[BUTTON_8
] = settings
.value("p2k_8", Qt::Key_8
).toInt();
1829 vjs
.p2KeyBindings
[BUTTON_9
] = settings
.value("p2k_9", Qt::Key_9
).toInt();
1830 vjs
.p2KeyBindings
[BUTTON_d
] = settings
.value("p2k_pound", Qt::Key_Slash
).toInt();
1831 vjs
.p2KeyBindings
[BUTTON_s
] = settings
.value("p2k_star", Qt::Key_Asterisk
).toInt();
1834 WriteLog("Read setting = Done\n");
1836 ReadProfiles(&settings
);
1841 // Default values will be used in case of no settings can be found
1843 #pragma message("Warning: !!! Need to check the window geometry to see if the positions are legal !!!")
1845 #warning "!!! Need to check the window geometry to see if the positions are legal !!!"
1847 // i.e., someone could drag it to another screen, close it, then disconnect that screen
1848 void MainWin::ReadUISettings(void)
1855 // Point on the emulator settings
1856 QSettings
settings("Underground Software", "Virtual Jaguar");
1857 settings
.beginGroup("ui");
1859 // Emulator main window UI information
1860 mainWinPosition
= settings
.value("pos", QPoint(200, 200)).toPoint();
1861 size
= settings
.value("size", QSize(400, 400)).toSize();
1863 move(mainWinPosition
);
1864 pos
= settings
.value("cartLoadPos", QPoint(200, 200)).toPoint();
1865 filePickWin
->move(pos
);
1867 // Video output information
1868 zoomLevel
= settings
.value("zoom", 2).toInt();
1870 // Alpine debug UI information (also needed by the Debugger)
1871 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
1873 // CPU registers UI information
1874 pos
= settings
.value("cpuBrowseWinPos", QPoint(200, 200)).toPoint();
1875 cpuBrowseWin
->move(pos
);
1876 settings
.value("cpuBrowseWinIsVisible", false).toBool() ? ShowCPUBrowserWin() : void();
1878 // Memory browser UI information
1879 pos
= settings
.value("memBrowseWinPos", QPoint(200, 200)).toPoint();
1880 memBrowseWin
->move(pos
);
1881 settings
.value("memBrowseWinIsVisible", false).toBool() ? ShowMemoryBrowserWin() : void();
1883 // Stack browser UI information
1884 pos
= settings
.value("stackBrowseWinPos", QPoint(200, 200)).toPoint();
1885 stackBrowseWin
->move(pos
);
1886 settings
.value("stackBrowseWinIsVisible", false).toBool() ? ShowStackBrowserWin() : void();
1887 size
= settings
.value("stackBrowseWinSize", QSize(400, 400)).toSize();
1888 stackBrowseWin
->resize(size
);
1890 // Emulator status UI information
1891 pos
= settings
.value("emuStatusWinPos", QPoint(200, 200)).toPoint();
1892 emuStatusWin
->move(pos
);
1893 settings
.value("emuStatusWinIsVisible", false).toBool() ? ShowEmuStatusWin() : void();
1895 // OP (Object Processor) UI information
1896 pos
= settings
.value("opBrowseWinPos", QPoint(200, 200)).toPoint();
1897 opBrowseWin
->move(pos
);
1898 settings
.value("opBrowseWinIsVisible", false).toBool() ? ShowOPBrowserWin() : void();
1899 size
= settings
.value("opBrowseWinSize", QSize(400, 400)).toSize();
1900 opBrowseWin
->resize(size
);
1902 // RISC disassembly UI information
1903 pos
= settings
.value("riscDasmBrowseWinPos", QPoint(200, 200)).toPoint();
1904 riscDasmBrowseWin
->move(pos
);
1905 settings
.value("riscDasmBrowseWinIsVisible", false).toBool() ? ShowRISCDasmBrowserWin() : void();
1907 // M68k disassembly UI information
1908 pos
= settings
.value("m68kDasmBrowseWinPos", QPoint(200, 200)).toPoint();
1909 m68kDasmBrowseWin
->move(pos
);
1910 //settings.value("m68kDasmBrowseWinIsVisible", false).toBool() ? ShowM68KDasmBrowserWin() : void();
1912 #pragma message("Warning: !!! Need to check the M68k disassembly window position crashing !!!")
1914 #warning "!!! Need to check the M68k disassembly window position crashing !!!"
1918 // Debugger UI information
1919 if (vjs
.softTypeDebugger
)
1922 pos
= settings
.value("m68kDasmWinPos", QPoint(200, 200)).toPoint();
1923 m68kDasmWin
->move(pos
);
1924 //settings.value("m68kDasmWinIsVisible", false).toBool() ? m68kDasmWin->show() : m68kDasmWin->hide();
1925 pos
= settings
.value("GPUDasmWinPos", QPoint(200, 200)).toPoint();
1926 GPUDasmWin
->move(pos
);
1927 pos
= settings
.value("DSPDasmWinPos", QPoint(200, 200)).toPoint();
1928 DSPDasmWin
->move(pos
);
1930 // All watch browser UI information
1931 pos
= settings
.value("allWatchBrowseWinPos", QPoint(200, 200)).toPoint();
1932 allWatchBrowseWin
->move(pos
);
1933 settings
.value("allWatchBrowseWinIsVisible", false).toBool() ? ShowAllWatchBrowserWin() : void();
1934 size
= settings
.value("allWatchBrowseWinSize", QSize(400, 400)).toSize();
1935 allWatchBrowseWin
->resize(size
);
1937 // Local browser UI information
1938 pos
= settings
.value("LocalBrowseWinPos", QPoint(200, 200)).toPoint();
1939 LocalBrowseWin
->move(pos
);
1940 settings
.value("LocalBrowseWinIsVisible", false).toBool() ? ShowLocalBrowserWin() : void();
1941 size
= settings
.value("LocalBrowseWinSize", QSize(400, 400)).toSize();
1942 LocalBrowseWin
->resize(size
);
1944 // Heap memory allocation browser UI information
1945 pos
= settings
.value("heapallocatorBrowseWinPos", QPoint(200, 200)).toPoint();
1946 heapallocatorBrowseWin
->move(pos
);
1947 settings
.value("heapallocatorBrowseWinIsVisible", false).toBool() ? ShowHeapAllocatorBrowserWin() : void();
1948 size
= settings
.value("heapallocatorBrowseWinSize", QSize(400, 400)).toSize();
1949 heapallocatorBrowseWin
->resize(size
);
1951 // Exception Vector Table UI Information
1952 pos
= settings
.value("exceptionVectorTableBrowseWinPos", QPoint(200, 200)).toPoint();
1953 exceptionvectortableBrowseWin
->move(pos
);
1954 settings
.value("exceptionVectorTableBrowseWinIsVisible", false).toBool() ? ShowExceptionVectorTableBrowserWin() : void();
1955 size
= settings
.value("exceptionVectorTableBrowseWinSize", QSize(400, 400)).toSize();
1956 exceptionvectortableBrowseWin
->resize(size
);
1958 // Call Stack browser UI information
1959 pos
= settings
.value("CallStackBrowseWinPos", QPoint(200, 200)).toPoint();
1960 CallStackBrowseWin
->move(pos
);
1961 settings
.value("CallStackBrowseWinIsVisible", false).toBool() ? ShowCallStackBrowserWin() : void();
1962 size
= settings
.value("CallStackBrowseWinSize", QSize(400, 400)).toSize();
1963 CallStackBrowseWin
->resize(size
);
1965 // Memories browser UI information
1966 for (i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
1968 sprintf(mem1Name
, "mem1BrowseWinPos[%i]", (unsigned int)i
);
1969 pos
= settings
.value(mem1Name
, QPoint(200, 200)).toPoint();
1970 mem1BrowseWin
[i
]->move(pos
);
1971 sprintf(mem1Name
, "mem1BrowseWinIsVisible[%i]", (unsigned int)i
);
1972 settings
.value(mem1Name
, false).toBool() ? ShowMemory1BrowserWin((int)i
) : void();
1973 sprintf(mem1Name
, "mem1BrowseWinSize[%i]", (unsigned int)i
);
1974 size
= settings
.value(mem1Name
, QSize(400, 400)).toSize();
1975 mem1BrowseWin
[i
]->resize(size
);
1979 settings
.endGroup();
1981 WriteLog("Read UI setting = Done\n");
1985 // Save the settings
1986 void MainWin::WriteSettings(void)
1990 // Point on the emulator settings
1991 QSettings
settings("Underground Software", "Virtual Jaguar");
1992 //settings.setValue("pos", pos());
1993 //settings.setValue("size", size());
1994 //settings.setValue("cartLoadPos", filePickWin->pos());
1996 //settings.setValue("zoom", zoomLevel);
1997 settings
.setValue("showUnknownSoftware", allowUnknownSoftware
);
1998 settings
.setValue("lastEditedProfile", lastEditedProfile
);
2000 settings
.setValue("useJoystick", vjs
.useJoystick
);
2001 settings
.setValue("joyport", vjs
.joyport
);
2002 settings
.setValue("hardwareTypeNTSC", vjs
.hardwareTypeNTSC
);
2003 settings
.setValue("frameSkip", vjs
.frameSkip
);
2004 settings
.setValue("useJaguarBIOS", vjs
.useJaguarBIOS
);
2005 settings
.setValue("useRetailBIOS", vjs
.useRetailBIOS
);
2006 settings
.setValue("useDevBIOS", vjs
.useDevBIOS
);
2007 settings
.setValue("GPUEnabled", vjs
.GPUEnabled
);
2008 settings
.setValue("DSPEnabled", vjs
.DSPEnabled
);
2009 settings
.setValue("audioEnabled", vjs
.audioEnabled
);
2010 settings
.setValue("usePipelinedDSP", vjs
.usePipelinedDSP
);
2011 settings
.setValue("fullscreen", vjs
.fullscreen
);
2012 settings
.setValue("useOpenGL", vjs
.useOpenGL
);
2013 settings
.setValue("glFilterType", vjs
.glFilter
);
2014 settings
.setValue("renderType", vjs
.renderType
);
2015 settings
.setValue("jaguarModel", vjs
.jaguarModel
);
2016 settings
.setValue("biosType", vjs
.biosType
);
2017 settings
.setValue("useFastBlitter", vjs
.useFastBlitter
);
2018 settings
.setValue("JagBootROM", vjs
.jagBootPath
);
2019 settings
.setValue("CDBootROM", vjs
.CDBootPath
);
2020 settings
.setValue("EEPROMs", vjs
.EEPROMPath
);
2021 settings
.setValue("ROMs", vjs
.ROMPath
);
2022 settings
.setValue("Screenshots", vjs
.screenshotPath
);
2024 // Write settings from the Alpine mode
2025 settings
.beginGroup("alpine");
2026 settings
.setValue("refresh", vjs
.refresh
);
2027 settings
.setValue("DefaultROM", vjs
.alpineROMPath
);
2028 settings
.setValue("DefaultABS", vjs
.absROMPath
);
2029 settings
.setValue("writeROM", vjs
.allowWritesToROM
);
2030 settings
.endGroup();
2032 // Write settings from the Debugger mode
2033 settings
.beginGroup("debugger");
2034 settings
.setValue("DisplayHWLabels", vjs
.displayHWlabels
);
2035 settings
.setValue("NbrDisasmLines", vjs
.nbrdisasmlines
);
2036 settings
.setValue("DisasmOpcodes", vjs
.disasmopcodes
);
2037 settings
.setValue("displayFullSourceFilename", vjs
.displayFullSourceFilename
);
2038 settings
.setValue("NbrMemory1BrowserWindow", (unsigned int)vjs
.nbrmemory1browserwindow
);
2039 settings
.setValue("DefaultROM", vjs
.debuggerROMPath
);
2040 settings
.endGroup();
2042 // Write settings from the Keybindings
2043 settings
.beginGroup("keybindings");
2044 for (i
= 0; i
< KB_END
; i
++)
2046 settings
.setValue(KeyBindingsTable
[i
].KBNameSetting
, vjs
.KBContent
[i
].KBSettingValue
);
2048 settings
.endGroup();
2051 settings
.setValue("p1k_up", vjs
.p1KeyBindings
[BUTTON_U
]);
2052 settings
.setValue("p1k_down", vjs
.p1KeyBindings
[BUTTON_D
]);
2053 settings
.setValue("p1k_left", vjs
.p1KeyBindings
[BUTTON_L
]);
2054 settings
.setValue("p1k_right", vjs
.p1KeyBindings
[BUTTON_R
]);
2055 settings
.setValue("p1k_c", vjs
.p1KeyBindings
[BUTTON_C
]);
2056 settings
.setValue("p1k_b", vjs
.p1KeyBindings
[BUTTON_B
]);
2057 settings
.setValue("p1k_a", vjs
.p1KeyBindings
[BUTTON_A
]);
2058 settings
.setValue("p1k_option", vjs
.p1KeyBindings
[BUTTON_OPTION
]);
2059 settings
.setValue("p1k_pause", vjs
.p1KeyBindings
[BUTTON_PAUSE
]);
2060 settings
.setValue("p1k_0", vjs
.p1KeyBindings
[BUTTON_0
]);
2061 settings
.setValue("p1k_1", vjs
.p1KeyBindings
[BUTTON_1
]);
2062 settings
.setValue("p1k_2", vjs
.p1KeyBindings
[BUTTON_2
]);
2063 settings
.setValue("p1k_3", vjs
.p1KeyBindings
[BUTTON_3
]);
2064 settings
.setValue("p1k_4", vjs
.p1KeyBindings
[BUTTON_4
]);
2065 settings
.setValue("p1k_5", vjs
.p1KeyBindings
[BUTTON_5
]);
2066 settings
.setValue("p1k_6", vjs
.p1KeyBindings
[BUTTON_6
]);
2067 settings
.setValue("p1k_7", vjs
.p1KeyBindings
[BUTTON_7
]);
2068 settings
.setValue("p1k_8", vjs
.p1KeyBindings
[BUTTON_8
]);
2069 settings
.setValue("p1k_9", vjs
.p1KeyBindings
[BUTTON_9
]);
2070 settings
.setValue("p1k_pound", vjs
.p1KeyBindings
[BUTTON_d
]);
2071 settings
.setValue("p1k_star", vjs
.p1KeyBindings
[BUTTON_s
]);
2073 settings
.setValue("p2k_up", vjs
.p2KeyBindings
[BUTTON_U
]);
2074 settings
.setValue("p2k_down", vjs
.p2KeyBindings
[BUTTON_D
]);
2075 settings
.setValue("p2k_left", vjs
.p2KeyBindings
[BUTTON_L
]);
2076 settings
.setValue("p2k_right", vjs
.p2KeyBindings
[BUTTON_R
]);
2077 settings
.setValue("p2k_c", vjs
.p2KeyBindings
[BUTTON_C
]);
2078 settings
.setValue("p2k_b", vjs
.p2KeyBindings
[BUTTON_B
]);
2079 settings
.setValue("p2k_a", vjs
.p2KeyBindings
[BUTTON_A
]);
2080 settings
.setValue("p2k_option", vjs
.p2KeyBindings
[BUTTON_OPTION
]);
2081 settings
.setValue("p2k_pause", vjs
.p2KeyBindings
[BUTTON_PAUSE
]);
2082 settings
.setValue("p2k_0", vjs
.p2KeyBindings
[BUTTON_0
]);
2083 settings
.setValue("p2k_1", vjs
.p2KeyBindings
[BUTTON_1
]);
2084 settings
.setValue("p2k_2", vjs
.p2KeyBindings
[BUTTON_2
]);
2085 settings
.setValue("p2k_3", vjs
.p2KeyBindings
[BUTTON_3
]);
2086 settings
.setValue("p2k_4", vjs
.p2KeyBindings
[BUTTON_4
]);
2087 settings
.setValue("p2k_5", vjs
.p2KeyBindings
[BUTTON_5
]);
2088 settings
.setValue("p2k_6", vjs
.p2KeyBindings
[BUTTON_6
]);
2089 settings
.setValue("p2k_7", vjs
.p2KeyBindings
[BUTTON_7
]);
2090 settings
.setValue("p2k_8", vjs
.p2KeyBindings
[BUTTON_8
]);
2091 settings
.setValue("p2k_9", vjs
.p2KeyBindings
[BUTTON_9
]);
2092 settings
.setValue("p2k_pound", vjs
.p2KeyBindings
[BUTTON_d
]);
2093 settings
.setValue("p2k_star", vjs
.p2KeyBindings
[BUTTON_s
]);
2096 WriteProfiles(&settings
);
2100 // Save the UI settings
2101 void MainWin::WriteUISettings(void)
2106 // Point on the emulator settings
2107 QSettings
settings("Underground Software", "Virtual Jaguar");
2108 settings
.beginGroup("ui");
2110 // Emulator UI information
2111 settings
.setValue("pos", pos());
2112 settings
.setValue("size", size());
2113 settings
.setValue("cartLoadPos", filePickWin
->pos());
2115 // Video output information
2116 settings
.setValue("zoom", zoomLevel
);
2118 // Alpine debug UI information (also needed by the Debugger)
2119 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
2121 settings
.setValue("cpuBrowseWinPos", cpuBrowseWin
->pos());
2122 settings
.setValue("cpuBrowseWinIsVisible", cpuBrowseWin
->isVisible());
2123 settings
.setValue("memBrowseWinPos", memBrowseWin
->pos());
2124 settings
.setValue("memBrowseWinIsVisible", memBrowseWin
->isVisible());
2125 settings
.setValue("stackBrowseWinPos", stackBrowseWin
->pos());
2126 settings
.setValue("stackBrowseWinIsVisible", stackBrowseWin
->isVisible());
2127 settings
.setValue("stackBrowseWinSize", stackBrowseWin
->size());
2128 settings
.setValue("emuStatusWinPos", emuStatusWin
->pos());
2129 settings
.setValue("emuStatusWinIsVisible", emuStatusWin
->isVisible());
2130 settings
.setValue("opBrowseWinPos", opBrowseWin
->pos());
2131 settings
.setValue("opBrowseWinIsVisible", opBrowseWin
->isVisible());
2132 settings
.setValue("opBrowseWinSize", opBrowseWin
->size());
2133 settings
.setValue("riscDasmBrowseWinPos", riscDasmBrowseWin
->pos());
2134 settings
.setValue("riscDasmBrowseWinIsVisible", riscDasmBrowseWin
->isVisible());
2135 settings
.setValue("m68kDasmBrowseWinPos", m68kDasmBrowseWin
->pos());
2136 settings
.setValue("m68kDasmBrowseWinIsVisible", m68kDasmBrowseWin
->isVisible());
2139 // Debugger UI information
2140 if (vjs
.softTypeDebugger
)
2143 settings
.setValue("m68kDasmWinPos", m68kDasmWin
->pos());
2144 //settings.setValue("m68kDasmWinIsVisible", m68kDasmWin->isVisible());
2145 settings
.setValue("GPUDasmWinPos", GPUDasmWin
->pos());
2146 settings
.setValue("DSPDasmWinPos", DSPDasmWin
->pos());
2148 settings
.setValue("allWatchBrowseWinPos", allWatchBrowseWin
->pos());
2149 settings
.setValue("allWatchBrowseWinIsVisible", allWatchBrowseWin
->isVisible());
2150 settings
.setValue("allWatchBrowseWinSize", allWatchBrowseWin
->size());
2151 settings
.setValue("LocalBrowseWinPos", LocalBrowseWin
->pos());
2152 settings
.setValue("LocalBrowseWinIsVisible", LocalBrowseWin
->isVisible());
2153 settings
.setValue("LocalBrowseWinSize", LocalBrowseWin
->size());
2154 settings
.setValue("heapallocatorBrowseWinPos", heapallocatorBrowseWin
->pos());
2155 settings
.setValue("heapallocatorBrowseWinIsVisible", heapallocatorBrowseWin
->isVisible());
2156 settings
.setValue("heapallocatorBrowseWinSize", heapallocatorBrowseWin
->size());
2157 settings
.setValue("exceptionVectorTableBrowseWinPos", exceptionvectortableBrowseWin
->pos());
2158 settings
.setValue("exceptionVectorTableBrowseWinIsVisible", exceptionvectortableBrowseWin
->isVisible());
2159 settings
.setValue("exceptionVectorTableBrowseWinSize", exceptionvectortableBrowseWin
->size());
2160 settings
.setValue("CallStackBrowseWinPos", CallStackBrowseWin
->pos());
2161 settings
.setValue("CallStackBrowseWinIsVisible", CallStackBrowseWin
->isVisible());
2162 settings
.setValue("CallStackBrowseWinSize", CallStackBrowseWin
->size());
2163 for (i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
2165 sprintf(mem1Name
, "mem1BrowseWinPos[%i]", (unsigned int)i
);
2166 settings
.setValue(mem1Name
, mem1BrowseWin
[i
]->pos());
2167 sprintf(mem1Name
, "mem1BrowseWinIsVisible[%i]", (unsigned int)i
);
2168 settings
.setValue(mem1Name
, mem1BrowseWin
[i
]->isVisible());
2169 sprintf(mem1Name
, "mem1BrowseWinSize[%i]", (unsigned int)i
);
2170 settings
.setValue(mem1Name
, mem1BrowseWin
[i
]->size());
2174 settings
.endGroup();
2178 // Refresh alpine debug windows
2179 void MainWin::RefreshAlpineWindows(void)
2181 cpuBrowseWin
->RefreshContents();
2182 memBrowseWin
->RefreshContents();
2183 stackBrowseWin
->RefreshContents();
2184 emuStatusWin
->RefreshContents();
2185 opBrowseWin
->RefreshContents();
2186 riscDasmBrowseWin
->RefreshContents();
2187 m68kDasmBrowseWin
->RefreshContents();
2191 // Reset soft debugger windows
2192 void MainWin::DebuggerResetWindows(void)
2194 if (vjs
.softTypeDebugger
)
2196 allWatchBrowseWin
->Reset();
2197 heapallocatorBrowseWin
->Reset();
2199 //ResetAlpineWindows();
2204 // Refresh soft debugger & alpine debug windows
2205 void MainWin::DebuggerRefreshWindows(void)
2209 if (vjs
.softTypeDebugger
)
2211 m68kDasmWin
->RefreshContents();
2212 GPUDasmWin
->RefreshContents();
2213 DSPDasmWin
->RefreshContents();
2214 allWatchBrowseWin
->RefreshContents();
2215 LocalBrowseWin
->RefreshContents();
2216 CallStackBrowseWin
->RefreshContents();
2217 heapallocatorBrowseWin
->RefreshContents();
2218 for (i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
2220 mem1BrowseWin
[i
]->RefreshContents(i
);
2223 RefreshAlpineWindows();
2228 // Create and save screenshot
2229 void MainWin::MakeScreenshot(void)
2233 time_t now
= time(0);
2237 tstruct
= *localtime(&now
);
2238 sprintf(Text
, "%svj_%i%i%i_%i%i%i.jpg", vjs
.screenshotPath
, tstruct
.tm_year
, tstruct
.tm_mon
, tstruct
.tm_mday
, tstruct
.tm_hour
, tstruct
.tm_min
, tstruct
.tm_sec
);
2240 // Create screenshot
2241 screenshot
= videoWidget
->grabFrameBuffer();
2242 screenshot
.save(Text
, "JPG", 100);