Skip to content

Commit 3dcbf84

Browse files
committed
memcard progress
1 parent 5d4f5d3 commit 3dcbf84

File tree

11 files changed

+65
-70
lines changed

11 files changed

+65
-70
lines changed
File renamed without changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <common.h>
2+
3+
char* DECOMP_MEMCARD_FindFirstGhost(int slotIdx, char *srcString)
4+
{
5+
if (sdata->memcard_stage != MC_STAGE_IDLE)
6+
{
7+
return 0;
8+
}
9+
10+
struct DIRENTRY *firstEntry;
11+
struct DIRENTRY someEntry;
12+
MEMCARD_StringSet(sdata->s_bu00_BASCUS_94426_slots, slotIdx, srcString);
13+
14+
firstEntry = firstfile(sdata->s_bu00_BASCUS_94426_slots, &someEntry);
15+
if (firstEntry == 0)
16+
return 0;
17+
18+
sdata->memcard_stage = MC_STAGE_GHOST_FOUND;
19+
strcpy(&sdata->s_memcardFindGhostFile[0], &firstEntry->name[0]);
20+
return &sdata->s_memcardFindGhostFile[0];
21+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <common.h>
2+
3+
char* DECOMP_MEMCARD_FindNextGhost(void)
4+
{
5+
if (sdata->memcard_stage != MC_STAGE_GHOST_FOUND)
6+
{
7+
return 0;
8+
}
9+
10+
struct DIRENTRY *nextEntry;
11+
struct DIRENTRY someEntry;
12+
13+
nextEntry == nextfile(&someEntry);
14+
if (nextEntry == 0)
15+
{
16+
sdata->memcard_stage = MC_STAGE_IDLE;
17+
return 0;
18+
}
19+
20+
strcpy(&sdata->s_memcardFindGhostFile[0], &someEntry.name[0]);
21+
return &sdata->s_memcardFindGhostFile[0];
22+
}
File renamed without changes.

decompile/WorkInProgress/src/MEMCARD/MEMCARD_Save.c renamed to decompile/WorkInProgress/src/MEMCARD/MEMCARD_20_Save.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ uint8_t MEMCARD_Save(int slotIdx, char *name,
7878
return MEMCARD_WriteFile(0, data.memcardIcon_PsyqHand, sdata->memcardIconSize);
7979
}
8080

81-
MEMCARD_CloseFile(0);
81+
MEMCARD_CloseFile();
8282
return MC_RETURN_FULL;
8383
}

decompile/WorkInProgress/src/MEMCARD/MEMCARD_FindFirstGhost.c

Lines changed: 0 additions & 28 deletions
This file was deleted.

decompile/WorkInProgress/src/MEMCARD/MEMCARD_FindNextGhost.c

Lines changed: 0 additions & 27 deletions
This file was deleted.

decompile/buildList.txt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ common, 231, RB_Hazard_CollLevInst, 0x0, General/2
107107
common, 231, RB_Hazard_InterpolateValue, 0x0, General/231/231_023_RB_Hazard_InterpolateValue.c
108108
common, 231, RB_MovingExplosive_ThTick, 0x0, General/231/231_024_RB_MovingExplosive_ThTick.c
109109
common, 231, RB_MovingExplosive_Explode, 0x0, General/231/231_025_RB_MovingExplosive_Explode.c
110+
111+
// TODO: BUGGED
110112
common, 231, RB_Warpball_FadeAway, 0x0, General/231/231_026_RB_Warpball_FadeAway.c
111113
common, 231, RB_Warpball_Death, 0x0, General/231/231_027_RB_Warpball_Death.c
112114
//common, 231, RB_Warpball_NewPathNode, 0x0, General/231/231_028_RB_Warpball_NewPathNode.c //TODO
@@ -116,6 +118,7 @@ common, 231, RB_Warpball_Start, 0x0, General/2
116118
common, 231, RB_Warpball_SeekDriver, 0x0, General/231/231_032_RB_Warpball_SeekDriver.c
117119
common, 231, RB_Warpball_TurnAround, 0x0, General/231/231_033_RB_Warpball_TurnAround.c
118120
//common, 231, RB_Warpball_ThTick, 0x0, General/231/231_034_RB_Warpball_ThTick.c //TODO
121+
119122
common, 231, RB_MaskWeapon_FadeAway, 0x0, General/231/231_035_RB_MaskWeapon_FadeAway.c
120123
common, 231, RB_MaskWeapon_ThTick, 0x0, General/231/231_036_RB_MaskWeapon_ThTick.c
121124
common, 231, RB_ShieldDark_ThTick_Pop, 0x0, General/231/231_037_RB_ShieldDark_ThTick_Pop.c
@@ -966,21 +969,24 @@ common, exe, MEMCARD_ReadFile, 0x0, General/MEMCARD/MEMCARD
966969
common, exe, MEMCARD_WriteFile, 0x0, General/MEMCARD/MEMCARD_15_WriteFile.c
967970
common, exe, MEMCARD_GetFreeBytes, 0x0, General/MEMCARD/MEMCARD_16_GetFreeBytes.c
968971
// unknown 8003ddac
969-
//common, exe, MEMCARD_GetInfo, 0x0, General/MEMCARD/MEMCARD_18_GetInfo.c //TODO
970-
//common, exe, MEMCARD_Load, 0x0, General/MEMCARD/MEMCARD_19_Load.c //TODO
971-
//common, exe, MEMCARD_Save, 0x0, General/MEMCARD/MEMCARD_20_Save.c //TODO
972+
common, exe, MEMCARD_GetInfo, 0x0, General/MEMCARD/MEMCARD_18_GetInfo.c
973+
974+
// WIP
975+
//common, exe, MEMCARD_Load, 0x0, General/MEMCARD/MEMCARD_19_Load.c
976+
//common, exe, MEMCARD_Save, 0x0, General/MEMCARD/MEMCARD_20_Save.c
977+
972978
common, exe, MEMCARD_Format, 0x0, General/MEMCARD/MEMCARD_21_Format.c
973979
common, exe, MEMCARD_IsFile, 0x0, General/MEMCARD/MEMCARD_22_IsFile.c
974-
//common, exe, MEMCARD_FindFirstGhost, 0x0, General/MEMCARD/MEMCARD_23_FindFirstGhost.c //bugged
975-
//common, exe, MEMCARD_FindNextGhost, 0x0, General/MEMCARD/MEMCARD_24_FindNextGhost.c //bugged
980+
common, exe, MEMCARD_FindFirstGhost, 0x0, General/MEMCARD/MEMCARD_23_FindFirstGhost.c
981+
common, exe, MEMCARD_FindNextGhost, 0x0, General/MEMCARD/MEMCARD_24_FindNextGhost.c
976982
common, exe, MEMCARD_EraseFile, 0x0, General/MEMCARD/MEMCARD_25_EraseFile.c
977983

