Shipwright/soh/include/z64audio.h

1093 lines
33 KiB
C
Raw Normal View History

#ifndef Z64_AUDIO_H
#define Z64_AUDIO_H
#define MK_CMD(b0,b1,b2,b3) ((((b0) & 0xFF) << 0x18) | (((b1) & 0xFF) << 0x10) | (((b2) & 0xFF) << 0x8) | (((b3) & 0xFF) << 0))
#define NO_LAYER ((SequenceLayer*)(-1))
#define TATUMS_PER_BEAT 48
#define IS_SEQUENCE_CHANNEL_VALID(ptr) ((uintptr_t)(ptr) != (uintptr_t)&gAudioContext.sequenceChannelNone)
#define MAX_CHANNELS_PER_BANK 3
#define ADSR_DISABLE 0
#define ADSR_HANG -1
#define ADSR_GOTO -2
#define ADSR_RESTART -3
#define AIBUF_LEN 0x580
#define CALC_RESAMPLE_FREQ(sampleRate) ((float)sampleRate / (s32)gAudioContext.audioBufferParameters.frequency)
2022-06-14 00:59:31 -04:00
extern char* fontMap[256];
2022-06-10 13:37:50 -04:00
typedef enum {
/* 0 */ ADSR_STATE_DISABLED,
/* 1 */ ADSR_STATE_INITIAL,
/* 2 */ ADSR_STATE_START_LOOP,
/* 3 */ ADSR_STATE_LOOP,
/* 4 */ ADSR_STATE_FADE,
/* 5 */ ADSR_STATE_HANG,
/* 6 */ ADSR_STATE_DECAY,
/* 7 */ ADSR_STATE_RELEASE,
/* 8 */ ADSR_STATE_SUSTAIN
} AdsrStatus;
typedef enum {
/* 0 */ MEDIUM_RAM,
/* 1 */ MEDIUM_UNK,
/* 2 */ MEDIUM_CART,
/* 3 */ MEDIUM_DISK_DRIVE
} SampleMedium;
typedef enum {
/* 0 */ CODEC_ADPCM,
/* 1 */ CODEC_S8,
/* 2 */ CODEC_S16_INMEMORY,
/* 3 */ CODEC_SMALL_ADPCM,
/* 4 */ CODEC_REVERB,
/* 5 */ CODEC_S16
} SampleCodec;
typedef enum {
/* 0 */ SEQUENCE_TABLE,
/* 1 */ FONT_TABLE,
/* 2 */ SAMPLE_TABLE
} SampleBankTableType;
typedef enum {
/* 0 */ CACHE_TEMPORARY,
/* 1 */ CACHE_PERSISTENT,
/* 2 */ CACHE_EITHER,
/* 3 */ CACHE_PERMANENT
} AudioCacheType;
typedef s32 (*DmaHandler)(OSPiHandle* handle, OSIoMesg* mb, s32 direction);
struct Note;
struct NotePool;
struct SequenceChannel;
struct SequenceLayer;
typedef 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.
// - List heads are always attached; if a list is empty, its head points
// to itself. 'count' contains the size of the list.
// If the list holds notes, 'pool' points back to the pool where it lives.
// Otherwise, that member is NULL.
/* 0x00 */ struct AudioListItem* prev;
/* 0x04 */ struct AudioListItem* next;
/* 0x08 */ union {
void* value; // either Note* or SequenceLayer*
s32 count;
} u;
/* 0x0C */ struct NotePool* pool;
} AudioListItem; // size = 0x10
typedef struct NotePool {
/* 0x00 */ AudioListItem disabled;
/* 0x10 */ AudioListItem decaying;
/* 0x20 */ AudioListItem releasing;
/* 0x30 */ AudioListItem active;
} NotePool;
// Pitch sliding by up to one octave in the positive direction. Negative
// direction is "supported" by setting extent to be negative. The code
// exterpolates exponentially in the wrong direction in that case, but that
// doesn't prevent seqplayer from doing it, AFAICT.
typedef struct {
/* 0x00 */ u8 mode; // bit 0x80 denotes something; the rest are an index 0-5
/* 0x02 */ u16 cur;
/* 0x04 */ u16 speed;
/* 0x08 */ f32 extent;
} Portamento; // size = 0xC
typedef struct {
/* 0x0 */ s16 delay;
/* 0x2 */ s16 arg;
} AdsrEnvelope; // size = 0x4
typedef struct {
2022-05-16 20:16:56 -04:00
/* 0x00 */ uintptr_t start;
/* 0x04 */ uintptr_t end;
/* 0x08 */ u32 count;
/* 0x0C */ char unk_0C[0x4];
/* 0x10 */ s16 state[16]; // only exists if count != 0. 8-byte aligned
} AdpcmLoop; // size = 0x30 (or 0x10)
typedef struct {
/* 0x00 */ s32 order;
/* 0x04 */ s32 npredictors;
/* 0x08 */ s16 book[1]; // size 8 * order * npredictors. 8-byte aligned
} AdpcmBook; // size >= 0x8
typedef struct
{
union {
struct {
/* 0x00 */ u32 codec : 4;
/* 0x00 */ u32 medium : 2;
/* 0x00 */ u32 unk_bit26 : 1;
/* 0x00 */ u32 unk_bit25 : 1;
/* 0x01 */ u32 size : 24;
};
u32 asU32;
};
/* 0x04 */ u8* sampleAddr;
/* 0x08 */ AdpcmLoop* loop;
/* 0x0C */ AdpcmBook* book;
2022-06-10 13:37:50 -04:00
u32 sampleRateMagicValue; // For wav samples only...
s32 sampleRate; // For wav samples only...
} SoundFontSample; // size = 0x10
typedef struct {
/* 0x00 */ SoundFontSample* sample;
/* 0x04 */ union {
u32 tuningAsU32;
f32 tuning;// frequency scale factor
};
} SoundFontSound; // size = 0x8
typedef struct {
/* 0x00 */ s16 numSamplesAfterDownsampling; // never read
/* 0x02 */ s16 chunkLen; // never read
/* 0x04 */ s16* toDownsampleLeft;
/* 0x08 */ s16* toDownsampleRight; // data pointed to by left and right are adjacent in memory
/* 0x0C */ s32 startPos; // start pos in ring buffer
/* 0x10 */ s16 lengthA; // first length in ring buffer (from startPos, at most until end)
/* 0x12 */ s16 lengthB; // second length in ring buffer (from pos 0)
/* 0x14 */ u16 unk_14;
/* 0x16 */ u16 unk_16;
/* 0x18 */ u16 unk_18;
} ReverbRingBufferItem; // size = 0x1C
typedef struct {
/* 0x000 */ u8 resampleFlags;
/* 0x001 */ u8 useReverb;
/* 0x002 */ u8 framesToIgnore;
/* 0x003 */ u8 curFrame;
/* 0x004 */ u8 downsampleRate;
/* 0x005 */ s8 unk_05;
/* 0x006 */ u16 windowSize;
/* 0x008 */ s16 unk_08;
/* 0x00A */ s16 unk_0A;
/* 0x00C */ u16 unk_0C;
/* 0x00E */ u16 unk_0E;
/* 0x010 */ s16 leakRtl;
/* 0x012 */ s16 leakLtr;
/* 0x014 */ u16 unk_14;
/* 0x016 */ s16 unk_16;
/* 0x018 */ u8 unk_18;
/* 0x019 */ u8 unk_19;
/* 0x01A */ u8 unk_1A;
/* 0x01B */ u8 unk_1B;
/* 0x01C */ s32 nextRingBufPos;
/* 0x020 */ s32 unk_20;
/* 0x024 */ s32 bufSizePerChan;
/* 0x028 */ s16* leftRingBuf;
/* 0x02C */ s16* rightRingBuf;
/* 0x030 */ void* unk_30;
/* 0x034 */ void* unk_34;
/* 0x038 */ void* unk_38;
/* 0x03C */ void* unk_3C;
/* 0x040 */ ReverbRingBufferItem items[2][5];
/* 0x158 */ ReverbRingBufferItem items2[2][5];
/* 0x270 */ s16* filterLeft;
/* 0x274 */ s16* filterRight;
/* 0x278 */ s16* filterLeftState;
/* 0x27C */ s16* filterRightState;
/* 0x280 */ SoundFontSound sound;
/* 0x288 */ SoundFontSample sample;
/* 0x298 */ AdpcmLoop loop;
} SynthesisReverb; // size = 0x2C8
typedef struct {
/* 0x00 */ u8 loaded;
/* 0x01 */ u8 normalRangeLo;
/* 0x02 */ u8 normalRangeHi;
/* 0x03 */ u8 releaseRate;
/* 0x04 */ AdsrEnvelope* envelope;
/* 0x08 */ SoundFontSound lowNotesSound;
/* 0x10 */ SoundFontSound normalNotesSound;
/* 0x18 */ SoundFontSound highNotesSound;
} Instrument; // size = 0x20
typedef struct {
/* 0x00 */ u8 releaseRate;
/* 0x01 */ u8 pan;
/* 0x02 */ u8 loaded;
/* 0x04 */ SoundFontSound sound;
/* 0x14 */ AdsrEnvelope* envelope;
} Drum; // size = 0x14
typedef struct {
/* 0x00 */ u8 numInstruments;
/* 0x01 */ u8 numDrums;
/* 0x02 */ u8 sampleBankId1;
/* 0x03 */ u8 sampleBankId2;
/* 0x04 */ u16 numSfx;
/* 0x08 */ Instrument** instruments;
/* 0x0C */ Drum** drums;
/* 0x10 */ SoundFontSound* soundEffects;
2022-06-14 00:59:31 -04:00
s32 fntIndex;
} SoundFont; // size = 0x14
typedef struct {
/* 0x00 */ u8* pc;
/* 0x04 */ u8* stack[4];
/* 0x14 */ u8 remLoopIters[4];
/* 0x18 */ u8 depth;
/* 0x19 */ s8 value;
} SeqScriptState; // size = 0x1C
// Also known as a Group, according to debug strings.
typedef struct {
/* 0x000 */ u8 enabled : 1;
/* 0x000 */ u8 finished : 1;
/* 0x000 */ u8 muted : 1;
/* 0x000 */ u8 seqDmaInProgress : 1;
/* 0x000 */ u8 fontDmaInProgress : 1;
/* 0x000 */ u8 recalculateVolume : 1;
/* 0x000 */ u8 stopScript : 1;
/* 0x000 */ u8 unk_0b1 : 1;
/* 0x001 */ u8 state;
/* 0x002 */ u8 noteAllocPolicy;
/* 0x003 */ u8 muteBehavior;
/* 0x004 */ u8 seqId;
/* 0x005 */ u8 defaultFont;
/* 0x006 */ u8 unk_06[1];
/* 0x007 */ s8 playerIdx;
/* 0x008 */ u16 tempo; // tatums per minute
/* 0x00A */ u16 tempoAcc;
/* 0x00C */ u16 unk_0C;
/* 0x00E */ s16 transposition;
/* 0x010 */ u16 delay;
/* 0x012 */ u16 fadeTimer;
/* 0x014 */ u16 fadeTimerUnkEu;
/* 0x018 */ u8* seqData;
/* 0x01C */ f32 fadeVolume;
/* 0x020 */ f32 fadeVelocity;
/* 0x024 */ f32 volume;
/* 0x028 */ f32 muteVolumeScale;
/* 0x02C */ f32 fadeVolumeScale;
f32 gameVolume;
/* 0x030 */ f32 appliedFadeVolume;
/* 0x034 */ f32 unk_34;
/* 0x038 */ struct SequenceChannel* channels[16];
/* 0x078 */ SeqScriptState scriptState;
/* 0x094 */ u8* shortNoteVelocityTable;
/* 0x098 */ u8* shortNoteGateTimeTable;
/* 0x09C */ NotePool notePool;
/* 0x0DC */ s32 skipTicks;
/* 0x0E0 */ u32 scriptCounter;
/* 0x0E4 */ char unk_E4[0x74]; // unused struct members for sequence/sound font dma management, according to sm64 decomp
/* 0x158 */ s8 soundScriptIO[8];
} SequencePlayer; // size = 0x160
typedef struct {
/* 0x0 */ u8 releaseRate;
/* 0x1 */ u8 sustain;
/* 0x4 */ AdsrEnvelope* envelope;
} AdsrSettings; // size = 0x8
typedef struct {
/* 0x00 */ union {
struct A {
/* 0x00 */ u8 unk_0b80 : 1;
/* 0x00 */ u8 hang : 1;
/* 0x00 */ u8 decay : 1;
/* 0x00 */ u8 release : 1;
/* 0x00 */ u8 state : 4;
} s;
/* 0x00 */ u8 asByte;
} action;
/* 0x01 */ u8 envIndex;
/* 0x02 */ s16 delay;
/* 0x04 */ f32 sustain;
/* 0x08 */ f32 velocity;
/* 0x0C */ f32 fadeOutVel;
/* 0x10 */ f32 current;
/* 0x14 */ f32 target;
/* 0x18 */ char unk_18[4];
/* 0x1C */ AdsrEnvelope* envelope;
} AdsrState;
typedef struct {
/* 0x00 */ u8 unused : 2;
/* 0x00 */ u8 bit2 : 2;
/* 0x00 */ u8 strongRight : 1;
/* 0x00 */ u8 strongLeft : 1;
/* 0x00 */ u8 stereoHeadsetEffects : 1;
/* 0x00 */ u8 usesHeadsetPanEffects : 1;
} StereoData;
typedef union {
/* 0x00 */ StereoData s;
/* 0x00 */ u8 asByte;
} Stereo;
typedef struct {
/* 0x00 */ u8 reverb;
/* 0x01 */ u8 unk_1;
/* 0x02 */ u8 pan;
/* 0x03 */ Stereo stereo;
/* 0x04 */ u8 unk_4;
/* 0x06 */ u16 unk_6;
/* 0x08 */ f32 freqScale;
/* 0x0C */ f32 velocity;
/* 0x10 */ s16* filter;
/* 0x14 */ s16 filterBuf[8];
} NoteAttributes; // size = 0x24
// Also known as a SubTrack, according to sm64 debug strings.
typedef struct SequenceChannel {
/* 0x00 */ u8 enabled : 1;
/* 0x00 */ u8 finished : 1;
/* 0x00 */ u8 stopScript : 1;
/* 0x00 */ u8 stopSomething2 : 1; // sets SequenceLayer.stopSomething
/* 0x00 */ u8 hasInstrument : 1;
/* 0x00 */ u8 stereoHeadsetEffects : 1;
/* 0x00 */ u8 largeNotes : 1; // notes specify duration and velocity
/* 0x00 */ u8 unused : 1;
union {
struct {
/* 0x01 */ u8 freqScale : 1;
/* 0x01 */ u8 volume : 1;
/* 0x01 */ u8 pan : 1;
} s;
/* 0x01 */ u8 asByte;
} changes;
/* 0x02 */ u8 noteAllocPolicy;
/* 0x03 */ u8 muteBehavior;
/* 0x04 */ u8 reverb; // or dry/wet mix
/* 0x05 */ u8 notePriority; // 0-3
/* 0x06 */ u8 someOtherPriority;
/* 0x07 */ u8 fontId;
/* 0x08 */ u8 reverbIndex;
/* 0x09 */ u8 bookOffset;
/* 0x0A */ u8 newPan;
/* 0x0B */ u8 panChannelWeight; // proportion of pan that comes from the channel (0..128)
/* 0x0C */ u8 unk_0C;
/* 0x0D */ u8 velocityRandomVariance;
/* 0x0E */ u8 gateTimeRandomVariance;
/* 0x0F */ u8 unk_0F;
/* 0x10 */ u16 vibratoRateStart;
/* 0x12 */ u16 vibratoExtentStart;
/* 0x14 */ u16 vibratoRateTarget;
/* 0x16 */ u16 vibratoExtentTarget;
/* 0x18 */ u16 vibratoRateChangeDelay;
/* 0x1A */ u16 vibratoExtentChangeDelay;
/* 0x1C */ u16 vibratoDelay;
/* 0x1E */ u16 delay;
/* 0x20 */ u16 unk_20;
/* 0x22 */ u16 unk_22;
/* 0x24 */ s16 instOrWave; // either 0 (none), instrument index + 1, or
// 0x80..0x83 for sawtooth/triangle/sine/square waves.
/* 0x26 */ s16 transposition;
/* 0x28 */ f32 volumeScale;
/* 0x2C */ f32 volume;
/* 0x30 */ s32 pan;
/* 0x34 */ f32 appliedVolume;
/* 0x38 */ f32 freqScale;
/* 0x3C */ u8 (*dynTable)[][2];
/* 0x40 */ struct Note* noteUnused;
/* 0x44 */ struct SequenceLayer* layerUnused;
/* 0x48 */ Instrument* instrument;
/* 0x4C */ SequencePlayer* seqPlayer;
/* 0x50 */ struct SequenceLayer* layers[4];
/* 0x60 */ SeqScriptState scriptState;
/* 0x7C */ AdsrSettings adsr;
/* 0x84 */ NotePool notePool;
/* 0xC4 */ s8 soundScriptIO[8]; // bridge between sound script and audio lib, "io ports"
/* 0xCC */ s16* filter;
/* 0xD0 */ Stereo stereo;
} SequenceChannel; // size = 0xD4
// Might also be known as a Track, according to sm64 debug strings (?).
typedef struct SequenceLayer {
/* 0x00 */ u8 enabled : 1;
/* 0x00 */ u8 finished : 1;
/* 0x00 */ u8 stopSomething : 1;
/* 0x00 */ u8 continuousNotes : 1; // keep the same note for consecutive notes with the same sound
/* 0x00 */ u8 bit3 : 1; // "loaded"?
/* 0x00 */ u8 ignoreDrumPan : 1;
/* 0x00 */ u8 bit1 : 1; // "has initialized continuous notes"?
/* 0x00 */ u8 notePropertiesNeedInit : 1;
/* 0x01 */ Stereo stereo;
/* 0x02 */ u8 instOrWave;
/* 0x03 */ u8 gateTime;
/* 0x04 */ u8 semitone;
/* 0x05 */ u8 portamentoTargetNote;
/* 0x06 */ u8 pan; // 0..128
/* 0x07 */ u8 notePan;
/* 0x08 */ s16 delay;
/* 0x0A */ s16 gateDelay;
/* 0x0C */ s16 delay2;
/* 0x0E */ u16 portamentoTime;
/* 0x10 */ s16 transposition; // #semitones added to play commands
// (seq instruction encoding only allows referring to the limited range
// 0..0x3F; this makes 0x40..0x7F accessible as well)
/* 0x12 */ s16 shortNoteDefaultDelay;
/* 0x14 */ s16 lastDelay;
/* 0x18 */ AdsrSettings adsr;
/* 0x20 */ Portamento portamento;
/* 0x2C */ struct Note* note;
/* 0x30 */ f32 freqScale;
/* 0x34 */ f32 unk_34;
/* 0x38 */ f32 velocitySquare2;
/* 0x3C */ f32 velocitySquare; // not sure which one of those corresponds to the sm64 original
/* 0x40 */ f32 noteVelocity;
/* 0x44 */ f32 noteFreqScale;
/* 0x48 */ Instrument* instrument;
/* 0x4C */ SoundFontSound* sound;
/* 0x50 */ SequenceChannel* channel;
/* 0x54 */ SeqScriptState scriptState;
/* 0x70 */ AudioListItem listItem;
} SequenceLayer; // size = 0x80
typedef struct {
/* 0x0000 */ s16 adpcmdecState[0x10];
/* 0x0020 */ s16 finalResampleState[0x10];
/* 0x0040 */ s16 mixEnvelopeState[0x28];
/* 0x0090 */ s16 panResampleState[0x10];
/* 0x00B0 */ s16 panSamplesBuffer[0x20];
/* 0x00F0 */ s16 dummyResampleState[0x10];
} NoteSynthesisBuffers; // size = 0x110
typedef struct {
/* 0x00 */ u8 restart;
/* 0x01 */ u8 sampleDmaIndex;
/* 0x02 */ u8 prevHeadsetPanRight;
/* 0x03 */ u8 prevHeadsetPanLeft;
/* 0x04 */ u8 reverbVol;
/* 0x05 */ u8 numParts;
/* 0x06 */ u16 samplePosFrac;
/* 0x08 */ s32 samplePosInt;
/* 0x0C */ NoteSynthesisBuffers* synthesisBuffers;
/* 0x10 */ s16 curVolLeft;
/* 0x12 */ s16 curVolRight;
/* 0x14 */ u16 unk_14;
/* 0x16 */ u16 unk_16;
/* 0x18 */ u16 unk_18;
/* 0x1A */ u8 unk_1A;
/* 0x1C */ u16 unk_1C;
/* 0x1E */ u16 unk_1E;
} NoteSynthesisState; // size = 0x20
typedef struct {
/* 0x00 */ struct SequenceChannel* channel;
/* 0x04 */ u32 time;
/* 0x08 */ s16* curve;
/* 0x0C */ f32 extent;
/* 0x10 */ f32 rate;
/* 0x14 */ u8 active;
/* 0x16 */ u16 rateChangeTimer;
/* 0x18 */ u16 extentChangeTimer;
/* 0x1A */ u16 delay;
} VibratoState; // size = 0x1C
typedef struct {
/* 0x00 */ u8 priority;
/* 0x01 */ u8 waveId;
/* 0x02 */ u8 sampleCountIndex;
/* 0x03 */ u8 fontId;
/* 0x04 */ u8 unk_04;
/* 0x05 */ u8 stereoHeadsetEffects;
/* 0x06 */ s16 adsrVolScaleUnused;
/* 0x08 */ f32 portamentoFreqScale;
/* 0x0C */ f32 vibratoFreqScale;
/* 0x10 */ SequenceLayer* prevParentLayer;
/* 0x14 */ SequenceLayer* parentLayer;
/* 0x18 */ SequenceLayer* wantedParentLayer;
/* 0x1C */ NoteAttributes attributes;
/* 0x40 */ AdsrState adsr;
// may contain portamento, vibratoState, if those are not part of Note itself
} NotePlaybackState;
typedef struct {
struct {
/* 0x00 */ volatile u8 enabled : 1;
/* 0x00 */ u8 needsInit : 1;
/* 0x00 */ u8 finished : 1; // ?
/* 0x00 */ u8 unused : 1;
/* 0x00 */ u8 stereoStrongRight : 1;
/* 0x00 */ u8 stereoStrongLeft : 1;
/* 0x00 */ u8 stereoHeadsetEffects : 1;
/* 0x00 */ u8 usesHeadsetPanEffects : 1; // ?
} bitField0;
struct {
/* 0x01 */ u8 reverbIndex : 3;
/* 0x01 */ u8 bookOffset : 2;
/* 0x01 */ u8 isSyntheticWave : 1;
/* 0x01 */ u8 hasTwoParts : 1;
/* 0x01 */ u8 usesHeadsetPanEffects2 : 1;
} bitField1;
/* 0x02 */ u8 unk_2;
/* 0x03 */ u8 headsetPanRight;
/* 0x04 */ u8 headsetPanLeft;
/* 0x05 */ u8 reverbVol;
/* 0x06 */ u8 unk_06;
/* 0x07 */ u8 unk_07;
/* 0x08 */ u16 targetVolLeft;
/* 0x0A */ u16 targetVolRight;
/* 0x0C */ u16 resamplingRateFixedPoint;
/* 0x0E */ u16 unk_0E;
/* 0x10 */ union {
SoundFontSound* soundFontSound;
s16* samples; // used for synthetic waves
} sound;
/* 0x14 */ s16* filter;
/* 0x18 */ char pad_18[0x8];
} NoteSubEu; // size = 0x20
typedef struct Note {
/* 0x00 */ AudioListItem listItem;
/* 0x10 */ NoteSynthesisState synthesisState;
/* 0x30 */ NotePlaybackState playbackState;
/* 0x90 */ Portamento portamento;
/* 0x9C */ VibratoState vibratoState;
/* 0xB8 */ char unk_B8[0x4];
/* 0xBC */ u32 unk_BC;
/* 0xC0 */ NoteSubEu noteSubEu;
} Note; // size = 0xE0
typedef struct {
/* 0x00 */ u8 downsampleRate;
/* 0x02 */ u16 windowSize;
/* 0x04 */ u16 unk_4;
/* 0x06 */ u16 unk_6;
/* 0x08 */ u16 unk_8;
/* 0x0A */ u16 unk_A;
/* 0x0C */ u16 leakRtl;
/* 0x0E */ u16 leakLtr;
/* 0x10 */ s8 unk_10;
/* 0x12 */ u16 unk_12;
/* 0x14 */ s16 lowPassFilterCutoffLeft;
/* 0x16 */ s16 lowPassFilterCutoffRight;
} ReverbSettings; // size = 0x18
typedef struct {
/* 0x00 */ u32 frequency;
/* 0x04 */ u8 unk_04;
/* 0x05 */ u8 numNotes;
/* 0x06 */ u8 numSequencePlayers;
/* 0x07 */ u8 unk_07; // unused, set to zero
/* 0x08 */ u8 unk_08; // unused, set to zero
/* 0x09 */ u8 numReverbs;
/* 0x0C */ ReverbSettings* reverbSettings;
/* 0x10 */ u16 sampleDmaBufSize1;
/* 0x12 */ u16 sampleDmaBufSize2;
/* 0x14 */ u16 unk_14;
/* 0x18 */ u32 persistentSeqMem;
/* 0x1C */ u32 persistentFontMem;
/* 0x20 */ u32 persistentSampleMem;
/* 0x24 */ u32 temporarySeqMem;
/* 0x28 */ u32 temporaryFontMem;
/* 0x2C */ u32 temporarySampleMem;
/* 0x30 */ s32 persistentSampleCacheMem;
/* 0x34 */ s32 temporarySampleCacheMem;
} AudioSpec; // size = 0x38
typedef struct {
/* 0x00 */ s16 specUnk4;
/* 0x02 */ u16 frequency;
/* 0x04 */ u16 aiFrequency;
/* 0x06 */ s16 samplesPerFrameTarget;
/* 0x08 */ s16 maxAiBufferLength;
/* 0x0A */ s16 minAiBufferLength;
/* 0x0C */ s16 updatesPerFrame;
/* 0x0E */ s16 samplesPerUpdate;
/* 0x10 */ s16 samplesPerUpdateMax;
/* 0x12 */ s16 samplesPerUpdateMin;
/* 0x14 */ s16 numSequencePlayers;
/* 0x18 */ f32 resampleRate;
/* 0x1C */ f32 updatesPerFrameInv;
/* 0x20 */ f32 unkUpdatesPerFrameScaled;
/* 0x24 */ f32 unk_24;
} AudioBufferParameters;
typedef struct {
/* 0x0 */ u8* start;
/* 0x4 */ u8* cur;
/* 0x8 */ ptrdiff_t size;
/* 0xC */ s32 count;
} AudioAllocPool; // size = 0x10
typedef struct {
/* 0x0 */ u8* ptr;
/* 0x4 */ size_t size;
/* 0x8 */ s16 tableType;
/* 0xA */ s16 id;
} AudioCacheEntry; // size = 0xC
typedef struct {
/* 0x00 */ s8 inUse;
/* 0x01 */ s8 origMedium;
/* 0x02 */ s8 sampleBankId;
/* 0x03 */ char unk_03[0x5];
/* 0x08 */ u8* allocatedAddr;
/* 0x0C */ void* sampleAddr;
/* 0x10 */ size_t size;
} SampleCacheEntry; // size = 0x14
typedef struct {
/* 0x000 */ AudioAllocPool pool;
/* 0x010 */ SampleCacheEntry entries[32];
/* 0x290 */ ptrdiff_t size;
} AudioSampleCache; // size = 0x294
typedef struct {
/* 0x00*/ u32 numEntries;
/* 0x04*/ AudioAllocPool pool;
/* 0x14*/ AudioCacheEntry entries[16];
} AudioPersistentCache; // size = 0xD4
typedef struct {
/* 0x00*/ u32 nextSide;
/* 0x04*/ AudioAllocPool pool;
/* 0x14*/ AudioCacheEntry entries[2];
} AudioTemporaryCache; // size = 0x3C
typedef struct {
/* 0x000*/ AudioPersistentCache persistent;
/* 0x0D4*/ AudioTemporaryCache temporary;
/* 0x100*/ u8 unk_100[0x10];
} AudioCache; // size = 0x110
typedef struct {
u32 wantPersistent;
u32 wantTemporary;
} AudioPoolSplit2; // size = 0x8
typedef struct {
u32 wantSeq;
u32 wantFont;
u32 wantSample;
} AudioPoolSplit3; // size = 0xC
typedef struct {
u32 wantSeq;
u32 wantFont;
u32 wantSample;
u32 wantCustom;
} AudioPoolSplit4; // size = 0x10
typedef struct {
/* 0x00 */ u32 endAndMediumKey;
/* 0x04 */ SoundFontSample* sample;
/* 0x08 */ u8* ramAddr;
/* 0x0C */ u32 encodedInfo;
/* 0x10 */ s32 isFree;
} AudioPreloadReq; // size = 0x14
typedef struct {
union{
u32 opArgs;
struct {
u8 arg2;
u8 arg1;
u8 arg0;
u8 op;
};
};
union {
u32 data;
f32 asFloat;
s32 asInt;
struct {
u8 pad2[2];
u16 asUShort;
};
struct {
u8 pad1[3];
s8 asSbyte;
};
struct {
u8 pad0[3];
u8 asUbyte;
};
u32 asUInt;
};
} AudioCmd;
typedef struct {
/* 0x00 */ s8 status;
/* 0x01 */ s8 delay;
/* 0x02 */ s8 medium;
/* 0x04 */ u8* ramAddr;
2022-05-16 20:16:56 -04:00
/* 0x08 */ u8* curDevAddr;
/* 0x0C */ u8* curRamAddr;
2022-05-16 20:16:56 -04:00
/* 0x10 */ size_t bytesRemaining;
/* 0x14 */ size_t chunkSize;
/* 0x18 */ s32 unkMediumParam;
/* 0x1C */ u32 retMsg;
/* 0x20 */ OSMesgQueue* retQueue;
/* 0x24 */ OSMesgQueue msgQueue;
/* 0x3C */ OSMesg msg;
/* 0x40 */ OSIoMesg ioMesg;
} AudioAsyncLoad; // size = 0x58
typedef struct {
/* 0x00 */ u8 medium;
/* 0x01 */ u8 seqOrFontId;
/* 0x02 */ u16 instId;
/* 0x04 */ s32 unkMediumParam;
2022-05-16 20:16:56 -04:00
/* 0x08 */ u8* curDevAddr;
/* 0x0C */ u8* curRamAddr;
/* 0x10 */ u8* ramAddr;
/* 0x14 */ s32 status;
/* 0x18 */ s32 bytesRemaining;
/* 0x1C */ s8* isDone;
/* 0x20 */ SoundFontSample sample;
/* 0x30 */ OSMesgQueue msgqueue;
/* 0x48 */ OSMesg msg;
/* 0x4C */ OSIoMesg ioMesg;
} AudioSlowLoad; // size = 0x64
typedef struct {
/* 0x00 */ uintptr_t romAddr;
/* 0x04 */ size_t size;
/* 0x08 */ s8 medium;
/* 0x09 */ s8 cachePolicy;
/* 0x0A */ s16 shortData1;
/* 0x0C */ s16 shortData2;
/* 0x0E */ s16 shortData3;
} AudioTableEntry; // size = 0x10
typedef struct {
/* 0x00 */ s16 numEntries;
/* 0x02 */ s16 unkMediumParam;
/* 0x04 */ uintptr_t romAddr;
/* 0x08 */ char pad[0x8];
/* 0x10 */ AudioTableEntry entries[512]; // (dynamic size)
} AudioTable; // size >= 0x20
typedef struct {
/* 0x00 */ OSTask task;
/* 0x40 */ OSMesgQueue* taskQueue;
/* 0x44 */ void* unk_44; // probably a message that gets unused.
/* 0x48 */ char unk_48[0x8];
} AudioTask; // size = 0x50
typedef struct {
/* 0x00 */ u8* ramAddr;
/* 0x04 */ u32 devAddr;
/* 0x08 */ u16 sizeUnused;
/* 0x0A */ u16 size;
/* 0x0C */ u8 unused;
/* 0x0D */ u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0
/* 0x0E */ u8 ttl; // duration after which the DMA can be discarded
} SampleDma; // size = 0x10
Nintendo switch support (#935) * Moved gfx effects to the gpu and removed loadtexbyname on some textures * Readded empty if * Added nintendo switch support * Fixed compilation errors and window closing issue on linux * Fixed kaleido on 64 bit * Fixed audio on nintendo switch * Implemented performance mode switcher * Added suggestions from pr review * Fixed ftruncate errors * Fixed compilation errors * Added missing include rule * Fixed libstorm path * Removed ftruncate extern to use a correct posix version * Merge branch 'develop' from HarbourMasters into znx (#3) * Add Support for macOS (#441) * Fixed soh filters * add more makefile changes * almost ready * more updates * update * update * Update Makefiles to handle both platforms * Allow for overriding the CXX and CC executables * Restore original structure while supporting custom CXX flags * Remove some platform specific libs * Dynamic target name * Make X11 paths package-agnostic * Remove changes to `gfx_opengl.cpp` * Use OpenGL2 on MacOS instead of OpenGL3 * make it actually render something * render at least the first texture, still need to figure out the second one * Let’s use OpenGL 3 again * maybe this works to get the right texture? link's eyes still look off a bit * did this work? * set the platform to macos * actual numbers are right, but logic is ugly XXX/TODO, i know * add zlib to ldflags for ZAPDUtils * A bit of cleanup * Revert unneeded changes * Remove GL_CHECK * Fix issues with z64 branch * use an std::map instead of a giant array * three point filter fix (#2) * Fix mac compilation * fix audio for 64 bit * revert audio heap size, keep bigger pools * Add more Apple specific checks to our modifications * Add building instructions for macOS * Remove unecessary step from building instructions * Add missing SDL2 & GLEW to Linux LDLIBS * Update BUILDING.md Co-authored-by: BountyChocolate123456 <101743444+BountyChocolate123456@users.noreply.github.com> * Update soh/.gitignore to include other arch binaries Co-authored-by: BountyChocolate123456 <101743444+BountyChocolate123456@users.noreply.github.com> * Use right platform name for debugging window Co-authored-by: BountyChocolate123456 <101743444+BountyChocolate123456@users.noreply.github.com> * Fix stormlib on macos (arm64) * Simplify some of the ifdef checks * Revert an older no longer necessary fix * Remove remaining unecessary deviations * Update building instructions after StormLib changes * Feature: Use OpenGL 4.1 (#1) * Further tweak the BUILDING * Tidy up * reword -j message * Add Jenkins CI Support (#2) * Fix type issues * add target <appbundle> and <filledappbundle> add makefile targets to create an .app `filledappbundle` creates the target with the .otr included this should perhaps be moved to Application Support though * pull gcc's rpath from otool output * move make target to the end so it's not default * Add Jenkins and make exe in par with other platforms * Actually save build artefacts * Fix artefact path * Remove x11 mentions and linking (not used) * Update building instructions for generating app * use appsupport directory * Add new app icon * Update target to match macOS types * Update more audio types * fix null deref in Audio_PlayFanfare * Remove old import from z64 * address final nit with apple ifdefs Co-authored-by: KiritoDev <36680385+KiritoDv@users.noreply.github.com> Co-authored-by: Jeffrey Crowell <github@crowell.biz> Co-authored-by: BountyChocolate123456 <101743444+BountyChocolate123456@users.noreply.github.com> * Move macOS to parallel stage * fix linux crash * Ignore all named saves Necessary after new save format * DPad items * Move UI location arrays from static to global to accomodate customizable UI * FIX: Increased the maximum actor limit for draw distance Fix issue #529 * FIX: Remove duplicates of gNewDrops from the enhancements menu * Get rid of erroneous int casts * casts jya_cobra's shadowTexture pointer to uintptr_t instead of s32. * Fix ability to assign equipment you don't own * Fix title cards for market potion shop and bombchu shop * Invalidate message item icon texture before drawing * Add margins for dpad * Fixed some instances where the original OOT save is erroneously preserved or recreated, leading to another conversion next time you launched the game * Headphones setting in game should now work. Resolves #13 * Map Select name fixes * Change Power to Upgrades * Rename Soh* files * Update names * Add more files * Add more files * Add toggles for disabling heart drops and random drops (#507) * Adds toggles for disabling random drops and fixed heart drops * Changed the "No Fixed Heart Drops" toggle to the more useful "No Random Heart Drops" toggle * Adds an explanation that the no heart drops option is similar to Hero Mode * Moved difficulty options into their own sub-menu Moved time saver options into their own sub-menu Moved clutter reducing options into their own sub-menu * fixed the tag name of mweep speed * Moved Skip Text to Experimental * Fix testing masks of DPad * Fix audio, boot commands, and save staes. * add menu from https://github.com/PurpleHato/Shipwright/tree/ResetMenu * implement reset * Update README.md * command on mac * special char doesn't work with default imgui font * change name based on PR comment * missed a couple spots * change sunset in save editor so dampe is out * Update to latest `docking` imgui (#582) * Update to latest `docking` imgui commit: 67410d53f739b6a0df138e2252f0e5136b42062f * Fix modified import for SDL * Update imgui_impl_sdl.cpp * Add Imgui include path for better imports * Controller Navigation Fix-Up (#544) * Controller Navigation Fix-Up * [MISC] Fix typo * Use Macro for __FILE__ & __LINE__ when possible (#559) * First batch some overlay * Almost all overlay * effect & gamestate * kaleido stuffs * more overlay * more left over from code folder * remaining hardcoded line and file * Open & Close _DISP __FILE__ & __LINE__ clean up * Some if (1) {} remove * LOG_xxxx __FILE__ , __LINE__ cleaned * ASSERT macro __FILE__ __LINE__ * mtx without line/file in functions * " if (1) {} " & "if (0) {}" and tab/white place * LogUtils as macro * GameState_, GameAlloc_, SystemArena_ & ZeldaArena_ * Revert "GameState_, GameAlloc_, SystemArena_ & ZeldaArena_" This reverts commit 0d85caaf7e342648c01a15fe21e93637352dc596. * Like last commit but as macro * Fix matrix not using macros * use function not macro * DebugArena_* functions GameAlloc_MallocDebug BgCheck_PosErrorCheck as macros removed issues with ; in macro file * MM Bunny Hood enhancements: no age restrictions & wear across entrances (#560) * Remove age restriction on MM Bunny Hood * Handle mask slot changing; init Link wearing mask * Reset mask state after selling * Use unordered maps in some hot paths (#566) * Use unordered maps in some hot paths * Address PR comments * Cheat: Infinite Epona Boost (#577) * Cheat: Infinite Epona Boost * Edit for readability * update pulseaudio for 44.1khz audio (#587) * use pulseaudio defaults * spaces/tabs * pulseaudio values tuned for n64 audio at 44.1khz * update tlength * remove one hardcoded samplerate Co-authored-by: briaguya <briaguya@alice> * Restoration Item Sliders (#595) * Allows players to set custom restoration values for potions and milk * Fixed a dumb oversight * implemented fairy sliders * use ini window resolution (#410) * use ini window resolution * use arguments for directx window size * default 640x480 not 320x240 * kick off a build * and revert * default config 640x480 not 320x240 * add todo Co-authored-by: briaguya <briaguya@alice> * 3D Drops & Projectiles update (#548) * Fix remaining rupee and keys * fix tabs -> spaces * more fix about tabs -> spaces * Better up <-> down mouvement for hearts * remove useless comment * Cosmetics menu rework (#589) * - * DPad/some margin fix(left side) * various ImGui stuff and fixes * disabled kaleido menu (non working) * fix win being dumb * same for C btn this time * Fix windows build * Beating hearts fix * Default win size and some placement fix * Fix Dpad Ammo & C notes, Kaleido, white dog * some texts fix and tab move * Add stone of agony, some fixes and build correctly * precise item place with Dpad * Gamecube -> GameCube Co-authored-by: Baoulettes <iMacWin10> * [CI] Create an Appimage for 64bit builds (#570) * [CI] Create AppImage file * [CI] Updated Jenkinsfile * [MISC] fix indentation * [MISC] Fix indentation * [MISC] Fix indentation * [CI] 7z appimage and readme * [CI] AppImage icon file (#597) * [CI] Add patchelf * [BUILD] Include Hi-Res icon * Fix portability use of std::clamp (#596) * Add N64 weird frames and OOB Bombchus cvars (#602) * Add gN64WeirdFrames and gBombchuOOB cvars * Rename gBombchuOOB to gBombchusOOB * Fix pipeline * [BUILD] Do not strip ZAPD (#598) * [BUILD] Do not strip ZAPD * [BUILD] Reuse Icon Asset * [APPIMAGE] Handle paths with spaces * [macos] Distribute optimized builds (#599) * Cosmetics texts fixes (#604) * branch init + few fixes * Reset button * Several texts fixes and default color to GameCube * space issues * some more extra space that was not needed. * space yes last time ... * Arrows being able to be rainbow some more texts fixes * more texts fixes * c-buttons some plurial fix * Fixes bug in demo effect due to removed display list set. * King dodongo room crash (#613) * first attempt * force camera setting to be at least 0 (dirty!) * - * reverted something to just include fix * Invalidate text box icon before drawing (#607) * [APPIMAGE] Set lib path for ZAPD (#611) * New drop runtime fix (#614) * inital rework * fixed default rotation for 2D sprites * fix tab/space issues * Fix Ganon's Castle title cards (#606) * Checkered room crash workaround (#615) * Increase poly and vertex count for dyna actors * Add TODO * Only apply fix in Forest Temple * Enable globally * Match case of 'Shipwright' in Linux build (#619) * Fix 0xabababab crash (#617) * Unconditionally setup the normal skybox * Only call Skybox_Setup once ever * Equipment upgrade text fix and any pause slot enhancement fix (#620) * Fix upgrade name text not rendering * Use cvar and don't render equip help for empty item slots * Fix rendering logic * Fix incorrect item name rendered for one frame * Reorder comparison * Remove extra indent * Remove accidental changes * ImGui grammer, consistency, and clarity fixes (#625) * ImGui grammer, consistency, and clarity fixes Co-Authored-By: Stormghetti <56653191+Stormghetti@users.noreply.github.com> * Adds more new lines for users on smaller displays Co-Authored-By: Stormghetti <56653191+Stormghetti@users.noreply.github.com> Co-authored-by: Stormghetti <56653191+Stormghetti@users.noreply.github.com> * New drops shadows & rotation fixes (#627) * fixes * forgot to add heart pieces in rotation logic * Dodongo's Cavern blue warp crash fix (#622) * Doodong's Cavern blue warp crash fix * >= not > * Don't waste a line of space * add support for clang compiler (#592) * hacks to align strings for clang... wow just wow * start work to getting built with clang * fix issues with struct constructors, all builds, doesn't link still * fix some narrowing issues that clang complains about * fix compliation of zapd * fix null deref in VersionInfo * builds with clang * make stringbuilding use StringHelper instead of addition * fix linking * add CLANG SHIP overlay on clang built versions * doesn't need to be volatile * mark unknown strings as extern * rename some stuff * can't align extern * hopefully fix compilation for everythign * expandtab * allow setting LD * Revert "allow setting LD" This reverts commit 711aba6db2c41bab476bd34e878af6a37a7f5559. maybe to use lld it should be a LDFLAG? * -Wno-deprecated-declarations is required for newer versions of clang on macOS 13 beta sdk, the version of apple clang requires this * Add jenkins support for clang * Forward CXX flags to stormlib compilation * Move GCC only flags to check * use exports to set multiarch setup * Fix Jenkins forever * use make instead of cmake --build add some flags to build with clang-11 as well * address review coments - rework extraction to allow multi thread - misc readability cleanup * update makefile to add WARN on linux+clang Co-authored-by: David Chavez <david@dcvz.io> * Fix develop * Fixes grey screen issue + tooltip for 2 handed shield * Don't close controller after SDL has quit (#642) * Don't close controller after SDL has quit * Don't check if controller can rumble if null * Fixes Barinade's set whenever boss fight is reloaded (#639) * Reimplements unused Barinade reset function. * Removes the Jellyfish from Barinade's body on reset. * add the ability to pull graves during the day (#637) * change max internal res multiplier to 3x, use float and % instead of int (#638) * change max internal res multiplier to 3x, use float and % instead of int * Update libultraship/libultraship/ImGuiImpl.cpp Co-authored-by: Kenix3 <kenixwhisperwind@gmail.com> Co-authored-by: briaguya <briaguya@alice> Co-authored-by: Kenix3 <kenixwhisperwind@gmail.com> * Fixes crash on Biggoron trade failure screen wipe Resolves #621 * fixes center docking (#652) * testing out item replacement (#416) * skip learning song of storms * don't set flag when getting goron tunic as child * Initiates prelude check when master sword unloads. Not quite how N64 rando does it but so far it's the only way I've found to make it trigger without also triggering the time travel again. * Stops Shadow Temple lore prompts from appearing in rando. * Skips cutscene of royal tomb explosion in rando. Explosion sound doesn't play correctly and I think the debris appears in the wrong place, but the functionality is here. * Improves visual of exploding gravestone. * Adds some comments explaining the rando differences * Skip ruto text box in jabu blue warp For rando * skip intro cutscene in dodongo's cavern * load spoiler files on boot, fix spoilerfile existing check when making new saves * name entry dropped spoiler logic * make sure to actually init the cvar * no chime on load * uncomment * Skip ganondrof cutscene Skip to scream part of the death animation, skipping the text boxes etc. For rando * Update z_boss_ganondrof.c * skip owl flight cutscenes in rando * Fixes skipped text so it only applies to shadow temple. Earlier fix inadvertently applied to some other text as well, changed logic so that only specified sceneNums and textIds can have this enabled, and text skipped by sceneNum can have the skip overriden by textId if needed. Currently there are no overrides so the textId section of the logic is commented out to avoid compilation errors. * Adds a default to the switch case statements that leaves the randoSkipText variable unchanged, just in case. * TEST: Text for item * Adding ganon flavor text * ADD: AMMO Count * format ganon text/hint text * Autoskip the tower cutscene if settings call for tower collapse. * ganon hint text logic * Improved prelude after time travel fix * swapped the sizes between ganon hint text and ganon text, as they were set to the wrong things. * this is all i did * not the cleanest code ever but it's working * ADD: GS Count * ADD: Wallter (crash for now) * TWEAK: Wallet check * FIX: Use DrawItem instread of DrawUpgrade... b-baka! * Fixes some vanilla bugs introduced by rando code. * Added cutscene skip for zelda escaping Using the debug cutscene skipping function. Also added a conditional so the bridge doesn't spawn closed when cutscene is ready to trigger * ADD: X Spacing + Placeholders for song * ADD: default case for items * TWEAK: Spacing * FIX: Light Arrow * ADD: Ammo Option * use groups instead * ADD: More spacing logic * songs and names * TWEAK: Color on wallet * colors * Added flags cutscene before nabooru fight * ADD: ChromaKey text * First attempt skip cs after nabooru defeat * Better implementation for specific rando cutscene skips * use pulseaudio defaults * spaces/tabs * move color push/pop to stop crash * make the colors work again * the real bottle fix * pulseaudio values tuned for n64 audio at 44.1khz * update tlength * remove one hardcoded samplerate * Cleaned up and fixed zelda escape skip The if statement is a freaking monster, but unless we want to skip more cutscenes in the same way later, this is the most compact way of doing it that I know of. * Revert one line to match original nothing functional * another hint line that breaks autonewline logic * don't autospawn epona if we don't have the song/ocarina * Trying to use iron knuckle death effects not working yet * Streamlined OoT cutscene skip for future additions Also cleaned up if statement in general * Made if statement more readable Also added clarity for what cutscene was skipped * Fixed typo in comment * Janky nabooru defeat cs skip * altar text formatting (gonna need help shortening some of the french ones) * more altar text formatting * english altar text formatting complete * make gtg blocking guard check for card not bridge * FIX: Typo! * FIX: Uppercases * FIX: Typo * TWEAK: Alter + some names * TWEAK: More caps! * ADD: Missing string TWEAK more uppercases and namefixe s * Hide nabooru death by covering her in flames * bandaid fix for death crash issue * Twinrova defeat cs skip Skips the animation and manually calls the function to show the "beam" around the sisters * fix crash * fix caps to match * fix great fairy reward mashing/shielding issue * TWEAK : Typo clé to Clé * TWEAK: Some Altar hints TWEAK: Some capitals * TWEAK: Unmatching text + some cap again * TWEAK: More tweaks * fix build * remove extra json.hpp, add hint * Update randomizer_item_tracker.cpp * TWEAK: Double Defense with RedParticles instead of white * make sure we don't optimize out the check to ensure a spoilerfile exists * vanilla ganon boss key hint formatting * TWEAK: FR- better way of the hero text * fix * and again * Initializes dungeonsDone items in gSaveContext to 0. * Replaces sizeof calculation with a NUM_DUNGEONS constant. * Fixes Saria's Gift on the LW Bridge from getting killed when holding shield. * More airtight fix for Saria's Gift on the Bridge. * Lifts one of the conditions in the if statement a little higher to prevent unnecessary lookups of getItemId. * Invalidate text box icon before drawing * Fixes the case where Saria's gift is an Ice Trap. We still get the Ice Trap once, but never again. This does mean you can now hold R while walking in to avoid the ice trap, but everything else seems to work fine. * Initial commit Might need changing when we change the settings in the future * Fixes Door of Time opening cutscene after warping with prelude. * Initial waterfall skip Very rudimentary way of doing things but it seems to work so :shrug: * inital rework * fixed default rotation for 2D sprites * fix tab/space issues * 3d drops rando merge fix again * Allows Impa to appear in the Lullaby check post drawbridge escape. * Changes Ganon's Trials Count setting to a checkbox The checkbox is whether or not to skip all of them. Leaving the box unchecked will mean doing all of them. Eventually this will be switched back to a slider once we implement the logic for which trials start out completed. * Sets all Ganon's Trials to incomplete in new saves. Fixes https://github.com/briaguya-ai/rando-issue-tracker/issues/131 * fix castle guards when oot throw cutscene has already played in rando * Properly removes the beams when trials are cleared. * Removes Question Mark from Skip Ganon's Trials UI. * Adds a todo comment about when to change back to slider. * make deku seeds check for bullet bag * Various tweaks TWEAK: Altar Text TWEAK: Hint names TWEAK: Replace more problematic œ to oe * upgrade ocarina on both child and adult equips * FIX: Jabu Item * update equipped hookshot/longshot when obtained as other age * add hint * don't give the bgs check without the claim check * Skips Darunia Cutscene in Fire Temple * Added a TODO note about not skipping the cutscene. There is a setting we will want to have eventually that will require this cutscene to not be skipped since it is used during a glitch. * remove todo * restore fast ocarina option in imgui that was lost in merge * Fixes grey screen issue + tooltip for 2 handed shield * update to use dg instead of g for textures in item tracker * TWEAK: Default color for cosmetic RAND button was not the corect one * fix texture crash, remove unused item tracker code * don't open mask shop until we get zelda's letter * Update README.md * Prevents "correct" chime under incorrect conditions. * Fixes typo in conditional and adds "bonk" sound effect. "Bonk" sound is NA_SE_SY_OCARINA_ERROR and it plays when conditions for the Door of Time have not been met after playing Song of Time. This is only possible in rando's "Intended" Door of Time option, in which the Ocarina of Time and all 3 spritual stones are required to open the door, instead of the vanilla requirements of just having the song of time. * remove modify dpad equips toggle, replace with checks for dpad menu * remove extra check * add ability to hold c-up to assign to dpad when dpad menuing is enabled * disable d-pad navigation on item menu when holding c-up to equip * dpad+c-up stuff for equipment menu * ADD: Checbox for songs colors * TWEAK: RandoColors for normal songs * kind of quick and dirty but it works * TWEAK: Clarity of the tooltip Co-authored-by: briaguya <briaguya@alice> Co-authored-by: Christopher Leggett <chris@leggett.dev> Co-authored-by: aMannus <mannusmenting@gmail.com> Co-authored-by: PurpleHato <linkvssangoku.jr@gmail.com> Co-authored-by: Dog <5172592+Dog@users.noreply.github.com> Co-authored-by: Vague Rant <vaguerant@users.noreply.github.com> Co-authored-by: Baoulettes <perlouzerie@hotmail.fr> Co-authored-by: Ada <60364512+GreatArgorath@users.noreply.github.com> * Cosmetics hotfixes (#640) * Initial branch creation * Revert Main Game so it do not conflict later * should fix window build, made namespace for Cosmetics * forgot to edit one title * Ability to add hidden window (usefull for Rainbow) Fix building issues * Line break, unused bool remove * add descriptive todo for death crash bandaid (#655) Co-authored-by: briaguya <briaguya@alice> * Removed legacy audio mode and fixed ganon sound bug (#657) * Free Camera (#337) * wip free cam * Almost done, needs collision still * Added free cam behind cvar * added WIP collision * Fixed & implemented "Manual mode" from WW & TP * Fixed camera not rotating when Link is moving * fixed initialized camera rotation * Fixed camera getting stuck + made it smoother * reduced deadzone * fixed epona camera height + added WW z-target free camera * Adjusted player camera height & fixed fov * Fixed camera roll * fixed fov when moving the camera while in z-target * Camera resets to Auto when going through doors or changing maps * Fixed building * touch * more touch work * Added WIP mouse support to the free cam * gui stuff * fixed building * fixed building error * ok fixed building for real this time * oops * Fix compilation issues * removed mouse stuff that magically appeared in this branch * smoothed out stick values & removed remains of mouse support * re-added manual camera when pressing Z * reduced minimum Y position of camera * Addressed dcsv's nitpicks * part 2 * oops Co-authored-by: David Chavez <david@dcvz.io> * Rando: Allows Malon's Item Check to be obtained by pulling out the Ocarina. [FIXED PR] (#672) * Fixes using the Ocarina to get the check from Malon. Still some cleanup to do here. For some reason the player can shield before receiving the check. It doesn't set the flag if the player does that so they can still try again, but would prefer a different solution if possible. * Prevents Shielding from blocking the Item_Give from happening. * Code Cleanup and comments explaining the new rando flow. * Removes inventory check when pulling out Ocarina This allows OI to properly give the check, which is important for Glitched logic later down the line. Talking to Malon still requires the Ocarina in your inventory. * Prevents non-malon textboxes from triggering the check. Also adds a comment explaining the condtional for getting the check from talking to Malon since it got pretty long. * Actually fixes checking for text boxes. * Relocates a comment for improved clarity. * Fix Rando Water Temple Softlock (#665) We use 3DS logic to generate item placement, but didn't have this specific door in Water Temple unlocked from the beginning like 3DS does. This meant that if people took specific paths through the temple, they could softlock themselves by missing a key. * Rando: GtG and carpenter prompts skip (#663) * Skip gtg and carpenter prompt For rando. Tested and just works. * Fixed missing break * Hide debug overlay behind gDebugEnabled (#660) * Introduce App Directory Path (#572) * Introduce app directory path concept * macos: Remove hacky way of using applicaiton directory * Update the new SaveManager * Address stack user after return * Remove unecessary property * Use std::string for filepath * Improve clang specific detections * Use new path system for imgui files * Improve helper for getting relative paths * fix hidden wnd (#744) * Split damage multiplication into its own PR (#656) * Split damage multiplication into its own PR * Found a more elegant implementation of the powers char*[] * Fixes Maps, Compasses, and Boss Keys in Vanilla. (#751) * .xiF slebaL * Update Keese labels * Fixed soundfont issues * Skip warp song cutscenes in rando (#664) Does it by skipping to the last part of the cutscene data. Tested on all songs, both adult and child. * don't spawn blocking mido after we've already shown him the sword/shield (#675) Co-authored-by: briaguya <briaguya@alice> * Controller Configuration UI and JSON Config (#760) * Initial controller hud ui * Reverted fbdemo changes * Moved config to json and implemented controller config * fix build on linux, gitignore new config file * fix build * Fix compilation and file directory paths * Call save on cvar save * Fixed cvar loading and added deck slots to the config * Changed control deck port 0 to use a physical device by default * Added gyro and rumble & fixed loading errors * Save config on toggle menubar * fix linux build * Fixed drift calculation * Controller config now saves when pressing F1 * Removed ExitGame hook from ImGuiImpl * Moved mappings to a map * Added GetKeyName * untranslate scancodes * Fixed hud layout on keyboard device * Fixed keyboard read on hud * Fixed crash when reloading controllers * Removed ConfigFile and changed file extension * Changed Dummy to Disconnected and fixed filters * Removed function leftover * Changed ControllerHud to InputEditor Co-authored-by: briaguya <briaguya@alice> Co-authored-by: David Chavez <david@dcvz.io> * Enough! My ship sails in the morning. * Fixed menubar items position (#763) * Fixed menubar items position * Reverted tooltip tab position * Fixes macOS randomizer functionality with App Directory (#761) * Fixes macOS randomizer functionality with App Directory * Fix windows build * Update soh/soh/Enhancements/randomizer/3drando/rando_main.cpp * Update soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp * Revert band-aid fix Co-authored-by: Kenix3 <kenixwhisperwind@gmail.com> * Fix migration cvar deletion path (#765) * Various controller fixes (#771) * Fix controller * Also fix rumble strength being a bool * Remove ControllerHud.cpp * Downgrade platform toolset back to previous version * Fix gyro * Fix bug that makes binding axes difficult and clear buttons before reading * Exaggerate gyro display and adjust stick binding threshold * Initialize drift thresholds * git subrepo push soh subrepo: subdir: "soh" merged: "75ccbade8" upstream: origin: "https://github.com/HarbourMasters/soh.git" branch: "master" commit: "75ccbade8" git-subrepo: version: "0.4.1" origin: "???" commit: "???" * One more change from PR review * Fix some paths * Fix merge conflict messup * More merge conflict fixes * And another conflict fix * And another fix * Remove reference to removed build files * Add full path to switch cmake Co-authored-by: David Chavez <david@dcvz.io> Co-authored-by: KiritoDev <36680385+KiritoDv@users.noreply.github.com> Co-authored-by: Jeffrey Crowell <github@crowell.biz> Co-authored-by: BountyChocolate123456 <101743444+BountyChocolate123456@users.noreply.github.com> Co-authored-by: sholdee <102821812+sholdee@users.noreply.github.com> Co-authored-by: briaguya <briaguya@alice> Co-authored-by: rozlette <Rozelette@users.noreply.github.com> Co-authored-by: PurpleHato <linkvssangoku.jr@gmail.com> Co-authored-by: Christopher Leggett <chris@leggett.dev> Co-authored-by: Kenix3 <kenixwhisperwind@gmail.com> Co-authored-by: vaguerant <vaguerant@users.noreply.github.com> Co-authored-by: earthcrafterman <banddstudios@gmail.com> Co-authored-by: louist103 <35883445+louist103@users.noreply.github.com> Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> Co-authored-by: qurious-pixel <62252937+qurious-pixel@users.noreply.github.com> Co-authored-by: Baoulettes <perlouzerie@hotmail.fr> Co-authored-by: Sirius902 <10891979+Sirius902@users.noreply.github.com> Co-authored-by: modestposer <modestposer@gmail.com> Co-authored-by: Ada <60364512+GreatArgorath@users.noreply.github.com> Co-authored-by: Stormghetti <56653191+Stormghetti@users.noreply.github.com> Co-authored-by: Sirius902 <3645979-Sirius902@users.noreply.gitlab.com> Co-authored-by: MelonSpeedruns <melonspeedruns@outlook.com> Co-authored-by: aMannus <mannusmenting@gmail.com> Co-authored-by: Dog <5172592+Dog@users.noreply.github.com> Co-authored-by: Nicholas Estelami <NEstelami@users.noreply.github.com> Co-authored-by: ChristopherJTrent <ChristopherJTrent@outlook.com> Co-authored-by: agamache <aaroncgamache@gmail.com> Co-authored-by: M4xw <m4x@m4xw.net> * Fixed switch compilation * Fixed responsive on switch imgui * Remove config save hook * Added physical slots into controller name * Add `ifdef` for switch specific code * Add `ifdef` for switch specific code * Added applet mode detection * Replaced homebrew icon * Fixed randomness on applet mode view * Fixed clkrst initialization * Switch profiles cleanup * Cleaned code based on dcvz comments * Remove unused hooks in Mercury * Fixed compilation * Use IMGUI_IMPL_OPENGL_LOADER_CUSTOM * Fix up StormLib modifications * Handle touch events at ImGui/SDL level * Enable opening menu with - * Load Nintendo Switch font * Updates to window initiation * Handle virtual keyboard via SDL * Print OTR missing message to screen * Rename makefile for Switch * Some more additional fixes * Branch creation plus edit Changed ItemWidth & made label invisible (else issues) Added a submit button next to the text field * Removed set_texture_filter on imgui draw * Readded nintendo switch font * Fixed randomizer crash * Fix issue with strdup windows * [SWITCH] Update Jenkins file (#9) * [SWITCH] Update Jenkins file * [SWITCH] Dockerfile.switch Can be combined with other Dockerfile * [SWITCH] Add entrypoint file * Update Jenkinsfile * [SWITCH] Dockerfile mtab link link `/proc/self/mounts /etc/mtab` Co-authored-by: David Chavez <david@dcvz.io> * Cleaned code based on PR comments * Fixed switch compilation * Cleaned full texture cache instead of doing it per char * Randomizer only saves when its not a vanilla save * Disabled input when menubar is opened * Removed return from SetupFont * Cleaned code based on comments * Cleaned up random texts on switch error screen * Killed * Removed debug and changed compilation flags Co-authored-by: KiritoDv <nohomoboi01@gmail.com> Co-authored-by: Felipe Guaycuru <guaycuru@gmail.com> Co-authored-by: David Chavez <david@dcvz.io> Co-authored-by: Jeffrey Crowell <github@crowell.biz> Co-authored-by: BountyChocolate123456 <101743444+BountyChocolate123456@users.noreply.github.com> Co-authored-by: sholdee <102821812+sholdee@users.noreply.github.com> Co-authored-by: briaguya <briaguya@alice> Co-authored-by: rozlette <Rozelette@users.noreply.github.com> Co-authored-by: PurpleHato <linkvssangoku.jr@gmail.com> Co-authored-by: Christopher Leggett <chris@leggett.dev> Co-authored-by: Kenix3 <kenixwhisperwind@gmail.com> Co-authored-by: vaguerant <vaguerant@users.noreply.github.com> Co-authored-by: earthcrafterman <banddstudios@gmail.com> Co-authored-by: louist103 <35883445+louist103@users.noreply.github.com> Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> Co-authored-by: qurious-pixel <62252937+qurious-pixel@users.noreply.github.com> Co-authored-by: Baoulettes <perlouzerie@hotmail.fr> Co-authored-by: Sirius902 <10891979+Sirius902@users.noreply.github.com> Co-authored-by: modestposer <modestposer@gmail.com> Co-authored-by: Ada <60364512+GreatArgorath@users.noreply.github.com> Co-authored-by: Stormghetti <56653191+Stormghetti@users.noreply.github.com> Co-authored-by: Sirius902 <3645979-Sirius902@users.noreply.gitlab.com> Co-authored-by: MelonSpeedruns <melonspeedruns@outlook.com> Co-authored-by: aMannus <mannusmenting@gmail.com> Co-authored-by: Dog <5172592+Dog@users.noreply.github.com> Co-authored-by: Nicholas Estelami <NEstelami@users.noreply.github.com> Co-authored-by: ChristopherJTrent <ChristopherJTrent@outlook.com> Co-authored-by: agamache <aaroncgamache@gmail.com> Co-authored-by: M4xw <m4x@m4xw.net>
2022-07-25 21:11:53 -04:00
#include <PR/ultra64/abi.h>
typedef struct {
/* 0x0000 */ char unk_0000;
/* 0x0001 */ s8 numSynthesisReverbs;
/* 0x0002 */ u16 unk_2;
/* 0x0004 */ u16 unk_4;
/* 0x0006 */ char unk_0006[0x0A];
/* 0x0010 */ s16* curLoadedBook;
/* 0x0014 */ NoteSubEu* noteSubsEu;
/* 0x0018 */ SynthesisReverb synthesisReverbs[4];
/* 0x0B38 */ char unk_0B38[0x30];
/* 0x0B68 */ SoundFontSample* usedSamples[128];
/* 0x0D68 */ AudioPreloadReq preloadSampleStack[128];
/* 0x1768 */ s32 numUsedSamples;
/* 0x176C */ s32 preloadSampleStackTop;
/* 0x1770 */ AudioAsyncLoad asyncLoads[0x10];
/* 0x1CF0 */ OSMesgQueue asyncLoadUnkMediumQueue;
/* 0x1D08 */ char unk_1D08[0x40];
/* 0x1D48 */ AudioAsyncLoad* curUnkMediumLoad;
/* 0x1D4C */ u32 slowLoadPos;
/* 0x1D50 */ AudioSlowLoad slowLoads[2];
/* 0x1E18 */ OSPiHandle* cartHandle;
/* 0x1E1C */ OSPiHandle* driveHandle;
/* 0x1E20 */ OSMesgQueue externalLoadQueue;
/* 0x1E38 */ OSMesg externalLoadMesgBuf[0x10];
/* 0x1E78 */ OSMesgQueue preloadSampleQueue;
/* 0x1E90 */ OSMesg preloadSampleMesgBuf[0x10];
/* 0x1ED0 */ OSMesgQueue currAudioFrameDmaQueue;
/* 0x1EE8 */ OSMesg currAudioFrameDmaMesgBuf[0x40];
/* 0x1FE8 */ OSIoMesg currAudioFrameDmaIoMesgBuf[0x40];
/* 0x25E8 */ OSMesgQueue syncDmaQueue;
/* 0x2600 */ OSMesg syncDmaMesg;
/* 0x2604 */ OSIoMesg syncDmaIoMesg;
/* 0x261C */ SampleDma* sampleDmas;
/* 0x2620 */ u32 sampleDmaCount;
/* 0x2624 */ u32 sampleDmaListSize1;
/* 0x2628 */ s32 unused2628;
/* 0x262C */ u8 sampleDmaReuseQueue1[0x100]; // read pos <= write pos, wrapping mod 256
/* 0x272C */ u8 sampleDmaReuseQueue2[0x100];
/* 0x282C */ u8 sampleDmaReuseQueue1RdPos;
/* 0x282D */ u8 sampleDmaReuseQueue2RdPos;
/* 0x282E */ u8 sampleDmaReuseQueue1WrPos;
/* 0x282F */ u8 sampleDmaReuseQueue2WrPos;
/* 0x2830 */ AudioTable* sequenceTable;
/* 0x2834 */ AudioTable* soundFontTable;
/* 0x2838 */ AudioTable* sampleBankTable;
/* 0x283C */ u8* sequenceFontTable;
/* 0x2840 */ u16 numSequences;
/* 0x2844 */ SoundFont* soundFonts;
/* 0x2848 */ AudioBufferParameters audioBufferParameters;
/* 0x2870 */ f32 unk_2870;
/* 0x2874 */ s32 sampleDmaBufSize1;
/* 0x2874 */ s32 sampleDmaBufSize2;
/* 0x287C */ char unk_287C[0x10];
/* 0x288C */ s32 sampleDmaBufSize;
/* 0x2890 */ s32 maxAudioCmds;
/* 0x2894 */ s32 numNotes;
/* 0x2898 */ s16 tempoInternalToExternal;
/* 0x289A */ s8 soundMode;
/* 0x289C */ s32 totalTaskCnt;
/* 0x28A0 */ s32 curAudioFrameDmaCount;
/* 0x28A4 */ s32 rspTaskIdx;
/* 0x28A8 */ s32 curAIBufIdx;
/* 0x28AC */ Acmd* abiCmdBufs[2];
/* 0x28B4 */ Acmd* curAbiCmdBuf;
/* 0x28B8 */ AudioTask* currTask;
/* 0x28BC */ char unk_28BC[0x4];
/* 0x28C0 */ AudioTask rspTask[2];
/* 0x2960 */ f32 unk_2960;
/* 0x2964 */ s32 refreshRate;
/* 0x2968 */ s16* aiBuffers[3];
/* 0x2974 */ s16 aiBufLengths[3];
/* 0x297C */ u32 audioRandom;
/* 0x2980 */ s32 audioErrorFlags;
/* 0x2984 */ volatile u32 resetTimer;
/* 0x2988 */ char unk_2988[0x8];
/* 0x2990 */ AudioAllocPool audioSessionPool;
/* 0x29A0 */ AudioAllocPool externalPool;
/* 0x29B0 */ AudioAllocPool audioInitPool;
/* 0x29C0 */ AudioAllocPool notesAndBuffersPool;
/* 0x29D0 */ char unk_29D0[0x20]; // probably two unused pools
/* 0x29F0 */ AudioAllocPool cachePool;
/* 0x2A00 */ AudioAllocPool persistentCommonPool;
/* 0x2A10 */ AudioAllocPool temporaryCommonPool;
/* 0x2A20 */ AudioCache seqCache;
/* 0x2B30 */ AudioCache fontCache;
/* 0x2C40 */ AudioCache sampleBankCache;
/* 0x2D50 */ AudioAllocPool permanentPool;
/* 0x2D60 */ AudioCacheEntry permanentCache[32];
/* 0x2EE0 */ AudioSampleCache persistentSampleCache;
/* 0x3174 */ AudioSampleCache temporarySampleCache;
/* 0x3408 */ AudioPoolSplit4 sessionPoolSplit;
/* 0x3418 */ AudioPoolSplit2 cachePoolSplit;
/* 0x3420 */ AudioPoolSplit3 persistentCommonPoolSplit;
/* 0x342C */ AudioPoolSplit3 temporaryCommonPoolSplit;
/* 0x3438 */ u8 sampleFontLoadStatus[0x30];
/* 0x3468 */ u8 fontLoadStatus[0x30];
/* 0x3498 */ u8 seqLoadStatus[0x80];
/* 0x3518 */ volatile u8 resetStatus;
/* 0x3519 */ u8 audioResetSpecIdToLoad;
/* 0x351C */ s32 audioResetFadeOutFramesLeft;
/* 0x3520 */ f32* unk_3520;
/* 0x3524 */ u8* audioHeap;
2022-05-16 20:16:56 -04:00
/* 0x3528 */ size_t audioHeapSize;
/* 0x352C */ Note* notes;
/* 0x3530 */ SequencePlayer seqPlayers[4];
/* 0x3AB0 */ SequenceLayer sequenceLayers[64];
/* 0x5AB0 */ SequenceChannel sequenceChannelNone;
/* 0x5B84 */ s32 noteSubEuOffset;
/* 0x5B88 */ AudioListItem layerFreeList;
/* 0x5B98 */ NotePool noteFreeLists;
/* 0x5BD8 */ u8 cmdWrPos;
/* 0x5BD9 */ u8 cmdRdPos;
/* 0x5BDA */ u8 cmdQueueFinished;
/* 0x5BDC */ u16 unk_5BDC[4];
/* 0x5BE4 */ OSMesgQueue* audioResetQueueP;
/* 0x5BE8 */ OSMesgQueue* taskStartQueueP;
/* 0x5BEC */ OSMesgQueue* cmdProcQueueP;
/* 0x5BF0 */ OSMesgQueue taskStartQueue;
/* 0x5C08 */ OSMesgQueue cmdProcQueue;
/* 0x5C20 */ OSMesgQueue audioResetQueue;
/* 0x5C38 */ OSMesg taskStartMsgs[1];
/* 0x5C3C */ OSMesg audioResetMesgs[1];
/* 0x5C40 */ OSMesg cmdProcMsgs[4];
/* 0x5C50 */ AudioCmd cmdBuf[0x100];
} AudioContext; // size = 0x6450
typedef struct {
/* 0x00 */ u8 reverbVol;
/* 0x01 */ u8 unk_1;
/* 0x02 */ u8 pan;
/* 0x03 */ Stereo stereo;
/* 0x04 */ f32 frequency;
/* 0x08 */ f32 velocity;
/* 0x0C */ char unk_0C[0x4];
/* 0x10 */ s16* filter;
/* 0x14 */ u8 unk_14;
/* 0x16 */ u16 unk_16;
} NoteSubAttributes; // size = 0x18
typedef struct {
2022-05-16 20:16:56 -04:00
/* 0x00 */ size_t heapSize;
/* 0x04 */ size_t initPoolSize;
/* 0x08 */ size_t permanentPoolSize;
} AudioContextInitSizes; // size = 0xC
typedef struct {
/* 0x00 */ f32 unk_00;
/* 0x04 */ f32 unk_04;
/* 0x08 */ f32 unk_08;
/* 0x0C */ u16 unk_0C;
/* 0x10 */ f32 unk_10;
/* 0x14 */ f32 unk_14;
/* 0x18 */ f32 unk_18;
/* 0x1C */ u16 unk_1C;
} unk_50_s; // size = 0x20
typedef struct {
/* 0x000 */ f32 volCur;
/* 0x004 */ f32 volTarget;
/* 0x008 */ f32 unk_08;
/* 0x00C */ u16 unk_0C;
/* 0x00E */ u8 volScales[0x4];
/* 0x012 */ u8 volFadeTimer;
/* 0x013 */ u8 fadeVolUpdate;
/* 0x014 */ u32 unk_14;
/* 0x018 */ u16 unk_18;
/* 0x01C */ f32 unk_1C;
/* 0x020 */ f32 unk_20;
/* 0x024 */ f32 unk_24;
/* 0x028 */ u16 unk_28;
/* 0x02C */ u32 unk_2C[8];
/* 0x04C */ u8 unk_4C;
/* 0x04D */ u8 unk_4D;
/* 0x04E */ u8 unk_4E;
/* 0x050 */ unk_50_s unk_50[0x10];
/* 0x250 */ u16 unk_250;
/* 0x252 */ u16 unk_252;
/* 0x254 */ u16 unk_254;
/* 0x256 */ u16 unk_256;
/* 0x258 */ u16 unk_258;
/* 0x25C */ u32 unk_25C;
/* 0x260 */ u8 unk_260;
} unk_D_8016E750; // size = 0x264
typedef enum {
/* 0 */ BANK_PLAYER,
/* 1 */ BANK_ITEM,
/* 2 */ BANK_ENV,
/* 3 */ BANK_ENEMY,
/* 4 */ BANK_SYSTEM,
/* 5 */ BANK_OCARINA,
/* 6 */ BANK_VOICE
} SoundBankTypes;
typedef enum {
/* 0 */ SFX_STATE_EMPTY,
/* 1 */ SFX_STATE_QUEUED,
/* 2 */ SFX_STATE_READY,
/* 3 */ SFX_STATE_PLAYING_REFRESH,
/* 4 */ SFX_STATE_PLAYING_1,
/* 5 */ SFX_STATE_PLAYING_2
} SfxState;
typedef struct {
/* 0x00 */ f32* posX;
/* 0x04 */ f32* posY;
/* 0x08 */ f32* posZ;
/* 0x0C */ u8 token;
/* 0x10 */ f32* freqScale;
/* 0x14 */ f32* vol;
/* 0x18 */ s8* reverbAdd;
/* 0x1C */ f32 dist;
/* 0x20 */ u32 priority; // lower is more prioritized
/* 0x24 */ u8 sfxImportance;
/* 0x26 */ u16 sfxParams;
/* 0x28 */ u16 sfxId;
/* 0x2A */ u8 state; // uses SfxState enum
/* 0x2B */ u8 freshness;
/* 0x2C */ u8 prev;
/* 0x2D */ u8 next;
/* 0x2E */ u8 channelIdx;
/* 0x2F */ u8 unk_2F;
} SoundBankEntry; // size = 0x30
/*
* SFX IDs
*
* index 0000000111111111 observed in audio code
* & 200 0000001000000000 single bit
* & 400 0000010000000000 single bit
* & 800 0000100000000000 single bit, what we currently call SFX_FLAG
* & 600 0000011000000000 2 bits
* & A00 0000101000000000 2 bits
* & C00 0000110000000000 2 bits, observed in audio code
* & E00 0000111000000000 all 3 bits
* bank 1111000000000000 observed in audio code
*/
#define SFX_BANK_SHIFT(sfxId) (((sfxId) >> 12) & 0xFF)
#define SFX_BANK_MASK(sfxId) ((sfxId) & 0xF000)
#define SFX_INDEX(sfxId) ((sfxId) & 0x01FF)
#define SFX_BANK(sfxId) SFX_BANK_SHIFT(SFX_BANK_MASK(sfxId))
typedef struct {
u32 priority; // lower is more prioritized
u8 entryIndex;
} ActiveSound;
typedef struct {
u8 importance;
u16 params;
} SoundParams;
typedef struct {
/* 0x0000 */ u8 noteIdx;
/* 0x0001 */ u8 unk_01;
/* 0x0002 */ u16 unk_02;
/* 0x0004 */ u8 volume;
/* 0x0005 */ u8 vibrato;
/* 0x0006 */ s8 tone;
/* 0x0007 */ u8 semitone;
} OcarinaNote; // size = 0x8
typedef struct {
u8 len;
u8 notesIdx[8];
} OcarinaSongInfo;
typedef struct {
u8 noteIdx;
u8 state; // original name: "status"
u8 pos; // original name: "locate"
} OcarinaStaff;
typedef enum {
/* 0 */ OCARINA_NOTE_A,
/* 1 */ OCARINA_NOTE_C_DOWN,
/* 2 */ OCARINA_NOTE_C_RIGHT,
/* 3 */ OCARINA_NOTE_C_LEFT,
/* 4 */ OCARINA_NOTE_C_UP,
/* -1 */ OCARINA_NOTE_INVALID = 0xFF
} OcarinaNoteIdx;
2022-06-10 13:37:50 -04:00
typedef struct {
char* seqData;
int32_t seqDataSize;
uint8_t seqNumber;
uint8_t medium;
uint8_t cachePolicy;
int32_t numFonts;
uint8_t fonts[16];
} SequenceData;
#ifdef __cplusplus
extern "C" {
#endif
void Audio_SetGameVolume(int player_id, f32 volume);
float Audio_GetGameVolume(int player_id);
#ifdef __cplusplus
}
#endif
#endif