Skip to content

Commit 9ca02c7

Browse files
authored
Misc fixes (#1800)
* disasm_fix * dtor * Fault_LogThreadContext * rearrange microcode * sGfxPrintFont size of 0x800 * Move (null) to stackcheck * vimgr bss * sfx * Remove code_801D1E80 * z_en_hy_code * Fix assembler messages with endlabels and dlabels * xlitob data * Move skin unused bss pad to rumble
1 parent 9213dc7 commit 9ca02c7

File tree

15 files changed

+65
-55
lines changed

15 files changed

+65
-55
lines changed

assets/xml/boot/gfxprint.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
<Texture Name="sGfxPrintRainbowTLUT" OutName="gfx_print_rainbow_tlut" Format="rgba16" Width="8" Height="2" Offset="0x16C70"/>
55
<!-- TODO: Properly extract fonts not as blobs -->
66
<Blob Name="sGfxPrintRainbowFont" Size="0x8" Offset="0x16C90"/>
7-
<Blob Name="sGfxPrintFont" Size="0x808" Offset="0x16C98"/>
7+
<Blob Name="sGfxPrintFont" Size="0x800" Offset="0x16C98"/>
88
</File>
99
</Root>

spec/spec

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ beginseg
2121
name "boot"
2222
address 0x80080060
2323
include "$(BUILD_DIR)/src/boot/boot_main.o"
24-
include "$(BUILD_DIR)/src/boot/rspboot.o"
2524
include "$(BUILD_DIR)/src/boot/idle.o"
2625
include "$(BUILD_DIR)/src/boot/viconfig.o"
2726
include "$(BUILD_DIR)/src/boot/carthandle.o"
@@ -244,6 +243,8 @@ beginseg
244243
include "$(BUILD_DIR)/src/boot/libc/strcpy.o"
245244
include "$(BUILD_DIR)/src/boot/libc/memmove.o"
246245
include "$(BUILD_DIR)/src/boot/build.o"
246+
include "$(BUILD_DIR)/src/boot/rspboot.o"
247+
247248
#ifdef COMPILER_GCC
248249
include "$(BUILD_DIR)/src/gcc_fix/missing_gcc_functions.o"
249250
#endif
@@ -609,7 +610,6 @@ beginseg
609610
name "code"
610611
compress
611612
after "dmadata"
612-
include "$(BUILD_DIR)/src/code/rsptext.o"
613613
include "$(BUILD_DIR)/src/code/z_en_a_keep.o"
614614
include "$(BUILD_DIR)/src/code/z_en_item00.o"
615615
include "$(BUILD_DIR)/src/code/z_eff_blure.o"
@@ -780,7 +780,7 @@ beginseg
780780
include "$(BUILD_DIR)/assets/audio/sequence_font_table.o"
781781
include "$(BUILD_DIR)/src/audio/tables/sequence_table.o"
782782
include "$(BUILD_DIR)/src/audio/tables/samplebank_table.o"
783-
include "$(BUILD_DIR)/src/code/rspdata.o"
783+
include "$(BUILD_DIR)/src/code/rspcode.o"
784784
endseg
785785

786786
// The game expects all the segments after the `code` segment and before the first overlay to be `NOLOAD` ones

src/boot/fault.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ void Fault_PrintThreadContext(OSThread* thread) {
468468
}
469469
}
470470

