mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-09-03 00:53:47 -04:00
A little work on jstudio (#2045)
This commit is contained in:
@@ -12,6 +12,7 @@ struct TLinkListNode {
|
||||
}
|
||||
|
||||
TLinkListNode* getNext() { return mNext; }
|
||||
TLinkListNode* getPrev() { return mPrev; }
|
||||
|
||||
/* 0x0 */ TLinkListNode* mNext;
|
||||
/* 0x4 */ TLinkListNode* mPrev;
|
||||
@@ -25,8 +26,14 @@ struct TNodeLinkList {
|
||||
node = node->getNext();
|
||||
return *this;
|
||||
}
|
||||
iterator& operator--() {
|
||||
node = node->getPrev();
|
||||
return *this;
|
||||
}
|
||||
TLinkListNode* operator->() { return node; }
|
||||
|
||||
inline friend bool operator==(iterator a, iterator b) { return a.node == b.node; }
|
||||
|
||||
TLinkListNode* node;
|
||||
};
|
||||
|
||||
@@ -91,6 +98,17 @@ struct TLinkList : public TNodeLinkList {
|
||||
JUT_ASSERT(541, node != 0);
|
||||
return Element_toValue(node);
|
||||
}
|
||||
iterator& operator--() {
|
||||
TNodeLinkList::iterator::operator--();
|
||||
return *this;
|
||||
}
|
||||
// Stack issues. See JStudio::ctb::TControl::getObject
|
||||
inline friend bool operator==(iterator a, iterator b) {
|
||||
TNodeLinkList::iterator ita = a;
|
||||
TNodeLinkList::iterator itb = b;
|
||||
return operator==(ita,itb);
|
||||
}
|
||||
inline friend bool operator!=(iterator a, iterator b) { return !(a == b); }
|
||||
};
|
||||
|
||||
struct const_iterator : TNodeLinkList::const_iterator {
|
||||
@@ -110,7 +128,7 @@ struct TLinkList : public TNodeLinkList {
|
||||
};
|
||||
|
||||
TLinkListNode* Element_toNode(T* element) const { return &element->ocObject_; }
|
||||
static T* Element_toValue(TLinkListNode* node) { return (T*)node; }
|
||||
static T* Element_toValue(TLinkListNode* node) { return (T*)((char*)node - offsetof(T, ocObject_)); }
|
||||
|
||||
iterator Insert(TLinkList::iterator iter, T* element) {
|
||||
TLinkListNode* node = Element_toNode(element);
|
||||
@@ -123,9 +141,7 @@ struct TLinkList : public TNodeLinkList {
|
||||
}
|
||||
|
||||
TLinkList::iterator end() {
|
||||
TNodeLinkList::iterator node_iter = TNodeLinkList::end();
|
||||
TLinkList::iterator iter(node_iter);
|
||||
return iter;
|
||||
return iterator(TNodeLinkList::end());
|
||||
}
|
||||
|
||||
TLinkList::const_iterator end() const {
|
||||
@@ -141,7 +157,7 @@ struct TLinkList : public TNodeLinkList {
|
||||
}
|
||||
|
||||
void Push_back(T* element) {
|
||||
TLinkList::iterator iter(TLinkList::end());
|
||||
TLinkList::iterator iter = TLinkList::end();
|
||||
this->Insert(iter, element);
|
||||
}
|
||||
|
||||
@@ -149,6 +165,11 @@ struct TLinkList : public TNodeLinkList {
|
||||
JUT_ASSERT(642, !empty());
|
||||
return *begin();
|
||||
}
|
||||
|
||||
T& back() {
|
||||
JUT_ASSERT(652, !empty());
|
||||
return *--TLinkList::end();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, int I>
|
||||
@@ -161,6 +182,16 @@ bool operator!=(const typename TLinkList<T, I>::const_iterator iter1, const type
|
||||
return !(iter1 == iter2);
|
||||
}
|
||||
|
||||
// template<typename T, int I>
|
||||
// inline bool operator==(typename TLinkList<T, I>::iterator iter1, typename TLinkList<T, I>::iterator iter2) {
|
||||
// return iter1->node == iter2->node;
|
||||
// }
|
||||
|
||||
// template<typename T, int I>
|
||||
// inline bool operator!=(typename TLinkList<T, I>::iterator iter1, typename TLinkList<T, I>::iterator iter2) {
|
||||
// return !(iter1 == iter2);
|
||||
// }
|
||||
|
||||
template <typename T, int I>
|
||||
struct TLinkList_factory : public TLinkList<T, I> {
|
||||
virtual ~TLinkList_factory() {}
|
||||
|
||||
@@ -8,17 +8,102 @@
|
||||
namespace JStudio {
|
||||
namespace ctb {
|
||||
struct TObject : public object::TObject_ID {
|
||||
TObject(const void* id, u32 size, const void* param_2) : object::TObject_ID(id, size) {
|
||||
pData_ = param_2;
|
||||
JUT_ASSERT(82, pData_!=0);
|
||||
}
|
||||
/* 80280F18 */ virtual ~TObject() = 0;
|
||||
|
||||
/* 0x08 vtable */
|
||||
/* 0x0C */ JGadget::TLinkListNode field_0xc;
|
||||
/* 0x14 */ void* pData_;
|
||||
/* 0x0C */ JGadget::TLinkListNode ocObject_;
|
||||
/* 0x14 */ const void* pData_;
|
||||
};
|
||||
|
||||
struct data {
|
||||
struct TParse_TBlock : public JGadget::binary::TParseData_aligned<4> {};
|
||||
struct THeaderData {
|
||||
u32 signature;
|
||||
u16 byteOrder;
|
||||
u16 version;
|
||||
u8 field_0x0[4];
|
||||
u32 blockNumber;
|
||||
u8 content[0];
|
||||
};
|
||||
|
||||
static u32 ga4cSignature;
|
||||
struct TParse_THeader : public JGadget::binary::TParseData_aligned<4> {
|
||||
TParse_THeader(const void* pContent) : JGadget::binary::TParseData_aligned<4>(pContent) {}
|
||||
const THeaderData* get() const {
|
||||
return (THeaderData*) getRaw();
|
||||
}
|
||||
|
||||
const void* get_signature() const {
|
||||
return &get()->signature;
|
||||
}
|
||||
|
||||
u32 get_blockNumber() const {
|
||||
return get()->blockNumber;
|
||||
}
|
||||
|
||||
u16 get_byteOrder() const {
|
||||
return get()->byteOrder;
|
||||
}
|
||||
|
||||
u16 get_version() const {
|
||||
return get()->version;
|
||||
}
|
||||
|
||||
const void* getContent() const {
|
||||
const THeaderData* header = (THeaderData*) getRaw();
|
||||
return header->content;
|
||||
}
|
||||
};
|
||||
|
||||
struct TBlockData {
|
||||
u32 size;
|
||||
u16 scheme;
|
||||
u16 IDSize;
|
||||
u32 field_0x8[0];
|
||||
};
|
||||
|
||||
struct TParse_TBlock : public JGadget::binary::TParseData_aligned<4> {
|
||||
TParse_TBlock(const void* pContent) : JGadget::binary::TParseData_aligned<4>(pContent) {}
|
||||
const TBlockData* get() const {
|
||||
return (const TBlockData*)getRaw();
|
||||
}
|
||||
|
||||
u32 get_size() const {
|
||||
return get()->size;
|
||||
}
|
||||
|
||||
u16 get_scheme() const {
|
||||
return get()->scheme;
|
||||
}
|
||||
|
||||
u16 get_IDSize() const {
|
||||
return get()->IDSize;
|
||||
}
|
||||
|
||||
const void* getBlockEnd_() const {
|
||||
return get()->field_0x8;
|
||||
}
|
||||
|
||||
const void* get_ID() const {
|
||||
const void* rv = NULL;
|
||||
if (get_IDSize() != 0) {
|
||||
rv = getBlockEnd_();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
const void* getContent() const {
|
||||
return (const void*)((char*)getBlockEnd_() + JGadget::binary::align_roundUp((u16)get_IDSize(), 4));
|
||||
}
|
||||
|
||||
const TParse_TBlock* getNext() {
|
||||
return (TParse_TBlock*)((char*)getRaw() + get_size());
|
||||
}
|
||||
};
|
||||
|
||||
static const u32 ga4cSignature;
|
||||
};
|
||||
|
||||
struct TObject_TxyzRy : public TObject {
|
||||
@@ -32,7 +117,7 @@ struct TFactory {
|
||||
TFactory() {}
|
||||
|
||||
/* 80281274 */ virtual ~TFactory();
|
||||
/* 802812BC */ virtual void create(JStudio::ctb::data::TParse_TBlock const&);
|
||||
/* 802812BC */ virtual TObject* create(JStudio::ctb::data::TParse_TBlock const&);
|
||||
/* 80281320 */ virtual void destroy(JStudio::ctb::TObject*);
|
||||
};
|
||||
|
||||
@@ -43,8 +128,10 @@ struct TControl {
|
||||
/* 802810AC */ void removeObject(JStudio::ctb::TObject*);
|
||||
/* 802810DC */ void destroyObject(JStudio::ctb::TObject*);
|
||||
/* 8028112C */ void destroyObject_all();
|
||||
/* 80281190 */ void getObject(void const*, u32);
|
||||
/* 80281230 */ void getObject_index(u32);
|
||||
/* 80281190 */ JStudio::ctb::TObject* getObject(void const*, u32);
|
||||
/* 80281230 */ JStudio::ctb::TObject* getObject_index(u32);
|
||||
|
||||
TFactory* getFactory() { return pFactory_; }
|
||||
|
||||
/* 0x4 */ TFactory* pFactory_;
|
||||
/* 0x8 */ JGadget::TLinkList<TObject, 2> mList;
|
||||
@@ -53,8 +140,10 @@ struct TControl {
|
||||
struct TParse : public JGadget::binary::TParse_header_block {
|
||||
/* 8028135C */ TParse(JStudio::ctb::TControl*);
|
||||
/* 8028137C */ virtual ~TParse();
|
||||
/* 802813DC */ virtual void parseHeader_next(void const**, u32*, u32);
|
||||
/* 80281470 */ virtual void parseBlock_next(void const**, u32*, u32);
|
||||
/* 802813DC */ virtual bool parseHeader_next(void const**, u32*, u32);
|
||||
/* 80281470 */ virtual bool parseBlock_next(void const**, u32*, u32);
|
||||
|
||||
TControl* getControl() { return pControl_; }
|
||||
|
||||
/* 0x4 */ TControl* pControl_;
|
||||
};
|
||||
|
||||
@@ -6,19 +6,24 @@
|
||||
namespace JStudio {
|
||||
namespace object {
|
||||
|
||||
struct TPRObject_ID_equal {};
|
||||
|
||||
struct TIDData {
|
||||
public:
|
||||
TIDData(const void* id, u32 id_size) : mID(id), mID_size(id_size) {}
|
||||
|
||||
/* 80288988 */ void isEqual(JStudio::object::TIDData const&, JStudio::object::TIDData const&);
|
||||
/* 80288988 */ bool isEqual(JStudio::object::TIDData const&, JStudio::object::TIDData const&);
|
||||
inline const void* getID() const { return mID; }
|
||||
inline u32 getIDSize() const { return mID_size; }
|
||||
|
||||
private:
|
||||
/* 0x00 */ const void* mID;
|
||||
/* 0x04 */ u32 mID_size;
|
||||
};
|
||||
|
||||
struct TPRObject_ID_equal : public TIDData {
|
||||
TPRObject_ID_equal(const void* id, u32 id_size) : TIDData(id, id_size) {}
|
||||
};
|
||||
|
||||
struct TObject_ID : public TIDData {
|
||||
TObject_ID(const void* id, u32 id_size) : TIDData(id, id_size) {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user