2 // mainwin.cpp - Qt-based GUI for Virtual Jaguar: Main Application Window
4 // (C) 2009 Underground Software
6 // JLH = James Hammons <jlhamm@acm.org>
9 // --- ---------- -------------------------------------------------------------
10 // JLH 12/23/2009 Created this file
11 // JLH 12/20/2010 Added settings, menus & toolbars
12 // JLH 07/05/2011 Added CD BIOS functionality to GUI
17 // - Add dbl click/enter to select in cart list, ESC to dimiss [DONE]
18 // - Autoscan/autoload all available BIOS from 'software' folder [DONE]
19 // - Add 1 key jumping in cartridge list (press 'R', jumps to carts starting with 'R', etc) [DONE]
20 // - Controller configuration [DONE]
24 // - Remove SDL dependencies (sound, mainly) from Jaguar core lib
25 // - Fix inconsistency with trailing slashes in paths (eeproms needs one, software doesn't)
27 // SFDX CODE: S1E9T8H5M23YS
29 // Uncomment this for debugging...
31 //#define DEBUGFOO // Various tool debugging...
32 //#define DEBUGTP // Toolpalette debugging...
39 #include "configdialog.h"
40 #include "filepicker.h"
42 #include "generaltab.h"
47 #include "debug/cpubrowser.h"
48 #include "debug/m68kdasmbrowser.h"
49 #include "debug/memorybrowser.h"
50 #include "debug/opbrowser.h"
51 #include "debug/riscdasmbrowser.h"
59 #include "jagcdbios.h"
60 #include "jagstub2bios.h"
63 // According to SebRmv, this header isn't seen on Arch Linux either... :-/
65 // Apparently on win32, usleep() is not pulled in by the usual suspects.
69 // The way BSNES controls things is by setting a timer with a zero
70 // timeout, sleeping if not emulating anything. Seems there has to be a
73 // It has a novel approach to plugging-in/using different video/audio/input
74 // methods, can we do something similar or should we just use the built-in
77 // We're going to try to use the built-in OpenGL support and see how it goes.
78 // We'll make the VJ core modular so that it doesn't matter what GUI is in
79 // use, we can drop it in anywhere and use it as-is.
81 MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
82 showUntunedTankCircuit(true), cartridgeLoaded(false), CDActive(false),
83 pauseForFileSelector(false), loadAndGo(autoRun), plzDontKillMyComputer(false)
85 for(int i=0; i<8; i++)
88 videoWidget = new GLWidget(this);
89 setCentralWidget(videoWidget);
90 setWindowIcon(QIcon(":/res/vj-icon.png"));
92 QString title = QString(tr("Virtual Jaguar " VJ_RELEASE_VERSION ));
94 if (vjs.hardwareTypeAlpine)
95 title += QString(tr(" - Alpine Mode"));
97 setWindowTitle(title);
99 aboutWin = new AboutWindow(this);
100 helpWin = new HelpWindow(this);
101 filePickWin = new FilePickerWindow(this);
102 memBrowseWin = new MemoryBrowserWindow(this);
103 cpuBrowseWin = new CPUBrowserWindow(this);
104 opBrowseWin = new OPBrowserWindow(this);
105 m68kDasmBrowseWin = new M68KDasmBrowserWindow(this);
106 riscDasmBrowseWin = new RISCDasmBrowserWindow(this);
108 videoWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
109 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
111 setUnifiedTitleAndToolBarOnMac(true);
115 quitAppAct = new QAction(tr("E&xit"), this);
116 // quitAppAct->setShortcuts(QKeySequence::Quit);
117 // quitAppAct->setShortcut(QKeySequence(tr("Alt+x")));
118 quitAppAct->setShortcut(QKeySequence(tr("Ctrl+q")));
119 quitAppAct->setStatusTip(tr("Quit Virtual Jaguar"));
120 connect(quitAppAct, SIGNAL(triggered()), this, SLOT(close()));
122 powerGreen.addFile(":/res/power-off.png", QSize(), QIcon::Normal, QIcon::Off);
123 powerGreen.addFile(":/res/power-on-green.png", QSize(), QIcon::Normal, QIcon::On);
124 powerRed.addFile(":/res/power-off.png", QSize(), QIcon::Normal, QIcon::Off);
125 powerRed.addFile(":/res/power-on-red.png", QSize(), QIcon::Normal, QIcon::On);
127 // powerAct = new QAction(QIcon(":/res/power.png"), tr("&Power"), this);
128 powerAct = new QAction(powerGreen, tr("&Power"), this);
129 powerAct->setStatusTip(tr("Powers Jaguar on/off"));
130 powerAct->setCheckable(true);
131 powerAct->setChecked(false);
132 // powerAct->setDisabled(true);
133 connect(powerAct, SIGNAL(triggered()), this, SLOT(TogglePowerState()));
136 pauseIcon.addFile(":/res/pause-off", QSize(), QIcon::Normal, QIcon::Off);
137 pauseIcon.addFile(":/res/pause-on", QSize(), QIcon::Normal, QIcon::On);
138 // pauseAct = new QAction(QIcon(":/res/pause.png"), tr("Pause"), this);
139 pauseAct = new QAction(pauseIcon, tr("Pause"), this);
140 pauseAct->setStatusTip(tr("Toggles the running state"));
141 pauseAct->setCheckable(true);
142 pauseAct->setDisabled(true);
143 pauseAct->setShortcut(QKeySequence(tr("Esc")));
144 connect(pauseAct, SIGNAL(triggered()), this, SLOT(ToggleRunState()));
146 zoomActs = new QActionGroup(this);
148 x1Act = new QAction(QIcon(":/res/zoom100.png"), tr("Zoom 100%"), zoomActs);
149 x1Act->setStatusTip(tr("Set window zoom to 100%"));
150 x1Act->setCheckable(true);
151 connect(x1Act, SIGNAL(triggered()), this, SLOT(SetZoom100()));
153 x2Act = new QAction(QIcon(":/res/zoom200.png"), tr("Zoom 200%"), zoomActs);
154 x2Act->setStatusTip(tr("Set window zoom to 200%"));
155 x2Act->setCheckable(true);
156 connect(x2Act, SIGNAL(triggered()), this, SLOT(SetZoom200()));
158 x3Act = new QAction(QIcon(":/res/zoom300.png"), tr("Zoom 300%"), zoomActs);
159 x3Act->setStatusTip(tr("Set window zoom to 300%"));
160 x3Act->setCheckable(true);
161 connect(x3Act, SIGNAL(triggered()), this, SLOT(SetZoom300()));
163 tvTypeActs = new QActionGroup(this);
165 ntscAct = new QAction(QIcon(":/res/ntsc.png"), tr("NTSC"), tvTypeActs);
166 ntscAct->setStatusTip(tr("Sets Jaguar to NTSC mode"));
167 ntscAct->setCheckable(true);
168 connect(ntscAct, SIGNAL(triggered()), this, SLOT(SetNTSC()));
170 palAct = new QAction(QIcon(":/res/pal.png"), tr("PAL"), tvTypeActs);
171 palAct->setStatusTip(tr("Sets Jaguar to PAL mode"));
172 palAct->setCheckable(true);
173 connect(palAct, SIGNAL(triggered()), this, SLOT(SetPAL()));
175 blurAct = new QAction(QIcon(":/res/blur.png"), tr("Blur"), this);
176 blurAct->setStatusTip(tr("Sets OpenGL rendering to GL_NEAREST"));
177 blurAct->setCheckable(true);
178 connect(blurAct, SIGNAL(triggered()), this, SLOT(ToggleBlur()));
180 aboutAct = new QAction(QIcon(":/res/vj-icon.png"), tr("&About..."), this);
181 aboutAct->setStatusTip(tr("Blatant self-promotion"));
182 connect(aboutAct, SIGNAL(triggered()), this, SLOT(ShowAboutWin()));
184 helpAct = new QAction(QIcon(":/res/vj-icon.png"), tr("&Contents..."), this);
185 helpAct->setStatusTip(tr("Help is available, if you should need it"));
186 connect(helpAct, SIGNAL(triggered()), this, SLOT(ShowHelpWin()));
188 filePickAct = new QAction(QIcon(":/res/software.png"), tr("&Insert Cartridge..."), this);
189 filePickAct->setStatusTip(tr("Insert a cartridge into Virtual Jaguar"));
190 filePickAct->setShortcut(QKeySequence(tr("Ctrl+i")));
191 connect(filePickAct, SIGNAL(triggered()), this, SLOT(InsertCart()));
193 configAct = new QAction(QIcon(":/res/wrench.png"), tr("&Configure"), this);
194 configAct->setStatusTip(tr("Configure options for Virtual Jaguar"));
195 configAct->setShortcut(QKeySequence(tr("Ctrl+c")));
196 connect(configAct, SIGNAL(triggered()), this, SLOT(Configure()));
198 useCDAct = new QAction(QIcon(":/res/compact-disc.png"), tr("&Use CD Unit"), this);
199 useCDAct->setStatusTip(tr("Use Jaguar Virtual CD unit"));
200 // useCDAct->setShortcut(QKeySequence(tr("Ctrl+c")));
201 useCDAct->setCheckable(true);
202 connect(useCDAct, SIGNAL(triggered()), this, SLOT(ToggleCDUsage()));
204 frameAdvanceAct = new QAction(QIcon(":/res/frame-advance.png"), tr("&Frame Advance"), this);
205 frameAdvanceAct->setShortcut(QKeySequence(tr("F7")));
206 frameAdvanceAct->setDisabled(true);
207 connect(frameAdvanceAct, SIGNAL(triggered()), this, SLOT(FrameAdvance()));
209 fullScreenAct = new QAction(QIcon(":/res/fullscreen.png"), tr("F&ull Screen"), this);
210 fullScreenAct->setShortcut(QKeySequence(tr("F9")));
211 fullScreenAct->setCheckable(true);
212 connect(fullScreenAct, SIGNAL(triggered()), this, SLOT(ToggleFullScreen()));
215 memBrowseAct = new QAction(QIcon(":/res/tool-memory.png"), tr("Memory Browser"), this);
216 memBrowseAct->setStatusTip(tr("Shows the Jaguar memory browser window"));
217 // memBrowseAct->setCheckable(true);
218 connect(memBrowseAct, SIGNAL(triggered()), this, SLOT(ShowMemoryBrowserWin()));
220 cpuBrowseAct = new QAction(QIcon(":/res/tool-cpu.png"), tr("CPU Browser"), this);
221 cpuBrowseAct->setStatusTip(tr("Shows the Jaguar CPU browser window"));
222 // memBrowseAct->setCheckable(true);
223 connect(cpuBrowseAct, SIGNAL(triggered()), this, SLOT(ShowCPUBrowserWin()));
225 opBrowseAct = new QAction(QIcon(":/res/tool-op.png"), tr("OP Browser"), this);
226 opBrowseAct->setStatusTip(tr("Shows the Jaguar OP browser window"));
227 // memBrowseAct->setCheckable(true);
228 connect(opBrowseAct, SIGNAL(triggered()), this, SLOT(ShowOPBrowserWin()));
230 m68kDasmBrowseAct = new QAction(QIcon(":/res/tool-68k-dis.png"), tr("68K Listing Browser"), this);
231 m68kDasmBrowseAct->setStatusTip(tr("Shows the 68K disassembly browser window"));
232 // memBrowseAct->setCheckable(true);
233 connect(m68kDasmBrowseAct, SIGNAL(triggered()), this, SLOT(ShowM68KDasmBrowserWin()));
235 riscDasmBrowseAct = new QAction(QIcon(":/res/tool-risc-dis.png"), tr("RISC Listing Browser"), this);
236 riscDasmBrowseAct->setStatusTip(tr("Shows the RISC disassembly browser window"));
237 // memBrowseAct->setCheckable(true);
238 connect(riscDasmBrowseAct, SIGNAL(triggered()), this, SLOT(ShowRISCDasmBrowserWin()));
240 // Misc. connections...
241 connect(filePickWin, SIGNAL(RequestLoad(QString)), this, SLOT(LoadSoftware(QString)));
242 connect(filePickWin, SIGNAL(FilePickerHiding()), this, SLOT(Unpause()));
244 // Create menus & toolbars
246 fileMenu = menuBar()->addMenu(tr("&Jaguar"));
247 fileMenu->addAction(powerAct);
248 fileMenu->addAction(pauseAct);
249 // fileMenu->addAction(frameAdvanceAct);
250 fileMenu->addAction(filePickAct);
251 fileMenu->addAction(useCDAct);
252 fileMenu->addAction(configAct);
253 fileMenu->addAction(quitAppAct);
255 if (vjs.hardwareTypeAlpine)
257 debugMenu = menuBar()->addMenu(tr("&Debug"));
258 debugMenu->addAction(memBrowseAct);
259 debugMenu->addAction(cpuBrowseAct);
260 debugMenu->addAction(opBrowseAct);
261 debugMenu->addAction(m68kDasmBrowseAct);
262 debugMenu->addAction(riscDasmBrowseAct);
265 helpMenu = menuBar()->addMenu(tr("&Help"));
266 helpMenu->addAction(helpAct);
267 helpMenu->addAction(aboutAct);
269 toolbar = addToolBar(tr("Stuff"));
270 toolbar->addAction(powerAct);
271 toolbar->addAction(pauseAct);
272 toolbar->addAction(frameAdvanceAct);
273 toolbar->addAction(filePickAct);
274 toolbar->addAction(useCDAct);
275 toolbar->addSeparator();
276 toolbar->addAction(x1Act);
277 toolbar->addAction(x2Act);
278 toolbar->addAction(x3Act);
279 toolbar->addSeparator();
280 toolbar->addAction(ntscAct);
281 toolbar->addAction(palAct);
282 toolbar->addSeparator();
283 toolbar->addAction(blurAct);
284 toolbar->addAction(fullScreenAct);
286 if (vjs.hardwareTypeAlpine)
288 debugbar = addToolBar(tr("&Debug"));
289 debugbar->addAction(memBrowseAct);
290 debugbar->addAction(cpuBrowseAct);
291 debugbar->addAction(opBrowseAct);
292 debugbar->addAction(m68kDasmBrowseAct);
293 debugbar->addAction(riscDasmBrowseAct);
297 statusBar()->showMessage(tr("Ready"));
301 // Do this in case original size isn't correct (mostly for the first-run case)
304 // Create our test pattern bitmap
305 QImage tempImg(":/res/test-pattern.jpg");
306 QImage tempImgScaled = tempImg.scaled(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT_PAL, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
308 for(uint32_t y=0; y<VIRTUAL_SCREEN_HEIGHT_PAL; y++)
310 const QRgb * scanline = (QRgb *)tempImgScaled.constScanLine(y);
312 for(uint32_t x=0; x<VIRTUAL_SCREEN_WIDTH; x++)
314 uint32_t pixel = (qRed(scanline[x]) << 24) | (qGreen(scanline[x]) << 16) | (qBlue(scanline[x]) << 8) | 0xFF;
315 testPattern[(y * VIRTUAL_SCREEN_WIDTH) + x] = pixel;
319 // Set up timer based loop for animation...
320 timer = new QTimer(this);
321 connect(timer, SIGNAL(timeout()), this, SLOT(Timer()));
323 // This isn't very accurate for NTSC: This is early by 40 msec per frame.
324 // This is because it's discarding the 0.6666... on the end of the fraction.
325 // Alas, 6 doesn't divide cleanly into 10. :-P
326 //Should we defer this until SyncUI? Probably.
327 //No, it doesn't work, because it uses setInterval() instead of start()...
328 // timer->start(vjs.hardwareTypeNTSC ? 16 : 20);
330 // We set this initially, to make VJ behave somewhat as it would if no
331 // cart were inserted and the BIOS was set as active...
332 jaguarCartInserted = true;
333 WriteLog("Virtual Jaguar %s (Last full build was on %s %s)\n", VJ_RELEASE_VERSION, __DATE__, __TIME__);
334 WriteLog("VJ: Initializing jaguar subsystem...\n");
336 // memcpy(jagMemSpace + 0xE00000, jaguarBootROM, 0x20000); // Use the stock BIOS
337 memcpy(jagMemSpace + 0xE00000, (vjs.biosType == BT_K_SERIES ? jaguarBootROM : jaguarBootROM2), 0x20000); // Use the stock BIOS
339 // Prevent the file scanner from running if filename passed
340 // in on the command line...
344 // Load up the default ROM if in Alpine mode:
345 if (vjs.hardwareTypeAlpine)
347 bool romLoaded = JaguarLoadFile(vjs.alpineROMPath);
349 // If regular load failed, try just a straight file load
350 // (Dev only! I don't want people to start getting lazy with their releases again! :-P)
352 romLoaded = AlpineLoadFile(vjs.alpineROMPath);
355 WriteLog("Alpine Mode: Successfully loaded file \"%s\".\n", vjs.alpineROMPath);
357 WriteLog("Alpine Mode: Unable to load file \"%s\"!\n", vjs.alpineROMPath);
359 // Attempt to load/run the ABS file...
360 LoadSoftware(vjs.absROMPath);
361 memcpy(jagMemSpace + 0xE00000, jaguarDevBootROM2, 0x20000); // Use the stub BIOS
362 // Prevent the scanner from running...
366 // Run the scanner if nothing passed in and *not* Alpine mode...
367 // NB: Really need to look into caching the info scanned in here...
368 filePickWin->ScanSoftwareFolder(allowUnknownSoftware);
372 void MainWin::LoadFile(QString file)
378 void MainWin::SyncUI(void)
380 // Set toolbar buttons/menus based on settings read in (sync the UI)...
381 // (Really, this is to sync command line options passed in)
382 blurAct->setChecked(vjs.glFilter);
383 x1Act->setChecked(zoomLevel == 1);
384 x2Act->setChecked(zoomLevel == 2);
385 x3Act->setChecked(zoomLevel == 3);
386 // running = powerAct->isChecked();
387 ntscAct->setChecked(vjs.hardwareTypeNTSC);
388 palAct->setChecked(!vjs.hardwareTypeNTSC);
389 powerAct->setIcon(vjs.hardwareTypeNTSC ? powerRed : powerGreen);
391 fullScreenAct->setChecked(vjs.fullscreen);
392 fullScreen = vjs.fullscreen;
393 SetFullScreen(fullScreen);
395 // Reset the timer to be what was set in the command line (if any):
396 // timer->setInterval(vjs.hardwareTypeNTSC ? 16 : 20);
397 timer->start(vjs.hardwareTypeNTSC ? 16 : 20);
401 void MainWin::closeEvent(QCloseEvent * event)
404 // This should only be done by the config dialog
407 event->accept(); // ignore() if can't close for some reason
411 void MainWin::keyPressEvent(QKeyEvent * e)
414 extern bool startM68KTracing;
416 // We ignore the Alt key for now, since it causes problems with the GUI
417 if (e->key() == Qt::Key_Alt)
422 else if (e->key() == Qt::Key_F11)
424 startM68KTracing = true;
430 if (e->key() == Qt::Key_F9)
440 void MainWin::keyReleaseEvent(QKeyEvent * e)
442 // We ignore the Alt key for now, since it causes problems with the GUI
443 if (e->key() == Qt::Key_Alt)
449 HandleKeys(e, false);
453 void MainWin::HandleKeys(QKeyEvent * e, bool state)
455 enum { P1LEFT = 0, P1RIGHT, P1UP, P1DOWN, P2LEFT, P2RIGHT, P2UP, P2DOWN };
456 // We kill bad key combos here, before they can get to the emulator...
457 // This also kills the illegal instruction problem that cropped up in Rayman!
458 // May want to do this by killing the old one instead of ignoring the new one...
459 // Seems to work better that way...
461 // The problem with this approach is that it causes bad results because it doesn't do
462 // any checking of previous states. Need to come up with something better because this
463 // causes problems where the keyboard acts as if it were unresponsive. :-P
465 if ((e->key() == vjs.p1KeyBindings[BUTTON_L] && joypad_0_buttons[BUTTON_R])
466 || (e->key() == vjs.p1KeyBindings[BUTTON_R] && joypad_0_buttons[BUTTON_L])
467 || (e->key() == vjs.p1KeyBindings[BUTTON_U] && joypad_0_buttons[BUTTON_D])
468 || (e->key() == vjs.p1KeyBindings[BUTTON_D] && joypad_0_buttons[BUTTON_U]))
472 if (e->key() == (int)vjs.p1KeyBindings[BUTTON_L] && joypad_0_buttons[BUTTON_R])
473 joypad_0_buttons[BUTTON_R] = 0;
474 if (e->key() == (int)vjs.p1KeyBindings[BUTTON_R] && joypad_0_buttons[BUTTON_L])
475 joypad_0_buttons[BUTTON_L] = 0;
476 if (e->key() == (int)vjs.p1KeyBindings[BUTTON_U] && joypad_0_buttons[BUTTON_D])
477 joypad_0_buttons[BUTTON_D] = 0;
478 if (e->key() == (int)vjs.p1KeyBindings[BUTTON_D] && joypad_0_buttons[BUTTON_U])
479 joypad_0_buttons[BUTTON_U] = 0;
481 if (e->key() == (int)vjs.p2KeyBindings[BUTTON_L] && joypad_1_buttons[BUTTON_R])
482 joypad_1_buttons[BUTTON_R] = 0;
483 if (e->key() == (int)vjs.p2KeyBindings[BUTTON_R] && joypad_1_buttons[BUTTON_L])
484 joypad_1_buttons[BUTTON_L] = 0;
485 if (e->key() == (int)vjs.p2KeyBindings[BUTTON_U] && joypad_1_buttons[BUTTON_D])
486 joypad_1_buttons[BUTTON_D] = 0;
487 if (e->key() == (int)vjs.p2KeyBindings[BUTTON_D] && joypad_1_buttons[BUTTON_U])
488 joypad_1_buttons[BUTTON_U] = 0;
490 //hrm, this still has sticky state problems... Ugh!
491 // First, settle key states...
492 if (e->key() == (int)vjs.p1KeyBindings[BUTTON_L])
493 keyHeld[P1LEFT] = state;
494 else if (e->key() == (int)vjs.p1KeyBindings[BUTTON_R])
495 keyHeld[P1RIGHT] = state;
496 else if (e->key() == (int)vjs.p1KeyBindings[BUTTON_U])
497 keyHeld[P1UP] = state;
498 else if (e->key() == (int)vjs.p1KeyBindings[BUTTON_D])
499 keyHeld[P1DOWN] = state;
500 else if (e->key() == (int)vjs.p2KeyBindings[BUTTON_L])
501 keyHeld[P2LEFT] = state;
502 else if (e->key() == (int)vjs.p2KeyBindings[BUTTON_R])
503 keyHeld[P2RIGHT] = state;
504 else if (e->key() == (int)vjs.p2KeyBindings[BUTTON_U])
505 keyHeld[P2UP] = state;
506 else if (e->key() == (int)vjs.p2KeyBindings[BUTTON_D])
507 keyHeld[P2DOWN] = state;
509 // Next, check for conflicts and bail out if there are any...
510 if ((keyHeld[P1LEFT] && keyHeld[P1RIGHT])
511 || (keyHeld[P1UP] && keyHeld[P1DOWN])
512 || (keyHeld[P2LEFT] && keyHeld[P2RIGHT])
513 || (keyHeld[P2UP] && keyHeld[P2DOWN]))
518 // No bad combos exist, let's stuff the emulator key buffers...!
519 for(int i=BUTTON_FIRST; i<=BUTTON_LAST; i++)
521 if (e->key() == (int)vjs.p1KeyBindings[i])
522 // joypad_0_buttons[i] = (uint8)state;
523 joypad_0_buttons[i] = (state ? 0x01 : 0x00);
525 // Pad #2 is screwing up pad #1. Prolly a problem in joystick.cpp...
526 // So let's try to fix it there. :-P [DONE]
527 if (e->key() == (int)vjs.p2KeyBindings[i])
528 // joypad_1_buttons[i] = (uint8)state;
529 joypad_1_buttons[i] = (state ? 0x01 : 0x00);
534 void MainWin::HandleGamepads(void)
538 for(int i=BUTTON_FIRST; i<=BUTTON_LAST; i++)
540 if (vjs.p1KeyBindings[i] & (JOY_BUTTON | JOY_HAT | JOY_AXIS))
541 joypad_0_buttons[i] = (Gamepad::GetState(0, vjs.p1KeyBindings[i]) ? 0x01 : 0x00);
543 if (vjs.p2KeyBindings[i] & (JOY_BUTTON | JOY_HAT | JOY_AXIS))
544 joypad_1_buttons[i] = (Gamepad::GetState(1, vjs.p2KeyBindings[i]) ? 0x01 : 0x00);
549 void MainWin::Open(void)
554 void MainWin::Configure(void)
556 // Call the configuration dialog and update settings
557 ConfigDialog dlg(this);
559 dlg.generalTab->useUnknownSoftware->setChecked(allowUnknownSoftware);
561 if (dlg.exec() == false)
564 QString before = vjs.ROMPath;
565 QString alpineBefore = vjs.alpineROMPath;
566 QString absBefore = vjs.absROMPath;
567 // bool audioBefore = vjs.audioEnabled;
568 bool audioBefore = vjs.DSPEnabled;
569 dlg.UpdateVJSettings();
570 QString after = vjs.ROMPath;
571 QString alpineAfter = vjs.alpineROMPath;
572 QString absAfter = vjs.absROMPath;
573 // bool audioAfter = vjs.audioEnabled;
574 bool audioAfter = vjs.DSPEnabled;
576 bool allowOld = allowUnknownSoftware;
578 allowUnknownSoftware = dlg.generalTab->useUnknownSoftware->isChecked();
580 // We rescan the "software" folder if the user either changed the path or
581 // checked/unchecked the "Allow unknown files" option in the config dialog.
582 if ((before != after) || (allowOld != allowUnknownSoftware))
583 filePickWin->ScanSoftwareFolder(allowUnknownSoftware);
585 // If the "Alpine" ROM is changed, then let's load it...
586 if (alpineBefore != alpineAfter)
588 if (!JaguarLoadFile(vjs.alpineROMPath) && !AlpineLoadFile(vjs.alpineROMPath))
590 // Oh crap, we couldn't get the file! Alert the media!
592 msg.setText(QString(tr("Could not load file \"%1\"!")).arg(vjs.alpineROMPath));
593 msg.setIcon(QMessageBox::Warning);
598 // If the "ABS" ROM is changed, then let's load it...
599 if (absBefore != absAfter)
601 if (!JaguarLoadFile(vjs.absROMPath))
603 // Oh crap, we couldn't get the file! Alert the media!
605 msg.setText(QString(tr("Could not load file \"%1\"!")).arg(vjs.absROMPath));
606 msg.setIcon(QMessageBox::Warning);
611 // If the "Enable DSP" checkbox changed, then we have to re-init the DAC,
612 // since it's running in the host audio IRQ...
613 if (audioBefore != audioAfter)
619 // Just in case we crash before a clean exit...
625 // Here's the main emulator loop
627 void MainWin::Timer(void)
632 if (showUntunedTankCircuit)
634 // Some machines can't handle this, so we give them the option to disable it. :-)
635 if (!plzDontKillMyComputer)
637 // Random hash & trash
638 // We try to simulate an untuned tank circuit here... :-)
639 for(uint32_t x=0; x<videoWidget->rasterWidth; x++)
641 for(uint32_t y=0; y<videoWidget->rasterHeight; y++)
643 videoWidget->buffer[(y * videoWidget->textureWidth) + x]
644 = (rand() & 0xFF) << 8 | (rand() & 0xFF) << 16 | (rand() & 0xFF) << 24;
651 // Otherwise, run the Jaguar simulation
656 videoWidget->updateGL();
660 void MainWin::TogglePowerState(void)
662 powerButtonOn = !powerButtonOn;
665 // With the power off, we simulate white noise on the screen. :-)
668 useCDAct->setDisabled(false);
669 palAct->setDisabled(false);
670 ntscAct->setDisabled(false);
671 pauseAct->setChecked(false);
672 pauseAct->setDisabled(true);
673 showUntunedTankCircuit = true;
674 DACPauseAudioThread();
675 // This is just in case the ROM we were playing was in a narrow or wide field mode,
676 // so the untuned tank sim doesn't look wrong. :-)
679 if (plzDontKillMyComputer)
681 // We have to do it line by line, because the texture pitch is not the
682 // same as the picture buffer's pitch.
683 for(uint32_t y=0; y<videoWidget->rasterHeight; y++)
685 memcpy(videoWidget->buffer + (y * videoWidget->textureWidth), testPattern + (y * VIRTUAL_SCREEN_WIDTH), VIRTUAL_SCREEN_WIDTH * sizeof(uint32_t));
691 useCDAct->setDisabled(true);
692 palAct->setDisabled(true);
693 ntscAct->setDisabled(true);
694 pauseAct->setChecked(false);
695 pauseAct->setDisabled(false);
696 showUntunedTankCircuit = false;
698 // Otherwise, we prepare for running regular software...
701 // Should check for cartridgeLoaded here as well...!
702 // We can clear it when toggling CDActive on, so that when we power cycle it does the
703 // expected thing. Otherwise, if we use the file picker to insert a cart, we expect
704 // to run the cart! Maybe have a RemoveCart function that only works if the CD unit
706 setWindowTitle(QString("Virtual Jaguar " VJ_RELEASE_VERSION
707 " - Now playing: Jaguar CD"));
710 WriteLog("GUI: Resetting Jaguar...\n");
712 DACPauseAudioThread(false);
717 void MainWin::ToggleRunState(void)
723 frameAdvanceAct->setDisabled(false);
725 for(uint32_t i=0; i<(uint32_t)(videoWidget->textureWidth * 256); i++)
727 uint32_t pixel = videoWidget->buffer[i];
728 uint8_t r = (pixel >> 24) & 0xFF, g = (pixel >> 16) & 0xFF, b = (pixel >> 8) & 0xFF;
729 pixel = ((r + g + b) / 3) & 0x00FF;
730 videoWidget->buffer[i] = 0x000000FF | (pixel << 16) | (pixel << 8);
733 videoWidget->updateGL();
736 frameAdvanceAct->setDisabled(true);
738 // Pause/unpause any running/non-running threads...
739 DACPauseAudioThread(!running);
743 void MainWin::SetZoom100(void)
750 void MainWin::SetZoom200(void)
757 void MainWin::SetZoom300(void)
764 void MainWin::SetNTSC(void)
766 powerAct->setIcon(powerRed);
767 timer->setInterval(16);
768 vjs.hardwareTypeNTSC = true;
774 void MainWin::SetPAL(void)
776 powerAct->setIcon(powerGreen);
777 timer->setInterval(20);
778 vjs.hardwareTypeNTSC = false;
784 void MainWin::ToggleBlur(void)
786 vjs.glFilter = !vjs.glFilter;
791 void MainWin::ShowAboutWin(void)
797 void MainWin::ShowHelpWin(void)
803 void MainWin::InsertCart(void)
805 // If the emulator is running, we pause it here and unpause it later
806 // if we dismiss the file selector without choosing anything
807 if (running && powerButtonOn)
810 pauseForFileSelector = true;
817 void MainWin::Unpause(void)
819 // Here we unpause the emulator if it was paused when we went into the file selector
820 if (pauseForFileSelector)
822 pauseForFileSelector = false;
824 // Some nutter might have unpaused while in the file selector, so check for that
831 void MainWin::LoadSoftware(QString file)
833 running = false; // Prevent bad things(TM) from happening...
834 pauseForFileSelector = false; // Reset the file selector pause flag
835 SET32(jaguarMainRAM, 0, 0x00200000); // Set top of stack...
836 cartridgeLoaded = JaguarLoadFile(file.toAscii().data());
838 char * biosPointer = jaguarBootROM;
840 if (vjs.hardwareTypeAlpine)
841 biosPointer = jaguarDevBootROM2;
843 memcpy(jagMemSpace + 0xE00000, biosPointer, 0x20000);
845 powerAct->setDisabled(false);
846 powerAct->setChecked(true);
847 powerButtonOn = false;
850 if (!vjs.hardwareTypeAlpine && !loadAndGo)
852 QString newTitle = QString("Virtual Jaguar " VJ_RELEASE_VERSION " - Now playing: %1")
853 .arg(filePickWin->GetSelectedPrettyName());
854 setWindowTitle(newTitle);
859 void MainWin::ToggleCDUsage(void)
861 CDActive = !CDActive;
863 // Set up the Jaguar CD for execution, otherwise, clear memory
865 memcpy(jagMemSpace + 0x800000, jaguarCDBootROM, 0x40000);
867 memset(jagMemSpace + 0x800000, 0xFF, 0x40000);
871 void MainWin::FrameAdvance(void)
873 //printf("Frame Advance...\n");
874 // Execute 1 frame, then exit (only useful in Pause mode)
876 videoWidget->updateGL();
877 // Need to execute 1 frames' worth of DSP thread as well :-/
878 #warning "!!! Need to execute the DSP thread for 1 frame too !!!"
882 void MainWin::SetFullScreen(bool state/*= true*/)
886 mainWinPosition = pos();
889 x1Act->setDisabled(true);
890 x2Act->setDisabled(true);
891 x3Act->setDisabled(true);
893 // This is needed because the fullscreen may happen on a different
894 // screen than screen 0:
895 int screenNum = QApplication::desktop()->screenNumber(videoWidget);
896 QRect r = QApplication::desktop()->availableGeometry(screenNum);
897 double targetWidth = (double)VIRTUAL_SCREEN_WIDTH,
898 targetHeight = (double)(vjs.hardwareTypeNTSC ? VIRTUAL_SCREEN_HEIGHT_NTSC : VIRTUAL_SCREEN_HEIGHT_PAL);
899 double aspectRatio = targetWidth / targetHeight;
900 // NOTE: Really should check here to see which dimension constrains the
901 // other. Right now, we assume that height is the constraint.
902 int newWidth = (int)(aspectRatio * (double)r.height());
903 videoWidget->offset = (r.width() - newWidth) / 2;
904 videoWidget->fullscreen = true;
905 videoWidget->outputWidth = newWidth;
906 videoWidget->setFixedSize(r.width(), r.height());
911 // Reset the video widget to windowed mode
912 videoWidget->offset = 0;
913 videoWidget->fullscreen = false;
914 x1Act->setDisabled(false);
915 x2Act->setDisabled(false);
916 x3Act->setDisabled(false);
921 move(mainWinPosition);
924 // For some reason, this doesn't work: If the emu is paused, toggling from
925 // fullscreen to windowed (& vice versa) shows a white screen.
926 // (It was the ResizeGL() function in GLWidget: it was being called too
927 // much, causing the buffer to be deleted, remade & cleared.)
928 // videoWidget->updateGL();
932 void MainWin::ToggleFullScreen(void)
934 fullScreen = !fullScreen;
935 SetFullScreen(fullScreen);
939 void MainWin::ShowMemoryBrowserWin(void)
941 memBrowseWin->show();
942 memBrowseWin->RefreshContents();
946 void MainWin::ShowCPUBrowserWin(void)
948 cpuBrowseWin->show();
949 cpuBrowseWin->RefreshContents();
953 void MainWin::ShowOPBrowserWin(void)
956 opBrowseWin->RefreshContents();
960 void MainWin::ShowM68KDasmBrowserWin(void)
962 m68kDasmBrowseWin->show();
963 m68kDasmBrowseWin->RefreshContents();
967 void MainWin::ShowRISCDasmBrowserWin(void)
969 riscDasmBrowseWin->show();
970 riscDasmBrowseWin->RefreshContents();
974 void MainWin::ResizeMainWindow(void)
976 videoWidget->setFixedSize(zoomLevel * VIRTUAL_SCREEN_WIDTH,
977 zoomLevel * (vjs.hardwareTypeNTSC ? VIRTUAL_SCREEN_HEIGHT_NTSC : VIRTUAL_SCREEN_HEIGHT_PAL));
979 // Show the test pattern if user requested plzDontKillMyComputer mode
980 if (!powerButtonOn && plzDontKillMyComputer)
982 for(uint32_t y=0; y<videoWidget->rasterHeight; y++)
984 memcpy(videoWidget->buffer + (y * videoWidget->textureWidth), testPattern + (y * VIRTUAL_SCREEN_WIDTH), VIRTUAL_SCREEN_WIDTH * sizeof(uint32_t));
990 for(int i=0; i<2; i++)
994 QApplication::processEvents();
999 #warning "!!! Need to check the window geometry to see if the positions are legal !!!"
1000 // i.e., someone could drag it to another screen, close it, then disconnect that screen
1001 void MainWin::ReadSettings(void)
1003 QSettings settings("Underground Software", "Virtual Jaguar");
1004 mainWinPosition = settings.value("pos", QPoint(200, 200)).toPoint();
1005 QSize size = settings.value("size", QSize(400, 400)).toSize();
1007 move(mainWinPosition);
1008 QPoint pos = settings.value("cartLoadPos", QPoint(200, 200)).toPoint();
1009 filePickWin->move(pos);
1011 zoomLevel = settings.value("zoom", 2).toInt();
1012 allowUnknownSoftware = settings.value("showUnknownSoftware", false).toBool();
1014 vjs.useJoystick = settings.value("useJoystick", false).toBool();
1015 vjs.joyport = settings.value("joyport", 0).toInt();
1016 vjs.hardwareTypeNTSC = settings.value("hardwareTypeNTSC", true).toBool();
1017 vjs.frameSkip = settings.value("frameSkip", 0).toInt();
1018 vjs.useJaguarBIOS = settings.value("useJaguarBIOS", false).toBool();
1019 vjs.GPUEnabled = settings.value("GPUEnabled", true).toBool();
1020 vjs.DSPEnabled = settings.value("DSPEnabled", false).toBool();
1021 vjs.audioEnabled = settings.value("audioEnabled", true).toBool();
1022 vjs.usePipelinedDSP = settings.value("usePipelinedDSP", false).toBool();
1023 vjs.fullscreen = settings.value("fullscreen", false).toBool();
1024 vjs.useOpenGL = settings.value("useOpenGL", true).toBool();
1025 vjs.glFilter = settings.value("glFilterType", 1).toInt();
1026 vjs.renderType = settings.value("renderType", 0).toInt();
1027 vjs.allowWritesToROM = settings.value("writeROM", false).toBool();
1028 vjs.biosType = settings.value("biosType", BT_M_SERIES).toInt();
1029 strcpy(vjs.EEPROMPath, settings.value("EEPROMs", "./eeproms/").toString().toAscii().data());
1030 strcpy(vjs.ROMPath, settings.value("ROMs", "./software/").toString().toAscii().data());
1031 strcpy(vjs.alpineROMPath, settings.value("DefaultROM", "").toString().toAscii().data());
1032 strcpy(vjs.absROMPath, settings.value("DefaultABS", "").toString().toAscii().data());
1034 WriteLog("MainWin: Paths\n");
1035 WriteLog(" EEPROMPath = \"%s\"\n", vjs.EEPROMPath);
1036 WriteLog(" ROMPath = \"%s\"\n", vjs.ROMPath);
1037 WriteLog("AlpineROMPath = \"%s\"\n", vjs.alpineROMPath);
1038 WriteLog(" absROMPath = \"%s\"\n", vjs.absROMPath);
1039 WriteLog("Pipelined DSP = %s\n", (vjs.usePipelinedDSP ? "ON" : "off"));
1041 // Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, *
1042 vjs.p1KeyBindings[BUTTON_U] = settings.value("p1k_up", Qt::Key_S).toInt();
1043 vjs.p1KeyBindings[BUTTON_D] = settings.value("p1k_down", Qt::Key_X).toInt();
1044 vjs.p1KeyBindings[BUTTON_L] = settings.value("p1k_left", Qt::Key_A).toInt();
1045 vjs.p1KeyBindings[BUTTON_R] = settings.value("p1k_right", Qt::Key_D).toInt();
1046 vjs.p1KeyBindings[BUTTON_C] = settings.value("p1k_c", Qt::Key_J).toInt();
1047 vjs.p1KeyBindings[BUTTON_B] = settings.value("p1k_b", Qt::Key_K).toInt();
1048 vjs.p1KeyBindings[BUTTON_A] = settings.value("p1k_a", Qt::Key_L).toInt();
1049 vjs.p1KeyBindings[BUTTON_OPTION] = settings.value("p1k_option", Qt::Key_O).toInt();
1050 vjs.p1KeyBindings[BUTTON_PAUSE] = settings.value("p1k_pause", Qt::Key_P).toInt();
1051 vjs.p1KeyBindings[BUTTON_0] = settings.value("p1k_0", Qt::Key_0).toInt();
1052 vjs.p1KeyBindings[BUTTON_1] = settings.value("p1k_1", Qt::Key_1).toInt();
1053 vjs.p1KeyBindings[BUTTON_2] = settings.value("p1k_2", Qt::Key_2).toInt();
1054 vjs.p1KeyBindings[BUTTON_3] = settings.value("p1k_3", Qt::Key_3).toInt();
1055 vjs.p1KeyBindings[BUTTON_4] = settings.value("p1k_4", Qt::Key_4).toInt();
1056 vjs.p1KeyBindings[BUTTON_5] = settings.value("p1k_5", Qt::Key_5).toInt();
1057 vjs.p1KeyBindings[BUTTON_6] = settings.value("p1k_6", Qt::Key_6).toInt();
1058 vjs.p1KeyBindings[BUTTON_7] = settings.value("p1k_7", Qt::Key_7).toInt();
1059 vjs.p1KeyBindings[BUTTON_8] = settings.value("p1k_8", Qt::Key_8).toInt();
1060 vjs.p1KeyBindings[BUTTON_9] = settings.value("p1k_9", Qt::Key_9).toInt();
1061 vjs.p1KeyBindings[BUTTON_d] = settings.value("p1k_pound", Qt::Key_Minus).toInt();
1062 vjs.p1KeyBindings[BUTTON_s] = settings.value("p1k_star", Qt::Key_Equal).toInt();
1064 vjs.p2KeyBindings[BUTTON_U] = settings.value("p2k_up", Qt::Key_Up).toInt();
1065 vjs.p2KeyBindings[BUTTON_D] = settings.value("p2k_down", Qt::Key_Down).toInt();
1066 vjs.p2KeyBindings[BUTTON_L] = settings.value("p2k_left", Qt::Key_Left).toInt();
1067 vjs.p2KeyBindings[BUTTON_R] = settings.value("p2k_right", Qt::Key_Right).toInt();
1068 vjs.p2KeyBindings[BUTTON_C] = settings.value("p2k_c", Qt::Key_Z).toInt();
1069 vjs.p2KeyBindings[BUTTON_B] = settings.value("p2k_b", Qt::Key_X).toInt();
1070 vjs.p2KeyBindings[BUTTON_A] = settings.value("p2k_a", Qt::Key_C).toInt();
1071 vjs.p2KeyBindings[BUTTON_OPTION] = settings.value("p2k_option", Qt::Key_Apostrophe).toInt();
1072 vjs.p2KeyBindings[BUTTON_PAUSE] = settings.value("p2k_pause", Qt::Key_Return).toInt();
1073 vjs.p2KeyBindings[BUTTON_0] = settings.value("p2k_0", Qt::Key_0).toInt();
1074 vjs.p2KeyBindings[BUTTON_1] = settings.value("p2k_1", Qt::Key_1).toInt();
1075 vjs.p2KeyBindings[BUTTON_2] = settings.value("p2k_2", Qt::Key_2).toInt();
1076 vjs.p2KeyBindings[BUTTON_3] = settings.value("p2k_3", Qt::Key_3).toInt();
1077 vjs.p2KeyBindings[BUTTON_4] = settings.value("p2k_4", Qt::Key_4).toInt();
1078 vjs.p2KeyBindings[BUTTON_5] = settings.value("p2k_5", Qt::Key_5).toInt();
1079 vjs.p2KeyBindings[BUTTON_6] = settings.value("p2k_6", Qt::Key_6).toInt();
1080 vjs.p2KeyBindings[BUTTON_7] = settings.value("p2k_7", Qt::Key_7).toInt();
1081 vjs.p2KeyBindings[BUTTON_8] = settings.value("p2k_8", Qt::Key_8).toInt();
1082 vjs.p2KeyBindings[BUTTON_9] = settings.value("p2k_9", Qt::Key_9).toInt();
1083 vjs.p2KeyBindings[BUTTON_d] = settings.value("p2k_pound", Qt::Key_Slash).toInt();
1084 vjs.p2KeyBindings[BUTTON_s] = settings.value("p2k_star", Qt::Key_Asterisk).toInt();
1088 void MainWin::WriteSettings(void)
1090 QSettings settings("Underground Software", "Virtual Jaguar");
1091 settings.setValue("pos", pos());
1092 settings.setValue("size", size());
1093 settings.setValue("cartLoadPos", filePickWin->pos());
1095 settings.setValue("zoom", zoomLevel);
1096 settings.setValue("showUnknownSoftware", allowUnknownSoftware);
1098 settings.setValue("useJoystick", vjs.useJoystick);
1099 settings.setValue("joyport", vjs.joyport);
1100 settings.setValue("hardwareTypeNTSC", vjs.hardwareTypeNTSC);
1101 settings.setValue("frameSkip", vjs.frameSkip);
1102 settings.setValue("useJaguarBIOS", vjs.useJaguarBIOS);
1103 settings.setValue("GPUEnabled", vjs.GPUEnabled);
1104 settings.setValue("DSPEnabled", vjs.DSPEnabled);
1105 settings.setValue("audioEnabled", vjs.audioEnabled);
1106 settings.setValue("usePipelinedDSP", vjs.usePipelinedDSP);
1107 settings.setValue("fullscreen", vjs.fullscreen);
1108 settings.setValue("useOpenGL", vjs.useOpenGL);
1109 settings.setValue("glFilterType", vjs.glFilter);
1110 settings.setValue("renderType", vjs.renderType);
1111 settings.setValue("writeROM", vjs.allowWritesToROM);
1112 settings.setValue("biosType", vjs.biosType);
1113 settings.setValue("JagBootROM", vjs.jagBootPath);
1114 settings.setValue("CDBootROM", vjs.CDBootPath);
1115 settings.setValue("EEPROMs", vjs.EEPROMPath);
1116 settings.setValue("ROMs", vjs.ROMPath);
1117 settings.setValue("DefaultROM", vjs.alpineROMPath);
1118 settings.setValue("DefaultABS", vjs.absROMPath);
1120 settings.setValue("p1k_up", vjs.p1KeyBindings[BUTTON_U]);
1121 settings.setValue("p1k_down", vjs.p1KeyBindings[BUTTON_D]);
1122 settings.setValue("p1k_left", vjs.p1KeyBindings[BUTTON_L]);
1123 settings.setValue("p1k_right", vjs.p1KeyBindings[BUTTON_R]);
1124 settings.setValue("p1k_c", vjs.p1KeyBindings[BUTTON_C]);
1125 settings.setValue("p1k_b", vjs.p1KeyBindings[BUTTON_B]);
1126 settings.setValue("p1k_a", vjs.p1KeyBindings[BUTTON_A]);
1127 settings.setValue("p1k_option", vjs.p1KeyBindings[BUTTON_OPTION]);
1128 settings.setValue("p1k_pause", vjs.p1KeyBindings[BUTTON_PAUSE]);
1129 settings.setValue("p1k_0", vjs.p1KeyBindings[BUTTON_0]);
1130 settings.setValue("p1k_1", vjs.p1KeyBindings[BUTTON_1]);
1131 settings.setValue("p1k_2", vjs.p1KeyBindings[BUTTON_2]);
1132 settings.setValue("p1k_3", vjs.p1KeyBindings[BUTTON_3]);
1133 settings.setValue("p1k_4", vjs.p1KeyBindings[BUTTON_4]);
1134 settings.setValue("p1k_5", vjs.p1KeyBindings[BUTTON_5]);
1135 settings.setValue("p1k_6", vjs.p1KeyBindings[BUTTON_6]);
1136 settings.setValue("p1k_7", vjs.p1KeyBindings[BUTTON_7]);
1137 settings.setValue("p1k_8", vjs.p1KeyBindings[BUTTON_8]);
1138 settings.setValue("p1k_9", vjs.p1KeyBindings[BUTTON_9]);
1139 settings.setValue("p1k_pound", vjs.p1KeyBindings[BUTTON_d]);
1140 settings.setValue("p1k_star", vjs.p1KeyBindings[BUTTON_s]);
1142 settings.setValue("p2k_up", vjs.p2KeyBindings[BUTTON_U]);
1143 settings.setValue("p2k_down", vjs.p2KeyBindings[BUTTON_D]);
1144 settings.setValue("p2k_left", vjs.p2KeyBindings[BUTTON_L]);
1145 settings.setValue("p2k_right", vjs.p2KeyBindings[BUTTON_R]);
1146 settings.setValue("p2k_c", vjs.p2KeyBindings[BUTTON_C]);
1147 settings.setValue("p2k_b", vjs.p2KeyBindings[BUTTON_B]);
1148 settings.setValue("p2k_a", vjs.p2KeyBindings[BUTTON_A]);
1149 settings.setValue("p2k_option", vjs.p2KeyBindings[BUTTON_OPTION]);
1150 settings.setValue("p2k_pause", vjs.p2KeyBindings[BUTTON_PAUSE]);
1151 settings.setValue("p2k_0", vjs.p2KeyBindings[BUTTON_0]);
1152 settings.setValue("p2k_1", vjs.p2KeyBindings[BUTTON_1]);
1153 settings.setValue("p2k_2", vjs.p2KeyBindings[BUTTON_2]);
1154 settings.setValue("p2k_3", vjs.p2KeyBindings[BUTTON_3]);
1155 settings.setValue("p2k_4", vjs.p2KeyBindings[BUTTON_4]);
1156 settings.setValue("p2k_5", vjs.p2KeyBindings[BUTTON_5]);
1157 settings.setValue("p2k_6", vjs.p2KeyBindings[BUTTON_6]);
1158 settings.setValue("p2k_7", vjs.p2KeyBindings[BUTTON_7]);
1159 settings.setValue("p2k_8", vjs.p2KeyBindings[BUTTON_8]);
1160 settings.setValue("p2k_9", vjs.p2KeyBindings[BUTTON_9]);
1161 settings.setValue("p2k_pound", vjs.p2KeyBindings[BUTTON_d]);
1162 settings.setValue("p2k_star", vjs.p2KeyBindings[BUTTON_s]);
1166 void MainWin::WriteUISettings(void)
1168 QSettings settings("Underground Software", "Virtual Jaguar");
1169 settings.setValue("pos", pos());
1170 settings.setValue("size", size());
1171 settings.setValue("cartLoadPos", filePickWin->pos());
1173 settings.setValue("zoom", zoomLevel);