mirror of
https://github.com/SourMesen/Mesen2.git
synced 2025-04-02 10:21:44 -04:00
SGB: Prevent freeze/lock up when resetting a MBC3 game that has a RTC clock
This commit is contained in:
parent
8d190963da
commit
53f17745d7
3 changed files with 12 additions and 3 deletions
|
@ -26,6 +26,7 @@ public:
|
|||
void InitCart() override
|
||||
{
|
||||
_memoryManager->MapRegisters(0x0000, 0x7FFF, RegisterAccess::Write);
|
||||
_rtc.Init();
|
||||
}
|
||||
|
||||
void RefreshMappings() override
|
||||
|
|
|
@ -26,8 +26,7 @@ public:
|
|||
GbMbc3Rtc(Emulator* emu)
|
||||
{
|
||||
_emu = emu;
|
||||
_lastMasterClock = 0;
|
||||
LoadBattery();
|
||||
Init();
|
||||
}
|
||||
|
||||
~GbMbc3Rtc()
|
||||
|
@ -35,6 +34,12 @@ public:
|
|||
SaveBattery();
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
_lastMasterClock = 0;
|
||||
LoadBattery();
|
||||
}
|
||||
|
||||
void LoadBattery()
|
||||
{
|
||||
vector<uint8_t> rtcData = _emu->GetBatteryManager()->LoadBattery(".rtc");
|
||||
|
|
|
@ -46,8 +46,11 @@ SuperGameboy::~SuperGameboy()
|
|||
|
||||
void SuperGameboy::Reset()
|
||||
{
|
||||
_control = 0;
|
||||
_control = 0x01;
|
||||
_effectiveClockRate = 0;
|
||||
_clockOffset = 0;
|
||||
_resetClock = 0;
|
||||
UpdateClockRatio();
|
||||
|
||||
memset(_input, 0, sizeof(_input));
|
||||
_inputIndex = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue