1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-05 23:44:53 +00:00

z_select decompiled, 1 non matching left (#202)

* First pass z_select

* lots of progress. 2 non matchings and data stuff needed

* match Select_LoadGame

* z_select almost ok, 1 func left

* remove comments

* remove comments and add description

* remove unused flg_set asm

* set_next_gamestate macro

* pr suggestions 1

* pr suggestions 2

* map -> scene

* pr suggestions 3

Co-authored-by: Kelebek1 <eeeedddccc@hotmail.co.uk>
This commit is contained in:
fig02 2020-06-13 22:59:58 -04:00 committed by GitHub
parent df3bfbc168
commit 031d946db7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 721 additions and 1675 deletions

View file

@ -50,7 +50,7 @@ void FlagSet_Update(GlobalContext* globalCtx) {
gfx = Graph_GfxPlusOne(polyOpa);
gSPDisplayList(gfxCtx->overlay.p++, gfx);
GfxPrint_Ctor(&printer);
GfxPrint_Init(&printer);
GfxPrint_Open(&printer, gfx);
GfxPrint_SetColor(&printer, 0xFA, 0x32, 0x32, 0xFF);
GfxPrint_SetPos(&printer, 4, 13);
@ -137,7 +137,7 @@ void FlagSet_Update(GlobalContext* globalCtx) {
}
gfx = GfxPrint_Close(&printer);
GfxPrint_Dtor(&printer);
GfxPrint_Destroy(&printer);
gSPEndDisplayList(gfx++);
Graph_BranchDlist(polyOpa, gfx);
gfxCtx->polyOpa.p = gfx;

View file

@ -175,11 +175,11 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
}
if (R_ENABLE_AUDIO_DBG & 1) {
GfxPrint_Ctor(&printChars);
GfxPrint_Init(&printChars);
GfxPrint_Open(&printChars, newDList);
func_800EEA50(&printChars);
newDList = GfxPrint_Close(&printChars);
GfxPrint_Dtor(&printChars);
GfxPrint_Destroy(&printChars);
}
if (R_ENABLE_ARENA_DBG < 0) {

View file

@ -341,7 +341,7 @@ GfxPrint* GfxPrint_Callback(GfxPrint* this, const char* str, size_t size) {
return this;
}
void GfxPrint_Ctor(GfxPrint* this) {
void GfxPrint_Init(GfxPrint* this) {
this->flag &= ~GFXPRINT_OPEN;
this->callback = &GfxPrint_Callback;
@ -364,7 +364,7 @@ void GfxPrint_Ctor(GfxPrint* this) {
}
}
void GfxPrint_Dtor(GfxPrint* this) {
void GfxPrint_Destroy(GfxPrint* this) {
}
void GfxPrint_Open(GfxPrint* this, Gfx* dlist) {

View file

@ -112,7 +112,7 @@ GameStateOverlay* Graph_GetNextGameState(GameState* gameState) {
if (gameStateInitFunc == TitleSetup_Init) {
return &gGameStateOverlayTable[0];
}
if (gameStateInitFunc == func_80801E44) {
if (gameStateInitFunc == Select_Init) {
return &gGameStateOverlayTable[1];
}
if (gameStateInitFunc == Title_Init) {
@ -389,7 +389,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
if (D_8012DBC0 && CHECK_PAD(gameState->input[0].press, Z_TRIG) &&
CHECK_PAD(gameState->input[0].cur, L_TRIG | R_TRIG)) {
gSaveContext.gameMode = 0;
SET_NEXT_GAMESTATE(gameState, func_80801E44, char[0x240]); // TODO : SelectContext
SET_NEXT_GAMESTATE(gameState, Select_Init, SelectContext);
gameState->running = false;
}

View file

@ -56,7 +56,6 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) {
u32 pad2[3];
Gfx* gfx;
Gfx* dispRefs[5];
Viewport viewport;
uly = this->y;
lry = this->y + 2;
@ -78,8 +77,8 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) {
View_Init(&view, gfxCtx);
view.flags = 0xA;
VIEWPORT_INIT(viewport, SCREEN_HEIGHT, SCREEN_WIDTH, 0, 0);
View_SetViewport(&view, &viewport);
SET_FULLSCREEN_VIEWPORT(&view);
gfx = gfxCtx->overlay.p;
func_800AB9EC(&view, 0xF, &gfx);
@ -123,8 +122,6 @@ void SpeedMeter_DrawAllocEntry(SpeedMeterAllocEntry* this, GraphicsContext* gfxC
View view;
Gfx* gfx;
Gfx* dispRefs[5];
Viewport viewport;
u32 pad2;
if (this->maxval == 0) {
osSyncPrintf(VT_FGCOL(RED));
@ -136,9 +133,8 @@ void SpeedMeter_DrawAllocEntry(SpeedMeterAllocEntry* this, GraphicsContext* gfxC
View_Init(&view, gfxCtx);
view.flags = 0xA;
VIEWPORT_INIT(viewport, SCREEN_HEIGHT, SCREEN_WIDTH, 0, 0);
SET_FULLSCREEN_VIEWPORT(&view);
View_SetViewport(&view, &viewport);
gfx = gfxCtx->overlay.p;
func_800AB9EC(&view, 0xF, &gfx);

View file

@ -224,7 +224,7 @@ void func_80063D7C(GraphicsContext* gfxCtx) {
Gfx* dispRefs[4]; // stores state of GfxCtx next ptrs
Graph_OpenDisps(dispRefs, gfxCtx, "../z_debug.c", 628);
GfxPrint_Ctor(&gfxPrint);
GfxPrint_Init(&gfxPrint);
sp78 = gfxCtx->polyOpa.p;
tempRet = Graph_GfxPlusOne(gfxCtx->polyOpa.p);
gSPDisplayList(gfxCtx->overlay.p++, tempRet);
@ -245,5 +245,5 @@ void func_80063D7C(GraphicsContext* gfxCtx) {
gfxCtx->polyOpa.p = sp7C;
if (0) {}
Graph_CloseDisps(dispRefs, gfxCtx, "../z_debug.c", 664);
GfxPrint_Dtor(&gfxPrint);
GfxPrint_Destroy(&gfxPrint);
}

View file

@ -59,7 +59,7 @@ void Cutscene_DrawDebugInfo(GlobalContext* globalCtx, Gfx** dlist, CutsceneConte
GfxPrint printer;
u8 pad2[8];
GfxPrint_Ctor(&printer);
GfxPrint_Init(&printer);
GfxPrint_Open(&printer, *dlist);
GfxPrint_SetPos(&printer, 22, 25);
GfxPrint_SetColor(&printer, 255, 255, 55, 32);
@ -70,7 +70,7 @@ void Cutscene_DrawDebugInfo(GlobalContext* globalCtx, Gfx** dlist, CutsceneConte
GfxPrint_SetPos(&printer, 4, 26);
GfxPrint_Printf(&printer, "%s", "SKIP=(START) or (Cursole Right)");
*dlist = GfxPrint_Close(&printer);
GfxPrint_Dtor(&printer);
GfxPrint_Destroy(&printer);
}
void func_8006450C(GlobalContext* globalCtx, CutsceneContext* csCtx) {

View file

@ -10,7 +10,7 @@
GameStateOverlay gGameStateOverlayTable[] = {
GAMESTATE_OVERLAY_INTERNAL(TitleSetup_Init, TitleSetup_Destroy, sizeof(GameState)),
GAMESTATE_OVERLAY(select, func_80801E44, func_80801E0C, 0x240), // TODO : sizeof(SelectContext)
GAMESTATE_OVERLAY(select, Select_Init, Select_Destroy, sizeof(SelectContext)),
GAMESTATE_OVERLAY(title, Title_Init, Title_Destroy, sizeof(TitleContext)),
GAMESTATE_OVERLAY_INTERNAL(Gameplay_Init, Gameplay_Destroy, sizeof(GlobalContext)),
GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)),

View file

@ -3094,14 +3094,7 @@ void func_8008A8B8(GlobalContext* globalCtx, s32 topY, s32 bottomY, s32 leftX, s
}
void func_8008A994(InterfaceContext* interfaceCtx) {
Viewport viewport;
// clang-format off
viewport.bottomY = SCREEN_HEIGHT; viewport.rightX = SCREEN_WIDTH;
viewport.topY = 0; viewport.leftX = 0;
// clang-format on
View_SetViewport(&interfaceCtx->view, &viewport);
SET_FULLSCREEN_VIEWPORT(&interfaceCtx->view);
func_800AB2C4(&interfaceCtx->view);
}

View file

@ -1135,14 +1135,12 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
if ((globalCtx->transitionMode == 3) || (globalCtx->transitionMode == 11) ||
(globalCtx->transitionCtx.transitionType >= 56)) {
View view; // 0xA0
Viewport viewport; // 0x90
View_Init(&view, gfxCtx);
view.flags = 2 | 8;
VIEWPORT_INIT(viewport, SCREEN_HEIGHT, SCREEN_WIDTH, 0, 0);
SET_FULLSCREEN_VIEWPORT(&view);
View_SetViewport(&view, &viewport);
func_800AB9EC(&view, 15, &gfxP);
globalCtx->transitionCtx.draw(&globalCtx->transitionCtx.data, &gfxP);
}

View file

@ -52,31 +52,31 @@ void Sample_Destroy(SampleContext* this) {
void Sample_SetupView(SampleContext* this) {
View* view;
GraphicsContext* gfxCtx;
Viewport viewport;
Vec3f v1;
Vec3f v2;
Vec3f v3;
view = &this->view;
gfxCtx = this->state.gfxCtx;
View_Init(view, gfxCtx);
VIEWPORT_INIT(viewport, SCREEN_HEIGHT, SCREEN_WIDTH, 0, 0);
View_SetViewport(view, &viewport);
SET_FULLSCREEN_VIEWPORT(view);
func_800AA460(view, 60, 10, 12800);
v1.x = 0;
v1.y = 0;
v2.x = 0;
v2.y = 0;
v2.z = 0;
v3.x = 0;
v3.z = 0;
v1.z = 3000;
v3.y = 1;
{
Vec3f v1;
Vec3f v2;
Vec3f v3;
func_800AA358(view, &v1, &v2, &v3);
v1.x = 0;
v1.y = 0;
v2.x = 0;
v2.y = 0;
v2.z = 0;
v3.x = 0;
v3.z = 0;
v1.z = 3000;
v3.y = 1;
func_800AA358(view, &v1, &v2, &v3);
}
}
void Sample_LoadTitleStatic(SampleContext* this) {