Mario Kart 64
Loading...
Searching...
No Matches
save.c File Reference
#include <ultra64.h>
#include <macros.h>
#include <defines.h>
#include "stddef.h"
#include "save.h"
#include "menu_items.h"
#include "menus.h"
#include "save_data.h"
#include "staff_ghosts.h"
#include "code_80057C60.h"
Include dependency graph for save.c:

Macros

#define PFS_COMPANY_CODE(c0, c1)   ((u16) (((c0) << 8) | ((c1))))
 
#define PFS_GAME_CODE(c0, c1, c2, c3)   ((u32) (((c0) << 24) | ((c1) << 16) | ((c2) << 8) | (c3)))
 
#define EEPROM_ADDR(ptr)   (((uintptr_t) (ptr) - (uintptr_t) (&gSaveData)) / 8)
 

Functions

void func_800B45E0 (s32 arg0)
 
void write_save_data_grand_prix_points_and_sound_mode (void)
 
void func_800B46D0 (void)
 
void func_800B4728 (s32 arg0)
 
void reset_save_data_grand_prix_points_and_sound_mode (void)
 
u8 checksum_time_trial_records (s32 courseIdx)
 
u8 compute_save_data_checksum_1 (void)
 
u8 compute_save_data_checksum_2 (void)
 
void load_save_data (void)
 
void func_800B4A9C (s32 course)
 
void validate_save_data (void)
 
void populate_time_trial_record (u8 *timeTrialRecord, u32 time, s32 characterId)
 
u32 func_800B4DF4 (u8 *arr)
 
s32 func_800B4E24 (s32 recordIndex)
 
u32 func_800B4EB4 (s32 recordIndex, s32 courseIndex)
 
s32 func_800B4F2C (void)
 
s32 func_800B4FB0 (s32 courseIndex)
 
s32 func_800B5020 (u32 time, s32 charId)
 
s32 func_800B5218 (void)
 
void func_800B536C (s32 arg0)
 
void func_800B5404 (s32 arg0, s32 arg1)
 
u8 func_800B54C0 (s32 cup, s32 cc_mode)
 
u8 func_800B54EC (s32 cup, s32 ccGrandPrixPoints)
 
u8 func_800B5508 (s32 cup, s32 ccGrandPrixPoints, s32 points_scored)
 
bool is_cc_mode_complete (s32 cc_mode)
 
s32 has_unlocked_extra_mode (void)
 
s32 has_completed_extra_mode (void)
 
void func_800B559C (s32 arg0)
 
u8 func_800B578C (s32 arg0)
 
s32 func_800B5888 (s32 arg0)
 
s32 func_800B58C4 (s32 arg0)
 
void update_save_data_backup (void)
 
u8 compute_save_data_checksum_backup_1 (void)
 
u8 compute_save_data_checksum_backup_2 (void)
 
s32 validate_save_data_checksum_backup (void)
 
s32 check_for_controller_pak (s32 controller)
 
s32 controller_pak_1_status (void)
 
s32 controller_pak_2_status (void)
 
s32 func_800B5F30 (void)
 
s32 func_800B6014 (void)
 
s32 func_800B6088 (s32 arg0)
 
u8 func_800B60E8 (s32 page)
 
s32 func_800B6178 (s32 arg0)
 
s32 func_800B6348 (s32 arg0)
 
s32 func_800B639C (s32 arg0)
 
s32 func_800B63F0 (s32 arg0)
 
s32 func_800B64EC (s32 arg0)
 
s32 func_800B65F4 (s32 arg0, s32 arg1)
 
void func_800B6708 (void)
 
void func_800B6798 (void)
 
u8 func_800B6828 (s32 arg0)
 
u8 func_800B68F4 (s32 arg0)
 
s32 func_800B69BC (s32 arg0)
 
s32 func_800B6A68 (void)
 
void func_8800B6AF8 (void)
 

Variables

struct_8018EE10_entry D_8018EE10 [2]
 
u16 gCompanyCode = PFS_COMPANY_CODE('0', '1')
 
u32 gGameCode = PFS_GAME_CODE('N', 'K', 'T', 'J')
 
s8 gControllerPak1State = BAD
 
s8 sControllerPak2State = BAD
 
const u8 D_800F2E60 [4] = { 0xc0, 0x27, 0x09, 0x00 }
 
const u8 gGameName []
 
const u8 gExtCode [] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
 

Macro Definition Documentation

◆ EEPROM_ADDR

#define EEPROM_ADDR ( ptr)    (((uintptr_t) (ptr) - (uintptr_t) (&gSaveData)) / 8)

◆ PFS_COMPANY_CODE

#define PFS_COMPANY_CODE ( c0,
c1 )   ((u16) (((c0) << 8) | ((c1))))

◆ PFS_GAME_CODE

#define PFS_GAME_CODE ( c0,
c1,
c2,
c3 )   ((u32) (((c0) << 24) | ((c1) << 16) | ((c2) << 8) | (c3)))

Function Documentation

◆ check_for_controller_pak()

s32 check_for_controller_pak ( s32 controller)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checksum_time_trial_records()

u8 checksum_time_trial_records ( s32 courseIdx)
Here is the caller graph for this function:

◆ compute_save_data_checksum_1()

u8 compute_save_data_checksum_1 ( void )
Here is the caller graph for this function:

◆ compute_save_data_checksum_2()

u8 compute_save_data_checksum_2 ( void )
Here is the caller graph for this function:

◆ compute_save_data_checksum_backup_1()

