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
cflags_game = [
*cflags_base,
"-lang=c99",
"-ipa file",
"-inline auto",
"-use_lmw_stmw on",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,6 @@
#ifndef RVL_SDK_AX_SPB_H
#define RVL_SDK_AX_SPB_H
#include <revolution/ax/AXPB.h>
#include <types.h>
#ifdef __cplusplus
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 __AXPrintStudio(void);
void __AXSPBInit(void);
void __AXSPBQuit(void);
void __AXDepopVoice(AXPB* pb);
#ifdef __cplusplus

View File

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

View File

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

View File

@ -9,6 +9,7 @@ extern "C" {
#define DVD_LOW_SPEED(x) (((x)&3) << 16)
// Forward declarations
#ifdef __MWERKS__
typedef struct DVDDiskID;
typedef struct DVDDriveInfo;
typedef struct ESTicket;
@ -16,6 +17,15 @@ typedef struct ESTicketView;
typedef struct ESTitleMeta;
typedef struct OSAlarm;
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 {
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,
// DVDLowCallback callback);
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 DVDLowClosePartition(DVDLowCallback callback);
BOOL DVDLowUnencryptedRead(void* dst, u32 size, u32 offset,

View File

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

View File

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

View File

@ -5,7 +5,11 @@
extern "C" {
#endif
#ifdef __MWERKS__
u32 IPC_HW_REGS[] : 0xCD000000;
#else
u32 IPC_HW_REGS[];
#endif
inline u32 ACRReadReg(u32 reg) {
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);
s32 NANDGetStatus(const char* path, NANDStatus* status);
s32 NANDPrivateGetStatus(const char* path, NANDStatus* status);
s32 NANDPrivateGetStatusAsync(const char* path, NANDStatus* status,
NANDAsyncCallback callback,
NANDCommandBlock* block);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
#include <revolution/AX.h>
#include <revolution/OS.h>
static BOOL __init = FALSE;
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/OS.h>
#ifdef __MWERKS__
asm u32 PPCMfmsr(void) {
// clang-format off
nofralloc
@ -304,3 +306,5 @@ void PPCMthid4(register u32 val) {
// clang-format on
}
}
#endif

View File

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

View File

@ -1,6 +1,7 @@
#include <revolution/DVD.h>
#include <revolution/ESP.h>
#include <revolution/OS.h>
#include <string.h>
#define DISK_TOC_OFFSET 0x40000
#define DISK_TOC_SIZE ROUND_UP(sizeof(DVDGameToc), 32)
@ -2384,4 +2385,3 @@ void DVDGetPartitionParamsAsync(){
//unused
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);
u32 ENCiConvertUtf8To32(const u8* src, s32 size);
void ENCiConvertUtf32To16(u16* dest, s32 size, u32 val);
static u32 ENCiConvertUtf8To32(const u8* src, s32 size);
static void ENCiConvertUtf32To16(u16* dest, s32 size, u32 val);
//unused
void ENCConvertStringUnicodeToAscii(){
@ -310,4 +310,3 @@ static void ENCiConvertUtf32To16(u16* dest, s32 size, u32 val){
//unused
static void ENCiGetBase64Value(){
}

View File

@ -1,3 +1,4 @@
#include "revolution/os/OSTime.h"
#include <revolution/DVD.h>
#include <revolution/EXI.h>
#include <revolution/OS.h>
@ -247,7 +248,7 @@ static BOOL __EXIProbe(EXIChannel chan) {
}
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) {
OS_EXI_LAST_INSERT[chan] = time;
}

View File

@ -1,6 +1,5 @@
#include <revolution/GX.h>
#include <revolution/OS.h>
#include <string.h>
static GXFifoObj DisplayListFifo;
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;
// clang-format off
#ifdef __MWERKS__
asm volatile {
lwz color, src->color
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_5, 0(dst), 0, 0
}
#endif
// clang-format on
}

View File

@ -6,6 +6,7 @@ inline void LoadProjPS(register f32* dst) {
register GXData* src;
// clang-format off
#ifdef __MWERKS__
asm volatile {
lwz src, __GXData
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_2, 16(dst), 0, 0
}
#endif
// 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;
// clang-format off
#ifdef __MWERKS__
asm volatile {
psq_l ps_0, 0(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_2, 0(dst), 0, 0
}
#endif
// 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;
// clang-format off
#ifdef __MWERKS__
asm volatile {
psq_l ps_0, 0(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_2, 16(dst), 0, 0
}
#endif
// 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;
// clang-format off
#ifdef __MWERKS__
asm volatile {
psq_l ps_0, 0(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_5, 0(dst), 0, 0
}
#endif
// 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;
// clang-format off
#ifdef __MWERKS__
asm volatile {
psq_l ps_0, 0(src), 0, 0
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
stfs ps_5, 0(dst)
}
#endif
// 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;
// clang-format off
#ifdef __MWERKS__
asm volatile {
psq_l ps_0, 0(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_3, 0(dst), 0, 0
}
#endif
// clang-format on
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,6 +8,7 @@ DECL_SECTION(".dtors$00") extern funcptr_t _dtors[];
asm void __init_hardware(void) {
// clang-format off
#ifdef __MWERKS__
nofralloc
// Enable floating-point
@ -25,11 +26,13 @@ asm void __init_hardware(void) {
// Restore LR
mtlr r31
blr
#endif
// clang-format on
}
asm void __flush_cache(register void* dst, register size_t n) {
// clang-format off
#ifdef __MWERKS__
nofralloc
lis r5, 0xFFFFFFF1@h
@ -49,17 +52,20 @@ _loop:
isync
blr
#endif
// clang-format on
}
asm void __init_user(void) {
// clang-format off
#ifdef __MWERKS__
fralloc
bl __init_cpp
frfree
blr
#endif
// 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) {
// clang-format off
#ifdef __MWERKS__
nofralloc
// Setup hardware
@ -281,6 +282,7 @@ _after_init_metro_trk_bba:
mr r4, r15
bl main
b exit // <- Will halt CPU
#endif
// 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) {
// clang-format off
#ifdef __MWERKS__
nofralloc
li r0, 0
@ -345,6 +348,7 @@ DECL_SECTION(".init") static asm void __init_registers(void) {
ori r13, r13, _SDA_BASE_@l
blr
#endif
// clang-format on
}

View File

@ -2,6 +2,7 @@
#include <revolution/OS.h>
#include <revolution/USB.h>
#include <stdio.h>
#include <string.h>
#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",
"IUSB_RegisterInsertionNotifyWithIdAsync",
"%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 "monolib/Math.hpp"
#include "kyoshin/appgame/cf/object/CfObjectActor.hpp"
namespace cf {
CActorParam::CActorParam(UNKTYPE* r4, UNKTYPE* r5) : CActorState(r4),

View File

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