You've already forked ultrasm64-2
mirror of
https://github.com/HackerN64/ultrasm64-2.git
synced 2026-01-21 10:38:08 -08:00
Refresh 15
This commit is contained in:
@@ -2110,10 +2110,11 @@ void set_audio_muted(u8 muted) {
|
||||
|
||||
for (i = 0; i < SEQUENCE_PLAYERS; i++) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
if (muted)
|
||||
if (muted) {
|
||||
func_802ad74c(0xf1000000, 0);
|
||||
else
|
||||
} else {
|
||||
func_802ad74c(0xf2000000, 0);
|
||||
}
|
||||
#else
|
||||
gSequencePlayers[i].muted = muted;
|
||||
#endif
|
||||
|
||||
@@ -82,8 +82,7 @@ void unk_pools_init(u32 size1, u32 size2);
|
||||
* Assuming 'k' in [9, 24],
|
||||
* Computes a newton's method step for f(x) = x^k - d
|
||||
*/
|
||||
f64 root_newton_step(f64 x, s32 k, f64 d)
|
||||
{
|
||||
f64 root_newton_step(f64 x, s32 k, f64 d) {
|
||||
f64 deg2 = x * x;
|
||||
f64 deg4 = deg2 * deg2;
|
||||
f64 deg8 = deg4 * deg4;
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
#define IS_BANK_LOAD_COMPLETE(bankId) (gBankLoadStatus[bankId] >= SOUND_LOAD_STATUS_COMPLETE)
|
||||
#define IS_SEQ_LOAD_COMPLETE(seqId) (gSeqLoadStatus[seqId] >= SOUND_LOAD_STATUS_COMPLETE)
|
||||
|
||||
struct SoundAllocPool
|
||||
{
|
||||
struct SoundAllocPool {
|
||||
u8 *start;
|
||||
u8 *cur;
|
||||
u32 size;
|
||||
@@ -34,15 +33,13 @@ struct SeqOrBankEntry {
|
||||
#endif
|
||||
}; // size = 0xC
|
||||
|
||||
struct PersistentPool
|
||||
{
|
||||
struct PersistentPool {
|
||||
/*0x00*/ u32 numEntries;
|
||||
/*0x04*/ struct SoundAllocPool pool;
|
||||
/*0x14*/ struct SeqOrBankEntry entries[32];
|
||||
}; // size = 0x194
|
||||
|
||||
struct TemporaryPool
|
||||
{
|
||||
struct TemporaryPool {
|
||||
/*EU, SH*/
|
||||
/*0x00, 0x00*/ u32 nextSide;
|
||||
/*0x04, */ struct SoundAllocPool pool;
|
||||
@@ -59,21 +56,18 @@ struct TemporaryPool
|
||||
/*0x28, 0x2A entries[1].id */
|
||||
}; // size = 0x2C
|
||||
|
||||
struct SoundMultiPool
|
||||
{
|
||||
struct SoundMultiPool {
|
||||
/*0x000*/ struct PersistentPool persistent;
|
||||
/*0x194*/ struct TemporaryPool temporary;
|
||||
/* */ u32 pad2[4];
|
||||
}; // size = 0x1D0
|
||||
|
||||
struct Unk1Pool
|
||||
{
|
||||
struct Unk1Pool {
|
||||
struct SoundAllocPool pool;
|
||||
struct SeqOrBankEntry entries[32];
|
||||
};
|
||||
|
||||
struct UnkEntry
|
||||
{
|
||||
struct UnkEntry {
|
||||
s8 used;
|
||||
s8 medium;
|
||||
s8 bankId;
|
||||
@@ -83,8 +77,7 @@ struct UnkEntry
|
||||
u32 size;
|
||||
};
|
||||
|
||||
struct UnkPool
|
||||
{
|
||||
struct UnkPool {
|
||||
/*0x00*/ struct SoundAllocPool pool;
|
||||
/*0x10*/ struct UnkEntry entries[64];
|
||||
/*0x510*/ s32 numEntries;
|
||||
|
||||
@@ -93,8 +93,7 @@
|
||||
|
||||
struct NotePool;
|
||||
|
||||
struct AudioListItem
|
||||
{
|
||||
struct AudioListItem {
|
||||
// A node in a circularly linked list. Each node is either a head or an item:
|
||||
// - Items can be either detached (prev = NULL), or attached to a list.
|
||||
// 'value' points to something of interest.
|
||||
@@ -111,8 +110,7 @@ struct AudioListItem
|
||||
struct NotePool *pool;
|
||||
}; // size = 0x10
|
||||
|
||||
struct NotePool
|
||||
{
|
||||
struct NotePool {
|
||||
struct AudioListItem disabled;
|
||||
struct AudioListItem decaying;
|
||||
struct AudioListItem releasing;
|
||||
@@ -154,8 +152,7 @@ struct AdsrEnvelope {
|
||||
s16 arg;
|
||||
}; // size = 0x4
|
||||
|
||||
struct AdpcmLoop
|
||||
{
|
||||
struct AdpcmLoop {
|
||||
u32 start;
|
||||
u32 end;
|
||||
u32 count;
|
||||
@@ -163,15 +160,13 @@ struct AdpcmLoop
|
||||
s16 state[16]; // only exists if count != 0. 8-byte aligned
|
||||
};
|
||||
|
||||
struct AdpcmBook
|
||||
{
|
||||
struct AdpcmBook {
|
||||
s32 order;
|
||||
s32 npredictors;
|
||||
s16 book[1]; // size 8 * order * npredictors. 8-byte aligned
|
||||
};
|
||||
|
||||
struct AudioBankSample
|
||||
{
|
||||
struct AudioBankSample {
|
||||
#ifdef VERSION_SH
|
||||
/* 0x00 */ u32 codec : 4;
|
||||
/* 0x00 */ u32 medium : 2;
|
||||
@@ -190,14 +185,12 @@ struct AudioBankSample
|
||||
#endif
|
||||
};
|
||||
|
||||
struct AudioBankSound
|
||||
{
|
||||
struct AudioBankSound {
|
||||
struct AudioBankSample *sample;
|
||||
f32 tuning; // frequency scale factor
|
||||
}; // size = 0x8
|
||||
|
||||
struct Instrument
|
||||
{
|
||||
struct Instrument {
|
||||
/*0x00*/ u8 loaded;
|
||||
/*0x01*/ u8 normalRangeLo;
|
||||
/*0x02*/ u8 normalRangeHi;
|
||||
@@ -208,8 +201,7 @@ struct Instrument
|
||||
/*0x18*/ struct AudioBankSound highNotesSound;
|
||||
}; // size = 0x20
|
||||
|
||||
struct Drum
|
||||
{
|
||||
struct Drum {
|
||||
u8 releaseRate;
|
||||
u8 pan;
|
||||
u8 loaded;
|
||||
@@ -217,14 +209,12 @@ struct Drum
|
||||
struct AdsrEnvelope *envelope;
|
||||
};
|
||||
|
||||
struct AudioBank
|
||||
{
|
||||
struct AudioBank {
|
||||
struct Drum **drums;
|
||||
struct Instrument *instruments[1];
|
||||
}; // dynamic size
|
||||
|
||||
struct CtlEntry
|
||||
{
|
||||
struct CtlEntry {
|
||||
#ifndef VERSION_SH
|
||||
u8 unused;
|
||||
#endif
|
||||
@@ -246,8 +236,7 @@ struct M64ScriptState {
|
||||
}; // size = 0x1C
|
||||
|
||||
// Also known as a Group, according to debug strings.
|
||||
struct SequencePlayer
|
||||
{
|
||||
struct SequencePlayer {
|
||||
/*US/JP, EU, SH */
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
/*0x000, 0x000, 0x000*/ u8 enabled : 1;
|
||||
@@ -325,8 +314,7 @@ struct SequencePlayer
|
||||
/*0x13C, 0x144*/ ssize_t bankDmaRemaining;
|
||||
}; // size = 0x140, 0x148 on EU, 0x14C on SH
|
||||
|
||||
struct AdsrSettings
|
||||
{
|
||||
struct AdsrSettings {
|
||||
u8 releaseRate;
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
u8 sustain;
|
||||
@@ -388,8 +376,7 @@ struct ReverbInfo {
|
||||
s16 *filter;
|
||||
};
|
||||
|
||||
struct NoteAttributes
|
||||
{
|
||||
struct NoteAttributes {
|
||||
u8 reverbVol;
|
||||
#ifdef VERSION_SH
|
||||
u8 synthesisVolume; // UQ4.4, although 0 <= x < 1 is rounded up to 1
|
||||
@@ -412,8 +399,7 @@ struct NoteAttributes
|
||||
|
||||
// Also known as a SubTrack, according to debug strings.
|
||||
// Confusingly, a SubTrack is a container of Tracks.
|
||||
struct SequenceChannel
|
||||
{
|
||||
struct SequenceChannel {
|
||||
/* U/J, EU, SH */
|
||||
/*0x00, 0x00*/ u8 enabled : 1;
|
||||
/*0x00, 0x00*/ u8 finished : 1;
|
||||
@@ -495,8 +481,7 @@ struct SequenceChannel
|
||||
}; // size = 0xC0, 0xC4 in EU, 0xD0 in SH
|
||||
|
||||
// Also known as a Track, according to debug strings.
|
||||
struct SequenceChannelLayer
|
||||
{
|
||||
struct SequenceChannelLayer {
|
||||
/* U/J, EU, SH */
|
||||
/*0x00, 0x00*/ u8 enabled : 1;
|
||||
/*0x00, 0x00*/ u8 finished : 1;
|
||||
@@ -554,8 +539,7 @@ struct SequenceChannelLayer
|
||||
}; // size = 0x80
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
struct NoteSynthesisState
|
||||
{
|
||||
struct NoteSynthesisState {
|
||||
/*0x00*/ u8 restart;
|
||||
/*0x01*/ u8 sampleDmaIndex;
|
||||
/*0x02*/ u8 prevHeadsetPanRight;
|
||||
@@ -570,8 +554,7 @@ struct NoteSynthesisState
|
||||
/*0x10*/ s16 curVolLeft; // UQ0.16 (EU Q1.15)
|
||||
/*0x12*/ s16 curVolRight; // UQ0.16 (EU Q1.15)
|
||||
};
|
||||
struct NotePlaybackState
|
||||
{
|
||||
struct NotePlaybackState {
|
||||
/* U/J, EU, SH */
|
||||
/*0x04, 0x00, 0x00*/ u8 priority;
|
||||
/* 0x01, 0x01*/ u8 waveId;
|
||||
@@ -591,8 +574,7 @@ struct NotePlaybackState
|
||||
/*0x74, 0x4C, */ struct Portamento portamento;
|
||||
/*0x84, 0x5C, */ struct VibratoState vibratoState;
|
||||
};
|
||||
struct NoteSubEu
|
||||
{
|
||||
struct NoteSubEu {
|
||||
/*0x00*/ volatile u8 enabled : 1;
|
||||
/*0x00*/ u8 needsInit : 1;
|
||||
/*0x00*/ u8 finished : 1;
|
||||
@@ -624,8 +606,7 @@ struct NoteSubEu
|
||||
/*0x10*/ s16 *filter;
|
||||
#endif
|
||||
};
|
||||
struct Note
|
||||
{
|
||||
struct Note {
|
||||
/* U/J, EU, SH */
|
||||
/*0xA4, 0x00, 0x00*/ struct AudioListItem listItem;
|
||||
/* 0x10, 0x10*/ struct NoteSynthesisState synthesisState;
|
||||
@@ -660,14 +641,12 @@ struct Note
|
||||
}; // size = 0xC0, known to be 0xC8 on SH
|
||||
#else
|
||||
// volatile Note, needed in synthesis_process_notes
|
||||
struct vNote
|
||||
{
|
||||
struct vNote {
|
||||
/* U/J, EU */
|
||||
/*0x00*/ volatile u8 enabled : 1;
|
||||
long long int force_structure_alignment;
|
||||
}; // size = 0xC0
|
||||
struct Note
|
||||
{
|
||||
struct Note {
|
||||
/* U/J, EU */
|
||||
/*0x00*/ u8 enabled : 1;
|
||||
/*0x00*/ u8 needsInit : 1;
|
||||
@@ -717,8 +696,7 @@ struct Note
|
||||
}; // size = 0xC0
|
||||
#endif
|
||||
|
||||
struct NoteSynthesisBuffers
|
||||
{
|
||||
struct NoteSynthesisBuffers {
|
||||
s16 adpcmdecState[0x10];
|
||||
s16 finalResampleState[0x10];
|
||||
#ifdef VERSION_SH
|
||||
@@ -737,15 +715,13 @@ struct NoteSynthesisBuffers
|
||||
};
|
||||
|
||||
#ifdef VERSION_EU
|
||||
struct ReverbSettingsEU
|
||||
{
|
||||
struct ReverbSettingsEU {
|
||||
u8 downsampleRate;
|
||||
u8 windowSize; // To be multiplied by 64
|
||||
u16 gain;
|
||||
};
|
||||
#else
|
||||
struct ReverbSettingsEU
|
||||
{
|
||||
struct ReverbSettingsEU {
|
||||
u8 downsampleRate; // always 1
|
||||
u8 windowSize; // To be multiplied by 16
|
||||
u16 gain;
|
||||
@@ -758,8 +734,7 @@ struct ReverbSettingsEU
|
||||
};
|
||||
#endif
|
||||
|
||||
struct AudioSessionSettingsEU
|
||||
{
|
||||
struct AudioSessionSettingsEU {
|
||||
/* 0x00 */ u32 frequency;
|
||||
/* 0x04 */ u8 unk1; // always 1
|
||||
/* 0x05 */ u8 maxSimultaneousNotes;
|
||||
@@ -782,8 +757,7 @@ struct AudioSessionSettingsEU
|
||||
#endif
|
||||
}; // 0x30 on shindou
|
||||
|
||||
struct AudioSessionSettings
|
||||
{
|
||||
struct AudioSessionSettings {
|
||||
/*0x00*/ u32 frequency;
|
||||
/*0x04*/ u8 maxSimultaneousNotes;
|
||||
/*0x05*/ u8 reverbDownsampleRate; // always 1
|
||||
|
||||
@@ -974,7 +974,8 @@ void audio_init() {
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_N64
|
||||
eu_stubbed_printf_3("Clear Workarea %x -%x size %x \n",
|
||||
eu_stubbed_printf_3(
|
||||
"Clear Workarea %x -%x size %x \n",
|
||||
(uintptr_t) &gAudioGlobalsStartMarker,
|
||||
(uintptr_t) &gAudioGlobalsEndMarker,
|
||||
(uintptr_t) &gAudioGlobalsEndMarker - (uintptr_t) &gAudioGlobalsStartMarker
|
||||
|
||||
@@ -254,8 +254,7 @@ void init_sample_dma_buffers(UNUSED s32 arg0) {
|
||||
sSampleDmas = sound_alloc_uninitialized(&gNotesAndBuffersPool,
|
||||
gMaxSimultaneousNotes * 4 * sizeof(struct SharedDma) * gAudioBufferParameters.presetUnk4);
|
||||
|
||||
for (i = 0; i < gMaxSimultaneousNotes * 3 * gAudioBufferParameters.presetUnk4; i++)
|
||||
{
|
||||
for (i = 0; i < gMaxSimultaneousNotes * 3 * gAudioBufferParameters.presetUnk4; i++) {
|
||||
if ((sSampleDmas[gSampleDmaNumListItems].buffer = sound_alloc_uninitialized(&gNotesAndBuffersPool, sDmaBufSize)) == NULL) {
|
||||
break;
|
||||
}
|
||||
@@ -622,8 +621,7 @@ void *func_sh_802f3764(s32 poolIdx, s32 idx, s32 *arg2) {
|
||||
devAddr = f->seqArray[idx].offset;
|
||||
|
||||
|
||||
switch (sp18)
|
||||
{
|
||||
switch (sp18) {
|
||||
case 0:
|
||||
vAddr = unk_pool1_alloc(poolIdx, idx, size);
|
||||
if (vAddr == NULL) {
|
||||
@@ -1033,7 +1031,8 @@ void audio_init() {
|
||||
port_eu_init();
|
||||
|
||||
#ifdef TARGET_N64
|
||||
eu_stubbed_printf_3("Clear Workarea %x -%x size %x \n",
|
||||
eu_stubbed_printf_3(
|
||||
"Clear Workarea %x -%x size %x \n",
|
||||
(uintptr_t) &gAudioGlobalsStartMarker,
|
||||
(uintptr_t) &gAudioGlobalsEndMarker,
|
||||
(uintptr_t) &gAudioGlobalsEndMarker - (uintptr_t) &gAudioGlobalsStartMarker
|
||||
@@ -1544,7 +1543,7 @@ s32 func_sh_802f573c(s32 audioResetStatus) {
|
||||
|
||||
if (D_SH_8034F68C > 0) {
|
||||
if (audioResetStatus != 0) {
|
||||
if (osRecvMesg(&gUnkQueue2, (OSMesg *) &idx, OS_MESG_NOBLOCK)){
|
||||
if (osRecvMesg(&gUnkQueue2, (OSMesg *) &idx, OS_MESG_NOBLOCK)) {
|
||||
}
|
||||
D_SH_8034F68C = 0;
|
||||
return 0;
|
||||
|
||||
@@ -134,44 +134,44 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
s32 i;
|
||||
|
||||
switch (cmd->u.s.op) {
|
||||
case 0x81:
|
||||
preload_sequence(cmd->u.s.arg2, 3);
|
||||
break;
|
||||
case 0x81:
|
||||
preload_sequence(cmd->u.s.arg2, 3);
|
||||
break;
|
||||
|
||||
case 0x82:
|
||||
case 0x88:
|
||||
load_sequence(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
|
||||
func_8031D690(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
break;
|
||||
case 0x82:
|
||||
case 0x88:
|
||||
load_sequence(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
|
||||
func_8031D690(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
break;
|
||||
|
||||
case 0x83:
|
||||
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE) {
|
||||
if (cmd->u2.as_s32 == 0) {
|
||||
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
|
||||
case 0x83:
|
||||
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE) {
|
||||
if (cmd->u2.as_s32 == 0) {
|
||||
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
|
||||
}
|
||||
else {
|
||||
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
}
|
||||
}
|
||||
else {
|
||||
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
break;
|
||||
|
||||
case 0xf0:
|
||||
gSoundMode = cmd->u2.as_s32;
|
||||
break;
|
||||
|
||||
case 0xf1:
|
||||
for (i = 0; i < 4; i++) {
|
||||
gSequencePlayers[i].muted = TRUE;
|
||||
gSequencePlayers[i].recalculateVolume = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 0xf0:
|
||||
gSoundMode = cmd->u2.as_s32;
|
||||
break;
|
||||
|
||||
case 0xf1:
|
||||
for (i = 0; i < 4; i++) {
|
||||
gSequencePlayers[i].muted = TRUE;
|
||||
gSequencePlayers[i].recalculateVolume = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xf2:
|
||||
for (i = 0; i < 4; i++) {
|
||||
gSequencePlayers[i].muted = FALSE;
|
||||
gSequencePlayers[i].recalculateVolume = TRUE;
|
||||
}
|
||||
break;
|
||||
case 0xf2:
|
||||
for (i = 0; i < 4; i++) {
|
||||
gSequencePlayers[i].muted = FALSE;
|
||||
gSequencePlayers[i].recalculateVolume = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,55 +259,54 @@ void func_802ad7ec(u32 arg0) {
|
||||
}
|
||||
else if ((cmd->u.s.op & 0x40) != 0) {
|
||||
switch (cmd->u.s.op) {
|
||||
case 0x41:
|
||||
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
|
||||
seqPlayer->recalculateVolume = TRUE;
|
||||
break;
|
||||
case 0x41:
|
||||
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
|
||||
seqPlayer->recalculateVolume = TRUE;
|
||||
break;
|
||||
|
||||
case 0x47:
|
||||
seqPlayer->tempo = cmd->u2.as_s32 * TATUMS_PER_BEAT;
|
||||
break;
|
||||
case 0x47:
|
||||
seqPlayer->tempo = cmd->u2.as_s32 * TATUMS_PER_BEAT;
|
||||
break;
|
||||
|
||||
case 0x48:
|
||||
seqPlayer->transposition = cmd->u2.as_s8;
|
||||
break;
|
||||
case 0x48:
|
||||
seqPlayer->transposition = cmd->u2.as_s8;
|
||||
break;
|
||||
|
||||
case 0x46:
|
||||
seqPlayer->seqVariationEu[cmd->u.s.arg3] = cmd->u2.as_s8;
|
||||
break;
|
||||
case 0x46:
|
||||
seqPlayer->seqVariationEu[cmd->u.s.arg3] = cmd->u2.as_s8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
|
||||
chan = seqPlayer->channels[cmd->u.s.arg2];
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(chan))
|
||||
{
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(chan)) {
|
||||
switch (cmd->u.s.op) {
|
||||
case 1:
|
||||
chan->volumeScale = cmd->u2.as_f32;
|
||||
chan->changes.as_bitfields.volume = TRUE;
|
||||
break;
|
||||
case 2:
|
||||
chan->volume = cmd->u2.as_f32;
|
||||
chan->changes.as_bitfields.volume = TRUE;
|
||||
break;
|
||||
case 3:
|
||||
chan->newPan = cmd->u2.as_s8;
|
||||
chan->changes.as_bitfields.pan = TRUE;
|
||||
break;
|
||||
case 4:
|
||||
chan->freqScale = cmd->u2.as_f32;
|
||||
chan->changes.as_bitfields.freqScale = TRUE;
|
||||
break;
|
||||
case 5:
|
||||
chan->reverbVol = cmd->u2.as_s8;
|
||||
break;
|
||||
case 6:
|
||||
if (cmd->u.s.arg3 < 8) {
|
||||
chan->soundScriptIO[cmd->u.s.arg3] = cmd->u2.as_s8;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
chan->stopSomething2 = cmd->u2.as_s8;
|
||||
case 1:
|
||||
chan->volumeScale = cmd->u2.as_f32;
|
||||
chan->changes.as_bitfields.volume = TRUE;
|
||||
break;
|
||||
case 2:
|
||||
chan->volume = cmd->u2.as_f32;
|
||||
chan->changes.as_bitfields.volume = TRUE;
|
||||
break;
|
||||
case 3:
|
||||
chan->newPan = cmd->u2.as_s8;
|
||||
chan->changes.as_bitfields.pan = TRUE;
|
||||
break;
|
||||
case 4:
|
||||
chan->freqScale = cmd->u2.as_f32;
|
||||
chan->changes.as_bitfields.freqScale = TRUE;
|
||||
break;
|
||||
case 5:
|
||||
chan->reverbVol = cmd->u2.as_s8;
|
||||
break;
|
||||
case 6:
|
||||
if (cmd->u.s.arg3 < 8) {
|
||||
chan->soundScriptIO[cmd->u.s.arg3] = cmd->u2.as_s8;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
chan->stopSomething2 = cmd->u2.as_s8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,74 +152,74 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
struct NoteSubEu *sub;
|
||||
|
||||
switch (cmd->u.s.op) {
|
||||
case 0x81:
|
||||
preload_sequence(cmd->u.s.arg2, 3);
|
||||
break;
|
||||
case 0x81:
|
||||
preload_sequence(cmd->u.s.arg2, 3);
|
||||
break;
|
||||
|
||||
case 0x82:
|
||||
case 0x88:
|
||||
load_sequence(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
|
||||
func_8031D690(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
break;
|
||||
case 0x82:
|
||||
case 0x88:
|
||||
load_sequence(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
|
||||
func_8031D690(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
break;
|
||||
|
||||
case 0x83:
|
||||
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE) {
|
||||
if (cmd->u2.as_s32 == 0) {
|
||||
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
|
||||
case 0x83:
|
||||
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE) {
|
||||
if (cmd->u2.as_s32 == 0) {
|
||||
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
|
||||
}
|
||||
else {
|
||||
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
}
|
||||
}
|
||||
else {
|
||||
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
break;
|
||||
|
||||
case 0x84:
|
||||
break;
|
||||
|
||||
case 0xf0:
|
||||
gSoundMode = cmd->u2.as_s32;
|
||||
break;
|
||||
|
||||
case 0xf1:
|
||||
for (i = 0; i < 4; i++) {
|
||||
gSequencePlayers[i].muted = TRUE;
|
||||
gSequencePlayers[i].recalculateVolume = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 0x84:
|
||||
break;
|
||||
|
||||
case 0xf0:
|
||||
gSoundMode = cmd->u2.as_s32;
|
||||
break;
|
||||
|
||||
case 0xf1:
|
||||
for (i = 0; i < 4; i++) {
|
||||
gSequencePlayers[i].muted = TRUE;
|
||||
gSequencePlayers[i].recalculateVolume = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xf2:
|
||||
if (cmd->u2.as_s32 == 1) {
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
note = &gNotes[i];
|
||||
sub = ¬e->noteSubEu;
|
||||
if (note->noteSubEu.enabled && note->unkSH34 == 0) {
|
||||
if ((note->parentLayer->seqChannel->muteBehavior & 8) != 0) {
|
||||
sub->finished = TRUE;
|
||||
case 0xf2:
|
||||
if (cmd->u2.as_s32 == 1) {
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
note = &gNotes[i];
|
||||
sub = ¬e->noteSubEu;
|
||||
if (note->noteSubEu.enabled && note->unkSH34 == 0) {
|
||||
if ((note->parentLayer->seqChannel->muteBehavior & 8) != 0) {
|
||||
sub->finished = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
gSequencePlayers[i].muted = FALSE;
|
||||
gSequencePlayers[i].recalculateVolume = TRUE;
|
||||
}
|
||||
break;
|
||||
for (i = 0; i < 4; i++) {
|
||||
gSequencePlayers[i].muted = FALSE;
|
||||
gSequencePlayers[i].recalculateVolume = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xf3:
|
||||
func_sh_802f3024(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
|
||||
break;
|
||||
case 0xf3:
|
||||
func_sh_802f3024(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
|
||||
break;
|
||||
|
||||
case 0xf4:
|
||||
func_sh_802f30f4(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3, &gUnkQueue1);
|
||||
break;
|
||||
case 0xf4:
|
||||
func_sh_802f30f4(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3, &gUnkQueue1);
|
||||
break;
|
||||
|
||||
case 0xf5:
|
||||
func_sh_802f3158(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3, &gUnkQueue1);
|
||||
break;
|
||||
case 0xf5:
|
||||
func_sh_802f3158(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3, &gUnkQueue1);
|
||||
break;
|
||||
|
||||
case 0xf6:
|
||||
func_sh_802f3288(cmd->u.s.arg2);
|
||||
break;
|
||||
case 0xf6:
|
||||
func_sh_802f3288(cmd->u.s.arg2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,75 +344,74 @@ void func_802ad7ec(u32 arg0) {
|
||||
}
|
||||
else if ((cmd->u.s.op & 0x40) != 0) {
|
||||
switch (cmd->u.s.op) {
|
||||
case 0x41:
|
||||
if (seqPlayer->fadeVolumeScale != cmd->u2.as_f32) {
|
||||
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
|
||||
seqPlayer->recalculateVolume = TRUE;
|
||||
}
|
||||
break;
|
||||
case 0x41:
|
||||
if (seqPlayer->fadeVolumeScale != cmd->u2.as_f32) {
|
||||
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
|
||||
seqPlayer->recalculateVolume = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x47:
|
||||
seqPlayer->tempo = cmd->u2.as_s32 * TATUMS_PER_BEAT;
|
||||
break;
|
||||
case 0x47:
|
||||
seqPlayer->tempo = cmd->u2.as_s32 * TATUMS_PER_BEAT;
|
||||
break;
|
||||
|
||||
case 0x49:
|
||||
seqPlayer->tempoAdd = cmd->u2.as_s32 * TEMPO_SCALE;
|
||||
break;
|
||||
case 0x49:
|
||||
seqPlayer->tempoAdd = cmd->u2.as_s32 * TEMPO_SCALE;
|
||||
break;
|
||||
|
||||
case 0x48:
|
||||
seqPlayer->transposition = cmd->u2.as_s8;
|
||||
break;
|
||||
case 0x48:
|
||||
seqPlayer->transposition = cmd->u2.as_s8;
|
||||
break;
|
||||
|
||||
case 0x46:
|
||||
seqPlayer->seqVariationEu[cmd->u.s.arg3] = cmd->u2.as_s8;
|
||||
break;
|
||||
case 0x46:
|
||||
seqPlayer->seqVariationEu[cmd->u.s.arg3] = cmd->u2.as_s8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
|
||||
chan = seqPlayer->channels[cmd->u.s.arg2];
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(chan))
|
||||
{
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(chan)) {
|
||||
switch (cmd->u.s.op) {
|
||||
case 1:
|
||||
if (chan->volumeScale != cmd->u2.as_f32) {
|
||||
chan->volumeScale = cmd->u2.as_f32;
|
||||
chan->changes.as_bitfields.volume = TRUE;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (chan->volume != cmd->u2.as_f32) {
|
||||
chan->volume = cmd->u2.as_f32;
|
||||
chan->changes.as_bitfields.volume = TRUE;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (chan->newPan != cmd->u2.as_s8) {
|
||||
chan->newPan = cmd->u2.as_s8;
|
||||
chan->changes.as_bitfields.pan = TRUE;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (chan->freqScale != cmd->u2.as_f32) {
|
||||
chan->freqScale = cmd->u2.as_f32;
|
||||
chan->changes.as_bitfields.freqScale = TRUE;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
//! @bug u8 s8 comparison (but harmless)
|
||||
if (chan->reverbVol != cmd->u2.as_s8) {
|
||||
chan->reverbVol = cmd->u2.as_s8;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (cmd->u.s.arg3 < 8) {
|
||||
chan->soundScriptIO[cmd->u.s.arg3] = cmd->u2.as_s8;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
chan->stopSomething2 = cmd->u2.as_s8;
|
||||
break;
|
||||
case 9:
|
||||
chan->muteBehavior = cmd->u2.as_s8;
|
||||
case 1:
|
||||
if (chan->volumeScale != cmd->u2.as_f32) {
|
||||
chan->volumeScale = cmd->u2.as_f32;
|
||||
chan->changes.as_bitfields.volume = TRUE;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (chan->volume != cmd->u2.as_f32) {
|
||||
chan->volume = cmd->u2.as_f32;
|
||||
chan->changes.as_bitfields.volume = TRUE;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (chan->newPan != cmd->u2.as_s8) {
|
||||
chan->newPan = cmd->u2.as_s8;
|
||||
chan->changes.as_bitfields.pan = TRUE;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (chan->freqScale != cmd->u2.as_f32) {
|
||||
chan->freqScale = cmd->u2.as_f32;
|
||||
chan->changes.as_bitfields.freqScale = TRUE;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
//! @bug u8 s8 comparison (but harmless)
|
||||
if (chan->reverbVol != cmd->u2.as_s8) {
|
||||
chan->reverbVol = cmd->u2.as_s8;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (cmd->u.s.arg3 < 8) {
|
||||
chan->soundScriptIO[cmd->u.s.arg3] = cmd->u2.as_s8;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
chan->stopSomething2 = cmd->u2.as_s8;
|
||||
break;
|
||||
case 9:
|
||||
chan->muteBehavior = cmd->u2.as_s8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1390,8 +1390,7 @@ s32 seq_channel_layer_process_script_part3(struct SequenceChannelLayer *layer, s
|
||||
layer->delay = sp3A;
|
||||
layer->duration = layer->noteDuration * sp3A >> 8;
|
||||
if ((seqPlayer->muted && (seqChannel->muteBehavior & 0x50) != 0)
|
||||
|| seqChannel->stopSomething2)
|
||||
{
|
||||
|| seqChannel->stopSomething2) {
|
||||
layer->stopSomething = TRUE;
|
||||
return -1;
|
||||
}
|
||||
@@ -1404,8 +1403,7 @@ u8 get_instrument(struct SequenceChannel *seqChannel, u8 instId, struct Instrume
|
||||
struct Instrument *inst;
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
inst = get_instrument_inner(seqChannel->bankId, instId);
|
||||
if (inst == NULL)
|
||||
{
|
||||
if (inst == NULL) {
|
||||
*instOut = NULL;
|
||||
return 0;
|
||||
}
|
||||
@@ -1524,25 +1522,21 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
for (;;) {
|
||||
cmd = m64_read_u8(state);
|
||||
#if !defined(VERSION_EU) && !defined(VERSION_SH)
|
||||
if (cmd == 0xff) // chan_end
|
||||
{
|
||||
if (cmd == 0xff) { // chan_end
|
||||
if (state->depth == 0) {
|
||||
sequence_channel_disable(seqChannel);
|
||||
break;
|
||||
}
|
||||
state->depth--, state->pc = state->stack[state->depth];
|
||||
}
|
||||
if (cmd == 0xfe) // chan_delay1
|
||||
{
|
||||
if (cmd == 0xfe) { // chan_delay1
|
||||
break;
|
||||
}
|
||||
if (cmd == 0xfd) // chan_delay
|
||||
{
|
||||
if (cmd == 0xfd) { // chan_delay
|
||||
seqChannel->delay = m64_read_compressed_u16(state);
|
||||
break;
|
||||
}
|
||||
if (cmd == 0xf3) // chan_hang
|
||||
{
|
||||
if (cmd == 0xf3) { // chan_hang
|
||||
seqChannel->stopScript = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -2362,8 +2356,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
#endif
|
||||
for (;;) {
|
||||
cmd = m64_read_u8(state);
|
||||
if (cmd == 0xff) // seq_end
|
||||
{
|
||||
if (cmd == 0xff) { // seq_end
|
||||
if (state->depth == 0) {
|
||||
sequence_player_disable(seqPlayer);
|
||||
break;
|
||||
@@ -2375,14 +2368,12 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
#endif
|
||||
}
|
||||
|
||||
if (cmd == 0xfd) // seq_delay
|
||||
{
|
||||
if (cmd == 0xfd) { // seq_delay
|
||||
seqPlayer->delay = m64_read_compressed_u16(state);
|
||||
break;
|
||||
}
|
||||
|
||||
if (cmd == 0xfe) // seq_delay1
|
||||
{
|
||||
if (cmd == 0xfe) { // seq_delay1
|
||||
seqPlayer->delay = 1;
|
||||
break;
|
||||
}
|
||||
@@ -2502,7 +2493,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
seqPlayer->tempo = gTempoInternalToExternal;
|
||||
}
|
||||
|
||||
//if (cmd){}
|
||||
//if (cmd) {}
|
||||
|
||||
if ((s16) seqPlayer->tempo <= 0) {
|
||||
seqPlayer->tempo = 1;
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
#define MAX_UPDATES_PER_FRAME 4
|
||||
#endif
|
||||
|
||||
struct ReverbRingBufferItem
|
||||
{
|
||||
struct ReverbRingBufferItem {
|
||||
s16 numSamplesAfterDownsampling;
|
||||
s16 chunkLen; // never read
|
||||
s16 *toDownsampleLeft;
|
||||
@@ -28,8 +27,7 @@ struct ReverbRingBufferItem
|
||||
s16 lengthB; // second length in ring buffer (from pos 0)
|
||||
}; // size = 0x14
|
||||
|
||||
struct SynthesisReverb
|
||||
{
|
||||
struct SynthesisReverb {
|
||||
/*0x00, 0x00, 0x00*/ u8 resampleFlags;
|
||||
/*0x01, 0x01, 0x01*/ u8 useReverb;
|
||||
/*0x02, 0x02, 0x02*/ u8 framesLeftToIgnore;
|
||||
@@ -53,8 +51,7 @@ struct SynthesisReverb
|
||||
/*0x08, 0x0C, 0x14*/ s32 nextRingBufferPos;
|
||||
/*0x0C, 0x10, 0x18*/ s32 unkC; // never read
|
||||
/*0x10, 0x14, 0x1C*/ s32 bufSizePerChannel;
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
s16 *left;
|
||||
s16 *right;
|
||||
} ringBuffer;
|
||||
|
||||
@@ -40,8 +40,3 @@ ALIGNED8 u8 gAudioSPTaskYieldBuffer[OS_YIELD_AUDIO_SIZE];
|
||||
#if !defined(F3DEX_GBI_SHARED) && !defined(VERSION_EU)
|
||||
ALIGNED8 u8 gUnusedThread2Stack[0x1400];
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
// 0x70800 bytes
|
||||
#ifdef AVOID_UB
|
||||
u16 gFrameBuffers[3][SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
u16 gFramebuffers[3][SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#else
|
||||
u16 gFrameBuffer0[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
u16 gFrameBuffer1[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
u16 gFrameBuffer2[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
u16 gFramebuffer0[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
u16 gFramebuffer1[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
u16 gFramebuffer2[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#endif
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
// -g codegen implies that they are separate variables. This is impossible to
|
||||
// reconcile without undefined behavior. Avoid that when possible.
|
||||
#ifdef AVOID_UB
|
||||
extern u16 gFrameBuffers[3][SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#define gFrameBuffer0 gFrameBuffers[0]
|
||||
#define gFrameBuffer1 gFrameBuffers[1]
|
||||
#define gFrameBuffer2 gFrameBuffers[2]
|
||||
extern u16 gFramebuffers[3][SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#define gFramebuffer0 gFramebuffers[0]
|
||||
#define gFramebuffer1 gFramebuffers[1]
|
||||
#define gFramebuffer2 gFramebuffers[2]
|
||||
#else
|
||||
extern u16 gFrameBuffer0[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
extern u16 gFrameBuffer1[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
extern u16 gFrameBuffer2[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
extern u16 gFramebuffer0[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
extern u16 gFramebuffer1[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
extern u16 gFramebuffer2[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#endif
|
||||
|
||||
#endif // FRAMEBUFFERS_H
|
||||
|
||||
@@ -904,7 +904,7 @@ static BhvCommandProc BehaviorCmdTable[] = {
|
||||
|
||||
// Execute the behavior script of the current object, process the object flags, and other miscellaneous code for updating objects.
|
||||
void cur_obj_update(void) {
|
||||
UNUSED u32 unused;
|
||||
UNUSED u8 filler[4];
|
||||
|
||||
s16 objFlags = gCurrentObject->oFlags;
|
||||
f32 distanceFromMario;
|
||||
|
||||
@@ -293,7 +293,7 @@ void geo_layout_cmd_nop3(void) {
|
||||
}
|
||||
|
||||
/*
|
||||
0x0C: Create zbuffer-toggling scene graph node
|
||||
0x0C: Create z-buffer-toggling scene graph node
|
||||
cmd+0x01: u8 enableZBuffer (1 = on, 0 = off)
|
||||
*/
|
||||
void geo_layout_cmd_node_master_list(void) {
|
||||
|
||||
@@ -719,7 +719,7 @@ void geo_obj_init_spawninfo(struct GraphNodeObject *graphNode, struct SpawnInfo
|
||||
|
||||
graphNode->areaIndex = spawn->areaIndex;
|
||||
graphNode->activeAreaIndex = spawn->activeAreaIndex;
|
||||
graphNode->sharedChild = spawn->unk18;
|
||||
graphNode->sharedChild = spawn->model;
|
||||
graphNode->unk4C = spawn;
|
||||
graphNode->throwMatrix = NULL;
|
||||
graphNode->animInfo.curAnim = 0;
|
||||
@@ -791,9 +791,7 @@ s32 retrieve_animation_index(s32 frame, u16 **attributes) {
|
||||
*/
|
||||
s16 geo_update_animation_frame(struct AnimInfo *obj, s32 *accelAssist) {
|
||||
s32 result;
|
||||
struct Animation *anim;
|
||||
|
||||
anim = obj->curAnim;
|
||||
struct Animation *anim = obj->curAnim;
|
||||
|
||||
if (obj->animTimer == gAreaUpdateCounter || anim->flags & ANIM_FLAG_2) {
|
||||
if (accelAssist != NULL) {
|
||||
@@ -804,7 +802,7 @@ s16 geo_update_animation_frame(struct AnimInfo *obj, s32 *accelAssist) {
|
||||
}
|
||||
|
||||
if (anim->flags & ANIM_FLAG_FORWARD) {
|
||||
if (obj->animAccel) {
|
||||
if (obj->animAccel != 0) {
|
||||
result = obj->animFrameAccelAssist - obj->animAccel;
|
||||
} else {
|
||||
result = (obj->animFrame - 1) << 16;
|
||||
|
||||
@@ -68,16 +68,14 @@ typedef Gfx *(*GraphNodeFunc)(s32 callContext, struct GraphNode *node, void *con
|
||||
* Many graph node types have an update function that gets called
|
||||
* when they are processed.
|
||||
*/
|
||||
struct FnGraphNode
|
||||
{
|
||||
struct FnGraphNode {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ GraphNodeFunc func;
|
||||
};
|
||||
|
||||
/** The very root of the geo tree. Specifies the viewport.
|
||||
*/
|
||||
struct GraphNodeRoot
|
||||
{
|
||||
struct GraphNodeRoot {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ u8 areaIndex;
|
||||
/*0x15*/ s8 unk15; // ?
|
||||
@@ -92,8 +90,7 @@ struct GraphNodeRoot
|
||||
/** A node that sets up an orthographic projection based on the global
|
||||
* root node. Used to draw the skybox image.
|
||||
*/
|
||||
struct GraphNodeOrthoProjection
|
||||
{
|
||||
struct GraphNodeOrthoProjection {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ f32 scale;
|
||||
};
|
||||
@@ -102,8 +99,7 @@ struct GraphNodeOrthoProjection
|
||||
* game world. It does not set up the camera position, that is done by
|
||||
* the child of this node, which has type GraphNodeCamera.
|
||||
*/
|
||||
struct GraphNodePerspective
|
||||
{
|
||||
struct GraphNodePerspective {
|
||||
/*0x00*/ struct FnGraphNode fnNode;
|
||||
/*0x18*/ s32 unused;
|
||||
/*0x1C*/ f32 fov; // horizontal field of view in degrees
|
||||
@@ -114,8 +110,7 @@ struct GraphNodePerspective
|
||||
/** An entry in the master list. It is a linked list of display lists
|
||||
* carrying a transformation matrix.
|
||||
*/
|
||||
struct DisplayListNode
|
||||
{
|
||||
struct DisplayListNode {
|
||||
Mtx *transform;
|
||||
void *displayList;
|
||||
struct DisplayListNode *next;
|
||||
@@ -126,8 +121,7 @@ struct DisplayListNode
|
||||
* different master list than opaque objects.
|
||||
* It also sets the z-buffer on before rendering and off after.
|
||||
*/
|
||||
struct GraphNodeMasterList
|
||||
{
|
||||
struct GraphNodeMasterList {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ struct DisplayListNode *listHeads[GFX_NUM_MASTER_LISTS];
|
||||
/*0x34*/ struct DisplayListNode *listTails[GFX_NUM_MASTER_LISTS];
|
||||
@@ -136,8 +130,7 @@ struct GraphNodeMasterList
|
||||
/** Simply used as a parent to group multiple children.
|
||||
* Does not have any additional functionality.
|
||||
*/
|
||||
struct GraphNodeStart
|
||||
{
|
||||
struct GraphNodeStart {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
};
|
||||
|
||||
@@ -147,8 +140,7 @@ struct GraphNodeStart
|
||||
* Usage examples: Mario has three level's of detail: Normal, low-poly arms only, and fully low-poly
|
||||
* The tower in Whomp's fortress has two levels of detail.
|
||||
*/
|
||||
struct GraphNodeLevelOfDetail
|
||||
{
|
||||
struct GraphNodeLevelOfDetail {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ s16 minDistance;
|
||||
/*0x16*/ s16 maxDistance;
|
||||
@@ -159,8 +151,7 @@ struct GraphNodeLevelOfDetail
|
||||
* which is set in the node's function.
|
||||
* Usage examples: room visibility, coin animation, blinking, Mario's power-up / hand pose / cap
|
||||
*/
|
||||
struct GraphNodeSwitchCase
|
||||
{
|
||||
struct GraphNodeSwitchCase {
|
||||
/*0x00*/ struct FnGraphNode fnNode;
|
||||
/*0x18*/ s32 unused;
|
||||
/*0x1C*/ s16 numCases;
|
||||
@@ -171,8 +162,7 @@ struct GraphNodeSwitchCase
|
||||
* GraphNode that specifies the location and aim of the camera.
|
||||
* When the roll is 0, the up vector is (0, 1, 0).
|
||||
*/
|
||||
struct GraphNodeCamera
|
||||
{
|
||||
struct GraphNodeCamera {
|
||||
/*0x00*/ struct FnGraphNode fnNode;
|
||||
/*0x18*/ union {
|
||||
// When the node is created, a mode is assigned to the node.
|
||||
@@ -195,8 +185,7 @@ struct GraphNodeCamera
|
||||
* based on the ENEMYINFO array.
|
||||
* The display list can be null, in which case it won't draw anything itself.
|
||||
*/
|
||||
struct GraphNodeTranslationRotation
|
||||
{
|
||||
struct GraphNodeTranslationRotation {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ void *displayList;
|
||||
/*0x18*/ Vec3s translation;
|
||||
@@ -207,12 +196,11 @@ struct GraphNodeTranslationRotation
|
||||
* Usage example: SUPER MARIO logo letters in debug level select.
|
||||
* The display list can be null, in which case it won't draw anything itself.
|
||||
*/
|
||||
struct GraphNodeTranslation
|
||||
{
|
||||
struct GraphNodeTranslation {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ void *displayList;
|
||||
/*0x18*/ Vec3s translation;
|
||||
u8 pad1E[2];
|
||||
u8 filler[2];
|
||||
};
|
||||
|
||||
/** GraphNode that rotates itself and its children.
|
||||
@@ -220,12 +208,11 @@ struct GraphNodeTranslation
|
||||
* set by a parent script node in that case.
|
||||
* The display list can be null, in which case it won't draw anything itself.
|
||||
*/
|
||||
struct GraphNodeRotation
|
||||
{
|
||||
struct GraphNodeRotation {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ void *displayList;
|
||||
/*0x18*/ Vec3s rotation;
|
||||
u8 pad1E[2];
|
||||
u8 filler[2];
|
||||
};
|
||||
|
||||
/** GraphNode part that transforms itself and its children based on animation
|
||||
@@ -235,8 +222,7 @@ struct GraphNodeRotation
|
||||
* Used for Mario, enemies and anything else with animation data.
|
||||
* The display list can be null, in which case it won't draw anything itself.
|
||||
*/
|
||||
struct GraphNodeAnimatedPart
|
||||
{
|
||||
struct GraphNodeAnimatedPart {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ void *displayList;
|
||||
/*0x18*/ Vec3s translation;
|
||||
@@ -247,8 +233,7 @@ struct GraphNodeAnimatedPart
|
||||
* then it simply sets the billboard flag for the entire object, this node is
|
||||
* used for billboard parts (like a chuckya or goomba body).
|
||||
*/
|
||||
struct GraphNodeBillboard
|
||||
{
|
||||
struct GraphNodeBillboard {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ void *displayList;
|
||||
/*0x18*/ Vec3s translation;
|
||||
@@ -257,8 +242,7 @@ struct GraphNodeBillboard
|
||||
/** A GraphNode that simply draws a display list without doing any
|
||||
* transformation beforehand. It does inherit the parent's transformation.
|
||||
*/
|
||||
struct GraphNodeDisplayList
|
||||
{
|
||||
struct GraphNodeDisplayList {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ void *displayList;
|
||||
};
|
||||
@@ -271,8 +255,7 @@ struct GraphNodeDisplayList
|
||||
* There is also a level command that scales the entire level, used for THI.
|
||||
* The display list can be null, in which case it won't draw anything itself.
|
||||
*/
|
||||
struct GraphNodeScale
|
||||
{
|
||||
struct GraphNodeScale {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ void *displayList;
|
||||
/*0x18*/ f32 scale;
|
||||
@@ -283,8 +266,7 @@ struct GraphNodeScale
|
||||
* The shadow type determines the shape (round or rectangular), vertices (4 or 9)
|
||||
* and other features.
|
||||
*/
|
||||
struct GraphNodeShadow
|
||||
{
|
||||
struct GraphNodeShadow {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ s16 shadowScale; // diameter (when a circle) or side (when a square) of shadow
|
||||
/*0x16*/ u8 shadowSolidity; // opacity of shadow, 255 = opaque
|
||||
@@ -294,8 +276,7 @@ struct GraphNodeShadow
|
||||
/** GraphNode that contains as its sharedChild a group node containing all
|
||||
* object nodes.
|
||||
*/
|
||||
struct GraphNodeObjectParent
|
||||
{
|
||||
struct GraphNodeObjectParent {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ struct GraphNode *sharedChild;
|
||||
};
|
||||
@@ -308,8 +289,7 @@ struct GraphNodeObjectParent
|
||||
* The parameter field gives extra context info. For shifting sand or paintings,
|
||||
* it can determine which texture to use.
|
||||
*/
|
||||
struct GraphNodeGenerated
|
||||
{
|
||||
struct GraphNodeGenerated {
|
||||
/*0x00*/ struct FnGraphNode fnNode;
|
||||
/*0x18*/ u32 parameter; // extra context for the function
|
||||
};
|
||||
@@ -317,8 +297,7 @@ struct GraphNodeGenerated
|
||||
/** GraphNode that draws a background image or a rectangle of a color.
|
||||
* Drawn in an orthographic projection, used for skyboxes.
|
||||
*/
|
||||
struct GraphNodeBackground
|
||||
{
|
||||
struct GraphNodeBackground {
|
||||
/*0x00*/ struct FnGraphNode fnNode;
|
||||
/*0x18*/ s32 unused;
|
||||
/*0x1C*/ s32 background; // background ID, or rgba5551 color if fnNode.func is null
|
||||
@@ -326,8 +305,7 @@ struct GraphNodeBackground
|
||||
|
||||
/** Renders the object that Mario is holding.
|
||||
*/
|
||||
struct GraphNodeHeldObject
|
||||
{
|
||||
struct GraphNodeHeldObject {
|
||||
/*0x00*/ struct FnGraphNode fnNode;
|
||||
/*0x18*/ s32 playerIndex;
|
||||
/*0x1C*/ struct Object *objNode;
|
||||
@@ -339,11 +317,10 @@ struct GraphNodeHeldObject
|
||||
* object node. Used for very large objects, such as shock wave rings that Bowser
|
||||
* creates, tornadoes, the big eel.
|
||||
*/
|
||||
struct GraphNodeCullingRadius
|
||||
{
|
||||
struct GraphNodeCullingRadius {
|
||||
/*0x00*/ struct GraphNode node;
|
||||
/*0x14*/ s16 cullingRadius; // specifies the 'sphere radius' for purposes of frustum culling
|
||||
u8 pad1E[2];
|
||||
u8 filler[2];
|
||||
};
|
||||
|
||||
extern struct GraphNodeMasterList *gCurGraphNodeMasterList;
|
||||
|
||||
@@ -286,7 +286,7 @@ static void level_cmd_load_mario_head(void) {
|
||||
if (addr != NULL) {
|
||||
gdm_init(addr, DOUBLE_SIZE_ON_64_BIT(0xE1000));
|
||||
gd_add_to_heap(gZBuffer, sizeof(gZBuffer)); // 0x25800
|
||||
gd_add_to_heap(gFrameBuffer0, 3 * sizeof(gFrameBuffer0)); // 0x70800
|
||||
gd_add_to_heap(gFramebuffer0, 3 * sizeof(gFramebuffer0)); // 0x70800
|
||||
gdm_setup();
|
||||
gdm_maketestdl(CMD_GET(s16, 2));
|
||||
} else {
|
||||
@@ -425,7 +425,7 @@ static void level_cmd_init_mario(void) {
|
||||
gMarioSpawnInfo->areaIndex = 0;
|
||||
gMarioSpawnInfo->behaviorArg = CMD_GET(u32, 4);
|
||||
gMarioSpawnInfo->behaviorScript = CMD_GET(void *, 8);
|
||||
gMarioSpawnInfo->unk18 = gLoadedGraphNodes[CMD_GET(u8, 3)];
|
||||
gMarioSpawnInfo->model = gLoadedGraphNodes[CMD_GET(u8, 3)];
|
||||
gMarioSpawnInfo->next = NULL;
|
||||
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
@@ -453,7 +453,7 @@ static void level_cmd_place_object(void) {
|
||||
|
||||
spawnInfo->behaviorArg = CMD_GET(u32, 16);
|
||||
spawnInfo->behaviorScript = CMD_GET(void *, 20);
|
||||
spawnInfo->unk18 = gLoadedGraphNodes[model];
|
||||
spawnInfo->model = gLoadedGraphNodes[model];
|
||||
spawnInfo->next = gAreas[sCurrAreaIndex].objectSpawnInfos;
|
||||
|
||||
gAreas[sCurrAreaIndex].objectSpawnInfos = spawnInfo;
|
||||
@@ -545,8 +545,8 @@ static void level_cmd_3A(void) {
|
||||
struct UnusedArea28 *val4;
|
||||
|
||||
if (sCurrAreaIndex != -1) {
|
||||
if ((val4 = gAreas[sCurrAreaIndex].unused28) == NULL) {
|
||||
val4 = gAreas[sCurrAreaIndex].unused28 =
|
||||
if ((val4 = gAreas[sCurrAreaIndex].unused) == NULL) {
|
||||
val4 = gAreas[sCurrAreaIndex].unused =
|
||||
alloc_only_pool_alloc(sLevelPool, sizeof(struct UnusedArea28));
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ s32 find_wall_collisions(struct WallCollisionData *colData) {
|
||||
numCollisions += find_wall_collisions_from_list(node, colData);
|
||||
|
||||
// Increment the debug tracker.
|
||||
gNumCalls.wall += 1;
|
||||
gNumCalls.wall++;
|
||||
|
||||
return numCollisions;
|
||||
}
|
||||
@@ -305,18 +305,20 @@ static struct Surface *find_ceil_from_list(struct SurfaceNode *surfaceNode, s32
|
||||
*/
|
||||
f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil) {
|
||||
s16 cellZ, cellX;
|
||||
|
||||
struct Surface *ceil, *dynamicCeil;
|
||||
struct SurfaceNode *surfaceList;
|
||||
|
||||
f32 height = CELL_HEIGHT_LIMIT;
|
||||
f32 dynamicHeight = CELL_HEIGHT_LIMIT;
|
||||
s16 x, y, z;
|
||||
|
||||
//! (Parallel Universes) Because position is casted to an s16, reaching higher
|
||||
// float locations can return ceilings despite them not existing there.
|
||||
//(Dynamic ceilings will unload due to the range.)
|
||||
x = (s16) posX;
|
||||
y = (s16) posY;
|
||||
z = (s16) posZ;
|
||||
// float locations can return ceilings despite them not existing there.
|
||||
// (Dynamic ceilings will unload due to the range.)
|
||||
s16 x = (s16) posX;
|
||||
s16 y = (s16) posY;
|
||||
s16 z = (s16) posZ;
|
||||
|
||||
*pceil = NULL;
|
||||
|
||||
if (x <= -LEVEL_BOUNDARY_MAX || x >= LEVEL_BOUNDARY_MAX) {
|
||||
@@ -346,7 +348,7 @@ f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil) {
|
||||
*pceil = ceil;
|
||||
|
||||
// Increment the debug tracker.
|
||||
gNumCalls.ceil += 1;
|
||||
gNumCalls.ceil++;
|
||||
|
||||
return height;
|
||||
}
|
||||
@@ -518,8 +520,8 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
|
||||
f32 dynamicHeight = FLOOR_LOWER_LIMIT;
|
||||
|
||||
//! (Parallel Universes) Because position is casted to an s16, reaching higher
|
||||
// float locations can return floors despite them not existing there.
|
||||
//(Dynamic floors will unload due to the range.)
|
||||
// float locations can return floors despite them not existing there.
|
||||
// (Dynamic floors will unload due to the range.)
|
||||
s16 x = (s16) xPos;
|
||||
s16 y = (s16) yPos;
|
||||
s16 z = (s16) zPos;
|
||||
@@ -563,7 +565,7 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
|
||||
|
||||
// If a floor was missed, increment the debug counter.
|
||||
if (floor == NULL) {
|
||||
gNumFindFloorMisses += 1;
|
||||
gNumFindFloorMisses++;
|
||||
}
|
||||
|
||||
if (dynamicHeight > height) {
|
||||
@@ -574,7 +576,7 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) {
|
||||
*pfloor = floor;
|
||||
|
||||
// Increment the debug tracker.
|
||||
gNumCalls.floor += 1;
|
||||
gNumCalls.floor++;
|
||||
|
||||
return height;
|
||||
}
|
||||
@@ -624,7 +626,7 @@ f32 find_water_level(f32 x, f32 z) {
|
||||
f32 find_poison_gas_level(f32 x, f32 z) {
|
||||
s32 i;
|
||||
s32 numRegions;
|
||||
UNUSED s32 unused;
|
||||
UNUSED u8 filler[4];
|
||||
s16 val;
|
||||
f32 loX, hiX, loZ, hiZ;
|
||||
f32 gasLevel = FLOOR_LOWER_LIMIT;
|
||||
|
||||
@@ -17,19 +17,17 @@
|
||||
// It doesn't match if ".0" is removed or ".f" is added
|
||||
#define FLOOR_LOWER_LIMIT_SHADOW (FLOOR_LOWER_LIMIT + 1000.0)
|
||||
|
||||
struct WallCollisionData
|
||||
{
|
||||
struct WallCollisionData {
|
||||
/*0x00*/ f32 x, y, z;
|
||||
/*0x0C*/ f32 offsetY;
|
||||
/*0x10*/ f32 radius;
|
||||
/*0x14*/ s16 unused;
|
||||
/*0x14*/ u8 filler[2];
|
||||
/*0x16*/ s16 numWalls;
|
||||
/*0x18*/ struct Surface *walls[4];
|
||||
};
|
||||
|
||||
struct FloorGeometry
|
||||
{
|
||||
f32 unused[4]; // possibly position data?
|
||||
struct FloorGeometry {
|
||||
u8 filler[16]; // possibly position data?
|
||||
f32 normalX;
|
||||
f32 normalY;
|
||||
f32 normalZ;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user