Skip to content

Commit

Permalink
Re-link gm (doldecomp#1149)
Browse files Browse the repository at this point in the history
  • Loading branch information
ribbanya authored Jan 29, 2024
1 parent 26f4ad3 commit 93f8a85
Show file tree
Hide file tree
Showing 16 changed files with 47,758 additions and 44,718 deletions.
80,287 changes: 40,947 additions & 39,340 deletions asm/melee/gm/gm_1A36.s

Large diffs are not rendered by default.

6,474 changes: 3,926 additions & 2,548 deletions asm/melee/gm/gmmain_lib.s

Large diffs are not rendered by default.

5,008 changes: 2,547 additions & 2,461 deletions asm/melee/lb/lbbgflash.s

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions config/GALE01/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ melee/gm/gm_1A36.c:
.bss start:0x80479C30 end:0x8049E6C8
.sdata start:0x804D4268 end:0x804D44E0
.sbss start:0x804D6720 end:0x804D6950
.sdata2 start:0x804DA9E8 end:0x804DAC80
.sdata2 start:0x804DA9E8 end:0x804DAC90

melee/gr/ground.c:
.text start:0x801BFFA8 end:0x801C5B90
Expand All @@ -1632,7 +1632,7 @@ melee/gr/ground.c:
.bss start:0x8049E6C8 end:0x8049EE10
.sdata start:0x804D44E0 end:0x804D4530
.sbss start:0x804D6950 end:0x804D6958
.sdata2 start:0x804DAC80 end:0x804DAD78
.sdata2 start:0x804DAC90 end:0x804DAD78

melee/gr/grdisplay.c:
.text start:0x801C5B90 end:0x801C5FC0
Expand Down
8 changes: 4 additions & 4 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def RuntimeLib(lib_name: str, objects: Objects) -> LibDict:
MeleeLib(
"mp (Map)",
[
Object(Unknown, "melee/mp/mpcoll.c"),
Object(NonMatching, "melee/mp/mpcoll.c"),
Object(NonMatching, "melee/mp/mplib.c"),
Object(NonMatching, "melee/mp/mpisland.c"),
],
Expand Down Expand Up @@ -733,12 +733,12 @@ def RuntimeLib(lib_name: str, objects: Objects) -> LibDict:
MeleeLib(
"gm (Main game loop)",
[
Object(Unknown, "melee/gm/gmmain_lib.c"),
Object(Unknown, "melee/gm/gmmain.c"),
Object(NonMatching, "melee/gm/gmmain_lib.c"),
Object(Matching, "melee/gm/gmmain.c"),
Object(NonMatching, "melee/gm/gm_1601.c"),
Object(NonMatching, "melee/gm/gmtitle.c"),
Object(NonMatching, "melee/gm/gmcamera.c"),
Object(Unknown, "melee/gm_1A36.c"),
Object(NonMatching, "melee/gm_1A36.c"),
],
),
MeleeLib(
Expand Down
1 change: 0 additions & 1 deletion obj_files.mk
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ TEXT_O_FILES +=\
$(BUILD_DIR)/src/melee/ft/ftbosslib.c.o\

TEXT_O_FILES +=\
$(BUILD_DIR)/src/melee/gm/gmmain_lib.c.o\
$(BUILD_DIR)/asm/melee/gm/gmmain_lib.s.o\
$(BUILD_DIR)/src/melee/gm/gmmain.c.o\
$(BUILD_DIR)/asm/melee/gm/gm_1601.s.o\
Expand Down
8 changes: 8 additions & 0 deletions src/melee/gm/forward.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef MELEE_GM_FORWARD_H
#define MELEE_GM_FORWARD_H

#include <placeholder.h>

typedef struct GameRules GameRules;

#endif
3 changes: 3 additions & 0 deletions src/melee/gm/gm_1A36.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <placeholder.h>

/* 1A4310 */ static UNK_RET gm_800A4310(UNK_PARAMS);
7 changes: 3 additions & 4 deletions src/melee/gm/gm_1A36.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

#include <placeholder.h>

unk_t gm_801A4BB8(void);
bool gm_801A45E8(s32);
void gm_801A4510(void);
/* 1A4310 */ /* static */ UNK_RET gm_801A4310(UNK_PARAMS);
/* 1A4510 */ void gm_801A4510(void);
/* 1A45E8 */ bool gm_801A45E8(s32);
/* 1A4BB8 */ UNK_T gm_801A4BB8(void);

#endif
18 changes: 5 additions & 13 deletions src/melee/gm/gmmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,11 @@ static void gmMain_8015FDA4(void)
}
}

#ifdef MUST_MATCH

static inline void init_spr_unk(void)
/// @remarks Might not do anything relevant to a port, but should still
/// understand its purpose before ignoring it.
static void init_spr_unk(void)
{
#ifdef MWERKS_GEKKO
#define MTSPR(spr, val) \
asm { li r3, val } \
asm \
Expand All @@ -141,24 +142,15 @@ static inline void init_spr_unk(void)
MTSPR(0x393, 5);
MTSPR(0x394, 6);
MTSPR(0x395, 7);
}
#else

/// @remarks Might not do anything relevant to a port, but should still
/// understand its purpose before ignoring it.
static inline void init_spr_unk(void)
{
NOT_IMPLEMENTED;
}

#endif
}

