* 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
This commit is contained in:
kipcode66 2025-12-15 20:00:16 -05:00 committed by GitHub
parent 4e6dffff5a
commit d7facf5956
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 203 additions and 38 deletions

View File

@ -15,14 +15,14 @@ public:
JGadget_outMessage(MessageFunc fn, const char* file, int line); JGadget_outMessage(MessageFunc fn, const char* file, int line);
~JGadget_outMessage(); ~JGadget_outMessage();
JGadget_outMessage& operator<<(int param_1) { return *this << (s32)param_1; } JGadget_outMessage& operator<<(int param_1) { return *this << (signed long)param_1; }
JGadget_outMessage& operator<<(u16); JGadget_outMessage& operator<<(u16);
JGadget_outMessage& operator<<(unsigned int); JGadget_outMessage& operator<<(unsigned int);
JGadget_outMessage& operator<<(u8 param_1) { return *this << (char)param_1; } JGadget_outMessage& operator<<(u8 param_1) { return *this << (char)param_1; }
JGadget_outMessage& operator<<(const char* str); JGadget_outMessage& operator<<(const char* str);
JGadget_outMessage& operator<<(char); JGadget_outMessage& operator<<(char);
JGadget_outMessage& operator<<(s32); JGadget_outMessage& operator<<(signed long);
JGadget_outMessage& operator<<(u32); JGadget_outMessage& operator<<(unsigned long);
JGadget_outMessage& operator<<(const void*); JGadget_outMessage& operator<<(const void*);
private: private:
@ -45,6 +45,10 @@ private:
JGadget_outMessage out(JGadget_outMessage::warning, __FILE__, line); \ JGadget_outMessage out(JGadget_outMessage::warning, __FILE__, line); \
out << msg << (arg); out << msg << (arg);
#define JGADGET_WARNMSG3(line, msg, arg1, arg2, arg3) \
JGadget_outMessage out(JGadget_outMessage::warning, __FILE__, line); \
out << msg << (arg1) << (arg2) << (arg3);
#define JGADGET_WARNMSG4(line, msg, arg1, arg2, arg3, arg4) \ #define JGADGET_WARNMSG4(line, msg, arg1, arg2, arg3, arg4) \
JGadget_outMessage out(JGadget_outMessage::warning, __FILE__, line); \ JGadget_outMessage out(JGadget_outMessage::warning, __FILE__, line); \
out << msg << (arg1) << (arg2) << (arg3) << (arg4); out << msg << (arg1) << (arg2) << (arg3) << (arg4);

View File

