add a flag to enable use of upper 4mb memory in DS mode

This commit is contained in:
Joshua Smith 2024-11-15 14:41:41 -05:00
parent 197634d411
commit 32caf387d6
5 changed files with 22 additions and 3 deletions

View File

@ -444,7 +444,7 @@ void NDS::Reset()
else else
{ {
ARM9ClockShift = 1; ARM9ClockShift = 1;
MainRAMMask = 0x3FFFFF; MainRAMMask = useExtendedMemory ? 0x7FFFFF : 0x3FFFFF;
} }
// has to be called before InitTimings // has to be called before InitTimings
// otherwise some PU settings are completely // otherwise some PU settings are completely
@ -4345,4 +4345,9 @@ void NDS::ARM7IOWrite32(u32 addr, u32 val)
Log(LogLevel::Debug, "unknown ARM7 IO write32 %08X %08X %08X\n", addr, val, ARM7.R[15]); Log(LogLevel::Debug, "unknown ARM7 IO write32 %08X %08X %08X\n", addr, val, ARM7.R[15]);
} }
void NDS::SetMemoryExtension(bool enabled)
{
useExtendedMemory = enabled;
}
} }

View File

@ -469,6 +469,8 @@ public: // TODO: Encapsulate the rest of these members
virtual void ARM7IOWrite16(u32 addr, u16 val); virtual void ARM7IOWrite16(u32 addr, u16 val);
virtual void ARM7IOWrite32(u32 addr, u32 val); virtual void ARM7IOWrite32(u32 addr, u32 val);
void SetMemoryExtension(bool enabled);
#ifdef JIT_ENABLED #ifdef JIT_ENABLED
[[nodiscard]] bool IsJITEnabled() const noexcept { return EnableJIT; } [[nodiscard]] bool IsJITEnabled() const noexcept { return EnableJIT; }
void SetJITArgs(std::optional<JITArgs> args) noexcept; void SetJITArgs(std::optional<JITArgs> args) noexcept;
@ -527,6 +529,7 @@ private:
void EnterSleepMode(); void EnterSleepMode();
template <CPUExecuteMode cpuMode> template <CPUExecuteMode cpuMode>
u32 RunFrame(); u32 RunFrame();
bool useExtendedMemory = false;
public: public:
NDS(NDSArgs&& args, void* userdata = nullptr) noexcept : NDS(std::move(args), 0, userdata) {} NDS(NDSArgs&& args, void* userdata = nullptr) noexcept : NDS(std::move(args), 0, userdata) {}

View File

@ -1353,6 +1353,7 @@ bool EmuInstance::updateConsole(UpdateConsoleNDSArgs&& _ndsargs, UpdateConsoleGB
nds = new NDS(std::move(ndsargs), this); nds = new NDS(std::move(ndsargs), this);
NDS::Current = nds; NDS::Current = nds;
nds->SetMemoryExtension(localCfg.GetBool("Debug.ExtendedMemory"));
nds->Reset(); nds->Reset();
loadRTCData(); loadRTCData();
//emuThread->updateVideoRenderer(); // not actually needed? //emuThread->updateVideoRenderer(); // not actually needed?

View File

@ -109,6 +109,8 @@ EmuSettingsDialog::EmuSettingsDialog(QWidget* parent) : QDialog(parent), ui(new
ui->cbGdbBOSA9->setDisabled(true); ui->cbGdbBOSA9->setDisabled(true);
#endif #endif
ui->cbDebugExtendedMem->setChecked(instcfg.GetBool("Debug.ExtendedMemory"));
on_chkEnableJIT_toggled(); on_chkEnableJIT_toggled();
on_cbGdbEnabled_toggled(); on_cbGdbEnabled_toggled();
on_chkExternalBIOS_toggled(); on_chkExternalBIOS_toggled();
@ -301,6 +303,7 @@ void EmuSettingsDialog::done(int r)
instcfg.SetBool("Gdb.ARM7.BreakOnStartup", ui->cbGdbBOSA7->isChecked()); instcfg.SetBool("Gdb.ARM7.BreakOnStartup", ui->cbGdbBOSA7->isChecked());
instcfg.SetBool("Gdb.ARM9.BreakOnStartup", ui->cbGdbBOSA9->isChecked()); instcfg.SetBool("Gdb.ARM9.BreakOnStartup", ui->cbGdbBOSA9->isChecked());
#endif #endif
instcfg.SetBool("Debug.ExtendedMemory", ui->cbDebugExtendedMem->isChecked());
cfg.SetInt("Emu.ConsoleType", ui->cbxConsoleType->currentIndex()); cfg.SetInt("Emu.ConsoleType", ui->cbxConsoleType->currentIndex());
cfg.SetBool("Emu.DirectBoot", ui->chkDirectBoot->isChecked()); cfg.SetBool("Emu.DirectBoot", ui->chkDirectBoot->isChecked());

View File

@ -580,7 +580,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="6" column="0">
<spacer name="verticalSpacer_4"> <spacer name="verticalSpacer_4">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -614,7 +614,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="7"> <item row="5" column="0" colspan="5">
<widget class="QCheckBox" name="cbDebugExtendedMem">
<property name="text">
<string>Enable extended main RAM (8Mb)</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="7">
<widget class="QLabel" name="label_18"> <widget class="QLabel" name="label_18">
<property name="text"> <property name="text">
<string>Note: melonDS must be restarted in order for these changes to have effect</string> <string>Note: melonDS must be restarted in order for these changes to have effect</string>