Skip to content

mkw: Decompile KartSettings constructor - #7

Open
EricOhebshalom wants to merge 3 commits into
doldecomp:mainfrom
EricOhebshalom:kart-settings
Open

EricOhebshalom wants to merge 3 commits into
doldecomp:mainfrom
EricOhebshalom:kart-settings

Conversation

@EricOhebshalom

Copy link
Copy Markdown
Contributor

Decompiles Kart::KartSettings constructor at 0x80592FC0 (__ct__Q24Kart12KartSettingsFv), fully completing src/kart/KartSettings.cpp.
Matched 100% on decomp.me:
https://decomp.me/scratch/xVuXe (credit: skijer)

@decomp-dev

decomp-dev Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Report for RMCP01 (386051f - 2d37580)

📈 Matched code: 5.77% (+0.00%, +204 bytes)

✅ 1 new match
Unit Item Bytes Before After
StaticR/kart/KartSettings Kart::KartSettings::KartSettings(signed char, System::VehicleId, System::CharacterId, unsigned long, Kart::KartParam*, void*, KartDriverDispParams*, KartPartsDispParams*, BikePartsDispParams*, DriverDispParams*) +204 0.00% 100.00%

Comment thread src/kart/KartSettings.cpp Outdated
Comment thread src/kart/KartSettings.cpp Outdated
Comment thread src/kart/KartSettings.cpp Outdated
Comment thread src/kart/KartSettings.cpp Outdated
self->gpStats = (Kart::GpStats*)operator new(0x1c);
if (System::RaceConfig::spInstance->mRaceScenario.mPlayers[(u8)playerIdx].mPlayerType ==
System::RaceConfig::Player::TYPE_REAL_LOCAL) {
this->raceStats = (RaceStats*)operator new(0x14);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this, do a normal ctor call and add a preliminary definition for RaceStats

class RaceStats {
  u8 _unk[0x14]; // prefer to use the definitions from the ghidra project here
};

that way we don't have to come back and fix such calls when RaceStats gets implemented

Comment thread src/kart/KartSettings.cpp Outdated
this->raceStats = (RaceStats*)operator new(0x14);
if (System::RaceConfig::spInstance->mRaceScenario.mSettings.mGameMode ==
System::RaceConfig::Settings::GAMEMODE_GRAND_PRIX) {
this->gpStats = (GpStats*)operator new(0x1c);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the comment for RaceStats

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants