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 // - Fix bug in switching between PAL & NTSC in fullscreen mode.
25 // - Remove SDL dependencies (sound, mainly) from Jaguar core lib
26 // - Fix inconsistency with trailing slashes in paths (eeproms needs one, software doesn't)
28 // SFDX CODE: S1E9T8H5M23YS
30 // Uncomment this for debugging...
32 //#define DEBUGFOO // Various tool debugging...
33 //#define DEBUGTP // Toolpalette debugging...
40 #include "configdialog.h"
41 #include "filepicker.h"
43 #include "generaltab.h"
48 #include "debug/cpubrowser.h"
49 #include "debug/m68kdasmbrowser.h"
50 #include "debug/memorybrowser.h"
51 #include "debug/opbrowser.h"
52 #include "debug/riscdasmbrowser.h"
60 #include "jagcdbios.h"
61 #include "jagstub2bios.h"
63 #include "m68000/m68kinterface.h"
65 // According to SebRmv, this header isn't seen on Arch Linux either... :-/
67 // Apparently on win32, usleep() is not pulled in by the usual suspects.
71 // The way BSNES controls things is by setting a timer with a zero
72 // timeout, sleeping if not emulating anything. Seems there has to be a
75 // It has a novel approach to plugging-in/using different video/audio/input
76 // methods, can we do something similar or should we just use the built-in
79 // We're going to try to use the built-in OpenGL support and see how it goes.
80 // We'll make the VJ core modular so that it doesn't matter what GUI is in
81 // use, we can drop it in anywhere and use it as-is.
83 MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
84 showUntunedTankCircuit(true), cartridgeLoaded(false), CDActive(false),
85 pauseForFileSelector(false), loadAndGo(autoRun), plzDontKillMyComputer(false)
87 for(int i=0; i<8; i++)
90 videoWidget = new GLWidget(this);
91 setCentralWidget(videoWidget);
92 setWindowIcon(QIcon(":/res/vj-icon.png"));
94 QString title = QString(tr("Virtual Jaguar " VJ_RELEASE_VERSION ));
96 if (vjs.hardwareTypeAlpine)
97 title += QString(tr(" - Alpine Mode"));
99 setWindowTitle(title);
101 aboutWin = new AboutWindow(this);
102 helpWin = new HelpWindow(this);
103 filePickWin = new FilePickerWindow(this);
104 memBrowseWin = new MemoryBrowserWindow(this);
105 cpuBrowseWin = new CPUBrowserWindow(this);
106 opBrowseWin = new OPBrowserWindow(this);
107 m68kDasmBrowseWin = new M68KDasmBrowserWindow(this);
108 riscDasmBrowseWin = new RISCDasmBrowserWindow(this);
110 videoWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
111 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
113 setUnifiedTitleAndToolBarOnMac(true);
117 quitAppAct = new QAction(tr("E&xit"), this);
118 // quitAppAct->setShortcuts(QKeySequence::Quit);
119 // quitAppAct->setShortcut(QKeySequence(tr("Alt+x")));
120 quitAppAct->setShortcut(QKeySequence(tr("Ctrl+q")));
121 quitAppAct->setStatusTip(tr("Quit Virtual Jaguar"));
122 connect(quitAppAct, SIGNAL(triggered()), this, SLOT(close()));
124 powerGreen.addFile(":/res/power-off.png", QSize(), QIcon::Normal, QIcon::Off);
125 powerGreen.addFile(":/res/power-on-green.png", QSize(), QIcon::Normal, QIcon::On);
126 powerRed.addFile(":/res/power-off.png", QSize(), QIcon::Normal, QIcon::Off);
127 powerRed.addFile(":/res/power-on-red.png", QSize(), QIcon::Normal, QIcon::On);
129 // powerAct = new QAction(QIcon(":/res/power.png"), tr("&Power"), this);
130 powerAct = new QAction(powerGreen, tr("&Power"), this);
131 powerAct->setStatusTip(tr("Powers Jaguar on/off"));
132 powerAct->setCheckable(true);
133 powerAct->setChecked(false);
134 // powerAct->setDisabled(true);
135 connect(powerAct, SIGNAL(triggered()), this, SLOT(TogglePowerState()));
138 pauseIcon.addFile(":/res/pause-off", QSize(), QIcon::Normal, QIcon::Off);
139 pauseIcon.addFile(":/res/pause-on", QSize(), QIcon::Normal, QIcon::On);
140 // pauseAct = new QAction(QIcon(":/res/pause.png"), tr("Pause"), this);
141 pauseAct = new QAction(pauseIcon, tr("Pause"), this);
142 pauseAct->setStatusTip(tr("Toggles the running state"));
143 pauseAct->setCheckable(true);
144 pauseAct->setDisabled(true);
145 pauseAct->setShortcut(QKeySequence(tr("Esc")));
146 connect(pauseAct, SIGNAL(triggered()), this, SLOT(ToggleRunState()));
148 zoomActs = new QActionGroup(this);
150 x1Act = new QAction(QIcon(":/res/zoom100.png"), tr("Zoom 100%"), zoomActs);
151 x1Act->setStatusTip(tr("Set window zoom to 100%"));
152 x1Act->setCheckable(true);
153 connect(x1Act, SIGNAL(triggered()), this, SLOT(SetZoom100()));
155 x2Act = new QAction(QIcon(":/res/zoom200.png"), tr("Zoom 200%"), zoomActs);
156 x2Act->setStatusTip(tr("Set window zoom to 200%"));
157 x2Act->setCheckable(true);
158 connect(x2Act, SIGNAL(triggered()), this, SLOT(SetZoom200()));
160 x3Act = new QAction(QIcon(":/res/zoom300.png"), tr("Zoom 300%"), zoomActs);
161 x3Act->setStatusTip(tr("Set window zoom to 300%"));
162 x3Act->setCheckable(true);
163 connect(x3Act, SIGNAL(triggered()), this, SLOT(SetZoom300()));
165 tvTypeActs = new QActionGroup(this);
167 ntscAct = new QAction(QIcon(":/res/ntsc.png"), tr("NTSC"), tvTypeActs);
168 ntscAct->setStatusTip(tr("Sets Jaguar to NTSC mode"));
169 ntscAct->setCheckable(true);
170 connect(ntscAct, SIGNAL(triggered()), this, SLOT(SetNTSC()));
172 palAct = new QAction(QIcon(":/res/pal.png"), tr("PAL"), tvTypeActs);
173 palAct->setStatusTip(tr("Sets Jaguar to PAL mode"));
174 palAct->setCheckable(true);
175 connect(palAct, SIGNAL(triggered()), this, SLOT(SetPAL()));
177 blurAct = new QAction(QIcon(":/res/blur.png"), tr("Blur"), this);
178 blurAct->setStatusTip(tr("Sets OpenGL rendering to GL_NEAREST"));
179 blurAct->setCheckable(true);
180 connect(blurAct, SIGNAL(triggered()), this, SLOT(ToggleBlur()));
182 aboutAct = new QAction(QIcon(":/res/vj-icon.png"), tr("&About..."), this);
183 aboutAct->setStatusTip(tr("Blatant self-promotion"));
184 connect(aboutAct, SIGNAL(triggered()), this, SLOT(ShowAboutWin()));
186 helpAct = new QAction(QIcon(":/res/vj-icon.png"), tr("&Contents..."), this);
187 helpAct->setStatusTip(tr("Help is available, if you should need it"));
188 connect(helpAct, SIGNAL(triggered()), this, SLOT(ShowHelpWin()));
190 filePickAct = new QAction(QIcon(":/res/software.png"), tr("&Insert Cartridge..."), this);
191 filePickAct->setStatusTip(tr("Insert a cartridge into Virtual Jaguar"));
192 filePickAct->setShortcut(QKeySequence(tr("Ctrl+i")));
193 connect(filePickAct, SIGNAL(triggered()), this, SLOT(InsertCart()));
195 configAct = new QAction(QIcon(":/res/wrench.png"), tr("&Configure"), this);
196 configAct->setStatusTip(tr("Configure options for Virtual Jaguar"));
197 configAct->setShortcut(QKeySequence(tr("Ctrl+c")));
198 connect(configAct, SIGNAL(triggered()), this, SLOT(Configure()));
200 useCDAct = new QAction(QIcon(":/res/compact-disc.png"), tr("&Use CD Unit"), this);
201 useCDAct->setStatusTip(tr("Use Jaguar Virtual CD unit"));
202 // useCDAct->setShortcut(QKeySequence(tr("Ctrl+c")));
203 useCDAct->setCheckable(true);
204 connect(useCDAct, SIGNAL(triggered()), this, SLOT(ToggleCDUsage()));
206 frameAdvanceAct = new QAction(QIcon(":/res/frame-advance.png"), tr("&Frame Advance"), this);
207 frameAdvanceAct->setShortcut(QKeySequence(tr("F7")));
208 frameAdvanceAct->setDisabled(true);
209 connect(frameAdvanceAct, SIGNAL(triggered()), this, SLOT(FrameAdvance()));
211 fullScreenAct = new QAction(QIcon(":/res/fullscreen.png"), tr("F&ull Screen"), this);
212 fullScreenAct->setShortcut(QKeySequence(tr("F9")));
213 fullScreenAct->setCheckable(true);
214 connect(fullScreenAct, SIGNAL(triggered()), this, SLOT(ToggleFullScreen()));
217 memBrowseAct = new QAction(QIcon(":/res/tool-memory.png"), tr("Memory Browser"), this);
218 memBrowseAct->setStatusTip(tr("Shows the Jaguar memory browser window"));
219 // memBrowseAct->setCheckable(true);
220 connect(memBrowseAct, SIGNAL(triggered()), this, SLOT(ShowMemoryBrowserWin()));
222 cpuBrowseAct = new QAction(QIcon(":/res/tool-cpu.png"), tr("CPU Browser"), this);
223 cpuBrowseAct->setStatusTip(tr("Shows the Jaguar CPU browser window"));
224 // memBrowseAct->setCheckable(true);
225 connect(cpuBrowseAct, SIGNAL(triggered()), this, SLOT(ShowCPUBrowserWin()));
227 opBrowseAct = new QAction(QIcon(":/res/tool-op.png"), tr("OP Browser"), this);
228 opBrowseAct->setStatusTip(tr("Shows the Jaguar OP browser window"));
229 // memBrowseAct->setCheckable(true);
230 connect(opBrowseAct, SIGNAL(triggered()), this, SLOT(ShowOPBrowserWin()));
232 m68kDasmBrowseAct = new QAction(QIcon(":/res/tool-68k-dis.png"), tr("68K Listing Browser"), this);
233 m68kDasmBrowseAct->setStatusTip(tr("Shows the 68K disassembly browser window"));
234 // memBrowseAct->setCheckable(true);
235 connect(m68kDasmBrowseAct, SIGNAL(triggered()), this, SLOT(ShowM68KDasmBrowserWin()));
237 riscDasmBrowseAct = new QAction(QIcon(":/res/tool-risc-dis.png"), tr("RISC Listing Browser"), this);
238 riscDasmBrowseAct->setStatusTip(tr("Shows the RISC disassembly browser window"));
239 // memBrowseAct->setCheckable(true);
240 connect(riscDasmBrowseAct, SIGNAL(triggered()), this, SLOT(ShowRISCDasmBrowserWin()));
242 // Misc. connections...
243 connect(filePickWin, SIGNAL(RequestLoad(QString)), this, SLOT(LoadSoftware(QString)));
244 connect(filePickWin, SIGNAL(FilePickerHiding()), this, SLOT(Unpause()));
246 // Create menus & toolbars
248 fileMenu = menuBar()->addMenu(tr("&Jaguar"));
249 fileMenu->addAction(powerAct);
250 fileMenu->addAction(pauseAct);
251 // fileMenu->addAction(frameAdvanceAct);
252 fileMenu->addAction(filePickAct);
253 fileMenu->addAction(useCDAct);
254 fileMenu->addAction(configAct);
255 fileMenu->addAction(quitAppAct);
257 if (vjs.hardwareTypeAlpine)
259 debugMenu = menuBar()->addMenu(tr("&Debug"));
260 debugMenu->addAction(memBrowseAct);
261 debugMenu->addAction(cpuBrowseAct);
262 debugMenu->addAction(opBrowseAct);
263 debugMenu->addAction(m68kDasmBrowseAct);
264 debugMenu->addAction(riscDasmBrowseAct);
267 helpMenu = menuBar()->addMenu(tr("&Help"));
268 helpMenu->addAction(helpAct);
269 helpMenu->addAction(aboutAct);
271 toolbar = addToolBar(tr("Stuff"));
272 toolbar->addAction(powerAct);
273 toolbar->addAction(pauseAct);
274 toolbar->addAction(frameAdvanceAct);
275 toolbar->addAction(filePickAct);
276 toolbar->addAction(useCDAct);
277 toolbar->addSeparator();
278 toolbar->addAction(x1Act);
279 toolbar->addAction(x2Act);
280 toolbar->addAction(x3Act);
281 toolbar->addSeparator();
282 toolbar->addAction(ntscAct);
283 toolbar->addAction(palAct);
284 toolbar->addSeparator();
285 toolbar->addAction(blurAct);
286 toolbar->addAction(fullScreenAct);
288 if (vjs.hardwareTypeAlpine)
290 debugbar = addToolBar(tr("&Debug"));
291 debugbar->addAction(memBrowseAct);
292 debugbar->addAction(cpuBrowseAct);
293 debugbar->addAction(opBrowseAct);
294 debugbar->addAction(m68kDasmBrowseAct);
295 debugbar->addAction(riscDasmBrowseAct);
299 statusBar()->showMessage(tr("Ready"));
303 // Do this in case original size isn't correct (mostly for the first-run case)
306 // Create our test pattern bitmap
307 QImage tempImg(":/res/test-pattern.jpg");
308 QImage tempImgScaled = tempImg.scaled(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT_PAL, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
310 for(uint32_t y=0; y<VIRTUAL_SCREEN_HEIGHT_PAL; y++)
312 const QRgb * scanline = (QRgb *)tempImgScaled.constScanLine(y);
314 for(uint32_t x=0; x<VIRTUAL_SCREEN_WIDTH; x++)
316 uint32_t pixel = (qRed(scanline[x]) << 24) | (qGreen(scanline[x]) << 16) | (qBlue(scanline[x]) << 8) | 0xFF;
317 testPattern[(y * VIRTUAL_SCREEN_WIDTH) + x] = pixel;
321 // Set up timer based loop for animation...
322 timer = new QTimer(this);
323 connect(timer, SIGNAL(timeout()), this, SLOT(Timer()));
325 // This isn't very accurate for NTSC: This is early by 40 msec per frame.
326 // This is because it's discarding the 0.6666... on the end of the fraction.
327 // Alas, 6 doesn't divide cleanly into 10. :-P
328 //Should we defer this until SyncUI? Probably.
329 //No, it doesn't work, because it uses setInterval() instead of start()...
330 // timer->start(vjs.hardwareTypeNTSC ? 16 : 20);
332 // We set this initially, to make VJ behave somewhat as it would if no
333 // cart were inserted and the BIOS was set as active...
334 jaguarCartInserted = true;
335 WriteLog("Virtual Jaguar %s (Last full build was on %s %s)\n", VJ_RELEASE_VERSION, __DATE__, __TIME__);
336 WriteLog("VJ: Initializing jaguar subsystem...\n");
338 // memcpy(jagMemSpace + 0xE00000, jaguarBootROM, 0x20000); // Use the stock BIOS
339 memcpy(jagMemSpace + 0xE00000, (vjs.biosType == BT_K_SERIES ? jaguarBootROM : jaguarBootROM2), 0x20000); // Use the stock BIOS
341 // Prevent the file scanner from running if filename passed
342 // in on the command line...
346 // Load up the default ROM if in Alpine mode:
347 if (vjs.hardwareTypeAlpine)
349 bool romLoaded = JaguarLoadFile(vjs.alpineROMPath);
351 // If regular load failed, try just a straight file load
352 // (Dev only! I don't want people to start getting lazy with their releases again! :-P)
354 romLoaded = AlpineLoadFile(vjs.alpineROMPath);
357 WriteLog("Alpine Mode: Successfully loaded file \"%s\".\n", vjs.alpineROMPath);
359 WriteLog("Alpine Mode: Unable to load file \"%s\"!\n", vjs.alpineROMPath);
361 // Attempt to load/run the ABS file...
362 LoadSoftware(vjs.absROMPath);
363 memcpy(jagMemSpace + 0xE00000, jaguarDevBootROM2, 0x20000); // Use the stub BIOS
364 // Prevent the scanner from running...
368 // Run the scanner if nothing passed in and *not* Alpine mode...
369 // NB: Really need to look into caching the info scanned in here...
370 filePickWin->ScanSoftwareFolder(allowUnknownSoftware);
374 void MainWin::LoadFile(QString file)
380 void MainWin::SyncUI(void)
382 // Set toolbar buttons/menus based on settings read in (sync the UI)...
383 // (Really, this is to sync command line options passed in)
384 blurAct->setChecked(vjs.glFilter);
385 x1Act->setChecked(zoomLevel == 1);
386 x2Act->setChecked(zoomLevel == 2);
387 x3Act->setChecked(zoomLevel == 3);
388 // running = powerAct->isChecked();
389 ntscAct->setChecked(vjs.hardwareTypeNTSC);
390 palAct->setChecked(!vjs.hardwareTypeNTSC);
391 powerAct->setIcon(vjs.hardwareTypeNTSC ? powerRed : powerGreen);
393 fullScreenAct->setChecked(vjs.fullscreen);
394 fullScreen = vjs.fullscreen;
395 SetFullScreen(fullScreen);
397 // Reset the timer to be what was set in the command line (if any):
398 // timer->setInterval(vjs.hardwareTypeNTSC ? 16 : 20);
399 timer->start(vjs.hardwareTypeNTSC ? 16 : 20);
403 void MainWin::closeEvent(QCloseEvent * event)
406 // This should only be done by the config dialog
409 event->accept(); // ignore() if can't close for some reason
413 void MainWin::keyPressEvent(QKeyEvent * e)
416 extern bool startM68KTracing;
418 // We ignore the Alt key for now, since it causes problems with the GUI
419 if (e->key() == Qt::Key_Alt)
424 else if (e->key() == Qt::Key_F11)
426 startM68KTracing = true;
432 if (e->key() == Qt::Key_F9)
442 void MainWin::keyReleaseEvent(QKeyEvent * e)
444 // We ignore the Alt key for now, since it causes problems with the GUI
445 if (e->key() == Qt::Key_Alt)
451 HandleKeys(e, false);
455 void MainWin::HandleKeys(QKeyEvent * e, bool state)
457 enum { P1LEFT = 0, P1RIGHT, P1UP, P1DOWN, P2LEFT, P2RIGHT, P2UP, P2DOWN };
458 // We kill bad key combos here, before they can get to the emulator...
459 // This also kills the illegal instruction problem that cropped up in Rayman!
460 // May want to do this by killing the old one instead of ignoring the new one...
461 // Seems to work better that way...
463 // The problem with this approach is that it causes bad results because it doesn't do
464 // any checking of previous states. Need to come up with something better because this
465 // causes problems where the keyboard acts as if it were unresponsive. :-P
467 if ((e->key() == vjs.p1KeyBindings[BUTTON_L] && joypad_0_buttons[BUTTON_R])
468 || (e->key() == vjs.p1KeyBindings[BUTTON_R] && joypad_0_buttons[BUTTON_L])
469 || (e->key() == vjs.p1KeyBindings[BUTTON_U] && joypad_0_buttons[BUTTON_D])
470 || (e->key() == vjs.p1KeyBindings[BUTTON_D] && joypad_0_buttons[BUTTON_U]))
474 if (e->key() == (int)vjs.p1KeyBindings[BUTTON_L] && joypad_0_buttons[BUTTON_R])
475 joypad_0_buttons[BUTTON_R] = 0;
476 if (e->key() == (int)vjs.p1KeyBindings[BUTTON_R] && joypad_0_buttons[BUTTON_L])
477 joypad_0_buttons[BUTTON_L] = 0;
478 if (e->key() == (int)vjs.p1KeyBindings[BUTTON_U] && joypad_0_buttons[BUTTON_D])
479 joypad_0_buttons[BUTTON_D] = 0;
480 if (e->key() == (int)vjs.p1KeyBindings[BUTTON_D] && joypad_0_buttons[BUTTON_U])
481 joypad_0_buttons[BUTTON_U] = 0;
483 if (e->key() == (int)vjs.p2KeyBindings[BUTTON_L] && joypad_1_buttons[BUTTON_R])
484 joypad_1_buttons[BUTTON_R] = 0;
485 if (e->key() == (int)vjs.p2KeyBindings[BUTTON_R] && joypad_1_buttons[BUTTON_L])
486 joypad_1_buttons[BUTTON_L] = 0;
487 if (e->key() == (int)vjs.p2KeyBindings[BUTTON_U] && joypad_1_buttons[BUTTON_D])
488 joypad_1_buttons[BUTTON_D] = 0;
489 if (e->key() == (int)vjs.p2KeyBindings[BUTTON_D] && joypad_1_buttons[BUTTON_U])
490 joypad_1_buttons[BUTTON_U] = 0;
492 //hrm, this still has sticky state problems... Ugh!
493 // First, settle key states...
494 if (e->key() == (int)vjs.p1KeyBindings[BUTTON_L])
495 keyHeld[P1LEFT] = state;
496 else if (e->key() == (int)vjs.p1KeyBindings[BUTTON_R])
497 keyHeld[P1RIGHT] = state;
498 else if (e->key() == (int)vjs.p1KeyBindings[BUTTON_U])
499 keyHeld[P1UP] = state;
500 else if (e->key() == (int)vjs.p1KeyBindings[BUTTON_D])
501 keyHeld[P1DOWN] = state;
502 else if (e->key() == (int)vjs.p2KeyBindings[BUTTON_L])
503 keyHeld[P2LEFT] = state;
504 else if (e->key() == (int)vjs.p2KeyBindings[BUTTON_R])
505 keyHeld[P2RIGHT] = state;
506 else if (e->key() == (int)vjs.p2KeyBindings[BUTTON_U])
507 keyHeld[P2UP] = state;
508 else if (e->key() == (int)vjs.p2KeyBindings[BUTTON_D])
509 keyHeld[P2DOWN] = state;
511 // Next, check for conflicts and bail out if there are any...
512 if ((keyHeld[P1LEFT] && keyHeld[P1RIGHT])
513 || (keyHeld[P1UP] && keyHeld[P1DOWN])
514 || (keyHeld[P2LEFT] && keyHeld[P2RIGHT])
515 || (keyHeld[P2UP] && keyHeld[P2DOWN]))
520 // No bad combos exist, let's stuff the emulator key buffers...!
521 for(int i=BUTTON_FIRST; i<=BUTTON_LAST; i++)
523 if (e->key() == (int)vjs.p1KeyBindings[i])
524 // joypad_0_buttons[i] = (uint8)state;
525 joypad_0_buttons[i] = (state ? 0x01 : 0x00);
527 // Pad #2 is screwing up pad #1. Prolly a problem in joystick.cpp...
528 // So let's try to fix it there. :-P [DONE]
529 if (e->key() == (int)vjs.p2KeyBindings[i])
530 // joypad_1_buttons[i] = (uint8)state;
531 joypad_1_buttons[i] = (state ? 0x01 : 0x00);
536 void MainWin::HandleGamepads(void)
540 for(int i=BUTTON_FIRST; i<=BUTTON_LAST; i++)
542 if (vjs.p1KeyBindings[i] & (JOY_BUTTON | JOY_HAT | JOY_AXIS))
543 joypad_0_buttons[i] = (Gamepad::GetState(0, vjs.p1KeyBindings[i]) ? 0x01 : 0x00);
545 if (vjs.p2KeyBindings[i] & (JOY_BUTTON | JOY_HAT | JOY_AXIS))
546 joypad_1_buttons[i] = (Gamepad::GetState(1, vjs.p2KeyBindings[i]) ? 0x01 : 0x00);
551 void MainWin::Open(void)
556 void MainWin::Configure(void)
558 // Call the configuration dialog and update settings
559 ConfigDialog dlg(this);
561 dlg.generalTab->useUnknownSoftware->setChecked(allowUnknownSoftware);
563 if (dlg.exec() == false)
566 QString before = vjs.ROMPath;
567 QString alpineBefore = vjs.alpineROMPath;
568 QString absBefore = vjs.absROMPath;
569 // bool audioBefore = vjs.audioEnabled;
570 bool audioBefore = vjs.DSPEnabled;
571 dlg.UpdateVJSettings();
572 QString after = vjs.ROMPath;
573 QString alpineAfter = vjs.alpineROMPath;
574 QString absAfter = vjs.absROMPath;
575 // bool audioAfter = vjs.audioEnabled;
576 bool audioAfter = vjs.DSPEnabled;
578 bool allowOld = allowUnknownSoftware;
580 allowUnknownSoftware = dlg.generalTab->useUnknownSoftware->isChecked();
582 // We rescan the "software" folder if the user either changed the path or
583 // checked/unchecked the "Allow unknown files" option in the config dialog.
584 if ((before != after) || (allowOld != allowUnknownSoftware))
585 filePickWin->ScanSoftwareFolder(allowUnknownSoftware);
587 // If the "Alpine" ROM is changed, then let's load it...
588 if (alpineBefore != alpineAfter)
590 if (!JaguarLoadFile(vjs.alpineROMPath) && !AlpineLoadFile(vjs.alpineROMPath))
592 // Oh crap, we couldn't get the file! Alert the media!
594 msg.setText(QString(tr("Could not load file \"%1\"!")).arg(vjs.alpineROMPath));
595 msg.setIcon(QMessageBox::Warning);
600 // If the "ABS" ROM is changed, then let's load it...
601 if (absBefore != absAfter)
603 if (!JaguarLoadFile(vjs.absROMPath))
605 // Oh crap, we couldn't get the file! Alert the media!
607 msg.setText(QString(tr("Could not load file \"%1\"!")).arg(vjs.absROMPath));
608 msg.setIcon(QMessageBox::Warning);
613 // If the "Enable DSP" checkbox changed, then we have to re-init the DAC,
614 // since it's running in the host audio IRQ...
615 if (audioBefore != audioAfter)
621 // Just in case we crash before a clean exit...
627 // Here's the main emulator loop
629 void MainWin::Timer(void)
634 if (showUntunedTankCircuit)
636 // Some machines can't handle this, so we give them the option to disable it. :-)
637 if (!plzDontKillMyComputer)
639 // Random hash & trash
640 // We try to simulate an untuned tank circuit here... :-)
641 for(uint32_t x=0; x<videoWidget->rasterWidth; x++)
643 for(uint32_t y=0; y<videoWidget->rasterHeight; y++)
645 videoWidget->buffer[(y * videoWidget->textureWidth) + x]
646 = (rand() & 0xFF) << 8 | (rand() & 0xFF) << 16 | (rand() & 0xFF) << 24;
653 // Otherwise, run the Jaguar simulation
656 // videoWidget->HideMouseIfTimedOut();
657 videoWidget->HandleMouseHiding();
660 videoWidget->updateGL();
664 void MainWin::TogglePowerState(void)
666 powerButtonOn = !powerButtonOn;
669 // With the power off, we simulate white noise on the screen. :-)
672 // Restore the mouse pointer, if hidden:
673 videoWidget->CheckAndRestoreMouseCursor();
674 useCDAct->setDisabled(false);
675 palAct->setDisabled(false);
676 ntscAct->setDisabled(false);
677 pauseAct->setChecked(false);
678 pauseAct->setDisabled(true);
679 showUntunedTankCircuit = true;
680 DACPauseAudioThread();
681 // This is just in case the ROM we were playing was in a narrow or wide field mode,
682 // so the untuned tank sim doesn't look wrong. :-)
685 if (plzDontKillMyComputer)
687 // We have to do it line by line, because the texture pitch is not the
688 // same as the picture buffer's pitch.
689 for(uint32_t y=0; y<videoWidget->rasterHeight; y++)
691 memcpy(videoWidget->buffer + (y * videoWidget->textureWidth), testPattern + (y * VIRTUAL_SCREEN_WIDTH), VIRTUAL_SCREEN_WIDTH * sizeof(uint32_t));
697 useCDAct->setDisabled(true);
698 palAct->setDisabled(true);
699 ntscAct->setDisabled(true);
700 pauseAct->setChecked(false);
701 pauseAct->setDisabled(false);
702 showUntunedTankCircuit = false;
704 // Otherwise, we prepare for running regular software...
707 // Should check for cartridgeLoaded here as well...!
708 // We can clear it when toggling CDActive on, so that when we power cycle it does the
709 // expected thing. Otherwise, if we use the file picker to insert a cart, we expect
710 // to run the cart! Maybe have a RemoveCart function that only works if the CD unit
712 setWindowTitle(QString("Virtual Jaguar " VJ_RELEASE_VERSION
713 " - Now playing: Jaguar CD"));
716 WriteLog("GUI: Resetting Jaguar...\n");
718 DACPauseAudioThread(false);
723 void MainWin::ToggleRunState(void)
729 // Restore the mouse pointer, if hidden:
730 videoWidget->CheckAndRestoreMouseCursor();
731 frameAdvanceAct->setDisabled(false);
733 for(uint32_t i=0; i<(uint32_t)(videoWidget->textureWidth * 256); i++)
735 uint32_t pixel = videoWidget->buffer[i];
736 uint8_t r = (pixel >> 24) & 0xFF, g = (pixel >> 16) & 0xFF, b = (pixel >> 8) & 0xFF;
737 pixel = ((r + g + b) / 3) & 0x00FF;
738 videoWidget->buffer[i] = 0x000000FF | (pixel << 16) | (pixel << 8);
741 videoWidget->updateGL();
744 frameAdvanceAct->setDisabled(true);
746 // Pause/unpause any running/non-running threads...
747 DACPauseAudioThread(!running);
751 void MainWin::SetZoom100(void)
758 void MainWin::SetZoom200(void)
765 void MainWin::SetZoom300(void)
772 void MainWin::SetNTSC(void)
774 powerAct->setIcon(powerRed);
775 timer->setInterval(16);
776 vjs.hardwareTypeNTSC = true;
782 void MainWin::SetPAL(void)
784 powerAct->setIcon(powerGreen);
785 timer->setInterval(20);
786 vjs.hardwareTypeNTSC = false;
792 void MainWin::ToggleBlur(void)
794 vjs.glFilter = !vjs.glFilter;
799 void MainWin::ShowAboutWin(void)
805 void MainWin::ShowHelpWin(void)
811 void MainWin::InsertCart(void)
813 // If the emulator is running, we pause it here and unpause it later
814 // if we dismiss the file selector without choosing anything
815 if (running && powerButtonOn)
818 pauseForFileSelector = true;
825 void MainWin::Unpause(void)
827 // Here we unpause the emulator if it was paused when we went into the file selector
828 if (pauseForFileSelector)
830 pauseForFileSelector = false;
832 // Some nutter might have unpaused while in the file selector, so check for that
839 void MainWin::LoadSoftware(QString file)
841 running = false; // Prevent bad things(TM) from happening...
842 pauseForFileSelector = false; // Reset the file selector pause flag
844 char * biosPointer = jaguarBootROM;
846 if (vjs.hardwareTypeAlpine)
847 biosPointer = jaguarDevBootROM2;
849 memcpy(jagMemSpace + 0xE00000, biosPointer, 0x20000);
851 powerAct->setDisabled(false);
852 powerAct->setChecked(true);
853 powerButtonOn = false;
855 // We have to load our software *after* the Jaguar RESET
856 cartridgeLoaded = JaguarLoadFile(file.toAscii().data());
857 SET32(jaguarMainRAM, 0, 0x00200000); // Set top of stack...
859 // This is icky because we've already done it
861 if (!vjs.useJaguarBIOS)
862 SET32(jaguarMainRAM, 4, jaguarRunAddress);
866 if (!vjs.hardwareTypeAlpine && !loadAndGo)
868 QString newTitle = QString("Virtual Jaguar " VJ_RELEASE_VERSION " - Now playing: %1")
869 .arg(filePickWin->GetSelectedPrettyName());
870 setWindowTitle(newTitle);
875 void MainWin::ToggleCDUsage(void)
877 CDActive = !CDActive;
879 // Set up the Jaguar CD for execution, otherwise, clear memory
881 memcpy(jagMemSpace + 0x800000, jaguarCDBootROM, 0x40000);
883 memset(jagMemSpace + 0x800000, 0xFF, 0x40000);
887 void MainWin::FrameAdvance(void)
889 //printf("Frame Advance...\n");
890 // Execute 1 frame, then exit (only useful in Pause mode)
892 videoWidget->updateGL();
893 // Need to execute 1 frames' worth of DSP thread as well :-/
894 #warning "!!! Need to execute the DSP thread for 1 frame too !!!"
898 void MainWin::SetFullScreen(bool state/*= true*/)
902 mainWinPosition = pos();
905 x1Act->setDisabled(true);
906 x2Act->setDisabled(true);
907 x3Act->setDisabled(true);
909 // This is needed because the fullscreen may happen on a different
910 // screen than screen 0:
911 int screenNum = QApplication::desktop()->screenNumber(videoWidget);
912 QRect r = QApplication::desktop()->availableGeometry(screenNum);
913 double targetWidth = (double)VIRTUAL_SCREEN_WIDTH,
914 targetHeight = (double)(vjs.hardwareTypeNTSC ? VIRTUAL_SCREEN_HEIGHT_NTSC : VIRTUAL_SCREEN_HEIGHT_PAL);
915 double aspectRatio = targetWidth / targetHeight;
916 // NOTE: Really should check here to see which dimension constrains the
917 // other. Right now, we assume that height is the constraint.
918 int newWidth = (int)(aspectRatio * (double)r.height());
919 videoWidget->offset = (r.width() - newWidth) / 2;
920 videoWidget->fullscreen = true;
921 videoWidget->outputWidth = newWidth;
922 videoWidget->setFixedSize(r.width(), r.height());
927 // Reset the video widget to windowed mode
928 videoWidget->offset = 0;
929 videoWidget->fullscreen = false;
930 x1Act->setDisabled(false);
931 x2Act->setDisabled(false);
932 x3Act->setDisabled(false);
937 move(mainWinPosition);
940 // For some reason, this doesn't work: If the emu is paused, toggling from
941 // fullscreen to windowed (& vice versa) shows a white screen.
942 // (It was the ResizeGL() function in GLWidget: it was being called too
943 // much, causing the buffer to be deleted, remade & cleared.)
944 // videoWidget->updateGL();
948 void MainWin::ToggleFullScreen(void)
950 fullScreen = !fullScreen;
951 SetFullScreen(fullScreen);
955 void MainWin::ShowMemoryBrowserWin(void)
957 memBrowseWin->show();
958 memBrowseWin->RefreshContents();
962 void MainWin::ShowCPUBrowserWin(void)
964 cpuBrowseWin->show();
965 cpuBrowseWin->RefreshContents();
969 void MainWin::ShowOPBrowserWin(void)
972 opBrowseWin->RefreshContents();
976 void MainWin::ShowM68KDasmBrowserWin(void)
978 m68kDasmBrowseWin->show();
979 m68kDasmBrowseWin->RefreshContents();
983 void MainWin::ShowRISCDasmBrowserWin(void)
985 riscDasmBrowseWin->show();
986 riscDasmBrowseWin->RefreshContents();
990 void MainWin::ResizeMainWindow(void)
992 videoWidget->setFixedSize(zoomLevel * VIRTUAL_SCREEN_WIDTH,
993 zoomLevel * (vjs.hardwareTypeNTSC ? VIRTUAL_SCREEN_HEIGHT_NTSC : VIRTUAL_SCREEN_HEIGHT_PAL));
995 // Show the test pattern if user requested plzDontKillMyComputer mode
996 if (!powerButtonOn && plzDontKillMyComputer)
998 for(uint32_t y=0; y<videoWidget->rasterHeight; y++)
1000 memcpy(videoWidget->buffer + (y * videoWidget->textureWidth), testPattern + (y * VIRTUAL_SCREEN_WIDTH), VIRTUAL_SCREEN_WIDTH * sizeof(uint32_t));
1006 for(int i=0; i<2; i++)
1010 QApplication::processEvents();
1015 #warning "!!! Need to check the window geometry to see if the positions are legal !!!"
1016 // i.e., someone could drag it to another screen, close it, then disconnect that screen
1017 void MainWin::ReadSettings(void)
1019 QSettings settings("Underground Software", "Virtual Jaguar");
1020 mainWinPosition = settings.value("pos", QPoint(200, 200)).toPoint();
1021 QSize size = settings.value("size", QSize(400, 400)).toSize();
1023 move(mainWinPosition);
1024 QPoint pos = settings.value("cartLoadPos", QPoint(200, 200)).toPoint();
1025 filePickWin->move(pos);
1027 zoomLevel = settings.value("zoom", 2).toInt();
1028 allowUnknownSoftware = settings.value("showUnknownSoftware", false).toBool();
1030 vjs.useJoystick = settings.value("useJoystick", false).toBool();
1031 vjs.joyport = settings.value("joyport", 0).toInt();
1032 vjs.hardwareTypeNTSC = settings.value("hardwareTypeNTSC", true).toBool();
1033 vjs.frameSkip = settings.value("frameSkip", 0).toInt();
1034 vjs.useJaguarBIOS = settings.value("useJaguarBIOS", false).toBool();
1035 vjs.GPUEnabled = settings.value("GPUEnabled", true).toBool();
1036 vjs.DSPEnabled = settings.value("DSPEnabled", false).toBool();
1037 vjs.audioEnabled = settings.value("audioEnabled", true).toBool();
1038 vjs.usePipelinedDSP = settings.value("usePipelinedDSP", false).toBool();
1039 vjs.fullscreen = settings.value("fullscreen", false).toBool();
1040 vjs.useOpenGL = settings.value("useOpenGL", true).toBool();
1041 vjs.glFilter = settings.value("glFilterType", 1).toInt();
1042 vjs.renderType = settings.value("renderType", 0).toInt();
1043 vjs.allowWritesToROM = settings.value("writeROM", false).toBool();
1044 vjs.biosType = settings.value("biosType", BT_M_SERIES).toInt();
1045 strcpy(vjs.EEPROMPath, settings.value("EEPROMs", "./eeproms/").toString().toAscii().data());
1046 strcpy(vjs.ROMPath, settings.value("ROMs", "./software/").toString().toAscii().data());
1047 strcpy(vjs.alpineROMPath, settings.value("DefaultROM", "").toString().toAscii().data());
1048 strcpy(vjs.absROMPath, settings.value("DefaultABS", "").toString().toAscii().data());
1050 WriteLog("MainWin: Paths\n");
1051 WriteLog(" EEPROMPath = \"%s\"\n", vjs.EEPROMPath);
1052 WriteLog(" ROMPath = \"%s\"\n", vjs.ROMPath);
1053 WriteLog("AlpineROMPath = \"%s\"\n", vjs.alpineROMPath);
1054 WriteLog(" absROMPath = \"%s\"\n", vjs.absROMPath);
1055 WriteLog("Pipelined DSP = %s\n", (vjs.usePipelinedDSP ? "ON" : "off"));
1057 // Keybindings in order of U, D, L, R, C, B, A, Op, Pa, 0-9, #, *
1058 vjs.p1KeyBindings[BUTTON_U] = settings.value("p1k_up", Qt::Key_S).toInt();
1059 vjs.p1KeyBindings[BUTTON_D] = settings.value("p1k_down", Qt::Key_X).toInt();
1060 vjs.p1KeyBindings[BUTTON_L] = settings.value("p1k_left", Qt::Key_A).toInt();
1061 vjs.p1KeyBindings[BUTTON_R] = settings.value("p1k_right", Qt::Key_D).toInt();
1062 vjs.p1KeyBindings[BUTTON_C] = settings.value("p1k_c", Qt::Key_J).toInt();
1063 vjs.p1KeyBindings[BUTTON_B] = settings.value("p1k_b", Qt::Key_K).toInt();
1064 vjs.p1KeyBindings[BUTTON_A] = settings.value("p1k_a", Qt::Key_L).toInt();
1065 vjs.p1KeyBindings[BUTTON_OPTION] = settings.value("p1k_option", Qt::Key_O).toInt();
1066 vjs.p1KeyBindings[BUTTON_PAUSE] = settings.value("p1k_pause", Qt::Key_P).toInt();
1067 vjs.p1KeyBindings[BUTTON_0] = settings.value("p1k_0", Qt::Key_0).toInt();
1068 vjs.p1KeyBindings[BUTTON_1] = settings.value("p1k_1", Qt::Key_1).toInt();
1069 vjs.p1KeyBindings[BUTTON_2] = settings.value("p1k_2", Qt::Key_2).toInt();
1070 vjs.p1KeyBindings[BUTTON_3] = settings.value("p1k_3", Qt::Key_3).toInt();
1071 vjs.p1KeyBindings[BUTTON_4] = settings.value("p1k_4", Qt::Key_4).toInt();
1072 vjs.p1KeyBindings[BUTTON_5] = settings.value("p1k_5", Qt::Key_5).toInt();
1073 vjs.p1KeyBindings[BUTTON_6] = settings.value("p1k_6", Qt::Key_6).toInt();
1074 vjs.p1KeyBindings[BUTTON_7] = settings.value("p1k_7", Qt::Key_7).toInt();
1075 vjs.p1KeyBindings[BUTTON_8] = settings.value("p1k_8", Qt::Key_8).toInt();
1076 vjs.p1KeyBindings[BUTTON_9] = settings.value("p1k_9", Qt::Key_9).toInt();
1077 vjs.p1KeyBindings[BUTTON_d] = settings.value("p1k_pound", Qt::Key_Minus).toInt();
1078 vjs.p1KeyBindings[BUTTON_s] = settings.value("p1k_star", Qt::Key_Equal).toInt();
1080 vjs.p2KeyBindings[BUTTON_U] = settings.value("p2k_up", Qt::Key_Up).toInt();
1081 vjs.p2KeyBindings[BUTTON_D] = settings.value("p2k_down", Qt::Key_Down).toInt();
1082 vjs.p2KeyBindings[BUTTON_L] = settings.value("p2k_left", Qt::Key_Left).toInt();
1083 vjs.p2KeyBindings[BUTTON_R] = settings.value("p2k_right", Qt::Key_Right).toInt();
1084 vjs.p2KeyBindings[BUTTON_C] = settings.value("p2k_c", Qt::Key_Z).toInt();
1085 vjs.p2KeyBindings[BUTTON_B] = settings.value("p2k_b", Qt::Key_X).toInt();
1086 vjs.p2KeyBindings[BUTTON_A] = settings.value("p2k_a", Qt::Key_C).toInt();
1087 vjs.p2KeyBindings[BUTTON_OPTION] = settings.value("p2k_option", Qt::Key_Apostrophe).toInt();
1088 vjs.p2KeyBindings[BUTTON_PAUSE] = settings.value("p2k_pause", Qt::Key_Return).toInt();
1089 vjs.p2KeyBindings[BUTTON_0] = settings.value("p2k_0", Qt::Key_0).toInt();
1090 vjs.p2KeyBindings[BUTTON_1] = settings.value("p2k_1", Qt::Key_1).toInt();
1091 vjs.p2KeyBindings[BUTTON_2] = settings.value("p2k_2", Qt::Key_2).toInt();
1092 vjs.p2KeyBindings[BUTTON_3] = settings.value("p2k_3", Qt::Key_3).toInt();
1093 vjs.p2KeyBindings[BUTTON_4] = settings.value("p2k_4", Qt::Key_4).toInt();
1094 vjs.p2KeyBindings[BUTTON_5] = settings.value("p2k_5", Qt::Key_5).toInt();
1095 vjs.p2KeyBindings[BUTTON_6] = settings.value("p2k_6", Qt::Key_6).toInt();
1096 vjs.p2KeyBindings[BUTTON_7] = settings.value("p2k_7", Qt::Key_7).toInt();
1097 vjs.p2KeyBindings[BUTTON_8] = settings.value("p2k_8", Qt::Key_8).toInt();
1098 vjs.p2KeyBindings[BUTTON_9] = settings.value("p2k_9", Qt::Key_9).toInt();
1099 vjs.p2KeyBindings[BUTTON_d] = settings.value("p2k_pound", Qt::Key_Slash).toInt();
1100 vjs.p2KeyBindings[BUTTON_s] = settings.value("p2k_star", Qt::Key_Asterisk).toInt();
1104 void MainWin::WriteSettings(void)
1106 QSettings settings("Underground Software", "Virtual Jaguar");
1107 settings.setValue("pos", pos());
1108 settings.setValue("size", size());
1109 settings.setValue("cartLoadPos", filePickWin->pos());
1111 settings.setValue("zoom", zoomLevel);
1112 settings.setValue("showUnknownSoftware", allowUnknownSoftware);
1114 settings.setValue("useJoystick", vjs.useJoystick);
1115 settings.setValue("joyport", vjs.joyport);
1116 settings.setValue("hardwareTypeNTSC", vjs.hardwareTypeNTSC);
1117 settings.setValue("frameSkip", vjs.frameSkip);
1118 settings.setValue("useJaguarBIOS", vjs.useJaguarBIOS);
1119 settings.setValue("GPUEnabled", vjs.GPUEnabled);
1120 settings.setValue("DSPEnabled", vjs.DSPEnabled);
1121 settings.setValue("audioEnabled", vjs.audioEnabled);
1122 settings.setValue("usePipelinedDSP", vjs.usePipelinedDSP);
1123 settings.setValue("fullscreen", vjs.fullscreen);
1124 settings.setValue("useOpenGL", vjs.useOpenGL);
1125 settings.setValue("glFilterType", vjs.glFilter);
1126 settings.setValue("renderType", vjs.renderType);
1127 settings.setValue("writeROM", vjs.allowWritesToROM);
1128 settings.setValue("biosType", vjs.biosType);
1129 settings.setValue("JagBootROM", vjs.jagBootPath);
1130 settings.setValue("CDBootROM", vjs.CDBootPath);
1131 settings.setValue("EEPROMs", vjs.EEPROMPath);
1132 settings.setValue("ROMs", vjs.ROMPath);
1133 settings.setValue("DefaultROM", vjs.alpineROMPath);
1134 settings.setValue("DefaultABS", vjs.absROMPath);
1136 settings.setValue("p1k_up", vjs.p1KeyBindings[BUTTON_U]);
1137 settings.setValue("p1k_down", vjs.p1KeyBindings[BUTTON_D]);
1138 settings.setValue("p1k_left", vjs.p1KeyBindings[BUTTON_L]);
1139 settings.setValue("p1k_right", vjs.p1KeyBindings[BUTTON_R]);
1140 settings.setValue("p1k_c", vjs.p1KeyBindings[BUTTON_C]);
1141 settings.setValue("p1k_b", vjs.p1KeyBindings[BUTTON_B]);
1142 settings.setValue("p1k_a", vjs.p1KeyBindings[BUTTON_A]);
1143 settings.setValue("p1k_option", vjs.p1KeyBindings[BUTTON_OPTION]);
1144 settings.setValue("p1k_pause", vjs.p1KeyBindings[BUTTON_PAUSE]);
1145 settings.setValue("p1k_0", vjs.p1KeyBindings[BUTTON_0]);
1146 settings.setValue("p1k_1", vjs.p1KeyBindings[BUTTON_1]);
1147 settings.setValue("p1k_2", vjs.p1KeyBindings[BUTTON_2]);
1148 settings.setValue("p1k_3", vjs.p1KeyBindings[BUTTON_3]);
1149 settings.setValue("p1k_4", vjs.p1KeyBindings[BUTTON_4]);
1150 settings.setValue("p1k_5", vjs.p1KeyBindings[BUTTON_5]);
1151 settings.setValue("p1k_6", vjs.p1KeyBindings[BUTTON_6]);
1152 settings.setValue("p1k_7", vjs.p1KeyBindings[BUTTON_7]);
1153 settings.setValue("p1k_8", vjs.p1KeyBindings[BUTTON_8]);
1154 settings.setValue("p1k_9", vjs.p1KeyBindings[BUTTON_9]);
1155 settings.setValue("p1k_pound", vjs.p1KeyBindings[BUTTON_d]);
1156 settings.setValue("p1k_star", vjs.p1KeyBindings[BUTTON_s]);
1158 settings.setValue("p2k_up", vjs.p2KeyBindings[BUTTON_U]);
1159 settings.setValue("p2k_down", vjs.p2KeyBindings[BUTTON_D]);
1160 settings.setValue("p2k_left", vjs.p2KeyBindings[BUTTON_L]);
1161 settings.setValue("p2k_right", vjs.p2KeyBindings[BUTTON_R]);
1162 settings.setValue("p2k_c", vjs.p2KeyBindings[BUTTON_C]);
1163 settings.setValue("p2k_b", vjs.p2KeyBindings[BUTTON_B]);
1164 settings.setValue("p2k_a", vjs.p2KeyBindings[BUTTON_A]);
1165 settings.setValue("p2k_option", vjs.p2KeyBindings[BUTTON_OPTION]);
1166 settings.setValue("p2k_pause", vjs.p2KeyBindings[BUTTON_PAUSE]);
1167 settings.setValue("p2k_0", vjs.p2KeyBindings[BUTTON_0]);
1168 settings.setValue("p2k_1", vjs.p2KeyBindings[BUTTON_1]);
1169 settings.setValue("p2k_2", vjs.p2KeyBindings[BUTTON_2]);
1170 settings.setValue("p2k_3", vjs.p2KeyBindings[BUTTON_3]);
1171 settings.setValue("p2k_4", vjs.p2KeyBindings[BUTTON_4]);
1172 settings.setValue("p2k_5", vjs.p2KeyBindings[BUTTON_5]);
1173 settings.setValue("p2k_6", vjs.p2KeyBindings[BUTTON_6]);
1174 settings.setValue("p2k_7", vjs.p2KeyBindings[BUTTON_7]);
1175 settings.setValue("p2k_8", vjs.p2KeyBindings[BUTTON_8]);
1176 settings.setValue("p2k_9", vjs.p2KeyBindings[BUTTON_9]);
1177 settings.setValue("p2k_pound", vjs.p2KeyBindings[BUTTON_d]);
1178 settings.setValue("p2k_star", vjs.p2KeyBindings[BUTTON_s]);
1182 void MainWin::WriteUISettings(void)
1184 QSettings settings("Underground Software", "Virtual Jaguar");
1185 settings.setValue("pos", pos());
1186 settings.setValue("size", size());
1187 settings.setValue("cartLoadPos", filePickWin->pos());
1189 settings.setValue("zoom", zoomLevel);