diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-03-23 23:55:22 +0100 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-03-23 23:55:22 +0100 |
commit | f7ac0090f0a9252e539c61c4fd9beff0b247658c (patch) | |
tree | ac2968824558978a50a790873431649537806b83 /src | |
parent | 4f5eb6caa0ea719f3590fa6a1bd326a7ddd3a175 (diff) |
fix bugs
Diffstat (limited to 'src')
-rw-r--r-- | src/NDSCart.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/NDSCart.cpp b/src/NDSCart.cpp index 615390b..386af21 100644 --- a/src/NDSCart.cpp +++ b/src/NDSCart.cpp @@ -365,12 +365,7 @@ void Write_Flash(u8 val, bool islast) } else { - // CHECKME: does Flash also wraparound when the address is out of bounds? - if (Addr >= SRAMLength) - Data = 0; - else - Data = SRAM[Addr]; - + Data = SRAM[Addr & (SRAMLength-1)]; Addr++; } break; @@ -384,9 +379,7 @@ void Write_Flash(u8 val, bool islast) } else { - if (Addr < SRAMLength) - SRAM[Addr] = val; - + SRAM[Addr & (SRAMLength-1)] = val; Addr++; } break; @@ -454,7 +447,7 @@ void Write(u8 val, u32 hold) break; } - if (islast && (CurCmd == 0x02 || CurCmd == 0x0A)) + if (islast && (CurCmd == 0x02 || CurCmd == 0x0A) && (SRAMLength > 0)) { FILE* f = fopen(SRAMPath, "wb"); if (f) |