mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 06:10:03 -06:00
Eject GBA cartridges on stop from the UI
This commit is contained in:
@ -145,9 +145,9 @@ void LoadSave(const char* path)
|
|||||||
}
|
}
|
||||||
else if (SRAMType == S_FLASH1M)
|
else if (SRAMType == S_FLASH1M)
|
||||||
{
|
{
|
||||||
// Macronix 128K chip
|
// Sanyo 128K chip
|
||||||
SRAMFlash.device = 0x09;
|
SRAMFlash.device = 0x13;
|
||||||
SRAMFlash.manufacturer = 0xC2;
|
SRAMFlash.manufacturer = 0x62;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,30 @@ void RelocateSave(const char* path, bool write)
|
|||||||
|
|
||||||
u8 Read_Flash(u32 addr)
|
u8 Read_Flash(u32 addr)
|
||||||
{
|
{
|
||||||
// TODO: pokemen
|
if (SRAMFlash.cmd == 0) // no cmd
|
||||||
|
{
|
||||||
|
return *(u8*)&SRAM[addr + 0x10000 * SRAMFlash.bank];
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO properly keep track of command sequences,
|
||||||
|
// and deny unauthorized writes
|
||||||
|
switch (SRAMFlash.cmd)
|
||||||
|
{
|
||||||
|
case 0x90: // chip ID
|
||||||
|
if (addr == 0x0A000000) return SRAMFlash.manufacturer;
|
||||||
|
if (addr == 0x0A000001) return SRAMFlash.device;
|
||||||
|
break;
|
||||||
|
case 0xF0: // terminate command (TODO: break if non-Macronix chip and not at the end of an ID call?)
|
||||||
|
SRAMFlash.state = 0;
|
||||||
|
SRAMFlash.cmd = 0;
|
||||||
|
break;
|
||||||
|
case 0xB0: // bank switching (128K only)
|
||||||
|
break; // we don't track the request for now
|
||||||
|
default:
|
||||||
|
printf("GBACart_SRAM::Read_Flash: unknown command 0x%02X @ 0x%08X\n", SRAMFlash.cmd, addr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1674,6 +1674,9 @@ void Stop(bool internal)
|
|||||||
while (EmuStatus != 2);
|
while (EmuStatus != 2);
|
||||||
RunningSomething = false;
|
RunningSomething = false;
|
||||||
|
|
||||||
|
// eject any inserted GBA cartridge
|
||||||
|
ROMPath[1][0] = '\0';
|
||||||
|
|
||||||
uiWindowSetTitle(MainWindow, "melonDS " MELONDS_VERSION);
|
uiWindowSetTitle(MainWindow, "melonDS " MELONDS_VERSION);
|
||||||
|
|
||||||
for (int i = 0; i < 9; i++) uiMenuItemDisable(MenuItem_SaveStateSlot[i]);
|
for (int i = 0; i < 9; i++) uiMenuItemDisable(MenuItem_SaveStateSlot[i]);
|
||||||
|
Reference in New Issue
Block a user