From 3d0aff6a84301ee87a71913cead5b2767ea64ba4 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Tue, 17 Jun 2025 22:30:17 -0400 Subject: [PATCH] daPy_lk_c::dProcTool and daDemo00_c::execute matched, fix up various inlines and template classes, stb OK --- configure.py | 2 +- include/JSystem/JFramework/JFWDisplay.h | 8 +- include/JSystem/JGadget/binary.h | 91 ++++--- include/JSystem/JStudio/JStudio/object-id.h | 1 + .../JSystem/JStudio/JStudio/stb-data-parse.h | 9 +- include/JSystem/JStudio/JStudio/stb.h | 49 ++-- include/JSystem/JUtility/JUTFader.h | 2 +- include/JSystem/JUtility/TColor.h | 5 +- include/d/actor/d_a_bst.h | 2 + include/d/actor/d_a_demo00.h | 10 +- include/d/actor/d_a_dk.h | 3 + include/d/actor/d_a_npc_bmsw.h | 2 + include/d/actor/d_a_npc_btsw.h | 2 + include/d/actor/d_a_npc_fa1.h | 2 + include/d/actor/d_a_npc_km1.h | 26 +- include/d/actor/d_a_obj_hfuck1.h | 11 +- include/d/actor/d_a_player.h | 4 +- include/d/actor/d_a_tag_kk1.h | 25 +- include/d/d_com_inf_game.h | 10 + include/d/d_file_select.h | 3 + include/d/d_save.h | 4 + include/m_Do/m_Do_graphic.h | 7 +- src/JSystem/J3DGraphAnimator/J3DCluster.cpp | 3 + src/JSystem/JMessage/processor.cpp | 8 +- .../JStudio/JStudio/stb-data-parse.cpp | 44 ++-- src/JSystem/JStudio/JStudio/stb.cpp | 25 +- .../Runtime/Src/runtime.c | 18 ++ src/d/actor/d_a_demo00.cpp | 232 +++++++++++++++++- src/d/actor/d_a_movie_player.cpp | 4 + src/d/actor/d_a_player_dproc.inc | 41 ++-- src/d/actor/d_a_player_tact.inc | 6 +- src/d/actor/d_a_title.cpp | 4 +- src/d/d_mesg.cpp | 2 +- src/d/d_s_play.cpp | 4 +- src/d/d_save.cpp | 6 +- 35 files changed, 492 insertions(+), 183 deletions(-) diff --git a/configure.py b/configure.py index 3d59bbf59..5804d77ee 100755 --- a/configure.py +++ b/configure.py @@ -726,7 +726,7 @@ config.libs = [ Object(Matching, "JSystem/JStudio/JStudio/fvb-data.cpp"), Object(Matching, "JSystem/JStudio/JStudio/fvb-data-parse.cpp"), Object(Matching, "JSystem/JStudio/JStudio/object-id.cpp"), - Object(NonMatching, "JSystem/JStudio/JStudio/stb.cpp"), + Object(Matching, "JSystem/JStudio/JStudio/stb.cpp", extra_cflags=['-pragma "nosyminline on"']), Object(Matching, "JSystem/JStudio/JStudio/stb-data.cpp"), Object(Matching, "JSystem/JStudio/JStudio/stb-data-parse.cpp"), ], diff --git a/include/JSystem/JFramework/JFWDisplay.h b/include/JSystem/JFramework/JFWDisplay.h index f60fd7d3a..4d06b074d 100644 --- a/include/JSystem/JFramework/JFWDisplay.h +++ b/include/JSystem/JFramework/JFWDisplay.h @@ -65,16 +65,16 @@ public: static JFWDisplay* getManager() { return sManager; } - BOOL startFadeOut(int param_0) { + BOOL startFadeOut(int fadeTime) { if (mpFader != NULL) { - return mpFader->startFadeOut(param_0); + return mpFader->startFadeOut(fadeTime); } return 1; } - BOOL startFadeIn(int param_0) { + BOOL startFadeIn(int fadeTime) { if (mpFader != NULL) { - return mpFader->startFadeIn(param_0); + return mpFader->startFadeIn(fadeTime); } return 1; } diff --git a/include/JSystem/JGadget/binary.h b/include/JSystem/JGadget/binary.h index ab7f57f32..37b52c04c 100644 --- a/include/JSystem/JGadget/binary.h +++ b/include/JSystem/JGadget/binary.h @@ -2,6 +2,7 @@ #define BINARY_H #include "dolphin/types.h" +#include "JSystem/JGadget/search.h" namespace JGadget { namespace binary { @@ -26,11 +27,11 @@ struct TParseData { /* 0x0 */ const void* raw; }; -template +template struct TParseData_aligned : public TParseData { TParseData_aligned(const void* pContent) : TParseData(pContent) {} void setRaw(const void* p) { - /* if ((u32)p % T != 0) { + /* if ((u32)p % S != 0) { JUTWarn w; w << "misaligned : " << (u32)p; } */ @@ -63,7 +64,12 @@ struct TParse_header_block { template struct TParseValue_raw_ { typedef T ParseType; - static T parse(const void* data) { return *(T*)data; } + static T parse(const void* data) { return (T)*(T*)data; } +}; + +template +struct TParseValue_raw : public TParseValue_raw_ { + typedef TParseValue_raw_ InnerParseValueClass; }; template @@ -71,36 +77,43 @@ struct TParseValue_endian_big_ : public TParseValue_raw_ { static T parse(const void* data) { return TParseValue_raw_::parse(data); } }; -template class Parser> -struct TParseValue : public Parser { - static T parse(const void* data) { return Parser::parse(data); } +template +struct TParseValue : public Parser { + static typename Parser::ParseType parse(const void* data) { return Parser::parse(data); } - static T parse(const void* data, s32 advanceNum) { - return Parser::parse(advance(data, advanceNum)); + static typename Parser::ParseType parse(const void* data, s32 advanceNum) { + return Parser::parse(advance(data, advanceNum)); } static const void* advance(const void* data, s32 advanceNum) { - return (char*)data + (advanceNum * sizeof(T)); + return (char*)data + (advanceNum * sizeof(Parser::ParseType)); } }; template -struct TValueIterator { +struct TValueIterator + : public JGadget::TIterator< + std::random_access_iterator_tag, + typename Parser::ParseType, + ptrdiff_t, + typename Parser::ParseType*, + typename Parser::ParseType& + > + { + typedef typename Parser::ParseType ValueType; + TValueIterator(const void* begin) { - mBegin = begin; + mBegin = reinterpret_cast(begin); } - // TValueIterator(const TValueIterator& other) { - // mBegin = other.mBegin; - // } const void* get() const { return mBegin; } typename Parser::ParseType operator*() const { - return Parser::parse(get()); + return TParseValue::parse(get()); } TValueIterator& operator++() { - mBegin = reinterpret_cast(const_cast(mBegin)) + size; + mBegin += size; return *this; } @@ -110,13 +123,13 @@ struct TValueIterator { return old; } - TValueIterator& operator+=(s32 v) { - mBegin = reinterpret_cast(const_cast(mBegin)) + size * v; + TValueIterator& operator+=(s32 n) { + mBegin += size * n; return *this; } TValueIterator& operator--() { - mBegin = reinterpret_cast(const_cast(mBegin)) - size; + mBegin -= size; return *this; } @@ -126,39 +139,55 @@ struct TValueIterator { return old; } - const void* mBegin; + char const* mBegin; }; template -struct TValueIterator_raw : public TValueIterator, sizeof(T)> { - TValueIterator_raw(const void* begin) : TValueIterator, sizeof(T)>(begin) {} - // TValueIterator_raw(const TValueIterator_raw& other) : TValueIterator, sizeof(T)>(other) {} +struct TValueIterator_raw : public TValueIterator, sizeof(T)> { + TValueIterator_raw(const void* begin) : TValueIterator, sizeof(T)>(begin) {} - friend bool operator==(TValueIterator, sizeof(T)> a, TValueIterator, sizeof(T)> b) { + friend bool operator==(TValueIterator, sizeof(T)> a, TValueIterator, sizeof(T)> b) { return a.mBegin == b.mBegin; } - friend T* operator+(TValueIterator, sizeof(T)> a, s32 b) { - return (T*)a.mBegin + b; + friend bool operator!=(TValueIterator, sizeof(T)> a, TValueIterator, sizeof(T)> b) { + return !operator==(a, b); + } + + friend TValueIterator, sizeof(T)> operator+(TValueIterator, sizeof(T)> a, s32 b) { + TValueIterator, sizeof(T)> it = a; + it += b; + return it; } }; template -struct TParseValue_misaligned : TParseValue_raw_ { - static T parse(const void* data) { return TParseValue_raw_::parse(data); } +struct TParseValue_misaligned_ : public TParseValue_raw_ { + typedef T ParseType; + static T parse(const void* data) { return TParseValue >::parse(data); } +}; + +template +struct TParseValue_misaligned : public TParseValue_raw_ { + typedef TParseValue_misaligned_ InnerParseValueClass; }; template struct TValueIterator_misaligned : public TValueIterator, sizeof(T)> { TValueIterator_misaligned(const void* begin) : TValueIterator, sizeof(T)>(begin) {} - // TValueIterator_misaligned(const TValueIterator_misaligned& other) : TValueIterator, sizeof(T)>(other) {} friend bool operator==(TValueIterator, sizeof(T)> a, TValueIterator, sizeof(T)> b) { return a.mBegin == b.mBegin; } - friend T* operator+(TValueIterator, sizeof(T)> a, s32 b) { - return (T*)a.mBegin + b; + friend bool operator!=(TValueIterator, sizeof(T)> a, TValueIterator, sizeof(T)> b) { + return !operator==(a, b); + } + + friend TValueIterator, sizeof(T)> operator+(TValueIterator, sizeof(T)> a, s32 b) { + TValueIterator, sizeof(T)> it(a); + it += b; + return it; } }; diff --git a/include/JSystem/JStudio/JStudio/object-id.h b/include/JSystem/JStudio/JStudio/object-id.h index 274b3a9ec..be8f8a2e6 100644 --- a/include/JSystem/JStudio/JStudio/object-id.h +++ b/include/JSystem/JStudio/JStudio/object-id.h @@ -27,6 +27,7 @@ struct TObject_ID : public TIDData { struct TPRObject_ID_equal : public TIDData { TPRObject_ID_equal(const void* id, u32 id_size) : TIDData(id, id_size) {} + ~TPRObject_ID_equal() {} bool operator()(TObject_ID const& id) const { return TIDData::isEqual(id.getIDData(), *this); } }; diff --git a/include/JSystem/JStudio/JStudio/stb-data-parse.h b/include/JSystem/JStudio/JStudio/stb-data-parse.h index adb8fbc31..80c94eeeb 100644 --- a/include/JSystem/JStudio/JStudio/stb-data-parse.h +++ b/include/JSystem/JStudio/JStudio/stb-data-parse.h @@ -67,12 +67,11 @@ public: struct TParse_TParagraph_data : public TParseData { struct TData { - // TODO: these field names are wrong /* 0x00 */ u8 status; - /* 0x04 */ u32 dataSize; - /* 0x08 */ u32 _8; - /* 0x0C */ const void* fileCount; - /* 0x10 */ const void* _10; + /* 0x04 */ u32 entrySize; + /* 0x08 */ u32 entryCount; + /* 0x0C */ const void* content; + /* 0x10 */ const void* next; }; TParse_TParagraph_data(const void* content) : TParseData(content) {} diff --git a/include/JSystem/JStudio/JStudio/stb.h b/include/JSystem/JStudio/JStudio/stb.h index 8567ad31d..f99d5a51a 100644 --- a/include/JSystem/JStudio/JStudio/stb.h +++ b/include/JSystem/JStudio/JStudio/stb.h @@ -44,7 +44,7 @@ public: void setFlag_operation(u8, int); void reset(void const*); - u8 forward(u32); + bool forward(u32); virtual void do_begin(); virtual void do_end(); virtual void do_paragraph(u32, void const*, u32); @@ -132,7 +132,7 @@ public: void destroyObject(TObject*); void destroyObject_all(); TObject* getObject(void const*, u32); - u8 forward(u32); + bool forward(u32); void setStatus_(u32 status) { mStatus = status; } void resetStatus_() { setStatus_(0); } @@ -142,6 +142,10 @@ public: TObject_control& referObject_control() { return mObject_control; } int getSuspend() const { return _54; } void setSuspend(s32 suspend) { mObject_control.setSuspend(suspend); } + void suspend(s32 param_0) { mObject_control.suspend(param_0); } + void unsuspend(s32 param_0) { suspend(-param_0); } + void getObjectContainer() const {} + void referObjectContainer() {} private: /* 0x04 */ u32 _4; @@ -159,31 +163,42 @@ struct TParseData : public data::TParse_TParagraph_data::TData { set(data::TParse_TParagraph_data(pContent)); } + TParseData() { + set(NULL); + } + void set(const data::TParse_TParagraph_data& data) { data.getData(this); } + void set(const void* pContent) { + set(data::TParse_TParagraph_data(pContent)); + } + bool isEnd() const { return status == 0; } bool empty() const { - return fileCount == NULL; + return content == NULL; } bool isValid() const { return !empty() && status == S; } - u32 size() const { return _8; } + const void* getContent() const { return content; } + + u32 size() const { return entryCount; } }; template > struct TParseData_fixed : public TParseData { TParseData_fixed(const void* pContent) : TParseData(pContent) {} + TParseData_fixed() : TParseData() {} const void* getNext() const { - return this->_10; + return this->next; } bool isValid() const { @@ -191,31 +206,21 @@ struct TParseData_fixed : public TParseData { } Iterator begin() const { - return Iterator(this->fileCount); + return Iterator(this->content); } Iterator end() const { - Iterator i(this->fileCount); + Iterator i(this->content); i += this->size(); return i; } - // TODO: front and back are needed to daPy_lk_c::dProcTool - // these implementations are just guesses though, probably wrong - Iterator front() const { - // Iterator i = begin(); - // i++; - // return i; - - // Iterator i(begin()); - // ++i; - // return i; - - return Iterator(begin()) + 1; + typename Iterator::ValueType front() const { + return *begin(); } - Iterator back() const { - Iterator i = end(); - return i + (-1); + + typename Iterator::ValueType back() const { + return *--end(); } }; diff --git a/include/JSystem/JUtility/JUTFader.h b/include/JSystem/JUtility/JUTFader.h index b2e992f31..e25158fe7 100644 --- a/include/JSystem/JUtility/JUTFader.h +++ b/include/JSystem/JUtility/JUTFader.h @@ -22,7 +22,7 @@ public: virtual void draw(); s32 getStatus() const { return mStatus; } - void setColor(JUtility::TColor& color) { mColor.set(color); } + void setColor(JUtility::TColor color) { mColor.set(color); } /* 0x04 */ s32 mStatus; /* 0x08 */ u16 mFadeTime; diff --git a/include/JSystem/JUtility/TColor.h b/include/JSystem/JUtility/TColor.h index a9e35a7e3..ba460306a 100644 --- a/include/JSystem/JUtility/TColor.h +++ b/include/JSystem/JUtility/TColor.h @@ -27,7 +27,10 @@ struct TColor : public GXColor { } void set(u32 u32Color) { *(u32*)&r = u32Color; } - void set(GXColor gxColor) { *(GXColor*)&r = gxColor; } + void set(GXColor gxColor) { + GXColor* temp = this; + *temp = gxColor; + } }; } // namespace JUtility diff --git a/include/d/actor/d_a_bst.h b/include/d/actor/d_a_bst.h index d42cf302d..53d7f7269 100644 --- a/include/d/actor/d_a_bst.h +++ b/include/d/actor/d_a_bst.h @@ -122,6 +122,8 @@ public: daBst_HIO_c(); virtual ~daBst_HIO_c() {} + void genMessage(JORMContext* ctx); + public: /* 0x4 */ s8 field_0x4; /* 0x5 */ u8 field_0x5; diff --git a/include/d/actor/d_a_demo00.h b/include/d/actor/d_a_demo00.h index 018b6799e..6e64141ce 100644 --- a/include/d/actor/d_a_demo00.h +++ b/include/d/actor/d_a_demo00.h @@ -15,7 +15,9 @@ class dBgS_GndChk; class daDemo00_shadow_c { public: +#if VERSION > VERSION_DEMO /* 0x00 */ u32 shadowID; +#endif /* 0x04 */ cXyz pos; /* 0x10 */ f32 field_0x10; /* 0x14 */ f32 field_0x14; @@ -26,7 +28,7 @@ public: void reset(); public: - /* 0x00 */ s32 modelID; + /* 0x00 */ u32 modelID; /* 0x04 */ s32 bckID; /* 0x08 */ s32 field_0x08; /* 0x0C */ s32 btpID; @@ -34,7 +36,7 @@ public: /* 0x14 */ s32 brkID; /* 0x18 */ s32 field_0x18; /* 0x1C */ s32 field_0x1C; - /* 0x20 */ s32 plightID; + /* 0x20 */ u32 plightID; /* 0x24 */ s32 shadowID; }; @@ -60,7 +62,9 @@ class daDemo00_bgc_c { class daDemo00_c : public fopAc_ac_c { public: +#if VERSION > VERSION_DEMO ~daDemo00_c(); +#endif typedef BOOL (daDemo00_c::*ActionFunc)(dDemo_actor_c* act); @@ -75,7 +79,7 @@ public: BOOL actLeaving(dDemo_actor_c*); inline BOOL create(); BOOL draw(); - BOOL execute(); + inline BOOL execute(); public: /* 0x290 */ ActionFunc actionFunc; diff --git a/include/d/actor/d_a_dk.h b/include/d/actor/d_a_dk.h index 5f22ca177..2365c9d1c 100644 --- a/include/d/actor/d_a_dk.h +++ b/include/d/actor/d_a_dk.h @@ -47,6 +47,9 @@ public: daDk_HIO_c(); virtual ~daDk_HIO_c() {} + void genMessage(JORMContext* ctx); + +public: /* 0x04 */ s8 mNo; /* 0x05 */ u8 field_0x05; /* 0x06 */ u8 field_0x06[0x08 - 0x06]; diff --git a/include/d/actor/d_a_npc_bmsw.h b/include/d/actor/d_a_npc_bmsw.h index ca1181b02..4f802b7fe 100644 --- a/include/d/actor/d_a_npc_bmsw.h +++ b/include/d/actor/d_a_npc_bmsw.h @@ -234,6 +234,8 @@ public: daNpc_Bmsw_HIO_c(); virtual ~daNpc_Bmsw_HIO_c() {} + void genMessage(JORMContext* ctx); + public: /* 0x04 */ s8 mNo; /* 0x05 */ u8 field_0x05[0x08 - 0x05]; diff --git a/include/d/actor/d_a_npc_btsw.h b/include/d/actor/d_a_npc_btsw.h index aa8c8ddb7..90e1fdbf0 100644 --- a/include/d/actor/d_a_npc_btsw.h +++ b/include/d/actor/d_a_npc_btsw.h @@ -218,6 +218,8 @@ public: daNpc_Btsw_HIO_c(); virtual ~daNpc_Btsw_HIO_c() {} + void genMessage(JORMContext* ctx); + public: /* 0x04 */ s8 mNo; /* 0x05 */ u8 field_0x05[0x08 - 0x05]; diff --git a/include/d/actor/d_a_npc_fa1.h b/include/d/actor/d_a_npc_fa1.h index 2c58bf3e9..416ffe7f5 100644 --- a/include/d/actor/d_a_npc_fa1.h +++ b/include/d/actor/d_a_npc_fa1.h @@ -256,6 +256,8 @@ public: daNpc_Fa1_HIO_c(); virtual ~daNpc_Fa1_HIO_c() {}; + void genMessage(JORMContext* ctx); + public: /* 0x04 */ s8 mNo; /* 0x08 */ hio_prm_c prm; diff --git a/include/d/actor/d_a_npc_km1.h b/include/d/actor/d_a_npc_km1.h index e0d770024..99ec6f54a 100644 --- a/include/d/actor/d_a_npc_km1.h +++ b/include/d/actor/d_a_npc_km1.h @@ -135,7 +135,8 @@ public: }; // Size: 0x7D8 class daNpc_Km1_HIO_c : public JORReflexible{ - struct hio_prm_c{ +public: + struct hio_prm_c { s16 field_0; s16 field_2; s16 field_4; @@ -149,18 +150,19 @@ class daNpc_Km1_HIO_c : public JORReflexible{ f32 mAttentionArrowYOffset; f32 field_18; }; // Size: 0x1C -public: - daNpc_Km1_HIO_c(); - virtual ~daNpc_Km1_HIO_c(){}; -public: - /* Place member variables here */ - /* 0x4 */ s8 mNo; - /* 0x5 */ s8 field_0x5; - /* 0x6 */ s8 field_0x6; - /* 0x7 */ s8 field_0x7; - /* 0x8 */ int field_0x8; - /* 0xC */ hio_prm_c mPrmTbl; + daNpc_Km1_HIO_c(); + virtual ~daNpc_Km1_HIO_c() {}; + + void genMessage(JORMContext* ctx); + +public: + /* 0x04 */ s8 mNo; + /* 0x05 */ s8 field_0x5; + /* 0x06 */ s8 field_0x6; + /* 0x07 */ s8 field_0x7; + /* 0x08 */ int field_0x8; + /* 0x0C */ hio_prm_c mPrmTbl; }; #endif /* D_A_NPC_KM1_H */ diff --git a/include/d/actor/d_a_obj_hfuck1.h b/include/d/actor/d_a_obj_hfuck1.h index 2eb988f25..d5079d088 100644 --- a/include/d/actor/d_a_obj_hfuck1.h +++ b/include/d/actor/d_a_obj_hfuck1.h @@ -35,11 +35,14 @@ public: daObjHfuck1_HIO_c(); virtual ~daObjHfuck1_HIO_c() {} + void genMessage(JORMContext* ctx); + +public: /* 0x04 */ s8 mNo; - f32 field_0x08; - f32 field_0x0C; - f32 field_0x10; - f32 field_0x14; + /* 0x08 */ f32 field_0x08; + /* 0x0C */ f32 field_0x0C; + /* 0x10 */ f32 field_0x10; + /* 0x14 */ f32 field_0x14; }; #endif diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index 4ae0d2389..c7afd1702 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -104,8 +104,8 @@ public: /* 0x047 */ DEMO_SHIPOFF_e = 71, /* 0x048 */ DEMO_UNK_072_e = 72, /* 0x049 */ DEMO_FOODTHROW_e = 73, - /* 0x04A */ DEMO_UNK_074_e = 0x4A, - /* 0x04B */ DEMO_LAST_e = 0x4B, + /* 0x04A */ DEMO_UNK_074_e = 74, + /* 0x04B */ DEMO_LAST_e, /* 0x200 */ DEMO_NEW_ANM0_e = 0x200, }; diff --git a/include/d/actor/d_a_tag_kk1.h b/include/d/actor/d_a_tag_kk1.h index bd0a219e1..1c49bccb3 100644 --- a/include/d/actor/d_a_tag_kk1.h +++ b/include/d/actor/d_a_tag_kk1.h @@ -19,21 +19,22 @@ public: }; // Size: 0x6C8 -class daTag_Kk1_HIO_c : public JORReflexible{ +class daTag_Kk1_HIO_c : public JORReflexible { +public: + struct hio_prm_c { + /* 0x08 */ f32 mHorizontalDistance; + /* 0x0C */ f32 mVerticalDistance; + /* 0x10 */ u8 field_0x10; + }; - public: - daTag_Kk1_HIO_c(); - virtual ~daTag_Kk1_HIO_c(){}; + daTag_Kk1_HIO_c(); + virtual ~daTag_Kk1_HIO_c() {}; - public: - struct hio_prm_c { - /* 0x08 */ f32 mHorizontalDistance; - /* 0x0C */ f32 mVerticalDistance; - /* 0x10 */ u8 field_0x10; - }; + void genMessage(JORMContext* ctx); - /* 0x04 */ s8 mNo; - /* 0x08 */ hio_prm_c prm; +public: + /* 0x04 */ s8 mNo; + /* 0x08 */ hio_prm_c prm; }; #endif /* D_A_TAG_KK1_H */ diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index e3d713434..92c8e05a5 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -1395,6 +1395,15 @@ inline void dComIfGs_setTurnRestartHasShip(BOOL hasShip) { } #endif +#if VERSION == VERSION_DEMO +inline void dComIfGs_setTurnRestart(const cXyz& i_pos, s16 i_angle, s8 i_roomNo, u32 i_param) { + g_dComIfG_gameInfo.save.getTurnRestart().set(i_pos, i_angle, i_roomNo, i_param, i_pos, i_angle); +} + +inline void dComIfGs_setTurnRestart(const cXyz& i_pos, s16 i_angle, s8 i_roomNo, u32 i_param, const cXyz& i_shipPos, s16 i_shipAngle) { + g_dComIfG_gameInfo.save.getTurnRestart().set(i_pos, i_angle, i_roomNo, i_param, i_shipPos, i_shipAngle); +} +#else inline void dComIfGs_setTurnRestart(const cXyz& i_pos, s16 i_angle, s8 i_roomNo, u32 i_param) { g_dComIfG_gameInfo.save.getTurnRestart().set(i_pos, i_angle, i_roomNo, i_param, i_pos, i_angle, FALSE); } @@ -1403,6 +1412,7 @@ inline void dComIfGs_setTurnRestart(const cXyz& i_pos, s16 i_angle, s8 i_roomNo, inline void dComIfGs_setTurnRestart(const cXyz& i_pos, s16 i_angle, s8 i_roomNo, u32 i_param, const cXyz& i_shipPos, s16 i_shipAngle, BOOL i_hasShip) { g_dComIfG_gameInfo.save.getTurnRestart().set(i_pos, i_angle, i_roomNo, i_param, i_shipPos, i_shipAngle, i_hasShip); } +#endif inline void dComIfGs_setMemoryToCard(u8* i_cardPtr, int i_dataNum) { g_dComIfG_gameInfo.save.memory_to_card((char*)i_cardPtr, i_dataNum); diff --git a/include/d/d_file_select.h b/include/d/d_file_select.h index 58655f0a3..6b932c28b 100644 --- a/include/d/d_file_select.h +++ b/include/d/d_file_select.h @@ -14,6 +14,9 @@ public: dFs_HIO_c(); virtual ~dFs_HIO_c() {} + void genMessage(JORMContext* ctx); + +public: /* 0x04 */ s8 mNo; /* 0x05 */ u8 field_0x05; /* 0x06 */ u8 field_0x06; diff --git a/include/d/d_save.h b/include/d/d_save.h index aa751ca92..ece6041f1 100644 --- a/include/d/d_save.h +++ b/include/d/d_save.h @@ -813,7 +813,11 @@ public: class dSv_turnRestart_c { public: +#if VERSION == VERSION_DEMO + void set(cXyz const&, s16, s8, u32, cXyz const&, s16); +#else void set(cXyz const&, s16, s8, u32, cXyz const&, s16, int); +#endif u32 getParam() { return mParam; } cXyz& getPos() { return mPosition; } diff --git a/include/m_Do/m_Do_graphic.h b/include/m_Do/m_Do_graphic.h index 978eba297..ef06f3496 100644 --- a/include/m_Do/m_Do_graphic.h +++ b/include/m_Do/m_Do_graphic.h @@ -7,6 +7,7 @@ bool mDoGph_Create(); struct ResTIMG; + class mDoGph_gInf_c { public: static void create(); @@ -27,9 +28,9 @@ public: mFader = fader; } - static BOOL startFadeOut(int param_0) { return JFWDisplay::getManager()->startFadeOut(param_0); } - static BOOL startFadeIn(int param_0) { return JFWDisplay::getManager()->startFadeIn(param_0); } - static void setFadeColor(JUtility::TColor color) { mFader->mColor.set(color); } + static BOOL startFadeOut(int fadeTime) { return JFWDisplay::getManager()->startFadeOut(fadeTime); } + static BOOL startFadeIn(int fadeTime) { return JFWDisplay::getManager()->startFadeIn(fadeTime); } + static void setFadeColor(JUtility::TColor& color) { mFader->setColor(color); } static void setClearColor(JUtility::TColor color) { JFWDisplay::getManager()->setClearColor(color); } static void setBackColor(GXColor& color) { mBackColor = color; } static void endFrame() { JFWDisplay::getManager()->endFrame(); } diff --git a/src/JSystem/J3DGraphAnimator/J3DCluster.cpp b/src/JSystem/J3DGraphAnimator/J3DCluster.cpp index e1b0289b2..82d1b6bbb 100644 --- a/src/JSystem/J3DGraphAnimator/J3DCluster.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DCluster.cpp @@ -476,7 +476,10 @@ void J3DSkinDeform::deformVtxPos_S16(J3DModel* model) const { for (s32 i = 0; i < vtxNum; i++) { Mtx* mtx = mtxArr[model->getModelData()->getDrawMtxFlag(mPosUseMtx[i])]; +// TODO: this line doesn't compile on debug +#ifndef DEBUG J3DPSMulMtxVec(mtx[model->getModelData()->getDrawMtxIndex(mPosUseMtx[i])], &curVtxPos[i], &transformedVtxPos[i]); +#endif } DCStoreRange(model->getVertexBuffer()->getTransformedVtxPos(0), model->getModelData()->getVtxNum() * sizeof(SVec)); diff --git a/src/JSystem/JMessage/processor.cpp b/src/JSystem/JMessage/processor.cpp index 5655ca53c..4827caf31 100644 --- a/src/JSystem/JMessage/processor.cpp +++ b/src/JSystem/JMessage/processor.cpp @@ -180,7 +180,7 @@ void TProcessor::do_tag_(u32 tag, const void* data, u32 size) { void TProcessor::do_systemTagCode_(u16 code, const void* data, u32 size) { switch (code) { case 0x05: - pushCurrent(mControl->on_message(JGadget::binary::TParseValue::parse(data))); + pushCurrent(mControl->on_message(JGadget::binary::TParseValue >::parse(data))); break; } } @@ -442,11 +442,11 @@ void TSequenceProcessor::do_tag_(u32 tag, const void* data, u32 size) { on_branch_query(code); break; case 0xF8: - on_branch_register(process_branch_limited_, datap + 2, JGadget::binary::TParseValue::parse(datap)); + on_branch_register(process_branch_limited_, datap + 2, JGadget::binary::TParseValue >::parse(datap)); on_branch_query(code); break; case 0xF7: - on_branch_register(process_branch_, datap + 2, JGadget::binary::TParseValue::parse(datap)); + on_branch_register(process_branch_, datap + 2, JGadget::binary::TParseValue >::parse(datap)); on_branch_query(code); break; default: @@ -464,7 +464,7 @@ void TSequenceProcessor::do_systemTagCode_(u16 code, const void* data, u32 size) case 3: break; case 6: { - u32 target = JGadget::binary::TParseValue::parse(data); + u32 target = JGadget::binary::TParseValue >::parse(data); on_jump_register(process_jump_, target); break; } diff --git a/src/JSystem/JStudio/JStudio/stb-data-parse.cpp b/src/JSystem/JStudio/JStudio/stb-data-parse.cpp index 48c6f9e73..0b53c5c4a 100644 --- a/src/JSystem/JStudio/JStudio/stb-data-parse.cpp +++ b/src/JSystem/JStudio/JStudio/stb-data-parse.cpp @@ -47,34 +47,34 @@ void TParse_TParagraph::getData(TParse_TParagraph::TData* pData) const { /* 80275B2C-80275BAC .text getData__Q47JStudio3stb4data22TParse_TParagraph_dataCFPQ57JStudio3stb4data22TParse_TParagraph_data5TData */ void TParse_TParagraph_data::getData(TParse_TParagraph_data::TData* pData) const { - u8* set2; - - int dSize = pData->dataSize = 0; - pData->_8 = 0; - pData->fileCount = NULL; - pData->_10 = NULL; - u8* filedata = (u8*)getRaw(); + // JUT_ASSERT(104, pData!=NULL); + pData->entrySize = 0; + pData->entryCount = 0; + pData->content = NULL; + pData->next = NULL; + u8* temp = (u8*)getRaw(); + u8* filedata = temp; if (filedata == NULL) return; - u8 set = *filedata; - pData->status = set & ~0x8; - if (!set) + u8 r29 = *filedata; + pData->status = r29 & ~0x8; + if (!r29) return; - int is8; - int set3 = 1; - is8 = set & 8; - // Probably fake match - if (set2 = (filedata + 1), is8) { - set3 = *set2++; + filedata++; + u32 r28 = 1; + if (r29 & 8) { + r28 = *filedata; + filedata++; } - pData->_8 = set3; - pData->fileCount = set2; + pData->entryCount = r28; + pData->content = filedata; - if (!(set & 7)) + u8 r27 = r29 & 7; + if (r27 == 0) return; - dSize = (gauDataSize_TEParagraph_data)[set &= 7]; - pData->dataSize = dSize; - pData->_10 = (u8*)set2 + (dSize * set3); + u32 dataSize = (gauDataSize_TEParagraph_data)[r27]; + pData->entrySize = dataSize; + pData->next = filedata + (dataSize * r28); } } // namespace data diff --git a/src/JSystem/JStudio/JStudio/stb.cpp b/src/JSystem/JStudio/JStudio/stb.cpp index f9425222b..4f84d5491 100644 --- a/src/JSystem/JStudio/JStudio/stb.cpp +++ b/src/JSystem/JStudio/JStudio/stb.cpp @@ -52,8 +52,8 @@ void TObject::reset(const void* arg1) { } /* 80274D64-80274F74 .text forward__Q37JStudio3stb7TObjectFUl */ -u8 TObject::forward(u32 arg1) { - u8 temp = false; +bool TObject::forward(u32 arg1) { + bool temp = false; while (true) { if (mFlag & 0x8000) { @@ -67,7 +67,7 @@ u8 TObject::forward(u32 arg1) { case STATUS_INACTIVE: break; } - return 1; + return true; } if (getStatus() == STATUS_INACTIVE) { @@ -84,7 +84,7 @@ u8 TObject::forward(u32 arg1) { setStatus_(STATUS_SUSPEND); on_wait(arg1); } - return 1; + return true; } while (true) { @@ -101,7 +101,7 @@ u8 TObject::forward(u32 arg1) { setStatus_(STATUS_END); on_end(); } - return 0; + return false; } if (!bSequence_) { @@ -127,7 +127,7 @@ u8 TObject::forward(u32 arg1) { } else { u32Wait_ -= arg1; on_wait(arg1); - return 1; + return true; } } } @@ -282,7 +282,6 @@ void TControl::destroyObject_all() { /* 802754C0-80275560 .text getObject__Q37JStudio3stb8TControlFPCvUl */ TObject* TControl::getObject(const void* param_0, u32 param_1) { - /* Nonmatching - TPRObject_ID_equal copy issue */ JGadget::TLinkList::iterator begin = mObjectContainer.begin(); JGadget::TLinkList::iterator end = mObjectContainer.end(); JGadget::TLinkList::iterator local_50 = std::find_if(begin, end, object::TPRObject_ID_equal(param_0, param_1)); @@ -293,21 +292,15 @@ TObject* TControl::getObject(const void* param_0, u32 param_1) { } /* 80275560-8027565C .text forward__Q37JStudio3stb8TControlFUl */ -u8 TControl::forward(u32 param_0) { - /* Nonmatching - regalloc */ +bool TControl::forward(u32 param_0) { _54 = mObject_control.getSuspend(); - u8 rv = mObject_control.forward(param_0); + bool rv = mObject_control.forward(param_0); int uVar7 = 0xf; int uVar6 = 0; JGadget::TContainerEnumerator aTStack_38(&mObjectContainer); while (aTStack_38) { JStudio::stb::TObject& this_00 = *aTStack_38; - u8 iVar5 = 0; - u8 iVar4 = this_00.forward(param_0); - if (iVar4 != 0 || rv != 0) { - iVar5 = 1; - } - rv = iVar5; + rv = this_00.forward(param_0) || rv; int uVar3 = this_00.getStatus(); uVar7 &= uVar3; uVar6 |= uVar3; diff --git a/src/PowerPC_EABI_Support/Runtime/Src/runtime.c b/src/PowerPC_EABI_Support/Runtime/Src/runtime.c index 2b81f1a65..9b337417f 100644 --- a/src/PowerPC_EABI_Support/Runtime/Src/runtime.c +++ b/src/PowerPC_EABI_Support/Runtime/Src/runtime.c @@ -145,22 +145,31 @@ ASM static void __save_fpr(void) { stfd fp15,-136(save_restore_reg) stfd fp16,-128(save_restore_reg) stfd fp17,-120(save_restore_reg) + ENTRY_SAVE_FPR(18) stfd fp18,-112(save_restore_reg) + ENTRY_SAVE_FPR(19) stfd fp19,-104(save_restore_reg) + ENTRY_SAVE_FPR(20) stfd fp20,-96(save_restore_reg) + ENTRY_SAVE_FPR(21) stfd fp21,-88(save_restore_reg) + ENTRY_SAVE_FPR(22) stfd fp22,-80(save_restore_reg) + ENTRY_SAVE_FPR(23) stfd fp23,-72(save_restore_reg) + ENTRY_SAVE_FPR(24) stfd fp24,-64(save_restore_reg) ENTRY_SAVE_FPR(25) stfd fp25,-56(save_restore_reg) ENTRY_SAVE_FPR(26) stfd fp26,-48(save_restore_reg) + ENTRY_SAVE_FPR(27) stfd fp27,-40(save_restore_reg) ENTRY_SAVE_FPR(28) stfd fp28,-32(save_restore_reg) ENTRY_SAVE_FPR(29) stfd fp29,-24(save_restore_reg) + ENTRY_SAVE_FPR(30) stfd fp30,-16(save_restore_reg) stfd fp31,-8(save_restore_reg) blr @@ -174,22 +183,31 @@ ASM static void __restore_fpr(void) { lfd fp15,-136(save_restore_reg) lfd fp16,-128(save_restore_reg) lfd fp17,-120(save_restore_reg) + ENTRY_RESTORE_FPR(18) lfd fp18,-112(save_restore_reg) + ENTRY_RESTORE_FPR(19) lfd fp19,-104(save_restore_reg) + ENTRY_RESTORE_FPR(20) lfd fp20,-96(save_restore_reg) + ENTRY_RESTORE_FPR(21) lfd fp21,-88(save_restore_reg) + ENTRY_RESTORE_FPR(22) lfd fp22,-80(save_restore_reg) + ENTRY_RESTORE_FPR(23) lfd fp23,-72(save_restore_reg) + ENTRY_RESTORE_FPR(24) lfd fp24,-64(save_restore_reg) ENTRY_RESTORE_FPR(25) lfd fp25,-56(save_restore_reg) ENTRY_RESTORE_FPR(26) lfd fp26,-48(save_restore_reg) + ENTRY_RESTORE_FPR(27) lfd fp27,-40(save_restore_reg) ENTRY_RESTORE_FPR(28) lfd fp28,-32(save_restore_reg) ENTRY_RESTORE_FPR(29) lfd fp29,-24(save_restore_reg) + ENTRY_RESTORE_FPR(30) lfd fp30,-16(save_restore_reg) lfd fp31,-8(save_restore_reg) blr diff --git a/src/d/actor/d_a_demo00.cpp b/src/d/actor/d_a_demo00.cpp index 7094ec58c..3e6e9f84c 100644 --- a/src/d/actor/d_a_demo00.cpp +++ b/src/d/actor/d_a_demo00.cpp @@ -11,6 +11,7 @@ #include "SSystem/SComponent/c_phase.h" #include "d/d_com_inf_game.h" #include "d/d_demo.h" +#include "d/d_item.h" #include "d/d_kankyo.h" #include "d/d_kankyo_demo.h" #include "d/d_procname.h" @@ -23,6 +24,10 @@ #include "JSystem/J3DGraphAnimator/J3DModelData.h" #include "string.h" +static void dummy() { + OSReport("V_24_tri_joint"); +} + /* 800E595C-800E598C .text reset__16daDemo00_resID_cFv */ void daDemo00_resID_c::reset() { modelID = -1; @@ -51,11 +56,13 @@ void daDemo00_model_c::reset() { shadow = NULL; } +#if VERSION > VERSION_DEMO daDemo00_c::~daDemo00_c() { if (heap != NULL && model.morf != NULL) { model.morf->stopZelAnime(); } } +#endif /* 800E5A60-800E5AFC .text setBaseMtx__10daDemo00_cFv */ void daDemo00_c::setBaseMtx() { @@ -108,7 +115,11 @@ BOOL awaCheck(J3DModel* model) { if (texName != NULL) { for (u16 i = 0; i < tex->getNum(); i++) { const char* name = texName->getName(i); - if (strcmp(name, "B_dummy") == 0 || strcmp(name, "cy_kankyo") == 0) { + if (strcmp(name, "B_dummy") == 0 +#if VERSION > VERSION_DEMO + || strcmp(name, "cy_kankyo") == 0 +#endif + ) { J3DSkinDeform* deform = new J3DSkinDeform(); if (deform == NULL) return FALSE; @@ -116,7 +127,10 @@ BOOL awaCheck(J3DModel* model) { if (model->setSkinDeform(deform, 1) != J3DErrType_Success) return FALSE; - if (strcmp(name, "B_dummy") == 0) { +#if VERSION > VERSION_DEMO + if (strcmp(name, "B_dummy") == 0) +#endif + { tex->setResTIMG(i, *mDoGph_gInf_c::getFrameBufferTimg()); mDoExt_modelTexturePatch(modelData); } @@ -135,12 +149,15 @@ static BOOL createHeapCallBack(fopAc_ac_c* i_this) { /* 800E6014-800E6620 .text createHeap__10daDemo00_cFv */ BOOL daDemo00_c::createHeap() { /* Nonmatching */ + J3DModelData* modelData; + JUT_ASSERT(0, modelData != NULL); + void* anm; + JUT_ASSERT(0, anm != NULL); } /* 800E6620-800E6758 .text actStandby__10daDemo00_cFP13dDemo_actor_c */ BOOL daDemo00_c::actStandby(dDemo_actor_c* act) { - /* Nonmatching */ - if (nextRes.modelID != 0xFFFF || nextRes.plightID != 0xFFFF) { + if (nextRes.modelID != -1 || nextRes.plightID != -1) { model.resID = nextRes; if (fopAcM_entrySolidHeap(this, createHeapCallBack, 0x4000) != 0) { if (model.model != NULL) { @@ -165,10 +182,11 @@ BOOL daDemo00_c::actPerformance(dDemo_actor_c*) { /* 800E6E2C-800E6E90 .text actLeaving__10daDemo00_cFP13dDemo_actor_c */ BOOL daDemo00_c::actLeaving(dDemo_actor_c* act) { - /* Nonmatching */ +#if VERSION > VERSION_DEMO if (model.morf != NULL) { model.morf->stopZelAnime(); } +#endif fopAcM_DeleteHeap(this); setAction(&daDemo00_c::actStandby); @@ -183,6 +201,9 @@ static BOOL daDemo00_Draw(daDemo00_c* i_this) { /* 800E6EB0-800E7204 .text draw__10daDemo00_cFv */ BOOL daDemo00_c::draw() { /* Nonmatching */ +#if VERSION > VERSION_DEMO + OSReport("GTower"); +#endif } /* 800E7204-800E7224 .text daDemo00_Execute__FP10daDemo00_c */ @@ -192,7 +213,204 @@ static BOOL daDemo00_Execute(daDemo00_c* i_this) { /* 800E7224-800E78A0 .text execute__10daDemo00_cFv */ BOOL daDemo00_c::execute() { - /* Nonmatching */ +#if VERSION > VERSION_DEMO + field_0x29e = 0; +#endif + + dDemo_actor_c* demo_actor = dComIfGp_demo_getActor(demoActorID); + if (demo_actor == NULL) { + fopAcM_delete(this); + } else { + if (demo_actor->checkEnable(dDemo_actor_c::ENABLE_SHAPE_e)) { + nextRes.modelID = demo_actor->getShapeId(); + } + if (demo_actor->checkEnable(dDemo_actor_c::ENABLE_ANM_e)) { + nextRes.bckID = demo_actor->getAnmId(); + } + if (demo_actor->checkEnable(dDemo_actor_c::ENABLE_UNK_e)) { +#if VERSION > VERSION_DEMO + u8 r29 = field_0x29c; +#endif + field_0x29c = demo_actor->getPrm()->getId(); + if (field_0x29c == 4) { + static const u16 l_eventBit[] = { + 0xFFFF, + 0x2A80, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0x2401, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0x2110, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0x2D01, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0xFFFF, + 0x3802, + }; + dDemo_prm_data* data = demo_actor->getPrm()->getData(); + JStudio::stb::TParseData_fixed<49, TValueIterator_raw > spCC(data); + if (!spCC.isEnd() && spCC.isValid()) { + TValueIterator_raw it = spCC.begin(); + int argID = *it; + JUT_ASSERT(VERSION_SELECT(771, 832, 832, 832), argID < (sizeof(l_eventBit)/sizeof(u16))); + if (l_eventBit[argID] != 0xFFFF) { + dComIfGs_onEventBit(l_eventBit[argID]); + } + } + } else if (field_0x29c == 5) { + static const u8 l_itemNo[] = { + dItem_MASTER_SWORD_1_e, + dItem_MASTER_SWORD_2_e, + dItem_MASTER_SWORD_3_e, + dItem_PEARL_DIN_e, + dItem_PEARL_FARORE_e, + dItem_PEARL_NAYRU_e, + dItem_DELIVERY_BAG_e, + dItem_SHIELD_e, + dItem_MAGIC_ARROW_e, + dItem_NONE_e, + }; + dDemo_prm_data* data = demo_actor->getPrm()->getData(); + JStudio::stb::TParseData_fixed<49, TValueIterator_raw > spB8(data); + if (!spB8.isEnd() && spB8.isValid()) { + TValueIterator_raw it = spB8.begin(); + int argID = *it; + JUT_ASSERT(VERSION_SELECT(797, 858, 858, 858), argID < (sizeof(l_itemNo)/sizeof(u8))); + if (l_itemNo[argID] != dItem_NONE_e) { + execItemGet(l_itemNo[argID]); + } + } + } else if (field_0x29c == 6) { + dDemo_prm_data* data = demo_actor->getPrm()->getData(); + JStudio::stb::TParseData_fixed<33, TValueIterator_misaligned > spA4(data); + if (!spA4.isEnd() && spA4.isValid()) { + TValueIterator_misaligned it = spA4.begin(); + int argID = *it; + mDoGph_gInf_c::setMonotoneRateSpeed(argID); + } + } else if (field_0x29c == 7) { + dDemo_prm_data* data = demo_actor->getPrm()->getData(); + JStudio::stb::TParseData_fixed<49, TValueIterator_raw > sp90(data); + if (!sp90.isEnd() && sp90.isValid()) { + TValueIterator_raw it = sp90.begin(); + int argID = *it; + if (argID < 100) { + dComIfGp_getVibration().StartShock(argID, 1, cXyz(0.0f, 1.0f, 0.0f)); + } else if (argID != 0xFF) { + dComIfGp_getVibration().StartQuake(argID - 100, 1, cXyz(0.0f, 1.0f, 0.0f)); + } else { + dComIfGp_getVibration().StopQuake(1); + } + } + } else if (field_0x29c == 9 || field_0x29c == 10) { + dDemo_prm_data* data = demo_actor->getPrm()->getData(); + JStudio::stb::TParseData_fixed<33, TValueIterator_raw > sp7C(data); + if (!sp7C.isEnd() && sp7C.isValid()) { + TValueIterator_raw it = sp7C.begin(); + int r4 = *it; +#if VERSION > VERSION_DEMO + if (field_0x29c != r29 || r4 != field_0x29d) +#endif + { +#if VERSION > VERSION_DEMO + field_0x29d = r4; +#endif + s8 r5 = 0; + if (++it != sp7C.end()) { + r5 = (int)*it; + } + if ((s8)r4 == 0) { + mDoGph_gInf_c::startFadeOut(r5); + } else { + mDoGph_gInf_c::startFadeIn(r5); + } + + JUtility::TColor& fade_color = field_0x29c == 9 ? (JUtility::TColor&)g_blackColor : (JUtility::TColor&)g_saftyWhiteColor; + mDoGph_gInf_c::setFadeColor(fade_color); + } + } + } else { + dDemo_prm_data* data = demo_actor->getPrm()->getData(); + JStudio::stb::TParseData_fixed<51, TValueIterator_misaligned > sp68(data); + if (!sp68.isEnd() && sp68.isValid()) { + int r5 = -1; + for (TValueIterator_misaligned it = sp68.begin(); it != sp68.end(); it++) { + if (r5 < 0) { + r5 = *it; + } else { + if (r5 == 0) { + nextRes.btpID = *it; + } else if (r5 == 1) { + nextRes.btkID = *it; + } else if (r5 == 2) { + nextRes.plightID = *it; + } else if (r5 == 3) { + nextRes.field_0x1C = *it; + } else if (r5 == 4) { + nextRes.brkID = *it; + } else if (r5 == 5) { + nextRes.shadowID = *it; + } else if (r5 == 6) { +#if VERSION == VERSION_DEMO + nextRes.btkID = *it | 0x10000; +#else + nextRes.btkID = *it | 0x10000000; +#endif + } else if (r5 == 7) { +#if VERSION == VERSION_DEMO + nextRes.brkID = *it | 0x10000; +#else + nextRes.brkID = *it | 0x10000000; +#endif + } + r5 = -1; + } + } + } + } + } + + action(demo_actor); + } + return TRUE; } /* 800E78A0-800E78A8 .text daDemo00_IsDelete__FP10daDemo00_c */ @@ -213,7 +431,9 @@ static cPhs_State daDemo00_Create(fopAc_ac_c* i_ac) { dKy_tevstr_init(&i_this->tevStr, dComIfGp_roomControl_getStayNo(), 0xFF); i_this->setAction(&daDemo00_c::actStandby); i_this->nextRes.reset(); +#if VERSION > VERSION_DEMO i_this->field_0x29d = -1; +#endif return cPhs_COMPLEATE_e; } diff --git a/src/d/actor/d_a_movie_player.cpp b/src/d/actor/d_a_movie_player.cpp index 5afd0b7b1..bb368815c 100644 --- a/src/d/actor/d_a_movie_player.cpp +++ b/src/d/actor/d_a_movie_player.cpp @@ -7,6 +7,10 @@ // in other TUs, but not here. #pragma dont_inline on +#ifdef DEBUG +#pragma optimization_level 1 +#endif + #include "d/actor/d_a_movie_player.h" #include "f_op/f_op_actor_mng.h" #include "d/d_procname.h" diff --git a/src/d/actor/d_a_player_dproc.inc b/src/d/actor/d_a_player_dproc.inc index 57d59b2ac..247d50388 100644 --- a/src/d/actor/d_a_player_dproc.inc +++ b/src/d/actor/d_a_player_dproc.inc @@ -177,7 +177,6 @@ BOOL daPy_lk_c::dProcTool_init() { /* 8012D3C4-8012DA3C .text dProcTool__9daPy_lk_cFv */ BOOL daPy_lk_c::dProcTool() { - /* Nonmatching - stack/instruction ordering issues related to JStudio inlines */ dDemo_actor_c* demo_actor = dComIfGp_demo_getActor(demoActorID); daPy_anmHeap_c* anm_heap_under = &m_anm_heap_under[0]; m3574 = 0; @@ -209,19 +208,15 @@ BOOL daPy_lk_c::dProcTool() { #endif ) { JStudio::stb::TParseData_fixed<50, TValueIterator_misaligned > spC4(data); - r29 = *spC4.begin(); + r29 = spC4.front(); JStudio::stb::TParseData_fixed<49, TValueIterator_raw > spB0(spC4.getNext()); if (spB0.size() == 3) { - mLeftHandIdx = *spB0.begin(); - // TValueIterator_raw it(spB0.begin()); - // mRightHandIdx = *++spB0.begin(); - // mRightHandIdx = *spB0.front(); - mRightHandIdx = *TValueIterator_raw(spB0.front()); - // mRightHandIdx = *TValueIterator_raw(spB0.begin() + 1); - f30 = *--spB0.end(); + mLeftHandIdx = spB0.front(); + mRightHandIdx = *(spB0.begin() + 1); + f30 = spB0.back(); } else { - mLeftHandIdx = *spB0.begin(); - mRightHandIdx = *--spB0.end(); + mLeftHandIdx = spB0.front(); + mRightHandIdx = spB0.back(); } if (demo_actor->getPrm()->getId() == 2) { @@ -239,25 +234,17 @@ BOOL daPy_lk_c::dProcTool() { #endif ) { JStudio::stb::TParseData_fixed<50, TValueIterator_misaligned > sp9C(data); - r29 = *sp9C.begin(); - // setDemoTextureAnime(*++sp9C.begin(), *--sp9C.end(), 0, r28); - // setDemoTextureAnime(*(sp9C.begin() + 1), *--sp9C.end(), 0, r28); - // setDemoTextureAnime(*sp9C.front(), *--sp9C.end(), 0, r28); - // setDemoTextureAnime(*(u16*)sp9C.front().get(), *--sp9C.end(), 0, r28); - // TValueIterator_misaligned it1(sp9C.begin()); - // TValueIterator_misaligned it2(sp9C.end()); - // setDemoTextureAnime(*it1, *it2, 0, r28); - setDemoTextureAnime(*TValueIterator_misaligned(sp9C.front()), *--sp9C.end(), 0, r28); + r29 = sp9C.front(); + // setDemoTextureAnime(*(sp9C.begin() + 1), sp9C.back(), 0, r28); // Seems more real, but doesn't match? + setDemoTextureAnime(*(u16*)(sp9C.begin() + 1).get(), sp9C.back(), 0, r28); // Fakematch? JStudio::stb::TParseData_fixed<49, TValueIterator_raw > sp88(sp9C.getNext()); if (sp88.size() == 3) { - mLeftHandIdx = *sp88.begin(); - // mRightHandIdx = *++sp88.begin(); - // mRightHandIdx = *sp88.front(); - mRightHandIdx = *TValueIterator_raw(sp88.front()); - f30 = *--sp88.end(); + mLeftHandIdx = sp88.front(); + mRightHandIdx = *(sp88.begin() + 1); + f30 = sp88.back(); } else { - mLeftHandIdx = *sp88.begin(); - mRightHandIdx = *--sp88.end(); + mLeftHandIdx = sp88.front(); + mRightHandIdx = sp88.back(); } if (demo_actor->getPrm()->getId() == 3) { diff --git a/src/d/actor/d_a_player_tact.inc b/src/d/actor/d_a_player_tact.inc index f154ddb77..063ba4a27 100644 --- a/src/d/actor/d_a_player_tact.inc +++ b/src/d/actor/d_a_player_tact.inc @@ -728,8 +728,10 @@ BOOL daPy_lk_c::procTactPlayEnd() { fopAcM_GetRoomNo(this), getDayNightParamData(), ship->current.pos, - ship->shape_angle.y, - hasShip + ship->shape_angle.y +#if VERSION > VERSION_DEMO + , hasShip +#endif ); if (dComIfG_getTimerMode() == 3 && dComIfG_getTimerPtr() != NULL) { dComIfG_getTimerPtr()->deleteRequest(); diff --git a/src/d/actor/d_a_title.cpp b/src/d/actor/d_a_title.cpp index adca3779a..733c2ec47 100644 --- a/src/d/actor/d_a_title.cpp +++ b/src/d/actor/d_a_title.cpp @@ -508,7 +508,9 @@ BOOL daTitle_c::draw() { BOOL daTitle_c::execute() { if (!fopOvlpM_IsPeek()) { - mDoGph_gInf_c::setFadeColor(*(JUtility::TColor*)&g_blackColor); // Fakematch? +#if VERSION > VERSION_DEMO + mDoGph_gInf_c::setFadeColor((JUtility::TColor&)g_blackColor); +#endif if ((CPad_CHECK_TRIG_A(0) || CPad_CHECK_TRIG_B(0) || CPad_CHECK_TRIG_START(0)) && mpTitleProc->getEnterMode() == 1) { mpTitleProc->setEnterMode(); diff --git a/src/d/d_mesg.cpp b/src/d/d_mesg.cpp index a9a809b41..296cfc7d0 100644 --- a/src/d/d_mesg.cpp +++ b/src/d/d_mesg.cpp @@ -2117,7 +2117,7 @@ void dMesg_closeProc(sub_mesg_class* i_Msg) { i_Msg->field_0x100->destroy(); i_Msg->field_0x100 = NULL; i_Msg->field_0x164 = 0; - dComIfGp_demo_get()->getControl()->referObject_control().suspend(-1); + dComIfGp_demo_get()->getControl()->unsuspend(1); } else { for (int i = 0; i < 18; i++) { if (i_Msg->outfont[i]) { diff --git a/src/d/d_s_play.cpp b/src/d/d_s_play.cpp index 1bfb1ef28..e7c953c76 100644 --- a/src/d/d_s_play.cpp +++ b/src/d/d_s_play.cpp @@ -328,9 +328,9 @@ static BOOL dScnPly_Draw(dScnPly_ply_c* i_this) { ((dComIfGp_getNextStageWipe() == 8 || dComIfGp_getNextStageWipe() == 10) && isNight) || ((dComIfGp_getNextStageWipe() == 9 || dComIfGp_getNextStageWipe() == 11) && !isNight)) { - mDoGph_gInf_c::setFadeColor(*(JUtility::TColor*)&g_saftyWhiteColor); // Fakematch? + mDoGph_gInf_c::setFadeColor((JUtility::TColor&)g_saftyWhiteColor); } else { - mDoGph_gInf_c::setFadeColor(*(JUtility::TColor*)&g_blackColor); // Fakematch? + mDoGph_gInf_c::setFadeColor((JUtility::TColor&)g_blackColor); } mDoAud_setSceneName(dComIfGp_getNextStageName(), dComIfGp_getNextStageRoomNo(), diff --git a/src/d/d_save.cpp b/src/d/d_save.cpp index a9920a23d..0ff54fb08 100644 --- a/src/d/d_save.cpp +++ b/src/d/d_save.cpp @@ -1336,7 +1336,11 @@ void dSv_restart_c::setRestartOption(s8 param_0, cXyz* i_pos, s16 i_angle, s8 i_ /* 8005D5B4-8005D604 .text set__17dSv_turnRestart_cFRC4cXyzsScUlRC4cXyzsi */ void dSv_turnRestart_c::set(const cXyz& i_pos, s16 i_angle, s8 i_roomNo, u32 i_param, - const cXyz& i_shipPos, s16 i_shipAngle, BOOL i_hasShip) { + const cXyz& i_shipPos, s16 i_shipAngle +#if VERSION > VERSION_DEMO + , BOOL i_hasShip +#endif +) { mPosition = i_pos; mAngleY = i_angle; mRoomNo = i_roomNo;