Nearly match CTweaks.cpp

Former-commit-id: 8a7821264f
This commit is contained in:
Phillip Stephens 2023-10-07 22:57:42 -07:00
parent 008dbc829b
commit 419604163a
16 changed files with 254 additions and 50 deletions

View File

@ -7,7 +7,7 @@ __CARDGetFatBlock:
/* 803BA56C 003B74CC 80 63 00 88 */ lwz r3, 0x88(r3) /* 803BA56C 003B74CC 80 63 00 88 */ lwz r3, 0x88(r3)
/* 803BA570 003B74D0 4E 80 00 20 */ blr /* 803BA570 003B74D0 4E 80 00 20 */ blr
WriteCallback: .fn WriteCallback, local
/* 803BA574 003B74D4 7C 08 02 A6 */ mflr r0 /* 803BA574 003B74D4 7C 08 02 A6 */ mflr r0
/* 803BA578 003B74D8 90 01 00 04 */ stw r0, 4(r1) /* 803BA578 003B74D8 90 01 00 04 */ stw r0, 4(r1)
/* 803BA57C 003B74DC 94 21 FF E0 */ stwu r1, -0x20(r1) /* 803BA57C 003B74DC 94 21 FF E0 */ stwu r1, -0x20(r1)
@ -65,8 +65,9 @@ lbl_803BA62C:
/* 803BA63C 003B759C 38 21 00 20 */ addi r1, r1, 0x20 /* 803BA63C 003B759C 38 21 00 20 */ addi r1, r1, 0x20
/* 803BA640 003B75A0 7C 08 03 A6 */ mtlr r0 /* 803BA640 003B75A0 7C 08 03 A6 */ mtlr r0
/* 803BA644 003B75A4 4E 80 00 20 */ blr /* 803BA644 003B75A4 4E 80 00 20 */ blr
.endfn WriteCallback
EraseCallback: .fn EraseCallback, local
/* 803BA648 003B75A8 7C 08 02 A6 */ mflr r0 /* 803BA648 003B75A8 7C 08 02 A6 */ mflr r0
/* 803BA64C 003B75AC 90 01 00 04 */ stw r0, 4(r1) /* 803BA64C 003B75AC 90 01 00 04 */ stw r0, 4(r1)
/* 803BA650 003B75B0 94 21 FF D8 */ stwu r1, -0x28(r1) /* 803BA650 003B75B0 94 21 FF D8 */ stwu r1, -0x28(r1)
@ -120,6 +121,7 @@ lbl_803BA6F4:
/* 803BA704 003B7664 38 21 00 28 */ addi r1, r1, 0x28 /* 803BA704 003B7664 38 21 00 28 */ addi r1, r1, 0x28
/* 803BA708 003B7668 7C 08 03 A6 */ mtlr r0 /* 803BA708 003B7668 7C 08 03 A6 */ mtlr r0
/* 803BA70C 003B766C 4E 80 00 20 */ blr /* 803BA70C 003B766C 4E 80 00 20 */ blr
.endfn EraseCallback
.global __CARDAllocBlock .global __CARDAllocBlock
__CARDAllocBlock: __CARDAllocBlock:

View File

@ -2,7 +2,7 @@
.section .text, "ax" .section .text, "ax"
CreateCallbackFat: .fn CreateCallbackFat, local
/* 803BD1C0 003BA120 7C 08 02 A6 */ mflr r0 /* 803BD1C0 003BA120 7C 08 02 A6 */ mflr r0
/* 803BD1C4 003BA124 90 01 00 04 */ stw r0, 4(r1) /* 803BD1C4 003BA124 90 01 00 04 */ stw r0, 4(r1)
/* 803BD1C8 003BA128 94 21 FF D8 */ stwu r1, -0x28(r1) /* 803BD1C8 003BA128 94 21 FF D8 */ stwu r1, -0x28(r1)
@ -81,6 +81,7 @@ lbl_803BD2DC:
/* 803BD2E4 003BA244 38 21 00 28 */ addi r1, r1, 0x28 /* 803BD2E4 003BA244 38 21 00 28 */ addi r1, r1, 0x28
/* 803BD2E8 003BA248 7C 08 03 A6 */ mtlr r0 /* 803BD2E8 003BA248 7C 08 03 A6 */ mtlr r0
/* 803BD2EC 003BA24C 4E 80 00 20 */ blr /* 803BD2EC 003BA24C 4E 80 00 20 */ blr
.endfn CreateCallbackFat
.global CARDCreateAsync .global CARDCreateAsync
CARDCreateAsync: CARDCreateAsync:

