Skip to content

Commit 3cd72e6

Browse files
authored
Merge pull request #153 from Kelebek1/fragment16
fragment16
2 parents 228b7ef + 81df8b6 commit 3cd72e6

22 files changed

+6977
-320
lines changed

include/libleo/internal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ typedef struct {
2626
} block_param_form; // size = 0x10
2727

2828
typedef union {
29-
/* 0x00 */ struct {
29+
struct {
3030
/* 0x00 */ u32 country;
3131
/* 0x04 */ u8 fmt_type;
3232
/* 0x05 */ u8 disk_type;

include/macros.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
4747
#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x))
4848

49-
#define ROUND_MAX(x) (((x) > 0.0f ? 0.5f : -0.5f) + (x))
49+
#define ROUND_MAX(x) ((x) + ((x) > 0.0f ? 0.5f : -0.5f))
5050

5151
#define ABS(x) ((x) < 0 ? -(x) : (x))
5252
#define ABS_ALT(x) ((x) >= 0 ? (x) : -(x))
@@ -72,7 +72,7 @@
7272
func_80004258(ASSET_ID(vram), rom##_ROM_START, rom##_ROM_END, arg0) \
7373
)
7474

75-
#define ASSET_LOAD2(vram, rom, arg0, arg1) (\
75+
#define ASSET_LOAD2(rom, arg0, arg1) (\
7676
func_800044F4(rom##_ROM_START, rom##_ROM_END, arg0, arg1) \
7777
)
7878
#endif

include/prevent_bss_reordering.h

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#ifndef PREVENT_BSS_REORDERING_H
2+
#define PREVENT_BSS_REORDERING_H
3+
4+
/**
5+
* To determine variable order for .bss, the compiler sorts variables by their
6+
* "name index" mod 256, where name index is something that, with -g, gets
7+
* incremented by struct and variable declarations, typedefs, and file markers,
8+
* among else. (Without -g, only variable declarations affects the index.)
9+
* This file contains enough dummy declarations to bump the index by 128.
10+
* Including it, or removing the include, should fix bss reordering problems
11+
* for a file, assuming the name index distance between its first and last bss
12+
* variable is at most 128.
13+
* Note that if a variable is declared "extern" within a header file, the name
14+
* index is taken at that point of the extern declaration. Thus, this include
15+
* must come before any such header.
16+
*/
17+
18+
struct Dummy0 { int x; };
19+
struct Dummy1 { int x; };
20+
struct Dummy2 { int x; };
21+
struct Dummy3 { int x; };
22+
struct Dummy4 { int x; };
23+
struct Dummy5 { int x; };
24+
struct Dummy6 { int x; };
25+
struct Dummy7 { int x; };
26+
struct Dummy8 { int x; };
27+
struct Dummy9 { int x; };
28+
struct Dummy10 { int x; };
29+
struct Dummy11 { int x; };
30+
struct Dummy12 { int x; };
31+
struct Dummy13 { int x; };
32+
struct Dummy14 { int x; };
33+
struct Dummy15 { int x; };
34+
struct Dummy16 { int x; };
35+
struct Dummy17 { int x; };
36+
struct Dummy18 { int x; };
37+
struct Dummy19 { int x; };
38+
struct Dummy20 { int x; };
39+
struct Dummy21 { int x; };
40+
struct Dummy22 { int x; };
41+
struct Dummy23 { int x; };
42+
struct Dummy24 { int x; };
43+
struct Dummy25 { int x; };
44+
struct Dummy26 { int x; };
45+
struct Dummy27 { int x; };
46+
struct Dummy28 { int x; };
47+
struct Dummy29 { int x; };
48+
struct Dummy30 { int x; };
49+
struct Dummy31 { int x; };
50+
struct Dummy32 { int x; };
51+
struct Dummy33 { int x; };
52+
struct Dummy34 { int x; };
53+
struct Dummy35 { int x; };
54+
struct Dummy36 { int x; };
55+
struct Dummy37 { int x; };
56+
struct Dummy38 { int x; };
57+
struct Dummy39 { int x; };
58+
struct Dummy40 { int x; };
59+
struct Dummy41 { int x; };
60+
struct Dummy42 { int x; };
61+
struct Dummy43 { int x; };
62+
struct Dummy44 { int x; };
63+
struct Dummy45 { int x; };
64+
struct Dummy46 { int x; };
65+
struct Dummy47 { int x; };
66+
struct Dummy48 { int x; };
67+
struct Dummy49 { int x; };
68+
struct Dummy50 { int x; };
69+
struct Dummy51 { int x; };
70+
struct Dummy52 { int x; };
71+
struct Dummy53 { int x; };
72+
struct Dummy54 { int x; };
73+
struct Dummy55 { int x; };
74+
struct Dummy56 { int x; };
75+
struct Dummy57 { int x; };
76+
struct Dummy58 { int x; };
77+
struct Dummy59 { int x; };
78+
struct Dummy60 { int x; };
79+
struct Dummy61 { int x; };
80+
struct Dummy62 { int x; };
81+
typedef int Dummy63;
82+
83+
#endif

linker_scripts/us/symbol_addrs.txt

+3
Original file line numberDiff line numberDiff line change
@@ -341,3 +341,6 @@ D_8007596C = 0x8007596C;
341341
D_8690B360 = 0x8690B360; // size:0x18
342342
D_8690B390 = 0x8690B390; // size:0x24
343343
D_8690B5D0 = 0x8690B5D0; // size:0x24
344+
D_86A06228 = 0x86A06228; // size:0xC
345+
D_86A06238 = 0x86A06238; // size:0xC
346+
D_86A06248 = 0x86A06248; // size:0xC

src/11BA0.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void func_80010FDC(unk_D_86002F34_000* arg0, func_D_86002F34_000_010 arg1, unk_D
3131
}
3232
}
3333

34-
unk_D_86002F34_000* func_8001103C(MainPoolState* arg0, void* arg1) {
34+
unk_D_86002F34_000* func_8001103C(MainPoolState* arg0, unk_D_86002F34_000* arg1) {
3535
if (arg0 != NULL) {
3636
arg1 = func_80002DCC(arg0, sizeof(unk_D_86002F34_000), 4);
3737
}

src/11BA0.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ typedef struct unk_D_8690A610 {
2222

2323
void func_80010FA0(unk_D_86002F34_000* arg0, u8 arg1);
2424
void func_80010FDC(unk_D_86002F34_000* arg0, func_D_86002F34_000_010 arg1, unk_D_86002F34_000_014* arg2);
25-
unk_D_86002F34_000* func_8001103C(MainPoolState* arg0, void* arg1);
25+
unk_D_86002F34_000* func_8001103C(MainPoolState* arg0, unk_D_86002F34_000* arg1);
2626
unk_D_86002F34_alt2* func_80011088(MainPoolState* arg0, unk_D_86002F34_alt2* arg1, unk_D_86002F34_000* arg2);
2727
unk_D_86002F34_00C* func_800110E0(MemoryBlock* arg0, unk_D_86002F34_00C* arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5);
2828
unk_D_86002F34_alt13* func_800111A4(MemoryBlock* arg0, unk_D_86002F34_alt13* arg1, s16 arg2);

0 commit comments

Comments
 (0)