Add a structure for accessing save data (#69)

* Added  save data struct

Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
This commit is contained in:
Tyler McGavran
2021-11-29 00:44:46 -05:00
committed by GitHub
parent 6451db9e40
commit c55c360b71
4 changed files with 107 additions and 38 deletions
+42 -34
View File
@@ -1,10 +1,13 @@
#include <ultra64.h>
#include <macros.h>
#include <defines.h>
#include "global.h"
#include "common_structs.h"
u32 func_802A7B70(u16 x);
extern u32 D_8018EDB8;
extern u32 D_8018EDBC;
extern SaveData D_8018EB90;
void func_800AF9B0(void) {
D_8018EDB8 = func_802A7B70(7680);
@@ -3213,64 +3216,69 @@ GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B4DCC.s")
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
s32 func_800B4DF4(void *arg0) {
return ((arg0->unk1 << 8) + arg0->unk0 + (arg0->unk2 << 0x10)) & 0xFFFFFF;
// Convert time trial record from its little-endian form to big-endian
s32 func_800B4DF4(u8 *arg0) {
return (arg0[0] + (arg0[1] << 8) + (arg0[2] << 0x10)) & 0xFFFFFF;
}
#else
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B4DF4.s")
#endif
#ifdef MIPS_TO_C
#if 1
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800B4DF4(void *, s32); // extern
extern ? D_8018EB90;
extern s8 gCupSelection;
void func_800B4E24(s32 arg0) {
s32 temp_v0;
temp_v0 = (gCupSelection * 4) + gCourseSelection;
func_800B4DF4(((temp_v0 / 4) * 0x60) + ((temp_v0 % 4) * 0x18) + (arg0 * 3) + &D_8018EB90, arg0);
// Get a time trial record, infer course index
s32 func_800B4E24(s32 recordIndex) {
return func_800B4DF4(
D_8018EB90.allCourseTimeTrialRecords \
.cupRecords[(((gCupSelection * 4) + gCourseSelection) / 4)] \
.courseRecords[(((gCupSelection * 4) + gCourseSelection) % 4)] \
.records[recordIndex]
);
}
#else
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B4E24.s")
#endif
#ifdef MIPS_TO_C
#if 1
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800B4DF4(void *, s32); // extern
extern ? D_8018EB90;
void func_800B4EB4(s32 arg0, s32 arg1) {
func_800B4DF4(((arg1 / 4) * 0x60) + ((arg1 % 4) * 0x18) + (arg0 * 3) + &D_8018EB90, arg0);
// Get a time trial record, but take the course index as an argument
s32 func_800B4EB4(s32 recordIndex, s32 courseIndex) {
return func_800B4DF4(
D_8018EB90.allCourseTimeTrialRecords \
.cupRecords[(courseIndex / 4)] \
.courseRecords[(courseIndex % 4)] \
.records[recordIndex]
);
}
#else
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B4EB4.s")
#endif
#ifdef MIPS_TO_C
#if 1
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800B4DF4(void *); // extern
extern ? D_8018EB90;
extern s8 gCupSelection;
void func_800B4F2C(void) {
s32 temp_v0;
temp_v0 = (gCupSelection * 4) + gCourseSelection;
func_800B4DF4(((temp_v0 / 4) * 0x60) + ((temp_v0 % 4) * 0x18) + 0xF + &D_8018EB90);
// Get Best Lap record of the inferred course index
s32 func_800B4F2C(void) {
return func_800B4DF4(
D_8018EB90.allCourseTimeTrialRecords \
.cupRecords[(((gCupSelection * 4) + gCourseSelection) / 4)] \
.courseRecords[(((gCupSelection * 4) + gCourseSelection) % 4)] \
.records[TIME_TRIAL_1LAP_RECORD]
);
}
#else
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B4F2C.s")
#endif
#ifdef MIPS_TO_C
#if 1
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_800B4DF4(void *, s32); // extern
extern ? D_8018EB90;
void func_800B4FB0(s32 arg0) {
func_800B4DF4(((arg0 / 4) * 0x60) + ((arg0 % 4) * 0x18) + 0xF + &D_8018EB90, arg0);
// Get the best single lap time record of the given course index
s32 func_800B4FB0(s32 courseIndex) {
return func_800B4DF4(
D_8018EB90.allCourseTimeTrialRecords \
.cupRecords[(courseIndex / 4)] \
.courseRecords[(courseIndex % 4)] \
.records[TIME_TRIAL_1LAP_RECORD]
);
}
#else
GLOBAL_ASM("asm/non_matchings/code_800AF9B0/func_800B4FB0.s")