Skip to content

Commit

Permalink
Finish mnhyaku (#1433)
Browse files Browse the repository at this point in the history
* Match 8024C9F0

* Match 8024CAC8

* Match 8024CB94

* Match 8024C68C

* Match 8024CD64

* Mark mnhyaku as matched

* Move functions into header

* Remove extern
  • Loading branch information
PsiLupan authored Aug 17, 2024
1 parent c320171 commit 5843c2c
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 704 deletions.
628 changes: 0 additions & 628 deletions asm/melee/mn/mnhyaku.s

This file was deleted.

6 changes: 3 additions & 3 deletions config/GALE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12858,9 +12858,9 @@ fn_8024C2E8 = .text:0x8024C2E8; // type:function size:0xDC
mnLanguage_8024C3C4 = .text:0x8024C3C4; // type:function size:0x1FC scope:global
mnLanguage_8024C5C0 = .text:0x8024C5C0; // type:function size:0xCC scope:global
mnHyaku_8024C68C = .text:0x8024C68C; // type:function size:0x364 scope:global
fn_8024C9F0 = .text:0x8024C9F0; // type:function size:0x60
fn_8024CA50 = .text:0x8024CA50; // type:function size:0x78
fn_8024CAC8 = .text:0x8024CAC8; // type:function size:0xCC
mnHyaku_8024C9F0 = .text:0x8024C9F0; // type:function size:0x60
mnHyaku_8024CA50 = .text:0x8024CA50; // type:function size:0x78
mnHyaku_8024CAC8 = .text:0x8024CAC8; // type:function size:0xCC
mnHyaku_8024CB94 = .text:0x8024CB94; // type:function size:0x1D0 scope:global
mnHyaku_8024CD64 = .text:0x8024CD64; // type:function size:0x110 scope:global
mnEvent_8024CE74 = .text:0x8024CE74; // type:function size:0x1A0 scope:global
Expand Down
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ def RuntimeLib(lib_name: str, objects: Objects) -> LibDict:
Object(Matching, "melee/mn/mndeflicker.c"),
Object(NonMatching, "melee/mn/mnsoundtest.c"),
Object(NonMatching, "melee/mn/mnlanguage.c"),
Object(NonMatching, "melee/mn/mnhyaku.c"),
Object(Matching, "melee/mn/mnhyaku.c"),
Object(NonMatching, "melee/mn/mnevent.c"),
Object(NonMatching, "melee/mn/mndatadel.c"),
Object(NonMatching, "melee/mn/mncount.c"),
Expand Down
2 changes: 1 addition & 1 deletion obj_files.mk
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ TEXT_O_FILES +=\
$(BUILD_DIR)/src/melee/mn/mndeflicker.c.o\
$(BUILD_DIR)/asm/melee/mn/mnsoundtest.s.o\
$(BUILD_DIR)/asm/melee/mn/mnlanguage.s.o\
$(BUILD_DIR)/asm/melee/mn/mnhyaku.s.o\
$(BUILD_DIR)/src/melee/mn/mnhyaku.c.o\
$(BUILD_DIR)/asm/melee/mn/mnevent.s.o\
$(BUILD_DIR)/asm/melee/mn/mndatadel.s.o\
$(BUILD_DIR)/asm/melee/mn/mncount.s.o\
Expand Down
144 changes: 73 additions & 71 deletions src/melee/mn/mnhyaku.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <platform.h>
#include "sc/forward.h"
#include <baselib/forward.h>

#include "mnhyaku.h"

#include "lb/lb_00F9.h"
#include "lb/lbarchive.h"
Expand All @@ -10,30 +10,11 @@
#include "mn/types.h"
#include "sc/types.h"

#include <dolphin/os.h>
#include <baselib/gobj.h>
#include <baselib/gobjgxlink.h>
#include <baselib/gobjobject.h>
#include <baselib/gobjplink.h>
#include <baselib/gobjproc.h>
#include <baselib/gobjuserdata.h>
#include <baselib/jobj.h>
#include <baselib/memory.h>
#include <baselib/sislib.h>

void mnHyaku_8024C68C(HSD_GObj*);
void mnHyaku_8024CB94(u8);
void mnHyaku_8024CD64(u8);

void fn_8024C9F0(HSD_GObj*);
void fn_8024CA50(HSD_GObj*);
void fn_8024CAC8(HSD_GObj*);

extern HSD_GObj* mnHyaku_804D6C58;
static HSD_GObj* mnHyaku_804D6C58;

void gm_801677E8(void);

void lbAudioAx_8002702C(s32, s32, s32);
void lbAudioAx_8002702C(s32, u64);
void lbAudioAx_80027168(void);
f32 lbAudioAx_80027648(void);

Expand Down Expand Up @@ -72,6 +53,8 @@ void mnHyaku_8024C68C(HSD_GObj* arg0)
{
u64 ret;
Menu* menu = GET_MENU(mnHyaku_804D6C58);
PAD_STACK(16);

if (mn_804D6BC8.x0 != 0) {
mn_804D6BC8.x0--;
mn_804D6BC8.x2 = 0;
Expand All @@ -85,7 +68,7 @@ void mnHyaku_8024C68C(HSD_GObj* arg0)
mn_80229894(9, 2, 3);
return;
}
if (ret) {
if (ret & 0x10) {
lbAudioAx_80024030(1);
mn_802295AC();
gm_801677E8();
Expand All @@ -112,115 +95,134 @@ void mnHyaku_8024C68C(HSD_GObj* arg0)
} else {
if (ret & 4) {
lbAudioAx_80024030(2);
menu->cursor = (menu->cursor == 0) ? 5 : (menu->cursor - 1);
if (menu->cursor == 0) {
menu->cursor = 5;
} else {
menu->cursor--;
}
mnHyaku_8024C68C_inline(mnHyaku_804D6C58->hsd_obj, menu->cursor);
mnHyaku_8024C68C_inline_2(mnHyaku_804D6C58);
return;
}
if (ret & 8) {
lbAudioAx_80024030(2);
menu->cursor = (menu->cursor == 5) ? 0 : (menu->cursor + 1);
if (menu->cursor == 5) {
menu->cursor = 0;
} else {
menu->cursor++;
}
mnHyaku_8024C68C_inline(mnHyaku_804D6C58->hsd_obj, menu->cursor);
mnHyaku_8024C68C_inline_2(mnHyaku_804D6C58);
}
}
}

void fn_8024C9F0(HSD_GObj* gobj)
void mnHyaku_8024C9F0(HSD_GObj* gobj)
{
f32 ret = mn_8022EC18(gobj->hsd_obj, &mnHyaku_803EF674[0], 0x80);
HSD_JObj* jobj = (HSD_JObj*) gobj->hsd_obj;
f32 ret = mn_8022EC18(jobj, &mnHyaku_803EF674[0], 0x80);
if (ret >= mnHyaku_803EF674[1]) {
HSD_GObjPLink_80390228(gobj);
}
}

void fn_8024CA50(HSD_GObj* gobj)
void mnHyaku_8024CA50(HSD_GObj* gobj)
{
HSD_GObjProc* gobj_proc;
Menu* menu = GET_MENU(gobj);
if (mn_804A04F0.x0 != 0x21) {
HSD_GObjProc_8038FE24(HSD_GObj_804D7838);
gobj_proc = HSD_GObjProc_8038FD54(gobj, fn_8024C9F0, 0U);
gobj_proc = HSD_GObjProc_8038FD54(gobj, mnHyaku_8024C9F0, 0U);
gobj_proc->flags_3 = HSD_GObj_804D783C;
HSD_SisLib_803A5CC4(menu->text);
}
}

void fn_8024CAC8(HSD_GObj* gobj)
void mnHyaku_8024CAC8(HSD_GObj* gobj)
{
{
HSD_GObjProc* gobj_proc;
Menu* menu = GET_MENU(gobj);
if (mn_804A04F0.x0 != 0x21) {
HSD_GObjProc_8038FE24(HSD_GObj_804D7838);
gobj_proc = HSD_GObjProc_8038FD54(gobj, fn_8024C9F0, 0U);
gobj_proc->flags_3 = HSD_GObj_804D783C;
HSD_SisLib_803A5CC4(menu->text);
return;
}
HSD_JObj* jobj;
HSD_GObjProc* gobj_proc;
Menu* menu;
f32 res;
PAD_STACK(12);

jobj = (HSD_JObj*) gobj->hsd_obj;
menu = GET_MENU(gobj);
if (mn_804A04F0.x0 != 0x21) {
HSD_GObjProc_8038FE24(HSD_GObj_804D7838);
gobj_proc = HSD_GObjProc_8038FD54(gobj, mnHyaku_8024C9F0, 0U);
gobj_proc->flags_3 = HSD_GObj_804D783C;
HSD_SisLib_803A5CC4(menu->text);
return;
}
if (mn_8022EC18(gobj->hsd_obj, &mnHyaku_803EF668[0], 0x80) ==
mnHyaku_803EF668[1])
{
HSD_GObjProc* gobj_proc;
res = mn_8022EC18(jobj, &mnHyaku_803EF668[0], 0x80);
if (res == mnHyaku_803EF668[1]) {
HSD_GObjProc_8038FE24(HSD_GObj_804D7838);
gobj_proc = HSD_GObjProc_8038FD54(gobj, fn_8024CA50, 0U);
gobj_proc = HSD_GObjProc_8038FD54(gobj, mnHyaku_8024CA50, 0U);
gobj_proc->flags_3 = HSD_GObj_804D783C;
}
}

inline static Menu* allocMenu(u8 arg0, HSD_GObj* gobj)
{
Menu* user_data;

user_data = HSD_MemAlloc(8);
if (user_data == NULL) {
OSReport("Can't get user_data.\n");
__assert(__FILE__, 360, "user_data");
}
user_data->cursor = arg0;
user_data->text = 0;
GObj_InitUserData(gobj, 0, HSD_Free, user_data);
return user_data;
}

void mnHyaku_8024CB94(u8 arg0)
{
HSD_GObj* gobj;
HSD_GObjProc* proc;
HSD_JObj* jobj;
u8 temp_r29;
Menu* menu;
HSD_GObjProc* temp_r3_4;

gobj = GObj_Create(HSD_GOBJ_CLASS_ITEM, 7U, 0x80);
mnHyaku_804D6C58 = gobj;
jobj = HSD_JObjLoadJoint(mnHyaku_804A08E8.joint);
temp_r29 = HSD_GObj_804D7849;
HSD_GObjObject_80390A70(gobj, temp_r29, jobj);
HSD_GObjObject_80390A70(gobj, HSD_GObj_804D7849, jobj);
GObj_SetupGXLink(gobj, HSD_GObj_80391070, 4, 0x80);
HSD_JObjAddAnimAll(jobj, mnHyaku_804A08E8.animjoint,
mnHyaku_804A08E8.matanim_joint,
mnHyaku_804A08E8.shapeanim_joint);
HSD_JObjReqAnimAll(jobj, 0.0F);
HSD_JObjAnimAll(jobj);
menu = HSD_MemAlloc(8);
if (menu == NULL) {
OSReport("Can't get menu.\n");
__assert("mnhyaku.c", 344, "menu");
}
menu->cursor = arg0;
menu->text = 0;
GObj_InitUserData(gobj, 0, HSD_Free, menu);

menu = allocMenu(arg0, gobj);
mnHyaku_8024C68C_inline(jobj, menu->cursor);
temp_r3_4 = HSD_GObjProc_8038FD54(gobj, fn_8024CAC8, 0U);
temp_r3_4->flags_3 = HSD_GObj_804D783C;
mnHyaku_8024C68C_inline_2(gobj);

proc = HSD_GObjProc_8038FD54(gobj, mnHyaku_8024CAC8, 0U);
proc->flags_3 = HSD_GObj_804D783C;

menu = gobj->user_data;
if (menu->text) {
HSD_SisLib_803A5CC4(menu->text);
}
Menu_InitCenterText(menu, vals[menu->cursor]);
}

void mnHyaku_8024CD64(u8 arg0)
{
HSD_GObjProc* temp_r3;
HSD_GObjProc* proc;
HSD_Archive* archive;
Vec3 pos;

mn_804D6BC8.x0 = 5;
mn_804A04F0.x1 = mn_804A04F0.x0;
mn_804A04F0.x0 = 0x15;
mn_804A04F0.x0 = 33;
mn_804A04F0.x2 = 0;

lbAudioAx_80026F2C(0x12);
lbAudioAx_8002702C(2, 0, 8);
lbAudioAx_8002702C(2, 8);
lbAudioAx_80027168();
pos.x = lbAudioAx_80027648();
pos.y = mnHyaku_803EF668[0];
pos.z = 0;
lbAudioAx_80027648();
archive = mn_804D6BB8;
lbArchive_LoadSections(
archive, (void**) &mnHyaku_804A08E8, "MenMainConKm_Top_joint",
Expand All @@ -229,8 +231,8 @@ void mnHyaku_8024CD64(u8 arg0)
&mnHyaku_804A08E8.shapeanim_joint, "MenMainConKm_Top_shapeanim_joint",
0);
mnHyaku_8024CB94(arg0);
temp_r3 = HSD_GObjProc_8038FD54(GObj_Create(0U, 1U, 0x80U),
mnHyaku_8024C68C, 0U);
temp_r3->flags_3 = HSD_GObj_804D783C;
proc = HSD_GObjProc_8038FD54(GObj_Create(0U, 1U, 0x80U), mnHyaku_8024C68C,
0U);
proc->flags_3 = HSD_GObj_804D783C;
lbAudioAx_800237A8(0x7530, 0x7FU, 0x40U);
}
25 changes: 25 additions & 0 deletions src/melee/mn/mnhyaku.h
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
#ifndef _MN_HYAKU_
#define _MN_HYAKU_

#include <platform.h>
#include <baselib/forward.h>

#include <dolphin/os.h>
#include <baselib/gobj.h>
#include <baselib/gobjgxlink.h>
#include <baselib/gobjobject.h>
#include <baselib/gobjplink.h>
#include <baselib/gobjproc.h>
#include <baselib/gobjuserdata.h>
#include <baselib/jobj.h>
#include <baselib/memory.h>
#include <baselib/sislib.h>

void mnHyaku_8024C68C(HSD_GObj*);
void mnHyaku_8024CB94(u8);
void mnHyaku_8024CD64(u8);

void mnHyaku_8024C9F0(HSD_GObj*);
void mnHyaku_8024CA50(HSD_GObj*);
void mnHyaku_8024CAC8(HSD_GObj*);

#endif

0 comments on commit 5843c2c

Please sign in to comment.