Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
472c615
Use HSD_ASSERT where the message is the condition
MarkMcCaskey Jul 26, 2026
55f961c
Replace raw __assert calls with the HSD assert macros
MarkMcCaskey Jul 26, 2026
4454244
Address review: rework ItemKind Pokemon_*, drop the lbfile respell
MarkMcCaskey Jul 26, 2026
0a42ccf
Apply the recovered range names at their existing sites
MarkMcCaskey Jul 26, 2026
cc63d90
Catch the Pokemon_* uses added upstream since this branch forked
MarkMcCaskey Jul 26, 2026
259bc79
Address review: doc-comment style, static common_pokemon
MarkMcCaskey Jul 26, 2026
3889fb3
Convert the lbmemory, mnhyaku, and grshrineroute asserts
MarkMcCaskey Jul 26, 2026
c1e8a2a
Address review: Doxygen groups, Parts_Max enum, _p() family
MarkMcCaskey Jul 26, 2026
1aa423b
Use Doxygen member group syntax
MarkMcCaskey Jul 26, 2026
f464521
Represent common Pokemon padding as alignment
MarkMcCaskey Jul 26, 2026
5443bb1
Split character-specific item tables
MarkMcCaskey Jul 26, 2026
3b981b2
Restore itzako prototype include
MarkMcCaskey Jul 26, 2026
5fd47e6
Use enum values for CmSnapStatus
MarkMcCaskey Jul 26, 2026
0732fe0
Use Unk names for CmSnapStatus placeholders
MarkMcCaskey Jul 26, 2026
2e85d2d
Clarify CmSnapStatus assert attribution
MarkMcCaskey Jul 26, 2026
0df362c
Remove brittle grBigBlue line reference
MarkMcCaskey Jul 26, 2026
dcc40ea
Flatten grBigBlue stage model setup
MarkMcCaskey Jul 26, 2026
9557838
Use Pl_ItemLog enum throughout item tracking
MarkMcCaskey Jul 26, 2026
8687c42
Complete Gm_Player enum range
MarkMcCaskey Jul 26, 2026
6a02989
Apply clang-format to Pl_ItemLog use
MarkMcCaskey Jul 26, 2026
fea3e40
Merge branch 'master' into use-hsd-assert-macros
ribbanya Jul 26, 2026
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
5 changes: 4 additions & 1 deletion config/GALE01/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3353,10 +3353,13 @@ melee/it/itanimlist.c:
melee/it/it_279C.c:
.text start:0x80279C48 end:0x8027B5B0
.rodata start:0x803B8588 end:0x803B85A8
.data start:0x803F2310 end:0x803F5428
.data start:0x803F2310 end:0x803F2F28
.sdata start:0x804D51D0 end:0x804D51E0
.sdata2 start:0x804DC7B8 end:0x804DC7D0

melee/it/it_3F2F.c:
.data start:0x803F2F28 end:0x803F5428

melee/it/itzako.c:
.text start:0x8027B5B0 end:0x8027CF00
.rodata start:0x803B85A8 end:0x803B8600
Expand Down
4 changes: 2 additions & 2 deletions config/GALE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ lbMemory_80014E24 = .text:0x80014E24; // type:function size:0xC8 scope:global
lbMemory_80014EEC = .text:0x80014EEC; // type:function size:0x90 scope:global
lbMemory_80014F7C = .text:0x80014F7C; // type:function size:0x4C scope:global
lbMemory_80014FC8 = .text:0x80014FC8; // type:function size:0x128 scope:global
lbMemory_800150F0 = .text:0x800150F0; // type:function size:0x94 scope:global
lbMemFreeToHeap = .text:0x800150F0; // type:function size:0x94 scope:global
fn_80015184 = .text:0x80015184; // type:function size:0x118
lbMemory_8001529C = .text:0x8001529C; // type:function size:0x84 scope:global
lbMemory_80015320 = .text:0x80015320; // type:function size:0x19C scope:global
Expand Down Expand Up @@ -23875,7 +23875,7 @@ it_803F22A8 = .data:0x803F22A8; // type:object size:0x40 scope:global
@188 = .data:0x803F2300; // type:object size:0xD scope:local data:string
it_803F2310 = .data:0x803F2310; // type:object size:0xBC scope:global
it_803F23CC = .data:0x803F23CC; // type:object size:0xB04 scope:global
it_803F2ED0 = .data:0x803F2ED0; // type:object size:0x58 scope:global
common_pokemon = .data:0x803F2ED0; // type:object size:0x54 scope:local
it_803F2F28 = .data:0x803F2F28; // type:object size:0x1D8 scope:global
it_803F3100 = .data:0x803F3100; // type:object size:0x1BA8 scope:global
it_803F4CA8 = .data:0x803F4CA8; // type:object size:0x78 scope:global
Expand Down
1 change: 1 addition & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,7 @@ def MatchingFor(*versions):
Object(Matching, "melee/it/iteffect.c"),
Object(Matching, "melee/it/itanimlist.c"),
Object(Matching, "melee/it/it_279C.c"),
Object(Matching, "melee/it/it_3F2F.c"),
Object(Matching, "melee/it/itzako.c"),
# Individual items
Object(Matching, "melee/it/items/itcapsule.c"),
Expand Down
40 changes: 21 additions & 19 deletions src/melee/cm/cmsnap.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "cm/cmsnap.h"

