mirror of
https://github.com/zeldaret/mm.git
synced 2024-11-23 12:59:44 +00:00
Main OK (#329)
* Main OK, use defines where known * Couple more defines * Tharo's review * Fix lifemeter bss
This commit is contained in:
parent
96cd49b6d5
commit
5c06a6b240
@ -1547,7 +1547,7 @@ s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4);
|
||||
s32 func_800E9138(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, f32 param_5);
|
||||
s32 func_800E9250(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, Vec3f param_5);
|
||||
u8 func_800E9360(void);
|
||||
// void static_context_init(void);
|
||||
void static_context_init(void);
|
||||
// void func_800E9470(void);
|
||||
void DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX, f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha, s16 type, GraphicsContext* gfxCtx);
|
||||
void DebugDisplay_DrawObjects(GlobalContext* globalCtx);
|
||||
@ -2089,8 +2089,8 @@ void func_8010A33C(GlobalContext* globalCtx, s16 param_2);
|
||||
// void func_8010BEF0(void);
|
||||
// void func_8010BF24(void);
|
||||
s32 func_8010BF58(Actor* actor, GlobalContext* globalCtx, s32* param_3, UNK_PTR param_4, s32* param_5);
|
||||
// void Nmi_Init(void);
|
||||
// void Nmi_SetPrenmiStart(void);
|
||||
void Nmi_Init(void);
|
||||
void Nmi_SetPrenmiStart(void);
|
||||
// s32 Nmi_GetPrenmiHasStarted(void);
|
||||
// void func_8010C1B0(void);
|
||||
f32 OLib_Vec3fDist(Vec3f* a, Vec3f* b);
|
||||
@ -3267,8 +3267,8 @@ void Check_DrawI4Texture(u16* buffer, u32 x, u32 y, u32 width, u32 height, u8* t
|
||||
void Check_ClearRGBA16(s16* buffer);
|
||||
// void Check_DrawExpansionPakErrorMessage(void);
|
||||
// void Check_DrawRegionLockErrorMessage(void);
|
||||
// void Check_ExpansionPak(void);
|
||||
// void Check_RegionIsSupported(void);
|
||||
void Check_ExpansionPak(void);
|
||||
void Check_RegionIsSupported(void);
|
||||
f32 func_80179300(f32 n);
|
||||
f32 func_80179400(s32 n);
|
||||
f32 pow_int(f32 base, s32 exp);
|
||||
|
102
include/regs.h
102
include/regs.h
@ -43,57 +43,57 @@
|
||||
#define bREG(r) BASE_REG(28, r)
|
||||
|
||||
/* TODO: Actually confirm these, in case of miss-match it's at least a simple list to `sed` */
|
||||
#define R_ENABLE_ARENA_DBG SREG(0)
|
||||
#define R_RUN_SPEED_LIMIT REG(45)
|
||||
#define R_UPDATE_RATE SREG(30)
|
||||
#define R_PAUSE_MENU_MODE SREG(94)
|
||||
#define R_C_UP_ICON_X YREG(88)
|
||||
#define R_C_UP_ICON_Y YREG(89)
|
||||
#define R_MAGIC_FILL_COLOR(i) ZREG(0 + i)
|
||||
#define R_C_BTN_COLOR(i) ZREG(39 + i)
|
||||
#define R_B_BTN_COLOR(i) ZREG(43 + i)
|
||||
#define R_START_LABEL_DD(i) ZREG(48 + i)
|
||||
#define R_START_LABEL_Y(i) ZREG(51 + i)
|
||||
#define R_START_LABEL_X(i) ZREG(54 + i)
|
||||
#define R_C_UP_BTN_X ZREG(62)
|
||||
#define R_C_UP_BTN_Y ZREG(63)
|
||||
#define R_START_BTN_X ZREG(68)
|
||||
#define R_START_BTN_Y ZREG(69)
|
||||
#define R_ITEM_BTN_X(i) ZREG(70 + i)
|
||||
#define R_ITEM_BTN_Y(i) ZREG(74 + i)
|
||||
#define R_ITEM_BTN_DD(i) ZREG(78 + i)
|
||||
#define R_ITEM_ICON_X(i) ZREG(82 + i)
|
||||
#define R_ITEM_ICON_Y(i) ZREG(86 + i)
|
||||
#define R_ITEM_ICON_DD(i) ZREG(90 + i)
|
||||
#define R_A_BTN_Y XREG(16)
|
||||
#define R_A_BTN_X XREG(17)
|
||||
#define R_A_ICON_Y XREG(19)
|
||||
#define R_A_ICON_X XREG(20)
|
||||
#define R_A_BTN_COLOR(i) XREG(22 + i)
|
||||
#define R_MAGIC_BAR_SMALL_Y XREG(48)
|
||||
#define R_MAGIC_BAR_X XREG(49)
|
||||
#define R_MAGIC_BAR_LARGE_Y XREG(50)
|
||||
#define R_MAGIC_FILL_X XREG(51)
|
||||
#define R_B_LABEL_DD WREG(0)
|
||||
#define R_OW_MINIMAP_X WREG(29)
|
||||
#define R_OW_MINIMAP_Y WREG(30)
|
||||
#define R_MINIMAP_TOGGLED WREG(31)
|
||||
#define R_B_LABEL_X(i) WREG(40 + i)
|
||||
#define R_B_LABEL_Y(i) WREG(43 + i)
|
||||
#define R_DGN_MINIMAP_X WREG(68)
|
||||
#define R_DGN_MINIMAP_Y WREG(69)
|
||||
#define R_MAP_INDEX VREG(11)
|
||||
#define R_MAP_TEX_INDEX_BASE VREG(12)
|
||||
#define R_MAP_TEX_INDEX VREG(13)
|
||||
#define R_COMPASS_SCALE_X VREG(14)
|
||||
#define R_COMPASS_SCALE_Y VREG(15)
|
||||
#define R_COMPASS_OFFSET_X VREG(16)
|
||||
#define R_COMPASS_OFFSET_Y VREG(17)
|
||||
#define R_MINIMAP_COLOR(i) VREG(18 + i)
|
||||
#define R_ITEM_AMMO_X(i) VREG(64 + i)
|
||||
#define R_ITEM_AMMO_Y(i) VREG(68 + i)
|
||||
#define R_ITEM_ICON_WIDTH(i) VREG(76 + i)
|
||||
#define R_ITEM_BTN_WIDTH(i) VREG(80 + i)
|
||||
#define R_ENABLE_ARENA_DBG SREG(0) // Same as OoT
|
||||
#define R_RUN_SPEED_LIMIT REG(45)
|
||||
#define R_UPDATE_RATE SREG(30)
|
||||
#define R_PAUSE_MENU_MODE SREG(94)
|
||||
#define R_C_UP_ICON_X YREG(88)
|
||||
#define R_C_UP_ICON_Y YREG(89)
|
||||
#define R_MAGIC_FILL_COLOR(i) ZREG(0 + i)
|
||||
#define R_C_BTN_COLOR(i) ZREG(39 + i)
|
||||
#define R_B_BTN_COLOR(i) ZREG(43 + i)
|
||||
#define R_START_LABEL_DD(i) ZREG(48 + i)
|
||||
#define R_START_LABEL_Y(i) ZREG(51 + i)
|
||||
#define R_START_LABEL_X(i) ZREG(54 + i)
|
||||
#define R_C_UP_BTN_X ZREG(62)
|
||||
#define R_C_UP_BTN_Y ZREG(63)
|
||||
#define R_START_BTN_X ZREG(68)
|
||||
#define R_START_BTN_Y ZREG(69)
|
||||
#define R_ITEM_BTN_X(i) ZREG(70 + i)
|
||||
#define R_ITEM_BTN_Y(i) ZREG(74 + i)
|
||||
#define R_ITEM_BTN_DD(i) ZREG(78 + i)
|
||||
#define R_ITEM_ICON_X(i) ZREG(82 + i)
|
||||
#define R_ITEM_ICON_Y(i) ZREG(86 + i)
|
||||
#define R_ITEM_ICON_DD(i) ZREG(90 + i)
|
||||
#define R_A_BTN_Y XREG(16)
|
||||
#define R_A_BTN_X XREG(17)
|
||||
#define R_A_ICON_Y XREG(19)
|
||||
#define R_A_ICON_X XREG(20)
|
||||
#define R_A_BTN_COLOR(i) XREG(22 + i)
|
||||
#define R_MAGIC_BAR_SMALL_Y XREG(48)
|
||||
#define R_MAGIC_BAR_X XREG(49)
|
||||
#define R_MAGIC_BAR_LARGE_Y XREG(50)
|
||||
#define R_MAGIC_FILL_X XREG(51)
|
||||
#define R_B_LABEL_DD WREG(0)
|
||||
#define R_OW_MINIMAP_X WREG(29)
|
||||
#define R_OW_MINIMAP_Y WREG(30)
|
||||
#define R_MINIMAP_TOGGLED WREG(31)
|
||||
#define R_B_LABEL_X(i) WREG(40 + i)
|
||||
#define R_B_LABEL_Y(i) WREG(43 + i)
|
||||
#define R_DGN_MINIMAP_X WREG(68)
|
||||
#define R_DGN_MINIMAP_Y WREG(69)
|
||||
#define R_MAP_INDEX VREG(11)
|
||||
#define R_MAP_TEX_INDEX_BASE VREG(12)
|
||||
#define R_MAP_TEX_INDEX VREG(13)
|
||||
#define R_COMPASS_SCALE_X VREG(14)
|
||||
#define R_COMPASS_SCALE_Y VREG(15)
|
||||
#define R_COMPASS_OFFSET_X VREG(16)
|
||||
#define R_COMPASS_OFFSET_Y VREG(17)
|
||||
#define R_MINIMAP_COLOR(i) VREG(18 + i)
|
||||
#define R_ITEM_AMMO_X(i) VREG(64 + i)
|
||||
#define R_ITEM_AMMO_Y(i) VREG(68 + i)
|
||||
#define R_ITEM_ICON_WIDTH(i) VREG(76 + i)
|
||||
#define R_ITEM_BTN_WIDTH(i) VREG(80 + i)
|
||||
|
||||
#define R_FB_FILTER_TYPE SREG(80)
|
||||
#define R_FB_FILTER_PRIM_COLOR(c) SREG(81 + c)
|
||||
|
@ -288,7 +288,7 @@ extern char gBuildMakeOption[];
|
||||
// extern u8 sIdleThreadStack[0x400];
|
||||
// extern StackEntry sIdleThreadInfo;
|
||||
// extern u8 sBootThreadStack[0x400];
|
||||
// extern IrqMgr gIrqMgr;
|
||||
extern IrqMgr gIrqMgr;
|
||||
// extern u8 sIrqMgrStack[0x500];
|
||||
// extern StackEntry sIrqMgrStackInfo;
|
||||
// extern OSThread gMainThread;
|
||||
@ -1665,7 +1665,7 @@ extern u32 D_801D1510;
|
||||
extern u32 D_801D1514[3];
|
||||
extern s32 gScreenWidth;
|
||||
extern s32 gScreenHeight;
|
||||
// extern UNK_TYPE4 startHeapSize;
|
||||
extern u32 startHeapSize;
|
||||
extern PadMgr* padmgrContext;
|
||||
// extern UNK_TYPE4 controllerInputsCaptured;
|
||||
// extern UNK_TYPE4 D_801D1538;
|
||||
|
@ -46,16 +46,20 @@
|
||||
#define Z_THREAD_ID_IDLE 1
|
||||
#define Z_THREAD_ID_SLOWLY 2
|
||||
#define Z_THREAD_ID_MAIN 3
|
||||
#define Z_THREAD_ID_GRAPH 4
|
||||
#define Z_THREAD_ID_SCHED 5
|
||||
#define Z_THREAD_ID_DMAMGR 18
|
||||
#define Z_THREAD_ID_IRQMGR 19
|
||||
|
||||
#define Z_PRIORITY_SLOWLY 5
|
||||
#define Z_PRIORITY_GRAPH 9
|
||||
#define Z_PRIORITY_IDLE 12
|
||||
#define Z_PRIORITY_MAIN 12
|
||||
#define Z_PRIORITY_DMAMGR 17
|
||||
#define Z_PRIORITY_IRQMGR 18
|
||||
#define Z_PRIORITY_SLOWLY 5
|
||||
#define Z_PRIORITY_GRAPH 9
|
||||
#define Z_PRIORITY_AUDIOMGR 11
|
||||
#define Z_PRIORITY_IDLE 12
|
||||
#define Z_PRIORITY_MAIN 12
|
||||
#define Z_PRIORITY_PADMGR 15
|
||||
#define Z_PRIORITY_SCHED 16
|
||||
#define Z_PRIORITY_DMAMGR 17
|
||||
#define Z_PRIORITY_IRQMGR 18
|
||||
|
||||
#define EQUIP_SLOT_B 0
|
||||
#define EQUIP_SLOT_C_LEFT 1
|
||||
|
@ -1,3 +1,72 @@
|
||||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/main/Main.s")
|
||||
void Main(void* arg) {
|
||||
intptr_t fb;
|
||||
intptr_t sysHeap;
|
||||
s32 exit;
|
||||
s16* msg;
|
||||
|
||||
gScreenWidth = SCREEN_WIDTH;
|
||||
gScreenHeight = SCREEN_HEIGHT;
|
||||
|
||||
Nmi_Init();
|
||||
Fault_Start();
|
||||
Check_RegionIsSupported();
|
||||
Check_ExpansionPak();
|
||||
|
||||
sysHeap = gSystemHeap;
|
||||
fb = 0x80780000;
|
||||
startHeapSize = fb - sysHeap;
|
||||
SystemArena_Init(sysHeap, startHeapSize);
|
||||
|
||||
static_context_init();
|
||||
|
||||
R_ENABLE_ARENA_DBG = 0;
|
||||
|
||||
osCreateMesgQueue(&siEventCallbackQueue, siEventCallbackBuffer, ARRAY_COUNT(siEventCallbackBuffer));
|
||||
osSetEventMesg(OS_EVENT_SI, &siEventCallbackQueue, NULL);
|
||||
|
||||
osCreateMesgQueue(&mainIrqmgrCallbackQueue, mainIrqCallbackBuffer, ARRAY_COUNT(mainIrqCallbackBuffer));
|
||||
|
||||
StackCheck_Init(&schedStackEntry, schedStack, schedStack + sizeof(schedStack), 0, 0x100, "sched");
|
||||
Sched_Init(&schedContext, schedStack + sizeof(schedStack), Z_PRIORITY_SCHED, D_8009B290, 1, &gIrqMgr);
|
||||
|
||||
CIC6105_AddRomInfoFaultPage();
|
||||
|
||||
IrqMgr_AddClient(&gIrqMgr, &mainIrqmgrCallbackNode, &mainIrqmgrCallbackQueue);
|
||||
|
||||
StackCheck_Init(&audioStackEntry, audioStack, audioStack + sizeof(audioStack), 0, 0x100, "audio");
|
||||
AudioMgr_Init(&audioContext, audioStack + sizeof(audioStack), Z_PRIORITY_AUDIOMGR, 0xA, &schedContext, &gIrqMgr);
|
||||
|
||||
StackCheck_Init(&padmgrStackEntry, padmgrStack, padmgrStack + sizeof(padmgrStack), 0, 0x100, "padmgr");
|
||||
Padmgr_Start(&siEventCallbackQueue, &gIrqMgr, 7, Z_PRIORITY_PADMGR, padmgrStack + sizeof(padmgrStack));
|
||||
|
||||
AudioMgr_Unlock(&audioContext);
|
||||
|
||||
StackCheck_Init(&graphStackEntry, graphStack, graphStack + sizeof(graphStack), 0, 0x100, "graph");
|
||||
osCreateThread(&graphOSThread, Z_THREAD_ID_GRAPH, Graph_ThreadEntry, arg, graphStack + sizeof(graphStack),
|
||||
Z_PRIORITY_GRAPH);
|
||||
osStartThread(&graphOSThread);
|
||||
|
||||
exit = false;
|
||||
|
||||
while (!exit) {
|
||||
msg = NULL;
|
||||
osRecvMesg(&mainIrqmgrCallbackQueue, (OSMesg)&msg, OS_MESG_BLOCK);
|
||||
if (msg == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (*msg) {
|
||||
case OS_SC_PRE_NMI_MSG:
|
||||
Nmi_SetPrenmiStart();
|
||||
break;
|
||||
case OS_SC_NMI_MSG:
|
||||
exit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
IrqMgr_RemoveClient(&gIrqMgr, &mainIrqmgrCallbackNode);
|
||||
osDestroyThread(&graphOSThread);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "prevent_bss_reordering.h"
|
||||
|
||||
static s16 sHeartsPrimColors[3][3] = { { 255, 70, 50 }, { 255, 190, 0 }, { 100, 100, 255 } };
|
||||
static s16 sHeartsEnvColors[3][3] = { { 50, 40, 60 }, { 255, 0, 0 }, { 0, 0, 255 } };
|
||||
|
Loading…
Reference in New Issue
Block a user