mirror of
https://github.com/zeldaret/tp
synced 2026-06-08 12:27:18 -04:00
getDemoIDData matched, fix up various inlines and template classes (#2489)
* Fix debug build * getDemoIDData matched, fix up various inlines and template classes * Remove nonmatching comments
This commit is contained in:
@@ -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 <int T>
|
||||
template <int S>
|
||||
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,41 +64,56 @@ struct TParse_header_block {
|
||||
template <typename T>
|
||||
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 <typename T>
|
||||
struct TParseValue_raw : public TParseValue_raw_<T> {
|
||||
typedef TParseValue_raw_<T> InnerParseValueClass;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct TParseValue_endian_big_ : public TParseValue_raw_<T> {
|
||||
static T parse(const void* data) { return TParseValue_raw_::parse(data); }
|
||||
static T parse(const void* data) { return TParseValue_raw_<T>::parse(data); }
|
||||
};
|
||||
|
||||
template <typename T, template <class> class Parser>
|
||||
struct TParseValue : public Parser<T> {
|
||||
static T parse(const void* data) { return Parser<T>::parse(data); }
|
||||
template <class Parser>
|
||||
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<T>::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<class Parser, int size>
|
||||
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<const char*>(begin);
|
||||
}
|
||||
|
||||
const void* get() const { return mBegin; }
|
||||
|
||||
typename Parser::ParseType operator*() const {
|
||||
return Parser::parse(get());
|
||||
return TParseValue<typename Parser::InnerParseValueClass>::parse(get());
|
||||
}
|
||||
|
||||
TValueIterator& operator++() {
|
||||
const_cast<u32*>(mBegin)++;
|
||||
mBegin += size;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -107,32 +123,68 @@ struct TValueIterator {
|
||||
return old;
|
||||
}
|
||||
|
||||
TValueIterator& operator+=(s32 v) {
|
||||
const_cast<u32*>(mBegin) += v;
|
||||
TValueIterator& operator+=(s32 n) {
|
||||
mBegin += size * n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const void* mBegin;
|
||||
TValueIterator& operator--() {
|
||||
mBegin -= size;
|
||||
return *this;
|
||||
}
|
||||
|
||||
char const* mBegin;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct TValueIterator_raw : public TValueIterator<TParseValue_raw_<u8>, 1> {
|
||||
TValueIterator_raw(const void* begin) : TValueIterator<TParseValue_raw_<u8>, 1>(begin) {}
|
||||
struct TValueIterator_raw : public TValueIterator<TParseValue_raw<T>, sizeof(T)> {
|
||||
TValueIterator_raw(const void* begin) : TValueIterator<TParseValue_raw<T>, sizeof(T)>(begin) {}
|
||||
|
||||
friend bool operator==(TValueIterator<TParseValue_raw<T>, sizeof(T)> a, TValueIterator<TParseValue_raw<T>, sizeof(T)> b) {
|
||||
return a.mBegin == b.mBegin;
|
||||
}
|
||||
|
||||
friend bool operator!=(TValueIterator<TParseValue_raw<T>, sizeof(T)> a, TValueIterator<TParseValue_raw<T>, sizeof(T)> b) {
|
||||
return !operator==(a, b);
|
||||
}
|
||||
|
||||
friend TValueIterator<TParseValue_raw<T>, sizeof(T)> operator+(TValueIterator<TParseValue_raw<T>, sizeof(T)> a, s32 b) {
|
||||
TValueIterator<TParseValue_raw<T>, sizeof(T)> it = a;
|
||||
it += b;
|
||||
return it;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct TParseValue_misaligned : TParseValue_raw_<T> {
|
||||
static T parse(const void* data) { return TParseValue_raw_::parse(data); }
|
||||
struct TParseValue_misaligned_ : public TParseValue_raw_<T> {
|
||||
typedef T ParseType;
|
||||
static T parse(const void* data) { return TParseValue_raw_<T>::parse(data); }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct TParseValue_misaligned : public TParseValue_raw_<T> {
|
||||
typedef TParseValue_misaligned_<T> InnerParseValueClass;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct TValueIterator_misaligned : public TValueIterator<TParseValue_misaligned<T>, sizeof(T)> {
|
||||
TValueIterator_misaligned(const void* begin) : TValueIterator<TParseValue_misaligned<T>, sizeof(T)>(begin) {}
|
||||
|
||||
friend bool operator==(TValueIterator<TParseValue_misaligned<T>, sizeof(T)> a, TValueIterator<TParseValue_misaligned<T>, sizeof(T)> b) {
|
||||
return a.mBegin == b.mBegin;
|
||||
}
|
||||
|
||||
friend bool operator!=(TValueIterator<TParseValue_misaligned<T>, sizeof(T)> a, TValueIterator<TParseValue_misaligned<T>, sizeof(T)> b) {
|
||||
return !operator==(a, b);
|
||||
}
|
||||
|
||||
friend TValueIterator<TParseValue_misaligned<T>, sizeof(T)> operator+(TValueIterator<TParseValue_misaligned<T>, sizeof(T)> a, s32 b) {
|
||||
TValueIterator<TParseValue_misaligned<T>, sizeof(T)> it(a);
|
||||
it += b;
|
||||
return it;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
inline bool operator==(TValueIterator<TParseValue_misaligned<u32>, 4> a, TValueIterator<TParseValue_misaligned<u32>, 4> b) { return a.mBegin == b.mBegin; }
|
||||
|
||||
} // namespace binary
|
||||
} // namespace JGadget
|
||||
|
||||
|
||||
@@ -28,7 +28,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(const TPRObject_ID_equal& other) : TIDData(other.mID, other.mID_size) {}
|
||||
~TPRObject_ID_equal() {}
|
||||
bool operator()(TObject_ID const& id) const { return TIDData::isEqual(id.getIDData(), *this); }
|
||||
};
|
||||
|
||||
|
||||
@@ -65,16 +65,16 @@ public:
|
||||
/* 80289A08 */ void getData(TData*) const;
|
||||
};
|
||||
|
||||
struct TParse_TParagraph_data : public TParseData_aligned<4> {
|
||||
struct TParse_TParagraph_data : public TParseData {
|
||||
struct TData {
|
||||
/* 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_aligned<4>(content) {}
|
||||
TParse_TParagraph_data(const void* content) : TParseData(content) {}
|
||||
/* 80289A80 */ void getData(TData* pData) const;
|
||||
};
|
||||
|
||||
@@ -90,7 +90,6 @@ public:
|
||||
|
||||
u16 get_flag() const { return get()->flag; }
|
||||
u16 get_IDSize() const { return get()->id_size; }
|
||||
u32 get_type() const { return get()->type; }
|
||||
const void* get_ID() const { return get()->id; }
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "dolphin/os.h"
|
||||
|
||||
namespace JStudio {
|
||||
struct TObject;
|
||||
class TObject;
|
||||
namespace stb {
|
||||
|
||||
class TControl;
|
||||
@@ -156,11 +156,10 @@ private:
|
||||
/* 0x54 */ s32 _54;
|
||||
};
|
||||
|
||||
template <int T>
|
||||
template <int S>
|
||||
struct TParseData : public data::TParse_TParagraph_data::TData {
|
||||
TParseData(const void* pContent) {
|
||||
data::TParse_TParagraph_data data(pContent);
|
||||
set(data);
|
||||
set(data::TParse_TParagraph_data(pContent));
|
||||
}
|
||||
|
||||
TParseData() {
|
||||
@@ -171,45 +170,57 @@ struct TParseData : public data::TParse_TParagraph_data::TData {
|
||||
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 == 50;
|
||||
return !empty() && status == S;
|
||||
}
|
||||
|
||||
const void* getContent() const { return fileCount; }
|
||||
const void* getContent() const { return content; }
|
||||
|
||||
u32 size() const { return dataSize; }
|
||||
u32 size() const { return entryCount; }
|
||||
};
|
||||
|
||||
template <int T, class Iterator=JGadget::binary::TValueIterator_raw<u8> >
|
||||
struct TParseData_fixed : public TParseData<T> {
|
||||
TParseData_fixed(const void* pContent) : TParseData<T>(pContent) {}
|
||||
TParseData_fixed() : TParseData<T>() {}
|
||||
template <int S, class Iterator=JGadget::binary::TValueIterator_raw<u8> >
|
||||
struct TParseData_fixed : public TParseData<S> {
|
||||
TParseData_fixed(const void* pContent) : TParseData<S>(pContent) {}
|
||||
TParseData_fixed() : TParseData<S>() {}
|
||||
|
||||
const void* getNext() const {
|
||||
return _10;
|
||||
return this->next;
|
||||
}
|
||||
|
||||
bool isValid() const {
|
||||
return TParseData::isValid() && getNext() != NULL;
|
||||
return TParseData<S>::isValid() && getNext() != NULL;
|
||||
}
|
||||
|
||||
Iterator begin() const {
|
||||
return Iterator(fileCount);
|
||||
return Iterator(this->content);
|
||||
}
|
||||
|
||||
Iterator end() const {
|
||||
Iterator i(fileCount);
|
||||
i += size();
|
||||
Iterator i(this->content);
|
||||
i += this->size();
|
||||
return i;
|
||||
}
|
||||
|
||||
typename Iterator::ValueType front() const {
|
||||
return *begin();
|
||||
}
|
||||
|
||||
typename Iterator::ValueType back() const {
|
||||
return *--end();
|
||||
}
|
||||
};
|
||||
|
||||
struct TParseData_string : public TParseData<0x60> {
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
/* 802E56DC */ 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 field_0x8;
|
||||
|
||||
@@ -28,7 +28,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
|
||||
|
||||
|
||||
@@ -86,6 +86,10 @@ public:
|
||||
typedef int (daObj_GrA_c::*MotionFunc)(int);
|
||||
typedef int (daObj_GrA_c::*Process)(void*);
|
||||
|
||||
enum {
|
||||
NUMLOOKMODES_e = 4,
|
||||
};
|
||||
|
||||
class daObj_GrA_prtclMngr_c {
|
||||
public:
|
||||
/* 80C04E14 */ ~daObj_GrA_prtclMngr_c() {}
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
/* 0x212 */ u16 field_0x212;
|
||||
/* 0x214 */ u16 field_0x214;
|
||||
/* 0x218 */ u32 field_0x218;
|
||||
/* 0x21C */ void* buffer;
|
||||
/* 0x21C */ void* dummyGameAlloc;
|
||||
/* 0x220 */ mDoDvdThd_mountXArchive_c* mpField0Command;
|
||||
/* 0x224 */ mDoDvdThd_mountXArchive_c* mpAlAnmCommand;
|
||||
/* 0x228 */ u8 field_0x228[4];
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
#include "JSystem/JFramework/JFWDisplay.h"
|
||||
#include "dolphin/mtx.h"
|
||||
|
||||
class JUTFader;
|
||||
|
||||
int mDoGph_Create();
|
||||
void mDoGph_drawFilterQuad(s8 param_0, s8 param_1);
|
||||
|
||||
@@ -61,7 +59,7 @@ public:
|
||||
|
||||
static int startFadeOut(int param_0) { return JFWDisplay::getManager()->startFadeOut(param_0); }
|
||||
static int startFadeIn(int param_0) { return JFWDisplay::getManager()->startFadeIn(param_0); }
|
||||
static void setFadeColor(JUtility::TColor color) { mFader->mColor.set(color); }
|
||||
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(); }
|
||||
|
||||
Reference in New Issue
Block a user