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 June/2016 Visual Studio support & Soft debugger integration
15 // JPM 01/11/2017 Added stack browser
16 // JPM Feb./2017 Added GPU/DSP disassembly
17 // JPM 07/12/2017 Added all Watch window
18 // JPM Aug./2017 Added heap allocator and memories window, a restart feature, and a [Not Supported] breakpoints window
19 // JPM Sept./2017 Save position, size & visibility windows status in the settings; added Exception Vector Table window, the 'Rx' word to the emulator window name, and the keybindings in the settings
20 // JPM 11/04/2017 Added the local window
21 // JPM 08/31/2018 Added the call stack window
22 // JPM Sept./2018 Added the new Models and BIOS handler, a screenshot feature and source code files browsing
23 // JPM Oct./2018 Added search paths in the settings, breakpoints feature
28 // - Add dbl click/enter to select in cart list, ESC to dimiss [DONE]
29 // - Autoscan/autoload all available BIOS from 'software' folder [DONE]
30 // - Add 1 key jumping in cartridge list (press 'R', jumps to carts starting
31 // with 'R', etc) [DONE]
32 // - Controller configuration [DONE]
36 // - Fix bug in switching between PAL & NTSC in fullscreen mode.
37 // - Remove SDL dependencies (sound, mainly) from Jaguar core lib
38 // - Fix inconsistency with trailing slashes in paths (eeproms needs one,
41 // SFDX CODE: S1E9T8H5M23YS
43 // Uncomment this for debugging...
45 //#define DEBUGFOO // Various tool debugging... but not used
46 //#define DEBUGTP // Toolpalette debugging... but not used
53 #include "configdialog.h"
54 #include "controllertab.h"
55 #include "keybindingstab.h"
56 #include "filepicker.h"
58 #include "generaltab.h"
64 #include "emustatus.h"
65 #include "debug/cpubrowser.h"
66 #include "debug/m68kdasmbrowser.h"
67 #include "debug/memorybrowser.h"
68 #include "debug/stackbrowser.h"
69 #include "debug/opbrowser.h"
70 #include "debug/riscdasmbrowser.h"
76 #ifndef NEWMODELSBIOSHANDLER
79 #include "jagstub2bios.h"
81 #include "modelsBIOS.h"
83 #include "jagcdbios.h"
85 #include "m68000/m68kinterface.h"
87 #include "debugger/DBGManager.h"
88 //#include "debugger/VideoWin.h"
89 //#include "debugger/DasmWin.h"
90 #include "debugger/m68KDasmWin.h"
91 #include "debugger/GPUDasmWin.h"
92 #include "debugger/DSPDasmWin.h"
93 #include "debugger/memory1browser.h"
94 #include "debugger/BreakpointsWin.h"
95 #include "debugger/NewFnctBreakpointWin.h"
96 #include "debugger/FilesrcListWin.h"
97 #include "debugger/exceptionvectortablebrowser.h"
98 #include "debugger/allwatchbrowser.h"
99 #include "debugger/localbrowser.h"
100 #include "debugger/heapallocatorbrowser.h"
101 #include "debugger/callstackbrowser.h"
104 // According to SebRmv, this header isn't seen on Arch Linux either... :-/
105 //#ifdef __GCCWIN32__
106 // Apparently on win32, usleep() is not pulled in by the usual suspects.
110 #include "_MSC_VER/unistd.h"
114 // The way BSNES controls things is by setting a timer with a zero
115 // timeout, sleeping if not emulating anything. Seems there has to be a
118 // It has a novel approach to plugging-in/using different video/audio/input
119 // methods, can we do something similar or should we just use the built-in
122 // We're going to try to use the built-in OpenGL support and see how it goes.
123 // We'll make the VJ core modular so that it doesn't matter what GUI is in
124 // use, we can drop it in anywhere and use it as-is.
126 MainWin::MainWin(bool autoRun
): running(true), powerButtonOn(false),
127 showUntunedTankCircuit(true), cartridgeLoaded(false), CDActive(false),
128 pauseForFileSelector(false), loadAndGo(autoRun
), scannedSoftwareFolder(false), plzDontKillMyComputer(false)
134 for(int i
=0; i
<8; i
++)
138 for(int i
=0; i
<RING_BUFFER_SIZE
; i
++)
141 ringBufferPointer
= RING_BUFFER_SIZE
- 1;
144 //if (vjs.softTypeDebugger)
146 // mainWindowCentrale = new QMdiArea;
147 // setCentralWidget(mainWindowCentrale);
150 WriteLog("Window creation start\n");
153 videoWidget
= new GLWidget(this);
154 videoWidget
->setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
156 // set central output window
157 if (!vjs
.softTypeDebugger
)
159 setCentralWidget(videoWidget
);
163 mainWindowCentrale
= new QMdiArea(this);
164 setCentralWidget(mainWindowCentrale
);
167 setWindowIcon(QIcon(":/res/vj-icon.png"));
169 QString title
= QString(tr("Virtual Jaguar " VJ_RELEASE_VERSION
" Rx"));
171 if (vjs
.hardwareTypeAlpine
)
172 title
+= QString(tr(" - Alpine Mode"));
174 if (vjs
.softTypeDebugger
)
175 title
+= QString(tr(" - Debugger Mode"));
177 setWindowTitle(title
);
179 aboutWin
= new AboutWindow(this);
180 helpWin
= new HelpWindow(this);
181 filePickWin
= new FilePickerWindow(this);
182 memBrowseWin
= new MemoryBrowserWindow(this);
183 stackBrowseWin
= new StackBrowserWindow(this);
184 emuStatusWin
= new EmuStatusWindow(this);
185 cpuBrowseWin
= new CPUBrowserWindow(this);
186 opBrowseWin
= new OPBrowserWindow(this);
187 m68kDasmBrowseWin
= new M68KDasmBrowserWindow(this);
188 riscDasmBrowseWin
= new RISCDasmBrowserWindow(this);
189 if (vjs
.softTypeDebugger
)
191 //VideoOutputWin = new VideoOutputWindow(this);
192 //VideoOutputWin->setCentralWidget()
193 //DasmWin = new DasmWindow();
194 //DasmWin = new DasmWindow(this);
195 allWatchBrowseWin
= new AllWatchBrowserWindow(this);
196 LocalBrowseWin
= new LocalBrowserWindow(this);
197 heapallocatorBrowseWin
= new HeapAllocatorBrowserWindow(this);
198 BreakpointsWin
= new BreakpointsWindow(this);
199 NewFunctionBreakpointWin
= new NewFnctBreakpointWindow(this);
200 exceptionvectortableBrowseWin
= new ExceptionVectorTableBrowserWindow(this);
201 CallStackBrowseWin
= new CallStackBrowserWindow(this);
203 mem1BrowseWin
= (Memory1BrowserWindow
**)calloc(vjs
.nbrmemory1browserwindow
, sizeof(Memory1BrowserWindow
));
205 #pragma message("Warning: !!! Need to do the memory desalocation for mem1BrowseWin !!!")
207 #warning "!!! Need to do the memory desalocation for mem1BrowseWin !!!"
209 for (size_t i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
211 mem1BrowseWin
[i
] = new Memory1BrowserWindow(this);
214 // Setup dock to display source code filenames tree
215 QDockWidget
*dockFiles
= new QDockWidget(tr("Files"), this);
216 dockFiles
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
218 addDockWidget(Qt::LeftDockWidgetArea
, dockFiles
);
219 mainWindowCentrale
->addAction(dockFiles
->toggleViewAction());
220 dockFiles
->setWidget(FilesrcListWin
= new FilesrcListWindow(this));
222 // Setup dock to display disassembly
223 QDockWidget
*dockDisasm
= new QDockWidget(tr("Disassembly"), this);
224 dockDisasm
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
225 addDockWidget(Qt::RightDockWidgetArea
, dockDisasm
);
226 mainWindowCentrale
->addAction(dockDisasm
->toggleViewAction());
227 dockDisasm
->setWidget(dasmtabWidget
= new QTabWidget(this));
229 dasmtabWidget
= new QTabWidget(this);
232 dasmtabWidget
->setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
233 dasmtabWidget
->addTab(m68kDasmWin
= new m68KDasmWindow(this), tr("M68000"));
234 dasmtabWidget
->addTab(GPUDasmWin
= new GPUDasmWindow(this), tr("GPU"));
235 dasmtabWidget
->addTab(DSPDasmWin
= new DSPDasmWindow(this), tr("DSP"));
237 setCentralWidget(dasmtabWidget
);
241 // videoWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
242 setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
244 setUnifiedTitleAndToolBarOnMac(true);
247 quitAppAct
= new QAction(QIcon(":/res/exit.png"), tr("E&xit"), this);
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()));
254 powerGreen
.addFile(":/res/power-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
255 powerGreen
.addFile(":/res/power-on-green.png", QSize(), QIcon::Normal
, QIcon::On
);
256 powerRed
.addFile(":/res/power-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
257 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(vjs
.KBContent
[KBPAUSE
].KBSettingValue
)));
273 pauseAct
->setShortcutContext(Qt::ApplicationShortcut
);
274 connect(pauseAct
, SIGNAL(triggered()), this, SLOT(ToggleRunState()));
277 screenshotAct
= new QAction(QIcon(":/res/screenshot.png"), tr("&Screenshot"), this);
278 screenshotAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBSCREENSHOT
].KBSettingValue
)));
279 screenshotAct
->setShortcutContext(Qt::ApplicationShortcut
);
280 screenshotAct
->setCheckable(false);
281 screenshotAct
->setDisabled(false);
282 connect(screenshotAct
, SIGNAL(triggered()), this, SLOT(MakeScreenshot()));
285 zoomActs
= new QActionGroup(this);
286 x1Act
= new QAction(QIcon(":/res/zoom100.png"), tr("Zoom 100%"), zoomActs
);
287 x1Act
->setStatusTip(tr("Set window zoom to 100%"));
288 x1Act
->setCheckable(true);
289 connect(x1Act
, SIGNAL(triggered()), this, SLOT(SetZoom100()));
290 x2Act
= new QAction(QIcon(":/res/zoom200.png"), tr("Zoom 200%"), zoomActs
);
291 x2Act
->setStatusTip(tr("Set window zoom to 200%"));
292 x2Act
->setCheckable(true);
293 connect(x2Act
, SIGNAL(triggered()), this, SLOT(SetZoom200()));
294 x3Act
= new QAction(QIcon(":/res/zoom300.png"), tr("Zoom 300%"), zoomActs
);
295 x3Act
->setStatusTip(tr("Set window zoom to 300%"));
296 x3Act
->setCheckable(true);
297 connect(x3Act
, SIGNAL(triggered()), this, SLOT(SetZoom300()));
300 tvTypeActs
= new QActionGroup(this);
301 ntscAct
= new QAction(QIcon(":/res/ntsc.png"), tr("NTSC"), tvTypeActs
);
302 ntscAct
->setStatusTip(tr("Sets Jaguar to NTSC mode"));
303 ntscAct
->setCheckable(true);
304 connect(ntscAct
, SIGNAL(triggered()), this, SLOT(SetNTSC()));
305 palAct
= new QAction(QIcon(":/res/pal.png"), tr("PAL"), tvTypeActs
);
306 palAct
->setStatusTip(tr("Sets Jaguar to PAL mode"));
307 palAct
->setCheckable(true);
308 connect(palAct
, SIGNAL(triggered()), this, SLOT(SetPAL()));
311 blur
.addFile(":/res/blur-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
312 blur
.addFile(":/res/blur-on.png", QSize(), QIcon::Normal
, QIcon::On
);
313 blurAct
= new QAction(blur
, tr("Blur"), this);
314 blurAct
->setStatusTip(tr("Sets OpenGL rendering to GL_NEAREST"));
315 blurAct
->setCheckable(true);
316 connect(blurAct
, SIGNAL(triggered()), this, SLOT(ToggleBlur()));
319 aboutAct
= new QAction(QIcon(":/res/vj-icon.png"), tr("&About..."), this);
320 aboutAct
->setStatusTip(tr("Blatant self-promotion"));
321 connect(aboutAct
, SIGNAL(triggered()), this, SLOT(ShowAboutWin()));
324 helpAct
= new QAction(QIcon(":/res/vj-icon.png"), tr("&Contents..."), this);
325 helpAct
->setStatusTip(tr("Help is available, if you should need it"));
326 connect(helpAct
, SIGNAL(triggered()), this, SLOT(ShowHelpWin()));
328 // File pickup action
329 if (!vjs
.softTypeDebugger
)
331 filePickAct
= new QAction(QIcon(":/res/software.png"), tr("&Insert Cartridge..."), this);
332 filePickAct
->setStatusTip(tr("Insert a cartridge into Virtual Jaguar"));
336 filePickAct
= new QAction(QIcon(":/res/software.png"), tr("&Insert executable file..."), this);
337 filePickAct
->setStatusTip(tr("Insert an executable into Virtual Jaguar"));
339 filePickAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBPICKFILE
].KBSettingValue
)));
340 filePickAct
->setShortcutContext(Qt::ApplicationShortcut
);
341 connect(filePickAct
, SIGNAL(triggered()), this, SLOT(InsertCart()));
343 // Configuration action
344 configAct
= new QAction(QIcon(":/res/wrench.png"), tr("&Configure"), this);
345 configAct
->setStatusTip(tr("Configure options for Virtual Jaguar"));
346 configAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBCONFIGURE
].KBSettingValue
)));
347 configAct
->setShortcutContext(Qt::ApplicationShortcut
);
348 connect(configAct
, SIGNAL(triggered()), this, SLOT(Configure()));
350 // Emulation status action
351 emustatusAct
= new QAction(QIcon(":/res/status.png"), tr("&Status"), this);
352 emustatusAct
->setStatusTip(tr("Emulator status"));
353 emustatusAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBEMUSTATUS
].KBSettingValue
)));
354 emustatusAct
->setShortcutContext(Qt::ApplicationShortcut
);
355 connect(emustatusAct
, SIGNAL(triggered()), this, SLOT(ShowEmuStatusWin()));
358 useCDAct
= new QAction(QIcon(":/res/compact-disc.png"), tr("&Use CD Unit"), this);
359 useCDAct
->setStatusTip(tr("Use Jaguar Virtual CD unit"));
360 useCDAct
->setCheckable(true);
361 connect(useCDAct
, SIGNAL(triggered()), this, SLOT(ToggleCDUsage()));
363 // Frame advance action
364 frameAdvanceAct
= new QAction(QIcon(":/res/frame-advance.png"), tr("&Frame Advance"), this);
365 frameAdvanceAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBFRAMEADVANCE
].KBSettingValue
)));
366 frameAdvanceAct
->setShortcutContext(Qt::ApplicationShortcut
);
367 frameAdvanceAct
->setDisabled(true);
368 connect(frameAdvanceAct
, SIGNAL(triggered()), this, SLOT(FrameAdvance()));
371 fullScreenAct
= new QAction(QIcon(":/res/fullscreen.png"), tr("F&ull Screen"), this);
372 fullScreenAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBFULLSCREEN
].KBSettingValue
)));
373 fullScreenAct
->setShortcutContext(Qt::ApplicationShortcut
);
374 fullScreenAct
->setCheckable(true);
375 connect(fullScreenAct
, SIGNAL(triggered()), this, SLOT(ToggleFullScreen()));
377 // Actions dedicated to debugger mode
378 if (vjs
.softTypeDebugger
)
381 restartAct
= new QAction(QIcon(":/res/debug-restart.png"), tr("&Restart"), this);
382 restartAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBRESTART
].KBSettingValue
)));
383 restartAct
->setShortcutContext(Qt::ApplicationShortcut
);
384 restartAct
->setCheckable(false);
385 restartAct
->setDisabled(true);
386 connect(restartAct
, SIGNAL(triggered()), this, SLOT(DebuggerRestart()));
389 traceStepOverAct
= new QAction(QIcon(":/res/debug-stepover.png"), tr("&Step Over"), this);
390 traceStepOverAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBSTEPOVER
].KBSettingValue
)));
391 traceStepOverAct
->setShortcutContext(Qt::ApplicationShortcut
);
392 traceStepOverAct
->setCheckable(false);
393 traceStepOverAct
->setDisabled(true);
394 connect(traceStepOverAct
, SIGNAL(triggered()), this, SLOT(DebuggerTraceStepOver()));
396 // Trace into tracing
397 traceStepIntoAct
= new QAction(QIcon(":/res/debug-stepinto.png"), tr("&Step Into"), this);
398 traceStepIntoAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBSTEPINTO
].KBSettingValue
)));
399 traceStepIntoAct
->setShortcutContext(Qt::ApplicationShortcut
);
400 traceStepIntoAct
->setCheckable(false);
401 traceStepIntoAct
->setDisabled(true);
402 connect(traceStepIntoAct
, SIGNAL(triggered()), this, SLOT(DebuggerTraceStepInto()));
404 // Function breakpoint
405 newFunctionBreakpointAct
= new QAction(QIcon(""), tr("&Function Breakpoint"), this);
406 newFunctionBreakpointAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBFUNCTIONBREAKPOINT
].KBSettingValue
)));
407 connect(newFunctionBreakpointAct
, SIGNAL(triggered()), this, SLOT(ShowNewFunctionBreakpointWin()));
408 BreakpointsAct
= new QAction(QIcon(":/res/debug-breakpoints.png"), tr("&Breakpoints"), this);
409 BreakpointsAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBBREAKPOINTS
].KBSettingValue
)));
410 connect(BreakpointsAct
, SIGNAL(triggered()), this, SLOT(ShowBreakpointsWin()));
411 deleteAllBreakpointsAct
= new QAction(QIcon(":/res/debug-deleteallbreakpoints.png"), tr("&Delete All Breakpoints"), this);
412 deleteAllBreakpointsAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBDELETEALLBREAKPOINTS
].KBSettingValue
)));
413 connect(deleteAllBreakpointsAct
, SIGNAL(triggered()), this, SLOT(DeleteAllBreakpoints()));
414 disableAllBreakpointsAct
= new QAction(QIcon(":/res/debug-disableallbreakpoints.png"), tr("&Disable All Breakpoints"), this);
415 connect(disableAllBreakpointsAct
, SIGNAL(triggered()), this, SLOT(DisableAllBreakpoints()));
417 //VideoOutputAct = new QAction(tr("Output Video"), this);
418 //VideoOutputAct->setStatusTip(tr("Shows the output video window"));
419 //connect(VideoOutputAct, SIGNAL(triggered()), this, SLOT(ShowVideoOutputWin()));
421 //DasmAct = new QAction(tr("Disassembly"), this);
422 //DasmAct->setStatusTip(tr("Shows the disassembly window"));
423 //connect(DasmAct, SIGNAL(triggered()), this, SLOT(ShowDasmWin()));
425 // Exception vector table window
426 exceptionVectorTableBrowseAct
= new QAction(QIcon(""), tr("Exception Vector Table"), this);
427 exceptionVectorTableBrowseAct
->setStatusTip(tr("Shows all Exception Vector Table browser window"));
428 connect(exceptionVectorTableBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowExceptionVectorTableBrowserWin()));
430 // All watch variables window
431 allWatchBrowseAct
= new QAction(QIcon(":/res/debug-watch.png"), tr("All Watch"), this);
432 allWatchBrowseAct
->setStatusTip(tr("Shows all Watch browser window"));
433 connect(allWatchBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowAllWatchBrowserWin()));
435 // Local variables window
436 LocalBrowseAct
= new QAction(QIcon(":/res/debug-local.png"), tr("Locals"), this);
437 LocalBrowseAct
->setStatusTip(tr("Shows Locals browser window"));
438 connect(LocalBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowLocalBrowserWin()));
440 // Heap (memory) allocation window
441 heapallocatorBrowseAct
= new QAction(QIcon(""), tr("Heap allocator"), this);
442 heapallocatorBrowseAct
->setStatusTip(tr("Shows the heap allocator browser window"));
443 connect(heapallocatorBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowHeapAllocatorBrowserWin()));
446 CallStackBrowseAct
= new QAction(QIcon(":/res/debug-callstack.png"), tr("Call Stack"), this);
447 CallStackBrowseAct
->setStatusTip(tr("Shows Call Stack browser window"));
448 connect(CallStackBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowCallStackBrowserWin()));
451 mem1BrowseAct
= (QAction
**)calloc(vjs
.nbrmemory1browserwindow
, sizeof(QAction
));
452 QSignalMapper
*signalMapper
= new QSignalMapper(this);
454 #pragma message("Warning: !!! Need to do the memory desalocation for mem1BrowseAct !!!")
456 #warning "!!! Need to do the memory desalocation for mem1BrowseAct !!!"
458 for (int i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
461 sprintf(MB
, "Memory %i", (unsigned int)(i
+1));
462 mem1BrowseAct
[i
] = new QAction(QIcon(":/res/debug-memory.png"), tr(MB
), this);
463 mem1BrowseAct
[i
]->setStatusTip(tr("Shows a Jaguar memory browser window"));
464 connect(mem1BrowseAct
[i
], SIGNAL(triggered()), signalMapper
, SLOT(map()));
465 signalMapper
->setMapping(mem1BrowseAct
[i
], (int)i
);
466 connect(signalMapper
, SIGNAL(mapped(int)), this, SLOT(ShowMemory1BrowserWin(int)));
470 // Memory browser window action
471 memBrowseAct
= new QAction(QIcon(":/res/tool-memory.png"), tr("Memory Browser"), this);
472 memBrowseAct
->setStatusTip(tr("Shows the Jaguar memory browser window"));
473 connect(memBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowMemoryBrowserWin()));
475 // Stack browser window action
476 stackBrowseAct
= new QAction(QIcon(":/res/tool-stack.png"), tr("Stack Browser"), this);
477 stackBrowseAct
->setStatusTip(tr("Shows the Jaguar stack browser window"));
478 connect(stackBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowStackBrowserWin()));
480 // CPUs (M68000, GPU & DSP browser window action
481 cpuBrowseAct
= new QAction(QIcon(":/res/tool-cpu.png"), tr("CPU Browser"), this);
482 cpuBrowseAct
->setStatusTip(tr("Shows the Jaguar CPU browser window"));
483 connect(cpuBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowCPUBrowserWin()));
485 // OP browser window action
486 opBrowseAct
= new QAction(QIcon(":/res/tool-op.png"), tr("OP Browser"), this);
487 opBrowseAct
->setStatusTip(tr("Shows the Jaguar OP browser window"));
488 connect(opBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowOPBrowserWin()));
490 // M68000 disassembly browser window
491 m68kDasmBrowseAct
= new QAction(QIcon(":/res/tool-68k-dis.png"), tr("68K Listing Browser"), this);
492 m68kDasmBrowseAct
->setStatusTip(tr("Shows the 68K disassembly browser window"));
493 connect(m68kDasmBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowM68KDasmBrowserWin()));
495 // Risc (DSP / GPU) disassembly browser window
496 riscDasmBrowseAct
= new QAction(QIcon(":/res/tool-risc-dis.png"), tr("RISC Listing Browser"), this);
497 riscDasmBrowseAct
->setStatusTip(tr("Shows the RISC disassembly browser window"));
498 connect(riscDasmBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowRISCDasmBrowserWin()));
500 // Misc. connections...
501 connect(filePickWin
, SIGNAL(RequestLoad(QString
)), this, SLOT(LoadSoftware(QString
)));
502 connect(filePickWin
, SIGNAL(FilePickerHiding()), this, SLOT(Unpause()));
506 fileMenu
= menuBar()->addMenu(tr("&Jaguar"));
507 fileMenu
->addAction(powerAct
);
508 if (!vjs
.softTypeDebugger
)
510 fileMenu
->addAction(pauseAct
);
511 // fileMenu->addAction(frameAdvanceAct);
513 fileMenu
->addAction(filePickAct
);
514 fileMenu
->addAction(useCDAct
);
515 fileMenu
->addAction(configAct
);
516 fileMenu
->addAction(emustatusAct
);
517 fileMenu
->addSeparator();
518 fileMenu
->addAction(quitAppAct
);
520 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
522 debugMenu
= menuBar()->addMenu(tr("&Debug"));
523 if (vjs
.softTypeDebugger
)
525 debugWindowsMenu
= debugMenu
->addMenu(tr("&Windows"));
526 debugWindowsMenu
->addAction(BreakpointsAct
);
527 debugWindowExceptionMenu
= debugWindowsMenu
->addMenu(tr("&Exception"));
528 debugWindowExceptionMenu
->addAction(exceptionVectorTableBrowseAct
);
529 debugWindowsMenu
->addSeparator();
531 debugWindowOutputMenu
= debugWindowsMenu
->addMenu(tr("&Output"));
532 debugWindowOutputMenu
->addAction(VideoOutputAct
);
533 debugWindowsMenu
->addSeparator();
535 debugWindowsWatchMenu
= debugWindowsMenu
->addMenu(tr("&Watch"));
536 debugWindowsWatchMenu
->addAction(allWatchBrowseAct
);
537 debugWindowsMenu
->addAction(LocalBrowseAct
);
538 debugWindowsMenu
->addSeparator();
539 debugWindowsMenu
->addAction(CallStackBrowseAct
);
540 debugWindowsMenu
->addSeparator();
541 debugWindowsMemoryMenu
= debugWindowsMenu
->addMenu(tr("&Memory"));
542 debugWindowsMemoryMenu
->addAction(heapallocatorBrowseAct
);
543 debugWindowsMemoryMenu
->addSeparator();
544 for (int i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
546 debugWindowsMemoryMenu
->addAction(mem1BrowseAct
[i
]);
548 debugWindowsMenu
->addSeparator();
549 debugWindowsBrowsesMenu
= debugWindowsMenu
->addMenu(tr("&Browsers"));
550 debugWindowsBrowsesMenu
->addAction(memBrowseAct
);
551 debugWindowsBrowsesMenu
->addAction(stackBrowseAct
);
552 debugWindowsBrowsesMenu
->addAction(cpuBrowseAct
);
553 debugWindowsBrowsesMenu
->addAction(opBrowseAct
);
554 debugWindowsBrowsesMenu
->addAction(m68kDasmBrowseAct
);
555 debugWindowsBrowsesMenu
->addAction(riscDasmBrowseAct
);
556 debugMenu
->addSeparator();
557 debugMenu
->addAction(pauseAct
);
558 debugMenu
->addAction(frameAdvanceAct
);
559 debugMenu
->addAction(restartAct
);
560 debugMenu
->addSeparator();
561 debugMenu
->addAction(traceStepIntoAct
);
562 debugMenu
->addAction(traceStepOverAct
);
563 debugMenu
->addSeparator();
564 debugNewBreakpointMenu
= debugMenu
->addMenu(tr("&New Breakpoint"));
565 debugNewBreakpointMenu
->addAction(newFunctionBreakpointAct
);
566 debugMenu
->addAction(deleteAllBreakpointsAct
);
567 debugMenu
->addAction(disableAllBreakpointsAct
);
568 //debugMenu->addSeparator();
569 //debugMenu->addAction(DasmAct);
573 debugMenu
->addAction(memBrowseAct
);
574 debugMenu
->addAction(stackBrowseAct
);
575 debugMenu
->addAction(cpuBrowseAct
);
576 debugMenu
->addAction(opBrowseAct
);
577 debugMenu
->addAction(m68kDasmBrowseAct
);
578 debugMenu
->addAction(riscDasmBrowseAct
);
583 helpMenu
= menuBar()->addMenu(tr("&Help"));
584 helpMenu
->addAction(helpAct
);
585 helpMenu
->addAction(aboutAct
);
589 toolbar
= addToolBar(tr("System"));
590 toolbar
->addAction(powerAct
);
591 if (!vjs
.softTypeDebugger
)
593 toolbar
->addAction(pauseAct
);
594 toolbar
->addAction(frameAdvanceAct
);
596 toolbar
->addAction(filePickAct
);
597 toolbar
->addAction(useCDAct
);
598 toolbar
->addSeparator();
599 if (!vjs
.softTypeDebugger
)
601 toolbar
->addAction(screenshotAct
);
602 toolbar
->addSeparator();
603 toolbar
->addAction(x1Act
);
604 toolbar
->addAction(x2Act
);
605 toolbar
->addAction(x3Act
);
606 toolbar
->addSeparator();
607 toolbar
->addAction(ntscAct
);
608 toolbar
->addAction(palAct
);
609 toolbar
->addSeparator();
610 toolbar
->addAction(blurAct
);
611 toolbar
->addAction(fullScreenAct
);
615 debuggerbar
= addToolBar(tr("&Debugger"));
616 debuggerbar
->addAction(pauseAct
);
617 debuggerbar
->addAction(frameAdvanceAct
);
618 debuggerbar
->addAction(restartAct
);
619 debuggerbar
->addSeparator();
620 debuggerbar
->addAction(traceStepIntoAct
);
621 debuggerbar
->addAction(traceStepOverAct
);
622 debuggerbar
->addSeparator();
623 debuggerbar
->addAction(BreakpointsAct
);
626 if (vjs
.hardwareTypeAlpine
)
628 debugbar
= addToolBar(tr("&Debug"));
629 debugbar
->addAction(memBrowseAct
);
630 debugbar
->addAction(stackBrowseAct
);
631 debugbar
->addAction(cpuBrowseAct
);
632 debugbar
->addAction(opBrowseAct
);
633 debugbar
->addAction(m68kDasmBrowseAct
);
634 debugbar
->addAction(riscDasmBrowseAct
);
637 // Add actions to the main window, as hiding widgets with them
639 addAction(fullScreenAct
);
640 addAction(quitAppAct
);
641 addAction(configAct
);
642 addAction(emustatusAct
);
644 addAction(filePickAct
);
645 addAction(frameAdvanceAct
);
648 statusBar()->showMessage(tr("Ready"));
650 // Do this in case original size isn't correct (mostly for the first-run case)
653 WriteLog("Window creation done\n");
655 // Create our test pattern NTSC bitmap
656 WriteLog("Test pattern 1 bitmap\n");
658 QImage
tempImg(":/res/test-pattern.jpg");
659 QImage tempImgScaled
= tempImg
.scaled(VIRTUAL_SCREEN_WIDTH
, VIRTUAL_SCREEN_HEIGHT_PAL
, Qt::IgnoreAspectRatio
, Qt::SmoothTransformation
);
661 for(uint32_t y
=0; y
<VIRTUAL_SCREEN_HEIGHT_PAL
; y
++)
663 const QRgb
* scanline
= (QRgb
*)tempImgScaled
.constScanLine(y
);
665 for(uint32_t x
=0; x
<VIRTUAL_SCREEN_WIDTH
; x
++)
667 uint32_t pixel
= (qRed(scanline
[x
]) << 24) | (qGreen(scanline
[x
]) << 16) | (qBlue(scanline
[x
]) << 8) | 0xFF;
668 testPattern
[(y
* VIRTUAL_SCREEN_WIDTH
) + x
] = pixel
;
672 // Create our test pattern PAL bitmap
673 WriteLog("Test pattern 2 bitmap\n");
675 QImage
tempImg2(":/res/test-pattern-pal.jpg");
676 QImage tempImgScaled2
= tempImg2
.scaled(VIRTUAL_SCREEN_WIDTH
, VIRTUAL_SCREEN_HEIGHT_PAL
, Qt::IgnoreAspectRatio
, Qt::SmoothTransformation
);
678 for(uint32_t y
=0; y
<VIRTUAL_SCREEN_HEIGHT_PAL
; y
++)
680 const QRgb
* scanline
= (QRgb
*)tempImgScaled2
.constScanLine(y
);
682 for(uint32_t x
=0; x
<VIRTUAL_SCREEN_WIDTH
; x
++)
684 uint32_t pixel
= (qRed(scanline
[x
]) << 24) | (qGreen(scanline
[x
]) << 16) | (qBlue(scanline
[x
]) << 8) | 0xFF;
685 testPattern2
[(y
* VIRTUAL_SCREEN_WIDTH
) + x
] = pixel
;
689 // Set up timer based loop for animation...
690 timer
= new QTimer(this);
691 connect(timer
, SIGNAL(timeout()), this, SLOT(Timer()));
693 // This isn't very accurate for NTSC: This is early by 40 msec per frame.
694 // This is because it's discarding the 0.6666... on the end of the fraction.
695 // Alas, 6 doesn't divide cleanly into 10. :-P
696 //Should we defer this until SyncUI? Probably.
697 //No, it doesn't work, because it uses setInterval() instead of start()...
698 // timer->start(vjs.hardwareTypeNTSC ? 16 : 20);
700 // We set this initially, to make VJ behave somewhat as it would if no
701 // cart were inserted and the BIOS was set as active...
702 jaguarCartInserted
= true;
703 WriteLog("Virtual Jaguar %s Rx (Last full build was on %s %s)\n", VJ_RELEASE_VERSION
, __DATE__
, __TIME__
);
704 WriteLog("VJ: Initializing jaguar subsystem...\n");
707 #ifndef NEWMODELSBIOSHANDLER
708 // memcpy(jagMemSpace + 0xE00000, jaguarBootROM, 0x20000); // Use the stock BIOS
709 memcpy(jagMemSpace
+ 0xE00000, (vjs
.biosType
== BT_K_SERIES
? jaguarBootROM
: jaguarBootROM2
), 0x20000); // Use the stock BIOS
711 SelectBIOS(vjs
.biosType
);
714 // Prevent the file scanner from running if filename passed
715 // in on the command line...
719 // Load up the default ROM if in Alpine mode:
720 if (vjs
.hardwareTypeAlpine
)
722 bool romLoaded
= JaguarLoadFile(vjs
.alpineROMPath
);
724 // If regular load failed, try just a straight file load
725 // (Dev only! I don't want people to start getting lazy with their releases again! :-P)
727 romLoaded
= AlpineLoadFile(vjs
.alpineROMPath
);
730 WriteLog("Alpine Mode: Successfully loaded file \"%s\".\n", vjs
.alpineROMPath
);
732 WriteLog("Alpine Mode: Unable to load file \"%s\"!\n", vjs
.alpineROMPath
);
734 // Attempt to load/run the ABS file...
735 LoadSoftware(vjs
.absROMPath
);
736 #ifndef NEWMODELSBIOSHANDLER
737 memcpy(jagMemSpace
+ 0xE00000, jaguarDevBootROM2
, 0x20000); // Use the stub BIOS
739 SelectBIOS(vjs
.biosType
);
741 // Prevent the scanner from running...
745 // Load up the default ROM if in Debugger mode:
746 if (vjs
.softTypeDebugger
)
748 bool romLoaded
= JaguarLoadFile(vjs
.debuggerROMPath
);
750 // If regular load failed, try just a straight file load
751 // (Dev only! I don't want people to start getting lazy with their releases again! :-P)
753 romLoaded
= DebuggerLoadFile(vjs
.debuggerROMPath
);
756 WriteLog("Debugger Mode: Successfully loaded file \"%s\".\n", vjs
.debuggerROMPath
);
758 WriteLog("Debugger Mode: Unable to load file \"%s\"!\n", vjs
.debuggerROMPath
);
760 // Attempt to load/run the ABS file...
761 LoadSoftware(vjs
.absROMPath
);
762 #ifndef NEWMODELSBIOSHANDLER
763 memcpy(jagMemSpace
+ 0xE00000, jaguarDevBootROM2
, 0x20000); // Use the stub BIOS
764 // Prevent the scanner from running...
766 SelectBIOS(vjs
.biosType
);
771 // Run the scanner if nothing passed in and *not* Alpine mode...
772 // NB: Really need to look into caching the info scanned in here...
773 filePickWin
->ScanSoftwareFolder(allowUnknownSoftware
);
774 scannedSoftwareFolder
= true;
778 void MainWin::LoadFile(QString file
)
784 void MainWin::SyncUI(void)
786 // Set toolbar buttons/menus based on settings read in (sync the UI)...
787 // (Really, this is to sync command line options passed in)
788 blurAct
->setChecked(vjs
.glFilter
);
789 x1Act
->setChecked(zoomLevel
== 1);
790 x2Act
->setChecked(zoomLevel
== 2);
791 x3Act
->setChecked(zoomLevel
== 3);
792 // running = powerAct->isChecked();
793 ntscAct
->setChecked(vjs
.hardwareTypeNTSC
);
794 palAct
->setChecked(!vjs
.hardwareTypeNTSC
);
795 powerAct
->setIcon(vjs
.hardwareTypeNTSC
? powerRed
: powerGreen
);
797 fullScreenAct
->setChecked(vjs
.fullscreen
);
798 fullScreen
= vjs
.fullscreen
;
799 SetFullScreen(fullScreen
);
801 // Reset the timer to be what was set in the command line (if any):
802 // timer->setInterval(vjs.hardwareTypeNTSC ? 16 : 20);
803 timer
->start(vjs
.hardwareTypeNTSC
? 16 : 20);
807 void MainWin::closeEvent(QCloseEvent
* event
)
810 // This should only be done by the config dialog
813 event
->accept(); // ignore() if can't close for some reason
817 void MainWin::keyPressEvent(QKeyEvent
* e
)
819 #ifndef VJ_REMOVE_DEV_CODE
821 //extern bool startM68KTracing; // moved to jaguar.h
823 extern int blit_start_log
;
825 extern bool startConciseBlitLogging
;
828 // We ignore the Alt key for now, since it causes problems with the GUI
829 if (e
->key() == Qt::Key_Alt
)
834 // Bar this shite from release versions kthxbai
835 #ifndef VJ_REMOVE_DEV_CODE
836 else if (e
->key() == Qt::Key_F11
)
838 startM68KTracing
= true;
842 else if (e
->key() == Qt::Key_F12
)
844 blit_start_log
= true;
848 else if (e
->key() == Qt::Key_F10
)
850 startConciseBlitLogging
= true;
855 else if (e
->key() == Qt::Key_F8
)
857 // ggn: For extra NYAN pleasure...
858 // ggn: There you go James :P
859 // Shamus: Thanks for the patch! :-D
860 WriteLog(" o + + +\n");
861 WriteLog("+ o o + o\n");
862 WriteLog("-_-_-_-_-_-_-_,------, o \n");
863 WriteLog("_-_-_-_-_-_-_-| /\\_/\\ \n");
864 WriteLog("-_-_-_-_-_-_-~|__( ^ .^) + + \n");
865 WriteLog("_-_-_-_-_-_-_-\"\" \"\" \n");
866 WriteLog("+ o o + o\n");
873 This is done now by a QAction...
874 if (e->key() == Qt::Key_F9)
884 void MainWin::keyReleaseEvent(QKeyEvent
* e
)
886 // We ignore the Alt key for now, since it causes problems with the GUI
887 if (e
->key() == Qt::Key_Alt
)
893 HandleKeys(e
, false);
897 void MainWin::HandleKeys(QKeyEvent
* e
, bool state
)
899 enum { P1LEFT
= 0, P1RIGHT
, P1UP
, P1DOWN
, P2LEFT
, P2RIGHT
, P2UP
, P2DOWN
};
900 // We kill bad key combos here, before they can get to the emulator...
901 // This also kills the illegal instruction problem that cropped up in
904 // First, settle key states...
905 if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_L
])
906 keyHeld
[P1LEFT
] = state
;
907 else if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_R
])
908 keyHeld
[P1RIGHT
] = state
;
909 else if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_U
])
910 keyHeld
[P1UP
] = state
;
911 else if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_D
])
912 keyHeld
[P1DOWN
] = state
;
913 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_L
])
914 keyHeld
[P2LEFT
] = state
;
915 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_R
])
916 keyHeld
[P2RIGHT
] = state
;
917 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_U
])
918 keyHeld
[P2UP
] = state
;
919 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_D
])
920 keyHeld
[P2DOWN
] = state
;
922 // Next, check for conflicts and kill 'em if there are any...
923 if (keyHeld
[P1LEFT
] && keyHeld
[P1RIGHT
])
924 keyHeld
[P1LEFT
] = keyHeld
[P1RIGHT
] = false;
926 if (keyHeld
[P1UP
] && keyHeld
[P1DOWN
])
927 keyHeld
[P1UP
] = keyHeld
[P1DOWN
] = false;
929 if (keyHeld
[P2LEFT
] && keyHeld
[P2RIGHT
])
930 keyHeld
[P2LEFT
] = keyHeld
[P2RIGHT
] = false;
932 if (keyHeld
[P2UP
] && keyHeld
[P2DOWN
])
933 keyHeld
[P2UP
] = keyHeld
[P2DOWN
] = false;
935 // No bad combos exist now, let's stuff the emulator key buffers...!
936 for(int i
=BUTTON_FIRST
; i
<=BUTTON_LAST
; i
++)
938 if (e
->key() == (int)vjs
.p1KeyBindings
[i
])
939 joypad0Buttons
[i
] = (state
? 0x01 : 0x00);
941 if (e
->key() == (int)vjs
.p2KeyBindings
[i
])
942 joypad1Buttons
[i
] = (state
? 0x01 : 0x00);
948 // N.B.: The profile system AutoConnect functionality sets the gamepad IDs here.
950 void MainWin::HandleGamepads(void)
954 for(int i
=BUTTON_FIRST
; i
<=BUTTON_LAST
; i
++)
956 if (vjs
.p1KeyBindings
[i
] & (JOY_BUTTON
| JOY_HAT
| JOY_AXIS
))
957 joypad0Buttons
[i
] = (Gamepad::GetState(gamepadIDSlot1
, vjs
.p1KeyBindings
[i
]) ? 0x01 : 0x00);
959 if (vjs
.p2KeyBindings
[i
] & (JOY_BUTTON
| JOY_HAT
| JOY_AXIS
))
960 joypad1Buttons
[i
] = (Gamepad::GetState(gamepadIDSlot2
, vjs
.p2KeyBindings
[i
]) ? 0x01 : 0x00);
965 void MainWin::Open(void)
970 void MainWin::Configure(void)
972 // Call the configuration dialog and update settings
973 ConfigDialog
dlg(this);
975 dlg
.generalTab
->useUnknownSoftware
->setChecked(allowUnknownSoftware
);
976 dlg
.controllerTab1
->profileNum
= lastEditedProfile
;
977 dlg
.controllerTab1
->SetupLastUsedProfile();
978 // maybe instead of this, we tell the controller tab to work on a copy that gets
979 // written if the user hits 'OK'.
980 SaveProfiles(); // Just in case user cancels
982 if (dlg
.exec() == false)
988 QString before
= vjs
.ROMPath
;
989 QString alpineBefore
= vjs
.alpineROMPath
;
990 QString absBefore
= vjs
.absROMPath
;
991 // bool audioBefore = vjs.audioEnabled;
992 bool audioBefore
= vjs
.DSPEnabled
;
993 dlg
.UpdateVJSettings();
994 QString after
= vjs
.ROMPath
;
995 QString alpineAfter
= vjs
.alpineROMPath
;
996 QString absAfter
= vjs
.absROMPath
;
997 // bool audioAfter = vjs.audioEnabled;
998 bool audioAfter
= vjs
.DSPEnabled
;
1000 bool allowOld
= allowUnknownSoftware
;
1002 allowUnknownSoftware
= dlg
.generalTab
->useUnknownSoftware
->isChecked();
1003 lastEditedProfile
= dlg
.controllerTab1
->profileNum
;
1004 AutoConnectProfiles();
1006 // We rescan the "software" folder if the user either changed the path or
1007 // checked/unchecked the "Allow unknown files" option in the config dialog.
1008 if ((before
!= after
) || (allowOld
!= allowUnknownSoftware
))
1009 filePickWin
->ScanSoftwareFolder(allowUnknownSoftware
);
1011 // If the "Alpine" ROM is changed, then let's load it...
1012 if (alpineBefore
!= alpineAfter
)
1014 if (!JaguarLoadFile(vjs
.alpineROMPath
) && !AlpineLoadFile(vjs
.alpineROMPath
))
1016 // Oh crap, we couldn't get the file! Alert the media!
1018 msg
.setText(QString(tr("Could not load file \"%1\"!")).arg(vjs
.alpineROMPath
));
1019 msg
.setIcon(QMessageBox::Warning
);
1024 // If the "ABS" ROM is changed, then let's load it...
1025 if (absBefore
!= absAfter
)
1027 if (!JaguarLoadFile(vjs
.absROMPath
))
1029 // Oh crap, we couldn't get the file! Alert the media!
1031 msg
.setText(QString(tr("Could not load file \"%1\"!")).arg(vjs
.absROMPath
));
1032 msg
.setIcon(QMessageBox::Warning
);
1037 // If the "Enable DSP" checkbox changed, then we have to re-init the DAC,
1038 // since it's running in the host audio IRQ...
1039 if (audioBefore
!= audioAfter
)
1045 // Just in case we crash before a clean exit...
1048 DebuggerRefreshWindows();
1053 // Here's the main emulator loop
1055 void MainWin::Timer(void)
1058 static uint32_t ntscTickCount
;
1059 if (vjs
.hardwareTypeNTSC
)
1063 timer
->start(16 + (ntscTickCount
== 0 ? 1 : 0));
1070 if (showUntunedTankCircuit
)
1072 // Some machines can't handle this, so we give them the option to disable it. :-)
1073 if (!plzDontKillMyComputer
)
1075 // if (!vjs.softTypeDebugger)
1077 // Random hash & trash
1078 // We try to simulate an untuned tank circuit here... :-)
1079 for (uint32_t x
= 0; x
< videoWidget
->rasterWidth
; x
++)
1081 for (uint32_t y
= 0; y
< videoWidget
->rasterHeight
; y
++)
1083 videoWidget
->buffer
[(y
* videoWidget
->textureWidth
) + x
] = (rand() & 0xFF) << 8 | (rand() & 0xFF) << 16 | (rand() & 0xFF) << 24;
1091 // Otherwise, run the Jaguar simulation
1094 //if (!vjs.softTypeDebugger)
1095 videoWidget
->HandleMouseHiding();
1097 static uint32_t refresh
= 0;
1098 // Do autorefresh on debug windows
1099 // Have to be careful, too much causes the emulator to slow way down!
1100 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
1102 if (refresh
== vjs
.refresh
)
1104 AlpineRefreshWindows();
1105 //memBrowseWin->RefreshContents();
1106 //cpuBrowseWin->RefreshContents();
1114 //if (!vjs.softTypeDebugger)
1115 videoWidget
->updateGL();
1118 // Approach: We use a ring buffer to store times (in ms) over a given
1119 // amount of frames, then sum them to figure out the FPS.
1120 uint32_t timestamp
= SDL_GetTicks();
1121 // This assumes the ring buffer size is a power of 2
1122 // ringBufferPointer = (ringBufferPointer + 1) & (RING_BUFFER_SIZE - 1);
1123 // Doing it this way is better. Ring buffer size can be arbitrary then.
1124 ringBufferPointer
= (ringBufferPointer
+ 1) % RING_BUFFER_SIZE
;
1125 ringBuffer
[ringBufferPointer
] = timestamp
- oldTimestamp
;
1126 uint32_t elapsedTime
= 0;
1128 for(uint32_t i
=0; i
<RING_BUFFER_SIZE
; i
++)
1129 elapsedTime
+= ringBuffer
[i
];
1131 // elapsedTime must be non-zero
1132 if (elapsedTime
== 0)
1135 // This is in frames per 10 seconds, so we can have 1 decimal
1136 uint32_t framesPerSecond
= (uint32_t)(((float)RING_BUFFER_SIZE
/ (float)elapsedTime
) * 10000.0);
1137 uint32_t fpsIntegerPart
= framesPerSecond
/ 10;
1138 uint32_t fpsDecimalPart
= framesPerSecond
% 10;
1139 // If this is updated too frequently to be useful, we can throttle it down
1140 // so that it only updates every 10th frame or so
1141 statusBar()->showMessage(QString("%1.%2 FPS").arg(fpsIntegerPart
).arg(fpsDecimalPart
));
1142 oldTimestamp
= timestamp
;
1144 if (M68KDebugHaltStatus())
1149 // Toggle the power state, it can be either on or off
1150 void MainWin::TogglePowerState(void)
1152 powerButtonOn
= !powerButtonOn
;
1155 // With the power off, we simulate white noise on the screen. :-)
1158 // Restore the mouse pointer, if hidden:
1159 //if (!vjs.softTypeDebugger)
1161 videoWidget
->CheckAndRestoreMouseCursor();
1164 useCDAct
->setDisabled(false);
1165 palAct
->setDisabled(false);
1166 ntscAct
->setDisabled(false);
1167 pauseAct
->setChecked(false);
1168 pauseAct
->setDisabled(true);
1169 showUntunedTankCircuit
= true;
1171 DACPauseAudioThread();
1172 // This is just in case the ROM we were playing was in a narrow or wide field mode, so the untuned tank sim doesn't look wrong. :-)
1175 if (plzDontKillMyComputer
)
1177 // We have to do it line by line, because the texture pitch is not the same as the picture buffer's pitch.
1178 for (uint32_t y
= 0; y
< videoWidget
->rasterHeight
; y
++)
1180 if (vjs
.hardwareTypeNTSC
)
1182 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1186 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern2
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1193 useCDAct
->setDisabled(true);
1194 palAct
->setDisabled(true);
1195 ntscAct
->setDisabled(true);
1196 pauseAct
->setChecked(false);
1197 pauseAct
->setDisabled(false);
1198 showUntunedTankCircuit
= false;
1200 // Otherwise, we prepare for running regular software...
1203 // Should check for cartridgeLoaded here as well...!
1204 // We can clear it when toggling CDActive on, so that when we power cycle it
1205 // does the expected thing. Otherwise, if we use the file picker to insert a
1206 // cart, we expect to run the cart! Maybe have a RemoveCart function that only
1207 // works if the CD unit is active?
1208 setWindowTitle(QString("Virtual Jaguar " VJ_RELEASE_VERSION
" Rx - Now playing: Jaguar CD"));
1211 WriteLog("GUI: Resetting Jaguar...\n");
1213 DeleteAllBreakpoints();
1214 DebuggerResetWindows();
1215 DACPauseAudioThread(false);
1220 // Toggle the emulator state, it can be either on or off
1221 void MainWin::ToggleRunState(void)
1223 startM68KTracing
= running
;
1229 // Set action buttons for the pause mode
1230 frameAdvanceAct
->setDisabled(false);
1231 pauseAct
->setChecked(true);
1232 pauseAct
->setDisabled(false);
1233 if (vjs
.softTypeDebugger
)
1235 traceStepIntoAct
->setDisabled(false);
1236 traceStepOverAct
->setDisabled(false);
1237 restartAct
->setDisabled(false);
1238 m68kDasmWin
->Use68KPCAddress();
1239 GPUDasmWin
->UseGPUPCAddress();
1240 DSPDasmWin
->UseDSPPCAddress();
1243 //if (!vjs.softTypeDebugger)
1245 // Restore the mouse pointer, if hidden:
1246 videoWidget
->CheckAndRestoreMouseCursor();
1248 for (uint32_t i
= 0; i
< (uint32_t)(videoWidget
->textureWidth
* 256); i
++)
1250 uint32_t pixel
= videoWidget
->buffer
[i
];
1251 uint8_t r
= (pixel
>> 24) & 0xFF, g
= (pixel
>> 16) & 0xFF, b
= (pixel
>> 8) & 0xFF;
1252 pixel
= ((r
+ g
+ b
) / 3) & 0x00FF;
1253 videoWidget
->buffer
[i
] = 0x000000FF | (pixel
<< 16) | (pixel
<< 8);
1256 videoWidget
->updateGL();
1258 cpuBrowseWin
->HoldBPM();
1259 cpuBrowseWin
->HandleBPMContinue();
1260 DebuggerRefreshWindows();
1265 frameAdvanceAct
->setDisabled(true);
1266 pauseAct
->setChecked(false);
1267 pauseAct
->setDisabled(false);
1268 if (vjs
.softTypeDebugger
)
1270 traceStepIntoAct
->setDisabled(true);
1271 traceStepOverAct
->setDisabled(true);
1272 restartAct
->setDisabled(true);
1275 cpuBrowseWin
->UnholdBPM();
1276 BreakpointsWin
->RefreshContents();
1279 // Pause/unpause any running/non-running threads...
1280 DACPauseAudioThread(!running
);
1284 void MainWin::SetZoom100(void)
1291 void MainWin::SetZoom200(void)
1298 void MainWin::SetZoom300(void)
1305 void MainWin::SetNTSC(void)
1307 powerAct
->setIcon(powerRed
);
1308 timer
->setInterval(16);
1309 vjs
.hardwareTypeNTSC
= true;
1315 void MainWin::SetPAL(void)
1317 powerAct
->setIcon(powerGreen
);
1318 timer
->setInterval(20);
1319 vjs
.hardwareTypeNTSC
= false;
1325 void MainWin::ToggleBlur(void)
1327 vjs
.glFilter
= !vjs
.glFilter
;
1332 void MainWin::ShowAboutWin(void)
1338 void MainWin::ShowHelpWin(void)
1344 void MainWin::InsertCart(void)
1346 // Check to see if we did autorun, 'cause we didn't load anything in that
1348 if (!scannedSoftwareFolder
)
1350 filePickWin
->ScanSoftwareFolder(allowUnknownSoftware
);
1351 scannedSoftwareFolder
= true;
1354 // If the emulator is running, we pause it here and unpause it later
1355 // if we dismiss the file selector without choosing anything
1356 if (running
&& powerButtonOn
)
1359 pauseForFileSelector
= true;
1362 filePickWin
->show();
1366 void MainWin::Unpause(void)
1368 // Here we unpause the emulator if it was paused when we went into the file selector
1369 if (pauseForFileSelector
)
1371 pauseForFileSelector
= false;
1373 // Some nutter might have unpaused while in the file selector, so check for that
1380 // Jaguar initialisation and load software file
1381 void MainWin::LoadSoftware(QString file
)
1383 running
= false; // Prevent bad things(TM) from happening...
1384 pauseForFileSelector
= false; // Reset the file selector pause flag
1386 // Setup BIOS in his own dedicated Jaguar memory
1387 #ifndef NEWMODELSBIOSHANDLER
1388 uint8_t * biosPointer
= jaguarBootROM
;
1390 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
1392 biosPointer
= jaguarDevBootROM2
;
1395 memcpy(jagMemSpace
+ 0xE00000, biosPointer
, 0x20000);
1397 SelectBIOS(vjs
.biosType
);
1400 // Turn 'on' the power to initialize the Jaguar
1401 powerAct
->setDisabled(false);
1402 powerAct
->setChecked(true);
1403 powerButtonOn
= false;
1406 // We have to load our software *after* the Jaguar RESET
1407 cartridgeLoaded
= JaguarLoadFile(file
.toUtf8().data());
1408 SET32(jaguarMainRAM
, 0, vjs
.DRAM_size
); // Set stack in the M68000's Reset SP
1410 // This is icky because we've already done it
1411 // it gets worse :-P
1412 if (!vjs
.useJaguarBIOS
)
1414 SET32(jaguarMainRAM
, 4, jaguarRunAddress
);
1419 // set the M68K in halt mode in case of a debug mode is used, so control is at user side
1420 if (vjs
.softTypeDebugger
)
1422 m68k_set_reg(M68K_REG_A6
, 0);
1423 m68kDasmWin
->SetAddress(jaguarRunAddress
);
1424 //pauseAct->setDisabled(false);
1425 //pauseAct->setChecked(true);
1431 // Prevent the launch in case of software without a start address and without BIOS presence
1432 if (!vjs
.useJaguarBIOS
&& !jaguarRunAddress
)
1438 if ((!vjs
.hardwareTypeAlpine
|| !vjs
.softTypeDebugger
) && !loadAndGo
&& jaguarRunAddress
)
1440 QString newTitle
= QString("Virtual Jaguar " VJ_RELEASE_VERSION
" Rx - Now playing: %1").arg(filePickWin
->GetSelectedPrettyName());
1441 setWindowTitle(newTitle
);
1446 void MainWin::ToggleCDUsage(void)
1448 CDActive
= !CDActive
;
1450 // Set up the Jaguar CD for execution, otherwise, clear memory
1452 memcpy(jagMemSpace
+ 0x800000, jaguarCDBootROM
, 0x40000);
1454 memset(jagMemSpace
+ 0x800000, 0xFF, 0x40000);
1459 void MainWin::ShowBreakpointsWin(void)
1461 BreakpointsWin
->show();
1462 BreakpointsWin
->RefreshContents();
1467 void MainWin::DeleteAllBreakpoints(void)
1469 cpuBrowseWin
->ResetBPM();
1471 ShowBreakpointsWin();
1476 void MainWin::DisableAllBreakpoints(void)
1478 cpuBrowseWin
->DisableBPM();
1480 ShowBreakpointsWin();
1485 void MainWin::ShowNewFunctionBreakpointWin(void)
1487 NewFunctionBreakpointWin
->show();
1488 ShowBreakpointsWin();
1493 void MainWin::DebuggerTraceStepInto(void)
1496 videoWidget
->updateGL();
1497 DebuggerRefreshWindows();
1499 #pragma message("Warning: !!! Need to verify the Step Into function !!!")
1501 #warning "!!! Need to verify the Step Into function !!!"
1506 // Restart the Jaguar executable
1507 void MainWin::DebuggerRestart(void)
1512 m68k_set_reg(M68K_REG_PC
, jaguarRunAddress
);
1513 m68k_set_reg(M68K_REG_SP
, vjs
.DRAM_size
);
1515 m68k_set_reg(M68K_REG_A6
, 0);
1516 m68k_brk_hitcounts_reset();
1518 DebuggerResetWindows();
1519 DebuggerRefreshWindows();
1521 #pragma message("Warning: !!! Need to verify the Restart function !!!")
1523 #warning "!!! Need to verify the Restart function !!!"
1529 void MainWin::DebuggerTraceStepOver(void)
1532 videoWidget
->updateGL();
1533 DebuggerRefreshWindows();
1535 #pragma message("Warning: !!! Need to verify the Step Over function !!!")
1537 #warning "!!! Need to verify the Step Over function !!!"
1542 // Advance / Execute for one frame
1543 void MainWin::FrameAdvance(void)
1545 //printf("Frame Advance...\n");
1547 // Execute 1 frame, then exit (only useful in Pause mode)
1549 //if (!vjs.softTypeDebugger)
1550 videoWidget
->updateGL();
1552 // Need to execute 1 frames' worth of DSP thread as well :-/
1554 //m68kDasmWin->Use68KPCAddress();
1557 #pragma message("Warning: !!! Need to execute the DSP thread for 1 frame too !!!")
1559 #warning "!!! Need to execute the DSP thread for 1 frame too !!!"
1564 void MainWin::SetFullScreen(bool state
/*= true*/)
1566 if (!vjs
.softTypeDebugger
)
1570 mainWinPosition
= pos();
1572 statusBar()->hide();
1578 // This is needed because the fullscreen may happen on a different
1579 // screen than screen 0:
1580 int screenNum
= QApplication::desktop()->screenNumber(videoWidget
);
1581 QRect r
= QApplication::desktop()->screenGeometry(screenNum
);
1582 double targetWidth
= (double)VIRTUAL_SCREEN_WIDTH
,
1583 targetHeight
= (double)(vjs
.hardwareTypeNTSC
? VIRTUAL_SCREEN_HEIGHT_NTSC
: VIRTUAL_SCREEN_HEIGHT_PAL
);
1584 double aspectRatio
= targetWidth
/ targetHeight
;
1585 // NOTE: Really should check here to see which dimension constrains the
1586 // other. Right now, we assume that height is the constraint.
1587 int newWidth
= (int)(aspectRatio
* (double)r
.height());
1588 videoWidget
->offset
= (r
.width() - newWidth
) / 2;
1589 videoWidget
->fullscreen
= true;
1590 videoWidget
->outputWidth
= newWidth
;
1591 videoWidget
->setFixedSize(r
.width(), r
.height());
1596 // Seems Qt is fussy about this: showNormal() has to go first, or it
1597 // will keep the window stuck in a psuedo-fullscreen mode with no way
1598 // to get out of it (except closing the app).
1601 // Reset the video widget to windowed mode
1602 videoWidget
->offset
= 0;
1603 videoWidget
->fullscreen
= false;
1605 statusBar()->show();
1612 move(mainWinPosition
);
1618 void MainWin::ToggleFullScreen(void)
1620 fullScreen
= !fullScreen
;
1621 SetFullScreen(fullScreen
);
1626 void MainWin::ShowExceptionVectorTableBrowserWin(void)
1628 exceptionvectortableBrowseWin
->show();
1629 exceptionvectortableBrowseWin
->RefreshContents();
1634 void MainWin::ShowLocalBrowserWin(void)
1636 LocalBrowseWin
->show();
1637 LocalBrowseWin
->RefreshContents();
1642 void MainWin::ShowCallStackBrowserWin(void)
1644 CallStackBrowseWin
->show();
1645 CallStackBrowseWin
->RefreshContents();
1649 void MainWin::ShowAllWatchBrowserWin(void)
1651 allWatchBrowseWin
->show();
1652 allWatchBrowseWin
->RefreshContents();
1656 void MainWin::ShowHeapAllocatorBrowserWin(void)
1658 heapallocatorBrowseWin
->show();
1659 heapallocatorBrowseWin
->RefreshContents();
1663 void MainWin::ShowMemoryBrowserWin(void)
1665 memBrowseWin
->show();
1666 memBrowseWin
->RefreshContents();
1670 void MainWin::ShowMemory1BrowserWin(int NumWin
)
1672 // for (int i = 0; i < vjs.nbrmemory1browserwindow; i++)
1674 mem1BrowseWin
[NumWin
]->show();
1675 mem1BrowseWin
[NumWin
]->RefreshContents(NumWin
);
1680 void MainWin::ShowEmuStatusWin(void)
1682 emuStatusWin
->show();
1683 emuStatusWin
->RefreshContents();
1687 void MainWin::ShowStackBrowserWin(void)
1689 stackBrowseWin
->show();
1690 stackBrowseWin
->RefreshContents();
1694 void MainWin::ShowCPUBrowserWin(void)
1696 cpuBrowseWin
->show();
1697 cpuBrowseWin
->RefreshContents();
1701 void MainWin::ShowOPBrowserWin(void)
1703 opBrowseWin
->show();
1704 opBrowseWin
->RefreshContents();
1708 void MainWin::ShowM68KDasmBrowserWin(void)
1710 m68kDasmBrowseWin
->show();
1711 m68kDasmBrowseWin
->RefreshContents();
1715 void MainWin::ShowRISCDasmBrowserWin(void)
1717 riscDasmBrowseWin
->show();
1718 riscDasmBrowseWin
->RefreshContents();
1724 void MainWin::ShowDasmWin(void)
1727 // DasmWin->RefreshContents();
1734 void MainWin::ShowVideoOutputWin(void)
1736 //VideoOutputWindowCentrale = mainWindowCentrale->addSubWindow(videoWidget);
1737 //VideoOutputWindowCentrale->setWindowTitle(QString(tr("Video output")));
1738 //VideoOutputWindowCentrale->show();
1739 //memBrowseWin->show();
1740 //VideoOutputWin->show();
1741 //VideoOutputWin->RefreshContents(videoWidget);
1746 // Resize video window based on zoom factor
1747 // It doesn't apply in debugger mode as we use this window to display disassembly
1748 void MainWin::ResizeMainWindow(void)
1750 if (!vjs
.softTypeDebugger
)
1752 videoWidget
->setFixedSize(zoomLevel
* VIRTUAL_SCREEN_WIDTH
, zoomLevel
* (vjs
.hardwareTypeNTSC
? VIRTUAL_SCREEN_HEIGHT_NTSC
: VIRTUAL_SCREEN_HEIGHT_PAL
));
1754 // Show the test pattern if user requested plzDontKillMyComputer mode
1755 if (!powerButtonOn
&& plzDontKillMyComputer
)
1757 for (uint32_t y
= 0; y
< videoWidget
->rasterHeight
; y
++)
1759 if (vjs
.hardwareTypeNTSC
)
1761 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1765 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern2
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1776 void MainWin::ReadSettings(void)
1780 QSettings
settings("Underground Software", "Virtual Jaguar");
1782 //zoomLevel = settings.value("zoom", 2).toInt();
1783 allowUnknownSoftware
= settings
.value("showUnknownSoftware", false).toBool();
1784 lastEditedProfile
= settings
.value("lastEditedProfile", 0).toInt();
1786 vjs
.useJoystick
= settings
.value("useJoystick", false).toBool();
1787 vjs
.joyport
= settings
.value("joyport", 0).toInt();
1788 vjs
.hardwareTypeNTSC
= settings
.value("hardwareTypeNTSC", true).toBool();
1789 vjs
.frameSkip
= settings
.value("frameSkip", 0).toInt();
1790 vjs
.useJaguarBIOS
= settings
.value("useJaguarBIOS", false).toBool();
1791 vjs
.useRetailBIOS
= settings
.value("useRetailBIOS", false).toBool();
1792 vjs
.useDevBIOS
= settings
.value("useDevBIOS", false).toBool();
1793 vjs
.GPUEnabled
= settings
.value("GPUEnabled", true).toBool();
1794 vjs
.DSPEnabled
= settings
.value("DSPEnabled", true).toBool();
1795 vjs
.audioEnabled
= settings
.value("audioEnabled", true).toBool();
1796 vjs
.usePipelinedDSP
= settings
.value("usePipelinedDSP", false).toBool();
1797 vjs
.fullscreen
= settings
.value("fullscreen", false).toBool();
1798 vjs
.useOpenGL
= settings
.value("useOpenGL", true).toBool();
1799 vjs
.glFilter
= settings
.value("glFilterType", 1).toInt();
1800 vjs
.renderType
= settings
.value("renderType", 0).toInt();
1801 vjs
.biosType
= settings
.value("biosType", BT_M_SERIES
).toInt();
1802 vjs
.jaguarModel
= settings
.value("jaguarModel", JAG_M_SERIES
).toInt();
1803 vjs
.useFastBlitter
= settings
.value("useFastBlitter", false).toBool();
1804 strcpy(vjs
.EEPROMPath
, settings
.value("EEPROMs", QStandardPaths::writableLocation(QStandardPaths::DataLocation
).append("/eeproms/")).toString().toUtf8().data());
1805 strcpy(vjs
.ROMPath
, settings
.value("ROMs", QStandardPaths::writableLocation(QStandardPaths::DataLocation
).append("/software/")).toString().toUtf8().data());
1806 strcpy(vjs
.screenshotPath
, settings
.value("Screenshots", QStandardPaths::writableLocation(QStandardPaths::DataLocation
).append("/screenshots/")).toString().toUtf8().data());
1808 // Read settings from the Debugger mode
1809 settings
.beginGroup("debugger");
1810 strcpy(vjs
.debuggerROMPath
, settings
.value("DefaultROM", "").toString().toUtf8().data());
1811 strcpy(vjs
.sourcefilesearchPaths
, settings
.value("SourceFileSearchPaths", "").toString().toUtf8().data());
1812 vjs
.nbrdisasmlines
= settings
.value("NbrDisasmLines", 32).toUInt();
1813 vjs
.disasmopcodes
= settings
.value("DisasmOpcodes", true).toBool();
1814 vjs
.displayHWlabels
= settings
.value("DisplayHWLabels", true).toBool();
1815 vjs
.displayFullSourceFilename
= settings
.value("displayFullSourceFilename", true).toBool();
1816 vjs
.nbrmemory1browserwindow
= settings
.value("NbrMemory1BrowserWindow", MaxMemory1BrowserWindow
).toUInt();
1817 settings
.endGroup();
1819 // Read settings from the Alpine mode
1820 settings
.beginGroup("alpine");
1821 strcpy(vjs
.alpineROMPath
, settings
.value("DefaultROM", "").toString().toUtf8().data());
1822 strcpy(vjs
.absROMPath
, settings
.value("DefaultABS", "").toString().toUtf8().data());
1823 vjs
.refresh
= settings
.value("refresh", 60).toUInt();
1824 vjs
.allowWritesToROM
= settings
.value("writeROM", false).toBool();
1825 settings
.endGroup();
1827 // Read settings from the Keybindings
1828 settings
.beginGroup("keybindings");
1829 for (i
= 0; i
< KB_END
; i
++)
1831 strcpy(vjs
.KBContent
[i
].KBSettingValue
, settings
.value(KeyBindingsTable
[i
].KBNameSetting
, KeyBindingsTable
[i
].KBDefaultValue
).toString().toUtf8().data());
1833 settings
.endGroup();
1835 // Write important settings to the log file
1836 WriteLog("MainWin: Paths\n");
1837 WriteLog(" EEPROMPath = \"%s\"\n", vjs
.EEPROMPath
);
1838 WriteLog(" ROMPath = \"%s\"\n", vjs
.ROMPath
);
1839 WriteLog(" AlpineROMPath = \"%s\"\n", vjs
.alpineROMPath
);
1840 WriteLog(" DebuggerROMPath = \"%s\"\n", vjs
.debuggerROMPath
);
1841 WriteLog(" absROMPath = \"%s\"\n", vjs
.absROMPath
);
1842 WriteLog(" ScreenshotsPath = \"%s\"\n", vjs
.screenshotPath
);
1843 WriteLog("SourceFileSearchPaths = \"%s\"\n", vjs
.sourcefilesearchPaths
);
1844 WriteLog("MainWin: Misc.\n");
1845 WriteLog(" Pipelined DSP = %s\n", (vjs
.usePipelinedDSP
? "ON" : "off"));
1848 // Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, *
1849 vjs
.p1KeyBindings
[BUTTON_U
] = settings
.value("p1k_up", Qt::Key_S
).toInt();
1850 vjs
.p1KeyBindings
[BUTTON_D
] = settings
.value("p1k_down", Qt::Key_X
).toInt();
1851 vjs
.p1KeyBindings
[BUTTON_L
] = settings
.value("p1k_left", Qt::Key_A
).toInt();
1852 vjs
.p1KeyBindings
[BUTTON_R
] = settings
.value("p1k_right", Qt::Key_D
).toInt();
1853 vjs
.p1KeyBindings
[BUTTON_C
] = settings
.value("p1k_c", Qt::Key_J
).toInt();
1854 vjs
.p1KeyBindings
[BUTTON_B
] = settings
.value("p1k_b", Qt::Key_K
).toInt();
1855 vjs
.p1KeyBindings
[BUTTON_A
] = settings
.value("p1k_a", Qt::Key_L
).toInt();
1856 vjs
.p1KeyBindings
[BUTTON_OPTION
] = settings
.value("p1k_option", Qt::Key_O
).toInt();
1857 vjs
.p1KeyBindings
[BUTTON_PAUSE
] = settings
.value("p1k_pause", Qt::Key_P
).toInt();
1858 vjs
.p1KeyBindings
[BUTTON_0
] = settings
.value("p1k_0", Qt::Key_0
).toInt();
1859 vjs
.p1KeyBindings
[BUTTON_1
] = settings
.value("p1k_1", Qt::Key_1
).toInt();
1860 vjs
.p1KeyBindings
[BUTTON_2
] = settings
.value("p1k_2", Qt::Key_2
).toInt();
1861 vjs
.p1KeyBindings
[BUTTON_3
] = settings
.value("p1k_3", Qt::Key_3
).toInt();
1862 vjs
.p1KeyBindings
[BUTTON_4
] = settings
.value("p1k_4", Qt::Key_4
).toInt();
1863 vjs
.p1KeyBindings
[BUTTON_5
] = settings
.value("p1k_5", Qt::Key_5
).toInt();
1864 vjs
.p1KeyBindings
[BUTTON_6
] = settings
.value("p1k_6", Qt::Key_6
).toInt();
1865 vjs
.p1KeyBindings
[BUTTON_7
] = settings
.value("p1k_7", Qt::Key_7
).toInt();
1866 vjs
.p1KeyBindings
[BUTTON_8
] = settings
.value("p1k_8", Qt::Key_8
).toInt();
1867 vjs
.p1KeyBindings
[BUTTON_9
] = settings
.value("p1k_9", Qt::Key_9
).toInt();
1868 vjs
.p1KeyBindings
[BUTTON_d
] = settings
.value("p1k_pound", Qt::Key_Minus
).toInt();
1869 vjs
.p1KeyBindings
[BUTTON_s
] = settings
.value("p1k_star", Qt::Key_Equal
).toInt();
1871 vjs
.p2KeyBindings
[BUTTON_U
] = settings
.value("p2k_up", Qt::Key_Up
).toInt();
1872 vjs
.p2KeyBindings
[BUTTON_D
] = settings
.value("p2k_down", Qt::Key_Down
).toInt();
1873 vjs
.p2KeyBindings
[BUTTON_L
] = settings
.value("p2k_left", Qt::Key_Left
).toInt();
1874 vjs
.p2KeyBindings
[BUTTON_R
] = settings
.value("p2k_right", Qt::Key_Right
).toInt();
1875 vjs
.p2KeyBindings
[BUTTON_C
] = settings
.value("p2k_c", Qt::Key_Z
).toInt();
1876 vjs
.p2KeyBindings
[BUTTON_B
] = settings
.value("p2k_b", Qt::Key_X
).toInt();
1877 vjs
.p2KeyBindings
[BUTTON_A
] = settings
.value("p2k_a", Qt::Key_C
).toInt();
1878 vjs
.p2KeyBindings
[BUTTON_OPTION
] = settings
.value("p2k_option", Qt::Key_Apostrophe
).toInt();
1879 vjs
.p2KeyBindings
[BUTTON_PAUSE
] = settings
.value("p2k_pause", Qt::Key_Return
).toInt();
1880 vjs
.p2KeyBindings
[BUTTON_0
] = settings
.value("p2k_0", Qt::Key_0
).toInt();
1881 vjs
.p2KeyBindings
[BUTTON_1
] = settings
.value("p2k_1", Qt::Key_1
).toInt();
1882 vjs
.p2KeyBindings
[BUTTON_2
] = settings
.value("p2k_2", Qt::Key_2
).toInt();
1883 vjs
.p2KeyBindings
[BUTTON_3
] = settings
.value("p2k_3", Qt::Key_3
).toInt();
1884 vjs
.p2KeyBindings
[BUTTON_4
] = settings
.value("p2k_4", Qt::Key_4
).toInt();
1885 vjs
.p2KeyBindings
[BUTTON_5
] = settings
.value("p2k_5", Qt::Key_5
).toInt();
1886 vjs
.p2KeyBindings
[BUTTON_6
] = settings
.value("p2k_6", Qt::Key_6
).toInt();
1887 vjs
.p2KeyBindings
[BUTTON_7
] = settings
.value("p2k_7", Qt::Key_7
).toInt();
1888 vjs
.p2KeyBindings
[BUTTON_8
] = settings
.value("p2k_8", Qt::Key_8
).toInt();
1889 vjs
.p2KeyBindings
[BUTTON_9
] = settings
.value("p2k_9", Qt::Key_9
).toInt();
1890 vjs
.p2KeyBindings
[BUTTON_d
] = settings
.value("p2k_pound", Qt::Key_Slash
).toInt();
1891 vjs
.p2KeyBindings
[BUTTON_s
] = settings
.value("p2k_star", Qt::Key_Asterisk
).toInt();
1894 WriteLog("Read setting = Done\n");
1896 ReadProfiles(&settings
);
1897 DBGManager_SourceFileSearchPathsSet(vjs
.sourcefilesearchPaths
);
1902 // Default values will be used in case of no settings can be found
1904 #pragma message("Warning: !!! Need to check the window geometry to see if the positions are legal !!!")
1906 #warning "!!! Need to check the window geometry to see if the positions are legal !!!"
1908 // i.e., someone could drag it to another screen, close it, then disconnect that screen
1909 void MainWin::ReadUISettings(void)
1916 // Point on the emulator settings
1917 QSettings
settings("Underground Software", "Virtual Jaguar");
1918 settings
.beginGroup("ui");
1920 // Emulator main window UI information
1921 mainWinPosition
= settings
.value("pos", QPoint(200, 200)).toPoint();
1922 size
= settings
.value("size", QSize(400, 400)).toSize();
1924 move(mainWinPosition
);
1925 pos
= settings
.value("cartLoadPos", QPoint(200, 200)).toPoint();
1926 filePickWin
->move(pos
);
1928 // Video output information
1929 zoomLevel
= settings
.value("zoom", 2).toInt();
1931 // Alpine debug UI information (also needed by the Debugger)
1932 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
1934 // CPU registers UI information
1935 pos
= settings
.value("cpuBrowseWinPos", QPoint(200, 200)).toPoint();
1936 cpuBrowseWin
->move(pos
);
1937 settings
.value("cpuBrowseWinIsVisible", false).toBool() ? ShowCPUBrowserWin() : void();
1939 // Memory browser UI information
1940 pos
= settings
.value("memBrowseWinPos", QPoint(200, 200)).toPoint();
1941 memBrowseWin
->move(pos
);
1942 settings
.value("memBrowseWinIsVisible", false).toBool() ? ShowMemoryBrowserWin() : void();
1944 // Stack browser UI information
1945 pos
= settings
.value("stackBrowseWinPos", QPoint(200, 200)).toPoint();
1946 stackBrowseWin
->move(pos
);
1947 settings
.value("stackBrowseWinIsVisible", false).toBool() ? ShowStackBrowserWin() : void();
1948 size
= settings
.value("stackBrowseWinSize", QSize(400, 400)).toSize();
1949 stackBrowseWin
->resize(size
);
1951 // Emulator status UI information
1952 pos
= settings
.value("emuStatusWinPos", QPoint(200, 200)).toPoint();
1953 emuStatusWin
->move(pos
);
1954 settings
.value("emuStatusWinIsVisible", false).toBool() ? ShowEmuStatusWin() : void();
1956 // OP (Object Processor) UI information
1957 pos
= settings
.value("opBrowseWinPos", QPoint(200, 200)).toPoint();
1958 opBrowseWin
->move(pos
);
1959 settings
.value("opBrowseWinIsVisible", false).toBool() ? ShowOPBrowserWin() : void();
1960 size
= settings
.value("opBrowseWinSize", QSize(400, 400)).toSize();
1961 opBrowseWin
->resize(size
);
1963 // RISC disassembly UI information
1964 pos
= settings
.value("riscDasmBrowseWinPos", QPoint(200, 200)).toPoint();
1965 riscDasmBrowseWin
->move(pos
);
1966 settings
.value("riscDasmBrowseWinIsVisible", false).toBool() ? ShowRISCDasmBrowserWin() : void();
1968 // M68k disassembly UI information
1969 pos
= settings
.value("m68kDasmBrowseWinPos", QPoint(200, 200)).toPoint();
1970 m68kDasmBrowseWin
->move(pos
);
1971 //settings.value("m68kDasmBrowseWinIsVisible", false).toBool() ? ShowM68KDasmBrowserWin() : void();
1973 #pragma message("Warning: !!! Need to check the M68k disassembly window position crashing !!!")
1975 #warning "!!! Need to check the M68k disassembly window position crashing !!!"
1979 // Debugger UI information
1980 if (vjs
.softTypeDebugger
)
1983 pos
= settings
.value("m68kDasmWinPos", QPoint(200, 200)).toPoint();
1984 m68kDasmWin
->move(pos
);
1985 //settings.value("m68kDasmWinIsVisible", false).toBool() ? m68kDasmWin->show() : m68kDasmWin->hide();
1986 pos
= settings
.value("GPUDasmWinPos", QPoint(200, 200)).toPoint();
1987 GPUDasmWin
->move(pos
);
1988 pos
= settings
.value("DSPDasmWinPos", QPoint(200, 200)).toPoint();
1989 DSPDasmWin
->move(pos
);
1991 // All watch browser UI information
1992 pos
= settings
.value("allWatchBrowseWinPos", QPoint(200, 200)).toPoint();
1993 allWatchBrowseWin
->move(pos
);
1994 settings
.value("allWatchBrowseWinIsVisible", false).toBool() ? ShowAllWatchBrowserWin() : void();
1995 size
= settings
.value("allWatchBrowseWinSize", QSize(400, 400)).toSize();
1996 allWatchBrowseWin
->resize(size
);
1998 // Local browser UI information
1999 pos
= settings
.value("LocalBrowseWinPos", QPoint(200, 200)).toPoint();
2000 LocalBrowseWin
->move(pos
);
2001 settings
.value("LocalBrowseWinIsVisible", false).toBool() ? ShowLocalBrowserWin() : void();
2002 size
= settings
.value("LocalBrowseWinSize", QSize(400, 400)).toSize();
2003 LocalBrowseWin
->resize(size
);
2005 // Heap memory allocation browser UI information
2006 pos
= settings
.value("heapallocatorBrowseWinPos", QPoint(200, 200)).toPoint();
2007 heapallocatorBrowseWin
->move(pos
);
2008 settings
.value("heapallocatorBrowseWinIsVisible", false).toBool() ? ShowHeapAllocatorBrowserWin() : void();
2009 size
= settings
.value("heapallocatorBrowseWinSize", QSize(400, 400)).toSize();
2010 heapallocatorBrowseWin
->resize(size
);
2012 // Exception Vector Table UI Information
2013 pos
= settings
.value("exceptionVectorTableBrowseWinPos", QPoint(200, 200)).toPoint();
2014 exceptionvectortableBrowseWin
->move(pos
);
2015 settings
.value("exceptionVectorTableBrowseWinIsVisible", false).toBool() ? ShowExceptionVectorTableBrowserWin() : void();
2016 size
= settings
.value("exceptionVectorTableBrowseWinSize", QSize(400, 400)).toSize();
2017 exceptionvectortableBrowseWin
->resize(size
);
2019 // Call Stack browser UI information
2020 pos
= settings
.value("CallStackBrowseWinPos", QPoint(200, 200)).toPoint();
2021 CallStackBrowseWin
->move(pos
);
2022 settings
.value("CallStackBrowseWinIsVisible", false).toBool() ? ShowCallStackBrowserWin() : void();
2023 size
= settings
.value("CallStackBrowseWinSize", QSize(400, 400)).toSize();
2024 CallStackBrowseWin
->resize(size
);
2026 // Breakpoints UI information
2027 pos
= settings
.value("BreakpointsWinPos", QPoint(200, 200)).toPoint();
2028 BreakpointsWin
->move(pos
);
2029 settings
.value("BreakpointsWinIsVisible", false).toBool() ? ShowBreakpointsWin() : void();
2030 size
= settings
.value("BreakpointsWinSize", QSize(400, 400)).toSize();
2031 BreakpointsWin
->resize(size
);
2032 // New function breakpoint UI information
2033 pos
= settings
.value("NewFunctionBreakpointWinPos", QPoint(200, 200)).toPoint();
2034 NewFunctionBreakpointWin
->move(pos
);
2035 settings
.value("NewFunctionBreakpointWinIsVisible", false).toBool() ? ShowNewFunctionBreakpointWin() : void();
2036 size
= settings
.value("NewFunctionBreakpointWinSize", QSize(400, 400)).toSize();
2037 NewFunctionBreakpointWin
->resize(size
);
2039 // Memories browser UI information
2040 for (i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
2042 sprintf(mem1Name
, "mem1BrowseWinPos[%i]", (unsigned int)i
);
2043 pos
= settings
.value(mem1Name
, QPoint(200, 200)).toPoint();
2044 mem1BrowseWin
[i
]->move(pos
);
2045 sprintf(mem1Name
, "mem1BrowseWinIsVisible[%i]", (unsigned int)i
);
2046 settings
.value(mem1Name
, false).toBool() ? ShowMemory1BrowserWin((int)i
) : void();
2047 sprintf(mem1Name
, "mem1BrowseWinSize[%i]", (unsigned int)i
);
2048 size
= settings
.value(mem1Name
, QSize(400, 400)).toSize();
2049 mem1BrowseWin
[i
]->resize(size
);
2053 settings
.endGroup();
2055 WriteLog("Read UI setting = Done\n");
2059 // Save the settings
2060 void MainWin::WriteSettings(void)
2064 // Point on the emulator settings
2065 QSettings
settings("Underground Software", "Virtual Jaguar");
2066 //settings.setValue("pos", pos());
2067 //settings.setValue("size", size());
2068 //settings.setValue("cartLoadPos", filePickWin->pos());
2070 //settings.setValue("zoom", zoomLevel);
2071 settings
.setValue("showUnknownSoftware", allowUnknownSoftware
);
2072 settings
.setValue("lastEditedProfile", lastEditedProfile
);
2074 settings
.setValue("useJoystick", vjs
.useJoystick
);
2075 settings
.setValue("joyport", vjs
.joyport
);
2076 settings
.setValue("hardwareTypeNTSC", vjs
.hardwareTypeNTSC
);
2077 settings
.setValue("frameSkip", vjs
.frameSkip
);
2078 settings
.setValue("useJaguarBIOS", vjs
.useJaguarBIOS
);
2079 settings
.setValue("useRetailBIOS", vjs
.useRetailBIOS
);
2080 settings
.setValue("useDevBIOS", vjs
.useDevBIOS
);
2081 settings
.setValue("GPUEnabled", vjs
.GPUEnabled
);
2082 settings
.setValue("DSPEnabled", vjs
.DSPEnabled
);
2083 settings
.setValue("audioEnabled", vjs
.audioEnabled
);
2084 settings
.setValue("usePipelinedDSP", vjs
.usePipelinedDSP
);
2085 settings
.setValue("fullscreen", vjs
.fullscreen
);
2086 settings
.setValue("useOpenGL", vjs
.useOpenGL
);
2087 settings
.setValue("glFilterType", vjs
.glFilter
);
2088 settings
.setValue("renderType", vjs
.renderType
);
2089 settings
.setValue("jaguarModel", vjs
.jaguarModel
);
2090 settings
.setValue("biosType", vjs
.biosType
);
2091 settings
.setValue("useFastBlitter", vjs
.useFastBlitter
);
2092 //settings.setValue("JagBootROM", vjs.jagBootPath);
2093 //settings.setValue("CDBootROM", vjs.CDBootPath);
2094 settings
.setValue("EEPROMs", vjs
.EEPROMPath
);
2095 settings
.setValue("ROMs", vjs
.ROMPath
);
2096 settings
.setValue("Screenshots", vjs
.screenshotPath
);
2098 // Write settings from the Alpine mode
2099 settings
.beginGroup("alpine");
2100 settings
.setValue("refresh", vjs
.refresh
);
2101 settings
.setValue("DefaultROM", vjs
.alpineROMPath
);
2102 settings
.setValue("DefaultABS", vjs
.absROMPath
);
2103 settings
.setValue("writeROM", vjs
.allowWritesToROM
);
2104 settings
.endGroup();
2106 // Write settings from the Debugger mode
2107 settings
.beginGroup("debugger");
2108 settings
.setValue("DisplayHWLabels", vjs
.displayHWlabels
);
2109 settings
.setValue("NbrDisasmLines", vjs
.nbrdisasmlines
);
2110 settings
.setValue("DisasmOpcodes", vjs
.disasmopcodes
);
2111 settings
.setValue("displayFullSourceFilename", vjs
.displayFullSourceFilename
);
2112 settings
.setValue("NbrMemory1BrowserWindow", (unsigned int)vjs
.nbrmemory1browserwindow
);
2113 settings
.setValue("DefaultROM", vjs
.debuggerROMPath
);
2114 settings
.setValue("SourceFileSearchPaths", vjs
.sourcefilesearchPaths
);
2115 settings
.endGroup();
2117 // Write settings from the Keybindings
2118 settings
.beginGroup("keybindings");
2119 for (i
= 0; i
< KB_END
; i
++)
2121 settings
.setValue(KeyBindingsTable
[i
].KBNameSetting
, vjs
.KBContent
[i
].KBSettingValue
);
2123 settings
.endGroup();
2126 settings
.setValue("p1k_up", vjs
.p1KeyBindings
[BUTTON_U
]);
2127 settings
.setValue("p1k_down", vjs
.p1KeyBindings
[BUTTON_D
]);
2128 settings
.setValue("p1k_left", vjs
.p1KeyBindings
[BUTTON_L
]);
2129 settings
.setValue("p1k_right", vjs
.p1KeyBindings
[BUTTON_R
]);
2130 settings
.setValue("p1k_c", vjs
.p1KeyBindings
[BUTTON_C
]);
2131 settings
.setValue("p1k_b", vjs
.p1KeyBindings
[BUTTON_B
]);
2132 settings
.setValue("p1k_a", vjs
.p1KeyBindings
[BUTTON_A
]);
2133 settings
.setValue("p1k_option", vjs
.p1KeyBindings
[BUTTON_OPTION
]);
2134 settings
.setValue("p1k_pause", vjs
.p1KeyBindings
[BUTTON_PAUSE
]);
2135 settings
.setValue("p1k_0", vjs
.p1KeyBindings
[BUTTON_0
]);
2136 settings
.setValue("p1k_1", vjs
.p1KeyBindings
[BUTTON_1
]);
2137 settings
.setValue("p1k_2", vjs
.p1KeyBindings
[BUTTON_2
]);
2138 settings
.setValue("p1k_3", vjs
.p1KeyBindings
[BUTTON_3
]);
2139 settings
.setValue("p1k_4", vjs
.p1KeyBindings
[BUTTON_4
]);
2140 settings
.setValue("p1k_5", vjs
.p1KeyBindings
[BUTTON_5
]);
2141 settings
.setValue("p1k_6", vjs
.p1KeyBindings
[BUTTON_6
]);
2142 settings
.setValue("p1k_7", vjs
.p1KeyBindings
[BUTTON_7
]);
2143 settings
.setValue("p1k_8", vjs
.p1KeyBindings
[BUTTON_8
]);
2144 settings
.setValue("p1k_9", vjs
.p1KeyBindings
[BUTTON_9
]);
2145 settings
.setValue("p1k_pound", vjs
.p1KeyBindings
[BUTTON_d
]);
2146 settings
.setValue("p1k_star", vjs
.p1KeyBindings
[BUTTON_s
]);
2148 settings
.setValue("p2k_up", vjs
.p2KeyBindings
[BUTTON_U
]);
2149 settings
.setValue("p2k_down", vjs
.p2KeyBindings
[BUTTON_D
]);
2150 settings
.setValue("p2k_left", vjs
.p2KeyBindings
[BUTTON_L
]);
2151 settings
.setValue("p2k_right", vjs
.p2KeyBindings
[BUTTON_R
]);
2152 settings
.setValue("p2k_c", vjs
.p2KeyBindings
[BUTTON_C
]);
2153 settings
.setValue("p2k_b", vjs
.p2KeyBindings
[BUTTON_B
]);
2154 settings
.setValue("p2k_a", vjs
.p2KeyBindings
[BUTTON_A
]);
2155 settings
.setValue("p2k_option", vjs
.p2KeyBindings
[BUTTON_OPTION
]);
2156 settings
.setValue("p2k_pause", vjs
.p2KeyBindings
[BUTTON_PAUSE
]);
2157 settings
.setValue("p2k_0", vjs
.p2KeyBindings
[BUTTON_0
]);
2158 settings
.setValue("p2k_1", vjs
.p2KeyBindings
[BUTTON_1
]);
2159 settings
.setValue("p2k_2", vjs
.p2KeyBindings
[BUTTON_2
]);
2160 settings
.setValue("p2k_3", vjs
.p2KeyBindings
[BUTTON_3
]);
2161 settings
.setValue("p2k_4", vjs
.p2KeyBindings
[BUTTON_4
]);
2162 settings
.setValue("p2k_5", vjs
.p2KeyBindings
[BUTTON_5
]);
2163 settings
.setValue("p2k_6", vjs
.p2KeyBindings
[BUTTON_6
]);
2164 settings
.setValue("p2k_7", vjs
.p2KeyBindings
[BUTTON_7
]);
2165 settings
.setValue("p2k_8", vjs
.p2KeyBindings
[BUTTON_8
]);
2166 settings
.setValue("p2k_9", vjs
.p2KeyBindings
[BUTTON_9
]);
2167 settings
.setValue("p2k_pound", vjs
.p2KeyBindings
[BUTTON_d
]);
2168 settings
.setValue("p2k_star", vjs
.p2KeyBindings
[BUTTON_s
]);
2171 WriteProfiles(&settings
);
2172 DBGManager_SourceFileSearchPathsSet(vjs
.sourcefilesearchPaths
);
2176 // Save the UI settings
2177 void MainWin::WriteUISettings(void)
2182 // Point on the emulator settings
2183 QSettings
settings("Underground Software", "Virtual Jaguar");
2184 settings
.beginGroup("ui");
2186 // Emulator UI information
2187 settings
.setValue("pos", pos());
2188 settings
.setValue("size", size());
2189 settings
.setValue("cartLoadPos", filePickWin
->pos());
2191 // Video output information
2192 settings
.setValue("zoom", zoomLevel
);
2194 // Alpine debug UI information (also needed by the Debugger)
2195 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
2197 settings
.setValue("cpuBrowseWinPos", cpuBrowseWin
->pos());
2198 settings
.setValue("cpuBrowseWinIsVisible", cpuBrowseWin
->isVisible());
2199 settings
.setValue("memBrowseWinPos", memBrowseWin
->pos());
2200 settings
.setValue("memBrowseWinIsVisible", memBrowseWin
->isVisible());
2201 settings
.setValue("stackBrowseWinPos", stackBrowseWin
->pos());
2202 settings
.setValue("stackBrowseWinIsVisible", stackBrowseWin
->isVisible());
2203 settings
.setValue("stackBrowseWinSize", stackBrowseWin
->size());
2204 settings
.setValue("emuStatusWinPos", emuStatusWin
->pos());
2205 settings
.setValue("emuStatusWinIsVisible", emuStatusWin
->isVisible());
2206 settings
.setValue("opBrowseWinPos", opBrowseWin
->pos());
2207 settings
.setValue("opBrowseWinIsVisible", opBrowseWin
->isVisible());
2208 settings
.setValue("opBrowseWinSize", opBrowseWin
->size());
2209 settings
.setValue("riscDasmBrowseWinPos", riscDasmBrowseWin
->pos());
2210 settings
.setValue("riscDasmBrowseWinIsVisible", riscDasmBrowseWin
->isVisible());
2211 settings
.setValue("m68kDasmBrowseWinPos", m68kDasmBrowseWin
->pos());
2212 settings
.setValue("m68kDasmBrowseWinIsVisible", m68kDasmBrowseWin
->isVisible());
2215 // Debugger UI information
2216 if (vjs
.softTypeDebugger
)
2219 settings
.setValue("m68kDasmWinPos", m68kDasmWin
->pos());
2220 //settings.setValue("m68kDasmWinIsVisible", m68kDasmWin->isVisible());
2221 settings
.setValue("GPUDasmWinPos", GPUDasmWin
->pos());
2222 settings
.setValue("DSPDasmWinPos", DSPDasmWin
->pos());
2224 settings
.setValue("allWatchBrowseWinPos", allWatchBrowseWin
->pos());
2225 settings
.setValue("allWatchBrowseWinIsVisible", allWatchBrowseWin
->isVisible());
2226 settings
.setValue("allWatchBrowseWinSize", allWatchBrowseWin
->size());
2227 settings
.setValue("LocalBrowseWinPos", LocalBrowseWin
->pos());
2228 settings
.setValue("LocalBrowseWinIsVisible", LocalBrowseWin
->isVisible());
2229 settings
.setValue("LocalBrowseWinSize", LocalBrowseWin
->size());
2230 settings
.setValue("heapallocatorBrowseWinPos", heapallocatorBrowseWin
->pos());
2231 settings
.setValue("heapallocatorBrowseWinIsVisible", heapallocatorBrowseWin
->isVisible());
2232 settings
.setValue("heapallocatorBrowseWinSize", heapallocatorBrowseWin
->size());
2233 settings
.setValue("exceptionVectorTableBrowseWinPos", exceptionvectortableBrowseWin
->pos());
2234 settings
.setValue("exceptionVectorTableBrowseWinIsVisible", exceptionvectortableBrowseWin
->isVisible());
2235 settings
.setValue("exceptionVectorTableBrowseWinSize", exceptionvectortableBrowseWin
->size());
2236 settings
.setValue("CallStackBrowseWinPos", CallStackBrowseWin
->pos());
2237 settings
.setValue("CallStackBrowseWinIsVisible", CallStackBrowseWin
->isVisible());
2238 settings
.setValue("CallStackBrowseWinSize", CallStackBrowseWin
->size());
2239 settings
.setValue("BreakpointsWinPos", BreakpointsWin
->pos());
2240 settings
.setValue("BreakpointsWinIsVisible", BreakpointsWin
->isVisible());
2241 settings
.setValue("BreakpointsWinSize", BreakpointsWin
->size());
2242 settings
.setValue("NewFunctionBreakpointWinPos", NewFunctionBreakpointWin
->pos());
2243 settings
.setValue("NewFunctionBreakpointWinIsVisible", NewFunctionBreakpointWin
->isVisible());
2244 settings
.setValue("NewFunctionBreakpointWinSize", NewFunctionBreakpointWin
->size());
2245 for (i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
2247 sprintf(mem1Name
, "mem1BrowseWinPos[%i]", (unsigned int)i
);
2248 settings
.setValue(mem1Name
, mem1BrowseWin
[i
]->pos());
2249 sprintf(mem1Name
, "mem1BrowseWinIsVisible[%i]", (unsigned int)i
);
2250 settings
.setValue(mem1Name
, mem1BrowseWin
[i
]->isVisible());
2251 sprintf(mem1Name
, "mem1BrowseWinSize[%i]", (unsigned int)i
);
2252 settings
.setValue(mem1Name
, mem1BrowseWin
[i
]->size());
2256 settings
.endGroup();
2260 // Refresh alpine debug windows
2261 void MainWin::AlpineRefreshWindows(void)
2263 cpuBrowseWin
->RefreshContents();
2264 memBrowseWin
->RefreshContents();
2265 stackBrowseWin
->RefreshContents();
2266 emuStatusWin
->RefreshContents();
2267 opBrowseWin
->RefreshContents();
2268 riscDasmBrowseWin
->RefreshContents();
2269 m68kDasmBrowseWin
->RefreshContents();
2273 // Reset soft debugger windows
2274 void MainWin::DebuggerResetWindows(void)
2276 if (vjs
.softTypeDebugger
)
2278 FilesrcListWin
->Reset();
2279 allWatchBrowseWin
->Reset();
2280 heapallocatorBrowseWin
->Reset();
2281 BreakpointsWin
->Reset();
2283 //ResetAlpineWindows();
2288 // Refresh soft debugger & alpine debug windows
2289 void MainWin::DebuggerRefreshWindows(void)
2293 if (vjs
.softTypeDebugger
)
2295 FilesrcListWin
->RefreshContents();
2296 m68kDasmWin
->RefreshContents();
2297 GPUDasmWin
->RefreshContents();
2298 DSPDasmWin
->RefreshContents();
2299 allWatchBrowseWin
->RefreshContents();
2300 LocalBrowseWin
->RefreshContents();
2301 CallStackBrowseWin
->RefreshContents();
2302 heapallocatorBrowseWin
->RefreshContents();
2303 BreakpointsWin
->RefreshContents();
2304 for (i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
2306 mem1BrowseWin
[i
]->RefreshContents(i
);
2309 AlpineRefreshWindows();
2314 // Create and save screenshot
2315 void MainWin::MakeScreenshot(void)
2319 time_t now
= time(0);
2323 tstruct
= *localtime(&now
);
2324 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
);
2326 // Create screenshot
2327 screenshot
= videoWidget
->grabFrameBuffer();
2328 screenshot
.save((char *)Text
, "JPG", 100);