X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgui%2Fmainwin.cpp;h=892fb1fec0bdbab4b21bd3fcc5ad36d3f4ad7577;hb=0c6ed444bbb07e5cc0513a7d3075fb24d06e61eb;hp=07f82d90eb6af32e572216b7b4b546249ffcfabb;hpb=c035466b10cc62451441136274fbe1d80b2bad21;p=virtualjaguar diff --git a/src/gui/mainwin.cpp b/src/gui/mainwin.cpp index 07f82d9..892fb1f 100644 --- a/src/gui/mainwin.cpp +++ b/src/gui/mainwin.cpp @@ -79,7 +79,8 @@ // use, we can drop it in anywhere and use it as-is. MainWin::MainWin(): running(false), powerButtonOn(false), showUntunedTankCircuit(true), - cartridgeLoaded(false), CDActive(false)//, alpineLoadSuccessful(false) + cartridgeLoaded(false), CDActive(false),//, alpineLoadSuccessful(false), + pauseForFileSelector(false) { videoWidget = new GLWidget(this); setCentralWidget(videoWidget); @@ -165,7 +166,7 @@ MainWin::MainWin(): running(false), powerButtonOn(false), showUntunedTankCircuit filePickAct->setShortcut(QKeySequence(tr("Ctrl+i"))); connect(filePickAct, SIGNAL(triggered()), this, SLOT(InsertCart())); - configAct = new QAction(QIcon(":/res/generic.png"), tr("&Configure"), this); + configAct = new QAction(QIcon(":/res/wrench.png"), tr("&Configure"), this); configAct->setStatusTip(tr("Configure options for Virtual Jaguar")); configAct->setShortcut(QKeySequence(tr("Ctrl+c"))); connect(configAct, SIGNAL(triggered()), this, SLOT(Configure())); @@ -178,14 +179,15 @@ MainWin::MainWin(): running(false), powerButtonOn(false), showUntunedTankCircuit // Misc. connections... connect(filePickWin, SIGNAL(RequestLoad(QString)), this, SLOT(LoadSoftware(QString))); + connect(filePickWin, SIGNAL(FilePickerHiding()), this, SLOT(Unpause())); // Create menus & toolbars - fileMenu = menuBar()->addMenu(tr("&File")); - fileMenu->addAction(filePickAct); - fileMenu->addAction(useCDAct); + fileMenu = menuBar()->addMenu(tr("&Jaguar")); fileMenu->addAction(powerAct); fileMenu->addAction(pauseAct); + fileMenu->addAction(filePickAct); + fileMenu->addAction(useCDAct); fileMenu->addAction(configAct); fileMenu->addAction(quitAppAct); @@ -272,6 +274,8 @@ MainWin::MainWin(): running(false), powerButtonOn(false), showUntunedTankCircuit // Attempt to load/run the ABS file... LoadSoftware(vjs.absROMPath); } + else + memcpy(jagMemSpace + 0xE00000, jaguarBootROM, 0x20000); // Otherwise, use the stock BIOS } void MainWin::closeEvent(QCloseEvent * event) @@ -312,6 +316,15 @@ void MainWin::HandleKeys(QKeyEvent * e, bool state) joypad_0_buttons[BUTTON_D] = 0; if (e->key() == (int)vjs.p1KeyBindings[BUTTON_D] && joypad_0_buttons[BUTTON_U]) joypad_0_buttons[BUTTON_U] = 0; + + if (e->key() == (int)vjs.p2KeyBindings[BUTTON_L] && joypad_1_buttons[BUTTON_R]) + joypad_0_buttons[BUTTON_R] = 0; + if (e->key() == (int)vjs.p2KeyBindings[BUTTON_R] && joypad_1_buttons[BUTTON_L]) + joypad_0_buttons[BUTTON_L] = 0; + if (e->key() == (int)vjs.p2KeyBindings[BUTTON_U] && joypad_1_buttons[BUTTON_D]) + joypad_0_buttons[BUTTON_D] = 0; + if (e->key() == (int)vjs.p2KeyBindings[BUTTON_D] && joypad_1_buttons[BUTTON_U]) + joypad_0_buttons[BUTTON_U] = 0; #endif // No bad combos exist, let's stuff the emulator key buffers...! @@ -319,6 +332,9 @@ void MainWin::HandleKeys(QKeyEvent * e, bool state) { if (e->key() == (int)vjs.p1KeyBindings[i]) joypad_0_buttons[i] = (uint8)state; + + if (e->key() == (int)vjs.p2KeyBindings[i]) + joypad_1_buttons[i] = (uint8)state; } } @@ -534,14 +550,33 @@ void MainWin::ShowAboutWin(void) void MainWin::InsertCart(void) { + // If the emulator is running, we pause it here and unpause it later + // if we dismiss the file selector without choosing anything + if (running) + { + ToggleRunState(); + pauseForFileSelector = true; + } + filePickWin->show(); } +void MainWin::Unpause(void) +{ + // Here we unpause the emulator if it was paused when we went into the file selector + if (pauseForFileSelector) + { + pauseForFileSelector = false; + ToggleRunState(); + } +} + void MainWin::LoadSoftware(QString file) { - running = false; // Prevent bad things(TM) from happening... + running = false; // Prevent bad things(TM) from happening... + pauseForFileSelector = false; // Reset the file selector pause flag SET32(jaguarMainRAM, 0, 0x00200000); // Set top of stack... - cartridgeLoaded = (JaguarLoadFile(file.toAscii().data()) ? true : false); + cartridgeLoaded = JaguarLoadFile(file.toAscii().data()); char * biosPointer = jaguarBootROM;