978984
// ====================================================================================================================
979985
// MEMPACK (done)
980986
// ====================================================================================================================
981987
common, exe, MEMPACK_Init, 0x0, General/MEMPACK/MEMPACK_00_Init.c
982988
common, exe, MEMPACK_SwapPacks, 0x0, General/MEMPACK/MEMPACK_01_SwapPacks.c
983-
common, exe, MEMPACK_NewPack, 0x0, General/MEMPACK/MEMPACK_02_NewPack.c
989+
common, exe, MEMPACK_NewPack, 0x0, General/MEMPACK/MEMPACK_02_NewPack.c
984990
common, exe, MEMPACK_GetFreeBytes, 0x0, General/MEMPACK/MEMPACK_03_GetFreeBytes.c
985991
common, exe, MEMPACK_AllocMem, 0x0, General/MEMPACK/MEMPACK_04_AllocMem.c
986992
common, exe, MEMPACK_AllocHighMem, 0x0, General/MEMPACK/MEMPACK_05_AllocHighMem.c

ghidra/MEMCARD.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ undefined4 FUN_8003db98(undefined4 param_1,undefined4 param_2,undefined4 param_3
501501
}
502502

503503

504-
// close memcard file
504+
// MEMCARD_CloseFile
505505
void FUN_8003dbf8(void)
506506
{
507507
// if file is open
@@ -535,7 +535,7 @@ undefined4 FUN_8003dc30(long param_1,long param_2)
535535
return 7;
536536
}
537537

538-
// close memcard file
538+
// MEMCARD_CloseFile
539539
FUN_8003dbf8();
540540

541541
// MC_RETURN TIMEOUT
@@ -560,7 +560,7 @@ undefined4 FUN_8003dc9c(long param_1,void *param_2,long param_3)
560560
return 7;
561561
}
562562

563-
// close memcard file
563+
// MEMCARD_CloseFile
564564
FUN_8003dbf8();
565565

566566
// MC_RETURN TIMEOUT
@@ -845,7 +845,7 @@ int FUN_8003ddac(void)
845845
}
846846
}
847847
LAB_8003e1fc:
848-
// close memcard file
848+
// MEMCARD_CloseFile
849849
FUN_8003dbf8();
850850
break;
851851
default:
@@ -862,7 +862,7 @@ int FUN_8003ddac(void)
862862
{
863863
if ((DAT_8008d404 != 9) && ((10 < DAT_8008d404 || ((DAT_8008d8cc & 4) != 0))))
864864
{
865-
// close memcard file
865+
// MEMCARD_CloseFile
866866
FUN_8003dbf8();
867867

868868
// MEMCARD_GetFreeBytes
@@ -995,7 +995,7 @@ undefined4 FUN_8003e29c(param1, param2, param3, param4, param5)
995995
// if open failed
996996
if (DAT_8008d40c == -1)
997997
{
998-
// close memcard file
998+
// MEMCARD_CloseFile
999999
FUN_8003dbf8();
10001000

10011001
// MC_RETURN_NODATA
@@ -1115,7 +1115,7 @@ undefined4 FUN_8003e344(undefined4 param_1,undefined4 param_2,
11151115
return uVar3;
11161116
}
11171117

1118-
// close memcard file
1118+
// MEMCARD_CloseFile
11191119
FUN_8003dbf8(0);
11201120

11211121
// MC_RETURN_FULL

ghidra/RefreshCard.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ uint FUN_80046a90(short param_1)
6565
return uVar1;
6666
}
6767

68-
68+
// RefreshCard_NextMemcardAction
6969
// param1 - memcardSlot
7070
// param2 - action
7171
// param3 - filename

0 commit comments

Comments
 (0)