View File

@ -7,7 +7,7 @@ __CARDGetDirBlock:
/* 803BA970 003B78D0 80 63 00 84 */ lwz r3, 0x84(r3) /* 803BA970 003B78D0 80 63 00 84 */ lwz r3, 0x84(r3)
/* 803BA974 003B78D4 4E 80 00 20 */ blr /* 803BA974 003B78D4 4E 80 00 20 */ blr
WriteCallback: .fn WriteCallback, local
/* 803BA978 003B78D8 7C 08 02 A6 */ mflr r0 /* 803BA978 003B78D8 7C 08 02 A6 */ mflr r0
/* 803BA97C 003B78DC 90 01 00 04 */ stw r0, 4(r1) /* 803BA97C 003B78DC 90 01 00 04 */ stw r0, 4(r1)
/* 803BA980 003B78E0 94 21 FF E0 */ stwu r1, -0x20(r1) /* 803BA980 003B78E0 94 21 FF E0 */ stwu r1, -0x20(r1)
@ -64,9 +64,9 @@ lbl_803BAA2C:
/* 803BAA3C 003B799C 38 21 00 20 */ addi r1, r1, 0x20 /* 803BAA3C 003B799C 38 21 00 20 */ addi r1, r1, 0x20
/* 803BAA40 003B79A0 7C 08 03 A6 */ mtlr r0 /* 803BAA40 003B79A0 7C 08 03 A6 */ mtlr r0
/* 803BAA44 003B79A4 4E 80 00 20 */ blr /* 803BAA44 003B79A4 4E 80 00 20 */ blr
.endfn WriteCallback
.global EraseCallback .fn EraseCallback, local
EraseCallback:
/* 803BAA48 003B79A8 7C 08 02 A6 */ mflr r0 /* 803BAA48 003B79A8 7C 08 02 A6 */ mflr r0
/* 803BAA4C 003B79AC 90 01 00 04 */ stw r0, 4(r1) /* 803BAA4C 003B79AC 90 01 00 04 */ stw r0, 4(r1)
/* 803BAA50 003B79B0 94 21 FF D8 */ stwu r1, -0x28(r1) /* 803BAA50 003B79B0 94 21 FF D8 */ stwu r1, -0x28(r1)
@ -120,6 +120,7 @@ lbl_803BAAF4:
/* 803BAB04 003B7A64 38 21 00 28 */ addi r1, r1, 0x28 /* 803BAB04 003B7A64 38 21 00 28 */ addi r1, r1, 0x28
/* 803BAB08 003B7A68 7C 08 03 A6 */ mtlr r0 /* 803BAB08 003B7A68 7C 08 03 A6 */ mtlr r0
/* 803BAB0C 003B7A6C 4E 80 00 20 */ blr /* 803BAB0C 003B7A6C 4E 80 00 20 */ blr
.endfn EraseCallback
.global __CARDUpdateDir .global __CARDUpdateDir
__CARDUpdateDir: __CARDUpdateDir:

View File

@ -2,7 +2,7 @@
.section .text, "ax" .section .text, "ax"
FormatCallback: .fn FormatCallback, local
/* 803BC588 003B94E8 7C 08 02 A6 */ mflr r0 /* 803BC588 003B94E8 7C 08 02 A6 */ mflr r0
/* 803BC58C 003B94EC 90 01 00 04 */ stw r0, 4(r1) /* 803BC58C 003B94EC 90 01 00 04 */ stw r0, 4(r1)
/* 803BC590 003B94F0 94 21 FF E0 */ stwu r1, -0x20(r1) /* 803BC590 003B94F0 94 21 FF E0 */ stwu r1, -0x20(r1)
@ -88,6 +88,7 @@ lbl_803BC6AC:
/* 803BC6C0 003B9620 38 21 00 20 */ addi r1, r1, 0x20 /* 803BC6C0 003B9620 38 21 00 20 */ addi r1, r1, 0x20
/* 803BC6C4 003B9624 7C 08 03 A6 */ mtlr r0 /* 803BC6C4 003B9624 7C 08 03 A6 */ mtlr r0
/* 803BC6C8 003B9628 4E 80 00 20 */ blr /* 803BC6C8 003B9628 4E 80 00 20 */ blr
.endfn FormatCallback
.global __CARDFormatRegionAsync .global __CARDFormatRegionAsync
__CARDFormatRegionAsync: __CARDFormatRegionAsync:

View File

