summaryrefslogtreecommitdiff
path: root/src/audio
diff options
context:
space:
mode:
authorcoco875 <59367621+coco875@users.noreply.github.com>2025-07-01 23:42:14 +0000
committerGitHub <noreply@github.com>2025-07-01 17:42:14 -0600
commit7937896598f3df46eb78c158bde787bc4f12ad7f (patch)
tree876548daaec2f8a5bb284374d834abcf9aad15b9 /src/audio
parentb57afa83b42bb14e526043be4ca9f6e322788edb (diff)
make some texture more flexible and editable + port documentation from the decomp + fix some bug (#309)
* support a more flexible background * remove useless function * rename of some font * experimental png * migrate to the new initdata * fix skybox and adjust minimap * format in audio * simplify player render * simplify shell render and support custom texture of shell * clean redshell texture * format and multiple fix * some update of name * allow change icon of character * more rename * continue rename * more documentation and simplification * change lus and continue rename * continue rename * few fix for asan * fix ghost * Update menu_items.c * fix mac error * some test of tweak for texture * some tweak * some button constant * finish fix ghost * Update menu_items.c * Update render_objects.c * Update menu_items.c * Update libultraship * Update libultraship * Delete valgrind.report * Update libultraship * callgrind benchmark * Update valgrind_callgrind.sh * fix animation * some rename * remove useless submodule * Update libultraship * fix assets * fix mistake * fix more mistake * Update menu_items.c * sync more rename with the decom + fix review * fix a mistake * fix more mistake * re add the limit of fps * fix some hd texture and minimap * fix a name * Update menu_items.c * fix a regression * fix some segment 5 texture (not all) * Update camera.c * improve performance of custom sprite * fix flatten bug and add documentation on player vertex * Update render_player.c * fix data menu * fix trophy for 50 and 150 * Update memory.c * Update code_80057C60.c * fix ghost * fix boo tlut * fix a mistake in yaml * fix yaml * Update common_data.yml * add comment for segment 3 * allow even more change in texture * Update common_data.yml * Update update.inc.c * Update camera.c * Update some_data.c * wip changes * Update other_textures.yml * More changes * Update update_objects.c * Fix compile * Update memory.c * Update memory.c --------- Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/external.c6
-rw-r--r--src/audio/load.c8
-rw-r--r--src/audio/seqplayer.c21
-rw-r--r--src/audio/synthesis.c7
4 files changed, 24 insertions, 18 deletions
diff --git a/src/audio/external.c b/src/audio/external.c
index 44923ab90..0dae888a4 100644
--- a/src/audio/external.c
+++ b/src/audio/external.c
@@ -1935,7 +1935,7 @@ void func_800C6108(u8 playerId) {
} else {
D_800E9E54[playerId] = (f32) -player->unk_0C0;
}
- if ((player->effects & 0x10) == 0x10) {
+ if ((player->effects & DRIFTING_EFFECT) == DRIFTING_EFFECT) {
D_800E9EB4[playerId] = D_800E9E64[playerId] + D_800E9DE4[playerId];
} else {
D_800E9EB4[playerId] = D_800E9E64[playerId] + D_800E9DE4[playerId] - (D_800E9E54[playerId] / 12000.0f);
@@ -2205,7 +2205,7 @@ void func_800C683C(u8 cameraId) {
void func_800C70A8(u8 playerId) {
if (D_800EA0EC[playerId] == 0) {
D_800E9E74[playerId] = 0;
- if ((D_800E9E54[playerId] > 3500.0f) || ((gPlayers[playerId].effects & 0x10) == 0x10)) {
+ if ((D_800E9E54[playerId] > 3500.0f) || ((gPlayers[playerId].effects & DRIFTING_EFFECT) == DRIFTING_EFFECT)) {
D_800E9E74[playerId] = 1;
switch (gPlayers[playerId].tyres[AUDIO_LEFT_TYRE].surfaceType) {
case DIRT: /* switch 1 */
@@ -2237,7 +2237,7 @@ void func_800C70A8(u8 playerId) {
break;
}
}
- if ((gPlayers[playerId].effects & 0x10) == 0x10) {
+ if ((gPlayers[playerId].effects & DRIFTING_EFFECT) == DRIFTING_EFFECT) {
D_800E9E74[playerId] = 2;
switch (gPlayers[playerId].tyres[AUDIO_LEFT_TYRE].surfaceType) { /* switch 2 */
case DIRT: /* switch 2 */
diff --git a/src/audio/load.c b/src/audio/load.c
index 4a56b86d7..2efa086af 100644
--- a/src/audio/load.c
+++ b/src/audio/load.c
@@ -240,8 +240,9 @@ void* dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8* dmaIndexRef) {
dma->ttl = 2;
dma->source = dmaDevAddr;
dma->sizeUnused = transfer;
- osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount++], OS_MESG_PRI_NORMAL, OS_READ, dmaDevAddr,
- dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
+ dma->buffer = dmaDevAddr;
+ // osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount++], OS_MESG_PRI_NORMAL, OS_READ, dmaDevAddr,
+ // dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
*dmaIndexRef = dmaIndex;
return (devAddr - dmaDevAddr) + dma->buffer;
}
@@ -329,6 +330,7 @@ s32 func_800BB304(struct AudioBankSample* sample) {
sample->loaded = 0x81;
sample->sampleAddr = mem; // sound->unk4
}
+ return 0;
}
s32 func_800BB388(s32 bankId, s32 instId, s32 arg2) {
@@ -414,7 +416,7 @@ void func_800BB584(s32 bankId) {
u8* var_a1;
if (gAlTbl->seqArray[bankId].len == 0) {
- var_a1 = gAlTbl->seqArray[(s32) gAlTbl->seqArray[bankId].offset].offset;
+ var_a1 = gAlTbl->seqArray[(uintptr_t) gAlTbl->seqArray[bankId].offset].offset;
} else {
var_a1 = gAlTbl->seqArray[bankId].offset;
}
diff --git a/src/audio/seqplayer.c b/src/audio/seqplayer.c
index c25eb8196..7b66d1058 100644
--- a/src/audio/seqplayer.c
+++ b/src/audio/seqplayer.c
@@ -11,6 +11,8 @@
#include "audio/external.h"
#include "port/Engine.h"
+#include <stdio.h>
+
/**
* Given that (almost) all of these are format strings, it is highly likely
* that they are meant to be used in some sort of printf variant. But I don't
@@ -733,14 +735,15 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer* layer) {
if (seqChannel) {}
}
-u8 get_instrument(struct SequenceChannel *seqChannel, u8 instId, struct Instrument **instOut, struct AdsrSettings *adsr) {
- struct CtlEntry *bank = GameEngine_LoadBank(seqChannel->bankId);
- if(instId >= bank->numInstruments) {
+u8 get_instrument(struct SequenceChannel* seqChannel, u8 instId, struct Instrument** instOut,
+ struct AdsrSettings* adsr) {
+ struct CtlEntry* bank = GameEngine_LoadBank(seqChannel->bankId);
+ if (instId >= bank->numInstruments) {
*instOut = NULL;
return 0;
}
struct Instrument* inst = bank->instruments[instId];
- if(inst == NULL) {
+ if (inst == NULL) {
*instOut = NULL;
return 0;
}
@@ -911,9 +914,9 @@ void sequence_channel_process_script(struct SequenceChannel* seqChannel) {
case 0xEB: {
cmd = m64_read_u8(state);
- struct AudioSequenceData *sequence = GameEngine_LoadSequence(seqPlayer->seqId);
+ struct AudioSequenceData* sequence = GameEngine_LoadSequence(seqPlayer->seqId);
cmd = sequence->banks[cmd];
- if(IS_BANK_LOAD_COMPLETE(cmd)) {
+ if (IS_BANK_LOAD_COMPLETE(cmd)) {
seqChannel->bankId = cmd;
}
}
@@ -1009,9 +1012,9 @@ void sequence_channel_process_script(struct SequenceChannel* seqChannel) {
case 0xC6: {
cmd = m64_read_u8(state);
- struct AudioSequenceData *sequence = GameEngine_LoadSequence(seqPlayer->seqId);
+ struct AudioSequenceData* sequence = GameEngine_LoadSequence(seqPlayer->seqId);
cmd = sequence->banks[cmd];
- if(IS_BANK_LOAD_COMPLETE(cmd)) {
+ if (IS_BANK_LOAD_COMPLETE(cmd)) {
seqChannel->bankId = cmd;
}
break;
@@ -1214,7 +1217,7 @@ void sequence_player_process_sequence(struct SequencePlayer* seqPlayer) {
if (seqPlayer->enabled == false) {
return;
}
-
+
GameEngine_LoadSequence(seqPlayer->seqId);
GameEngine_LoadBank(seqPlayer->defaultBank[0]);
diff --git a/src/audio/synthesis.c b/src/audio/synthesis.c
index aecf4e732..69cee4ef6 100644
--- a/src/audio/synthesis.c
+++ b/src/audio/synthesis.c
@@ -470,11 +470,12 @@ Acmd* synthesis_process_note(s32 noteIndex, struct NoteSubEu* noteSubEu, struct
if (loopInfo_2 != 0) {
temp_t6 = ((synthesisState->samplePosInt - s3) + 16) / 16; // diff from sm64 sh
if (audioBookSample->loaded == 0x81) { // sm64 has audioBookSample->medium
- var_a0_2 = (temp_t6 * 9) + sampleAddr;
+ var_a0_2 = &sampleAddr[temp_t6 * 9];
} else {
var_a0_2 = (temp_t6 * 9) + sampleAddr;
// var_a0_2 =
- // dma_sample_data((uintptr_t) (temp_t6 * 9) + sampleAddr, ALIGN(((loopInfo_2 * 9) + 16), 4),
+ // dma_sample_data((uintptr_t) (temp_t6 * 9) + sampleAddr, ALIGN(((loopInfo_2 * 9) + 16),
+ // 4),
// flags, &synthesisState->sampleDmaIndex);
// unsure flags?
}
@@ -576,7 +577,7 @@ Acmd* synthesis_process_note(s32 noteIndex, struct NoteSubEu* noteSubEu, struct
resampledTempLen + DMEM_ADDR_RESAMPLED);
break;
}
- //break;
+ // break;
}
if (noteSubEu->finished != false) {
break;