summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2025-04-12 02:12:27 -0400
committerGitHub <noreply@github.com>2025-04-12 09:12:27 +0300
commitb52d288cd025ee6459caf3fc838b5108b45a0f75 (patch)
tree4315dc61b5506ea048ed2676cb9b780f64f29c8e
parentcc3e0856bfc1d7597c47c84fb428da5f8e0a5536 (diff)
functionvalue 100% (#2389)
* functionvalue 100% * Fix ninja always thinking the build is dirty due to nonexistent dependent file
-rwxr-xr-xconfigure.py2
-rw-r--r--include/JSystem/JGadget/search.h23
-rw-r--r--include/JSystem/JGadget/vector.h15
-rw-r--r--include/JSystem/JStudio/JStudio/functionvalue.h233
-rw-r--r--include/JSystem/JStudio/JStudio_JStage/control.h4
-rw-r--r--src/JSystem/JMessage/resource.cpp3
-rw-r--r--src/JSystem/JStudio/JStudio/functionvalue.cpp165
-rw-r--r--src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/algorithm.h29
-rw-r--r--src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/functional.h18
-rw-r--r--src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/iterator.h14
-rw-r--r--src/TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Processor/ppc/Export/targsupp.s2
11 files changed, 308 insertions, 200 deletions
diff --git a/configure.py b/configure.py
index 5cceeee96b..9f0ac3a85a 100755
--- a/configure.py
+++ b/configure.py
@@ -770,7 +770,7 @@ config.libs = [
[
Object(MatchingFor("GZ2E01"), "JSystem/JStudio/JStudio/ctb.cpp"),
Object(MatchingFor("GZ2E01"), "JSystem/JStudio/JStudio/ctb-data.cpp"),
- Object(NonMatching, "JSystem/JStudio/JStudio/functionvalue.cpp"),
+ Object(Equivalent, "JSystem/JStudio/JStudio/functionvalue.cpp", extra_cflags=['-pragma "nosyminline off"']), # weak func order
Object(NonMatching, "JSystem/JStudio/JStudio/fvb.cpp"),
Object(MatchingFor("GZ2E01"), "JSystem/JStudio/JStudio/fvb-data.cpp"),
Object(MatchingFor("GZ2E01"), "JSystem/JStudio/JStudio/fvb-data-parse.cpp"),
diff --git a/include/JSystem/JGadget/search.h b/include/JSystem/JGadget/search.h
index 1e6b7561af..1fdd846dde 100644
--- a/include/JSystem/JGadget/search.h
+++ b/include/JSystem/JGadget/search.h
@@ -25,13 +25,22 @@ struct TExpandStride_<s32> {
//! 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];
+ JUT_ASSERT(200, pValue!=0);
+ u32 index = idx;
+ if (index >= count) {
+ return fallback;
+ } else {
+ return pValue[index];
+ }
}
+template <typename Category, typename T, typename Distance, typename Pointer, typename Reference>
+struct TIterator : public std::iterator<Category, T, Distance, Pointer, Reference> {
+};
+
template <typename Iterator, typename T, typename Predicate>
inline Iterator findUpperBound_binary_all(Iterator first, Iterator last, const T& val, Predicate p) {
- return upper_bound(first, last, val, p);
+ return std::upper_bound(first, last, val, p);
}
template <typename Iterator, typename T, typename Predicate>
@@ -104,15 +113,13 @@ inline Iterator findUpperBound_binary_end(Iterator first, Iterator last, const T
template <typename Iterator, typename T, typename Predicate>
Iterator findUpperBound_binary_current(Iterator first, Iterator last, Iterator current, const T& val, Predicate p) {
return current == last || p(val, *current) ?
- findUpperBound_binary_end(first, current, val, p)
- : findUpperBound_binary_begin(current, last, val, p);
+ findUpperBound_binary_end(first, current, val, p) :
+ findUpperBound_binary_begin(current, last, val, p);
}
-// NONMATCHING stack alloc
template <typename Iterator, typename T>
Iterator findUpperBound_binary_current(Iterator first, Iterator last, Iterator current, const T& val) {
- std::less<T> less;
- return findUpperBound_binary_current(first, last, current, val, less);
+ return findUpperBound_binary_current(first, last, current, val, std::less<T>());
}
} // namespace JGadget
diff --git a/include/JSystem/JGadget/vector.h b/include/JSystem/JGadget/vector.h
index 6372f183a5..e38211f6b5 100644
--- a/include/JSystem/JGadget/vector.h
+++ b/include/JSystem/JGadget/vector.h
@@ -1,9 +1,8 @@
#ifndef VECTOR_H
#define VECTOR_H
-#include <dolphin/types.h>
-
-extern u8 data_804511E0;
+#include "JSystem/JGadget/std-memory.h"
+#include "types.h"
namespace JGadget {
@@ -15,16 +14,6 @@ typedef u32 (*ExtendFunc)(u32, u32, u32);
} // namespace vector
-template <typename T>
-struct TAllocator {
- static TAllocator get() {}
- inline TAllocator(u8 param_0) { _0 = param_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) {
diff --git a/include/JSystem/JStudio/JStudio/functionvalue.h b/include/JSystem/JStudio/JStudio/functionvalue.h
index 6152f05fdb..2d9430287b 100644
--- a/include/JSystem/JStudio/JStudio/functionvalue.h
+++ b/include/JSystem/JStudio/JStudio/functionvalue.h
@@ -1,11 +1,10 @@
#ifndef FUNCTIONVALUE_H
#define FUNCTIONVALUE_H
+#include <math.h>
#include "JSystem/JGadget/std-vector.h"
-#include "dolphin/os.h"
-#include <iterator.h>
-
-extern u8 lit_569;
+#include "JSystem/JGadget/define.h"
+#include "JSystem/JGadget/search.h"
namespace JStudio {
@@ -229,8 +228,8 @@ public:
};
class TFunctionValue_transition : public TFunctionValue,
- TFunctionValueAttribute_range,
- TFunctionValueAttribute_interpolate {
+ public TFunctionValueAttribute_range,
+ public TFunctionValueAttribute_interpolate {
public:
/* 802823EC */ TFunctionValue_transition();
/* 80283CE4 */ virtual ~TFunctionValue_transition() {}
@@ -254,8 +253,8 @@ private:
};
class TFunctionValue_list : public TFunctionValue,
- TFunctionValueAttribute_range,
- TFunctionValueAttribute_interpolate {
+ public TFunctionValueAttribute_range,
+ public TFunctionValueAttribute_interpolate {
public:
struct TIndexData_ {
f64 _0;
@@ -305,43 +304,78 @@ private:
};
class TFunctionValue_list_parameter : public TFunctionValue,
- TFunctionValueAttribute_range,
- TFunctionValueAttribute_interpolate {
+ public TFunctionValueAttribute_range,
+ public TFunctionValueAttribute_interpolate {
public:
- struct TIterator_data_ {
- TIterator_data_(const f32* value) : value_(value) {}
- TIterator_data_& operator--() {
- value_ -= 2;
+ struct TIterator_data_
+ : public JGadget::TIterator<
+ std::random_access_iterator_tag,
+ const f32,
+ ptrdiff_t,
+ const f32*,
+ const f32&
+ >
+ {
+ TIterator_data_(const TFunctionValue_list_parameter& rParent, const f32* value) {
+#ifdef DEBUG
+ pOwn_ = &rParent;
+#endif
+ pf_ = value;
+ }
+
+ const f32* get() const { return pf_; }
+ void set(const f32* value) { pf_ = value; }
+
+ friend bool operator==(const TIterator_data_& r1, const TIterator_data_& r2) {
+#ifdef DEBUG
+ if (!(r1.pOwn_==r2.pOwn_)) {
+ JGadget_outMessage msg(JGadget_outMessage::warning, __FILE__, 124);
+ msg << "r1.pOwn_==r2.pOwn_";
+ }
+#endif
+ return r1.pf_ == r2.pf_;
+ }
+
+ f32 operator*() {
+#ifdef DEBUG
+ JUT_ASSERT(947, pf_!=0);
+#endif
+ return *pf_;
+ }
+
+ TIterator_data_& operator+=(s32 n) {
+ pf_ += suData_size * n;
return *this;
}
TIterator_data_& operator-=(s32 n) {
- value_ -= n * 2;
+ pf_ -= suData_size * n;
return *this;
}
- s32 operator-(const TIterator_data_& other) {
- return (u32)(value_ - other.value_) >> 1;
- }
TIterator_data_& operator++() {
- value_ += 2;
+ pf_ += suData_size;
return *this;
}
- TIterator_data_& operator+=(s32 n) {
- value_ += n * 2;
+ TIterator_data_& operator--() {
+ pf_ -= suData_size;
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_;
+ friend s32 operator-(const TIterator_data_& r1, const TIterator_data_& r2) {
+#ifdef DEBUG
+ if (!(r1.pOwn_==r2.pOwn_)) {
+ JGadget_outMessage msg(JGadget_outMessage::warning, __FILE__, 124);
+ msg << "r1.pOwn_==r2.pOwn_";
+ }
+#endif
+ return (r1.pf_ - r2.pf_) / suData_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;
+#ifdef DEBUG
+ /* 0x00 */ const TFunctionValue_list_parameter* pOwn_;
+ /* 0x04 */ const f32* pf_;
+#else
+ /* 0x00 */ const f32* pf_;
+#endif
};
typedef f64 (*update_INTERPOLATE)(const TFunctionValue_list_parameter&, f64);
@@ -364,10 +398,12 @@ public:
/* 80283060 */ static f64
update_INTERPOLATE_BSPLINE_dataMore3_(JStudio::TFunctionValue_list_parameter const&, f64);
- f64 data_getValue_back() {
- return pfData_[(uData_ - 1) * 2];
+ static const u32 suData_size = 2;
+
+ f64 data_getValue_back() const {
+ return pfData_[(uData_ - 1) * suData_size];
}
- f64 data_getValue_front() { return pfData_[0]; }
+ f64 data_getValue_front() const { return pfData_[0]; }
private:
/* 0x44 */ const f32* pfData_;
@@ -378,52 +414,88 @@ private:
/* 0x58 */ update_INTERPOLATE pfnUpdate_;
};
-class TFunctionValue_hermite : public TFunctionValue, TFunctionValueAttribute_range {
+class TFunctionValue_hermite : public TFunctionValue, public TFunctionValueAttribute_range {
public:
- struct TIterator_data_ {
+ struct TIterator_data_
+ : public JGadget::TIterator<
+ std::random_access_iterator_tag,
+ const f32,
+ ptrdiff_t,
+ const f32*,
+ const f32&
+ >
+ {
TIterator_data_(const TFunctionValue_hermite& rParent, const f32* value) {
- value_ = value;
- size_ = rParent.data_getSize();
+#ifdef DEBUG
+ pOwn_ = &rParent;
+#endif
+ pf_ = value;
+ uSize_ = rParent.data_getSize();
}
- const f32* get() { return value_; }
-
+ const f32* get() const { return pf_; }
void set(const f32* value, u32 size) {
- value_ = value;
- size_ = size;
+ pf_ = value;
+ uSize_ = size;
}
-
- 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_;
+ friend bool operator==(const TIterator_data_& r1, const TIterator_data_& r2) {
+#ifdef DEBUG
+ if (!(r1.pOwn_==r2.pOwn_)) {
+ JGadget_outMessage msg(JGadget_outMessage::warning, __FILE__, 124);
+ msg << "r1.pOwn_==r2.pOwn_";
+ }
+#endif
+ return r1.pf_ == r2.pf_;
+ }
+
+ f32 operator*() {
+#ifdef DEBUG
+ JUT_ASSERT(1098, pf_!=0);
+#endif
+ return *pf_;
+ }
+
+ TIterator_data_& operator+=(s32 n) {
+ pf_ += uSize_ * n;
return *this;
}
TIterator_data_& operator-=(s32 n) {
- value_ -= size_ * n;
+ pf_ -= uSize_ * n;
return *this;
}
- s32 operator-(const TIterator_data_& other) {
- return (value_ - other.value_) / size_;
- }
TIterator_data_& operator++() {
- value_ += size_;
+ pf_ += uSize_;
return *this;
}
- TIterator_data_& operator+=(s32 n) {
- value_ += size_ * n;
+ TIterator_data_& operator--() {
+ pf_ -= uSize_;
return *this;
}
- /* 0x00 */ const f32* value_;
- /* 0x04 */ u32 size_;
+ friend s32 operator-(const TIterator_data_& r1, const TIterator_data_& r2) {
+#ifdef DEBUG
+ if (!(r1.pOwn_==r2.pOwn_)) {
+ JGadget_outMessage msg(JGadget_outMessage::warning, __FILE__, 124);
+ msg << "r1.pOwn_==r2.pOwn_";
+ }
+ if (!(r1.uSize_==r2.uSize_)) {
+ JGadget_outMessage msg(JGadget_outMessage::warning, __FILE__, 124);
+ msg << "r1.uSize_==r2.uSize_";
+ }
+ JUT_ASSERT(0, r1.uSize_>0);
+#endif
+ return (r1.pf_ - r2.pf_) / r1.uSize_;
+ }
- typedef s32 difference_type;
- typedef f32 value_type;
- typedef const f32* pointer;
- typedef const f32& reference;
- typedef std::random_access_iterator_tag iterator_category;
+#ifdef DEBUG
+ /* 0x00 */ const TFunctionValue_hermite* pOwn_;
+ /* 0x04 */ const f32* pf_;
+ /* 0x08 */ u32 uSize_;
+#else
+ /* 0x00 */ const f32* pf_;
+ /* 0x04 */ u32 uSize_;
+#endif
};
/* 802832C4 */ TFunctionValue_hermite();
@@ -437,13 +509,13 @@ public:
/* 8028344C */ virtual f64 getValue(f64);
u32 data_getSize() const { return uSize_; }
- f64 data_getValue_back() {
- return pf_[(u_ - 1) * uSize_];
+ f64 data_getValue_back() const {
+ return pfData_[(u_ - 1) * uSize_];
}
- f64 data_getValue_front() { return pf_[0]; }
+ f64 data_getValue_front() const { return pfData_[0]; }
private:
- /* 0x40 */ const f32* pf_;
+ /* 0x40 */ const f32* pfData_;
/* 0x44 */ u32 u_;
/* 0x48 */ u32 uSize_;
/* 0x4c */ TIterator_data_ dat1;
@@ -451,6 +523,35 @@ private:
/* 0x54 */ TIterator_data_ dat3;
};
+namespace functionvalue {
+
+inline f64 extrapolateParameter_raw(f64 a1, f64 a2) {
+ return a1;
+}
+
+inline f64 extrapolateParameter_repeat(f64 a1, f64 a2) {
+ f64 t = fmod(a1, a2);
+
+ if (t < 0.0)
+ t += a2;
+
+ return t;
+}
+
+f64 extrapolateParameter_turn(f64, f64);
+
+inline f64 extrapolateParameter_clamp(f64 value, f64 max) {
+ if (value <= 0.0)
+ return 0.0;
+
+ if (max <= value)
+ value = max;
+
+ return value;
+}
+
+}; // namespace functionvalue
+
} // namespace JStudio
#endif /* FUNCTIONVALUE_H */
diff --git a/include/JSystem/JStudio/JStudio_JStage/control.h b/include/JSystem/JStudio/JStudio_JStage/control.h
index c595055640..86ed98c0be 100644
--- a/include/JSystem/JStudio/JStudio_JStage/control.h
+++ b/include/JSystem/JStudio/JStudio_JStage/control.h
@@ -52,10 +52,6 @@ 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
{
diff --git a/src/JSystem/JMessage/resource.cpp b/src/JSystem/JMessage/resource.cpp
index b3fac0ab0d..8de8effe4c 100644
--- a/src/JSystem/JMessage/resource.cpp
+++ b/src/JSystem/JMessage/resource.cpp
@@ -19,7 +19,8 @@ u16 JMessage::TResource::toMessageIndex_messageID(u32 lowerHalf, u32 upperHalf,
u32 val = -1;
bool check = true;
- switch (mMessageID.get_formSupplement()) {
+ u8 sp0A = mMessageID.get_formSupplement();
+ switch (sp0A) {
case 0:
if (upperHalf) {
check = false;
diff --git a/src/JSystem/JStudio/JStudio/functionvalue.cpp b/src/JSystem/JStudio/JStudio/functionvalue.cpp
index 03c7a4c9ae..6f9982293f 100644
--- a/src/JSystem/JStudio/JStudio/functionvalue.cpp
+++ b/src/JSystem/JStudio/JStudio/functionvalue.cpp
@@ -13,22 +13,6 @@
namespace JStudio {
-namespace functionvalue {
-f64 extrapolateParameter_raw(f64, f64);
-inline f64 extrapolateParameter_repeat(f64, f64);
-f64 extrapolateParameter_turn(f64, f64);
-f64 extrapolateParameter_clamp(f64, f64);
-
-static inline f64 i_extrapolateParameter_repeat(f64 a1, f64 a2) {
- f64 t = fmod(a1, a2);
-
- if (t < 0.0)
- t += a2;
-
- return t;
-}
-}; // namespace functionvalue
-
namespace {
const ExtrapolateParameter gapfnExtrapolateParameter_[4] = {
@@ -95,46 +79,54 @@ f64 interpolateValue_hermite(f64 c0, f64 c1, f64 x, f64 c2, f64 x2, f64 c3, f64
/* 80281774-802817D8 27C0B4 0064+00 1/1 0/0 0/0 .text
* interpolateValue_BSpline_uniform__Q27JStudio13functionvalueFddddd */
-f64 interpolateValue_BSpline_uniform(f64 f1, f64 f2, f64 f3, f64 f4, f64 f5) {
- f64 f6 = (1.0 - f1) * (1.0 - f1);
- f64 f9 = f6 * (1.0 - f1);
+f64 interpolateValue_BSpline_uniform(f64 interpolationFactor, f64 point2, f64 point3, f64 point4, f64 point5) {
+ f64 inverseInterpolationFactor = (1.0 - interpolationFactor);
+ f64 inverseInterpolationFactorSquared = inverseInterpolationFactor * inverseInterpolationFactor;
+ f64 inverseInterpolationFactorCubed = inverseInterpolationFactorSquared * inverseInterpolationFactor;
+
+ f64 interpolationFactorSquared = interpolationFactor * interpolationFactor;
+ f64 interpolationFactorCubed = interpolationFactorSquared * interpolationFactor;
+
+ f64 coefficient1 = inverseInterpolationFactorCubed;
- f64 f0 = f1 * f1;
- f64 f8 = f0 * f1;
+ f64 blendFactorForPoint3 = (1.0 / 2.0) * interpolationFactorCubed - interpolationFactorSquared + (2.0 / 3.0);
- f64 temp = f9;
- f64 temp3 = ((0.5 * f8 - f0) + (2.0 / 3.0));
- f64 temp2 = ((1.0 / 6.0) + 0.5 * ((f1 + f0) - f8));
+ f64 blendFactorForPoint4 =
+ (1.0 / 2.0) * (interpolationFactor + interpolationFactorSquared - interpolationFactorCubed) + (1.0 / 6.0);
- return temp3 * f3 + (temp * f2 + f8 * f5) * (1.0 / 6.0) + temp2 * f4;
+ f64 coefficient2 = interpolationFactorCubed;
+
+ return ((coefficient1 * point2) + (coefficient2 * point5)) * (1.0 / 6.0) + (blendFactorForPoint3 * point3) +
+ (blendFactorForPoint4 * point4);
}
/* 802817D8-802818B8 27C118 00E0+00 1/1 0/0 0/0 .text
* interpolateValue_BSpline_nonuniform__Q27JStudio13functionvalueFdPCdPCd */
-f64 interpolateValue_BSpline_nonuniform(f64 f, f64 const* p1, f64 const* p2) {
- f64 f0 = p2[0];
- f64 f1 = p2[1];
- f64 f2 = p2[2];
- f64 f3 = p2[3];
- f64 f4 = p2[4];
- f64 f5 = p2[5];
- f64 a0 = f - f0;
- f64 a1 = f - f1;
- f64 a2 = f - f2;
- f64 a3 = f3 - f;
- f64 a4 = f4 - f;
- f64 a5 = f5 - f;
- f64 t0 = 1.0 / (f3 - f2);
- f64 t1 = (a3 * t0) / (f3 - f1);
- f64 t2 = (a2 * t0) / (f4 - f2);
- f64 t3 = (a3 * t1) / (f3 - f0);
- f64 t4 = (a1 * t1 + a4 * t2) / (f4 - f1);
- f64 t5 = (a2 * t2) / (f5 - f2);
- f64 coeff0 = a3 * t3;
- f64 coeff1 = a0 * t3 + a4 * t4;
- f64 coeff2 = a1 * t4 + a5 * t5;
- f64 coeff3 = a2 * t5;
- return coeff0 * p1[0] + coeff1 * p1[1] + coeff2 * p1[2] + coeff3 * p1[3];
+f64 interpolateValue_BSpline_nonuniform(f64 interpolationFactor, const f64* controlPoints, const f64* knotVector) {
+ f64 knot0 = knotVector[0];
+ f64 knot1 = knotVector[1];
+ f64 knot2 = knotVector[2];
+ f64 knot3 = knotVector[3];
+ f64 knot4 = knotVector[4];
+ f64 knot5 = knotVector[5];
+ f64 diff0 = interpolationFactor - knot0;
+ f64 diff1 = interpolationFactor - knot1;
+ f64 diff2 = interpolationFactor - knot2;
+ f64 diff3 = knot3 - interpolationFactor;
+ f64 diff4 = knot4 - interpolationFactor;
+ f64 diff5 = knot5 - interpolationFactor;
+ f64 inverseDeltaKnot32 = 1 / (knot3 - knot2);
+ f64 blendFactor3 = (diff3 * inverseDeltaKnot32) / (knot3 - knot1);
+ f64 blendFactor2 = (diff2 * inverseDeltaKnot32) / (knot4 - knot2);
+ f64 blendFactor1 = (diff3 * blendFactor3) / (knot3 - knot0);
+ f64 blendFactor4 = ((diff1 * blendFactor3) + (diff4 * blendFactor2)) / (knot4 - knot1);
+ f64 blendFactor5 = (diff2 * blendFactor2) / (knot5 - knot2);
+ f64 term1 = diff3 * blendFactor1;
+ f64 term2 = (diff0 * blendFactor1) + (diff4 * blendFactor4);
+ f64 term3 = (diff1 * blendFactor4) + (diff5 * blendFactor5);
+ f64 term4 = diff2 * blendFactor5;
+
+ return (term1 * controlPoints[0]) + (term2 * controlPoints[1]) + (term3 * controlPoints[2]) + (term4 * controlPoints[3]);
}
inline f64 interpolateValue_linear(f64 a1, f64 a2, f64 a3, f64 a4, f64 a5) {
@@ -153,7 +145,7 @@ inline f64 interpolateValue_plateau(f64 a1, f64 a2, f64 a3, f64 a4, f64 a5) {
* extrapolateParameter_turn__Q27JStudio13functionvalueFdd */
f64 extrapolateParameter_turn(f64 param_0, f64 param_1) {
f64 dVar2 = 2.0 * param_1;
- f64 dVar1 = i_extrapolateParameter_repeat(param_0, dVar2);
+ f64 dVar1 = extrapolateParameter_repeat(param_0, dVar2);
if (dVar1 >= param_1) {
dVar1 = dVar2 - dVar1;
}
@@ -321,7 +313,7 @@ f64 TFunctionValue_composite::composite_index(TVector_pointer<TFunctionValue*> c
index = size - 2;
}
break;
- case 1:
+ case 1: {
div_t dt = div(index, size - 1);
index = dt.rem;
if (index < 0) {
@@ -329,6 +321,7 @@ f64 TFunctionValue_composite::composite_index(TVector_pointer<TFunctionValue*> c
index--;
}
break;
+ }
case 2:
if (size - 1 == 1) {
index = 0;
@@ -686,7 +679,7 @@ f64 TFunctionValue_list::update_INTERPOLATE_BSPLINE_dataMore3_(
TFunctionValue_list_parameter::TFunctionValue_list_parameter()
- : pfData_(NULL), uData_(0), dat1(NULL), dat2(dat1), dat3(dat1), pfnUpdate_(NULL) {}
+ : pfData_(NULL), uData_(0), dat1(*this, NULL), dat2(dat1), dat3(dat1), pfnUpdate_(NULL) {}
u32 TFunctionValue_list_parameter::getType() const {
return 5;
@@ -697,7 +690,7 @@ TFunctionValueAttributeSet TFunctionValue_list_parameter::getAttributeSet() {
}
void TFunctionValue_list_parameter::data_set(const f32* pf, u32 u) {
- ASSERT((pf != NULL) || (u == 0));
+ JUT_ASSERT(1277, (pf != NULL) || (u == 0));
pfData_ = pf;
uData_ = u;
@@ -705,6 +698,9 @@ void TFunctionValue_list_parameter::data_set(const f32* pf, u32 u) {
dat1.set(pfData_);
dat2.set(&pfData_[uData_ * 2]);
dat3 = dat1;
+#ifdef DEBUG
+ pfnUpdate_ = NULL;
+#endif
}
void TFunctionValue_list_parameter::initialize() {
@@ -714,7 +710,7 @@ void TFunctionValue_list_parameter::initialize() {
pfData_ = NULL;
uData_ = 0;
- TIterator_data_ iter(NULL);
+ TIterator_data_ iter(*this, NULL);
dat1 = iter;
dat2 = dat1;
@@ -765,7 +761,6 @@ f64 TFunctionValue_list_parameter::getValue(f64 param_0) {
}
const f32* pf = dat3.get();
- const int suData_size = 1;
JUT_ASSERT(1411, (pfData_<=pf-suData_size)&&(pf<pfData_+suData_size*uData_));
JUT_ASSERT(1412, pfnUpdate_!=0);
return pfnUpdate_(*this, param_0);
@@ -805,8 +800,8 @@ f64 TFunctionValue_list_parameter::update_INTERPOLATE_BSPLINE_dataMore3_(
local_68[2] = pfVar2[1];
local_48[2] = pfVar2[-2];
local_48[3] = pfVar2[0];
- s32 iVar3 = ((int)rThis.dat2.get() - (int)pfVar2) / 4;
s32 iVar5 = ((int)pfVar2 - (int)rThis.dat1.get()) / 4;
+ s32 iVar3 = ((int)rThis.dat2.get() - (int)pfVar2) / 4;
switch(iVar5) {
case 2:
local_68[0] = 2.0 * local_68[1] - local_68[2];
@@ -816,6 +811,7 @@ f64 TFunctionValue_list_parameter::update_INTERPOLATE_BSPLINE_dataMore3_(
local_48[0] = 2.0 * local_48[2] - local_48[4];
switch (iVar3) {
case 2:
+ JUT_ASSERT(1481, false);
case 4:
local_48[5] = 2.0 * local_48[4] - local_48[3];
break;
@@ -874,7 +870,7 @@ f64 TFunctionValue_list_parameter::update_INTERPOLATE_BSPLINE_dataMore3_(
TFunctionValue_hermite::TFunctionValue_hermite()
- : pf_(NULL), u_(0), uSize_(0), dat1(*this, NULL), dat2(dat1), dat3(dat1) {}
+ : pfData_(NULL), u_(0), uSize_(0), dat1(*this, NULL), dat2(dat1), dat3(dat1) {}
u32 JStudio::TFunctionValue_hermite::getType() const {
return 6;
@@ -885,27 +881,26 @@ TFunctionValueAttributeSet TFunctionValue_hermite::getAttributeSet() {
}
void TFunctionValue_hermite::data_set(const f32* pf, u32 u, u32 uSize) {
- ASSERT((pf != NULL) || (u == 0));
- ASSERT((uSize == 3) || (uSize == 4));
+ JUT_ASSERT(1676, (pf != NULL) || (u == 0));
+ JUT_ASSERT(1677, (uSize == 3) || (uSize == 4));
- pf_ = pf;
+ pfData_ = pf;
u_ = u;
uSize_ = uSize;
- dat1.set(pf_, uSize_);
- dat2.set(&pf_[u_ * uSize_], uSize_);
+ dat1.set(pfData_, uSize_);
+ dat2.set(&pfData_[u_ * uSize_], uSize_);
dat3 = dat1;
}
void TFunctionValue_hermite::initialize() {
range_initialize();
- pf_ = NULL;
+ pfData_ = NULL;
u_ = 0;
uSize_ = 0;
- TIterator_data_ data(*this, NULL);
- dat1 = data;
+ dat1 = TIterator_data_(*this, NULL);
dat2 = dat1;
dat3 = dat1;
}
@@ -916,10 +911,11 @@ void TFunctionValue_hermite::prepare() {
/* 8028344C-80283570 27DD8C 0124+00 1/0 0/0 0/0 .text
* getValue__Q27JStudio22TFunctionValue_hermiteFd */
-f64 TFunctionValue_hermite::getValue(f64 pfData_) {
- pfData_ = range_getParameter(pfData_, data_getValue_front(), data_getValue_back());
- JUT_ASSERT(1395, pfData_!=0)
- dat3 = JGadget::findUpperBound_binary_current(dat1, dat2, dat3, pfData_);
+f64 TFunctionValue_hermite::getValue(f64 param_0) {
+ param_0 = range_getParameter(param_0, data_getValue_front(), data_getValue_back());
+ JUT_ASSERT(1716, pfData_!=0)
+
+ dat3 = JGadget::findUpperBound_binary_current(dat1, dat2, dat3, param_0);
if (dat3 == dat1) {
return dat3.get()[1];
@@ -932,38 +928,9 @@ f64 TFunctionValue_hermite::getValue(f64 pfData_) {
const f32* pfVar5 = dat3.get();
const f32* pfVar7 = pfVar5 - uSize_;
return functionvalue::interpolateValue_hermite(
- pfData_, pfVar7[0], pfVar7[1],
+ param_0, pfVar7[0], pfVar7[1],
pfVar7[uSize_ - 1], pfVar5[0],
pfVar5[1], pfVar5[2]);
}
} // namespace JStudio
-
-namespace JStudio {
-namespace functionvalue {
-
-f64 extrapolateParameter_raw(f64 a1, f64 a2) {
- return a1;
-}
-
-inline f64 extrapolateParameter_repeat(f64 a1, f64 a2) {
- f64 t = fmod(a1, a2);
-
- if (t < 0.0)
- t += a2;
-
- return t;
-}
-
-f64 extrapolateParameter_clamp(f64 value, f64 max) {
- if (value <= 0.0)
- return 0.0;
-
- if (max <= value)
- value = max;
-
- return value;
-}
-
-} // namespace functionvalue
-} // namespace JStudio
diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/algorithm.h b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/algorithm.h
index 521ea84e6f..23d1a166eb 100644
--- a/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/algorithm.h
+++ b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/algorithm.h
@@ -3,10 +3,36 @@
#include <iterator.h>
#include <string.h>
+#include <functional.h>
namespace std {
+
+template <class ForwardIterator, class T, typename Predicate>
+inline ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, const T& val, Predicate p) {
+ typedef typename iterator_traits<ForwardIterator>::difference_type difference_type;
+ difference_type len = std::distance(first, last);
+
+ while (len > 0) {
+ ForwardIterator i = first;
+ difference_type step = len / 2;
+ std::advance(i, step);
+
+ if (p(*i, val)) {
+ first = ++i;
+ len -= step + 1;
+ } else {
+ len = step;
+ }
+ }
+
+ return first;
+}
+
template <class ForwardIterator, class T>
ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, const T& val) {
+ // For some reason, calling the other lower_bound matches for debug, but not for retail:
+ // return lower_bound(first, last, val, std::detail::less<T, T>());
+
typedef typename iterator_traits<ForwardIterator>::difference_type difference_type;
difference_type len = std::distance(first, last);
@@ -47,9 +73,6 @@ ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last, const T
return first;
}
-template <class ForwardIterator, class T>
-ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last, const T& val);
-
template<class InputIt, class UnaryPredicate>
InputIt find_if(InputIt first, InputIt last, UnaryPredicate p) {
while (first != last && !p(*first)) {
diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/functional.h b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/functional.h
index 79429e5e9f..1c7b8fb46c 100644
--- a/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/functional.h
+++ b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/functional.h
@@ -2,11 +2,21 @@
#define MSL_FUNCTIONAL_H_
namespace std {
-template <class T> struct less {
- bool operator()(const T& a, const T& b) const {
- return a < b;
- }
+
+namespace detail {
+
+template <class T1, class T2>
+struct less {
+ bool operator()(const T1& lhs, const T2& rhs) const { return lhs < rhs; }
+};
+
+} // namespace detail
+
+template <class T>
+struct less : public std::detail::less<T, T> {
+ bool operator()(const T& lhs, const T& rhs) const { return lhs < rhs; }
};
+
} // namespace std
#endif
diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/iterator.h b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/iterator.h
index e79e680143..73ca5de699 100644
--- a/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/iterator.h
+++ b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/iterator.h
@@ -28,6 +28,20 @@ struct iterator_traits<T*> {
typedef random_access_iterator_tag iterator_category;
};
+template<
+ class Category,
+ class T,
+ class Distance,
+ class Pointer,
+ class Reference
+> struct iterator {
+ typedef Distance difference_type;
+ typedef T value_type;
+ typedef Pointer pointer;
+ typedef Reference reference;
+ typedef Category iterator_category;
+};
+
template <class InputIterator, class Distance>
inline void __advance(InputIterator& i, Distance n, input_iterator_tag) {
for (; n > 0; --n)
diff --git a/src/TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Processor/ppc/Export/targsupp.s b/src/TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Processor/ppc/Export/targsupp.s
index 0244131bd8..0d3813d084 100644
--- a/src/TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Processor/ppc/Export/targsupp.s
+++ b/src/TRK_MINNOW_DOLPHIN/debugger/embedded/MetroTRK/Processor/ppc/Export/targsupp.s
@@ -1,5 +1,5 @@
.include "macros.inc"
-.file "targsupp.s"
+# .file "targsupp.s"
.text
.balign 16