Skip to content

Commit

Permalink
eep stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
hensldm committed Jul 19, 2024
1 parent c05863f commit 090a418
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions linker_scripts/us/symbol_addrs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ csleep = 0x800821A0;
// data

gEepMgr = 0x800F95D0;
D_800F97F8 = 0x800F97F8;
sEepBuff = 0x800F97F8;
sEepStack = 0x800F9FF8;
sEepBuff = 0x800FA2F8;
sEepCache = 0x800FA2F8;
sEepStackInfo = 0x800FAB00;
sBootStack = 0x800FB018;
sBootStackInfo = 0x800FD018;
Expand Down
26 changes: 13 additions & 13 deletions src/main/O2/65430.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,18 +519,18 @@ u16 func_800699BC(EepBuffer* arg0);
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/65430/func_800699BC.s")

extern EepMgr gEepMgr;
extern EepBuffer D_800F97F8[2];
extern STACK(sEepStack, 0x300);
extern EepBuffer sEepBuff[2];
extern STACK(sEepStack, 0x300);
extern EepBuffer sEepCache[2];
extern StackEntry sEepStackInfo;

s32 func_80069A80(void* arg0) {
func_80065528(&D_800F97F8[0].data, arg0, ARRAY_COUNT(D_800F97F8[0].data));
D_800F97F8[0].unk3FA = func_800699BC(D_800F97F8);
D_800F97F8[0].magic = EEPBUFFER_MAGIC;
D_800F97F8[1] = D_800F97F8[0];
func_80065528(&sEepBuff[0].data, arg0, ARRAY_COUNT(sEepBuff[0].data));
sEepBuff[0].unk3FA = func_800699BC(sEepBuff);
sEepBuff[0].magic = EEPBUFFER_MAGIC;
sEepBuff[1] = sEepBuff[0];

eepmgr_SendWrite(&gEepMgr, D_800F97F8);
eepmgr_SendWrite(&gEepMgr, sEepBuff);
if (func_8007D508(&gEepMgr) != 0) {
return 1;
}
Expand All @@ -539,19 +539,19 @@ s32 func_80069A80(void* arg0) {
}

s32 func_80069B34(UNK_PTR arg0) {
eepmgr_SendRead(&gEepMgr, D_800F97F8);
eepmgr_SendRead(&gEepMgr, sEepBuff);

if (func_8007D508(&gEepMgr) != 0) {
return 1;
}

if ((D_800F97F8[0].unk3FA == func_800699BC(&D_800F97F8[0])) && (D_800F97F8[0].magic == EEPBUFFER_MAGIC)) {
func_80065528(arg0, &D_800F97F8[0].data, ARRAY_COUNT(D_800F97F8[0].data));
if ((sEepBuff[0].unk3FA == func_800699BC(&sEepBuff[0])) && (sEepBuff[0].magic == EEPBUFFER_MAGIC)) {
func_80065528(arg0, &sEepBuff[0].data, ARRAY_COUNT(sEepBuff[0].data));
return 0;
}

if ((D_800F97F8[1].unk3FA == func_800699BC(&D_800F97F8[1])) && (D_800F97F8[1].magic == EEPBUFFER_MAGIC)) {
func_80065528(arg0, &D_800F97F8[1].data, ARRAY_COUNT(D_800F97F8[1].data));
if ((sEepBuff[1].unk3FA == func_800699BC(&sEepBuff[1])) && (sEepBuff[1].magic == EEPBUFFER_MAGIC)) {
func_80065528(arg0, &sEepBuff[1].data, ARRAY_COUNT(sEepBuff[1].data));
return 0;
}

Expand All @@ -560,6 +560,6 @@ s32 func_80069B34(UNK_PTR arg0) {

void func_80069C10(void) {
StackCheck_Init(&sEepStackInfo, sEepStack, STACK_TOP(sEepStack), 0, 0x100, "eepmgr");
eepmgr_Create(&gEepMgr, &D_8010DF40, EEPROM_TYPE_16K, sEepBuff, Y_THREAD_ID_EEPMGR, Y_PRIORITY_EEPMGR,
eepmgr_Create(&gEepMgr, &D_8010DF40, EEPROM_TYPE_16K, sEepCache, Y_THREAD_ID_EEPMGR, Y_PRIORITY_EEPMGR,
STACK_TOP(sEepStack));
}
8 changes: 4 additions & 4 deletions src/main/eepmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ void eepmgr_Probe(EepMgr* eepmgr) {
}
}

void eepmgr_Setup(EepMgr* eepmgr, UNK_PTR arg1, s32 type, EepBuffer* buffer) {
void eepmgr_Setup(EepMgr* eepmgr, UNK_PTR arg1, s32 type, EepBuffer* cache) {
bzero(eepmgr, sizeof(EepMgr));
eepmgr->unk218 = arg1;
eepmgr->cache = buffer;
eepmgr->cache = cache;
eepmgr->type = type;
eepmgr->numBlocks = sMaxBlocks[eepmgr->type];
}
Expand Down Expand Up @@ -255,9 +255,9 @@ void eepmgr_ThreadEntry(void* arg) {
}
}

void eepmgr_Create(EepMgr* eepmgr, UNK_PTR arg1, s32 type, EepBuffer* buffer, s32 id, s32 priority, void* stack) {
void eepmgr_Create(EepMgr* eepmgr, UNK_PTR arg1, s32 type, EepBuffer* cache, s32 id, s32 priority, void* stack) {
(void)"eepmgr_Create(%08x, %08x, %d, %08x, %d, %d, %08x)\n";
eepmgr_Setup(eepmgr, arg1, type, buffer);
eepmgr_Setup(eepmgr, arg1, type, cache);
osCreateMesgQueue(&eepmgr->unk014, eepmgr->unk000, ARRAY_COUNT(eepmgr->unk000));
osCreateMesgQueue(&eepmgr->unk02C, eepmgr->unk004, ARRAY_COUNT(eepmgr->unk004));
osCreateThread(&eepmgr->thread, id, eepmgr_ThreadEntry, eepmgr, stack, priority);
Expand Down

0 comments on commit 090a418

Please sign in to comment.