@ -126,7 +126,7 @@ lbl_803BD6A8:
/* 803BD6C0 003BA620 7C 08 03 A6 */ mtlr r0 /* 803BD6C0 003BA620 7C 08 03 A6 */ mtlr r0
/* 803BD6C4 003BA624 4E 80 00 20 */ blr /* 803BD6C4 003BA624 4E 80 00 20 */ blr
ReadCallback: .fn ReadCallback, local
/* 803BD6C8 003BA628 7C 08 02 A6 */ mflr r0 /* 803BD6C8 003BA628 7C 08 02 A6 */ mflr r0
/* 803BD6CC 003BA62C 90 01 00 04 */ stw r0, 4(r1) /* 803BD6CC 003BA62C 90 01 00 04 */ stw r0, 4(r1)
/* 803BD6D0 003BA630 94 21 FF D8 */ stwu r1, -0x28(r1) /* 803BD6D0 003BA630 94 21 FF D8 */ stwu r1, -0x28(r1)
@ -210,6 +210,7 @@ lbl_803BD7E4:
/* 803BD7EC 003BA74C 38 21 00 28 */ addi r1, r1, 0x28 /* 803BD7EC 003BA74C 38 21 00 28 */ addi r1, r1, 0x28
/* 803BD7F0 003BA750 7C 08 03 A6 */ mtlr r0 /* 803BD7F0 003BA750 7C 08 03 A6 */ mtlr r0
/* 803BD7F4 003BA754 4E 80 00 20 */ blr /* 803BD7F4 003BA754 4E 80 00 20 */ blr
.endfn ReadCallback
.global CARDReadAsync .global CARDReadAsync
CARDReadAsync: CARDReadAsync:

View File

