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
+50
View File
@@ -297,6 +297,56 @@ typedef struct {
/* 0x0DD4 */ s16 unk_DD4;
} Player; // size = 0xDD8
typedef struct {
// 6 little endian 3-byte records.
// When converted to big endian the bottom 5 nibbles can be interpreted as the centisecond count for that record.
// The top nibble is the character ID of the charcter used to set that record
// The first 5 records are the top 5 3-lap records
// The 6th record is the best 1-lap record
u8 records[6][3];
// It's unknown what these bytes are used for
// Byte 1 might be an indicator that there is a ghost available for that course
u8 unknownBytes[6];
} CourseTimeTrialRecords; // size = 0x18
typedef struct {
// Each cup is made up of 4 courses
CourseTimeTrialRecords courseRecords[4];
} CupTimeTrialRecords; // size = 0x60
typedef struct {
// There are 4 cups total
CupTimeTrialRecords cupRecords[4];
} AllCourseTimeTrialRecords; // size = 0x180
typedef struct {
// Records 0 through 3 are for the first cup's courses
// Records 4 through 7 are for the second cup's courses
u8 bestThreelaps[8][3];
u8 bestSinglelaps[8][3];
// It's unknown what these bytes are used for
u8 unknownBytes[8];
} OnlyBestTimeTrialRecords; // size = 0x38
typedef struct {
AllCourseTimeTrialRecords allCourseTimeTrialRecords;
// GP Points scored for each CC mode
// 1st place is 3 points, 2nd is 2, etc.
// Lowest dibit is the Mushroom Cup, 2nd dibit is the Flower Cup, etc
u8 grandPrixPoints[4];
// Its unknown what these bytes are used for
// They appear related to the Grand Prix points in some capacity but I can't figure out how
u8 unknownBytes1[4];
// For some reason there's 2 entries covering 4 cups
// Instead of 4 entries, one per cup. Or even just one big entry for all 4 cups
// Its also unknown why these are here when they're identical to the values found
// in allCourseTimeTrialRecords
OnlyBestTimeTrialRecords onlyBestTimeTrialRecords[2];
// Its unknown what these bytes are used for, they appear to be identical to
// grandPrixPoints and unknownBytes1
u8 unknownBytes2[8];
} SaveData; // size = 0x200
typedef struct {
/* 0x00 */ char unk_00[0x1D];
/* 0x1D */ s8 unk_1D;
+9
View File
@@ -71,6 +71,15 @@
#define BOWSER 7
/**
* Indexes for accessing Time Trial records
**/
#define TIME_TRIAL_3LAP_RECORD_1 0
#define TIME_TRIAL_3LAP_RECORD_2 1
#define TIME_TRIAL_3LAP_RECORD_3 2
#define TIME_TRIAL_3LAP_RECORD_4 3
#define TIME_TRIAL_3LAP_RECORD_5 4
#define TIME_TRIAL_1LAP_RECORD 5
* Text color options
* The 2 cycling options cycle through Blue -> Green -> Red
* Cycle 2 appears to be one step ahead of Cycle 1
+6 -4
View File
@@ -3,13 +3,17 @@
#include "global.h"
extern s32 gCCSelection;
extern s8 gCourseSelection;
extern s16 gCurrentCourseId;
extern s32 gModeSelection;
extern s32 gPlayerCountSelection1;
extern s8 gCupSelection;
extern s8 gHumanPlayerCount;
extern f32 gKartFrictionTable[];
extern f32 gKartBoundingBoxTable[];
extern f32 gKartGravityTable[];
extern s8 gGPOverallRanks[8];
extern s32 gModeSelection;
extern s32 gPlayerCountSelection1;
extern struct_D_802874D8 D_802874D8;
extern s16 D_801650D0[4][8];
@@ -33,7 +37,6 @@ extern s16 D_80165572;
extern s16 D_80165580;
extern s16 D_80165582;
extern s8 D_800E86A8[4];
extern s8 gGPOverallRanks[8];
extern s16 D_80165270[8];
extern Player* D_800DC4DC;
extern Player* D_800DC4E0;
@@ -59,7 +62,6 @@ extern s16* D_80164550;
extern f32 D_80165210[];
extern f32 D_80165230[];
extern struct_D_800E261C D_800E261C;
extern s32 gCCSelection;
extern f32 D_80164510[];
extern s32 D_80165420[];
extern s32 D_80165440[];