int main(void)
{
#ifdef MUST_MATCH
char* unused_format_string = "Data %lx\n";
u32 _[2];
#endif

OSInit();
VIInit();
Expand Down
45 changes: 2 additions & 43 deletions src/melee/gm/gmmain_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "lb/lbtime.h"

/* 15D888 */ static void gmMainLib_8015D888(u32);

GameRules* gmMainLib_8015CC34(void)
{
return &gmMainLib_804D3EE0->x1850;
Expand Down Expand Up @@ -603,48 +605,6 @@ u32* gmMainLib_8015D970(ssize_t idx)
return &base[idx];
}

void gmMainLib_8015D9F4(u32 arg0);
void gmMainLib_8015DA40(u32 arg0);

#ifdef MUST_MATCH
#pragma push
asm bool gmMainLib_8015D984(u32 arg0)
{ // clang-format off
nofralloc
/* 8015D984 0015A564 7C 08 02 A6 */ mflr r0
/* 8015D988 0015A568 90 01 00 04 */ stw r0, 4(r1)
/* 8015D98C 0015A56C 94 21 FF D8 */ stwu r1, -0x28(r1)
/* 8015D990 0015A570 93 E1 00 24 */ stw r31, 0x24(r1)
/* 8015D994 0015A574 93 C1 00 20 */ stw r30, 0x20(r1)
/* 8015D998 0015A578 7C 7E 1B 78 */ mr r30, r3
/* 8015D99C 0015A57C 48 00 00 F5 */ bl gmMainLib_8015DA90
/* 8015D9A0 0015A580 2C 03 00 00 */ cmpwi r3, 0
/* 8015D9A4 0015A584 40 82 00 34 */ bne lbl_8015D9D8
/* 8015D9A8 0015A588 80 6D 88 40 */ lwz r3, gmMainLib_804D3EE0
/* 8015D9AC 0015A58C 57 C0 10 3A */ slwi r0, r30, 2
/* 8015D9B0 0015A590 7C 63 02 14 */ add r3, r3, r0
/* 8015D9B4 0015A594 3B E3 00 6C */ addi r31, r3, 0x6c
/* 8015D9B8 0015A598 4B EA D6 05 */ bl lbTime_8000AFBC
/* 8015D9BC 0015A59C 90 7F 00 00 */ stw r3, 0(r31)
/* 8015D9C0 0015A5A0 7F C3 F3 78 */ mr r3, r30
/* 8015D9C4 0015A5A4 48 00 00 31 */ bl gmMainLib_8015D9F4
/* 8015D9C8 0015A5A8 7F C3 F3 78 */ mr r3, r30
/* 8015D9CC 0015A5AC 48 00 00 75 */ bl gmMainLib_8015DA40
/* 8015D9D0 0015A5B0 38 60 00 01 */ li r3, 1
/* 8015D9D4 0015A5B4 48 00 00 08 */ b lbl_8015D9DC
lbl_8015D9D8:
/* 8015D9D8 0015A5B8 38 60 00 00 */ li r3, 0
lbl_8015D9DC:
/* 8015D9DC 0015A5BC 80 01 00 2C */ lwz r0, 0x2c(r1)
/* 8015D9E0 0015A5C0 83 E1 00 24 */ lwz r31, 0x24(r1)
/* 8015D9E4 0015A5C4 83 C1 00 20 */ lwz r30, 0x20(r1)
/* 8015D9E8 0015A5C8 38 21 00 28 */ addi r1, r1, 0x28
/* 8015D9EC 0015A5CC 7C 08 03 A6 */ mtlr r0
/* 8015D9F0 0015A5D0 4E 80 00 20 */ blr
} // clang-format on
#pragma pop

#else
// https://decomp.me/scratch/CJy8X
// register swap
bool gmMainLib_8015D984(u32 arg0)
Expand All @@ -663,7 +623,6 @@ bool gmMainLib_8015D984(u32 arg0)

return false;
}
#endif

void gmMainLib_8015D9F4(u32 arg0)
{
Expand Down
Loading

0 comments on commit 93f8a85

Please sign in to comment.