From 059e07b0b6b55d8a4a935718a9f522e4274106cb Mon Sep 17 00:00:00 2001 From: Sean Miller Date: Wed, 8 Apr 2026 17:56:07 +0100 Subject: [PATCH] 100% d_state --- config/SOUE01/symbols.txt | 6 +++--- configure.py | 2 +- include/d/d_main.h | 4 ++++ src/d/d_main.cpp | 6 +++--- src/d/d_state.cpp | 30 ++++++++++++++++++++++++++++++ 5 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 src/d/d_state.cpp diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 509a69bd..66b9b74d 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -2236,9 +2236,9 @@ __sinit_\d_heap_cpp = .text:0x80054F00; // type:function size:0x30 scope:local getCurrentLanguage1__Fv = .text:0x80054F30; // type:function size:0x4 getCurrentLanguage2__Fv = .text:0x80054F40; // type:function size:0x4 getCurrentLanguage__Fv = .text:0x80054F50; // type:function size:0x38 -fn_80054F90__FUl = .text:0x80054F90; // type:function size:0x18 -fn_80054FB0__FUl = .text:0x80054FB0; // type:function size:0x24 -fn_80054FE0__FUl = .text:0x80054FE0; // type:function size:0x20 +fn_80054F90__5dMainFUl = .text:0x80054F90; // type:function size:0x18 +fn_80054FB0__5dMainFUl = .text:0x80054FB0; // type:function size:0x24 +fn_80054FE0__5dMainFUl = .text:0x80054FE0; // type:function size:0x20 Create__5dMainFv = .text:0x80055000; // type:function size:0x28 Execute__5dMainFv = .text:0x80055030; // type:function size:0x14 main01__5dMainFPv = .text:0x80055050; // type:function size:0x28 diff --git a/configure.py b/configure.py index 76b8c1d2..b7fc4aa8 100644 --- a/configure.py +++ b/configure.py @@ -463,7 +463,7 @@ config.libs = [ Object(Matching, "d/d_player_guide_colors.cpp"), Object(Matching, "d/d_rawarchive.cpp"), Object(Matching, "d/d_scene.cpp"), - Object(NonMatching, "d/d_state.cpp"), + Object(Matching, "d/d_state.cpp"), Object(Matching, "d/d_stage_parse.cpp"), Object(Matching, "d/d_sys.cpp"), Object(NonMatching, "d/d_sys_init.cpp"), diff --git a/include/d/d_main.h b/include/d/d_main.h index 57332fe9..6fc6f4c7 100644 --- a/include/d/d_main.h +++ b/include/d/d_main.h @@ -5,6 +5,10 @@ namespace dMain { +bool fn_80054F90(u32 val); +void fn_80054FB0(u32 val); +void fn_80054FE0(u32 val); + void Create(); void Execute(); void *main01(void *arg); diff --git a/src/d/d_main.cpp b/src/d/d_main.cpp index 28118b10..653f1051 100644 --- a/src/d/d_main.cpp +++ b/src/d/d_main.cpp @@ -10,11 +10,11 @@ u32 lbl_805751D0; OSTime g_InitialTime; -bool fn_80054F90(u32 val) { +bool dMain::fn_80054F90(u32 val) { return lbl_805751D0 & val; } -void fn_80054FB0(u32 val) { +void dMain::fn_80054FB0(u32 val) { u32 flags = lbl_805751D0; if (!flags) { @@ -27,7 +27,7 @@ void fn_80054FB0(u32 val) { lbl_805751D0 = flags | val; } -void fn_80054FE0(u32 val) { +void dMain::fn_80054FE0(u32 val) { lbl_805751D0 &= ~val; if (!lbl_805751D0) { diff --git a/src/d/d_state.cpp b/src/d/d_state.cpp new file mode 100644 index 00000000..12209932 --- /dev/null +++ b/src/d/d_state.cpp @@ -0,0 +1,30 @@ +#include "d/d_main.h" +#include "d/d_state.h" +#include "m/m3d/m_state.h" + +void dState::fn_80062E40() { + m3d::mState::fn_802EE0A0(); +} + +void dState::fn_80062E50() { + m3d::mState::fn_802EE0B0(); + + if (m3d::mState::fn_802EE0D0()) { + if (dMain::fn_80054F90(1)) { + dMain::fn_80054FE0(1); + } + } + else { + if (!dMain::fn_80054F90(1)) { + dMain::fn_80054FB0(1); + } + } +} + +void dState::fn_80062EB0() { + m3d::mState::fn_802EE0C0(); +} + +bool dState::fn_80062EC0() { + return m3d::mState::fn_802EE0D0(); +}