@ -14,18 +14,23 @@ __vt__12CInputStream:
.section .sbss, "wa" .section .sbss, "wa"
.balign 8 .balign 8
.global lbl_805A94F0 .obj c$101, local
lbl_805A94F0: .skip 0x1
.endobj c$101
.skip 0x1
.obj s$108, local
.skip 0x2 .skip 0x2
.global lbl_805A94F2 .endobj s$108
lbl_805A94F2:
.skip 0x2 .obj l$112, local
.global lbl_805A94F4
lbl_805A94F4:
.skip 0x4 .skip 0x4
.global lbl_805A94F8 .endobj l$112
lbl_805A94F8:
.obj lbl_805A94F8, local
.skip 0x4 .skip 0x4
.endobj lbl_805A94F8
.global lbl_805A94FC .global lbl_805A94FC
lbl_805A94FC: lbl_805A94FC:
.skip 0x4 .skip 0x4
@ -68,12 +73,12 @@ ReadLongLong__12CInputStreamFv:
ReadLong__12CInputStreamFv: ReadLong__12CInputStreamFv:
/* 8033EC84 0033BBE4 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8033EC84 0033BBE4 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 8033EC88 0033BBE8 7C 08 02 A6 */ mflr r0 /* 8033EC88 0033BBE8 7C 08 02 A6 */ mflr r0
/* 8033EC8C 0033BBEC 38 8D A9 34 */ addi r4, r13, lbl_805A94F4@sda21 /* 8033EC8C 0033BBEC 38 8D A9 34 */ addi r4, r13, l$112@sda21
/* 8033EC90 0033BBF0 38 A0 00 04 */ li r5, 4 /* 8033EC90 0033BBF0 38 A0 00 04 */ li r5, 4
/* 8033EC94 0033BBF4 90 01 00 14 */ stw r0, 0x14(r1) /* 8033EC94 0033BBF4 90 01 00 14 */ stw r0, 0x14(r1)
/* 8033EC98 0033BBF8 48 00 02 BD */ bl Get__12CInputStreamFPvUl /* 8033EC98 0033BBF8 48 00 02 BD */ bl Get__12CInputStreamFPvUl
/* 8033EC9C 0033BBFC 80 01 00 14 */ lwz r0, 0x14(r1) /* 8033EC9C 0033BBFC 80 01 00 14 */ lwz r0, 0x14(r1)
/* 8033ECA0 0033BC00 80 6D A9 34 */ lwz r3, lbl_805A94F4@sda21(r13) /* 8033ECA0 0033BC00 80 6D A9 34 */ lwz r3, l$112@sda21(r13)
/* 8033ECA4 0033BC04 7C 08 03 A6 */ mtlr r0 /* 8033ECA4 0033BC04 7C 08 03 A6 */ mtlr r0
/* 8033ECA8 0033BC08 38 21 00 10 */ addi r1, r1, 0x10 /* 8033ECA8 0033BC08 38 21 00 10 */ addi r1, r1, 0x10
/* 8033ECAC 0033BC0C 4E 80 00 20 */ blr /* 8033ECAC 0033BC0C 4E 80 00 20 */ blr
@ -82,12 +87,12 @@ ReadLong__12CInputStreamFv:
ReadShort__12CInputStreamFv: ReadShort__12CInputStreamFv:
/* 8033ECB0 0033BC10 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8033ECB0 0033BC10 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 8033ECB4 0033BC14 7C 08 02 A6 */ mflr r0 /* 8033ECB4 0033BC14 7C 08 02 A6 */ mflr r0
/* 8033ECB8 0033BC18 38 8D A9 32 */ addi r4, r13, lbl_805A94F2@sda21 /* 8033ECB8 0033BC18 38 8D A9 32 */ addi r4, r13, s$108@sda21
/* 8033ECBC 0033BC1C 38 A0 00 02 */ li r5, 2 /* 8033ECBC 0033BC1C 38 A0 00 02 */ li r5, 2
/* 8033ECC0 0033BC20 90 01 00 14 */ stw r0, 0x14(r1) /* 8033ECC0 0033BC20 90 01 00 14 */ stw r0, 0x14(r1)
/* 8033ECC4 0033BC24 48 00 02 91 */ bl Get__12CInputStreamFPvUl /* 8033ECC4 0033BC24 48 00 02 91 */ bl Get__12CInputStreamFPvUl
/* 8033ECC8 0033BC28 80 01 00 14 */ lwz r0, 0x14(r1) /* 8033ECC8 0033BC28 80 01 00 14 */ lwz r0, 0x14(r1)
/* 8033ECCC 0033BC2C A0 6D A9 32 */ lhz r3, lbl_805A94F2@sda21(r13) /* 8033ECCC 0033BC2C A0 6D A9 32 */ lhz r3, s$108@sda21(r13)
/* 8033ECD0 0033BC30 7C 08 03 A6 */ mtlr r0 /* 8033ECD0 0033BC30 7C 08 03 A6 */ mtlr r0
/* 8033ECD4 0033BC34 38 21 00 10 */ addi r1, r1, 0x10 /* 8033ECD4 0033BC34 38 21 00 10 */ addi r1, r1, 0x10
/* 8033ECD8 0033BC38 4E 80 00 20 */ blr /* 8033ECD8 0033BC38 4E 80 00 20 */ blr
@ -111,12 +116,12 @@ ReadBool__12CInputStreamFv:
ReadChar__12CInputStreamFv: ReadChar__12CInputStreamFv:
/* 8033ED0C 0033BC6C 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8033ED0C 0033BC6C 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 8033ED10 0033BC70 7C 08 02 A6 */ mflr r0 /* 8033ED10 0033BC70 7C 08 02 A6 */ mflr r0
/* 8033ED14 0033BC74 38 8D A9 30 */ addi r4, r13, lbl_805A94F0@sda21 /* 8033ED14 0033BC74 38 8D A9 30 */ addi r4, r13, c$101@sda21
/* 8033ED18 0033BC78 38 A0 00 01 */ li r5, 1 /* 8033ED18 0033BC78 38 A0 00 01 */ li r5, 1
/* 8033ED1C 0033BC7C 90 01 00 14 */ stw r0, 0x14(r1) /* 8033ED1C 0033BC7C 90 01 00 14 */ stw r0, 0x14(r1)
/* 8033ED20 0033BC80 48 00 02 35 */ bl Get__12CInputStreamFPvUl /* 8033ED20 0033BC80 48 00 02 35 */ bl Get__12CInputStreamFPvUl
/* 8033ED24 0033BC84 80 01 00 14 */ lwz r0, 0x14(r1) /* 8033ED24 0033BC84 80 01 00 14 */ lwz r0, 0x14(r1)
/* 8033ED28 0033BC88 88 6D A9 30 */ lbz r3, lbl_805A94F0@sda21(r13) /* 8033ED28 0033BC88 88 6D A9 30 */ lbz r3, c$101@sda21(r13)
/* 8033ED2C 0033BC8C 7C 08 03 A6 */ mtlr r0 /* 8033ED2C 0033BC8C 7C 08 03 A6 */ mtlr r0
/* 8033ED30 0033BC90 38 21 00 10 */ addi r1, r1, 0x10 /* 8033ED30 0033BC90 38 21 00 10 */ addi r1, r1, 0x10
/* 8033ED34 0033BC94 4E 80 00 20 */ blr /* 8033ED34 0033BC94 4E 80 00 20 */ blr
@ -427,13 +432,13 @@ __ct__12CInputStreamFi:
/* 8033F14C 0033C0AC 94 21 FF F0 */ stwu r1, -0x10(r1) /* 8033F14C 0033C0AC 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 8033F150 0033C0B0 7C 08 02 A6 */ mflr r0 /* 8033F150 0033C0B0 7C 08 02 A6 */ mflr r0
/* 8033F154 0033C0B4 3C C0 80 3F */ lis r6, __vt__12CInputStream@ha /* 8033F154 0033C0B4 3C C0 80 3F */ lis r6, __vt__12CInputStream@ha
/* 8033F158 0033C0B8 3C A0 80 3D */ lis r5, lbl_803D7A68@ha /* 8033F158 0033C0B8 3C A0 80 3D */ lis r5, "@stringBase0"@ha
/* 8033F15C 0033C0BC 90 01 00 14 */ stw r0, 0x14(r1) /* 8033F15C 0033C0BC 90 01 00 14 */ stw r0, 0x14(r1)
/* 8033F160 0033C0C0 38 06 E3 88 */ addi r0, r6, __vt__12CInputStream@l /* 8033F160 0033C0C0 38 06 E3 88 */ addi r0, r6, __vt__12CInputStream@l
/* 8033F164 0033C0C4 93 E1 00 0C */ stw r31, 0xc(r1) /* 8033F164 0033C0C4 93 E1 00 0C */ stw r31, 0xc(r1)
/* 8033F168 0033C0C8 7C 7F 1B 78 */ mr r31, r3 /* 8033F168 0033C0C8 7C 7F 1B 78 */ mr r31, r3
/* 8033F16C 0033C0CC 7C 83 23 78 */ mr r3, r4 /* 8033F16C 0033C0CC 7C 83 23 78 */ mr r3, r4
/* 8033F170 0033C0D0 38 85 7A 68 */ addi r4, r5, lbl_803D7A68@l /* 8033F170 0033C0D0 38 85 7A 68 */ addi r4, r5, "@stringBase0"@l
/* 8033F174 0033C0D4 90 1F 00 00 */ stw r0, 0(r31) /* 8033F174 0033C0D4 90 1F 00 00 */ stw r0, 0(r31)
/* 8033F178 0033C0D8 38 00 00 00 */ li r0, 0 /* 8033F178 0033C0D8 38 00 00 00 */ li r0, 0
/* 8033F17C 0033C0DC 38 A0 00 00 */ li r5, 0 /* 8033F17C 0033C0DC 38 A0 00 00 */ li r5, 0
@ -457,9 +462,7 @@ __ct__12CInputStreamFi:
.section .rodata .section .rodata
.balign 8 .balign 8
.global lbl_803D7A68 .obj "@stringBase0", local
lbl_803D7A68:
# ROM: 0x3D4A68 # ROM: 0x3D4A68
.asciz "??(??)" .asciz "??(??)"
.balign 4 .endobj "@stringBase0"

