diff --git a/configure.py b/configure.py index 6c0dc034c..07088809b 100644 --- a/configure.py +++ b/configure.py @@ -727,7 +727,7 @@ config.libs = [ "JMessage", [ Object(Matching, "JSystem/JMessage/data.cpp"), - Object(NonMatching, "JSystem/JMessage/control.cpp"), + Object(Matching, "JSystem/JMessage/control.cpp"), Object(NonMatching, "JSystem/JMessage/processor.cpp"), Object(NonMatching, "JSystem/JMessage/resource.cpp"), ], diff --git a/include/JSystem/JMessage/control.h b/include/JSystem/JMessage/control.h index 9423b0d71..4ce365731 100644 --- a/include/JSystem/JMessage/control.h +++ b/include/JSystem/JMessage/control.h @@ -52,6 +52,17 @@ struct TControl { const char* getMessageData(u16, u16) const; void reset_(); + void getMessageCode() const {} + void getMessageData(u32) const {} + void getMessageEntry(u32) const {} + void getMessageEntry(u16, u16) const {} + void getMessageGroupID() const {} + void getMessageIndex() const {} + void on_isLeadByte(int) {} + void on_word(u32) {} + void setMessageIndex(u16) {} + void setResourceContainer(const JMessage::TResourceContainer*) {} + /* 0x04 */ TResourceContainer* mResourceContainer; /* 0x08 */ mutable TResource* mResource; /* 0x0C */ TSequenceProcessor* mBaseProcSeq; @@ -62,8 +73,7 @@ struct TControl { /* 0x1C */ const char* mMessageDataStart; /* 0x20 */ const char* mMessageDataCurrent; /* 0x24 */ const char* mCurrentText; - /* 0x28 */ void* field_0x28; - /* 0x2C */ TProcessor::TStack_ mRenderStack; + /* 0x28 */ TProcessor::TStack_ mRenderStack; }; }; // namespace JMessage diff --git a/include/JSystem/JMessage/processor.h b/include/JSystem/JMessage/processor.h index 78ae93b75..39d7ab1a5 100644 --- a/include/JSystem/JMessage/processor.h +++ b/include/JSystem/JMessage/processor.h @@ -37,8 +37,8 @@ public: inline const char* top() const { return mStack[mNum - 2]; } inline bool empty() const { return mNum == 0; } - /* 0x00 */ const char* mStack[3]; - /* 0x0C */ u32 mNum; + /* 0x00 */ const char* mStack[4]; + /* 0x10 */ u32 mNum; }; // XXX: None of this shows up in the debug map. Is this TStatusData? @@ -94,7 +94,6 @@ public: /* 0x00 */ /* vtable */ /* 0x04 */ TControl* mControl; /* 0x08 */ const char* mCurrent; - /* 0x0C */ void* field_0x0C; /* 0x0C */ TStack_ mStack; /* 0x20 */ TProcess mProcess; }; diff --git a/include/JSystem/JMessage/resource.h b/include/JSystem/JMessage/resource.h index 78711ebfa..283a22b24 100644 --- a/include/JSystem/JMessage/resource.h +++ b/include/JSystem/JMessage/resource.h @@ -57,8 +57,11 @@ namespace JMessage { void SetEncoding(u8); bool IsEncodingSettable(u8 encoding) const { - return mEncoding == encoding || encoding == 0; + return mEncoding == encoding || mEncoding == 0; } + bool IsLeadByte(int param_0) const { return mIsLeadByteFunc(param_0); } + + void Get_groupID(u16) const {} private: void SetEncoding_(u8); diff --git a/src/JSystem/JMessage/control.cpp b/src/JSystem/JMessage/control.cpp index 5c54d6191..3d6fa4d71 100644 --- a/src/JSystem/JMessage/control.cpp +++ b/src/JSystem/JMessage/control.cpp @@ -19,7 +19,6 @@ JMessage::TControl::TControl() , mMessageDataCurrent(NULL) , mCurrentText(NULL) { - /* Nonmatching */ } /* 8029E970-8029E9B8 .text __dt__Q28JMessage8TControlFv */ @@ -84,13 +83,11 @@ bool JMessage::TControl::update() { /* 8029EC00-8029ECCC .text render__Q28JMessage8TControlFv */ void JMessage::TControl::render() { - /* Nonmatching */ if (!isReady_render_()) { return; } mBaseProcRender->setBegin(mMessageEntry, mMessageDataCurrent); - // mBaseProcRender->field_0x0C = field_0x28; mBaseProcRender->mStack = mRenderStack; mBaseProcRender->process(mCurrentText); } @@ -102,7 +99,6 @@ const char* JMessage::TControl::do_word(u32) { /* 8029ECD4-8029ED88 .text setMessageCode_flush___Q28JMessage8TControlFv */ bool JMessage::TControl::setMessageCode_flush_() { - /* Nonmatching */ reset_(); u16 messageIndex = mMessageIndex; TResource* resource = getResource_groupID(mGroupID); @@ -111,7 +107,7 @@ bool JMessage::TControl::setMessageCode_flush_() { if (mMessageEntry == NULL) return false; - u32 offs = *(u32*)messageEntry; + u32 offs = *(u32*)mMessageEntry; mMessageDataStart = mResource->mMessageData + offs; mMessageDataCurrent = mMessageDataStart; return true; diff --git a/src/JSystem/JMessage/processor.cpp b/src/JSystem/JMessage/processor.cpp index cf2c40812..c2b604b66 100644 --- a/src/JSystem/JMessage/processor.cpp +++ b/src/JSystem/JMessage/processor.cpp @@ -32,9 +32,7 @@ bool process_setMessage_index_(TControl* control, u16 index) { /* 8029EE18-8029EE6C .text process_setMessage_code___Q28JMessage23@unnamed@processor_cpp@FPQ28JMessage8TControlUl */ bool process_setMessage_code_(TControl* control, u32 code) { - /* Nonmatching */ - u16 messageIndex = code & 0xFFFF; - if (messageIndex >= 0xFF00) { + if ((u16)code >= 0xFF00) { return process_setMessageIndex_reserved_(code); } else { return !!control->setMessageCode(code); @@ -144,7 +142,7 @@ void TProcessor::on_tag_() { size = current[1]; mCurrent = (const char*)current + size; - u32 tag = (current[2] << 16 | current[3] << 8); + u32 tag = (current[2] << 16 | (u8)current[3] << 8); tag |= current[4]; if (!do_tag(tag, ¤t[5], size - 5)) { @@ -189,8 +187,8 @@ void TProcessor::do_systemTagCode_(u16 code, const void* data, u32 size) { /* 8029F2A0-8029F37C .text process_character___Q28JMessage10TProcessorFv */ bool TProcessor::process_character_() { - /* Nonmatching */ - const char * current = getCurrent(); + const u8* current = (const u8*)getCurrent(); + u32 r31 = current[0]; switch (current[0]) { case 0: if (!mProcess.mCallBack(this)) @@ -200,7 +198,14 @@ bool TProcessor::process_character_() { on_tag_(); break; default: - // mControl->do_word(current[0]); + if (mControl->mResourceContainer->IsLeadByte(r31)) { + r31 <<= 8; + mCurrent++; + current = (const u8*)getCurrent(); + r31 |= current[0]; + } + mCurrent++; + do_character(r31); break; } return true;