Script var buffer save/restore functions

This commit is contained in:
Mateon1 2024-09-19 23:21:29 +02:00
parent 0abc6f4c89
commit dcc7bd7115
No known key found for this signature in database
GPG Key ID: 6A6067123E4CAF6E
5 changed files with 9 additions and 7 deletions

View File

@ -78,8 +78,8 @@ u8 sub_8002658(s16 param_1);
s16 sub_8002694(u8 param_1);
bool8 sub_80026CC(s16 r0);
void sub_80026E8(s16 r0, bool8 r1);
bool8 sub_8002700(void *r0);
bool8 sub_8002718(u8 *r0);
bool8 SaveGlobalScriptVars(void *r0);
bool8 RestoreGlobalScriptVars(u8 *r0);
void sub_8002758(s32 r0);
u8 sub_800276C(void);

View File

@ -1,4 +1,6 @@
s/gGroundEnterLookupTable/gGroundEnterLookupTable/g
s/sub_80022F8/JudgeVarWithImmediate/g
s/sub_8002318/JudgeVarWithVar/g
s/sub_8002700/SaveGlobalScriptVars/g
s/sub_8002718/RestoreGlobalScriptVars/g

View File

@ -604,13 +604,13 @@ void sub_80026E8(s16 r0, bool8 r1)
UnlockFriendArea(sub_8002658(r0));
}
bool8 sub_8002700(void *r0)
bool8 SaveGlobalScriptVars(void *r0)
{
MemoryCopy8(r0, gScriptVarBuffer, 0x400);
return 1;
}
bool8 sub_8002718(u8 *r0)
bool8 RestoreGlobalScriptVars(u8 *r0)
{
struct ScriptVarPtr temp;
GetScriptVarRef(&temp, 0, 0);

View File

@ -218,7 +218,7 @@ u32 ReadSaveFromPak(u32 *a)
if (!saveStatus)
{
if (gUnknown_203B184 == NULL) {
if (!sub_8002718(playerSave->unk004)) {
if (!RestoreGlobalScriptVars(playerSave->unk004)) {
saveStatus = 4;
}
}
@ -343,7 +343,7 @@ u32 WriteSavetoPak(s32 *param_1, u32 param_2)
gameName = GetGameInternalName();
strncpy(playerSave->gameInternalName,gameName, ARRAY_COUNT(playerSave->gameInternalName));
if (gUnknown_203B184 == NULL) {
sub_8002700(playerSave->unk004);
SaveGlobalScriptVars(playerSave->unk004);
}
else {
MemoryCopy8(playerSave->unk004,gUnknown_203B184->unk04C,ARRAY_COUNT(playerSave->unk004));

View File

@ -4,7 +4,7 @@
gUnknown_2000A80: /* 2000A80 (GameLoop) */
.space 0x8
gScriptVarBuffer: /* 2000A88 (ThoroughlyResetScriptVars - sub_8002718) */
gScriptVarBuffer: /* 2000A88 (ThoroughlyResetScriptVars - RestoreGlobalScriptVars) */
.space 0x400
.include "src/memory.o"