Skip to content

Commit

Permalink
memcard progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Niko committed Jul 4, 2024
1 parent e322899 commit d3910dd
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 18 deletions.
9 changes: 7 additions & 2 deletions ghidra/MEMCARD.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ undefined4 FUN_8003db54(void)
// MEMCARD_NewTask
// param1 slotIndex
// param2 name
// param3 pointer to memcard
// param3 pointer to profile
// param4 memcard size
undefined4 FUN_8003db98(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

Expand All @@ -487,7 +487,8 @@ undefined4 FUN_8003db98(undefined4 param_1,undefined4 param_2,undefined4 param_3
// MEMCARD_StringSet
FUN_8003d730(&DAT_800990a4,param_1,param_2);

// pointer to memcard 800992e4
// pointer to profile
// either Save Source, or Load Destination
DAT_8008d408 = param_3;

// reset to 8 attempts before quitting
Expand Down Expand Up @@ -1011,13 +1012,17 @@ undefined4 FUN_8003e344(undefined4 param_1,undefined4 param_2,
DAT_8008d8cc = DAT_8008d8cc & 0xfffffffb;
DAT_800857a3 = (byte)(DAT_8008d8d8 + param_5 * 2 + 0x1fff >> 0xd);
}

// clear icon
iVar2 = 0;
do {
iVar4 = iVar2 + 2;
(&DAT_800857a4)[iVar2] = 0x81;
(&DAT_800857a5)[iVar2] = 0x40;
iVar2 = iVar4;
} while (iVar4 < 0x40);

// file icon
cVar1 = *param_3;
iVar2 = 0;
while ((cVar1 != '\0' && (iVar2 < 0x40))) {
Expand Down
7 changes: 4 additions & 3 deletions ghidra/RefreshCard.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,16 @@ void FUN_80046b1c(undefined2 param_1,undefined2 param_2,undefined4 param_3,undef
// param1 always zero?
DAT_8009aa44 = param_1;

// Name of the save
// Save filename (BASCUS...)
DAT_8009aa48 = param_3;

// Save icon (crash/ghost/psyqhand)
DAT_8009aa4c = param_4;

// if reading, copy data to this address
// pointer to tape (not memcard)
DAT_8009aa50 = param_5;

// if reading, copy data of this size
// size (3E00)
DAT_8009aa54 = param_6;
return;
}
Expand Down
59 changes: 46 additions & 13 deletions include/regionsEXE.h
Original file line number Diff line number Diff line change
Expand Up @@ -2008,7 +2008,7 @@ struct Data
char data28_afterSlots[0x28];
#elif BUILD == UsaRetail || BUILD == EurRetail || BUILD == JpnRetail
// 0x800859F8
unsigned char data38[0x38];
unsigned char memcardIcon_HeaderSLOTS[0x38];
#endif

// Something changed in JPN
Expand Down Expand Up @@ -4726,10 +4726,12 @@ struct sData
struct Mempack mempack[3]; // each is 0x60 bytes

// 80099204
char fillerAfterMempack[0xE0];
char fillerAfterMempack[0xA0];

// 80099264 (time string at end of time trial race)
// 800992a4 (ghost profile related)

// 800992a4
char memcardIcon_HeaderGHOST[0x40];

// 800992E4
// literally every byte of memory card,
Expand Down Expand Up @@ -4762,16 +4764,47 @@ struct sData
} LoadSaveData[12];

// 0x8009AA30
char unk_Between_LoadSave_And_Ghosts[0x2c];

// related to memcard
// FUN_80046b1c handles 8009aa30 to 8009aa58

// [no hole]

// 8009aa56 -- Ghost Profile Index (load or save)?
// 8009aa58 -- Ghost Profile Index (load or save)?
// 8009aa5a -- Ghost Profile Index (load or save)?
int memcardUnk1;

// 0x8009AA34
int memcardUnk2;

// 8009aa38
int memcardSlot_copy1;

// 8009aa3c
int memcardSlot_copy2;

// 8009aa40
int memcardSlot_copy3;

// 8009aa44
int memcardSlot_copy4;

// 8009aa48
char* ghostProfile_fileName;

// 8009aa4c
char* ghostProfile_fileIconHeader;

// 8009aa50
// Points to Destination (ghost load)
// Points to Source (ghost save)
struct GhostHeader* ghostProfile_ptrGhostHeader;

// 8009aa54 -- Size (saving = 3E00)
short ghostProfile_size3E00;

// 8009aa56
// only set for one frame,
// then resets to -1
short ghostProfile_rowSelect;

// 8009aa58
short ghostProfile_indexSave;

// 8009aa5a
short ghostProfile_indexLoad;

// 8009aa5c
int numGhostProfilesSaved;
Expand Down

0 comments on commit d3910dd

Please sign in to comment.