Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RaceConfig refactoring #233

Merged
merged 3 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 43 additions & 43 deletions pack/symbols.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10045,71 +10045,71 @@ global:
0x8052d46c: 'unk_8052d46c'
0x8052d828: 'unk_8052d828'
0x8052d888: 'unk_8052d888'
0x8052d96c: '__ct__Q26System16RaceConfigPlayerFv'
0x8052d96c: '__ct__Q36System10RaceConfig6PlayerFv'
0x8052da10: '__dt__Q26System6RatingFv'
0x8052da50: 'appendParamFile__Q26System16RaceConfigPlayerFPQ26System10RaceConfig'
0x8052daf0: 'computeGpRank__Q26System16RaceConfigPlayerCFv'
0x8052dbc8: '__ct__Q26System18RaceConfigScenarioFPQ26System12RawGhostFile'
0x8052dc68: '__dt__Q26System16RaceConfigPlayerFv'
0x8052dca8: 'computeWinningTeam__Q26System18RaceConfigScenarioFv'
0x8052dd18: 'getTeam__Q26System16RaceConfigPlayerFv'
0x8052dd20: 'getPlayer__Q26System12RaceScenarioCFUc'
0x8052da50: 'appendParamFile__Q36System10RaceConfig6PlayerFPQ26System10RaceConfig'
0x8052daf0: 'computeGpRank__Q36System10RaceConfig6PlayerCFv'
0x8052dbc8: '__ct__Q36System10RaceConfig8ScenarioFPQ26System12RawGhostFile'
0x8052dc68: '__dt__Q36System10RaceConfig6PlayerFv'
0x8052dca8: 'computeWinningTeam__Q36System10RaceConfig8ScenarioFv'
0x8052dd18: 'getTeam__Q36System10RaceConfig6PlayerFv'
0x8052dd20: 'getPlayer__Q36System10RaceConfig8ScenarioCFUc'
0x8052dd30: 'getRacePlayerCount__Q26System10RaceConfigFv'
0x8052dd40: 'Racedata_init'
0x8052e42c: 'setCharacter__Q26System16RaceConfigPlayerFQ26System11CharacterId'
0x8052e434: 'getPlayer__Q26System18RaceConfigScenarioFUc'
0x8052e444: 'setVehicle__Q26System16RaceConfigPlayerFQ26System9VehicleId'
0x8052e44c: 'setPlayerType__Q26System16RaceConfigPlayerFl'
0x8052e454: 'reset__Q26System10RaceConfigFv'
0x8052e640: 'reset__Q26System16RaceConfigPlayerFSc'
0x8052e658: 'setPrevFinishPos__Q26System16RaceConfigPlayerFSc'
0x8052e660: 'setUnkPos__Q26System16RaceConfigPlayerFSc'
0x8052e668: 'reset__Q26System18RaceConfigScenarioFv'
0x8052e42c: 'setCharacter__Q36System10RaceConfig6PlayerFQ26System11CharacterId'
0x8052e434: 'getPlayer__Q36System10RaceConfig8ScenarioFUc'
0x8052e444: 'setVehicle__Q36System10RaceConfig6PlayerFQ26System9VehicleId'
0x8052e44c: 'setPlayerType__Q36System10RaceConfig6PlayerFl'
0x8052e454: 'clear__Q26System10RaceConfigFv'
0x8052e640: 'reset__Q36System10RaceConfig6PlayerFSc'
0x8052e658: 'setPrevFinishPos__Q36System10RaceConfig6PlayerFSc'
0x8052e660: 'setUnkPos__Q36System10RaceConfig6PlayerFSc'
0x8052e668: 'clear__Q36System10RaceConfig8ScenarioFv'
0x8052e764: 'empty1__6SystemFv'
0x8052e768: 'empty2__6SystemFv'
0x8052e76c: 'empty3__6SystemFv'
0x8052e770: 'update__Q26System18RaceConfigScenarioFv'
0x8052e770: 'update__Q36System10RaceConfig8ScenarioFv'
0x8052e870: 'updateRating__Q26System10RaceConfigFUc'
0x8052e950: 'unk_8052e950'
0x8052ed18: 'getGametype__Q26System18RaceConfigScenarioFv'
0x8052ed20: 'getPlayerType__Q26System16RaceConfigPlayerFv'
0x8052ed28: 'postInitControllers__Q26System18RaceConfigScenarioFPQ26System12RaceScenario'
0x8052ed18: 'getGametype__Q36System10RaceConfig8ScenarioFv'
0x8052ed20: 'getPlayerType__Q36System10RaceConfig6PlayerFv'
0x8052ed28: 'postInitControllers__Q36System10RaceConfig8ScenarioFPQ36System10RaceConfig8Scenario'
0x8052eef0: 'unk_8052eef0'
0x8052efd4: 'resetPlayers__Q26System18RaceConfigScenarioFv'
0x8052f064: 'unk_8052f064'
0x8052f1e0: 'copyPrevPositions__Q26System18RaceConfigScenarioFv'
0x8052f4e8: 'initControllers__Q26System18RaceConfigScenarioFUc'
0x8052f788: 'computePlayerCounts__Q26System18RaceConfigScenarioFPUcPUcPUc'
0x8052f924: 'initRng__Q26System18RaceConfigScenarioFv'
0x8052fa0c: 'initCompetitionSettings__Q26System18RaceConfigScenarioFv'
0x8052fb90: 'initRace__Q26System18RaceConfigScenarioFPQ26System12RaceScenario'
0x8052efd4: 'resetPlayers__Q36System10RaceConfig8ScenarioFv'
0x8052f064: 'initPlayers__Q36System10RaceConfig8ScenarioFUc'
0x8052f1e0: 'copyPrevPositions__Q36System10RaceConfig8ScenarioFv'
0x8052f4e8: 'initControllers__Q36System10RaceConfig8ScenarioFUc'
0x8052f788: 'computePlayerCounts__Q36System10RaceConfig8ScenarioFRUcRUcRUc'
0x8052f924: 'initRng__Q36System10RaceConfig8ScenarioFv'
0x8052fa0c: 'initCompetitionSettings__Q36System10RaceConfig8ScenarioFv'
0x8052fb90: 'initRace__Q36System10RaceConfig8ScenarioFPQ36System10RaceConfig8Scenario'
0x8052fe58: 'createInstance__Q26System10RaceConfigFv'
0x8052ffe8: 'destroyInstance__Q26System10RaceConfigFv'
0x80530038: 'Racedata_destroy'
0x805300f4: 'RacedataScenario_destroy'
0x8053015c: 'Racedata_construct'
0x80530038: '__dt__Q26System10RaceConfigFv'
0x805300f4: '__dt__Q36System10RaceConfig8ScenarioFv'
0x8053015c: '__ct__Q26System10RaceConfigFv'
0x805302c4: 'initRace__Q26System10RaceConfigFv'
0x805305ac: 'RacedataScenario_copy'
0x80530864: 'Racedata_initAwards'
0x80530f0c: 'isTeamMode__Q26System18RaceConfigScenarioFv'
0x80530f18: 'getUnkPos__Q26System16RaceConfigPlayerFv'
0x80530f20: 'getCharacter__Q26System16RaceConfigPlayerFv'
0x80530f28: 'getVehicle__Q26System16RaceConfigPlayerFv'
0x80530f30: 'setMii__Q26System16RaceConfigPlayerFRCQ26System3Mii'
0x80531068: 'getMii__Q26System16RaceConfigPlayerFv'
0x80530f0c: 'isTeamMode__Q36System10RaceConfig8ScenarioFv'
0x80530f18: 'getUnkPos__Q36System10RaceConfig6PlayerFv'
0x80530f20: 'getCharacter__Q36System10RaceConfig6PlayerFv'
0x80530f28: 'getVehicle__Q36System10RaceConfig6PlayerFv'
0x80530f30: 'setMii__Q36System10RaceConfig6PlayerFRCQ26System3Mii'
0x80531068: 'getMii__Q36System10RaceConfig6PlayerFv'
0x80531070: 'Racedata_initCredits'
0x80531ce4: 'update__Q26System10RaceConfigFv'
0x80531de4: 'appendParamFile__Q26System18RaceConfigScenarioFPQ26System10RaceConfig'
0x80531de4: 'appendParamFile__Q36System10RaceConfig8ScenarioFPQ26System10RaceConfig'
0x80531f18: 'getLocalPlayerCount__Q26System10RaceConfigFUc'
0x80531f2c: 'setGhost__Q26System10RaceConfigFPQ26System12RawGhostFile'
0x80531f70: 'getHudPlayerId__Q26System10RaceConfigFUc'
0x80531f80: 'loadNextCourse__Q26System10RaceConfigFv'
0x80531fc8: 'isLiveView__Q26System10RaceConfigFUc'
0x80532030: 'isTimeAttackReplay__Q26System10RaceConfigFv'
0x80532070: 'vf18__Q26System10RaceConfigFv'
0x80532074: 'vf14__Q26System10RaceConfigFv'
0x80532078: 'vf10__Q26System10RaceConfigFv'
0x8053207c: 'unk_8053207c'
0x80532070: 'emptySub3__Q26System13ParameterFileFv'
0x80532074: 'emptySub2__Q26System13ParameterFileFv'
0x80532078: 'emptySub1__Q26System13ParameterFileFv'
0x8053207c: 'emptySub0__Q26System13ParameterFileFv'
0x80532084: 'Raceinfo_initStaticInstance'
0x805320d4: 'Raceinfo_destroyStaticInstance'
0x80532124: 'unk_80532124'
Expand Down
88 changes: 88 additions & 0 deletions source/game/system/Competition.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#pragma once

