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
27 // - Add dbl click/enter to select in cart list, ESC to dimiss [DONE]
28 // - Autoscan/autoload all available BIOS from 'software' folder [DONE]
29 // - Add 1 key jumping in cartridge list (press 'R', jumps to carts starting
30 // with 'R', etc) [DONE]
31 // - Controller configuration [DONE]
35 // - Fix bug in switching between PAL & NTSC in fullscreen mode.
36 // - Remove SDL dependencies (sound, mainly) from Jaguar core lib
37 // - Fix inconsistency with trailing slashes in paths (eeproms needs one,
40 // SFDX CODE: S1E9T8H5M23YS
42 // Uncomment this for debugging...
44 //#define DEBUGFOO // Various tool debugging... but not used
45 //#define DEBUGTP // Toolpalette debugging... but not used
52 #include "configdialog.h"
53 #include "controllertab.h"
54 #include "keybindingstab.h"
55 #include "filepicker.h"
57 #include "generaltab.h"
63 #include "emustatus.h"
64 #include "debug/cpubrowser.h"
65 #include "debug/m68kdasmbrowser.h"
66 #include "debug/memorybrowser.h"
67 #include "debug/stackbrowser.h"
68 #include "debug/opbrowser.h"
69 #include "debug/riscdasmbrowser.h"
75 #ifndef NEWMODELSBIOSHANDLER
78 #include "jagstub2bios.h"
80 #include "modelsBIOS.h"
82 #include "jagcdbios.h"
84 #include "m68000/m68kinterface.h"
86 //#include "debugger/VideoWin.h"
87 //#include "debugger/DasmWin.h"
88 #include "debugger/m68KDasmWin.h"
89 #include "debugger/GPUDasmWin.h"
90 #include "debugger/DSPDasmWin.h"
91 #include "debugger/memory1browser.h"
92 //#include "debugger/brkWin.h"
93 #include "debugger/FilesrcListWin.h"
94 #include "debugger/exceptionvectortablebrowser.h"
95 #include "debugger/allwatchbrowser.h"
96 #include "debugger/localbrowser.h"
97 #include "debugger/heapallocatorbrowser.h"
98 #include "debugger/callstackbrowser.h"
101 // According to SebRmv, this header isn't seen on Arch Linux either... :-/
102 //#ifdef __GCCWIN32__
103 // Apparently on win32, usleep() is not pulled in by the usual suspects.
107 #include "_MSC_VER/unistd.h"
111 // The way BSNES controls things is by setting a timer with a zero
112 // timeout, sleeping if not emulating anything. Seems there has to be a
115 // It has a novel approach to plugging-in/using different video/audio/input
116 // methods, can we do something similar or should we just use the built-in
119 // We're going to try to use the built-in OpenGL support and see how it goes.
120 // We'll make the VJ core modular so that it doesn't matter what GUI is in
121 // use, we can drop it in anywhere and use it as-is.
123 MainWin::MainWin(bool autoRun
): running(true), powerButtonOn(false),
124 showUntunedTankCircuit(true), cartridgeLoaded(false), CDActive(false),
125 pauseForFileSelector(false), loadAndGo(autoRun
), scannedSoftwareFolder(false), plzDontKillMyComputer(false)
131 for(int i
=0; i
<8; i
++)
135 for(int i
=0; i
<RING_BUFFER_SIZE
; i
++)
138 ringBufferPointer
= RING_BUFFER_SIZE
- 1;
141 //if (vjs.softTypeDebugger)
143 // mainWindowCentrale = new QMdiArea;
144 // setCentralWidget(mainWindowCentrale);
147 WriteLog("Window creation start\n");
150 videoWidget
= new GLWidget(this);
151 videoWidget
->setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
153 // set central output window
154 if (!vjs
.softTypeDebugger
)
156 setCentralWidget(videoWidget
);
160 mainWindowCentrale
= new QMdiArea(this);
161 setCentralWidget(mainWindowCentrale
);
164 setWindowIcon(QIcon(":/res/vj-icon.png"));
166 QString title
= QString(tr("Virtual Jaguar " VJ_RELEASE_VERSION
" Rx"));
168 if (vjs
.hardwareTypeAlpine
)
169 title
+= QString(tr(" - Alpine Mode"));
171 if (vjs
.softTypeDebugger
)
172 title
+= QString(tr(" - Debugger Mode"));
174 setWindowTitle(title
);
176 aboutWin
= new AboutWindow(this);
177 helpWin
= new HelpWindow(this);
178 filePickWin
= new FilePickerWindow(this);
179 memBrowseWin
= new MemoryBrowserWindow(this);
180 stackBrowseWin
= new StackBrowserWindow(this);
181 emuStatusWin
= new EmuStatusWindow(this);
182 cpuBrowseWin
= new CPUBrowserWindow(this);
183 opBrowseWin
= new OPBrowserWindow(this);
184 m68kDasmBrowseWin
= new M68KDasmBrowserWindow(this);
185 riscDasmBrowseWin
= new RISCDasmBrowserWindow(this);
186 if (vjs
.softTypeDebugger
)
188 //VideoOutputWin = new VideoOutputWindow(this);
189 //VideoOutputWin->setCentralWidget()
190 //DasmWin = new DasmWindow();
191 //DasmWin = new DasmWindow(this);
192 allWatchBrowseWin
= new AllWatchBrowserWindow(this);
193 LocalBrowseWin
= new LocalBrowserWindow(this);
194 heapallocatorBrowseWin
= new HeapAllocatorBrowserWindow(this);
195 //brkWin = new BrkWindow(this);
196 exceptionvectortableBrowseWin
= new ExceptionVectorTableBrowserWindow(this);
197 CallStackBrowseWin
= new CallStackBrowserWindow(this);
199 mem1BrowseWin
= (Memory1BrowserWindow
**)calloc(vjs
.nbrmemory1browserwindow
, sizeof(Memory1BrowserWindow
));
201 #pragma message("Warning: !!! Need to do the memory desalocation for mem1BrowseWin !!!")
203 #warning "!!! Need to do the memory desalocation for mem1BrowseWin !!!"
205 for (size_t i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
207 mem1BrowseWin
[i
] = new Memory1BrowserWindow(this);
210 // Setup dock to display source code filenames tree
211 QDockWidget
*dockFiles
= new QDockWidget(tr("Files"), this);
212 dockFiles
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
214 addDockWidget(Qt::LeftDockWidgetArea
, dockFiles
);
215 mainWindowCentrale
->addAction(dockFiles
->toggleViewAction());
216 dockFiles
->setWidget(FilesrcListWin
= new FilesrcListWindow(this));
218 // Setup dock to display disassembly
219 QDockWidget
*dockDisasm
= new QDockWidget(tr("Disassembly"), this);
220 dockDisasm
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
221 addDockWidget(Qt::RightDockWidgetArea
, dockDisasm
);
222 mainWindowCentrale
->addAction(dockDisasm
->toggleViewAction());
223 dockDisasm
->setWidget(dasmtabWidget
= new QTabWidget(this));
225 dasmtabWidget
= new QTabWidget(this);
228 dasmtabWidget
->setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
229 dasmtabWidget
->addTab(m68kDasmWin
= new m68KDasmWindow(this), tr("M68000"));
230 dasmtabWidget
->addTab(GPUDasmWin
= new GPUDasmWindow(this), tr("GPU"));
231 dasmtabWidget
->addTab(DSPDasmWin
= new DSPDasmWindow(this), tr("DSP"));
233 setCentralWidget(dasmtabWidget
);
237 // videoWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
238 setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
240 setUnifiedTitleAndToolBarOnMac(true);
243 quitAppAct
= new QAction(QIcon(":/res/exit.png"), tr("E&xit"), this);
244 quitAppAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBQUIT
].KBSettingValue
)));
245 quitAppAct
->setShortcutContext(Qt::ApplicationShortcut
);
246 quitAppAct
->setStatusTip(tr("Quit Virtual Jaguar"));
247 connect(quitAppAct
, SIGNAL(triggered()), this, SLOT(close()));
250 powerGreen
.addFile(":/res/power-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
251 powerGreen
.addFile(":/res/power-on-green.png", QSize(), QIcon::Normal
, QIcon::On
);
252 powerRed
.addFile(":/res/power-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
253 powerRed
.addFile(":/res/power-on-red.png", QSize(), QIcon::Normal
, QIcon::On
);
254 powerAct
= new QAction(powerGreen
, tr("&Power"), this);
255 powerAct
->setStatusTip(tr("Powers Jaguar on/off"));
256 powerAct
->setCheckable(true);
257 powerAct
->setChecked(false);
258 connect(powerAct
, SIGNAL(triggered()), this, SLOT(TogglePowerState()));
262 pauseIcon
.addFile(":/res/pause-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
263 pauseIcon
.addFile(":/res/pause-on.png", QSize(), QIcon::Normal
, QIcon::On
);
264 pauseAct
= new QAction(pauseIcon
, tr("Pause"), this);
265 pauseAct
->setStatusTip(tr("Toggles the running state"));
266 pauseAct
->setCheckable(true);
267 pauseAct
->setDisabled(true);
268 pauseAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBPAUSE
].KBSettingValue
)));
269 pauseAct
->setShortcutContext(Qt::ApplicationShortcut
);
270 connect(pauseAct
, SIGNAL(triggered()), this, SLOT(ToggleRunState()));
273 screenshotAct
= new QAction(QIcon(":/res/screenshot.png"), tr("&Screenshot"), this);
274 screenshotAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBSCREENSHOT
].KBSettingValue
)));
275 screenshotAct
->setShortcutContext(Qt::ApplicationShortcut
);
276 screenshotAct
->setCheckable(false);
277 screenshotAct
->setDisabled(false);
278 connect(screenshotAct
, SIGNAL(triggered()), this, SLOT(MakeScreenshot()));
281 zoomActs
= new QActionGroup(this);
282 x1Act
= new QAction(QIcon(":/res/zoom100.png"), tr("Zoom 100%"), zoomActs
);
283 x1Act
->setStatusTip(tr("Set window zoom to 100%"));
284 x1Act
->setCheckable(true);
285 connect(x1Act
, SIGNAL(triggered()), this, SLOT(SetZoom100()));
286 x2Act
= new QAction(QIcon(":/res/zoom200.png"), tr("Zoom 200%"), zoomActs
);
287 x2Act
->setStatusTip(tr("Set window zoom to 200%"));
288 x2Act
->setCheckable(true);
289 connect(x2Act
, SIGNAL(triggered()), this, SLOT(SetZoom200()));
290 x3Act
= new QAction(QIcon(":/res/zoom300.png"), tr("Zoom 300%"), zoomActs
);
291 x3Act
->setStatusTip(tr("Set window zoom to 300%"));
292 x3Act
->setCheckable(true);
293 connect(x3Act
, SIGNAL(triggered()), this, SLOT(SetZoom300()));
296 tvTypeActs
= new QActionGroup(this);
297 ntscAct
= new QAction(QIcon(":/res/ntsc.png"), tr("NTSC"), tvTypeActs
);
298 ntscAct
->setStatusTip(tr("Sets Jaguar to NTSC mode"));
299 ntscAct
->setCheckable(true);
300 connect(ntscAct
, SIGNAL(triggered()), this, SLOT(SetNTSC()));
301 palAct
= new QAction(QIcon(":/res/pal.png"), tr("PAL"), tvTypeActs
);
302 palAct
->setStatusTip(tr("Sets Jaguar to PAL mode"));
303 palAct
->setCheckable(true);
304 connect(palAct
, SIGNAL(triggered()), this, SLOT(SetPAL()));
307 blur
.addFile(":/res/blur-off.png", QSize(), QIcon::Normal
, QIcon::Off
);
308 blur
.addFile(":/res/blur-on.png", QSize(), QIcon::Normal
, QIcon::On
);
309 blurAct
= new QAction(blur
, tr("Blur"), this);
310 blurAct
->setStatusTip(tr("Sets OpenGL rendering to GL_NEAREST"));
311 blurAct
->setCheckable(true);
312 connect(blurAct
, SIGNAL(triggered()), this, SLOT(ToggleBlur()));
315 aboutAct
= new QAction(QIcon(":/res/vj-icon.png"), tr("&About..."), this);
316 aboutAct
->setStatusTip(tr("Blatant self-promotion"));
317 connect(aboutAct
, SIGNAL(triggered()), this, SLOT(ShowAboutWin()));
320 helpAct
= new QAction(QIcon(":/res/vj-icon.png"), tr("&Contents..."), this);
321 helpAct
->setStatusTip(tr("Help is available, if you should need it"));
322 connect(helpAct
, SIGNAL(triggered()), this, SLOT(ShowHelpWin()));
324 // File pickup action
325 if (!vjs
.softTypeDebugger
)
327 filePickAct
= new QAction(QIcon(":/res/software.png"), tr("&Insert Cartridge..."), this);
328 filePickAct
->setStatusTip(tr("Insert a cartridge into Virtual Jaguar"));
332 filePickAct
= new QAction(QIcon(":/res/software.png"), tr("&Insert executable file..."), this);
333 filePickAct
->setStatusTip(tr("Insert an executable into Virtual Jaguar"));
335 filePickAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBPICKFILE
].KBSettingValue
)));
336 filePickAct
->setShortcutContext(Qt::ApplicationShortcut
);
337 connect(filePickAct
, SIGNAL(triggered()), this, SLOT(InsertCart()));
339 // Configuration action
340 configAct
= new QAction(QIcon(":/res/wrench.png"), tr("&Configure"), this);
341 configAct
->setStatusTip(tr("Configure options for Virtual Jaguar"));
342 configAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBCONFIGURE
].KBSettingValue
)));
343 configAct
->setShortcutContext(Qt::ApplicationShortcut
);
344 connect(configAct
, SIGNAL(triggered()), this, SLOT(Configure()));
346 // Emulation status action
347 emustatusAct
= new QAction(QIcon(":/res/status.png"), tr("&Status"), this);
348 emustatusAct
->setStatusTip(tr("Emulator status"));
349 emustatusAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBEMUSTATUS
].KBSettingValue
)));
350 emustatusAct
->setShortcutContext(Qt::ApplicationShortcut
);
351 connect(emustatusAct
, SIGNAL(triggered()), this, SLOT(ShowEmuStatusWin()));
354 useCDAct
= new QAction(QIcon(":/res/compact-disc.png"), tr("&Use CD Unit"), this);
355 useCDAct
->setStatusTip(tr("Use Jaguar Virtual CD unit"));
356 useCDAct
->setCheckable(true);
357 connect(useCDAct
, SIGNAL(triggered()), this, SLOT(ToggleCDUsage()));
359 // Frame advance action
360 frameAdvanceAct
= new QAction(QIcon(":/res/frame-advance.png"), tr("&Frame Advance"), this);
361 frameAdvanceAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBFRAMEADVANCE
].KBSettingValue
)));
362 frameAdvanceAct
->setShortcutContext(Qt::ApplicationShortcut
);
363 frameAdvanceAct
->setDisabled(true);
364 connect(frameAdvanceAct
, SIGNAL(triggered()), this, SLOT(FrameAdvance()));
367 fullScreenAct
= new QAction(QIcon(":/res/fullscreen.png"), tr("F&ull Screen"), this);
368 fullScreenAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBFULLSCREEN
].KBSettingValue
)));
369 fullScreenAct
->setShortcutContext(Qt::ApplicationShortcut
);
370 fullScreenAct
->setCheckable(true);
371 connect(fullScreenAct
, SIGNAL(triggered()), this, SLOT(ToggleFullScreen()));
373 // Actions dedicated to debugger mode
374 if (vjs
.softTypeDebugger
)
377 restartAct
= new QAction(QIcon(":/res/debug-restart.png"), tr("&Restart"), this);
378 restartAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBRESTART
].KBSettingValue
)));
379 restartAct
->setShortcutContext(Qt::ApplicationShortcut
);
380 restartAct
->setCheckable(false);
381 restartAct
->setDisabled(true);
382 connect(restartAct
, SIGNAL(triggered()), this, SLOT(DebuggerRestart()));
385 traceStepOverAct
= new QAction(QIcon(":/res/debug-stepover.png"), tr("&Step Over"), this);
386 traceStepOverAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBSTEPOVER
].KBSettingValue
)));
387 traceStepOverAct
->setShortcutContext(Qt::ApplicationShortcut
);
388 traceStepOverAct
->setCheckable(false);
389 traceStepOverAct
->setDisabled(true);
390 connect(traceStepOverAct
, SIGNAL(triggered()), this, SLOT(DebuggerTraceStepOver()));
393 traceStepIntoAct
= new QAction(QIcon(":/res/debug-stepinto.png"), tr("&Step Into"), this);
394 traceStepIntoAct
->setShortcut(QKeySequence(tr(vjs
.KBContent
[KBSTEPINTO
].KBSettingValue
)));
395 traceStepIntoAct
->setShortcutContext(Qt::ApplicationShortcut
);
396 traceStepIntoAct
->setCheckable(false);
397 traceStepIntoAct
->setDisabled(true);
398 connect(traceStepIntoAct
, SIGNAL(triggered()), this, SLOT(DebuggerTraceStepInto()));
400 //newBreakpointFunctionAct = new QAction(QIcon(""), tr("&Function Breakpoint"), this);
401 //newBreakpointFunctionAct->setShortcut(QKeySequence(tr("Ctrl+B")));
402 //connect(newBreakpointFunctionAct, SIGNAL(triggered()), this, SLOT(NewBreakpointFunction()));
404 //VideoOutputAct = new QAction(tr("Output Video"), this);
405 //VideoOutputAct->setStatusTip(tr("Shows the output video window"));
406 //connect(VideoOutputAct, SIGNAL(triggered()), this, SLOT(ShowVideoOutputWin()));
408 //DasmAct = new QAction(tr("Disassembly"), this);
409 //DasmAct->setStatusTip(tr("Shows the disassembly window"));
410 //connect(DasmAct, SIGNAL(triggered()), this, SLOT(ShowDasmWin()));
412 // Exception vector table window
413 exceptionVectorTableBrowseAct
= new QAction(QIcon(""), tr("Exception Vector Table"), this);
414 exceptionVectorTableBrowseAct
->setStatusTip(tr("Shows all Exception Vector Table browser window"));
415 connect(exceptionVectorTableBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowExceptionVectorTableBrowserWin()));
417 // All watch variables window
418 allWatchBrowseAct
= new QAction(QIcon(":/res/debug-watch.png"), tr("All Watch"), this);
419 allWatchBrowseAct
->setStatusTip(tr("Shows all Watch browser window"));
420 connect(allWatchBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowAllWatchBrowserWin()));
422 // Local variables window
423 LocalBrowseAct
= new QAction(QIcon(":/res/debug-local.png"), tr("Locals"), this);
424 LocalBrowseAct
->setStatusTip(tr("Shows Locals browser window"));
425 connect(LocalBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowLocalBrowserWin()));
427 // Heap (memory) allocation window
428 heapallocatorBrowseAct
= new QAction(QIcon(""), tr("Heap allocator"), this);
429 heapallocatorBrowseAct
->setStatusTip(tr("Shows the heap allocator browser window"));
430 connect(heapallocatorBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowHeapAllocatorBrowserWin()));
433 CallStackBrowseAct
= new QAction(QIcon(":/res/debug-callstack.png"), tr("Call Stack"), this);
434 CallStackBrowseAct
->setStatusTip(tr("Shows Call Stack browser window"));
435 connect(CallStackBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowCallStackBrowserWin()));
438 mem1BrowseAct
= (QAction
**)calloc(vjs
.nbrmemory1browserwindow
, sizeof(QAction
));
439 QSignalMapper
*signalMapper
= new QSignalMapper(this);
441 #pragma message("Warning: !!! Need to do the memory desalocation for mem1BrowseAct !!!")
443 #warning "!!! Need to do the memory desalocation for mem1BrowseAct !!!"
445 for (int i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
448 sprintf(MB
, "Memory %i", (unsigned int)(i
+1));
449 mem1BrowseAct
[i
] = new QAction(QIcon(":/res/debug-memory.png"), tr(MB
), this);
450 mem1BrowseAct
[i
]->setStatusTip(tr("Shows a Jaguar memory browser window"));
451 connect(mem1BrowseAct
[i
], SIGNAL(triggered()), signalMapper
, SLOT(map()));
452 signalMapper
->setMapping(mem1BrowseAct
[i
], (int)i
);
453 connect(signalMapper
, SIGNAL(mapped(int)), this, SLOT(ShowMemory1BrowserWin(int)));
457 // Memory browser window action
458 memBrowseAct
= new QAction(QIcon(":/res/tool-memory.png"), tr("Memory Browser"), this);
459 memBrowseAct
->setStatusTip(tr("Shows the Jaguar memory browser window"));
460 connect(memBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowMemoryBrowserWin()));
462 // Stack browser window action
463 stackBrowseAct
= new QAction(QIcon(":/res/tool-stack.png"), tr("Stack Browser"), this);
464 stackBrowseAct
->setStatusTip(tr("Shows the Jaguar stack browser window"));
465 connect(stackBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowStackBrowserWin()));
467 // CPUs (M68000, GPU & DSP browser window action
468 cpuBrowseAct
= new QAction(QIcon(":/res/tool-cpu.png"), tr("CPU Browser"), this);
469 cpuBrowseAct
->setStatusTip(tr("Shows the Jaguar CPU browser window"));
470 connect(cpuBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowCPUBrowserWin()));
472 // OP browser window action
473 opBrowseAct
= new QAction(QIcon(":/res/tool-op.png"), tr("OP Browser"), this);
474 opBrowseAct
->setStatusTip(tr("Shows the Jaguar OP browser window"));
475 connect(opBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowOPBrowserWin()));
477 // M68000 disassembly browser window
478 m68kDasmBrowseAct
= new QAction(QIcon(":/res/tool-68k-dis.png"), tr("68K Listing Browser"), this);
479 m68kDasmBrowseAct
->setStatusTip(tr("Shows the 68K disassembly browser window"));
480 connect(m68kDasmBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowM68KDasmBrowserWin()));
482 // Risc (DSP / GPU) disassembly browser window
483 riscDasmBrowseAct
= new QAction(QIcon(":/res/tool-risc-dis.png"), tr("RISC Listing Browser"), this);
484 riscDasmBrowseAct
->setStatusTip(tr("Shows the RISC disassembly browser window"));
485 connect(riscDasmBrowseAct
, SIGNAL(triggered()), this, SLOT(ShowRISCDasmBrowserWin()));
487 // Misc. connections...
488 connect(filePickWin
, SIGNAL(RequestLoad(QString
)), this, SLOT(LoadSoftware(QString
)));
489 connect(filePickWin
, SIGNAL(FilePickerHiding()), this, SLOT(Unpause()));
493 fileMenu
= menuBar()->addMenu(tr("&Jaguar"));
494 fileMenu
->addAction(powerAct
);
495 if (!vjs
.softTypeDebugger
)
497 fileMenu
->addAction(pauseAct
);
498 // fileMenu->addAction(frameAdvanceAct);
500 fileMenu
->addAction(filePickAct
);
501 fileMenu
->addAction(useCDAct
);
502 fileMenu
->addAction(configAct
);
503 fileMenu
->addAction(emustatusAct
);
504 fileMenu
->addSeparator();
505 fileMenu
->addAction(quitAppAct
);
507 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
509 debugMenu
= menuBar()->addMenu(tr("&Debug"));
510 if (vjs
.softTypeDebugger
)
512 debugWindowsMenu
= debugMenu
->addMenu(tr("&Windows"));
513 debugWindowExceptionMenu
= debugWindowsMenu
->addMenu(tr("&Exception"));
514 debugWindowExceptionMenu
->addAction(exceptionVectorTableBrowseAct
);
515 debugWindowsMenu
->addSeparator();
517 debugWindowOutputMenu
= debugWindowsMenu
->addMenu(tr("&Output"));
518 debugWindowOutputMenu
->addAction(VideoOutputAct
);
519 debugWindowsMenu
->addSeparator();
521 debugWindowsWatchMenu
= debugWindowsMenu
->addMenu(tr("&Watch"));
522 debugWindowsWatchMenu
->addAction(allWatchBrowseAct
);
523 debugWindowsMenu
->addAction(LocalBrowseAct
);
524 debugWindowsMenu
->addSeparator();
525 debugWindowsMenu
->addAction(CallStackBrowseAct
);
526 debugWindowsMenu
->addSeparator();
527 debugWindowsMemoryMenu
= debugWindowsMenu
->addMenu(tr("&Memory"));
528 debugWindowsMemoryMenu
->addAction(heapallocatorBrowseAct
);
529 debugWindowsMemoryMenu
->addSeparator();
530 for (int i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
532 debugWindowsMemoryMenu
->addAction(mem1BrowseAct
[i
]);
534 debugWindowsMenu
->addSeparator();
535 debugWindowsBrowsesMenu
= debugWindowsMenu
->addMenu(tr("&Browsers"));
536 debugWindowsBrowsesMenu
->addAction(memBrowseAct
);
537 debugWindowsBrowsesMenu
->addAction(stackBrowseAct
);
538 debugWindowsBrowsesMenu
->addAction(cpuBrowseAct
);
539 debugWindowsBrowsesMenu
->addAction(opBrowseAct
);
540 debugWindowsBrowsesMenu
->addAction(m68kDasmBrowseAct
);
541 debugWindowsBrowsesMenu
->addAction(riscDasmBrowseAct
);
542 debugMenu
->addSeparator();
543 debugMenu
->addAction(pauseAct
);
544 debugMenu
->addAction(frameAdvanceAct
);
545 debugMenu
->addAction(restartAct
);
546 debugMenu
->addSeparator();
547 debugMenu
->addAction(traceStepIntoAct
);
548 debugMenu
->addAction(traceStepOverAct
);
550 debugMenu
->addSeparator();
551 debugNewBreakpointMenu
= debugMenu
->addMenu(tr("&New Breakpoint"));
552 debugNewBreakpointMenu
->addAction(newBreakpointFunctionAct
);
554 //debugMenu->addSeparator();
555 //debugMenu->addAction(DasmAct);
559 debugMenu
->addAction(memBrowseAct
);
560 debugMenu
->addAction(stackBrowseAct
);
561 debugMenu
->addAction(cpuBrowseAct
);
562 debugMenu
->addAction(opBrowseAct
);
563 debugMenu
->addAction(m68kDasmBrowseAct
);
564 debugMenu
->addAction(riscDasmBrowseAct
);
569 helpMenu
= menuBar()->addMenu(tr("&Help"));
570 helpMenu
->addAction(helpAct
);
571 helpMenu
->addAction(aboutAct
);
575 toolbar
= addToolBar(tr("System"));
576 toolbar
->addAction(powerAct
);
577 if (!vjs
.softTypeDebugger
)
579 toolbar
->addAction(pauseAct
);
580 toolbar
->addAction(frameAdvanceAct
);
582 toolbar
->addAction(filePickAct
);
583 toolbar
->addAction(useCDAct
);
584 toolbar
->addSeparator();
585 if (!vjs
.softTypeDebugger
)
587 toolbar
->addAction(screenshotAct
);
588 toolbar
->addSeparator();
589 toolbar
->addAction(x1Act
);
590 toolbar
->addAction(x2Act
);
591 toolbar
->addAction(x3Act
);
592 toolbar
->addSeparator();
593 toolbar
->addAction(ntscAct
);
594 toolbar
->addAction(palAct
);
595 toolbar
->addSeparator();
596 toolbar
->addAction(blurAct
);
597 toolbar
->addAction(fullScreenAct
);
601 debuggerbar
= addToolBar(tr("&Debugger"));
602 debuggerbar
->addAction(pauseAct
);
603 debuggerbar
->addAction(frameAdvanceAct
);
604 debuggerbar
->addAction(restartAct
);
605 debuggerbar
->addSeparator();
606 debuggerbar
->addAction(traceStepIntoAct
);
607 debuggerbar
->addAction(traceStepOverAct
);
610 if (vjs
.hardwareTypeAlpine
)
612 debugbar
= addToolBar(tr("&Debug"));
613 debugbar
->addAction(memBrowseAct
);
614 debugbar
->addAction(stackBrowseAct
);
615 debugbar
->addAction(cpuBrowseAct
);
616 debugbar
->addAction(opBrowseAct
);
617 debugbar
->addAction(m68kDasmBrowseAct
);
618 debugbar
->addAction(riscDasmBrowseAct
);
621 // Add actions to the main window, as hiding widgets with them
623 addAction(fullScreenAct
);
624 addAction(quitAppAct
);
625 addAction(configAct
);
626 addAction(emustatusAct
);
628 addAction(filePickAct
);
629 addAction(frameAdvanceAct
);
632 statusBar()->showMessage(tr("Ready"));
634 // Do this in case original size isn't correct (mostly for the first-run case)
637 WriteLog("Window creation done\n");
639 // Create our test pattern NTSC bitmap
640 WriteLog("Test pattern 1 bitmap\n");
642 QImage
tempImg(":/res/test-pattern.jpg");
643 QImage tempImgScaled
= tempImg
.scaled(VIRTUAL_SCREEN_WIDTH
, VIRTUAL_SCREEN_HEIGHT_PAL
, Qt::IgnoreAspectRatio
, Qt::SmoothTransformation
);
645 for(uint32_t y
=0; y
<VIRTUAL_SCREEN_HEIGHT_PAL
; y
++)
647 const QRgb
* scanline
= (QRgb
*)tempImgScaled
.constScanLine(y
);
649 for(uint32_t x
=0; x
<VIRTUAL_SCREEN_WIDTH
; x
++)
651 uint32_t pixel
= (qRed(scanline
[x
]) << 24) | (qGreen(scanline
[x
]) << 16) | (qBlue(scanline
[x
]) << 8) | 0xFF;
652 testPattern
[(y
* VIRTUAL_SCREEN_WIDTH
) + x
] = pixel
;
656 // Create our test pattern PAL bitmap
657 WriteLog("Test pattern 2 bitmap\n");
659 QImage
tempImg2(":/res/test-pattern-pal.jpg");
660 QImage tempImgScaled2
= tempImg2
.scaled(VIRTUAL_SCREEN_WIDTH
, VIRTUAL_SCREEN_HEIGHT_PAL
, Qt::IgnoreAspectRatio
, Qt::SmoothTransformation
);
662 for(uint32_t y
=0; y
<VIRTUAL_SCREEN_HEIGHT_PAL
; y
++)
664 const QRgb
* scanline
= (QRgb
*)tempImgScaled2
.constScanLine(y
);
666 for(uint32_t x
=0; x
<VIRTUAL_SCREEN_WIDTH
; x
++)
668 uint32_t pixel
= (qRed(scanline
[x
]) << 24) | (qGreen(scanline
[x
]) << 16) | (qBlue(scanline
[x
]) << 8) | 0xFF;
669 testPattern2
[(y
* VIRTUAL_SCREEN_WIDTH
) + x
] = pixel
;
673 // Set up timer based loop for animation...
674 timer
= new QTimer(this);
675 connect(timer
, SIGNAL(timeout()), this, SLOT(Timer()));
677 // This isn't very accurate for NTSC: This is early by 40 msec per frame.
678 // This is because it's discarding the 0.6666... on the end of the fraction.
679 // Alas, 6 doesn't divide cleanly into 10. :-P
680 //Should we defer this until SyncUI? Probably.
681 //No, it doesn't work, because it uses setInterval() instead of start()...
682 // timer->start(vjs.hardwareTypeNTSC ? 16 : 20);
684 // We set this initially, to make VJ behave somewhat as it would if no
685 // cart were inserted and the BIOS was set as active...
686 jaguarCartInserted
= true;
687 WriteLog("Virtual Jaguar %s Rx (Last full build was on %s %s)\n", VJ_RELEASE_VERSION
, __DATE__
, __TIME__
);
688 WriteLog("VJ: Initializing jaguar subsystem...\n");
691 #ifndef NEWMODELSBIOSHANDLER
692 // memcpy(jagMemSpace + 0xE00000, jaguarBootROM, 0x20000); // Use the stock BIOS
693 memcpy(jagMemSpace
+ 0xE00000, (vjs
.biosType
== BT_K_SERIES
? jaguarBootROM
: jaguarBootROM2
), 0x20000); // Use the stock BIOS
695 SelectBIOS(vjs
.biosType
);
698 // Prevent the file scanner from running if filename passed
699 // in on the command line...
703 // Load up the default ROM if in Alpine mode:
704 if (vjs
.hardwareTypeAlpine
)
706 bool romLoaded
= JaguarLoadFile(vjs
.alpineROMPath
);
708 // If regular load failed, try just a straight file load
709 // (Dev only! I don't want people to start getting lazy with their releases again! :-P)
711 romLoaded
= AlpineLoadFile(vjs
.alpineROMPath
);
714 WriteLog("Alpine Mode: Successfully loaded file \"%s\".\n", vjs
.alpineROMPath
);
716 WriteLog("Alpine Mode: Unable to load file \"%s\"!\n", vjs
.alpineROMPath
);
718 // Attempt to load/run the ABS file...
719 LoadSoftware(vjs
.absROMPath
);
720 #ifndef NEWMODELSBIOSHANDLER
721 memcpy(jagMemSpace
+ 0xE00000, jaguarDevBootROM2
, 0x20000); // Use the stub BIOS
723 SelectBIOS(vjs
.biosType
);
725 // Prevent the scanner from running...
729 // Load up the default ROM if in Debugger mode:
730 if (vjs
.softTypeDebugger
)
732 bool romLoaded
= JaguarLoadFile(vjs
.debuggerROMPath
);
734 // If regular load failed, try just a straight file load
735 // (Dev only! I don't want people to start getting lazy with their releases again! :-P)
737 romLoaded
= DebuggerLoadFile(vjs
.debuggerROMPath
);
740 WriteLog("Debugger Mode: Successfully loaded file \"%s\".\n", vjs
.debuggerROMPath
);
742 WriteLog("Debugger Mode: Unable to load file \"%s\"!\n", vjs
.debuggerROMPath
);
744 // Attempt to load/run the ABS file...
745 LoadSoftware(vjs
.absROMPath
);
746 #ifndef NEWMODELSBIOSHANDLER
747 memcpy(jagMemSpace
+ 0xE00000, jaguarDevBootROM2
, 0x20000); // Use the stub BIOS
748 // Prevent the scanner from running...
750 SelectBIOS(vjs
.biosType
);
755 // Run the scanner if nothing passed in and *not* Alpine mode...
756 // NB: Really need to look into caching the info scanned in here...
757 filePickWin
->ScanSoftwareFolder(allowUnknownSoftware
);
758 scannedSoftwareFolder
= true;
762 void MainWin::LoadFile(QString file
)
768 void MainWin::SyncUI(void)
770 // Set toolbar buttons/menus based on settings read in (sync the UI)...
771 // (Really, this is to sync command line options passed in)
772 blurAct
->setChecked(vjs
.glFilter
);
773 x1Act
->setChecked(zoomLevel
== 1);
774 x2Act
->setChecked(zoomLevel
== 2);
775 x3Act
->setChecked(zoomLevel
== 3);
776 // running = powerAct->isChecked();
777 ntscAct
->setChecked(vjs
.hardwareTypeNTSC
);
778 palAct
->setChecked(!vjs
.hardwareTypeNTSC
);
779 powerAct
->setIcon(vjs
.hardwareTypeNTSC
? powerRed
: powerGreen
);
781 fullScreenAct
->setChecked(vjs
.fullscreen
);
782 fullScreen
= vjs
.fullscreen
;
783 SetFullScreen(fullScreen
);
785 // Reset the timer to be what was set in the command line (if any):
786 // timer->setInterval(vjs.hardwareTypeNTSC ? 16 : 20);
787 timer
->start(vjs
.hardwareTypeNTSC
? 16 : 20);
791 void MainWin::closeEvent(QCloseEvent
* event
)
794 // This should only be done by the config dialog
797 event
->accept(); // ignore() if can't close for some reason
801 void MainWin::keyPressEvent(QKeyEvent
* e
)
803 #ifndef VJ_REMOVE_DEV_CODE
805 //extern bool startM68KTracing; // moved to jaguar.h
807 extern int blit_start_log
;
809 extern bool startConciseBlitLogging
;
812 // We ignore the Alt key for now, since it causes problems with the GUI
813 if (e
->key() == Qt::Key_Alt
)
818 // Bar this shite from release versions kthxbai
819 #ifndef VJ_REMOVE_DEV_CODE
820 else if (e
->key() == Qt::Key_F11
)
822 startM68KTracing
= true;
826 else if (e
->key() == Qt::Key_F12
)
828 blit_start_log
= true;
832 else if (e
->key() == Qt::Key_F10
)
834 startConciseBlitLogging
= true;
839 else if (e
->key() == Qt::Key_F8
)
841 // ggn: For extra NYAN pleasure...
842 // ggn: There you go James :P
843 // Shamus: Thanks for the patch! :-D
844 WriteLog(" o + + +\n");
845 WriteLog("+ o o + o\n");
846 WriteLog("-_-_-_-_-_-_-_,------, o \n");
847 WriteLog("_-_-_-_-_-_-_-| /\\_/\\ \n");
848 WriteLog("-_-_-_-_-_-_-~|__( ^ .^) + + \n");
849 WriteLog("_-_-_-_-_-_-_-\"\" \"\" \n");
850 WriteLog("+ o o + o\n");
857 This is done now by a QAction...
858 if (e->key() == Qt::Key_F9)
868 void MainWin::keyReleaseEvent(QKeyEvent
* e
)
870 // We ignore the Alt key for now, since it causes problems with the GUI
871 if (e
->key() == Qt::Key_Alt
)
877 HandleKeys(e
, false);
881 void MainWin::HandleKeys(QKeyEvent
* e
, bool state
)
883 enum { P1LEFT
= 0, P1RIGHT
, P1UP
, P1DOWN
, P2LEFT
, P2RIGHT
, P2UP
, P2DOWN
};
884 // We kill bad key combos here, before they can get to the emulator...
885 // This also kills the illegal instruction problem that cropped up in
888 // First, settle key states...
889 if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_L
])
890 keyHeld
[P1LEFT
] = state
;
891 else if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_R
])
892 keyHeld
[P1RIGHT
] = state
;
893 else if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_U
])
894 keyHeld
[P1UP
] = state
;
895 else if (e
->key() == (int)vjs
.p1KeyBindings
[BUTTON_D
])
896 keyHeld
[P1DOWN
] = state
;
897 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_L
])
898 keyHeld
[P2LEFT
] = state
;
899 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_R
])
900 keyHeld
[P2RIGHT
] = state
;
901 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_U
])
902 keyHeld
[P2UP
] = state
;
903 else if (e
->key() == (int)vjs
.p2KeyBindings
[BUTTON_D
])
904 keyHeld
[P2DOWN
] = state
;
906 // Next, check for conflicts and kill 'em if there are any...
907 if (keyHeld
[P1LEFT
] && keyHeld
[P1RIGHT
])
908 keyHeld
[P1LEFT
] = keyHeld
[P1RIGHT
] = false;
910 if (keyHeld
[P1UP
] && keyHeld
[P1DOWN
])
911 keyHeld
[P1UP
] = keyHeld
[P1DOWN
] = false;
913 if (keyHeld
[P2LEFT
] && keyHeld
[P2RIGHT
])
914 keyHeld
[P2LEFT
] = keyHeld
[P2RIGHT
] = false;
916 if (keyHeld
[P2UP
] && keyHeld
[P2DOWN
])
917 keyHeld
[P2UP
] = keyHeld
[P2DOWN
] = false;
919 // No bad combos exist now, let's stuff the emulator key buffers...!
920 for(int i
=BUTTON_FIRST
; i
<=BUTTON_LAST
; i
++)
922 if (e
->key() == (int)vjs
.p1KeyBindings
[i
])
923 joypad0Buttons
[i
] = (state
? 0x01 : 0x00);
925 if (e
->key() == (int)vjs
.p2KeyBindings
[i
])
926 joypad1Buttons
[i
] = (state
? 0x01 : 0x00);
932 // N.B.: The profile system AutoConnect functionality sets the gamepad IDs here.
934 void MainWin::HandleGamepads(void)
938 for(int i
=BUTTON_FIRST
; i
<=BUTTON_LAST
; i
++)
940 if (vjs
.p1KeyBindings
[i
] & (JOY_BUTTON
| JOY_HAT
| JOY_AXIS
))
941 joypad0Buttons
[i
] = (Gamepad::GetState(gamepadIDSlot1
, vjs
.p1KeyBindings
[i
]) ? 0x01 : 0x00);
943 if (vjs
.p2KeyBindings
[i
] & (JOY_BUTTON
| JOY_HAT
| JOY_AXIS
))
944 joypad1Buttons
[i
] = (Gamepad::GetState(gamepadIDSlot2
, vjs
.p2KeyBindings
[i
]) ? 0x01 : 0x00);
949 void MainWin::Open(void)
954 void MainWin::Configure(void)
956 // Call the configuration dialog and update settings
957 ConfigDialog
dlg(this);
959 dlg
.generalTab
->useUnknownSoftware
->setChecked(allowUnknownSoftware
);
960 dlg
.controllerTab1
->profileNum
= lastEditedProfile
;
961 dlg
.controllerTab1
->SetupLastUsedProfile();
962 // maybe instead of this, we tell the controller tab to work on a copy that gets
963 // written if the user hits 'OK'.
964 SaveProfiles(); // Just in case user cancels
966 if (dlg
.exec() == false)
972 QString before
= vjs
.ROMPath
;
973 QString alpineBefore
= vjs
.alpineROMPath
;
974 QString absBefore
= vjs
.absROMPath
;
975 // bool audioBefore = vjs.audioEnabled;
976 bool audioBefore
= vjs
.DSPEnabled
;
977 dlg
.UpdateVJSettings();
978 QString after
= vjs
.ROMPath
;
979 QString alpineAfter
= vjs
.alpineROMPath
;
980 QString absAfter
= vjs
.absROMPath
;
981 // bool audioAfter = vjs.audioEnabled;
982 bool audioAfter
= vjs
.DSPEnabled
;
984 bool allowOld
= allowUnknownSoftware
;
986 allowUnknownSoftware
= dlg
.generalTab
->useUnknownSoftware
->isChecked();
987 lastEditedProfile
= dlg
.controllerTab1
->profileNum
;
988 AutoConnectProfiles();
990 // We rescan the "software" folder if the user either changed the path or
991 // checked/unchecked the "Allow unknown files" option in the config dialog.
992 if ((before
!= after
) || (allowOld
!= allowUnknownSoftware
))
993 filePickWin
->ScanSoftwareFolder(allowUnknownSoftware
);
995 // If the "Alpine" ROM is changed, then let's load it...
996 if (alpineBefore
!= alpineAfter
)
998 if (!JaguarLoadFile(vjs
.alpineROMPath
) && !AlpineLoadFile(vjs
.alpineROMPath
))
1000 // Oh crap, we couldn't get the file! Alert the media!
1002 msg
.setText(QString(tr("Could not load file \"%1\"!")).arg(vjs
.alpineROMPath
));
1003 msg
.setIcon(QMessageBox::Warning
);
1008 // If the "ABS" ROM is changed, then let's load it...
1009 if (absBefore
!= absAfter
)
1011 if (!JaguarLoadFile(vjs
.absROMPath
))
1013 // Oh crap, we couldn't get the file! Alert the media!
1015 msg
.setText(QString(tr("Could not load file \"%1\"!")).arg(vjs
.absROMPath
));
1016 msg
.setIcon(QMessageBox::Warning
);
1021 // If the "Enable DSP" checkbox changed, then we have to re-init the DAC,
1022 // since it's running in the host audio IRQ...
1023 if (audioBefore
!= audioAfter
)
1029 // Just in case we crash before a clean exit...
1032 DebuggerRefreshWindows();
1037 // Here's the main emulator loop
1039 void MainWin::Timer(void)
1042 static uint32_t ntscTickCount
;
1043 if (vjs
.hardwareTypeNTSC
)
1047 timer
->start(16 + (ntscTickCount
== 0 ? 1 : 0));
1054 if (showUntunedTankCircuit
)
1056 // Some machines can't handle this, so we give them the option to disable it. :-)
1057 if (!plzDontKillMyComputer
)
1059 // if (!vjs.softTypeDebugger)
1061 // Random hash & trash
1062 // We try to simulate an untuned tank circuit here... :-)
1063 for (uint32_t x
= 0; x
< videoWidget
->rasterWidth
; x
++)
1065 for (uint32_t y
= 0; y
< videoWidget
->rasterHeight
; y
++)
1067 videoWidget
->buffer
[(y
* videoWidget
->textureWidth
) + x
] = (rand() & 0xFF) << 8 | (rand() & 0xFF) << 16 | (rand() & 0xFF) << 24;
1075 // Otherwise, run the Jaguar simulation
1078 if (!vjs
.softTypeDebugger
)
1079 videoWidget
->HandleMouseHiding();
1081 static uint32_t refresh
= 0;
1082 // Do autorefresh on debug windows
1083 // Have to be careful, too much causes the emulator to slow way down!
1084 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
1086 if (refresh
== vjs
.refresh
)
1088 AlpineRefreshWindows();
1089 //memBrowseWin->RefreshContents();
1090 //cpuBrowseWin->RefreshContents();
1098 //if (!vjs.softTypeDebugger)
1099 videoWidget
->updateGL();
1102 // Approach: We use a ring buffer to store times (in ms) over a given
1103 // amount of frames, then sum them to figure out the FPS.
1104 uint32_t timestamp
= SDL_GetTicks();
1105 // This assumes the ring buffer size is a power of 2
1106 // ringBufferPointer = (ringBufferPointer + 1) & (RING_BUFFER_SIZE - 1);
1107 // Doing it this way is better. Ring buffer size can be arbitrary then.
1108 ringBufferPointer
= (ringBufferPointer
+ 1) % RING_BUFFER_SIZE
;
1109 ringBuffer
[ringBufferPointer
] = timestamp
- oldTimestamp
;
1110 uint32_t elapsedTime
= 0;
1112 for(uint32_t i
=0; i
<RING_BUFFER_SIZE
; i
++)
1113 elapsedTime
+= ringBuffer
[i
];
1115 // elapsedTime must be non-zero
1116 if (elapsedTime
== 0)
1119 // This is in frames per 10 seconds, so we can have 1 decimal
1120 uint32_t framesPerSecond
= (uint32_t)(((float)RING_BUFFER_SIZE
/ (float)elapsedTime
) * 10000.0);
1121 uint32_t fpsIntegerPart
= framesPerSecond
/ 10;
1122 uint32_t fpsDecimalPart
= framesPerSecond
% 10;
1123 // If this is updated too frequently to be useful, we can throttle it down
1124 // so that it only updates every 10th frame or so
1125 statusBar()->showMessage(QString("%1.%2 FPS").arg(fpsIntegerPart
).arg(fpsDecimalPart
));
1126 oldTimestamp
= timestamp
;
1128 if (M68KDebugHaltStatus())
1133 // Toggle the power state, it can be either on or off
1134 void MainWin::TogglePowerState(void)
1136 powerButtonOn
= !powerButtonOn
;
1139 // With the power off, we simulate white noise on the screen. :-)
1142 // Restore the mouse pointer, if hidden:
1143 if (!vjs
.softTypeDebugger
)
1145 videoWidget
->CheckAndRestoreMouseCursor();
1148 useCDAct
->setDisabled(false);
1149 palAct
->setDisabled(false);
1150 ntscAct
->setDisabled(false);
1151 pauseAct
->setChecked(false);
1152 pauseAct
->setDisabled(true);
1153 showUntunedTankCircuit
= true;
1155 DACPauseAudioThread();
1156 // 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. :-)
1159 if (plzDontKillMyComputer
)
1161 // We have to do it line by line, because the texture pitch is not the same as the picture buffer's pitch.
1162 for (uint32_t y
= 0; y
< videoWidget
->rasterHeight
; y
++)
1164 if (vjs
.hardwareTypeNTSC
)
1166 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1170 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern2
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1177 useCDAct
->setDisabled(true);
1178 palAct
->setDisabled(true);
1179 ntscAct
->setDisabled(true);
1180 pauseAct
->setChecked(false);
1181 pauseAct
->setDisabled(false);
1182 showUntunedTankCircuit
= false;
1184 // Otherwise, we prepare for running regular software...
1187 // Should check for cartridgeLoaded here as well...!
1188 // We can clear it when toggling CDActive on, so that when we power cycle it
1189 // does the expected thing. Otherwise, if we use the file picker to insert a
1190 // cart, we expect to run the cart! Maybe have a RemoveCart function that only
1191 // works if the CD unit is active?
1192 setWindowTitle(QString("Virtual Jaguar " VJ_RELEASE_VERSION
" Rx - Now playing: Jaguar CD"));
1195 WriteLog("GUI: Resetting Jaguar...\n");
1197 DebuggerResetWindows();
1198 DACPauseAudioThread(false);
1203 // Toggle the emulator state, it can be either on or off
1204 void MainWin::ToggleRunState(void)
1206 startM68KTracing
= running
;
1212 // Set action buttons for the pause mode
1213 frameAdvanceAct
->setDisabled(false);
1214 pauseAct
->setChecked(true);
1215 pauseAct
->setDisabled(false);
1216 if (vjs
.softTypeDebugger
)
1218 traceStepIntoAct
->setDisabled(false);
1219 traceStepOverAct
->setDisabled(false);
1220 restartAct
->setDisabled(false);
1221 m68kDasmWin
->Use68KPCAddress();
1222 GPUDasmWin
->UseGPUPCAddress();
1223 DSPDasmWin
->UseDSPPCAddress();
1226 //if (!vjs.softTypeDebugger)
1228 // Restore the mouse pointer, if hidden:
1229 videoWidget
->CheckAndRestoreMouseCursor();
1231 for (uint32_t i
= 0; i
< (uint32_t)(videoWidget
->textureWidth
* 256); i
++)
1233 uint32_t pixel
= videoWidget
->buffer
[i
];
1234 uint8_t r
= (pixel
>> 24) & 0xFF, g
= (pixel
>> 16) & 0xFF, b
= (pixel
>> 8) & 0xFF;
1235 pixel
= ((r
+ g
+ b
) / 3) & 0x00FF;
1236 videoWidget
->buffer
[i
] = 0x000000FF | (pixel
<< 16) | (pixel
<< 8);
1239 videoWidget
->updateGL();
1241 cpuBrowseWin
->HoldBPM();
1242 cpuBrowseWin
->HandleBPMContinue();
1243 DebuggerRefreshWindows();
1248 frameAdvanceAct
->setDisabled(true);
1249 pauseAct
->setChecked(false);
1250 pauseAct
->setDisabled(false);
1251 if (vjs
.softTypeDebugger
)
1253 traceStepIntoAct
->setDisabled(true);
1254 traceStepOverAct
->setDisabled(true);
1255 restartAct
->setDisabled(true);
1258 cpuBrowseWin
->UnholdBPM();
1261 // Pause/unpause any running/non-running threads...
1262 DACPauseAudioThread(!running
);
1266 void MainWin::SetZoom100(void)
1273 void MainWin::SetZoom200(void)
1280 void MainWin::SetZoom300(void)
1287 void MainWin::SetNTSC(void)
1289 powerAct
->setIcon(powerRed
);
1290 timer
->setInterval(16);
1291 vjs
.hardwareTypeNTSC
= true;
1297 void MainWin::SetPAL(void)
1299 powerAct
->setIcon(powerGreen
);
1300 timer
->setInterval(20);
1301 vjs
.hardwareTypeNTSC
= false;
1307 void MainWin::ToggleBlur(void)
1309 vjs
.glFilter
= !vjs
.glFilter
;
1314 void MainWin::ShowAboutWin(void)
1320 void MainWin::ShowHelpWin(void)
1326 void MainWin::InsertCart(void)
1328 // Check to see if we did autorun, 'cause we didn't load anything in that
1330 if (!scannedSoftwareFolder
)
1332 filePickWin
->ScanSoftwareFolder(allowUnknownSoftware
);
1333 scannedSoftwareFolder
= true;
1336 // If the emulator is running, we pause it here and unpause it later
1337 // if we dismiss the file selector without choosing anything
1338 if (running
&& powerButtonOn
)
1341 pauseForFileSelector
= true;
1344 filePickWin
->show();
1348 void MainWin::Unpause(void)
1350 // Here we unpause the emulator if it was paused when we went into the file selector
1351 if (pauseForFileSelector
)
1353 pauseForFileSelector
= false;
1355 // Some nutter might have unpaused while in the file selector, so check for that
1362 // Jaguar initialisation and load software file
1363 void MainWin::LoadSoftware(QString file
)
1365 running
= false; // Prevent bad things(TM) from happening...
1366 pauseForFileSelector
= false; // Reset the file selector pause flag
1368 // Setup BIOS in his own dedicated Jaguar memory
1369 #ifndef NEWMODELSBIOSHANDLER
1370 uint8_t * biosPointer
= jaguarBootROM
;
1372 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
1374 biosPointer
= jaguarDevBootROM2
;
1377 memcpy(jagMemSpace
+ 0xE00000, biosPointer
, 0x20000);
1379 SelectBIOS(vjs
.biosType
);
1382 // Turn 'on' the power to initialize the Jaguar
1383 powerAct
->setDisabled(false);
1384 powerAct
->setChecked(true);
1385 powerButtonOn
= false;
1388 // We have to load our software *after* the Jaguar RESET
1389 cartridgeLoaded
= JaguarLoadFile(file
.toUtf8().data());
1390 SET32(jaguarMainRAM
, 0, vjs
.DRAM_size
); // Set stack in the M68000's Reset SP
1392 // This is icky because we've already done it
1393 // it gets worse :-P
1394 if (!vjs
.useJaguarBIOS
)
1396 SET32(jaguarMainRAM
, 4, jaguarRunAddress
);
1401 // set the M68K in halt mode in case of a debug mode is used, so control is at user side
1402 if (vjs
.softTypeDebugger
)
1404 m68k_set_reg(M68K_REG_A6
, 0);
1405 m68kDasmWin
->SetAddress(jaguarRunAddress
);
1406 //pauseAct->setDisabled(false);
1407 //pauseAct->setChecked(true);
1413 // Prevent the Alpine mode to crash in case of software without a start address
1414 if (vjs
.hardwareTypeAlpine
&& !jaguarRunAddress
)
1420 if ((!vjs
.hardwareTypeAlpine
|| !vjs
.softTypeDebugger
) && !loadAndGo
&& jaguarRunAddress
)
1422 QString newTitle
= QString("Virtual Jaguar " VJ_RELEASE_VERSION
" Rx - Now playing: %1").arg(filePickWin
->GetSelectedPrettyName());
1423 setWindowTitle(newTitle
);
1428 void MainWin::ToggleCDUsage(void)
1430 CDActive
= !CDActive
;
1432 // Set up the Jaguar CD for execution, otherwise, clear memory
1434 memcpy(jagMemSpace
+ 0x800000, jaguarCDBootROM
, 0x40000);
1436 memset(jagMemSpace
+ 0x800000, 0xFF, 0x40000);
1441 void MainWin::NewBreakpointFunction(void)
1444 //brkWin->RefreshContents();
1449 void MainWin::DebuggerTraceStepInto(void)
1452 videoWidget
->updateGL();
1453 DebuggerRefreshWindows();
1455 #pragma message("Warning: !!! Need to verify the Step Into function !!!")
1457 #warning "!!! Need to verify the Step Into function !!!"
1463 void MainWin::DebuggerRestart(void)
1468 m68k_set_reg(M68K_REG_PC
, jaguarRunAddress
);
1469 m68k_set_reg(M68K_REG_SP
, vjs
.DRAM_size
);
1471 m68k_set_reg(M68K_REG_A6
, 0);
1473 DebuggerResetWindows();
1474 DebuggerRefreshWindows();
1476 #pragma message("Warning: !!! Need to verify the Restart function !!!")
1478 #warning "!!! Need to verify the Restart function !!!"
1484 void MainWin::DebuggerTraceStepOver(void)
1487 videoWidget
->updateGL();
1488 DebuggerRefreshWindows();
1490 #pragma message("Warning: !!! Need to verify the Step Over function !!!")
1492 #warning "!!! Need to verify the Step Over function !!!"
1497 // Advance / Execute for one frame
1498 void MainWin::FrameAdvance(void)
1500 //printf("Frame Advance...\n");
1502 // Execute 1 frame, then exit (only useful in Pause mode)
1504 //if (!vjs.softTypeDebugger)
1505 videoWidget
->updateGL();
1507 // Need to execute 1 frames' worth of DSP thread as well :-/
1509 //m68kDasmWin->Use68KPCAddress();
1512 #pragma message("Warning: !!! Need to execute the DSP thread for 1 frame too !!!")
1514 #warning "!!! Need to execute the DSP thread for 1 frame too !!!"
1519 void MainWin::SetFullScreen(bool state
/*= true*/)
1521 if (!vjs
.softTypeDebugger
)
1525 mainWinPosition
= pos();
1527 statusBar()->hide();
1533 // This is needed because the fullscreen may happen on a different
1534 // screen than screen 0:
1535 int screenNum
= QApplication::desktop()->screenNumber(videoWidget
);
1536 QRect r
= QApplication::desktop()->screenGeometry(screenNum
);
1537 double targetWidth
= (double)VIRTUAL_SCREEN_WIDTH
,
1538 targetHeight
= (double)(vjs
.hardwareTypeNTSC
? VIRTUAL_SCREEN_HEIGHT_NTSC
: VIRTUAL_SCREEN_HEIGHT_PAL
);
1539 double aspectRatio
= targetWidth
/ targetHeight
;
1540 // NOTE: Really should check here to see which dimension constrains the
1541 // other. Right now, we assume that height is the constraint.
1542 int newWidth
= (int)(aspectRatio
* (double)r
.height());
1543 videoWidget
->offset
= (r
.width() - newWidth
) / 2;
1544 videoWidget
->fullscreen
= true;
1545 videoWidget
->outputWidth
= newWidth
;
1546 videoWidget
->setFixedSize(r
.width(), r
.height());
1551 // Seems Qt is fussy about this: showNormal() has to go first, or it
1552 // will keep the window stuck in a psuedo-fullscreen mode with no way
1553 // to get out of it (except closing the app).
1556 // Reset the video widget to windowed mode
1557 videoWidget
->offset
= 0;
1558 videoWidget
->fullscreen
= false;
1560 statusBar()->show();
1567 move(mainWinPosition
);
1573 void MainWin::ToggleFullScreen(void)
1575 fullScreen
= !fullScreen
;
1576 SetFullScreen(fullScreen
);
1581 void MainWin::ShowExceptionVectorTableBrowserWin(void)
1583 exceptionvectortableBrowseWin
->show();
1584 exceptionvectortableBrowseWin
->RefreshContents();
1589 void MainWin::ShowLocalBrowserWin(void)
1591 LocalBrowseWin
->show();
1592 LocalBrowseWin
->RefreshContents();
1597 void MainWin::ShowCallStackBrowserWin(void)
1599 CallStackBrowseWin
->show();
1600 CallStackBrowseWin
->RefreshContents();
1604 void MainWin::ShowAllWatchBrowserWin(void)
1606 allWatchBrowseWin
->show();
1607 allWatchBrowseWin
->RefreshContents();
1611 void MainWin::ShowHeapAllocatorBrowserWin(void)
1613 heapallocatorBrowseWin
->show();
1614 heapallocatorBrowseWin
->RefreshContents();
1618 void MainWin::ShowMemoryBrowserWin(void)
1620 memBrowseWin
->show();
1621 memBrowseWin
->RefreshContents();
1625 void MainWin::ShowMemory1BrowserWin(int NumWin
)
1627 // for (int i = 0; i < vjs.nbrmemory1browserwindow; i++)
1629 mem1BrowseWin
[NumWin
]->show();
1630 mem1BrowseWin
[NumWin
]->RefreshContents(NumWin
);
1635 void MainWin::ShowEmuStatusWin(void)
1637 emuStatusWin
->show();
1638 emuStatusWin
->RefreshContents();
1642 void MainWin::ShowStackBrowserWin(void)
1644 stackBrowseWin
->show();
1645 stackBrowseWin
->RefreshContents();
1649 void MainWin::ShowCPUBrowserWin(void)
1651 cpuBrowseWin
->show();
1652 cpuBrowseWin
->RefreshContents();
1656 void MainWin::ShowOPBrowserWin(void)
1658 opBrowseWin
->show();
1659 opBrowseWin
->RefreshContents();
1663 void MainWin::ShowM68KDasmBrowserWin(void)
1665 m68kDasmBrowseWin
->show();
1666 m68kDasmBrowseWin
->RefreshContents();
1670 void MainWin::ShowRISCDasmBrowserWin(void)
1672 riscDasmBrowseWin
->show();
1673 riscDasmBrowseWin
->RefreshContents();
1679 void MainWin::ShowDasmWin(void)
1682 // DasmWin->RefreshContents();
1689 void MainWin::ShowVideoOutputWin(void)
1691 //VideoOutputWindowCentrale = mainWindowCentrale->addSubWindow(videoWidget);
1692 //VideoOutputWindowCentrale->setWindowTitle(QString(tr("Video output")));
1693 //VideoOutputWindowCentrale->show();
1694 //memBrowseWin->show();
1695 //VideoOutputWin->show();
1696 //VideoOutputWin->RefreshContents(videoWidget);
1701 // Resize video window based on zoom factor
1702 // It doesn't apply in debugger mode as we use this window to display disassembly
1703 void MainWin::ResizeMainWindow(void)
1705 if (!vjs
.softTypeDebugger
)
1707 videoWidget
->setFixedSize(zoomLevel
* VIRTUAL_SCREEN_WIDTH
, zoomLevel
* (vjs
.hardwareTypeNTSC
? VIRTUAL_SCREEN_HEIGHT_NTSC
: VIRTUAL_SCREEN_HEIGHT_PAL
));
1709 // Show the test pattern if user requested plzDontKillMyComputer mode
1710 if (!powerButtonOn
&& plzDontKillMyComputer
)
1712 for (uint32_t y
= 0; y
< videoWidget
->rasterHeight
; y
++)
1714 if (vjs
.hardwareTypeNTSC
)
1716 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1720 memcpy(videoWidget
->buffer
+ (y
* videoWidget
->textureWidth
), testPattern2
+ (y
* VIRTUAL_SCREEN_WIDTH
), VIRTUAL_SCREEN_WIDTH
* sizeof(uint32_t));
1731 void MainWin::ReadSettings(void)
1735 QSettings
settings("Underground Software", "Virtual Jaguar");
1737 //zoomLevel = settings.value("zoom", 2).toInt();
1738 allowUnknownSoftware
= settings
.value("showUnknownSoftware", false).toBool();
1739 lastEditedProfile
= settings
.value("lastEditedProfile", 0).toInt();
1741 vjs
.useJoystick
= settings
.value("useJoystick", false).toBool();
1742 vjs
.joyport
= settings
.value("joyport", 0).toInt();
1743 vjs
.hardwareTypeNTSC
= settings
.value("hardwareTypeNTSC", true).toBool();
1744 vjs
.frameSkip
= settings
.value("frameSkip", 0).toInt();
1745 vjs
.useJaguarBIOS
= settings
.value("useJaguarBIOS", false).toBool();
1746 vjs
.useRetailBIOS
= settings
.value("useRetailBIOS", false).toBool();
1747 vjs
.useDevBIOS
= settings
.value("useDevBIOS", false).toBool();
1748 vjs
.GPUEnabled
= settings
.value("GPUEnabled", true).toBool();
1749 vjs
.DSPEnabled
= settings
.value("DSPEnabled", true).toBool();
1750 vjs
.audioEnabled
= settings
.value("audioEnabled", true).toBool();
1751 vjs
.usePipelinedDSP
= settings
.value("usePipelinedDSP", false).toBool();
1752 vjs
.fullscreen
= settings
.value("fullscreen", false).toBool();
1753 vjs
.useOpenGL
= settings
.value("useOpenGL", true).toBool();
1754 vjs
.glFilter
= settings
.value("glFilterType", 1).toInt();
1755 vjs
.renderType
= settings
.value("renderType", 0).toInt();
1756 vjs
.biosType
= settings
.value("biosType", BT_M_SERIES
).toInt();
1757 vjs
.jaguarModel
= settings
.value("jaguarModel", JAG_M_SERIES
).toInt();
1758 vjs
.useFastBlitter
= settings
.value("useFastBlitter", false).toBool();
1759 strcpy(vjs
.EEPROMPath
, settings
.value("EEPROMs", QStandardPaths::writableLocation(QStandardPaths::DataLocation
).append("/eeproms/")).toString().toUtf8().data());
1760 strcpy(vjs
.ROMPath
, settings
.value("ROMs", QStandardPaths::writableLocation(QStandardPaths::DataLocation
).append("/software/")).toString().toUtf8().data());
1761 strcpy(vjs
.screenshotPath
, settings
.value("Screenshots", QStandardPaths::writableLocation(QStandardPaths::DataLocation
).append("/screenshots/")).toString().toUtf8().data());
1763 // Read settings from the Debugger mode
1764 settings
.beginGroup("debugger");
1765 strcpy(vjs
.debuggerROMPath
, settings
.value("DefaultROM", "").toString().toUtf8().data());
1766 vjs
.nbrdisasmlines
= settings
.value("NbrDisasmLines", 32).toUInt();
1767 vjs
.disasmopcodes
= settings
.value("DisasmOpcodes", true).toBool();
1768 vjs
.displayHWlabels
= settings
.value("DisplayHWLabels", true).toBool();
1769 vjs
.displayFullSourceFilename
= settings
.value("displayFullSourceFilename", true).toBool();
1770 vjs
.nbrmemory1browserwindow
= settings
.value("NbrMemory1BrowserWindow", MaxMemory1BrowserWindow
).toUInt();
1771 settings
.endGroup();
1773 // Read settings from the Alpine mode
1774 settings
.beginGroup("alpine");
1775 strcpy(vjs
.alpineROMPath
, settings
.value("DefaultROM", "").toString().toUtf8().data());
1776 strcpy(vjs
.absROMPath
, settings
.value("DefaultABS", "").toString().toUtf8().data());
1777 vjs
.refresh
= settings
.value("refresh", 60).toUInt();
1778 vjs
.allowWritesToROM
= settings
.value("writeROM", false).toBool();
1779 settings
.endGroup();
1781 // Read settings from the Keybindings
1782 settings
.beginGroup("keybindings");
1783 for (i
= 0; i
< KB_END
; i
++)
1785 strcpy(vjs
.KBContent
[i
].KBSettingValue
, settings
.value(KeyBindingsTable
[i
].KBNameSetting
, KeyBindingsTable
[i
].KBDefaultValue
).toString().toUtf8().data());
1787 settings
.endGroup();
1789 // Write important settings to the log file
1790 WriteLog("MainWin: Paths\n");
1791 WriteLog(" EEPROMPath = \"%s\"\n", vjs
.EEPROMPath
);
1792 WriteLog(" ROMPath = \"%s\"\n", vjs
.ROMPath
);
1793 WriteLog(" AlpineROMPath = \"%s\"\n", vjs
.alpineROMPath
);
1794 WriteLog("DebuggerROMPath = \"%s\"\n", vjs
.debuggerROMPath
);
1795 WriteLog(" absROMPath = \"%s\"\n", vjs
.absROMPath
);
1796 WriteLog("ScreenshotsPath = \"%s\"\n", vjs
.screenshotPath
);
1797 WriteLog(" Pipelined DSP = %s\n", (vjs
.usePipelinedDSP
? "ON" : "off"));
1800 // Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, *
1801 vjs
.p1KeyBindings
[BUTTON_U
] = settings
.value("p1k_up", Qt::Key_S
).toInt();
1802 vjs
.p1KeyBindings
[BUTTON_D
] = settings
.value("p1k_down", Qt::Key_X
).toInt();
1803 vjs
.p1KeyBindings
[BUTTON_L
] = settings
.value("p1k_left", Qt::Key_A
).toInt();
1804 vjs
.p1KeyBindings
[BUTTON_R
] = settings
.value("p1k_right", Qt::Key_D
).toInt();
1805 vjs
.p1KeyBindings
[BUTTON_C
] = settings
.value("p1k_c", Qt::Key_J
).toInt();
1806 vjs
.p1KeyBindings
[BUTTON_B
] = settings
.value("p1k_b", Qt::Key_K
).toInt();
1807 vjs
.p1KeyBindings
[BUTTON_A
] = settings
.value("p1k_a", Qt::Key_L
).toInt();
1808 vjs
.p1KeyBindings
[BUTTON_OPTION
] = settings
.value("p1k_option", Qt::Key_O
).toInt();
1809 vjs
.p1KeyBindings
[BUTTON_PAUSE
] = settings
.value("p1k_pause", Qt::Key_P
).toInt();
1810 vjs
.p1KeyBindings
[BUTTON_0
] = settings
.value("p1k_0", Qt::Key_0
).toInt();
1811 vjs
.p1KeyBindings
[BUTTON_1
] = settings
.value("p1k_1", Qt::Key_1
).toInt();
1812 vjs
.p1KeyBindings
[BUTTON_2
] = settings
.value("p1k_2", Qt::Key_2
).toInt();
1813 vjs
.p1KeyBindings
[BUTTON_3
] = settings
.value("p1k_3", Qt::Key_3
).toInt();
1814 vjs
.p1KeyBindings
[BUTTON_4
] = settings
.value("p1k_4", Qt::Key_4
).toInt();
1815 vjs
.p1KeyBindings
[BUTTON_5
] = settings
.value("p1k_5", Qt::Key_5
).toInt();
1816 vjs
.p1KeyBindings
[BUTTON_6
] = settings
.value("p1k_6", Qt::Key_6
).toInt();
1817 vjs
.p1KeyBindings
[BUTTON_7
] = settings
.value("p1k_7", Qt::Key_7
).toInt();
1818 vjs
.p1KeyBindings
[BUTTON_8
] = settings
.value("p1k_8", Qt::Key_8
).toInt();
1819 vjs
.p1KeyBindings
[BUTTON_9
] = settings
.value("p1k_9", Qt::Key_9
).toInt();
1820 vjs
.p1KeyBindings
[BUTTON_d
] = settings
.value("p1k_pound", Qt::Key_Minus
).toInt();
1821 vjs
.p1KeyBindings
[BUTTON_s
] = settings
.value("p1k_star", Qt::Key_Equal
).toInt();
1823 vjs
.p2KeyBindings
[BUTTON_U
] = settings
.value("p2k_up", Qt::Key_Up
).toInt();
1824 vjs
.p2KeyBindings
[BUTTON_D
] = settings
.value("p2k_down", Qt::Key_Down
).toInt();
1825 vjs
.p2KeyBindings
[BUTTON_L
] = settings
.value("p2k_left", Qt::Key_Left
).toInt();
1826 vjs
.p2KeyBindings
[BUTTON_R
] = settings
.value("p2k_right", Qt::Key_Right
).toInt();
1827 vjs
.p2KeyBindings
[BUTTON_C
] = settings
.value("p2k_c", Qt::Key_Z
).toInt();
1828 vjs
.p2KeyBindings
[BUTTON_B
] = settings
.value("p2k_b", Qt::Key_X
).toInt();
1829 vjs
.p2KeyBindings
[BUTTON_A
] = settings
.value("p2k_a", Qt::Key_C
).toInt();
1830 vjs
.p2KeyBindings
[BUTTON_OPTION
] = settings
.value("p2k_option", Qt::Key_Apostrophe
).toInt();
1831 vjs
.p2KeyBindings
[BUTTON_PAUSE
] = settings
.value("p2k_pause", Qt::Key_Return
).toInt();
1832 vjs
.p2KeyBindings
[BUTTON_0
] = settings
.value("p2k_0", Qt::Key_0
).toInt();
1833 vjs
.p2KeyBindings
[BUTTON_1
] = settings
.value("p2k_1", Qt::Key_1
).toInt();
1834 vjs
.p2KeyBindings
[BUTTON_2
] = settings
.value("p2k_2", Qt::Key_2
).toInt();
1835 vjs
.p2KeyBindings
[BUTTON_3
] = settings
.value("p2k_3", Qt::Key_3
).toInt();
1836 vjs
.p2KeyBindings
[BUTTON_4
] = settings
.value("p2k_4", Qt::Key_4
).toInt();
1837 vjs
.p2KeyBindings
[BUTTON_5
] = settings
.value("p2k_5", Qt::Key_5
).toInt();
1838 vjs
.p2KeyBindings
[BUTTON_6
] = settings
.value("p2k_6", Qt::Key_6
).toInt();
1839 vjs
.p2KeyBindings
[BUTTON_7
] = settings
.value("p2k_7", Qt::Key_7
).toInt();
1840 vjs
.p2KeyBindings
[BUTTON_8
] = settings
.value("p2k_8", Qt::Key_8
).toInt();
1841 vjs
.p2KeyBindings
[BUTTON_9
] = settings
.value("p2k_9", Qt::Key_9
).toInt();
1842 vjs
.p2KeyBindings
[BUTTON_d
] = settings
.value("p2k_pound", Qt::Key_Slash
).toInt();
1843 vjs
.p2KeyBindings
[BUTTON_s
] = settings
.value("p2k_star", Qt::Key_Asterisk
).toInt();
1846 WriteLog("Read setting = Done\n");
1848 ReadProfiles(&settings
);
1853 // Default values will be used in case of no settings can be found
1855 #pragma message("Warning: !!! Need to check the window geometry to see if the positions are legal !!!")
1857 #warning "!!! Need to check the window geometry to see if the positions are legal !!!"
1859 // i.e., someone could drag it to another screen, close it, then disconnect that screen
1860 void MainWin::ReadUISettings(void)
1867 // Point on the emulator settings
1868 QSettings
settings("Underground Software", "Virtual Jaguar");
1869 settings
.beginGroup("ui");
1871 // Emulator main window UI information
1872 mainWinPosition
= settings
.value("pos", QPoint(200, 200)).toPoint();
1873 size
= settings
.value("size", QSize(400, 400)).toSize();
1875 move(mainWinPosition
);
1876 pos
= settings
.value("cartLoadPos", QPoint(200, 200)).toPoint();
1877 filePickWin
->move(pos
);
1879 // Video output information
1880 zoomLevel
= settings
.value("zoom", 2).toInt();
1882 // Alpine debug UI information (also needed by the Debugger)
1883 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
1885 // CPU registers UI information
1886 pos
= settings
.value("cpuBrowseWinPos", QPoint(200, 200)).toPoint();
1887 cpuBrowseWin
->move(pos
);
1888 settings
.value("cpuBrowseWinIsVisible", false).toBool() ? ShowCPUBrowserWin() : void();
1890 // Memory browser UI information
1891 pos
= settings
.value("memBrowseWinPos", QPoint(200, 200)).toPoint();
1892 memBrowseWin
->move(pos
);
1893 settings
.value("memBrowseWinIsVisible", false).toBool() ? ShowMemoryBrowserWin() : void();
1895 // Stack browser UI information
1896 pos
= settings
.value("stackBrowseWinPos", QPoint(200, 200)).toPoint();
1897 stackBrowseWin
->move(pos
);
1898 settings
.value("stackBrowseWinIsVisible", false).toBool() ? ShowStackBrowserWin() : void();
1899 size
= settings
.value("stackBrowseWinSize", QSize(400, 400)).toSize();
1900 stackBrowseWin
->resize(size
);
1902 // Emulator status UI information
1903 pos
= settings
.value("emuStatusWinPos", QPoint(200, 200)).toPoint();
1904 emuStatusWin
->move(pos
);
1905 settings
.value("emuStatusWinIsVisible", false).toBool() ? ShowEmuStatusWin() : void();
1907 // OP (Object Processor) UI information
1908 pos
= settings
.value("opBrowseWinPos", QPoint(200, 200)).toPoint();
1909 opBrowseWin
->move(pos
);
1910 settings
.value("opBrowseWinIsVisible", false).toBool() ? ShowOPBrowserWin() : void();
1911 size
= settings
.value("opBrowseWinSize", QSize(400, 400)).toSize();
1912 opBrowseWin
->resize(size
);
1914 // RISC disassembly UI information
1915 pos
= settings
.value("riscDasmBrowseWinPos", QPoint(200, 200)).toPoint();
1916 riscDasmBrowseWin
->move(pos
);
1917 settings
.value("riscDasmBrowseWinIsVisible", false).toBool() ? ShowRISCDasmBrowserWin() : void();
1919 // M68k disassembly UI information
1920 pos
= settings
.value("m68kDasmBrowseWinPos", QPoint(200, 200)).toPoint();
1921 m68kDasmBrowseWin
->move(pos
);
1922 //settings.value("m68kDasmBrowseWinIsVisible", false).toBool() ? ShowM68KDasmBrowserWin() : void();
1924 #pragma message("Warning: !!! Need to check the M68k disassembly window position crashing !!!")
1926 #warning "!!! Need to check the M68k disassembly window position crashing !!!"
1930 // Debugger UI information
1931 if (vjs
.softTypeDebugger
)
1934 pos
= settings
.value("m68kDasmWinPos", QPoint(200, 200)).toPoint();
1935 m68kDasmWin
->move(pos
);
1936 //settings.value("m68kDasmWinIsVisible", false).toBool() ? m68kDasmWin->show() : m68kDasmWin->hide();
1937 pos
= settings
.value("GPUDasmWinPos", QPoint(200, 200)).toPoint();
1938 GPUDasmWin
->move(pos
);
1939 pos
= settings
.value("DSPDasmWinPos", QPoint(200, 200)).toPoint();
1940 DSPDasmWin
->move(pos
);
1942 // All watch browser UI information
1943 pos
= settings
.value("allWatchBrowseWinPos", QPoint(200, 200)).toPoint();
1944 allWatchBrowseWin
->move(pos
);
1945 settings
.value("allWatchBrowseWinIsVisible", false).toBool() ? ShowAllWatchBrowserWin() : void();
1946 size
= settings
.value("allWatchBrowseWinSize", QSize(400, 400)).toSize();
1947 allWatchBrowseWin
->resize(size
);
1949 // Local browser UI information
1950 pos
= settings
.value("LocalBrowseWinPos", QPoint(200, 200)).toPoint();
1951 LocalBrowseWin
->move(pos
);
1952 settings
.value("LocalBrowseWinIsVisible", false).toBool() ? ShowLocalBrowserWin() : void();
1953 size
= settings
.value("LocalBrowseWinSize", QSize(400, 400)).toSize();
1954 LocalBrowseWin
->resize(size
);
1956 // Heap memory allocation browser UI information
1957 pos
= settings
.value("heapallocatorBrowseWinPos", QPoint(200, 200)).toPoint();
1958 heapallocatorBrowseWin
->move(pos
);
1959 settings
.value("heapallocatorBrowseWinIsVisible", false).toBool() ? ShowHeapAllocatorBrowserWin() : void();
1960 size
= settings
.value("heapallocatorBrowseWinSize", QSize(400, 400)).toSize();
1961 heapallocatorBrowseWin
->resize(size
);
1963 // Exception Vector Table UI Information
1964 pos
= settings
.value("exceptionVectorTableBrowseWinPos", QPoint(200, 200)).toPoint();
1965 exceptionvectortableBrowseWin
->move(pos
);
1966 settings
.value("exceptionVectorTableBrowseWinIsVisible", false).toBool() ? ShowExceptionVectorTableBrowserWin() : void();
1967 size
= settings
.value("exceptionVectorTableBrowseWinSize", QSize(400, 400)).toSize();
1968 exceptionvectortableBrowseWin
->resize(size
);
1970 // Call Stack browser UI information
1971 pos
= settings
.value("CallStackBrowseWinPos", QPoint(200, 200)).toPoint();
1972 CallStackBrowseWin
->move(pos
);
1973 settings
.value("CallStackBrowseWinIsVisible", false).toBool() ? ShowCallStackBrowserWin() : void();
1974 size
= settings
.value("CallStackBrowseWinSize", QSize(400, 400)).toSize();
1975 CallStackBrowseWin
->resize(size
);
1977 // Memories browser UI information
1978 for (i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
1980 sprintf(mem1Name
, "mem1BrowseWinPos[%i]", (unsigned int)i
);
1981 pos
= settings
.value(mem1Name
, QPoint(200, 200)).toPoint();
1982 mem1BrowseWin
[i
]->move(pos
);
1983 sprintf(mem1Name
, "mem1BrowseWinIsVisible[%i]", (unsigned int)i
);
1984 settings
.value(mem1Name
, false).toBool() ? ShowMemory1BrowserWin((int)i
) : void();
1985 sprintf(mem1Name
, "mem1BrowseWinSize[%i]", (unsigned int)i
);
1986 size
= settings
.value(mem1Name
, QSize(400, 400)).toSize();
1987 mem1BrowseWin
[i
]->resize(size
);
1991 settings
.endGroup();
1993 WriteLog("Read UI setting = Done\n");
1997 // Save the settings
1998 void MainWin::WriteSettings(void)
2002 // Point on the emulator settings
2003 QSettings
settings("Underground Software", "Virtual Jaguar");
2004 //settings.setValue("pos", pos());
2005 //settings.setValue("size", size());
2006 //settings.setValue("cartLoadPos", filePickWin->pos());
2008 //settings.setValue("zoom", zoomLevel);
2009 settings
.setValue("showUnknownSoftware", allowUnknownSoftware
);
2010 settings
.setValue("lastEditedProfile", lastEditedProfile
);
2012 settings
.setValue("useJoystick", vjs
.useJoystick
);
2013 settings
.setValue("joyport", vjs
.joyport
);
2014 settings
.setValue("hardwareTypeNTSC", vjs
.hardwareTypeNTSC
);
2015 settings
.setValue("frameSkip", vjs
.frameSkip
);
2016 settings
.setValue("useJaguarBIOS", vjs
.useJaguarBIOS
);
2017 settings
.setValue("useRetailBIOS", vjs
.useRetailBIOS
);
2018 settings
.setValue("useDevBIOS", vjs
.useDevBIOS
);
2019 settings
.setValue("GPUEnabled", vjs
.GPUEnabled
);
2020 settings
.setValue("DSPEnabled", vjs
.DSPEnabled
);
2021 settings
.setValue("audioEnabled", vjs
.audioEnabled
);
2022 settings
.setValue("usePipelinedDSP", vjs
.usePipelinedDSP
);
2023 settings
.setValue("fullscreen", vjs
.fullscreen
);
2024 settings
.setValue("useOpenGL", vjs
.useOpenGL
);
2025 settings
.setValue("glFilterType", vjs
.glFilter
);
2026 settings
.setValue("renderType", vjs
.renderType
);
2027 settings
.setValue("jaguarModel", vjs
.jaguarModel
);
2028 settings
.setValue("biosType", vjs
.biosType
);
2029 settings
.setValue("useFastBlitter", vjs
.useFastBlitter
);
2030 //settings.setValue("JagBootROM", vjs.jagBootPath);
2031 //settings.setValue("CDBootROM", vjs.CDBootPath);
2032 settings
.setValue("EEPROMs", vjs
.EEPROMPath
);
2033 settings
.setValue("ROMs", vjs
.ROMPath
);
2034 settings
.setValue("Screenshots", vjs
.screenshotPath
);
2036 // Write settings from the Alpine mode
2037 settings
.beginGroup("alpine");
2038 settings
.setValue("refresh", vjs
.refresh
);
2039 settings
.setValue("DefaultROM", vjs
.alpineROMPath
);
2040 settings
.setValue("DefaultABS", vjs
.absROMPath
);
2041 settings
.setValue("writeROM", vjs
.allowWritesToROM
);
2042 settings
.endGroup();
2044 // Write settings from the Debugger mode
2045 settings
.beginGroup("debugger");
2046 settings
.setValue("DisplayHWLabels", vjs
.displayHWlabels
);
2047 settings
.setValue("NbrDisasmLines", vjs
.nbrdisasmlines
);
2048 settings
.setValue("DisasmOpcodes", vjs
.disasmopcodes
);
2049 settings
.setValue("displayFullSourceFilename", vjs
.displayFullSourceFilename
);
2050 settings
.setValue("NbrMemory1BrowserWindow", (unsigned int)vjs
.nbrmemory1browserwindow
);
2051 settings
.setValue("DefaultROM", vjs
.debuggerROMPath
);
2052 settings
.endGroup();
2054 // Write settings from the Keybindings
2055 settings
.beginGroup("keybindings");
2056 for (i
= 0; i
< KB_END
; i
++)
2058 settings
.setValue(KeyBindingsTable
[i
].KBNameSetting
, vjs
.KBContent
[i
].KBSettingValue
);
2060 settings
.endGroup();
2063 settings
.setValue("p1k_up", vjs
.p1KeyBindings
[BUTTON_U
]);
2064 settings
.setValue("p1k_down", vjs
.p1KeyBindings
[BUTTON_D
]);
2065 settings
.setValue("p1k_left", vjs
.p1KeyBindings
[BUTTON_L
]);
2066 settings
.setValue("p1k_right", vjs
.p1KeyBindings
[BUTTON_R
]);
2067 settings
.setValue("p1k_c", vjs
.p1KeyBindings
[BUTTON_C
]);
2068 settings
.setValue("p1k_b", vjs
.p1KeyBindings
[BUTTON_B
]);
2069 settings
.setValue("p1k_a", vjs
.p1KeyBindings
[BUTTON_A
]);
2070 settings
.setValue("p1k_option", vjs
.p1KeyBindings
[BUTTON_OPTION
]);
2071 settings
.setValue("p1k_pause", vjs
.p1KeyBindings
[BUTTON_PAUSE
]);
2072 settings
.setValue("p1k_0", vjs
.p1KeyBindings
[BUTTON_0
]);
2073 settings
.setValue("p1k_1", vjs
.p1KeyBindings
[BUTTON_1
]);
2074 settings
.setValue("p1k_2", vjs
.p1KeyBindings
[BUTTON_2
]);
2075 settings
.setValue("p1k_3", vjs
.p1KeyBindings
[BUTTON_3
]);
2076 settings
.setValue("p1k_4", vjs
.p1KeyBindings
[BUTTON_4
]);
2077 settings
.setValue("p1k_5", vjs
.p1KeyBindings
[BUTTON_5
]);
2078 settings
.setValue("p1k_6", vjs
.p1KeyBindings
[BUTTON_6
]);
2079 settings
.setValue("p1k_7", vjs
.p1KeyBindings
[BUTTON_7
]);
2080 settings
.setValue("p1k_8", vjs
.p1KeyBindings
[BUTTON_8
]);
2081 settings
.setValue("p1k_9", vjs
.p1KeyBindings
[BUTTON_9
]);
2082 settings
.setValue("p1k_pound", vjs
.p1KeyBindings
[BUTTON_d
]);
2083 settings
.setValue("p1k_star", vjs
.p1KeyBindings
[BUTTON_s
]);
2085 settings
.setValue("p2k_up", vjs
.p2KeyBindings
[BUTTON_U
]);
2086 settings
.setValue("p2k_down", vjs
.p2KeyBindings
[BUTTON_D
]);
2087 settings
.setValue("p2k_left", vjs
.p2KeyBindings
[BUTTON_L
]);
2088 settings
.setValue("p2k_right", vjs
.p2KeyBindings
[BUTTON_R
]);
2089 settings
.setValue("p2k_c", vjs
.p2KeyBindings
[BUTTON_C
]);
2090 settings
.setValue("p2k_b", vjs
.p2KeyBindings
[BUTTON_B
]);
2091 settings
.setValue("p2k_a", vjs
.p2KeyBindings
[BUTTON_A
]);
2092 settings
.setValue("p2k_option", vjs
.p2KeyBindings
[BUTTON_OPTION
]);
2093 settings
.setValue("p2k_pause", vjs
.p2KeyBindings
[BUTTON_PAUSE
]);
2094 settings
.setValue("p2k_0", vjs
.p2KeyBindings
[BUTTON_0
]);
2095 settings
.setValue("p2k_1", vjs
.p2KeyBindings
[BUTTON_1
]);
2096 settings
.setValue("p2k_2", vjs
.p2KeyBindings
[BUTTON_2
]);
2097 settings
.setValue("p2k_3", vjs
.p2KeyBindings
[BUTTON_3
]);
2098 settings
.setValue("p2k_4", vjs
.p2KeyBindings
[BUTTON_4
]);
2099 settings
.setValue("p2k_5", vjs
.p2KeyBindings
[BUTTON_5
]);
2100 settings
.setValue("p2k_6", vjs
.p2KeyBindings
[BUTTON_6
]);
2101 settings
.setValue("p2k_7", vjs
.p2KeyBindings
[BUTTON_7
]);
2102 settings
.setValue("p2k_8", vjs
.p2KeyBindings
[BUTTON_8
]);
2103 settings
.setValue("p2k_9", vjs
.p2KeyBindings
[BUTTON_9
]);
2104 settings
.setValue("p2k_pound", vjs
.p2KeyBindings
[BUTTON_d
]);
2105 settings
.setValue("p2k_star", vjs
.p2KeyBindings
[BUTTON_s
]);
2108 WriteProfiles(&settings
);
2112 // Save the UI settings
2113 void MainWin::WriteUISettings(void)
2118 // Point on the emulator settings
2119 QSettings
settings("Underground Software", "Virtual Jaguar");
2120 settings
.beginGroup("ui");
2122 // Emulator UI information
2123 settings
.setValue("pos", pos());
2124 settings
.setValue("size", size());
2125 settings
.setValue("cartLoadPos", filePickWin
->pos());
2127 // Video output information
2128 settings
.setValue("zoom", zoomLevel
);
2130 // Alpine debug UI information (also needed by the Debugger)
2131 if (vjs
.hardwareTypeAlpine
|| vjs
.softTypeDebugger
)
2133 settings
.setValue("cpuBrowseWinPos", cpuBrowseWin
->pos());
2134 settings
.setValue("cpuBrowseWinIsVisible", cpuBrowseWin
->isVisible());
2135 settings
.setValue("memBrowseWinPos", memBrowseWin
->pos());
2136 settings
.setValue("memBrowseWinIsVisible", memBrowseWin
->isVisible());
2137 settings
.setValue("stackBrowseWinPos", stackBrowseWin
->pos());
2138 settings
.setValue("stackBrowseWinIsVisible", stackBrowseWin
->isVisible());
2139 settings
.setValue("stackBrowseWinSize", stackBrowseWin
->size());
2140 settings
.setValue("emuStatusWinPos", emuStatusWin
->pos());
2141 settings
.setValue("emuStatusWinIsVisible", emuStatusWin
->isVisible());
2142 settings
.setValue("opBrowseWinPos", opBrowseWin
->pos());
2143 settings
.setValue("opBrowseWinIsVisible", opBrowseWin
->isVisible());
2144 settings
.setValue("opBrowseWinSize", opBrowseWin
->size());
2145 settings
.setValue("riscDasmBrowseWinPos", riscDasmBrowseWin
->pos());
2146 settings
.setValue("riscDasmBrowseWinIsVisible", riscDasmBrowseWin
->isVisible());
2147 settings
.setValue("m68kDasmBrowseWinPos", m68kDasmBrowseWin
->pos());
2148 settings
.setValue("m68kDasmBrowseWinIsVisible", m68kDasmBrowseWin
->isVisible());
2151 // Debugger UI information
2152 if (vjs
.softTypeDebugger
)
2155 settings
.setValue("m68kDasmWinPos", m68kDasmWin
->pos());
2156 //settings.setValue("m68kDasmWinIsVisible", m68kDasmWin->isVisible());
2157 settings
.setValue("GPUDasmWinPos", GPUDasmWin
->pos());
2158 settings
.setValue("DSPDasmWinPos", DSPDasmWin
->pos());
2160 settings
.setValue("allWatchBrowseWinPos", allWatchBrowseWin
->pos());
2161 settings
.setValue("allWatchBrowseWinIsVisible", allWatchBrowseWin
->isVisible());
2162 settings
.setValue("allWatchBrowseWinSize", allWatchBrowseWin
->size());
2163 settings
.setValue("LocalBrowseWinPos", LocalBrowseWin
->pos());
2164 settings
.setValue("LocalBrowseWinIsVisible", LocalBrowseWin
->isVisible());
2165 settings
.setValue("LocalBrowseWinSize", LocalBrowseWin
->size());
2166 settings
.setValue("heapallocatorBrowseWinPos", heapallocatorBrowseWin
->pos());
2167 settings
.setValue("heapallocatorBrowseWinIsVisible", heapallocatorBrowseWin
->isVisible());
2168 settings
.setValue("heapallocatorBrowseWinSize", heapallocatorBrowseWin
->size());
2169 settings
.setValue("exceptionVectorTableBrowseWinPos", exceptionvectortableBrowseWin
->pos());
2170 settings
.setValue("exceptionVectorTableBrowseWinIsVisible", exceptionvectortableBrowseWin
->isVisible());
2171 settings
.setValue("exceptionVectorTableBrowseWinSize", exceptionvectortableBrowseWin
->size());
2172 settings
.setValue("CallStackBrowseWinPos", CallStackBrowseWin
->pos());
2173 settings
.setValue("CallStackBrowseWinIsVisible", CallStackBrowseWin
->isVisible());
2174 settings
.setValue("CallStackBrowseWinSize", CallStackBrowseWin
->size());
2175 for (i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
2177 sprintf(mem1Name
, "mem1BrowseWinPos[%i]", (unsigned int)i
);
2178 settings
.setValue(mem1Name
, mem1BrowseWin
[i
]->pos());
2179 sprintf(mem1Name
, "mem1BrowseWinIsVisible[%i]", (unsigned int)i
);
2180 settings
.setValue(mem1Name
, mem1BrowseWin
[i
]->isVisible());
2181 sprintf(mem1Name
, "mem1BrowseWinSize[%i]", (unsigned int)i
);
2182 settings
.setValue(mem1Name
, mem1BrowseWin
[i
]->size());
2186 settings
.endGroup();
2190 // Refresh alpine debug windows
2191 void MainWin::AlpineRefreshWindows(void)
2193 cpuBrowseWin
->RefreshContents();
2194 memBrowseWin
->RefreshContents();
2195 stackBrowseWin
->RefreshContents();
2196 emuStatusWin
->RefreshContents();
2197 opBrowseWin
->RefreshContents();
2198 riscDasmBrowseWin
->RefreshContents();
2199 m68kDasmBrowseWin
->RefreshContents();
2203 // Reset soft debugger windows
2204 void MainWin::DebuggerResetWindows(void)
2206 if (vjs
.softTypeDebugger
)
2208 FilesrcListWin
->Reset();
2209 allWatchBrowseWin
->Reset();
2210 heapallocatorBrowseWin
->Reset();
2212 //ResetAlpineWindows();
2217 // Refresh soft debugger & alpine debug windows
2218 void MainWin::DebuggerRefreshWindows(void)
2222 if (vjs
.softTypeDebugger
)
2224 FilesrcListWin
->RefreshContents();
2225 m68kDasmWin
->RefreshContents();
2226 GPUDasmWin
->RefreshContents();
2227 DSPDasmWin
->RefreshContents();
2228 allWatchBrowseWin
->RefreshContents();
2229 LocalBrowseWin
->RefreshContents();
2230 CallStackBrowseWin
->RefreshContents();
2231 heapallocatorBrowseWin
->RefreshContents();
2232 for (i
= 0; i
< vjs
.nbrmemory1browserwindow
; i
++)
2234 mem1BrowseWin
[i
]->RefreshContents(i
);
2237 AlpineRefreshWindows();
2242 // Create and save screenshot
2243 void MainWin::MakeScreenshot(void)
2247 time_t now
= time(0);
2251 tstruct
= *localtime(&now
);
2252 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
);
2254 // Create screenshot
2255 screenshot
= videoWidget
->grabFrameBuffer();
2256 screenshot
.save((char *)Text
, "JPG", 100);