Skip to content

Commit

Permalink
Decomp: ResourceManager (#192)
Browse files Browse the repository at this point in the history
* MenuCharacterManager: full match

Co-Authored-By: riidefi <34194588+riidefi@users.noreply.github.com>

* JobContext: full match

Co-Authored-By: em-eight <107326447+em-eight@users.noreply.github.com>

* CourseCache: ctor, dtor, init

* CourseCache: load

* Add loadCourse WIP

* WIP comment requestLoad ASM

* Match loadCourse and requestLoad

* CourseCache: loadOther, full match

* ResourceManager: createInstance

* ResourceManager: loadMission, loadCompetition

Co-Authored-By: riidefi <34194588+riidefi@users.noreply.github.com>
Co-Authored-By: em-eight <107326447+em-eight@users.noreply.github.com>

* ResourceManager: doLoadTask

* Dummy: unused vtable calls

* ResourceManager: requestLoad (DvdArchive)

* ResourceManager: requestLoad (MultiDvdArchive, fileHeap)

* ResourceManager: load / rodata

* ResourceManager: rodata formatting

* A couple of more functions

* ResourceManager: loadUI, minor cleanup

* ResourceManager: loadSystemResource

* ResourceManager: loadMenuKartModel, minor cleanup

* ResourceManager: unmountMulti, unmountArchive

* ResourceManager: getFile

* ResourceManager: getCharacterFile

* ResourceManager: getVehicleFile

* ResourceManager: getFileCopy

* a couple of functions

* ResourceManager: cleanup

* ResourceManager: clear

* ResourceManager: getBspFile, CourseCache: load

* ResourceManager: getBspFile, CourseCache: load

* Unused: getNullString

* ResourceManager: setArcResourceLink

* ResourceManager: attachArcResourceAccessor

* ResourceManager: attachArcResourceAccessor

* request things

* doLoadGlobe

* globe loads

* load globe async

* (de)init globeHeap

* WIP: doLoadMenuCharacterModel

* Match doLoadCharacterKartModel

* Match deinitGlobeHeap

* doLoadCharacterModel and staffGhost

* loadCharMdlAsync

* FUN22CC

* ResourceManager: start cleanup

Co-authored-by: em-eight <107326447+em-eight@users.noreply.github.com>
Co-authored-by: Theodoros Tyrovouzis <teotyrov@gmail.com>
Co-authored-by: riidefi <34194588+riidefi@users.noreply.github.com>
  • Loading branch information
4 people authored Jul 7, 2022
1 parent 7b0789a commit 107930e
Show file tree
Hide file tree
Showing 9 changed files with 1,250 additions and 3,168 deletions.
6 changes: 3 additions & 3 deletions pack/rel_objects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ out/rel/data_808b2d50_808b3188.o
out/LocalizedArchive.o
out/MultiDvdArchive.o
out/rel/text_8052ae5c_8053fc4c.o
out/rel/rodata_8088fe28_80890ad8.o
out/rel/data_808b31e8_808b3bf8.o
out/rel/rodata_8088fe28_80890490.o
out/rel/data_808b31e8_808b3960.o
out/ResourceManager.o
out/rel/text_80542878_80555464.o
out/rel/rodata_80890b20_80891370.o
out/rel/rodata_80890d0c_80891370.o
out/rel/data_808b3c2c_808b42e0.o
out/Random.o
out/rel/text_8055572c_80590128.o
Expand Down
2 changes: 1 addition & 1 deletion pack/rel_slices.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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,,,,,0x80890AD8,0x80890B20,0x808B3BF8,0x808b3c2c,,
1,source/game/system/ResourceManager.cpp,0x8053FC4C,0x80542878,,,,,0x80890490,0x80890d0c,0x808b3960,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,,,,,,,,,,
Expand Down
16 changes: 8 additions & 8 deletions pack/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9978,9 +9978,9 @@
0x80540558 unk_80540558
0x80540680 ResourceManager_loadUI
0x80540760 loadCourse__Q26System15ResourceManagerF8CourseIdPQ23EGG4Heapb
0x80540918 ResourceManager_loadMission
0x80540b14 ResourceManager_loadCompetition
0x80540cfc unk_80540cfc
0x80540918 loadMission__Q26System15ResourceManagerF8CourseIdlPQ23EGG4Heapb
0x80540b14 loadCompetition__Q26System15ResourceManagerF8CourseIdPvUlPQ23EGG4HeapUc
0x80540cfc loadKartFromArchive__Q26System15ResourceManagerFPQ26System15MultiDvdArchiveUl6KartId11CharacterId10BattleTeam8PlayModePQ23EGG4HeapPQ23EGG4Heap
0x80540e3c unk_80540e3c
0x80540f90 unk_80540f90
0x805410e4 unk_805410e4
Expand All @@ -9992,27 +9992,27 @@
0x80541320 unk_80541320
0x805413c8 unk_805413c8
0x80541438 unk_80541438
0x805414a8 unk_805414a8
0x805414a8 ResourceManager_loadBSP
0x8054155c unk_8054155c
0x805415b0 unk_805415b0
0x805415b4 unk_805415b4
0x805415c4 unk_805415c4
0x805415d4 unk_805415d4
0x805415e4 unk_805415e4
0x80541614 unk_80541614
0x80541614 getArchiveStart__Q26System15ResourceManagerFQ26System17ResourceChannelIdUl
0x8054169c unk_8054169c
0x80541738 unk_80541738
0x80541794 ResourceManager_getMenuArchiveCount
0x805417a4 unk_805417a4
0x80541878 ResourceManager_attachLayoutDir
0x80541998 ResourceManager_preloadCourseTask
0x805419ac ResourceManager_preloadCourseAsync
0x805419c8 unk_805419c8
0x805419ec unk_805419ec
0x805419c8 getCharacterName__6SystemF11CharacterId
0x805419ec getKartName__6SystemF11CharacterId
0x80541a10 unk_80541a10
0x80541a70 unk_80541a70
0x80541ac4 unk_80541ac4
0x80541b58 unk_80541b58
0x80541b58 load__Q26System11CourseCacheFl
0x80541c18 unk_80541c18
0x80541c38 unk_80541c38
0x80541c48 unk_80541c48
Expand Down
9 changes: 5 additions & 4 deletions source/egg/core/eggStreamDecomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ namespace EGG {
//!
class StreamDecomp {
public:
virtual bool init(void* dst, u32 maxCompressedSize) = 0;
virtual bool decomp(const void* src, u32 len) = 0;
virtual u32 getHeaderSize() = 0;
virtual u32 getUncompressedSize(const void* src) = 0;
virtual bool init(void* dst, u32 maxCompressedSize);
virtual bool decomp(const void* src, u32 len);
virtual u32 getHeaderSize();
virtual u32 getUncompressedSize(const void* src);
void foo();
};

class LZStreamDecomp : public StreamDecomp {
Expand Down
1 change: 1 addition & 0 deletions source/game/system/DvdArchive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ enum ArchiveState {

class DvdArchive {
friend class MultiDvdArchive;
friend class ResourceManager;

public:
DvdArchive();
Expand Down
21 changes: 12 additions & 9 deletions source/game/system/MultiDvdArchive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,19 @@ enum ResourceChannelID {
RES_CHAN_NUM,
};

enum EResourceKind {
RES_KIND_FILE_DOUBLE_FORMAT, // 0 %s%s Supports prefix
RES_KIND_FILE_SINGLE_FORMAT, // 1 %s
RES_KIND_BUFFER, // 2
RES_KIND_3, // unseen
RES_KIND_4, // _Dif loader

RES_KIND_DEFAULT = RES_KIND_FILE_DOUBLE_FORMAT,
};

class MultiDvdArchive {
friend class ResourceManager;

public:
MultiDvdArchive(u16 archiveCount = 1);
virtual ~MultiDvdArchive();
Expand All @@ -46,15 +58,6 @@ class MultiDvdArchive {
void* getEarliestResBufInMem();
void* getFarthestResBufInMem();

enum EResourceKind {
RES_KIND_FILE_DOUBLE_FORMAT, // 0 %s%s Supports prefix
RES_KIND_FILE_SINGLE_FORMAT, // 1 %s
RES_KIND_BUFFER, // 2
RES_KIND_3, // unseen
RES_KIND_4, // _Dif loader

RES_KIND_DEFAULT = RES_KIND_FILE_DOUBLE_FORMAT,
};
enum {
SUFFIX_SIZE = 128,
};
Expand Down
28 changes: 28 additions & 0 deletions source/game/system/RaceConfig.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once

#include <rk_types.h>

struct RaceConfigPlayer {
u8 _00[0x08 - 0x00];
u32 vehicleId;
u32 characterId;
u32 type;
u8 _14[0xd0 - 0x14];
s32 controllerId;
u8 _d4[0xf0 - 0xd4];
};

struct RaceConfigScenario {
u8 _000[0x004 - 0x000];
u8 playerCount;
u8 _005[0x008 - 0x005];
RaceConfigPlayer players[12];
// ...
};

struct RaceConfig {
static RaceConfig* spInstance;
u8 _0000[0x0020 - 0x0000];
RaceConfigScenario raceScenario;
// ...
};
Loading

0 comments on commit 107930e

Please sign in to comment.