u8 compute_save_data_checksum_backup_1 ( void )
Here is the caller graph for this function:

◆ compute_save_data_checksum_backup_2()

u8 compute_save_data_checksum_backup_2 ( void )
Here is the caller graph for this function:

◆ controller_pak_1_status()

s32 controller_pak_1_status ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ controller_pak_2_status()

s32 controller_pak_2_status ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B45E0()

void func_800B45E0 ( s32 arg0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B46D0()

void func_800B46D0 ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B4728()

void func_800B4728 ( s32 arg0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B4A9C()

void func_800B4A9C ( s32 course)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B4DF4()

u32 func_800B4DF4 ( u8 * arr)
Here is the caller graph for this function:

◆ func_800B4E24()

s32 func_800B4E24 ( s32 recordIndex)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B4EB4()

u32 func_800B4EB4 ( s32 recordIndex,
s32 courseIndex )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B4F2C()

s32 func_800B4F2C ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B4FB0()

s32 func_800B4FB0 ( s32 courseIndex)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B5020()

s32 func_800B5020 ( u32 time,
s32 charId )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B5218()

s32 func_800B5218 ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B536C()

void func_800B536C ( s32 arg0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B5404()

void func_800B5404 ( s32 arg0,
s32 arg1 )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B54C0()

u8 func_800B54C0 ( s32 cup,
s32 cc_mode )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B54EC()

u8 func_800B54EC ( s32 cup,
s32 ccGrandPrixPoints )
Here is the caller graph for this function:

◆ func_800B5508()

u8 func_800B5508 ( s32 cup,
s32 ccGrandPrixPoints,
s32 points_scored )
Here is the caller graph for this function:

◆ func_800B559C()

void func_800B559C ( s32 arg0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B578C()

u8 func_800B578C ( s32 arg0)

This one is weird. Its some type of checksum calculator, seemingly for the best time trial records. But the number of bytes it operates over is odd. It calculates a checksum for 51 bytes in 17 byte chunks, but that doesn't line up with anything in the save data cleanly. At that byte count it would get the 48 bytes for the records plus 3 of the unknown bytes.

But only unknown bytes 7 and 8 ever get set, so why the extra 3, and why in chunks of 17?

Here is the caller graph for this function:

◆ func_800B5888()

s32 func_800B5888 ( s32 arg0)
Here is the caller graph for this function:

◆ func_800B58C4()

s32 func_800B58C4 ( s32 arg0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B5F30()

s32 func_800B5F30 ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B6014()

s32 func_800B6014 ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B6088()

s32 func_800B6088 ( s32 arg0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B60E8()

u8 func_800B60E8 ( s32 page)
Here is the caller graph for this function:

◆ func_800B6178()

s32 func_800B6178 ( s32 arg0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B6348()

s32 func_800B6348 ( s32 arg0)
Here is the caller graph for this function:

◆ func_800B639C()

s32 func_800B639C ( s32 arg0)
Here is the caller graph for this function:

◆ func_800B63F0()

s32 func_800B63F0 ( s32 arg0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B64EC()

s32 func_800B64EC ( s32 arg0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B65F4()

s32 func_800B65F4 ( s32 arg0,
s32 arg1 )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B6708()

void func_800B6708 ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B6798()

void func_800B6798 ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B6828()

u8 func_800B6828 ( s32 arg0)
Here is the caller graph for this function:

◆ func_800B68F4()

u8 func_800B68F4 ( s32 arg0)
Here is the caller graph for this function:

◆ func_800B69BC()

s32 func_800B69BC ( s32 arg0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_800B6A68()

s32 func_800B6A68 ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_8800B6AF8()

void func_8800B6AF8 ( void )
Here is the call graph for this function:

◆ has_completed_extra_mode()

s32 has_completed_extra_mode ( void )
Here is the call graph for this function:

◆ has_unlocked_extra_mode()

s32 has_unlocked_extra_mode ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_cc_mode_complete()

bool is_cc_mode_complete ( s32 cc_mode)
Here is the caller graph for this function:

◆ load_save_data()

void load_save_data ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ populate_time_trial_record()

void populate_time_trial_record ( u8 * timeTrialRecord,
u32 time,
s32 characterId )
Here is the caller graph for this function:

◆ reset_save_data_grand_prix_points_and_sound_mode()

void reset_save_data_grand_prix_points_and_sound_mode ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_save_data_backup()

void update_save_data_backup ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ validate_save_data()

void validate_save_data ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ validate_save_data_checksum_backup()

s32 validate_save_data_checksum_backup ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_save_data_grand_prix_points_and_sound_mode()

void write_save_data_grand_prix_points_and_sound_mode ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ D_800F2E60

const u8 D_800F2E60[4] = { 0xc0, 0x27, 0x09, 0x00 }

◆ D_8018EE10

struct_8018EE10_entry D_8018EE10[2]

BSS

◆ gCompanyCode

u16 gCompanyCode = PFS_COMPANY_CODE('0', '1')

◆ gControllerPak1State

s8 gControllerPak1State = BAD

◆ gExtCode

const u8 gExtCode[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }

◆ gGameCode

u32 gGameCode = PFS_GAME_CODE('N', 'K', 'T', 'J')

◆ gGameName

const u8 gGameName[]
Initial value:
= {
0x26, 0x1a, 0x2b, 0x22, 0x28, 0x24, 0x1a, 0x2b, 0x2d, 0x16, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00
}

◆ sControllerPak2State

s8 sControllerPak2State = BAD