1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 09:45:02 +00:00

Minor data/ cleanups (#1025)

* Moved code_800D2E30's data to C
* Moved some audio data from asm to C
* Made separate data files for unknown pointer arrays
* Fixed a few missing balign directives
This commit is contained in:
Roman971 2021-11-24 03:07:48 +01:00 committed by GitHub
parent 8d4828a3be
commit 0f58b15b27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 69 additions and 78 deletions

View file

@ -7,5 +7,7 @@
.section .rodata .section .rodata
.balign 16
glabel __libm_qnan_f glabel __libm_qnan_f
.word 0x7F810000 .word 0x7F810000

View file

@ -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

View file

@ -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

View file

@ -7,18 +7,10 @@
.section .text .section .text
.balign 16
glabel D_80009320 glabel D_80009320
.incbin "baserom.z64", 0x9F20, 0xD0 .incbin "baserom.z64", 0x9F20, 0xD0
glabel D_800093F0 glabel D_800093F0
.incbin "baserom.z64", 0x9FF0, 0x20 .incbin "baserom.z64", 0x9FF0, 0x20
glabel D_80009410
.word osStopThread
.word __osSetHWIntrRoutine
.word __osSetFpcCsr
.word __osGetFpcCsr
.word __osGetHWIntrRoutine
.word __osSetHWIntrRoutine
.word osViGetNextFramebuffer
.word bcmp

21
data/unk_80009410.data.s Normal file
View file

@ -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

25
data/unk_8012ABC0.data.s Normal file
View file

@ -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

View file

@ -16,18 +16,3 @@ glabel gMojiFontTLUTs
glabel gMojiFontTex glabel gMojiFontTex
.incbin "baserom.z64", 0xBA1960, 0x400 .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

View file

@ -341,9 +341,6 @@ extern f32 gDefaultPanVolume[128];
extern s16 sLowPassFilterData[16*8]; extern s16 sLowPassFilterData[16*8];
extern s16 sHighPassFilterData[15*8]; extern s16 sHighPassFilterData[15*8];
extern s32 gAudioContextInitalized; extern s32 gAudioContextInitalized;
extern f32 D_80130510;
extern s32 D_80130514;
extern u8 D_80130520[];
extern u8 gIsLargeSoundBank[7]; extern u8 gIsLargeSoundBank[7];
extern u8 gChannelsPerBank[4][7]; extern u8 gChannelsPerBank[4][7];
extern u8 gUsedChannelsPerBank[4][7]; extern u8 gUsedChannelsPerBank[4][7];

4
spec
View file

@ -13,6 +13,7 @@ beginseg
name "boot" name "boot"
address 0x80000460 address 0x80000460
include "build/src/boot/boot_main.o" include "build/src/boot/boot_main.o"
include "build/data/unk_80009410.data.o"
include "build/src/boot/idle.o" include "build/src/boot/idle.o"
include "build/src/boot/viconfig.o" include "build/src/boot/viconfig.o"
include "build/src/boot/z_std_dma.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/z_ss_sram.o"
include "build/src/code/code_800A9F30.o" include "build/src/code/code_800A9F30.o"
include "build/data/z_text.data.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_view.o"
include "build/src/code/z_vimode.o" include "build/src/code/z_vimode.o"
include "build/src/code/code_800ACE70.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_matrix.o"
include "build/src/code/sys_ucode.o" include "build/src/code/sys_ucode.o"
include "build/src/code/code_800D2E30.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/code_800D31A0.o"
include "build/src/code/irqmgr.o" include "build/src/code/irqmgr.o"
include "build/src/code/debug_malloc.o" include "build/src/code/debug_malloc.o"
@ -416,7 +417,6 @@ beginseg
include "build/src/libultra_code_O2/osAiSetNextBuffer.o" include "build/src/libultra_code_O2/osAiSetNextBuffer.o"
include "build/src/code/audio_playback.o" include "build/src/code/audio_playback.o"
include "build/src/code/audio_effects.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/audio_seqplayer.o"
include "build/src/code/code_800EC960.o" include "build/src/code/code_800EC960.o"
include "build/src/code/audio_sound_params.o" include "build/src/code/audio_sound_params.o"

View file

@ -105,13 +105,13 @@ s16 Audio_GetVibratoPitchChange(VibratoState* vib) {
} }
f32 Audio_GetVibratoFreqScale(VibratoState* vib) { f32 Audio_GetVibratoFreqScale(VibratoState* vib) {
static f32 D_80130510 = 0.0f;
static s32 D_80130514 = 0;
f32 pitchChange; f32 pitchChange;
f32 extent; f32 extent;
f32 invExtent; f32 invExtent;
f32 result; f32 result;
f32 temp; f32 temp;
f32 twoToThe16th = 65536.0f;
s32 one = 1;
SequenceChannel* channel = vib->channel; SequenceChannel* channel = vib->channel;
if (vib->delay != 0) { if (vib->delay != 0) {
@ -160,13 +160,11 @@ f32 Audio_GetVibratoFreqScale(VibratoState* vib) {
extent = temp + 1.0f; extent = temp + 1.0f;
invExtent = 1.0f / extent; invExtent = 1.0f / extent;
// fakematch: 2^16 and 1 need to be set at the very top of this function, result = 1.0f / ((extent - invExtent) * pitchChange / 65536.0f + invExtent);
// 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);
D_80130510 += result; D_80130510 += result;
D_80130514 += one; D_80130514++;
return result; return result;
} }

View file

@ -9,14 +9,20 @@
#define PORTAMENTO_MODE_4 4 #define PORTAMENTO_MODE_4 4
#define PORTAMENTO_MODE_5 5 #define PORTAMENTO_MODE_5 5
extern u8 D_80130470[];
u8 AudioSeq_ScriptReadU8(SeqScriptState* state); u8 AudioSeq_ScriptReadU8(SeqScriptState* state);
s16 AudioSeq_ScriptReadS16(SeqScriptState* state); s16 AudioSeq_ScriptReadS16(SeqScriptState* state);
u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state); u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state);
u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** instOut, AdsrSettings* adsr); 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) { u16 AudioSeq_GetScriptControlFlowArgument(SeqScriptState* state, u8 arg1) {
u8 temp_v0 = D_80130520[arg1 - 0xB0]; u8 temp_v0 = D_80130520[arg1 - 0xB0];
u8 loBits = temp_v0 & 3; u8 loBits = temp_v0 & 3;

View file

@ -1,23 +1,22 @@
#include "global.h" #include "global.h"
void func_800D2E30(UnkRumbleStruct* arg0) { void func_800D2E30(UnkRumbleStruct* arg0) {
static u8 D_8012DBB0 = 1;
s32 i; s32 i;
s32 unk_a3; s32 unk_a3;
s32 index = -1; s32 index = -1;
UnkRumbleStruct* new_var;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
arg0->rumbleEnable[i] = 0; arg0->rumbleEnable[i] = 0;
} }
if (arg0->unk_105 == 0) { if (arg0->unk_105 == 0) {
new_var = arg0;
if (D_8012DBB0 != 0) { if (D_8012DBB0 != 0) {
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
gPadMgr.pakType[i] = 0; gPadMgr.pakType[i] = 0;
} }
} }
D_8012DBB0 = new_var->unk_105; D_8012DBB0 = arg0->unk_105;
return; return;
} }