diff options
| author | hatal175 <hatal175@users.noreply.github.com> | 2024-01-03 05:37:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-02 19:37:15 -0800 |
| commit | d5d59471ea885faeb3ca0909e1329082b67a9b90 (patch) | |
| tree | 45a20bec694afc4762cd0f4655dca4506e48b07d /include/JSystem | |
| parent | be10df47608afc4c346e7dba2aac56eca59c45b6 (diff) | |
Match most of d_msg_string_base (#2021)
Diffstat (limited to 'include/JSystem')
| -rw-r--r-- | include/JSystem/J2DGraph/J2DTextBox.h | 3 | ||||
| -rw-r--r-- | include/JSystem/JGadget/linklist.h | 35 | ||||
| -rw-r--r-- | include/JSystem/JMessage/control.h | 13 | ||||
| -rw-r--r-- | include/JSystem/JMessage/processor.h | 4 | ||||
| -rw-r--r-- | include/JSystem/JMessage/resource.h | 14 |
5 files changed, 63 insertions, 6 deletions
diff --git a/include/JSystem/J2DGraph/J2DTextBox.h b/include/JSystem/J2DGraph/J2DTextBox.h index 057809adb9..979c9039c1 100644 --- a/include/JSystem/J2DGraph/J2DTextBox.h +++ b/include/JSystem/J2DGraph/J2DTextBox.h @@ -123,6 +123,9 @@ public: return (J2DTextBoxHBinding)((mFlags >> 2) & 3); } + JUtility::TColor getCharColor() { return mCharColor; } + JUtility::TColor getGradColor() { return mGradientColor; } + // private: /* 0x0100 */ JUTFont* mFont; /* 0x0104 */ JUtility::TColor mCharColor; diff --git a/include/JSystem/JGadget/linklist.h b/include/JSystem/JGadget/linklist.h index 932f0f2705..e7552610d1 100644 --- a/include/JSystem/JGadget/linklist.h +++ b/include/JSystem/JGadget/linklist.h @@ -2,6 +2,7 @@ #define LINKLIST_H #include "dolphin/types.h" +#include "JSystem/JUtility/JUTAssert.h" namespace JGadget { struct TLinkListNode { @@ -24,6 +25,7 @@ struct TNodeLinkList { node = node->getNext(); return *this; } + TLinkListNode* operator->() { return node; } TLinkListNode* node; }; @@ -55,8 +57,13 @@ struct TNodeLinkList { } iterator begin() { - iterator iter(ocObject_.mNext); - return iter; + return iterator(ocObject_.getNext()); + } + + u32 size() { return count; } + bool empty() { return size() == 0; } + iterator pop_front() { + return erase(begin()); } /* 802DCA1C */ ~TNodeLinkList(); @@ -78,6 +85,12 @@ struct TLinkList : public TNodeLinkList { struct iterator : TNodeLinkList::iterator { iterator(TNodeLinkList::iterator iter) : TNodeLinkList::iterator(iter) {} + T& operator*() { return *operator->(); } + T* operator->() { + TLinkListNode* node = TNodeLinkList::iterator::operator->(); + JUT_ASSERT(541, node != 0); + return Element_toValue(node); + } }; struct const_iterator : TNodeLinkList::const_iterator { @@ -86,7 +99,7 @@ struct TLinkList : public TNodeLinkList { const T* operator->() const { return Element_toValue(TNodeLinkList::const_iterator::operator->()); } - const T& operator*() const { return *operator->();} + const T& operator*() const { return *operator->(); } const_iterator& operator++() { TNodeLinkList::const_iterator::operator++(); return *this; @@ -117,9 +130,7 @@ struct TLinkList : public TNodeLinkList { } TLinkList::iterator begin() { - TNodeLinkList::iterator node_iter = TNodeLinkList::begin(); - TLinkList::iterator iter(node_iter); - return iter; + return iterator(TNodeLinkList::begin()); } TLinkList::const_iterator begin() const { @@ -130,6 +141,11 @@ struct TLinkList : public TNodeLinkList { TLinkList::iterator iter(TLinkList::end()); this->Insert(iter, element); } + + T& front() { + JUT_ASSERT(642, !empty()); + return *begin(); + } }; template<typename T, int I> @@ -147,6 +163,13 @@ struct TLinkList_factory : public TLinkList<T, I> { virtual ~TLinkList_factory() {} virtual T* Do_create() = 0; virtual void Do_destroy(T*) = 0; + void Clear_destroy() { + while (!empty()) { + T* item = &front(); + pop_front(); + Do_destroy(item); + } + } }; template <typename T, int I> diff --git a/include/JSystem/JMessage/control.h b/include/JSystem/JMessage/control.h index b94516abe5..36fbebfc47 100644 --- a/include/JSystem/JMessage/control.h +++ b/include/JSystem/JMessage/control.h @@ -39,6 +39,19 @@ struct TControl { const char* getMessageText_begin() const { return pMessageText_begin_; } void* getMessageEntry() const { return pEntry_; } + void setSequenceProcessor(TSequenceProcessor* processor) { pSequenceProcessor_ = processor; } + void setRenderingProcessor(TRenderingProcessor* processor) { pRenderingProcessor_ = processor; } + void resetResourceCache() { + if (pSequenceProcessor_ != NULL) { + pSequenceProcessor_->resetResourceCache(); + } + + if (pRenderingProcessor_ != NULL) { + pRenderingProcessor_->resetResourceCache(); + } + + pResourceCache_ = NULL; + } /* 0x04 */ TSequenceProcessor* pSequenceProcessor_; /* 0x08 */ TRenderingProcessor* pRenderingProcessor_; diff --git a/include/JSystem/JMessage/processor.h b/include/JSystem/JMessage/processor.h index a01572c19c..6cd21e08bc 100644 --- a/include/JSystem/JMessage/processor.h +++ b/include/JSystem/JMessage/processor.h @@ -25,6 +25,7 @@ struct TReference { } TResourceContainer* getResourceContainer() const { return pcResource_; } + void setResourceContainer(TResourceContainer* container) { pcResource_ = container; } /* 0x4 */ TResourceContainer* pcResource_; }; @@ -208,6 +209,9 @@ struct TProcessor { return pReference_->getResourceContainer(); } + void setResourceCache(TResource* cache) { pResourceCache_ = cache; } + void resetResourceCache() { setResourceCache(NULL); } + /* 0x04 */ const TReference* pReference_; /* 0x08 */ const TResource* pResourceCache_; /* 0x0C */ const char* pszCurrent_; diff --git a/include/JSystem/JMessage/resource.h b/include/JSystem/JMessage/resource.h index 61c2bb2fad..66c1e0d002 100644 --- a/include/JSystem/JMessage/resource.h +++ b/include/JSystem/JMessage/resource.h @@ -56,6 +56,10 @@ struct TResource { struct TResource_color { TResource_color() : field_0x0(NULL), field_0x4(NULL) {} + void reset() { + field_0x0.setRaw(NULL); + field_0x4.setRaw(NULL); + } /* 0x0 */ data::TParse_THeader field_0x0; /* 0x4 */ data::TParse_TBlock_color field_0x4; @@ -83,6 +87,16 @@ struct TResourceContainer { bool isEncodingSettable(u8 e) const { return mEncodingType == e || mEncodingType == 0; } const TCResource* getResourceContainer() const { return &resContainer_; } + void destroyResource() { + resContainer_.Clear_destroy(); + } + void destroyResource_color() { + resColor_.reset(); + } + void destroyResource_all() { + destroyResource(); + destroyResource_color(); + } static JMessage::locale::parseCharacter_function sapfnParseCharacter_[5]; |
