Skip to content

Commit

Permalink
Merge pull request pret#137 from Kelebek1/various
Browse files Browse the repository at this point in the history
2FEA0
  • Loading branch information
RevoSucks authored Sep 23, 2024
2 parents 9cdabf9 + b819408 commit 5d69e32
Show file tree
Hide file tree
Showing 19 changed files with 260 additions and 63 deletions.
4 changes: 2 additions & 2 deletions include/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
#define FRAGMENT_ID(fragment) ((((u32)fragment##_TEXT_START & 0x0FF00000) >> 0x14) - 0x10)
#define ASSET_ID(asset) (((u32)asset & 0x0F000000) >> 0x18)

#define FRAGMENT_LOAD(load_func, fragment) ( \
load_func(FRAGMENT_ID(fragment), fragment##_ROM_START, fragment##_relocs_ROM_END) \
#define FRAGMENT_LOAD(fragment) ( \
func_80004454(FRAGMENT_ID(fragment), fragment##_ROM_START, fragment##_relocs_ROM_END) \
)

#define FRAGMENT_LOAD_AND_CALL(fragment, arg0, arg1) (\
Expand Down
20 changes: 17 additions & 3 deletions include/sections.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
extern u8 fragment1_TEXT_START[];
extern u8 fragment1_ROM_START[];
extern u8 fragment1_ROM_END[];
extern u8 fragment1_relocs_ROM_END[];

// fragment 2
extern u8 fragment2_TEXT_START[];
Expand All @@ -28,16 +29,19 @@ extern u8 fragment4_relocs_ROM_END[];
extern u8 fragment5_TEXT_START[];
extern u8 fragment5_ROM_START[];
extern u8 fragment5_ROM_END[];
extern u8 fragment5_relocs_ROM_END[];

// fragment 6
extern u8 fragment6_TEXT_START[];
extern u8 fragment6_ROM_START[];
extern u8 fragment6_ROM_END[];
extern u8 fragment6_relocs_ROM_END[];

// fragment 7
extern u8 fragment7_TEXT_START[];
extern u8 fragment7_ROM_START[];
extern u8 fragment7_ROM_END[];
extern u8 fragment7_relocs_ROM_END[];

// fragment 8
extern u8 fragment8_TEXT_START[];
Expand All @@ -49,26 +53,31 @@ extern u8 fragment8_relocs_ROM_END[];
extern u8 fragment9_TEXT_START[];
extern u8 fragment9_ROM_START[];
extern u8 fragment9_ROM_END[];
extern u8 fragment9_relocs_ROM_END[];

// fragment 10
extern u8 fragment10_TEXT_START[];
extern u8 fragment10_ROM_START[];
extern u8 fragment10_ROM_END[];
extern u8 fragment10_relocs_ROM_END[];

// fragment 11
extern u8 fragment11_TEXT_START[];
extern u8 fragment11_ROM_START[];
extern u8 fragment11_ROM_END[];
extern u8 fragment11_relocs_ROM_END[];

// fragment 12
extern u8 fragment12_TEXT_START[];
extern u8 fragment12_ROM_START[];
extern u8 fragment12_ROM_END[];
extern u8 fragment12_relocs_ROM_END[];

// fragment 13
extern u8 fragment13_TEXT_START[];
extern u8 fragment13_ROM_START[];
extern u8 fragment13_ROM_END[];
extern u8 fragment13_relocs_ROM_END[];

// fragment 14
extern u8 fragment14_TEXT_START[];
Expand Down Expand Up @@ -104,21 +113,25 @@ extern u8 fragment18_relocs_ROM_END[];
extern u8 fragment19_TEXT_START[];
extern u8 fragment19_ROM_START[];
extern u8 fragment19_ROM_END[];
extern u8 fragment19_relocs_ROM_END[];

// fragment 20
extern u8 fragment20_TEXT_START[];
extern u8 fragment20_ROM_START[];
extern u8 fragment20_ROM_END[];
extern u8 fragment20_relocs_ROM_END[];

// fragment 21
extern u8 fragment21_TEXT_START[];
extern u8 fragment21_ROM_START[];
extern u8 fragment21_ROM_END[];
extern u8 fragment21_relocs_ROM_END[];

// fragment 22
extern u8 fragment22_TEXT_START[];
extern u8 fragment22_ROM_START[];
extern u8 fragment22_ROM_END[];
extern u8 fragment22_relocs_ROM_END[];

// fragment 23
extern u8 fragment23_TEXT_START[];
Expand Down Expand Up @@ -179,6 +192,7 @@ extern u8 fragment33_TEXT_START[];
extern u8 fragment33_ROM_START[];
extern u8 fragment33_ROM_END[];
extern u8 fragment33_relocs_ROM_END[];
extern u8 fragment33_misc_ROM_START[];

// fragment 34
extern u8 fragment34_TEXT_START[];
Expand Down Expand Up @@ -214,6 +228,7 @@ extern u8 fragment38_relocs_ROM_END[];
extern u8 fragment39_TEXT_START[];
extern u8 fragment39_ROM_START[];
extern u8 fragment39_ROM_END[];
extern u8 fragment39_relocs_ROM_END[];

// fragment 40
extern u8 fragment40_TEXT_START[];
Expand All @@ -225,6 +240,7 @@ extern u8 fragment40_relocs_ROM_END[];
extern u8 fragment41_TEXT_START[];
extern u8 fragment41_ROM_START[];
extern u8 fragment41_ROM_END[];
extern u8 fragment41_relocs_ROM_END[];

// fragment 42
extern u8 fragment42_TEXT_START[];
Expand Down Expand Up @@ -479,11 +495,9 @@ extern u8 _6C4E50_ROM_END[];

extern u8 D_124570[];

extern u32 fragment1_relocs_ROM_END[];

extern u8 _675FA0_ROM_START[];
extern u8 _675FA0_ROM_END[];

extern u8 _696350_ROM_START[];
extern u8 textdata_ROM_START[]; // 783760
extern u8 textdata_ROM_END[]; // 783760

Expand Down
1 change: 1 addition & 0 deletions src/22630.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ void func_800238D8(UNUSED MainPoolBlock* arg0, u32 arg1);
void func_80023990(s32 arg0);
s32 func_80023A04(s32 arg0);
void func_80023AF8(s32);
void func_80023D60(s32);
void func_80023F78(s32 arg0);
void func_80024040(s32 arg0);
s32 func_800240A0(void);
Expand Down
44 changes: 22 additions & 22 deletions src/29BA0.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ s32 func_800290E4(s16 arg0) {

main_pool_push_state('Demo');

FRAGMENT_LOAD(func_80004454, fragment34);
FRAGMENT_LOAD(func_80004454, fragment2);
FRAGMENT_LOAD(func_80004454, fragment3);
FRAGMENT_LOAD(fragment34);
FRAGMENT_LOAD(fragment2);
FRAGMENT_LOAD(fragment3);

D_800AE540.unk_0000 = arg0;

Expand All @@ -113,9 +113,9 @@ s32 func_800290E4(s16 arg0) {
void func_800291E0(void) {
main_pool_push_state('demo');

FRAGMENT_LOAD(func_80004454, fragment34);
FRAGMENT_LOAD(func_80004454, fragment2);
FRAGMENT_LOAD(func_80004454, fragment3);
FRAGMENT_LOAD(fragment34);
FRAGMENT_LOAD(fragment2);
FRAGMENT_LOAD(fragment3);

if (D_800AE540.unk_11F2 != 0) {
FRAGMENT_LOAD_AND_CALL(fragment16, 0, 0);
Expand Down Expand Up @@ -149,26 +149,26 @@ void func_800293CC(void) {
main_pool_push_state('DEMO');

if (D_800AE540.unk_0000 == 0x10) {
FRAGMENT_LOAD(func_80004454, fragment34);
FRAGMENT_LOAD(fragment34);
FRAGMENT_LOAD_AND_CALL(fragment62, 0, &D_800AE540);
} else {
ASSET_LOAD(D_3000000, _675FA0, 0);
FRAGMENT_LOAD(func_80004454, fragment2);
FRAGMENT_LOAD(func_80004454, fragment34);
FRAGMENT_LOAD(fragment2);
FRAGMENT_LOAD(fragment34);

switch (D_800AE540.unk_0003) {
case 3:
FRAGMENT_LOAD(func_80004454, fragment4);
FRAGMENT_LOAD(fragment4);
FRAGMENT_LOAD_AND_CALL(fragment8, 1, 0);
break;

case 9:
FRAGMENT_LOAD(func_80004454, fragment3);
FRAGMENT_LOAD(fragment3);
FRAGMENT_LOAD_AND_CALL(fragment14, 1, 0);
break;

case 13:
FRAGMENT_LOAD(func_80004454, fragment3);
FRAGMENT_LOAD(fragment3);
FRAGMENT_LOAD_AND_CALL(fragment18, 1, 0);
break;
}
Expand Down Expand Up @@ -198,7 +198,7 @@ void func_800296E0(void) {
func_80005E40(0x10000, 0);
temp_s0 = func_80007444(1, 1, 2, 0, 2, 1);

FRAGMENT_LOAD(func_80004454, fragment34);
FRAGMENT_LOAD(fragment34);
func_80007678(temp_s0);
FRAGMENT_LOAD_AND_CALL2(fragment67, 1, 0);

Expand Down Expand Up @@ -302,7 +302,7 @@ void func_80029BC0(void) {

main_pool_push_state('STAD');

FRAGMENT_LOAD(func_80004454, fragment34);
FRAGMENT_LOAD(fragment34);
FRAGMENT_LOAD_AND_CALL(fragment62, 0, &D_800AE540);

main_pool_pop_state('STAD');
Expand Down Expand Up @@ -400,7 +400,7 @@ void func_8002A06C(void) {

main_pool_push_state('FREE');

FRAGMENT_LOAD(func_80004454, fragment34);
FRAGMENT_LOAD(fragment34);
FRAGMENT_LOAD_AND_CALL(fragment62, 0, &D_800AE540);

main_pool_pop_state('FREE');
Expand Down Expand Up @@ -476,7 +476,7 @@ void func_8002A400(void) {

main_pool_push_state('STAD');

FRAGMENT_LOAD(func_80004454, fragment34);
FRAGMENT_LOAD(fragment34);
FRAGMENT_LOAD_AND_CALL(fragment62, 0, &D_800AE540);

main_pool_pop_state('STAD');
Expand Down Expand Up @@ -633,7 +633,7 @@ void func_8002AAA8(void) {

main_pool_push_state('STAD');

FRAGMENT_LOAD(func_80004454, fragment34);
FRAGMENT_LOAD(fragment34);
FRAGMENT_LOAD_AND_CALL(fragment62, 0, &D_800AE540);

main_pool_pop_state('STAD');
Expand Down Expand Up @@ -681,7 +681,7 @@ void func_8002ADE8(s32 arg0) {

main_pool_push_state('FIGT');

FRAGMENT_LOAD(func_80004454, fragment34);
FRAGMENT_LOAD(fragment34);
FRAGMENT_LOAD_AND_CALL(fragment62, 0, &D_800AE540);

main_pool_pop_state('FIGT');
Expand All @@ -701,7 +701,7 @@ void func_8002AF38(void) {

main_pool_push_state('FIGT');

FRAGMENT_LOAD(func_80004454, fragment34);
FRAGMENT_LOAD(fragment34);
FRAGMENT_LOAD_AND_CALL(fragment62, 0, &D_800AE540);

main_pool_pop_state('FIGT');
Expand All @@ -720,10 +720,10 @@ void func_8002B07C(void) {

main_pool_push_state('DOSE');

frag_43_entry = FRAGMENT_LOAD(func_80004454, fragment43);
frag_43_entry = FRAGMENT_LOAD(fragment43);
frag_43_entry();

FRAGMENT_LOAD(func_80004454, fragment34);
FRAGMENT_LOAD(fragment34);
FRAGMENT_LOAD_AND_CALL(fragment75, 0, 0);

gCurrentGameState = STATE_TITLE_SCREEN;
Expand All @@ -737,7 +737,7 @@ void func_8002B180(void) {
func_8002BC64(1, 0, 2, 0);
func_800367A0(0xA0, 0xA, 0);

FRAGMENT_LOAD(func_80004454, fragment34);
FRAGMENT_LOAD(fragment34);
FRAGMENT_LOAD_AND_CALL(fragment62, 0, &D_800AE540);

main_pool_pop_state('STAD');
Expand Down
16 changes: 9 additions & 7 deletions src/2E110.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
#include "src/3FB0.h"
#include "src/memory.h"

#define D_800AF740_NUM_FILES 42

static BinArchive* D_800AF740;
static char** D_800AF744;
static s32* D_800AF744;

void func_8002D510(void) {
s32 i;

D_800AF740 = func_800044F4(textdata_ROM_START, NULL, 1, 0);
D_800AF744 = main_pool_alloc(0xA8, 0);
D_800AF744 = main_pool_alloc(D_800AF740_NUM_FILES * sizeof(s32), 0);

for (i = 0; i < 42; i++) {
D_800AF744[i] = NULL;
for (i = 0; i < D_800AF740_NUM_FILES; i++) {
D_800AF744[i] = 0;
}
}

Expand Down Expand Up @@ -58,9 +60,9 @@ void func_8002D628(char* arg0, u32 arg1, s8* arg2) {
if (temp_v0 == 0x23) {
temp_v0 = *arg2++;

temp_v0 -= 0x30;
temp_v0 = (*arg2++ + (temp_v0 * 10)) - 0x30;
if ((temp_v0 > 0) && (temp_v0 < 0xA)) {
temp_v0 -= '0';
temp_v0 = (*arg2++ + (temp_v0 * 10)) - '0';
if ((temp_v0 > 0) && (temp_v0 < 10)) {
sprintf(&sp58, "%d", D_800AF744[temp_v0]);
var_s4 = &sp58;
var_s2 = 1;
Expand Down
Loading

0 comments on commit 5d69e32

Please sign in to comment.