This commit is contained in:
Rainchus 2023-05-18 04:16:40 -05:00
commit 1ee1dff3c8
46 changed files with 441 additions and 177 deletions

View File

@ -16,7 +16,7 @@
"limitSymbolsToIncludedHeaders": true,
"path": [
"${workspaceFolder}/include/**",
"${workspaceFolder}/src/**",
"${workspaceFolder}/src/**"
]
},
"includePath": [
@ -30,7 +30,8 @@
"_MIPS_SZLONG=32"
],
"cStandard": "gnu89",
"intelliSenseMode": "${default}"
"intelliSenseMode": "${default}",
"configurationProvider": "ms-vscode.makefile-tools"
}
]
}

View File

@ -20,6 +20,8 @@ optO1_files = [
'vimgr.c'
]
optg0_files = ['DA68F0.c']
c_files = []
for root, dirs, files in os.walk(dir_path):
for file in files:
@ -96,6 +98,10 @@ ninja_file.rule('main_cc',
command = '$ASM_PROC $ASM_PROC_FLAGS $ido_cc -- $AS $ASFLAGS -- -c -32 $cflags $DEFINES $CFLAGS -O2 -g3 $mips_version -o $out $in',
description = 'Compiling -O2 .c file' )
#doesn't have -g3
ninja_file.rule('O2g0_cc',
command = '$ASM_PROC $ASM_PROC_FLAGS $ido_cc -- $AS $ASFLAGS -- -c -32 $cflags $DEFINES $CFLAGS -O2 -g0 $mips_version -o $out $in',
description = 'Compiling -O2 -g0 .c file')
ninja_file.rule('O2_cc',
command = '$ASM_PROC $ASM_PROC_FLAGS $ido_cc -- $AS $ASFLAGS -- -c -32 $cflags $DEFINES $CFLAGS -O2 $mips_version -o $out $in',
description = 'Compiling -O2 .c file' )
@ -103,7 +109,7 @@ ninja_file.rule('O2_cc',
ninja_file.rule('O1_cc',
command = '$ASM_PROC $ASM_PROC_FLAGS $ido_cc -- $AS $ASFLAGS -- -c -32 $cflags $DEFINES $CFLAGS -O1 $mips_version -o $out $in',
description = 'Compiling -O1 .c file' )
ninja_file.rule('s_file',
command = 'iconv --from UTF-8 --to EUC-JP $in | $AS $ASFLAGS -o $out',
description = 'Assembling .s file' )
@ -133,12 +139,15 @@ ninja_file.rule('rgba16_convert',
ninja_file.rule('rgba16_build',
command = "($LD -r -b binary -o $out $in)",
description = "Converting rgba16")
print (c_files)
for c_file in c_files:
if os.path.basename(c_file) in optO2_files:
ninja_file.build("build/" + append_extension(c_file), "O2_cc", c_file)
elif os.path.basename(c_file) in optO1_files:
ninja_file.build("build/" + append_extension(c_file), "O1_cc", c_file)
elif os.path.basename(c_file) in optg0_files:
ninja_file.build("build/" + append_extension(c_file), "O2g0_cc", c_file)
else:
ninja_file.build("build/" + append_extension(c_file), "main_cc", c_file)
for s_file in s_files:

View File

@ -73,7 +73,7 @@ typedef struct {
typedef struct {
/* 0x0 */ u16 actionID;
/* 0x2 */ u16 actionTimer;
/* 0x2 */ s16 actionTimer;
/* 0x4 */ u16 unk4;
/* 0x6 */ u16 unk6;
/* 0x8 */ u16 unk8;

View File

@ -30,14 +30,14 @@ segments:
- [0xC120, c]
- [0xC910, c]
- [0xFA60, c]
- [0x12450, c, shadow ]
- [0x12450, c, shadow]
- [0x12740, c]
- [0x15440, c]
- [0x191F0, c]
- [0x1BCD0, c]
- [0x1D160, c]
- [0x1E4B0, c]
- [0x1EDF0, c]
- [0x1EDF0, c, hud]
- [0x21D70, c, inventory]
- [0x234E0, c, screen_dim]
- [0x23740, c]
@ -52,25 +52,25 @@ segments:
- [0x31F00, c]
- [0x32840, c]
- [0x328F0, c]
- [0x34450, c, initialize]
- [0x346E0, c, createthread]
- [0x34830, c, startthread]
- [0x34980, c, pimgr] #migrate bss to finish
- [0x34B10, c, createmesgqueue]
- [0x34B40, c, visetevent]
- [0x34450, c, os/initialize]
- [0x346E0, c, os/createthread]
- [0x34830, c, os/startthread]
- [0x34980, c, os/pimgr] #migrate bss to finish
- [0x34B10, c, os/createmesgqueue]
- [0x34B40, c, os/visetevent]
- [0x34BB0, asm, seteventmesg]
- [0x34C20, asm, recvmesg]
- [0x34D60, asm, setintmask] #handwritten
- [0x34E00, asm, sendmesg]
- [0x34F50, asm, writebackdcacheall] #handwritten
- [0x34F80, c, sptaskyield]
- [0x34FA0, c, sptaskyielded]
- [0x35020, c, sptask]
- [0x352E0, c, viblack]
- [0x35350, c, viswapbuf]
- [0x353A0, c, vigetcurrframebuf]
- [0x34F80, c, os/sptaskyield]
- [0x34FA0, c, os/sptaskyielded]
- [0x35020, c, os/sptask]
- [0x352E0, c, os/viblack]
- [0x35350, c, os/viswapbuf]
- [0x353A0, c, os/vigetcurrframebuf]
#- [0x353E0, hasm]
- [0x35440, c, vimgr]
- [0x35440, c, os/vimgr]
- [0x357A0, asm, visetmode]
- [0x35810, asm, visetspecial]
- [0x359D0, asm, virtualtophysical]
@ -96,17 +96,17 @@ segments:
- [0x372C0, asm, aisetfreq]
- [0x374E0, asm, seqpsetvol]
- [0x37520, asm, synthesizer]
- [0x37C00, c, aigetlen]
- [0x37C00, c, os/aigetlen]
- [0x37C10, asm, aisetnextbuf]
- [0x37CC0, asm, n_alseqpgetvol]
- [0x37CD0, c, csplayer]
- [0x37CD0, c, os/csplayer]
- [0x38F00, asm, bnkf]
- [0x39150, asm, seqpsetbank]
- [0x39190, asm, cseq]
- [0x39C50, asm, cspsetseq]
- [0x39C90, asm, seqpplay]
- [0x39CC0, asm, seqpstop]
- [0x39CF0, c, seqpgetstate]
- [0x39CF0, c, os/seqpgetstate]
- [0x39D00, asm, sndplayer]
- [0x3A410, asm, sndpallocate]
- [0x3A4B0, asm, sndpsetsound]
@ -119,17 +119,17 @@ segments:
- [0x3A6D0, asm, ll]
- [0x3A990, asm, pfsinitpak]
- [0x3AC00, asm, motor]
- [0x3B3A0, c, syncprintf]
- [0x3B3E0, c, controller]
- [0x3B3A0, c, os/syncprintf]
- [0x3B3E0, c, os/controller]
- [0x3B7A0, asm, contsetch]
- [0x3B810, asm, contreaddata]
- [0x3BA30, c, pfsfilestate]
- [0x3BD20, c, pfsfreeblocks]
- [0x3BE70, c, pfsallocatefile]
- [0x3C620, c, pfsdeletefile]
- [0x3CC30, c, pfsreadwritefile]
- [0x3BA30, c, os/pfsfilestate]
- [0x3BD20, c, os/pfsfreeblocks]
- [0x3BE70, c, os/pfsallocatefile]
- [0x3C620, c, os/pfsdeletefile]
- [0x3CC30, c, os/pfsreadwritefile]
- [0x3D130, asm, __osGetId]
- [0x3D390, c, pfsnumfiles]
- [0x3D390, c, os/pfsnumfiles]
- [0x3D4E0, asm, contquery]
- [0x3D590, asm, setsr]
- [0x3D5A0, asm, getsr]
@ -143,7 +143,7 @@ segments:
- [0x3E0D0, asm, interrupt]
- [0x3E110, asm, thread]
- [0x3E150, asm, cartrominit]
- [0x3E250, c, leodiskinit]
- [0x3E250, c, os/leodiskinit]
- [0x3E350, asm, siacsDuplicate]
- [0x3E410, asm, getthreadpri]
- [0x3E430, asm, setthreadpri]
@ -189,16 +189,16 @@ segments:
- [0x452C0, asm, synsetfxmix]
- [0x45360, asm, synstartvoice]
- [0x453F0, asm, siacs]
- [0x454B0, c, pfsgetstatus]
- [0x456F0, c, contpfs]
- [0x46450, c, contramread]
- [0x467B0, c, pfschecker]
- [0x47210, c, pfsisplug]
- [0x454B0, c, os/pfsgetstatus]
- [0x456F0, c, os/contpfs]
- [0x46450, c, os/contramread]
- [0x467B0, c, os/pfschecker]
- [0x47210, c, os/pfsisplug]
- [0x47550, asm, sirawdma]
- [0x47600, asm, crc]
- [0x47780, asm, contramwrite]
- [0x47AE0, asm, settimer]
- [0x47BC0, c, pfssearchfile]
- [0x47BC0, c, os/pfssearchfile]
- [0x47D80, asm, si]
- [0x47DB0, asm, leointerrupt]
- [0x48630, asm, destroythread]
@ -273,12 +273,16 @@ segments:
- [0x873F20, bin, npcs/NPC_Blob]
- [0xA725D0, bin, npcs/actor_Shannon]
- [0xA7A190, bin, monsters/HolyPlainsMonsters]
- [0xADC420, bin, monsters/DondoranMonsters]
- [0xB637E0, bin, monsters/BlueCaveMonsters]
- [0xBBE1E0, bin, monsters/DesertMonsters]
- [0xC31BD0, bin, monsters/NormoonMonsters]
- [0xC9C1D0, bin, monsters/MammonMonsters]
- [0xA7A190, bin, monsters/HolyPlains/data]
- [0xAB7540, bin, monsters/HolyPlains/textures/textures.rgba16]
- [0xACD430, bin, monsters/HolyPlains/dls/models.f3dex]
- [0xADBEE0, bin, monsters/HolyPlains/endData]
- [0xADC420, bin, monsters/Dondoran/data]
- [0xB637E0, bin, monsters/BlueCave/data]
- [0xBBE1E0, bin, monsters/Desert/data]
- [0xC31BD0, bin, monsters/Normoon/data]
- [0xC9C1D0, bin, monsters/Mammon/data]
- [0xCC4570, bin, bosses/nepty/data]
- [0xCCA8B0, rgba16, bosses/nepty/textures/ear_upper.rgba16, 24, 32]
@ -294,11 +298,29 @@ segments:
- [0xCCC9B0, rgba16, bosses/nepty/textures/unk6.rgba16, 16, 32]
- [0xCCCDB0, rgba16, bosses/nepty/textures/hand.rgba16, 16, 16]
- [0xCCCFB0, rgba16, bosses/nepty/textures/unk8.rgba16, 16, 32]
- [0xCCD3B0, bin, bosses/nepty/dls/model]
- [0xCCD3B0, bin, bosses/nepty/dls/head.f3dex]
- [0xCCDBC0, bin, bosses/nepty/dls/neck.f3dex]
- [0xCCDD50, bin, bosses/nepty/dls/bust.f3dex]
- [0xCCE210, bin, bosses/nepty/dls/torso_and_cape.f3dex]
- [0xCCE5C0, bin, bosses/nepty/dls/left_shoulder.f3dex]
- [0xCCE6C0, bin, bosses/nepty/dls/left_upper_arm.f3dex]
- [0xCCE7B0, bin, bosses/nepty/dls/left_forearm_and_hand.f3dex]
- [0xCCE960, bin, bosses/nepty/dls/right_shoulder.f3dex]
- [0xCCEA60, bin, bosses/nepty/dls/right_upper_arm.f3dex]
- [0xCCEB50, bin, bosses/nepty/dls/right_forearm_and_hand.fedex]
- [0xCCED00, bin, bosses/nepty/dls/left_upper_leg.f3dex]
- [0xCCEE10, bin, bosses/nepty/dls/left_lower_leg.f3dex]
- [0xCCEFD0, bin, bosses/nepty/dls/left_foot.f3dex]
- [0xCCF0B0, bin, bosses/nepty/dls/right_upper_leg.f3dex]
- [0xCCF1C0, bin, bosses/nepty/dls/right_lower_leg.f3dex]
- [0xCCF380, bin, bosses/nepty/dls/right_foot.f3dex]
#a few of these seem to be unreferenced, and don't render correctly in texture64
- [0xCCF460, bin, bosses/boss_Solvaring]
- [0xCCF460, bin, bosses/solvaring/data]
- [0xCD65E0, rgba16, bosses/solvaring/textures/arm_shield.rgba16, 24, 32]
- [0xCD6BE0, rgba16, bosses/solvaring/textures/arm_cloth.rgba16, 16, 16]
- [0xCD6DE0, rgba16, bosses/solvaring/textures/cape.rgba16, 32, 32]
@ -311,12 +333,12 @@ segments:
- [0xCD8160, rgba16, bosses/solvaring/textures/belt.rgba16, 16, 16]
- [0xCD8360, rgba16, bosses/solvaring/textures/pelt_eye.rgba16, 16, 16]
- [0xCD8560, rgba16, bosses/solvaring/textures/pants_cloth.rgba16, 16, 16]
- [0xCD8760, bin, bosses/solvaring/textures/unk4.rgba16]
- [0xCD8960, bin, bosses/solvaring/textures/unk5.rgba16]
- [0xCD8760, rgba16, bosses/solvaring/textures/unk4.rgba16, 16, 16]
- [0xCD8960, rgba16, bosses/solvaring/textures/unk5.rgba16, 8, 32]
- [0xCD8B60, rgba16, bosses/solvaring/textures/pelt_ear.rgba16, 8, 8]
- [0xCD8BE0, rgba16, bosses/solvaring/textures/skin.rgba16, 16, 32]
- [0xCD8FE0, rgba16, bosses/solvaring/textures/chest_armor.rgba16, 16, 16]
- [0xCD91E0, bin, bosses/solvaring/textures/unk6.rgba16]
- [0xCD91E0, rgba16, bosses/solvaring/textures/unk6.rgba16, 16, 16]
- [0xCD93E0, bin, bosses/solvaring/dls/model]
- [0xCDB730, bin, bosses/zelse/data]
@ -346,12 +368,64 @@ segments:
- [0xCF0530, rgba16, bosses/shilf/textures/sash.rgba16, 8, 16]
- [0xCF0630, bin, bosses/shilf/dls/model]
- [0xCF2A10, bin, bosses/fargo/data]
- [0xCFA1E0, rgba16, bosses/fargo/textures/hair.rgba16, 16, 32]
- [0xCFA5E0, rgba16, bosses/fargo/textures/unk1.rgba16, 8, 8]
- [0xCFA660, rgba16, bosses/fargo/textures/unk2.rgba16, 16, 16]
- [0xCFA860, rgba16, bosses/fargo/textures/unk3.rgba16, 8, 8]
- [0xCFA8E0, rgba16, bosses/fargo/textures/face.rgba16, 32, 32]
- [0xCFB0E0, rgba16, bosses/fargo/textures/unk4.rgba16, 8, 8]
- [0xCFB160, rgba16, bosses/fargo/textures/unk5.rgba16, 32, 64]
- [0xCFC160, rgba16, bosses/fargo/textures/unk6.rgba16, 16, 24]
- [0xCFC460, rgba16, bosses/fargo/textures/unk7.rgba16, 8, 8]
- [0xCFC4E0, rgba16, bosses/fargo/textures/unk10.rgba16, 8, 8]
- [0xCFC560, rgba16, bosses/fargo/textures/unk11.rgba16, 24, 24]
- [0xCFC9E0, rgba16, bosses/fargo/textures/unk12.rgba16, 16, 24]
- [0xCFCCE0, rgba16, bosses/fargo/textures/unk13.rgba16, 16, 48]
- [0xCFD2E0, rgba16, bosses/fargo/textures/unk14.rgba16, 24, 24]
- [0xCFD760, rgba16, bosses/fargo/textures/unk8.rgba16, 16, 16]
- [0xCFD960, rgba16, bosses/fargo/textures/unk9.rgba16, 8, 16]
- [0xCFDA60, bin, bosses/fargo/dls/model]
- [0xD006B0, bin, bosses/guilty/data]
- [0xD0A670, rgba16, bosses/guilty/textures/unk1.rgba16, 16, 16]
- [0xD0A870, rgba16, bosses/guilty/textures/unk2.rgba16, 16, 16]
- [0xD0AA70, rgba16, bosses/guilty/textures/unk3.rgba16, 16, 16]
- [0xD0AC70, rgba16, bosses/guilty/textures/unk4.rgba16, 16, 16]
- [0xD0AE70, rgba16, bosses/guilty/textures/unk9.rgba16, 16, 16]
- [0xD0B070, rgba16, bosses/guilty/textures/unk5.rgba16, 16, 16]
- [0xD0B270, rgba16, bosses/guilty/textures/unk6.rgba16, 32, 32]
- [0xD0BA70, rgba16, bosses/guilty/textures/grass_cloak.rgba16, 32, 32]
- [0xD0C270, rgba16, bosses/guilty/textures/unk7.rgba16, 16, 24]
- [0xD0C570, rgba16, bosses/guilty/textures/unk8.rgba16, 16, 16]
- [0xD0C770, bin, bosses/guilty/dls/model]
- [0xCF2A10, bin, bosses/boss_Fargo]
- [0xD006B0, bin, bosses/boss_Guilty]
- [0xD0FEE0, bin, bosses/boss_Mammon]
- [0xD237F0, bin, bosses/boss_Beigis]
- [0xD0FEE0, bin, bosses/mammon/data]
- [0xD1D5E0, rgba16, bosses/mammon/textures/unk1.rgba16, 32, 32]
- [0xD1DDE0, rgba16, bosses/mammon/textures/unk2.rgba16, 16, 16]
- [0xD1DFE0, rgba16, bosses/mammon/textures/unk3.rgba16, 16, 24]
- [0xD1E2E0, rgba16, bosses/mammon/textures/unk4.rgba16, 8, 16]
- [0xD1E3E0, rgba16, bosses/mammon/textures/unk5.rgba16, 16, 16]
- [0xD1E5E0, rgba16, bosses/mammon/textures/unk6.rgba16, 32, 32]
- [0xD1EDE0, rgba16, bosses/mammon/textures/unk7.rgba16, 16, 16]
- [0xD1EFE0, rgba16, bosses/mammon/textures/unk8.rgba16, 16, 24]
- [0xD1F2E0, rgba16, bosses/mammon/textures/unk9.rgba16, 8, 16]
- [0xD1F3E0, rgba16, bosses/mammon/textures/unk10.rgba16, 16, 32]
- [0xD1F7E0, rgba16, bosses/mammon/textures/unk11.rgba16, 8, 16]
- [0xD1F8E0, rgba16, bosses/mammon/textures/wings.rgba16, 32, 32]
- [0xD200E0, bin, bosses/mammon/dls/model]
- [0xD237F0, bin, bosses/beigis/data]
- [0xD2C8F0, rgba16, bosses/beigis/textures/unk1.rgba16, 16, 16]
- [0xD2CAF0, rgba16, bosses/beigis/textures/unk2.rgba16, 16, 16]
- [0xD2CCF0, rgba16, bosses/beigis/textures/unk3.rgba16, 8, 8]
- [0xD2CD70, bin, bosses/beigis/textures/unk4.rgba16]
- [0xD2D2F0, rgba16, bosses/beigis/textures/unk5.rgba16, 16, 32]
- [0xD2D6F0, rgba16, bosses/beigis/textures/unk6.rgba16, 16, 16]
- [0xD2D8F0, rgba16, bosses/beigis/textures/unk7.rgba16, 32, 32]
- [0xD2E0F0, rgba16, bosses/beigis/textures/unk8.rgba16, 16, 16]
- [0xD2E2F0, rgba16, bosses/beigis/textures/unk9.rgba16, 16, 32]
- [0xD2E6F0, bin, bosses/beigis/dls/model]
- [0xD305E0, bin, npcs/NPC_Msg]
@ -388,8 +462,79 @@ segments:
- [0xD3E2C0, bin, text/font_tbl]
- [0xD4B3C0, bin]
- [0xDA99F8, bin]
- type: code
start: 0xDA68F0
vram: 0x80100000
dir: ovl_overlay1
name: overlay1
overlay: True
exclusive_ram_id: cutscene
symbol_name_format: $VRAM_$ROM
subsegments:
- [0xDA68F0, c]
- [0xDA9A20, bin]
- [0xDC15C0, rodata]
- [0xDC15E0, rodata]
- [0xDC1620, bin, overlay2]
#- type: code
# start: 0xDC1620
# vram: 0x80100000
# dir: ovl_overlay2
# name: overlay2
# overlay: True
# exclusive_ram_id: cutscene
# subsegments:
# - [0xDC1620, c]
# - [0xDC7860, data]
# - [0xDC7F2C, c]
# - [0xDC810C, data]
# - [0xDC8134, data]
# - [0xDC815C, c]
# - [0xDC8364, data]
# - [0xDC838C, data]
# - [0xDC83B4, c]
# - [0xDC86FC, data]
# - [0xDC8724, data]
# - [0xDC874C, c]
# - [0xDC8954, data]
# - [0xDC897C, data]
# - [0xDC89A4, data]
# - [0xDC8B0C, data]
# - [0xDC9534, data]
# - [0xDC9AFC, data]
# - [0xDCA27C, data]
# - [0xDCAA24, data]
# - [0xDCAC54, c]
# - [0xDCAE0C, data]
# - [0xDCAE34, data]
# - [0xDCAE5C, c]
# - [0xDCB064, data]
# - [0xDCB08C, data]
# - [0xDCB0B4, c]
# - [0xDCB1F4, data]
# - [0xDCB21C, data]
# - [0xDCBE24, data]
# - [0xDCC1E4, c]
# - [0xDCC39C, data]
# - [0xDCC3C4, data]
# - [0xDCC3EC, c]
# - [0xDCC5F4, data]
# - [0xDCC61C, data]
# - [0xDCC644, data]
# - [0xDCC7AC, data]
#- type: code
# start: 0xE27840
# vram: 0x80100000
# dir: ovl_overlay3
# name: overlay3
# overlay: True
# exclusive_ram_id: cutscene
# subsegments:
# - [0xE27840, c]
- [0xE7E800, bin, Instrument_ctl]
- [0xE81610, bin, Instrument_tbl]
- [0xEEE020, bin, SE_ctl]

View File

@ -33,6 +33,10 @@ typedef struct {
f32 unk10;
}unka3f4s;
extern s32 D_8007BA68;
extern s32 D_8007BA6C;
extern unk232f4s D_8007D0D0;
extern void** D_8007D0A8;
extern void* D_8007D0AC;
extern unkMonsterData* D_8007D0BC;
@ -121,6 +125,29 @@ void func_8000932C(void) {
#pragma GLOBAL_ASM("asm/nonmatchings/97B0/func_80009588.s")
#pragma GLOBAL_ASM("asm/nonmatchings/97B0/func_80009818.s")
/*function matches but does not build. Needs investigation*/
#ifdef NON_MATCHING
void func_80009818(BrianData2* arg0, EnemyAction* arg1, s32 arg2) {
func_8000A7D8(arg0, &D_8007D0D0);
func_8000A508(0, D_8007D0D0.unk0, D_8007D0D0.unk4, (unk202e4s* ) arg0, arg1);
arg1->actionTimer--;
if ((s16) arg1->actionTimer == 0) {
if (arg1->currHP == 0) {
func_800202E4((unk202e4s* ) arg0);
func_8000B170(arg0);
arg0->unk50 = -1;
arg0->unk60 &= 0xFFFE;
D_8007C990 -= 1;
D_8007BA68 += arg0->brianData1->exp;
D_8007BA6C += arg0->brianData1->unk14;
func_800268D4(0, 0xA, 0xFF);
return;
}
arg1->actionID = 0;
arg0->unk60 &= 0xFFFC;
}
}
#endif
#pragma GLOBAL_ASM("asm/nonmatchings/97B0/func_80009934.s")

View File

@ -1,5 +0,0 @@
#include "common.h"
#pragma GLOBAL_ASM("asm/nonmatchings/contramread/__osContRamRead.s")
#pragma GLOBAL_ASM("asm/nonmatchings/contramread/__osPackRamReadData.s")

View File

@ -1,28 +0,0 @@
#include <os_internal.h>
#include <R4300.h>
void __osCleanupThread(void);
extern OSThread *__osActiveQueue;
void osCreateThread(OSThread *t, OSId id, void (*entry)(void *), void *arg, void *sp, OSPri p)
{
register u32 saveMask;
OSIntMask mask;
t->id = id;
t->priority = p;
t->next = NULL;
t->queue = NULL;
t->context.pc = (u32)entry;
t->context.a0 = (u64)arg;
t->context.sp = (u64)sp - 16;
t->context.ra = (u64)__osCleanupThread;
mask = OS_IM_ALL;
t->context.sr = SR_IMASK | SR_EXL | SR_IE;
t->context.rcp = (mask & RCP_IMASK) >> RCP_IMASKSHIFT;
t->context.fpcsr = (u32)(FPCSR_FS | FPCSR_EV);
t->fp = 0;
t->state = OS_STATE_STOPPED;
t->flags = 0;
saveMask = __osDisableInt();
t->tlnext = __osActiveQueue;
__osActiveQueue = t;
__osRestoreInt(saveMask);
}

View File

@ -1,22 +0,0 @@
#include <libaudio.h>
#include <os_internal.h>
#include <ultraerror.h>
#include <assert.h>
#pragma GLOBAL_ASM("asm/nonmatchings/csplayer/__CSPPostNextSeqEvent.s")
#pragma GLOBAL_ASM("asm/nonmatchings/csplayer/func_80037140.s")
void func_80037174(void) {
}
#pragma GLOBAL_ASM("asm/nonmatchings/csplayer/func_8003717C.s")
#pragma GLOBAL_ASM("asm/nonmatchings/csplayer/func_8003734C.s")
void func_80037B74(void) {
}
#pragma GLOBAL_ASM("asm/nonmatchings/csplayer/func_80037B7C.s")
#pragma GLOBAL_ASM("asm/nonmatchings/csplayer/alCSPNew.s")

View File

@ -1,10 +0,0 @@
#include "common.h"
//#pragma GLOBAL_ASM("asm/nonmatchings/deletedfuncs/func_8003A7A0.s")
void func_8003A7A0(s32 arg0, ...) {
}
//#pragma GLOBAL_ASM("asm/nonmatchings/deletedfuncs/func_8003A7BC.s")
void func_8003A7BC(s32 arg0, ...) {
}

View File

@ -155,7 +155,7 @@ void func_800210FC(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s
void func_80020E2C(unk20e2cs* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
void func_80020B4C(temp4* arg0, s32 arg1, s32 arg2, u8* arg3);
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_8001E1F0.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_8001E1F0.s")
void func_8001E1F0(void)
{
D_8008C638 = 0;
@ -167,9 +167,9 @@ void func_8001E1F0(void)
D_8008C65C = 0xF0; //HUD Width
D_8008C630 = 0;
}
#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_8001E25C.s")
#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_8001E25C.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_8001E7FC.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_8001E7FC.s")
void func_8001E7FC(BrianData2 *arg0)
{
s32 temp_lo;
@ -198,7 +198,7 @@ void func_8001E7FC(BrianData2 *arg0)
func_80020F8C(0x2F, 0, 8, 0xA, 0x70, 0x1D, 0x400, 0x400);
func_80020F8C(0x2F, 0x1B, 8, 0xA, 0x70, 0x1D, 0x400, 0x400);
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_8001EA84.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_8001EA84.s")
void func_8001EA84(Mtx *arg0) {
MtxF sp38;
@ -220,7 +220,7 @@ void func_8001EA84(Mtx *arg0) {
//Pointer to texture, X, Y, NumPixelsX, NumPixelsY, SheetLocationX, unknown, resolutionX, resolutionY
func_800210FC((s32) &gTex_HUD_and_Menu, 0xD, 0xA, 0xB, 0xE, 0x93, 0, 0x400, 0x400);
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_8001EBDC.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_8001EBDC.s")
void func_8001EBDC(unk1ebdcs* arg0) {
s32 var_s0;
s32 i;
@ -239,9 +239,9 @@ void func_8001EBDC(unk1ebdcs* arg0) {
var_s0 += 0x16;
}
}
#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_8001ED5C.s")
#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_8001ED5C.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_8001F3DC.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_8001F3DC.s")
void func_8001F3DC(unk1f3dcTEST* arg0) {
s32 var_t9;
unk1f3dcTEST2* temp_v0_14;
@ -299,7 +299,7 @@ void func_8001F3DC(unk1f3dcTEST* arg0) {
}
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_8001F818.s") //Matched by rainchus
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_8001F818.s") //Matched by rainchus
void func_8001F818(void) {
s32 sp34; //probably a struct of 8 size to align stack
Vec3f* temp_v0;
@ -315,7 +315,7 @@ void func_8001F818(void) {
D_8008C644 = 0xF0;
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_8001F900.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_8001F900.s")
void func_8001F900(void) {
s32 sp34;
s32 sp30;
@ -325,7 +325,7 @@ void func_8001F900(void) {
func_80020F8C(sp34, sp30 - 0x1E, 0x18, 0x1E, 0, 0, 0x400, 0x400);
}
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_8001F9B0.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_8001F9B0.s")
//displays exclamation mark above brian's head
void func_8001F9B0(void) {
@ -338,7 +338,7 @@ void func_8001F9B0(void) {
func_80020F8C(sp34, sp30 - 0x1E, 0x10, 0x1E, 0, 0, 0x400, 0x400);
}
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_8001FA60.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_8001FA60.s")
/*This is set as non-matching until the enemy data structs are fixed*/
void func_8001FA60(u16 monsterNum) {
@ -370,7 +370,7 @@ void func_8001FA60(u16 monsterNum) {
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_8001FB94.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_8001FB94.s")
void func_8001FB94(void) {
s32 sp5C;
@ -399,11 +399,11 @@ void func_8001FB94(void) {
}
}
#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_8001FCF8.s")
#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_8001FCF8.s")
#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_8001FEEC.s")
#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_8001FEEC.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_800202E4.s")//Matched by EllipticEllipsis and StuckPixel
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_800202E4.s")//Matched by EllipticEllipsis and StuckPixel
void func_800202E4(unk202e4s *arg0)
{
u32 i;
@ -443,7 +443,7 @@ void func_800203C0(void) {
void func_800203C8(void) {
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_800203D0.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_800203D0.s")
void func_800203D0(void)
{
unk20e2cs *new_var;
@ -487,7 +487,7 @@ void func_800203D0(void)
}
}
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/Init_MISS_Icon.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/Init_MISS_Icon.s")
void Init_MISS_Icon(void) {
MissIcon* missIconData;
s32 var_v1;
@ -501,7 +501,7 @@ void Init_MISS_Icon(void) {
var_v1--;
}
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/Setup_MISS_Icon.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/Setup_MISS_Icon.s")
/*may be a different struct for the argument since it also applies to the MISS above Brian, but this works for now*/
void Setup_MISS_Icon(MonsterBattleData* arg0) {
MonsterBaseData* monsterData;
@ -530,7 +530,7 @@ void Setup_MISS_Icon(MonsterBattleData* arg0) {
missIconData->height = 0xE;
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/Draw_MISS_Icon.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/Draw_MISS_Icon.s")
void Draw_MISS_Icon(void)
{
@ -576,7 +576,7 @@ void Draw_MISS_Icon(void)
}
}
#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_80020B4C.s")
#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_80020B4C.s")
/*This DOES match, I just have to fix a ton of errors in other functions to make it work.*/
#ifdef NON_MATCHING
@ -621,7 +621,7 @@ void func_80020B4C(temp4* arg0, s32 arg1, s32 arg2, u8* arg3) {
}
#endif
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_80020D18.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_80020D18.s")
s32 func_80020D18(u8* arg0) {
s32 ret;
u8 val;
@ -640,7 +640,7 @@ s32 func_80020D18(u8* arg0) {
return ret;
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_80020D4C.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_80020D4C.s")
void func_80020D4C(u16 arg0, s32 arg1, s32 arg2, s32 arg3)
{
u8 *var_s1;
@ -668,7 +668,7 @@ void func_80020D4C(u16 arg0, s32 arg1, s32 arg2, s32 arg3)
void func_80020E24(void) {
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_80020E2C.s") //Assist by StuckPixel
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_80020E2C.s") //Assist by StuckPixel
/*This function sets up the graphics pipeline for loading a texture image and rendering it to the screen.*/
void func_80020E2C(unk20e2cs* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
@ -681,7 +681,7 @@ void func_80020E2C(unk20e2cs* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
gDPSetTileSize(gMasterGfxPos++, G_TX_RENDERTILE, arg1 * 4, arg2 * 4, (arg1 + arg3) * 4, (arg2 + arg4) * 4);
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_80020F8C.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_80020F8C.s")
void func_80020F8C(s32 ulx, s32 uly, s32 lrx, s32 lry, s32 s, s32 t, s32 dsdx, s32 dtdy)
{
ulx += gHUDResolutionX;
@ -715,7 +715,7 @@ void func_80020F8C(s32 ulx, s32 uly, s32 lrx, s32 lry, s32 s, s32 t, s32 dsdx, s
}
dummy_label_814065: ;
}
//#pragma GLOBAL_ASM("asm/nonmatchings/1EDF0/func_800210FC.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/hud/func_800210FC.s")
void func_800210FC(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8) {
func_80020E2C((unk20e2cs* ) arg0, arg5, arg6, arg3, arg4);
func_80020F8C(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);

5
src/os/contramread.c Normal file
View File

@ -0,0 +1,5 @@
#include "common.h"
#pragma GLOBAL_ASM("asm/nonmatchings/os/contramread/__osContRamRead.s")
#pragma GLOBAL_ASM("asm/nonmatchings/os/contramread/__osPackRamReadData.s")

View File

@ -19,7 +19,7 @@ OSMesgQueue __osEepromTimerQ;
OSMesg __osEepromTimerMsg;
*/
#pragma GLOBAL_ASM("asm/nonmatchings/controller/osContInit.s")
#pragma GLOBAL_ASM("asm/nonmatchings/os/controller/osContInit.s")
/*s32 osContInit(OSMesgQueue* mq, u8* bitpattern, OSContStatus* data) {
OSMesg dummy;
s32 ret = 0;
@ -58,6 +58,6 @@ OSMesg __osEepromTimerMsg;
return ret;
}*/
#pragma GLOBAL_ASM("asm/nonmatchings/controller/__osContGetInitData.s")
#pragma GLOBAL_ASM("asm/nonmatchings/os/controller/__osContGetInitData.s")
#pragma GLOBAL_ASM("asm/nonmatchings/controller/__osPackRequestData.s")
#pragma GLOBAL_ASM("asm/nonmatchings/os/controller/__osPackRequestData.s")

22
src/os/csplayer.c Normal file
View File

@ -0,0 +1,22 @@
#include <libaudio.h>
#include <os_internal.h>
#include <ultraerror.h>
#include <assert.h>
#pragma GLOBAL_ASM("asm/nonmatchings/os/csplayer/__CSPPostNextSeqEvent.s")
#pragma GLOBAL_ASM("asm/nonmatchings/os/csplayer/func_80037140.s")
void func_80037174(void) {
}
#pragma GLOBAL_ASM("asm/nonmatchings/os/csplayer/func_8003717C.s")
#pragma GLOBAL_ASM("asm/nonmatchings/os/csplayer/func_8003734C.s")
void func_80037B74(void) {
}
#pragma GLOBAL_ASM("asm/nonmatchings/os/csplayer/func_80037B7C.s")
#pragma GLOBAL_ASM("asm/nonmatchings/os/csplayer/alCSPNew.s")

View File

@ -2,7 +2,7 @@
#include <os_internal.h>
#include <R4300.h>
#include <rcp.h>
#pragma GLOBAL_ASM("asm/nonmatchings/initialize/osInitialize.s")
#pragma GLOBAL_ASM("asm/nonmatchings/os/initialize/osInitialize.s")
/*Matching, but needs data migration to work*/
#ifdef NON_MATCHING

View File

@ -2,7 +2,7 @@
#include <rcp.h>
#include <bstring.h>
#pragma GLOBAL_ASM("asm/nonmatchings/leodiskinit/func_8003D650.s")
#pragma GLOBAL_ASM("asm/nonmatchings/os/leodiskinit/func_8003D650.s")
/*
OSPiHandle LeoDiskHandle;
OSPiHandle *__osDiskHandle;

5
src/os/pimgr.c Normal file
View File

@ -0,0 +1,5 @@
#include "common.h"
#pragma GLOBAL_ASM("asm/nonmatchings/os/pimgr/osCreatePiManager.s")
/*MIGRATE .bss*/

12
src/os/sptask.c Normal file
View File

@ -0,0 +1,12 @@
#include <os_internal.h>
#include <sptask.h>
#include <bstring.h>
#include <rcp.h>
/*Needs help from .bss migration*/
#pragma GLOBAL_ASM("asm/nonmatchings/os/sptask/_VirtualToPhysicalTask.s")
#pragma GLOBAL_ASM("asm/nonmatchings/os/sptask/osSpTaskLoad.s")
#pragma GLOBAL_ASM("asm/nonmatchings/os/sptask/osSpTaskStartGo.s")

View File

@ -1,6 +1,6 @@
#include "common.h"
#pragma GLOBAL_ASM("asm/nonmatchings/vigetcurrframebuf/osViGetCurrentFramebuffer.s")
#pragma GLOBAL_ASM("asm/nonmatchings/os/vigetcurrframebuf/osViGetCurrentFramebuffer.s")
#ifdef NON_MATCHING //matches, but needs some stuff done with the next funtction to work out some bad data.
void *osViGetCurrentFramebuffer(void)
{

10
src/os/vimgr.c Normal file
View File

@ -0,0 +1,10 @@
#include <os_internal.h>
#include <rcp.h>
#include "viint.h"
#include "osint.h"
/*Needs .bss migration to work*/
#pragma GLOBAL_ASM("asm/nonmatchings/os/vimgr/osCreateViManager.s")
#pragma GLOBAL_ASM("asm/nonmatchings/os/vimgr/viMgrMain.s")

49
src/ovl_overlay1/DA68F0.c Normal file
View File

@ -0,0 +1,49 @@
#include "common.h"
extern s32 D_80103420_DA9D10;
extern s32 D_80103424_DA9D14;
extern s32 D_8011AD30;
extern s32 D_8011AD34;
extern s32 D_8011AD38;
extern s32 D_8011AD3C;
extern s32 D_8011AD40;
extern s32 D_8011AD44;
extern u8 D_80103138_DA9A28[];
void func_80100BA0_DA7490(u32 arg0);
//#pragma GLOBAL_ASM("asm/nonmatchings/ovl_overlay1/DA68F0/func_80100000_DA68F0.s")
void func_80100000_DA68F0(void) {
D_8011AD30 = 0;
D_8011AD44 = 0;
D_80103424_DA9D14 = 1;
D_80103420_DA9D10 = 0;
D_8011AD34 = 1;
D_8011AD3C = 0;
D_8011AD40 = 8;
D_8011AD38 = 0;
}
#pragma GLOBAL_ASM("asm/nonmatchings/ovl_overlay1/DA68F0/func_8010004C_DA693C.s")
#pragma GLOBAL_ASM("asm/nonmatchings/ovl_overlay1/DA68F0/func_801000A8_DA6998.s")
#pragma GLOBAL_ASM("asm/nonmatchings/ovl_overlay1/DA68F0/func_801006D8_DA6FC8.s")
//#pragma GLOBAL_ASM("asm/nonmatchings/ovl_overlay1/DA68F0/func_80100B14_DA7404.s")
void func_80100B14_DA7404(void) {
gSPDisplayList(gMasterGfxPos++, D_80103138_DA9A28);
gDPSetEnvColor(gMasterGfxPos++, 0x00, 0x00, 0x00, 0xFF);
func_80100BA0_DA7490(D_8011AD44);
D_8011AD34--;
if (D_8011AD34 == 0) {
D_8011AD44 = 0xF;
}
}
#pragma GLOBAL_ASM("asm/nonmatchings/ovl_overlay1/DA68F0/func_80100BA0_DA7490.s")
#pragma GLOBAL_ASM("asm/nonmatchings/ovl_overlay1/DA68F0/func_80102E30_DA9720.s")
#pragma GLOBAL_ASM("asm/nonmatchings/ovl_overlay1/DA68F0/func_80102F14_DA9804.s")

View File

@ -1,5 +0,0 @@
#include "common.h"
#pragma GLOBAL_ASM("asm/nonmatchings/pimgr/osCreatePiManager.s")
/*MIGRATE .bss*/

View File

@ -1,12 +0,0 @@
#include <os_internal.h>
#include <sptask.h>
#include <bstring.h>
#include <rcp.h>
/*Needs help from .bss migration*/
#pragma GLOBAL_ASM("asm/nonmatchings/sptask/_VirtualToPhysicalTask.s")
#pragma GLOBAL_ASM("asm/nonmatchings/sptask/osSpTaskLoad.s")
#pragma GLOBAL_ASM("asm/nonmatchings/sptask/osSpTaskStartGo.s")

View File

@ -1,10 +0,0 @@
#include <os_internal.h>
#include <rcp.h>
#include "viint.h"
#include "osint.h"
/*Needs .bss migration to work*/
#pragma GLOBAL_ASM("asm/nonmatchings/vimgr/osCreateViManager.s")
#pragma GLOBAL_ASM("asm/nonmatchings/vimgr/viMgrMain.s")

71
tools/m2ctx.py Normal file
View File

@ -0,0 +1,71 @@
#!/usr/bin/env python3
import argparse
import os
import sys
import subprocess
import tempfile
script_dir = os.path.dirname(os.path.realpath(__file__))
root_dir = os.path.abspath(os.path.join(script_dir, ".."))
src_dir = root_dir + "src/"
# Project-specific
CPP_FLAGS = [
"-I.",
"-Iinclude",
"-Iinclude/2.0I",
"-Iinclude/2.0I/PR",
"-D_LANGUAGE_C",
"-D_FINALROM",
"-DF3DEX_GBI",
"-DWIN32",
]
def import_c_file(in_file) -> str:
in_file = os.path.relpath(in_file, root_dir)
cpp_command = ["gcc", "-E", "-P", "-dM", *CPP_FLAGS, in_file]
cpp_command2 = ["gcc", "-E", "-P", *CPP_FLAGS, in_file]
with tempfile.NamedTemporaryFile(suffix=".c") as tmp:
stock_macros = subprocess.check_output(["gcc", "-E", "-P", "-dM", tmp.name], cwd=root_dir, encoding="utf-8")
out_text = ""
try:
out_text += subprocess.check_output(cpp_command, cwd=root_dir, encoding="utf-8")
out_text += subprocess.check_output(cpp_command2, cwd=root_dir, encoding="utf-8")
except subprocess.CalledProcessError:
print(
"Failed to preprocess input file, when running command:\n"
+ ' '.join(cpp_command),
file=sys.stderr,
)
sys.exit(1)
if not out_text:
print("Output is empty - aborting")
sys.exit(1)
for line in stock_macros.strip().splitlines():
out_text = out_text.replace(line + "\n", "")
return out_text
def main():
parser = argparse.ArgumentParser(
description="""Create a context file which can be used for mips_to_c"""
)
parser.add_argument(
"c_file",
help="""File from which to create context""",
)
args = parser.parse_args()
output = import_c_file(args.c_file)
with open(os.path.join(root_dir, "ctx.c"), "w", encoding="UTF-8") as f:
f.write(output)
if __name__ == "__main__":
main()