mirror of
https://github.com/zeldaret/af.git
synced 2026-10-01 23:42:04 -04:00
main OK (#234)
* main OK * gSegments -> SegmentBaseAddress * newline * format
This commit is contained in:
+13
-13
@@ -718,13 +718,13 @@ void cKF_SkeletonInfo_R_init_reverse_setspeedandmorphandmode(SkeletonInfoR* skel
|
||||
void func_80053384_jp(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, UNK_PTR* arg6, UNK_PTR* arg7,
|
||||
UNK_PTR* arg8) {
|
||||
if (arg3 != 0) {
|
||||
gSegments[arg0] = (uintptr_t)OS_K0_TO_PHYSICAL(arg6);
|
||||
SegmentBaseAddress[arg0] = (uintptr_t)OS_K0_TO_PHYSICAL(arg6);
|
||||
}
|
||||
if (arg4 != 0) {
|
||||
gSegments[arg1] = (uintptr_t)OS_K0_TO_PHYSICAL(arg7);
|
||||
SegmentBaseAddress[arg1] = (uintptr_t)OS_K0_TO_PHYSICAL(arg7);
|
||||
}
|
||||
if (arg5 != 0) {
|
||||
gSegments[arg2] = (uintptr_t)OS_K0_TO_PHYSICAL(arg8);
|
||||
SegmentBaseAddress[arg2] = (uintptr_t)OS_K0_TO_PHYSICAL(arg8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -887,14 +887,14 @@ s32 cKF_SkeletonInfo_R_combine_play(SkeletonInfoR* skeletonInfo1, SkeletonInfoR*
|
||||
joint = (!IS_ZERO(skeletonInfo1->morphCounter)) ? (s16*)skeletonInfo1->morphTable : (s16*)skeletonInfo1->jointTable;
|
||||
|
||||
if (arg4 != 0) {
|
||||
sp44 = OS_PHYSICAL_TO_K0(gSegments[arg2]);
|
||||
gSegments[arg2] = (uintptr_t)OS_K0_TO_PHYSICAL(arg4);
|
||||
sp44 = OS_PHYSICAL_TO_K0(SegmentBaseAddress[arg2]);
|
||||
SegmentBaseAddress[arg2] = (uintptr_t)OS_K0_TO_PHYSICAL(arg4);
|
||||
cKF_SkeletonInfo_R_combine_work_set(&combine3, skeletonInfo1);
|
||||
}
|
||||
|
||||
if (arg5 != 0) {
|
||||
sp40 = OS_PHYSICAL_TO_K0(gSegments[arg3]);
|
||||
gSegments[arg3] = (uintptr_t)OS_K0_TO_PHYSICAL(arg5);
|
||||
sp40 = OS_PHYSICAL_TO_K0(SegmentBaseAddress[arg3]);
|
||||
SegmentBaseAddress[arg3] = (uintptr_t)OS_K0_TO_PHYSICAL(arg5);
|
||||
cKF_SkeletonInfo_R_combine_work_set(&combine2, skeletonInfo2);
|
||||
cKF_SkeletonInfo_R_combine_work_set(&combine1, skeletonInfo2);
|
||||
}
|
||||
@@ -965,18 +965,18 @@ void cKF_SkeletonInfo_R_T_combine_play(s32* arg0, s32* arg1, s32* arg2, Skeleton
|
||||
spAC = (!IS_ZERO(skeletonInfo1->morphCounter)) ? (s16*)skeletonInfo1->morphTable : (s16*)skeletonInfo1->jointTable;
|
||||
|
||||
if (arg9 != 0) {
|
||||
sp48 = OS_PHYSICAL_TO_K0(gSegments[arg6]);
|
||||
gSegments[arg6] = (uintptr_t)OS_K0_TO_PHYSICAL(arg9);
|
||||
sp48 = OS_PHYSICAL_TO_K0(SegmentBaseAddress[arg6]);
|
||||
SegmentBaseAddress[arg6] = (uintptr_t)OS_K0_TO_PHYSICAL(arg9);
|
||||
cKF_SkeletonInfo_R_combine_work_set(&sp4C, skeletonInfo1);
|
||||
}
|
||||
if (argA != 0) {
|
||||
sp44 = OS_PHYSICAL_TO_K0(gSegments[arg7]);
|
||||
gSegments[arg7] = (uintptr_t)OS_K0_TO_PHYSICAL(argA);
|
||||
sp44 = OS_PHYSICAL_TO_K0(SegmentBaseAddress[arg7]);
|
||||
SegmentBaseAddress[arg7] = (uintptr_t)OS_K0_TO_PHYSICAL(argA);
|
||||
cKF_SkeletonInfo_R_combine_work_set(&sp6C, skeletonInfo2);
|
||||
}
|
||||
if (argB != 0) {
|
||||
sp40 = OS_PHYSICAL_TO_K0(gSegments[arg8]);
|
||||
gSegments[arg8] = (uintptr_t)OS_K0_TO_PHYSICAL(argB);
|
||||
sp40 = OS_PHYSICAL_TO_K0(SegmentBaseAddress[arg8]);
|
||||
SegmentBaseAddress[arg8] = (uintptr_t)OS_K0_TO_PHYSICAL(argB);
|
||||
cKF_SkeletonInfo_R_combine_work_set(&sp8C, skeletonInfo3);
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -192,7 +192,7 @@ void Actor_ct(Actor* actor, Game_Play* game_play) {
|
||||
Shape_Info_init(actor, 0.0f, NULL, 0.0f, 0.0f);
|
||||
|
||||
if (Actor_data_bank_dma_end_check(actor, game_play) == 1) {
|
||||
gSegments[6] = (uintptr_t)OS_K0_TO_PHYSICAL(temp_a0->status[actor->unk_026].segment);
|
||||
SegmentBaseAddress[6] = (uintptr_t)OS_K0_TO_PHYSICAL(temp_a0->status[actor->unk_026].segment);
|
||||
actor->ct(actor, game_play);
|
||||
actor->ct = NULL;
|
||||
}
|
||||
@@ -263,7 +263,7 @@ void Actor_draw(Game_Play* game_play, Actor* actor) {
|
||||
{
|
||||
void* segment = game_play->objectExchangeBank.status[(void)0, actor->unk_026].segment;
|
||||
|
||||
gSegments[6] = (uintptr_t)OS_PHYSICAL_TO_K0(segment);
|
||||
SegmentBaseAddress[6] = (uintptr_t)OS_PHYSICAL_TO_K0(segment);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, segment);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x06, segment);
|
||||
@@ -441,7 +441,7 @@ void Actor_info_call_actor(Game_Play* game_play, ActorInfo* actorInfo) {
|
||||
|
||||
if (actor->ct != NULL) {
|
||||
if (Actor_data_bank_dma_end_check(actor, game_play) == 1) {
|
||||
gSegments[6] =
|
||||
SegmentBaseAddress[6] =
|
||||
(uintptr_t)OS_K0_TO_PHYSICAL(game_play->objectExchangeBank.status[actor->unk_026].segment);
|
||||
|
||||
game_play->state.unk_9D = 0x98;
|
||||
@@ -478,7 +478,7 @@ void Actor_info_call_actor(Game_Play* game_play, ActorInfo* actorInfo) {
|
||||
|
||||
actor->flags &= ~ACTOR_FLAG_1000000;
|
||||
if ((actor->flags & (ACTOR_FLAG_40 | ACTOR_FLAG_10)) || (actor->part == ACTOR_PART_NPC)) {
|
||||
gSegments[6] =
|
||||
SegmentBaseAddress[6] =
|
||||
(uintptr_t)OS_K0_TO_PHYSICAL(game_play->objectExchangeBank.status[actor->unk_026].segment);
|
||||
game_play->state.unk_9D = 0xA1;
|
||||
actor->update(actor, game_play);
|
||||
@@ -833,9 +833,9 @@ Actor* Actor_info_make_actor(ActorInfo* actorInfo, Game_Play* game_play, s16 act
|
||||
{
|
||||
uintptr_t segmentTemp;
|
||||
|
||||
segmentTemp = gSegments[6];
|
||||
segmentTemp = SegmentBaseAddress[6];
|
||||
Actor_ct(sp68, game_play);
|
||||
gSegments[6] = segmentTemp;
|
||||
SegmentBaseAddress[6] = segmentTemp;
|
||||
}
|
||||
|
||||
return sp68;
|
||||
|
||||
+1
-1
@@ -448,7 +448,7 @@ void mSc_data_bank_ct(Game_Play* game_play, ObjectExchangeBank* objectExchangeBa
|
||||
objectExchangeBank->unk1810[0] = temp_v0;
|
||||
objectExchangeBank->unk1810[1] = temp_v0;
|
||||
func_800C5B74_jp(objectExchangeBank, GAMEPLAY_KEEP);
|
||||
gSegments[4] = (uintptr_t)OS_PHYSICAL_TO_K0(objectExchangeBank->status[0].segment);
|
||||
SegmentBaseAddress[4] = (uintptr_t)OS_PHYSICAL_TO_K0(objectExchangeBank->status[0].segment);
|
||||
}
|
||||
|
||||
void mSc_decide_exchange_bank(ObjectExchangeBank* objectExchangeBank) {
|
||||
|
||||
+112
-12
@@ -1,13 +1,36 @@
|
||||
#include "main.h"
|
||||
#include "zurumode.h"
|
||||
#include "fault.h"
|
||||
#include "code_variables.h"
|
||||
#include "macros.h"
|
||||
#include "game.h"
|
||||
#include "6FB340.h"
|
||||
#include "6FD190.h"
|
||||
#include "audioMgr.h"
|
||||
#include "graph.h"
|
||||
#include "m_debug.h"
|
||||
#include "code_variables.h"
|
||||
#include "fault.h"
|
||||
#include "game.h"
|
||||
#include "getcurrentms.h"
|
||||
#include "graph.h"
|
||||
#include "irqmgr.h"
|
||||
#include "libu64/stackcheck.h"
|
||||
#include "m_debug.h"
|
||||
#include "m_flashrom.h"
|
||||
#include "m_thread.h"
|
||||
#include "macros.h"
|
||||
#include "padmgr.h"
|
||||
#include "segment_symbols.h"
|
||||
#include "sys_initial_check.h"
|
||||
#include "sys_stacks.h"
|
||||
#include "system_heap.h"
|
||||
#include "zurumode.h"
|
||||
|
||||
OSThread graphThread;
|
||||
StackEntry graphStackInfo;
|
||||
StackEntry schedStackInfo;
|
||||
StackEntry audioStackInfo;
|
||||
StackEntry padmgrStackInfo;
|
||||
StackEntry irqmgrStackInfo;
|
||||
OSMesgQueue l_serialMsgQ;
|
||||
OSMesg serialMsgBuf[1];
|
||||
size_t gSystemHeapSize;
|
||||
|
||||
uintptr_t SegmentBaseAddress[NUM_SEGMENTS];
|
||||
|
||||
void func_800D64E0_jp(void) {
|
||||
u32 baseTime;
|
||||
@@ -35,8 +58,8 @@ void func_800D64E0_jp(void) {
|
||||
|
||||
if ((graphReg != 0) || (audioReg != 0)) {
|
||||
FaultDrawer_SetDrawerFB(osViGetCurrentFramebuffer(), SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
FaultDrawer_SetForeColor(65535);
|
||||
FaultDrawer_SetBackColor(32769);
|
||||
FaultDrawer_SetForeColor(GPACK_RGBA5551(255, 255, 255, 1));
|
||||
FaultDrawer_SetBackColor(GPACK_RGBA5551(128, 0, 0, 1));
|
||||
FaultDrawer_SetCharPad(0, 0);
|
||||
if (graphReg != 0) {
|
||||
unk9D = (game_class_p != NULL) ? game_class_p->unk_9D : 0;
|
||||
@@ -44,16 +67,93 @@ void func_800D64E0_jp(void) {
|
||||
unk9C = (game_class_p != NULL) ? game_class_p->unk_9C : 0;
|
||||
|
||||
FaultDrawer_DrawText(24, 16, "GRAPH INF.LOOP %2d %3d %3d %6lu", B_80145370_jp, unk9D, unk9C, graphTime);
|
||||
fault_DrawStackTrace(&graphThread, 0x20, 0x1A, 0xA);
|
||||
fault_DrawStackTrace(&graphThread, 32, 26, 10);
|
||||
}
|
||||
if (audioReg != 0) {
|
||||
FaultDrawer_DrawText(24, 126, "AUDIO INF.LOOP %2d %3d %6lu", audiomgr_class.unk_28A, D_80113854_jp,
|
||||
audioTime);
|
||||
fault_DrawStackTrace(&audiomgr_class.thread, 0x20, 0x88, 0xA);
|
||||
fault_DrawStackTrace(&audiomgr_class.thread, 32, 136, 10);
|
||||
}
|
||||
FaultDrawer_WritebackFBDCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/jp/nonmatchings/code/main/func_800D66D0_jp.s")
|
||||
void mainproc(void* arg) {
|
||||
IrqmgrClient client;
|
||||
OSMesgQueue irqMsgQueue;
|
||||
OSMesg irqMsgBuf[10];
|
||||
uintptr_t fb;
|
||||
uintptr_t sysHeap;
|
||||
s16* msg;
|
||||
|
||||
ScreenWidth = SCREEN_WIDTH;
|
||||
ScreenHeight = SCREEN_HEIGHT;
|
||||
|
||||
fault_Init();
|
||||
Check_RegionIsSupported();
|
||||
|
||||
fb = func_800D94F0_jp();
|
||||
sysHeap = (uintptr_t)SEGMENT_VRAM_END(buffers);
|
||||
gSystemHeapSize = fb - sysHeap;
|
||||
SystemHeap_Init((void*)sysHeap, gSystemHeapSize);
|
||||
|
||||
func_800D9524_jp();
|
||||
|
||||
func_800D955C_jp(0);
|
||||
func_800D955C_jp(1);
|
||||
func_800D955C_jp(2);
|
||||
func_800D955C_jp(3);
|
||||
|
||||
func_8008EE24_jp();
|
||||
|
||||
new_Debug_mode();
|
||||
SREG(0) = 0;
|
||||
|
||||
osCreateMesgQueue(&l_serialMsgQ, serialMsgBuf, ARRAY_COUNT(serialMsgBuf));
|
||||
osSetEventMesg(OS_EVENT_SI, &l_serialMsgQ, NULL);
|
||||
|
||||
osCreateMesgQueue(&irqMsgQueue, irqMsgBuf, ARRAY_COUNT(irqMsgBuf));
|
||||
StackCheck_Init(&irqmgrStackInfo, irqmgrStack, STACK_TOP(irqmgrStack), 0, 0x100, "irqmgr");
|
||||
CreateIRQManager(STACK_TOP(irqmgrStack), M_PRIORITY_IRQMGR, 1);
|
||||
|
||||
StackCheck_Init(&schedStackInfo, schedStack, STACK_TOP(schedStack), 0, 0x100, "sched");
|
||||
func_800D87C0_jp(STACK_TOP(schedStack), M_PRIORITY_SCHED);
|
||||
|
||||
irqmgr_AddClient(&client, &irqMsgQueue);
|
||||
|
||||
StackCheck_Init(&audioStackInfo, audioStack, STACK_TOP(audioStack), 0, 0x100, "audio");
|
||||
func_800D2AD0_jp(STACK_TOP(audioStack), M_PRIORITY_AUDIOMGR, M_THREAD_ID_AUDIOMGR);
|
||||
|
||||
StackCheck_Init(&padmgrStackInfo, padmgrStack, STACK_TOP(padmgrStack), 0, 0x100, "padmgr");
|
||||
padmgr_Init(&l_serialMsgQ, 7, M_PRIORITY_PADMGR, STACK_TOP(padmgrStack));
|
||||
|
||||
func_800D2AA0_jp();
|
||||
|
||||
StackCheck_Init(&graphStackInfo, &graphStack, STACK_TOP(graphStack), 0, 0x100, "graph");
|
||||
osCreateThread(&graphThread, M_THREAD_ID_GRAPH, graph_proc, arg, STACK_TOP(graphStack), M_PRIORITY_GRAPH);
|
||||
osStartThread(&graphThread);
|
||||
|
||||
osSetThreadPri(NULL, M_PRIORITY_MAIN_HIGH);
|
||||
|
||||
while (true) {
|
||||
msg = NULL;
|
||||
|
||||
while (irqMsgQueue.validCount != 0) {
|
||||
osRecvMesg(&irqMsgQueue, NULL, OS_MESG_NOBLOCK);
|
||||
}
|
||||
|
||||
osRecvMesg(&irqMsgQueue, (OSMesg*)&msg, OS_MESG_BLOCK);
|
||||
if (msg == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (*msg) {
|
||||
case OS_SC_RETRACE_MSG:
|
||||
if ((zurumode_flag != 0) && (fault_class.msgId == 0) && (D_8010F3E8_jp != 0)) {
|
||||
func_800D64E0_jp();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "sys_stacks.h"
|
||||
|
||||
STACK(graphStack, 0x1800);
|
||||
STACK(schedStack, 0x600);
|
||||
STACK(audioStack, 0x800);
|
||||
STACK(padmgrStack, 0x500);
|
||||
STACK(irqmgrStack, 0x500);
|
||||
Reference in New Issue
Block a user