mirror of
https://github.com/zeldaret/tww.git
synced 2026-05-23 06:54:16 -04:00
Copy JStudio::stb progress from TP
This commit is contained in:
+2
-2
@@ -609,8 +609,8 @@ config.libs = [
|
||||
Object(NonMatching, "JSystem/JStudio/JStudio/fvb-data-parse.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/stb-data.cpp"),
|
||||
Object(Matching, "JSystem/JStudio/JStudio/stb-data-parse.cpp"),
|
||||
],
|
||||
),
|
||||
JSystemLib(
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
#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);
|
||||
}
|
||||
|
||||
bool checkNext(const void** ptrLocation, u32* headerEnd, u32 idx) {
|
||||
bool checkNext = false;
|
||||
if (parseHeader_next(ptrLocation, headerEnd, idx)) {
|
||||
checkNext = true;
|
||||
}
|
||||
return checkNext;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct TParseValue_raw_ {
|
||||
static T parse(const void* data) { return *(T*)data; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct TParseValue_endian_big_ : public TParseValue_raw_<T> {
|
||||
static T parse(const void* data) { return TParseValue_raw_::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); }
|
||||
|
||||
static T parse(const void* data, s32 advanceNum) {
|
||||
return Parser<T>::parse(advance(data, advanceNum));
|
||||
}
|
||||
|
||||
static const void* advance(const void* data, s32 advanceNum) {
|
||||
return (char*)data + (advanceNum * sizeof(T));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace binary
|
||||
} // namespace JGadget
|
||||
|
||||
#endif /* BINARY_H */
|
||||
@@ -174,6 +174,8 @@ struct TLinkList : public TNodeLinkList {
|
||||
void Push_back(T* element) { Insert(end(), element); }
|
||||
iterator Find(const T* element) { return iterator(TNodeLinkList::Find(Element_toNode(element))); }
|
||||
void Remove(T* element) { TNodeLinkList::Remove(Element_toNode(element)); }
|
||||
u32 size() { return count; }
|
||||
bool empty() { return size() == 0; }
|
||||
};
|
||||
|
||||
template <typename T, int I>
|
||||
@@ -189,6 +191,35 @@ struct TEnumerator {
|
||||
TLinkList<T, I> field_0x4;
|
||||
};
|
||||
|
||||
// TEnumerator2 should be the same but there are two issues:
|
||||
// 1. How to derive the iterator return type for operator* (the debug makes it seem like operator* is called
|
||||
// so the return value should be what the iterator points to)
|
||||
// 2. Calling the * operator seems to make functions using TEnumerator<T*> not work. See
|
||||
// JStudio::TAdaptor::adaptor_setVariableValue_n
|
||||
// Perhaps template specialization?
|
||||
template <typename Iterator, typename T>
|
||||
struct TEnumerator2 {
|
||||
inline TEnumerator2(Iterator _current, Iterator _end)
|
||||
: current(_current), end(_end) {}
|
||||
|
||||
bool isEnd() const { return current != end; }
|
||||
operator bool() const { return isEnd(); }
|
||||
T& operator*() {
|
||||
T& rv = *current;
|
||||
++current;
|
||||
return rv;
|
||||
}
|
||||
|
||||
Iterator current;
|
||||
Iterator end;
|
||||
};
|
||||
|
||||
template <typename T, int I>
|
||||
struct TContainerEnumerator : public TEnumerator2<TLinkList<T, I>::iterator, T> {
|
||||
inline TContainerEnumerator(TLinkList<T, I>* param_0)
|
||||
: TEnumerator2<TLinkList<T, I>::iterator, T>(param_0->begin(), param_0->end()) {}
|
||||
};
|
||||
|
||||
template <typename T, int I>
|
||||
struct TContainerEnumerator_const : public TEnumerator<T, I> {};
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef SEARCH_H
|
||||
#define SEARCH_H
|
||||
|
||||
#include "global.h"
|
||||
|
||||
namespace JGadget {
|
||||
|
||||
//! @todo: mangled name isn't correct, fix this
|
||||
//! Current: toValueFromIndex<PFdd_d>__7JGadgetFiPCPFdd_dUlRCPFdd_d
|
||||
//! Target: toValueFromIndex<PFdd_d>__7JGadgetFiPCPFdd_dUlRCPFdd_d_RCPFdd_d
|
||||
template <typename T>
|
||||
inline const T& toValueFromIndex(int idx, const T* pValue, u32 count, const T& fallback) {
|
||||
ASSERT(pValue != NULL);
|
||||
return (idx >= count) ? fallback : pValue[idx];
|
||||
}
|
||||
|
||||
} // namespace JGadget
|
||||
|
||||
#endif /* SEARCH_H */
|
||||
@@ -0,0 +1,86 @@
|
||||
#ifndef VECTOR_H
|
||||
#define VECTOR_H
|
||||
|
||||
|
||||
extern u8 data_804511E0;
|
||||
extern u8 lit_569[];
|
||||
|
||||
namespace JGadget {
|
||||
|
||||
namespace vector {
|
||||
|
||||
u32 extend_default(u32 arg1, u32 arg2, u32 arg3);
|
||||
|
||||
typedef u32 (*ExtendFunc)(u32, u32, u32);
|
||||
|
||||
} // namespace vector
|
||||
|
||||
template <typename T>
|
||||
struct TAllocator {
|
||||
static TAllocator get() {}
|
||||
inline TAllocator() { _0 = lit_569[0]; }
|
||||
/* 0x0 */ u8 _0;
|
||||
/* 0x4 */ u32 _4;
|
||||
/* 0x8 */ u32 _8;
|
||||
/* 0xc */ u32 _c;
|
||||
};
|
||||
|
||||
template <typename T, template <class> class Allocator>
|
||||
struct TVector {
|
||||
TVector(Allocator<T> alloc) {
|
||||
_0 = NULL;
|
||||
pBegin_ = _0;
|
||||
_c = NULL;
|
||||
extend = vector::extend_default;
|
||||
}
|
||||
|
||||
inline u32 size() const {
|
||||
if (pBegin_ == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ((int)pEnd_ - (int)pBegin_) / 4;
|
||||
}
|
||||
|
||||
void **const begin() const { return pBegin_; }
|
||||
void **const end() const { return pEnd_; }
|
||||
void** begin() { return pBegin_; }
|
||||
void** end() { return pEnd_; }
|
||||
// void erase(void** arg1, void** arg2) {}
|
||||
|
||||
void** _0;
|
||||
void** pBegin_;
|
||||
void** pEnd_;
|
||||
u32 _c;
|
||||
vector::ExtendFunc extend;
|
||||
};
|
||||
|
||||
struct TVector_pointer_void : TVector<void*, TAllocator> {
|
||||
TVector_pointer_void(JGadget::TAllocator<void*> const&);
|
||||
~TVector_pointer_void();
|
||||
void erase(void**, void**);
|
||||
void insert(void**, void* const&);
|
||||
|
||||
void clear() { erase(begin(), end()); }
|
||||
void push_back(const void*& ref) { insert(end(), (void* const&)ref); }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct TVector_pointer : TVector_pointer_void {
|
||||
TVector_pointer(const TAllocator<void*>& allocator) : TVector_pointer_void(allocator) {}
|
||||
~TVector_pointer() {}
|
||||
|
||||
const T* begin() const { return (const T*)TVector_pointer_void::begin(); }
|
||||
T* begin() { return (T*)TVector_pointer_void::begin(); }
|
||||
|
||||
const T* end() const { return (const T*)TVector_pointer_void::end(); }
|
||||
T* end() { return (T*)TVector_pointer_void::end(); }
|
||||
|
||||
void push_back(const T& ref) {
|
||||
static_cast<TVector_pointer_void*>(this)->push_back((const void*&)ref);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace JGadget
|
||||
|
||||
#endif /* VECTOR_H */
|
||||
@@ -0,0 +1,158 @@
|
||||
#ifndef CTB_H
|
||||
#define CTB_H
|
||||
|
||||
#include "JSystem/JGadget/binary.h"
|
||||
#include "JSystem/JGadget/linklist.h"
|
||||
#include "JSystem/JStudio/JStudio/object-id.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
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);
|
||||
}
|
||||
virtual ~TObject() = 0;
|
||||
virtual int getScheme() const = 0;
|
||||
const void* getData() const { return pData_; }
|
||||
|
||||
/* 0x08 vtable */
|
||||
/* 0x0C */ JGadget::TLinkListNode ocObject_;
|
||||
/* 0x14 */ const void* pData_;
|
||||
};
|
||||
|
||||
struct data {
|
||||
struct THeaderData {
|
||||
u32 signature;
|
||||
u16 byteOrder;
|
||||
u16 version;
|
||||
u8 field_0x0[4];
|
||||
u32 blockNumber;
|
||||
u8 content[0];
|
||||
};
|
||||
|
||||
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 {
|
||||
TObject_TxyzRy(JStudio::ctb::data::TParse_TBlock const&);
|
||||
|
||||
virtual ~TObject_TxyzRy();
|
||||
virtual int getScheme() const;
|
||||
};
|
||||
|
||||
struct TFactory {
|
||||
TFactory() {}
|
||||
|
||||
virtual ~TFactory();
|
||||
virtual TObject* create(JStudio::ctb::data::TParse_TBlock const&);
|
||||
virtual void destroy(JStudio::ctb::TObject*);
|
||||
};
|
||||
|
||||
struct TControl {
|
||||
TControl();
|
||||
virtual ~TControl();
|
||||
void appendObject(JStudio::ctb::TObject*);
|
||||
void removeObject(JStudio::ctb::TObject*);
|
||||
void destroyObject(JStudio::ctb::TObject*);
|
||||
void destroyObject_all();
|
||||
JStudio::ctb::TObject* getObject(void const*, u32);
|
||||
JStudio::ctb::TObject* getObject_index(u32);
|
||||
|
||||
TFactory* getFactory() { return pFactory_; }
|
||||
void setFactory(TFactory* factory) { pFactory_ = factory; }
|
||||
|
||||
/* 0x4 */ TFactory* pFactory_;
|
||||
/* 0x8 */ JGadget::TLinkList<TObject, -12> mList;
|
||||
};
|
||||
|
||||
struct TParse : public JGadget::binary::TParse_header_block {
|
||||
TParse(JStudio::ctb::TControl*);
|
||||
virtual ~TParse();
|
||||
virtual bool parseHeader_next(void const**, u32*, u32);
|
||||
virtual bool parseBlock_next(void const**, u32*, u32);
|
||||
|
||||
TControl* getControl() { return pControl_; }
|
||||
|
||||
/* 0x4 */ TControl* pControl_;
|
||||
};
|
||||
|
||||
}; // namespace ctb
|
||||
}; // namespace JStudio
|
||||
|
||||
#endif /* CTB_H */
|
||||
@@ -0,0 +1,412 @@
|
||||
#ifndef FUNCTIONVALUE_H
|
||||
#define FUNCTIONVALUE_H
|
||||
|
||||
#include "JSystem/JGadget/search.h"
|
||||
#include "JSystem/JGadget/vector.h"
|
||||
#include "global.h"
|
||||
|
||||
namespace JStudio {
|
||||
|
||||
typedef f64 (*ExtrapolateParameter)(f64, f64);
|
||||
|
||||
class TFunctionValue;
|
||||
class TFunctionValueAttributeSet;
|
||||
|
||||
class TFunctionValueAttribute_refer;
|
||||
class TFunctionValueAttribute_range;
|
||||
class TFunctionValueAttribute_interpolate;
|
||||
|
||||
class TFunctionValue {
|
||||
public:
|
||||
enum TEProgress { PROG_INIT };
|
||||
enum TEAdjust { ADJ_INIT, ADJ_UNK1, ADJ_UNK2, ADJ_UNK3, ADJ_UNK4 };
|
||||
enum TEOutside { OUT_INIT };
|
||||
enum TEInterpolate {};
|
||||
|
||||
TFunctionValue();
|
||||
virtual ~TFunctionValue() = 0;
|
||||
|
||||
virtual u32 getType() const = 0;
|
||||
virtual TFunctionValueAttributeSet getAttributeSet() = 0;
|
||||
virtual void initialize() = 0;
|
||||
virtual void prepare() = 0;
|
||||
virtual f64 getValue(f64 arg1) = 0;
|
||||
|
||||
static ExtrapolateParameter toFunction_outside(int);
|
||||
|
||||
static ExtrapolateParameter toFunction(TFunctionValue::TEOutside outside) {
|
||||
return toFunction_outside(outside);
|
||||
}
|
||||
};
|
||||
|
||||
class TFunctionValueAttributeSet_const {
|
||||
public:
|
||||
TFunctionValueAttributeSet_const(TFunctionValueAttribute_refer* refer,
|
||||
TFunctionValueAttribute_range* range,
|
||||
TFunctionValueAttribute_interpolate* interp)
|
||||
: refer_(refer), range_(range), interp_(interp) {}
|
||||
|
||||
TFunctionValueAttribute_refer* refer_get() const { return refer_; }
|
||||
TFunctionValueAttribute_range* range_get() const { return range_; }
|
||||
TFunctionValueAttribute_interpolate* interpolate_get() const { return interp_; }
|
||||
|
||||
private:
|
||||
/* 0x00 */ TFunctionValueAttribute_refer* refer_;
|
||||
/* 0x04 */ TFunctionValueAttribute_range* range_;
|
||||
/* 0x08 */ TFunctionValueAttribute_interpolate* interp_;
|
||||
};
|
||||
|
||||
class TFunctionValueAttributeSet : public TFunctionValueAttributeSet_const {
|
||||
public:
|
||||
TFunctionValueAttributeSet(TFunctionValueAttribute_refer* refer,
|
||||
TFunctionValueAttribute_range* range,
|
||||
TFunctionValueAttribute_interpolate* interp)
|
||||
: TFunctionValueAttributeSet_const(refer, range, interp) {}
|
||||
|
||||
TFunctionValueAttribute_refer* refer_get() const {
|
||||
return static_cast<const TFunctionValueAttributeSet_const*>(this)->refer_get();
|
||||
}
|
||||
TFunctionValueAttribute_range* range_get() const {
|
||||
return static_cast<const TFunctionValueAttributeSet_const*>(this)->range_get();
|
||||
}
|
||||
TFunctionValueAttribute_interpolate* interpolate_get() const {
|
||||
return static_cast<const TFunctionValueAttributeSet_const*>(this)->interpolate_get();
|
||||
}
|
||||
};
|
||||
|
||||
class TFunctionValueAttribute_refer : public JGadget::TVector_pointer<TFunctionValue*> {
|
||||
public:
|
||||
TFunctionValueAttribute_refer() :
|
||||
JGadget::TVector_pointer<TFunctionValue*>(JGadget::TAllocator<void*>()) {}
|
||||
~TFunctionValueAttribute_refer() {}
|
||||
|
||||
void refer_initialize();
|
||||
|
||||
const TFunctionValueAttribute_refer* refer_getContainer() const { return this; }
|
||||
JGadget::TVector_pointer<TFunctionValue*>& refer_referContainer() { return *this; }
|
||||
bool refer_isReferring(const TFunctionValue* p) const { return false; } // todo
|
||||
};
|
||||
|
||||
class TFunctionValueAttribute_range {
|
||||
public:
|
||||
TFunctionValueAttribute_range();
|
||||
|
||||
void range_initialize();
|
||||
void range_prepare();
|
||||
void range_set(f64, f64);
|
||||
f64 range_getParameter(f64, f64, f64) const;
|
||||
|
||||
TFunctionValue::TEProgress range_getProgress() const {
|
||||
return (TFunctionValue::TEProgress)mProgress;
|
||||
}
|
||||
void range_setProgress(TFunctionValue::TEProgress progress) { mProgress = progress; }
|
||||
TFunctionValue::TEAdjust range_getAdjust() const { return (TFunctionValue::TEAdjust)mAdjust; }
|
||||
void range_setAdjust(TFunctionValue::TEAdjust adjust) { mAdjust = adjust; }
|
||||
void range_setOutside(TFunctionValue::TEOutside outside) { range_setOutside(outside, outside); }
|
||||
void range_setOutside(TFunctionValue::TEOutside begin, TFunctionValue::TEOutside end) {
|
||||
range_setOutside_begin(begin);
|
||||
range_setOutside_end(end);
|
||||
}
|
||||
void range_setOutside_begin(TFunctionValue::TEOutside begin) { mBegin = begin; }
|
||||
void range_setOutside_end(TFunctionValue::TEOutside end) { mEnd = end; }
|
||||
f64 range_getParameter_outside(f64 arg1) const {
|
||||
f64 result = arg1;
|
||||
result -= fBegin_;
|
||||
if (result < 0.0) {
|
||||
result = TFunctionValue::toFunction(mBegin)(result, fDifference_);
|
||||
} else if (result >= fDifference_) {
|
||||
result = TFunctionValue::toFunction(mEnd)(result, fDifference_);
|
||||
}
|
||||
result += fBegin_;
|
||||
return result;
|
||||
}
|
||||
f64 range_getParameter_progress(f64 arg1) const { return _20 + _28 * (arg1 - _20); }
|
||||
f64 range_getBegin() const { return fBegin_;}
|
||||
f64 range_getEnd() const { return fEnd_;}
|
||||
f64 range_getDifference() const { return fDifference_; }
|
||||
|
||||
private:
|
||||
/* 0x00 */ f64 fBegin_;
|
||||
/* 0x08 */ f64 fEnd_;
|
||||
/* 0x10 */ f64 fDifference_;
|
||||
/* 0x18 */ s8 mProgress;
|
||||
/* 0x19 */ s8 mAdjust;
|
||||
/* 0x1A */ s8 _1a[2];
|
||||
/* 0x1C */ u32 _1c;
|
||||
/* 0x20 */ f64 _20;
|
||||
/* 0x28 */ f64 _28;
|
||||
/* 0x30 */ TFunctionValue::TEOutside mBegin;
|
||||
/* 0x34 */ TFunctionValue::TEOutside mEnd;
|
||||
};
|
||||
|
||||
class TFunctionValueAttribute_interpolate {
|
||||
public:
|
||||
TFunctionValueAttribute_interpolate() : interpolate_(0) {}
|
||||
|
||||
void interpolate_initialize() { interpolate_ = 0; }
|
||||
void interpolate_prepare() {}
|
||||
u32 interpolate_get() const { return interpolate_; }
|
||||
void interpolate_set(TFunctionValue::TEInterpolate interpolate) { interpolate_ = interpolate; }
|
||||
|
||||
private:
|
||||
/* 0x0 */ u32 interpolate_;
|
||||
};
|
||||
|
||||
class TFunctionValue_constant : public TFunctionValue {
|
||||
public:
|
||||
TFunctionValue_constant();
|
||||
virtual ~TFunctionValue_constant() {}
|
||||
|
||||
virtual u32 getType() const;
|
||||
virtual TFunctionValueAttributeSet getAttributeSet();
|
||||
virtual void initialize();
|
||||
virtual void prepare();
|
||||
virtual f64 getValue(f64);
|
||||
|
||||
void data_set(f64 value) { fValue_ = value; }
|
||||
|
||||
private:
|
||||
f64 fValue_;
|
||||
};
|
||||
|
||||
class TFunctionValue_composite : public TFunctionValue, public TFunctionValueAttribute_refer {
|
||||
public:
|
||||
struct TData {
|
||||
TData(void* data) : u32data((u32)data) {}
|
||||
TData(const void* data) : rawData(data) {}
|
||||
TData(u32 data) : u32data(data) {}
|
||||
TData(f32 data) : f32data(data) {}
|
||||
|
||||
inline void operator=(const TData& rhs) { f32data = rhs.f32data; }
|
||||
u32 get_unsignedInteger() const { return u32data; }
|
||||
f64 get_value() const { return f32data; }
|
||||
|
||||
union {
|
||||
const void* rawData;
|
||||
u32 u32data;
|
||||
f64 f32data;
|
||||
};
|
||||
};
|
||||
typedef f64 (*UnkFunc)(f64, const TFunctionValueAttribute_refer*,
|
||||
const TFunctionValue_composite::TData*);
|
||||
typedef f64 (*CompositeFunc)(const JGadget::TVector_pointer<TFunctionValue>&,
|
||||
const TFunctionValue_composite::TData&, f64);
|
||||
|
||||
TFunctionValue_composite();
|
||||
virtual ~TFunctionValue_composite() {}
|
||||
|
||||
virtual u32 getType() const;
|
||||
virtual TFunctionValueAttributeSet getAttributeSet();
|
||||
virtual void initialize();
|
||||
virtual void prepare();
|
||||
virtual f64 getValue(f64);
|
||||
static f64 composite_raw(TVector_pointer<TFunctionValue*> const&, TData const&, f64);
|
||||
static f64 composite_index(TVector_pointer<TFunctionValue*> const&, TData const&, f64);
|
||||
static f64 composite_parameter(TVector_pointer<TFunctionValue*> const&,
|
||||
TData const&, f64);
|
||||
static f64 composite_add(TVector_pointer<JStudio::TFunctionValue*> const&,
|
||||
TData const&, f64);
|
||||
static f64 composite_subtract(TVector_pointer<TFunctionValue*> const&, TData const&,
|
||||
f64);
|
||||
static f64 composite_multiply(TVector_pointer<TFunctionValue*> const&, TData const&,
|
||||
f64);
|
||||
static f64 composite_divide(TVector_pointer<TFunctionValue*> const&, TData const&,
|
||||
f64);
|
||||
|
||||
void data_set(CompositeFunc fn, const TData& dat) {
|
||||
pfn_ = (UnkFunc)fn;
|
||||
data_setData(dat);
|
||||
}
|
||||
const TData* data_getData() const { return &data; }
|
||||
void data_setData(const TData& dat) { data = dat; }
|
||||
|
||||
// private:
|
||||
UnkFunc pfn_;
|
||||
TData data;
|
||||
};
|
||||
|
||||
class TFunctionValue_transition : TFunctionValue,
|
||||
TFunctionValueAttribute_range,
|
||||
TFunctionValueAttribute_interpolate {
|
||||
public:
|
||||
TFunctionValue_transition();
|
||||
virtual ~TFunctionValue_transition() {}
|
||||
|
||||
virtual u32 getType() const;
|
||||
virtual TFunctionValueAttributeSet getAttributeSet();
|
||||
virtual void initialize();
|
||||
virtual void prepare();
|
||||
virtual f64 getValue(f64);
|
||||
|
||||
void data_set(f64 a1, f64 a2) {
|
||||
_48 = a1;
|
||||
_50 = a2;
|
||||
}
|
||||
|
||||
f64 data_getDifference() const { return _50 - _48; }
|
||||
|
||||
private:
|
||||
/* 0x48 */ f64 _48;
|
||||
/* 0x50 */ f64 _50;
|
||||
};
|
||||
|
||||
class TFunctionValue_list : TFunctionValue,
|
||||
TFunctionValueAttribute_range,
|
||||
TFunctionValueAttribute_interpolate {
|
||||
public:
|
||||
struct TIndexData_ {
|
||||
f64 _0;
|
||||
f64 _8;
|
||||
u32 _10;
|
||||
};
|
||||
typedef f64 (*update_INTERPOLATE)(const TFunctionValue_list&, const TIndexData_&);
|
||||
|
||||
TFunctionValue_list();
|
||||
virtual ~TFunctionValue_list() {}
|
||||
|
||||
virtual u32 getType() const;
|
||||
virtual TFunctionValueAttributeSet getAttributeSet();
|
||||
virtual void initialize();
|
||||
virtual void prepare();
|
||||
virtual f64 getValue(f64);
|
||||
|
||||
void data_set(const f32* pf, u32 u) {
|
||||
ASSERT((pf != NULL) || (u == 0));
|
||||
_44 = pf;
|
||||
uData_ = u;
|
||||
}
|
||||
|
||||
void data_setInterval(f64 f) {
|
||||
ASSERT(f > TValue(0));
|
||||
_50 = f;
|
||||
}
|
||||
|
||||
static f64
|
||||
update_INTERPOLATE_NONE_(JStudio::TFunctionValue_list const&,
|
||||
JStudio::TFunctionValue_list::TIndexData_ const&);
|
||||
static f64
|
||||
update_INTERPOLATE_LINEAR_(JStudio::TFunctionValue_list const&,
|
||||
JStudio::TFunctionValue_list::TIndexData_ const&);
|
||||
static f64
|
||||
update_INTERPOLATE_PLATEAU_(JStudio::TFunctionValue_list const&,
|
||||
JStudio::TFunctionValue_list::TIndexData_ const&);
|
||||
static f64
|
||||
update_INTERPOLATE_BSPLINE_dataMore3_(JStudio::TFunctionValue_list const&,
|
||||
JStudio::TFunctionValue_list::TIndexData_ const&);
|
||||
|
||||
private:
|
||||
/* 0x44 */ const f32* _44;
|
||||
/* 0x48 */ u32 uData_;
|
||||
/* 0x50 */ f64 _50;
|
||||
/* 0x58 */ update_INTERPOLATE pfnUpdate_;
|
||||
};
|
||||
|
||||
class TFunctionValue_list_parameter : TFunctionValue,
|
||||
TFunctionValueAttribute_range,
|
||||
TFunctionValueAttribute_interpolate {
|
||||
public:
|
||||
struct TIterator_data_ {
|
||||
TIterator_data_(const f32* value) : value_(value) {}
|
||||
TIterator_data_(const TIterator_data_& other) : value_(other.value_) {}
|
||||
|
||||
void operator=(const TIterator_data_& rhs) { value_ = rhs.value_; }
|
||||
TIterator_data_& operator--() {
|
||||
value_ -= 2;
|
||||
return *this;
|
||||
}
|
||||
friend bool operator==(const TIterator_data_& lhs, const TIterator_data_& rhs) { return lhs.value_ == rhs.value_; }
|
||||
|
||||
const f32* get() const { return value_; }
|
||||
void set(const f32* value) { value_ = value; }
|
||||
|
||||
const f32* value_;
|
||||
};
|
||||
typedef f64 (*update_INTERPOLATE)(const TFunctionValue_list_parameter&, f64);
|
||||
|
||||
TFunctionValue_list_parameter();
|
||||
virtual ~TFunctionValue_list_parameter() {}
|
||||
|
||||
virtual u32 getType() const;
|
||||
virtual TFunctionValueAttributeSet getAttributeSet();
|
||||
void data_set(f32 const*, u32);
|
||||
virtual void initialize();
|
||||
virtual void prepare();
|
||||
virtual f64 getValue(f64);
|
||||
|
||||
static f64
|
||||
update_INTERPOLATE_NONE_(JStudio::TFunctionValue_list_parameter const&, f64);
|
||||
static f64
|
||||
update_INTERPOLATE_LINEAR_(JStudio::TFunctionValue_list_parameter const&, f64);
|
||||
static f64
|
||||
update_INTERPOLATE_PLATEAU_(JStudio::TFunctionValue_list_parameter const&, f64);
|
||||
static f64
|
||||
update_INTERPOLATE_BSPLINE_dataMore3_(JStudio::TFunctionValue_list_parameter const&, f64);
|
||||
|
||||
f64 data_getValue_back() {
|
||||
return pfData_[(uData_ - 1) * 2];
|
||||
}
|
||||
f64 data_getValue_front() { return pfData_[0]; }
|
||||
|
||||
private:
|
||||
/* 0x44 */ const f32* pfData_;
|
||||
/* 0x48 */ u32 uData_;
|
||||
/* 0x4c */ TIterator_data_ dat1;
|
||||
/* 0x50 */ TIterator_data_ dat2;
|
||||
/* 0x54 */ TIterator_data_ dat3;
|
||||
/* 0x58 */ update_INTERPOLATE pfnUpdate_;
|
||||
};
|
||||
|
||||
class TFunctionValue_hermite : TFunctionValue, TFunctionValueAttribute_range {
|
||||
public:
|
||||
struct TIterator_data_ {
|
||||
TIterator_data_(const TFunctionValue_hermite& rParent, const f32* value) {
|
||||
value_ = value;
|
||||
size_ = rParent.data_getSize();
|
||||
}
|
||||
|
||||
const f32* get() { return value_; }
|
||||
|
||||
void set(const f32* value, u32 size) {
|
||||
value_ = value;
|
||||
size_ = size;
|
||||
}
|
||||
|
||||
friend bool operator==(const TIterator_data_& lhs, const TIterator_data_& rhs) { return lhs.value_ == rhs.value_; }
|
||||
|
||||
TIterator_data_& operator--() {
|
||||
value_ -= size_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* 0x00 */ const f32* value_;
|
||||
/* 0x04 */ u32 size_;
|
||||
};
|
||||
|
||||
TFunctionValue_hermite();
|
||||
virtual ~TFunctionValue_hermite() {}
|
||||
|
||||
virtual u32 getType() const;
|
||||
virtual TFunctionValueAttributeSet getAttributeSet();
|
||||
void data_set(f32 const*, u32, u32);
|
||||
virtual void initialize();
|
||||
virtual void prepare();
|
||||
virtual f64 getValue(f64);
|
||||
|
||||
u32 data_getSize() const { return uSize_; }
|
||||
f64 data_getValue_back() {
|
||||
return pf_[(u_ - 1) * uSize_];
|
||||
}
|
||||
f64 data_getValue_front() { return pf_[0]; }
|
||||
|
||||
private:
|
||||
/* 0x40 */ const f32* pf_;
|
||||
/* 0x44 */ u32 u_;
|
||||
/* 0x48 */ u32 uSize_;
|
||||
/* 0x4c */ TIterator_data_ dat1;
|
||||
/* 0x50 */ TIterator_data_ dat2;
|
||||
/* 0x54 */ TIterator_data_ dat3;
|
||||
};
|
||||
|
||||
} // namespace JStudio
|
||||
|
||||
#endif /* FUNCTIONVALUE_H */
|
||||
@@ -0,0 +1,53 @@
|
||||
#ifndef FVB_DATA_PARSE_H
|
||||
#define FVB_DATA_PARSE_H
|
||||
|
||||
#include "JSystem/JStudio/JStudio/fvb-data.h"
|
||||
|
||||
namespace JStudio {
|
||||
namespace fvb {
|
||||
namespace data {
|
||||
|
||||
class TParse_TBlock : public TParseData_aligned<4> {
|
||||
public:
|
||||
TParse_TBlock(const void* content) : TParseData_aligned<4>(content) {}
|
||||
|
||||
const TBlock* get() const { return (TBlock*)getRaw(); }
|
||||
|
||||
u32 get_size() const { return get()->size; }
|
||||
const void* getNext() const {
|
||||
u32 size = get_size();
|
||||
return (const void*)((u8*)getRaw() + size);
|
||||
}
|
||||
u16 get_type() const { return get()->type; }
|
||||
u16 get_IDSize() const { return get()->id_size; }
|
||||
const void* getBlockEnd_() const { return (u8*)getRaw() + sizeof(TBlock); }
|
||||
const void* get_ID() const {
|
||||
const void* ret = 0;
|
||||
if (get_IDSize())
|
||||
ret = getBlockEnd_();
|
||||
return ret;
|
||||
}
|
||||
const void* getContent() const {
|
||||
u32 size = align_roundUp(get_IDSize(), 4);
|
||||
return (const void*)((int)getBlockEnd_() + size);
|
||||
}
|
||||
};
|
||||
|
||||
class TParse_TParagraph : public TParseData_aligned<4> {
|
||||
public:
|
||||
struct TData {
|
||||
/* 0x04 */ u32 u32Size;
|
||||
/* 0x08 */ u32 u32Type;
|
||||
/* 0x0C */ const void* pContent;
|
||||
/* 0x10 */ const void* next;
|
||||
};
|
||||
TParse_TParagraph(const void* content) : TParseData_aligned<4>(content) {}
|
||||
|
||||
void getData(JStudio::fvb::data::TParse_TParagraph::TData*) const;
|
||||
};
|
||||
|
||||
} // namespace data
|
||||
} // namespace fvb
|
||||
} // namespace JStudio
|
||||
|
||||
#endif /* FVB_DATA_PARSE_H */
|
||||
@@ -0,0 +1,63 @@
|
||||
#ifndef FVB_DATA_H
|
||||
#define FVB_DATA_H
|
||||
|
||||
#include "JSystem/JGadget/binary.h"
|
||||
#include "JSystem/JStudio/JStudio/functionvalue.h"
|
||||
|
||||
using namespace JGadget::binary;
|
||||
|
||||
namespace JStudio {
|
||||
namespace fvb {
|
||||
namespace data {
|
||||
|
||||
extern const char ga4cSignature[4];
|
||||
|
||||
const int PARAGRAPH_DATA = 1;
|
||||
|
||||
typedef enum TEComposite {
|
||||
/* 0x0 */ COMPOSITE_NONE,
|
||||
/* 0x1 */ COMPOSITE_RAW,
|
||||
/* 0x2 */ COMPOSITE_IDX,
|
||||
/* 0x3 */ COMPOSITE_PARAM,
|
||||
/* 0x4 */ COMPOSITE_ADD,
|
||||
/* 0x5 */ COMPOSITE_SUB,
|
||||
/* 0x6 */ COMPOSITE_MUL,
|
||||
/* 0x7 */ COMPOSITE_DIV,
|
||||
/* 0x8 */ COMPOSITE_ENUM_SIZE,
|
||||
};
|
||||
|
||||
typedef const void* (*CompositeOperation)(TFunctionValue_composite::TData);
|
||||
|
||||
struct TBlock {
|
||||
/* 0x0 */ u32 size;
|
||||
/* 0x4 */ u16 type;
|
||||
/* 0x6 */ u16 id_size;
|
||||
/* 0x8 */ u8 id[0];
|
||||
};
|
||||
|
||||
struct THeader {
|
||||
/* 0x00 */ char signature[4];
|
||||
/* 0x04 */ u16 byte_order; // must be 0xFEFF
|
||||
/* 0x06 */ u16 version; // 0-1 = obselete, 2-7 = OK
|
||||
/* 0x08 */ u32 _8;
|
||||
/* 0x0C */ u32 block_number;
|
||||
/* 0x10 */ u8 content[0];
|
||||
};
|
||||
// Parses a THeader
|
||||
class TParse_THeader : public TParseData_aligned<4> {
|
||||
public:
|
||||
TParse_THeader(const void* p) : TParseData_aligned<4>(p) {}
|
||||
|
||||
const THeader* get() const { return (THeader*)getRaw(); }
|
||||
const void* getContent() const { return ((THeader*)getRaw())->content; }
|
||||
const char* get_signature() const { return get()->signature; }
|
||||
u16 get_byteOrder() const { return get()->byte_order; }
|
||||
u16 get_version() const { return get()->version; }
|
||||
u32 get_blockNumber() const { return get()->block_number; }
|
||||
};
|
||||
|
||||
} // namespace data
|
||||
} // namespace fvb
|
||||
} // namespace JStudio
|
||||
|
||||
#endif /* FVB_DATA_H */
|
||||
@@ -0,0 +1,160 @@
|
||||
#ifndef FVB_H
|
||||
#define FVB_H
|
||||
|
||||
#include "JSystem/JGadget/linklist.h"
|
||||
#include "JSystem/JStudio/JStudio/fvb-data-parse.h"
|
||||
#include "JSystem/JStudio/JStudio/object-id.h"
|
||||
|
||||
namespace JStudio {
|
||||
namespace fvb {
|
||||
|
||||
class TControl;
|
||||
|
||||
class TParse : public TParse_header_block {
|
||||
public:
|
||||
TParse(JStudio::fvb::TControl*);
|
||||
virtual ~TParse();
|
||||
virtual bool parseHeader_next(void const**, u32*, u32);
|
||||
virtual bool parseBlock_next(void const**, u32*, u32);
|
||||
|
||||
TControl* getControl() const { return pControl_; }
|
||||
|
||||
private:
|
||||
TControl* pControl_;
|
||||
};
|
||||
|
||||
class TObject : public object::TObject_ID {
|
||||
public:
|
||||
TObject(const data::TParse_TBlock& block);
|
||||
TObject(void const* id, u32 id_size, TFunctionValue* value);
|
||||
|
||||
explicit TObject(const data::TParse_TBlock& block, TFunctionValue* value)
|
||||
: TObject_ID(block.get_ID(), block.get_IDSize()), pfv_(value) {
|
||||
ASSERT(pfv_ != NULL);
|
||||
}
|
||||
|
||||
virtual ~TObject() = 0;
|
||||
|
||||
virtual void prepare_data_(const data::TParse_TParagraph::TData& data, TControl* control) = 0;
|
||||
|
||||
void prepare(const data::TParse_TBlock& block, TControl* control);
|
||||
|
||||
TFunctionValue* const& referFunctionValue() { return pfv_; }
|
||||
|
||||
private:
|
||||
/* 0x0C */ JGadget::TLinkListNode mNode;
|
||||
/* 0x14 */ TFunctionValue* pfv_;
|
||||
};
|
||||
|
||||
class TFactory {
|
||||
public:
|
||||
TFactory() {}
|
||||
|
||||
virtual ~TFactory();
|
||||
virtual TObject* create(JStudio::fvb::data::TParse_TBlock const&);
|
||||
virtual void destroy(JStudio::fvb::TObject*);
|
||||
};
|
||||
|
||||
class TControl {
|
||||
public:
|
||||
TControl();
|
||||
virtual ~TControl();
|
||||
|
||||
void appendObject(JStudio::fvb::TObject*);
|
||||
void removeObject(JStudio::fvb::TObject*);
|
||||
void destroyObject(JStudio::fvb::TObject*);
|
||||
void destroyObject_all();
|
||||
TObject* getObject(void const*, u32);
|
||||
TObject* getObject_index(u32);
|
||||
|
||||
TFactory* getFactory() const { return pFactory; }
|
||||
void setFactory(TFactory* factory) { pFactory = factory; }
|
||||
|
||||
private:
|
||||
/* 0x4 */ TFactory* pFactory;
|
||||
/* 0x8 */ JGadget::TLinkList<TObject, 12> ocObject_;
|
||||
}; // Size: 0x14
|
||||
|
||||
class TObject_composite : public TObject {
|
||||
public:
|
||||
TObject_composite(JStudio::fvb::data::TParse_TBlock const&);
|
||||
virtual void prepare_data_(JStudio::fvb::data::TParse_TParagraph::TData const&,
|
||||
JStudio::fvb::TControl*);
|
||||
virtual ~TObject_composite() {}
|
||||
|
||||
private:
|
||||
TFunctionValue_composite fnValue;
|
||||
};
|
||||
|
||||
class TObject_constant : public TObject {
|
||||
public:
|
||||
TObject_constant(data::TParse_TBlock const&);
|
||||
virtual ~TObject_constant() {}
|
||||
|
||||
virtual void prepare_data_(data::TParse_TParagraph::TData const&, TControl*);
|
||||
|
||||
private:
|
||||
TFunctionValue_constant fnValue;
|
||||
};
|
||||
|
||||
class TObject_transition : public TObject {
|
||||
public:
|
||||
TObject_transition(data::TParse_TBlock const&);
|
||||
virtual ~TObject_transition() {}
|
||||
|
||||
virtual void prepare_data_(data::TParse_TParagraph::TData const&, TControl*);
|
||||
|
||||
private:
|
||||
TFunctionValue_transition fnValue;
|
||||
};
|
||||
|
||||
class TObject_list : public TObject {
|
||||
public:
|
||||
struct ListData {
|
||||
/* 0x0 */ f32 _0;
|
||||
/* 0x4 */ u32 _4;
|
||||
/* 0x8 */ f32 _8[0];
|
||||
};
|
||||
TObject_list(data::TParse_TBlock const&);
|
||||
virtual ~TObject_list() {}
|
||||
|
||||
virtual void prepare_data_(data::TParse_TParagraph::TData const&, TControl*);
|
||||
|
||||
private:
|
||||
TFunctionValue_list fnValue;
|
||||
};
|
||||
|
||||
class TObject_list_parameter : public TObject {
|
||||
public:
|
||||
struct ListData {
|
||||
u32 _0;
|
||||
f32 _4[0];
|
||||
};
|
||||
TObject_list_parameter(data::TParse_TBlock const&);
|
||||
virtual ~TObject_list_parameter() {}
|
||||
|
||||
virtual void prepare_data_(data::TParse_TParagraph::TData const&, TControl*);
|
||||
|
||||
private:
|
||||
TFunctionValue_list_parameter fnValue;
|
||||
};
|
||||
|
||||
struct TObject_hermite : public TObject {
|
||||
public:
|
||||
struct ListData {
|
||||
u32 _0; // u : 28, uSize : 4
|
||||
f32 _4[0];
|
||||
};
|
||||
TObject_hermite(data::TParse_TBlock const&);
|
||||
virtual ~TObject_hermite() {}
|
||||
|
||||
virtual void prepare_data_(data::TParse_TParagraph::TData const&, TControl*);
|
||||
|
||||
private:
|
||||
TFunctionValue_hermite fnValue;
|
||||
};
|
||||
|
||||
} // namespace fvb
|
||||
} // namespace JStudio
|
||||
|
||||
#endif /* FVB_H */
|
||||
@@ -0,0 +1,131 @@
|
||||
#ifndef JSTUDIO_CONTROL_H
|
||||
#define JSTUDIO_CONTROL_H
|
||||
|
||||
#include "JSystem/JStudio/JStudio/fvb.h"
|
||||
#include "JSystem/JStudio/JStudio/stb.h"
|
||||
#include "JSystem/JStudio/JStudio/ctb.h"
|
||||
#include "dolphin/gx/GX.h"
|
||||
#include "dolphin/mtx/vec.h"
|
||||
|
||||
namespace JStudio {
|
||||
struct TObject;
|
||||
struct TCreateObject {
|
||||
TCreateObject() {}
|
||||
virtual ~TCreateObject() = 0;
|
||||
virtual bool create(TObject**, JStudio::stb::data::TParse_TBlock_object const&) = 0;
|
||||
|
||||
/* 0x4 */ JGadget::TLinkListNode mNode;
|
||||
}; // Size: 0xC
|
||||
|
||||
struct TFactory : public stb::TFactory {
|
||||
TFactory() {}
|
||||
|
||||
virtual ~TFactory();
|
||||
virtual TObject* create(JStudio::stb::data::TParse_TBlock_object const&);
|
||||
|
||||
void appendCreateObject(JStudio::TCreateObject*);
|
||||
|
||||
/* 0x04 */ JGadget::TLinkList<TCreateObject, -4> mList;
|
||||
/* 0x10 */ fvb::TFactory fvb_Factory;
|
||||
/* 0x14 */ ctb::TFactory ctb_Factory;
|
||||
};
|
||||
|
||||
class TControl : public stb::TControl {
|
||||
public:
|
||||
struct TTransform_translation_rotation_scaling {};
|
||||
struct TTransform_position {};
|
||||
|
||||
TControl();
|
||||
virtual ~TControl();
|
||||
void setFactory(JStudio::TFactory*);
|
||||
int transformOnSet_setOrigin_TxyzRy(Vec const&, f32);
|
||||
int transformOnGet_setOrigin_TxyzRy(Vec const&, f32);
|
||||
int transform_setOrigin_ctb(JStudio::ctb::TObject const&);
|
||||
bool transform_setOrigin_ctb_index(u32);
|
||||
|
||||
void stb_destroyObject_all() { stb::TControl::destroyObject_all(); }
|
||||
void fvb_destroyObject_all() { fvb_Control.destroyObject_all(); }
|
||||
void ctb_destroyObject_all() { ctb_Control.destroyObject_all(); }
|
||||
|
||||
void destroyObject_all() {
|
||||
stb_destroyObject_all();
|
||||
fvb_destroyObject_all();
|
||||
ctb_destroyObject_all();
|
||||
}
|
||||
|
||||
void transformOnSet_enable(bool param_0) { mTransformOnSet = param_0; }
|
||||
void transformOnGet_enable(bool param_0) { mTransformOnGet = param_0; }
|
||||
|
||||
void transform_enable(bool param_0) {
|
||||
transformOnSet_enable(param_0);
|
||||
transformOnGet_enable(param_0);
|
||||
}
|
||||
|
||||
void transform_setOrigin_TxyzRy(const Vec& xyz, f32 rotY) {
|
||||
transformOnSet_setOrigin_TxyzRy(xyz, rotY);
|
||||
transformOnGet_setOrigin_TxyzRy(xyz, rotY);
|
||||
}
|
||||
|
||||
void transform_setOrigin(const Vec& xyz, f32 rotY) {
|
||||
transform_setOrigin_TxyzRy(xyz, rotY);
|
||||
}
|
||||
|
||||
void setSecondPerFrame(f64 param_0) { mSecondPerFrame = param_0; }
|
||||
f64 getSecondPerFrame() const { return mSecondPerFrame; }
|
||||
|
||||
ctb::TObject* ctb_getObject_index(u32 index) {
|
||||
return ctb_Control.getObject_index(index);
|
||||
}
|
||||
|
||||
fvb::TObject* fvb_getObject(const void* param_1, u32 param_2) {
|
||||
return fvb_Control.getObject(param_1, param_2);
|
||||
}
|
||||
|
||||
fvb::TObject* fvb_getObject_index(u32 index) {
|
||||
return fvb_Control.getObject_index(index);
|
||||
}
|
||||
|
||||
TFunctionValue* getFunctionValue(const void* param_1, u32 param_2) {
|
||||
fvb::TObject* obj = fvb_getObject(param_1, param_2);
|
||||
if (obj == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return obj->referFunctionValue();
|
||||
}
|
||||
|
||||
TFunctionValue* getFunctionValue_index(u32 index) {
|
||||
fvb::TObject* obj = fvb_getObject_index(index);
|
||||
if (obj == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return obj->referFunctionValue();
|
||||
}
|
||||
|
||||
/* 0x58 */ f64 mSecondPerFrame;
|
||||
/* 0x60 */ fvb::TControl fvb_Control;
|
||||
/* 0x74 */ ctb::TControl ctb_Control;
|
||||
/* 0x88 */ bool mTransformOnSet;
|
||||
/* 0x89 */ bool mTransformOnGet;
|
||||
/* 0x8C */ Vec field_0x8c;
|
||||
/* 0x98 */ Vec field_0x98;
|
||||
/* 0xA4 */ f32 mTransformOnSet_RotationY;
|
||||
/* 0xA8 */ f32 field_0xa8;
|
||||
/* 0xAC */ Mtx mTransformOnSet_Matrix;
|
||||
/* 0xDC */ Mtx mTransformOnGet_Matrix;
|
||||
};
|
||||
|
||||
struct TParse : public stb::TParse {
|
||||
TParse(JStudio::TControl*);
|
||||
bool parseBlock_block_fvb_(JStudio::stb::data::TParse_TBlock const&, u32);
|
||||
bool parseBlock_block_ctb_(JStudio::stb::data::TParse_TBlock const&, u32);
|
||||
|
||||
virtual ~TParse();
|
||||
virtual bool parseHeader(JStudio::stb::data::TParse_THeader const&, u32);
|
||||
virtual bool parseBlock_block(JStudio::stb::data::TParse_TBlock const&, u32);
|
||||
|
||||
TControl* getControl() { return (TControl*)stb::TParse::getControl(); }
|
||||
};
|
||||
|
||||
}; // namespace JStudio
|
||||
|
||||
#endif /* JSTUDIO_CONTROL_H */
|
||||
@@ -0,0 +1,336 @@
|
||||
#ifndef JSTUDIO_OBJECT_H
|
||||
#define JSTUDIO_OBJECT_H
|
||||
|
||||
#include "JSystem/JStudio/JStudio/ctb.h"
|
||||
#include "JSystem/JStudio/JStudio/jstudio-control.h"
|
||||
#include "limits.h"
|
||||
|
||||
typedef struct _GXColor GXColor;
|
||||
|
||||
namespace JStudio {
|
||||
namespace data {
|
||||
enum TEOperationData {
|
||||
UNK_0x1 = 0x1,
|
||||
UNK_0x2 = 0x2,
|
||||
UNK_0x3 = 0x3,
|
||||
UNK_0x10 = 0x10,
|
||||
UNK_0x12 = 0x12,
|
||||
UNK_0x19 = 0x19,
|
||||
};
|
||||
};
|
||||
|
||||
struct TAdaptor;
|
||||
struct TVariableValue {
|
||||
struct TOutput {
|
||||
virtual void operator()(f32, JStudio::TAdaptor*) const = 0;
|
||||
~TOutput();
|
||||
};
|
||||
|
||||
struct TOutput_none_ {
|
||||
~TOutput_none_();
|
||||
void operator()(f32, JStudio::TAdaptor*) const;
|
||||
};
|
||||
|
||||
void update(f64, JStudio::TAdaptor*);
|
||||
static void update_immediate_(JStudio::TVariableValue*, f64);
|
||||
static void update_time_(JStudio::TVariableValue*, f64);
|
||||
static void update_functionValue_(JStudio::TVariableValue*, f64);
|
||||
TVariableValue();
|
||||
|
||||
void setValue_immediate(f32 value) {
|
||||
field_0x8 = &update_immediate_;
|
||||
field_0x4 = 0;
|
||||
field_0xc.val = value;
|
||||
}
|
||||
|
||||
void setValue_none() {
|
||||
field_0x8 = NULL;
|
||||
}
|
||||
|
||||
void setValue_time(f32 value) {
|
||||
field_0x8 = &update_time_;
|
||||
field_0x4 = 0;
|
||||
field_0xc.val = value;
|
||||
}
|
||||
|
||||
void setValue_functionValue(TFunctionValue* value) {
|
||||
field_0x8 = &update_functionValue_;
|
||||
field_0x4 = 0;
|
||||
field_0xc.fv = value;
|
||||
}
|
||||
|
||||
f32 getValue() const { return mValue; }
|
||||
|
||||
template<typename T>
|
||||
T getValue_clamp() const {
|
||||
f32 val = mValue;
|
||||
if (val <= std::numeric_limits<T>::min()) {
|
||||
return std::numeric_limits<T>::min();
|
||||
} else if (val >= std::numeric_limits<T>::max()) {
|
||||
return std::numeric_limits<T>::max();
|
||||
}
|
||||
return val;
|
||||
}
|
||||
u8 getValue_uint8() const { return getValue_clamp<u8>(); }
|
||||
|
||||
void forward(u32 param_0) {
|
||||
if (std::numeric_limits<u32>::max() - field_0x4 <= param_0) {
|
||||
field_0x4 = std::numeric_limits<u32>::max();
|
||||
} else {
|
||||
field_0x4 += param_0;
|
||||
}
|
||||
}
|
||||
|
||||
static u8 soOutput_none_[4 + 4 /* padding */];
|
||||
|
||||
/* 0x00 */ f32 mValue;
|
||||
/* 0x04 */ u32 field_0x4;
|
||||
/* 0x08 */ void (*field_0x8)(TVariableValue*, double);
|
||||
/* 0x0C */ union {
|
||||
TFunctionValue* fv;
|
||||
f32 val;
|
||||
} field_0xc;
|
||||
/* 0x10 */ TOutput* pOutput_;
|
||||
}; // Size: 0x14
|
||||
|
||||
typedef void (TObject::*paragraphFunc)(u32, void const*, u32);
|
||||
|
||||
class TObject : public stb::TObject {
|
||||
public:
|
||||
TObject(JStudio::stb::data::TParse_TBlock_object const&, JStudio::TAdaptor*);
|
||||
void forward_value(u32);
|
||||
|
||||
virtual ~TObject() = 0;
|
||||
virtual void do_begin();
|
||||
virtual void do_end();
|
||||
virtual void do_paragraph(u32, void const*, u32) = 0;
|
||||
virtual void do_wait(u32);
|
||||
virtual void do_data(void const*, u32, void const*, u32);
|
||||
|
||||
TAdaptor* getAdaptor() { return mpAdaptor; }
|
||||
TControl* getControl() { return (TControl*)stb::TObject::getControl(); }
|
||||
|
||||
void prepareAdaptor() {
|
||||
if (mpAdaptor != NULL) {
|
||||
// mpAdaptor->adaptor_setObject_(this);
|
||||
// mpAdaptor->adaptor_do_begin();
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T* createFromAdaptor(const stb::data::TParse_TBlock_object& param_0, T* param_1) {
|
||||
T* n = new T(param_0, param_1);
|
||||
|
||||
if (n == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
n->prepareAdaptor();
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/* 0x34 */ TAdaptor* mpAdaptor;
|
||||
};
|
||||
|
||||
struct TAdaptor {
|
||||
struct TSetVariableValue_immediate {
|
||||
u32 field_0x0;
|
||||
f32 field_0x4;
|
||||
};
|
||||
typedef void (*setVarFunc)(JStudio::TAdaptor*, JStudio::TControl*, u32, void const*, u32);
|
||||
virtual ~TAdaptor() = 0;
|
||||
virtual void adaptor_do_prepare();
|
||||
virtual void adaptor_do_begin();
|
||||
virtual void adaptor_do_end();
|
||||
virtual void adaptor_do_update(u32);
|
||||
virtual void adaptor_do_data(void const*, u32, void const*, u32);
|
||||
|
||||
void adaptor_setVariableValue(JStudio::TControl*, u32,
|
||||
JStudio::data::TEOperationData, void const*, u32);
|
||||
void adaptor_setVariableValue_n(JStudio::TControl*, u32 const*, u32,
|
||||
JStudio::data::TEOperationData, void const*,
|
||||
u32);
|
||||
void
|
||||
adaptor_setVariableValue_immediate(JStudio::TAdaptor::TSetVariableValue_immediate const*);
|
||||
void adaptor_setVariableValue_Vec(u32 const*, Vec const&);
|
||||
void adaptor_getVariableValue_Vec(Vec*, u32 const*) const;
|
||||
void adaptor_setVariableValue_GXColor(u32 const*, GXColor const&);
|
||||
void adaptor_getVariableValue_GXColor(GXColor*, u32 const*) const;
|
||||
void adaptor_updateVariableValue(JStudio::TControl*, u32);
|
||||
static void adaptor_setVariableValue_VOID_(JStudio::TAdaptor*, JStudio::TControl*, u32,
|
||||
void const*, u32);
|
||||
static void adaptor_setVariableValue_IMMEDIATE_(JStudio::TAdaptor*, JStudio::TControl*,
|
||||
u32, void const*, u32);
|
||||
static void adaptor_setVariableValue_TIME_(JStudio::TAdaptor*, JStudio::TControl*, u32,
|
||||
void const*, u32);
|
||||
static void adaptor_setVariableValue_FVR_NAME_(JStudio::TAdaptor*, JStudio::TControl*,
|
||||
u32, void const*, u32);
|
||||
static void adaptor_setVariableValue_FVR_INDEX_(JStudio::TAdaptor*, JStudio::TControl*,
|
||||
u32, void const*, u32);
|
||||
|
||||
void adaptor_setObject_(const TObject* pObject) {
|
||||
pObject_ = pObject;
|
||||
}
|
||||
|
||||
TVariableValue* adaptor_referVariableValue(u32 param_0) {
|
||||
return &pValue_[param_0];
|
||||
}
|
||||
|
||||
void adaptor_setVariableValue_immediate(u32 param_0, f32 param_1) {
|
||||
adaptor_referVariableValue(param_0)->setValue_immediate(param_1);
|
||||
}
|
||||
|
||||
const TVariableValue* adaptor_getVariableValue(u32 param_0) const {
|
||||
return &pValue_[param_0];
|
||||
}
|
||||
|
||||
/* 0x4 */ const TObject* pObject_;
|
||||
/* 0x8 */ TVariableValue* pValue_;
|
||||
/* 0xC */ u32 u;
|
||||
};
|
||||
|
||||
struct TAdaptor_actor : public TAdaptor {
|
||||
virtual ~TAdaptor_actor() = 0;
|
||||
|
||||
/* 0x10 */ TVariableValue mValue[14];
|
||||
|
||||
static u8 const sauVariableValue_3_TRANSLATION_XYZ[12];
|
||||
static u8 const sauVariableValue_3_ROTATION_XYZ[12];
|
||||
static u8 const sauVariableValue_3_SCALING_XYZ[12];
|
||||
}; // Size: 0x128
|
||||
|
||||
struct TObject_actor : public TObject {
|
||||
TObject_actor(JStudio::stb::data::TParse_TBlock_object const&,
|
||||
JStudio::TAdaptor_actor*);
|
||||
|
||||
virtual ~TObject_actor();
|
||||
virtual void do_paragraph(u32, void const*, u32);
|
||||
};
|
||||
|
||||
struct TAdaptor_ambientLight : public TAdaptor {
|
||||
virtual ~TAdaptor_ambientLight() = 0;
|
||||
|
||||
/* 0x10 */ TVariableValue mValue[4];
|
||||
|
||||
static u8 const sauVariableValue_3_COLOR_RGB[12];
|
||||
static u8 const sauVariableValue_4_COLOR_RGBA[16];
|
||||
};
|
||||
|
||||
struct TObject_ambientLight : public TObject {
|
||||
TObject_ambientLight(JStudio::stb::data::TParse_TBlock_object const&,
|
||||
JStudio::TAdaptor_ambientLight*);
|
||||
|
||||
virtual ~TObject_ambientLight();
|
||||
virtual void do_paragraph(u32, void const*, u32);
|
||||
};
|
||||
|
||||
struct TAdaptor_camera : public TAdaptor {
|
||||
virtual ~TAdaptor_camera() = 0;
|
||||
|
||||
/* 0x10 */ TVariableValue mValue[12];
|
||||
|
||||
static u8 const sauVariableValue_3_POSITION_XYZ[12];
|
||||
static u8 const sauVariableValue_3_TARGET_POSITION_XYZ[12];
|
||||
static u8 sauVariableValue_2_DISTANCE_NEAR_FAR[8];
|
||||
};
|
||||
|
||||
struct TObject_camera : public TObject {
|
||||
TObject_camera(JStudio::stb::data::TParse_TBlock_object const&,
|
||||
JStudio::TAdaptor_camera*);
|
||||
|
||||
virtual ~TObject_camera();
|
||||
virtual void do_paragraph(u32, void const*, u32);
|
||||
};
|
||||
|
||||
struct TAdaptor_fog : public TAdaptor {
|
||||
virtual ~TAdaptor_fog() = 0;
|
||||
|
||||
/* 0x10 */ TVariableValue mValue[6];
|
||||
|
||||
static u8 const sauVariableValue_3_COLOR_RGB[12];
|
||||
static u8 const sauVariableValue_4_COLOR_RGBA[16];
|
||||
static u8 sauVariableValue_2_RANGE_BEGIN_END[8];
|
||||
};
|
||||
|
||||
struct TObject_fog : public TObject {
|
||||
TObject_fog(JStudio::stb::data::TParse_TBlock_object const&,
|
||||
JStudio::TAdaptor_fog*);
|
||||
|
||||
virtual ~TObject_fog();
|
||||
virtual void do_paragraph(u32, void const*, u32);
|
||||
};
|
||||
|
||||
struct TAdaptor_light : public TAdaptor {
|
||||
virtual ~TAdaptor_light() = 0;
|
||||
|
||||
/* 0x10 */ TVariableValue mValue[13];
|
||||
|
||||
static u8 const sauVariableValue_3_COLOR_RGB[12];
|
||||
static u8 const sauVariableValue_4_COLOR_RGBA[16];
|
||||
static u8 const sauVariableValue_3_POSITION_XYZ[12];
|
||||
static u8 const sauVariableValue_3_TARGET_POSITION_XYZ[12];
|
||||
static u8 sauVariableValue_2_DIRECTION_THETA_PHI[8];
|
||||
};
|
||||
|
||||
struct TObject_light : public TObject {
|
||||
TObject_light(JStudio::stb::data::TParse_TBlock_object const&,
|
||||
JStudio::TAdaptor_light*);
|
||||
|
||||
virtual ~TObject_light();
|
||||
virtual void do_paragraph(u32, void const*, u32);
|
||||
};
|
||||
|
||||
struct TAdaptor_message : public TAdaptor {
|
||||
virtual ~TAdaptor_message() = 0;
|
||||
};
|
||||
|
||||
struct TObject_message : public TObject {
|
||||
TObject_message(JStudio::stb::data::TParse_TBlock_object const&,
|
||||
JStudio::TAdaptor_message*);
|
||||
|
||||
virtual ~TObject_message();
|
||||
virtual void do_paragraph(u32, void const*, u32);
|
||||
};
|
||||
|
||||
struct TAdaptor_particle : public TAdaptor {
|
||||
virtual ~TAdaptor_particle() = 0;
|
||||
|
||||
/* 0x10 */ TVariableValue mValue[20];
|
||||
|
||||
static u8 const sauVariableValue_3_TRANSLATION_XYZ[12];
|
||||
static u8 const sauVariableValue_3_ROTATION_XYZ[12];
|
||||
static u8 const sauVariableValue_3_SCALING_XYZ[12];
|
||||
static u8 const sauVariableValue_3_COLOR_RGB[12];
|
||||
static u8 const sauVariableValue_4_COLOR_RGBA[16];
|
||||
static u8 const sauVariableValue_3_COLOR1_RGB[12];
|
||||
static u8 const sauVariableValue_4_COLOR1_RGBA[16];
|
||||
};
|
||||
|
||||
struct TObject_particle : public TObject {
|
||||
TObject_particle(JStudio::stb::data::TParse_TBlock_object const&,
|
||||
JStudio::TAdaptor_particle*);
|
||||
|
||||
virtual ~TObject_particle();
|
||||
virtual void do_paragraph(u32, void const*, u32);
|
||||
};
|
||||
|
||||
struct TAdaptor_sound : public TAdaptor {
|
||||
virtual ~TAdaptor_sound() = 0;
|
||||
|
||||
/* 0x10 */ TVariableValue mValue[13];
|
||||
|
||||
static u8 const sauVariableValue_3_POSITION_XYZ[12];
|
||||
}; // Size: 0x114
|
||||
|
||||
struct TObject_sound : public TObject {
|
||||
TObject_sound(JStudio::stb::data::TParse_TBlock_object const&,
|
||||
JStudio::TAdaptor_sound*);
|
||||
|
||||
virtual ~TObject_sound();
|
||||
virtual void do_paragraph(u32, void const*, u32);
|
||||
};
|
||||
|
||||
}; // namespace JStudio
|
||||
|
||||
#endif /* JSTUDIO_OBJECT_H */
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef OBJECT_ID_H
|
||||
#define OBJECT_ID_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
namespace JStudio {
|
||||
namespace object {
|
||||
|
||||
|
||||
struct TIDData {
|
||||
public:
|
||||
TIDData(const void* id, u32 id_size) : mID(id), mID_size(id_size) {}
|
||||
|
||||
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) {}
|
||||
};
|
||||
|
||||
} // namespace object
|
||||
} // namespace JStudio
|
||||
|
||||
#endif /* OBJECT_ID_H */
|
||||
@@ -0,0 +1,112 @@
|
||||
#ifndef STB_DATA_PARSE_H
|
||||
#define STB_DATA_PARSE_H
|
||||
|
||||
#include "JSystem/JGadget/binary.h"
|
||||
#include "JSystem/JStudio/JStudio/stb-data.h"
|
||||
|
||||
using namespace JGadget::binary;
|
||||
|
||||
namespace JStudio {
|
||||
namespace stb {
|
||||
namespace data {
|
||||
|
||||
// Parses a THeader
|
||||
class TParse_THeader : public TParseData_aligned<4> {
|
||||
public:
|
||||
TParse_THeader(const void* p) : TParseData_aligned<4>(p) {}
|
||||
|
||||
const THeader* get() const { return (THeader*)getRaw(); }
|
||||
const void* getContent() const { return ((THeader*)getRaw())->content; }
|
||||
const char* get_signature() const { return get()->signature; }
|
||||
u16 get_byteOrder() const { return get()->byte_order; }
|
||||
u16 get_version() const { return get()->version; }
|
||||
u32 get_blockNumber() const { return get()->block_number; }
|
||||
const THeader::Target& get_target() const { return get()->target; }
|
||||
};
|
||||
|
||||
class TParse_TBlock : public TParseData_aligned<4> {
|
||||
public:
|
||||
TParse_TBlock(const void* content) : TParseData_aligned<4>(content) {}
|
||||
|
||||
const TBlock* get() const { return (TBlock*)getRaw(); }
|
||||
const TBlock* getNext() const { return (TBlock*)((u8*)getRaw() + get_size()); }
|
||||
|
||||
u32 get_size() const { return get()->size; }
|
||||
u32 get_type() const { return get()->type; }
|
||||
const void* getContent() const { return ((char*)getRaw()) + 8;}
|
||||
};
|
||||
|
||||
class TParse_TSequence : public TParseData_aligned<4> {
|
||||
public:
|
||||
struct TData {
|
||||
/* 0x00 */ u8 type;
|
||||
/* 0x04 */ u32 param;
|
||||
/* 0x08 */ const void* content;
|
||||
/* 0x0C */ const void* next;
|
||||
};
|
||||
|
||||
TParse_TSequence(const void* content) : TParseData_aligned<4>(content) {}
|
||||
void getData(TData*) const;
|
||||
|
||||
const void* get() const { return getRaw(); }
|
||||
u32 get_head() const { return *(u32*)get(); }
|
||||
};
|
||||
|
||||
class TParse_TParagraph : public TParseData_aligned<4> {
|
||||
public:
|
||||
struct TData {
|
||||
/* 0x00 */ u32 type;
|
||||
/* 0x04 */ u32 param;
|
||||
/* 0x08 */ const void* content;
|
||||
/* 0x0C */ const void* next;
|
||||
};
|
||||
|
||||
TParse_TParagraph(const void* content) : TParseData_aligned<4>(content) {}
|
||||
void getData(TData*) const;
|
||||
};
|
||||
|
||||
struct TParse_TParagraph_data : public TParseData_aligned<4> {
|
||||
struct TData {
|
||||
/* 0x00 */ u8 status;
|
||||
/* 0x04 */ u32 dataSize;
|
||||
/* 0x08 */ u32 _8;
|
||||
/* 0x0C */ const void* fileCount;
|
||||
/* 0x10 */ const void* _10;
|
||||
};
|
||||
|
||||
TParse_TParagraph_data(const void* content) : TParseData_aligned<4>(content) {}
|
||||
void getData(TData* pData) const;
|
||||
};
|
||||
|
||||
// Parses a TObject ("demo object")
|
||||
class TParse_TBlock_object : public TParse_TBlock {
|
||||
public:
|
||||
TParse_TBlock_object(const void* content) : TParse_TBlock(content) {}
|
||||
|
||||
const TBlock_object* get() const { return (TBlock_object*)getRaw(); }
|
||||
const void* getContent() const {
|
||||
return ((TBlock_object*)getRaw())->id + align_roundUp(get_IDSize(), 4);
|
||||
}
|
||||
|
||||
u16 get_flag() const { return get()->flag; }
|
||||
u16 get_IDSize() const { return get()->id_size; }
|
||||
const void* get_ID() const { return get()->id; }
|
||||
};
|
||||
|
||||
class TParse_TParagraph_dataID : public TParseData_aligned<4> {
|
||||
public:
|
||||
TParse_TParagraph_dataID(const void* pContent) : TParseData_aligned<4>(pContent) {}
|
||||
|
||||
const TParagraph* get() const { return (TParagraph*)getRaw(); }
|
||||
u16 get_IDSize() const { return get()->id_size; }
|
||||
const void* get_ID() const { return get()->id; }
|
||||
const void* getContent() const {
|
||||
return ((TParagraph*)getRaw())->id + align_roundUp(get_IDSize(), 4);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace data
|
||||
} // namespace stb
|
||||
} // namespace JStudio
|
||||
|
||||
#endif /* STB_DATA_PARSE_H */
|
||||
@@ -0,0 +1,69 @@
|
||||
#ifndef STB_DATA_H
|
||||
#define STB_DATA_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
namespace JStudio {
|
||||
namespace stb {
|
||||
namespace data {
|
||||
|
||||
const int guBit_TSequence_type = 24;
|
||||
|
||||
const int BLOCK_SOUND = 'JSND';
|
||||
const int BLOCK_ACTOR = 'JACT';
|
||||
const int BLOCK_AMBIENTLIGHT = 'JABL';
|
||||
const int BLOCK_CAMERA = 'JCMR';
|
||||
const int BLOCK_FOG = 'JFOG';
|
||||
const int BLOCK_LIGHT = 'JLIT';
|
||||
const int BLOCK_MESSAGE = 'JMSG';
|
||||
const int BLOCK_PARTICLE = 'JPTC';
|
||||
const int BLOCK_NONE = -1;
|
||||
|
||||
// Used to expand a signed 24 int to a signed 32 int
|
||||
const u32 gu32Mask_TSequence_value_signExpansion = 0xFF000000;
|
||||
extern const u32 ga4cSignature; // 'STB/0'
|
||||
extern const s32 gauDataSize_TEParagraph_data[8];
|
||||
|
||||
inline void toString_block(char* a5c, u32 arg1) {
|
||||
// from debug, todo
|
||||
}
|
||||
|
||||
struct THeader {
|
||||
struct Target {
|
||||
/* 0x00 */ char name[8]; // "jstudio"
|
||||
/* 0x08 */ u16 _8[3];
|
||||
/* 0x0E */ u16 target_version;
|
||||
};
|
||||
|
||||
/* 0x00 */ char signature[4];
|
||||
/* 0x04 */ u16 byte_order; // must be 0xFEFF
|
||||
/* 0x06 */ u16 version; // 0-1 = obselete, 2-7 = OK
|
||||
/* 0x08 */ u32 _8;
|
||||
/* 0x0C */ u32 block_number;
|
||||
/* 0x10 */ Target target;
|
||||
/* 0x20 */ u8 content[0];
|
||||
};
|
||||
|
||||
struct TBlock {
|
||||
/* 0x0 */ u32 size;
|
||||
/* 0x4 */ u32 type; // char[4] JMSG, JSND, JACT, ...
|
||||
};
|
||||
|
||||
struct TBlock_object : TBlock {
|
||||
/* 0x8 */ u16 flag;
|
||||
/* 0xA */ u16 id_size;
|
||||
/* 0xC */ u8 id[0]; // unique identifier
|
||||
///* ??? */ u8 content[0];
|
||||
};
|
||||
|
||||
struct TParagraph {
|
||||
/* 0x0 */ u16 _0;
|
||||
/* 0x2 */ u16 id_size;
|
||||
/* 0x4 */ u8 id[0]; // unique identifier
|
||||
};
|
||||
|
||||
} // namespace data
|
||||
} // namespace stb
|
||||
} // namespace JStudio
|
||||
|
||||
#endif /* STB_DATA_H */
|
||||
@@ -0,0 +1,199 @@
|
||||
#ifndef STB_H
|
||||
#define STB_H
|
||||
|
||||
#include "JSystem/JGadget/linklist.h"
|
||||
#include "JSystem/JStudio/JStudio/object-id.h"
|
||||
#include "JSystem/JStudio/JStudio/stb-data-parse.h"
|
||||
#include "global.h"
|
||||
|
||||
namespace JStudio {
|
||||
struct TObject;
|
||||
namespace stb {
|
||||
|
||||
class TControl;
|
||||
|
||||
class TParse : public TParse_header_block {
|
||||
public:
|
||||
TParse(TControl*);
|
||||
virtual ~TParse();
|
||||
virtual bool parseHeader_next(void const**, u32*, u32);
|
||||
virtual bool parseBlock_next(void const**, u32*, u32);
|
||||
virtual bool parseHeader(data::TParse_THeader const&, u32);
|
||||
virtual bool parseBlock_block(data::TParse_TBlock const&, u32);
|
||||
virtual bool parseBlock_object(data::TParse_TBlock_object const&, u32);
|
||||
|
||||
TControl* getControl() const { return pControl; }
|
||||
|
||||
private:
|
||||
TControl* pControl;
|
||||
};
|
||||
|
||||
class TObject : public object::TObject_ID {
|
||||
public:
|
||||
enum TEStatus {
|
||||
/* 0x0 */ STATUS_STILL = 0,
|
||||
/* 0x1 */ STATUS_END = 1 << 0,
|
||||
/* 0x2 */ STATUS_WAIT = 1 << 1,
|
||||
/* 0x4 */ STATUS_SUSPEND = 1 << 2,
|
||||
/* 0x8 */ STATUS_INACTIVE = 1 << 3,
|
||||
};
|
||||
|
||||
TObject(data::TParse_TBlock_object const&);
|
||||
explicit TObject(u32, void const*, u32);
|
||||
virtual ~TObject();
|
||||
|
||||
void setFlag_operation(u8, int);
|
||||
void reset(void const*);
|
||||
u8 forward(u32);
|
||||
virtual void do_begin();
|
||||
virtual void do_end();
|
||||
virtual void do_paragraph(u32, void const*, u32);
|
||||
virtual void do_wait(u32);
|
||||
virtual void do_data(void const*, u32, void const*, u32);
|
||||
void process_sequence_();
|
||||
void process_paragraph_reserved_(u32, void const*, u32);
|
||||
|
||||
const char* toString_status(int status);
|
||||
|
||||
void on_begin() { do_begin(); }
|
||||
void on_end() { do_end(); }
|
||||
void on_paragraph(u32 arg1, const void* arg2, u32 arg3) { do_paragraph(arg1, arg2, arg3); }
|
||||
void on_wait(u32 arg1) { do_wait(arg1); }
|
||||
void on_data(const void* arg1, u32 arg2, const void* arg3, u32 arg4) {
|
||||
do_data(arg1, arg2, arg3, arg4);
|
||||
}
|
||||
|
||||
TControl* getControl() const { return pControl; }
|
||||
void setControl_(TControl* control) { pControl = control; }
|
||||
int getSuspend() const { return _20; }
|
||||
void setSuspend(s32 val) { _20 = val; }
|
||||
bool isSuspended() const { return getSuspend() > 0; }
|
||||
void suspend(s32 val) { _20 += val; }
|
||||
const void* getSequence() const { return pSequence; }
|
||||
void setSequence_(const void* arg1) { pSequence = arg1; }
|
||||
const void* getSequence_offset(s32 i_no) const {
|
||||
int s32Val = (s32)getSequence();
|
||||
return (const void*)(s32Val + i_no);
|
||||
}
|
||||
const void* getSequence_next() const { return pSequence_next; }
|
||||
void setSequence_next(const void* seq) { pSequence_next = seq; }
|
||||
u32 getWait() const { return u32Wait_; }
|
||||
void setWait(u32 wait) { u32Wait_ = wait; }
|
||||
TEStatus getStatus() const { return mStatus; }
|
||||
void setStatus_(TEStatus status) { mStatus = status; }
|
||||
u32 toInt32FromUInt24_(u32 val) {
|
||||
if (val & 0x800000) {
|
||||
val |= data::gu32Mask_TSequence_value_signExpansion;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
void setFlag_operation_(u32 u32Data) {
|
||||
ASSERT((u32Data >> data::guBit_TSequence_type) == 0);
|
||||
setFlag_operation(u32Data >> 16, u32Data & 0xFFFF);
|
||||
}
|
||||
|
||||
/* 0x10 */ JGadget::TLinkListNode ocObject_;
|
||||
|
||||
private:
|
||||
/* 0x14 */ TControl* pControl;
|
||||
/* 0x18 */ u32 signature;
|
||||
/* 0x1C */ u16 mFlag;
|
||||
/* 0x1E */ u8 bSequence_;
|
||||
/* 0x20 */ u32 _20; // "second per frame"?
|
||||
/* 0x24 */ const void* pSequence;
|
||||
/* 0x28 */ const void* pSequence_next;
|
||||
/* 0x2C */ u32 u32Wait_;
|
||||
/* 0x30 */ TEStatus mStatus;
|
||||
};
|
||||
|
||||
class TFactory {
|
||||
public:
|
||||
TFactory() {}
|
||||
|
||||
virtual ~TFactory();
|
||||
virtual JStudio::TObject* create(data::TParse_TBlock_object const&);
|
||||
virtual void destroy(TObject*);
|
||||
};
|
||||
|
||||
class TObject_control : public TObject {
|
||||
public:
|
||||
TObject_control(void const*, u32);
|
||||
~TObject_control() {}
|
||||
};
|
||||
|
||||
// Manages TObjects
|
||||
class TControl {
|
||||
public:
|
||||
TControl();
|
||||
virtual ~TControl();
|
||||
|
||||
void appendObject(TObject*);
|
||||
void removeObject(TObject*);
|
||||
void destroyObject(TObject*);
|
||||
void destroyObject_all();
|
||||
TObject* getObject(void const*, u32);
|
||||
u8 forward(u32);
|
||||
|
||||
void setStatus_(u32 status) { mStatus = status; }
|
||||
void resetStatus_() { setStatus_(0); }
|
||||
bool isSuspended() const { return _54 > 0; }
|
||||
TFactory* getFactory() const { return pFactory; }
|
||||
void setFactory(TFactory* factory) { pFactory = factory; }
|
||||
TObject_control& referObject_control() { return mObject_control; }
|
||||
int getSuspend() const { return _54; }
|
||||
void setSuspend(s32 suspend) { mObject_control.setSuspend(suspend); }
|
||||
|
||||
private:
|
||||
/* 0x04 */ u32 _4;
|
||||
/* 0x08 */ u32 _8;
|
||||
/* 0x0C */ TFactory* pFactory;
|
||||
/* 0x10 */ JGadget::TLinkList<TObject, -12> mObjectContainer;
|
||||
/* 0x1C */ u32 mStatus;
|
||||
/* 0x20 */ TObject_control mObject_control;
|
||||
/* 0x54 */ s32 _54;
|
||||
};
|
||||
|
||||
template <int T>
|
||||
struct TParseData {
|
||||
TParseData(const void* pContent) {
|
||||
data::TParse_TParagraph_data data(pContent);
|
||||
set(data);
|
||||
}
|
||||
|
||||
void set(const data::TParse_TParagraph_data& data) {
|
||||
//data::TParse_TParagraph_data::TData* p = (data::TParse_TParagraph_data::TData*)this;
|
||||
data.getData(m_data);
|
||||
}
|
||||
|
||||
bool isEnd() const {
|
||||
return m_data->_0 == 0;
|
||||
}
|
||||
|
||||
bool empty() const {
|
||||
return m_data->_c == NULL;
|
||||
}
|
||||
|
||||
bool isValid() const {
|
||||
return !empty() && m_data->_0 == 50;
|
||||
}
|
||||
|
||||
data::TParse_TParagraph_data::TData* m_data;
|
||||
};
|
||||
|
||||
template <int T>
|
||||
struct TParseData_fixed : public TParseData<T> {
|
||||
TParseData_fixed(const void* pContent) : TParseData(pContent) {}
|
||||
|
||||
const void* getNext() const {
|
||||
return m_data->_c;
|
||||
}
|
||||
|
||||
bool isValid() const {
|
||||
return TParseData::isValid() && getNext() != NULL;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace stb
|
||||
} // namespace JStudio
|
||||
|
||||
#endif /* STB_H */
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
class JPABaseEmitter;
|
||||
class mDoExt_bckAnm;
|
||||
class J3DNode;
|
||||
|
||||
class daStandItem_c : public fopAc_ac_c {
|
||||
public:
|
||||
|
||||
@@ -3,21 +3,80 @@
|
||||
// Translation Unit: stb-data-parse.cpp
|
||||
//
|
||||
|
||||
#include "stb-data-parse.h"
|
||||
#include "JSystem/JStudio/JStudio/stb-data-parse.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
namespace JStudio {
|
||||
namespace stb {
|
||||
namespace data {
|
||||
|
||||
/* 80275A64-80275AB4 .text getData__Q47JStudio3stb4data16TParse_TSequenceCFPQ57JStudio3stb4data16TParse_TSequence5TData */
|
||||
void JStudio::stb::data::TParse_TSequence::getData(JStudio::stb::data::TParse_TSequence::TData*) const {
|
||||
/* Nonmatching */
|
||||
void TParse_TSequence::getData(TParse_TSequence::TData* pData) const {
|
||||
pData->content = NULL;
|
||||
pData->next = NULL;
|
||||
u32 head = get_head();
|
||||
u8 type = head >> 24;
|
||||
u32 param = head & 0xffffff;
|
||||
pData->type = type;
|
||||
pData->param = param;
|
||||
if (type != 0) {
|
||||
const void* next = (const void*)((int)getRaw() + 4);
|
||||
if (type <= 0x7f) {
|
||||
pData->next = next;
|
||||
} else {
|
||||
pData->content = next;
|
||||
pData->next = (const void*)((int)next + param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 80275AB4-80275B2C .text getData__Q47JStudio3stb4data17TParse_TParagraphCFPQ57JStudio3stb4data17TParse_TParagraph5TData */
|
||||
void JStudio::stb::data::TParse_TParagraph::getData(JStudio::stb::data::TParse_TParagraph::TData*) const {
|
||||
/* Nonmatching */
|
||||
void TParse_TParagraph::getData(TParse_TParagraph::TData* pData) const {
|
||||
const void* data = getRaw();
|
||||
u32 result;
|
||||
const void* next = parseVariableUInt_16_32_following(data, &result, &pData->type, NULL);
|
||||
pData->param = result;
|
||||
if (result == 0) {
|
||||
pData->content = NULL;
|
||||
pData->next = next;
|
||||
} else {
|
||||
pData->content = next;
|
||||
pData->next = (const void*)((int)next + align_roundUp(result, 4));
|
||||
}
|
||||
}
|
||||
|
||||
/* 80275B2C-80275BAC .text getData__Q47JStudio3stb4data22TParse_TParagraph_dataCFPQ57JStudio3stb4data22TParse_TParagraph_data5TData */
|
||||
void JStudio::stb::data::TParse_TParagraph_data::getData(JStudio::stb::data::TParse_TParagraph_data::TData*) const {
|
||||
/* Nonmatching */
|
||||
void TParse_TParagraph_data::getData(TParse_TParagraph_data::TData* pData) const {
|
||||
u8* set2;
|
||||
|
||||
int dSize = pData->dataSize = 0;
|
||||
pData->_8 = 0;
|
||||
pData->fileCount = NULL;
|
||||
pData->_10 = NULL;
|
||||
u8* filedata = (u8*)getRaw();
|
||||
if (filedata == NULL)
|
||||
return;
|
||||
u8 set = *filedata;
|
||||
pData->status = set & ~0x8;
|
||||
if (!set)
|
||||
return;
|
||||
int is8;
|
||||
int set3 = 1;
|
||||
is8 = set & 8;
|
||||
// Probably fake match
|
||||
if (set2 = (filedata + 1), is8) {
|
||||
set3 = *set2++;
|
||||
}
|
||||
pData->_8 = set3;
|
||||
pData->fileCount = set2;
|
||||
|
||||
if (!(set & 7))
|
||||
return;
|
||||
dSize = (gauDataSize_TEParagraph_data)[set &= 7];
|
||||
pData->dataSize = dSize;
|
||||
pData->_10 = (u8*)set2 + (dSize * set3);
|
||||
}
|
||||
|
||||
} // namespace data
|
||||
} // namespace stb
|
||||
} // namespace JStudio
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
// Translation Unit: stb-data.cpp
|
||||
//
|
||||
|
||||
#include "stb-data.h"
|
||||
#include "JSystem/JStudio/JStudio/stb-data.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
const s32 JStudio::stb::data::gauDataSize_TEParagraph_data[8] = {0x0, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40};
|
||||
const u32 JStudio::stb::data::ga4cSignature = 'STB\0';
|
||||
|
||||
@@ -3,176 +3,423 @@
|
||||
// Translation Unit: stb.cpp
|
||||
//
|
||||
|
||||
#include "stb.h"
|
||||
#include "JSystem/JStudio/JStudio/stb.h"
|
||||
#include "JSystem/JStudio/JStudio/jstudio-object.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "algorithm.h"
|
||||
#include "PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/string.h"
|
||||
|
||||
namespace JStudio {
|
||||
namespace stb {
|
||||
|
||||
/* 80274BE8-80274C30 .text __ct__Q37JStudio3stb7TObjectFUlPCvUl */
|
||||
JStudio::stb::TObject::TObject(unsigned long, const void*, unsigned long) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
TObject::TObject(u32 arg1, const void* id, u32 id_size)
|
||||
: TObject_ID(id, id_size), pControl(NULL), signature(arg1), mFlag(0), bSequence_(0), _20(0),
|
||||
pSequence(NULL), pSequence_next(NULL), u32Wait_(0), mStatus(STATUS_STILL) {}
|
||||
|
||||
/* 80274C30-80274CAC .text __ct__Q37JStudio3stb7TObjectFRCQ47JStudio3stb4data20TParse_TBlock_object */
|
||||
JStudio::stb::TObject::TObject(const JStudio::stb::data::TParse_TBlock_object&) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
TObject::TObject(const data::TParse_TBlock_object& object)
|
||||
: TObject_ID(object.get_ID(), object.get_IDSize()), pControl(NULL),
|
||||
signature(object.get_type()), mFlag(object.get_flag()), bSequence_(0), _20(0), pSequence(0),
|
||||
pSequence_next(object.getContent()), u32Wait_(0), mStatus(STATUS_STILL) {}
|
||||
|
||||
/* 80274CAC-80274CF4 .text __dt__Q37JStudio3stb7TObjectFv */
|
||||
JStudio::stb::TObject::~TObject() {
|
||||
/* Nonmatching */
|
||||
}
|
||||
TObject::~TObject() {}
|
||||
|
||||
/* 80274CF4-80274D4C .text setFlag_operation__Q37JStudio3stb7TObjectFUci */
|
||||
void JStudio::stb::TObject::setFlag_operation(unsigned char, int) {
|
||||
/* Nonmatching */
|
||||
void TObject::setFlag_operation(u8 op, int val) {
|
||||
switch (op) {
|
||||
default:
|
||||
break;
|
||||
case 1:
|
||||
mFlag |= val;
|
||||
break;
|
||||
case 2:
|
||||
mFlag &= val;
|
||||
break;
|
||||
case 3:
|
||||
mFlag ^= val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* 80274D4C-80274D64 .text reset__Q37JStudio3stb7TObjectFPCv */
|
||||
void JStudio::stb::TObject::reset(const void*) {
|
||||
/* Nonmatching */
|
||||
void TObject::reset(const void* arg1) {
|
||||
bSequence_ = 0;
|
||||
mStatus = STATUS_STILL;
|
||||
pSequence_next = arg1;
|
||||
u32Wait_ = 0;
|
||||
}
|
||||
|
||||
/* 80274D64-80274F74 .text forward__Q37JStudio3stb7TObjectFUl */
|
||||
void JStudio::stb::TObject::forward(unsigned long) {
|
||||
/* Nonmatching */
|
||||
u8 TObject::forward(u32 arg1) {
|
||||
u8 temp = false;
|
||||
|
||||
while (true) {
|
||||
if (mFlag & 0x8000) {
|
||||
switch (getStatus()) {
|
||||
default:
|
||||
setStatus_(STATUS_INACTIVE);
|
||||
if (bSequence_) {
|
||||
on_end();
|
||||
}
|
||||
break;
|
||||
case STATUS_INACTIVE:
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (getStatus() == STATUS_INACTIVE) {
|
||||
ASSERT(bSequence_);
|
||||
on_begin();
|
||||
setStatus_(STATUS_WAIT);
|
||||
}
|
||||
ASSERT(getStatus() != STATUS_INACTIVE);
|
||||
|
||||
TControl* control = getControl();
|
||||
if ((control != NULL && control->isSuspended()) || isSuspended()) {
|
||||
if (bSequence_) {
|
||||
ASSERT((getStatus() == STATUS_WAIT) || (getStatus() == STATUS_SUSPEND));
|
||||
setStatus_(STATUS_SUSPEND);
|
||||
on_wait(arg1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
void* nextseq = (void*)getSequence_next();
|
||||
setSequence_(nextseq);
|
||||
|
||||
if (nextseq == NULL) {
|
||||
if (bSequence_) {
|
||||
ASSERT(getStatus() != STATUS_STILL);
|
||||
if (!temp) {
|
||||
on_wait(0);
|
||||
}
|
||||
bSequence_ = false;
|
||||
setStatus_(STATUS_END);
|
||||
on_end();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!bSequence_) {
|
||||
ASSERT(getStatus() == STATUS_STILL);
|
||||
bSequence_ = true;
|
||||
on_begin();
|
||||
}
|
||||
setStatus_(STATUS_WAIT);
|
||||
if (u32Wait_ == 0) {
|
||||
process_sequence_();
|
||||
if (u32Wait_ == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
ASSERT(u32Wait_ > 0);
|
||||
|
||||
temp = true;
|
||||
if (arg1 >= u32Wait_) {
|
||||
u32 wait = u32Wait_;
|
||||
arg1 -= u32Wait_;
|
||||
u32Wait_ = 0;
|
||||
on_wait(wait);
|
||||
} else {
|
||||
u32Wait_ -= arg1;
|
||||
on_wait(arg1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 80274F74-80274F78 .text do_begin__Q37JStudio3stb7TObjectFv */
|
||||
void JStudio::stb::TObject::do_begin() {
|
||||
/* Nonmatching */
|
||||
}
|
||||
void TObject::do_begin() {}
|
||||
|
||||
/* 80274F78-80274F7C .text do_end__Q37JStudio3stb7TObjectFv */
|
||||
void JStudio::stb::TObject::do_end() {
|
||||
/* Nonmatching */
|
||||
}
|
||||
void TObject::do_end() {}
|
||||
|
||||
/* 80274F7C-80274F80 .text do_paragraph__Q37JStudio3stb7TObjectFUlPCvUl */
|
||||
void JStudio::stb::TObject::do_paragraph(unsigned long, const void*, unsigned long) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
void TObject::do_paragraph(u32, const void*, u32) {}
|
||||
|
||||
/* 80274F80-80274F84 .text do_wait__Q37JStudio3stb7TObjectFUl */
|
||||
void JStudio::stb::TObject::do_wait(unsigned long) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
void TObject::do_wait(u32) {}
|
||||
|
||||
/* 80274F84-80274F88 .text do_data__Q37JStudio3stb7TObjectFPCvUlPCvUl */
|
||||
void JStudio::stb::TObject::do_data(const void*, unsigned long, const void*, unsigned long) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
void TObject::do_data(const void*, u32, const void*, u32) {}
|
||||
|
||||
/* 80274F88-802750DC .text process_sequence___Q37JStudio3stb7TObjectFv */
|
||||
void process_sequence___Q37JStudio3stb7TObjectFv {
|
||||
/* Nonmatching */
|
||||
void TObject::process_sequence_() {
|
||||
data::TParse_TSequence seq(getSequence());
|
||||
|
||||
data::TParse_TSequence::TData dat;
|
||||
|
||||
seq.getData(&dat);
|
||||
u8 type = dat.type;
|
||||
u32 u32Value = dat.param;
|
||||
const void* pContent = dat.content;
|
||||
const void* pNext = dat.next;
|
||||
setSequence_next(dat.next);
|
||||
|
||||
switch (type) {
|
||||
case 0:
|
||||
JUT_EXPECT(u32Value == 0);
|
||||
JUT_EXPECT(pContent == 0);
|
||||
break;
|
||||
case 1:
|
||||
JUT_EXPECT(pContent == 0);
|
||||
setFlag_operation_(u32Value);
|
||||
break;
|
||||
case 2:
|
||||
JUT_EXPECT(pContent == 0);
|
||||
setWait(u32Value);
|
||||
break;
|
||||
case 3:
|
||||
JUT_EXPECT(pContent == 0);
|
||||
s32 off = toInt32FromUInt24_(u32Value);
|
||||
void* nextseq = (void*)getSequence_offset(off);
|
||||
setSequence_next(nextseq);
|
||||
break;
|
||||
case 4:
|
||||
JUT_EXPECT(pContent == 0);
|
||||
u32 val = toInt32FromUInt24_(u32Value);
|
||||
suspend(val);
|
||||
break;
|
||||
case 0x80:
|
||||
ASSERT(pContent != 0);
|
||||
void* p = (void*)pContent;
|
||||
data::TParse_TParagraph para(NULL);
|
||||
while (p < pNext) {
|
||||
para.setRaw(p);
|
||||
|
||||
data::TParse_TParagraph::TData para_dat;
|
||||
para.getData(¶_dat);
|
||||
if (para_dat.type <= 0xff) {
|
||||
process_paragraph_reserved_(para_dat.type, para_dat.content, para_dat.param);
|
||||
} else {
|
||||
on_paragraph(para_dat.type, para_dat.content, para_dat.param);
|
||||
}
|
||||
p = (void*)para_dat.next;
|
||||
ASSERT(p != 0);
|
||||
}
|
||||
JUT_EXPECT(p == pNext);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* 802750DC-802751C4 .text process_paragraph_reserved___Q37JStudio3stb7TObjectFUlPCvUl */
|
||||
void process_paragraph_reserved___Q37JStudio3stb7TObjectFUlPCvUl {
|
||||
/* Nonmatching */
|
||||
void TObject::process_paragraph_reserved_(u32 arg1, const void* pContent, u32 uSize) {
|
||||
switch (arg1) {
|
||||
case 0x1:
|
||||
setFlag_operation_(*(u32*)pContent);
|
||||
break;
|
||||
case 0x2:
|
||||
setWait(*(u32*)pContent);
|
||||
break;
|
||||
case 0x3:
|
||||
const void* seq = getSequence_offset(*(s32*)pContent);
|
||||
setSequence_next(seq);
|
||||
break;
|
||||
case 0x80:
|
||||
on_data(NULL, 0, pContent, uSize);
|
||||
break;
|
||||
case 0x81:
|
||||
data::TParse_TParagraph_dataID dataID(pContent);
|
||||
const void* temp = dataID.getContent();
|
||||
on_data(dataID.get_ID(), dataID.get_IDSize(), temp,
|
||||
uSize - ((u32)temp - (u32)dataID.getRaw()));
|
||||
break;
|
||||
case 0x82:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* 802751C4-80275210 .text __ct__Q37JStudio3stb15TObject_controlFPCvUl */
|
||||
JStudio::stb::TObject_control::TObject_control(const void*, unsigned long) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
TObject_control::TObject_control(const void* arg1, u32 arg2) : TObject(-1, arg1, arg2) {}
|
||||
|
||||
/* 80275210-80275290 .text __ct__Q37JStudio3stb8TControlFv */
|
||||
JStudio::stb::TControl::TControl() {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 80275290-802752F0 .text __dt__Q37JStudio3stb15TObject_controlFv */
|
||||
JStudio::stb::TObject_control::~TObject_control() {
|
||||
/* Nonmatching */
|
||||
TControl::TControl() : _4(0), _8(0), pFactory(NULL), mObject_control(NULL, 0), _54(0) {
|
||||
resetStatus_();
|
||||
mObject_control.setControl_(this);
|
||||
}
|
||||
|
||||
/* 802752F0-80275384 .text __dt__Q37JStudio3stb8TControlFv */
|
||||
JStudio::stb::TControl::~TControl() {
|
||||
/* Nonmatching */
|
||||
TControl::~TControl() {
|
||||
mObject_control.setControl_(NULL);
|
||||
}
|
||||
|
||||
/* 80275384-802753D4 .text appendObject__Q37JStudio3stb8TControlFPQ37JStudio3stb7TObject */
|
||||
void JStudio::stb::TControl::appendObject(JStudio::stb::TObject*) {
|
||||
/* Nonmatching */
|
||||
void TControl::appendObject(TObject* p) {
|
||||
p->setControl_(this);
|
||||
mObjectContainer.Push_back(p);
|
||||
}
|
||||
|
||||
/* 802753D4-8027540C .text removeObject__Q37JStudio3stb8TControlFPQ37JStudio3stb7TObject */
|
||||
void JStudio::stb::TControl::removeObject(JStudio::stb::TObject*) {
|
||||
/* Nonmatching */
|
||||
void TControl::removeObject(TObject* p) {
|
||||
p->setControl_(NULL);
|
||||
mObjectContainer.Erase(p);
|
||||
}
|
||||
|
||||
/* 8027540C-8027545C .text destroyObject__Q37JStudio3stb8TControlFPQ37JStudio3stb7TObject */
|
||||
void JStudio::stb::TControl::destroyObject(JStudio::stb::TObject*) {
|
||||
/* Nonmatching */
|
||||
void TControl::destroyObject(TObject* p) {
|
||||
removeObject(p);
|
||||
pFactory->destroy(p);
|
||||
}
|
||||
|
||||
/* 8027545C-802754C0 .text destroyObject_all__Q37JStudio3stb8TControlFv */
|
||||
void JStudio::stb::TControl::destroyObject_all() {
|
||||
/* Nonmatching */
|
||||
void TControl::destroyObject_all() {
|
||||
while (!mObjectContainer.empty()) {
|
||||
destroyObject(&mObjectContainer.back());
|
||||
}
|
||||
}
|
||||
|
||||
/* 802754C0-80275560 .text getObject__Q37JStudio3stb8TControlFPCvUl */
|
||||
void JStudio::stb::TControl::getObject(const void*, unsigned long) {
|
||||
/* Nonmatching */
|
||||
TObject* TControl::getObject(const void* param_0, u32 param_1) {
|
||||
/* Nonmatching - TPRObject_ID_equal copy issue */
|
||||
JGadget::TLinkList<TObject, -12>::iterator begin = mObjectContainer.begin();
|
||||
JGadget::TLinkList<TObject, -12>::iterator end = mObjectContainer.end();
|
||||
JGadget::TLinkList<TObject, -12>::iterator local_50 = std::find_if(begin, end, object::TPRObject_ID_equal(param_0, param_1));
|
||||
if ((local_50 != end) != false) {
|
||||
return &*local_50;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 80275560-8027565C .text forward__Q37JStudio3stb8TControlFUl */
|
||||
void JStudio::stb::TControl::forward(unsigned long) {
|
||||
/* Nonmatching */
|
||||
u8 TControl::forward(u32 param_0) {
|
||||
/* Nonmatching - regalloc */
|
||||
_54 = mObject_control.getSuspend();
|
||||
u8 rv = mObject_control.forward(param_0);
|
||||
int uVar7 = 0xf;
|
||||
int uVar6 = 0;
|
||||
JGadget::TContainerEnumerator<JStudio::stb::TObject, -12> aTStack_38(&mObjectContainer);
|
||||
while (aTStack_38) {
|
||||
JStudio::stb::TObject& this_00 = *aTStack_38;
|
||||
u8 iVar5 = 0;
|
||||
u8 iVar4 = this_00.forward(param_0);
|
||||
if (iVar4 != 0 || rv != 0) {
|
||||
iVar5 = 1;
|
||||
}
|
||||
rv = iVar5;
|
||||
int uVar3 = this_00.getStatus();
|
||||
uVar7 &= uVar3;
|
||||
uVar6 |= uVar3;
|
||||
}
|
||||
setStatus_(uVar7 | (uVar6 << 0x10));
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* 8027565C-802756A4 .text __dt__Q37JStudio3stb8TFactoryFv */
|
||||
JStudio::stb::TFactory::~TFactory() {
|
||||
/* Nonmatching */
|
||||
}
|
||||
TFactory::~TFactory() {}
|
||||
|
||||
/* 802756A4-802756AC .text create__Q37JStudio3stb8TFactoryFRCQ47JStudio3stb4data20TParse_TBlock_object */
|
||||
void JStudio::stb::TFactory::create(const JStudio::stb::data::TParse_TBlock_object&) {
|
||||
/* Nonmatching */
|
||||
JStudio::TObject* TFactory::create(const data::TParse_TBlock_object&) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 802756AC-802756E8 .text destroy__Q37JStudio3stb8TFactoryFPQ37JStudio3stb7TObject */
|
||||
void JStudio::stb::TFactory::destroy(JStudio::stb::TObject*) {
|
||||
/* Nonmatching */
|
||||
void TFactory::destroy(TObject* p) {
|
||||
delete p;
|
||||
}
|
||||
|
||||
/* 802756E8-80275708 .text __ct__Q37JStudio3stb6TParseFPQ37JStudio3stb8TControl */
|
||||
JStudio::stb::TParse::TParse(JStudio::stb::TControl*) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
TParse::TParse(TControl* pControl) : pControl(pControl) {}
|
||||
|
||||
/* 80275708-80275768 .text __dt__Q37JStudio3stb6TParseFv */
|
||||
JStudio::stb::TParse::~TParse() {
|
||||
/* Nonmatching */
|
||||
}
|
||||
TParse::~TParse() {}
|
||||
|
||||
/* 80275768-80275834 .text parseHeader_next__Q37JStudio3stb6TParseFPPCvPUlUl */
|
||||
void JStudio::stb::TParse::parseHeader_next(const void**, unsigned long*, unsigned long) {
|
||||
/* Nonmatching */
|
||||
bool TParse::parseHeader_next(const void** ppData_inout, u32* puBlock_out, u32 flags) {
|
||||
ASSERT(ppData_inout != 0);
|
||||
ASSERT(puBlock_out != 0);
|
||||
|
||||
const void* pData = *ppData_inout;
|
||||
ASSERT(pData != 0);
|
||||
|
||||
const data::TParse_THeader header(pData);
|
||||
*ppData_inout = header.getContent();
|
||||
*puBlock_out = header.get_blockNumber();
|
||||
|
||||
if (memcmp(header.get_signature(), &data::ga4cSignature, 4) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (header.get_byteOrder() != 0xFEFF) {
|
||||
return false;
|
||||
}
|
||||
u16 version = header.get_version();
|
||||
if (version < 1) {
|
||||
return false;
|
||||
} else if (version > 3) {
|
||||
return false;
|
||||
}
|
||||
return parseHeader(header, flags);
|
||||
}
|
||||
|
||||
/* 80275834-80275888 .text parseBlock_next__Q37JStudio3stb6TParseFPPCvPUlUl */
|
||||
void JStudio::stb::TParse::parseBlock_next(const void**, unsigned long*, unsigned long) {
|
||||
/* Nonmatching */
|
||||
bool TParse::parseBlock_next(void const** ppData_inout, u32* puData_out, u32 flags) {
|
||||
const void* pData = *ppData_inout;
|
||||
|
||||
data::TParse_TBlock blk(pData);
|
||||
*ppData_inout = blk.getNext();
|
||||
*puData_out = blk.get_size();
|
||||
return parseBlock_block(blk, flags);
|
||||
}
|
||||
|
||||
/* 80275888-80275890 .text parseHeader__Q37JStudio3stb6TParseFRCQ47JStudio3stb4data14TParse_THeaderUl */
|
||||
void JStudio::stb::TParse::parseHeader(const JStudio::stb::data::TParse_THeader&, unsigned long) {
|
||||
/* Nonmatching */
|
||||
bool TParse::parseHeader(const data::TParse_THeader&, u32) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* 80275890-802758C8 .text parseBlock_block__Q37JStudio3stb6TParseFRCQ47JStudio3stb4data13TParse_TBlockUl */
|
||||
void JStudio::stb::TParse::parseBlock_block(const JStudio::stb::data::TParse_TBlock&, unsigned long) {
|
||||
/* Nonmatching */
|
||||
bool TParse::parseBlock_block(const data::TParse_TBlock& ppBlock, u32 flags) {
|
||||
return parseBlock_object(ppBlock.get(), flags);
|
||||
}
|
||||
|
||||
/* 802758C8-802759D0 .text parseBlock_object__Q37JStudio3stb6TParseFRCQ47JStudio3stb4data20TParse_TBlock_objectUl */
|
||||
void JStudio::stb::TParse::parseBlock_object(const JStudio::stb::data::TParse_TBlock_object&, unsigned long) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802759D0-80275A64 .text find_if<Q37JGadget37TLinkList<Q37JStudio3stb7TObject,-12>8iterator,Q37JStudio6object18TPRObject_ID_equal>__3stdFQ37JGadget37TLinkList<Q37JStudio3stb7TObject,-12>8iteratorQ37JGadget37TLinkList<Q37JStudio3stb7TObject,-12>8iteratorQ37JStudio6object18TPRObject_ID_equal */
|
||||
void find_if<Q37JGadget37TLinkList<Q37JStudio3stb7TObject,-12>8iterator,Q37JStudio6object18TPRObject_ID_equal>__3stdFQ37JGadget37TLinkList<Q37JStudio3stb7TObject,-12>8iteratorQ37JGadget37TLinkList<Q37JStudio3stb7TObject,-12>8iteratorQ37JStudio6object18TPRObject_ID_equal {
|
||||
/* Nonmatching */
|
||||
bool TParse::parseBlock_object(const data::TParse_TBlock_object& ppObject, u32 flags) {
|
||||
TControl* pControl = getControl();
|
||||
ASSERT(pControl != 0);
|
||||
|
||||
if (ppObject.get_type() == data::BLOCK_NONE) {
|
||||
TObject_control& ref = pControl->referObject_control();
|
||||
ref.reset(ppObject.getContent());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (flags & 0x10) {
|
||||
TObject* p = pControl->getObject(ppObject.get_ID(), ppObject.get_IDSize());
|
||||
if (p != NULL) {
|
||||
p->reset(ppObject.getContent());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & 0x20)
|
||||
return true;
|
||||
|
||||
TFactory* pFactory = pControl->getFactory();
|
||||
if (pFactory == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JStudio::TObject* p = pFactory->create(ppObject);
|
||||
if (p == NULL) {
|
||||
if (flags & 0x40)
|
||||
return true;
|
||||
|
||||
char a5c[8];
|
||||
char t[16];
|
||||
int type = ppObject.get_type();
|
||||
data::toString_block(a5c, type);
|
||||
|
||||
return false;
|
||||
}
|
||||
pControl->appendObject(p);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace stb
|
||||
} // namespace JStudio
|
||||
|
||||
Reference in New Issue
Block a user