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 10/10/2018 Added search paths in the settings
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/brkWin.h"
95 #include "debugger/FilesrcListWin.h"
96 #include "debugger/exceptionvectortablebrowser.h"
97 #include "debugger/allwatchbrowser.h"
98 #include "debugger/localbrowser.h"
99 #include "debugger/heapallocatorbrowser.h"
100 #include "debugger/callstackbrowser.h"
103 // According to SebRmv, this header isn't seen on Arch Linux either... :-/
104 //#ifdef __GCCWIN32__
105 // Apparently on win32, usleep() is not pulled in by the usual suspects.
109 #include "_MSC_VER/unistd.h"
113 // The way BSNES controls things is by setting a timer with a zero
114 // timeout, sleeping if not emulating anything. Seems there has to be a
117 // It has a novel approach to plugging-in/using different video/audio/input
118 // methods, can we do something similar or should we just use the built-in
121 // We're going to try to use the built-in OpenGL support and see how it goes.
122 // We'll make the VJ core modular so that it doesn't matter what GUI is in
123 // use, we can drop it in anywhere and use it as-is.
125 MainWin::MainWin(bool autoRun
): running(true), powerButtonOn(false),
126 showUntunedTankCircuit(true), cartridgeLoaded(false), CDActive(false),
127 pauseForFileSelector(false), loadAndGo(autoRun
), scannedSoftwareFolder(false), plzDontKillMyComputer(false)
133 for(int i
=0; i
<8; i
++)
137 for(int i
=0; i
<RING_BUFFER_SIZE
; i
++)
140 ringBufferPointer
= RING_BUFFER_SIZE
- 1;
143 //if (vjs.softTypeDebugger)
145 // mainWindowCentrale = new QMdiArea;
146 // setCentralWidget(mainWindowCentrale);
149 WriteLog("Window creation start\n");
152 videoWidget
= new GLWidget(this);
153 videoWidget
->setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
155 // set central output window
156 if (!vjs
.softTypeDebugger
)
158 setCentralWidget(videoWidget
);
162 mainWindowCentrale
= new QMdiArea(this);
163 setCentralWidget(mainWindowCentrale
);
166 setWindowIcon(QIcon(":/res/vj-icon.png"));
168 QString title
= QString(tr("Virtual Jaguar " VJ_RELEASE_VERSION
" Rx"));
170 if (vjs
.hardwareTypeAlpine
)
171 title
+= QString(tr(" - Alpine Mode"));
173 if (vjs
.softTypeDebugger
)
174 title
+= QString(tr(" - Debugger Mode"));
176 setWindowTitle(title
);
178 aboutWin
= new AboutWindow(this);
179 helpWin
= new HelpWindow(this);
180 filePickWin
= new FilePickerWindow(this);
181 memBrowseWin
= new MemoryBrowserWindow(this);
182 stackBrowseWin
= new StackBrowserWindow(this);
183 emuStatusWin
= new EmuStatusWindow(this);
184 cpuBrowseWin
= new CPUBrowserWindow(this);
185 opBrowseWin
= new OPBrowserWindow(this);
186 m68kDasmBrowseWin
= new M68KDasmBrowserWindow(this);
187 riscDasmBrowseWin
= new RISCDasmBrowserWindow(this);
188 if (vjs
.softTypeDebugger
)
190 //VideoOutputWin = new VideoOutputWindow(this);
191 //VideoOutputWin->setCentralWidget()
192 //DasmWin = new DasmWindow();
193 //DasmWin = new DasmWindow(this);
194 allWatchBrowseWin
= new AllWatchBrowserWindow(this);
195 LocalBrowseWin
= new LocalBrowserWindow(this);
196 heapallocatorBrowseWin
= new HeapAllocatorBrowserWindow(this);
197 //brkWin = new BrkWindow(this);
198 exceptionvectortableBrowseWin
= new ExceptionVectorTableBrowserWindow(this);
199 CallStackBrowseWin
= new CallStackBrowserWindow(this);
201 mem1BrowseWin
= (Memory1BrowserWindow
**)calloc(vjs
.nbrmemory1browserwindow
, sizeof(Memory1BrowserWindow
));
203 #pragma message("Warning: !!! Need to do the memory desalocation for mem1BrowseWin !!!")
205 #warning "!!! Need to do the memory desalocation for mem1BrowseWin !!!"
207 for (size_t i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
209 mem1BrowseWin
[i
] = new Memory1BrowserWindow(this);
212 // Setup dock to display source code filenames tree
213 QDockWidget
*dockFiles
= new QDockWidget(tr("Files"), this);
214 dockFiles
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
216 addDockWidget(Qt::LeftDockWidgetArea
, dockFiles
);
217 mainWindowCentrale
->addAction(dockFiles
->toggleViewAction());
218 dockFiles
->setWidget(FilesrcListWin
= new FilesrcListWindow(this));
220 // Setup dock to display disassembly
221 QDockWidget
*dockDisasm
= new QDockWidget(tr("Disassembly"), this);
222 dockDisasm
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
223 addDockWidget(Qt::RightDockWidgetArea
, dockDisasm
);
224 mainWindowCentrale
->addAction(dockDisasm
->toggleViewAction());
225 dockDisasm
->setWidget(dasmtabWidget
= new QTabWidget(this));
227 dasmtabWidget
= new QTabWidget(this);
230 dasmtabWidget
->setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
231 dasmtabWidget
->addTab(m68kDasmWin
= new m68KDasmWindow(this), tr("M68000"));
232 dasmtabWidget
->addTab(GPUDasmWin
= new GPUDasmWindow(this), tr("GPU"));
233 dasmtabWidget
->addTab(DSPDasmWin
= new DSPDasmWindow(this), tr("DSP"));
235 setCentralWidget(dasmtabWidget
);
239 // videoWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
240 setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
242 setUnifiedTitleAndToolBarOnMac(true);
245 quitAppAct
= new QAction(QIcon(":/res/exit.png"), tr("E&xit"), this);
246 quitAppAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBQUIT
].KBSettingValue
)));
247 quitAppAct
->setShortcutContext(Qt::ApplicationShortcut
);
248 quitAppAct
->setStatusTip(tr("Quit Virtual Jaguar"));
249 connect(quitAppAct
, SIGNAL(triggered()), this, SLOT(close()));
252 powerGreen
.addFile(":/res/power-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
253 powerGreen
.addFile(":/res/power-on-green.png", QSize(), QIcon::Normal
, QIcon::On
);
254 powerRed
.addFile(":/res/power-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
255 powerRed
.addFile(":/res/power-on-red.png", QSize(), QIcon::Normal
, QIcon::On
);
256 powerAct
= new QAction(powerGreen
, tr("&Power"), this);
257 powerAct
->setStatusTip(tr("Powers Jaguar on/off"));
258 powerAct
->setCheckable(true);
259 powerAct
->setChecked(false);
260 connect(powerAct
, SIGNAL(triggered()), this, SLOT(TogglePowerState()));
264 pauseIcon
.addFile(":/res/pause-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
265 pauseIcon
.addFile(":/res/pause-on.png", QSize(), QIcon::Normal
, QIcon::On
);
266 pauseAct
= new QAction(pauseIcon
, tr("Pause"), this);
267 pauseAct
->setStatusTip(tr("Toggles the running state"));
268 pauseAct
->setCheckable(true);
269 pauseAct
->setDisabled(true);
270 pauseAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBPAUSE
].KBSettingValue
)));
271 pauseAct
->setShortcutContext(Qt::ApplicationShortcut
);
272 connect(pauseAct
, SIGNAL(triggered()), this, SLOT(ToggleRunState()));
275 screenshotAct
= new QAction(QIcon(":/res/screenshot.png"), tr("&Screenshot"), this);
276 screenshotAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBSCREENSHOT
].KBSettingValue
)));
277 screenshotAct
->setShortcutContext(Qt::ApplicationShortcut
);
278 screenshotAct
->setCheckable(false);
279 screenshotAct
->setDisabled(false);
280 connect(screenshotAct
, SIGNAL(triggered()), this, SLOT(MakeScreenshot()));
283 zoomActs
= new QActionGroup(this);
284 x1Act
= new QAction(QIcon(":/res/zoom100.png"), tr("Zoom 100%"), zoomActs
);
285 x1Act
->setStatusTip(tr("Set window zoom to 100%"));
286 x1Act
->setCheckable(true);
287 connect(x1Act
, SIGNAL(triggered()), this, SLOT(SetZoom100()));
288 x2Act
= new QAction(QIcon(":/res/zoom200.png"), tr("Zoom 200%"), zoomActs
);
289 x2Act
->setStatusTip(tr("Set window zoom to 200%"));
290 x2Act
->setCheckable(true);
291 connect(x2Act
, SIGNAL(triggered()), this, SLOT(SetZoom200()));
292 x3Act
= new QAction(QIcon(":/res/zoom300.png"), tr("Zoom 300%"), zoomActs
);
293 x3Act
->setStatusTip(tr("Set window zoom to 300%"));
294 x3Act
->setCheckable(true);
295 connect(x3Act
, SIGNAL(triggered()), this, SLOT(SetZoom300()));
298 tvTypeActs
= new QActionGroup(this);
299 ntscAct
= new QAction(QIcon(":/res/ntsc.png"), tr("NTSC"), tvTypeActs
);
300 ntscAct
->setStatusTip(tr("Sets Jaguar to NTSC mode"));
301 ntscAct
->setCheckable(true);
302 connect(ntscAct
, SIGNAL(triggered()), this, SLOT(SetNTSC()));
303 palAct
= new QAction(QIcon(":/res/pal.png"), tr("PAL"), tvTypeActs
);
304 palAct
->setStatusTip(tr("Sets Jaguar to PAL mode"));
305 palAct
->setCheckable(true);
306 connect(palAct
, SIGNAL(triggered()), this, SLOT(SetPAL()));
309 blur
.addFile(":/res/blur-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
310 blur
.addFile(":/res/blur-on.png", QSize(), QIcon::Normal
, QIcon::On
);
311 blurAct
= new QAction(blur
, tr("Blur"), this);
312 blurAct
->setStatusTip(tr("Sets OpenGL rendering to GL_NEAREST"));
313 blurAct
->setCheckable(true);
314 connect(blurAct
, SIGNAL(triggered()), this, SLOT(ToggleBlur()));
317 aboutAct
= new QAction(QIcon(":/res/vj-icon.png"), tr("&About..."), this);
318 aboutAct
->setStatusTip(tr("Blatant self-promotion"));
319 connect(aboutAct
, SIGNAL(triggered()), this, SLOT(ShowAboutWin()));
322 helpAct
= new QAction(QIcon(":/res/vj-icon.png"), tr("&Contents..."), this);
323 helpAct
->setStatusTip(tr("Help is available, if you should need it"));
324 connect(helpAct
, SIGNAL(triggered()), this, SLOT(ShowHelpWin()));
326 // File pickup action
327 if (!vjs
.softTypeDebugger
)
329 filePickAct
= new QAction(QIcon(":/res/software.png"), tr("&Insert Cartridge..."), this);
330 filePickAct
->setStatusTip(tr("Insert a cartridge into Virtual Jaguar"));
334 filePickAct
= new QAction(QIcon(":/res/software.png"), tr("&Insert executable file..."), this);
335 filePickAct
->setStatusTip(tr("Insert an executable into Virtual Jaguar"));
337 filePickAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBPICKFILE
].KBSettingValue
)));
338 filePickAct
->setShortcutContext(Qt::ApplicationShortcut
);
339 connect(filePickAct
, SIGNAL(triggered()), this, SLOT(InsertCart()));
341 // Configuration action
342 configAct
= new QAction(QIcon(":/res/wrench.png"), tr("&Configure"), this);
343 configAct
->setStatusTip(tr("Configure options for Virtual Jaguar"));
344 configAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBCONFIGURE
].KBSettingValue
)));
345 configAct
->setShortcutContext(Qt::ApplicationShortcut
);
346 connect(configAct
, SIGNAL(triggered()), this, SLOT(Configure()));
348 // Emulation status action
349 emustatusAct
= new QAction(QIcon(":/res/status.png"), tr("&Status"), this);
350 emustatusAct
->setStatusTip(tr("Emulator status"));
351 emustatusAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBEMUSTATUS
].KBSettingValue
)));
352 emustatusAct
->setShortcutContext(Qt::ApplicationShortcut
);
353 connect(emustatusAct
, SIGNAL(triggered()), this, SLOT(ShowEmuStatusWin()));
356 useCDAct
= new QAction(QIcon(":/res/compact-disc.png"), tr("&Use CD Unit"), this);
357 useCDAct
->setStatusTip(tr("Use Jaguar Virtual CD unit"));
358 useCDAct
->setCheckable(true);
359 connect(useCDAct
, SIGNAL(triggered()), this, SLOT(ToggleCDUsage()));
361 // Frame advance action
362 frameAdvanceAct
= new QAction(QIcon(":/res/frame-advance.png"), tr("&Frame Advance"), this);
363 frameAdvanceAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBFRAMEADVANCE
].KBSettingValue
)));
364 frameAdvanceAct
->setShortcutContext(Qt::ApplicationShortcut
);
365 frameAdvanceAct
->setDisabled(true);
366 connect(frameAdvanceAct
, SIGNAL(triggered()), this, SLOT(FrameAdvance()));
369 fullScreenAct
= new QAction(QIcon(":/res/fullscreen.png"), tr("F&ull Screen"), this);
370 fullScreenAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBFULLSCREEN
].KBSettingValue
)));
371 fullScreenAct
->setShortcutContext(Qt::ApplicationShortcut
);
372 fullScreenAct
->setCheckable(true);
373 connect(fullScreenAct
, SIGNAL(triggered()), this, SLOT(ToggleFullScreen()));
375 // Actions dedicated to debugger mode
376 if (vjs
.softTypeDebugger
)
379 restartAct
= new QAction(QIcon(":/res/debug-restart.png"), tr("&Restart"), this);
380 restartAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBRESTART
].KBSettingValue
)));
381 restartAct
->setShortcutContext(Qt::ApplicationShortcut
);
382 restartAct
->setCheckable(false);
383 restartAct
->setDisabled(true);
384 connect(restartAct
, SIGNAL(triggered()), this, SLOT(DebuggerRestart()));
387 traceStepOverAct
= new QAction(QIcon(":/res/debug-stepover.png"), tr("&Step Over"), this);
388 traceStepOverAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBSTEPOVER
].KBSettingValue
)));
389 traceStepOverAct
->setShortcutContext(Qt::ApplicationShortcut
);
390 traceStepOverAct
->setCheckable(false);
391 traceStepOverAct
->setDisabled(true);
392 connect(traceStepOverAct
, SIGNAL(triggered()), this, SLOT(DebuggerTraceStepOver()));
395 traceStepIntoAct
= new QAction(QIcon(":/res/debug-stepinto.png"), tr("&Step Into"), this);
396 traceStepIntoAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBSTEPINTO
].KBSettingValue
)));
397 traceStepIntoAct
->setShortcutContext(Qt::ApplicationShortcut
);
398 traceStepIntoAct
->setCheckable(false);
399 traceStepIntoAct
->setDisabled(true);
400 connect(traceStepIntoAct
, SIGNAL(triggered()), this, SLOT(DebuggerTraceStepInto()));
402 //newBreakpointFunctionAct = new QAction(QIcon(""), tr("&Function Breakpoint"), this);
403 //newBreakpointFunctionAct->setShortcut(QKeySequence(tr("Ctrl+B")));
404 //connect(newBreakpointFunctionAct, SIGNAL(triggered()), this, SLOT(NewBreakpointFunction()));
406 //VideoOutputAct = new QAction(tr("Output Video"), this);
407 //VideoOutputAct->setStatusTip(tr("Shows the output video window"));
408 //connect(VideoOutputAct, SIGNAL(triggered()), this, SLOT(ShowVideoOutputWin()));
410 //DasmAct = new QAction(tr("Disassembly"), this);
411 //DasmAct->setStatusTip(tr("Shows the disassembly window"));
412 //connect(DasmAct, SIGNAL(triggered()), this, SLOT(ShowDasmWin()));
414 // Exception vector table window
415 exceptionVectorTableBrowseAct
= new QAction(QIcon(""), tr("Exception Vector Table"), this);
416 exceptionVectorTableBrowseAct
->setStatusTip(tr("Shows all Exception Vector Table browser window"));
417 connect(exceptionVectorTableBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowExceptionVectorTableBrowserWin()));
419 // All watch variables window
420 allWatchBrowseAct
= new QAction(QIcon(":/res/debug-watch.png"), tr("All Watch"), this);
421 allWatchBrowseAct
->setStatusTip(tr("Shows all Watch browser window"));
422 connect(allWatchBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowAllWatchBrowserWin()));
424 // Local variables window
425 LocalBrowseAct
= new QAction(QIcon(":/res/debug-local.png"), tr("Locals"), this);
426 LocalBrowseAct
->setStatusTip(tr("Shows Locals browser window"));
427 connect(LocalBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowLocalBrowserWin()));
429 // Heap (memory) allocation window
430 heapallocatorBrowseAct
= new QAction(QIcon(""), tr("Heap allocator"), this);
431 heapallocatorBrowseAct
->setStatusTip(tr("Shows the heap allocator browser window"));
432 connect(heapallocatorBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowHeapAllocatorBrowserWin()));
435 CallStackBrowseAct
= new QAction(QIcon(":/res/debug-callstack.png"), tr("Call Stack"), this);
436 CallStackBrowseAct
->setStatusTip(tr("Shows Call Stack browser window"));
437 connect(CallStackBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowCallStackBrowserWin()));
440 mem1BrowseAct
= (QAction
**)calloc(vjs
.nbrmemory1browserwindow
, sizeof(QAction
));
441 QSignalMapper
*signalMapper
= new QSignalMapper(this);
443 #pragma message("Warning: !!! Need to do the memory desalocation for mem1BrowseAct !!!")
445 #warning "!!! Need to do the memory desalocation for mem1BrowseAct !!!"
447 for (int i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
450 sprintf(MB
, "Memory %i", (unsigned int)(i
+1));
451 mem1BrowseAct
[i
] = new QAction(QIcon(":/res/debug-memory.png"), tr(MB
), this);
452 mem1BrowseAct
[i
]->setStatusTip(tr("Shows a Jaguar memory browser window"));
453 connect(mem1BrowseAct
[i
], SIGNAL(triggered()), signalMapper
, SLOT(map()));
454 signalMapper
->setMapping(mem1BrowseAct
[i
], (int)i
);
455 connect(signalMapper
, SIGNAL(mapped(int)), this, SLOT(ShowMemory1BrowserWin(int)));
459 // Memory browser window action
460 memBrowseAct
= new QAction(QIcon(":/res/tool-memory.png"), tr("Memory Browser"), this);
461 memBrowseAct
->setStatusTip(tr("Shows the Jaguar memory browser window"));
462 connect(memBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowMemoryBrowserWin()));
464 // Stack browser window action
465 stackBrowseAct
= new QAction(QIcon(":/res/tool-stack.png"), tr("Stack Browser"), this);
466 stackBrowseAct
->setStatusTip(tr("Shows the Jaguar stack browser window"));
467 connect(stackBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowStackBrowserWin()));
469 // CPUs (M68000, GPU & DSP browser window action
470 cpuBrowseAct
= new QAction(QIcon(":/res/tool-cpu.png"), tr("CPU Browser"), this);
471 cpuBrowseAct
->setStatusTip(tr("Shows the Jaguar CPU browser window"));
472 connect(cpuBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowCPUBrowserWin()));
474 // OP browser window action
475 opBrowseAct
= new QAction(QIcon(":/res/tool-op.png"), tr("OP Browser"), this);
476 opBrowseAct
->setStatusTip(tr("Shows the Jaguar OP browser window"));
477 connect(opBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowOPBrowserWin()));
479 // M68000 disassembly browser window
480 m68kDasmBrowseAct
= new QAction(QIcon(":/res/tool-68k-dis.png"), tr("68K Listing Browser"), this);
481 m68kDasmBrowseAct
->setStatusTip(tr("Shows the 68K disassembly browser window"));
482 connect(m68kDasmBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowM68KDasmBrowserWin()));
484 // Risc (DSP / GPU) disassembly browser window
485 riscDasmBrowseAct
= new QAction(QIcon(":/res/tool-risc-dis.png"), tr("RISC Listing Browser"), this);
486 riscDasmBrowseAct
->setStatusTip(tr("Shows the RISC disassembly browser window"));
487 connect(riscDasmBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowRISCDasmBrowserWin()));
489 // Misc. connections...
490 connect(filePickWin
, SIGNAL(RequestLoad(QString
)), this, SLOT(LoadSoftware(QString
)));
491 connect(filePickWin
, SIGNAL(FilePickerHiding()), this, SLOT(Unpause()));
495 fileMenu
= menuBar()->addMenu(tr("&Jaguar"));
496 fileMenu
->addAction(powerAct
);
497 if (!vjs
.softTypeDebugger
)
499 fileMenu
->addAction(pauseAct
);
500 // fileMenu->addAction(frameAdvanceAct);
502 fileMenu
->addAction(filePickAct
);
503 fileMenu
->addAction(useCDAct
);
504 fileMenu
->addAction(configAct
);
505 fileMenu
->addAction(emustatusAct
);
506 fileMenu
->addSeparator();
507 fileMenu
->addAction(quitAppAct
);
509 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
511 debugMenu
= menuBar()->addMenu(tr("&Debug"));
512 if (vjs
.softTypeDebugger
)
514 debugWindowsMenu
= debugMenu
->addMenu(tr("&Windows"));
515 debugWindowExceptionMenu
= debugWindowsMenu
->addMenu(tr("&Exception"));
516 debugWindowExceptionMenu
->addAction(exceptionVectorTableBrowseAct
);
517 debugWindowsMenu
->addSeparator();
519 debugWindowOutputMenu
= debugWindowsMenu
->addMenu(tr("&Output"));
520 debugWindowOutputMenu
->addAction(VideoOutputAct
);
521 debugWindowsMenu
->addSeparator();
523 debugWindowsWatchMenu
= debugWindowsMenu
->addMenu(tr("&Watch"));
524 debugWindowsWatchMenu
->addAction(allWatchBrowseAct
);
525 debugWindowsMenu
->addAction(LocalBrowseAct
);
526 debugWindowsMenu
->addSeparator();
527 debugWindowsMenu
->addAction(CallStackBrowseAct
);
528 debugWindowsMenu
->addSeparator();
529 debugWindowsMemoryMenu
= debugWindowsMenu
->addMenu(tr("&Memory"));
530 debugWindowsMemoryMenu
->addAction(heapallocatorBrowseAct
);
531 debugWindowsMemoryMenu
->addSeparator();
532 for (int i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
534 debugWindowsMemoryMenu
->addAction(mem1BrowseAct
[i
]);
536 debugWindowsMenu
->addSeparator();
537 debugWindowsBrowsesMenu
= debugWindowsMenu
->addMenu(tr("&Browsers"));
538 debugWindowsBrowsesMenu
->addAction(memBrowseAct
);
539 debugWindowsBrowsesMenu
->addAction(stackBrowseAct
);
540 debugWindowsBrowsesMenu
->addAction(cpuBrowseAct
);
541 debugWindowsBrowsesMenu
->addAction(opBrowseAct
);
542 debugWindowsBrowsesMenu
->addAction(m68kDasmBrowseAct
);
543 debugWindowsBrowsesMenu
->addAction(riscDasmBrowseAct
);
544 debugMenu
->addSeparator();
545 debugMenu
->addAction(pauseAct
);
546 debugMenu
->addAction(frameAdvanceAct
);
547 debugMenu
->addAction(restartAct
);
548 debugMenu
->addSeparator();
549 debugMenu
->addAction(traceStepIntoAct
);
550 debugMenu
->addAction(traceStepOverAct
);
552 debugMenu
->addSeparator();
553 debugNewBreakpointMenu
= debugMenu
->addMenu(tr("&New Breakpoint"));
554 debugNewBreakpointMenu
->addAction(newBreakpointFunctionAct
);
556 //debugMenu->addSeparator();
557 //debugMenu->addAction(DasmAct);
561 debugMenu
->addAction(memBrowseAct
);
562 debugMenu
->addAction(stackBrowseAct
);
563 debugMenu
->addAction(cpuBrowseAct
);
564 debugMenu
->addAction(opBrowseAct
);
565 debugMenu
->addAction(m68kDasmBrowseAct
);
566 debugMenu
->addAction(riscDasmBrowseAct
);
571 helpMenu
= menuBar()->addMenu(tr("&Help"));
572 helpMenu
->addAction(helpAct
);
573 helpMenu
->addAction(aboutAct
);
577 toolbar
= addToolBar(tr("System"));
578 toolbar
->addAction(powerAct
);
579 if (!vjs
.softTypeDebugger
)
581 toolbar
->addAction(pauseAct
);
582 toolbar
->addAction(frameAdvanceAct
);
584 toolbar
->addAction(filePickAct
);
585 toolbar
->addAction(useCDAct
);
586 toolbar
->addSeparator();
587 if (!vjs
.softTypeDebugger
)
589 toolbar
->addAction(screenshotAct
);
590 toolbar
->addSeparator();
591 toolbar
->addAction(x1Act
);
592 toolbar
->addAction(x2Act
);
593 toolbar
->addAction(x3Act
);
594 toolbar
->addSeparator();
595 toolbar
->addAction(ntscAct
);
596 toolbar
->addAction(palAct
);
597 toolbar
->addSeparator();
598 toolbar
->addAction(blurAct
);
599 toolbar
->addAction(fullScreenAct
);
603 debuggerbar
= addToolBar(tr("&Debugger"));
604 debuggerbar
->addAction(pauseAct
);
605 debuggerbar
->addAction(frameAdvanceAct
);
606 debuggerbar
->addAction(restartAct
);
607 debuggerbar
->addSeparator();
608 debuggerbar
->addAction(traceStepIntoAct
);
609 debuggerbar
->addAction(traceStepOverAct
);
612 if (vjs
.hardwareTypeAlpine
)
614 debugbar
= addToolBar(tr("&Debug"));
615 debugbar
->addAction(memBrowseAct
);
616 debugbar
->addAction(stackBrowseAct
);
617 debugbar
->addAction(cpuBrowseAct
);
618 debugbar
->addAction(opBrowseAct
);
619 debugbar
->addAction(m68kDasmBrowseAct
);
620 debugbar
->addAction(riscDasmBrowseAct
);
623 // Add actions to the main window, as hiding widgets with them
625 addAction(fullScreenAct
);
626 addAction(quitAppAct
);
627 addAction(configAct
);
628 addAction(emustatusAct
);
630 addAction(filePickAct
);
631 addAction(frameAdvanceAct
);
634 statusBar()->showMessage(tr("Ready"));
636 // Do this in case original size isn't correct (mostly for the first-run case)
639 WriteLog("Window creation done\n");
641 // Create our test pattern NTSC bitmap
642 WriteLog("Test pattern 1 bitmap\n");
644 QImage
tempImg(":/res/test-pattern.jpg");
645 QImage tempImgScaled
= tempImg
.scaled(VIRTUAL_SCREEN_WIDTH
, VIRTUAL_SCREEN_HEIGHT_PAL
, Qt::IgnoreAspectRatio
, Qt::SmoothTransformation
);
647 for(uint32_t y
=0; y
<VIRTUAL_SCREEN_HEIGHT_PAL
; y
++)
649 const QRgb
* scanline
= (QRgb
*)tempImgScaled
.constScanLine(y
);
651 for(uint32_t x
=0; x
<VIRTUAL_SCREEN_WIDTH
; x
++)
653 uint32_t pixel
= (qRed(scanline
[x
]) << 24) | (qGreen(scanline
[x
]) << 16) | (qBlue(scanline
[x
]) << 8) | 0xFF;
654 testPattern
[(y
* VIRTUAL_SCREEN_WIDTH
) + x
] = pixel
;
658 // Create our test pattern PAL bitmap
659 WriteLog("Test pattern 2 bitmap\n");
661 QImage
tempImg2(":/res/test-pattern-pal.jpg");
662 QImage tempImgScaled2
= tempImg2
.scaled(VIRTUAL_SCREEN_WIDTH
, VIRTUAL_SCREEN_HEIGHT_PAL
, Qt::IgnoreAspectRatio
, Qt::SmoothTransformation
);
664 for(uint32_t y
=0; y
<VIRTUAL_SCREEN_HEIGHT_PAL
; y
++)
666 const QRgb
* scanline
= (QRgb
*)tempImgScaled2
.constScanLine(y
);
668 for(uint32_t x
=0; x
<VIRTUAL_SCREEN_WIDTH
; x
++)
670 uint32_t pixel
= (qRed(scanline
[x
]) << 24) | (qGreen(scanline
[x
]) << 16) | (qBlue(scanline
[x
]) << 8) | 0xFF;
671 testPattern2
[(y
* VIRTUAL_SCREEN_WIDTH
) + x
] = pixel
;
675 // Set up timer based loop for animation...
676 timer
= new QTimer(this);
677 connect(timer
, SIGNAL(timeout()), this, SLOT(Timer()));
679 // This isn't very accurate for NTSC: This is early by 40 msec per frame.
680 // This is because it's discarding the 0.6666... on the end of the fraction.
681 // Alas, 6 doesn't divide cleanly into 10. :-P
682 //Should we defer this until SyncUI? Probably.
683 //No, it doesn't work, because it uses setInterval() instead of start()...
684 // timer->start(vjs.hardwareTypeNTSC ? 16 : 20);
686 // We set this initially, to make VJ behave somewhat as it would if no
687 // cart were inserted and the BIOS was set as active...
688 jaguarCartInserted
= true;
689 WriteLog("Virtual Jaguar %s Rx (Last full build was on %s %s)\n", VJ_RELEASE_VERSION
, __DATE__
, __TIME__
);
690 WriteLog("VJ: Initializing jaguar subsystem...\n");
693 #ifndef NEWMODELSBIOSHANDLER
694 // memcpy(jagMemSpace + 0xE00000, jaguarBootROM, 0x20000); // Use the stock BIOS
695 memcpy(jagMemSpace
+ 0xE00000, (vjs
.biosType
== BT_K_SERIES
? jaguarBootROM
: jaguarBootROM2
), 0x20000); // Use the stock BIOS
697 SelectBIOS(vjs
.biosType
);
700 // Prevent the file scanner from running if filename passed
701 // in on the command line...
705 // Load up the default ROM if in Alpine mode:
706 if (vjs
.hardwareTypeAlpine
)
708 bool romLoaded
= JaguarLoadFile(vjs
.alpineROMPath
);
710 // If regular load failed, try just a straight file load
711 // (Dev only! I don't want people to start getting lazy with their releases again! :-P)
713 romLoaded
= AlpineLoadFile(vjs
.alpineROMPath
);
716 WriteLog("Alpine Mode: Successfully loaded file \"%s\".\n", vjs
.alpineROMPath
);
718 WriteLog("Alpine Mode: Unable to load file \"%s\"!\n", vjs
.alpineROMPath
);
720 // Attempt to load/run the ABS file...
721 LoadSoftware(vjs
.absROMPath
);
722 #ifndef NEWMODELSBIOSHANDLER
723 memcpy(jagMemSpace
+ 0xE00000, jaguarDevBootROM2
, 0x20000); // Use the stub BIOS
725 SelectBIOS(vjs
.biosType
);
727 // Prevent the scanner from running...
731 // Load up the default ROM if in Debugger mode:
732 if (vjs
.softTypeDebugger
)
734 bool romLoaded
= JaguarLoadFile(vjs
.debuggerROMPath
);
736 // If regular load failed, try just a straight file load
737 // (Dev only! I don't want people to start getting lazy with their releases again! :-P)
739 romLoaded
= DebuggerLoadFile(vjs
.debuggerROMPath
);
742 WriteLog("Debugger Mode: Successfully loaded file \"%s\".\n", vjs
.debuggerROMPath
);
744 WriteLog("Debugger Mode: Unable to load file \"%s\"!\n", vjs
.debuggerROMPath
);
746 // Attempt to load/run the ABS file...
747 LoadSoftware(vjs
.absROMPath
);
748 #ifndef NEWMODELSBIOSHANDLER
749 memcpy(jagMemSpace
+ 0xE00000, jaguarDevBootROM2
, 0x20000); // Use the stub BIOS
750 // Prevent the scanner from running...
752 SelectBIOS(vjs
.biosType
);
757 // Run the scanner if nothing passed in and *not* Alpine mode...
758 // NB: Really need to look into caching the info scanned in here...
759 filePickWin
->ScanSoftwareFolder(allowUnknownSoftware
);
760 scannedSoftwareFolder
= true;
764 void MainWin::LoadFile(QString file
)
770 void MainWin::SyncUI(void)
772 // Set toolbar buttons/menus based on settings read in (sync the UI)...
773 // (Really, this is to sync command line options passed in)
774 blurAct
->setChecked(vjs
.glFilter
);
775 x1Act
->setChecked(zoomLevel
== 1);
776 x2Act
->setChecked(zoomLevel
== 2);
777 x3Act
->setChecked(zoomLevel
== 3);
778 // running = powerAct->isChecked();
779 ntscAct
->setChecked(vjs
.hardwareTypeNTSC
);
780 palAct
->setChecked(!vjs
.hardwareTypeNTSC
);
781 powerAct
->setIcon(vjs
.hardwareTypeNTSC
? powerRed
: powerGreen
);
783 fullScreenAct
->setChecked(vjs
.fullscreen
);
784 fullScreen
= vjs
.fullscreen
;
785 SetFullScreen(fullScreen
);
787 // Reset the timer to be what was set in the command line (if any):
788 // timer->setInterval(vjs.hardwareTypeNTSC ? 16 : 20);
789 timer
->start(vjs
.hardwareTypeNTSC
? 16 : 20);
793 void MainWin::closeEvent(QCloseEvent
* event
)
796 // This should only be done by the config dialog
799 event
->accept(); // ignore() if can't close for some reason
803 void MainWin::keyPressEvent(QKeyEvent
* e
)
805 #ifndef VJ_REMOVE_DEV_CODE
807 //extern bool startM68KTracing; // moved to jaguar.h
809 extern int blit_start_log
;
811 extern bool startConciseBlitLogging
;
814 // We ignore the Alt key for now, since it causes problems with the GUI
815 if (e
->key() == Qt::Key_Alt
)
820 // Bar this shite from release versions kthxbai
821 #ifndef VJ_REMOVE_DEV_CODE
822 else if (e
->key() == Qt::Key_F11
)
824 startM68KTracing
= true;
828 else if (e
->key() == Qt::Key_F12
)
830 blit_start_log
= true;
834 else if (e
->key() == Qt::Key_F10
)
836 startConciseBlitLogging
= true;
841 else if (e
->key() == Qt::Key_F8
)
843 // ggn: For extra NYAN pleasure...
844 // ggn: There you go James :P
845 // Shamus: Thanks for the patch! :-D
846 WriteLog(" o + + +\n");
847 WriteLog("+ o o + o\n");
848 WriteLog("-_-_-_-_-_-_-_,------, o \n");
849 WriteLog("_-_-_-_-_-_-_-| /\\_/\\ \n");
850 WriteLog("-_-_-_-_-_-_-~|__( ^ .^) + + \n");
851 WriteLog("_-_-_-_-_-_-_-\"\" \"\" \n");
852 WriteLog("+ o o + o\n");
859 This is done now by a QAction...
860 if (e->key() == Qt::Key_F9)
870 void MainWin::keyReleaseEvent(QKeyEvent
* e
)
872 // We ignore the Alt key for now, since it causes problems with the GUI
873 if (e
->key() == Qt::Key_Alt
)
879 HandleKeys(e
, false);
883 void MainWin::HandleKeys(QKeyEvent
* e
, bool state
)
885 enum { P1LEFT
= 0, P1RIGHT
, P1UP
, P1DOWN
, P2LEFT
, P2RIGHT
, P2UP
, P2DOWN
};
886 // We kill bad key combos here, before they can get to the emulator...
887 // This also kills the illegal instruction problem that cropped up in
890 // First, settle key states...
891 if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_L
])
892 keyHeld
[P1LEFT
] = state
;
893 else if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_R
])
894 keyHeld
[P1RIGHT
] = state
;
895 else if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_U
])
896 keyHeld
[P1UP
] = state
;
897 else if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_D
])
898 keyHeld
[P1DOWN
] = state
;
899 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_L
])
900 keyHeld
[P2LEFT
] = state
;
901 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_R
])
902 keyHeld
[P2RIGHT
] = state
;
903 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_U
])
904 keyHeld
[P2UP
] = state
;
905 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_D
])
906 keyHeld
[P2DOWN
] = state
;
908 // Next, check for conflicts and kill 'em if there are any...
909 if (keyHeld
[P1LEFT
] && keyHeld
[P1RIGHT
])
910 keyHeld
[P1LEFT
] = keyHeld
[P1RIGHT
] = false;
912 if (keyHeld
[P1UP
] && keyHeld
[P1DOWN
])
913 keyHeld
[P1UP
] = keyHeld
[P1DOWN
] = false;
915 if (keyHeld
[P2LEFT
] && keyHeld
[P2RIGHT
])
916 keyHeld
[P2LEFT
] = keyHeld
[P2RIGHT
] = false;
918 if (keyHeld
[P2UP
] && keyHeld
[P2DOWN
])
919 keyHeld
[P2UP
] = keyHeld
[P2DOWN
] = false;
921 // No bad combos exist now, let's stuff the emulator key buffers...!
922 for(int i
=BUTTON_FIRST
; i
<=BUTTON_LAST
; i
++)
924 if (e
->key() == (int)vjs
.p1KeyBindings
[i
])
925 joypad0Buttons
[i
] = (state
? 0x01 : 0x00);
927 if (e
->key() == (int)vjs
.p2KeyBindings
[i
])
928 joypad1Buttons
[i
] = (state
? 0x01 : 0x00);
934 // N.B.: The profile system AutoConnect functionality sets the gamepad IDs here.
936 void MainWin::HandleGamepads(void)
940 for(int i
=BUTTON_FIRST
; i
<=BUTTON_LAST
; i
++)
942 if (vjs
.p1KeyBindings
[i
] & (JOY_BUTTON
| JOY_HAT
| JOY_AXIS
))
943 joypad0Buttons
[i
] = (Gamepad::GetState(gamepadIDSlot1
, vjs
.p1KeyBindings
[i
]) ? 0x01 : 0x00);
945 if (vjs
.p2KeyBindings
[i
] & (JOY_BUTTON
| JOY_HAT
| JOY_AXIS
))
946 joypad1Buttons
[i
] = (Gamepad::GetState(gamepadIDSlot2
, vjs
.p2KeyBindings
[i
]) ? 0x01 : 0x00);
951 void MainWin::Open(void)
956 void MainWin::Configure(void)
958 // Call the configuration dialog and update settings
959 ConfigDialog
dlg(this);
961 dlg
.generalTab
->useUnknownSoftware
->setChecked(allowUnknownSoftware
);
962 dlg
.controllerTab1
->profileNum
= lastEditedProfile
;
963 dlg
.controllerTab1
->SetupLastUsedProfile();
964 // maybe instead of this, we tell the controller tab to work on a copy that gets
965 // written if the user hits 'OK'.
966 SaveProfiles(); // Just in case user cancels
968 if (dlg
.exec() == false)
974 QString before
= vjs
.ROMPath
;
975 QString alpineBefore
= vjs
.alpineROMPath
;
976 QString absBefore
= vjs
.absROMPath
;
977 // bool audioBefore = vjs.audioEnabled;
978 bool audioBefore
= vjs
.DSPEnabled
;
979 dlg
.UpdateVJSettings();
980 QString after
= vjs
.ROMPath
;
981 QString alpineAfter
= vjs
.alpineROMPath
;
982 QString absAfter
= vjs
.absROMPath
;
983 // bool audioAfter = vjs.audioEnabled;
984 bool audioAfter
= vjs
.DSPEnabled
;
986 bool allowOld
= allowUnknownSoftware
;
988 allowUnknownSoftware
= dlg
.generalTab
->useUnknownSoftware
->isChecked();
989 lastEditedProfile
= dlg
.controllerTab1
->profileNum
;
990 AutoConnectProfiles();
992 // We rescan the "software" folder if the user either changed the path or
993 // checked/unchecked the "Allow unknown files" option in the config dialog.
994 if ((before
!= after
) || (allowOld
!= allowUnknownSoftware
))
995 filePickWin
->ScanSoftwareFolder(allowUnknownSoftware
);
997 // If the "Alpine" ROM is changed, then let's load it...
998 if (alpineBefore
!= alpineAfter
)
1000 if (!JaguarLoadFile(vjs
.alpineROMPath
) && !AlpineLoadFile(vjs
.alpineROMPath
))
1002 // Oh crap, we couldn't get the file! Alert the media!
1004 msg
.setText(QString(tr("Could not load file \"%1\"!")).arg(vjs
.alpineROMPath
));
1005 msg
.setIcon(QMessageBox::Warning
);
1010 // If the "ABS" ROM is changed, then let's load it...
1011 if (absBefore
!= absAfter
)
1013 if (!JaguarLoadFile(vjs
.absROMPath
))
1015 // Oh crap, we couldn't get the file! Alert the media!
1017 msg
.setText(QString(tr("Could not load file \"%1\"!")).arg(vjs
.absROMPath
));
1018 msg
.setIcon(QMessageBox::Warning
);
1023 // If the "Enable DSP" checkbox changed, then we have to re-init the DAC,
1024 // since it's running in the host audio IRQ...
1025 if (audioBefore
!= audioAfter
)
1031 // Just in case we crash before a clean exit...
1034 DebuggerRefreshWindows();
1039 // Here's the main emulator loop
1041 void MainWin::Timer(void)
1044 static uint32_t ntscTickCount
;
1045 if (vjs
.hardwareTypeNTSC
)
1049 timer
->start(16 + (ntscTickCount
== 0 ? 1 : 0));
1056 if (showUntunedTankCircuit
)
1058 // Some machines can't handle this, so we give them the option to disable it. :-)
1059 if (!plzDontKillMyComputer
)
1061 // if (!vjs.softTypeDebugger)
1063 // Random hash & trash
1064 // We try to simulate an untuned tank circuit here... :-)
1065 for (uint32_t x
= 0; x
< videoWidget
->rasterWidth
; x
++)
1067 for (uint32_t y
= 0; y
< videoWidget
->rasterHeight
; y
++)
1069 videoWidget
->buffer
[(y
* videoWidget
->textureWidth
) + x
] = (rand() & 0xFF) << 8 | (rand() & 0xFF) << 16 | (rand() & 0xFF) << 24;
1077 // Otherwise, run the Jaguar simulation
1080 //if (!vjs.softTypeDebugger)
1081 videoWidget
->HandleMouseHiding();
1083 static uint32_t refresh
= 0;
1084 // Do autorefresh on debug windows
1085 // Have to be careful, too much causes the emulator to slow way down!
1086 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
1088 if (refresh
== vjs
.refresh
)
1090 AlpineRefreshWindows();
1091 //memBrowseWin->RefreshContents();
1092 //cpuBrowseWin->RefreshContents();
1100 //if (!vjs.softTypeDebugger)
1101 videoWidget
->updateGL();
1104 // Approach: We use a ring buffer to store times (in ms) over a given
1105 // amount of frames, then sum them to figure out the FPS.
1106 uint32_t timestamp
= SDL_GetTicks();
1107 // This assumes the ring buffer size is a power of 2
1108 // ringBufferPointer = (ringBufferPointer + 1) & (RING_BUFFER_SIZE - 1);
1109 // Doing it this way is better. Ring buffer size can be arbitrary then.
1110 ringBufferPointer
= (ringBufferPointer
+ 1) % RING_BUFFER_SIZE
;
1111 ringBuffer
[ringBufferPointer
] = timestamp
- oldTimestamp
;
1112 uint32_t elapsedTime
= 0;
1114 for(uint32_t i
=0; i
<RING_BUFFER_SIZE
; i
++)
1115 elapsedTime
+= ringBuffer
[i
];
1117 // elapsedTime must be non-zero
1118 if (elapsedTime
== 0)
1121 // This is in frames per 10 seconds, so we can have 1 decimal
1122 uint32_t framesPerSecond
= (uint32_t)(((float)RING_BUFFER_SIZE
/ (float)elapsedTime
) * 10000.0);
1123 uint32_t fpsIntegerPart
= framesPerSecond
/ 10;
1124 uint32_t fpsDecimalPart
= framesPerSecond
% 10;
1125 // If this is updated too frequently to be useful, we can throttle it down
1126 // so that it only updates every 10th frame or so
1127 statusBar()->showMessage(QString("%1.%2 FPS").arg(fpsIntegerPart
).arg(fpsDecimalPart
));
1128 oldTimestamp
= timestamp
;
1130 if (M68KDebugHaltStatus())
1135 // Toggle the power state, it can be either on or off
1136 void MainWin::TogglePowerState(void)
1138 powerButtonOn
= !powerButtonOn
;
1141 // With the power off, we simulate white noise on the screen. :-)
1144 // Restore the mouse pointer, if hidden:
1145 //if (!vjs.softTypeDebugger)
1147 videoWidget
->CheckAndRestoreMouseCursor();
1150 useCDAct
->setDisabled(false);
1151 palAct
->setDisabled(false);
1152 ntscAct
->setDisabled(false);
1153 pauseAct
->setChecked(false);
1154 pauseAct
->setDisabled(true);
1155 showUntunedTankCircuit
= true;
1157 DACPauseAudioThread();
1158 // 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. :-)
1161 if (plzDontKillMyComputer
)
1163 // We have to do it line by line, because the texture pitch is not the same as the picture buffer's pitch.
1164 for (uint32_t y
= 0; y
< videoWidget
->rasterHeight
; y
++)
1166 if (vjs
.hardwareTypeNTSC
)
1168 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1172 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern2
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1179 useCDAct
->setDisabled(true);
1180 palAct
->setDisabled(true);
1181 ntscAct
->setDisabled(true);
1182 pauseAct
->setChecked(false);
1183 pauseAct
->setDisabled(false);
1184 showUntunedTankCircuit
= false;
1186 // Otherwise, we prepare for running regular software...
1189 // Should check for cartridgeLoaded here as well...!
1190 // We can clear it when toggling CDActive on, so that when we power cycle it
1191 // does the expected thing. Otherwise, if we use the file picker to insert a
1192 // cart, we expect to run the cart! Maybe have a RemoveCart function that only
1193 // works if the CD unit is active?
1194 setWindowTitle(QString("Virtual Jaguar " VJ_RELEASE_VERSION
" Rx - Now playing: Jaguar CD"));
1197 WriteLog("GUI: Resetting Jaguar...\n");
1199 DebuggerResetWindows();
1200 DACPauseAudioThread(false);
1205 // Toggle the emulator state, it can be either on or off
1206 void MainWin::ToggleRunState(void)
1208 startM68KTracing
= running
;
1214 // Set action buttons for the pause mode
1215 frameAdvanceAct
->setDisabled(false);
1216 pauseAct
->setChecked(true);
1217 pauseAct
->setDisabled(false);
1218 if (vjs
.softTypeDebugger
)
1220 traceStepIntoAct
->setDisabled(false);
1221 traceStepOverAct
->setDisabled(false);
1222 restartAct
->setDisabled(false);
1223 m68kDasmWin
->Use68KPCAddress();
1224 GPUDasmWin
->UseGPUPCAddress();
1225 DSPDasmWin
->UseDSPPCAddress();
1228 //if (!vjs.softTypeDebugger)
1230 // Restore the mouse pointer, if hidden:
1231 videoWidget
->CheckAndRestoreMouseCursor();
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 // Setup BIOS in his own dedicated Jaguar memory
1371 #ifndef NEWMODELSBIOSHANDLER
1372 uint8_t * biosPointer
= jaguarBootROM
;
1374 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
1376 biosPointer
= jaguarDevBootROM2
;
1379 memcpy(jagMemSpace
+ 0xE00000, biosPointer
, 0x20000);
1381 SelectBIOS(vjs
.biosType
);
1384 // Turn 'on' the power to initialize the Jaguar
1385 powerAct
->setDisabled(false);
1386 powerAct
->setChecked(true);
1387 powerButtonOn
= false;
1390 // We have to load our software *after* the Jaguar RESET
1391 cartridgeLoaded
= JaguarLoadFile(file
.toUtf8().data());
1392 SET32(jaguarMainRAM
, 0, vjs
.DRAM_size
); // Set stack in the M68000's Reset SP
1394 // This is icky because we've already done it
1395 // it gets worse :-P
1396 if (!vjs
.useJaguarBIOS
)
1398 SET32(jaguarMainRAM
, 4, jaguarRunAddress
);
1403 // set the M68K in halt mode in case of a debug mode is used, so control is at user side
1404 if (vjs
.softTypeDebugger
)
1406 m68k_set_reg(M68K_REG_A6
, 0);
1407 m68kDasmWin
->SetAddress(jaguarRunAddress
);
1408 //pauseAct->setDisabled(false);
1409 //pauseAct->setChecked(true);
1415 // Prevent the launch in case of software without a start address and without BIOS presence
1416 if (!vjs
.useJaguarBIOS
&& !jaguarRunAddress
)
1422 if ((!vjs
.hardwareTypeAlpine
|| !vjs
.softTypeDebugger
) && !loadAndGo
&& jaguarRunAddress
)
1424 QString newTitle
= QString("Virtual Jaguar " VJ_RELEASE_VERSION
" Rx - Now playing: %1").arg(filePickWin
->GetSelectedPrettyName());
1425 setWindowTitle(newTitle
);
1430 void MainWin::ToggleCDUsage(void)
1432 CDActive
= !CDActive
;
1434 // Set up the Jaguar CD for execution, otherwise, clear memory
1436 memcpy(jagMemSpace
+ 0x800000, jaguarCDBootROM
, 0x40000);
1438 memset(jagMemSpace
+ 0x800000, 0xFF, 0x40000);
1443 void MainWin::NewBreakpointFunction(void)
1446 //brkWin->RefreshContents();
1451 void MainWin::DebuggerTraceStepInto(void)
1454 videoWidget
->updateGL();
1455 DebuggerRefreshWindows();
1457 #pragma message("Warning: !!! Need to verify the Step Into function !!!")
1459 #warning "!!! Need to verify the Step Into function !!!"
1465 void MainWin::DebuggerRestart(void)
1470 m68k_set_reg(M68K_REG_PC
, jaguarRunAddress
);
1471 m68k_set_reg(M68K_REG_SP
, vjs
.DRAM_size
);
1473 m68k_set_reg(M68K_REG_A6
, 0);
1475 DebuggerResetWindows();
1476 DebuggerRefreshWindows();
1478 #pragma message("Warning: !!! Need to verify the Restart function !!!")
1480 #warning "!!! Need to verify the Restart function !!!"
1486 void MainWin::DebuggerTraceStepOver(void)
1489 videoWidget
->updateGL();
1490 DebuggerRefreshWindows();
1492 #pragma message("Warning: !!! Need to verify the Step Over function !!!")
1494 #warning "!!! Need to verify the Step Over function !!!"
1499 // Advance / Execute for one frame
1500 void MainWin::FrameAdvance(void)
1502 //printf("Frame Advance...\n");
1504 // Execute 1 frame, then exit (only useful in Pause mode)
1506 //if (!vjs.softTypeDebugger)
1507 videoWidget
->updateGL();
1509 // Need to execute 1 frames' worth of DSP thread as well :-/
1511 //m68kDasmWin->Use68KPCAddress();
1514 #pragma message("Warning: !!! Need to execute the DSP thread for 1 frame too !!!")
1516 #warning "!!! Need to execute the DSP thread for 1 frame too !!!"
1521 void MainWin::SetFullScreen(bool state
/*= true*/)
1523 if (!vjs
.softTypeDebugger
)
1527 mainWinPosition
= pos();
1529 statusBar()->hide();
1535 // This is needed because the fullscreen may happen on a different
1536 // screen than screen 0:
1537 int screenNum
= QApplication::desktop()->screenNumber(videoWidget
);
1538 QRect r
= QApplication::desktop()->screenGeometry(screenNum
);
1539 double targetWidth
= (double)VIRTUAL_SCREEN_WIDTH
,
1540 targetHeight
= (double)(vjs
.hardwareTypeNTSC
? VIRTUAL_SCREEN_HEIGHT_NTSC
: VIRTUAL_SCREEN_HEIGHT_PAL
);
1541 double aspectRatio
= targetWidth
/ targetHeight
;
1542 // NOTE: Really should check here to see which dimension constrains the
1543 // other. Right now, we assume that height is the constraint.
1544 int newWidth
= (int)(aspectRatio
* (double)r
.height());
1545 videoWidget
->offset
= (r
.width() - newWidth
) / 2;
1546 videoWidget
->fullscreen
= true;
1547 videoWidget
->outputWidth
= newWidth
;
1548 videoWidget
->setFixedSize(r
.width(), r
.height());
1553 // Seems Qt is fussy about this: showNormal() has to go first, or it
1554 // will keep the window stuck in a psuedo-fullscreen mode with no way
1555 // to get out of it (except closing the app).
1558 // Reset the video widget to windowed mode
1559 videoWidget
->offset
= 0;
1560 videoWidget
->fullscreen
= false;
1562 statusBar()->show();
1569 move(mainWinPosition
);
1575 void MainWin::ToggleFullScreen(void)
1577 fullScreen
= !fullScreen
;
1578 SetFullScreen(fullScreen
);
1583 void MainWin::ShowExceptionVectorTableBrowserWin(void)
1585 exceptionvectortableBrowseWin
->show();
1586 exceptionvectortableBrowseWin
->RefreshContents();
1591 void MainWin::ShowLocalBrowserWin(void)
1593 LocalBrowseWin
->show();
1594 LocalBrowseWin
->RefreshContents();
1599 void MainWin::ShowCallStackBrowserWin(void)
1601 CallStackBrowseWin
->show();
1602 CallStackBrowseWin
->RefreshContents();
1606 void MainWin::ShowAllWatchBrowserWin(void)
1608 allWatchBrowseWin
->show();
1609 allWatchBrowseWin
->RefreshContents();
1613 void MainWin::ShowHeapAllocatorBrowserWin(void)
1615 heapallocatorBrowseWin
->show();
1616 heapallocatorBrowseWin
->RefreshContents();
1620 void MainWin::ShowMemoryBrowserWin(void)
1622 memBrowseWin
->show();
1623 memBrowseWin
->RefreshContents();
1627 void MainWin::ShowMemory1BrowserWin(int NumWin
)
1629 // for (int i = 0; i < vjs.nbrmemory1browserwindow; i++)
1631 mem1BrowseWin
[NumWin
]->show();
1632 mem1BrowseWin
[NumWin
]->RefreshContents(NumWin
);
1637 void MainWin::ShowEmuStatusWin(void)
1639 emuStatusWin
->show();
1640 emuStatusWin
->RefreshContents();
1644 void MainWin::ShowStackBrowserWin(void)
1646 stackBrowseWin
->show();
1647 stackBrowseWin
->RefreshContents();
1651 void MainWin::ShowCPUBrowserWin(void)
1653 cpuBrowseWin
->show();
1654 cpuBrowseWin
->RefreshContents();
1658 void MainWin::ShowOPBrowserWin(void)
1660 opBrowseWin
->show();
1661 opBrowseWin
->RefreshContents();
1665 void MainWin::ShowM68KDasmBrowserWin(void)
1667 m68kDasmBrowseWin
->show();
1668 m68kDasmBrowseWin
->RefreshContents();
1672 void MainWin::ShowRISCDasmBrowserWin(void)
1674 riscDasmBrowseWin
->show();
1675 riscDasmBrowseWin
->RefreshContents();
1681 void MainWin::ShowDasmWin(void)
1684 // DasmWin->RefreshContents();
1691 void MainWin::ShowVideoOutputWin(void)
1693 //VideoOutputWindowCentrale = mainWindowCentrale->addSubWindow(videoWidget);
1694 //VideoOutputWindowCentrale->setWindowTitle(QString(tr("Video output")));
1695 //VideoOutputWindowCentrale->show();
1696 //memBrowseWin->show();
1697 //VideoOutputWin->show();
1698 //VideoOutputWin->RefreshContents(videoWidget);
1703 // Resize video window based on zoom factor
1704 // It doesn't apply in debugger mode as we use this window to display disassembly
1705 void MainWin::ResizeMainWindow(void)
1707 if (!vjs
.softTypeDebugger
)
1709 videoWidget
->setFixedSize(zoomLevel
* VIRTUAL_SCREEN_WIDTH
, zoomLevel
* (vjs
.hardwareTypeNTSC
? VIRTUAL_SCREEN_HEIGHT_NTSC
: VIRTUAL_SCREEN_HEIGHT_PAL
));
1711 // Show the test pattern if user requested plzDontKillMyComputer mode
1712 if (!powerButtonOn
&& plzDontKillMyComputer
)
1714 for (uint32_t y
= 0; y
< videoWidget
->rasterHeight
; y
++)
1716 if (vjs
.hardwareTypeNTSC
)
1718 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1722 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern2
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1733 void MainWin::ReadSettings(void)
1737 QSettings
settings("Underground Software", "Virtual Jaguar");
1739 //zoomLevel = settings.value("zoom", 2).toInt();
1740 allowUnknownSoftware
= settings
.value("showUnknownSoftware", false).toBool();
1741 lastEditedProfile
= settings
.value("lastEditedProfile", 0).toInt();
1743 vjs
.useJoystick
= settings
.value("useJoystick", false).toBool();
1744 vjs
.joyport
= settings
.value("joyport", 0).toInt();
1745 vjs
.hardwareTypeNTSC
= settings
.value("hardwareTypeNTSC", true).toBool();
1746 vjs
.frameSkip
= settings
.value("frameSkip", 0).toInt();
1747 vjs
.useJaguarBIOS
= settings
.value("useJaguarBIOS", false).toBool();
1748 vjs
.useRetailBIOS
= settings
.value("useRetailBIOS", false).toBool();
1749 vjs
.useDevBIOS
= settings
.value("useDevBIOS", false).toBool();
1750 vjs
.GPUEnabled
= settings
.value("GPUEnabled", true).toBool();
1751 vjs
.DSPEnabled
= settings
.value("DSPEnabled", true).toBool();
1752 vjs
.audioEnabled
= settings
.value("audioEnabled", true).toBool();
1753 vjs
.usePipelinedDSP
= settings
.value("usePipelinedDSP", false).toBool();
1754 vjs
.fullscreen
= settings
.value("fullscreen", false).toBool();
1755 vjs
.useOpenGL
= settings
.value("useOpenGL", true).toBool();
1756 vjs
.glFilter
= settings
.value("glFilterType", 1).toInt();
1757 vjs
.renderType
= settings
.value("renderType", 0).toInt();
1758 vjs
.biosType
= settings
.value("biosType", BT_M_SERIES
).toInt();
1759 vjs
.jaguarModel
= settings
.value("jaguarModel", JAG_M_SERIES
).toInt();
1760 vjs
.useFastBlitter
= settings
.value("useFastBlitter", false).toBool();
1761 strcpy(vjs
.EEPROMPath
, settings
.value("EEPROMs", QStandardPaths::writableLocation(QStandardPaths::DataLocation
).append("/eeproms/")).toString().toUtf8().data());
1762 strcpy(vjs
.ROMPath
, settings
.value("ROMs", QStandardPaths::writableLocation(QStandardPaths::DataLocation
).append("/software/")).toString().toUtf8().data());
1763 strcpy(vjs
.screenshotPath
, settings
.value("Screenshots", QStandardPaths::writableLocation(QStandardPaths::DataLocation
).append("/screenshots/")).toString().toUtf8().data());
1765 // Read settings from the Debugger mode
1766 settings
.beginGroup("debugger");
1767 strcpy(vjs
.debuggerROMPath
, settings
.value("DefaultROM", "").toString().toUtf8().data());
1768 strcpy(vjs
.sourcefilesearchPaths
, settings
.value("SourceFileSearchPaths", "").toString().toUtf8().data());
1769 vjs
.nbrdisasmlines
= settings
.value("NbrDisasmLines", 32).toUInt();
1770 vjs
.disasmopcodes
= settings
.value("DisasmOpcodes", true).toBool();
1771 vjs
.displayHWlabels
= settings
.value("DisplayHWLabels", true).toBool();
1772 vjs
.displayFullSourceFilename
= settings
.value("displayFullSourceFilename", true).toBool();
1773 vjs
.nbrmemory1browserwindow
= settings
.value("NbrMemory1BrowserWindow", MaxMemory1BrowserWindow
).toUInt();
1774 settings
.endGroup();
1776 // Read settings from the Alpine mode
1777 settings
.beginGroup("alpine");
1778 strcpy(vjs
.alpineROMPath
, settings
.value("DefaultROM", "").toString().toUtf8().data());
1779 strcpy(vjs
.absROMPath
, settings
.value("DefaultABS", "").toString().toUtf8().data());
1780 vjs
.refresh
= settings
.value("refresh", 60).toUInt();
1781 vjs
.allowWritesToROM
= settings
.value("writeROM", false).toBool();
1782 settings
.endGroup();
1784 // Read settings from the Keybindings
1785 settings
.beginGroup("keybindings");
1786 for (i
= 0; i
< KB_END
; i
++)
1788 strcpy(vjs
.KBContent
[i
].KBSettingValue
, settings
.value(KeyBindingsTable
[i
].KBNameSetting
, KeyBindingsTable
[i
].KBDefaultValue
).toString().toUtf8().data());
1790 settings
.endGroup();
1792 // Write important settings to the log file
1793 WriteLog("MainWin: Paths\n");
1794 WriteLog(" EEPROMPath = \"%s\"\n", vjs
.EEPROMPath
);
1795 WriteLog(" ROMPath = \"%s\"\n", vjs
.ROMPath
);
1796 WriteLog(" AlpineROMPath = \"%s\"\n", vjs
.alpineROMPath
);
1797 WriteLog(" DebuggerROMPath = \"%s\"\n", vjs
.debuggerROMPath
);
1798 WriteLog(" absROMPath = \"%s\"\n", vjs
.absROMPath
);
1799 WriteLog(" ScreenshotsPath = \"%s\"\n", vjs
.screenshotPath
);
1800 WriteLog("SourceFileSearchPaths = \"%s\"\n", vjs
.sourcefilesearchPaths
);
1801 WriteLog("MainWin: Misc.\n");
1802 WriteLog(" Pipelined DSP = %s\n", (vjs
.usePipelinedDSP
? "ON" : "off"));
1805 // Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, *
1806 vjs
.p1KeyBindings
[BUTTON_U
] = settings
.value("p1k_up", Qt::Key_S
).toInt();
1807 vjs
.p1KeyBindings
[BUTTON_D
] = settings
.value("p1k_down", Qt::Key_X
).toInt();
1808 vjs
.p1KeyBindings
[BUTTON_L
] = settings
.value("p1k_left", Qt::Key_A
).toInt();
1809 vjs
.p1KeyBindings
[BUTTON_R
] = settings
.value("p1k_right", Qt::Key_D
).toInt();
1810 vjs
.p1KeyBindings
[BUTTON_C
] = settings
.value("p1k_c", Qt::Key_J
).toInt();
1811 vjs
.p1KeyBindings
[BUTTON_B
] = settings
.value("p1k_b", Qt::Key_K
).toInt();
1812 vjs
.p1KeyBindings
[BUTTON_A
] = settings
.value("p1k_a", Qt::Key_L
).toInt();
1813 vjs
.p1KeyBindings
[BUTTON_OPTION
] = settings
.value("p1k_option", Qt::Key_O
).toInt();
1814 vjs
.p1KeyBindings
[BUTTON_PAUSE
] = settings
.value("p1k_pause", Qt::Key_P
).toInt();
1815 vjs
.p1KeyBindings
[BUTTON_0
] = settings
.value("p1k_0", Qt::Key_0
).toInt();
1816 vjs
.p1KeyBindings
[BUTTON_1
] = settings
.value("p1k_1", Qt::Key_1
).toInt();
1817 vjs
.p1KeyBindings
[BUTTON_2
] = settings
.value("p1k_2", Qt::Key_2
).toInt();
1818 vjs
.p1KeyBindings
[BUTTON_3
] = settings
.value("p1k_3", Qt::Key_3
).toInt();
1819 vjs
.p1KeyBindings
[BUTTON_4
] = settings
.value("p1k_4", Qt::Key_4
).toInt();
1820 vjs
.p1KeyBindings
[BUTTON_5
] = settings
.value("p1k_5", Qt::Key_5
).toInt();
1821 vjs
.p1KeyBindings
[BUTTON_6
] = settings
.value("p1k_6", Qt::Key_6
).toInt();
1822 vjs
.p1KeyBindings
[BUTTON_7
] = settings
.value("p1k_7", Qt::Key_7
).toInt();
1823 vjs
.p1KeyBindings
[BUTTON_8
] = settings
.value("p1k_8", Qt::Key_8
).toInt();
1824 vjs
.p1KeyBindings
[BUTTON_9
] = settings
.value("p1k_9", Qt::Key_9
).toInt();
1825 vjs
.p1KeyBindings
[BUTTON_d
] = settings
.value("p1k_pound", Qt::Key_Minus
).toInt();
1826 vjs
.p1KeyBindings
[BUTTON_s
] = settings
.value("p1k_star", Qt::Key_Equal
).toInt();
1828 vjs
.p2KeyBindings
[BUTTON_U
] = settings
.value("p2k_up", Qt::Key_Up
).toInt();
1829 vjs
.p2KeyBindings
[BUTTON_D
] = settings
.value("p2k_down", Qt::Key_Down
).toInt();
1830 vjs
.p2KeyBindings
[BUTTON_L
] = settings
.value("p2k_left", Qt::Key_Left
).toInt();
1831 vjs
.p2KeyBindings
[BUTTON_R
] = settings
.value("p2k_right", Qt::Key_Right
).toInt();
1832 vjs
.p2KeyBindings
[BUTTON_C
] = settings
.value("p2k_c", Qt::Key_Z
).toInt();
1833 vjs
.p2KeyBindings
[BUTTON_B
] = settings
.value("p2k_b", Qt::Key_X
).toInt();
1834 vjs
.p2KeyBindings
[BUTTON_A
] = settings
.value("p2k_a", Qt::Key_C
).toInt();
1835 vjs
.p2KeyBindings
[BUTTON_OPTION
] = settings
.value("p2k_option", Qt::Key_Apostrophe
).toInt();
1836 vjs
.p2KeyBindings
[BUTTON_PAUSE
] = settings
.value("p2k_pause", Qt::Key_Return
).toInt();
1837 vjs
.p2KeyBindings
[BUTTON_0
] = settings
.value("p2k_0", Qt::Key_0
).toInt();
1838 vjs
.p2KeyBindings
[BUTTON_1
] = settings
.value("p2k_1", Qt::Key_1
).toInt();
1839 vjs
.p2KeyBindings
[BUTTON_2
] = settings
.value("p2k_2", Qt::Key_2
).toInt();
1840 vjs
.p2KeyBindings
[BUTTON_3
] = settings
.value("p2k_3", Qt::Key_3
).toInt();
1841 vjs
.p2KeyBindings
[BUTTON_4
] = settings
.value("p2k_4", Qt::Key_4
).toInt();
1842 vjs
.p2KeyBindings
[BUTTON_5
] = settings
.value("p2k_5", Qt::Key_5
).toInt();
1843 vjs
.p2KeyBindings
[BUTTON_6
] = settings
.value("p2k_6", Qt::Key_6
).toInt();
1844 vjs
.p2KeyBindings
[BUTTON_7
] = settings
.value("p2k_7", Qt::Key_7
).toInt();
1845 vjs
.p2KeyBindings
[BUTTON_8
] = settings
.value("p2k_8", Qt::Key_8
).toInt();
1846 vjs
.p2KeyBindings
[BUTTON_9
] = settings
.value("p2k_9", Qt::Key_9
).toInt();
1847 vjs
.p2KeyBindings
[BUTTON_d
] = settings
.value("p2k_pound", Qt::Key_Slash
).toInt();
1848 vjs
.p2KeyBindings
[BUTTON_s
] = settings
.value("p2k_star", Qt::Key_Asterisk
).toInt();
1851 WriteLog("Read setting = Done\n");
1853 ReadProfiles(&settings
);
1854 DBGManager_SourceFileSearchPathsSet(vjs
.sourcefilesearchPaths
);
1859 // Default values will be used in case of no settings can be found
1861 #pragma message("Warning: !!! Need to check the window geometry to see if the positions are legal !!!")
1863 #warning "!!! Need to check the window geometry to see if the positions are legal !!!"
1865 // i.e., someone could drag it to another screen, close it, then disconnect that screen
1866 void MainWin::ReadUISettings(void)
1873 // Point on the emulator settings
1874 QSettings
settings("Underground Software", "Virtual Jaguar");
1875 settings
.beginGroup("ui");
1877 // Emulator main window UI information
1878 mainWinPosition
= settings
.value("pos", QPoint(200, 200)).toPoint();
1879 size
= settings
.value("size", QSize(400, 400)).toSize();
1881 move(mainWinPosition
);
1882 pos
= settings
.value("cartLoadPos", QPoint(200, 200)).toPoint();
1883 filePickWin
->move(pos
);
1885 // Video output information
1886 zoomLevel
= settings
.value("zoom", 2).toInt();
1888 // Alpine debug UI information (also needed by the Debugger)
1889 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
1891 // CPU registers UI information
1892 pos
= settings
.value("cpuBrowseWinPos", QPoint(200, 200)).toPoint();
1893 cpuBrowseWin
->move(pos
);
1894 settings
.value("cpuBrowseWinIsVisible", false).toBool() ? ShowCPUBrowserWin() : void();
1896 // Memory browser UI information
1897 pos
= settings
.value("memBrowseWinPos", QPoint(200, 200)).toPoint();
1898 memBrowseWin
->move(pos
);
1899 settings
.value("memBrowseWinIsVisible", false).toBool() ? ShowMemoryBrowserWin() : void();
1901 // Stack browser UI information
1902 pos
= settings
.value("stackBrowseWinPos", QPoint(200, 200)).toPoint();
1903 stackBrowseWin
->move(pos
);
1904 settings
.value("stackBrowseWinIsVisible", false).toBool() ? ShowStackBrowserWin() : void();
1905 size
= settings
.value("stackBrowseWinSize", QSize(400, 400)).toSize();
1906 stackBrowseWin
->resize(size
);
1908 // Emulator status UI information
1909 pos
= settings
.value("emuStatusWinPos", QPoint(200, 200)).toPoint();
1910 emuStatusWin
->move(pos
);
1911 settings
.value("emuStatusWinIsVisible", false).toBool() ? ShowEmuStatusWin() : void();
1913 // OP (Object Processor) UI information
1914 pos
= settings
.value("opBrowseWinPos", QPoint(200, 200)).toPoint();
1915 opBrowseWin
->move(pos
);
1916 settings
.value("opBrowseWinIsVisible", false).toBool() ? ShowOPBrowserWin() : void();
1917 size
= settings
.value("opBrowseWinSize", QSize(400, 400)).toSize();
1918 opBrowseWin
->resize(size
);
1920 // RISC disassembly UI information
1921 pos
= settings
.value("riscDasmBrowseWinPos", QPoint(200, 200)).toPoint();
1922 riscDasmBrowseWin
->move(pos
);
1923 settings
.value("riscDasmBrowseWinIsVisible", false).toBool() ? ShowRISCDasmBrowserWin() : void();
1925 // M68k disassembly UI information
1926 pos
= settings
.value("m68kDasmBrowseWinPos", QPoint(200, 200)).toPoint();
1927 m68kDasmBrowseWin
->move(pos
);
1928 //settings.value("m68kDasmBrowseWinIsVisible", false).toBool() ? ShowM68KDasmBrowserWin() : void();
1930 #pragma message("Warning: !!! Need to check the M68k disassembly window position crashing !!!")
1932 #warning "!!! Need to check the M68k disassembly window position crashing !!!"
1936 // Debugger UI information
1937 if (vjs
.softTypeDebugger
)
1940 pos
= settings
.value("m68kDasmWinPos", QPoint(200, 200)).toPoint();
1941 m68kDasmWin
->move(pos
);
1942 //settings.value("m68kDasmWinIsVisible", false).toBool() ? m68kDasmWin->show() : m68kDasmWin->hide();
1943 pos
= settings
.value("GPUDasmWinPos", QPoint(200, 200)).toPoint();
1944 GPUDasmWin
->move(pos
);
1945 pos
= settings
.value("DSPDasmWinPos", QPoint(200, 200)).toPoint();
1946 DSPDasmWin
->move(pos
);
1948 // All watch browser UI information
1949 pos
= settings
.value("allWatchBrowseWinPos", QPoint(200, 200)).toPoint();
1950 allWatchBrowseWin
->move(pos
);
1951 settings
.value("allWatchBrowseWinIsVisible", false).toBool() ? ShowAllWatchBrowserWin() : void();
1952 size
= settings
.value("allWatchBrowseWinSize", QSize(400, 400)).toSize();
1953 allWatchBrowseWin
->resize(size
);
1955 // Local browser UI information
1956 pos
= settings
.value("LocalBrowseWinPos", QPoint(200, 200)).toPoint();
1957 LocalBrowseWin
->move(pos
);
1958 settings
.value("LocalBrowseWinIsVisible", false).toBool() ? ShowLocalBrowserWin() : void();
1959 size
= settings
.value("LocalBrowseWinSize", QSize(400, 400)).toSize();
1960 LocalBrowseWin
->resize(size
);
1962 // Heap memory allocation browser UI information
1963 pos
= settings
.value("heapallocatorBrowseWinPos", QPoint(200, 200)).toPoint();
1964 heapallocatorBrowseWin
->move(pos
);
1965 settings
.value("heapallocatorBrowseWinIsVisible", false).toBool() ? ShowHeapAllocatorBrowserWin() : void();
1966 size
= settings
.value("heapallocatorBrowseWinSize", QSize(400, 400)).toSize();
1967 heapallocatorBrowseWin
->resize(size
);
1969 // Exception Vector Table UI Information
1970 pos
= settings
.value("exceptionVectorTableBrowseWinPos", QPoint(200, 200)).toPoint();
1971 exceptionvectortableBrowseWin
->move(pos
);
1972 settings
.value("exceptionVectorTableBrowseWinIsVisible", false).toBool() ? ShowExceptionVectorTableBrowserWin() : void();
1973 size
= settings
.value("exceptionVectorTableBrowseWinSize", QSize(400, 400)).toSize();
1974 exceptionvectortableBrowseWin
->resize(size
);
1976 // Call Stack browser UI information
1977 pos
= settings
.value("CallStackBrowseWinPos", QPoint(200, 200)).toPoint();
1978 CallStackBrowseWin
->move(pos
);
1979 settings
.value("CallStackBrowseWinIsVisible", false).toBool() ? ShowCallStackBrowserWin() : void();
1980 size
= settings
.value("CallStackBrowseWinSize", QSize(400, 400)).toSize();
1981 CallStackBrowseWin
->resize(size
);
1983 // Memories browser UI information
1984 for (i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
1986 sprintf(mem1Name
, "mem1BrowseWinPos[%i]", (unsigned int)i
);
1987 pos
= settings
.value(mem1Name
, QPoint(200, 200)).toPoint();
1988 mem1BrowseWin
[i
]->move(pos
);
1989 sprintf(mem1Name
, "mem1BrowseWinIsVisible[%i]", (unsigned int)i
);
1990 settings
.value(mem1Name
, false).toBool() ? ShowMemory1BrowserWin((int)i
) : void();
1991 sprintf(mem1Name
, "mem1BrowseWinSize[%i]", (unsigned int)i
);
1992 size
= settings
.value(mem1Name
, QSize(400, 400)).toSize();
1993 mem1BrowseWin
[i
]->resize(size
);
1997 settings
.endGroup();
1999 WriteLog("Read UI setting = Done\n");
2003 // Save the settings
2004 void MainWin::WriteSettings(void)
2008 // Point on the emulator settings
2009 QSettings
settings("Underground Software", "Virtual Jaguar");
2010 //settings.setValue("pos", pos());
2011 //settings.setValue("size", size());
2012 //settings.setValue("cartLoadPos", filePickWin->pos());
2014 //settings.setValue("zoom", zoomLevel);
2015 settings
.setValue("showUnknownSoftware", allowUnknownSoftware
);
2016 settings
.setValue("lastEditedProfile", lastEditedProfile
);
2018 settings
.setValue("useJoystick", vjs
.useJoystick
);
2019 settings
.setValue("joyport", vjs
.joyport
);
2020 settings
.setValue("hardwareTypeNTSC", vjs
.hardwareTypeNTSC
);
2021 settings
.setValue("frameSkip", vjs
.frameSkip
);
2022 settings
.setValue("useJaguarBIOS", vjs
.useJaguarBIOS
);
2023 settings
.setValue("useRetailBIOS", vjs
.useRetailBIOS
);
2024 settings
.setValue("useDevBIOS", vjs
.useDevBIOS
);
2025 settings
.setValue("GPUEnabled", vjs
.GPUEnabled
);
2026 settings
.setValue("DSPEnabled", vjs
.DSPEnabled
);
2027 settings
.setValue("audioEnabled", vjs
.audioEnabled
);
2028 settings
.setValue("usePipelinedDSP", vjs
.usePipelinedDSP
);
2029 settings
.setValue("fullscreen", vjs
.fullscreen
);
2030 settings
.setValue("useOpenGL", vjs
.useOpenGL
);
2031 settings
.setValue("glFilterType", vjs
.glFilter
);
2032 settings
.setValue("renderType", vjs
.renderType
);
2033 settings
.setValue("jaguarModel", vjs
.jaguarModel
);
2034 settings
.setValue("biosType", vjs
.biosType
);
2035 settings
.setValue("useFastBlitter", vjs
.useFastBlitter
);
2036 //settings.setValue("JagBootROM", vjs.jagBootPath);
2037 //settings.setValue("CDBootROM", vjs.CDBootPath);
2038 settings
.setValue("EEPROMs", vjs
.EEPROMPath
);
2039 settings
.setValue("ROMs", vjs
.ROMPath
);
2040 settings
.setValue("Screenshots", vjs
.screenshotPath
);
2042 // Write settings from the Alpine mode
2043 settings
.beginGroup("alpine");
2044 settings
.setValue("refresh", vjs
.refresh
);
2045 settings
.setValue("DefaultROM", vjs
.alpineROMPath
);
2046 settings
.setValue("DefaultABS", vjs
.absROMPath
);
2047 settings
.setValue("writeROM", vjs
.allowWritesToROM
);
2048 settings
.endGroup();
2050 // Write settings from the Debugger mode
2051 settings
.beginGroup("debugger");
2052 settings
.setValue("DisplayHWLabels", vjs
.displayHWlabels
);
2053 settings
.setValue("NbrDisasmLines", vjs
.nbrdisasmlines
);
2054 settings
.setValue("DisasmOpcodes", vjs
.disasmopcodes
);
2055 settings
.setValue("displayFullSourceFilename", vjs
.displayFullSourceFilename
);
2056 settings
.setValue("NbrMemory1BrowserWindow", (unsigned int)vjs
.nbrmemory1browserwindow
);
2057 settings
.setValue("DefaultROM", vjs
.debuggerROMPath
);
2058 settings
.setValue("SourceFileSearchPaths", vjs
.sourcefilesearchPaths
);
2059 settings
.endGroup();
2061 // Write settings from the Keybindings
2062 settings
.beginGroup("keybindings");
2063 for (i
= 0; i
< KB_END
; i
++)
2065 settings
.setValue(KeyBindingsTable
[i
].KBNameSetting
, vjs
.KBContent
[i
].KBSettingValue
);
2067 settings
.endGroup();
2070 settings
.setValue("p1k_up", vjs
.p1KeyBindings
[BUTTON_U
]);
2071 settings
.setValue("p1k_down", vjs
.p1KeyBindings
[BUTTON_D
]);
2072 settings
.setValue("p1k_left", vjs
.p1KeyBindings
[BUTTON_L
]);
2073 settings
.setValue("p1k_right", vjs
.p1KeyBindings
[BUTTON_R
]);
2074 settings
.setValue("p1k_c", vjs
.p1KeyBindings
[BUTTON_C
]);
2075 settings
.setValue("p1k_b", vjs
.p1KeyBindings
[BUTTON_B
]);
2076 settings
.setValue("p1k_a", vjs
.p1KeyBindings
[BUTTON_A
]);
2077 settings
.setValue("p1k_option", vjs
.p1KeyBindings
[BUTTON_OPTION
]);
2078 settings
.setValue("p1k_pause", vjs
.p1KeyBindings
[BUTTON_PAUSE
]);
2079 settings
.setValue("p1k_0", vjs
.p1KeyBindings
[BUTTON_0
]);
2080 settings
.setValue("p1k_1", vjs
.p1KeyBindings
[BUTTON_1
]);
2081 settings
.setValue("p1k_2", vjs
.p1KeyBindings
[BUTTON_2
]);
2082 settings
.setValue("p1k_3", vjs
.p1KeyBindings
[BUTTON_3
]);
2083 settings
.setValue("p1k_4", vjs
.p1KeyBindings
[BUTTON_4
]);
2084 settings
.setValue("p1k_5", vjs
.p1KeyBindings
[BUTTON_5
]);
2085 settings
.setValue("p1k_6", vjs
.p1KeyBindings
[BUTTON_6
]);
2086 settings
.setValue("p1k_7", vjs
.p1KeyBindings
[BUTTON_7
]);
2087 settings
.setValue("p1k_8", vjs
.p1KeyBindings
[BUTTON_8
]);
2088 settings
.setValue("p1k_9", vjs
.p1KeyBindings
[BUTTON_9
]);
2089 settings
.setValue("p1k_pound", vjs
.p1KeyBindings
[BUTTON_d
]);
2090 settings
.setValue("p1k_star", vjs
.p1KeyBindings
[BUTTON_s
]);
2092 settings
.setValue("p2k_up", vjs
.p2KeyBindings
[BUTTON_U
]);
2093 settings
.setValue("p2k_down", vjs
.p2KeyBindings
[BUTTON_D
]);
2094 settings
.setValue("p2k_left", vjs
.p2KeyBindings
[BUTTON_L
]);
2095 settings
.setValue("p2k_right", vjs
.p2KeyBindings
[BUTTON_R
]);
2096 settings
.setValue("p2k_c", vjs
.p2KeyBindings
[BUTTON_C
]);
2097 settings
.setValue("p2k_b", vjs
.p2KeyBindings
[BUTTON_B
]);
2098 settings
.setValue("p2k_a", vjs
.p2KeyBindings
[BUTTON_A
]);
2099 settings
.setValue("p2k_option", vjs
.p2KeyBindings
[BUTTON_OPTION
]);
2100 settings
.setValue("p2k_pause", vjs
.p2KeyBindings
[BUTTON_PAUSE
]);
2101 settings
.setValue("p2k_0", vjs
.p2KeyBindings
[BUTTON_0
]);
2102 settings
.setValue("p2k_1", vjs
.p2KeyBindings
[BUTTON_1
]);
2103 settings
.setValue("p2k_2", vjs
.p2KeyBindings
[BUTTON_2
]);
2104 settings
.setValue("p2k_3", vjs
.p2KeyBindings
[BUTTON_3
]);
2105 settings
.setValue("p2k_4", vjs
.p2KeyBindings
[BUTTON_4
]);
2106 settings
.setValue("p2k_5", vjs
.p2KeyBindings
[BUTTON_5
]);
2107 settings
.setValue("p2k_6", vjs
.p2KeyBindings
[BUTTON_6
]);
2108 settings
.setValue("p2k_7", vjs
.p2KeyBindings
[BUTTON_7
]);
2109 settings
.setValue("p2k_8", vjs
.p2KeyBindings
[BUTTON_8
]);
2110 settings
.setValue("p2k_9", vjs
.p2KeyBindings
[BUTTON_9
]);
2111 settings
.setValue("p2k_pound", vjs
.p2KeyBindings
[BUTTON_d
]);
2112 settings
.setValue("p2k_star", vjs
.p2KeyBindings
[BUTTON_s
]);
2115 WriteProfiles(&settings
);
2116 DBGManager_SourceFileSearchPathsSet(vjs
.sourcefilesearchPaths
);
2120 // Save the UI settings
2121 void MainWin::WriteUISettings(void)
2126 // Point on the emulator settings
2127 QSettings
settings("Underground Software", "Virtual Jaguar");
2128 settings
.beginGroup("ui");
2130 // Emulator UI information
2131 settings
.setValue("pos", pos());
2132 settings
.setValue("size", size());
2133 settings
.setValue("cartLoadPos", filePickWin
->pos());
2135 // Video output information
2136 settings
.setValue("zoom", zoomLevel
);
2138 // Alpine debug UI information (also needed by the Debugger)
2139 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
2141 settings
.setValue("cpuBrowseWinPos", cpuBrowseWin
->pos());
2142 settings
.setValue("cpuBrowseWinIsVisible", cpuBrowseWin
->isVisible());
2143 settings
.setValue("memBrowseWinPos", memBrowseWin
->pos());
2144 settings
.setValue("memBrowseWinIsVisible", memBrowseWin
->isVisible());
2145 settings
.setValue("stackBrowseWinPos", stackBrowseWin
->pos());
2146 settings
.setValue("stackBrowseWinIsVisible", stackBrowseWin
->isVisible());
2147 settings
.setValue("stackBrowseWinSize", stackBrowseWin
->size());
2148 settings
.setValue("emuStatusWinPos", emuStatusWin
->pos());
2149 settings
.setValue("emuStatusWinIsVisible", emuStatusWin
->isVisible());
2150 settings
.setValue("opBrowseWinPos", opBrowseWin
->pos());
2151 settings
.setValue("opBrowseWinIsVisible", opBrowseWin
->isVisible());
2152 settings
.setValue("opBrowseWinSize", opBrowseWin
->size());
2153 settings
.setValue("riscDasmBrowseWinPos", riscDasmBrowseWin
->pos());
2154 settings
.setValue("riscDasmBrowseWinIsVisible", riscDasmBrowseWin
->isVisible());
2155 settings
.setValue("m68kDasmBrowseWinPos", m68kDasmBrowseWin
->pos());
2156 settings
.setValue("m68kDasmBrowseWinIsVisible", m68kDasmBrowseWin
->isVisible());
2159 // Debugger UI information
2160 if (vjs
.softTypeDebugger
)
2163 settings
.setValue("m68kDasmWinPos", m68kDasmWin
->pos());
2164 //settings.setValue("m68kDasmWinIsVisible", m68kDasmWin->isVisible());
2165 settings
.setValue("GPUDasmWinPos", GPUDasmWin
->pos());
2166 settings
.setValue("DSPDasmWinPos", DSPDasmWin
->pos());
2168 settings
.setValue("allWatchBrowseWinPos", allWatchBrowseWin
->pos());
2169 settings
.setValue("allWatchBrowseWinIsVisible", allWatchBrowseWin
->isVisible());
2170 settings
.setValue("allWatchBrowseWinSize", allWatchBrowseWin
->size());
2171 settings
.setValue("LocalBrowseWinPos", LocalBrowseWin
->pos());
2172 settings
.setValue("LocalBrowseWinIsVisible", LocalBrowseWin
->isVisible());
2173 settings
.setValue("LocalBrowseWinSize", LocalBrowseWin
->size());
2174 settings
.setValue("heapallocatorBrowseWinPos", heapallocatorBrowseWin
->pos());
2175 settings
.setValue("heapallocatorBrowseWinIsVisible", heapallocatorBrowseWin
->isVisible());
2176 settings
.setValue("heapallocatorBrowseWinSize", heapallocatorBrowseWin
->size());
2177 settings
.setValue("exceptionVectorTableBrowseWinPos", exceptionvectortableBrowseWin
->pos());
2178 settings
.setValue("exceptionVectorTableBrowseWinIsVisible", exceptionvectortableBrowseWin
->isVisible());
2179 settings
.setValue("exceptionVectorTableBrowseWinSize", exceptionvectortableBrowseWin
->size());
2180 settings
.setValue("CallStackBrowseWinPos", CallStackBrowseWin
->pos());
2181 settings
.setValue("CallStackBrowseWinIsVisible", CallStackBrowseWin
->isVisible());
2182 settings
.setValue("CallStackBrowseWinSize", CallStackBrowseWin
->size());
2183 for (i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
2185 sprintf(mem1Name
, "mem1BrowseWinPos[%i]", (unsigned int)i
);
2186 settings
.setValue(mem1Name
, mem1BrowseWin
[i
]->pos());
2187 sprintf(mem1Name
, "mem1BrowseWinIsVisible[%i]", (unsigned int)i
);
2188 settings
.setValue(mem1Name
, mem1BrowseWin
[i
]->isVisible());
2189 sprintf(mem1Name
, "mem1BrowseWinSize[%i]", (unsigned int)i
);
2190 settings
.setValue(mem1Name
, mem1BrowseWin
[i
]->size());
2194 settings
.endGroup();
2198 // Refresh alpine debug windows
2199 void MainWin::AlpineRefreshWindows(void)
2201 cpuBrowseWin
->RefreshContents();
2202 memBrowseWin
->RefreshContents();
2203 stackBrowseWin
->RefreshContents();
2204 emuStatusWin
->RefreshContents();
2205 opBrowseWin
->RefreshContents();
2206 riscDasmBrowseWin
->RefreshContents();
2207 m68kDasmBrowseWin
->RefreshContents();
2211 // Reset soft debugger windows
2212 void MainWin::DebuggerResetWindows(void)
2214 if (vjs
.softTypeDebugger
)
2216 FilesrcListWin
->Reset();
2217 allWatchBrowseWin
->Reset();
2218 heapallocatorBrowseWin
->Reset();
2220 //ResetAlpineWindows();
2225 // Refresh soft debugger & alpine debug windows
2226 void MainWin::DebuggerRefreshWindows(void)
2230 if (vjs
.softTypeDebugger
)
2232 FilesrcListWin
->RefreshContents();
2233 m68kDasmWin
->RefreshContents();
2234 GPUDasmWin
->RefreshContents();
2235 DSPDasmWin
->RefreshContents();
2236 allWatchBrowseWin
->RefreshContents();
2237 LocalBrowseWin
->RefreshContents();
2238 CallStackBrowseWin
->RefreshContents();
2239 heapallocatorBrowseWin
->RefreshContents();
2240 for (i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
2242 mem1BrowseWin
[i
]->RefreshContents(i
);
2245 AlpineRefreshWindows();
2250 // Create and save screenshot
2251 void MainWin::MakeScreenshot(void)
2255 time_t now
= time(0);
2259 tstruct
= *localtime(&now
);
2260 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
);
2262 // Create screenshot
2263 screenshot
= videoWidget
->grabFrameBuffer();
2264 screenshot
.save((char *)Text
, "JPG", 100);