diff --git a/docs/recommended_todo.md b/docs/recommended_todo.md
index 1df8e5e25..67bf76c93 100644
--- a/docs/recommended_todo.md
+++ b/docs/recommended_todo.md
@@ -188,8 +188,8 @@
###
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
-| PSMainSide_ObjCalc.cpp | 9412 | menu.cpp | 13538 |
-| PSMainSide_CreaturePrm.cpp | 14244 | PSMainSide_TrackMap.cpp | 17206 |
+| PSMainSide_CreaturePrm.cpp | 4104 | PSMainSide_ObjCalc.cpp | 9412 |
+| menu.cpp | 13538 | PSMainSide_TrackMap.cpp | 17206 |
| PSMainSide_BossMgr.cpp | 19867 | PSMainSide_Sound.cpp | 28263 |
diff --git a/include/JSystem/JUtility/JUTException.h b/include/JSystem/JUtility/JUTException.h
index cb218b095..ff5dd070b 100644
--- a/include/JSystem/JUtility/JUTException.h
+++ b/include/JSystem/JUtility/JUTException.h
@@ -165,6 +165,14 @@ struct JUTException : public JKRThread {
} \
P2ASSERTLINE(line, check##line)
+// Used in PSMainSide_CreaturePrm
+#define P2ASSERTBOUNDSLINE2(line, lowerLimitExclusive, var, upperLimitInclusive) \
+ bool check##line = false; \
+ if (var > lowerLimitExclusive && var <= upperLimitInclusive) { \
+ check##line = true; \
+ } \
+ P2ASSERTLINE(line, check##line)
+
#define P2ASSERTBOUNDSINCLUSIVELINE(line, lowerLimitInclusive, var, upperLimitInclusive) \
bool check##line = false; \
if (lowerLimitInclusive <= var && var <= upperLimitInclusive) { \
diff --git a/include/PSM/CreaturePrm.h b/include/PSM/CreaturePrm.h
index 909d08e8c..7310a3b9b 100644
--- a/include/PSM/CreaturePrm.h
+++ b/include/PSM/CreaturePrm.h
@@ -2,15 +2,22 @@
#define _PSM_CREATUREPRM_H
#include "PSSystem/PSCommon.h"
+#include "PSGame/SoundTable.h"
namespace PSM {
struct CreaturePrm : public PSSystem::SingletonBase {
- CreaturePrm(); // inlined/unused
+ CreaturePrm()
+ {
+ sInstance = this;
+ mPersp.set(1.0f, 400.0f, 0.8f, 700.0f, 0.0f);
+ }
- virtual ~CreaturePrm(); // _08 (weak)
+ virtual ~CreaturePrm() { } // _08 (weak)
// _00 = VTBL
+ PSGame::SoundTable::SePerspInfo mPersp; // _04
};
+
} // namespace PSM
#endif
diff --git a/include/PSM/THPDinamics.h b/include/PSM/THPDinamics.h
index 18fa11198..f9a86bf2b 100644
--- a/include/PSM/THPDinamics.h
+++ b/include/PSM/THPDinamics.h
@@ -17,21 +17,29 @@ enum THP_ID {
PLAY_5 = 9,
PLAY_6 = 10,
CRIME = 11,
+ THP_COUNT = 12,
};
struct THPDemoDinamics {
+ f32 _00;
+ f32 _04;
+ f32 _08;
+ bool mEnableDyn;
+ char* mName;
};
struct THPDinamicsProc {
THPDinamicsProc(); // inlined/unused
- void setSetting(THP_ID);
- void setSetting(THPDemoDinamics*);
- f32 dinamics(f32);
+ void setSetting(THP_ID id);
+ void setSetting(THPDemoDinamics* dyn);
+ f32 dinamics(f32 input);
void complessor(f32);
inline f32 doAudioDinamics(u16 vol, int val) { return 32768.0f * dinamics((vol * val >> 15) / 32768.0f); }
+
+ THPDemoDinamics* mDemoInfo; // _00
};
extern THPDinamicsProc sTHPDinamicsProc;
diff --git a/src/utilityU/PSMainSide_CreaturePrm.cpp b/src/utilityU/PSMainSide_CreaturePrm.cpp
index e5a75a346..b17e77b24 100644
--- a/src/utilityU/PSMainSide_CreaturePrm.cpp
+++ b/src/utilityU/PSMainSide_CreaturePrm.cpp
@@ -1,384 +1,57 @@
-#include "types.h"
-
-/*
- Generated from dpostproc
-
- .section .ctors, "wa" # 0x80472F00 - 0x804732C0
- .4byte __sinit_PSMainSide_CreaturePrmCpp
-
- .section .rodata # 0x804732E0 - 0x8049E220
- .global lbl_8049E0F0
- lbl_8049E0F0:
- .asciz "Opening1"
- .skip 3
- .global lbl_8049E0FC
- lbl_8049E0FC:
- .asciz "Opening2"
- .skip 3
- .global lbl_8049E108
- lbl_8049E108:
- .asciz "Staffroll"
- .skip 2
- .global lbl_8049E114
- lbl_8049E114:
- .asciz "PSMainSide_CreaturePrm.cpp"
- .skip 1
- .global lbl_8049E130
- lbl_8049E130:
- .asciz "P2Assert"
- .skip 3
- .global cVolMaxDist_Kehai__Q23PSM11CreaturePrm
- cVolMaxDist_Kehai__Q23PSM11CreaturePrm:
- .float 150.0
- .float 100.0
- .float 500.0
- .float 500.0
- .float 600.0
- .float 800.0
- .float 300.0
- .global cVolMaxDist_Battle__Q23PSM11CreaturePrm
- cVolMaxDist_Battle__Q23PSM11CreaturePrm:
- .float 210.0
- .float 140.0
- .float 700.0
- .float 700.0
- .float 840.0
- .float 1120.0
- .float 420.0
- .global cVolZeroDist_Kehai__Q23PSM11CreaturePrm
- cVolZeroDist_Kehai__Q23PSM11CreaturePrm:
- .float 300.0
- .float 200.0
- .float 1000.0
- .float 1000.0
- .float 1200.0
- .float 1600.0
- .float 600.0
- .global cVolZeroDist_Battle__Q23PSM11CreaturePrm
- cVolZeroDist_Battle__Q23PSM11CreaturePrm:
- .float 420.0
- .float 280.0
- .float 1400.0
- .float 1400.0
- .float 1680.0
- .float 2240.0
- .float 840.0
- .global cVolZeroDist_InnerSize_Kehai__Q23PSM11CreaturePrm
- cVolZeroDist_InnerSize_Kehai__Q23PSM11CreaturePrm:
- .float 233.99998
- .float 156.0
- .float 780.0
- .float 780.0
- .float 935.99994
- .float 1248.0
- .float 467.99997
-
- .section .data, "wa" # 0x8049E220 - 0x804EFC20
- .global sThpDemoDinamics__3PSM
- sThpDemoDinamics__3PSM:
- .float 0.8
- .float 0.38
- .float 0.94
- .byte 0x01
- .skip 3
- .4byte lbl_8049E0F0
- .float 0.9
- .float 0.22
- .float 0.98
- .byte 0x01
- .skip 3
- .4byte lbl_8049E0FC
- .float 0.7
- .float 0.38
- .float 0.98
- .byte 0x01
- .skip 3
- .4byte lbl_80520DB8
- .float 0.8
- .float 0.44
- .float 0.99
- .byte 0x01
- .skip 3
- .4byte lbl_80520DC0
- .float 0.57
- .float 1.0
- .float 1.0
- .byte 0x00
- .skip 3
- .4byte lbl_8049E108
- .float 0.5
- .float 1.0
- .float 1.0
- .byte 0x00
- .skip 3
- .4byte lbl_80520DC8
- .float 0.7
- .float 1.0
- .float 1.0
- .byte 0x00
- .skip 3
- .4byte lbl_80520DD0
- .float 0.7
- .float 1.0
- .float 1.0
- .byte 0x00
- .skip 3
- .4byte lbl_80520DD8
- .float 0.7
- .float 1.0
- .float 1.0
- .byte 0x00
- .skip 3
- .4byte lbl_80520DE0
- .float 0.7
- .float 1.0
- .float 1.0
- .byte 0x00
- .skip 3
- .4byte lbl_80520DE8
- .float 0.7
- .float 1.0
- .float 1.0
- .byte 0x00
- .skip 3
- .4byte lbl_80520DF0
- .float 0.7
- .float 1.0
- .float 1.0
- .byte 0x00
- .skip 3
- .4byte lbl_80520DF8
- .global __vt__Q23PSM11CreaturePrm
- __vt__Q23PSM11CreaturePrm:
- .4byte 0
- .4byte 0
- .4byte __dt__Q23PSM11CreaturePrmFv
- .global "__vt__Q28PSSystem34SingletonBase"
- "__vt__Q28PSSystem34SingletonBase":
- .4byte 0
- .4byte 0
- .4byte "__dt__Q28PSSystem34SingletonBaseFv"
-
- .section .bss # 0x804EFC20 - 0x8051467C
- .global sInsReal__3PSM
- sInsReal__3PSM:
- .skip 0x1C
-
- .section .sdata, "wa" # 0x80514680 - 0x80514D80
- .global sCamFov__3PSM
- sCamFov__3PSM:
- .float 0.25
- .global sBoss_ViewDist__3PSM
- sBoss_ViewDist__3PSM:
- .float 1300.0
- .global sBoss_ViewDistVol__3PSM
- sBoss_ViewDistVol__3PSM:
- .float 0.3
- .global sBoss_DistMax__3PSM
- sBoss_DistMax__3PSM:
- .float 4000.0
-
- .section .sbss # 0x80514D80 - 0x80516360
- .global sTHPDinamicsProc__3PSM
- sTHPDinamicsProc__3PSM:
- .skip 0x4
-
- .section .sdata2, "a" # 0x80516360 - 0x80520E40
- .global lbl_80520DB8
- lbl_80520DB8:
- .asciz "Ending1"
- .global lbl_80520DC0
- lbl_80520DC0:
- .asciz "Ending2"
- .global lbl_80520DC8
- lbl_80520DC8:
- .asciz "Play1"
- .skip 2
- .global lbl_80520DD0
- lbl_80520DD0:
- .asciz "Play2"
- .skip 2
- .global lbl_80520DD8
- lbl_80520DD8:
- .asciz "Play3"
- .skip 2
- .global lbl_80520DE0
- lbl_80520DE0:
- .asciz "Play4"
- .skip 2
- .global lbl_80520DE8
- lbl_80520DE8:
- .asciz "Play5"
- .skip 2
- .global lbl_80520DF0
- lbl_80520DF0:
- .asciz "Play6"
- .skip 2
- .global lbl_80520DF8
- lbl_80520DF8:
- .asciz "Crime"
- .skip 2
- .global lbl_80520E00
- lbl_80520E00:
- .float 0.0
- .global lbl_80520E04
- lbl_80520E04:
- .float 1.0
- .global lbl_80520E08
- lbl_80520E08:
- .float -1.0
- .global lbl_80520E0C
- lbl_80520E0C:
- .float 400.0
- .global lbl_80520E10
- lbl_80520E10:
- .float 0.8
- .global lbl_80520E14
- lbl_80520E14:
- .float 700.0
- .global cNoukouDistance__Q23PSM11CreaturePrm
- cNoukouDistance__Q23PSM11CreaturePrm:
- .float 300.0
- .global cSeFxMix__Q23PSM11CreaturePrm
- cSeFxMix__Q23PSM11CreaturePrm:
- .float 0.07
- .global cSeFxMix_cave__Q23PSM11CreaturePrm
- cSeFxMix_cave__Q23PSM11CreaturePrm:
- .float 1.0
-*/
+#include "PSM/THPDinamics.h"
+#include "PSM/CreaturePrm.h"
namespace PSM {
+static CreaturePrm sInsReal;
+
+// THPDinamicsProc sTHPDinamicsProc;
+
+// clang-format off
+THPDemoDinamics sTHPDemoDinamics[THP_COUNT]
+ = { { 0.8f, 0.38f, 0.94f, true, "Opening1" },
+ { 0.9f, 0.22f, 0.98f, true, "Opening2" },
+ { 0.7f, 0.38f, 0.98f, true, "Ending1" },
+ { 0.8f, 0.44f, 0.99f, true, "Ending2" },
+ { 0.57f, 1.00f, 1.00f, false, "Staffroll" },
+ { 0.5f, 1.00f, 1.00f, false, "Play1" },
+ { 0.7f, 1.00f, 1.00f, false, "Play2" },
+ { 0.7f, 1.00f, 1.00f, false, "Play3" },
+ { 0.7f, 1.00f, 1.00f, false, "Play4" },
+ { 0.7f, 1.00f, 1.00f, false, "Play5" },
+ { 0.7f, 1.00f, 1.00f, false, "Play6" },
+ { 0.7f, 1.00f, 1.00f, false, "Crime" }, };
+// clang-format on
+
/*
* --INFO--
* Address: 804724A0
* Size: 000070
*/
-void THPDinamicsProc::setSetting(PSM::THP_ID)
+void THPDinamicsProc::setSetting(THP_ID id)
{
- /*
- stwu r1, -0x10(r1)
- mflr r0
- stw r0, 0x14(r1)
- stw r31, 0xc(r1)
- mr r31, r4
- cmpwi r31, 0xc
- stw r30, 8(r1)
- mr r30, r3
- blt lbl_804724E0
- lis r3, lbl_8049E114@ha
- lis r5, lbl_8049E130@ha
- addi r3, r3, lbl_8049E114@l
- li r4, 0x76
- addi r5, r5, lbl_8049E130@l
- crclr 6
- bl panic_f__12JUTExceptionFPCciPCce
-
-lbl_804724E0:
- mulli r5, r31, 0x14
- lis r4, sThpDemoDinamics__3PSM@ha
- mr r3, r30
- addi r0, r4, sThpDemoDinamics__3PSM@l
- add r4, r0, r5
- bl setSetting__Q23PSM15THPDinamicsProcFPQ23PSM15THPDemoDinamics
- lwz r0, 0x14(r1)
- lwz r31, 0xc(r1)
- lwz r30, 8(r1)
- mtlr r0
- addi r1, r1, 0x10
- blr
- */
+ P2ASSERTLINE(118, id < THP_COUNT);
+ setSetting(&sTHPDemoDinamics[id]);
}
+const f32 cVolMaxDist_Kehai[7] = { 150.0f, 100.0f, 500.0f, 500.0f, 600.0f, 800.0f, 300.0f };
+const f32 cVolMaxDist_Battle[7] = { 210.0f, 140.0f, 700.0f, 700.0f, 840.0f, 1120.0f, 420.0f };
+const f32 cVolZeroDist_Kehai[7] = { 300.0f, 200.0f, 1000.0f, 1000.0f, 1200.0f, 1600.0f, 600.0f };
+const f32 cVolZeroDist_Battle[7] = { 420.0f, 280.0f, 1400.0f, 1400.0f, 1680.0f, 2240.0f, 840.0f };
+const f32 cVolZeroDist_InnerSize_Kehai[7] = { 233.99998f, 156.0f, 780.0f, 780.0f, 935.99996f, 1248.0f, 467.99998f };
+
/*
* --INFO--
* Address: 80472510
* Size: 000110
*/
-void THPDinamicsProc::setSetting(PSM::THPDemoDinamics*)
+void THPDinamicsProc::setSetting(THPDemoDinamics* dyn)
{
- /*
- stwu r1, -0x10(r1)
- mflr r0
- stw r0, 0x14(r1)
- stw r31, 0xc(r1)
- or. r31, r4, r4
- stw r31, 0(r3)
- bne lbl_80472548
- lis r3, lbl_8049E114@ha
- lis r5, lbl_8049E130@ha
- addi r3, r3, lbl_8049E114@l
- li r4, 0x7d
- addi r5, r5, lbl_8049E130@l
- crclr 6
- bl panic_f__12JUTExceptionFPCciPCce
-
-lbl_80472548:
- lfs f1, 4(r31)
- li r0, 0
- lfs f0, lbl_80520E00@sda21(r2)
- fcmpo cr0, f1, f0
- ble lbl_80472570
- lfs f0, lbl_80520E04@sda21(r2)
- fcmpo cr0, f1, f0
- cror 2, 0, 2
- bne lbl_80472570
- li r0, 1
-
-lbl_80472570:
- clrlwi. r0, r0, 0x18
- bne lbl_80472594
- lis r3, lbl_8049E114@ha
- lis r5, lbl_8049E130@ha
- addi r3, r3, lbl_8049E114@l
- li r4, 0x7e
- addi r5, r5, lbl_8049E130@l
- crclr 6
- bl panic_f__12JUTExceptionFPCciPCce
-
-lbl_80472594:
- lfs f1, 8(r31)
- li r0, 0
- lfs f0, lbl_80520E00@sda21(r2)
- fcmpo cr0, f1, f0
- ble lbl_804725BC
- lfs f0, lbl_80520E04@sda21(r2)
- fcmpo cr0, f1, f0
- cror 2, 0, 2
- bne lbl_804725BC
- li r0, 1
-
-lbl_804725BC:
- clrlwi. r0, r0, 0x18
- bne lbl_804725E0
- lis r3, lbl_8049E114@ha
- lis r5, lbl_8049E130@ha
- addi r3, r3, lbl_8049E114@l
- li r4, 0x7f
- addi r5, r5, lbl_8049E130@l
- crclr 6
- bl panic_f__12JUTExceptionFPCciPCce
-
-lbl_804725E0:
- lfs f1, 0(r31)
- lfs f0, lbl_80520E00@sda21(r2)
- fcmpo cr0, f1, f0
- bgt lbl_8047260C
- lis r3, lbl_8049E114@ha
- lis r5, lbl_8049E130@ha
- addi r3, r3, lbl_8049E114@l
- li r4, 0x80
- addi r5, r5, lbl_8049E130@l
- crclr 6
- bl panic_f__12JUTExceptionFPCciPCce
-
-lbl_8047260C:
- lwz r0, 0x14(r1)
- lwz r31, 0xc(r1)
- mtlr r0
- addi r1, r1, 0x10
- blr
- */
+ mDemoInfo = dyn;
+ P2ASSERTLINE(125, dyn);
+ P2ASSERTBOUNDSLINE2(126, 0.0f, dyn->_04, 1.0f);
+ P2ASSERTBOUNDSLINE2(127, 0.0f, dyn->_08, 1.0f);
+ P2ASSERTLINE(128, dyn->_00 > 0.0f);
}
/*
@@ -386,8 +59,14 @@ void THPDinamicsProc::setSetting(PSM::THPDemoDinamics*)
* Address: 80472620
* Size: 000130
*/
-void THPDinamicsProc::dinamics(float)
+f32 THPDinamicsProc::dinamics(f32 input)
{
+ P2ASSERTLINE(137, mDemoInfo);
+ THPDemoDinamics* info = mDemoInfo;
+ if (info->mEnableDyn) {
+ // nasty
+ }
+ return input * info->_00;
/*
stwu r1, -0x20(r1)
mflr r0
@@ -488,121 +167,4 @@ void THPDinamicsProc::dinamics(float)
*/
}
-/*
- * --INFO--
- * Address: 80472750
- * Size: 000064
- */
-CreaturePrm::~CreaturePrm()
-{
- /*
- stwu r1, -0x10(r1)
- mflr r0
- stw r0, 0x14(r1)
- stw r31, 0xc(r1)
- or. r31, r3, r3
- beq lbl_8047279C
- lis r3, __vt__Q23PSM11CreaturePrm@ha
- addi r0, r3, __vt__Q23PSM11CreaturePrm@l
- stw r0, 0(r31)
- beq lbl_8047278C
- lis r3, "__vt__Q28PSSystem34SingletonBase"@ha
- li r0, 0
- addi r3, r3, "__vt__Q28PSSystem34SingletonBase"@l
- stw r3, 0(r31)
- stw r0,
-"sInstance__Q28PSSystem34SingletonBase"@sda21(r13)
-
-lbl_8047278C:
- extsh. r0, r4
- ble lbl_8047279C
- mr r3, r31
- bl __dl__FPv
-
-lbl_8047279C:
- lwz r0, 0x14(r1)
- mr r3, r31
- lwz r31, 0xc(r1)
- mtlr r0
- addi r1, r1, 0x10
- blr
- */
-}
-
-namespace PSSystem {
-
-} // namespace PSSystem
-
-/*
- * --INFO--
- * Address: 804727B4
- * Size: 000050
- */
-void SingletonBase::~SingletonBase()
-{
- /*
- stwu r1, -0x10(r1)
- mflr r0
- stw r0, 0x14(r1)
- stw r31, 0xc(r1)
- or. r31, r3, r3
- beq lbl_804727EC
- lis r5, "__vt__Q28PSSystem34SingletonBase"@ha
- extsh. r0, r4
- addi r4, r5, "__vt__Q28PSSystem34SingletonBase"@l
- li r0, 0
- stw r4, 0(r31)
- stw r0,
-"sInstance__Q28PSSystem34SingletonBase"@sda21(r13) ble
-lbl_804727EC bl __dl__FPv
-
-lbl_804727EC:
- lwz r0, 0x14(r1)
- mr r3, r31
- lwz r31, 0xc(r1)
- mtlr r0
- addi r1, r1, 0x10
- blr
- */
-}
-
} // namespace PSM
-
-/*
- * --INFO--
- * Address: 80472804
- * Size: 0000A0
- */
-void __sinit_PSMainSide_CreaturePrmCpp()
-{
- /*
- stwu r1, -0x10(r1)
- mflr r0
- lis r3, "__vt__Q28PSSystem34SingletonBase"@ha
- lis r4, sInsReal__3PSM@ha
- stw r0, 0x14(r1)
- addi r0, r3, "__vt__Q28PSSystem34SingletonBase"@l
- lfs f5, lbl_80520E00@sda21(r2)
- lis r3, __vt__Q23PSM11CreaturePrm@ha
- stw r31, 0xc(r1)
- li r5, 0
- lfs f1, lbl_80520E04@sda21(r2)
- stwu r0, sInsReal__3PSM@l(r4)
- addi r0, r3, __vt__Q23PSM11CreaturePrm@l
- lfs f2, lbl_80520E0C@sda21(r2)
- stw r5, sTHPDinamicsProc__3PSM@sda21(r13)
- mr r31, r4
- lfs f3, lbl_80520E10@sda21(r2)
- addi r3, r4, 4
- stw r4,
- "sInstance__Q28PSSystem34SingletonBase"@sda21(r13) lfs
- f4, lbl_80520E14@sda21(r2) stw r0, 0(r4) stfs f1, 4(r4) stfs f5,
- 8(r4) stfs f5, 0xc(r4) stfs f5, 0x10(r4) stfs f5, 0x14(r4) stb
- r5, 0x18(r4) stb r5, 0x19(r4) bl
- set__Q36PSGame10SoundTable11SePerspInfoFfffff lis r3,
- __dt__Q23PSM11CreaturePrmFv@ha lis r5, lbl_80506A80@ha addi r4, r3,
- __dt__Q23PSM11CreaturePrmFv@l mr r3, r31 addi r5, r5,
- lbl_80506A80@l bl __register_global_object lwz r0, 0x14(r1) lwz
- r31, 0xc(r1) mtlr r0 addi r1, r1, 0x10 blr
- */
-}