move CartHomebrew init to reset, so it doesn't shit the bed if you change the config

This commit is contained in:
Arisotura 2022-01-03 12:29:14 +01:00
parent 46656eccda
commit 3abfa269ba
1 changed files with 22 additions and 14 deletions

View File

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