diff --git a/configure.py b/configure.py index c66366d4..2f7ffe6c 100644 --- a/configure.py +++ b/configure.py @@ -410,9 +410,9 @@ def provide_ppc2cpp(): ppc2cpp_zip = "ppc2cpp.zip" print("Downloading ppc2cpp...") if sys.platform == "win32" or sys.platform == "msys": - ppc2cpp_url = "https://github.com/em-eight/ppc2cpp/releases/download/v1.0-rc1/ppc2cpp-Windows.zip" + ppc2cpp_url = "https://github.com/em-eight/ppc2cpp/releases/download/v1.0-rc2/ppc2cpp-Windows.zip" else: - ppc2cpp_url = "https://github.com/em-eight/ppc2cpp/releases/download/v1.0-rc1/ppc2cpp-Linux.zip" + ppc2cpp_url = "https://github.com/em-eight/ppc2cpp/releases/download/v1.0-rc2/ppc2cpp-Linux.zip" urllib.request.urlretrieve(ppc2cpp_url, ppc2cpp_zip) with zipfile.ZipFile(ppc2cpp_zip, 'r') as zip_ref: zip_ref.extractall("tools/ppc2cpp") diff --git a/mkwutil/gen_asm.py b/mkwutil/gen_asm.py index 739ab32c..2d0b1980 100644 --- a/mkwutil/gen_asm.py +++ b/mkwutil/gen_asm.py @@ -137,7 +137,8 @@ def decompile_data(self, addr, const): txt, refs = self.disaser.data_to_text_with_referenced(addr, const=const) self.collect_refs(refs) # Remove duplicate extern declaration - self.extern_data.remove((addr, self.disaser._sym.get_name(addr))) + if (addr, self.disaser._sym.get_name(addr)) in self.extern_data: + self.extern_data.remove((addr, self.disaser._sym.get_name(addr))) return txt def collect_refs(self, refs): diff --git a/mkwutil/tools/set_symbol.py b/mkwutil/tools/set_symbol.py index 846e43f1..035af861 100755 --- a/mkwutil/tools/set_symbol.py +++ b/mkwutil/tools/set_symbol.py @@ -26,7 +26,7 @@ def set_symbol(address, symbolname, symbolmap): os.replace(temp_filename, symbolmap) if old_name != symbolname: - command = f"find asm source -type f \( -name \"*.hpp\" -o -name \"*.cpp\" -o -name \"*.s\" \) -exec sed -i 's/\<{old_name}\>/{symbolname}/g' {{}} +" + command = f"find asm source pack/*.lcf* -type f \( -name \"*.hpp\" -o -name \"*.cpp\" -o -name \"*.s\" \) -exec sed -i 's/\<{old_name}\>/{symbolname}/g' {{}} +" print(command) os.system(command) diff --git a/mkwutil/verify_staticr_rel.py b/mkwutil/verify_staticr_rel.py index 05c14681..4fd98530 100644 --- a/mkwutil/verify_staticr_rel.py +++ b/mkwutil/verify_staticr_rel.py @@ -25,9 +25,10 @@ def chunks(lst, n): for i in range(0, len(lst), n): yield lst[i:i + n] +# returns whether the section was equal or not. If not equal, the second return value contains the region that failed def compare_section_data(good_section: RelSection, bad_section: RelSection, info: Section, dataflow_funcs): if info.name != "text": - return good_section.data == bad_section.data + return good_section.data == bad_section.data, (info.start, info.start + len(info)) else: # check all section regions except those occupied by function to be checked by the flow-checker match = True @@ -35,11 +36,18 @@ def compare_section_data(good_section: RelSection, bad_section: RelSection, info for addr, size, name in dataflow_funcs: assert info.start <= addr and addr+size <= info.stop, "Can't dataflow-compare region outside .text!" func_off = addr - info.start - assert func_off > reg_start, "dataflow-checked functions must be non-overlapping and in incresing order" + assert func_off >= reg_start, "dataflow-checked functions must be non-overlapping and in incresing order" + match = good_section.data[reg_start:func_off] == bad_section.data[reg_start:func_off] and match + if not match: + return match, (info.start + reg_start, info.start + func_off) + reg_start = func_off + size + + func_off = len(info) + match = good_section.data[reg_start:func_off] == bad_section.data[reg_start:func_off] and match - return match + return match, (info.start + reg_start, info.start + func_off) def __native_binary(path): @@ -67,7 +75,8 @@ def check_dataflow_funcs(dataflow_funcs): orig_ppc2cpp_proj = Path("artifacts", "orig", "pal", "orig.ppc2cpp") target_ppc2cpp_proj = Path("artifacts", "orig", "pal", "target.ppc2cpp") import subprocess - completedProc = subprocess.run([str(PPC2CPP), "checkflow", str(orig_ppc2cpp_proj), str(target_ppc2cpp_proj)] + dataflow_func_names) + ppc2cpp_args = [str(PPC2CPP), "checkflow", str(orig_ppc2cpp_proj), str(target_ppc2cpp_proj)] + dataflow_func_names + completedProc = subprocess.run(ppc2cpp_args) return completedProc.returncode @@ -121,7 +130,7 @@ def verify_rel(reference: Path, target: Path): good_section = good.section_info[idx] bad_section = bad.section_info[idx] info = REL_SECTIONS[idx - 1] - match = compare_section_data(good_section, bad_section, info, dataflow_funcs) + match, region = compare_section_data(good_section, bad_section, info, dataflow_funcs) section_match = section_match and match tag = "OK" if match else "FAIL" if good_section.length != bad_section.length: @@ -145,6 +154,8 @@ def verify_rel(reference: Path, target: Path): for i, (good_bytes, bad_bytes) in enumerate(paired_data): vaddr = info.start + i * 4 + if vaddr < region[0] or vaddr > region[1]: + continue if good_bytes == bad_bytes or amount_printed > 10: continue print("%x: Good=%x Bad=%x" % (vaddr, struct.unpack(">I", good_bytes)[0], struct.unpack(">I", bad_bytes)[0])) diff --git a/pack/dol.lcf.j2 b/pack/dol.lcf.j2 index cf118ab1..e1b4b109 100644 --- a/pack/dol.lcf.j2 +++ b/pack/dol.lcf.j2 @@ -719,8 +719,8 @@ setAxisRotation__Q23EGG5QuatfFRCQ23EGG8Vector3ff squareNorm__Q23EGG5QuatfFv normalise__Q23EGG5QuatfFv inverse__Q23EGG5QuatfFv -rotateVector__Q23EGG5QuatfFRCQ23EGG8Vector3f -rotateVectorInv__Q23EGG5QuatfFRCQ23EGG8Vector3f +rotateVector__Q23EGG5QuatfFRCQ23EGG8Vector3fRQ23EGG8Vector3f +rotateVectorInv__Q23EGG5QuatfFRCQ23EGG8Vector3fRQ23EGG8Vector3f __ml__3EGGFRCQ23EGG5QuatfRCQ23EGG8Vector3f slerpTo__Q23EGG5QuatfCFRCQ23EGG5QuatffRQ23EGG5Quatf makeVectorRotation__Q23EGG5QuatfFRQ23EGG8Vector3fRQ23EGG8Vector3f diff --git a/pack/symbols.yml b/pack/symbols.yml index a28af67a..d5a38568 100644 --- a/pack/symbols.yml +++ b/pack/symbols.yml @@ -9009,7 +9009,7 @@ global: 0x8022f89c: 'unk_8022f89c' 0x8022f8c0: 'unk_8022f8c0' 0x8022f8e4: 'atan2_Q23EGG5MathfFf' - 0x8022f90c: 'rotateBaseX__Q23EGG9Matrix34fFRQ23EGG8Vector3fRQ23EGG9Matrix34f' + 0x8022f90c: 'inverseToC__Q23EGG9Matrix34fCFRQ23EGG9Matrix34f' 0x8022fabc: 'inverseTo__Q23EGG9Matrix34fCFRQ23EGG9Matrix34f' 0x8022fac0: 'inverseTransposeTo__Q23EGG9Matrix34fCFRQ23EGG9Matrix34f' 0x8022fac4: 'makeIdentity__Q23EGG9Matrix34fFv' @@ -9211,8 +9211,8 @@ global: 0x8023a138: 'squareNorm__Q23EGG5QuatfFv' 0x8023a168: 'normalise__Q23EGG5QuatfFv' 0x8023a210: 'inverse__Q23EGG5QuatfFv' - 0x8023a2d0: 'rotateVector__Q23EGG5QuatfFRCQ23EGG8Vector3f' - 0x8023a404: 'rotateVectorInv__Q23EGG5QuatfFRCQ23EGG8Vector3f' + 0x8023a2d0: 'rotateVector__Q23EGG5QuatfFRCQ23EGG8Vector3fRQ23EGG8Vector3f' + 0x8023a404: 'rotateVectorInv__Q23EGG5QuatfFRCQ23EGG8Vector3fRQ23EGG8Vector3f' 0x8023a540: '__ml__3EGGFRCQ23EGG5QuatfRCQ23EGG8Vector3f' 0x8023a5c4: 'slerpTo__Q23EGG5QuatfCFRCQ23EGG5QuatffRQ23EGG5Quatf' 0x8023a788: 'makeVectorRotation__Q23EGG5QuatfFRQ23EGG8Vector3fRQ23EGG8Vector3f' @@ -11404,7 +11404,7 @@ global: 0x802a4080: 'sInstance__Q26System8RKSystem' 0x802a4100: 'lbl_802a4100' 0x802a4118: 'lbl_802a4118' - 0x802a4130: 'lbl_802a4130' + 0x802a4130: 'RKSystem_ey' 0x802a4148: 'lbl_802a4148' 0x802a4178: 'lbl_802a4178' 0x802a41b0: 'lbl_802a41b0' @@ -18260,8 +18260,8 @@ global: 0x8059f4f0: 'unk_8059f4f0' 0x8059f508: 'unk_8059f508' 0x8059f5bc: 'PlayerPhysicsHolder_construct' - 0x8059f678: 'PlayerPhysics_destroy' - 0x8059f6b8: 'unk_8059f6b8' + 0x8059f678: '__dt__Q24kart12KartDynamicsFv' + 0x8059f6b8: '__dt__Q24kart11KartPhysics' 0x8059f6f8: 'unk_8059f6f8' 0x8059f788: 'unk_8059f788' 0x8059f7c8: 'unk_8059f7c8' @@ -18651,29 +18651,29 @@ global: 0x805b4a30: 'unk_805b4a30' 0x805b4a8c: 'unk_805b4a8c' 0x805b4a98: 'unk_805b4a98' - 0x805b4af8: 'PlayerPhysics_construct' - 0x805b4b54: 'PlayerPhysics_construct2' - 0x805b4d24: 'PlayerPhysics_reset' - 0x805b4dc0: 'PlayerPhysics_construct3' - 0x805b4dc4: 'PlayerPhysics_initInertia0' - 0x805b4e84: 'PlayerPhysics_initInertia1' + 0x805b4af8: '__ct__Q24kart12KartDynamicsFv' + 0x805b4b54: 'setDefault__Q24kart12KartDynamicsFv' + 0x805b4d24: 'reset__Q24kart12KartDynamicsFv' + 0x805b4dc0: 'init__Q24kart12KartDynamicsFv' + 0x805b4dc4: 'setBspParams__Q24kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3fbf' + 0x805b4e84: 'setInertia__Q24kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3f' 0x805b4f34: 'unk_805b4f34' 0x805b4f44: 'unk_805b4f44' - 0x805b50f8: 'unk_805b50f8' + 0x805b50f8: 'composeQuat__Q24kart12KartDynamicsFRQ23EGG5QuatfRCQ23EGG5QuatfRCQ23EGG5Quatf' 0x805b5170: 'PlayerPhysics_update' - 0x805b5b64: 'unk_805b5b64' - 0x805b5b68: 'PlayerPhysics_stabilize' + 0x805b5b64: 'forceUpright__Q24kart12KartDynamicsFv' + 0x805b5b68: 'stabilize__Q24kart12KartDynamicsFv' 0x805b5ce8: 'unk_805b5ce8' - 0x805b5e40: 'unk_805b5e40' + 0x805b5e40: 'applyTorqueWorld__Q24kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3f' 0x805b5f44: 'unk_805b5f44' 0x805b5f78: 'unk_805b5f78' - 0x805b6150: 'PlayerPhysics_applyWheelSuspension' + 0x805b6150: 'applySuspensionWrench__Q24kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3fRCQ23EGG8Vector3fb' 0x805b629c: 'unk_805b629c' - 0x805b6388: 'unk_805b6388' - 0x805b63bc: 'unk_805b63bc' - 0x805b6438: 'unk_805b6438' - 0x805b6448: 'PlayerPhysicsBike_stabilize' - 0x805b66e4: 'PlayerPhysicsBike_destroy' + 0x805b6388: 'addForce__Q24kart12KartDynamicsFRCQ23EGG8Vector3f' + 0x805b63bc: 'getAngAcc__Q24kart12KartDynamicsFRQ23EGG8Vector3fRCQ23EGG8Vector3f' + 0x805b6438: 'forceUpright__Q24kart16KartDynamicsBikeFv' + 0x805b6448: 'stabilize__Q24kart16KartDynamicsBikeFv' + 0x805b66e4: '__dt__Q24kart16KartDynamicsBikeFv' 0x805b6724: 'PlayerSub18_findCollisionInner' 0x805b6a9c: 'unk_805b6a9c' 0x805b6d48: 'PlayerSub18_applyBodyCollision' @@ -36632,7 +36632,7 @@ global: 0x808b6968: 'lbl_808b6968' 0x808b69b0: 'lbl_808b69b0' 0x808b69cc: 'lbl_808b69cc' - 0x808b69e8: 'lbl_808b69e8' + 0x808b69e8: '__vt__Q24kart11KartPhysics' 0x808b6a08: 'lbl_808b6a08' 0x808b6a10: 'lbl_808b6a10' 0x808b6a20: 'lbl_808b6a20' @@ -36704,8 +36704,8 @@ global: 0x808b72a0: 'lbl_808b72a0' 0x808b72c0: 'lbl_808b72c0' 0x808b72e0: 'lbl_808b72e0' - 0x808b7300: 'lbl_808b7300' - 0x808b7314: 'lbl_808b7314' + 0x808b7300: '__vt__Q24kart16KartDynamicsBike' + 0x808b7314: '__vt__Q24kart12KartDynamics' 0x808b7328: 'lbl_808b7328' 0x808b7334: 'lbl_808b7334' 0x808b7340: 'lbl_808b7340' diff --git a/source/egg/math/eggQuat.cpp b/source/egg/math/eggQuat.cpp index ceff10e2..5f5a3693 100644 --- a/source/egg/math/eggQuat.cpp +++ b/source/egg/math/eggQuat.cpp @@ -433,11 +433,12 @@ asm Quatf Quatf::inverse() { // clang-format on } -// Symbol: rotateVector__Q23EGG5QuatfFRCQ23EGG8Vector3f +// Symbol: rotateVector__Q23EGG5QuatfFRCQ23EGG8Vector3fRQ23EGG8Vector3f // PAL: 0x8023a2d0..0x8023a404 -MARK_BINARY_BLOB(rotateVector__Q23EGG5QuatfFRCQ23EGG8Vector3f, 0x8023a2d0, +MARK_BINARY_BLOB(rotateVector__Q23EGG5QuatfFRCQ23EGG8Vector3fRQ23EGG8Vector3f, 0x8023a2d0, 0x8023a404); -asm void Quatf::rotateVector(const Vector3f& v) { + +asm void Quatf::rotateVector(const Vector3f& v, Vector3f& out) { // clang-format off nofralloc; stwu r1, -0x50(r1); @@ -520,11 +521,11 @@ asm void Quatf::rotateVector(const Vector3f& v) { // clang-format on } -// Symbol: rotateVectorInv__Q23EGG5QuatfFRCQ23EGG8Vector3f +// Symbol: rotateVectorInv__Q23EGG5QuatfFRCQ23EGG8Vector3fRQ23EGG8Vector3f // PAL: 0x8023a404..0x8023a540 -MARK_BINARY_BLOB(rotateVectorInv__Q23EGG5QuatfFRCQ23EGG8Vector3f, 0x8023a404, +MARK_BINARY_BLOB(rotateVectorInv__Q23EGG5QuatfFRCQ23EGG8Vector3fRQ23EGG8Vector3f, 0x8023a404, 0x8023a540); -asm void Quatf::rotateVectorInv(const Vector3f& v) { +asm void Quatf::rotateVectorInv(const Vector3f& v, Vector3f& out) { // clang-format off nofralloc; stwu r1, -0x50(r1); diff --git a/source/egg/math/eggQuat.hpp b/source/egg/math/eggQuat.hpp index 028097e3..dae1fed8 100644 --- a/source/egg/math/eggQuat.hpp +++ b/source/egg/math/eggQuat.hpp @@ -13,18 +13,68 @@ namespace EGG { class Quatf { public: - void set(float a, float b, float c, float d); + void set(float w, float x, float y, float z); void setRPY(const Vector3f& euler); void setRPY(float r, float p, float y); void setAxisRotation(const Vector3f& axis, float angle); float squareNorm(); void normalise(); Quatf inverse(); - void rotateVector(const Vector3f& v); - void rotateVectorInv(const Vector3f& v); + void rotateVector(const Vector3f& v, Vector3f& out); + void rotateVectorInv(const Vector3f& v, Vector3f& out); void slerpTo(const Quatf& r4, float, Quatf& r5) const; void makeVectorRotation(Vector3f& v0, Vector3f& v1); + inline void setIdentity() { + set(1.0f, 0.0f, 0.0f, 0.0f); + } + + inline Quatf& operator*(float f) { + _[0] *= f; + _[1] *= f; + _[2] *= f; + _[3] *= f; + return *this; + } + + inline Quatf& operator+=(const Quatf& rhs) { + _[0] += rhs._[0]; + _[1] += rhs._[1]; + _[2] += rhs._[2]; + _[3] += rhs._[3]; + } + + inline static void quatMul(Quatf& dst, const Quatf& q1, const Quatf& q2) { + float x1 = q1._[0]; + float x2 = q2._[0]; + float y1 = q1._[1]; + float y2 = q2._[1]; + float z1 = q1._[2]; + float z2 = q2._[2]; + float w1 = q1._[3]; + dst.set( + -(x1*x2 + y1*y2 + z1*z2), + y1*z2 + w1*x2 - z1*y2, + z1*x2 + w1*y2 - x1*z2, + w1*z2 + x1*y2 - y1*x2 + ); + } + inline static void quatMul(Quatf& dst, const Quatf& q1, const Vector3f& v) { + float x1 = q1._[0]; + float x2 = v.x; + float y1 = q1._[1]; + float y2 = v.y; + float z1 = q1._[2]; + float z2 = v.z; + float w1 = q1._[3]; + dst.set( + -(x1*x2 + y1*y2 + z1*z2), + y1*z2 + w1*x2 - z1*y2, + z1*x2 + w1*y2 - x1*z2, + w1*z2 + x1*y2 - y1*x2 + ); + } + f32 _[4]; }; diff --git a/source/game/kart/KartMove.cpp b/source/game/kart/KartMove.cpp index 64100f3c..3b9e1271 100644 --- a/source/game/kart/KartMove.cpp +++ b/source/game/kart/KartMove.cpp @@ -52,7 +52,7 @@ extern UNKNOWN_FUNCTION(setAxisRotation__Q23EGG5QuatfFRCQ23EGG8Vector3ff); // PAL: 0x8023a168 extern UNKNOWN_FUNCTION(normalise__Q23EGG5QuatfFv); // PAL: 0x8023a2d0 -extern UNKNOWN_FUNCTION(rotateVector__Q23EGG5QuatfFRCQ23EGG8Vector3f); +extern UNKNOWN_FUNCTION(rotateVector__Q23EGG5QuatfFRCQ23EGG8Vector3fRQ23EGG8Vector3f); // PAL: 0x8023a5c4 extern UNKNOWN_FUNCTION(slerpTo__Q23EGG5QuatfCFRCQ23EGG5QuatffRQ23EGG5Quatf); // PAL: 0x8023a788 @@ -427,11 +427,11 @@ extern UNKNOWN_FUNCTION(VEC3_rejUnit); // PAL: 0x805aec24 extern UNKNOWN_FUNCTION(VEC3_projAndRej); // PAL: 0x805b4d24 -extern UNKNOWN_FUNCTION(PlayerPhysics_reset); +extern UNKNOWN_FUNCTION(reset__Q24kart12KartDynamicsFv); // PAL: 0x805b5ce8 extern UNKNOWN_FUNCTION(unk_805b5ce8); // PAL: 0x805b6388 -extern UNKNOWN_FUNCTION(unk_805b6388); +extern UNKNOWN_FUNCTION(addForce__Q24kart12KartDynamicsFRCQ23EGG8Vector3f); // PAL: 0x806a1808 extern UNKNOWN_FUNCTION(unk_806a1808); // PAL: 0x806a3948 @@ -521,7 +521,7 @@ extern UNKNOWN_DATA(lbl_802a4100); // PAL: 0x802a4118 extern UNKNOWN_DATA(lbl_802a4118); // PAL: 0x802a4130 -extern UNKNOWN_DATA(lbl_802a4130); +extern UNKNOWN_DATA(RKSystem_ey); // PAL: 0x802a4148 extern UNKNOWN_DATA(lbl_802a4148); // PAL: 0x80384ba0 diff --git a/source/game/kart/KartObjectProxy.cpp b/source/game/kart/KartObjectProxy.cpp index 8d2e7533..f9d4edfb 100644 --- a/source/game/kart/KartObjectProxy.cpp +++ b/source/game/kart/KartObjectProxy.cpp @@ -75,7 +75,7 @@ extern UNKNOWN_FUNCTION(unk_805a6ab8); // PAL: 0x805a6dcc extern UNKNOWN_FUNCTION(unk_805a6dcc); // PAL: 0x805b4e84 -extern UNKNOWN_FUNCTION(PlayerPhysics_initInertia1); +extern UNKNOWN_FUNCTION(setInertia__Q24kart12KartDynamicsFRCQ23EGG8Vector3fRCQ23EGG8Vector3f); // PAL: 0x808646f0 extern UNKNOWN_FUNCTION(unk_808646f0); // Extern data references. // PAL: 0x80891c58 diff --git a/source/game/system/CourseMap.cpp b/source/game/system/CourseMap.cpp index bcb76b69..0c12144c 100644 --- a/source/game/system/CourseMap.cpp +++ b/source/game/system/CourseMap.cpp @@ -23,7 +23,7 @@ extern UNKNOWN_FUNCTION(__dla__FPv); // PAL: 0x80239f58 extern UNKNOWN_FUNCTION(setRPY__Q23EGG5QuatfFfff); // PAL: 0x8023a2d0 -extern UNKNOWN_FUNCTION(rotateVector__Q23EGG5QuatfFRCQ23EGG8Vector3f); +extern UNKNOWN_FUNCTION(rotateVector__Q23EGG5QuatfFRCQ23EGG8Vector3fRQ23EGG8Vector3f); // PAL: 0x80243a00 extern UNKNOWN_FUNCTION(normalise__Q23EGG8Vector2fFv); // PAL: 0x80511e00 @@ -170,7 +170,7 @@ extern UNKNOWN_FUNCTION(unk_8054d114); // PAL: 0x802a4118 extern UNKNOWN_DATA(lbl_802a4118); // PAL: 0x802a4130 -extern UNKNOWN_DATA(lbl_802a4130); +extern UNKNOWN_DATA(RKSystem_ey); // PAL: 0x802a4148 extern UNKNOWN_DATA(lbl_802a4148); // PAL: 0x8088f8e8 @@ -1537,7 +1537,7 @@ asm void VEC3_fromQuaternionRotated(EGG::Vector3f& dst, const EGG::Quatf& q, /* 80514800 7C832378 */ mr r3, r4 /* 80514804 7CA42B78 */ mr r4, r5 /* 80514808 7C050378 */ mr r5, r0 - /* 8051480C 4BD25AC4 */ b rotateVector__Q23EGG5QuatfFRCQ23EGG8Vector3f + /* 8051480C 4BD25AC4 */ b rotateVector__Q23EGG5QuatfFRCQ23EGG8Vector3fRQ23EGG8Vector3f // clang-format on } @@ -1644,10 +1644,10 @@ asm UNKNOWN_FUNCTION(unk_805148a0) { /* 8051491C 38810048 */ addi r4, r1, 0x48 /* 80514920 38A54118 */ addi r5, r5, lbl_802a4118@l /* 80514924 4BFFFED9 */ bl VEC3_fromQuaternionRotated__FRQ23EGG8Vector3fRCQ23EGG5QuatfRCQ23EGG8Vector3f - /* 80514928 3CA0802A */ lis r5, lbl_802a4130@ha + /* 80514928 3CA0802A */ lis r5, RKSystem_ey@ha /* 8051492C 38610020 */ addi r3, r1, 0x20 /* 80514930 38810048 */ addi r4, r1, 0x48 - /* 80514934 38A54130 */ addi r5, r5, lbl_802a4130@l + /* 80514934 38A54130 */ addi r5, r5, RKSystem_ey@l /* 80514938 4BFFFEC5 */ bl VEC3_fromQuaternionRotated__FRQ23EGG8Vector3fRCQ23EGG5QuatfRCQ23EGG8Vector3f /* 8051493C C03E017C */ lfs f1, 0x17c(r30) /* 80514940 4BB70841 */ bl CosFIdx__Q24nw4r4mathFf @@ -3399,9 +3399,17 @@ MapdataAreaBase::MapdataAreaBase(const SData* data) : mIndex(-1) { mZAxis.y = 0.0f; mZAxis.x = 0.0f; } +} -// Regswap - https://decomp.me/scratch/1tQoj -MARK_FLOW_CHECK(0x805160b0); +#ifndef NON_MATCHING +// Symbol: isInside__Q26System15MapdataAreaBaseCFRCQ23EGG8Vector3f +MARK_BINARY_BLOB(isInside__Q26System15MapdataAreaBaseCFRCQ23EGG8Vector3f, 0x805160b0, 0x80516138); +asm UNKNOWN_FUNCTION(isInside__Q26System15MapdataAreaBaseCFRCQ23EGG8Vector3f) { + #include "asm/805160b0.s" +} +#else +// Stack + regswap - https://decomp.me/scratch/1tQoj +//MARK_FLOW_CHECK(0x805160b0); bool MapdataAreaBase::isInside(const EGG::Vector3f& pos) const { f32 x = mpData->position.x - pos.x; f32 y = mpData->position.y - pos.y; @@ -3410,7 +3418,9 @@ bool MapdataAreaBase::isInside(const EGG::Vector3f& pos) const { EGG::Vector3f pos_(x, y, z); return pos_.dot() > mBoundingSphereRadiusSq ? false : isInsideShape(pos); } +#endif +namespace System { s32 MapdataAreaBase::getRouteId() const { // Of course it uses r0 return CourseMap::instance()->getVersion() >= 2200 ? (s8)mpData->railID : -1; @@ -3595,11 +3605,11 @@ asm UNKNOWN_FUNCTION(AreaBox_construct) { /* 80516324 38A54118 */ addi r5, r5, lbl_802a4118@l /* 80516328 4BFFE4D5 */ bl VEC3_fromQuaternionRotated__FRQ23EGG8Vector3fRCQ23EGG5QuatfRCQ23EGG8Vector3f /* 8051632C C0010020 */ lfs f0, 0x20(r1) - /* 80516330 3CA0802A */ lis r5, lbl_802a4130@ha + /* 80516330 3CA0802A */ lis r5, RKSystem_ey@ha /* 80516334 D01F0008 */ stfs f0, 8(r31) /* 80516338 38610014 */ addi r3, r1, 0x14 /* 8051633C 38810030 */ addi r4, r1, 0x30 - /* 80516340 38A54130 */ addi r5, r5, lbl_802a4130@l + /* 80516340 38A54130 */ addi r5, r5, RKSystem_ey@l /* 80516344 C0010024 */ lfs f0, 0x24(r1) /* 80516348 D01F000C */ stfs f0, 0xc(r31) /* 8051634C C0010028 */ lfs f0, 0x28(r1) @@ -3812,11 +3822,11 @@ asm UNKNOWN_FUNCTION(AreaCylinder_construct) { /* 805165F8 38A54118 */ addi r5, r5, lbl_802a4118@l /* 805165FC 4BFFE201 */ bl VEC3_fromQuaternionRotated__FRQ23EGG8Vector3fRCQ23EGG5QuatfRCQ23EGG8Vector3f /* 80516600 C0010020 */ lfs f0, 0x20(r1) - /* 80516604 3CA0802A */ lis r5, lbl_802a4130@ha + /* 80516604 3CA0802A */ lis r5, RKSystem_ey@ha /* 80516608 D01F0008 */ stfs f0, 8(r31) /* 8051660C 38610014 */ addi r3, r1, 0x14 /* 80516610 38810030 */ addi r4, r1, 0x30 - /* 80516614 38A54130 */ addi r5, r5, lbl_802a4130@l + /* 80516614 38A54130 */ addi r5, r5, RKSystem_ey@l /* 80516618 C0010024 */ lfs f0, 0x24(r1) /* 8051661C D01F000C */ stfs f0, 0xc(r31) /* 80516620 C0010028 */ lfs f0, 0x28(r1) @@ -6295,10 +6305,10 @@ asm UNKNOWN_FUNCTION(unk_805184fc) { /* 80518578 38810060 */ addi r4, r1, 0x60 /* 8051857C 38A54118 */ addi r5, r5, lbl_802a4118@l /* 80518580 4BFFC27D */ bl VEC3_fromQuaternionRotated__FRQ23EGG8Vector3fRCQ23EGG5QuatfRCQ23EGG8Vector3f - /* 80518584 3CA0802A */ lis r5, lbl_802a4130@ha + /* 80518584 3CA0802A */ lis r5, RKSystem_ey@ha /* 80518588 38610038 */ addi r3, r1, 0x38 /* 8051858C 38810060 */ addi r4, r1, 0x60 - /* 80518590 38A54130 */ addi r5, r5, lbl_802a4130@l + /* 80518590 38A54130 */ addi r5, r5, RKSystem_ey@l /* 80518594 4BFFC269 */ bl VEC3_fromQuaternionRotated__FRQ23EGG8Vector3fRCQ23EGG5QuatfRCQ23EGG8Vector3f /* 80518598 C03F0194 */ lfs f1, 0x194(r31) /* 8051859C 4BB6CBE5 */ bl CosFIdx__Q24nw4r4mathFf