mirror of https://github.com/zeldaret/mm.git
Misc Cleanup (#1782)
* Remove some unnecessary casts in Graph_TaskSet00 * gGfxSPTaskYieldBuffer as u64 * gGfxSPTaskStack size macro * R_THREE_DAY_CLOCK_Y_POS set to negative number * scope cfb in Graph_TaskSet00 * Graph_ThreadEntry types * func_80124618 * SysCfb_SetHiResMode
This commit is contained in:
parent
b9267f0550
commit
982ca889e2
|
@ -18,8 +18,8 @@ typedef union {
|
|||
extern BufferLow gLoBuffer;
|
||||
|
||||
|
||||
extern u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE];
|
||||
extern STACK(gGfxSPTaskStack, 0x400);
|
||||
extern u64 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE / sizeof(u64)];
|
||||
extern STACK(gGfxSPTaskStack, SP_DRAM_STACK_SIZE8);
|
||||
extern GfxPool gGfxPools[2];
|
||||
extern u8 gAudioHeap[0x138000];
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "prevent_bss_reordering.h"
|
||||
#include "buffers.h"
|
||||
|
||||
u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE] ALIGNED(16);
|
||||
u64 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE / sizeof(u64)] ALIGNED(16);
|
||||
|
||||
STACK(gGfxSPTaskStack, 0x400) ALIGNED(16);
|
||||
STACK(gGfxSPTaskStack, SP_DRAM_STACK_SIZE8) ALIGNED(16);
|
||||
|
||||
GfxPool gGfxPools[2] ALIGNED(16);
|
||||
|
|
|
@ -147,7 +147,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx, GameState* gameState) {
|
|||
OSScTask* scTask = &gfxCtx->task;
|
||||
OSTimer timer;
|
||||
OSMesg msg;
|
||||
CfbInfo* cfb;
|
||||
s32 pad;
|
||||
|
||||
retry:
|
||||
osSetTimer(&timer, OS_USEC_TO_CYCLES(3 * 1000 * 1000), 0, &gfxCtx->queue, (OSMesg)666);
|
||||
|
@ -180,13 +180,13 @@ retry:
|
|||
task->ucode_data = SysUcode_GetUCodeData();
|
||||
task->ucode_size = SP_UCODE_SIZE;
|
||||
task->ucode_data_size = SP_UCODE_DATA_SIZE;
|
||||
task->dram_stack = (u64*)gGfxSPTaskStack;
|
||||
task->dram_stack = gGfxSPTaskStack;
|
||||
task->dram_stack_size = sizeof(gGfxSPTaskStack);
|
||||
task->output_buff = gGfxSPTaskOutputBufferPtr;
|
||||
task->output_buff_size = (void*)gGfxSPTaskOutputBufferEnd;
|
||||
task->output_buff_size = gGfxSPTaskOutputBufferEnd;
|
||||
task->data_ptr = (u64*)gGfxMasterDL;
|
||||
task->data_size = 0;
|
||||
task->yield_data_ptr = (u64*)gGfxSPTaskYieldBuffer;
|
||||
task->yield_data_ptr = gGfxSPTaskYieldBuffer;
|
||||
task->yield_data_size = sizeof(gGfxSPTaskYieldBuffer);
|
||||
|
||||
scTask->next = NULL;
|
||||
|
@ -201,27 +201,28 @@ retry:
|
|||
scTask->msgQ = &gfxCtx->queue;
|
||||
scTask->msg = NULL;
|
||||
|
||||
{ s32 pad; }
|
||||
{
|
||||
CfbInfo* cfb = &sGraphCfbInfos[sCfbIndex];
|
||||
|
||||
cfb = &sGraphCfbInfos[sCfbIndex];
|
||||
sCfbIndex = (sCfbIndex + 1) % ARRAY_COUNT(sGraphCfbInfos);
|
||||
sCfbIndex = (sCfbIndex + 1) % ARRAY_COUNT(sGraphCfbInfos);
|
||||
|
||||
cfb->framebuffer = gfxCtx->curFrameBuffer;
|
||||
cfb->swapBuffer = gfxCtx->curFrameBuffer;
|
||||
cfb->framebuffer = gfxCtx->curFrameBuffer;
|
||||
cfb->swapBuffer = gfxCtx->curFrameBuffer;
|
||||
|
||||
if (gfxCtx->updateViMode) {
|
||||
gfxCtx->updateViMode = false;
|
||||
cfb->viMode = gfxCtx->viMode;
|
||||
cfb->viFeatures = gfxCtx->viConfigFeatures;
|
||||
cfb->xScale = gfxCtx->xScale;
|
||||
cfb->yScale = gfxCtx->yScale;
|
||||
} else {
|
||||
cfb->viMode = NULL;
|
||||
if (gfxCtx->updateViMode) {
|
||||
gfxCtx->updateViMode = false;
|
||||
cfb->viMode = gfxCtx->viMode;
|
||||
cfb->viFeatures = gfxCtx->viConfigFeatures;
|
||||
cfb->xScale = gfxCtx->xScale;
|
||||
cfb->yScale = gfxCtx->yScale;
|
||||
} else {
|
||||
cfb->viMode = NULL;
|
||||
}
|
||||
cfb->unk_10 = 0;
|
||||
cfb->updateRate = gameState->framerateDivisor;
|
||||
|
||||
scTask->framebuffer = cfb;
|
||||
}
|
||||
cfb->unk_10 = 0;
|
||||
cfb->updateRate = gameState->framerateDivisor;
|
||||
|
||||
scTask->framebuffer = cfb;
|
||||
|
||||
while (gfxCtx->queue.validCount != 0) {
|
||||
osRecvMesg(&gfxCtx->queue, NULL, OS_MESG_NOBLOCK);
|
||||
|
@ -341,11 +342,11 @@ void Graph_ThreadEntry(void* arg) {
|
|||
GameStateOverlay* nextOvl = &gGameStateOverlayTable[0];
|
||||
GameStateOverlay* ovl;
|
||||
GameState* gameState;
|
||||
u32 size;
|
||||
size_t size;
|
||||
s32 pad[2];
|
||||
|
||||
gZBufferLoRes = malloc(sizeof(*gZBufferLoRes) + sizeof(*gWorkBufferLoRes) + 64 - 1);
|
||||
gZBufferLoRes = (void*)ALIGN64((u32)gZBufferLoRes);
|
||||
gZBufferLoRes = (void*)ALIGN64((uintptr_t)gZBufferLoRes);
|
||||
|
||||
gWorkBufferLoRes = (void*)((u8*)gZBufferLoRes + sizeof(*gZBufferLoRes));
|
||||
|
||||
|
|
|
@ -63,27 +63,40 @@ void SysCfb_SetHiResMode(void) {
|
|||
gWorkBuffer = gWorkBufferHiRes;
|
||||
gGfxSPTaskOutputBufferPtr = *gGfxSPTaskOutputBufferHiRes;
|
||||
gGfxSPTaskOutputBufferEnd = gGfxSPTaskOutputBufferEndHiRes;
|
||||
if (1) {}
|
||||
gCfbWidth = HIRES_BUFFER_WIDTH;
|
||||
gCfbHeight = HIRES_BUFFER_HEIGHT;
|
||||
gCfbLeftAdjust = 30;
|
||||
gCfbUpperAdjust = 10;
|
||||
|
||||
if (0) {
|
||||
// Remnant of debug
|
||||
} else {
|
||||
gCfbWidth = HIRES_BUFFER_WIDTH;
|
||||
gCfbHeight = HIRES_BUFFER_HEIGHT;
|
||||
gCfbLeftAdjust = 30;
|
||||
gCfbUpperAdjust = 10;
|
||||
}
|
||||
gScreenWidth = gCfbWidth;
|
||||
gScreenHeight = gCfbHeight;
|
||||
|
||||
if ((gCfbWidth == SCREEN_WIDTH_HIRES) && (gCfbHeight == SCREEN_HEIGHT_HIRES)) {
|
||||
gActiveViMode = &osViModeNtscHpf1;
|
||||
} else {
|
||||
s32 leftAdjust;
|
||||
s32 rightAdjust;
|
||||
s32 upperAdjust;
|
||||
s32 lowerAdjust;
|
||||
|
||||
//! FAKE:
|
||||
l1:
|
||||
rightAdjust = gCfbWidth - 610;
|
||||
lowerAdjust = gCfbHeight - 470;
|
||||
ViMode_Configure(&sNotebookViMode, -1, osTvType, 0, 1, 0, 1, gCfbWidth, gCfbHeight, 30, rightAdjust, 10,
|
||||
lowerAdjust);
|
||||
if (0) {
|
||||
// Remnant of debug
|
||||
} else {
|
||||
leftAdjust = 30;
|
||||
upperAdjust = 10;
|
||||
rightAdjust = gCfbWidth - (SCREEN_WIDTH_HIRES - leftAdjust);
|
||||
lowerAdjust = gCfbHeight - (SCREEN_HEIGHT_HIRES - upperAdjust);
|
||||
}
|
||||
|
||||
ViMode_Configure(&sNotebookViMode, -1, osTvType, false, true, false, true, gCfbWidth, gCfbHeight, leftAdjust,
|
||||
rightAdjust, upperAdjust, lowerAdjust);
|
||||
gActiveViMode = &sNotebookViMode;
|
||||
}
|
||||
|
||||
gSysCfbHiResEnabled = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ void Setup_InitRegs(void) {
|
|||
R_A_BTN_Y_OFFSET = 0;
|
||||
R_MAGIC_CONSUME_TIMER_GIANTS_MASK = 80;
|
||||
|
||||
R_THREE_DAY_CLOCK_Y_POS = 64596;
|
||||
R_THREE_DAY_CLOCK_Y_POS = -940;
|
||||
R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF = 215;
|
||||
R_THREE_DAY_CLOCK_HOUR_DIGIT_CUTOFF = 218;
|
||||
|
||||
|
|
|
@ -1782,6 +1782,7 @@ void Player_UpdateBunnyEars(Player* player) {
|
|||
}
|
||||
|
||||
void func_80124618(struct_80124618 arg0[], f32 curFrame, Vec3f* arg2) {
|
||||
struct_80124618* prev;
|
||||
s32 currentFrame = curFrame;
|
||||
f32 temp_f0;
|
||||
f32 temp_f14;
|
||||
|
@ -1793,16 +1794,18 @@ void func_80124618(struct_80124618 arg0[], f32 curFrame, Vec3f* arg2) {
|
|||
arg0++;
|
||||
} while (temp_v1 < currentFrame);
|
||||
|
||||
temp_f0 = arg0[-1].unk_0;
|
||||
prev = arg0 - 1;
|
||||
|
||||
temp_f0 = prev->unk_0;
|
||||
progress = (curFrame - temp_f0) / (temp_v1 - temp_f0);
|
||||
|
||||
temp_f14 = arg0[-1].unk_2.x;
|
||||
temp_f14 = prev->unk_2.x;
|
||||
arg2->x = LERPIMP(temp_f14, arg0->unk_2.x, progress) * 0.01f;
|
||||
|
||||
temp_f14 = arg0[-1].unk_2.y;
|
||||
temp_f14 = prev->unk_2.y;
|
||||
arg2->y = LERPIMP(temp_f14, arg0->unk_2.y, progress) * 0.01f;
|
||||
|
||||
temp_f14 = arg0[-1].unk_2.z;
|
||||
temp_f14 = prev->unk_2.z;
|
||||
arg2->z = LERPIMP(temp_f14, arg0->unk_2.z, progress) * 0.01f;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue