Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some mn work #1487

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/GALE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ lb_8000CE30 = .text:0x8000CE30; // type:function size:0x10 scope:global
lb_8000CE40 = .text:0x8000CE40; // type:function size:0x10 scope:global
expf = .text:0x8000CE50; // type:function size:0x90 scope:global
powf = .text:0x8000CEE0; // type:function size:0x94 scope:global
lb_8000CF74 = .text:0x8000CF74; // type:function size:0x94 scope:global
powi = .text:0x8000CF74; // type:function size:0x94 scope:global
lb_8000D008 = .text:0x8000D008; // type:function size:0x140 scope:global
lb_8000D148 = .text:0x8000D148; // type:function size:0x1A4 scope:global
lbVector_Normalize = .text:0x8000D2EC; // type:function size:0xC4 scope:global
Expand Down
125 changes: 114 additions & 11 deletions src/melee/gm/gm_1A36.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#include <placeholder.h>

#include "gm_1A36.static.h"
#include "gm/gm_1A36.static.h"

#include "gmmain_lib.h"

#include "db/db_2253.h"
#include "gm/types.h"
#include "lb/lb_00B0.h"
#include "lb/lbaudio_ax.h"
#include "lb/lbcardgame.h"
Expand All @@ -21,21 +22,123 @@
#include <baselib/devcom.h>
#include <baselib/video.h>

/// #gm_801A3680
u64 gm_801A3680(u8 idx)
{
return gm_80479C30[(u8) idx].button;
}

/// #gm_801A36A0
u64 gm_801A36A0(u8 idx)
{
return gm_80479C30[(u8) idx].trigger;
}

/// #gm_801A36C0
u64 gm_801A36C0(u8 idx)
{
return gm_80479C30[(u8) idx].unk;
}

/// #gm_801A36E0
void gm_801A36E0(s32 idx, s32 arg1)
{
if (idx == 4) {
gm_80479C30[0].x28 = arg1;
gm_80479C30[1].x28 = arg1;
gm_80479C30[2].x28 = arg1;
gm_80479C30[3].x28 = arg1;
return;
}
gm_80479C30[idx].x28 = arg1;
}

/// #gm_801A3714
void gm_801A3714(s32 idx, u64 arg1, u64 arg2)
{
if (arg1 & gm_80479C30[idx].button) {
gm_80479C30[idx].button |= arg2;
}
if (arg1 & gm_80479C30[idx].repeat) {
gm_80479C30[idx].repeat |= arg2;
}
if (arg1 & gm_80479C30[idx].trigger) {
gm_80479C30[idx].trigger |= arg2;
}
if (arg1 & gm_80479C30[idx].release) {
gm_80479C30[idx].release |= arg2;
}
}

/// #gm_801A3820
void gm_801A3820(s32 idx, u64 arg1, u64 arg2)
{
u64 val;
if (arg1 == (arg1 & gm_80479C30[idx].button)) {
gm_80479C30[idx].button |= arg2;
}
if (arg1 == (arg1 & gm_80479C30[idx].repeat)) {
gm_80479C30[idx].repeat |= arg2;
}
if (arg1 == (arg1 & gm_80479C30[idx].button)) {
if (arg1 & gm_80479C30[idx].trigger) {
gm_80479C30[idx].trigger |= arg2;
}
}
if (arg1 == (arg1 & gm_80479C30[idx].button)) {
if (arg1 & gm_80479C30[idx].release) {
gm_80479C30[idx].release |= arg2;
}
}
}

/// #fn_801A396C
void fn_801A396C(s32 idx)
{
if (gm_80479C30[idx].button || gm_80479C30[idx].release) {
gm_80479C30[idx].unk = gm_80479C30[idx].button;
gm_80479C30[idx].x28 = gm_80479D24;
gm_80479C30[idx].x2C = 0;
}
if (gm_80479C30[idx].x2C < gm_80479D24) {
gm_80479C30[idx].x2C++;
}
if (gm_80479C30[idx].x28 != 0) {
gm_80479C30[idx].x28--;
gm_80479C30[idx].unk = 0;
}
}

/// #gm_801A3A74
#pragma push
#pragma dont_inline on
void gm_801A3A74(void)
{
gm_controller_map* controller = gm_80479C30;
int i;
for (i = 0; i < 4; i++) {
controller->button = HSD_PadCopyStatus[i].button;
controller->trigger = HSD_PadCopyStatus[i].trigger;
controller->repeat = HSD_PadCopyStatus[i].repeat;
controller->release = HSD_PadCopyStatus[i].release;
gm_801A3714(i, 0x1100, ((u64) 1 << (32 + 0)));
gm_801A3714(i, 0x200, ((u64) 1 << (32 + 1)));
gm_801A3820(i, 0x1060, ((u64) 1 << (32 + 2)));
gm_801A3820(i, 0x1160, ((u64) 1 << (32 + 3)));
gm_801A3714(i, 0x10008, ((u64) 1 << (32 + 4)));
gm_801A3714(i, 0x20004, ((u64) 1 << (32 + 5)));
gm_801A3714(i, 0x40001, ((u64) 1 << (32 + 6)));
gm_801A3714(i, 0x80002, ((u64) 1 << (32 + 7)));
gm_80479D20(i);
controller++;
}
controller_union.button = 0;
controller_union.trigger = 0;
controller_union.repeat = 0;
controller_union.release = 0;
controller_union.unk = 0;
controller_union.x28 = 0;
controller_union.x2C = 0;
for (i = 0; i < 4; i++) {
controller_union.button |= gm_80479C30[i].button;
controller_union.trigger |= gm_80479C30[i].trigger;
controller_union.repeat |= gm_80479C30[i].repeat;
controller_union.release |= gm_80479C30[i].release;
}
}
#pragma pop