View File

@ -35,7 +35,7 @@ LIBS = [
"MetroidPrime/Factories/CCharacterFactory", "MetroidPrime/Factories/CCharacterFactory",
"MetroidPrime/Factories/CAssetFactory", "MetroidPrime/Factories/CAssetFactory",
["MetroidPrime/Tweaks/CTweakPlayer", True], ["MetroidPrime/Tweaks/CTweakPlayer", True],
"MetroidPrime/Tweaks/CTweaks", ["MetroidPrime/Tweaks/CTweaks", False],
["MetroidPrime/Tweaks/CTweakGame", True], ["MetroidPrime/Tweaks/CTweakGame", True],
"MetroidPrime/CGameProjectile", "MetroidPrime/CGameProjectile",
["MetroidPrime/Player/CPlayerGun", False], ["MetroidPrime/Player/CPlayerGun", False],

View File

@ -1,24 +1,18 @@
#ifndef _TONESTATIC #ifndef _TONESTATIC
#define _TONESTATIC #define _TONESTATIC
#include "types.h"
#include "stdio.h" #include "stdio.h"
#include "types.h"
template < typename T > template < typename T >
class TOneStatic { class TOneStatic {
public: public:
void* operator new(size_t sz, const char*, const char*); /* { void* operator new(size_t sz, const char*, const char*);
ReferenceCount()++;
return GetAllocSpace();
}*/
void* operator new(size_t sz) { return operator new(sz, "??(??)", nullptr); } void* operator new(size_t sz) { return operator new(sz, "??(??)", nullptr); }
void operator delete(void* ptr); void operator delete(void* ptr);
private: private:
static void* GetAllocSpace() { static void* GetAllocSpace();
static uchar sAllocSpace[sizeof(T)];
return &sAllocSpace;
}
static uint& ReferenceCount(); static uint& ReferenceCount();
}; };
@ -28,9 +22,23 @@ uint& TOneStatic< T >::ReferenceCount() {
return sReferenceCount; return sReferenceCount;
} }
template < typename T >
void* TOneStatic< T >::GetAllocSpace() {
static char sAllocSpace[sizeof(T)];
return &sAllocSpace;
}
template < typename T >
void* TOneStatic< T >::operator new(size_t sz, const char*, const char*) {
ReferenceCount()++;
return GetAllocSpace();
}
template < typename T > template < typename T >
void TOneStatic< T >::operator delete(void* ptr) { void TOneStatic< T >::operator delete(void* ptr) {
ReferenceCount()--; ReferenceCount()--;
} }
#endif // _TONESTATIC #endif // _TONESTATIC

