From a221df432d1f0b55030cf6910fe4049be4cf30ee Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Sat, 21 Jun 2025 07:40:17 -0400 Subject: [PATCH] jaudio_NES: link ja_calc --- configure.py | 2 +- .../Msl/MSL_C/PPC_EABI/cmath_gcn.h | 21 +++++++++++++++++++ src/static/jaudio_NES/internal/ja_calc.c | 5 +++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/configure.py b/configure.py index e7ed62e5..7c3149b0 100644 --- a/configure.py +++ b/configure.py @@ -778,7 +778,7 @@ config.libs = [ Object(Matching, "jaudio_NES/internal/fxinterface.c"), Object(NonMatching, "jaudio_NES/internal/heapctrl.c"), Object(Matching, "jaudio_NES/internal/ipldec.c"), - Object(NonMatching, "jaudio_NES/internal/ja_calc.c"), + Object(Matching, "jaudio_NES/internal/ja_calc.c", extra_cflags=["-sym off"]), Object(NonMatching, "jaudio_NES/internal/jammain_2.c"), Object(NonMatching, "jaudio_NES/internal/jamosc.c"), Object(NonMatching, "jaudio_NES/internal/memory.c"), diff --git a/include/PowerPC_EABI_Support/Msl/MSL_C/PPC_EABI/cmath_gcn.h b/include/PowerPC_EABI_Support/Msl/MSL_C/PPC_EABI/cmath_gcn.h index 8e0133ef..2555215d 100644 --- a/include/PowerPC_EABI_Support/Msl/MSL_C/PPC_EABI/cmath_gcn.h +++ b/include/PowerPC_EABI_Support/Msl/MSL_C/PPC_EABI/cmath_gcn.h @@ -10,6 +10,27 @@ namespace std { float sqrtf(float); float sinf(float); + inline float sinf(float x) { + return (float)sin((double)x); + } + + inline float sqrtf(float x) { + static const double _half = .5; + static const double _three = 3.0; + volatile float y; + + if (x > 0.0f) { + double guess = __frsqrte((double)x); // returns an approximation to + guess = _half * guess * (_three - guess * guess * x); // now have 12 sig bits + guess = _half * guess * (_three - guess * guess * x); // now have 24 sig bits + guess = _half * guess * (_three - guess * guess * x); // now have 32 sig bits + y = (float)(x * guess); + return y; + } + + return x; + } + #ifdef __cplusplus } #endif diff --git a/src/static/jaudio_NES/internal/ja_calc.c b/src/static/jaudio_NES/internal/ja_calc.c index 4e9cd8e8..f6873b3b 100644 --- a/src/static/jaudio_NES/internal/ja_calc.c +++ b/src/static/jaudio_NES/internal/ja_calc.c @@ -43,9 +43,10 @@ f32 atanf2(f32 x, f32 y) * Address: ........ * Size: 000020 */ -void sinf2(f32) +f32 sinf2(f32 x) { - // UNUSED FUNCTION + // @fabricated + return std::sinf(x); } /*