too tired but implemented os stuff.

This commit is contained in:
Prakxo
2022-12-24 20:41:04 +01:00
parent 295ba86193
commit 1753100e34
12 changed files with 72 additions and 39 deletions
+6
View File
@@ -4,3 +4,9 @@ libultra/gfxprint/gfxprint_locate8x8.c:
.text: [0x8005B210, 0x8005B238]
# libforest/ReconfigBATs.c:
# .text: [0x8007C070, 0x8005ae84]
# OS/OSEnableInterrupts.c: I'm too tired, but I did these and cba to fix atm stuff
# .text: [0x8007ac38, 0x8007ac4c]
# OS/OSRestoreInterrupts.c:
# .text: [0x8007ac4c, 0x8007ac70]
# OS/OSDisableInterrupts.c:
# .text: [0x8007ac24, 0x8007ac38]
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef _JSYSTEM_JUT_JUTASSERTION_H
#define _JSYSTEM_JUT_JUTASSERTION_H
void JC_JUTAssertion_changeDevice(u32); // I know these are C++ but these were used to match a c function so I'll fix these when I need them or fix zurumode update.
void JC_JUTAssertion_changeDevice(u32);
#endif
+4
View File
@@ -5,4 +5,8 @@
void OSReport(const char*, ...);
asm BOOL OSDisableInterrupts(void);
asm BOOL OSEnableInterrupts(void);
asm BOOL OSRestoreInterrupts(BOOL level);
#endif
+1 -1
View File
@@ -3,5 +3,5 @@
static asm void Config24MB();
static asm void Config48MB();
static asm void ReconfigBATs();
void ReconfigBATs();
#endif
+5 -6
View File
@@ -2,19 +2,18 @@
#define GFXPRINT_H
#include "types.h"
typedef struct gfxprint_obj {
s32 unk0;
struct unknown_struct * unk4;
struct unknown_struct * unk4; // This is from GBI.h, from what I've seen
s16 NewX;
s16 NewY;
u16 PrevX;
u8 PrevY;
u8 unkF;
u8 flags;
u8 R;
u8 G;
u8 B;
u8 A;
u8 B;
u8 G;
u8 A;
};
void gfxprint_locate(struct gfxprint_obj*, s32, s32);
+1 -1
View File
@@ -5,6 +5,6 @@
void bcmp (const void *v1, const void *v2, u32 size);
void bcopy(const void *dst, void *src, size_t n);
void bzero(void *ptr, size_t size);
extern s32 osAppNMIBuffer[16]; //?? It's most likely an u8 with 64 instead of s32 of 16, so the function that uses this is probably a fakematch.
extern s32 osAppNMIBuffer[15];
#endif
-3
View File
@@ -22,9 +22,6 @@ extern s32 zurumode_flag;
#define OS_APP_NMI_ZURUMODE_IDX 15
#define FALSE 0
#define TRUE 1
#define BUTTON_NONE 0x0000
#define BUTTON_CRIGHT 0x0001
+1 -2
View File
@@ -10,9 +10,8 @@ typedef struct {
extern padmgr padmgr_class;
extern void zurumode_callback(void*);
extern s32 zurumode_flag;
extern void zurumode_cleanup(void) {
extern void zurumode_cleanup(void) { // Hm, this looks like PADMGR_UNSET_RETRACE_CALLBACK macro lol
if ((padmgr_class.callback2 == &zurumode_callback) && (padmgr_class.callback2_param == &padmgr_class)) {
padmgr_class.callback2 = NULL;
padmgr_class.callback2_param = NULL;
+12
View File
@@ -0,0 +1,12 @@
#include "dolphin/os.h"
asm BOOL OSDisableInterrupts(void){
nofralloc
mfmsr r3
rlwinm r4, r3, 0, 17, 15
mtmsr r4
rlwinm r3, r3, 17, 31, 31
blr
}
+11
View File
@@ -0,0 +1,11 @@
#include "dolphin/os.h"
asm BOOL OSEnableInterrupts(void){
nofralloc
/* 8007AC38 7C6000A6 */ mfmsr r3
/* 8007AC3C 60648000 */ ori r4, r3, 0x8000
/* 8007AC40 7C800124 */ mtmsr r4
/* 8007AC44 54638FFE */ rlwinm r3, r3, 0x11, 0x1f, 0x1f
/* 8007AC48 4E800020 */ blr
}
+17
View File
@@ -0,0 +1,17 @@
#include "dolphin/os.h"
asm BOOL OSRestoreInterrupts(register BOOL level){
nofralloc
/* 8007AC4C 2C030000 */ cmpwi level, 0x0
/* 8007AC50 7C8000A6 */ mfmsr r4
/* 8007AC54 4182000C */ beq- lbl_8007ac60
/* 8007AC58 60858000 */ ori r5, r4, 0x8000
/* 8007AC5C 48000008 */ b lbl_8007ac64
lbl_8007ac60:
/* 8007AC60 5485045E */ rlwinm r5, r4, 0, 0x11, 0xf
lbl_8007ac64:
/* 8007AC64 7CA00124 */ mtmsr r5
/* 8007AC68 54838FFE */ rlwinm r3, r4, 0x11, 0x1f, 0x1f
/* 8007AC6C 4E800020 */ blr
}
+13 -25
View File
@@ -1,4 +1,5 @@
#include "libforest/batconfig.h"
#include "dolphin/os.h"
// Different to the OS ones.
// Not fully Decompiled, need ReconfigBATs func, however there's os stuff that needs to be known.
static asm void Config24MB(){
@@ -31,7 +32,7 @@ nofralloc
/* 8005AE10 4C00012C */ isync
/* 8005AE14 4E800020 */ blr
}
static void Config48MB(){
static asm void Config48MB(){
nofralloc
/* 8005AE18 7C6000A6 */ mfmsr r3
/* 8005AE1C 54630734 */ rlwinm r3, r3, 0, 0x1c, 0x1a
@@ -61,28 +62,15 @@ nofralloc
/* 8005AE7C 4C00012C */ isync
/* 8005AE80 4E800020 */ blr
}
static void ReconfigBATs(){
nofralloc
/* 8005AE84 9421FFF0 */ stwu r1, -0x10(r1)
/* 8005AE88 7C0802A6 */ mflr r0
/* 8005AE8C 90010014 */ stw r0, 0x14(r1)
/* 8005AE90 93E1000C */ stw r31, 0xc(r1)
/* 8005AE94 4801FD91 */ bl func_8007ac24
/* 8005AE98 7C7F1B78 */ mr r31, r3
/* 8005AE9C 4802105D */ bl func_8007bef8
/* 8005AEA0 3C000180 */ lis r0, 0x180
/* 8005AEA4 7C030040 */ cmplw r3, r0
/* 8005AEA8 4181000C */ bgt- lbl_8005aeb4
/* 8005AEAC 4BFFFF01 */ bl func_8005adac
/* 8005AEB0 48000008 */ b lbl_8005aeb8
lbl_8005aeb4:
/* 8005AEB4 4BFFFF65 */ bl func_8005ae18
lbl_8005aeb8:
/* 8005AEB8 7FE3FB78 */ mr r3, r31
/* 8005AEBC 4801FD91 */ bl func_8007ac4c
/* 8005AEC0 80010014 */ lwz r0, 0x14(r1)
/* 8005AEC4 83E1000C */ lwz r31, 0xc(r1)
/* 8005AEC8 7C0803A6 */ mtlr r0
/* 8005AECC 38210010 */ addi r1, r1, 0x10
/* 8005AED0 4E800020 */ blr
void ReconfigBATs(){
BOOL restore = OSDisableInterrupts();
if (OSGetSimulatedMemorySize() <= 0x1800000) {
Config24MB();
else{
Config48MB();
}
}
OSRestoreInterrupts(restore);
}