mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-12 19:24:55 -04:00
Fix errors for msvc
Use less strict compiler flags instead of modifying source code Add ugly defines so MSVC stops complaining about zero length arrays
This commit is contained in:
@@ -6,9 +6,13 @@
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
|
||||
#ifndef __MWERKS__
|
||||
#include <limits>
|
||||
#ifdef _MSVC_LANG
|
||||
#include <float.h>
|
||||
#else
|
||||
#include<limits>
|
||||
#define FLT_EPSILON std::numeric_limits<float>::epsilon()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace JGeometry {
|
||||
|
||||
|
||||
@@ -2,7 +2,14 @@
|
||||
#define JORMCONTEXT_H
|
||||
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
#ifdef _MSVC_LANG
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#include <stdint>
|
||||
#endif
|
||||
|
||||
#include <global.h>
|
||||
#include "JSystem/JHostIO/JORReflexible.h"
|
||||
#include "JSystem/JSupport/JSUMemoryStream.h"
|
||||
|
||||
|
||||
@@ -35,7 +35,12 @@ typedef struct str1_entry_t {
|
||||
|
||||
typedef struct str1_section_t {
|
||||
/* 0x00 */ bmg_section_t header; // section header
|
||||
#ifdef _MSVC_LANG
|
||||
str1_entry_t* __get_entries() const { return (str1_entry_t*)(this + 1); }
|
||||
__declspec(property(get = __get_entries)) str1_entry_t* entries;
|
||||
#else
|
||||
/* 0x08 */ str1_entry_t entries[0];
|
||||
#endif
|
||||
} str1_section_t;
|
||||
|
||||
#endif /* JMESSAGE_H */
|
||||
|
||||
@@ -18,6 +18,13 @@ public:
|
||||
s32 write(const void*, s32);
|
||||
void write(const char*);
|
||||
|
||||
#ifdef _MSVC_LANG
|
||||
JSUOutputStream& operator<<(uintptr_t param_0) {
|
||||
write(¶m_0, sizeof(uintptr_t));
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
JSUOutputStream& operator<<(u32 param_0) {
|
||||
write(¶m_0, sizeof(u32));
|
||||
return *this;
|
||||
|
||||
@@ -52,7 +52,12 @@ struct ResFONT {
|
||||
/* 0x1A */ u16 textureWidth;
|
||||
/* 0x1C */ u16 textureHeight;
|
||||
/* 0x1E */ u16 padding;
|
||||
#ifdef _MSVC_LANG
|
||||
u8* __get_data() const { return (u8*)(this + 1); }
|
||||
__declspec(property(get = __get_data)) u8* data;
|
||||
#else
|
||||
/* 0x20 */ u8 data[];
|
||||
#endif
|
||||
};
|
||||
|
||||
/* 0x00 */ u64 magic;
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
#include "dolphin/mtx.h"
|
||||
#include <cmath>
|
||||
|
||||
#ifdef _MSVC_LANG
|
||||
#define M_PI 3.14159265358979323846f
|
||||
#endif
|
||||
|
||||
struct cXyz : Vec {
|
||||
static const cXyz Zero;
|
||||
static const cXyz BaseX;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef Z2STATUSMGR_H
|
||||
#define Z2STATUSMGR_H
|
||||
|
||||
#include <global.h>
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
#include <dolphin/mtx.h>
|
||||
|
||||
|
||||
@@ -626,7 +626,8 @@ public:
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_faceMotionSequenceData,
|
||||
int i_faceMotionStepNum,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_motionSequenceData,
|
||||
int i_motionStepNum, daNpcT_evtData_c const* i_evtData, char** i_arcNames) :
|
||||
int i_motionStepNum, daNpcT_evtData_c const* i_evtData, char** i_arcNames)
|
||||
:
|
||||
mpFaceMotionAnmData(i_faceMotionAnmData),
|
||||
mpMotionAnmData(i_motionAnmData),
|
||||
mpEvtData(i_evtData),
|
||||
|
||||
@@ -149,8 +149,7 @@ public:
|
||||
int i_faceMotionStepNum,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_motionSequenceData,
|
||||
int i_motionStepNum,
|
||||
daNpcT_evtData_c const* i_evtData,
|
||||
char** i_arcNames)
|
||||
daNpcT_evtData_c const* i_evtData, char** i_arcNames)
|
||||
: daNpcT_c(i_faceMotionAnmData, i_motionAnmData, i_faceMotionSequenceData,
|
||||
i_faceMotionStepNum, i_motionSequenceData, i_motionStepNum, i_evtData,
|
||||
i_arcNames) {}
|
||||
|
||||
@@ -111,8 +111,7 @@ public:
|
||||
int i_faceMotionStepNum,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_motionSequenceData,
|
||||
int i_motionStepNum,
|
||||
daNpcT_evtData_c const* i_evtData,
|
||||
char** i_arcNames)
|
||||
daNpcT_evtData_c const* i_evtData, char** i_arcNames)
|
||||
: daNpcT_c(i_faceMotionAnmData, i_motionAnmData, i_faceMotionSequenceData,
|
||||
i_faceMotionStepNum, i_motionSequenceData, i_motionStepNum, i_evtData,
|
||||
i_arcNames) {
|
||||
|
||||
@@ -86,9 +86,10 @@ public:
|
||||
int talkwithJagar(void*);
|
||||
int talk(void*);
|
||||
daNpc_Bou_c(daNpcT_faceMotionAnmData_c const* param_1, daNpcT_motionAnmData_c const* param_2,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* param_3, int param_4,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* param_5, int param_6,
|
||||
daNpcT_evtData_c const* param_7, char** param_8) :
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* param_3, int param_4,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* param_5, int param_6,
|
||||
daNpcT_evtData_c const* param_7, char** param_8)
|
||||
:
|
||||
daNpcT_c(param_1, param_2, param_3, param_4, param_5, param_6, param_7, param_8)
|
||||
{}
|
||||
|
||||
|
||||
@@ -95,13 +95,12 @@ public:
|
||||
int tend(void*);
|
||||
int talk(void*);
|
||||
int shop(void*);
|
||||
daNpc_clerkA_c(
|
||||
daNpcT_faceMotionAnmData_c const* i_faceMotionAnmData,
|
||||
daNpcT_motionAnmData_c const* i_motionAnmData,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_faceMotionSequenceData,
|
||||
int i_faceMotionStepNum,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_motionSequenceData, int i_motionStepNum,
|
||||
daNpcT_evtData_c const* i_evtData, char** i_arcNames)
|
||||
daNpc_clerkA_c(daNpcT_faceMotionAnmData_c const* i_faceMotionAnmData,
|
||||
daNpcT_motionAnmData_c const* i_motionAnmData,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_faceMotionSequenceData,
|
||||
int i_faceMotionStepNum,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_motionSequenceData,
|
||||
int i_motionStepNum, daNpcT_evtData_c const* i_evtData, char** i_arcNames)
|
||||
: dShopSystem_c(i_faceMotionAnmData, i_motionAnmData, i_faceMotionSequenceData,
|
||||
i_faceMotionStepNum, i_motionSequenceData, i_motionStepNum, i_evtData,
|
||||
i_arcNames) {}
|
||||
|
||||
@@ -108,13 +108,12 @@ public:
|
||||
int tend(void*);
|
||||
int talk(void*);
|
||||
int shop(void*);
|
||||
daNpc_clerkB_c(
|
||||
daNpcT_faceMotionAnmData_c const* i_faceMotionAnmData,
|
||||
daNpcT_motionAnmData_c const* i_motionAnmData,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_faceMotionSequenceData,
|
||||
int i_faceMotionStepNum,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_motionSequenceData, int i_motionStepNum,
|
||||
daNpcT_evtData_c const* i_evtData, char** i_arcNames)
|
||||
daNpc_clerkB_c(daNpcT_faceMotionAnmData_c const* i_faceMotionAnmData,
|
||||
daNpcT_motionAnmData_c const* i_motionAnmData,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_faceMotionSequenceData,
|
||||
int i_faceMotionStepNum,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_motionSequenceData,
|
||||
int i_motionStepNum, daNpcT_evtData_c const* i_evtData, char** i_arcNames)
|
||||
: dShopSystem_c(i_faceMotionAnmData, i_motionAnmData, i_faceMotionSequenceData,
|
||||
i_faceMotionStepNum, i_motionSequenceData, i_motionStepNum, i_evtData,
|
||||
i_arcNames) {}
|
||||
|
||||
@@ -121,13 +121,12 @@ public:
|
||||
int practice(void*);
|
||||
int nurse(void*);
|
||||
int talk(void*);
|
||||
daNpc_Taro_c(
|
||||
daNpcT_faceMotionAnmData_c const* i_faceMotionAnmData,
|
||||
daNpcT_motionAnmData_c const* i_motionAnmData,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_faceMotionSequenceData,
|
||||
int i_faceMotionStepNum,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_motionSequenceData, int i_motionStepNum,
|
||||
daNpcT_evtData_c const* i_evtData, char** i_arcNames)
|
||||
daNpc_Taro_c(daNpcT_faceMotionAnmData_c const* i_faceMotionAnmData,
|
||||
daNpcT_motionAnmData_c const* i_motionAnmData,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_faceMotionSequenceData,
|
||||
int i_faceMotionStepNum,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* i_motionSequenceData,
|
||||
int i_motionStepNum, daNpcT_evtData_c const* i_evtData, char** i_arcNames)
|
||||
: daNpcT_c(i_faceMotionAnmData, i_motionAnmData, i_faceMotionSequenceData,
|
||||
i_faceMotionStepNum, i_motionSequenceData, i_motionStepNum, i_evtData,
|
||||
i_arcNames) {
|
||||
|
||||
@@ -924,7 +924,8 @@ inline void dComIfG_ct() {
|
||||
g_dComIfG_gameInfo.ct();
|
||||
}
|
||||
|
||||
int dComLbG_PhaseHandler(request_of_phase_process_class*, request_of_phase_process_fn*, void*);
|
||||
int dComLbG_PhaseHandler(request_of_phase_process_class*, request_of_phase_process_fn*,
|
||||
void*);
|
||||
BOOL dComIfG_resetToOpening(scene_class* scene);
|
||||
char* dComIfG_getRoomArcName(int roomNo);
|
||||
void* dComIfG_getStageRes(char const* i_resName);
|
||||
@@ -3757,7 +3758,8 @@ inline int dComIfGp_evmng_getMyStaffId(const char* i_staffname, fopAc_ac_c* i_ac
|
||||
return dComIfGp_getPEvtManager()->getMyStaffId(i_staffname, i_actor, i_tagId);
|
||||
}
|
||||
|
||||
inline int dComIfGp_evmng_getMyActIdx(int i_staffId, char** i_actions, int i_actionNum, BOOL param_3, BOOL param_4) {
|
||||
inline int dComIfGp_evmng_getMyActIdx(int i_staffId, char** i_actions, int i_actionNum,
|
||||
BOOL param_3, BOOL param_4) {
|
||||
return dComIfGp_getPEvtManager()->getMyActIdx(i_staffId, i_actions, i_actionNum, param_3, param_4);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,12 @@ public:
|
||||
/* 0x0 */ char mStageName[8];
|
||||
/* 0x8 */ u16 mAreaName;
|
||||
/* 0xA */ u8 mCount;
|
||||
#ifdef _MSVC_LANG
|
||||
u8* __get_mRoomNos() const { return (u8*)(this + 1); }
|
||||
__declspec(property(get = __get_mRoomNos)) u8* mRoomNos;
|
||||
#else
|
||||
/* 0xB */ u8 mRoomNos[0];
|
||||
#endif
|
||||
};
|
||||
|
||||
/* 0x0 */ u8 mCount;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define D_PARTICLE_D_PARTICLE_NAME_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include <global.h>
|
||||
|
||||
// Room scenes use a bit to specify an ID is from a room particle pack, not the common particle pack
|
||||
#define dPa_RM(id) (0x8000 | (id))
|
||||
|
||||
@@ -29,10 +29,11 @@ public:
|
||||
};
|
||||
|
||||
dShopSystem_c(daNpcT_faceMotionAnmData_c const* param_1, daNpcT_motionAnmData_c const* param_2,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* param_3, int param_4,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* param_5, int param_6, daNpcT_evtData_c const* param_7,
|
||||
char** param_8) : daNpcT_c(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8) {
|
||||
OS_REPORT("|%06d:%x|dShopSystem_c -> コンストラクト\n", g_Counter.mCounter0, this);
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* param_3, int param_4,
|
||||
daNpcT_MotionSeqMngr_c::sequenceStepData_c const* param_5, int param_6,
|
||||
daNpcT_evtData_c const* param_7, char** param_8)
|
||||
: daNpcT_c(param_1, param_2, param_3, param_4, param_5, param_6, param_7, param_8) {
|
||||
OS_REPORT("|%06d:%x|dShopSystem_c -> コンストラクト\n", g_Counter.mCounter0, this);
|
||||
initShopSystem();
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,24 @@ extern int __abs(int);
|
||||
void* __memcpy(void*, const void*, int);
|
||||
#endif
|
||||
|
||||
#ifdef _MSVC_LANG
|
||||
inline int __builtin_clz(unsigned int v) {
|
||||
int count = 32;
|
||||
while (v != 0) {
|
||||
count--;
|
||||
v >>= 1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
#define COMPOUND_LITERAL(x)
|
||||
#define M_PI 3.14159265358979323846f
|
||||
#else
|
||||
|
||||
#define COMPOUND_LITERAL(x) (x)
|
||||
|
||||
#endif
|
||||
|
||||
#define FAST_DIV(x, n) (x >> (n / 2))
|
||||
|
||||
#define SQUARE(x) ((x) * (x))
|
||||
@@ -145,4 +163,23 @@ static const float INF = 2000000000.0f;
|
||||
#define UNSET_FLAG(var, flag, type) (var) &= ~(flag)
|
||||
#endif
|
||||
|
||||
#ifdef _MSVC_LANG
|
||||
template <int N>
|
||||
inline constexpr auto MultiCharLiteral(const char (&buf)[N]) {
|
||||
// static_assert(buf[0] == '\'' && buf[N - 2] == '\''); // can't constexpr strings, just pray
|
||||
constexpr int len = N - 1;
|
||||
static_assert(len >= 2 && len <= 10);
|
||||
|
||||
unsigned long long out = 0;
|
||||
for (int i = 1; i < len - 1; i++) {
|
||||
out = (out << 8) | ((unsigned long long)buf[i]);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
#define MULTI_CHAR(x) MultiCharLiteral(#x)
|
||||
#else
|
||||
#define MULTI_CHAR(x) MultiCharLiteral(#x)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user