remove unneeded file. make sure you can't insert a GBA cart in DSi mode.

This commit is contained in:
Arisotura 2022-01-07 12:10:06 +01:00
parent f577b45eb9
commit 145c1639fb
5 changed files with 42 additions and 48 deletions

View File

@ -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);

View File

@ -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 <string>
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

View File

@ -35,7 +35,6 @@ SET(SOURCES_QT_SDL
../Util_Audio.cpp
../FrontendUtil.h
../mic_blow.h
../SharedConfig.h
${CMAKE_SOURCE_DIR}/res/melon.qrc
)

View File

@ -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";

View File

@ -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());
}