@ -29,6 +29,9 @@ struct TVector {
T* mPtr; T* mPtr;
}; };
typedef T* iterator;
typedef const T* const_iterator;
TVector(Allocator const& allocator) { TVector(Allocator const& allocator) {
mAllocator = allocator; mAllocator = allocator;
pBegin_ = NULL; pBegin_ = NULL;
@ -111,9 +114,10 @@ struct TVector {
return pBegin_ + diff; return pBegin_ + diff;
} }
T* begin() const { return pBegin_; } iterator begin() { return pBegin_; }
const_iterator begin() const { return pBegin_; }
T* end() const { return pEnd_; } iterator end() { return pEnd_; }
const_iterator end() const { return pEnd_; }
u32 size() const { u32 size() const {
if (pBegin_ == 0) { if (pBegin_ == 0) {
@ -178,6 +182,9 @@ struct TVector_pointer : TVector_pointer_void {
TVector_pointer(const TAllocator<void*>& allocator) : TVector_pointer_void(allocator) {} TVector_pointer(const TAllocator<void*>& allocator) : TVector_pointer_void(allocator) {}
~TVector_pointer() {} ~TVector_pointer() {}
typedef T* iterator;
typedef const T* const_iterator;
const T* begin() const { return (const T*)TVector_pointer_void::begin(); } const T* begin() const { return (const T*)TVector_pointer_void::begin(); }
T* begin() { return (T*)TVector_pointer_void::begin(); } T* begin() { return (T*)TVector_pointer_void::begin(); }

View File

@ -33,7 +33,7 @@ public:
virtual TFunctionValueAttributeSet getAttributeSet() = 0; virtual TFunctionValueAttributeSet getAttributeSet() = 0;
virtual void initialize() = 0; virtual void initialize() = 0;
virtual void prepare() = 0; virtual void prepare() = 0;
virtual f64 getValue(f64 arg1) = 0; virtual TValue getValue(f64 arg1) = 0;
static ExtrapolateParameter toFunction_outside(int); static ExtrapolateParameter toFunction_outside(int);
@ -180,6 +180,7 @@ public:
inline void operator=(const TData& rhs) { f32data = rhs.f32data; } inline void operator=(const TData& rhs) { f32data = rhs.f32data; }
u32 get_unsignedInteger() const { return u32data; } u32 get_unsignedInteger() const { return u32data; }
u32 get_outside() const { return u32data; }
f64 get_value() const { return f32data; } f64 get_value() const { return f32data; }
union { union {

View File

@ -43,7 +43,21 @@ public:
virtual ~TObject(); virtual ~TObject();
void setFlag_operation(u8, int); void setFlag_operation(u8, int);
#if PLATFORM_SHIELD && !DEBUG
void reset(void const* arg1) {
bSequence_ = 0;
mStatus = STATUS_STILL;
pSequence_next = arg1;
u32Wait_ = 0;
}
#else
void reset(void const*); void reset(void const*);
#endif
#if !DEBUG
void reset() { reset(NULL); }
#else
void reset();
#endif
bool forward(u32); bool forward(u32);
virtual void do_begin(); virtual void do_begin();
virtual void do_end(); virtual void do_end();

View File

@ -119,8 +119,7 @@ void JMessage::TResourceContainer::TCResource::Do_destroy(JMessage::TResource* p
#if DEBUG #if DEBUG
delete pResource; delete pResource;
#else #else
// Fake Match - extra null comparison when not doing the conversion operator delete(pResource);
delete (void*)pResource;
#endif #endif
} }

View File

@ -59,7 +59,7 @@ JStudio::ctb::TObject* JStudio::ctb::TControl::getObject_index(u32 param_0) {
return 0; return 0;
} }
JGadget::TLinkList<TObject, -12>::iterator aiStack_14 = ocObject_.begin(); 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; return &*aiStack_14;
} }

View File

@ -7,6 +7,7 @@
#include "JSystem/JGadget/linklist.h" #include "JSystem/JGadget/linklist.h"
#include "math.h" #include "math.h"
#include "stdlib.h" #include "stdlib.h"
#include "limits.h"
namespace JStudio { namespace JStudio {
@ -261,13 +262,13 @@ f64 TFunctionValue_composite::getValue(f64 arg1) {
f64 TFunctionValue_composite::composite_raw(TVector_pointer<TFunctionValue*> const& param_1, f64 TFunctionValue_composite::composite_raw(TVector_pointer<TFunctionValue*> const& param_1,
TData const& param_2, f64 param_3) { TData const& param_2, f64 param_3) {
u32 index = param_2.get_unsignedInteger(); u32 index = param_2.get_unsignedInteger();
u32 size = param_1.size(); if (index >= param_1.size()) {
if (index >= size) {
return 0.0; return 0.0;
} }
TFunctionValue** local_18 = (TFunctionValue**)param_1.begin(); TFunctionValue** p = (TFunctionValue**)param_1.begin();
std::advance_pointer(local_18, index); std::advance(p, index);
TFunctionValue* piVar4 = *local_18; JUT_ASSERT(0x247, p!=0);
TFunctionValue* piVar4 = *p;
return piVar4->getValue(param_3); 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** local_148 = (TFunctionValue**)param_1.begin();
TFunctionValue* pFront = *local_148; TFunctionValue* pFront = *local_148;
JUT_ASSERT(599, pFront!=NULL); JUT_ASSERT(599, pFront!=NULL);
f64 dVar4 = pFront->getValue(param_3); TValue fData = pFront->getValue(param_3);
s32 index = floor(dVar4); s32 index = floor(fData);
u32 uVar2 = param_2.get_unsignedInteger(); u32 uVar2 = param_2.get_outside();
switch (uVar2) { switch (uVar2) {
case 0: case 0:
case 3: case 3:
@ -360,8 +361,9 @@ f64 TFunctionValue_composite::composite_add(TVector_pointer<TFunctionValue*> con
f64 dVar4 = param_2.get_value(); f64 dVar4 = param_2.get_value();
TContainerEnumerator_const_TVector<TFunctionValue*> aTStack_18(param_1); TContainerEnumerator_const_TVector<TFunctionValue*> aTStack_18(param_1);
while (aTStack_18) { while (aTStack_18) {
TFunctionValue* const* ppiVar3 = *aTStack_18; TFunctionValue* const* p = *aTStack_18;
TFunctionValue* piVar3 = *ppiVar3; JUT_ASSERT(0x2a1, p!=0);
TFunctionValue* piVar3 = *p;
dVar4 += piVar3->getValue(param_3); dVar4 += piVar3->getValue(param_3);
} }
return dVar4; return dVar4;
@ -382,8 +384,9 @@ f64 TFunctionValue_composite::composite_subtract(TVector_pointer<TFunctionValue*
JUT_ASSERT(688, pFront!=NULL); JUT_ASSERT(688, pFront!=NULL);
f64 dVar4 = pFront->getValue(param_3); f64 dVar4 = pFront->getValue(param_3);
while (aTStack_18) { while (aTStack_18) {
TFunctionValue* const* ppiVar3 = *aTStack_18; TFunctionValue* const* p = *aTStack_18;
TFunctionValue* piVar3 = *ppiVar3; JUT_ASSERT(0x2b5, p!=0);
TFunctionValue* piVar3 = *p;
dVar4 -= piVar3->getValue(param_3); dVar4 -= piVar3->getValue(param_3);
} }
dVar4 -= param_2.f32data; dVar4 -= param_2.f32data;
@ -399,8 +402,9 @@ f64 TFunctionValue_composite::composite_multiply(TVector_pointer<TFunctionValue*
f64 dVar4 = param_2.get_value(); f64 dVar4 = param_2.get_value();
TContainerEnumerator_const_TVector<TFunctionValue*> aTStack_18(param_1); TContainerEnumerator_const_TVector<TFunctionValue*> aTStack_18(param_1);
while (aTStack_18) { while (aTStack_18) {
TFunctionValue* const* ppiVar3 = *aTStack_18; TFunctionValue* const* p = *aTStack_18;
TFunctionValue* piVar3 = *ppiVar3; JUT_ASSERT(0x2c5, p!=0);
TFunctionValue* piVar3 = *p;
dVar4 *= piVar3->getValue(param_3); dVar4 *= piVar3->getValue(param_3);
} }
return dVar4; return dVar4;
@ -419,18 +423,29 @@ f64 TFunctionValue_composite::composite_divide(TVector_pointer<TFunctionValue*>
TFunctionValue* const* local_148 = *aTStack_18; TFunctionValue* const* local_148 = *aTStack_18;
TFunctionValue* pFront = *local_148; TFunctionValue* pFront = *local_148;
JUT_ASSERT(724, pFront!=NULL); JUT_ASSERT(724, pFront!=NULL);
f64 dVar4 = pFront->getValue(param_3); TValue fData = pFront->getValue(param_3);
while (aTStack_18) { while (aTStack_18) {
TFunctionValue* const* ppiVar3 = *aTStack_18; TFunctionValue* const* p = *aTStack_18;
TFunctionValue* piVar3 = *ppiVar3; JUT_ASSERT(0x2d9, p!=0);
dVar4 /= piVar3->getValue(param_3); TFunctionValue* piVar3 = *p;
fData /= piVar3->getValue(param_3);
JGADGET_ASSERTWARN(0x2db, fData!=TValue(0));
} }
dVar4 /= param_2.f32data; #if DEBUG
return dVar4; 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 { u32 TFunctionValue_constant::getType() const {
return 2; return 2;

View File

@ -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); JGadget::TContainerEnumerator<JGadget::TLinkList<TCreateObject, -4> > aTStack_368(mList);
while(aTStack_368) { while(aTStack_368) {
TCreateObject& piVar1 = *aTStack_368; TCreateObject& piVar1 = *aTStack_368;
JStudio::TObject* obj; JStudio::TObject* obj;
if (piVar1.create(&obj, param_0)) { if (piVar1.create(&obj, rParse)) {
return obj; 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; return NULL;
} }

View File

@ -67,12 +67,20 @@ void TObject::setFlag_operation(u8 op, int val) {
} }
} }
#if !PLATFORM_SHIELD || DEBUG
void TObject::reset(const void* arg1) { void TObject::reset(const void* arg1) {
bSequence_ = 0; bSequence_ = 0;
mStatus = STATUS_STILL; mStatus = STATUS_STILL;
pSequence_next = arg1; pSequence_next = arg1;
u32Wait_ = 0; u32Wait_ = 0;
} }
#endif
#if DEBUG
void TObject::reset() {
reset(NULL);
}
#endif
bool TObject::forward(u32 arg1) { bool TObject::forward(u32 arg1) {
bool temp = false; bool temp = false;
@ -334,10 +342,10 @@ TObject* TControl::getObject(void const* param_0, u32 param_1) {
void TControl::reset() { void TControl::reset() {
resetStatus_(); resetStatus_();
mObject_control.reset(NULL); mObject_control.reset();
JGadget::TContainerEnumerator<JGadget::TLinkList<JStudio::stb::TObject, -12> > aTStack_18(mObjectContainer); JGadget::TContainerEnumerator<JGadget::TLinkList<JStudio::stb::TObject, -12> > aTStack_18(mObjectContainer);
while (aTStack_18) { while (aTStack_18) {
(*aTStack_18).reset(NULL); (*aTStack_18).reset();
} }
} }

View File

@ -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

View File

@ -104,8 +104,20 @@ class numeric_limits<float> {
public: public:
inline static float min(); inline static float min();
inline static float max() { return FLT_MAX; } 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 } // namespace std
#endif #endif
#endif #endif

View File

@ -4,6 +4,12 @@ unsigned long __float_nan[] = {0x7FFFFFFF};
unsigned long __float_huge[] = {0x7F800000}; unsigned long __float_huge[] = {0x7F800000};
#if !__REVOLUTION_SDK__
unsigned long __float_max[] = {0x7F7FFFFF}; unsigned long __float_max[] = {0x7F7FFFFF};
unsigned long __float_epsilon[] = {0x34000000}; unsigned long __float_epsilon[] = {0x34000000};
#endif
#if DEBUG
unsigned long long __double_huge[] = {0x7ff0000000000000ULL};
#endif