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