Start switch to clangd
Some checks are pending
Build / build (eu) (push) Waiting to run
Build / build (jp) (push) Waiting to run
Build / build (us) (push) Waiting to run

This commit is contained in:
Amber Brault 2024-11-07 13:38:33 -05:00
parent 8f2a261bf0
commit 94fc3e45eb
54 changed files with 317 additions and 110 deletions

30
.clang-format Normal file
View File

@ -0,0 +1,30 @@
Language: Cpp
BasedOnStyle: WebKit
ColumnLimit: 140
SortIncludes: false
IndentWidth: 4
TabWidth: 4
UseTab: ForIndentation
NamespaceIndentation: None
FixNamespaceComments: true
CompactNamespaces: false
AlignTrailingComments: true
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: Left
AlignOperands: AlignAfterOperator
AllowShortFunctionsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: Never
Cpp11BracedListStyle: false
AlwaysBreakTemplateDeclarations: true
BreakStringLiterals: true
ReflowComments: true

View File

@ -1,77 +0,0 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/src",
"${workspaceFolder}/include",
"${workspaceFolder}/libs/PowerPC_EABI_Support/include",
"${workspaceFolder}/libs/PowerPC_EABI_Support/include/stl",
"${workspaceFolder}/libs/CriWare/include",
"${workspaceFolder}/libs/CriWare/src",
"${workspaceFolder}/libs/monolib/include",
"${workspaceFolder}/libs/NdevExi2A/include",
"${workspaceFolder}/libs/nw4r/include/**",
"${workspaceFolder}/libs/RVL_SDK/include",
"${workspaceFolder}/libs/RVL_SDK/src/revolution/hbm/include/**"
],
"cStandard": "c99",
"cppStandard": "c++98",
"intelliSenseMode": "linux-clang-x86",
"compilerPath": "",
"configurationProvider": "ms-vscode.makefile-tools",
"forcedInclude": [
".vscode/warnings.h"
]
},
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/src",
"${workspaceFolder}/include",
"${workspaceFolder}/libs/PowerPC_EABI_Support/include",
"${workspaceFolder}/libs/PowerPC_EABI_Support/include/stl",
"${workspaceFolder}/libs/CriWare/include",
"${workspaceFolder}/libs/CriWare/src",
"${workspaceFolder}/libs/monolib/include",
"${workspaceFolder}/libs/NdevExi2A/include",
"${workspaceFolder}/libs/nw4r/include/**",
"${workspaceFolder}/libs/RVL_SDK/include",
"${workspaceFolder}/libs/RVL_SDK/src/revolution/hbm/include/**"
],
"cStandard": "c99",
"cppStandard": "c++98",
"intelliSenseMode": "windows-clang-x86",
"compilerPath": "",
"configurationProvider": "ms-vscode.makefile-tools",
"forcedInclude": [
"${workspaceFolder}/.vscode/warnings.h"
]
},
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/src",
"${workspaceFolder}/include",
"${workspaceFolder}/libs/PowerPC_EABI_Support/include",
"${workspaceFolder}/libs/PowerPC_EABI_Support/include/stl",
"${workspaceFolder}/libs/CriWare/include",
"${workspaceFolder}/libs/CriWare/src",
"${workspaceFolder}/libs/monolib/include",
"${workspaceFolder}/libs/NdevExi2A/include",
"${workspaceFolder}/libs/nw4r/include/**",
"${workspaceFolder}/libs/RVL_SDK/include",
"${workspaceFolder}/libs/RVL_SDK/src/revolution/hbm/include/**"
],
"cStandard": "c99",
"cppStandard": "c++98",
"intelliSenseMode": "macos-clang-x86",
"compilerPath": "",
"configurationProvider": "ms-vscode.makefile-tools",
"forcedInclude": [
"${workspaceFolder}/.vscode/warnings.h"
]
}
],
"version": 4
}

View File

