diff --git a/data/__libm_qnan_f.rodata.s b/data/__libm_qnan_f.rodata.s index 8edfc0bfc0..3c3686576b 100644 --- a/data/__libm_qnan_f.rodata.s +++ b/data/__libm_qnan_f.rodata.s @@ -7,5 +7,7 @@ .section .rodata +.balign 16 + glabel __libm_qnan_f - .word 0x7F810000 + .word 0x7F810000 diff --git a/data/audio_effects.data.s b/data/audio_effects.data.s deleted file mode 100644 index 96720abfd4..0000000000 --- a/data/audio_effects.data.s +++ /dev/null @@ -1,21 +0,0 @@ -.include "macro.inc" - -# assembler directives -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches -.set gp=64 # allow use of 64-bit general purpose registers - -.section .data - -.balign 16 - -glabel D_80130510 - .word 0 - -glabel D_80130514 - .word 0 - -.word 0, 0 # file boundary - -glabel D_80130520 - .incbin "baserom.z64", 0xBA76C0, 0x50 diff --git a/data/code_800D2E30.data.s b/data/code_800D2E30.data.s deleted file mode 100644 index bf01aed6db..0000000000 --- a/data/code_800D2E30.data.s +++ /dev/null @@ -1,13 +0,0 @@ -.include "macro.inc" - -# assembler directives -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches -.set gp=64 # allow use of 64-bit general purpose registers - -.section .data - -.balign 16 - -glabel D_8012DBB0 - .incbin "baserom.z64", 0xBA4D50, 0x10 diff --git a/data/rsp_boot.text.s b/data/rsp_boot.text.s index f9495dcac8..9ca646e4a8 100644 --- a/data/rsp_boot.text.s +++ b/data/rsp_boot.text.s @@ -7,18 +7,10 @@ .section .text +.balign 16 + glabel D_80009320 .incbin "baserom.z64", 0x9F20, 0xD0 glabel D_800093F0 .incbin "baserom.z64", 0x9FF0, 0x20 - -glabel D_80009410 - .word osStopThread - .word __osSetHWIntrRoutine - .word __osSetFpcCsr - .word __osGetFpcCsr - .word __osGetHWIntrRoutine - .word __osSetHWIntrRoutine - .word osViGetNextFramebuffer - .word bcmp diff --git a/data/unk_80009410.data.s b/data/unk_80009410.data.s new file mode 100644 index 0000000000..d2bded6c36 --- /dev/null +++ b/data/unk_80009410.data.s @@ -0,0 +1,21 @@ +.include "macro.inc" + +# assembler directives +.set noat # allow manual use of $at +.set noreorder # don't insert nops after branches +.set gp=64 # allow use of 64-bit general purpose registers + +.section .data + +.balign 16 + +# Unused +glabel D_80009410 + .word osStopThread + .word __osSetHWIntrRoutine + .word __osSetFpcCsr + .word __osGetFpcCsr + .word __osGetHWIntrRoutine + .word __osSetHWIntrRoutine + .word osViGetNextFramebuffer + .word bcmp diff --git a/data/unk_8012ABC0.data.s b/data/unk_8012ABC0.data.s new file mode 100644 index 0000000000..d4781c3b8c --- /dev/null +++ b/data/unk_8012ABC0.data.s @@ -0,0 +1,25 @@ +.include "macro.inc" + +# assembler directives +.set noat # allow manual use of $at +.set noreorder # don't insert nops after branches +.set gp=64 # allow use of 64-bit general purpose registers + +.section .data + +.balign 16 + +# Unused +glabel D_8012ABC0 + .word func_801067F0 # fmodf? + .word guScale + .word guRotate + .word guTranslate + .word GfxPrint_SetPos + .word GfxPrint_SetColor + .word GfxPrint_Printf + .word GfxPrint_SetPosPx + .word GfxPrint_Init + .word GfxPrint_Open + .word GfxPrint_Close + .word GfxPrint_Destroy diff --git a/data/z_text.data.s b/data/z_text.data.s index c20dd6cca6..a9cda47f02 100644 --- a/data/z_text.data.s +++ b/data/z_text.data.s @@ -16,18 +16,3 @@ glabel gMojiFontTLUTs glabel gMojiFontTex .incbin "baserom.z64", 0xBA1960, 0x400 - -# Unused -glabel D_8012ABC0 - .word func_801067F0 # fmodf? - .word guScale - .word guRotate - .word guTranslate - .word GfxPrint_SetPos - .word GfxPrint_SetColor - .word GfxPrint_Printf - .word GfxPrint_SetPosPx - .word GfxPrint_Init - .word GfxPrint_Open - .word GfxPrint_Close - .word GfxPrint_Destroy diff --git a/include/variables.h b/include/variables.h index 614d6a0818..cbd37e4f36 100644 --- a/include/variables.h +++ b/include/variables.h @@ -341,9 +341,6 @@ extern f32 gDefaultPanVolume[128]; extern s16 sLowPassFilterData[16*8]; extern s16 sHighPassFilterData[15*8]; extern s32 gAudioContextInitalized; -extern f32 D_80130510; -extern s32 D_80130514; -extern u8 D_80130520[]; extern u8 gIsLargeSoundBank[7]; extern u8 gChannelsPerBank[4][7]; extern u8 gUsedChannelsPerBank[4][7]; diff --git a/spec b/spec index 443f0e24ec..55c3ed5155 100644 --- a/spec +++ b/spec @@ -13,6 +13,7 @@ beginseg name "boot" address 0x80000460 include "build/src/boot/boot_main.o" + include "build/data/unk_80009410.data.o" include "build/src/boot/idle.o" include "build/src/boot/viconfig.o" include "build/src/boot/z_std_dma.o" @@ -357,6 +358,7 @@ beginseg include "build/src/code/z_ss_sram.o" include "build/src/code/code_800A9F30.o" include "build/data/z_text.data.o" + include "build/data/unk_8012ABC0.data.o" include "build/src/code/z_view.o" include "build/src/code/z_vimode.o" include "build/src/code/code_800ACE70.o" @@ -397,7 +399,6 @@ beginseg include "build/src/code/sys_matrix.o" include "build/src/code/sys_ucode.o" include "build/src/code/code_800D2E30.o" - include "build/data/code_800D2E30.data.o" include "build/src/code/code_800D31A0.o" include "build/src/code/irqmgr.o" include "build/src/code/debug_malloc.o" @@ -416,7 +417,6 @@ beginseg include "build/src/libultra_code_O2/osAiSetNextBuffer.o" include "build/src/code/audio_playback.o" include "build/src/code/audio_effects.o" - include "build/data/audio_effects.data.o" include "build/src/code/audio_seqplayer.o" include "build/src/code/code_800EC960.o" include "build/src/code/audio_sound_params.o" diff --git a/src/code/audio_effects.c b/src/code/audio_effects.c index 04aa5e0060..b871867193 100644 --- a/src/code/audio_effects.c +++ b/src/code/audio_effects.c @@ -105,13 +105,13 @@ s16 Audio_GetVibratoPitchChange(VibratoState* vib) { } f32 Audio_GetVibratoFreqScale(VibratoState* vib) { + static f32 D_80130510 = 0.0f; + static s32 D_80130514 = 0; f32 pitchChange; f32 extent; f32 invExtent; f32 result; f32 temp; - f32 twoToThe16th = 65536.0f; - s32 one = 1; SequenceChannel* channel = vib->channel; if (vib->delay != 0) { @@ -160,13 +160,11 @@ f32 Audio_GetVibratoFreqScale(VibratoState* vib) { extent = temp + 1.0f; invExtent = 1.0f / extent; - // fakematch: 2^16 and 1 need to be set at the very top of this function, - // or else the addresses of D_80130510 and D_80130514 get computed once - // instead of twice. 'temp' is also a fakematch sign; removing it causes - // regalloc differences and reorderings at the top of the function. - result = 1.0f / ((extent - invExtent) * pitchChange / twoToThe16th + invExtent); + result = 1.0f / ((extent - invExtent) * pitchChange / 65536.0f + invExtent); + D_80130510 += result; - D_80130514 += one; + D_80130514++; + return result; } diff --git a/src/code/audio_seqplayer.c b/src/code/audio_seqplayer.c index 0cbe6a539b..547a957a9d 100644 --- a/src/code/audio_seqplayer.c +++ b/src/code/audio_seqplayer.c @@ -9,14 +9,20 @@ #define PORTAMENTO_MODE_4 4 #define PORTAMENTO_MODE_5 5 -extern u8 D_80130470[]; - u8 AudioSeq_ScriptReadU8(SeqScriptState* state); s16 AudioSeq_ScriptReadS16(SeqScriptState* state); u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state); u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** instOut, AdsrSettings* adsr); +u8 D_80130520[] = { + 0x81, 0x00, 0x81, 0x01, 0x00, 0x00, 0x00, 0x81, 0x01, 0x01, 0x01, 0x42, 0x81, 0xC2, 0x00, 0x00, + 0x00, 0x01, 0x81, 0x00, 0x00, 0x00, 0x01, 0x42, 0x01, 0x01, 0x01, 0x81, 0x01, 0x01, 0x81, 0x81, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x81, 0x01, 0x01, 0x01, 0x81, 0x01, + 0x01, 0x03, 0x03, 0x01, 0x00, 0x01, 0x01, 0x81, 0x03, 0x01, 0x00, 0x02, 0x00, 0x01, 0x01, 0x82, + 0x00, 0x01, 0x01, 0x01, 0x01, 0x81, 0x00, 0x00, 0x01, 0x81, 0x81, 0x81, 0x81, 0x00, 0x00, 0x00, +}; + u16 AudioSeq_GetScriptControlFlowArgument(SeqScriptState* state, u8 arg1) { u8 temp_v0 = D_80130520[arg1 - 0xB0]; u8 loBits = temp_v0 & 3; diff --git a/src/code/code_800D2E30.c b/src/code/code_800D2E30.c index 1c731c9bdf..a182926f10 100644 --- a/src/code/code_800D2E30.c +++ b/src/code/code_800D2E30.c @@ -1,23 +1,22 @@ #include "global.h" void func_800D2E30(UnkRumbleStruct* arg0) { + static u8 D_8012DBB0 = 1; s32 i; s32 unk_a3; s32 index = -1; - UnkRumbleStruct* new_var; for (i = 0; i < 4; i++) { arg0->rumbleEnable[i] = 0; } if (arg0->unk_105 == 0) { - new_var = arg0; if (D_8012DBB0 != 0) { for (i = 0; i < 4; i++) { gPadMgr.pakType[i] = 0; } } - D_8012DBB0 = new_var->unk_105; + D_8012DBB0 = arg0->unk_105; return; }