more asset preparation

This commit is contained in:
Prakxo
2023-03-14 08:36:15 +00:00
parent b3050638b2
commit bcebb21d48
14 changed files with 174 additions and 11 deletions
+1
View File
@@ -1,6 +1,7 @@
#include "dolphin/os/OSAlarm.h"
#include "dolphin/os/OSTime.h"
#include "dolphin/os/OSContext.h"
#include "dolphin/os/OSInterrupt.h"
static void DecrementerExceptionHandler(u8, OSContext*);
+2
View File
@@ -1,5 +1,7 @@
#include "dolphin/os/OSContext.h"
#include "dolphin/os/OSError.h"
#include "dolphin/os/OSInterrupt.h"
static asm void __OSLoadFPUContext(int unused, register OSContext* ctx){
nofralloc
lhz r5, ctx->state
+1 -1
View File
@@ -1,4 +1,4 @@
#include "dolphin/os/os.h"
#include "dolphin/os/OSInterrupt.h"
asm BOOL OSDisableInterrupts(void){
nofralloc
+88
View File
@@ -0,0 +1,88 @@
#include "libforest/osreport.h"
#include "dolphin/os/OSInterrupt.h"
#include "dolphin/os/OSThread.h"
#include "dolphin/os/OSRtc.h"
#include "dolphin/os/OSMutex.h"
#include "MSL_C/printf.h"
OSMutex print_mutex;
u8 print_mutex_initialized;
static void* __OSReport_MonopolyThread;
static s32 __OSReport_disable;
void OSReportDisable (void){
__OSReport_disable = 1;
}
void OSReportEnable (void){
__OSReport_disable = 0;
}
void OSVReport(const char* fmt, va_list list){
OSThread* cur_thread;
u32 enable;
if(__OSReport_disable == 0){
cur_thread = OSGetCurrentThread();
if((cur_thread != NULL) && (cur_thread->state !=2)) {
cur_thread = NULL;
}
if((__OSReport_MonopolyThread == NULL) || (__OSReport_MonopolyThread == cur_thread)){
enable = OSDisableInterrupts();
if(print_mutex_initialized == 0){
OSInitMutex(&print_mutex);
print_mutex_initialized = 1;
printf("*** OSVReport - OSInitMutex ***");
}
OSRestoreInterrupts(enable);
if(cur_thread != NULL){
OSLockMutex(&print_mutex);
}
vprintf(fmt, list);
if(cur_thread != NULL){
OSUnlockMutex(&print_mutex);
}
}
}
}
void OSReport(const char* fmt,...){
va_list list;
va_start(list, fmt);
OSVReport(fmt, list);
va_end(list);
}
void OSPanic(const char* file, u32 line, const char* fmt, ...){
va_list list;
u32 enable;
OSThread* thread;
enable = OSDisableInterrupts();
va_start(list, fmt);
vprintf(fmt, list);
va_end(list);
printf(" in \"%s\" on line %d.\n", file, line);
thread = OSGetCurrentThread();
OSSetThreadPriority(thread, 0x1f);
OSRestoreInterrupts(enable);
*(int*)0 = 0; //why lol
}
void OSChangeBootMode(u32 mode){
__OSSetBootMode(mode ? 0x80 : 0);
while(__OSSyncSram() == 0) { }
}
void OSDVDFatalError(void){
OSReport("OSDVDFatalError called.\nExitThread.\n");
OSExitThread(0);
}
+8
View File
@@ -0,0 +1,8 @@
#include "types.h"
u8 __Creator__[]{
#include "assets/__Creator__bin.inc"
}
u8 __DateTime__[]{
#include "assets/__DateTime__.bin.inc"
}