From 7b1721e4de34d7cf64e1adc83f179e8d53cf0313 Mon Sep 17 00:00:00 2001 From: Theodoros Tyrovouzis Date: Sun, 19 Jun 2022 20:35:58 +0300 Subject: [PATCH 1/2] WIP comment requestLoad ASM --- source/game/system/ResourceManager.cpp | 30 ++++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/source/game/system/ResourceManager.cpp b/source/game/system/ResourceManager.cpp index f37d17813..425a6021d 100644 --- a/source/game/system/ResourceManager.cpp +++ b/source/game/system/ResourceManager.cpp @@ -477,7 +477,7 @@ asm UNKNOWN_FUNCTION(unk_805401fc) { // Symbol: unk_8054020c // PAL: 0x8054020c..0x805402c0 -MARK_BINARY_BLOB(unk_8054020c, 0x8054020c, 0x805402c0); +/*MARK_BINARY_BLOB(unk_8054020c, 0x8054020c, 0x805402c0); asm UNKNOWN_FUNCTION(unk_8054020c) { // clang-format off nofralloc; @@ -528,6 +528,21 @@ asm UNKNOWN_FUNCTION(unk_8054020c) { addi r1, r1, 0x20; blr; // clang-format on +}*/ + +namespace System { +void ResourceManager::requestLoad(s32 idx, MultiDvdArchive* m, const char* p, EGG::Heap* archiveHeap) { + this->jobContexts[idx].multiArchive = m; + strncpy(this->jobContexts[idx].filename, p, 0x40); + this->jobContexts[idx].archiveHeap = archiveHeap; + + this->taskThread->request(ResourceManager::doLoadTask, (void*)idx, 0); + this->process(); + + if (!m->isLoaded()) { + OSSleepMilliseconds(16); + } +} } // Symbol: unk_805402c0 @@ -1006,19 +1021,6 @@ asm UNKNOWN_FUNCTION(ResourceManager_loadCourse) { }*/ namespace System { -void ResourceManager::requestLoad(s32 idx, MultiDvdArchive* m, const char* p, EGG::Heap* archiveHeap) { - this->jobContexts[idx].multiArchive = m; - strncpy(this->jobContexts[idx].filename, p, 0x40); - this->jobContexts[idx].archiveHeap = archiveHeap; - - this->taskThread->request(ResourceManager::doLoadTask, (void*)idx, 0); - this->process(); - - if (!m->isLoaded()) { - OSSleepMilliseconds(16); - } -} - MultiDvdArchive* ResourceManager::loadCourse(CourseId courseId, EGG::Heap* param_3, bool splitScreen) { char courseName[128]; From f3744cc9a3f2624803952b12c04e3fcbc295f107 Mon Sep 17 00:00:00 2001 From: Theodoros Tyrovouzis Date: Mon, 20 Jun 2022 00:56:00 +0300 Subject: [PATCH 2/2] Match loadCourse and requestLoad --- pack/rel_objects.txt | 3 +- pack/rel_slices.csv | 2 +- source/game/system/ResourceManager.cpp | 46 +++++++++++++++++--------- source/game/system/ResourceManager.hpp | 8 ++--- 4 files changed, 36 insertions(+), 23 deletions(-) diff --git a/pack/rel_objects.txt b/pack/rel_objects.txt index 5a47d1f94..570624e14 100644 --- a/pack/rel_objects.txt +++ b/pack/rel_objects.txt @@ -17,10 +17,11 @@ out/rel/data_808b2d50_808b3188.o out/LocalizedArchive.o out/MultiDvdArchive.o out/rel/text_8052ae5c_8053fc4c.o -out/rel/rodata_8088fe28_80891370.o +out/rel/rodata_8088fe28_80890ae8.o out/rel/data_808b31e8_808b3c08.o out/ResourceManager.o out/rel/text_80542878_80555464.o +out/rel/rodata_80890b20_80891370.o out/rel/data_808b3c2c_808b42e0.o out/Random.o out/rel/text_8055572c_80590128.o diff --git a/pack/rel_slices.csv b/pack/rel_slices.csv index ed56ec9de..26a236a53 100644 --- a/pack/rel_slices.csv +++ b/pack/rel_slices.csv @@ -4,7 +4,7 @@ enabled,name,textStart,textEnd,ctorsStart,ctorsEnd,dtorsStart,dtorsEnd,rodataSta 1,source/game/system/GhostFile.cpp,0x8051c088,0x8051d4d4,,,,,,,0x808b2d38,0x808b2d50,, 1,source/game/system/LocalizedArchive.cpp,0x8052a098,0x8052a538,,,,,0x8088fdc0,0x8088fe00,0x808b3188,0x808b31d8,, 1,source/game/system/MultiDvdArchive.cpp,0x8052a538,0x8052ae5c,,,,,0x8088fe00,0x8088fe28,0x808b31d8,0x808b31e8,, -1,source/game/system/ResourceManager.cpp,0x8053FC4C,0x80542878,,,,,,,0x808b3c08,0x808b3c2c,, +1,source/game/system/ResourceManager.cpp,0x8053FC4C,0x80542878,,,,,0x80890AE8,0x80890B20,0x808b3c08,0x808b3c2c,, 1,source/game/util/Random.cpp,0x80555464,0x8055572c,,,,,0x80891370,0x80891380,0x808b42e0,0x808b42ec,, 1,source/game/kart/KartComponent.cpp,0x80590128,0x805901d0,,,,,,,,,0x809c1900,0x809c1910 1,source/game/ui/ControlGroup.cpp,0x805c23e4,0x805c2c18,,,,,,,,,, diff --git a/source/game/system/ResourceManager.cpp b/source/game/system/ResourceManager.cpp index 425a6021d..622b5c905 100644 --- a/source/game/system/ResourceManager.cpp +++ b/source/game/system/ResourceManager.cpp @@ -2,6 +2,20 @@ #include "rvl/os/osThread.h" + + +extern const char* COURSE_NAMES[]; + +extern const int arr_80890AE8[]; +const int arr_80890AE8[] = { + 819200, + 921600, + 36, + 48, + 14, + 51200 +}; + extern "C" { extern UNKNOWN_FUNCTION(load__Q26System10DvdArchiveFPCcUlPQ23EGG4Heap); extern UNKNOWN_FUNCTION(getFileCopy__Q26System10DvdArchiveFPcPQ23EGG4HeapPUlSc); @@ -349,10 +363,10 @@ asm UNKNOWN_FUNCTION(unk_80540038) { // clang-format on } -// Symbol: ResourceManager_process +// Symbol: process__Q26System15ResourceManagerFv // PAL: 0x805400a0..0x805401ec -MARK_BINARY_BLOB(ResourceManager_process, 0x805400a0, 0x805401ec); -asm UNKNOWN_FUNCTION(ResourceManager_process) { +MARK_BINARY_BLOB(process__Q26System15ResourceManagerFv, 0x805400a0, 0x805401ec); +asm UNKNOWN_FUNCTION(process__Q26System15ResourceManagerFv) { // clang-format off nofralloc; stwu r1, -0x20(r1); @@ -505,7 +519,7 @@ asm UNKNOWN_FUNCTION(unk_8054020c) { lwz r3, 0x584(r27); bl unk_805553b0; mr r3, r27; - bl ResourceManager_process; + bl process__Q26System15ResourceManagerFv; mr r3, r29; bl isLoaded__Q26System15MultiDvdArchiveFv; cmpwi r3, 0; @@ -577,7 +591,7 @@ asm UNKNOWN_FUNCTION(unk_805402c0) { lwz r3, 0x584(r26); bl unk_805553b0; mr r3, r26; - bl ResourceManager_process; + bl process__Q26System15ResourceManagerFv; lwz r0, 0x20(r28); li r3, 0; cmpwi r0, 4; @@ -642,7 +656,7 @@ asm UNKNOWN_FUNCTION(unk_80540394) { lwz r3, 0x584(r26); bl unk_805553b0; mr r3, r26; - bl ResourceManager_process; + bl process__Q26System15ResourceManagerFv; mr r3, r28; bl isLoaded__Q26System15MultiDvdArchiveFv; cmpwi r3, 0; @@ -714,7 +728,7 @@ asm UNKNOWN_FUNCTION(ResourceManager_load) { li r6, 0; bl unk_805553b0; mr r3, r31; - bl ResourceManager_process; + bl process__Q26System15ResourceManagerFv; mr r3, r30; bl isLoaded__Q26System15MultiDvdArchiveFv; cmpwi r3, 0; @@ -796,7 +810,7 @@ asm UNKNOWN_FUNCTION(unk_80540558) { li r6, 0; bl unk_805553b0; mr r3, r30; - bl ResourceManager_process; + bl process__Q26System15ResourceManagerFv; lwz r0, 0x2c8(r28); li r3, 0; cmpwi r0, 4; @@ -868,7 +882,7 @@ asm UNKNOWN_FUNCTION(ResourceManager_loadUI) { li r6, 0; bl unk_805553b0; mr r3, r29; - bl ResourceManager_process; + bl process__Q26System15ResourceManagerFv; mr r3, r31; bl isLoaded__Q26System15MultiDvdArchiveFv; cmpwi r3, 0; @@ -990,7 +1004,7 @@ asm UNKNOWN_FUNCTION(ResourceManager_loadCourse) { li r6, 0; bl unk_805553b0; mr r3, r31; - bl ResourceManager_process; + bl process__Q26System15ResourceManagerFv; mr r3, r30; bl isLoaded__Q26System15MultiDvdArchiveFv; cmpwi r3, 0; @@ -1162,7 +1176,7 @@ asm UNKNOWN_FUNCTION(ResourceManager_loadMission) { li r6, 0; bl unk_805553b0; mr r3, r28; - bl ResourceManager_process; + bl process__Q26System15ResourceManagerFv; mr r3, r29; bl isLoaded__Q26System15MultiDvdArchiveFv; cmpwi r3, 0; @@ -1299,7 +1313,7 @@ asm UNKNOWN_FUNCTION(ResourceManager_loadCompetition) { li r6, 0; bl unk_805553b0; mr r3, r23; - bl ResourceManager_process; + bl process__Q26System15ResourceManagerFv; mr r3, r21; bl isLoaded__Q26System15MultiDvdArchiveFv; cmpwi r3, 0; @@ -1391,7 +1405,7 @@ asm UNKNOWN_FUNCTION(unk_80540cfc) { li r6, 0; bl unk_805553b0; mr r3, r28; - bl ResourceManager_process; + bl process__Q26System15ResourceManagerFv; mr r3, r31; bl isLoaded__Q26System15MultiDvdArchiveFv; cmpwi r3, 0; @@ -1491,7 +1505,7 @@ asm UNKNOWN_FUNCTION(unk_80540e3c) { li r6, 0; bl unk_805553b0; mr r3, r30; - bl ResourceManager_process; + bl process__Q26System15ResourceManagerFv; mr r3, r31; bl isLoaded__Q26System15MultiDvdArchiveFv; cmpwi r3, 0; @@ -1592,7 +1606,7 @@ asm UNKNOWN_FUNCTION(unk_80540f90) { li r6, 0; bl unk_805553b0; mr r3, r30; - bl ResourceManager_process; + bl process__Q26System15ResourceManagerFv; mr r3, r31; bl isLoaded__Q26System15MultiDvdArchiveFv; cmpwi r3, 0; @@ -2676,7 +2690,7 @@ asm UNKNOWN_FUNCTION(unk_80541c48) { cmpwi r31, 0; beq lbl_80541ca0; mr r3, r30; - bl ResourceManager_process; + bl process__Q26System15ResourceManagerFv; lbl_80541ca0: mr r3, r31; lwz r31, 0xc(r1); diff --git a/source/game/system/ResourceManager.hpp b/source/game/system/ResourceManager.hpp index 43adb5206..079f64b4d 100644 --- a/source/game/system/ResourceManager.hpp +++ b/source/game/system/ResourceManager.hpp @@ -33,7 +33,7 @@ UNKNOWN_FUNCTION(ResourceManager_destroy); // PAL: 0x80540038..0x805400a0 UNKNOWN_FUNCTION(unk_80540038); // PAL: 0x805400a0..0x805401ec -UNKNOWN_FUNCTION(ResourceManager_process); +UNKNOWN_FUNCTION(process__Q26System15ResourceManagerFv); // PAL: 0x805401ec..0x805401fc UNKNOWN_FUNCTION(unk_805401ec); // PAL: 0x805401fc..0x8054020c @@ -167,8 +167,6 @@ UNKNOWN_FUNCTION(unk_80542868); namespace System { -const char* COURSE_NAMES[] = {"TODO"}; - struct JobContext { MultiDvdArchive* multiArchive; DvdArchive* archive; @@ -213,8 +211,8 @@ class CourseCache : EGG::Disposer { //private: // idk if rii prefers to befriend every class over public-ing everything void* mBuffer; EGG::ExpHeap* mHeap; - u32 mCourseId; - volatile u32 mState; + s32 mCourseId; + s32 mState; MultiDvdArchive* mArchive; };