From 3abfa269ba0e40d45f8324325ec04a06858e6798 Mon Sep 17 00:00:00 2001 From: Arisotura Date: Mon, 3 Jan 2022 12:29:14 +0100 Subject: [PATCH] move CartHomebrew init to reset, so it doesn't shit the bed if you change the config --- src/NDSCart.cpp | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/NDSCart.cpp b/src/NDSCart.cpp index 1fe355bf..b78366b1 100644 --- a/src/NDSCart.cpp +++ b/src/NDSCart.cpp @@ -1212,8 +1212,30 @@ u8 CartRetailBT::SPIWrite(u8 val, u32 pos, bool last) CartHomebrew::CartHomebrew(u8* rom, u32 len, u32 chipid) : CartCommon(rom, len, chipid) { + SD = nullptr; +} + +CartHomebrew::~CartHomebrew() +{ + if (SD) + { + SD->Close(); + delete SD; + } +} + +void CartHomebrew::Reset() +{ + CartCommon::Reset(); + ReadOnly = Platform::GetConfigBool(Platform::DLDI_ReadOnly); + if (SD) + { + SD->Close(); + delete SD; + } + if (Platform::GetConfigBool(Platform::DLDI_Enable)) { std::string folderpath; @@ -1233,20 +1255,6 @@ CartHomebrew::CartHomebrew(u8* rom, u32 len, u32 chipid) : CartCommon(rom, len, SD = nullptr; } -CartHomebrew::~CartHomebrew() -{ - if (SD) - { - SD->Close(); - delete SD; - } -} - -void CartHomebrew::Reset() -{ - CartCommon::Reset(); -} - void CartHomebrew::SetupDirectBoot(std::string romname) { CartCommon::SetupDirectBoot(romname);