diff options
| author | kipcode66 <kipcode66@gmail.com> | 2025-12-15 20:00:16 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-15 17:00:16 -0800 |
| commit | d7facf5956b50ad28523908336c01c9c7ab52ea9 (patch) | |
| tree | daccdf4b8a69ecd701e8d755a571ff00b64b69c6 /src | |
| parent | 4e6dffff5a325365dce234d3b7daba60dc3245c0 (diff) | |
Resource (#2939)
* matching Do_destroy from resource.cpp
* add missing constants from `float.c`
* add numeric_limits for double
* set TObject::reset for each version in stb.cpp
* improve debug matching
Diffstat (limited to 'src')
| -rw-r--r-- | src/JSystem/JMessage/resource.cpp | 9 | ||||
| -rw-r--r-- | src/JSystem/JStudio/JStudio/ctb.cpp | 2 | ||||
| -rw-r--r-- | src/JSystem/JStudio/JStudio/functionvalue.cpp | 57 | ||||
| -rw-r--r-- | src/JSystem/JStudio/JStudio/jstudio-control.cpp | 13 | ||||
| -rw-r--r-- | src/JSystem/JStudio/JStudio/stb.cpp | 12 | ||||
| -rw-r--r-- | src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/type_traits.h | 90 | ||||
| -rw-r--r-- | src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h | 12 | ||||
| -rw-r--r-- | src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c | 6 |
8 files changed, 170 insertions, 31 deletions
diff --git a/src/JSystem/JMessage/resource.cpp b/src/JSystem/JMessage/resource.cpp index 2b1ddf7068..0007e370af 100644 --- a/src/JSystem/JMessage/resource.cpp +++ b/src/JSystem/JMessage/resource.cpp @@ -116,12 +116,11 @@ JMessage::TResource* JMessage::TResourceContainer::TCResource::Do_create() { } void JMessage::TResourceContainer::TCResource::Do_destroy(JMessage::TResource* pResource) { - #if DEBUG +#if DEBUG delete pResource; - #else - // Fake Match - extra null comparison when not doing the conversion - delete (void*)pResource; - #endif +#else + operator delete(pResource); +#endif } JMessage::TResourceContainer::TResourceContainer() : encodingType_(0), pfnParseCharacter_(NULL) {} diff --git a/src/JSystem/JStudio/JStudio/ctb.cpp b/src/JSystem/JStudio/JStudio/ctb.cpp index 9d98328def..db86c69e77 100644 --- a/src/JSystem/JStudio/JStudio/ctb.cpp +++ b/src/JSystem/JStudio/JStudio/ctb.cpp @@ -59,7 +59,7 @@ JStudio::ctb::TObject* JStudio::ctb::TControl::getObject_index(u32 param_0) { return 0; } JGadget::TLinkList<TObject, -12>::iterator aiStack_14 = ocObject_.begin(); - std::advance_fake(aiStack_14, param_0); + std::advance(aiStack_14, param_0); return &*aiStack_14; } diff --git a/src/JSystem/JStudio/JStudio/functionvalue.cpp b/src/JSystem/JStudio/JStudio/functionvalue.cpp index 52e642b711..7ca04c6252 100644 --- a/src/JSystem/JStudio/JStudio/functionvalue.cpp +++ b/src/JSystem/JStudio/JStudio/functionvalue.cpp @@ -7,6 +7,7 @@ #include "JSystem/JGadget/linklist.h" #include "math.h" #include "stdlib.h" +#include "limits.h" namespace JStudio { @@ -261,13 +262,13 @@ f64 TFunctionValue_composite::getValue(f64 arg1) { f64 TFunctionValue_composite::composite_raw(TVector_pointer<TFunctionValue*> const& param_1, TData const& param_2, f64 param_3) { u32 index = param_2.get_unsignedInteger(); - u32 size = param_1.size(); - if (index >= size) { + if (index >= param_1.size()) { return 0.0; } - TFunctionValue** local_18 = (TFunctionValue**)param_1.begin(); - std::advance_pointer(local_18, index); - TFunctionValue* piVar4 = *local_18; + TFunctionValue** p = (TFunctionValue**)param_1.begin(); + std::advance(p, index); + JUT_ASSERT(0x247, p!=0); + TFunctionValue* piVar4 = *p; return piVar4->getValue(param_3); } @@ -284,9 +285,9 @@ f64 TFunctionValue_composite::composite_index(TVector_pointer<TFunctionValue*> c TFunctionValue** local_148 = (TFunctionValue**)param_1.begin(); TFunctionValue* pFront = *local_148; JUT_ASSERT(599, pFront!=NULL); - f64 dVar4 = pFront->getValue(param_3); - s32 index = floor(dVar4); - u32 uVar2 = param_2.get_unsignedInteger(); + TValue fData = pFront->getValue(param_3); + s32 index = floor(fData); + u32 uVar2 = param_2.get_outside(); switch (uVar2) { case 0: case 3: @@ -360,8 +361,9 @@ f64 TFunctionValue_composite::composite_add(TVector_pointer<TFunctionValue*> con f64 dVar4 = param_2.get_value(); TContainerEnumerator_const_TVector<TFunctionValue*> aTStack_18(param_1); while (aTStack_18) { - TFunctionValue* const* ppiVar3 = *aTStack_18; - TFunctionValue* piVar3 = *ppiVar3; + TFunctionValue* const* p = *aTStack_18; + JUT_ASSERT(0x2a1, p!=0); + TFunctionValue* piVar3 = *p; dVar4 += piVar3->getValue(param_3); } return dVar4; @@ -382,8 +384,9 @@ f64 TFunctionValue_composite::composite_subtract(TVector_pointer<TFunctionValue* JUT_ASSERT(688, pFront!=NULL); f64 dVar4 = pFront->getValue(param_3); while (aTStack_18) { - TFunctionValue* const* ppiVar3 = *aTStack_18; - TFunctionValue* piVar3 = *ppiVar3; + TFunctionValue* const* p = *aTStack_18; + JUT_ASSERT(0x2b5, p!=0); + TFunctionValue* piVar3 = *p; dVar4 -= piVar3->getValue(param_3); } dVar4 -= param_2.f32data; @@ -399,8 +402,9 @@ f64 TFunctionValue_composite::composite_multiply(TVector_pointer<TFunctionValue* f64 dVar4 = param_2.get_value(); TContainerEnumerator_const_TVector<TFunctionValue*> aTStack_18(param_1); while (aTStack_18) { - TFunctionValue* const* ppiVar3 = *aTStack_18; - TFunctionValue* piVar3 = *ppiVar3; + TFunctionValue* const* p = *aTStack_18; + JUT_ASSERT(0x2c5, p!=0); + TFunctionValue* piVar3 = *p; dVar4 *= piVar3->getValue(param_3); } return dVar4; @@ -419,18 +423,29 @@ f64 TFunctionValue_composite::composite_divide(TVector_pointer<TFunctionValue*> TFunctionValue* const* local_148 = *aTStack_18; TFunctionValue* pFront = *local_148; JUT_ASSERT(724, pFront!=NULL); - f64 dVar4 = pFront->getValue(param_3); + TValue fData = pFront->getValue(param_3); while (aTStack_18) { - TFunctionValue* const* ppiVar3 = *aTStack_18; - TFunctionValue* piVar3 = *ppiVar3; - dVar4 /= piVar3->getValue(param_3); + TFunctionValue* const* p = *aTStack_18; + JUT_ASSERT(0x2d9, p!=0); + TFunctionValue* piVar3 = *p; + fData /= piVar3->getValue(param_3); + JGADGET_ASSERTWARN(0x2db, fData!=TValue(0)); } - dVar4 /= param_2.f32data; - return dVar4; +#if DEBUG + TValue v = param_2.get_value(); + JGADGET_ASSERTWARN(0x2df, fData!=TValue(0)); +#endif + fData /= param_2.f32data; + return fData; } +#if PLATFORM_WII || PLATFORM_SHIELD +#define NUMERIC_LIMIT double +#else +#define NUMERIC_LIMIT float +#endif -TFunctionValue_constant::TFunctionValue_constant() : fValue_(NAN) {} +TFunctionValue_constant::TFunctionValue_constant() : fValue_(std::numeric_limits<NUMERIC_LIMIT>::signaling_NaN()) {} u32 TFunctionValue_constant::getType() const { return 2; diff --git a/src/JSystem/JStudio/JStudio/jstudio-control.cpp b/src/JSystem/JStudio/JStudio/jstudio-control.cpp index b58fb20f0f..649501b4c9 100644 --- a/src/JSystem/JStudio/JStudio/jstudio-control.cpp +++ b/src/JSystem/JStudio/JStudio/jstudio-control.cpp @@ -81,15 +81,24 @@ void JStudio::TFactory::appendCreateObject(JStudio::TCreateObject* param_0) { } -JStudio::TObject* JStudio::TFactory::create(JStudio::stb::data::TParse_TBlock_object const& param_0) { +JStudio::TObject* JStudio::TFactory::create(JStudio::stb::data::TParse_TBlock_object const& rParse) { JGadget::TContainerEnumerator<JGadget::TLinkList<TCreateObject, -4> > aTStack_368(mList); while(aTStack_368) { TCreateObject& piVar1 = *aTStack_368; JStudio::TObject* obj; - if (piVar1.create(&obj, param_0)) { + if (piVar1.create(&obj, rParse)) { return obj; } } +#if DEBUG + u32 type = rParse.get_type(); + char a5c[8]; + stb::data::toString_block(a5c, type); + const char* szID = (const char*)rParse.get_ID(); + JGADGET_ASSERTWARN(0x108, rParse.get_IDSize()>0); + JGADGET_ASSERTWARN(0x109, szID[rParse.get_IDSize()-1]=='\\0'); + JGADGET_WARNMSG3(0x10c, "ID not found\n demo object : ", szID, "\n type : ", a5c); +#endif return NULL; } diff --git a/src/JSystem/JStudio/JStudio/stb.cpp b/src/JSystem/JStudio/JStudio/stb.cpp index 776f6c39f8..6a2f6515c7 100644 --- a/src/JSystem/JStudio/JStudio/stb.cpp +++ b/src/JSystem/JStudio/JStudio/stb.cpp @@ -67,12 +67,20 @@ void TObject::setFlag_operation(u8 op, int val) { } } +#if !PLATFORM_SHIELD || DEBUG void TObject::reset(const void* arg1) { bSequence_ = 0; mStatus = STATUS_STILL; pSequence_next = arg1; u32Wait_ = 0; } +#endif + +#if DEBUG +void TObject::reset() { + reset(NULL); +} +#endif bool TObject::forward(u32 arg1) { bool temp = false; @@ -334,10 +342,10 @@ TObject* TControl::getObject(void const* param_0, u32 param_1) { void TControl::reset() { resetStatus_(); - mObject_control.reset(NULL); + mObject_control.reset(); JGadget::TContainerEnumerator<JGadget::TLinkList<JStudio::stb::TObject, -12> > aTStack_18(mObjectContainer); while (aTStack_18) { - (*aTStack_18).reset(NULL); + (*aTStack_18).reset(); } } diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/type_traits.h b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/type_traits.h new file mode 100644 index 0000000000..14c7f35734 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/type_traits.h @@ -0,0 +1,90 @@ +#ifndef MSL_TYPE_TRAITS_H_ +#define MSL_TYPE_TRAITS_H_ + +#include <stddef.h> + +namespace std { + // helper class + template<class T, T v> struct integral_constant { static const T value = v;}; + + typedef integral_constant<bool, true> true_type; + typedef integral_constant<bool, false> false_type; + + template <bool B, typename T = void> + struct enable_if {}; + + template <typename T> + struct enable_if<true, T> { typedef T type; }; + + template<class T> struct remove_reference { typedef T type; }; + template<class T> struct remove_reference<T&> { typedef T type; }; + + template<bool B, class T, class F> + struct conditional { typedef T type; }; + + template<class T, class F> + struct conditional<false, T, F> { typedef F type; }; + + template<class T> + struct is_array : false_type {}; + + template<class T> + struct is_array<T[]> : std::true_type {}; + + template<class T, size_t N> + struct is_array<T[N]> : std::true_type {}; + + template <typename T> + struct add_pointer + { + typedef T* type; + }; + template <typename T> + struct add_pointer<T&> + { + typedef T* type; + }; + template <typename T> + struct add_pointer<T const&> + { + typedef T* type; + }; + template <typename T> + struct add_pointer<T volatile&> + { + typedef T* type; + }; + template <typename T> + struct add_pointer<T const volatile&> + { + typedef T* type; + }; + + template<class T> + struct remove_extent { typedef T type; }; + + template<class T> + struct remove_extent<T[]> { typedef T type; }; + + template<class T, size_t N> + struct remove_extent<T[N]> { typedef T type; }; + + template<class T> struct remove_cv { typedef T type; }; + template<class T> struct remove_cv<const T> { typedef T type; }; + template<class T> struct remove_cv<volatile T> { typedef T type; }; + template<class T> struct remove_cv<const volatile T> { typedef T type; }; + + template<class T> struct remove_const { typedef T type; }; + template<class T> struct remove_const<const T> { typedef T type; }; + + template<class T> struct remove_volatile { typedef T type; }; + template<class T> struct remove_volatile<volatile T> { typedef T type; }; + + template<class T, class U> + struct is_same : std::false_type {}; + + template<class T> + struct is_same<T, T> : std::true_type {}; +} + +#endif diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h index b04a57536e..e8f381874e 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/limits.h @@ -104,8 +104,20 @@ class numeric_limits<float> { public: inline static float min(); inline static float max() { return FLT_MAX; } + inline static float signaling_NaN() { return *(float*)__float_nan; } }; +#if __REVOLUTION_SDK__ +template <> +class numeric_limits<double> { +public: + static const unsigned long long x = 0x7ff0000000000001ULL; + inline static double min(); + inline static double max(); + inline static double signaling_NaN() { return *reinterpret_cast<const double*>(&x); } +}; +#endif + } // namespace std #endif #endif diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c index 782bc99688..3455dbf930 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Src/float.c @@ -4,6 +4,12 @@ unsigned long __float_nan[] = {0x7FFFFFFF}; unsigned long __float_huge[] = {0x7F800000}; +#if !__REVOLUTION_SDK__ unsigned long __float_max[] = {0x7F7FFFFF}; unsigned long __float_epsilon[] = {0x34000000}; +#endif + +#if DEBUG +unsigned long long __double_huge[] = {0x7ff0000000000000ULL}; +#endif |
