diff --git a/.github/workflows/VerifyBuild.yml b/.github/workflows/VerifyBuild.yml index 32251063..df45326c 100644 --- a/.github/workflows/VerifyBuild.yml +++ b/.github/workflows/VerifyBuild.yml @@ -16,12 +16,12 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive - + - name: Install packages run: | sudo apt-get update sudo apt-get install -y build-essential pkg-config git python3 libssl-dev wget libcapstone-dev binutils-mips-linux-gnu - + - name: Get ROM run: wget -q -O baseroms/dkr.z64 ${{secrets.ROMURL}} @@ -37,17 +37,17 @@ jobs: - name: Build Tools run: | cd tools - make + make -j4 cd .. - name: Extract Assets run: | ./extract.sh python3 tools/python/check_if_need_to_extract.py us_1.0 - + - name: Build ROM - run: make - + run: make -j4 + - name: Verify Build run: if [[ $(sha1sum -c --quiet sha1/dkr.us_1.0.sha1) = "" ]]; then echo "Signature OK"; else echo "Failed"; exit 1; fi @@ -55,10 +55,10 @@ jobs: run: make clean - name: Verify NON_MATCHING - run: make NON_MATCHING=1 + run: make -j4 NON_MATCHING=1 - name: Clean Again run: make clean - name: Verify NON_EQUIVALENT - run: make NON_EQUIVALENT=1 + run: make -j4 NON_EQUIVALENT=1 diff --git a/.github/workflows/VerifyPR.yml b/.github/workflows/VerifyPR.yml index 935ef0f7..3839d782 100644 --- a/.github/workflows/VerifyPR.yml +++ b/.github/workflows/VerifyPR.yml @@ -37,7 +37,7 @@ jobs: - name: Build Tools run: | cd tools - make + make -j4 cd .. - name: Extract Assets @@ -46,7 +46,7 @@ jobs: python3 tools/python/check_if_need_to_extract.py us_1.0 - name: Build ROM - run: make + run: make -j4 - name: Verify Build run: if [[ $(sha1sum -c --quiet sha1/dkr.us_1.0.sha1) = "" ]]; then echo "Signature OK"; else echo "Failed"; exit 1; fi @@ -55,21 +55,11 @@ jobs: run: make clean - name: Verify NON_MATCHING - run: make NON_MATCHING=1 + run: make -j4 NON_MATCHING=1 - name: Clean Again run: make clean - name: Verify NON_EQUIVALENT - run: make NON_EQUIVALENT=1 + run: make -j4 NON_EQUIVALENT=1 - - name: Update decomp score in README - run: ./score.sh --update-readme - - - name: Update PR - uses: test-room-7/action-update-file@v1 - with: - file-path: README.md - commit-msg: Update score in README - branch: ${{ env.GITHUB_REF_NAME }} - github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/asm/non_matchings/printf/func_800B4488.s b/asm/non_matchings/printf/func_800B4488.s deleted file mode 100644 index 24978736..00000000 --- a/asm/non_matchings/printf/func_800B4488.s +++ /dev/null @@ -1,22 +0,0 @@ -glabel func_800B4488 -/* 0B5088 800B4488 3C03800E */ lui $v1, %hi(gParticlesAssetTableCount) # $v1, 0x800e -/* 0B508C 800B448C 8C632CE8 */ lw $v1, %lo(gParticlesAssetTableCount)($v1) -/* 0B5090 800B4490 3C0E800E */ lui $t6, %hi(gParticlesAssetTable) # $t6, 0x800e -/* 0B5094 800B4494 0083082A */ slt $at, $a0, $v1 -/* 0B5098 800B4498 10200007 */ beqz $at, .L800B44B8 -/* 0B509C 800B449C 3C19800E */ lui $t9, %hi(gParticlesAssetTable) # $t9, 0x800e -/* 0B50A0 800B44A0 8DCE2CF0 */ lw $t6, %lo(gParticlesAssetTable)($t6) -/* 0B50A4 800B44A4 00047880 */ sll $t7, $a0, 2 -/* 0B50A8 800B44A8 01CFC021 */ addu $t8, $t6, $t7 -/* 0B50AC 800B44AC 8F020000 */ lw $v0, ($t8) -/* 0B50B0 800B44B0 03E00008 */ jr $ra -/* 0B50B4 800B44B4 00000000 */ nop - -.L800B44B8: -/* 0B50B8 800B44B8 8F392CF0 */ lw $t9, %lo(gParticlesAssetTable)($t9) -/* 0B50BC 800B44BC 00034080 */ sll $t0, $v1, 2 -/* 0B50C0 800B44C0 03284821 */ addu $t1, $t9, $t0 -/* 0B50C4 800B44C4 8D22FFFC */ lw $v0, -4($t1) -/* 0B50C8 800B44C8 00000000 */ nop -/* 0B50CC 800B44CC 03E00008 */ jr $ra -/* 0B50D0 800B44D0 00000000 */ nop diff --git a/asm/non_matchings/printf/func_800B44D4.s b/asm/non_matchings/printf/func_800B44D4.s deleted file mode 100644 index f41c90d1..00000000 --- a/asm/non_matchings/printf/func_800B44D4.s +++ /dev/null @@ -1,25 +0,0 @@ -glabel func_800B44D4 -/* 0B50D4 800B44D4 8C8E0000 */ lw $t6, ($a0) -/* 0B50D8 800B44D8 3C05800E */ lui $a1, %hi(gParticlesAssetTableCount) # $a1, 0x800e -/* 0B50DC 800B44DC 25C30001 */ addiu $v1, $t6, 1 -/* 0B50E0 800B44E0 24A52CE8 */ addiu $a1, %lo(gParticlesAssetTableCount) # addiu $a1, $a1, 0x2ce8 -/* 0B50E4 800B44E4 AC830000 */ sw $v1, ($a0) -/* 0B50E8 800B44E8 8CA20000 */ lw $v0, ($a1) -/* 0B50EC 800B44EC 3C19800E */ lui $t9, %hi(gParticlesAssetTable) # $t9, 0x800e -/* 0B50F0 800B44F0 0062082A */ slt $at, $v1, $v0 -/* 0B50F4 800B44F4 14200007 */ bnez $at, .L800B4514 -/* 0B50F8 800B44F8 0062C023 */ subu $t8, $v1, $v0 -.L800B44FC: -/* 0B50FC 800B44FC AC980000 */ sw $t8, ($a0) -/* 0B5100 800B4500 8CA20000 */ lw $v0, ($a1) -/* 0B5104 800B4504 03001825 */ move $v1, $t8 -/* 0B5108 800B4508 0302082A */ slt $at, $t8, $v0 -/* 0B510C 800B450C 1020FFFB */ beqz $at, .L800B44FC -/* 0B5110 800B4510 0062C023 */ subu $t8, $v1, $v0 -.L800B4514: -/* 0B5114 800B4514 8F392CF0 */ lw $t9, %lo(gParticlesAssetTable)($t9) -/* 0B5118 800B4518 00034080 */ sll $t0, $v1, 2 -/* 0B511C 800B451C 03284821 */ addu $t1, $t9, $t0 -/* 0B5120 800B4520 8D220000 */ lw $v0, ($t1) -/* 0B5124 800B4524 03E00008 */ jr $ra -/* 0B5128 800B4528 00000000 */ nop \ No newline at end of file diff --git a/asm/non_matchings/printf/func_800B452C.s b/asm/non_matchings/printf/func_800B452C.s deleted file mode 100644 index 6996fbef..00000000 --- a/asm/non_matchings/printf/func_800B452C.s +++ /dev/null @@ -1,23 +0,0 @@ -glabel func_800B452C -/* 0B512C 800B452C 8C8E0000 */ lw $t6, ($a0) -/* 0B5130 800B4530 3C08800E */ lui $t0, %hi(gParticlesAssetTable) # $t0, 0x800e -/* 0B5134 800B4534 25C3FFFF */ addiu $v1, $t6, -1 -/* 0B5138 800B4538 04610009 */ bgez $v1, .L800B4560 -/* 0B513C 800B453C AC830000 */ sw $v1, ($a0) -/* 0B5140 800B4540 3C02800E */ lui $v0, %hi(gParticlesAssetTableCount) # $v0, 0x800e -/* 0B5144 800B4544 24422CE8 */ addiu $v0, %lo(gParticlesAssetTableCount) # addiu $v0, $v0, 0x2ce8 -.L800B4548: -/* 0B5148 800B4548 8C580000 */ lw $t8, ($v0) -/* 0B514C 800B454C 00000000 */ nop -/* 0B5150 800B4550 0078C821 */ addu $t9, $v1, $t8 -/* 0B5154 800B4554 AC990000 */ sw $t9, ($a0) -/* 0B5158 800B4558 0720FFFB */ bltz $t9, .L800B4548 -/* 0B515C 800B455C 03201825 */ move $v1, $t9 -.L800B4560: -/* 0B5160 800B4560 8D082CF0 */ lw $t0, %lo(gParticlesAssetTable)($t0) -/* 0B5164 800B4564 00034880 */ sll $t1, $v1, 2 -/* 0B5168 800B4568 01095021 */ addu $t2, $t0, $t1 -/* 0B516C 800B456C 8D420000 */ lw $v0, ($t2) -/* 0B5170 800B4570 03E00008 */ jr $ra -/* 0B5174 800B4574 00000000 */ nop - diff --git a/asm/non_matchings/printf/func_800B4578.s b/asm/non_matchings/printf/func_800B4578.s deleted file mode 100644 index 43d723ae..00000000 --- a/asm/non_matchings/printf/func_800B4578.s +++ /dev/null @@ -1,23 +0,0 @@ -glabel func_800B4578 -/* 0B5178 800B4578 3C03800E */ lui $v1, %hi(gParticleBehavioursAssetTableCount) # $v1, 0x800e -/* 0B517C 800B457C 8C632CF4 */ lw $v1, %lo(gParticleBehavioursAssetTableCount)($v1) -/* 0B5180 800B4580 3C0E800E */ lui $t6, %hi(gParticleBehavioursAssetTable) # $t6, 0x800e -/* 0B5184 800B4584 0083082A */ slt $at, $a0, $v1 -/* 0B5188 800B4588 10200007 */ beqz $at, .L800B45A8 -/* 0B518C 800B458C 3C19800E */ lui $t9, %hi(gParticleBehavioursAssetTable) # $t9, 0x800e -/* 0B5190 800B4590 8DCE2CFC */ lw $t6, %lo(gParticleBehavioursAssetTable)($t6) -/* 0B5194 800B4594 00047880 */ sll $t7, $a0, 2 -/* 0B5198 800B4598 01CFC021 */ addu $t8, $t6, $t7 -/* 0B519C 800B459C 8F020000 */ lw $v0, ($t8) -/* 0B51A0 800B45A0 03E00008 */ jr $ra -/* 0B51A4 800B45A4 00000000 */ nop - -.L800B45A8: -/* 0B51A8 800B45A8 8F392CFC */ lw $t9, %lo(gParticleBehavioursAssetTable)($t9) -/* 0B51AC 800B45AC 00034080 */ sll $t0, $v1, 2 -/* 0B51B0 800B45B0 03284821 */ addu $t1, $t9, $t0 -/* 0B51B4 800B45B4 8D22FFFC */ lw $v0, -4($t1) -/* 0B51B8 800B45B8 00000000 */ nop -/* 0B51BC 800B45BC 03E00008 */ jr $ra -/* 0B51C0 800B45C0 00000000 */ nop - diff --git a/score.sh b/score.sh index 4853b7c4..70c5f759 100755 --- a/score.sh +++ b/score.sh @@ -1,24 +1 @@ -if [[ $1 == '--update-readme' ]]; then - export NEW_SCORE=$(python3 ./tools/python/score.py) - echo "$NEW_SCORE" - python3 - <<'EOF' > README.md.tmp -import sys -import os -import re -from datetime import datetime - -BEGIN = '' -END = '' -DATE_STR = datetime.now().strftime('As of %B %-d, %Y, this is our current score:') -print( - re.sub( - fr'(?s).{BEGIN}.*{END}', - f'\n{BEGIN}\n{DATE_STR}\n```\n{os.environ["NEW_SCORE"]}\n```\n{END}', - open('README.md', 'r').read() - ) -) -EOF -sed '$ { /^$/ d}' README.md.tmp > README.md # removes extra newlines at end of file -else - python3 ./tools/python/score.py "$@" -fi +python3 ./tools/python/score.py "$@" diff --git a/src/audio.h b/src/audio.h index c6140746..672ff9a8 100644 --- a/src/audio.h +++ b/src/audio.h @@ -130,6 +130,8 @@ void func_800022BC(u8 arg0, ALSeqPlayer *arg1); void func_80002570(ALSeqPlayer *seqp); void func_80002608(u8 arg0); u8 func_80002630(void); +void alSeqFileNew(ALSeqFile *file, u8 *base); +void func_80063A90(ALSeqPlayer *seqp, u8 chan); void play_sound_global(u16 soundID, s32* soundMask); //Non matching. void func_8000232C(ALSeqPlayer *seqp, void *ptr, u8 *arg2, ALCSeq *seq); //Non Matching diff --git a/src/particles.h b/src/particles.h index bcbd36e1..2b8e810d 100644 --- a/src/particles.h +++ b/src/particles.h @@ -113,6 +113,12 @@ typedef struct XYStruct { s16 x, y; } XYStruct; +extern unk800E2CF0 **gParticlesAssetTable; +extern s32 gParticlesAssetTableCount; + +extern ParticleBehavior **gParticleBehavioursAssetTable; +extern s32 gParticleBehavioursAssetTableCount; + void func_800AE270(void); void func_800AE2A0(void); void func_800AE2D8(void); diff --git a/src/printf.c b/src/printf.c index c39818df..6feaea6c 100644 --- a/src/printf.c +++ b/src/printf.c @@ -10,6 +10,7 @@ #include "textures_sprites.h" #include "stdio.h" #include "objects.h" +#include "particles.h" /************ .data ************/ @@ -95,10 +96,34 @@ UNUSED void func_800B3678(Gfx **arg0, Mtx **arg1, VertexList **arg2) { GLOBAL_ASM("asm/non_matchings/printf/func_800B3740.s") GLOBAL_ASM("asm/non_matchings/printf/func_800B3E64.s") -GLOBAL_ASM("asm/non_matchings/printf/func_800B4488.s") -GLOBAL_ASM("asm/non_matchings/printf/func_800B44D4.s") -GLOBAL_ASM("asm/non_matchings/printf/func_800B452C.s") -GLOBAL_ASM("asm/non_matchings/printf/func_800B4578.s") + +UNUSED unk800E2CF0 *func_800B4488(s32 idx) { + if (idx < gParticlesAssetTableCount) { + return gParticlesAssetTable[idx]; + } + return gParticlesAssetTable[gParticlesAssetTableCount - 1]; +} + +UNUSED unk800E2CF0 *func_800B44D4(s32 *idx) { + *idx = *idx + 1; + while (*idx >= gParticlesAssetTableCount) { + *idx = *idx - gParticlesAssetTableCount; + } + return gParticlesAssetTable[*idx]; +} + +UNUSED unk800E2CF0 *func_800B452C(s32 *arg0) { + for (*arg0 = *arg0 - 1; *arg0 < 0; *arg0 += gParticlesAssetTableCount); + return gParticlesAssetTable[*arg0]; +} + +UNUSED ParticleBehavior *func_800B4578(s32 idx) { + if (idx < gParticleBehavioursAssetTableCount) { + return gParticleBehavioursAssetTable[idx]; + } + return gParticleBehavioursAssetTable[gParticleBehavioursAssetTableCount - 1]; +} + GLOBAL_ASM("asm/non_matchings/printf/func_800B45C4.s") GLOBAL_ASM("asm/non_matchings/printf/func_800B461C.s") GLOBAL_ASM("asm/non_matchings/printf/func_800B4668.s") diff --git a/src/printf.h b/src/printf.h index 2d1f31b6..af3e2140 100644 --- a/src/printf.h +++ b/src/printf.h @@ -3,6 +3,8 @@ #include "types.h" #include "structs.h" +#include "particles.h" +#include "macros.h" #include @@ -35,6 +37,10 @@ void func_800B4A08(s32 arg0); +UNUSED unk800E2CF0 *func_800B4488(s32 idx); +UNUSED unk800E2CF0 *func_800B44D4(s32 *idx); +UNUSED unk800E2CF0 *func_800B452C(s32 *arg0); +UNUSED ParticleBehavior *func_800B4578(s32 idx); void func_800B5E88(void); void set_render_printf_colour(u8 red, u8 green, u8 blue, u8 alpha); void set_render_printf_background_colour(u8 red, u8 green, u8 blue, u8 alpha); diff --git a/update-score.sh b/update-score.sh new file mode 100755 index 00000000..2ed9b538 --- /dev/null +++ b/update-score.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +export NEW_SCORE=$(python3 ./tools/python/score.py) +python3 - <<'EOF' > README.md.tmp +import sys +import os +import re +from datetime import datetime + +BEGIN = '' +END = '' +DATE_STR = datetime.now().strftime('As of %B %-d, %Y, this is our current score:') +print( + re.sub( + fr'(?s).{BEGIN}.*{END}', + f'\n{BEGIN}\n{DATE_STR}\n```\n{os.environ["NEW_SCORE"]}\n```\n{END}', + open('README.md', 'r').read() + ), + end='' +) +EOF +mv README.md.tmp README.md