#include "cm/forward.h"

#include "lb/lbspdisplay.h"

#include <baselib/debug.h>
Expand All @@ -8,49 +10,49 @@
#include <baselib/tobj.h>

typedef struct {
int unk0;
CmSnapStatus status;
HSD_ImageDesc unk1;
int unk2;
} _cmsnap_data;
static _cmsnap_data cmsnap_data;
#define _p(x) (cmsnap_data.x)

void cmSnap_800315C8(void)
{
HSD_ASSERTMSG(0x55, cmsnap_data.unk0 == 0,
"_p(status) == CmSnapStatus_Sleep");
cmsnap_data.unk0 = 1;
HSD_ASSERT(0x55, _p(status) == CmSnapStatus_Sleep);
_p(status) = CmSnapStatus_Unk1;
}

void* cmSnap_80031618(void)
{
if (cmsnap_data.unk0 != 5) {
if (_p(status) != CmSnapStatus_Unk5) {
return 0;
}
cmsnap_data.unk0 = 0;
return cmsnap_data.unk1.image_ptr;
_p(status) = CmSnapStatus_Sleep;
return _p(unk1).image_ptr;
}

void cmSnap_80031640(HSD_GObj* arg0, int code)
{
switch (cmsnap_data.unk0) {
case 0:
switch (_p(status)) {
case CmSnapStatus_Sleep:
break;
case 1:
lb_800122C8(&cmsnap_data.unk1, 0, 0, 0);
cmsnap_data.unk0 = 2;
case CmSnapStatus_Unk1:
lb_800122C8(&_p(unk1), 0, 0, 0);
_p(status) = CmSnapStatus_Unk2;
break;
case 2:
case 3:
case 4:
cmsnap_data.unk0 += 1;
case CmSnapStatus_Unk2:
case CmSnapStatus_Unk3:
case CmSnapStatus_Unk4:
_p(status) += 1;
break;
}
}

void cmSnap_800316B4(void)
{
cmsnap_data.unk0 = 0;
cmsnap_data.unk1.image_ptr = NULL;
_p(status) = CmSnapStatus_Sleep;
_p(unk1).image_ptr = NULL;
GObj_SetupGXLinkMax(GObj_Create(0x12, 0x12, 0), cmSnap_80031640, 4);
lb_800121FC(&cmsnap_data.unk1, 0x280, 0x1E0, 4, 0x7D6);
lb_800121FC(&_p(unk1), 0x280, 0x1E0, 4, 0x7D6);
}
11 changes: 11 additions & 0 deletions src/melee/cm/forward.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,15 @@ typedef struct CameraDebugMode CameraDebugMode;
typedef struct CameraModeCallbacks CameraModeCallbacks;
typedef struct CameraInputs CameraInputs;

/// @remarks @c CmSnapStatus_Sleep is named by an assert in
/// #cmSnap_800315C8.
typedef enum CmSnapStatus {
/* 0x0 */ CmSnapStatus_Sleep,
/* 0x1 */ CmSnapStatus_Unk1,
/* 0x2 */ CmSnapStatus_Unk2,
/* 0x3 */ CmSnapStatus_Unk3,
/* 0x4 */ CmSnapStatus_Unk4,
/* 0x5 */ CmSnapStatus_Unk5,
} CmSnapStatus;

#endif
2 changes: 1 addition & 1 deletion src/melee/ft/chara/ftCaptain/ftCa_SpecialS.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void ftCa_SpecialS_OnDetect(HSD_GObj* gobj)
itGetKind(detected_gobj) < It_Kind_Octarock_Stone) ||
(itGetKind(detected_gobj) >= It_Kind_Old_Kuri &&
itGetKind(detected_gobj) < It_Kind_Arwing_Laser) ||
itGetKind(detected_gobj) == Pokemon_Random)
itGetKind(detected_gobj) == It_PKind_Random)
{
switch (fp->motion_id) {
case ftCa_MS_SpecialSStart: {
Expand Down
4 changes: 2 additions & 2 deletions src/melee/ft/chara/ftCommon/ftpickupitem.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ bool ftpickupitem_8009447C(Fighter_GObj* gobj, Item_GObj* item_gobj)
Fighter_8006CF5C(fp, it_8026B47C(item_gobj));
Item_8026A8EC(item_gobj);
goto block_35;
case Pokemon_Lucky_Egg:
case It_Kind_Lucky_Egg:
Fighter_8006CF5C(fp, it_8026B47C(item_gobj));
Item_8026A8EC(item_gobj);
goto block_35;
Expand Down Expand Up @@ -363,7 +363,7 @@ void ftpickupitem_80094B6C(Fighter_GObj* gobj, Item_GObj* item_gobj)
Fighter_8006CF5C(fp, it_8026B47C(item_gobj));
Item_8026A8EC(item_gobj);
return;
case Pokemon_Lucky_Egg:
case It_Kind_Lucky_Egg:
Fighter_8006CF5C(fp, it_8026B47C(item_gobj));
Item_8026A8EC(item_gobj);
return;
Expand Down
6 changes: 2 additions & 4 deletions src/melee/ft/ftchangeparam.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

#include "placeholder.h"

#include <baselib/debug.h>
#include <melee/ft/fighter.h>
#include <melee/ft/inlines.h>

float ftCo_CalcYScaledKnockback(float arg0, float scale, float arg2)
{
/// @todo Convert to @c HSD_ASSERT once a byte-matching form is found.
if (scale == 0.0F) {
__assert("ftchangeparam.c", 0x1E, "scale != 0.0F");
}
HSD_ASSERT(0x1E, scale != 0.0F);
if (arg2 == 0.0F) {
return arg0;
}
Expand Down
14 changes: 14 additions & 0 deletions src/melee/gm/forward.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,18 @@ typedef struct VsApproachData VsApproachData;

typedef bool (*GmRouteCallback)(int);

/// Player slot indices.
/// @remarks @c Gm_Player_NumMax is named by an assert in #pl_8004049C.
/// @c Gm_Player_Other is named by asserts in #setFlag and #setPointValue.
typedef enum Gm_Player {
/* 0x00 */ Gm_Player_Unk0,
/* 0x01 */ Gm_Player_Unk1,
/* 0x02 */ Gm_Player_Unk2,
/* 0x03 */ Gm_Player_Unk3,
/* 0x04 */ Gm_Player_Unk4,
/* 0x05 */ Gm_Player_Unk5,
/* 0x06 */ Gm_Player_NumMax = 6,
/* 0x06 */ Gm_Player_Other = Gm_Player_NumMax,
} Gm_Player;

#endif
3 changes: 1 addition & 2 deletions src/melee/gm/gmmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ static void gmMain_8015FDA4(void)
db_804D6B20 = false;
}
} else {
HSD_ASSERTMSG(0xD2, DbLevel == DbLKind_NoDebugRom,
"DbLevel == DbLKind_NoDebugRom");
HSD_ASSERT(0xD2, DbLevel == DbLKind_NoDebugRom);
DbLevel = 0;
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/melee/gm/gmregenddisp.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ void gm_801A9094(void)
HSD_MatAnimJoint* matanim;
HSD_GObj* gobj;
HSD_JObj* root;
HSD_JObj* child;
HSD_JObj* jobj;
PAD_STACK(0x84);

gm_801A8D54(sp8C);
Expand All @@ -306,14 +306,14 @@ void gm_801A9094(void)
HSD_JObjSetScaleY(root, 1.8f);
HSD_JObjSetScaleZ(root, 1.8f);
HSD_ASSERT(0x2F5, joint);
child = HSD_JObjLoadJoint(joint);
HSD_ASSERTMSG(0x2F7, child, "jobj");
HSD_JObjAddChild(root, child);
HSD_JObjAddAnimAll(child, NULL, matanim, NULL);
HSD_JObjReqAnimAll(child, (f32) dsp->x05);
HSD_JObjAnimAll(child);
HSD_JObjSetTranslateX(child, dsp->x08);
HSD_JObjSetTranslateZ(child, dsp->x0C);
jobj = HSD_JObjLoadJoint(joint);
HSD_ASSERT(0x2F7, jobj);
HSD_JObjAddChild(root, jobj);
HSD_JObjAddAnimAll(jobj, NULL, matanim, NULL);
HSD_JObjReqAnimAll(jobj, (f32) dsp->x05);
HSD_JObjAnimAll(jobj);
HSD_JObjSetTranslateX(jobj, dsp->x08);
HSD_JObjSetTranslateZ(jobj, dsp->x0C);
HSD_JObjAddChild(root, HSD_JObjLoadJoint(bg_joint));
gm_801A85E4(root, i, sp8C[i]);
}
Expand Down
4 changes: 2 additions & 2 deletions src/melee/gm/gmtoulib.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <placeholder.h>

#include "baselib/debug.h"
#include "baselib/fog.h"
#include "baselib/gobjgxlink.h"
#include "baselib/gobjobject.h"
Expand Down Expand Up @@ -2054,8 +2055,7 @@ int fn_8018F4A0(void)
printf("This is impossible stage num from mnSelStageRandom() -> stage "
"%d \n",
temp_r3);
/// @todo No byte-matching HSD assert macro form.
__assert("gmtoulib.c", 0x53D, "0");
HSD_ASSERT(0x53D, 0);
}
return temp_r3;
}
Expand Down
6 changes: 6 additions & 0 deletions src/melee/gr/forward.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ typedef enum StadiumGrType {
PsType_Display = 1,
} StadiumGrType;

