mirror of https://github.com/AxioDL/metaforce.git
Implement "ENGAGE RIDLEY MOTHER FUCKER" NES password failsafe.
See https://youtu.be/cFNGtxs2BXc?t=481 for details.
This commit is contained in:
parent
4423250f36
commit
137c7424bb
|
@ -183,10 +183,12 @@ CNESEmulator::CNESEmulator()
|
||||||
|
|
||||||
void CNESEmulator::InitializeEmulator()
|
void CNESEmulator::InitializeEmulator()
|
||||||
{
|
{
|
||||||
emuNesROMsize = 0x20000;
|
nesPause = false;
|
||||||
emuNesROM = (uint8_t*)malloc(emuNesROMsize);
|
ppuDebugPauseFrame = false;
|
||||||
DecompressROM(m_nesEmuPBuf.get(), emuNesROM);
|
mainClock = 1;
|
||||||
m_nesEmuPBuf.reset();
|
apuClock = 1;
|
||||||
|
ppuClock = 1;
|
||||||
|
vrc7Clock = 1;
|
||||||
|
|
||||||
puts(VERSION_STRING);
|
puts(VERSION_STRING);
|
||||||
strcpy(window_title, VERSION_STRING);
|
strcpy(window_title, VERSION_STRING);
|
||||||
|
@ -229,7 +231,6 @@ void CNESEmulator::InitializeEmulator()
|
||||||
if(!mapperInit(mapper, prgROM, prgROMsize, emuPrgRAM, emuPrgRAMsize, chrROM, chrROMsize))
|
if(!mapperInit(mapper, prgROM, prgROMsize, emuPrgRAM, emuPrgRAMsize, chrROM, chrROMsize))
|
||||||
{
|
{
|
||||||
printf("Mapper init failed!\n");
|
printf("Mapper init failed!\n");
|
||||||
free(emuNesROM);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if DEBUG_LOAD_INFO
|
#if DEBUG_LOAD_INFO
|
||||||
|
@ -303,9 +304,7 @@ void CNESEmulator::DeinitializeEmulator()
|
||||||
fclose(save);
|
fclose(save);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(emuNesROM);
|
|
||||||
}
|
}
|
||||||
emuNesROM = NULL;
|
|
||||||
if(emuPrgRAM != NULL)
|
if(emuPrgRAM != NULL)
|
||||||
{
|
{
|
||||||
if(emuSaveEnabled)
|
if(emuSaveEnabled)
|
||||||
|
@ -329,6 +328,11 @@ CNESEmulator::~CNESEmulator()
|
||||||
{
|
{
|
||||||
if (EmulatorInst)
|
if (EmulatorInst)
|
||||||
DeinitializeEmulator();
|
DeinitializeEmulator();
|
||||||
|
if (emuNesROM)
|
||||||
|
{
|
||||||
|
free(emuNesROM);
|
||||||
|
emuNesROM = nullptr;
|
||||||
|
}
|
||||||
EmulatorConstructed = false;
|
EmulatorConstructed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -908,11 +912,22 @@ void CNESEmulator::Update()
|
||||||
if (m_dvdReq && m_dvdReq->IsComplete())
|
if (m_dvdReq && m_dvdReq->IsComplete())
|
||||||
{
|
{
|
||||||
m_dvdReq.reset();
|
m_dvdReq.reset();
|
||||||
|
emuNesROMsize = 0x20000;
|
||||||
|
emuNesROM = (uint8_t*)malloc(emuNesROMsize);
|
||||||
|
DecompressROM(m_nesEmuPBuf.get(), emuNesROM);
|
||||||
|
m_nesEmuPBuf.reset();
|
||||||
InitializeEmulator();
|
InitializeEmulator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (nesPause)
|
||||||
|
{
|
||||||
|
DeinitializeEmulator();
|
||||||
|
InitializeEmulator();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool gameOver = CheckForGameOver(ppuGetVRAM(), x21_passwordFromNES);
|
bool gameOver = CheckForGameOver(ppuGetVRAM(), x21_passwordFromNES);
|
||||||
x34_passwordEntryState = CheckForPasswordEntryScreen(ppuGetVRAM());
|
x34_passwordEntryState = CheckForPasswordEntryScreen(ppuGetVRAM());
|
||||||
if (x34_passwordEntryState == EPasswordEntryState::NotEntered && x38_passwordPending)
|
if (x34_passwordEntryState == EPasswordEntryState::NotEntered && x38_passwordPending)
|
||||||
|
|
Loading…
Reference in New Issue