diff options
| author | Caroline Madsen <69010899+randomsalience@users.noreply.github.com> | 2025-04-09 16:45:30 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-09 13:45:30 -0700 |
| commit | c6f76e7240dde8bbcf40a88d6d88cf87cab616b4 (patch) | |
| tree | bf9afbb1c32e66f45bdba30f61a9e4f0d92f804a /include/JSystem/JStudio | |
| parent | 6672817e41064e04951ec28d51070b66fc8377ac (diff) | |
Various JSystem work (#2383)
* JKernel and JStudio cleanup
* JMessage cleanup
* JAudio cleanup
* JASBNKParser work
* functionvalue work
* fvb work
* J2D and J3D cleanup
* steal from tww
* J2DPictureEx mostly done
* fix build
Diffstat (limited to 'include/JSystem/JStudio')
| -rw-r--r-- | include/JSystem/JStudio/JStudio/ctb.h | 2 | ||||
| -rw-r--r-- | include/JSystem/JStudio/JStudio/functionvalue.h | 74 | ||||
| -rw-r--r-- | include/JSystem/JStudio/JStudio/fvb-data-parse.h | 8 | ||||
| -rw-r--r-- | include/JSystem/JStudio/JStudio/fvb-data.h | 5 | ||||
| -rw-r--r-- | include/JSystem/JStudio/JStudio/fvb.h | 2 | ||||
| -rw-r--r-- | include/JSystem/JStudio/JStudio/jstudio-math.h | 16 | ||||
| -rw-r--r-- | include/JSystem/JStudio/JStudio/jstudio-object.h | 9 | ||||
| -rw-r--r-- | include/JSystem/JStudio/JStudio/object-id.h | 13 | ||||
| -rw-r--r-- | include/JSystem/JStudio/JStudio/stb.h | 4 | ||||
| -rw-r--r-- | include/JSystem/JStudio/JStudio_JStage/control.h | 29 |
10 files changed, 119 insertions, 43 deletions
diff --git a/include/JSystem/JStudio/JStudio/ctb.h b/include/JSystem/JStudio/JStudio/ctb.h index 6e303cd47f..d45b3e74bc 100644 --- a/include/JSystem/JStudio/JStudio/ctb.h +++ b/include/JSystem/JStudio/JStudio/ctb.h @@ -112,7 +112,7 @@ struct data { struct TObject_TxyzRy : public TObject { /* 80280F60 */ TObject_TxyzRy(JStudio::ctb::data::TParse_TBlock const&); - /* 80281554 */ virtual ~TObject_TxyzRy(); + /* 80281554 */ virtual ~TObject_TxyzRy() {} /* 80280FBC */ virtual int getScheme() const; }; diff --git a/include/JSystem/JStudio/JStudio/functionvalue.h b/include/JSystem/JStudio/JStudio/functionvalue.h index c6833d4294..6152f05fdb 100644 --- a/include/JSystem/JStudio/JStudio/functionvalue.h +++ b/include/JSystem/JStudio/JStudio/functionvalue.h @@ -1,9 +1,11 @@ #ifndef FUNCTIONVALUE_H #define FUNCTIONVALUE_H -#include "JSystem/JGadget/search.h" -#include "JSystem/JGadget/vector.h" -#include "global.h" +#include "JSystem/JGadget/std-vector.h" +#include "dolphin/os.h" +#include <iterator.h> + +extern u8 lit_569; namespace JStudio { @@ -66,20 +68,19 @@ public: : TFunctionValueAttributeSet_const(refer, range, interp) {} TFunctionValueAttribute_refer* refer_get() const { - return static_cast<const TFunctionValueAttributeSet_const*>(this)->refer_get(); + return TFunctionValueAttributeSet_const::refer_get(); } TFunctionValueAttribute_range* range_get() const { - return static_cast<const TFunctionValueAttributeSet_const*>(this)->range_get(); + return TFunctionValueAttributeSet_const::range_get(); } TFunctionValueAttribute_interpolate* interpolate_get() const { - return static_cast<const TFunctionValueAttributeSet_const*>(this)->interpolate_get(); + return TFunctionValueAttributeSet_const::interpolate_get(); } }; class TFunctionValueAttribute_refer : public JGadget::TVector_pointer<TFunctionValue*> { public: - TFunctionValueAttribute_refer() : - JGadget::TVector_pointer<TFunctionValue*>(JGadget::TAllocator<void*>()) {} + inline TFunctionValueAttribute_refer(); ~TFunctionValueAttribute_refer() {} /* 802816E8 */ void refer_initialize(); @@ -191,7 +192,7 @@ public: }; typedef f64 (*UnkFunc)(f64, const TFunctionValueAttribute_refer*, const TFunctionValue_composite::TData*); - typedef f64 (*CompositeFunc)(const JGadget::TVector_pointer<TFunctionValue>&, + typedef f64 (*CompositeFunc)(const JGadget::TVector_pointer<TFunctionValue*>&, const TFunctionValue_composite::TData&, f64); /* 80281D5C */ TFunctionValue_composite(); @@ -227,7 +228,7 @@ public: TData data; }; -class TFunctionValue_transition : TFunctionValue, +class TFunctionValue_transition : public TFunctionValue, TFunctionValueAttribute_range, TFunctionValueAttribute_interpolate { public: @@ -252,7 +253,7 @@ private: /* 0x50 */ f64 _50; }; -class TFunctionValue_list : TFunctionValue, +class TFunctionValue_list : public TFunctionValue, TFunctionValueAttribute_range, TFunctionValueAttribute_interpolate { public: @@ -303,25 +304,44 @@ private: /* 0x58 */ update_INTERPOLATE pfnUpdate_; }; -class TFunctionValue_list_parameter : TFunctionValue, +class TFunctionValue_list_parameter : public 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; } + TIterator_data_& operator-=(s32 n) { + value_ -= n * 2; + return *this; + } + s32 operator-(const TIterator_data_& other) { + return (u32)(value_ - other.value_) >> 1; + } + TIterator_data_& operator++() { + value_ += 2; + return *this; + } + TIterator_data_& operator+=(s32 n) { + value_ += n * 2; + return *this; + } friend bool operator==(const TIterator_data_& lhs, const TIterator_data_& rhs) { return lhs.value_ == rhs.value_; } + f32 operator*() { return *value_; } const f32* get() const { return value_; } void set(const f32* value) { value_ = value; } const f32* value_; + + typedef s32 difference_type; + typedef f32 value_type; + typedef const f32* pointer; + typedef const f32& reference; + typedef std::random_access_iterator_tag iterator_category; }; typedef f64 (*update_INTERPOLATE)(const TFunctionValue_list_parameter&, f64); @@ -358,7 +378,7 @@ private: /* 0x58 */ update_INTERPOLATE pfnUpdate_; }; -class TFunctionValue_hermite : TFunctionValue, TFunctionValueAttribute_range { +class TFunctionValue_hermite : public TFunctionValue, TFunctionValueAttribute_range { public: struct TIterator_data_ { TIterator_data_(const TFunctionValue_hermite& rParent, const f32* value) { @@ -374,14 +394,36 @@ public: } friend bool operator==(const TIterator_data_& lhs, const TIterator_data_& rhs) { return lhs.value_ == rhs.value_; } + f32 operator*() { return *value_; } TIterator_data_& operator--() { value_ -= size_; return *this; } + TIterator_data_& operator-=(s32 n) { + value_ -= size_ * n; + return *this; + } + s32 operator-(const TIterator_data_& other) { + return (value_ - other.value_) / size_; + } + TIterator_data_& operator++() { + value_ += size_; + return *this; + } + TIterator_data_& operator+=(s32 n) { + value_ += size_ * n; + return *this; + } /* 0x00 */ const f32* value_; /* 0x04 */ u32 size_; + + typedef s32 difference_type; + typedef f32 value_type; + typedef const f32* pointer; + typedef const f32& reference; + typedef std::random_access_iterator_tag iterator_category; }; /* 802832C4 */ TFunctionValue_hermite(); diff --git a/include/JSystem/JStudio/JStudio/fvb-data-parse.h b/include/JSystem/JStudio/JStudio/fvb-data-parse.h index 16b3627827..776d86c321 100644 --- a/include/JSystem/JStudio/JStudio/fvb-data-parse.h +++ b/include/JSystem/JStudio/JStudio/fvb-data-parse.h @@ -36,10 +36,10 @@ public: class TParse_TParagraph : public TParseData_aligned<4> { public: struct TData { - /* 0x04 */ u32 u32Size; - /* 0x08 */ u32 u32Type; - /* 0x0C */ const void* pContent; - /* 0x10 */ const void* next; + /* 0x00 */ u32 u32Size; + /* 0x04 */ u32 u32Type; + /* 0x08 */ const void* pContent; + /* 0x0C */ const void* next; }; TParse_TParagraph(const void* content) : TParseData_aligned<4>(content) {} diff --git a/include/JSystem/JStudio/JStudio/fvb-data.h b/include/JSystem/JStudio/JStudio/fvb-data.h index 6469a31645..cacc41cafd 100644 --- a/include/JSystem/JStudio/JStudio/fvb-data.h +++ b/include/JSystem/JStudio/JStudio/fvb-data.h @@ -26,7 +26,10 @@ typedef enum TEComposite { /* 0x8 */ COMPOSITE_ENUM_SIZE, }; -typedef const void* (*CompositeOperation)(TFunctionValue_composite::TData); +struct CompositeOperation { + TFunctionValue_composite::CompositeFunc composite; + TFunctionValue_composite::TData (*getCompositeData)(const void*); +}; struct TBlock { /* 0x0 */ u32 size; diff --git a/include/JSystem/JStudio/JStudio/fvb.h b/include/JSystem/JStudio/JStudio/fvb.h index 8da397eb49..5ccf0d0f1c 100644 --- a/include/JSystem/JStudio/JStudio/fvb.h +++ b/include/JSystem/JStudio/JStudio/fvb.h @@ -72,7 +72,7 @@ public: private: /* 0x4 */ TFactory* pFactory; - /* 0x8 */ JGadget::TLinkList<TObject, 12> ocObject_; + /* 0x8 */ JGadget::TLinkList<TObject, -12> ocObject_; }; // Size: 0x14 class TObject_composite : public TObject { diff --git a/include/JSystem/JStudio/JStudio/jstudio-math.h b/include/JSystem/JStudio/JStudio/jstudio-math.h index c02f19f37d..0e061b6ab8 100644 --- a/include/JSystem/JStudio/JStudio/jstudio-math.h +++ b/include/JSystem/JStudio/JStudio/jstudio-math.h @@ -44,16 +44,16 @@ namespace math { return VECMag(&local_18); } - inline void getFromTransformation_S(CMtxP param_1, Vec* param_2) { - param_2->x = getFromTransformation_Sn(param_1, 0); - param_2->y = getFromTransformation_Sn(param_1, 1); - param_2->z = getFromTransformation_Sn(param_1, 2); + inline void getFromTransformation_S(Vec* param_1, CMtxP param_2) { + param_1->x = getFromTransformation_Sn(param_2, 0); + param_1->y = getFromTransformation_Sn(param_2, 1); + param_1->z = getFromTransformation_Sn(param_2, 2); } - inline void getFromTransformation_T(CMtxP param_1, Vec* param_2) { - param_2->x = param_1[0][3]; - param_2->y = param_1[1][3]; - param_2->z = param_1[2][3]; + inline void getFromTransformation_T(Vec* param_1, CMtxP param_2) { + param_1->x = param_2[0][3]; + param_1->y = param_2[1][3]; + param_1->z = param_2[2][3]; } inline void getTransformation_T(Mtx mtx, const Vec* param_2) { diff --git a/include/JSystem/JStudio/JStudio/jstudio-object.h b/include/JSystem/JStudio/JStudio/jstudio-object.h index 1c87b6ba03..1eb93d5abb 100644 --- a/include/JSystem/JStudio/JStudio/jstudio-object.h +++ b/include/JSystem/JStudio/JStudio/jstudio-object.h @@ -2,6 +2,7 @@ #define JSTUDIO_OBJECT_H #include "JSystem/JStudio/JStudio/jstudio-control.h" +#include "global.h" #include "limits.h" #include "math.h" @@ -27,7 +28,7 @@ struct TVariableValue { /* 80285E0C */ virtual ~TOutput() = 0; }; - struct TOutput_none_ { + struct TOutput_none_ : TOutput { /* 80285F6C */ ~TOutput_none_(); /* 80285FCC */ void operator()(f32, JStudio::TAdaptor*) const; }; @@ -36,7 +37,7 @@ struct TVariableValue { /* 80285EB8 */ static void update_immediate_(JStudio::TVariableValue*, f64); /* 80285ECC */ static void update_time_(JStudio::TVariableValue*, f64); /* 80285F08 */ static void update_functionValue_(JStudio::TVariableValue*, f64); - /* 8028B568 */ TVariableValue() : field_0x4(0), field_0x8(NULL), pOutput_((TOutput*)soOutput_none_) {} + /* 8028B568 */ TVariableValue() : field_0x4(0), field_0x8(NULL), pOutput_(&soOutput_none_) {} void setValue_immediate(f32 value) { field_0x8 = &update_immediate_; @@ -83,10 +84,10 @@ struct TVariableValue { } void setOutput(const TOutput* param_1) { - pOutput_ = (param_1 != NULL) ? param_1 : (TOutput*)soOutput_none_; + pOutput_ = (param_1 != NULL) ? param_1 : &soOutput_none_; } - static u8 soOutput_none_[4 + 4 /* padding */]; + static TOutput_none_ soOutput_none_; /* 0x00 */ f32 mValue; /* 0x04 */ u32 field_0x4; diff --git a/include/JSystem/JStudio/JStudio/object-id.h b/include/JSystem/JStudio/JStudio/object-id.h index fbcfb0e414..4b0113f0b2 100644 --- a/include/JSystem/JStudio/JStudio/object-id.h +++ b/include/JSystem/JStudio/JStudio/object-id.h @@ -15,17 +15,20 @@ public: inline const u8* getID() const { return (const u8*)mID; } inline u32 getIDSize() const { return mID_size; } -private: +protected: /* 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) {} + TIDData const& getIDData() const { return *this; } +}; + +struct TPRObject_ID_equal : public TIDData { + TPRObject_ID_equal(const void* id, u32 id_size) : TIDData(id, id_size) {} + TPRObject_ID_equal(const TPRObject_ID_equal& other) : TIDData(other.mID, other.mID_size) {} + bool operator()(TObject_ID const& id) const { return TIDData::isEqual(id.getIDData(), *this); } }; } // namespace object diff --git a/include/JSystem/JStudio/JStudio/stb.h b/include/JSystem/JStudio/JStudio/stb.h index d1846bdb49..6582961688 100644 --- a/include/JSystem/JStudio/JStudio/stb.h +++ b/include/JSystem/JStudio/JStudio/stb.h @@ -44,7 +44,7 @@ public: /* 80288B78 */ void setFlag_operation(u8, int); /* 80288BD0 */ void reset(void const*); - /* 80288BE8 */ u8 forward(u32); + /* 80288BE8 */ bool forward(u32); /* 80288E18 */ virtual void do_begin(); /* 80288E1C */ virtual void do_end(); /* 80288E20 */ virtual void do_paragraph(u32, void const*, u32); @@ -133,7 +133,7 @@ public: /* 80289300 */ void destroyObject_all(); /* 80289364 */ TObject* getObject(void const*, u32); /* 80289404 */ void reset(); - /* 802894B4 */ u8 forward(u32); + /* 802894B4 */ bool forward(u32); void setStatus_(u32 status) { mStatus = status; } void resetStatus_() { setStatus_(0); } diff --git a/include/JSystem/JStudio/JStudio_JStage/control.h b/include/JSystem/JStudio/JStudio_JStage/control.h index 04da734dbb..c595055640 100644 --- a/include/JSystem/JStudio/JStudio_JStage/control.h +++ b/include/JSystem/JStudio/JStudio_JStage/control.h @@ -1,6 +1,7 @@ #ifndef JSTUDIO_JSTAGE_CONTROL_H #define JSTUDIO_JSTAGE_CONTROL_H +#include "JSystem/JGadget/pointer.h" #include "JSystem/JStage/JSGActor.h" #include "JSystem/JStage/JSGAmbientLight.h" #include "JSystem/JStage/JSGCamera.h" @@ -51,6 +52,10 @@ struct TAdaptor_actor : public JStudio::TAdaptor_actor, public JStudio_JStage::T typedef f32 (JStage::TActor::*Getter)() const; typedef f32 (JStage::TActor::*MaxGetter)() const; + enum TEVariableValue { + TEACTOR_1 = 1, + }; + struct TVVOutput_ANIMATION_FRAME_ : public JStudio::TVariableValue::TOutput { @@ -300,7 +305,7 @@ inline bool transform_toGlobalFromLocal(JStudio::TControl::TTransform_position* if (!transform_toGlobalFromLocal(afStack_38, param_2, param_3, param_4)) { return false; } - JStudio::math::getFromTransformation_T(afStack_38, param_1); + JStudio::math::getFromTransformation_T(param_1, afStack_38); return true; } /* 8028A328 */ bool @@ -310,6 +315,28 @@ inline bool transform_toGlobalFromLocal(JStudio::TControl::TTransform_position* /* 8028A3CC */ bool transform_toLocalFromGlobal(f32 (*)[4], JStudio::TControl::TTransform_position const&, JStage::TObject const*, u32); + +namespace { + +template <class AdaptorT, class ObjectT> +JStudio::TObject* createObject_JSG_(const JStudio::stb::data::TParse_TBlock_object& param_1, + JStage::TObject* param_2, const JStage::TSystem* param_3) { + ObjectT* objt = (ObjectT*)param_2; + AdaptorT* pAdaptor = new AdaptorT(param_3, objt); + if (pAdaptor == NULL) { + return NULL; + } + JGadget::TPointer_delete<AdaptorT> adaptorGuard(pAdaptor); + JStudio::TObject* pObj = JStudio::TCreateObject::createFromAdaptor<AdaptorT>(param_1, pAdaptor); + if (pObj == NULL) { + return NULL; + } + adaptorGuard.set(NULL); + return pObj; +} + +} // namespace + }; // namespace JStudio_JStage #endif /* JSTUDIO_JSTAGE_CONTROL_H */ |