/// Size of the Home-Run Contest parts array, named by an assert in
/// #grHomeRun_8021CB20.
typedef enum Gr_Homerun_Parts {
/* 0x40 */ Gr_Homerun_Parts_Max = 64,
} Gr_Homerun_Parts;

typedef void (*unkCastleCallback)(void*, struct unkCastle*);
typedef void (*unkCastleCallback2)(void*, struct unkCastle*, Ground_GObj*);
typedef int (*GrIceMtSegmentLookup)(Ground_GObj*);
Expand Down
16 changes: 8 additions & 8 deletions src/melee/gr/grbigblue.c
Original file line number Diff line number Diff line change
Expand Up @@ -2386,9 +2386,9 @@ static grBb_TrackEntry grBb_TrackEntries[12] = {

void grBigBlue_801EB004(Ground_GObj* gobj)
{
HSD_JObj* jobj = GET_JOBJ(gobj);
HSD_JObj* stage_jobj = GET_JOBJ(gobj);
Ground* gp = gobj->user_data;
HSD_JObj* child;
HSD_JObj* jobj;
Vec3 pos;
Vec3 end_pos;
Vec3 diff;
Expand All @@ -2397,21 +2397,21 @@ void grBigBlue_801EB004(Ground_GObj* gobj)
grBb_TrackEntry* entry;
PAD_STACK(4);

HSD_JObjSetFlagsAll(jobj, JOBJ_HIDDEN);
HSD_JObjSetFlagsAll(stage_jobj, JOBJ_HIDDEN);

pos.x = pos.y = pos.z = 1.0F;
HSD_JObjSetScale(jobj, &pos);
HSD_JObjSetScale(stage_jobj, &pos);

pos.x = pos.y = pos.z = Ground_801C0498();

entry = grBb_TrackEntries;
for (i = 0; i < 12; i++, entry++) {
HSD_JObj* start_jobj;
HSD_JObj* end_jobj;
child = Ground_801C3FA4(gobj, entry->jobj_index);
jobj = Ground_801C3FA4(gobj, entry->jobj_index);

/* goto required for match: skips to assert block on NULL */
if (child == NULL) {
if (jobj == NULL) {
goto assert_block;
}

Expand All @@ -2425,7 +2425,7 @@ void grBigBlue_801EB004(Ground_GObj* gobj)
goto assert_block;
}

HSD_JObjSetScale(child, &pos);
HSD_JObjSetScale(jobj, &pos);

lb_8000B1CC(start_jobj, NULL, &start_pos);
lb_8000B1CC(end_jobj, NULL, &end_pos);
Expand All @@ -2437,7 +2437,7 @@ void grBigBlue_801EB004(Ground_GObj* gobj)
continue;

assert_block:
HSD_ASSERTMSG(2328, child, "jobj");
HSD_ASSERT(2328, jobj);
HSD_ASSERT(2329, start_jobj);
HSD_ASSERT(2330, end_jobj);
}
Expand Down
2 changes: 1 addition & 1 deletion src/melee/gr/grcastle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,7 @@ void grCastle_801D0680(void* arg0, unkCastle* arg1)

static void grCastle_801D06CC_sub(unkCastle* arg0, Ground_GObj* gobj, s32 i)
{
if (ftLib_80086960(gobj) || itGetKind(gobj) != Pokemon_Random) {
if (ftLib_80086960(gobj) || itGetKind(gobj) != It_PKind_Random) {
arg0->x134[i] = 1;
grMaterial_801C8CDC(arg0->x10C[i]);
arg0->x10C[i] = NULL;
Expand Down
Loading
Loading