aboutsummaryrefslogtreecommitdiff
path: root/src/NDSCart.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/NDSCart.cpp')
-rw-r--r--src/NDSCart.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/NDSCart.cpp b/src/NDSCart.cpp
index ab2a5f9..44d6ca9 100644
--- a/src/NDSCart.cpp
+++ b/src/NDSCart.cpp
@@ -36,7 +36,7 @@ namespace NDSCart_SRAM
u8* SRAM;
u32 SRAMLength;
-char SRAMPath[256];
+char SRAMPath[1024];
void (*WriteFunc)(u8 val, bool islast);
@@ -148,8 +148,8 @@ void LoadSave(const char* path)
Discover_AddrLength = 0x7FFFFFFF;
Discover_LikelySize = 0;
- strncpy(SRAMPath, path, 255);
- SRAMPath[255] = '\0';
+ strncpy(SRAMPath, path, 1023);
+ SRAMPath[1023] = '\0';
FILE* f = melon_fopen(path, "rb");
if (f)
@@ -196,6 +196,22 @@ void LoadSave(const char* path)
StatusReg = 0x00;
}
+void RelocateSave(const char* path)
+{
+ strncpy(SRAMPath, path, 1023);
+ SRAMPath[1023] = '\0';
+
+ FILE* f = melon_fopen(path, "wb");
+ if (!f)
+ {
+ printf("NDSCart_SRAM::RelocateSave: failed to create new file. fuck\n");
+ return;
+ }
+
+ fwrite(SRAM, SRAMLength, 1, f);
+ fclose(f);
+}
+
u8 Read()
{
return Data;
@@ -1127,6 +1143,12 @@ bool LoadROM(const char* path, const char* sram, bool direct)
return true;
}
+void RelocateSave(const char* path)
+{
+ // herp derp
+ NDSCart_SRAM::RelocateSave(path);
+}
+
void ReadROM(u32 addr, u32 len, u32 offset)
{
if (!CartInserted) return;