diff --git a/src/NDS.cpp b/src/NDS.cpp index 2e80113a..b5c8ee96 100644 --- a/src/NDS.cpp +++ b/src/NDS.cpp @@ -904,7 +904,8 @@ bool DoSavestate(Savestate* file) ARM7->DoSavestate(file); NDSCart::DoSavestate(file); - GBACart::DoSavestate(file); + if (ConsoleType == 0) + GBACart::DoSavestate(file); GPU::DoSavestate(file); SPU::DoSavestate(file); SPI::DoSavestate(file); diff --git a/src/frontend/SharedConfig.h b/src/frontend/SharedConfig.h deleted file mode 100644 index 01c8d699..00000000 --- a/src/frontend/SharedConfig.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright 2016-2021 Arisotura - - This file is part of melonDS. - - melonDS is free software: you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. - - melonDS is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with melonDS. If not, see http://www.gnu.org/licenses/. -*/ - -#ifndef SHAREDCONFIG_H -#define SHAREDCONFIG_H - -#include - -namespace Config -{ - -extern int ConsoleType; -extern bool DirectBoot; -extern bool SavestateRelocSRAM; - -extern bool ExternalBIOSEnable; - -extern std::string BIOS9Path; -extern std::string BIOS7Path; -extern std::string FirmwarePath; - -extern std::string DSiBIOS9Path; -extern std::string DSiBIOS7Path; -extern std::string DSiFirmwarePath; -extern std::string DSiNANDPath; - -} - -#endif diff --git a/src/frontend/qt_sdl/CMakeLists.txt b/src/frontend/qt_sdl/CMakeLists.txt index 047aa93e..b1dfd450 100644 --- a/src/frontend/qt_sdl/CMakeLists.txt +++ b/src/frontend/qt_sdl/CMakeLists.txt @@ -35,7 +35,6 @@ SET(SOURCES_QT_SDL ../Util_Audio.cpp ../FrontendUtil.h ../mic_blow.h - ../SharedConfig.h ${CMAKE_SOURCE_DIR}/res/melon.qrc ) diff --git a/src/frontend/qt_sdl/ROMManager.cpp b/src/frontend/qt_sdl/ROMManager.cpp index a0871b78..2fa811ed 100644 --- a/src/frontend/qt_sdl/ROMManager.cpp +++ b/src/frontend/qt_sdl/ROMManager.cpp @@ -408,6 +408,7 @@ ARCodeFile* GetCheatFile() void Reset() { NDS::SetConsoleType(Config::ConsoleType); + if (Config::ConsoleType == 1) EjectGBACart(); NDS::Reset(); if (!BaseROMName.empty()) @@ -596,6 +597,7 @@ QString CartLabel() bool LoadGBAROM(QStringList filepath) { + if (Config::ConsoleType == 1) return false; if (filepath.empty()) return false; u8* filedata; @@ -700,6 +702,8 @@ bool LoadGBAROM(QStringList filepath) void LoadGBAAddon(int type) { + if (Config::ConsoleType == 1) return; + if (GBASave) delete GBASave; GBASave = nullptr; @@ -731,10 +735,20 @@ bool GBACartInserted() QString GBACartLabel() { + if (Config::ConsoleType == 1) return "none (DSi)"; + switch (GBACartType) { case 0: - return "it's a ROM (TODO)"; + { + QString ret = QString::fromStdString(BaseGBAROMName); + + int maxlen = 32; + if (ret.length() > maxlen) + ret = ret.left(maxlen-6) + "..." + ret.right(3); + + return ret; + } case NDS::GBAAddon_RAMExpansion: return "Memory expansion"; diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index 6766928f..96c33a6c 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -1619,6 +1619,13 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) actEjectCart->setEnabled(false); actEjectGBACart->setEnabled(false); + if (Config::ConsoleType == 1) + { + actInsertGBACart->setEnabled(false); + for (int i = 0; i < 1; i++) + actInsertGBAAddon[i]->setEnabled(false); + } + for (int i = 0; i < 9; i++) { actSaveState[i]->setEnabled(false); @@ -2037,7 +2044,7 @@ void MainWindow::updateCartInserted(bool gba) bool inserted; if (gba) { - inserted = ROMManager::GBACartInserted(); + inserted = ROMManager::GBACartInserted() && (Config::ConsoleType == 0); actCurrentGBACart->setText("GBA slot: " + ROMManager::GBACartLabel()); actEjectGBACart->setEnabled(inserted); } @@ -2541,9 +2548,26 @@ void MainWindow::onEmuSettingsDialogFinished(int res) { emuThread->emuUnpause(); + if (Config::ConsoleType == 1) + { + actInsertGBACart->setEnabled(false); + for (int i = 0; i < 1; i++) + actInsertGBAAddon[i]->setEnabled(false); + actEjectGBACart->setEnabled(false); + } + else + { + actInsertGBACart->setEnabled(true); + for (int i = 0; i < 1; i++) + actInsertGBAAddon[i]->setEnabled(true); + actEjectGBACart->setEnabled(ROMManager::GBACartInserted()); + } + if (EmuSettingsDialog::needsReset) onReset(); + actCurrentGBACart->setText("GBA slot: " + ROMManager::GBACartLabel()); + if (!RunningSomething) actTitleManager->setEnabled(!Config::DSiNANDPath.empty()); }