Imported most of dolphin/os

This commit is contained in:
dbalatoni13 2024-11-12 19:16:59 +01:00
parent 023cd90675
commit 970da00ce2
35 changed files with 6591 additions and 131 deletions

View file

@ -7,19 +7,18 @@
extern "C" {
#endif
typedef int OSHeapHandle;
typedef void (*OSAllocVisitor)(void* obj, u32 size);
void* OSInitAlloc(void* arenaStart, void* arenaEnd, int maxHeaps);
OSHeapHandle OSCreateHeap(void* start, void* end);
typedef void (*OSAllocVisitor)(void *obj, u32 size);
void *OSInitAlloc(void *arenaStart, void *arenaEnd, int maxHeaps);
OSHeapHandle OSCreateHeap(void *start, void *end);
void OSDestroyHeap(OSHeapHandle heap);
void OSAddToHeap(OSHeapHandle heap, void* start, void* end);
void OSAddToHeap(OSHeapHandle heap, void *start, void *end);
OSHeapHandle OSSetCurrentHeap(OSHeapHandle heap);
void* OSAllocFromHeap(OSHeapHandle heap, u32 size);
void* OSAllocFixed(void** rstart, void** rend);
void OSFreeToHeap(OSHeapHandle heap, void* ptr);
void *OSAllocFromHeap(OSHeapHandle heap, u32 size);
void *OSAllocFixed(void **rstart, void **rend);
void OSFreeToHeap(OSHeapHandle heap, void *ptr);
long OSCheckHeap(OSHeapHandle heap);
void OSDumpHeap(OSHeapHandle heap);
void *OSAllocFixed(void **rstart, void **rend);
u32 OSReferentSize(void* ptr);
u32 OSReferentSize(void *ptr);
void OSVisitAllocated(OSAllocVisitor visitor);
extern volatile OSHeapHandle __OSCurrHeap;
#define OSAlloc(size) OSAllocFromHeap(__OSCurrHeap, (size))

View file

@ -158,10 +158,16 @@ typedef struct OSContext {
} OSContext;
u32 OSGetStackPointer(void);
void OSDumpContext(OSContext *context);
u32 OSSaveContext(OSContext* context);
void OSLoadContext(OSContext* context);
void OSClearContext(OSContext* context);
OSContext* OSGetCurrentContext();
void OSSetCurrentContext(OSContext* context);
void OSSaveFPUContext(OSContext *fpuContext);
void OSInitContext(OSContext *context, u32 pc, u32 newsp);
#ifdef __cplusplus
}

View file

@ -9,17 +9,44 @@ extern "C" {
#define OS_FONT_ENCODE_ANSI 0u
#define OS_FONT_ENCODE_SJIS 1u
#define OS_FONT_ENCODE_UTF8 3u // UTF-8 [RFC 3629]
#define OS_FONT_ENCODE_UTF16 4u // UTF-16BE [RFC 2781]
#define OS_FONT_ENCODE_UTF32 5u // UTF-32
#define OS_FONT_ENCODE_MAX 5u
#define OS_FONT_ENCODE_VOID 0xffffu
#define OS_FONT_SIZE_ANSI (288 + 131072) // 9 sheets
#define OS_FONT_SIZE_SJIS (3840 + 1179648) // 1 sheet
#define OS_FONT_ROM_SIZE_ANSI 0x03000
#define OS_FONT_ROM_SIZE_SJIS 0x4D000
#define OS_FONT_PROPORTIONAL FALSE
#define OS_FONT_FIXED TRUE
typedef struct OSFontHeader
{
/*0x00*/ u16 fontType;
u16 firstChar;
u16 lastChar;
u16 invalChar;
/*0x08*/ u16 ascent;
u16 descent;
u16 width;
u16 leading;
/*0x10*/ u16 cellWidth;
u16 cellHeight;
/*0x14*/ u32 sheetSize;
/*0x18*/ u16 sheetFormat;
u16 sheetColumn;
u16 sheetRow;
u16 sheetWidth;
/*0x20*/ u16 sheetHeight;
u16 widthTable;
u32 sheetImage;
u32 sheetFullSize;
u8 c0;
u8 c1;
u8 c2;
u8 c3;
} OSFontHeader;
u16 OSGetFontEncode(void);
u16 OSSetFontEncode(u16 encode);
BOOL OSInitFont(OSFontHeader *fontData);
u32 OSLoadFont(OSFontHeader *fontData, void *temp);
char *OSGetFontTexture(char *string, void **image, s32 *x, s32 *y, s32 *width);
char *OSGetFontWidth(char *string, s32 *width);
char *OSGetFontTexel(char *string, void *image, s32 pos, s32 stride, s32 *width);
#ifdef __cplusplus
}

20
include/dolphin/os/OSIC.h Normal file
View file

@ -0,0 +1,20 @@
#ifndef _DOLPHIN_OSIC
#define _DOLPHIN_OSIC
#ifdef __cplusplus
extern "C" {
#endif
void ICFlashInvalidate(void);
void ICEnable(void);
void ICDisable(void);
void ICFreeze(void);
void ICUnfreeze(void);
void ICBlockInvalidate(void *addr);
void ICSync(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -105,8 +105,8 @@ BOOL OSUnlink(OSModuleInfo* oldModule);
OSModuleInfo* OSSearchModule(void* ptr, u32* section, u32* offset);
// debugger notification
void OSNotifyLink(OSModuleInfo* module);
void OSNotifyUnlink(OSModuleInfo* module);
void OSNotifyLink(void);
void OSNotifyUnlink(void);
#ifdef __cplusplus
}

View file

@ -7,10 +7,42 @@
extern "C" {
#endif
#define OFFSET(addr, align) (((u32)(addr) & ((align)-1)))
// OSAudioSystem.c
void __OSInitAudioSystem(void);
void __OSStopAudioSystem(void);
// OSCache.c
void __OSCacheInit(void);
// OSContext.c
void __OSContextInit(void);
// OSMutex.c
void __OSUnlockAllMutex(struct OSThread *thread);
// OSInterrupt.c
extern void __RAS_OSDisableInterrupts_begin(void);
extern void __RAS_OSDisableInterrupts_end(void);
void __OSInterruptInit(void);
void __OSModuleInit(void);
void __OSInitSystemCall(void);
// OSThread.c
void __OSThreadInit(void);
void __OSReschedule(void);
typedef void (*OSExceptionHandler)(__OSException, OSContext*);
OSExceptionHandler __OSSetExceptionHandler(__OSException exception, OSExceptionHandler handler);
__OSExceptionHandler __OSGetExceptionHandler(__OSException exception);
OSTime __OSGetSystemTime();
OSTime __OSTimeToSystemTime(OSTime);
// OSReboot
void __OSReboot(u32 resetCode, u32 bootDol);
#ifdef __cplusplus
}
#endif