#include <rk_types.h>
#include <decomp.h>

namespace System {

struct CharacterVehicleChoice {
s8 characterId;
s8 vehicleId;
};

struct RawCompetitionFile {
char rkctMagic[4];
s32 dataLength;
s32 headerLength;
s32 field3_0xc;
char rkcoMagic[4];
u16 competitionType;
u8 courseId;
u8 engineClass;
u8 numLaps;
u8 field9_0x19;
u16 vehicleRestriction;
u16 cameraAngle;
u16 minimapObject;
u16 field13_0x20;
u16 field14_0x22;
u16 cannonFlag;
u16 cpuCount;
CharacterVehicleChoice cpuCombos[11];
u8 controllerRestriction;
u8 field19_0x3f;
u16 objectFiles;
u16 score;
u8 s32roSetting;
u8 field23_0x45;
u16 field24_0x46;
u16 field25_0x48;
u16 field26_0x4a;
inline u16 getSize() { return min32(11, cpuCount); }
};

struct CompetitionWrapper {
bool isValid;
RawCompetitionFile* fileRaw;
s32 field5_0x8;
s32 field6_0xc;
s32 field7_0x10;
s32 field8_0x14;
s32 field9_0x18;
s32 field10_0x1c;
};

struct CompetitionSettings {
u16 field0_0x0;
u16 field1_0x2; /* something depending on competition type */
u8 courseId;
u8 padding[2];
u8 engineClass;
u8 field5_0x8[39]; /* unknown padding */
u8 controllerRestriction;
u32 field7_0x30[6]; /* those s32s probably represent amount of coins, gates
etc */
u16 cameraAngle;
u16 minimapObject;
u16 field10_0x4c;
u16 field11_0x4e;
u16 cannonFlag;
u8 field13_0x52[6]; /* unknown padding */
u16 cpuCount;
CharacterVehicleChoice cpuCombos[11]; /* one for each CPU */

inline void cpuCombosFromFile(RawCompetitionFile* file) {
for (u8 i = 0; i < file->getSize(); i++) {
this->cpuCombos[i] = file->cpuCombos[i];
}
}

inline void cpuCombosFromWrapper2(const CompetitionWrapper& wrapper) {
this->cpuCombosFromFile(wrapper.fileRaw);
}
inline void cpuCombosFromWrapper(const CompetitionWrapper& wrapper) {
this->cpuCombosFromWrapper2(wrapper);
}
};

} // namespace System
Loading