View File

@ -104,7 +104,6 @@ private:
CMemorySys x6d_memorySys; CMemorySys x6d_memorySys;
CDvdRequestSys x6e_dvdRequestSys; CDvdRequestSys x6e_dvdRequestSys;
CTweaks x70_tweaks; CTweaks x70_tweaks;
uchar pad[0x14];
double xe8_; double xe8_;
TReservedAverage< float, 4 > xf0_; TReservedAverage< float, 4 > xf0_;
TReservedAverage< float, 4 > x104_; TReservedAverage< float, 4 > x104_;

View File

@ -52,6 +52,7 @@ public:
return type >= kMOT_BlueDoor && type <= kMOT_PlasmaDoorFloor2; return type >= kMOT_BlueDoor && type <= kMOT_PlasmaDoorFloor2;
} }
static void ReadAutomapperTweaks(const CTweakAutoMapper&);
private: private:
EMappableObjectType x0_type; EMappableObjectType x0_type;
EVisMode x4_visibilityMode; EVisMode x4_visibilityMode;
@ -60,7 +61,6 @@ private:
CTransform4f x10_transform; CTransform4f x10_transform;
uchar x40_pad[0x10]; uchar x40_pad[0x10];
static void ReadAutomapperTweaks(const CTweakAutoMapper&);
CTransform4f AdjustTransformForType(); CTransform4f AdjustTransformForType();
static CVector3f skDoorVerts[8]; static CVector3f skDoorVerts[8];

View File

@ -9,7 +9,7 @@
#include "Kyoto/CObjectReference.hpp" #include "Kyoto/CObjectReference.hpp"
class CTweakGunRes : public ITweakObject { class CTweakGunRes : public ITweakObject, public TOneStatic<CTweakGunRes> {
public: public:
typedef CAssetId ResId; typedef CAssetId ResId;
typedef CPlayerState::EBeamId EBeamId; typedef CPlayerState::EBeamId EBeamId;
@ -21,8 +21,9 @@ public:
ResId* d; ResId* d;
}; };
CTweakGunRes(CInputStream& in);
~CTweakGunRes() override; ~CTweakGunRes() override;
#if 0
ResId x4_gunMotion; ResId x4_gunMotion;
ResId x8_grappleArm; ResId x8_grappleArm;
ResId xc_rightHand; ResId xc_rightHand;
@ -50,7 +51,8 @@ public:
ResId xbc_grappleHit; ResId xbc_grappleHit;
ResId xc0_grappleMuzzle; ResId xc0_grappleMuzzle;
ResId xc4_grappleSwoosh; ResId xc4_grappleSwoosh;
#endif
char cls[0xc4];
const WeaponResourcePair* GetWeaponResourcePair(int beam) const; /* { const WeaponResourcePair* GetWeaponResourcePair(int beam) const; /* {
const int b = int(beam); const int b = int(beam);
if (b < 0 || b > 4) { if (b < 0 || b > 4) {

View File

@ -63,8 +63,9 @@ struct SWeaponInfo {
explicit SWeaponInfo(CInputStream& in); explicit SWeaponInfo(CInputStream& in);
}; };
class CTweakPlayerGun : public ITweakObject { class CTweakPlayerGun : public ITweakObject, public TOneStatic<CTweakPlayerGun> {
public: public:
CTweakPlayerGun(CInputStream& in);
~CTweakPlayerGun() override; ~CTweakPlayerGun() override;
float GetUpLookAngle() const { return x4_upLookAngle; } float GetUpLookAngle() const { return x4_upLookAngle; }

View File

@ -1,15 +1,21 @@
#ifndef _CTWEAKPLAYERRES #ifndef _CTWEAKPLAYERRES
#define _CTWEAKPLAYERRES #define _CTWEAKPLAYERRES
#include <MetroidPrime/Tweaks/ITweakObject.hpp>
#include "Kyoto/SObjectTag.hpp" #include "Kyoto/SObjectTag.hpp"
struct CTweakPlayerRes { struct CTweakPlayerRes : public ITweakObject, public TOneStatic<CTweakPlayerRes> {
public: public:
/*
CAssetId x4_saveStationIcon; CAssetId x4_saveStationIcon;
CAssetId x8_missileStationIcon; CAssetId x8_missileStationIcon;
CAssetId xc_elevatorIcon; CAssetId xc_elevatorIcon;
CAssetId x10_minesBreakFirstTopIcon; CAssetId x10_minesBreakFirstTopIcon;
CAssetId x14_minesBreakFirstBottomIcon; CAssetId x14_minesBreakFirstBottomIcon;
*/
char cls[0xf0];
CTweakPlayerRes(CInputStream& in);
}; };
extern CTweakPlayerRes* gpTweakPlayerRes; extern CTweakPlayerRes* gpTweakPlayerRes;

