* func_800D2CDC_jp

* func_800D2CB4_jp

* func_800D2C10_jp

* cleanup

* Small docs of CfbInfo struct
This commit is contained in:
Derek Hensley
2025-01-03 16:51:33 -08:00
committed by GitHub
parent f319c81250
commit a9e52e5a55
6 changed files with 102 additions and 28 deletions
+75
View File
@@ -0,0 +1,75 @@
#include "cfbinfo.h"
#include "libc/stdbool.h"
#include "libc64/sleep.h"
#include "libu64/debug.h"
#include "idle.h"
#include "irqmgr.h"
#include "macros.h"
#include "viconfig.h"
#include "6FD410.h"
CfbInfo sCfbInfos[3];
CfbInfo* func_800D2C10_jp(void) {
s32 i;
CfbInfo* cfb;
s32 attempts = 0;
retry:
i = 0;
while (true) {
cfb = &sCfbInfos[i];
if (cfb->state == 0) {
break;
}
i++;
if (i == ARRAY_COUNT(sCfbInfos)) {
if (attempts++ > 10000) {
_dbg_hungup("../cfbinfo.c", 0x27);
}
usleep(100);
(void)"";
goto retry;
}
}
bzero(cfb, sizeof(CfbInfo));
cfb->state = 1;
// (reservation)
(void)"(予約)";
return cfb;
}
void func_800D2CB4_jp(CfbInfo* cfb) {
if (cfb->unk_0B != 0) {
cfb->unk_0B = 0;
B_80146080_jp = 3;
}
cfb->state = 0;
}
void func_800D2CDC_jp(CfbInfo* cfb) {
if ((ResetStatus < 2) && (cfb->swapBuffer != NULL)) {
osViSwapBuffer(cfb->swapBuffer);
cfb->unk_0A = cfb->unk_09;
cfb->state = 4;
if (cfb->viMode != NULL) {
gViConfigMode = *cfb->viMode;
gViConfigFeatures = cfb->viFeatures;
gViConfigXScale = cfb->xScale;
gViConfigYScale = cfb->yScale;
if (!gViConfigBlack) {
osViSetMode(cfb->viMode);
osViSetSpecialFeatures(cfb->viFeatures);
osViSetXScale(cfb->xScale);
osViSetYScale(cfb->yScale);
}
if (!gViConfigBlack) {}
}
} else {
func_800D2CB4_jp(cfb);
}
}
+9 -9
View File
@@ -264,23 +264,23 @@ void graph_task_set00(GraphicsContext* gfxCtx) {
scTask->msg = NULL;
{
cfbStruct* cfb = func_800D2C10_jp();
CfbInfo* cfb = func_800D2C10_jp();
cfb->unk_00 = gfxCtx->unk_2E4;
cfb->unk_04 = NULL;
cfb->swapBuffer = NULL;
cfb->unk_09 = game_GameFrame;
cfb->unk_0C = NULL;
cfb->viMode = NULL;
if (scTask->flags & OS_SC_SWAPBUFFER) {
cfb->unk_04 = gfxCtx->unk_2E4;
cfb->swapBuffer = gfxCtx->unk_2E4;
if (gfxCtx->unk_2F2 != 0) {
gfxCtx->unk_2F2 = 0;
cfb->unk_0C = gfxCtx->unk_25C;
cfb->unk_10 = gfxCtx->unk_2EC;
cfb->unk_14 = gfxCtx->unk_2FC;
cfb->unk_18 = gfxCtx->unk_300;
cfb->viMode = gfxCtx->unk_25C;
cfb->viFeatures = gfxCtx->unk_2EC;
cfb->xScale = gfxCtx->unk_2FC;
cfb->yScale = gfxCtx->unk_300;
}
if (B_80146080_jp == 1) {
B_80146084_jp = cfb->unk_04;
B_80146084_jp = cfb->swapBuffer;
cfb->unk_0B = 1;
B_80146080_jp = 2;
}