Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
**/JSystem/**
# Ignore SND Files - Copied from https://github.com/muff1n1634/nw4r_snd_mid2010, https://github.com/kiwi515/ogws
**/nw4r/snd/**
# Ignore Some PPEABI Files
**/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/**
5 changes: 3 additions & 2 deletions config/SOUE01/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5358,15 +5358,16 @@ JSystem/JStudio/JStudio_JStage/object-message.cpp:
.text start:0x804C3870 end:0x804C39D4 align:16
.data start:0x80570378 end:0x805703A0

toBeSorted/JSystem/unk_jstage_maybe.cpp:
JSystem/JStage/unk_jstage_maybe.cpp:
.text start:0x804C39E0 end:0x804C3FC8 align:16
.rodata start:0x804FBF98 end:0x804FBFA8
.data start:0x805703A0 end:0x805703B8
.sdata2 start:0x8057F9A0 end:0x8057F9B8
.sdata2 start:0x8057F9A0 end:0x8057F9A8

JSystem/JStudio/JStudio_JParticle/control.cpp:
.text start:0x804C3FD0 end:0x804C42CC align:16
.data start:0x805703B8 end:0x805703D0
.sdata2 start:0x8057F9A8 end:0x8057F9B8

JSystem/JStudio/JStudio_JParticle/object-particle.cpp:
.text start:0x804C42D0 end:0x804C53DC align:16
Expand Down
4 changes: 2 additions & 2 deletions config/SOUE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26875,7 +26875,7 @@ Insert__Q27JGadget13TNodeLinkListFQ37JGadget13TNodeLinkList8iteratorPQ27JGadget1
Erase__Q27JGadget13TNodeLinkListFPQ27JGadget13TLinkListNode = .text:0x804B7D80; // type:function size:0x24
extend_default__Q27JGadget6vectorFUlUlUl = .text:0x804B7DB0; // type:function size:0x8
__ct__Q27JGadget20TVector_pointer_voidFRCQ27JGadget14TAllocator<Pv> = .text:0x804B7DC0; // type:function size:0x20
fn_804B7DE0 = .text:0x804B7DE0; // type:function size:0x584
__ct__Q27JGadget20TVector_pointer_voidFUlRCPvRCQ27JGadget14TAllocator<Pv> = .text:0x804B7DE0; // type:function size:0x584
__dt__Q27JGadget20TVector_pointer_voidFv = .text:0x804B8370; // type:function size:0xB4
insert__Q27JGadget20TVector_pointer_voidFPPvRCPv = .text:0x804B8430; // type:function size:0x594
erase__Q27JGadget20TVector_pointer_voidFPPvPPv = .text:0x804B89D0; // type:function size:0x88
Expand Down Expand Up @@ -27040,7 +27040,7 @@ parseBlock_block_ctb___Q27JStudio6TParseFRCQ47JStudio3stb4data13TParse_TBlockUl
getRotation_xyz__Q27JStudio4mathFPA4_ffff = .text:0x804BD110; // type:function size:0x16C
getTransformation_SRxyzT__Q27JStudio4mathFPA4_fRC3VecRC3VecRC3Vec = .text:0x804BD280; // type:function size:0x90
getFromTransformation_SRxyzT__Q27JStudio4mathFP3VecP3VecP3VecPA4_Cf = .text:0x804BD310; // type:function size:0x2CC
__sinit_\jstudio_math_cpp = .text:0x804BD5E0; // type:function size:0xC scope:local
__sinit_\jstudio-math_cpp = .text:0x804BD5E0; // type:function size:0xC scope:local
__dt__Q37JStudio14TVariableValue7TOutputFv = .text:0x804BD5F0; // type:function size:0x40
update__Q27JStudio14TVariableValueFdPQ27JStudio8TAdaptor = .text:0x804BD630; // type:function size:0x64
update_immediate___Q27JStudio14TVariableValueFPQ27JStudio14TVariableValued = .text:0x804BD6A0; // type:function size:0x14
Expand Down
30 changes: 17 additions & 13 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1355,28 +1355,28 @@ def MatchingFor(*versions):
JSystemLib(
"JGadget",
[
Object(NonMatching, "JSystem/JGadget/binary.cpp"),
Object(NonMatching, "JSystem/JGadget/linklist.cpp"),
Object(Matching, "JSystem/JGadget/binary.cpp"),
Object(Matching, "JSystem/JGadget/linklist.cpp"),
Object(NonMatching, "JSystem/JGadget/std-vector.cpp"),
],
),
JSystemLib(
"JStudio",
[
Object(NonMatching, "JSystem/JStudio/JStudio/ctb.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio/ctb-data.cpp"),
Object(Matching, "JSystem/JStudio/JStudio/ctb.cpp"),
Object(Matching, "JSystem/JStudio/JStudio/ctb-data.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio/functionvalue.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio/fvb.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio/fvb-data.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio/fvb-data-parse.cpp"),
Object(Matching, "JSystem/JStudio/JStudio/fvb-data.cpp"),
Object(Matching, "JSystem/JStudio/JStudio/fvb-data-parse.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio/jstudio-control.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio/jstudio-data.cpp"),
Object(Matching, "JSystem/JStudio/JStudio/jstudio-data.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio/jstudio-math.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio/jstudio-object.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio/object-id.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio/stb.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio/stb-data.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio/stb-data-parse.cpp"),
Object(Matching, "JSystem/JStudio/JStudio/object-id.cpp"),
Object(Matching, "JSystem/JStudio/JStudio/stb.cpp"),
Object(Matching, "JSystem/JStudio/JStudio/stb-data.cpp"),
Object(Matching, "JSystem/JStudio/JStudio/stb-data-parse.cpp"),
],
),
JSystemLib(
Expand All @@ -1388,8 +1388,12 @@ def MatchingFor(*versions):
Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-camera.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-light.cpp"),
Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-message.cpp"),
# this one is hard to identify
Object(NonMatching, "toBeSorted/JSystem/unk_jstage_maybe.cpp"),
],
),
JSystemLib(
"JStage",
[
Object(NonMatching, "JSystem/JStage/unk_jstage_maybe.cpp"),
],
),
JSystemLib(
Expand Down
189 changes: 189 additions & 0 deletions include/JSystem/JGadget/binary.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
#ifndef JGADGET_BINARY_H
#define JGADGET_BINARY_H

#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JGadget/search.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 bool isPower2(unsigned int arg0) {
return arg0 != 0 && (arg0 & arg0 - 1) == 0;
}

inline u32 align_roundUp(unsigned int arg0, unsigned int uAlign) {
JUT_ASSERT(98, isPower2(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 S>
struct TParseData_aligned : public TParseData {
TParseData_aligned(const void* pContent) : TParseData(pContent) {}
void setRaw(const void* p) {
/* if ((u32)p % S != 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() = 0;

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);
}
};

template <typename T>
struct TParseValue_raw_ {
typedef T ParseType;
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_<T>::parse(data); }
};

template <class Parser>
struct TParseValue : public Parser {
static typename Parser::ParseType parse(const void* data) { return Parser::parse(data); }

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(typename Parser::ParseType));
}
};

template<class Parser, int size>
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 = reinterpret_cast<const char*>(begin);
bool unused = false;
(void)&unused;
}

const void* get() const { return mBegin; }

typename Parser::ParseType operator*() const {
return TParseValue<typename Parser::InnerParseValueClass>::parse(get());
}

TValueIterator& operator++() {
mBegin += size;
return *this;
}

const TValueIterator operator++(int) {
TValueIterator old(*this);
++(*this);
return old;
}

TValueIterator& operator+=(s32 n) {
mBegin += size * n;
return *this;
}

TValueIterator& operator--() {
mBegin -= size;
return *this;
}

char const* mBegin;
};

template<typename T>
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_ : 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;
}
};

} // namespace binary
} // namespace JGadget

#endif /* JGADGET_BINARY_H */
73 changes: 73 additions & 0 deletions include/JSystem/JGadget/define.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#ifndef JGADGET_DEFINE_H
#define JGADGET_DEFINE_H