471-
void osSyncPrintfThreadContext(OSThread* thread) {
471+
void Fault_LogThreadContext(OSThread* thread) {
472472
__OSThreadContext* threadCtx;
473473
s16 causeStrIndex = _SHIFTR((u32)thread->context.cause, 2, 5);
474474

@@ -1035,7 +1035,7 @@ void Fault_ThreadEntry(void* arg) {
10351035
do {
10361036
// Thread context page
10371037
Fault_PrintThreadContext(faultedThread);
1038-
osSyncPrintfThreadContext(faultedThread);
1038+
Fault_LogThreadContext(faultedThread);
10391039
Fault_WaitForInput();
10401040

10411041
// Stack trace page

src/boot/fault_drawer.c

-2
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ void* FaultDrawer_FormatStringFunc(void* arg, const char* str, size_t count) {
266266
return arg;
267267
}
268268

269-
const char D_80099080[] = "(null)";
270-
271269
s32 FaultDrawer_VPrintf(const char* fmt, va_list ap) {
272270
return _Printf(FaultDrawer_FormatStringFunc, sFaultDrawerInstance, fmt, ap);
273271
}

src/boot/libu64/stackcheck.c

+2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ StackStatus StackCheck_GetState(StackEntry* entry) {
9494
status = STACK_STATUS_OK;
9595
}
9696

97+
(void)"(null)";
98+
9799
return status;
98100
}
99101

src/boot/rspboot.s

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
.include "macro.inc"
22

3-
.section .data
3+
.section .text
44

5-
dlabel rspbootTextStart
5+
.balign 16
6+
7+
glabel rspbootTextStart
68
.incbin "incbin/rspbootText"
9+
endlabel rspbootTextStart
710
dlabel rspbootTextEnd

src/code/rspdata.s src/code/rspcode.s

+21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,28 @@
11
.include "macro.inc"
22

3+
.section .text
4+
5+
.balign 16
6+
7+
glabel aspMainTextStart
8+
.incbin "incbin/aspMainText"
9+
endlabel aspMainTextStart
10+
dlabel aspMainTextEnd
11+
12+
glabel gspS2DEX2_fifoTextStart
13+
.incbin "incbin/gspS2DEX2_fifoText"
14+
endlabel gspS2DEX2_fifoTextStart
15+
dlabel gspS2DEX2_fifoTextEnd
16+
17+
glabel njpgdspMainTextStart
18+
.incbin "incbin/njpgdspMainText"
19+
endlabel njpgdspMainTextStart
20+
dlabel njpgdspMainTextEnd
21+
322
.section .rodata
423

24+
.balign 16
25+
526
dlabel aspMainDataStart
627
.incbin "incbin/aspMainData"
728
dlabel aspMainDataEnd

src/code/rsptext.s

-15
This file was deleted.

src/code/z_rumble.c

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
#include "global.h"
1111
#include "z64rumble.h"
1212

13+
#pragma increment_block_number "n64-us:128"
14+
15+
static s32 sBssPad[4];
1316
RumbleManager gRumbleMgr;
1417

1518
void Rumble_Update(void* arg0) {

src/code/z_skin.c

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
// 60 is an arbitrary number which specifies the max amount of limbs per skeleton this system supports
1111
MtxF gSkinLimbMatrices[60];
1212

13-
static s32 sBssPad;
14-
1513
void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos) {
1614
SkinVertex* vertexEntry;
1715
Vtx* vtx;

src/libultra/gu/position.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
* Creates a rotation/parallel translation modelling matrix (floating point)
77
*/
88
void guPositionF(f32 mf[4][4], f32 rot, f32 pitch, f32 yaw, f32 scale, f32 x, f32 y, f32 z) {
9-
static f32 D_80134D00 = M_PIf / 180.0f;
9+
static f32 dtor = M_PIf / 180.0f;
1010
f32 sinr;
1111
f32 sinp;
1212
f32 sinh;
1313
f32 cosr;
1414
f32 cosp;
1515
f32 cosh;
1616

17-
rot *= D_80134D00;
18-
pitch *= D_80134D00;
19-
yaw *= D_80134D00;
17+
rot *= dtor;
18+
pitch *= dtor;
19+
yaw *= dtor;
2020

2121
sinr = sinf(rot);
2222
cosr = cosf(rot);

tools/disasm/disasm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2229,7 +2229,7 @@ def find_late_rodata_start(rodata):
22292229
data_size = 0x80800000 - file_list[full_index]
22302230
elif segment[0] == "boot" and name == "vimgr" and segment[3][i][2] == "bss":
22312231
# This is the end of boot, hardcode it
2232-
data_size = 0x800A5AC0 - file_list[full_index]
2232+
data_size = 0x8009F8B0 - file_list[full_index]
22332233
else:
22342234
data_size = file_list[full_index + 1] - file_list[full_index]
22352235

tools/disasm/files.txt

+21-21
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,6 @@
2121
0x80080000 : "entry",
2222
},
2323
],
24-
['dmadata', None, 'dmadata',
25-
[
26-
[0x8009F8B0, 0x800A5AB0, 'dmadata', None],
27-
[0x800A5AB0, 0x800A5AC0, 'bss', None],
28-
],
29-
{
30-
0x8009F8B0 : "dmadata",
31-
},
32-
],
3324
['boot', None, 'boot',
3425
[
3526
[0x80080060, 0x800969C0, 'text', None],
@@ -243,9 +234,9 @@
243234
0x800968B0 : "strcmp",
244235
0x800968F0 : "strcpy",
245236
0x80096930 : "memmove",
237+
0x800969C0 : "rspboot",
246238

247239
# .data section
248-
0x800969C0 : "rspboot",
249240
0x80096B20 : "idle",
250241
0x80096B40 : "carthandle",
251242
0x80096B50 : "z_std_dma",
@@ -269,8 +260,8 @@
269260
0x80097E50 : "initialize",
270261
0x80097E70 : "pimgr",
271262
0x80097EA0 : "piacs",
272-
0x80097EB0 : "contpfs",
273263
0x80097EB0 : "vimodentschpn1",
264+
0x80097F00 : "contpfs",
274265
0x80097F10 : "seteventmesg",
275266
0x80097F20 : "xprintf",
276267
0x80097F70 : "timerintr",
@@ -283,7 +274,7 @@
283274
0x80098060 : "vi",
284275
0x800980D0 : "cartrominit",
285276
0x800980E0 : "vimodefpallan1",
286-
0x80098130 : "xldtob",
277+
0x80098130 : "xlitob",
287278
0x80098160 : "vimgr",
288279
0x80098180 : "voicecontrolgain",
289280

@@ -296,6 +287,7 @@
296287
0x80098280 : "CIC6105",
297288
0x800982B0 : "fault",
298289
0x80098C50 : "fault_drawer",
290+
0x80099080 : "stackcheck",
299291
0x80099090 : "gfxprint",
300292
0x800990B0 : "debug",
301293
0x800990C0 : "math64",
@@ -342,6 +334,15 @@
342334
0x8009E690 : "vimgr",
343335
},
344336
],
337+
['dmadata', None, 'dmadata',
338+
[
339+
[0x8009F8B0, 0x800A5AB0, 'dmadata', None],
340+
[0x800A5AB0, 0x800A5AC0, 'bss', None],
341+
],
342+
{
343+
0x8009F8B0 : "dmadata",
344+
},
345+
],
345346
['code', None, 'code',
346347
[
347348
[0x800A5AC0, 0x801AAAB0, 'text', ((0x80186028, 0x80186A70, 'data', None, None, None),)],
@@ -382,7 +383,7 @@
382383
0x800EFE60 : "z_eff_footmark",
383384
0x800F0390 : "z_sound_source",
384385
0x800F05C0 : "z_elf_message",
385-
0x800F07C0 : "z_en_hy",
386+
0x800F07C0 : "z_en_hy_code",
386387
0x800F1250 : "z_face_reaction",
387388
0x800F12D0 : "z_env_flags",
388389
0x800F1460 : "z_eventmgr",
@@ -500,17 +501,17 @@
500501
0x801A4EB0 : "voice_external",
501502
0x801A51F0 : "voice_internal",
502503
0x801A5BC0 : "[PADDING]",
503-
0x801A5BD0 : "code_801A5BD0",
504+
0x801A5BD0 : "sfx",
504505
0x801A7B10 : "sequence",
505506
0x801A9B10 : "jpegutils",
506507
0x801AA020 : "jpegdecoder",
507508
0x801AA610 : "z_game_over",
508509
0x801AAAA0 : "z_construct",
509-
510-
# .data section
511510
0x801AAAB0 : "aspMain",
512511
0x801ABAB0 : "gspS2DEX2.fifo",
513512
0x801AD370 : "njpgdspMain",
513+
514+
# .data section
514515
0x801ADE60 : "z_en_a_keep",
515516
0x801ADEC0 : "z_en_item00",
516517
0x801AE240 : "z_eff_blure",
@@ -588,8 +589,7 @@
588589
0x801D1DE0 : "sys_matrix",
589590
0x801D1E60 : "sys_ucode",
590591
0x801D1E70 : "sys_rumble",
591-
0x801D1E80 : "code_801D1E80",
592-
0x801D2E80 : "audio_data",
592+
0x801D1E80 : "audio_data",
593593
0x801D5FB0 : "audio_synthesis",
594594
0x801D5FE0 : "audio_load",
595595
0x801D5FF0 : "audio_thread",
@@ -601,7 +601,7 @@
601601
0x801D8BE0 : "voice_external",
602602
0x801D8E50 : "voice_internal",
603603
0x801D9090 : "audio_sound_params",
604-
0x801DB470 : "code_801A5BD0",
604+
0x801DB470 : "sfx",
605605
0x801DB4C0 : "sequence",
606606
0x801DB4E0 : "session_config",
607607

@@ -682,7 +682,7 @@
682682
0x801E0540 : "audio_seqplayer",
683683
0x801E0BD0 : "code_8019AF00",
684684
0x801E0EC0 : "voice_internal",
685-
0x801E1050 : "code_801A5BD0",
685+
0x801E1050 : "sfx",
686686
0x801E1070 : "sequence",
687687
0x801E1100 : "session_config",
688688
0x801E1110 : "z_game_over",
@@ -748,7 +748,7 @@
748748
0x801FD140 : "audio_load",
749749
0x801FD1F0 : "code_8019AF00",
750750
0x801FD5A0 : "voice_internal",
751-
0x801FD710 : "code_801A5BD0",
751+
0x801FD710 : "sfx",
752752
0x801FFD00 : "sequence",
753753
0x80200BE0 : "session_config",
754754
0x80208E90 : "jpegdecoder",

tools/disasm/functions.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
0x80082330:("Fault_PrintFPCSR",),
7070
0x800823D4:("Fault_LogFPCSR",),
7171
0x8008246C:("Fault_PrintThreadContext",),
72-
0x800827BC:("osSyncPrintfThreadContext",),
72+
0x800827BC:("Fault_LogThreadContext",),
7373
0x80082AB8:("Fault_FindFaultedThread",),
7474
0x80082B40:("Fault_Wait5Seconds",),
7575
0x80082BD0:("Fault_WaitForButtonCombo",),

tools/sizes/boot_functions.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ asm/non_matchings/boot/fault/Fault_LogFReg.s,Fault_LogFReg,0x80082280,0x2C
6666
asm/non_matchings/boot/fault/Fault_PrintFPCSR.s,Fault_PrintFPCSR,0x80082330,0x29
6767
asm/non_matchings/boot/fault/Fault_LogFPCSR.s,Fault_LogFPCSR,0x800823D4,0x26
6868
asm/non_matchings/boot/fault/Fault_PrintThreadContext.s,Fault_PrintThreadContext,0x8008246C,0xD4
69-
asm/non_matchings/boot/fault/osSyncPrintfThreadContext.s,osSyncPrintfThreadContext,0x800827BC,0xBF
69+
asm/non_matchings/boot/fault/Fault_LogThreadContext.s,Fault_LogThreadContext,0x800827BC,0xBF
7070
asm/non_matchings/boot/fault/Fault_FindFaultedThread.s,Fault_FindFaultedThread,0x80082AB8,0x22
7171
asm/non_matchings/boot/fault/Fault_Wait5Seconds.s,Fault_Wait5Seconds,0x80082B40,0x24
7272
asm/non_matchings/boot/fault/Fault_WaitForButtonCombo.s,Fault_WaitForButtonCombo,0x80082BD0,0x27

0 commit comments

Comments
 (0)