mirror of
https://github.com/zeldaret/tp
synced 2026-07-07 14:13:27 -04:00
JMessage work (#1951)
This commit is contained in:
@@ -31,6 +31,12 @@ struct TNodeLinkList {
|
||||
struct const_iterator {
|
||||
const_iterator(TLinkListNode* pNode) { node = pNode; }
|
||||
const_iterator(const const_iterator& iter) { *this = iter; }
|
||||
const_iterator(iterator iter) { *this = iter; }
|
||||
TLinkListNode* operator->() const { return node; }
|
||||
const_iterator& operator++() {
|
||||
node = node->getNext();
|
||||
return *this;
|
||||
}
|
||||
|
||||
TLinkListNode* node;
|
||||
};
|
||||
@@ -74,11 +80,25 @@ struct TLinkList : public TNodeLinkList {
|
||||
iterator(TNodeLinkList::iterator iter) : TNodeLinkList::iterator(iter) {}
|
||||
};
|
||||
|
||||
TLinkListNode* Element_toNode(T* element) const { return &element->ocObject_; }
|
||||
struct const_iterator : TNodeLinkList::const_iterator {
|
||||
const_iterator(TNodeLinkList::const_iterator iter) : TNodeLinkList::const_iterator(iter) {}
|
||||
const_iterator(iterator iter) : TNodeLinkList::const_iterator(iter) {}
|
||||
const T* operator->() const {
|
||||
return Element_toValue(TNodeLinkList::const_iterator::operator->());
|
||||
}
|
||||
const T& operator*() const { return *operator->();}
|
||||
const_iterator& operator++() {
|
||||
TNodeLinkList::const_iterator::operator++();
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
void Insert(TLinkList::iterator iter, T* element) {
|
||||
TLinkListNode* Element_toNode(T* element) const { return &element->ocObject_; }
|
||||
static T* Element_toValue(TLinkListNode* node) { return (T*)node; }
|
||||
|
||||
iterator Insert(TLinkList::iterator iter, T* element) {
|
||||
TLinkListNode* node = Element_toNode(element);
|
||||
TNodeLinkList::Insert(iter, node);
|
||||
return TNodeLinkList::Insert(iter, node);
|
||||
}
|
||||
|
||||
iterator Erase(T* element) {
|
||||
@@ -92,18 +112,36 @@ struct TLinkList : public TNodeLinkList {
|
||||
return iter;
|
||||
}
|
||||
|
||||
TLinkList::const_iterator end() const {
|
||||
return TLinkList::const_iterator(((TLinkList*)this)->end());
|
||||
}
|
||||
|
||||
TLinkList::iterator begin() {
|
||||
TNodeLinkList::iterator node_iter = TNodeLinkList::begin();
|
||||
TLinkList::iterator iter(node_iter);
|
||||
return iter;
|
||||
}
|
||||
|
||||
TLinkList::const_iterator begin() const {
|
||||
return TLinkList::const_iterator(((TLinkList*)this)->begin());
|
||||
}
|
||||
|
||||
void Push_back(T* element) {
|
||||
TLinkList::iterator iter(TLinkList::end());
|
||||
this->Insert(iter, element);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, int I>
|
||||
bool operator==(const typename TLinkList<T, I>::const_iterator iter1, const typename TLinkList<T, I>::const_iterator iter2) {
|
||||
return iter1->node == iter2->node;
|
||||
}
|
||||
|
||||
template<typename T, int I>
|
||||
bool operator!=(const typename TLinkList<T, I>::const_iterator iter1, const typename TLinkList<T, I>::const_iterator iter2) {
|
||||
return !(iter1 == iter2);
|
||||
}
|
||||
|
||||
template <typename T, int I>
|
||||
struct TLinkList_factory : public TLinkList<T, I> {
|
||||
virtual ~TLinkList_factory() {}
|
||||
@@ -113,12 +151,27 @@ struct TLinkList_factory : public TLinkList<T, I> {
|
||||
|
||||
template <typename T, int I>
|
||||
struct TEnumerator {
|
||||
TLinkList<T, I> field_0x0;
|
||||
TLinkList<T, I> field_0x4;
|
||||
inline TEnumerator(typename TLinkList<T,I>::const_iterator _current, typename TLinkList<T,I>::const_iterator _end) :
|
||||
current(_current), end(_end)
|
||||
{}
|
||||
|
||||
bool isEnd() const { return current.node == end.node; }
|
||||
operator bool() const { return isEnd(); }
|
||||
T& operator*() {
|
||||
T& rv = (T&)*current;
|
||||
++current;
|
||||
return rv;
|
||||
}
|
||||
|
||||
TLinkList<T, I>::const_iterator current;
|
||||
TLinkList<T, I>::const_iterator end;
|
||||
};
|
||||
|
||||
template <typename T, int I>
|
||||
struct TContainerEnumerator_const : public TEnumerator<T, I> {};
|
||||
struct TContainerEnumerator_const : public TEnumerator<T, I> {
|
||||
inline TContainerEnumerator_const(const T* param_0) : TEnumerator<T,I>(param_0->begin(), param_0->end())
|
||||
{}
|
||||
};
|
||||
|
||||
}; // namespace JGadget
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ struct data {
|
||||
TParse_TBlock_color(const void* data) : TParse_TBlock(data) {}
|
||||
};
|
||||
|
||||
static u16 getTagCode(u32 tag) { return tag & 0xFFFF; }
|
||||
static u8 getTagGroup(u32 tag) { return (tag >> 0x10) & 0xFF; }
|
||||
static u32 getTagCode(u32 tag) { return tag & 0xFFFF; }
|
||||
static u32 getTagGroup(u32 tag) { return (tag >> 0x10) & 0xFF; }
|
||||
|
||||
static u32 ga4cSignature;
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ struct TReference {
|
||||
return pcResource_->getResource_groupID(groupID);
|
||||
}
|
||||
|
||||
TResourceContainer* getResourceContainer() const { return pcResource_; }
|
||||
|
||||
/* 0x4 */ TResourceContainer* pcResource_;
|
||||
};
|
||||
|
||||
@@ -192,6 +194,14 @@ struct TProcessor {
|
||||
return pResourceCache_ != NULL && groupID == pResourceCache_->getGroupID();
|
||||
}
|
||||
|
||||
TResourceContainer* getResourceContainer() const {
|
||||
if (pReference_ == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pReference_->getResourceContainer();
|
||||
}
|
||||
|
||||
/* 0x04 */ const TReference* pReference_;
|
||||
/* 0x08 */ const TResource* pResourceCache_;
|
||||
/* 0x0C */ const char* pszCurrent_;
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
#include "JSystem/JStudio/JStudio/fvb-data.h"
|
||||
|
||||
namespace JMessage {
|
||||
struct TResource : public JGadget::TLinkListNode {
|
||||
struct TResource {
|
||||
TResource()
|
||||
: field_0x8(NULL), field_0xc(NULL), field_0x10(NULL), field_0x14(0), field_0x18(NULL) {}
|
||||
|
||||
/* 802A8CDC */ void toMessageIndex_messageID(u32, u32, bool*) const;
|
||||
/* 802A8CDC */ u16 toMessageIndex_messageID(u32, u32, bool*) const;
|
||||
|
||||
bool isContained_messageIndex(u16 messageIndex) const {
|
||||
return messageIndex < getMessageEntryNumber();
|
||||
@@ -46,7 +46,7 @@ struct TResource : public JGadget::TLinkListNode {
|
||||
void setData_header(const void* pData) {
|
||||
field_0x8.setRaw(pData);
|
||||
}
|
||||
|
||||
JGadget::TLinkListNode ocObject_;
|
||||
/* 0x08 */ data::TParse_THeader field_0x8;
|
||||
/* 0x0C */ data::TParse_TBlock_info field_0xc;
|
||||
/* 0x10 */ char* field_0x10;
|
||||
@@ -81,7 +81,8 @@ struct TResourceContainer {
|
||||
TResource* getResource_groupID(u16 groupID) { return resContainer_.Get_groupID(groupID); }
|
||||
TResource* getResource_groupID(u16 groupID) const { return getResource_groupID(groupID); }
|
||||
|
||||
bool isEncodingSettable(u8 e) const { return mEncodingType == e || e == 0; }
|
||||
bool isEncodingSettable(u8 e) const { return mEncodingType == e || mEncodingType == 0; }
|
||||
const TCResource* getResourceContainer() const { return &resContainer_; }
|
||||
|
||||
static JMessage::locale::parseCharacter_function sapfnParseCharacter_[5];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user