summaryrefslogtreecommitdiff
path: root/src/save.c
diff options
context:
space:
mode:
authoroctorock <79596758+octorock@users.noreply.github.com>2021-06-16 21:11:01 +0200
committeroctorock <79596758+octorock@users.noreply.github.com>2021-06-23 08:30:45 +0200
commitb0510402aba80e534c85ba29aa8ffa6d7c5a2c17 (patch)
tree18d555f7aabc3848c388bf28f9bd0f0bd508ca8b /src/save.c
parent8621bc9329e7c4989ce6e391a06867638a7b23e7 (diff)
Add DEMO variant
Diffstat (limited to 'src/save.c')
-rw-r--r--src/save.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/src/save.c b/src/save.c
index 749b6730..8b751914 100644
--- a/src/save.c
+++ b/src/save.c
@@ -41,10 +41,20 @@ u32 DataCompare(u32 address, const void* data, u32 size);
const u16 gUnk_0811E454[] = { 0x0, 0x0, 0x100, 0x200, 0x300, 0x400, 0x500,
0x5C0, 0x680, 0x740, 0x800, 0x8C0, 0x9C0, 0xA80 };
-const char gUnk_0811E470[6] = "LINK";
+const char gUnk_0811E470[4] = "LINK";
+
+#ifdef DEMO
+const u8 unknown[] = { 0x0, 0x0f, 0x0a, 0x0a, 0x0f, 0x0f, 0x0f, 0x08, 0x05, 0x05, 0x00, 0x00 };
+#else
+const u8 padding[2] = {0,0};
+#endif
static SaveResult (*const sSaveHandlers[])(u32) = { HandleSaveInit, HandleSaveInProgress, HandleSaveDone };
+
+#ifdef DEMO
+asm(".incbin \"baserom_demo.gba\", 0x11e010, 0xf0c"); // @nocheckin
+#else
static const char sSignatureLong[32] = "AGBZELDA:THE MINISH CAP:ZELDA 5";
// Save file is untouched
@@ -60,7 +70,7 @@ const SaveFileEEPROMAddresses gSaveFileEEPROMAddresses[] = { { 0x500, 0x30, 0x10
{ 0x20, 0, 0, 0, 0x1000 },
{ 0x20, 0x60, 0x1060, 0xf80, 0x1f80 },
{ 0x8, 0xfa0, 0x1fa0, 0xfa0, 0x1fa0 } };
-
+#endif
void sub_0807CD9C() {
sub_080530C8();
}
@@ -122,7 +132,12 @@ SaveResult HandleSaveDone(u32 arg0) {
return result;
}
+
u32 InitSaveData(void) {
+#ifdef DEMO
+ CpuSet(NULL,&gSave,0x4b4);
+ return 1;
+#else
const SaveFileEEPROMAddresses* eepromAddresses;
u32 error;
@@ -147,40 +162,71 @@ u32 InitSaveData(void) {
DataWrite(eepromAddresses->address1, sSignatureLong, eepromAddresses->size);
}
return 1;
+#endif
}
u32 WriteSaveFile(u32 index, SaveFile* saveFile) {
+ #ifdef DEMO
+ return 1;
+ #else
return DataDoubleWriteWithStatus(index, saveFile);
+ #endif
}
u32 Write_02000000(struct_02000000* arg0) {
+ #ifdef DEMO
+ return 1;
+ #else
return DataDoubleWriteWithStatus(3, arg0);
+ #endif
}
u32 sub_0807CF1C(u8* arg0) {
+ #ifdef DEMO
+ return 1;
+ #else
return DataDoubleWriteWithStatus(5, arg0);
+ #endif
}
s32 ReadSaveFile(u32 index, SaveFile* saveFile) {
+ #ifdef DEMO
+ return 1;
+ #else
return DataDoubleReadWithStatus(index, saveFile);
+ #endif
}
u32 Read_02000000(struct_02000000* arg0) {
+ #ifdef DEMO
+ return 0;
+ #else
return DataDoubleReadWithStatus(3, arg0);
+ #endif
}
u32 sub_0807CF3C(u8* arg0) {
+ #ifdef DEMO
+ return 0;
+ #else
return DataDoubleReadWithStatus(5, arg0);
+ #endif
}
+
+
void SetFileStatusDeleted(u32 index) {
+ #ifndef DEMO
const SaveFileEEPROMAddresses* eepromAddresses;
eepromAddresses = GetSaveFileEEPROMAddresses(index);
WriteSaveFileStatus(eepromAddresses->checksum2, &sSaveDescDeleted);
WriteSaveFileStatus(eepromAddresses->checksum1, &sSaveDescDeleted);
+ #endif
}
+
+#ifndef DEMO
void SetFileStatusInit(u32 index) {
const SaveFileEEPROMAddresses* eepromAddresses;
const SaveFileStatus* fileStatus;
@@ -406,3 +452,4 @@ bool32 DataCompare(u32 address, const void* data, u32 size) {
}
return TRUE;
}
+#endif \ No newline at end of file