mirror of
https://github.com/n64decomp/mk64
synced 2026-06-24 16:23:14 -04:00
Fix EU build and related cleanup and fixes (#710)
* Fix EU build and eu-final offsets * Fix instrument align and bring EU matches * Fix EU trig table segment * Label audio_init * Simplify float comments * Proper EU name version defines
This commit is contained in:
+23
-19
@@ -964,9 +964,6 @@ void func_800C36C4(u8 arg0, u8 arg1, u8 arg2, u8 arg3) {
|
||||
D_801930D0[arg0].unk_012 = 1;
|
||||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
GLOBAL_ASM("asm/eu_nonmatchings/func_800C3724.s")
|
||||
#else
|
||||
void func_800C3724(void) {
|
||||
u8 seqPlayerIndex;
|
||||
f32 volume;
|
||||
@@ -1097,6 +1094,12 @@ void func_800C3724(void) {
|
||||
}
|
||||
}
|
||||
if (D_801930D0[seqPlayerIndex].unk_041) {
|
||||
#ifdef VERSION_EU
|
||||
if (func_800C357C_eu(-0x10000000, -0x10000000) == 0) {
|
||||
D_801930D0[seqPlayerIndex].unk_041 = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (D_801930D0[seqPlayerIndex].unk_040 != 0) {
|
||||
D_801930D0[seqPlayerIndex].unk_040--;
|
||||
continue;
|
||||
@@ -1156,7 +1159,6 @@ void func_800C3724(void) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void func_800C3F70(void) {
|
||||
u8 var_v0;
|
||||
@@ -1939,24 +1941,24 @@ void func_800C6108(u8 playerId) {
|
||||
#ifdef VERSION_EU
|
||||
if ((D_800E9EE4[playerId] > 0.5f) || (D_800E9EE4[playerId] < -0.5f))
|
||||
#else
|
||||
if ((D_800E9EE4[playerId] > 0.5f) || (D_800E9EE4[playerId] < 0.5f)) {
|
||||
if ((D_800E9EE4[playerId] > 0.5f) || (D_800E9EE4[playerId] < 0.5f))
|
||||
#endif
|
||||
{
|
||||
D_800E9ED4[playerId] = D_800E9EE4[playerId] * 0.25f;
|
||||
D_800E9F7C[playerId].unk_0C = D_800E9EC4[playerId] + D_800E9ED4[playerId] + D_800E9F34[playerId];
|
||||
}
|
||||
else {
|
||||
D_800E9F7C[playerId].unk_0C = D_800E9EC4[playerId] + D_800E9ED4[playerId] + D_800E9F34[playerId];
|
||||
} else {
|
||||
D_800E9F7C[playerId].unk_0C = D_800E9EB4[playerId] + D_800E9F34[playerId];
|
||||
}
|
||||
}
|
||||
#ifdef VERSION_EU
|
||||
if (D_800E9F7C[playerId].unk_0C < 0.0f) {
|
||||
D_800E9F7C[playerId].unk_0C = 0.0f;
|
||||
}
|
||||
if (D_800E9F7C[playerId].unk_0C < 0.0f) {
|
||||
D_800E9F7C[playerId].unk_0C = 0.0f;
|
||||
}
|
||||
#endif
|
||||
if (D_800E9F7C[playerId].unk_0C > 4.0f) {
|
||||
D_800E9F7C[playerId].unk_0C = 4.0f;
|
||||
}
|
||||
D_800E9EC4[playerId] = D_800E9F7C[playerId].unk_0C;
|
||||
D_800E9F7C[playerId].unk_38 = (D_800E9F7C[playerId].unk_0C / 1.5f) + 0.4f;
|
||||
if (D_800E9F7C[playerId].unk_0C > 4.0f) {
|
||||
D_800E9F7C[playerId].unk_0C = 4.0f;
|
||||
}
|
||||
D_800E9EC4[playerId] = D_800E9F7C[playerId].unk_0C;
|
||||
D_800E9F7C[playerId].unk_38 = (D_800E9F7C[playerId].unk_0C / 1.5f) + 0.4f;
|
||||
}
|
||||
|
||||
void func_800C64A0(u8 playerId) {
|
||||
@@ -2493,8 +2495,9 @@ void func_800C76C0(u8 playerId) {
|
||||
} else if ((D_800EA104 == 1) && (D_800EA0EC[playerId] == 1)) {
|
||||
func_800C5278(5U);
|
||||
#ifndef VERSION_EU
|
||||
if (func_800C3508(1) != 0x000D) {
|
||||
if (func_800C3508(1) != 0x000D)
|
||||
#endif
|
||||
{
|
||||
D_800EA104 = 0;
|
||||
func_800CA414(0x000EU, 0x0017U);
|
||||
}
|
||||
@@ -2516,8 +2519,9 @@ void func_800C76C0(u8 playerId) {
|
||||
} else if ((D_800EA104 == 2) && (D_800EA0EC[playerId] == 1)) {
|
||||
func_800C5278(5U);
|
||||
#ifndef VERSION_EU
|
||||
if (func_800C3508(1) != 0x000E) {
|
||||
if (func_800C3508(1) != 0x000E)
|
||||
#endif
|
||||
{
|
||||
D_800EA104 = 0;
|
||||
func_800CA414(0x000EU, 0x0017U);
|
||||
}
|
||||
|
||||
+49
-42
@@ -755,11 +755,6 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
|
||||
seqPlayer->scriptState.pc = sequenceData;
|
||||
}
|
||||
|
||||
|
||||
#ifdef VERSION_EU
|
||||
GLOBAL_ASM("asm/eu_nonmatchings/audio_init.s")
|
||||
#else
|
||||
|
||||
extern u8 _audio_banksSegmentRomStart;
|
||||
extern u8 _audio_tablesSegmentRomStart;
|
||||
extern u8 _instrument_setsSegmentRomStart;
|
||||
@@ -774,14 +769,14 @@ void audio_init(void) {
|
||||
s32 i;
|
||||
UNUSED s32 pad[6];
|
||||
s32 j, k;
|
||||
s32 aaa;
|
||||
u32 sp60[2];
|
||||
s32 ctlSeqCount;
|
||||
u32 buf[2];
|
||||
UNUSED s32 lim2, lim3;
|
||||
s32 size;
|
||||
u64* ptr64;
|
||||
UNUSED void *data;
|
||||
UNUSED s32 pad2;
|
||||
UNUSED s32 one = 1;
|
||||
u8* test;
|
||||
void* data;
|
||||
|
||||
gAudioLoadLock = 0;
|
||||
|
||||
@@ -797,21 +792,26 @@ void audio_init(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (osTvType) { /* irregular */
|
||||
case 0:
|
||||
#ifdef VERSION_EU
|
||||
D_803B7178 = 20.03042f;
|
||||
gRefreshRate = 50;
|
||||
#else // US
|
||||
switch (osTvType) {
|
||||
case TV_TYPE_PAL:
|
||||
D_803B7178 = 20.03042f;
|
||||
gRefreshRate = 0x00000032;
|
||||
gRefreshRate = 50;
|
||||
break;
|
||||
case 2:
|
||||
case TV_TYPE_MPAL:
|
||||
D_803B7178 = 16.546f;
|
||||
gRefreshRate = 0x0000003C;
|
||||
gRefreshRate = 60;
|
||||
break;
|
||||
case 1:
|
||||
case TV_TYPE_NTSC:
|
||||
default:
|
||||
D_803B7178 = 16.713f;
|
||||
gRefreshRate = 0x0000003C;
|
||||
gRefreshRate = 60;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
port_eu_init();
|
||||
if (k) {} // fake
|
||||
for (i = 0; i < NUMAIBUFFERS; i++) {
|
||||
@@ -842,42 +842,49 @@ void audio_init(void) {
|
||||
gAudioResetPresetIdToLoad = 0;
|
||||
gAudioResetStatus = one;
|
||||
audio_shut_down_and_reset_step();
|
||||
gSeqFileHeader = (ALSeqFile*) sp60;
|
||||
test = &_sequencesSegmentRomStart;
|
||||
audio_dma_copy_immediate(test, gSeqFileHeader, 0x00000010U);
|
||||
|
||||
// Load headers for sounds and sequences
|
||||
gSeqFileHeader = (ALSeqFile*) buf;
|
||||
data = &_sequencesSegmentRomStart;
|
||||
audio_dma_copy_immediate(data, gSeqFileHeader, 0x10);
|
||||
gSequenceCount = gSeqFileHeader->seqCount;
|
||||
size = gSequenceCount * sizeof(ALSeqData) + 4;
|
||||
size = ALIGN16(size);
|
||||
gSeqFileHeader = soundAlloc(&gAudioInitPool, size);
|
||||
audio_dma_copy_immediate(test, gSeqFileHeader, size);
|
||||
func_800BB43C(gSeqFileHeader, test);
|
||||
gAlCtlHeader = (ALSeqFile*) sp60;
|
||||
test = &_audio_banksSegmentRomStart;
|
||||
audio_dma_copy_immediate(test, gAlCtlHeader, 0x00000010U);
|
||||
aaa = gAlCtlHeader->seqCount;
|
||||
size = ALIGN16(aaa * sizeof(ALSeqData) + 4);
|
||||
gAlCtlHeader = soundAlloc(&gAudioInitPool, size);
|
||||
audio_dma_copy_immediate(test, gAlCtlHeader, size);
|
||||
func_800BB43C(gAlCtlHeader, test);
|
||||
gCtlEntries = soundAlloc(&gAudioInitPool, aaa * 0xC);
|
||||
for (i = 0; i < aaa; i++) {
|
||||
audio_dma_copy_immediate(gAlCtlHeader->seqArray[i].offset, sp60, 0x00000010U);
|
||||
audio_dma_copy_immediate(data, gSeqFileHeader, size);
|
||||
func_800BB43C(gSeqFileHeader, data);
|
||||
|
||||
gCtlEntries[i].numInstruments = sp60[0];
|
||||
gCtlEntries[i].numDrums = sp60[1];
|
||||
// Load header for CTL (instrument metadata)
|
||||
gAlCtlHeader = (ALSeqFile*) buf;
|
||||
data = &_audio_banksSegmentRomStart;
|
||||
audio_dma_copy_immediate(data, gAlCtlHeader, 0x10);
|
||||
ctlSeqCount = gAlCtlHeader->seqCount;
|
||||
size = ALIGN16(ctlSeqCount * sizeof(ALSeqData) + 4);
|
||||
gAlCtlHeader = soundAlloc(&gAudioInitPool, size);
|
||||
audio_dma_copy_immediate(data, gAlCtlHeader, size);
|
||||
func_800BB43C(gAlCtlHeader, data);
|
||||
gCtlEntries = soundAlloc(&gAudioInitPool, ctlSeqCount * sizeof(struct CtlEntry));
|
||||
for (i = 0; i < ctlSeqCount; i++) {
|
||||
audio_dma_copy_immediate(gAlCtlHeader->seqArray[i].offset, buf, 0x10);
|
||||
gCtlEntries[i].numInstruments = buf[0];
|
||||
gCtlEntries[i].numDrums = buf[1];
|
||||
}
|
||||
gAlTbl = (ALSeqFile*) sp60;
|
||||
test = &_audio_tablesSegmentRomStart;
|
||||
audio_dma_copy_immediate(test, gAlTbl, 0x00000010U);
|
||||
|
||||
// Load header for TBL (raw sound data)
|
||||
gAlTbl = (ALSeqFile*) buf;
|
||||
data = &_audio_tablesSegmentRomStart;
|
||||
audio_dma_copy_immediate(data, gAlTbl, 0x10);
|
||||
size = gAlTbl->seqCount * sizeof(ALSeqData) + 4;
|
||||
size = ALIGN16(size);
|
||||
gAlTbl = soundAlloc(&gAudioInitPool, size);
|
||||
audio_dma_copy_immediate(test, gAlTbl, size);
|
||||
func_800BB43C(gAlTbl, test);
|
||||
gAlBankSets = soundAlloc(&gAudioInitPool, 0x00000100U);
|
||||
audio_dma_copy_immediate((u32) &_instrument_setsSegmentRomStart, gAlBankSets, 0x00000100U);
|
||||
audio_dma_copy_immediate(data, gAlTbl, size);
|
||||
func_800BB43C(gAlTbl, data);
|
||||
|
||||
// Load bank sets for each sequence
|
||||
gAlBankSets = soundAlloc(&gAudioInitPool, 0x100);
|
||||
audio_dma_copy_immediate((u8 *) &_instrument_setsSegmentRomStart, gAlBankSets, 0x100);
|
||||
|
||||
sound_alloc_pool_init(&gUnkPool1.pool, soundAlloc(&gAudioInitPool, (u32) D_800EA5D8), (u32) D_800EA5D8);
|
||||
init_sequence_players();
|
||||
gAudioLoadLock = 0x76557364;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -231,7 +231,7 @@ void process_notes(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU_1_0
|
||||
#ifdef VERSION_EU_V10
|
||||
// Just threw these in here. They are probably wrong place and variables.
|
||||
stubbed_printf("----------------------Double-Error CH: %x %f\n", ¬e, note->parentLayer->seqChannel);
|
||||
stubbed_printf("----------------------Double-Error NT: %x\n", ¬e);
|
||||
|
||||
@@ -24,7 +24,7 @@ char seqplayer_unused_string02[] = "Audio:Track: Warning :SUBTRACK had been stol
|
||||
char seqplayer_unused_string03[] = "SEQID %d,BANKID %d\n";
|
||||
char seqplayer_unused_string04[] = "ERR:SUBTRACK %d NOT ALLOCATED\n";
|
||||
char seqplayer_unused_string05[] = "Error:Same List Add\n";
|
||||
#ifdef VERSION_EU_1_0
|
||||
#ifdef VERSION_EU_V10
|
||||
char seqplayer_unused_string_eu_01[] = "Wait Time out!\n";
|
||||
#endif
|
||||
char seqplayer_unused_string06[] = "Macro Level Over Error!\n";
|
||||
@@ -363,7 +363,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer* layer) {
|
||||
if (!layer->continuousNotes) {
|
||||
seq_channel_layer_note_decay(layer);
|
||||
}
|
||||
#ifdef VERSION_EU_1_0
|
||||
#ifdef VERSION_EU_V10
|
||||
else {
|
||||
if ((layer->note != 0) && (layer == layer->note->wantedParentLayer)) {
|
||||
seq_channel_layer_note_decay(layer);
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
#include <segments.h>
|
||||
|
||||
u16 gRandomSeed16;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
u8 randomSeedPadding[16];
|
||||
#else
|
||||
u8 randomSeedPadding[216];
|
||||
#endif
|
||||
|
||||
@@ -6,8 +6,4 @@
|
||||
* See trig_tables.c for the real file.
|
||||
*/
|
||||
|
||||
#ifdef VERSION_EU
|
||||
ALIGNED8 u8 trigTablesPadding[0x5750];
|
||||
#else
|
||||
ALIGNED8 u8 trigTablesPadding[0x5810];
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user