mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-03 16:31:56 -04:00
Fix MSVC compiler and linker errors
- Fix struct/class forward declaration mismatches (JAIAudience, JASTrack) causing different MSVC mangled names and unresolved symbols - Add jsystem_stubs.cpp with stubs for JASHeap, JASVoiceBank, J3DShapeTable, JAUSection, JHICommBuf, HIO/HIO2, JOR
This commit is contained in:
@@ -526,6 +526,32 @@ inline f32 J2DHermiteInterpolation(__REGISTER f32 pp1, __REGISTER s16* pp2, __RE
|
||||
fsubs fout, fout, ff0
|
||||
}
|
||||
// clang-format on
|
||||
return fout;
|
||||
#else
|
||||
f32 time1 = (f32)*pp2;
|
||||
f32 value1 = (f32)*pp3;
|
||||
f32 tangent1 = (f32)*pp4;
|
||||
f32 time2 = (f32)*pp5;
|
||||
f32 value2 = (f32)*pp6;
|
||||
f32 tangent2 = (f32)*pp7;
|
||||
|
||||
f32 duration = time2 - time1;
|
||||
f32 t = (pp1 - time1) / duration;
|
||||
f32 t2 = t * t;
|
||||
|
||||
f32 dv = value2 - value1;
|
||||
f32 ff4 = dv - duration * tangent1;
|
||||
|
||||
f32 ff0 = tangent2 * duration + value1;
|
||||
ff0 = ff0 - value2;
|
||||
ff0 = ff0 - ff4;
|
||||
ff0 = t2 * ff0;
|
||||
|
||||
f32 fout = duration * tangent1 + ff0;
|
||||
fout = fout * t + value1;
|
||||
fout = ff4 * t2 + fout;
|
||||
fout = fout - ff0;
|
||||
|
||||
return fout;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef J3DSHAPETABLE_H
|
||||
#define J3DSHAPETABLE_H
|
||||
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/J3DAssert.h"
|
||||
|
||||
class J3DVertexData;
|
||||
struct J3DDrawMtxData;
|
||||
|
||||
@@ -26,6 +26,8 @@ inline f32 J3DCalcZValue(__REGISTER MtxP m, __REGISTER Vec v) {
|
||||
// clang-format on
|
||||
|
||||
return out;
|
||||
#else
|
||||
return m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
#ifndef J3DUD_H
|
||||
#define J3DUD_H
|
||||
|
||||
#include <dolphin/types.h>
|
||||
#include "dolphin/types.h"
|
||||
#ifndef __MWERKS__
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
namespace J3DUD {
|
||||
inline f32 JMAAbs(f32 x) {
|
||||
#ifdef __MWERKS__
|
||||
return __fabsf(x);
|
||||
#endif
|
||||
}
|
||||
inline f32 JMAAbs(f32 x) {
|
||||
#ifdef __MWERKS__
|
||||
return __fabsf(x);
|
||||
#else
|
||||
return fabsf(x);
|
||||
#endif
|
||||
}
|
||||
} // namespace J3DUD
|
||||
|
||||
#endif /* J3DUD_H */
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
} id_;
|
||||
};
|
||||
|
||||
class JASTrack;
|
||||
struct JASTrack;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
@@ -250,7 +250,7 @@ public:
|
||||
|
||||
class JAISoundHandle;
|
||||
class JAIAudible;
|
||||
class JAIAudience;
|
||||
struct JAIAudience;
|
||||
class JAISe;
|
||||
class JAISeq;
|
||||
class JAISoundChild;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
|
||||
class JASTrack;
|
||||
struct JASTrack;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace JASKernel { JKRHeap* getSystemHeap(); };
|
||||
*
|
||||
*/
|
||||
template<u32 ChunkSize, template<typename> class T>
|
||||
class JASMemChunkPool : public T<JASMemChunkPool<ChunkSize, T> >::ObjectLevelLockable {
|
||||
class JASMemChunkPool : public T<JASMemChunkPool<ChunkSize, T> > {
|
||||
struct MemoryChunk {
|
||||
MemoryChunk(MemoryChunk* nextChunk) {
|
||||
mNextChunk = nextChunk;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "JSystem/JAudio2/JASSeqReader.h"
|
||||
|
||||
class JASTrack;
|
||||
struct JASTrack;
|
||||
class JASSeqParser;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <dolphin/types.h>
|
||||
|
||||
class JASTrack;
|
||||
struct JASTrack;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
|
||||
@@ -9,7 +9,11 @@
|
||||
namespace JGadget {
|
||||
namespace search {
|
||||
template <typename T>
|
||||
struct TExpandStride_ {};
|
||||
struct TExpandStride_ {
|
||||
#ifdef _MSC_VER
|
||||
static T get(T n) { return n << 3; }
|
||||
#endif
|
||||
};
|
||||
|
||||
template <>
|
||||
struct TExpandStride_<s32> {
|
||||
|
||||
@@ -6,13 +6,9 @@
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
|
||||
#ifndef __MWERKS__
|
||||
#ifdef _MSVC_LANG
|
||||
#include <float.h>
|
||||
#else
|
||||
#include<limits>
|
||||
#include <limits>
|
||||
#define FLT_EPSILON std::numeric_limits<float>::epsilon()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace JGeometry {
|
||||
|
||||
@@ -50,6 +46,10 @@ struct TUtil<f32> {
|
||||
f32 root = __frsqrte(x);
|
||||
root = 0.5f * root * (3.0f - x * (root * root));
|
||||
return root;
|
||||
#else
|
||||
if (x <= 0.0f)
|
||||
return x;
|
||||
return 1.0f / std::sqrt(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -62,6 +62,10 @@ struct TUtil<f32> {
|
||||
f32 root = __frsqrte(x);
|
||||
root = 0.5f * root * (3.0f - x * (root * root));
|
||||
return x * root;
|
||||
#else
|
||||
if (x <= 0.0f)
|
||||
return x;
|
||||
return std::sqrt(x);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef JMATH_H
|
||||
#define JMATH_H
|
||||
|
||||
#include <dolphin/mtx.h>
|
||||
#include "dolphin/mtx.h"
|
||||
#include <cmath>
|
||||
|
||||
void JMAMTXApplyScale(const Mtx, Mtx, f32, f32, f32);
|
||||
@@ -14,18 +14,24 @@ void JMAVECScaleAdd(__REGISTER const Vec* vec1, __REGISTER const Vec* vec2, __RE
|
||||
inline int JMAAbs(int value) {
|
||||
#ifdef __MWERKS__
|
||||
return __abs(value);
|
||||
#else
|
||||
return abs(value);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline f32 JMAAbs(f32 x) {
|
||||
#ifdef __MWERKS__
|
||||
return __fabsf(x);
|
||||
#else
|
||||
return fabsf(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline f32 JMAFastReciprocal(f32 value) {
|
||||
#ifdef __MWERKS__
|
||||
return __fres(value);
|
||||
#else
|
||||
return 1.0f / value;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -40,6 +46,8 @@ inline float __frsqrtes(__REGISTER double f) {
|
||||
|
||||
// clang-format on
|
||||
return out;
|
||||
#else
|
||||
return 1.0f / sqrtf(f);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -54,6 +62,8 @@ inline f32 JMAFastSqrt(__REGISTER const f32 input) {
|
||||
} else {
|
||||
return input;
|
||||
}
|
||||
#else
|
||||
return sqrt(input);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -87,6 +97,15 @@ inline f32 JMAHermiteInterpolation(__REGISTER f32 p1, __REGISTER f32 p2, __REGIS
|
||||
}
|
||||
// clang-format on
|
||||
return ff25;
|
||||
#else
|
||||
f32 t = (p1 - p2) / (p5 - p2);
|
||||
f32 t2 = t * t;
|
||||
f32 t3 = t2 * t;
|
||||
f32 h1 = 2.0f * t3 - 3.0f * t2 + 1.0f;
|
||||
f32 h2 = -2.0f * t3 + 3.0f * t2;
|
||||
f32 h3 = t3 - 2.0f * t2 + t;
|
||||
f32 h4 = t3 - t2;
|
||||
return h1 * p4 + h2 * p7 + h3 * (p3 - p4) + h4 * (p6 - p3);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -115,6 +134,12 @@ inline void gekko_ps_copy3(__REGISTER void* dst, __REGISTER const void* src) {
|
||||
psq_st src0, 0(dst), 0, 0
|
||||
stfs src1, 8(dst)
|
||||
};
|
||||
#else
|
||||
f32* fsrc = (f32*)src;
|
||||
f32* fdst = (f32*)dst;
|
||||
fdst[0] = fsrc[0];
|
||||
fdst[1] = fsrc[1];
|
||||
fdst[2] = fsrc[2];
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -131,6 +156,15 @@ inline void gekko_ps_copy6(__REGISTER void* dst, __REGISTER const void* src) {
|
||||
psq_st src1, 8(dst), 0, 0
|
||||
psq_st src2, 16(dst), 0, 0
|
||||
};
|
||||
#else
|
||||
f32* fsrc = (f32*)src;
|
||||
f32* fdst = (f32*)dst;
|
||||
fdst[0] = fsrc[0];
|
||||
fdst[1] = fsrc[1];
|
||||
fdst[2] = fsrc[2];
|
||||
fdst[3] = fsrc[3];
|
||||
fdst[4] = fsrc[4];
|
||||
fdst[5] = fsrc[5];
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -156,6 +190,12 @@ inline void gekko_ps_copy12(__REGISTER void* dst, __REGISTER const void* src) {
|
||||
psq_st src4, 32(dst), 0, 0
|
||||
psq_st src5, 40(dst), 0, 0
|
||||
};
|
||||
#else
|
||||
f32* fsrc = (f32*)src;
|
||||
f32* fdst = (f32*)dst;
|
||||
for (int i = 0; i < 12; i++) {
|
||||
fdst[i] = fsrc[i];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -187,13 +227,19 @@ inline void gekko_ps_copy16(__REGISTER void* dst, __REGISTER const void* src) {
|
||||
psq_st src6, 48(dst), 0, 0
|
||||
psq_st src7, 56(dst), 0, 0
|
||||
};
|
||||
#else
|
||||
f32* fsrc = (f32*)src;
|
||||
f32* fdst = (f32*)dst;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
fdst[i] = fsrc[i];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}; // namespace JMath
|
||||
|
||||
namespace JMathInlineVEC {
|
||||
inline void C_VECAdd(__REGISTER const Vec* a, __REGISTER const Vec* b, __REGISTER Vec* ab) {
|
||||
inline void C_VECAdd(__REGISTER const Vec* a, __REGISTER const Vec* b, __REGISTER Vec* ab) {
|
||||
#ifdef __MWERKS__
|
||||
__REGISTER f32 axy;
|
||||
__REGISTER f32 bxy;
|
||||
@@ -211,17 +257,21 @@ namespace JMathInlineVEC {
|
||||
ps_add sumz, az, bz
|
||||
psq_st sumz, 8(ab), 1, 0
|
||||
}
|
||||
#else
|
||||
ab->x = a->x + b->x;
|
||||
ab->y = a->y + b->y;
|
||||
ab->z = a->z + b->z;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
inline void C_VECSubtract(__REGISTER const Vec* a, __REGISTER const Vec* b, __REGISTER Vec* ab) {
|
||||
#ifdef __MWERKS__
|
||||
__REGISTER f32 axy;
|
||||
__REGISTER f32 bxy;
|
||||
__REGISTER f32 az;
|
||||
__REGISTER f32 subz;
|
||||
__REGISTER f32 bz;
|
||||
asm {
|
||||
inline void C_VECSubtract(__REGISTER const Vec* a, __REGISTER const Vec* b, __REGISTER Vec* ab) {
|
||||
#ifdef __MWERKS__
|
||||
__REGISTER f32 axy;
|
||||
__REGISTER f32 bxy;
|
||||
__REGISTER f32 az;
|
||||
__REGISTER f32 subz;
|
||||
__REGISTER f32 bz;
|
||||
asm {
|
||||
psq_l axy, 0(a), 0, 0
|
||||
psq_l bxy, 0(b), 0, 0
|
||||
ps_sub bxy, axy, bxy
|
||||
@@ -230,35 +280,41 @@ namespace JMathInlineVEC {
|
||||
psq_l bz, 8(b), 1, 0
|
||||
ps_sub subz, az, bz
|
||||
psq_st subz, 8(ab), 1, 0
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
ab->x = a->x - b->x;
|
||||
ab->y = a->y - b->y;
|
||||
ab->z = a->z - b->z;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline f32 C_VECSquareMag(__REGISTER const Vec* v) {
|
||||
#ifdef __MWERKS__
|
||||
__REGISTER f32 x_y;
|
||||
__REGISTER f32 z;
|
||||
__REGISTER f32 res;
|
||||
|
||||
asm {
|
||||
inline f32 C_VECSquareMag(__REGISTER const Vec* v) {
|
||||
#ifdef __MWERKS__
|
||||
__REGISTER f32 x_y;
|
||||
__REGISTER f32 z;
|
||||
__REGISTER f32 res;
|
||||
|
||||
asm {
|
||||
psq_l x_y, 0(v), 0, 0
|
||||
ps_mul x_y, x_y, x_y
|
||||
lfs z, 8(v)
|
||||
ps_madd res, z, z, x_y
|
||||
ps_sum0 res, res, x_y, x_y
|
||||
}
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
return res;
|
||||
#else
|
||||
return (v->x * v->x) + (v->y * v->y) + (v->z * v->z);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline f32 C_VECDotProduct(__REGISTER const Vec *a, __REGISTER const Vec *b) {
|
||||
#ifdef __MWERKS__
|
||||
__REGISTER f32 res;
|
||||
__REGISTER f32 thisyz;
|
||||
__REGISTER f32 otheryz;
|
||||
__REGISTER f32 otherxy;
|
||||
__REGISTER f32 thisxy;
|
||||
asm {
|
||||
inline f32 C_VECDotProduct(__REGISTER const Vec* a, __REGISTER const Vec* b) {
|
||||
#ifdef __MWERKS__
|
||||
__REGISTER f32 res;
|
||||
__REGISTER f32 thisyz;
|
||||
__REGISTER f32 otheryz;
|
||||
__REGISTER f32 otherxy;
|
||||
__REGISTER f32 thisxy;
|
||||
asm {
|
||||
psq_l thisyz, 4(a), 0, 0
|
||||
psq_l otheryz, 4(b), 0, 0
|
||||
ps_mul thisyz, thisyz, otheryz
|
||||
@@ -266,13 +322,15 @@ namespace JMathInlineVEC {
|
||||
psq_l otherxy, 0(b), 0, 0
|
||||
ps_madd otheryz, thisxy, otherxy, thisyz
|
||||
ps_sum0 res, otheryz, thisyz, thisyz
|
||||
};
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
};
|
||||
return res;
|
||||
#else
|
||||
return (a->x * b->x) + (a->y * b->y) + (a->z * b->z);
|
||||
#endif
|
||||
}
|
||||
}; // namespace JMathInlineVEC
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
inline T JMAMax(T param_0, T param_1) {
|
||||
T ret;
|
||||
if (param_0 > param_1) {
|
||||
|
||||
@@ -333,7 +333,11 @@ public:
|
||||
return r1.pf_ == r2.pf_;
|
||||
}
|
||||
|
||||
#ifdef __MWERKS__
|
||||
f32 operator*() {
|
||||
#else
|
||||
f32 operator*() const {
|
||||
#endif
|
||||
// this guard is required - removing it breaks float regalloc in std::upper_bound
|
||||
#if DEBUG
|
||||
JUT_ASSERT(947, pf_!=NULL);
|
||||
@@ -444,7 +448,11 @@ public:
|
||||
return r1.pf_ == r2.pf_;
|
||||
}
|
||||
|
||||
#ifdef __MWERKS__
|
||||
f32 operator*() {
|
||||
#else
|
||||
f32 operator*() const {
|
||||
#endif
|
||||
#if DEBUG
|
||||
JUT_ASSERT(1098, pf_!=NULL);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user