@ -237,7 +237,6 @@ else:
# Game/Monolithlib Flags # Game/Monolithlib Flags
cflags_game = [ cflags_game = [
*cflags_base, *cflags_base,
"-lang=c99",
"-ipa file", "-ipa file",
"-inline auto", "-inline auto",
"-use_lmw_stmw on", "-use_lmw_stmw on",

View File

@ -10,9 +10,9 @@
#define CONCAT(x, y) __CONCAT(x, y) #define CONCAT(x, y) __CONCAT(x, y)
// Compile without matching hacks. // Compile without matching hacks.
#ifdef __DECOMP_NON_MATCHING #if defined(__DECOMP_NON_MATCHING) || !defined(__MWERKS__)
#define DECOMP_FORCEACTIVE(module, ...) #define DECOMP_FORCEACTIVE(module, ...)
#define DECOMP_FORCELITERAL(module, x) #define DECOMP_FORCELITERAL(module, ...)
#define DECOMP_FORCEDTOR(module, cls) #define DECOMP_FORCEDTOR(module, cls)
#define CW_FORCE_BSS(module, ...) #define CW_FORCE_BSS(module, ...)
#define CW_FORCE_STRINGS(module, ...) #define CW_FORCE_STRINGS(module, ...)

View File

@ -26,10 +26,14 @@
#define DECLTYPE(x) __decltype__(x) #define DECLTYPE(x) __decltype__(x)
// For VSCode // For VSCode
#ifdef __INTELLISENSE__ #ifndef __MWERKS__
#define asm #define asm
#define __attribute__(x) #define __attribute__(x)
#define __declspec(x) #define __declspec(x)
#define __rlwimi(ra, rs, sh, mb, me) 0
#define __cntlzw(x) 0
#define __abs(x) 0
#define __sync()
#endif #endif
#define VERSION_JP 0 #define VERSION_JP 0

View File

@ -5,7 +5,7 @@
extern "C" { extern "C" {
#endif #endif
#if defined(__INTELLISENSE__) && defined(__cplusplus) #if !defined(__MWERKS__)
#define __builtin_va_info(v) 0 /* definition for IDEs */ #define __builtin_va_info(v) 0 /* definition for IDEs */
#endif #endif

View File

@ -8,8 +8,8 @@
extern "C" { extern "C" {
#endif #endif
//#include <revolution/nand/NANDCheck.h> #include <revolution/nand/NANDCheck.h>
//#include <revolution/nand/NANDCore.h> #include <revolution/nand/NANDCore.h>
#include <revolution/nand/NANDOpenClose.h> #include <revolution/nand/NANDOpenClose.h>
#include <revolution/nand/nand.h> #include <revolution/nand/nand.h>

View File

@ -8,7 +8,11 @@ extern "C" {
/** /**
* AI hardware registers * AI hardware registers
*/ */
#ifdef __MWERKS__
volatile u32 AI_HW_REGS[] : 0xCD006C00; volatile u32 AI_HW_REGS[] : 0xCD006C00;
#else
volatile u32 AI_HW_REGS[];
#endif
/** /**
* Hardware register indexes * Hardware register indexes

View File

@ -14,6 +14,7 @@ AXVPB* __AXGetStackHead(u32 prio);
void __AXServiceCallbackStack(void); void __AXServiceCallbackStack(void);
void __AXInitVoiceStacks(void); void __AXInitVoiceStacks(void);
void __AXAllocInit(void); void __AXAllocInit(void);
void __AXAllocQuit(void);
void __AXPushFreeStack(AXVPB* vpb); void __AXPushFreeStack(AXVPB* vpb);
AXVPB* __AXPopFreeStack(void); AXVPB* __AXPopFreeStack(void);
void __AXPushCallbackStack(AXVPB* vpb); void __AXPushCallbackStack(AXVPB* vpb);

View File

@ -34,6 +34,7 @@ typedef enum {
typedef void (*AXAuxCallback)(void* chans, void* context); typedef void (*AXAuxCallback)(void* chans, void* context);
void __AXAuxInit(void); void __AXAuxInit(void);
void __AXAuxQuit(void);
void __AXGetAuxAInput(void** out); void __AXGetAuxAInput(void** out);
void __AXGetAuxAOutput(void** out); void __AXGetAuxAOutput(void** out);
void __AXGetAuxAInputDpl2(void** out); void __AXGetAuxAInputDpl2(void** out);

View File

@ -24,6 +24,7 @@ void* __AXGetCommandListAddress(void);
void __AXWriteToCommandList(u16 cmd); void __AXWriteToCommandList(u16 cmd);
void __AXNextFrame(void* surround, void* lr, void* rmt); void __AXNextFrame(void* surround, void* lr, void* rmt);
void __AXClInit(void); void __AXClInit(void);
void __AXClQuit(void);
void AXSetMode(u32 mode); void AXSetMode(u32 mode);
u32 AXGetMode(void); u32 AXGetMode(void);
u16 AXGetAuxAReturnVolume(void); u16 AXGetAuxAReturnVolume(void);

View File

@ -15,6 +15,7 @@ u32 __AXOutNewFrame(void);
void __AXOutAiCallback(void); void __AXOutAiCallback(void);
void __AXOutInitDSP(void); void __AXOutInitDSP(void);
void __AXOutInit(u32 mode); void __AXOutInit(u32 mode);
void __AXOutQuit(void);
AXOutCallback AXRegisterCallback(AXOutCallback callback); AXOutCallback AXRegisterCallback(AXOutCallback callback);
s32 AXRmtGetSamplesLeft(void); s32 AXRmtGetSamplesLeft(void);
s32 AXRmtGetSamples(s32 chan, s16* out, s32 num); s32 AXRmtGetSamples(s32 chan, s16* out, s32 num);

View File

@ -1,5 +1,6 @@
#ifndef RVL_SDK_AX_SPB_H #ifndef RVL_SDK_AX_SPB_H
#define RVL_SDK_AX_SPB_H #define RVL_SDK_AX_SPB_H
#include <revolution/ax/AXPB.h>
#include <types.h> #include <types.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -74,6 +75,7 @@ void __AXDepopFadeMain(s32* all, s32* value, s16* depop) DECOMP_DONT_INLINE;
void __AXDepopFadeRmt(s32* all, s32* value, s16* depop) DECOMP_DONT_INLINE; void __AXDepopFadeRmt(s32* all, s32* value, s16* depop) DECOMP_DONT_INLINE;
void __AXPrintStudio(void); void __AXPrintStudio(void);
void __AXSPBInit(void); void __AXSPBInit(void);
void __AXSPBQuit(void);
void __AXDepopVoice(AXPB* pb); void __AXDepopVoice(AXPB* pb);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -67,6 +67,7 @@ void __AXSyncPBs(u32 baseCycles);
AXPB* __AXGetPBs(void); AXPB* __AXGetPBs(void);
void __AXSetPBDefault(AXVPB* vpb); void __AXSetPBDefault(AXVPB* vpb);
void __AXVPBInit(void); void __AXVPBInit(void);
void __AXVPBQuit(void);
void AXSetVoiceState(AXVPB* vpb, u16 state); void AXSetVoiceState(AXVPB* vpb, u16 state);
void AXSetVoiceAddr(AXVPB* vpb, AXPBADDR* addr); void AXSetVoiceAddr(AXVPB* vpb, AXPBADDR* addr);
void AXGetLpfCoefs(u16 freq, u16* a, u16* b); void AXGetLpfCoefs(u16 freq, u16* a, u16* b);

View File

@ -8,7 +8,11 @@ extern "C" {
/** /**
* DSP hardware registers * DSP hardware registers
*/ */
#ifdef __MWERKS__
volatile u16 DSP_HW_REGS[] : 0xCC005000; volatile u16 DSP_HW_REGS[] : 0xCC005000;
#else
volatile u16 DSP_HW_REGS[];
#endif
/** /**
* Hardware register indexes * Hardware register indexes

View File

@ -9,6 +9,7 @@ extern "C" {
#define DVD_LOW_SPEED(x) (((x)&3) << 16) #define DVD_LOW_SPEED(x) (((x)&3) << 16)
// Forward declarations // Forward declarations
#ifdef __MWERKS__
typedef struct DVDDiskID; typedef struct DVDDiskID;
typedef struct DVDDriveInfo; typedef struct DVDDriveInfo;
typedef struct ESTicket; typedef struct ESTicket;
@ -16,6 +17,15 @@ typedef struct ESTicketView;
typedef struct ESTitleMeta; typedef struct ESTitleMeta;
typedef struct OSAlarm; typedef struct OSAlarm;
typedef struct DVDVideoReportKey; typedef struct DVDVideoReportKey;
#else
typedef struct DVDDiskID DVDDiskID;
typedef struct DVDDriveInfo DVDDriveInfo;
typedef struct ESTicket ESTicket;
typedef struct ESTicketView ESTicketView;
typedef struct ESTitleMeta ESTitleMeta;
typedef struct OSAlarm OSAlarm;
typedef struct DVDVideoReportKey DVDVideoReportKey;
#endif
typedef enum { typedef enum {
DVD_INTTYPE_TC = (1 << 0), // Transaction callback? DVD_INTTYPE_TC = (1 << 0), // Transaction callback?
@ -41,6 +51,8 @@ BOOL DVDLowReadDiskID(struct DVDDiskID* out, DVDLowCallback callback);
// u32 certsSize, const void* const certs, struct ESTitleMeta* tmd, // u32 certsSize, const void* const certs, struct ESTitleMeta* tmd,
// DVDLowCallback callback); // DVDLowCallback callback);
BOOL DVDLowOpenPartitionWithTmdAndTicketView(const u32, const struct ESTicketView* const, const u32, const struct ESTitleMeta* const, const u32, const u8* const, DVDLowCallback); BOOL DVDLowOpenPartitionWithTmdAndTicketView(const u32, const struct ESTicketView* const, const u32, const struct ESTitleMeta* const, const u32, const u8* const, DVDLowCallback);
BOOL DVDLowGetNoDiscBufferSizes(const u32 offset, u32* numTmdBytes, u32* numCertBytes, DVDLowCallback callback);
BOOL DVDLowGetNoDiscOpenPartitionParams(const u32 offset, struct ESTicket* eTicket, u32* numTmdBytes, struct ESTitleMeta* tmd, u32* numCertBytes, u8* certificates, u32* dataWordOffset, u8* h3HashPtr, DVDLowCallback callback);
BOOL DVDLowOpenPartition(const u32, const struct ESTicket* const, const u32, const u8* const, struct ESTitleMeta *, DVDLowCallback); BOOL DVDLowOpenPartition(const u32, const struct ESTicket* const, const u32, const u8* const, struct ESTitleMeta *, DVDLowCallback);
BOOL DVDLowClosePartition(DVDLowCallback callback); BOOL DVDLowClosePartition(DVDLowCallback callback);
BOOL DVDLowUnencryptedRead(void* dst, u32 size, u32 offset, BOOL DVDLowUnencryptedRead(void* dst, u32 size, u32 offset,

View File

@ -14,7 +14,11 @@ typedef struct EXIChannelParam {
u32 data; // at 0x10 u32 data; // at 0x10
} EXIChannelParam; } EXIChannelParam;
#ifdef __MWERKS__
volatile EXIChannelParam EXI_CHAN_PARAMS[EXI_MAX_CHAN] : 0xCD006800; volatile EXIChannelParam EXI_CHAN_PARAMS[EXI_MAX_CHAN] : 0xCD006800;
#else
volatile EXIChannelParam EXI_CHAN_PARAMS[EXI_MAX_CHAN];
#endif
// CPR - Channel Parameter Register // CPR - Channel Parameter Register
#define EXI_CPR_EXIINTMASK (1 << 0) #define EXI_CPR_EXIINTMASK (1 << 0)

View File

@ -43,7 +43,11 @@ extern volatile union {
unsigned int ui; unsigned int ui;
void* p; void* p;
float f; float f;
#ifdef __MWERKS__
} WGPIPE : 0xCC008000; } WGPIPE : 0xCC008000;
#else
} WGPIPE;
#endif
/** /**
* FIFO commands * FIFO commands

View File

@ -5,7 +5,11 @@
extern "C" { extern "C" {
#endif #endif
#ifdef __MWERKS__
u32 IPC_HW_REGS[] : 0xCD000000; u32 IPC_HW_REGS[] : 0xCD000000;
#else
u32 IPC_HW_REGS[];
#endif
inline u32 ACRReadReg(u32 reg) { inline u32 ACRReadReg(u32 reg) {
return IPC_HW_REGS[reg / 4]; return IPC_HW_REGS[reg / 4];

View File

@ -0,0 +1,21 @@
#ifndef RVL_SDK_NAND_CHECK_H
#define RVL_SDK_NAND_CHECK_H
#include <revolution/nand/nand.h>
#include <types.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
NAND_CHECK_TOO_MANY_APP_BLOCKS = (1 << 0),
NAND_CHECK_TOO_MANY_APP_FILES = (1 << 1),
NAND_CHECK_TOO_MANY_USER_BLOCKS = (1 << 2),
NAND_CHECK_TOO_MANY_USER_FILES = (1 << 3),
} NANDCheckFlags;
s32 NANDCheck(u32 neededBlocks, u32 neededFiles, u32* answer);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,35 @@
#ifndef RVL_SDK_NAND_CORE_H
#define RVL_SDK_NAND_CORE_H
#include <revolution/nand/nand.h>
#include <types.h>
#ifdef __cplusplus
extern "C" {
#endif
void nandRemoveTailToken(char* newp, const char* oldp);
void nandGetHeadToken(char* head, char* rest, const char* path);
void nandGetRelativeName(char* name, const char* path);
void nandConvertPath(char* abs, const char* dir, const char* rel);
BOOL nandIsPrivatePath(const char* path);
BOOL nandIsUnderPrivatePath(const char* path);
BOOL nandIsInitialized(void);
void nandReportErrorCode(s32 result) DECOMP_DONT_INLINE;
s32 nandConvertErrorCode(s32 result);
void nandGenerateAbsPath(char* abs, const char* rel);
void nandGetParentDirectory(char* dir, const char* path);
s32 NANDInit(void);
s32 NANDGetCurrentDir(char* out);
s32 NANDGetHomeDir(char* out);
void nandCallback(s32 result, void* arg);
s32 NANDGetType(const char* path, u8* type);
s32 NANDPrivateGetTypeAsync(const char* path, u8* type,
NANDAsyncCallback callback,
NANDCommandBlock* block);
const char* nandGetHomeDir(void);
void NANDInitBanner(NANDBanner* banner, u32 flags, const wchar_t* title,
const wchar_t* subtitle);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -171,6 +171,7 @@ s32 NANDGetLengthAsync(NANDFileInfo* info, u32* lengthOut,
NANDAsyncCallback callback, NANDCommandBlock* block); NANDAsyncCallback callback, NANDCommandBlock* block);
s32 NANDGetStatus(const char* path, NANDStatus* status); s32 NANDGetStatus(const char* path, NANDStatus* status);
s32 NANDPrivateGetStatus(const char* path, NANDStatus* status);
s32 NANDPrivateGetStatusAsync(const char* path, NANDStatus* status, s32 NANDPrivateGetStatusAsync(const char* path, NANDStatus* status,
NANDAsyncCallback callback, NANDAsyncCallback callback,
NANDCommandBlock* block); NANDCommandBlock* block);

View File

@ -8,7 +8,11 @@ extern "C" {
#define OS_CACHE_BASE 0xE0000000 #define OS_CACHE_BASE 0xE0000000
// Forward declarations // Forward declarations
#ifdef __MWERKS__
typedef struct OSContext; typedef struct OSContext;
#else
typedef struct OSContext OSContext;
#endif
void DCEnable(void); void DCEnable(void);
void DCInvalidateRange(const void* buf, u32 len); void DCInvalidateRange(const void* buf, u32 len);

View File

@ -12,6 +12,7 @@ extern "C" {
// GQR5: signed 16 bit // GQR5: signed 16 bit
static inline void OSInitFastCast(void) { static inline void OSInitFastCast(void) {
// clang-format off // clang-format off
#ifdef __MWERKS__
asm { asm {
li r3, 4 li r3, 4
oris r3, r3, 4 oris r3, r3, 4
@ -29,6 +30,7 @@ static inline void OSInitFastCast(void) {
oris r3, r3, 7 oris r3, r3, 7
mtgqr5 r3 mtgqr5 r3
} }
#endif
// clang-format on // clang-format on
} }
@ -36,9 +38,11 @@ static inline void OSSetGQR6(register u32 type, register u32 scale) {
register u32 val = ((scale << 8 | type) << 16) | ((scale << 8) | type); register u32 val = ((scale << 8 | type) << 16) | ((scale << 8) | type);
// clang-format off // clang-format off
#ifdef __MWERKS__
asm { asm {
mtspr 0x396, val mtspr 0x396, val
} }
#endif
// clang-format on // clang-format on
} }
@ -46,9 +50,11 @@ static inline void OSSetGQR7(register u32 type, register u32 scale) {
register u32 val = ((scale << 8 | type) << 16) | ((scale << 8) | type); register u32 val = ((scale << 8 | type) << 16) | ((scale << 8) | type);
// clang-format off // clang-format off
#ifdef __MWERKS__
asm { asm {
mtspr 0x397, val mtspr 0x397, val
} }
#endif
// clang-format on // clang-format on
} }
@ -56,9 +62,11 @@ static inline f32 __OSu16tof32(register const u16* arg) {
register f32 ret; register f32 ret;
// clang-format off // clang-format off
#ifdef __MWERKS__
asm { asm {
psq_l ret, 0(arg), 1, 3 psq_l ret, 0(arg), 1, 3
} }
#endif
// clang-format on // clang-format on
return ret; return ret;
@ -74,9 +82,11 @@ static inline u16 __OSf32tou16(register f32 arg) {
u16 r; u16 r;
// clang-format off // clang-format off
#ifdef __MWERKS__
asm { asm {
psq_st arg, 0(ptr), 1, 3 psq_st arg, 0(ptr), 1, 3
} }
#endif
// clang-format on // clang-format on
r = *(u16*)ptr; r = *(u16*)ptr;
@ -91,9 +101,11 @@ static inline f32 __OSs16tof32(register const s16* arg) {
register f32 ret; register f32 ret;
// clang-format off // clang-format off
#ifdef __MWERKS__
asm { asm {
psq_l ret, 0(arg), 1, 5 psq_l ret, 0(arg), 1, 5
} }
#endif
// clang-format on // clang-format on
return ret; return ret;
@ -109,9 +121,11 @@ static inline s16 __OSf32tos16(register f32 arg) {
s16 r; s16 r;
// clang-format off // clang-format off
#ifdef __MWERKS__
asm { asm {
psq_st arg, 0(ptr), 1, 5 psq_st arg, 0(ptr), 1, 5
} }
#endif
// clang-format on // clang-format on
r = *(s16*)ptr; r = *(s16*)ptr;

View File

@ -25,6 +25,7 @@ typedef struct OSExecParams;
static const u32 OS_CACHED_##name = (addr); \ static const u32 OS_CACHED_##name = (addr); \
static const u32 OS_UNCACHED_##name = (addr) + (0xC0000000 - 0x80000000); static const u32 OS_UNCACHED_##name = (addr) + (0xC0000000 - 0x80000000);
#ifdef __MWERKS__
// Define a global variable in *CACHED* MEM1. // Define a global variable in *CACHED* MEM1.
// Can be accessed directly or with OSAddress functions. // Can be accessed directly or with OSAddress functions.
#define OS_DEF_GLOBAL_VAR(type, name, addr) \ #define OS_DEF_GLOBAL_VAR(type, name, addr) \
@ -43,6 +44,18 @@ typedef struct OSExecParams;
#define OS_DEF_HW_REG(type, name, addr) \ #define OS_DEF_HW_REG(type, name, addr) \
/* Memory-mapped value for direct access */ \ /* Memory-mapped value for direct access */ \
type OS_##name : (addr); type OS_##name : (addr);
#else
#define OS_DEF_GLOBAL_VAR(type, name, addr) \
type OS_##name; \
__DEF_ADDR_OFFSETS(name, addr)
#define OS_DEF_GLOBAL_ARR(type, name, arr, addr) \
type OS_##name arr; \
__DEF_ADDR_OFFSETS(name, addr)
#define OS_DEF_HW_REG(type, name, addr) \
type OS_##name;
#endif
typedef enum { typedef enum {
OS_BOOT_MAGIC_BOOTROM = 0xD15EA5E, OS_BOOT_MAGIC_BOOTROM = 0xD15EA5E,
@ -162,7 +175,12 @@ OS_DEF_GLOBAL_ARR(u8, SC_PRDINFO, [0x100], 0x80003800);
/** /**
* PI hardware globals * PI hardware globals
*/ */
#ifdef __MWERKS__
volatile u32 PI_HW_REGS[] : 0xCC003000; volatile u32 PI_HW_REGS[] : 0xCC003000;
#else
volatile u32 PI_HW_REGS[];
#endif
typedef enum { typedef enum {
PI_INTSR, //!< 0xCC003000 PI_INTSR, //!< 0xCC003000
PI_INTMR, //!< 0xCC003004 PI_INTMR, //!< 0xCC003004
@ -215,7 +233,12 @@ typedef enum {
/** /**
* MI hardware registers * MI hardware registers
*/ */
#ifdef __MWERKS__
volatile u16 MI_HW_REGS[] : 0xCC004000; volatile u16 MI_HW_REGS[] : 0xCC004000;
#else
volatile u16 MI_HW_REGS[];
#endif
typedef enum { typedef enum {
MI_PAGE_MEM0_H, //!< 0xCC004000 MI_PAGE_MEM0_H, //!< 0xCC004000
MI_PAGE_MEM0_L, //!< 0xCC004002 MI_PAGE_MEM0_L, //!< 0xCC004002

View File

@ -54,6 +54,7 @@ typedef enum {
extern u32 __PADSpec; extern u32 __PADSpec;
void PADControlMotor(s32 chan, u32 cmd); void PADControlMotor(s32 chan, u32 cmd);
BOOL __PADDisableRecalibration(BOOL disable);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -8,7 +8,11 @@ extern "C" {
/** /**
* SI hardware registers * SI hardware registers
*/ */
#ifdef __MWERKS__
volatile u32 SI_HW_REGS[] : 0xCD006400; volatile u32 SI_HW_REGS[] : 0xCD006400;
#else
volatile u32 SI_HW_REGS[];
#endif
/** /**
* Hardware register indexes * Hardware register indexes

View File

@ -30,6 +30,7 @@ u32 VIGetScanMode(void);
u32 VIGetDTVStatus(); u32 VIGetDTVStatus();
u32 VIGetDimmingCount(); u32 VIGetDimmingCount();
BOOL VIEnableDimming(BOOL enable); BOOL VIEnableDimming(BOOL enable);
BOOL VIResetDimmingCount();
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -8,7 +8,11 @@ extern "C" {
/** /**
* VI hardware registers * VI hardware registers
*/ */
#ifdef __MWERKS__
volatile u16 VI_HW_REGS[] : 0xCC002000; volatile u16 VI_HW_REGS[] : 0xCC002000;
#else
volatile u16 VI_HW_REGS[];
#endif
/** /**
* Hardware register indexes * Hardware register indexes

View File

@ -166,7 +166,7 @@ void __AIDHandler(s32 intr, OSContext* ctx) {
static asm void __AICallbackStackSwitch(register AIDMACallback callback) { static asm void __AICallbackStackSwitch(register AIDMACallback callback) {
// clang-format off // clang-format off
#ifdef __MWERKS__
mr r31, callback mr r31, callback
lis r5, __OldStack@ha lis r5, __OldStack@ha
@ -187,7 +187,7 @@ static asm void __AICallbackStackSwitch(register AIDMACallback callback) {
frfree frfree
blr blr
#endif
// clang-format on // clang-format on
} }

View File

@ -1,4 +1,5 @@
#include <revolution/AX.h> #include <revolution/AX.h>
#include <revolution/OS.h>
static BOOL __init = FALSE; static BOOL __init = FALSE;
const char* __AXVersion = "<< RVL_SDK - AX \trelease build: Feb 27 2009 10:01:36 (0x4302_145) >>"; const char* __AXVersion = "<< RVL_SDK - AX \trelease build: Feb 27 2009 10:01:36 (0x4302_145) >>";

View File

@ -1,6 +1,8 @@
#include <revolution/BASE.h> #include <revolution/BASE.h>
#include <revolution/OS.h> #include <revolution/OS.h>
#ifdef __MWERKS__
asm u32 PPCMfmsr(void) { asm u32 PPCMfmsr(void) {
// clang-format off // clang-format off
nofralloc nofralloc
@ -304,3 +306,5 @@ void PPCMthid4(register u32 val) {
// clang-format on // clang-format on
} }
} }
#endif

View File

@ -26,6 +26,7 @@ void __DBExceptionDestinationAux(void) {
asm void __DBExceptionDestination(void){ asm void __DBExceptionDestination(void){
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
// Set up MMU // Set up MMU
@ -34,6 +35,7 @@ asm void __DBExceptionDestination(void){
mtmsr r3 mtmsr r3
b __DBExceptionDestinationAux b __DBExceptionDestinationAux
#endif
// clang-format on // clang-format on
} }

View File

@ -1,6 +1,7 @@
#include <revolution/DVD.h> #include <revolution/DVD.h>
#include <revolution/ESP.h> #include <revolution/ESP.h>
#include <revolution/OS.h> #include <revolution/OS.h>
#include <string.h>
#define DISK_TOC_OFFSET 0x40000 #define DISK_TOC_OFFSET 0x40000
#define DISK_TOC_SIZE ROUND_UP(sizeof(DVDGameToc), 32) #define DISK_TOC_SIZE ROUND_UP(sizeof(DVDGameToc), 32)
@ -2384,4 +2385,3 @@ void DVDGetPartitionParamsAsync(){
//unused //unused
void DVDOpenPartitionWithParamsAsync(){ void DVDOpenPartitionWithParamsAsync(){
} }

View File

@ -6,8 +6,8 @@ static char base64_array[] = {
}; };
ENCResult ENCiConvertStringUtf8ToUtf16(u16* dest, u32* destLengthPtr, const u8* src, u32* srcLengthPtr, ENCBreakType brType); ENCResult ENCiConvertStringUtf8ToUtf16(u16* dest, u32* destLengthPtr, const u8* src, u32* srcLengthPtr, ENCBreakType brType);
u32 ENCiConvertUtf8To32(const u8* src, s32 size); static u32 ENCiConvertUtf8To32(const u8* src, s32 size);
void ENCiConvertUtf32To16(u16* dest, s32 size, u32 val); static void ENCiConvertUtf32To16(u16* dest, s32 size, u32 val);
//unused //unused
void ENCConvertStringUnicodeToAscii(){ void ENCConvertStringUnicodeToAscii(){
@ -310,4 +310,3 @@ static void ENCiConvertUtf32To16(u16* dest, s32 size, u32 val){
//unused //unused
static void ENCiGetBase64Value(){ static void ENCiGetBase64Value(){
} }

View File

@ -1,3 +1,4 @@
#include "revolution/os/OSTime.h"
#include <revolution/DVD.h> #include <revolution/DVD.h>
#include <revolution/EXI.h> #include <revolution/EXI.h>
#include <revolution/OS.h> #include <revolution/OS.h>
@ -247,7 +248,7 @@ static BOOL __EXIProbe(EXIChannel chan) {
} }
if (cpr & EXI_CPR_EXT) { if (cpr & EXI_CPR_EXT) {
s32 time = (s32)(OS_TICKS_TO_MSEC(OSGetTime()) / 100) + 1; s32 time = (s32)(OSTicksToMilliseconds(OSGetTime()) / 100) + 1;
if (OS_EXI_LAST_INSERT[chan] == 0) { if (OS_EXI_LAST_INSERT[chan] == 0) {
OS_EXI_LAST_INSERT[chan] = time; OS_EXI_LAST_INSERT[chan] = time;
} }

View File

@ -1,6 +1,5 @@
#include <revolution/GX.h> #include <revolution/GX.h>
#include <revolution/OS.h> #include <revolution/OS.h>
#include <string.h>
static GXFifoObj DisplayListFifo; static GXFifoObj DisplayListFifo;
static GXData __savedGXdata; static GXData __savedGXdata;

View File

@ -215,6 +215,7 @@ inline void WriteLightObj(register volatile void* dst,
register f32 ps_0, ps_1, ps_2, ps_3, ps_4, ps_5; register f32 ps_0, ps_1, ps_2, ps_3, ps_4, ps_5;
// clang-format off // clang-format off
#ifdef __MWERKS__
asm volatile { asm volatile {
lwz color, src->color lwz color, src->color
xor r6, r6, r6 // make zero xor r6, r6, r6 // make zero
@ -237,6 +238,7 @@ inline void WriteLightObj(register volatile void* dst,
psq_st ps_4, 0(dst), 0, 0 psq_st ps_4, 0(dst), 0, 0
psq_st ps_5, 0(dst), 0, 0 psq_st ps_5, 0(dst), 0, 0
} }
#endif
// clang-format on // clang-format on
} }

View File

@ -6,6 +6,7 @@ inline void LoadProjPS(register f32* dst) {
register GXData* src; register GXData* src;
// clang-format off // clang-format off
#ifdef __MWERKS__
asm volatile { asm volatile {
lwz src, __GXData lwz src, __GXData
psq_l ps_0, 0 + GXData.proj(src), 0, 0 psq_l ps_0, 0 + GXData.proj(src), 0, 0
@ -15,6 +16,7 @@ inline void LoadProjPS(register f32* dst) {
psq_st ps_1, 8(dst), 0, 0 psq_st ps_1, 8(dst), 0, 0
psq_st ps_2, 16(dst), 0, 0 psq_st ps_2, 16(dst), 0, 0
} }
#endif
// clang-format on // clang-format on
} }
@ -22,6 +24,7 @@ inline void WriteProjPS(register volatile void* dst, register const f32* src) {
register f32 ps_0, ps_1, ps_2; register f32 ps_0, ps_1, ps_2;
// clang-format off // clang-format off
#ifdef __MWERKS__
asm volatile { asm volatile {
psq_l ps_0, 0(src), 0, 0 psq_l ps_0, 0(src), 0, 0
psq_l ps_1, 8(src), 0, 0 psq_l ps_1, 8(src), 0, 0
@ -30,6 +33,7 @@ inline void WriteProjPS(register volatile void* dst, register const f32* src) {
psq_st ps_1, 0(dst), 0, 0 psq_st ps_1, 0(dst), 0, 0
psq_st ps_2, 0(dst), 0, 0 psq_st ps_2, 0(dst), 0, 0
} }
#endif
// clang-format on // clang-format on
} }
@ -37,6 +41,7 @@ inline void Copy6Floats(register f32* dst, register const f32* src) {
register f32 ps_0, ps_1, ps_2; register f32 ps_0, ps_1, ps_2;
// clang-format off // clang-format off
#ifdef __MWERKS__
asm volatile { asm volatile {
psq_l ps_0, 0(src), 0, 0 psq_l ps_0, 0(src), 0, 0
psq_l ps_1, 8(src), 0, 0 psq_l ps_1, 8(src), 0, 0
@ -45,6 +50,7 @@ inline void Copy6Floats(register f32* dst, register const f32* src) {
psq_st ps_1, 8(dst), 0, 0 psq_st ps_1, 8(dst), 0, 0
psq_st ps_2, 16(dst), 0, 0 psq_st ps_2, 16(dst), 0, 0
} }
#endif
// clang-format on // clang-format on
} }
@ -96,6 +102,7 @@ inline void WriteMTXPS4x3(register volatile void* dst, register const Mtx src) {
register f32 ps_0, ps_1, ps_2, ps_3, ps_4, ps_5; register f32 ps_0, ps_1, ps_2, ps_3, ps_4, ps_5;
// clang-format off // clang-format off
#ifdef __MWERKS__
asm volatile { asm volatile {
psq_l ps_0, 0(src), 0, 0 psq_l ps_0, 0(src), 0, 0
psq_l ps_1, 8(src), 0, 0 psq_l ps_1, 8(src), 0, 0
@ -111,6 +118,7 @@ inline void WriteMTXPS4x3(register volatile void* dst, register const Mtx src) {
psq_st ps_4, 0(dst), 0, 0 psq_st ps_4, 0(dst), 0, 0
psq_st ps_5, 0(dst), 0, 0 psq_st ps_5, 0(dst), 0, 0
} }
#endif
// clang-format on // clang-format on
} }
@ -118,6 +126,7 @@ inline void WriteMTXPS3x3(register volatile void* dst, register const Mtx src) {
register f32 ps_0, ps_1, ps_2, ps_3, ps_4, ps_5; register f32 ps_0, ps_1, ps_2, ps_3, ps_4, ps_5;
// clang-format off // clang-format off
#ifdef __MWERKS__
asm volatile { asm volatile {
psq_l ps_0, 0(src), 0, 0 psq_l ps_0, 0(src), 0, 0
lfs ps_1, 8(src) lfs ps_1, 8(src)
@ -133,6 +142,7 @@ inline void WriteMTXPS3x3(register volatile void* dst, register const Mtx src) {
psq_st ps_4, 0(dst), 0, 0 psq_st ps_4, 0(dst), 0, 0
stfs ps_5, 0(dst) stfs ps_5, 0(dst)
} }
#endif
// clang-format on // clang-format on
} }
@ -140,6 +150,7 @@ inline void WriteMTXPS4x2(register volatile void* dst, register const Mtx src) {
register f32 ps_0, ps_1, ps_2, ps_3; register f32 ps_0, ps_1, ps_2, ps_3;
// clang-format off // clang-format off
#ifdef __MWERKS__
asm volatile { asm volatile {
psq_l ps_0, 0(src), 0, 0 psq_l ps_0, 0(src), 0, 0
psq_l ps_1, 8(src), 0, 0 psq_l ps_1, 8(src), 0, 0
@ -151,6 +162,7 @@ inline void WriteMTXPS4x2(register volatile void* dst, register const Mtx src) {
psq_st ps_2, 0(dst), 0, 0 psq_st ps_2, 0(dst), 0, 0
psq_st ps_3, 0(dst), 0, 0 psq_st ps_3, 0(dst), 0, 0
} }
#endif
// clang-format on // clang-format on
} }

View File

@ -1,5 +1,6 @@
#include <revolution/IPC.h> #include <revolution/IPC.h>
#include <revolution/OS.h> #include <revolution/OS.h>
#include <string.h>
#define IPC_QUEUE_CAPACITY 16 #define IPC_QUEUE_CAPACITY 16
#define IPC_HEAP_SIZE_OLD 0x800 #define IPC_HEAP_SIZE_OLD 0x800

View File

@ -9,6 +9,7 @@ DECOMP_FORCELITERAL(mtx_c, 1.0f, 0.0f);
void C_MTXIdentity(){ void C_MTXIdentity(){
} }
#ifdef __MWERKS__
void PSMTXIdentity(register Mtx m) { void PSMTXIdentity(register Mtx m) {
register f32 c_zero = 0.0f; register f32 c_zero = 0.0f;
register f32 c_one = 1.0f; register f32 c_one = 1.0f;
@ -26,11 +27,13 @@ void PSMTXIdentity(register Mtx m) {
psq_st c_10, 40(m), 0, 0 psq_st c_10, 40(m), 0, 0
} }
} }
#endif
//unused //unused
void C_MTXCopy(){ void C_MTXCopy(){
} }
#ifdef __MWERKS__
asm void PSMTXCopy(const register Mtx src, register Mtx dst) { asm void PSMTXCopy(const register Mtx src, register Mtx dst) {
nofralloc nofralloc
psq_l fp0, 0(src), 0, 0 psq_l fp0, 0(src), 0, 0
@ -47,11 +50,13 @@ asm void PSMTXCopy(const register Mtx src, register Mtx dst) {
psq_st fp5, 40(dst), 0, 0 psq_st fp5, 40(dst), 0, 0
blr blr
} }
#endif
//unused //unused
void C_MTXConcat(){ void C_MTXConcat(){
} }
#ifdef __MWERKS__
asm void PSMTXConcat(const register Mtx mA, const register Mtx mB, asm void PSMTXConcat(const register Mtx mA, const register Mtx mB,
register Mtx mAB) { register Mtx mAB) {
nofralloc nofralloc
@ -107,11 +112,13 @@ asm void PSMTXConcat(const register Mtx mA, const register Mtx mB,
addi r1, r1, 64 addi r1, r1, 64
blr blr
} }
#endif
//unused //unused
void C_MTXConcatArray(){ void C_MTXConcatArray(){
} }
#ifdef __MWERKS__
void PSMTXConcatArray(const register Mtx mtx1, const register Mtx mtx2, void PSMTXConcatArray(const register Mtx mtx1, const register Mtx mtx2,
register Mtx mtx3, register u32 vv4) { register Mtx mtx3, register u32 vv4) {
register f32 va0, va1, va2, va3, va4, va5; register f32 va0, va1, va2, va3, va4, va5;
@ -202,11 +209,13 @@ _loop:
psq_st vd5, 40(mtx3), 0, 0 psq_st vd5, 40(mtx3), 0, 0
} }
} }
#endif
//unused //unused
void C_MTXTranspose(){ void C_MTXTranspose(){
} }
#ifdef __MWERKS__
void PSMTXTranspose(const register Mtx src, register Mtx xPose) { void PSMTXTranspose(const register Mtx src, register Mtx xPose) {
register f32 c_zero = 0.0f; register f32 c_zero = 0.0f;
register f32 row0a, row1a, row0b, row1b; register f32 row0a, row1a, row0b, row1b;
@ -233,11 +242,13 @@ void PSMTXTranspose(const register Mtx src, register Mtx xPose) {
stfs row0b, 40(xPose) stfs row0b, 40(xPose)
} }
} }
#endif
//unused //unused
void C_MTXInverse(){ void C_MTXInverse(){
} }
#ifdef __MWERKS__
asm void PSMTXInverse(const register Mtx src, register Mtx inv) { asm void PSMTXInverse(const register Mtx src, register Mtx inv) {
nofralloc nofralloc
psq_l fp0, 0(src), 1, 0 psq_l fp0, 0(src), 1, 0
@ -304,22 +315,26 @@ loc0:
addi r3, 0, 1 addi r3, 0, 1
blr blr
} }
#endif
//unused //unused
void C_MTXRotRad(){ void C_MTXRotRad(){
} }
#ifdef __MWERKS__
void PSMTXRotRad(Mtx m, char axis, f32 rad) { void PSMTXRotRad(Mtx m, char axis, f32 rad) {
f32 sinA, cosA; f32 sinA, cosA;
sinA = sinf(rad); sinA = sinf(rad);
cosA = cosf(rad); cosA = cosf(rad);
PSMTXRotTrig(m, axis, sinA, cosA); PSMTXRotTrig(m, axis, sinA, cosA);
} }
#endif
//unused //unused
void C_MTXRotTrig(){ void C_MTXRotTrig(){
} }
#ifdef __MWERKS__
void PSMTXRotTrig(register Mtx m, register char arg2, register f32 sinA, void PSMTXRotTrig(register Mtx m, register char arg2, register f32 sinA,
register f32 cosA) { register f32 cosA) {
register f32 fc0, fc1, nsinA; register f32 fc0, fc1, nsinA;
@ -379,11 +394,13 @@ loc2:
loc3: loc3:
} }
} }
#endif
//unused //unused
void C_MTXRotAxisRad(){ void C_MTXRotAxisRad(){
} }
#ifdef __MWERKS__
void __PSMTXRotAxisRadInternal(register Mtx m, const register Vec* axis, void __PSMTXRotAxisRadInternal(register Mtx m, const register Vec* axis,
register f32 sT, register f32 cT) { register f32 sT, register f32 cT) {
register f32 tT, fc0; register f32 tT, fc0;
@ -437,17 +454,21 @@ void __PSMTXRotAxisRadInternal(register Mtx m, const register Vec* axis,
psq_st tmp5, 40(m), 0, 0 psq_st tmp5, 40(m), 0, 0
} }
} }
#endif
#ifdef __MWERKS__
void PSMTXRotAxisRad(Mtx m, const Vec* axis, f32 rad) { void PSMTXRotAxisRad(Mtx m, const Vec* axis, f32 rad) {
f32 sinT = sinf(rad); f32 sinT = sinf(rad);
f32 cosT = cosf(rad); f32 cosT = cosf(rad);
__PSMTXRotAxisRadInternal(m, axis, sinT, cosT); __PSMTXRotAxisRadInternal(m, axis, sinT, cosT);
} }
#endif
//unused //unused
void C_MTXTrans(){ void C_MTXTrans(){
} }
#ifdef __MWERKS__
void PSMTXTrans(register Mtx m, register f32 xT, register f32 yT, void PSMTXTrans(register Mtx m, register f32 xT, register f32 yT,
register f32 zT) { register f32 zT) {
register f32 c0 = 0.0f; register f32 c0 = 0.0f;
@ -466,11 +487,13 @@ void PSMTXTrans(register Mtx m, register f32 xT, register f32 yT,
stfs c1, 0(m) stfs c1, 0(m)
} }
} }
#endif
//unused //unused
void C_MTXTransApply(){ void C_MTXTransApply(){
} }
#ifdef __MWERKS__
asm void PSMTXTransApply(const register Mtx src, register Mtx dst, asm void PSMTXTransApply(const register Mtx src, register Mtx dst,
register f32 xT, register f32 yT, register f32 zT) { register f32 xT, register f32 yT, register f32 zT) {
nofralloc nofralloc
@ -499,11 +522,13 @@ asm void PSMTXTransApply(const register Mtx src, register Mtx dst,
psq_st fp8, 40(dst), 0, 0 psq_st fp8, 40(dst), 0, 0
blr blr
} }
#endif
//unused //unused
void C_MTXScale(){ void C_MTXScale(){
} }
#ifdef __MWERKS__
void PSMTXScale(register Mtx m, register f32 xS, register f32 yS, void PSMTXScale(register Mtx m, register f32 xS, register f32 yS,
register f32 zS) { register f32 zS) {
register f32 c0 = 0.0f; register f32 c0 = 0.0f;
@ -519,11 +544,13 @@ void PSMTXScale(register Mtx m, register f32 xS, register f32 yS,
stfs c0, 44(m) stfs c0, 44(m)
} }
} }
#endif
//unused //unused
void C_MTXScaleApply(){ void C_MTXScaleApply(){
} }
#ifdef __MWERKS__
asm void PSMTXScaleApply(const register Mtx src, register Mtx dst, asm void PSMTXScaleApply(const register Mtx src, register Mtx dst,
register f32 xS, register f32 yS, register f32 zS) { register f32 xS, register f32 yS, register f32 zS) {
nofralloc nofralloc
@ -553,11 +580,13 @@ asm void PSMTXScaleApply(const register Mtx src, register Mtx dst,
psq_st fp2, 40(dst), 0, 0 psq_st fp2, 40(dst), 0, 0
blr blr
} }
#endif
//unused //unused
void C_MTXQuat(){ void C_MTXQuat(){
} }
#ifdef __MWERKS__
void PSMTXQuat(register Mtx m, const register Quaternion* q) { void PSMTXQuat(register Mtx m, const register Quaternion* q) {
register f32 c_zero, c_one, c_two, scale; register f32 c_zero, c_one, c_two, scale;
register f32 tmp0, tmp1, tmp2, tmp3, tmp4; register f32 tmp0, tmp1, tmp2, tmp3, tmp4;
@ -608,14 +637,17 @@ void PSMTXQuat(register Mtx m, const register Quaternion* q) {
psq_st tmp9, 32(m), 0, 0 psq_st tmp9, 32(m), 0, 0
} }
} }
#endif
//unused //unused
void C_MTXReflect(){ void C_MTXReflect(){
} }
#ifdef __MWERKS__
//unused //unused
asm void PSMTXReflect(){ asm void PSMTXReflect(){
} }
#endif
void C_MTXLookAt(Mtx m, const Vec* camPos, const Vec* camUp, const Vec* target) { void C_MTXLookAt(Mtx m, const Vec* camPos, const Vec* camUp, const Vec* target) {
Vec vLook, vRight, vUp; Vec vLook, vRight, vUp;

View File

@ -4,6 +4,7 @@
void C_MTXMultVec(){ void C_MTXMultVec(){
} }
#ifdef __MWERKS__
asm void PSMTXMultVec(register const Mtx m, register const Vec* src, asm void PSMTXMultVec(register const Mtx m, register const Vec* src,
register Vec* dst) { register Vec* dst) {
// clang-format off // clang-format off
@ -48,6 +49,7 @@ asm void PSMTXMultVec(register const Mtx m, register const Vec* src,
blr blr
// clang-format on // clang-format on
} }
#endif
//unused //unused
void C_MTXMultVecArray(){ void C_MTXMultVecArray(){
@ -72,4 +74,3 @@ void C_MTXMultVecArraySR(){
//unused //unused
asm void PSMTXMultVecArraySR(){ asm void PSMTXMultVecArraySR(){
} }

View File

@ -3,6 +3,7 @@
DECOMP_FORCELITERAL(quat_c, 0.00001f, 1.0f, 0.0f); DECOMP_FORCELITERAL(quat_c, 0.00001f, 1.0f, 0.0f);
#ifdef __MWERKS__
//TODO: get it to match with a register var instead of f3 //TODO: get it to match with a register var instead of f3
void PSQUATAdd(const register Quaternion* quat1, const register Quaternion* quat2, void PSQUATAdd(const register Quaternion* quat1, const register Quaternion* quat2,
register Quaternion* out) { register Quaternion* out) {
@ -141,8 +142,8 @@ void PSQUATNormalize(register const Quaternion* in, register Quaternion* out) {
} }
//unused //unused
/*
void PSQUATInverse(const register Quaternion* src, register Quaternion* inv) { void PSQUATInverse(const register Quaternion* src, register Quaternion* inv) {
/*
register f32 vv1, vv2, vv3, vv4; register f32 vv1, vv2, vv3, vv4;
register f32 vv5, vv6, vv7, vv8, vv9, vvA, vvB; register f32 vv5, vv6, vv7, vv8, vv9, vvA, vvB;
register f32 vvC = 1.0F; register f32 vvC = 1.0F;
@ -172,8 +173,9 @@ loc1:
psq_st vv1, 0(inv), 0, 0; psq_st vv1, 0(inv), 0, 0;
psq_st vv3, 8(inv), 1, 0; psq_st vv3, 8(inv), 1, 0;
} }
*/
} }
*/ #endif
inline f32 mySqrtf(f32 x){ inline f32 mySqrtf(f32 x){
return sqrt(x); return sqrt(x);
@ -228,14 +230,15 @@ void C_QUATMtx(Quaternion* quat, const Mtx mtx) {
} }
//unused //unused
/*
void C_QUATLerp(const Quaternion* quat1, const Quaternion* quat2, void C_QUATLerp(const Quaternion* quat1, const Quaternion* quat2,
Quaternion* out, f32 f) { Quaternion* out, f32 f) {
/*
out->x = f * (quat2->x - quat1->x) + quat1->x; out->x = f * (quat2->x - quat1->x) + quat1->x;
out->y = f * (quat2->y - quat1->y) + quat1->y; out->y = f * (quat2->y - quat1->y) + quat1->y;
out->z = f * (quat2->z - quat1->z) + quat1->z; out->z = f * (quat2->z - quat1->z) + quat1->z;
out->w = f * (quat2->w - quat1->w) + quat1->w; out->w = f * (quat2->w - quat1->w) + quat1->w;
}*/ */
}
void C_QUATSlerp(const Quaternion* a, const Quaternion* b, Quaternion* out, void C_QUATSlerp(const Quaternion* a, const Quaternion* b, Quaternion* out,
f32 t) { f32 t) {

View File

@ -4,6 +4,7 @@
void C_VECAdd(){ void C_VECAdd(){
} }
#ifdef __MWERKS__
asm void PSVECAdd(register const Vec* vec1, register const Vec* vec2, asm void PSVECAdd(register const Vec* vec1, register const Vec* vec2,
register Vec* dst) { register Vec* dst) {
// clang-format off // clang-format off
@ -28,6 +29,7 @@ asm void PSVECAdd(register const Vec* vec1, register const Vec* vec2,
blr blr
// clang-format on // clang-format on
} }
#endif
//unused //unused
void C_VECSubtract(){ void C_VECSubtract(){
@ -41,6 +43,7 @@ asm void PSVECSubtract(){
void C_VECScale(){ void C_VECScale(){
} }
#ifdef __MWERKS__
//unused //unused
void PSVECScale(register const Vec* in, register Vec* out, register f32 scale) { void PSVECScale(register const Vec* in, register Vec* out, register f32 scale) {
register f32 xy, z; register f32 xy, z;
@ -62,11 +65,13 @@ void PSVECScale(register const Vec* in, register Vec* out, register f32 scale) {
} }
// clang-format on // clang-format on
} }
#endif
//unused //unused
void C_VECNormalize(){ void C_VECNormalize(){
} }
#ifdef __MWERKS__
void PSVECNormalize(register const Vec* vec1, register Vec* dst) { void PSVECNormalize(register const Vec* vec1, register Vec* dst) {
register f32 c_half, c_three; register f32 c_half, c_three;
register f32 v1_xy, v1_z; register f32 v1_xy, v1_z;
@ -109,6 +114,7 @@ void PSVECNormalize(register const Vec* vec1, register Vec* dst) {
} }
// clang-format on // clang-format on
} }
#endif
//unused //unused
void C_VECSquareMag(){ void C_VECSquareMag(){
@ -122,6 +128,7 @@ asm void PSVECSquareMag(){
void C_VECMag(){ void C_VECMag(){
} }
#ifdef __MWERKS__
f32 PSVECMag(register const Vec* v) { f32 PSVECMag(register const Vec* v) {
register f32 vxy, vzz, mag; register f32 vxy, vzz, mag;
register f64 rmag; register f64 rmag;
@ -171,11 +178,13 @@ f32 PSVECMag(register const Vec* v) {
return mag; return mag;
} }
#endif
//unused //unused
void C_VECDotProduct(){ void C_VECDotProduct(){
} }
#ifdef __MWERKS__
asm f32 PSVECDotProduct(register const Vec* vec1, register const Vec* vec2) { asm f32 PSVECDotProduct(register const Vec* vec1, register const Vec* vec2) {
// clang-format off // clang-format off
nofralloc nofralloc
@ -196,11 +205,13 @@ asm f32 PSVECDotProduct(register const Vec* vec1, register const Vec* vec2) {
blr blr
// clang-format on // clang-format on
} }
#endif
//unused //unused
void C_VECCrossProduct(){ void C_VECCrossProduct(){
} }
#ifdef __MWERKS__
asm void PSVECCrossProduct(register const Vec* vec1, register const Vec* vec2, asm void PSVECCrossProduct(register const Vec* vec1, register const Vec* vec2,
register Vec* dst) { register Vec* dst) {
// clang-format off // clang-format off
@ -237,6 +248,7 @@ asm void PSVECCrossProduct(register const Vec* vec1, register const Vec* vec2,
blr blr
// clang-format on // clang-format on
} }
#endif
void C_VECHalfAngle(register const Vec* a, register const Vec* b, void C_VECHalfAngle(register const Vec* a, register const Vec* b,
register Vec* half) { register Vec* half) {
@ -269,6 +281,7 @@ void C_VECReflect(){
void C_VECSquareDistance(){ void C_VECSquareDistance(){
} }
#ifdef __MWERKS__
//unused //unused
f32 PSVECSquareDistance(register const Vec* a, register const Vec* b) { f32 PSVECSquareDistance(register const Vec* a, register const Vec* b) {
register f32 ayz, byz; register f32 ayz, byz;
@ -297,6 +310,7 @@ f32 PSVECSquareDistance(register const Vec* a, register const Vec* b) {
return dist; return dist;
} }
#endif
//unused //unused
void C_VECDistance(){ void C_VECDistance(){
@ -305,4 +319,3 @@ void C_VECDistance(){
//unused //unused
void PSVECDistance(){ void PSVECDistance(){
} }

View File

@ -57,6 +57,7 @@ void __OSIsDebuggerPresent(){
asm void __OSFPRInit(void) { asm void __OSFPRInit(void) {
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
// Set FP available bit // Set FP available bit
@ -140,6 +141,7 @@ paired_singles_disabled:
mtfsf 0xff, f0 mtfsf 0xff, f0
blr blr
#endif
// clang-format on // clang-format on
} }
@ -760,6 +762,7 @@ static void OSExceptionInit(void) {
static asm void __OSDBIntegrator(void) { static asm void __OSDBIntegrator(void) {
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
entry __OSDBINTSTART entry __OSDBINTSTART
@ -785,11 +788,13 @@ static asm void __OSDBIntegrator(void) {
blr blr
entry __OSDBINTEND entry __OSDBINTEND
#endif
// clang-format on // clang-format on
} }
static asm void __OSDBJump(void){ static asm void __OSDBJump(void){
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
entry __OSDBJUMPSTART entry __OSDBJUMPSTART
@ -797,6 +802,7 @@ static asm void __OSDBJump(void){
bla 0x60 bla 0x60
entry __OSDBJUMPEND entry __OSDBJUMPEND
#endif
// clang-format on // clang-format on
} }
@ -813,6 +819,7 @@ OSExceptionHandler __OSGetExceptionHandler(u8 type) {
static asm void OSExceptionVector(void) { static asm void OSExceptionVector(void) {
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
entry __OSEVStart entry __OSEVStart
@ -873,11 +880,13 @@ lbl_800ECF70:
entry __OSEVEnd entry __OSEVEnd
nop nop
#endif
// clang-format on // clang-format on
} }
asm void OSDefaultExceptionHandler(u8 type, register OSContext* ctx) { asm void OSDefaultExceptionHandler(u8 type, register OSContext* ctx) {
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
stw r0, ctx->gprs[0] stw r0, ctx->gprs[0]
@ -905,6 +914,7 @@ asm void OSDefaultExceptionHandler(u8 type, register OSContext* ctx) {
stwu r1, -8(r1) stwu r1, -8(r1)
b __OSUnhandledException b __OSUnhandledException
#endif
// clang-format on // clang-format on
} }
@ -913,6 +923,7 @@ void __OSPSInit(void) {
ICFlashInvalidate(); ICFlashInvalidate();
// clang-format off // clang-format off
#ifdef __MWERKS__
asm { asm {
sync sync
li r3, 0 li r3, 0
@ -925,6 +936,7 @@ void __OSPSInit(void) {
mtgqr6 r3 mtgqr6 r3
mtgqr7 r3 mtgqr7 r3
} }
#endif
// clang-format on // clang-format on
} }

View File

@ -202,6 +202,7 @@ static void DecrementerExceptionCallback(u8 type, OSContext* ctx) {
static asm void DecrementerExceptionHandler(register u8 type, static asm void DecrementerExceptionHandler(register u8 type,
register OSContext* ctx) { register OSContext* ctx) {
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
stw r0, ctx->gprs[0] stw r0, ctx->gprs[0]
@ -226,6 +227,7 @@ static asm void DecrementerExceptionHandler(register u8 type,
stwu r1, -8(r1) stwu r1, -8(r1)
b DecrementerExceptionCallback b DecrementerExceptionCallback
#endif
// clang-format on // clang-format on
} }

View File

@ -18,6 +18,7 @@ static void ExternalInterruptHandler(u8 type, OSContext* ctx);
asm BOOL OSDisableInterrupts(void) { asm BOOL OSDisableInterrupts(void) {
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
entry __RAS_OSDisableInterrupts_begin entry __RAS_OSDisableInterrupts_begin
@ -32,11 +33,13 @@ asm BOOL OSDisableInterrupts(void) {
// Return old interrupt status // Return old interrupt status
rlwinm r3, r3, 17, 31, 31 rlwinm r3, r3, 17, 31, 31
blr blr
#endif
// clang-format on // clang-format on
} }
asm BOOL OSEnableInterrupts(void) { asm BOOL OSEnableInterrupts(void) {
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
mfmsr r3 mfmsr r3
@ -47,11 +50,13 @@ asm BOOL OSEnableInterrupts(void) {
// Return old interrupt status // Return old interrupt status
rlwinm r3, r3, 17, 31, 31 rlwinm r3, r3, 17, 31, 31
blr blr
#endif
// clang-format on // clang-format on
} }
asm BOOL OSRestoreInterrupts(register BOOL status){ asm BOOL OSRestoreInterrupts(register BOOL status){
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
cmpwi status, 0 cmpwi status, 0
@ -71,11 +76,11 @@ set_msr:
// Return old interrupt status // Return old interrupt status
rlwinm r3, r4, 17, 31, 31 rlwinm r3, r4, 17, 31, 31
blr blr
#endif
// clang-format on // clang-format on
} }
OSInterruptHandler OSInterruptHandler __OSSetInterruptHandler(OSInterruptType type, OSInterruptHandler handler) {
__OSSetInterruptHandler(OSInterruptType type, OSInterruptHandler handler) {
OSInterruptHandler old = InterruptHandlerTable[type]; OSInterruptHandler old = InterruptHandlerTable[type];
InterruptHandlerTable[type] = handler; InterruptHandlerTable[type] = handler;
return old; return old;
@ -86,15 +91,13 @@ OSInterruptHandler __OSGetInterruptHandler(OSInterruptType type) {
} }
void __OSInterruptInit(void) { void __OSInterruptInit(void) {
InterruptHandlerTable = InterruptHandlerTable = (OSInterruptHandler*)OSPhysicalToCached(OS_PHYS_INTR_HANDLER_TABLE);
(OSInterruptHandler*)OSPhysicalToCached(OS_PHYS_INTR_HANDLER_TABLE);
memset(InterruptHandlerTable, 0, sizeof(OSInterruptHandler) * OS_INTR_MAX); memset(InterruptHandlerTable, 0, sizeof(OSInterruptHandler) * OS_INTR_MAX);
*(u32*)OSPhysicalToCached(OS_PHYS_PREV_INTR_MASK) = 0; *(u32*)OSPhysicalToCached(OS_PHYS_PREV_INTR_MASK) = 0;
*(u32*)OSPhysicalToCached(OS_PHYS_CURRENT_INTR_MASK) = 0; *(u32*)OSPhysicalToCached(OS_PHYS_CURRENT_INTR_MASK) = 0;
PI_HW_REGS[PI_INTMR] = PI_HW_REGS[PI_INTMR] = PI_INTMR_EXI | PI_INTMR_AI | PI_INTMR_DSP | PI_INTMR_MEM;
PI_INTMR_EXI | PI_INTMR_AI | PI_INTMR_DSP | PI_INTMR_MEM;
OS_UNK_CD000034 = 0x40000000; OS_UNK_CD000034 = 0x40000000;
__OSMaskInterrupts( __OSMaskInterrupts(
@ -539,6 +542,7 @@ void __OSDispatchInterrupt(u8 intr, OSContext* ctx) {
static asm void ExternalInterruptHandler(register u8 type, static asm void ExternalInterruptHandler(register u8 type,
register OSContext* ctx) { register OSContext* ctx) {
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
stw r0, ctx->gprs[0] stw r0, ctx->gprs[0]
@ -563,5 +567,6 @@ static asm void ExternalInterruptHandler(register u8 type,
stwu r1, -8(r1) stwu r1, -8(r1)
b __OSDispatchInterrupt b __OSDispatchInterrupt
#endif
// clang-format on // clang-format on
} }

View File

@ -10,6 +10,7 @@ void __OSSystemCallVectorEnd(void);
static asm void SystemCallVector(void) { static asm void SystemCallVector(void) {
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
entry __OSSystemCallVectorStart entry __OSSystemCallVectorStart
@ -24,6 +25,7 @@ static asm void SystemCallVector(void) {
entry __OSSystemCallVectorEnd entry __OSSystemCallVectorEnd
nop nop
#endif
// clang-format on // clang-format on
} }

View File

@ -22,6 +22,7 @@ static s32 LeapYearDays[MONTH_MAX] = {0, 31, 60, 91, 121, 152,
asm s64 OSGetTime(void) { asm s64 OSGetTime(void) {
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
mftbu r3 mftbu r3
@ -33,15 +34,19 @@ asm s64 OSGetTime(void) {
bne OSGetTime bne OSGetTime
blr blr
#endif
// clang-format on // clang-format on
} }
asm u32 OSGetTick(void){ asm u32 OSGetTick(void){
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
mftb r3 mftb r3
blr blr
#endif
// clang-format on
} }
//unused //unused

View File

@ -8,6 +8,7 @@ DECL_SECTION(".dtors$00") extern funcptr_t _dtors[];
asm void __init_hardware(void) { asm void __init_hardware(void) {
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
// Enable floating-point // Enable floating-point
@ -25,11 +26,13 @@ asm void __init_hardware(void) {
// Restore LR // Restore LR
mtlr r31 mtlr r31
blr blr
#endif
// clang-format on // clang-format on
} }
asm void __flush_cache(register void* dst, register size_t n) { asm void __flush_cache(register void* dst, register size_t n) {
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
lis r5, 0xFFFFFFF1@h lis r5, 0xFFFFFFF1@h
@ -49,17 +52,20 @@ _loop:
isync isync
blr blr
#endif
// clang-format on // clang-format on
} }
asm void __init_user(void) { asm void __init_user(void) {
// clang-format off // clang-format off
#ifdef __MWERKS__
fralloc fralloc
bl __init_cpp bl __init_cpp
frfree frfree
blr blr
#endif
// clang-format on // clang-format on
} }

View File

@ -28,6 +28,7 @@ DECL_SECTION(".init") static BOOL __get_debug_bba(void) {
DECL_SECTION(".init") DECL_WEAK asm void __start(void) { DECL_SECTION(".init") DECL_WEAK asm void __start(void) {
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
// Setup hardware // Setup hardware
@ -281,6 +282,7 @@ _after_init_metro_trk_bba:
mr r4, r15 mr r4, r15
bl main bl main
b exit // <- Will halt CPU b exit // <- Will halt CPU
#endif
// clang-format on // clang-format on
} }
@ -305,6 +307,7 @@ static void __init_bss_section(void* dst, size_t size) {
DECL_SECTION(".init") static asm void __init_registers(void) { DECL_SECTION(".init") static asm void __init_registers(void) {
// clang-format off // clang-format off
#ifdef __MWERKS__
nofralloc nofralloc
li r0, 0 li r0, 0
@ -345,6 +348,7 @@ DECL_SECTION(".init") static asm void __init_registers(void) {
ori r13, r13, _SDA_BASE_@l ori r13, r13, _SDA_BASE_@l
blr blr
#endif
// clang-format on // clang-format on
} }

View File

@ -2,6 +2,7 @@
#include <revolution/OS.h> #include <revolution/OS.h>
#include <revolution/USB.h> #include <revolution/USB.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#define USB_HEAP_SIZE 0x4000 #define USB_HEAP_SIZE 0x4000
@ -761,4 +762,3 @@ CW_FORCE_STRINGS(usb_c_4, "GetStrCb returned: %d\n",
"Invalid path or devClass in insertion notification call\n", "Invalid path or devClass in insertion notification call\n",
"IUSB_RegisterInsertionNotifyWithIdAsync", "IUSB_RegisterInsertionNotifyWithIdAsync",
"%s: Not enough memory\n", "Failed to open %s: %d\n"); "%s: Not enough memory\n", "Failed to open %s: %d\n");

View File

@ -1,6 +1,5 @@
#include "kyoshin/appgame/cf/object/CActorParam.hpp" #include "kyoshin/appgame/cf/object/CActorParam.hpp"
#include "monolib/Math.hpp" #include "monolib/Math.hpp"
#include "kyoshin/appgame/cf/object/CfObjectActor.hpp"
namespace cf { namespace cf {
CActorParam::CActorParam(UNKTYPE* r4, UNKTYPE* r5) : CActorState(r4), CActorParam::CActorParam(UNKTYPE* r4, UNKTYPE* r5) : CActorState(r4),

View File

@ -12,9 +12,9 @@
struct FunctionStruct{ struct FunctionStruct{
const char* name; const char* name;
void* function; void (*function)();
u32 unk8; u32 unk8;
u32 uckC; u32 unkC;
}; };
struct StaticArcFile{ struct StaticArcFile{
@ -22,7 +22,7 @@ struct StaticArcFile{
const char* filename; const char* filename;
u32 unk8; u32 unk8;
void (*function1)(int); void (*function1)(int);
void* function2; void (*function2)();
}; };
extern "C"{ extern "C"{
@ -53,4 +53,3 @@ void func_80039F64(int);
void func_80039F68(); void func_80039F68();
void vmInitPluginRegistCallback(); void vmInitPluginRegistCallback();
void vmInitCallback(); void vmInitCallback();
void main(int argc, char* argv[]);