/// #gm_801A3E88

Expand Down Expand Up @@ -363,9 +466,9 @@ s32 gm_801A4B90(void)

extern void* gm_804D6720;

s32 gm_801A4B9C(void)
s8* gm_801A4B9C(void)
{
return M2C_FIELD(gm_804D6720, s32*, 8);
return (s8*) M2C_FIELD(gm_804D6720, s32*, 8);
}

struct gm_80479D58_t* gm_801A4BA8(void)
Expand Down
16 changes: 9 additions & 7 deletions src/melee/gm/gm_1A36.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
#include <platform.h>
#include <placeholder.h>

/* 1A3680 */ UNK_RET gm_801A3680(UNK_PARAMS);
/* 1A36A0 */ UNK_RET gm_801A36A0(UNK_PARAMS);
/* 1A36C0 */ UNK_RET gm_801A36C0(UNK_PARAMS);
/* 1A36E0 */ UNK_RET gm_801A36E0(UNK_PARAMS);
/* 1A3714 */ UNK_RET gm_801A3714(UNK_PARAMS);
/* 1A3820 */ UNK_RET gm_801A3820(UNK_PARAMS);
#include "gm/types.h"

/* 1A3680 */ u64 gm_801A3680(u8);
/* 1A36A0 */ u64 gm_801A36A0(u8);
/* 1A36C0 */ u64 gm_801A36C0(u8);
/* 1A36E0 */ void gm_801A36E0(s32, s32);
/* 1A3714 */ void gm_801A3714(s32, u64, u64);
/* 1A3820 */ void gm_801A3820(s32, u64, u64);
/* 1A396C */ UNK_RET fn_801A396C(UNK_PARAMS);
/* 1A3A74 */ UNK_RET gm_801A3A74(UNK_PARAMS);
/* 1A3E88 */ UNK_RET gm_801A3E88(UNK_PARAMS);
Expand All @@ -34,7 +36,7 @@
/* 1A4B60 */ UNK_RET gm_801A4B60(UNK_PARAMS);
/* 1A4B74 */ UNK_RET gm_801A4B74(UNK_PARAMS);
/* 1A4B90 */ s32 gm_801A4B90(void);
/* 1A4B9C */ s32 gm_801A4B9C(void);
/* 1A4B9C */ s8* gm_801A4B9C(void);
/* 1A4BA8 */ struct gm_80479D58_t* gm_801A4BA8(void);
/* 1A4BC8 */ s32 gm_801A4BC8(void);
/* 1A4BD0 */ UNK_RET fn_801A4BD0(UNK_PARAMS);
Expand Down
16 changes: 16 additions & 0 deletions src/melee/gm/gm_1A36.static.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@ struct fn_801BA3B4_arg0_t {
/* +C:7 */ u8 xC_b7 : 1;
};

typedef struct gm_controller_map gm_controller_map;
struct gm_controller_map {
u64 button;
u64 trigger;
u64 repeat;
u64 release;
u64 unk;
s32 x28;
s32 x2C;
};

/* 1A3F48 */ static void gm_801A3F48(MinorScene*);
/* 1A4014 */ static void gm_801A4014(MajorScene* scene);
/* 1A4284 */ static UNK_T gm_801A4284(UNK_T);
Expand Down Expand Up @@ -154,6 +165,11 @@ struct fn_801BA3B4_arg0_t {
/* 1BF684 */ static void gm_801BF684(s16 arg0);
/* 1BF694 */ static u8 gm_801BF694(void);
/* 2A3EF4 */ static void gm_801A3EF4(void);
static u64 gm_803DA788;
static gm_controller_map gm_80479C30[4];
static gm_controller_map controller_union;
void (*gm_80479D20)(s32);
s32 gm_80479D24;
/* 3DA920 */ static MajorScene gm_803DA920;
/* 3DACA4 */ static MajorScene gm_803DACA4;
/* 3DD2C0 */ static int gm_803DD2C0[74];
Expand Down
7 changes: 4 additions & 3 deletions src/melee/gr/grkongo.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,12 +394,13 @@ void grKongo_801D577C(HSD_GObj* arg0)
lb_8000B1CC(temp_r30, NULL, &vec);
Ground_801C4D70(arg0, &vec, temp_r31->gv.kongo3.xD8);
switch (temp_r31->gv.kongo3.xC8) {
case 0:
case 0: {
s16 val = temp_r31->gv.kongo2.xCE;
temp_r31->gv.kongo2.xCE -= 1;
if (temp_r31->gv.kongo2.xCE < 0) {
if (val < 0) {
temp_r31->gv.kongo2.xC8 = 1;
}
break;
} break;
case 1:
temp_r31->gv.kongo2.xE8 += grKg_804D6980->unk5C;
if (temp_r31->gv.kongo2.xE8 > grKg_804D6980->unk60) {
Expand Down
Loading
Loading