mirror of
https://github.com/zeldaret/tp
synced 2026-05-23 15:01:53 -04:00
f8979749e3
* work on fop actor / actor mng, daalink, d_a_obj_item * d_a_title mostly decompiled * daalink / d_event / JMessage / dmsg_out_font work * msg_scrn_base / msg_scrn_boss * some work on mDo machine, d_menu_save, d_tresure, and various * remove asm * progress * finish d_menu_save / d_pane_class_alpha / d_pane_class / rename some data * rename more data * remove asm / progress * match all of d_pane_class * fixes / some dKankyo doc * bunch of j2d work. d_drawlist / d_attention cleanup * progress / asm * cleanup wip * decompile JStage * setup some more JStudio structs * set up d_demo classes * some d_demo work * cleanup dolphin os stuff * some initial dEvent documentation * some At collision documentation * match JUTConsole::doDraw * dbgs work / split up some of d_a_alink into .inc files * d_a_alink_spinner work
59 lines
1.4 KiB
C++
59 lines
1.4 KiB
C++
#ifndef BINARY_H
|
|
#define BINARY_H
|
|
|
|
#include "dolphin/types.h"
|
|
|
|
namespace JGadget {
|
|
namespace binary {
|
|
|
|
struct TEBit {
|
|
u32 value;
|
|
};
|
|
|
|
const void* parseVariableUInt_16_32_following(const void* pu16, u32* pu32First, u32* pu32Second,
|
|
TEBit* tebit);
|
|
|
|
inline u32 align_roundUp(u32 arg0, u32 uAlign) {
|
|
return (arg0 + uAlign - 1) & ~(uAlign - 1);
|
|
}
|
|
|
|
struct TParseData {
|
|
TParseData(const void* pContent) : raw(pContent) {}
|
|
|
|
const void* getRaw() const { return raw; }
|
|
void setRaw(const void* p) { raw = p; }
|
|
|
|
/* 0x0 */ const void* raw;
|
|
};
|
|
|
|
template <int T>
|
|
struct TParseData_aligned : public TParseData {
|
|
TParseData_aligned(const void* pContent) : TParseData(pContent) {}
|
|
void setRaw(const void* p) {
|
|
if ((u32)p % T != 0) {
|
|
JUTWarn w;
|
|
w << "misaligned : " << (u32)p;
|
|
}
|
|
static_cast<TParseData*>(this)->setRaw(p);
|
|
}
|
|
};
|
|
|
|
// Base for header and/or block parsing
|
|
struct TParse_header_block {
|
|
virtual ~TParse_header_block();
|
|
|
|
virtual bool parseHeader_next(const void** ppData_inout, u32* puBlock_out, u32 arg2) = 0;
|
|
virtual bool parseBlock_next(const void** ppData_inout, u32* puData_out, u32 arg2) = 0;
|
|
|
|
bool parse_next(const void** ppData_inout, u32 a2);
|
|
|
|
bool parse(const void* ppData_inout, u32 a2) {
|
|
return parse_next(&ppData_inout, a2);
|
|
}
|
|
};
|
|
|
|
} // namespace binary
|
|
} // namespace JGadget
|
|
|
|
#endif /* BINARY_H */
|