diff options
Diffstat (limited to 'src/frontend/qt_sdl/main.cpp')
-rw-r--r-- | src/frontend/qt_sdl/main.cpp | 222 |
1 files changed, 131 insertions, 91 deletions
diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index 4286498..54a6f14 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -203,6 +203,30 @@ EmuThread::EmuThread(QObject* parent) : QThread(parent) static_cast<ScreenPanelGL*>(mainWindow->panel)->transferLayout(this); } +std::unique_ptr<NDS> EmuThread::CreateConsole() +{ + if (Config::ConsoleType == 1) + { + return std::make_unique<melonDS::DSi>(); + } + + return std::make_unique<melonDS::NDS>(); +} + +void EmuThread::RecreateConsole() +{ + if (!NDS || NDS->ConsoleType != Config::ConsoleType) + { + NDS = nullptr; // To ensure the destructor is called before a new one is created + NDS::Current = nullptr; + + NDS = CreateConsole(); + // TODO: Insert ROMs + NDS::Current = NDS.get(); + } +} + + void EmuThread::updateScreenSettings(bool filter, const WindowInfo& windowInfo, int numScreens, int* screenKind, float* screenMatrix) { screenSettingsLock.lock(); @@ -318,7 +342,7 @@ void EmuThread::run() u32 mainScreenPos[3]; Platform::FileHandle* file; - NDS::Init(); + RecreateConsole(); mainScreenPos[0] = 0; mainScreenPos[1] = 0; @@ -340,10 +364,10 @@ void EmuThread::run() videoRenderer = 0; } - NDS::GPU->InitRenderer(videoRenderer); - NDS::GPU->SetRenderSettings(videoRenderer, videoSettings); + NDS->GPU.InitRenderer(videoRenderer); + NDS->GPU.SetRenderSettings(videoRenderer, videoSettings); - NDS::SPU->SetInterpolation(Config::AudioInterp); + NDS->SPU.SetInterpolation(Config::AudioInterp); Input::Init(); @@ -362,7 +386,7 @@ void EmuThread::run() RTC::StateData state; Platform::FileRead(&state, sizeof(state), 1, file); Platform::CloseFile(file); - NDS::RTC->SetState(state); + NDS->RTC.SetState(state); } char melontitle[100]; @@ -384,8 +408,7 @@ void EmuThread::run() if (Input::HotkeyPressed(HK_SolarSensorDecrease)) { - assert(NDS::GBACartSlot != nullptr); - int level = NDS::GBACartSlot->SetInput(GBACart::Input_SolarSensorDown, true); + int level = NDS->GBACartSlot.SetInput(GBACart::Input_SolarSensorDown, true); if (level != -1) { char msg[64]; @@ -395,8 +418,7 @@ void EmuThread::run() } if (Input::HotkeyPressed(HK_SolarSensorIncrease)) { - assert(NDS::GBACartSlot != nullptr); - int level = NDS::GBACartSlot->SetInput(GBACart::Input_SolarSensorUp, true); + int level = NDS->GBACartSlot.SetInput(GBACart::Input_SolarSensorUp, true); if (level != -1) { char msg[64]; @@ -405,40 +427,41 @@ void EmuThread::run() } } - if (NDS::ConsoleType == 1) + if (NDS->ConsoleType == 1) { + DSi& dsi = static_cast<DSi&>(*NDS); double currentTime = SDL_GetPerformanceCounter() * perfCountsSec; // Handle power button if (Input::HotkeyDown(HK_PowerButton)) { - DSi::I2C->GetBPTWL()->SetPowerButtonHeld(currentTime); + dsi.I2C.GetBPTWL()->SetPowerButtonHeld(currentTime); } else if (Input::HotkeyReleased(HK_PowerButton)) { - DSi::I2C->GetBPTWL()->SetPowerButtonReleased(currentTime); + dsi.I2C.GetBPTWL()->SetPowerButtonReleased(currentTime); } // Handle volume buttons if (Input::HotkeyDown(HK_VolumeUp)) { - DSi::I2C->GetBPTWL()->SetVolumeSwitchHeld(DSi::I2C->GetBPTWL()->volumeKey_Up); + dsi.I2C.GetBPTWL()->SetVolumeSwitchHeld(DSi_BPTWL::volumeKey_Up); } else if (Input::HotkeyReleased(HK_VolumeUp)) { - DSi::I2C->GetBPTWL()->SetVolumeSwitchReleased(DSi::I2C->GetBPTWL()->volumeKey_Up); + dsi.I2C.GetBPTWL()->SetVolumeSwitchReleased(DSi_BPTWL::volumeKey_Up); } if (Input::HotkeyDown(HK_VolumeDown)) { - DSi::I2C->GetBPTWL()->SetVolumeSwitchHeld(DSi::I2C->GetBPTWL()->volumeKey_Down); + dsi.I2C.GetBPTWL()->SetVolumeSwitchHeld(DSi_BPTWL::volumeKey_Down); } else if (Input::HotkeyReleased(HK_VolumeDown)) { - DSi::I2C->GetBPTWL()->SetVolumeSwitchReleased(DSi::I2C->GetBPTWL()->volumeKey_Down); + dsi.I2C.GetBPTWL()->SetVolumeSwitchReleased(DSi_BPTWL::volumeKey_Down); } - DSi::I2C->GetBPTWL()->ProcessVolumeSwitchInput(currentTime); + dsi.I2C.GetBPTWL()->ProcessVolumeSwitchInput(currentTime); } if (EmuRunning == emuStatus_Running || EmuRunning == emuStatus_FrameStep) @@ -472,28 +495,28 @@ void EmuThread::run() videoSettings.GL_ScaleFactor = Config::GL_ScaleFactor; videoSettings.GL_BetterPolygons = Config::GL_BetterPolygons; - NDS::GPU->SetRenderSettings(videoRenderer, videoSettings); + NDS->GPU.SetRenderSettings(videoRenderer, videoSettings); } // process input and hotkeys - NDS::SetKeyMask(Input::InputMask); + NDS->SetKeyMask(Input::InputMask); if (Input::HotkeyPressed(HK_Lid)) { - bool lid = !NDS::IsLidClosed(); - NDS::SetLidClosed(lid); + bool lid = !NDS->IsLidClosed(); + NDS->SetLidClosed(lid); OSD::AddMessage(0, lid ? "Lid closed" : "Lid opened"); } // microphone input - AudioInOut::MicProcess(); + AudioInOut::MicProcess(*NDS); // auto screen layout if (Config::ScreenSizing == Frontend::screenSizing_Auto) { mainScreenPos[2] = mainScreenPos[1]; mainScreenPos[1] = mainScreenPos[0]; - mainScreenPos[0] = NDS::PowerControl9 >> 15; + mainScreenPos[0] = NDS->PowerControl9 >> 15; int guess; if (mainScreenPos[0] == mainScreenPos[2] && @@ -520,7 +543,7 @@ void EmuThread::run() // emulate - u32 nlines = NDS::RunFrame(); + u32 nlines = NDS->RunFrame(); if (ROMManager::NDSSave) ROMManager::NDSSave->CheckFlush(); @@ -534,12 +557,12 @@ void EmuThread::run() if (!oglContext) { FrontBufferLock.lock(); - FrontBuffer = NDS::GPU->FrontBuffer; + FrontBuffer = NDS->GPU.FrontBuffer; FrontBufferLock.unlock(); } else { - FrontBuffer = NDS::GPU->FrontBuffer; + FrontBuffer = NDS->GPU.FrontBuffer; drawScreenGL(); } @@ -563,9 +586,10 @@ void EmuThread::run() oglContext->SetSwapInterval(0); } - if (Config::DSiVolumeSync && NDS::ConsoleType == 1) + if (Config::DSiVolumeSync && NDS->ConsoleType == 1) { - u8 volumeLevel = DSi::I2C->GetBPTWL()->GetVolumeLevel(); + DSi& dsi = static_cast<DSi&>(*NDS); + u8 volumeLevel = dsi.I2C.GetBPTWL()->GetVolumeLevel(); if (volumeLevel != dsiVolumeLevel) { dsiVolumeLevel = volumeLevel; @@ -576,7 +600,7 @@ void EmuThread::run() } if (Config::AudioSync && !fastforward) - AudioInOut::AudioSync(); + AudioInOut::AudioSync(*emuThread->NDS); double frametimeStep = nlines / (60.0 * 263.0); @@ -669,16 +693,15 @@ void EmuThread::run() if (file) { RTC::StateData state; - NDS::RTC->GetState(state); + NDS->RTC.GetState(state); Platform::FileWrite(&state, sizeof(state), 1, file); Platform::CloseFile(file); } EmuStatus = emuStatus_Exit; - NDS::GPU->DeInitRenderer(); - NDS::DeInit(); - //Platform::LAN_DeInit(); + NDS::Current = nullptr; + // nds is out of scope, so unique_ptr cleans it up for us } void EmuThread::changeWindowTitle(char* title) @@ -759,6 +782,7 @@ bool EmuThread::emuIsActive() void EmuThread::drawScreenGL() { + if (!NDS) return; int w = windowInfo.surface_width; int h = windowInfo.surface_height; float factor = windowInfo.surface_scale; @@ -780,10 +804,10 @@ void EmuThread::drawScreenGL() glActiveTexture(GL_TEXTURE0); #ifdef OGLRENDERER_ENABLED - if (NDS::GPU->Renderer != 0) + if (NDS->GPU.Renderer != 0) { // hardware-accelerated render - NDS::GPU->CurGLCompositor->BindOutputTexture(frontbuf); + NDS->GPU.CurGLCompositor->BindOutputTexture(frontbuf); } else #endif @@ -791,12 +815,12 @@ void EmuThread::drawScreenGL() // regular render glBindTexture(GL_TEXTURE_2D, screenTexture); - if (NDS::GPU->Framebuffer[frontbuf][0] && NDS::GPU->Framebuffer[frontbuf][1]) + if (NDS->GPU.Framebuffer[frontbuf][0] && NDS->GPU.Framebuffer[frontbuf][1]) { glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 256, 192, GL_RGBA, - GL_UNSIGNED_BYTE, NDS::GPU->Framebuffer[frontbuf][0]); + GL_UNSIGNED_BYTE, NDS->GPU.Framebuffer[frontbuf][0]); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 192+2, 256, 192, GL_RGBA, - GL_UNSIGNED_BYTE, NDS::GPU->Framebuffer[frontbuf][1]); + GL_UNSIGNED_BYTE, NDS->GPU.Framebuffer[frontbuf][1]); } } @@ -927,7 +951,8 @@ void ScreenHandler::screenOnMousePress(QMouseEvent* event) if (Frontend::GetTouchCoords(x, y, false)) { touching = true; - NDS::TouchScreen(x, y); + assert(emuThread->NDS != nullptr); + emuThread->NDS->TouchScreen(x, y); } } @@ -939,7 +964,8 @@ void ScreenHandler::screenOnMouseRelease(QMouseEvent* event) if (touching) { touching = false; - NDS::ReleaseScreen(); + assert(emuThread->NDS != nullptr); + emuThread->NDS->ReleaseScreen(); } } @@ -956,7 +982,10 @@ void ScreenHandler::screenOnMouseMove(QMouseEvent* event) int y = event->pos().y(); if (Frontend::GetTouchCoords(x, y, true)) - NDS::TouchScreen(x, y); + { + assert(emuThread->NDS != nullptr); + emuThread->NDS->TouchScreen(x, y); + } } void ScreenHandler::screenHandleTablet(QTabletEvent* event) @@ -974,14 +1003,16 @@ void ScreenHandler::screenHandleTablet(QTabletEvent* event) if (Frontend::GetTouchCoords(x, y, event->type()==QEvent::TabletMove)) { touching = true; - NDS::TouchScreen(x, y); + assert(emuThread->NDS != nullptr); + emuThread->NDS->TouchScreen(x, y); } } break; case QEvent::TabletRelease: if (touching) { - NDS::ReleaseScreen(); + assert(emuThread->NDS != nullptr); + emuThread->NDS->ReleaseScreen(); touching = false; } break; @@ -1007,14 +1038,16 @@ void ScreenHandler::screenHandleTouch(QTouchEvent* event) if (Frontend::GetTouchCoords(x, y, event->type()==QEvent::TouchUpdate)) { touching = true; - NDS::TouchScreen(x, y); + assert(emuThread->NDS != nullptr); + emuThread->NDS->TouchScreen(x, y); } } break; case QEvent::TouchEnd: if (touching) { - NDS::ReleaseScreen(); + assert(emuThread->NDS != nullptr); + emuThread->NDS->ReleaseScreen(); touching = false; } break; @@ -1080,16 +1113,17 @@ void ScreenPanelNative::paintEvent(QPaintEvent* event) if (emuThread->emuIsActive()) { + assert(emuThread->NDS != nullptr); emuThread->FrontBufferLock.lock(); int frontbuf = emuThread->FrontBuffer; - if (!NDS::GPU->Framebuffer[frontbuf][0] || !NDS::GPU->Framebuffer[frontbuf][1]) + if (!emuThread->NDS->GPU.Framebuffer[frontbuf][0] || !emuThread->NDS->GPU.Framebuffer[frontbuf][1]) { emuThread->FrontBufferLock.unlock(); return; } - memcpy(screen[0].scanLine(0), NDS::GPU->Framebuffer[frontbuf][0], 256 * 192 * 4); - memcpy(screen[1].scanLine(0), NDS::GPU->Framebuffer[frontbuf][1], 256 * 192 * 4); + memcpy(screen[0].scanLine(0), emuThread->NDS->GPU.Framebuffer[frontbuf][0], 256 * 192 * 4); + memcpy(screen[1].scanLine(0), emuThread->NDS->GPU.Framebuffer[frontbuf][1], 256 * 192 * 4); emuThread->FrontBufferLock.unlock(); QRect screenrc(0, 0, 256, 192); @@ -1472,7 +1506,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) QMenu* submenu = menu->addMenu("Insert add-on cart"); actInsertGBAAddon[0] = submenu->addAction("Memory expansion"); - actInsertGBAAddon[0]->setData(QVariant(NDS::GBAAddon_RAMExpansion)); + actInsertGBAAddon[0]->setData(QVariant(GBAAddon_RAMExpansion)); connect(actInsertGBAAddon[0], &QAction::triggered, this, &MainWindow::onInsertGBAAddon); } @@ -2025,7 +2059,7 @@ void MainWindow::dropEvent(QDropEvent* event) if (isNdsRom) { - if (!ROMManager::LoadROM(file, true)) + if (!ROMManager::LoadROM(emuThread, file, true)) { // TODO: better error reporting? QMessageBox::critical(this, "melonDS", "Failed to load the DS ROM."); @@ -2038,14 +2072,15 @@ void MainWindow::dropEvent(QDropEvent* event) recentFileList.prepend(barredFilename); updateRecentFilesMenu(); - NDS::Start(); + assert(emuThread->NDS != nullptr); + emuThread->NDS->Start(); emuThread->emuRun(); updateCartInserted(false); } else if (isGbaRom) { - if (!ROMManager::LoadGBAROM(file)) + if (!ROMManager::LoadGBAROM(*emuThread->NDS, file)) { // TODO: better error reporting? QMessageBox::critical(this, "melonDS", "Failed to load the GBA ROM."); @@ -2111,7 +2146,7 @@ bool MainWindow::preloadROMs(QStringList file, QStringList gbafile, bool boot) bool gbaloaded = false; if (!gbafile.isEmpty()) { - if (!ROMManager::LoadGBAROM(gbafile)) + if (!ROMManager::LoadGBAROM(*emuThread->NDS, gbafile)) { // TODO: better error reporting? QMessageBox::critical(this, "melonDS", "Failed to load the GBA ROM."); @@ -2124,7 +2159,7 @@ bool MainWindow::preloadROMs(QStringList file, QStringList gbafile, bool boot) bool ndsloaded = false; if (!file.isEmpty()) { - if (!ROMManager::LoadROM(file, true)) + if (!ROMManager::LoadROM(emuThread, file, true)) { // TODO: better error reporting? QMessageBox::critical(this, "melonDS", "Failed to load the ROM."); @@ -2140,7 +2175,7 @@ bool MainWindow::preloadROMs(QStringList file, QStringList gbafile, bool boot) { if (ndsloaded) { - NDS::Start(); + emuThread->NDS->Start(); emuThread->emuRun(); } else @@ -2333,7 +2368,7 @@ void MainWindow::onOpenFile() return; } - if (!ROMManager::LoadROM(file, true)) + if (!ROMManager::LoadROM(emuThread, file, true)) { // TODO: better error reporting? QMessageBox::critical(this, "melonDS", "Failed to load the ROM."); @@ -2346,7 +2381,8 @@ void MainWindow::onOpenFile() recentFileList.prepend(filename); updateRecentFilesMenu(); - NDS::Start(); + assert(emuThread->NDS != nullptr); + emuThread->NDS->Start(); emuThread->emuRun(); updateCartInserted(false); @@ -2431,7 +2467,7 @@ void MainWindow::onClickRecentFile() return; } - if (!ROMManager::LoadROM(file, true)) + if (!ROMManager::LoadROM(emuThread, file, true)) { // TODO: better error reporting? QMessageBox::critical(this, "melonDS", "Failed to load the ROM."); @@ -2443,7 +2479,8 @@ void MainWindow::onClickRecentFile() recentFileList.prepend(filename); updateRecentFilesMenu(); - NDS::Start(); + assert(emuThread->NDS != nullptr); + emuThread->NDS->Start(); emuThread->emuRun(); updateCartInserted(false); @@ -2459,7 +2496,7 @@ void MainWindow::onBootFirmware() return; } - if (!ROMManager::LoadBIOS()) + if (!ROMManager::LoadBIOS(emuThread)) { // TODO: better error reporting? QMessageBox::critical(this, "melonDS", "This firmware is not bootable."); @@ -2467,7 +2504,8 @@ void MainWindow::onBootFirmware() return; } - NDS::Start(); + assert(emuThread->NDS != nullptr); + emuThread->NDS->Start(); emuThread->emuRun(); } @@ -2482,7 +2520,7 @@ void MainWindow::onInsertCart() return; } - if (!ROMManager::LoadROM(file, false)) + if (!ROMManager::LoadROM(emuThread, file, false)) { // TODO: better error reporting? QMessageBox::critical(this, "melonDS", "Failed to load the ROM."); @@ -2499,7 +2537,7 @@ void MainWindow::onEjectCart() { emuThread->emuPause(); - ROMManager::EjectCart(); + ROMManager::EjectCart(*emuThread->NDS); emuThread->emuUnpause(); @@ -2517,7 +2555,7 @@ void MainWindow::onInsertGBACart() return; } - if (!ROMManager::LoadGBAROM(file)) + if (!ROMManager::LoadGBAROM(*emuThread->NDS, file)) { // TODO: better error reporting? QMessageBox::critical(this, "melonDS", "Failed to load the ROM."); @@ -2537,7 +2575,7 @@ void MainWindow::onInsertGBAAddon() emuThread->emuPause(); - ROMManager::LoadGBAAddon(type); + ROMManager::LoadGBAAddon(*emuThread->NDS, type); emuThread->emuUnpause(); @@ -2548,7 +2586,7 @@ void MainWindow::onEjectGBACart() { emuThread->emuPause(); - ROMManager::EjectGBACart(); + ROMManager::EjectGBACart(*emuThread->NDS); emuThread->emuUnpause(); @@ -2582,7 +2620,7 @@ void MainWindow::onSaveState() filename = qfilename.toStdString(); } - if (ROMManager::SaveState(filename)) + if (ROMManager::SaveState(*emuThread->NDS, filename)) { char msg[64]; if (slot > 0) sprintf(msg, "State saved to slot %d", slot); @@ -2637,7 +2675,7 @@ void MainWindow::onLoadState() return; } - if (ROMManager::LoadState(filename)) + if (ROMManager::LoadState(*emuThread->NDS, filename)) { char msg[64]; if (slot > 0) sprintf(msg, "State loaded from slot %d", slot); @@ -2657,7 +2695,7 @@ void MainWindow::onLoadState() void MainWindow::onUndoStateLoad() { emuThread->emuPause(); - ROMManager::UndoStateLoad(); + ROMManager::UndoStateLoad(*emuThread->NDS); emuThread->emuUnpause(); OSD::AddMessage(0, "State load undone"); @@ -2696,7 +2734,7 @@ void MainWindow::onImportSavefile() return; } - ROMManager::Reset(); + ROMManager::Reset(emuThread); } u32 len = FileLength(f); @@ -2705,7 +2743,8 @@ void MainWindow::onImportSavefile() Platform::FileRewind(f); Platform::FileRead(data, len, 1, f); - NDS::LoadSave(data, len); + assert(emuThread->NDS != nullptr); + emuThread->NDS->LoadSave(data, len); delete[] data; CloseFile(f); @@ -2747,7 +2786,7 @@ void MainWindow::onReset() actUndoStateLoad->setEnabled(false); - ROMManager::Reset(); + ROMManager::Reset(emuThread); OSD::AddMessage(0, "Reset"); emuThread->emuRun(); @@ -2758,7 +2797,7 @@ void MainWindow::onStop() if (!RunningSomething) return; emuThread->emuPause(); - NDS::Stop(); + emuThread->NDS->Stop(); } void MainWindow::onFrameStep() @@ -2775,13 +2814,13 @@ void MainWindow::onOpenDateTime() void MainWindow::onOpenPowerManagement() { - PowerManagementDialog* dlg = PowerManagementDialog::openDlg(this); + PowerManagementDialog* dlg = PowerManagementDialog::openDlg(this, emuThread); } void MainWindow::onEnableCheats(bool checked) { Config::EnableCheats = checked?1:0; - ROMManager::EnableCheats(Config::EnableCheats != 0); + ROMManager::EnableCheats(*emuThread->NDS, Config::EnableCheats != 0); } void MainWindow::onSetupCheats() @@ -2799,12 +2838,14 @@ void MainWindow::onCheatsDialogFinished(int res) void MainWindow::onROMInfo() { - ROMInfoDialog* dlg = ROMInfoDialog::openDlg(this); + auto cart = emuThread->NDS->NDSCartSlot.GetCart(); + if (cart) + ROMInfoDialog* dlg = ROMInfoDialog::openDlg(this, *cart); } void MainWindow::onRAMInfo() { - RAMInfoDialog* dlg = RAMInfoDialog::openDlg(this); + RAMInfoDialog* dlg = RAMInfoDialog::openDlg(this, emuThread); } void MainWindow::onOpenTitleManager() @@ -2907,7 +2948,7 @@ void MainWindow::onCameraSettingsFinished(int res) void MainWindow::onOpenAudioSettings() { - AudioSettingsDialog* dlg = AudioSettingsDialog::openDlg(this, emuThread->emuIsActive()); + AudioSettingsDialog* dlg = AudioSettingsDialog::openDlg(this, emuThread->emuIsActive(), emuThread); connect(emuThread, &EmuThread::syncVolumeLevel, dlg, &AudioSettingsDialog::onSyncVolumeLevel); connect(emuThread, &EmuThread::windowEmuStart, dlg, &AudioSettingsDialog::onConsoleReset); connect(dlg, &AudioSettingsDialog::updateAudioSettings, this, &MainWindow::onUpdateAudioSettings); @@ -2948,17 +2989,18 @@ void MainWindow::onPathSettingsFinished(int res) void MainWindow::onUpdateAudioSettings() { - NDS::SPU->SetInterpolation(Config::AudioInterp); + assert(emuThread->NDS != nullptr); + emuThread->NDS->SPU.SetInterpolation(Config::AudioInterp); if (Config::AudioBitDepth == 0) - NDS::SPU->SetDegrade10Bit(NDS::ConsoleType == 0); + emuThread->NDS->SPU.SetDegrade10Bit(emuThread->NDS->ConsoleType == 0); else - NDS::SPU->SetDegrade10Bit(Config::AudioBitDepth == 1); + emuThread->NDS->SPU.SetDegrade10Bit(Config::AudioBitDepth == 1); } void MainWindow::onAudioSettingsFinished(int res) { - AudioInOut::UpdateSettings(); + AudioInOut::UpdateSettings(*emuThread->NDS); } void MainWindow::onOpenMPSettings() @@ -3313,13 +3355,11 @@ int main(int argc, char** argv) #define SANITIZE(var, min, max) { var = std::clamp(var, min, max); } SANITIZE(Config::ConsoleType, 0, 1); - SANITIZE(Config::_3DRenderer, - 0, - 0 // Minimum, Software renderer - #ifdef OGLRENDERER_ENABLED - + 1 // OpenGL Renderer - #endif - ); +#ifdef OGLRENDERER_ENABLED + SANITIZE(Config::_3DRenderer, 0, 1); // 0 is the software renderer, 1 is the OpenGL renderer +#else + SANITIZE(Config::_3DRenderer, 0, 0); +#endif SANITIZE(Config::ScreenVSyncInterval, 1, 20); SANITIZE(Config::GL_ScaleFactor, 1, 16); SANITIZE(Config::AudioInterp, 0, 3); @@ -3333,7 +3373,6 @@ int main(int argc, char** argv) SANITIZE(Config::ScreenAspectBot, 0, AspectRatiosNum); #undef SANITIZE - AudioInOut::Init(); camStarted[0] = false; camStarted[1] = false; camManager[0] = new CameraManager(0, 640, 480, true); @@ -3341,7 +3380,6 @@ int main(int argc, char** argv) camManager[0]->setXFlip(Config::Camera[0].XFlip); camManager[1]->setXFlip(Config::Camera[1].XFlip); - ROMManager::EnableCheats(Config::EnableCheats != 0); Input::JoystickID = Config::JoystickID; Input::OpenJoystick(); @@ -3354,6 +3392,8 @@ int main(int argc, char** argv) emuThread->start(); emuThread->emuPause(); + AudioInOut::Init(emuThread); + ROMManager::EnableCheats(*emuThread->NDS, Config::EnableCheats != 0); AudioInOut::AudioMute(mainWindow); QObject::connect(&melon, &QApplication::applicationStateChanged, mainWindow, &MainWindow::onAppStateChanged); |