#include "common.h"

#ifdef __cplusplus
extern "C" {

class JGadget_outMessage {
public:
typedef void (*MessageFunc)(const char*, int, const char*);

static void warning(const char*, int, const char*);

JGadget_outMessage(MessageFunc fn, const char* file, int line);
~JGadget_outMessage();

JGadget_outMessage& operator<<(int param_1) { return *this << (s32)param_1; }
JGadget_outMessage& operator<<(u16);
JGadget_outMessage& operator<<(unsigned);
JGadget_outMessage& operator<<(u8 param_1) { return *this << (char)param_1; }
JGadget_outMessage& operator<<(const char* str);
JGadget_outMessage& operator<<(char);
JGadget_outMessage& operator<<(s32);
JGadget_outMessage& operator<<(u32);
JGadget_outMessage& operator<<(const void*);

static const int BUFFER_SIZE = 256;

private:
MessageFunc mMsgFunc;
char mBuffer[BUFFER_SIZE];
char* mWrite_p;
const char* mFile;
int mLine;
};

#if DEBUG

#define JGADGET_ASSERTWARN(line, COND) \
((COND)) || (JGadget_outMessage(JGadget_outMessage::warning, __FILE__, line) << #COND, false);

#define JGADGET_WARNMSG(line, msg) \
JGadget_outMessage(JGadget_outMessage::warning, __FILE__, line) << msg, false;

#define JGADGET_WARNMSG1(line, msg, arg) \
JGadget_outMessage out(JGadget_outMessage::warning, __FILE__, line); \
out << msg << (arg);

#define JGADGET_WARNMSG3(line, msg, arg1, arg2, arg3) \
JGadget_outMessage out(JGadget_outMessage::warning, __FILE__, line); \
out << msg << (arg1) << (arg2) << (arg3);

#define JGADGET_WARNMSG4(line, msg, arg1, arg2, arg3, arg4) \
JGadget_outMessage out(JGadget_outMessage::warning, __FILE__, line); \
out << msg << (arg1) << (arg2) << (arg3) << (arg4);

#define JGADGET_EXITWARN(line, COND) \
if (!(COND)) { \
JGadget_outMessage(JGadget_outMessage::warning, __FILE__, line) << #COND, false; \
return false; \
}
#else
#define JGADGET_ASSERTWARN(line, COND) (void)0
#define JGADGET_WARNMSG(line, msg) (void)0
#define JGADGET_WARNMSG1(line, msg, arg) (void)0
#define JGADGET_WARNMSG4(line, msg, arg1, arg2, arg3, arg4) (void)0
#define JGADGET_EXITWARN(line, COND) (void)0
#endif
}
#endif

#endif
Loading
Loading