aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2018-12-31 14:17:58 +0100
committerStapleButter <thetotalworm@gmail.com>2018-12-31 14:17:58 +0100
commit786abe63cbaf6d2dcfe40d60ac78fe9d7e3443ed (patch)
tree7f59076169eedd8fe0991d48f901a2a5ab11fca6 /src
parenta4593a8f586228ca8738489aa16c56945e3e1350 (diff)
add support for 128K EEPROM (Pokémon Mystery Dungeon - Explorers of Sky)
fixes #344 also, fix save type for Puzzler World (plain old 8K EEPROM. not sure why the Wood entry was different)
Diffstat (limited to 'src')
-rw-r--r--src/NDSCart.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/NDSCart.cpp b/src/NDSCart.cpp
index 2572fe8..b0cc378 100644
--- a/src/NDSCart.cpp
+++ b/src/NDSCart.cpp
@@ -135,7 +135,7 @@ void LoadSave(const char* path, u32 type)
else
{
if (type > 8) type = 0;
- int sramlen[] = {0, 512, 8192, 65536, 256*1024, 512*1024, 1024*1024, 8192*1024, 32768*1024};
+ int sramlen[] = {0, 512, 8192, 65536, 128*1024, 256*1024, 512*1024, 1024*1024, 8192*1024, 32768*1024};
SRAMLength = sramlen[type];
if (SRAMLength)
@@ -149,7 +149,8 @@ void LoadSave(const char* path, u32 type)
{
case 512: WriteFunc = Write_EEPROMTiny; break;
case 8192:
- case 65536: WriteFunc = Write_EEPROM; break;
+ case 65536:
+ case 128*1024: WriteFunc = Write_EEPROM; break;
case 256*1024:
case 512*1024:
case 1024*1024:
@@ -242,10 +243,13 @@ void Write_EEPROMTiny(u8 val, bool islast)
void Write_EEPROM(u8 val, bool islast)
{
+ u32 addrsize = 2;
+ if (SRAMLength > 65536) addrsize++;
+
switch (CurCmd)
{
case 0x02:
- if (DataPos < 2)
+ if (DataPos < addrsize)
{
Addr <<= 8;
Addr |= val;
@@ -259,7 +263,7 @@ void Write_EEPROM(u8 val, bool islast)
break;
case 0x03:
- if (DataPos < 2)
+ if (DataPos < addrsize)
{
Addr <<= 8;
Addr |= val;