View File

@ -0,0 +1,14 @@
#ifndef _CTWEAKTARGETING
#define _CTWEAKTARGETING
#include "MetroidPrime/Tweaks/ITweakObject.hpp"
class CTweakTargeting : public ITweakObject, public TOneStatic<CTweakTargeting> {
public:
CTweakTargeting(CInputStream& in);
private:
uchar cls[0x224];
};
#endif // _CTWEAKTARGETING

View File

@ -18,9 +18,9 @@ public:
void RegisterTweaks(); void RegisterTweaks();
private: private:
rstl::reserved_vector< rstl::auto_ptr< ITweakObject >, 12 > x0_; rstl::reserved_vector< rstl::auto_ptr< ITweakObject >, 14 > mTweakObjects;
}; };
CHECK_SIZEOF(CTweaks, 0x64) CHECK_SIZEOF(CTweaks, 0x74)
extern CTweakPlayerControl* gpTweakPlayerControlCurrent; extern CTweakPlayerControl* gpTweakPlayerControlCurrent;
extern CTweakPlayerControl* gpTweakPlayerControl1; extern CTweakPlayerControl* gpTweakPlayerControl1;

View File

@ -0,0 +1,165 @@
#include <MetroidPrime/CMappableObject.hpp>
#include <MetroidPrime/Player/CPlayerCameraBob.hpp>
// These files must remain in this order....
// clang-format off
#include <MetroidPrime/Tweaks/CTweakPlayer.hpp>
#include <MetroidPrime/Tweaks/CTweakBall.hpp>
#include <MetroidPrime/Tweaks/CTweakGame.hpp>
#include <MetroidPrime/Tweaks/CTweakParticle.hpp>
#include <MetroidPrime/Tweaks/CTweakPlayerGun.hpp>
#include <MetroidPrime/Tweaks/CTweakGui.hpp>
#include <MetroidPrime/Tweaks/CTweakGuiColors.hpp>
#include <MetroidPrime/Tweaks/CTweakTargeting.hpp>
#include <MetroidPrime/Tweaks/CTweakAutoMapper.hpp>
#include <MetroidPrime/Tweaks/CTweakGunRes.hpp>
#include <MetroidPrime/Tweaks/CTweakPlayerControl.hpp>
#include <MetroidPrime/Tweaks/CTweakPlayerRes.hpp>
#include <MetroidPrime/Tweaks/CTweakSlideShow.hpp>
#include <MetroidPrime/Tweaks/CTweaks.hpp>
// clang-format on
#include <Kyoto/CresFactory.hpp>
CTweakPlayer* gpTweakPlayer = nullptr;
CTweakBall* gpTweakBall = nullptr;
CTweakGame* gpTweakGame = nullptr;
CTweakParticle* gpTweakParticle = nullptr;
CTweakPlayerControl* gpTweakPlayerControlCurrent = nullptr;
CTweakPlayerControl* gpTweakPlayerControl1 = nullptr;
CTweakPlayerControl* gpTweakPlayerControl2 = nullptr;
CTweakPlayerGun* gpTweakPlayerGun = nullptr;
CTweakGui* gpTweakGui = nullptr;
CTweakGuiColors* gpTweakGuiColors = nullptr;
CTweakTargeting* gpTweakTargeting = nullptr;
CTweakAutoMapper* gpTweakAutoMapper = nullptr;
CTweakGunRes* gpTweakGunRes = nullptr;
CTweakPlayerRes* gpTweakPlayerRes = nullptr;
CTweakSlideShow* gpTweakSlideShow = nullptr;
CAssetId IDFromFactory(CResFactory& factory, const char* filename) {
return factory.GetResourceIdByName(filename)->id;
}
CTweaks::CTweaks() { mTweakObjects.resize(14, rstl::auto_ptr< ITweakObject >()); }
CTweaks::~CTweaks() {
gpTweakPlayer = nullptr;
gpTweakBall = nullptr;
gpTweakGame = nullptr;
gpTweakParticle = nullptr;
gpTweakPlayerControlCurrent = nullptr;
gpTweakPlayerGun = nullptr;
gpTweakGui = nullptr;
gpTweakGuiColors = nullptr;
gpTweakTargeting = nullptr;
gpTweakAutoMapper = nullptr;
gpTweakGunRes = nullptr;
gpTweakPlayerRes = nullptr;
gpTweakSlideShow = nullptr;
}
void CTweaks::RegisterTweaks() {
CResFactory* resFactory = gpResourceFactory;
{
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "Particle")), nullptr);
gpTweakParticle = new CTweakParticle(*stream);
mTweakObjects[2] = gpTweakParticle;
}
{
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "Player")), nullptr);
gpTweakPlayer = new CTweakPlayer(*stream);
mTweakObjects[0] = gpTweakPlayer;
}
{
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "CameraBob")), nullptr);
CPlayerCameraBob::ReadTweaks(*stream);
}
{
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "Ball")), nullptr);
gpTweakBall = new CTweakBall(*stream);
mTweakObjects[7] = gpTweakBall;
}
{
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "PlayerGun")), nullptr);
gpTweakPlayerGun = new CTweakPlayerGun(*stream);
mTweakObjects[4] = gpTweakPlayerGun;
}
{
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "Targeting")), nullptr);
gpTweakTargeting = new CTweakTargeting(*stream);
mTweakObjects[8] = gpTweakTargeting;
}
{
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "Game")), nullptr);
gpTweakGame = new CTweakGame(*stream);
mTweakObjects[1] = gpTweakGame;
}
{
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "GuiColors")), nullptr);
gpTweakGuiColors = new CTweakGuiColors(*stream);
mTweakObjects[6] = gpTweakGuiColors;
}
{
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "AutoMapper")), nullptr);
gpTweakAutoMapper = new CTweakAutoMapper(*stream);
mTweakObjects[2] = gpTweakAutoMapper;
CMappableObject::ReadAutomapperTweaks(*gpTweakAutoMapper);
}
{
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "Gui")), nullptr);
gpTweakGui = new CTweakGui(*stream);
mTweakObjects[5] = gpTweakGui;
}
{
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "PlayerControls")), nullptr);
gpTweakPlayerControlCurrent = new CTweakPlayerControl(*stream);
mTweakObjects[3] = gpTweakPlayerControlCurrent;
gpTweakPlayerControl1 = gpTweakPlayerControlCurrent;
}
{
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "PlayerControls2")), nullptr);
gpTweakPlayerControl2 = new CTweakPlayerControl(*stream);
mTweakObjects[13] = gpTweakPlayerControl2;
}
{
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "SlideShow")), nullptr);
gpTweakSlideShow = new CTweakSlideShow(*stream);
mTweakObjects[12] = gpTweakSlideShow;
}
}
void CTweaks::RegisterResourceTweaks() {
CResFactory* resFactory = gpResourceFactory;
if (gpTweakGunRes == nullptr) {
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "GunRes")), nullptr);
gpTweakGunRes = new CTweakGunRes(*stream);
mTweakObjects[10] = gpTweakGunRes;
}
if (gpTweakPlayerRes == nullptr) {
rstl::auto_ptr< CInputStream > stream = resFactory->GetResLoader().LoadNewResourceSync(
SObjectTag('CTWK', IDFromFactory(*resFactory, "PlayerRes")), nullptr);
gpTweakPlayerRes = new CTweakPlayerRes(*stream);
mTweakObjects[11] = gpTweakPlayerRes;
}
}