shieldD revolution OS mostly done (#2892)

* begin revolution sdk setup

* wii rvl test

* revo OS mostly done for shieldD
This commit is contained in:
TakaRikka
2025-11-30 08:59:04 +02:00
committed by GitHub
parent 3c1323cf0d
commit 139722c731
59 changed files with 18747 additions and 100 deletions
+1 -1
View File
@@ -4108,7 +4108,7 @@ revolution/os/OSPlayTime.c:
revolution/os/OSLaunch.c:
.text start:0x805C95C0 end:0x805C9810
revolution/os/__ppc_eabi_init.c:
revolution/os/__ppc_eabi_init.cpp:
.text start:0x805C9810 end:0x805C9920
revolution/exi/EXIBios.c:
+100
View File
@@ -358,6 +358,50 @@ cflags_dolphin = [
"-DSDK_REVISION=2",
]
# Revolution library flags
cflags_revolution_base = [
"-nodefaults",
"-proc gekko",
"-align powerpc",
"-enum int",
"-fp hardware",
"-Cpp_exceptions off",
'-pragma "cats off"',
'-pragma "warn_notinlined off"',
"-maxerrors 1",
"-nosyspath",
#"-char unsigned",
"-sym on",
"-inline auto",
"-ipa file",
"-i include",
f"-i build/{config.version}/include",
"-ir src/revolution",
"-i src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include",
"-i src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common_Embedded/Math/Include",
"-i src/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/Include",
"-i src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include",
"-i src/PowerPC_EABI_Support/Runtime/Inc",
"-i src/PowerPC_EABI_Support/MetroTRK",
"-i include/revolution",
f"-DVERSION={version_num}",
"-D__GEKKO__",
"-D__REVOLUTION_SDK__",
]
cflags_revolution_retail = [
*cflags_revolution_base,
"-O4,p",
"-DSDK_SEP2006",
]
cflags_revolution_debug = [
*cflags_revolution_base,
"-opt off",
"-DDEBUG=1",
"-DSDK_AUG2010",
]
# Framework flags
cflags_framework = [
*cflags_base,
@@ -426,6 +470,23 @@ def DolphinLib(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
"objects": objects,
}
def RevolutionLib(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
if config.version == "ShieldD":
return {
"lib": lib_name,
"mw_version": "Wii/1.0",
"cflags": cflags_revolution_debug,
"progress_category": "sdk",
"objects": objects,
}
else:
return {
"lib": lib_name,
"mw_version": "GC/3.0a3",
"cflags": cflags_revolution_retail,
"progress_category": "sdk",
"objects": objects,
}
# Helper function for REL script objects
def Rel(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
@@ -1391,6 +1452,45 @@ config.libs = [
Object(MatchingFor(ALL_GCN), "dolphin/gd/GDGeometry.c"),
],
),
RevolutionLib(
"os",
[
Object(MatchingFor("ShieldD"), "revolution/os/OS.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSAddress.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSAlarm.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSAlloc.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSArena.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSAudioSystem.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSCache.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSContext.c"),
Object(NonMatching, "revolution/os/OSError.c"),
Object(NonMatching, "revolution/os/OSExec.c"),
Object(NonMatching, "revolution/os/OSFatal.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSFont.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSInterrupt.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSLink.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSMessage.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSMemory.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSMutex.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSReboot.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSReset.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSRtc.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSStopwatch.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSSync.c"),
Object(NonMatching, "revolution/os/OSThread.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSTime.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSUtf.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSIpc.c"),
Object(NonMatching, "revolution/os/OSStateTM.c"),
Object(NonMatching, "revolution/os/OSPlayRecord.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSStateFlags.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSNet.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSNandbootInfo.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSPlayTime.c"),
Object(MatchingFor("ShieldD"), "revolution/os/OSLaunch.c"),
Object(MatchingFor("ShieldD"), "revolution/os/__ppc_eabi_init.cpp"),
],
),
{
"lib": "Runtime.PPCEABI.H",
"mw_version": MWVersion(config.version),
+2 -1
View File
@@ -1,7 +1,7 @@
#ifndef _REVOLUTION_PPCARCH
#define _REVOLUTION_PPCARCH
#include "dolphin/types.h"
#include "revolution/types.h"
#ifdef __cplusplus
extern "C" {
@@ -508,6 +508,7 @@ void PPCMtpmc1(u32 newPmc1);
void PPCMtpmc2(u32 newPmc1);
void PPCMtpmc3(u32 newPmc1);
void PPCMtpmc4(u32 newPmc1);
void PPCMthid4(u32);
void PPCMtmmcr0(u32 newMmcr0);
void PPCMtmmcr1(u32 newMmcr0);
void PPCMtdmaU(u32 newdmau);
+28
View File
@@ -2,6 +2,7 @@
#define _REVOLUTION_DVD_H_
#include <revolution/types.h>
#include <revolution/esp.h>
#ifdef __cplusplus
extern "C" {
@@ -136,6 +137,26 @@ typedef struct DVDDriveInfo {
/* 0x08 */ u8 padding[24];
} DVDDriveInfo;
typedef struct DVDGamePartition {
ESTicket ticket;
u32 tmdSize;
ESTitleMeta* tmd;
u32 certBlobSize;
void* certBlob;
u8* h3Hashes;
u8* encryptedArea;
} DVDGamePartition;
typedef struct DVDPartitionInfo {
DVDGamePartition* gamePartition;
u32 type;
} DVDPartitionInfo;
typedef struct DVDGameTOC {
u32 numGamePartitions;
DVDPartitionInfo* partitionInfos;
} DVDGameTOC;
// DVD
void DVDInit(void);
int DVDReadAbsAsyncPrio(DVDCommandBlock* block, void* addr, s32 length, s32 offset, DVDCBCallback callback, s32 prio);
@@ -229,6 +250,13 @@ u32 DVDLowGetCoverStatus(void);
// DVD QUEUE
void DVDDumpWaitingQueue(void);
// unsorted revo
BOOL DVDLowUnencryptedRead(void*, u32, u32, DVDLowCallback);
BOOL DVDLowClosePartition(DVDLowCallback);
BOOL DVDLowOpenPartitionWithTmdAndTicketView(const u32, const ESTicketView* const, const u32, const ESTitleMeta* const, const u32, const u8* const, DVDLowCallback);
BOOL DVDLowOpenPartition(const u32, const ESTicket* const, const u32, const u8* const, ESTitleMeta*, DVDLowCallback);
#ifdef __cplusplus
}
#endif
+138
View File
@@ -0,0 +1,138 @@
#ifndef ESP_H
#define ESP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <revolution/types.h>
#include <revolution/private/iostypes.h>
typedef u32 ESId;
typedef u32 ESContentId;
typedef u64 ESTitleId;
typedef u64 ESTicketId;
typedef u8 ESVersion;
typedef u16 ESTitleVersion;
typedef ESTitleId ESSysVersion;
typedef u32 ESTitleType;
typedef u16 ESContentType;
typedef u8 ESTmdReserved[62];
typedef u8 ESTicketReserved[48];
typedef u8 ESSysAccessMask[2];
typedef u8 ESCidxMask[64];
#pragma pack(push, 4)
typedef struct {
ESVersion version;
ESSysVersion sysVersion;
ESTitleId titleId;
ESTitleType type;
u16 groupId;
ESTmdReserved reserved;
ESTitleVersion titleVersion;
u16 numContents;
} ESTmdViewHeader;
typedef struct {
ESContentId cid;
u16 index;
ESContentType type;
u64 size;
} ESCmdView;
typedef struct {
u32 code;
u32 limit;
} ESLpEntry;
typedef struct {
ESVersion version;
ESTicketId ticketID;
ESId devID;
ESTitleId titleID;
ESSysAccessMask sysAccessMask;
u16 ticketVer;
u32 accTitleID;
u32 accTitleMask;
u8 license;
ESTicketReserved reserved;
u8 audit;
ESCidxMask cidxMask;
ESLpEntry limits[8];
} ESTicketView;
typedef struct {
ESTmdViewHeader head;
ESCmdView contents[512];
} ESTmdView;
typedef struct {
ESContentId cid;
u16 index;
ESContentType type;
u64 size;
IOSCHash hash;
} ESContentMeta;
typedef struct {
ESVersion version;
ESVersion caCrlVersion;
ESVersion signerCrlVersion;
ESSysVersion sysVersion;
ESTitleId titleId;
ESTitleType type;
u16 groupId;
ESTmdReserved reserved;
u32 accessRights;
ESTitleVersion titleVersion;
u16 numContents;
u16 bootIndex;
} ESTitleMetaHeader;
typedef struct {
IOSCSigRsa2048 sig;
ESTitleMetaHeader head;
ESContentMeta contents[512];
} ESTitleMeta;
typedef struct {
IOSCSigRsa2048 sig;
IOSCEccPublicKey serverPubKey;
ESVersion version;
ESVersion caCrlVersion;
ESVersion signerCrlVersion;
IOSCAesKey titleKey;
ESTicketId ticketId;
ESId deviceId;
ESTitleId titleId;
ESSysAccessMask sysAccessMask;
u16 ticketVersion;
u32 accessTitleId;
u32 accessTitleMask;
u8 licenseType;
ESTicketReserved reserved;
u8 audit;
ESCidxMask cidxMask;
ESLpEntry limits[8];
} ESTicket;
#pragma pack(pop)
s32 ESP_InitLib(void);
s32 ESP_CloseLib(void);
s32 ESP_LaunchTitle(u64, ESTicketView*);
s32 ESP_GetTicketViews(ESTitleId, ESTicketView*, u32*);
s32 ESP_DiGetTicketView(const void*, ESTicketView*);
s32 ESP_DiGetTmd(ESTitleMeta*, u32*);
s32 ESP_GetTmdView(ESTitleId, ESTmdView*, u32*);
s32 ESP_GetDataDir(ESTitleId, char*);
s32 ESP_GetTitleId(ESTitleId*);
s32 ESP_GetConsumption(ESTicketId, ESLpEntry*, u32*);
#ifdef __cplusplus
}
#endif
#endif // ESP_H
+8 -6
View File
@@ -8,19 +8,21 @@ volatile u16 __VIRegs[59] AT_ADDRESS(0xCC002000);
volatile u32 __PIRegs[12] AT_ADDRESS(0xCC003000);
volatile u16 __MEMRegs[64] AT_ADDRESS(0xCC004000);
volatile u16 __DSPRegs[] AT_ADDRESS(0xCC005000);
volatile u32 __DIRegs[] AT_ADDRESS(0xCC006000);
volatile u32 __DIRegs[] AT_ADDRESS(0xCD006000);
volatile u32 __SIRegs[0x100] AT_ADDRESS(0xCC006400);
volatile u32 __EXIRegs[0x40] AT_ADDRESS(0xCC006800);
volatile u32 __AIRegs[8] AT_ADDRESS(0xCC006C00);
volatile u32 __EXIRegs[0x40] AT_ADDRESS(0xCD006800);
volatile u32 __AIRegs[8] AT_ADDRESS(0xCD006C00);
volatile u32 __IPCRegs[4] AT_ADDRESS(0xCD000000);
#else
#define __VIRegs ((volatile u16 *)0xCC002000)
#define __PIRegs ((volatile u32 *)0xCC003000)
#define __MEMRegs ((volatile u16 *)0xCC004000)
#define __DSPRegs ((volatile u16 *)0xCC005000)
#define __DIRegs ((volatile u32 *)0xCC006000)
#define __DIRegs ((volatile u32 *)0xCD006000)
#define __SIRegs ((volatile u32 *)0xCC006400)
#define __EXIRegs ((volatile u32 *)0xCC006800)
#define __AIRegs ((volatile u32 *)0xCC006C00)
#define __EXIRegs ((volatile u32 *)0xCD006800)
#define __AIRegs ((volatile u32 *)0xCD006C00)
#define __IPCRegs ((volatile u32 *)0xCD000000)
#endif
// Offsets for __VIRegs
+167
View File
@@ -0,0 +1,167 @@
#ifndef _REVOLUTION_NAND_H_
#define _REVOLUTION_NAND_H_
#include <revolution/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#define NAND_RESULT_OK 0
#define NAND_RESULT_ACCESS (-1)
#define NAND_RESULT_ALLOC_FAILED (-2)
#define NAND_RESULT_BUSY (-3)
#define NAND_RESULT_CORRUPT (-4)
#define NAND_RESULT_ECC_CRIT (-5)
#define NAND_RESULT_EXISTS (-6)
#define NAND_RESULT_INVALID (-8)
#define NAND_RESULT_MAXBLOCKS (-9)
#define NAND_RESULT_MAXFD (-10)
#define NAND_RESULT_MAXFILES (-11)
#define NAND_RESULT_NOEXISTS (-12)
#define NAND_RESULT_NOTEMPTY (-13)
#define NAND_RESULT_OPENFD (-14)
#define NAND_RESULT_AUTHENTICATION (-15)
#define NAND_RESULT_MAXDEPTH (-16)
#define NAND_RESULT_UNKNOWN (-64)
#define NAND_RESULT_FATAL_ERROR (-128)
#define NAND_MAX_PATH 64
#define NAND_CHECK_HOME_INSSPACE 0x00000001
#define NAND_CHECK_HOME_INSINODE 0x00000002
#define NAND_CHECK_SYS_INSSPACE 0x00000004
#define NAND_CHECK_SYS_INSINODE 0x00000008
typedef enum {
NAND_ACCESS_NONE,
NAND_ACCESS_READ,
NAND_ACCESS_WRITE,
NAND_ACCESS_RW
} NANDAccessType;
typedef enum {
// Read/write by owner
NAND_PERM_RUSR = (NAND_ACCESS_READ << 4),
NAND_PERM_WUSR = (NAND_ACCESS_WRITE << 4),
// Read/write by group
NAND_PERM_RGRP = (NAND_ACCESS_READ << 2),
NAND_PERM_WGRP = (NAND_ACCESS_WRITE << 2),
// Read/write by other
NAND_PERM_ROTH = (NAND_ACCESS_READ << 0),
NAND_PERM_WOTH = (NAND_ACCESS_WRITE << 0),
// Read/write by all
NAND_PERM_RALL = NAND_PERM_RUSR | NAND_PERM_RGRP | NAND_PERM_ROTH,
NAND_PERM_WALL = NAND_PERM_WUSR | NAND_PERM_WGRP | NAND_PERM_WOTH,
NAND_PERM_RWALL = NAND_PERM_RALL | NAND_PERM_WALL
} NANDPermission;
typedef struct NANDFileInfo {
s32 fileDescriptor;
s32 origFd;
char origPath[NAND_MAX_PATH];
char tmpPath[NAND_MAX_PATH];
u8 accType;
u8 stage;
u8 mark;
} NANDFileInfo;
typedef struct NANDCommandBlock {
void* userData;
void* callback;
void* fileInfo;
void* bytes;
void* inodes;
void* status;
u32 ownerId;
u16 groupId;
u8 nextStage;
u32 attr;
u32 ownerAcc;
u32 groupAcc;
u32 othersAcc;
u32 num;
char absPath[NAND_MAX_PATH];
u32* length;
u32* pos;
int state;
void* copyBuf;
u32 bufLength;
u8* type;
u32 uniqNo;
u32 reqBlocks;
u32 reqInodes;
u32* answer;
u32 homeBlocks;
u32 homeInodes;
u32 userBlocks;
u32 userInodes;
u32 workBlocks;
u32 workInodes;
const char* *dir;
BOOL simpleFlag;
} NANDCommandBlock;
typedef struct NANDStatus {
u32 ownerId;
u16 groupId;
u8 attribute;
u8 permission;
} NANDStatus;
typedef struct {
u32 signature;
u32 flag;
u16 iconSpeed;
u8 reserved[22];
u16 comment[2][32];
u8 bannerTexture[192 * 64 * 2];
u8 iconTexture[8][48 * 48 * 2];
} NANDBanner;
typedef void (*NANDCallback)(s32, NANDCommandBlock*);
typedef void (*NANDAsyncCallback)(s32 result, struct NANDCommandBlock* block);
s32 NANDInit(void);
s32 NANDCreate(const char*, u8, u8);
s32 NANDPrivateCreate(const char*, u8, u8);
s32 NANDOpen(const char*, NANDFileInfo*, u8);
s32 NANDPrivateOpen(const char*, NANDFileInfo*, u8);
s32 NANDOpenAsync(const char*, NANDFileInfo*, u8, NANDCallback, NANDCommandBlock*);
s32 NANDPrivateOpenAsync(const char*, NANDFileInfo*, const u8, NANDCallback, NANDCommandBlock*);
s32 NANDClose(NANDFileInfo*);
s32 NANDCloseAsync(NANDFileInfo*, NANDCallback, NANDCommandBlock*);
s32 NANDRead(NANDFileInfo*, void*, u32);
s32 NANDReadAsync(NANDFileInfo*, void*, u32, NANDCallback, NANDCommandBlock*);
s32 NANDGetLength(NANDFileInfo*, u32*);
s32 NANDDelete(const char*);
s32 NANDMove(const char*, const char*);
s32 NANDCheck(u32, u32, u32*);
s32 NANDWrite(NANDFileInfo*, const void*, u32);
s32 NANDWriteAsync(NANDFileInfo*, const void*, u32, NANDCallback, NANDCommandBlock*);
s32 NANDSeekAsync(NANDFileInfo*, s32, s32, NANDCallback, NANDCommandBlock*);
s32 NANDPrivateGetStatus(const char*, NANDStatus*);
s32 NANDPrivateDelete(const char*);
s32 NANDPrivateCreate(const char*, u8, u8);
s32 NANDGetHomeDir(char[NAND_MAX_PATH]);
s32 NANDGetStatus(const char*, NANDStatus*);
s32 NANDSecretGetUsage(const char*, u32*, u32*);
#ifdef __cplusplus
}
#endif
#endif
+31 -11
View File
@@ -42,6 +42,10 @@ typedef u32 OSTick;
#include <revolution/os/OSSemaphore.h>
#include <revolution/os/OSUtf.h>
#include <revolution/os/OSTimer.h>
#include <revolution/os/OSPlayTime.h>
#include <revolution/os/OSStateFlags.h>
#include <revolution/os/OSIpc.h>
#include <revolution/os/OSNandbootInfo.h>
// private macro, maybe shouldn't be defined here?
#define OFFSET(addr, align) (((u32)(addr) & ((align)-1)))
@@ -96,11 +100,20 @@ void* OSGetArenaHi(void);
void* OSGetArenaLo(void);
void OSSetArenaHi(void* newHi);
void OSSetArenaLo(void* newLo);
void OSSetMEM1ArenaHi(void* newHi);
void OSSetMEM1ArenaLo(void* newLo);
void OSSetMEM2ArenaHi(void* newHi);
void OSSetMEM2ArenaLo(void* newLo);
void* OSGetMEM1ArenaLo(void);
void* OSGetMEM1ArenaHi(void);
void* OSGetMEM2ArenaLo(void);
void* OSGetMEM2ArenaHi(void);
void* OSAllocFromMEM1ArenaLo(u32 size, u32 align);
void* OSAllocFromMEM1ArenaHi(u32 size, u32 align);
u32 OSGetPhysicalMemSize(void);
void __OSPSInit(void);
void __OSFPRInit(void);
u32 __OSGetDIConfig(void);
@@ -133,6 +146,16 @@ typedef struct OSBootInfo_s {
u32 FSTMaxLength;
} OSBootInfo;
typedef struct OSIOSRev {
u8 reserved;
u8 major;
u8 minor;
u8 micro;
u8 month;
u8 date;
u16 year;
} OSIOSRev;
typedef struct OSStopwatch {
char* name;
u32 hits;
@@ -187,6 +210,8 @@ BOOL OSRestoreInterrupts(BOOL level);
u32 OSGetSoundMode(void);
void OSSetSoundMode(u32 mode);
u8 OSGetAppType(void);
__declspec(weak) void OSReport(const char* msg, ...);
__declspec(weak) void OSVReport(const char* msg, va_list list);
__declspec(weak) void OSPanic(const char* file, int line, const char* msg, ...);
@@ -243,21 +268,16 @@ void* OSUncachedToCached(void* ucaddr);
#define OSUncachedToCached(ucaddr) ((void*) ((u8*)(ucaddr) - (OS_BASE_UNCACHED - OS_BASE_CACHED)))
#endif
#define OSIsMEM1Region(addr) (((u32)(addr) & 0x30000000) == 0x00000000)
#define OSIsMEM2Region(addr) (((u32)(addr) & 0x30000000) == 0x10000000)
// unsorted externs
extern OSTime __OSGetSystemTime(void);
__declspec(weak) extern int __OSIsGcam;
extern OSExecParams __OSRebootParams;
extern OSTime __OSStartTime;
extern int __OSInIPL;
// helper for assert line numbers in different revisions
#if SDK_REVISION < 1
#define LINE(l0, l1, l2) (l0)
#elif SDK_REVISION < 2
#define LINE(l0, l1, l2) (l1)
#else
#define LINE(l0, l1, l2) (l2)
#endif
extern BOOL __OSInReboot;
#ifdef DEBUG
#define ASSERTLINE(line, cond) \
+3 -1
View File
@@ -17,10 +17,10 @@ struct OSAlarm {
OSAlarm* next;
OSTime period;
OSTime start;
void* userData;
};
BOOL OSCheckAlarmQueue(void);
void OSInitAlarm(void);
void OSCreateAlarm(OSAlarm* alarm);
void OSSetAlarm(OSAlarm* alarm, OSTime tick, OSAlarmHandler handler);
void OSSetAbsAlarm(OSAlarm* alarm, OSTime time, OSAlarmHandler handler);
@@ -28,6 +28,8 @@ void OSSetPeriodicAlarm(OSAlarm* alarm, OSTime start, OSTime period, OSAlarmHand
void OSCancelAlarm(OSAlarm *alarm);
void OSSetAlarmTag(OSAlarm* alarm, u32 tag);
void OSCancelAlarms(u32 tag);
void OSSetAlarmUserData(OSAlarm* alarm, void* userData);
void* OSGetAlarmUserData(const OSAlarm* alarm);
#ifdef __cplusplus
}
+74 -51
View File
@@ -38,61 +38,84 @@ typedef u32 OSInterruptMask;
#define __OS_INTERRUPT_PI_VI 24
#define __OS_INTERRUPT_PI_DEBUG 25
#define __OS_INTERRUPT_PI_HSP 26
#define __OS_INTERRUPT_PI_ACR 27
#define __OS_INTERRUPT_MAX 32
#define OS_INTERRUPTMASK(interrupt) (0x80000000u >> (interrupt))
#define OS_INTERRUPTMASK_MEM_0 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_0)
#define OS_INTERRUPTMASK_MEM_1 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_1)
#define OS_INTERRUPTMASK_MEM_2 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_2)
#define OS_INTERRUPTMASK_MEM_3 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_3)
#define OS_INTERRUPTMASK_MEM_ADDRESS OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_ADDRESS)
#define OS_INTERRUPTMASK_MEM_RESET \
(OS_INTERRUPTMASK_MEM_0 | OS_INTERRUPTMASK_MEM_1 | OS_INTERRUPTMASK_MEM_2 | \
OS_INTERRUPTMASK_MEM_3)
#define OS_INTERRUPTMASK_MEM \
(OS_INTERRUPTMASK_MEM_0 | OS_INTERRUPTMASK_MEM_1 | OS_INTERRUPTMASK_MEM_2 | \
OS_INTERRUPTMASK_MEM_3 | OS_INTERRUPTMASK_MEM_ADDRESS)
#define OS_INTERRUPTMASK_DSP_AI OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_AI)
#define OS_INTERRUPTMASK_DSP_ARAM OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_ARAM)
#define OS_INTERRUPTMASK_DSP_DSP OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_DSP)
#define OS_INTERRUPTMASK_DSP \
(OS_INTERRUPTMASK_DSP_AI | OS_INTERRUPTMASK_DSP_ARAM | OS_INTERRUPTMASK_DSP_DSP)
#define OS_INTERRUPTMASK_AI_AI OS_INTERRUPTMASK(__OS_INTERRUPT_AI_AI)
#define OS_INTERRUPTMASK_AI (OS_INTERRUPTMASK_AI_AI)
#define OS_INTERRUPTMASK_EXI_0_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_EXI)
#define OS_INTERRUPTMASK_EXI_0_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_TC)
#define OS_INTERRUPTMASK_EXI_0_EXT OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_EXT)
#define OS_INTERRUPTMASK_EXI_0 \
(OS_INTERRUPTMASK_EXI_0_EXI | OS_INTERRUPTMASK_EXI_0_TC | OS_INTERRUPTMASK_EXI_0_EXT)
#define OS_INTERRUPTMASK_EXI_1_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_EXI)
#define OS_INTERRUPTMASK_EXI_1_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_TC)
#define OS_INTERRUPTMASK_EXI_1_EXT OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_EXT)
#define OS_INTERRUPTMASK_EXI_1 \
(OS_INTERRUPTMASK_EXI_1_EXI | OS_INTERRUPTMASK_EXI_1_TC | OS_INTERRUPTMASK_EXI_1_EXT)
#define OS_INTERRUPTMASK_EXI_2_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_2_EXI)
#define OS_INTERRUPTMASK_EXI_2_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_2_TC)
#define OS_INTERRUPTMASK_EXI_2 (OS_INTERRUPTMASK_EXI_2_EXI | OS_INTERRUPTMASK_EXI_2_TC)
#define OS_INTERRUPTMASK_EXI \
(OS_INTERRUPTMASK_EXI_0_EXI | OS_INTERRUPTMASK_EXI_0_TC | OS_INTERRUPTMASK_EXI_0_EXT | \
OS_INTERRUPTMASK_EXI_1_EXI | OS_INTERRUPTMASK_EXI_1_TC | OS_INTERRUPTMASK_EXI_1_EXT | \
OS_INTERRUPTMASK_EXI_2_EXI | OS_INTERRUPTMASK_EXI_2_TC)
#define OS_INTERRUPTMASK_PI_PE_TOKEN OS_INTERRUPTMASK(__OS_INTERRUPT_PI_PE_TOKEN)
#define OS_INTERRUPTMASK_PI_PE_FINISH OS_INTERRUPTMASK(__OS_INTERRUPT_PI_PE_FINISH)
#define OS_INTERRUPTMASK_PI_PE (OS_INTERRUPTMASK_PI_PE_TOKEN | OS_INTERRUPTMASK_PI_PE_FINISH)
#define OS_INTERRUPTMASK_PI_CP OS_INTERRUPTMASK(__OS_INTERRUPT_PI_CP)
#define OS_INTERRUPTMASK_PI_SI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_SI)
#define OS_INTERRUPTMASK_PI_DI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_DI)
#define OS_INTERRUPTMASK_PI_RSW OS_INTERRUPTMASK(__OS_INTERRUPT_PI_RSW)
#define OS_INTERRUPTMASK_PI_ERROR OS_INTERRUPTMASK(__OS_INTERRUPT_PI_ERROR)
#define OS_INTERRUPTMASK_PI_VI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_VI)
#define OS_INTERRUPTMASK_PI_DEBUG OS_INTERRUPTMASK(__OS_INTERRUPT_PI_DEBUG)
#define OS_INTERRUPTMASK_PI_HSP OS_INTERRUPTMASK(__OS_INTERRUPT_PI_HSP)
#define OS_INTERRUPTMASK_PI \
(OS_INTERRUPTMASK_PI_CP | OS_INTERRUPTMASK_PI_SI | OS_INTERRUPTMASK_PI_DI | \
OS_INTERRUPTMASK_PI_RSW | OS_INTERRUPTMASK_PI_ERROR | OS_INTERRUPTMASK_PI_VI | \
OS_INTERRUPTMASK_PI_PE_TOKEN | OS_INTERRUPTMASK_PI_PE_FINISH | OS_INTERRUPTMASK_PI_DEBUG | \
OS_INTERRUPTMASK_PI_HSP)
#define OS_INTERRUPTMASK_MEM_0 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_0)
#define OS_INTERRUPTMASK_MEM_1 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_1)
#define OS_INTERRUPTMASK_MEM_2 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_2)
#define OS_INTERRUPTMASK_MEM_3 OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_3)
#define OS_INTERRUPTMASK_MEM_ADDRESS OS_INTERRUPTMASK(__OS_INTERRUPT_MEM_ADDRESS)
#define OS_INTERRUPTMASK_MEM_RESET (OS_INTERRUPTMASK_MEM_0 | \
OS_INTERRUPTMASK_MEM_1 | \
OS_INTERRUPTMASK_MEM_2 | \
OS_INTERRUPTMASK_MEM_3)
#define OS_INTERRUPTMASK_MEM (OS_INTERRUPTMASK_MEM_0 | \
OS_INTERRUPTMASK_MEM_1 | \
OS_INTERRUPTMASK_MEM_2 | \
OS_INTERRUPTMASK_MEM_3 | \
OS_INTERRUPTMASK_MEM_ADDRESS)
#define OS_INTERRUPTMASK_DSP_AI OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_AI)
#define OS_INTERRUPTMASK_DSP_ARAM OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_ARAM)
#define OS_INTERRUPTMASK_DSP_DSP OS_INTERRUPTMASK(__OS_INTERRUPT_DSP_DSP)
#define OS_INTERRUPTMASK_DSP (OS_INTERRUPTMASK_DSP_AI | \
OS_INTERRUPTMASK_DSP_ARAM | \
OS_INTERRUPTMASK_DSP_DSP)
#define OS_INTERRUPTMASK_AI_AI OS_INTERRUPTMASK(__OS_INTERRUPT_AI_AI)
#define OS_INTERRUPTMASK_AI (OS_INTERRUPTMASK_AI_AI)
#define OS_INTERRUPTMASK_EXI_0_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_EXI)
#define OS_INTERRUPTMASK_EXI_0_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_TC)
#define OS_INTERRUPTMASK_EXI_0_EXT OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_0_EXT)
#define OS_INTERRUPTMASK_EXI_0 (OS_INTERRUPTMASK_EXI_0_EXI | \
OS_INTERRUPTMASK_EXI_0_TC | \
OS_INTERRUPTMASK_EXI_0_EXT)
#define OS_INTERRUPTMASK_EXI_1_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_EXI)
#define OS_INTERRUPTMASK_EXI_1_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_TC)
#define OS_INTERRUPTMASK_EXI_1_EXT OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_1_EXT)
#define OS_INTERRUPTMASK_EXI_1 (OS_INTERRUPTMASK_EXI_1_EXI | \
OS_INTERRUPTMASK_EXI_1_TC | \
OS_INTERRUPTMASK_EXI_1_EXT)
#define OS_INTERRUPTMASK_EXI_2_EXI OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_2_EXI)
#define OS_INTERRUPTMASK_EXI_2_TC OS_INTERRUPTMASK(__OS_INTERRUPT_EXI_2_TC)
#define OS_INTERRUPTMASK_EXI_2 (OS_INTERRUPTMASK_EXI_2_EXI | \
OS_INTERRUPTMASK_EXI_2_TC)
#define OS_INTERRUPTMASK_EXI (OS_INTERRUPTMASK_EXI_0_EXI | \
OS_INTERRUPTMASK_EXI_0_TC | \
OS_INTERRUPTMASK_EXI_0_EXT | \
OS_INTERRUPTMASK_EXI_1_EXI | \
OS_INTERRUPTMASK_EXI_1_TC | \
OS_INTERRUPTMASK_EXI_1_EXT | \
OS_INTERRUPTMASK_EXI_2_EXI | \
OS_INTERRUPTMASK_EXI_2_TC)
#define OS_INTERRUPTMASK_PI_PE_TOKEN OS_INTERRUPTMASK(__OS_INTERRUPT_PI_PE_TOKEN)
#define OS_INTERRUPTMASK_PI_PE_FINISH OS_INTERRUPTMASK(__OS_INTERRUPT_PI_PE_FINISH)
#define OS_INTERRUPTMASK_PI_PE (OS_INTERRUPTMASK_PI_PE_TOKEN | \
OS_INTERRUPTMASK_PI_PE_FINISH)
#define OS_INTERRUPTMASK_PI_CP OS_INTERRUPTMASK(__OS_INTERRUPT_PI_CP)
#define OS_INTERRUPTMASK_PI_SI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_SI)
#define OS_INTERRUPTMASK_PI_DI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_DI)
#define OS_INTERRUPTMASK_PI_RSW OS_INTERRUPTMASK(__OS_INTERRUPT_PI_RSW)
#define OS_INTERRUPTMASK_PI_ERROR OS_INTERRUPTMASK(__OS_INTERRUPT_PI_ERROR)
#define OS_INTERRUPTMASK_PI_VI OS_INTERRUPTMASK(__OS_INTERRUPT_PI_VI)
#define OS_INTERRUPTMASK_PI_DEBUG OS_INTERRUPTMASK(__OS_INTERRUPT_PI_DEBUG)
#define OS_INTERRUPTMASK_PI_HSP OS_INTERRUPTMASK(__OS_INTERRUPT_PI_HSP)
#define OS_INTERRUPTMASK_PI_ACR OS_INTERRUPTMASK(__OS_INTERRUPT_PI_ACR)
#define OS_INTERRUPTMASK_PI (OS_INTERRUPTMASK_PI_CP | \
OS_INTERRUPTMASK_PI_SI | \
OS_INTERRUPTMASK_PI_DI | \
OS_INTERRUPTMASK_PI_RSW | \
OS_INTERRUPTMASK_PI_ERROR | \
OS_INTERRUPTMASK_PI_VI | \
OS_INTERRUPTMASK_PI_PE_TOKEN | \
OS_INTERRUPTMASK_PI_PE_FINISH | \
OS_INTERRUPTMASK_PI_DEBUG | \
OS_INTERRUPTMASK_PI_HSP | \
OS_INTERRUPTMASK_PI_ACR )
typedef void (*__OSInterruptHandler)(__OSInterrupt interrupt, OSContext* context);
+19
View File
@@ -0,0 +1,19 @@
#ifndef _REVOLUTION_OSIPC_H_
#define _REVOLUTION_OSIPC_H_
#include <revolution/types.h>
#ifdef __cplusplus
extern "C" {
#endif
void* __OSGetIPCBufferHi(void);
void* __OSGetIPCBufferLo(void);
void __OSInitIPCBuffer(void);
#ifdef __cplusplus
}
#endif
#endif // _REVOLUTION_OSIPC_H_
+4 -2
View File
@@ -18,8 +18,10 @@ extern "C" {
#define OS_PROTECT_CONTROL_RDWR (OS_PROTECT_CONTROL_READ | OS_PROTECT_CONTROL_WRITE)
void OSProtectRange(u32 chan, void* addr, u32 nBytes, u32 control);
u32 OSGetPhysicalMemSize(void);
u32 OSGetConsoleSimulatedMemSize(void);
u32 OSGetPhysicalMem1Size(void);
u32 OSGetPhysicalMem2Size(void);
u32 OSGetConsoleSimulatedMem1Size(void);
u32 OSGetConsoleSimulatedMem2Size(void);
#ifdef __cplusplus
}
+4 -4
View File
@@ -90,10 +90,10 @@ struct OSRel {
u32 addend;
};
#define R_REVOLUTION_NOP 201 // C9h current offset += OSRel.offset
#define R_REVOLUTION_SECTION 202 // CAh current section = OSRel.section
#define R_REVOLUTION_END 203 // CBh
#define R_REVOLUTION_MRKREF 204 // CCh
#define R_DOLPHIN_NOP 201 // C9h current offset += OSRel.offset
#define R_DOLPHIN_SECTION 202 // CAh current section = OSRel.section
#define R_DOLPHIN_END 203 // CBh
#define R_DOLPHIN_MRKREF 204 // CCh
void OSSetStringTable(void* stringTable);
BOOL OSLink(OSModuleInfo* newModule, void* bss);
+40
View File
@@ -0,0 +1,40 @@
#ifndef _REVOLUTION_OSNANDBOOT_H_
#define _REVOLUTION_OSNANDBOOT_H_
#include <revolution/types.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
u32 CheckSum;
u32 ArgOffset;
u8 reserved[2];
u8 LastAppType;
u8 ReturnType;
u32 ArgValue;
u8 padding[8];
u64 LastTitleId;
u8 args[0x1000];
} OSNandbootInfo;
typedef struct {
u32 CheckSum;
u32 ArgOffset;
u8 reserved[2];
u8 LastAppType;
u8 ReturnType;
u32 ArgValue;
u8 padding[8];
u64 LastTitleId;
} OSNandbootInfoHeader;
BOOL __OSCreateNandbootInfo(void);
BOOL __OSWriteNandbootInfo(OSNandbootInfo*);
#ifdef __cplusplus
}
#endif
#endif // _REVOLUTION_OSNANDBOOT_H_
+19
View File
@@ -0,0 +1,19 @@
#ifndef OSPLAYRECORD_H
#define OSPLAYRECORD_H
#include <revolution/os.h>
typedef struct {
u32 checkSum;
u16 titleName[2][21];
OSTime playStartTime;
OSTime playTime;
char gameCode[4];
char companyCode[2];
char res[18];
} OSPlayRecord;
void __OSStartPlayRecord(void);
void __OSStopPlayRecord(void);
#endif // OSPLAYRECORD_H
+25
View File
@@ -0,0 +1,25 @@
#ifndef _REVOLUTION_OSPLAYTIME_H_
#define _REVOLUTION_OSPLAYTIME_H_
#include <revolution/types.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
OSPLAYTIME_PERMANENT = 0,
OSPLAYTIME_LIMITED = 1,
OSPLAYTIME_LIMITED_LAUNCH = 4,
OSPLAYTIME_OTHER = 9
} __OSPlayTimeType;
typedef void (*OSPlayTimeCallbackFunc)(void);
BOOL OSPlayTimeIsLimited(void);
#ifdef __cplusplus
}
#endif
#endif
+15 -11
View File
@@ -11,26 +11,30 @@ extern "C" {
#define OS_RESET_HOTRESET 1
#define OS_RESET_SHUTDOWN 2
typedef struct OSResetFunctionInfo OSResetFunctionInfo;
typedef struct OSResetFunctionQueue {
OSResetFunctionInfo* head;
OSResetFunctionInfo* tail;
} OSResetFunctionQueue;
typedef struct OSShutdownFunctionInfo OSShutdownFunctionInfo;
typedef struct OSShutdownFunctionQueue {
OSShutdownFunctionInfo* head;
OSShutdownFunctionInfo* tail;
} OSShutdownFunctionQueue;
typedef BOOL (*OSResetFunction)(BOOL);
typedef BOOL (*OSResetFunction)(BOOL, u32);
struct OSResetFunctionInfo {
struct OSShutdownFunctionInfo {
OSResetFunction func;
u32 priority;
OSResetFunctionInfo* next;
OSResetFunctionInfo* prev;
OSShutdownFunctionInfo* next;
OSShutdownFunctionInfo* prev;
};
void OSRegisterResetFunction(OSResetFunctionInfo* info);
void OSUnregisterResetFunction(OSResetFunctionInfo* info);
void OSRegisterShutdownFunction(OSShutdownFunctionInfo* info);
void OSUnregisterShutdownFunction(OSShutdownFunctionInfo* info);
void OSResetSystem(int reset, u32 resetCode, BOOL forceMenu);
u32 OSGetResetCode();
u32 OSSetBootDol(u32 dolOffset);
void OSReturnToMenu(void);
#define OSIsRestart() \
((OSGetResetCode() & 0x80000000) ? TRUE : FALSE)
#ifdef __cplusplus
}
+1
View File
@@ -8,6 +8,7 @@ extern "C" {
#endif
typedef void (*OSResetCallback)(void);
typedef void (*OSPowerCallback)(void);
OSResetCallback OSSetResetCallback(OSResetCallback callback);
BOOL OSGetResetSwitchState(void);
+26
View File
@@ -0,0 +1,26 @@
#ifndef _REVOLUTION_OSSTATEFLAGS_H_
#define _REVOLUTION_OSSTATEFLAGS_H_
#include <revolution/types.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
u32 checkSum;
u8 lastBootApp;
u8 lastShutdown;
u8 lastDiscState;
u8 menuMode;
u8 reserved[24];
} OSStateFlags;
BOOL __OSWriteStateFlags(OSStateFlags*);
BOOL __OSReadStateFlags(OSStateFlags*);
#ifdef __cplusplus
}
#endif
#endif // OSSTATEFLAGS_H
+9
View File
@@ -0,0 +1,9 @@
#pragma once
#include <revolution/private/iosrestypes.h>
#include <revolution/private/iostypes.h>
#include <revolution/types.h>
typedef IOSError (*IOSIpcCb) (IOSError, void *);
s32 IOS_Read(s32, void*, u32);

Some files were not shown because too many files have changed in this diff Show More