Fix errors when building with -ipa program (#3035)

This commit is contained in:
Max Roncace 2026-01-11 22:25:26 -05:00 committed by GitHub
parent 47daf0b4ed
commit 6a59c5231f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 88 additions and 91 deletions

View File

@ -1084,7 +1084,7 @@ config.libs = [
Object(MatchingFor(ALL_GCN), "JSystem/JAudio2/JASOscillator.cpp"),
Object(MatchingFor(ALL_GCN), "JSystem/JAudio2/JASAiCtrl.cpp"),
Object(MatchingFor(ALL_GCN), "JSystem/JAudio2/JASAudioThread.cpp"),
Object(MatchingFor(ALL_GCN, "ShieldD"), "JSystem/JAudio2/JASAudioReseter.cpp"),
Object(MatchingFor(ALL_GCN), "JSystem/JAudio2/JASAudioReseter.cpp"),
Object(MatchingFor(ALL_GCN, "ShieldD"), "JSystem/JAudio2/JASDSPChannel.cpp"),
Object(MatchingFor(ALL_GCN), "JSystem/JAudio2/JASDSPInterface.cpp"),
Object(MatchingFor(ALL_GCN), "JSystem/JAudio2/JASDriverIF.cpp"),

View File

@ -29,6 +29,7 @@ struct JASDSPChannel {
void drop();
void setPriority(u8);
void updateProc();
u8 getStatus() const { return mStatus; }
static void initAll();
static JASDSPChannel* alloc(u8, Callback, void*);

View File

@ -2,8 +2,18 @@
#define JMATRIGONOMETRIC_H
#include "dolphin/types.h"
#include <math>
#include <utility>
#ifdef __cplusplus
extern "C" {
#endif
extern double asin(double);
extern double atan(double);
#ifdef __cplusplus
}
#endif
namespace JMath {
template<typename T>
struct TAngleConstant_;
@ -28,6 +38,16 @@ template<int N, typename T>
struct TSinCosTable {
std::pair<T, T> table[1 << N];
TSinCosTable() {
init();
}
void init() {
for (int i = 0; i < 1 << N; i++) {
table[i].first = sin((i * f64(TAngleConstant_<f32>::RADIAN_DEG360())) / (1 << N));
table[i].second = cos((i * f64(TAngleConstant_<f32>::RADIAN_DEG360())) / (1 << N));
}
}
T sinShort(s16 v) const { return table[(u16)v >> (16U - N)].first; }
T cosShort(s16 v) const { return table[(u16)v >> (16U - N)].second; }
@ -68,6 +88,19 @@ template<int N, typename T>
struct TAtanTable {
T table[N + 1];
u8 pad[0x1C];
TAtanTable() {
init();
}
void init() {
// u32 cast needed for cmplwi instead of cmpwi
for (int i = 0; i < (u32)N; i++) {
table[i] = atan(i / (f64)N);
}
table[0] = 0.0f;
table[N] = TAngleConstant_<T>::RADIAN_DEG180() / 4.0f;
}
};
/**
@ -79,6 +112,18 @@ struct TAsinAcosTable {
T table[N + 1];
u8 pad[0x1C];
TAsinAcosTable() {
init();
}
void init() {
for (int i = 0; i < 1024; i++) {
table[i] = asin(i / (f64)N);
}
table[0] = 0.0f;
table[N] = TAngleConstant_<T>::RADIAN_DEG180() / 4.0f;
}
T acos_(T x) const {
if (x >= 1.0f) {
return 0.0f;

View File

@ -4,6 +4,7 @@
#include "JSystem/J3DGraphAnimator/J3DMaterialAttach.h"
#include "JSystem/J3DGraphBase/J3DPacket.h"
#include "JSystem/J3DGraphBase/J3DShape.h"
#include "JSystem/JAudio2/JASDSPChannel.h"
#include "JSystem/JSupport/JSUList.h"
#endif // JSYSTEM_PCH

View File

@ -474,14 +474,14 @@ extern "C" void ModuleUnresolved() {
OSReport_Error("\n");
}
extern "C" void ModuleConstructorsX(void (**ctors)()) {
extern "C" void ModuleConstructorsX(void (*const *ctors)()) {
while (*ctors != 0) {
(**ctors)();
ctors++;
}
}
extern "C" void ModuleDestructorsX(void (**dtors)()) {
extern "C" void ModuleDestructorsX(void (*const *dtors)()) {
while (*dtors != 0) {
(**dtors)();
dtors++;

View File

@ -4,16 +4,9 @@
#include "JSystem/JAudio2/JASAudioThread.h"
#include "JSystem/JAudio2/JASCriticalSection.h"
#include "JSystem/JAudio2/JASDriverIF.h"
#include "JSystem/JAudio2/JASDSPChannel.h"
#include "dolphin/types.h"
struct JASDSPChannel {
void drop();
static JASDSPChannel* getHandle(u32);
inline u8 getStatus() const { return mStatus; }
u32 mStatus;
};
JASAudioReseter::JASAudioReseter() {
field_0x0 = 0;
mDoneFlag = true;
@ -52,16 +45,15 @@ s32 JASAudioReseter::checkDone() const {
return mDoneFlag;
}
s32 JASAudioReseter::calc() {
if(field_0x0==0) {
for(size_t i = 0; i<64; i++) {
if (field_0x0==0) {
for (size_t i = 0; i<64; i++) {
JASDSPChannel* handle = JASDSPChannel::getHandle(i);
if ((handle->getStatus())==0) {
if (handle->getStatus() == 0) {
handle->drop();
}
}
if(mThreadStopFlag!=false) {
if (mThreadStopFlag!=false) {
JASAudioThread* pAudioThread = JASGlobalInstance<JASAudioThread>::getInstance();
JUT_ASSERT(78, pAudioThread);
pAudioThread->stop();

View File

@ -9,7 +9,7 @@ static void DspHandShake(void* param_0);
static int DspStartWork(u32 param_0, void (*param_1)(u16));
extern int Dsp_Running_Check();
extern int Dsp_Running_Start();
extern void Dsp_Running_Start();
void DspHandShake(void*) {
OS_REPORT("DSP InitCallback \n");

View File

@ -151,8 +151,8 @@ static void Dsp_Update_Request() {
}
}
bool Dsp_Running_Check() {
return struct_80451308 == 1;
int Dsp_Running_Check() {
return struct_80451308 == 1 ? TRUE : FALSE;
}
void Dsp_Running_Start() {

View File

@ -1,7 +1,6 @@
#include "JSystem/JSystem.h" // IWYU pragma: keep
// don't include header until this "zero" mess is figured out
// #include "JSystem/JMath/JMATrigonometric.h"
#include "JSystem/JMath/JMATrigonometric.h"
#include <math>
#include "global.h"
@ -9,78 +8,14 @@ static f32 dummy() {
return 0.0f;
}
namespace std {
template <typename A1, typename B1>
struct pair {
A1 a1;
B1 b1;
pair() {
a1 = A1();
b1 = B1();
}
};
} // namespace std
namespace JMath {
template<typename T>
struct TAngleConstant_;
template<>
struct TAngleConstant_<f32> {
static f32 RADIAN_DEG180() { return M_PI;}
static f32 RADIAN_DEG360() { return M_PI * 2; }
};
template<int N, typename T>
struct TSinCosTable {
std::pair<T, T> table[1 << N];
TSinCosTable() {
init();
}
void init() {
for (int i = 0; i < 1 << N; i++) {
table[i].a1 = sin((i * f64(TAngleConstant_<f32>::RADIAN_DEG360())) / (1 << N));
table[i].b1 = cos((i * f64(TAngleConstant_<f32>::RADIAN_DEG360())) / (1 << N));
}
}
};
inline f64 getConst2() {
return 9.765625E-4;
}
template<int N, typename T>
struct TAtanTable {
T table[N + 1];
u8 pad[0x1C];
TAtanTable() {
init();
}
void init() {
for (int i = 0; i < u32(N); i++) {
table[i] = atan(getConst2() * i);
}
table[0] = 0.0f;
table[N] = TAngleConstant_<f32>::RADIAN_DEG180() * 0.25f; // 0.25 * PI
}
};
template<int N, typename T>
struct TAsinAcosTable {
T table[N + 1];
u8 pad[0x1C];
TAsinAcosTable() {
init();
}
void init() {
for (int i = 0; i < N; i++) {
table[i] = asin(getConst2() * i);
}
table[0] = 0.0f;
table[N] = TAngleConstant_<f32>::RADIAN_DEG180() * 0.25f; // 0.25 * PI
}
};
TSinCosTable<13, f32> sincosTable_ ATTRIBUTE_ALIGN(32);
TAtanTable<1024, f32> atanTable_ ATTRIBUTE_ALIGN(32);

View File

@ -20,4 +20,15 @@ typedef struct decform {
short digits;
} decform;
void __ull2dec(decimal*, unsigned long long);
void __timesdec(decimal*, const decimal*, const decimal*);
void __str2dec(decimal*, const char*, short);
void __two_exp(decimal*, long);
int __equals_dec(const decimal*, const decimal*);
int __less_dec(const decimal*, const decimal*);
void __minus_dec(decimal*, const decimal*, const decimal*);
void __num2dec_internal(decimal*, double);
void __num2dec(const decform*, double, decimal*);
double __dec2num(const decimal*);
#endif

View File

@ -5,7 +5,7 @@
extern "C" {
#endif
typedef struct {
typedef struct div_t {
int quot; /* quotient */
int rem; /* remainder */
} div_t;

View File

@ -1,3 +1,4 @@
#include "alloc.h"
#include "ansi_files.h"
#include "critical_regions.h"

View File

@ -1,5 +1,7 @@
#include "buffer_io.h"
#include "char_io.h"
#include "critical_regions.h"
#include "FILE_POS.h"
#include "misc_io.h"
#include "wchar_io.h"

View File

@ -1,6 +1,10 @@
#include "direct_io.h"
#include "buffer_io.h"
#include "critical_regions.h"
#include "direct_io.h"
#include "FILE_POS.h"
#include "misc_io.h"
#include "wchar_io.h"
#include <cstring>
size_t fwrite(const void* buffer, size_t size, size_t count, FILE* stream) {
size_t retval;

View File

@ -1,4 +1,7 @@
#include "alloc.h"
#include "buffer_io.h"
#include "file_io.h"
#include "FILE_POS.h"
#include <ctype>
int fclose(FILE* file) {

View File

@ -1,3 +1,4 @@
#include "mem_funcs.h"
#include <cstring>
void* memmove(void* dst, const void* src, size_t n) {

View File

@ -1,13 +1,15 @@
#include "printf.h"
#include "ansi_fp.h"
#include "critical_regions.h"
#include <ctype>
#include "direct_io.h"
#include "mbstring.h"
#include "scanf.h"
#include "wchar_io.h"
#include <ctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdint>
#include "wchar_io.h"
#define LDBL_MANT_DIG 53
@ -19,8 +21,7 @@
#define TARGET_FLOAT_MANT_BITS (TARGET_FLOAT_MANT_DIG - TARGET_FLOAT_IMPLICIT_J_BIT)
#define TARGET_FLOAT_EXP_BITS (TARGET_FLOAT_BITS - TARGET_FLOAT_MANT_BITS - 1)
#define PTRDIFF __typeof__((char*)0 - (char*)0)
typedef PTRDIFF ptrdiff_t;
extern void __msl_runtime_constraint_violation_s(const char* msg, void* ptr, int error);
enum justification_options { left_justification, right_justification, zero_fill };