From 4fb788ce970cac7647ffefb176567af17e72fead Mon Sep 17 00:00:00 2001 From: sowens99 Date: Thu, 22 Feb 2024 10:30:57 -0500 Subject: [PATCH] Add KartState --- pack/rel_objects.txt | 10 +- pack/rel_slices.yml | 8 +- source/game/kart/KartState.cpp | 324 +++++++++++++++++++++++++++++++++ source/game/kart/KartState.hpp | 2 +- sources.py | 1 + 5 files changed, 337 insertions(+), 8 deletions(-) create mode 100644 source/game/kart/KartState.cpp diff --git a/pack/rel_objects.txt b/pack/rel_objects.txt index 460692aa..c3bf3f22 100644 --- a/pack/rel_objects.txt +++ b/pack/rel_objects.txt @@ -51,13 +51,17 @@ out/rel/text_80574030_80577fc4.o out/KartMove.o out/rel/text_8058985c_80590128.o out/rel/rodata_808917b0_80891c58.o -out/rel/data_808b56c0_808b65b0.o +out/rel/data_808b56c0_808b64e8.o out/rel/bss_809bd73c_809c1900.o out/KartObjectProxy.o out/rel/text_805919f4_80592fc0.o out/KartSettings.o -out/rel/text_8059308c_80598b08.o -out/rel/rodata_80891c80_80891f60.o +out/rel/text_8059308c_805943b4.o +out/rel/rodata_80891c80_80891ef0.o +out/KartState.o +out/rel/text_80595d04_80598b08.o +out/rel/rodata_80891f18_80891f60.o +out/rel/data_808b6540_808b65b0.o out/KartSus.o out/KartWheelPhysics.o out/rel/text_8059aa44_8059f5bc.o diff --git a/pack/rel_slices.yml b/pack/rel_slices.yml index dce3f410..2f2f0cdf 100644 --- a/pack/rel_slices.yml +++ b/pack/rel_slices.yml @@ -99,10 +99,10 @@ source/game/kart/KartObjectProxy.cpp: source/game/kart/KartSettings.cpp: text: [0x80592fc0, 0x8059308c] -#source/game/kart/KartState.cpp: -# text: [0x805943b4, 0x80595d04] -# rodata: [0x80891ef0, 0x80891f18] -# data: [0x808b64e8, 0x808b6540] +source/game/kart/KartState.cpp: + text: [0x805943b4, 0x80595d04] + rodata: [0x80891ef0, 0x80891f18] + data: [0x808b64e8, 0x808b6540] source/game/kart/KartSus.cpp: text: [0x80598b08, 0x8059940c] diff --git a/source/game/kart/KartState.cpp b/source/game/kart/KartState.cpp new file mode 100644 index 00000000..fd9e7da2 --- /dev/null +++ b/source/game/kart/KartState.cpp @@ -0,0 +1,324 @@ +#include +#include +// --- EXTERN DECLARATIONS BEGIN --- + +extern "C" { + + +// PAL: 0x805943b4..0x8059455c +UNKNOWN_FUNCTION(PlayerSub1c_construct); +// PAL: 0x8059455c..0x80594594 +UNKNOWN_FUNCTION(init__Q24Kart9KartStateFv); +// PAL: 0x80594594..0x80594634 +UNKNOWN_FUNCTION(reset__Q24Kart9KartStateFv); +// PAL: 0x80594634..0x80594644 +UNKNOWN_FUNCTION(resetOob__Q24Kart9KartStateFv); +// PAL: 0x80594644..0x805946f4 +UNKNOWN_FUNCTION(unk_80594644); +// PAL: 0x805946f4..0x80594704 +UNKNOWN_FUNCTION(PlayerSub1c_startOobWipe); +// PAL: 0x80594704..0x8059474c +UNKNOWN_FUNCTION(unk_80594704); +// PAL: 0x8059474c..0x8059487c +UNKNOWN_FUNCTION(PlayerSub1c_updateCollisionsAndMore); +// PAL: 0x8059487c..0x80594bd4 +UNKNOWN_FUNCTION(PlayerSub1c_updateFromInput); +// PAL: 0x80594bd4..0x805958ec +UNKNOWN_FUNCTION(PlayerSub1c_updateCollisions); +// PAL: 0x805958ec..0x805958f0 +UNKNOWN_FUNCTION(unk_805958ec); +// PAL: 0x805958f0..0x80595918 +UNKNOWN_FUNCTION(unk_805958f0); +// PAL: 0x80595918..0x805959d4 +UNKNOWN_FUNCTION(PlayerSub1c_updateStartBoostCharge); +// PAL: 0x805959d4..0x80595af8 +UNKNOWN_FUNCTION(PlayerSub1c_computeStartBoost); +// PAL: 0x80595af8..0x80595c5c +UNKNOWN_FUNCTION(PlayerSub1c_applyStartBoost); +// PAL: 0x80595c5c..0x80595ca4 +UNKNOWN_FUNCTION(unk_80595c5c); +// PAL: 0x80595ca4..0x80595cb4 +UNKNOWN_FUNCTION(unk_80595ca4); +// PAL: 0x80595cb4..0x80595cc4 +UNKNOWN_FUNCTION(unk_80595cb4); +// PAL: 0x80595cc4..0x80595d04 +UNKNOWN_FUNCTION(PlayerSub1c_destroy); +// Extern function references. +// PAL: 0x80021580 +extern UNKNOWN_FUNCTION(_savegpr_19); +// PAL: 0x800215cc +extern UNKNOWN_FUNCTION(_restgpr_19); +// PAL: 0x80229dcc +extern UNKNOWN_FUNCTION(__nw__FUl); +// PAL: 0x8022f80c +extern UNKNOWN_FUNCTION(sqrt__Q23EGG5MathfFf); +// PAL: 0x80243adc +extern UNKNOWN_FUNCTION(normalise__Q23EGG8Vector3fFv); +// PAL: 0x80533090 +extern UNKNOWN_FUNCTION(RaceInfo_getCountdown); +// PAL: 0x80536230 +extern UNKNOWN_FUNCTION(Raceinfo_isAtLeastStage); +// PAL: 0x8053db34 +extern UNKNOWN_FUNCTION(unk_8053db34); +// PAL: 0x8056e70c +extern UNKNOWN_FUNCTION(updateBbox__Q24Kart11KartCollideFv); +// PAL: 0x80573ed4 +extern UNKNOWN_FUNCTION(PlayerSub18_updateRespawn); +// PAL: 0x805758e4 +extern UNKNOWN_FUNCTION(PlayerZipper_end); +// PAL: 0x805766b8 +extern UNKNOWN_FUNCTION(PlayerTrick_end); +// PAL: 0x8057f7a8 +extern UNKNOWN_FUNCTION(PlayerSub10_endTrick); +// PAL: 0x8058212c +extern UNKNOWN_FUNCTION(PlayerSub10_applyStartBoost); +// PAL: 0x805890b0 +extern UNKNOWN_FUNCTION(unk_805890b0); +// PAL: 0x8059018c +extern UNKNOWN_FUNCTION(__ct__Q24Kart15KartObjectProxyFv); +// PAL: 0x8059020c +extern UNKNOWN_FUNCTION(getPos__Q24Kart15KartObjectProxyCFv); +// PAL: 0x805902ec +extern UNKNOWN_FUNCTION(PlayerPointers_getWheelCount1); +// PAL: 0x805903ac +extern UNKNOWN_FUNCTION(kartPhysics__Q24Kart15KartObjectProxyFv); +// PAL: 0x805903cc +extern UNKNOWN_FUNCTION(kartDynamics__Q24Kart15KartObjectProxyFv); +// PAL: 0x805903f4 +extern UNKNOWN_FUNCTION(KartAccessor_getInput); +// PAL: 0x8059041c +extern UNKNOWN_FUNCTION(unk_8059041c); +// PAL: 0x80590664 +extern UNKNOWN_FUNCTION(PlayerPointers_isCpu); +// PAL: 0x805906dc +extern UNKNOWN_FUNCTION(kartWheel__Q24Kart15KartObjectProxyFl); +// PAL: 0x80590734 +extern UNKNOWN_FUNCTION(PlayerPointers_getWheelPhysics); +// PAL: 0x8059077c +extern UNKNOWN_FUNCTION(kartMove__Q24Kart15KartObjectProxyFv); +// PAL: 0x805907a0 +extern UNKNOWN_FUNCTION(unk_805907a0); +// PAL: 0x8059084c +extern UNKNOWN_FUNCTION(kartCollide__Q24Kart15KartObjectProxyFv); +// PAL: 0x80590a5c +extern UNKNOWN_FUNCTION(getPlayerIdx__Q24Kart15KartObjectProxyCFv); +// PAL: 0x80590a6c +extern UNKNOWN_FUNCTION(PlayerPointers_isBike); +// PAL: 0x80590d08 +extern UNKNOWN_FUNCTION(playerPointers_getSpeed); +// PAL: 0x80590d5c +extern UNKNOWN_FUNCTION(unk_80590d5c); +// PAL: 0x80591044 +extern UNKNOWN_FUNCTION(unk_80591044); +// PAL: 0x805911a8 +extern UNKNOWN_FUNCTION(unk_805911a8); +// PAL: 0x805911c0 +extern UNKNOWN_FUNCTION(unk_805911c0); +// PAL: 0x80591440 +extern UNKNOWN_FUNCTION(kartNetSender__Q24Kart15KartObjectProxyFv); +// PAL: 0x805917c0 +extern UNKNOWN_FUNCTION(unk_805917c0); +// PAL: 0x80591904 +extern UNKNOWN_FUNCTION(kartHalfPipe__Q24Kart15KartObjectProxyFv); +// PAL: 0x80591914 +extern UNKNOWN_FUNCTION(kartJump__Q24Kart15KartObjectProxyFv); +// PAL: 0x80594594 +extern UNKNOWN_FUNCTION(reset__Q24Kart9KartStateFv); +// PAL: 0x80594bd4 +extern UNKNOWN_FUNCTION(PlayerSub1c_updateCollisions); +// PAL: 0x805959d4 +extern UNKNOWN_FUNCTION(PlayerSub1c_computeStartBoost); +// PAL: 0x80595af8 +extern UNKNOWN_FUNCTION(PlayerSub1c_applyStartBoost); +// PAL: 0x80595cc4 +extern UNKNOWN_FUNCTION(PlayerSub1c_destroy); +// PAL: 0x80599eac +extern UNKNOWN_FUNCTION(hasFloorCollision__Q24Kart16KartWheelPhysicsCFv); +// PAL: 0x80599ec8 +extern UNKNOWN_FUNCTION(getKartCollisionInfo__Q24Kart16KartWheelPhysicsCFv); +// PAL: 0x80865138 +extern UNKNOWN_FUNCTION(unk_80865138);// Extern data references. +// PAL: 0x802a4100 +extern UNKNOWN_DATA(lbl_802a4100); +// PAL: 0x802a4130 +extern UNKNOWN_DATA(RKSystem_ey); +// PAL: 0x809bd728 +extern UNKNOWN_DATA(spInstance__Q26System10RaceConfig); +// PAL: 0x809bd730 +extern UNKNOWN_DATA(lbl_809bd730); +// PAL: 0x809c18f8 +extern UNKNOWN_DATA(lbl_809c18f8); +// PAL: 0x809c1950 +extern UNKNOWN_DATA(lbl_809c1950); +// PAL: 0x809c1951 +extern UNKNOWN_DATA(lbl_809c1951); +} + +// --- EXTERN DECLARATIONS END --- + +// .rodata +const u32 lbl_80891ef0[] = { + 0x00000000 +}; +const u32 lbl_80891ef4[] = { + 0x3f800000 +}; +const u32 lbl_80891ef8[] = { + 0x43300000, 0x80000000, 0x41200000, 0x3f4ccccd, + 0x3f59999a, 0x3d4ccccd, 0xc1b00000, 0xc0e00000 +}; + +// .data +#pragma explicit_zero_data on +u32 lbl_808b64e8[] = { + 0x3ca3d70a, 0x3b03126f, 0x3f75c28f, 0x3ca3d70a +}; +u32 lbl_808b64f8[] = { + 0x3f59999a, 0x00000000, 0x3f6147ae, 0x000a0000, + 0x3f67ae14, 0x00140000, 0x3f6ccccd, 0x001e0000, + 0x3f70a3d7, 0x002d0000, 0x3f733333, 0x00460000 +}; +u32 lbl_808b6528[] = { + 0x00b40000, 0x0000000a, 0x42200000 +}; +u32 lbl_808b6534[] = { + 0x00000000, 0x00000000, (u32)&PlayerSub1c_destroy +}; +#pragma explicit_zero_data off + +// .bss + + +// Symbol: PlayerSub1c_construct +// PAL: 0x805943b4..0x8059455c +MARK_BINARY_BLOB(PlayerSub1c_construct, 0x805943b4, 0x8059455c); +asm UNKNOWN_FUNCTION(PlayerSub1c_construct) { + #include "asm/805943b4.s" +} + +// Symbol: init__Q24Kart9KartStateFv +// PAL: 0x8059455c..0x80594594 +MARK_BINARY_BLOB(init__Q24Kart9KartStateFv, 0x8059455c, 0x80594594); +asm UNKNOWN_FUNCTION(init__Q24Kart9KartStateFv) { + #include "asm/8059455c.s" +} + +// Symbol: reset__Q24Kart9KartStateFv +// PAL: 0x80594594..0x80594634 +MARK_BINARY_BLOB(reset__Q24Kart9KartStateFv, 0x80594594, 0x80594634); +asm UNKNOWN_FUNCTION(reset__Q24Kart9KartStateFv) { + #include "asm/80594594.s" +} + +// Symbol: resetOob__Q24Kart9KartStateFv +// PAL: 0x80594634..0x80594644 +MARK_BINARY_BLOB(resetOob__Q24Kart9KartStateFv, 0x80594634, 0x80594644); +asm UNKNOWN_FUNCTION(resetOob__Q24Kart9KartStateFv) { + #include "asm/80594634.s" +} + +// Symbol: unk_80594644 +// PAL: 0x80594644..0x805946f4 +MARK_BINARY_BLOB(unk_80594644, 0x80594644, 0x805946f4); +asm UNKNOWN_FUNCTION(unk_80594644) { + #include "asm/80594644.s" +} + +// Symbol: PlayerSub1c_startOobWipe +// PAL: 0x805946f4..0x80594704 +MARK_BINARY_BLOB(PlayerSub1c_startOobWipe, 0x805946f4, 0x80594704); +asm UNKNOWN_FUNCTION(PlayerSub1c_startOobWipe) { + #include "asm/805946f4.s" +} + +// Symbol: unk_80594704 +// PAL: 0x80594704..0x8059474c +MARK_BINARY_BLOB(unk_80594704, 0x80594704, 0x8059474c); +asm UNKNOWN_FUNCTION(unk_80594704) { + #include "asm/80594704.s" +} + +// Symbol: PlayerSub1c_updateCollisionsAndMore +// PAL: 0x8059474c..0x8059487c +MARK_BINARY_BLOB(PlayerSub1c_updateCollisionsAndMore, 0x8059474c, 0x8059487c); +asm UNKNOWN_FUNCTION(PlayerSub1c_updateCollisionsAndMore) { + #include "asm/8059474c.s" +} + +// Symbol: PlayerSub1c_updateFromInput +// PAL: 0x8059487c..0x80594bd4 +MARK_BINARY_BLOB(PlayerSub1c_updateFromInput, 0x8059487c, 0x80594bd4); +asm UNKNOWN_FUNCTION(PlayerSub1c_updateFromInput) { + #include "asm/8059487c.s" +} + +// Symbol: PlayerSub1c_updateCollisions +// PAL: 0x80594bd4..0x805958ec +MARK_BINARY_BLOB(PlayerSub1c_updateCollisions, 0x80594bd4, 0x805958ec); +asm UNKNOWN_FUNCTION(PlayerSub1c_updateCollisions) { + #include "asm/80594bd4.s" +} + +// Symbol: unk_805958ec +// PAL: 0x805958ec..0x805958f0 +MARK_BINARY_BLOB(unk_805958ec, 0x805958ec, 0x805958f0); +asm UNKNOWN_FUNCTION(unk_805958ec) { + #include "asm/805958ec.s" +} + +// Symbol: unk_805958f0 +// PAL: 0x805958f0..0x80595918 +MARK_BINARY_BLOB(unk_805958f0, 0x805958f0, 0x80595918); +asm UNKNOWN_FUNCTION(unk_805958f0) { + #include "asm/805958f0.s" +} + +// Symbol: PlayerSub1c_updateStartBoostCharge +// PAL: 0x80595918..0x805959d4 +MARK_BINARY_BLOB(PlayerSub1c_updateStartBoostCharge, 0x80595918, 0x805959d4); +asm UNKNOWN_FUNCTION(PlayerSub1c_updateStartBoostCharge) { + #include "asm/80595918.s" +} + +// Symbol: PlayerSub1c_computeStartBoost +// PAL: 0x805959d4..0x80595af8 +MARK_BINARY_BLOB(PlayerSub1c_computeStartBoost, 0x805959d4, 0x80595af8); +asm UNKNOWN_FUNCTION(PlayerSub1c_computeStartBoost) { + #include "asm/805959d4.s" +} + +// Symbol: PlayerSub1c_applyStartBoost +// PAL: 0x80595af8..0x80595c5c +MARK_BINARY_BLOB(PlayerSub1c_applyStartBoost, 0x80595af8, 0x80595c5c); +asm UNKNOWN_FUNCTION(PlayerSub1c_applyStartBoost) { + #include "asm/80595af8.s" +} + +// Symbol: unk_80595c5c +// PAL: 0x80595c5c..0x80595ca4 +MARK_BINARY_BLOB(unk_80595c5c, 0x80595c5c, 0x80595ca4); +asm UNKNOWN_FUNCTION(unk_80595c5c) { + #include "asm/80595c5c.s" +} + +// Symbol: unk_80595ca4 +// PAL: 0x80595ca4..0x80595cb4 +MARK_BINARY_BLOB(unk_80595ca4, 0x80595ca4, 0x80595cb4); +asm UNKNOWN_FUNCTION(unk_80595ca4) { + #include "asm/80595ca4.s" +} + +// Symbol: unk_80595cb4 +// PAL: 0x80595cb4..0x80595cc4 +MARK_BINARY_BLOB(unk_80595cb4, 0x80595cb4, 0x80595cc4); +asm UNKNOWN_FUNCTION(unk_80595cb4) { + #include "asm/80595cb4.s" +} + +// Symbol: PlayerSub1c_destroy +// PAL: 0x80595cc4..0x80595d04 +MARK_BINARY_BLOB(PlayerSub1c_destroy, 0x80595cc4, 0x80595d04); +asm UNKNOWN_FUNCTION(PlayerSub1c_destroy) { + #include "asm/80595cc4.s" +} + diff --git a/source/game/kart/KartState.hpp b/source/game/kart/KartState.hpp index 5f353a9f..795166cb 100644 --- a/source/game/kart/KartState.hpp +++ b/source/game/kart/KartState.hpp @@ -11,7 +11,7 @@ extern "C" { // PAL: 0x805943b4..0x8059455c UNKNOWN_FUNCTION(PlayerSub1c_construct); // PAL: 0x8059455c..0x80594594 -UNKNOWN_FUNCTION(unk_8059455c); +UNKNOWN_FUNCTION(init__Q24Kart9KartStateFv); // PAL: 0x80594594..0x80594634 UNKNOWN_FUNCTION(reset__Q24Kart9KartStateFv); // PAL: 0x80594634..0x80594644 diff --git a/sources.py b/sources.py index 15de816c..dfcc7e6c 100644 --- a/sources.py +++ b/sources.py @@ -485,6 +485,7 @@ class Source: Source(src="source/game/kart/KartMove.cpp", cc='4201_127', opts=REL_OPTS), Source(src="source/game/kart/KartObjectProxy.cpp", cc='4201_127', opts=REL_OPTS), Source(src="source/game/kart/KartSettings.cpp", cc='4201_127', opts=REL_OPTS), + Source(src="source/game/kart/KartState.cpp", cc='4201_127', opts=REL_OPTS), Source(src="source/game/kart/KartSus.cpp", cc='4201_127', opts=REL_OPTS), Source(src="source/game/kart/KartWheelPhysics.cpp", cc='4201_127', opts=REL_OPTS), Source(src="source/game/kart/KartPhysics.cpp", cc='4201_127', opts=REL_OPTS),