You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Merge branch 'develop/2.1.0' of https://github.com/HackerN64/HackerSM64 into develop/2.1.0-four-controllers-base
This commit is contained in:
246
src/audio/data.c
246
src/audio/data.c
@@ -43,7 +43,7 @@ struct AudioSessionSettingsEU gAudioSessionPresets[] = {
|
||||
|
||||
#ifdef BETTER_REVERB
|
||||
// Each entry represents an array of variable audio buffer sizes / delays for each respective filter.
|
||||
u32 delaysArr[][NUM_ALLPASS] = {
|
||||
u32 sReverbDelaysArr[][NUM_ALLPASS] = {
|
||||
{ /* 0 */
|
||||
4, 4, 4,
|
||||
4, 4, 4,
|
||||
@@ -65,8 +65,7 @@ u32 delaysArr[][NUM_ALLPASS] = {
|
||||
};
|
||||
|
||||
// Each entry represents an array of multipliers applied to the final output of each group of 3 filters.
|
||||
// These values are u8s in spirit, but are set as s32 values to slightly increase performance during calculations.
|
||||
s32 reverbMultsArr[][NUM_ALLPASS / 3] = {
|
||||
u8 sReverbMultsArr[][NUM_ALLPASS / 3] = {
|
||||
/* 0 */ {0x00, 0x00, 0x00, 0x00},
|
||||
/* 1 */ {0xD7, 0x6F, 0x36, 0x22},
|
||||
/* 2 */ {0xCF, 0x73, 0x38, 0x1F},
|
||||
@@ -75,11 +74,11 @@ s32 reverbMultsArr[][NUM_ALLPASS / 3] = {
|
||||
/**
|
||||
* Format:
|
||||
* - useLightweightSettings (Reduce some runtime configurability options in favor of a slight speed boost during processing; Light configurability settings are found in synthesis.h)
|
||||
* - downsampleRate (Higher values exponentially reduce the number of input samples to process, improving perfomance at cost of quality)
|
||||
* - downsampleRate (Higher values exponentially reduce the number of input samples to process, improving perfomance at cost of quality; number <= 0 signifies use of vanilla reverb)
|
||||
* - isMono (Only process reverb on the left channel and share it with the right channel, improving performance at cost of quality)
|
||||
* - filterCount (Number of filters to process data with; in general, more filters means higher quality at the cost of performance demand; always 3 with light settings)
|
||||
*
|
||||
* - windowSize (Size of circular reverb buffer; higher values work better for a more open soundscape, lower is better for a more compact sound)
|
||||
* - windowSize (Size of circular reverb buffer; higher values work better for a more open soundscape, lower is better for a more compact sound; value of 0 disables all reverb)
|
||||
* - gain (Amount of audio retransmitted into the circular reverb buffer, emulating decay; higher values represent a lengthier decay period)
|
||||
* - gainIndex (Advanced parameter; used to tune the outputs of every first two of three filters; overridden when using light settings)
|
||||
* - reverbIndex (Advanced parameter; used to tune the incoming output of every third filter; overridden when using light settings)
|
||||
@@ -94,55 +93,98 @@ s32 reverbMultsArr[][NUM_ALLPASS / 3] = {
|
||||
*/
|
||||
struct BetterReverbSettings gBetterReverbSettings[] = {
|
||||
{ /* Preset 0 - Vanilla Reverb [Default Preset] */
|
||||
.useLightweightSettings = FALSE, // Ignored with vanilla reverb
|
||||
.downsampleRate = -1, // Signifies use of vanilla reverb
|
||||
.isMono = FALSE, // Ignored with vanilla reverb
|
||||
.filterCount = NUM_ALLPASS, // Ignored with vanilla reverb
|
||||
.useLightweightSettings = FALSE, // Ignored with vanilla reverb
|
||||
.downsampleRate = -1, // Signifies use of vanilla reverb
|
||||
.isMono = FALSE, // Ignored with vanilla reverb
|
||||
.filterCount = NUM_ALLPASS, // Ignored with vanilla reverb
|
||||
|
||||
.windowSize = -1, // Use vanilla preset window size
|
||||
.gain = -1, // Use vanilla preset gain value
|
||||
.gainIndex = 0x00, // Ignored with vanilla reverb
|
||||
.reverbIndex = 0x00, // Ignored with vanilla reverb
|
||||
.windowSize = -1, // Use vanilla preset window size
|
||||
.gain = -1, // Use vanilla preset gain value
|
||||
.gainIndex = 0x00, // Ignored with vanilla reverb
|
||||
.reverbIndex = 0x00, // Ignored with vanilla reverb
|
||||
|
||||
.delaysL = delaysArr[0], // Ignored with vanilla reverb
|
||||
.delaysR = delaysArr[0], // Ignored with vanilla reverb
|
||||
.reverbMultsL = reverbMultsArr[0], // Ignored with vanilla reverb
|
||||
.reverbMultsR = reverbMultsArr[0], // Ignored with vanilla reverb
|
||||
.delaysL = sReverbDelaysArr[0], // Ignored with vanilla reverb
|
||||
.delaysR = sReverbDelaysArr[0], // Ignored with vanilla reverb
|
||||
.reverbMultsL = sReverbMultsArr[0], // Ignored with vanilla reverb
|
||||
.reverbMultsR = sReverbMultsArr[0], // Ignored with vanilla reverb
|
||||
},
|
||||
{ /* Preset 1 - Sample Console Configuration */
|
||||
.useLightweightSettings = TRUE,
|
||||
.downsampleRate = 2,
|
||||
.isMono = FALSE,
|
||||
.filterCount = (NUM_ALLPASS - 9), // Ignored with lightweight settings
|
||||
.filterCount = (NUM_ALLPASS - 9), // Ignored with lightweight settings
|
||||
|
||||
.windowSize = 0x0E00,
|
||||
.gain = 0x43FF,
|
||||
.gainIndex = 0xA0, // Ignored with lightweight settings
|
||||
.reverbIndex = 0x30, // Ignored with lightweight settings
|
||||
.gain = 0x2FFF,
|
||||
.gainIndex = 0xA0, // Ignored with lightweight settings
|
||||
.reverbIndex = 0x30, // Ignored with lightweight settings
|
||||
|
||||
.delaysL = delaysArr[1],
|
||||
.delaysR = delaysArr[2],
|
||||
.reverbMultsL = reverbMultsArr[1], // Ignored with lightweight settings
|
||||
.reverbMultsR = reverbMultsArr[2], // Ignored with lightweight settings
|
||||
.delaysL = sReverbDelaysArr[1],
|
||||
.delaysR = sReverbDelaysArr[2],
|
||||
.reverbMultsL = sReverbMultsArr[1], // Ignored with lightweight settings
|
||||
.reverbMultsR = sReverbMultsArr[2], // Ignored with lightweight settings
|
||||
},
|
||||
{ /* Preset 2 - Sample Emulator Configuration (RCVI Hack Only) */
|
||||
{ /* Preset 2 - Sample Emulator Configuration (RCVI Hack or Emulator CPU Overclocking Required!) */
|
||||
.useLightweightSettings = FALSE,
|
||||
.downsampleRate = 1,
|
||||
.isMono = FALSE,
|
||||
.filterCount = NUM_ALLPASS,
|
||||
|
||||
.windowSize = 0x0E00,
|
||||
.gain = 0x28FF,
|
||||
.gain = 0x2AFF,
|
||||
.gainIndex = 0xA0,
|
||||
.reverbIndex = 0x60,
|
||||
.reverbIndex = 0x40,
|
||||
|
||||
.delaysL = delaysArr[1],
|
||||
.delaysR = delaysArr[2],
|
||||
.reverbMultsL = reverbMultsArr[1],
|
||||
.reverbMultsR = reverbMultsArr[2],
|
||||
.delaysL = sReverbDelaysArr[1],
|
||||
.delaysR = sReverbDelaysArr[2],
|
||||
.reverbMultsL = sReverbMultsArr[1],
|
||||
.reverbMultsR = sReverbMultsArr[2],
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
// Used for A/B comparisons and preset configuration debugging alongside Puppyprint Debug
|
||||
struct BetterReverbSettings gDebugBetterReverbSettings[2] = {
|
||||
{ /* Preset A */
|
||||
.useLightweightSettings = FALSE,
|
||||
.downsampleRate = 2,
|
||||
.isMono = FALSE,
|
||||
.filterCount = (NUM_ALLPASS - 9),
|
||||
|
||||
.windowSize = 0x0E00,
|
||||
.gain = 0x2FFF,
|
||||
.gainIndex = 0xA0,
|
||||
.reverbIndex = 0x30,
|
||||
|
||||
.delaysL = sReverbDelaysArr[1],
|
||||
.delaysR = sReverbDelaysArr[2],
|
||||
.reverbMultsL = sReverbMultsArr[1],
|
||||
.reverbMultsR = sReverbMultsArr[2],
|
||||
},
|
||||
{ /* Preset B */
|
||||
.useLightweightSettings = FALSE,
|
||||
.downsampleRate = 2,
|
||||
.isMono = FALSE,
|
||||
.filterCount = (NUM_ALLPASS - 9),
|
||||
|
||||
.windowSize = 0x0E00,
|
||||
.gain = 0x2FFF,
|
||||
.gainIndex = 0xA0,
|
||||
.reverbIndex = 0x30,
|
||||
|
||||
.delaysL = sReverbDelaysArr[1],
|
||||
.delaysR = sReverbDelaysArr[2],
|
||||
.reverbMultsL = sReverbMultsArr[1],
|
||||
.reverbMultsR = sReverbMultsArr[2],
|
||||
},
|
||||
};
|
||||
#endif // PUPPYPRINT_DEBUG
|
||||
|
||||
STATIC_ASSERT(ARRAY_COUNT(gBetterReverbSettings) > 0, "gBetterReverbSettings must contain presets!");
|
||||
STATIC_ASSERT(ARRAY_COUNT(sReverbDelaysArr) > 0, "sReverbDelaysArr must not be empty!");
|
||||
STATIC_ASSERT(ARRAY_COUNT(sReverbMultsArr) > 0, "sReverbMultsArr must not be empty!");
|
||||
|
||||
#endif // BETTER_REVERB
|
||||
|
||||
// Format:
|
||||
// - frequency
|
||||
@@ -613,8 +655,10 @@ u16 gHeadsetPanQuantization[0x10] = {
|
||||
0x40, 0x40, 0x30, 0x30, 0x20, 0x20, 0x10, 0, 0, 0,
|
||||
};
|
||||
#elif !defined(VERSION_SH)
|
||||
#ifdef ENABLE_STEREO_HEADSET_EFFECTS
|
||||
u16 gHeadsetPanQuantization[10] = { 0x40, 0x30, 0x20, 0x10, 0, 0, 0, 0, 0, 0 };
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
s16 euUnknownData_80301950[64] = {
|
||||
@@ -623,6 +667,7 @@ s16 euUnknownData_80301950[64] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_STEREO_HEADSET_EFFECTS
|
||||
// Linearly interpolated between
|
||||
// f(0/2 * 127) = 1
|
||||
// f(1/2 * 127) = 1/sqrt(2)
|
||||
@@ -668,6 +713,7 @@ f32 gStereoPanVolume[128] = {
|
||||
0.242161f, 0.253295f, 0.264429f, 0.275563f, 0.286697f, 0.297831f, 0.308965f, 0.320098f, 0.331232f,
|
||||
0.342366f, 0.3535f
|
||||
};
|
||||
#endif
|
||||
|
||||
// gDefaultVolume[k] = cos(pi/2 * k / 127)
|
||||
f32 gDefaultPanVolume[128] = {
|
||||
@@ -689,131 +735,7 @@ f32 gDefaultPanVolume[128] = {
|
||||
};
|
||||
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
// gVolRampingLhs136[k] = 2^16 * max(1, (256*k)^(1/17)
|
||||
f32 gVolRampingLhs136[128] = {
|
||||
65536.0f, 90811.555f, 94590.766f, 96873.96f, 98527.26f, 99829.06f, 100905.47f,
|
||||
101824.61f, 102627.57f, 103341.086f, 103983.55f, 104568.164f, 105104.75f, 105600.8f,
|
||||
106062.14f, 106493.46f, 106898.52f, 107280.414f, 107641.73f, 107984.62f, 108310.93f,
|
||||
108622.23f, 108919.875f, 109205.055f, 109478.8f, 109742.0f, 109995.48f, 110239.94f,
|
||||
110476.02f, 110704.305f, 110925.3f, 111139.45f, 111347.21f, 111548.945f, 111745.0f,
|
||||
111935.7f, 112121.35f, 112302.2f, 112478.51f, 112650.51f, 112818.4f, 112982.38f,
|
||||
113142.66f, 113299.37f, 113452.69f, 113602.766f, 113749.734f, 113893.73f, 114034.87f,
|
||||
114173.26f, 114309.02f, 114442.26f, 114573.055f, 114701.5f, 114827.69f, 114951.695f,
|
||||
115073.6f, 115193.47f, 115311.375f, 115427.39f, 115541.56f, 115653.96f, 115764.63f,
|
||||
115873.64f, 115981.04f, 116086.86f, 116191.164f, 116293.99f, 116395.38f, 116495.38f,
|
||||
116594.02f, 116691.34f, 116787.39f, 116882.19f, 116975.77f, 117068.17f, 117159.414f,
|
||||
117249.54f, 117338.57f, 117426.53f, 117513.45f, 117599.35f, 117684.266f, 117768.2f,
|
||||
117851.195f, 117933.266f, 118014.44f, 118094.72f, 118174.14f, 118252.71f, 118330.46f,
|
||||
118407.4f, 118483.55f, 118558.914f, 118633.53f, 118707.4f, 118780.54f, 118852.97f,
|
||||
118924.695f, 118995.74f, 119066.11f, 119135.82f, 119204.88f, 119273.31f, 119341.125f,
|
||||
119408.32f, 119474.92f, 119540.93f, 119606.36f, 119671.22f, 119735.52f, 119799.28f,
|
||||
119862.5f, 119925.195f, 119987.36f, 120049.02f, 120110.18f, 120170.84f, 120231.016f,
|
||||
120290.71f, 120349.945f, 120408.7f, 120467.016f, 120524.875f, 120582.3f, 120639.28f,
|
||||
120695.84f, 120751.984f
|
||||
};
|
||||
|
||||
// gVolRampingRhs136[k] = 1 / max(1, (256*k)^(1/17))
|
||||
f32 gVolRampingRhs136[128] = {
|
||||
1.0f, 0.72167f, 0.692837f, 0.676508f, 0.665156f, 0.656482f, 0.649479f, 0.643616f, 0.638581f,
|
||||
0.634172f, 0.630254f, 0.62673f, 0.62353f, 0.620601f, 0.617902f, 0.615399f, 0.613067f, 0.610885f,
|
||||
0.608835f, 0.606901f, 0.605073f, 0.603339f, 0.60169f, 0.600119f, 0.598618f, 0.597183f, 0.595806f,
|
||||
0.594485f, 0.593215f, 0.591991f, 0.590812f, 0.589674f, 0.588573f, 0.587509f, 0.586478f, 0.585479f,
|
||||
0.58451f, 0.583568f, 0.582654f, 0.581764f, 0.580898f, 0.580055f, 0.579233f, 0.578432f, 0.57765f,
|
||||
0.576887f, 0.576142f, 0.575414f, 0.574701f, 0.574005f, 0.573323f, 0.572656f, 0.572002f, 0.571361f,
|
||||
0.570733f, 0.570118f, 0.569514f, 0.568921f, 0.568339f, 0.567768f, 0.567207f, 0.566656f, 0.566114f,
|
||||
0.565582f, 0.565058f, 0.564543f, 0.564036f, 0.563537f, 0.563046f, 0.562563f, 0.562087f, 0.561618f,
|
||||
0.561156f, 0.560701f, 0.560253f, 0.559811f, 0.559375f, 0.558945f, 0.558521f, 0.558102f, 0.557689f,
|
||||
0.557282f, 0.55688f, 0.556483f, 0.556091f, 0.555704f, 0.555322f, 0.554944f, 0.554571f, 0.554203f,
|
||||
0.553839f, 0.553479f, 0.553123f, 0.552772f, 0.552424f, 0.55208f, 0.55174f, 0.551404f, 0.551071f,
|
||||
0.550742f, 0.550417f, 0.550095f, 0.549776f, 0.549461f, 0.549148f, 0.548839f, 0.548534f, 0.548231f,
|
||||
0.547931f, 0.547634f, 0.54734f, 0.547048f, 0.54676f, 0.546474f, 0.546191f, 0.54591f, 0.545632f,
|
||||
0.545357f, 0.545084f, 0.544813f, 0.544545f, 0.54428f, 0.544016f, 0.543755f, 0.543496f, 0.543239f,
|
||||
0.542985f, 0.542732f
|
||||
};
|
||||
|
||||
// gVolRampingLhs144[k] = 2^16 * max(1, (256*k)^(1/18))
|
||||
f32 gVolRampingLhs144[128] = {
|
||||
65536.0f, 89180.734f, 92681.9f, 94793.33f, 96320.52f, 97522.02f, 98514.84f,
|
||||
99362.14f, 100101.99f, 100759.16f, 101350.664f, 101888.74f, 102382.46f, 102838.75f,
|
||||
103263.016f, 103659.58f, 104031.914f, 104382.89f, 104714.88f, 105029.89f, 105329.61f,
|
||||
105615.5f, 105888.81f, 106150.63f, 106401.914f, 106643.49f, 106876.12f, 107100.44f,
|
||||
107317.05f, 107526.47f, 107729.17f, 107925.6f, 108116.125f, 108301.12f, 108480.88f,
|
||||
108655.72f, 108825.91f, 108991.68f, 109153.28f, 109310.914f, 109464.77f, 109615.04f,
|
||||
109761.88f, 109905.46f, 110045.92f, 110183.41f, 110318.02f, 110449.91f, 110579.17f,
|
||||
110705.914f, 110830.234f, 110952.234f, 111071.99f, 111189.59f, 111305.12f, 111418.64f,
|
||||
111530.23f, 111639.95f, 111747.875f, 111854.05f, 111958.54f, 112061.4f, 112162.67f,
|
||||
112262.42f, 112360.68f, 112457.51f, 112552.93f, 112647.0f, 112739.76f, 112831.23f,
|
||||
112921.46f, 113010.484f, 113098.33f, 113185.02f, 113270.61f, 113355.11f, 113438.555f,
|
||||
113520.97f, 113602.375f, 113682.805f, 113762.27f, 113840.81f, 113918.44f, 113995.18f,
|
||||
114071.055f, 114146.08f, 114220.266f, 114293.65f, 114366.24f, 114438.06f, 114509.12f,
|
||||
114579.44f, 114649.02f, 114717.91f, 114786.086f, 114853.586f, 114920.42f, 114986.6f,
|
||||
115052.14f, 115117.055f, 115181.34f, 115245.04f, 115308.13f, 115370.65f, 115432.59f,
|
||||
115493.98f, 115554.81f, 115615.11f, 115674.875f, 115734.12f, 115792.85f, 115851.08f,
|
||||
115908.82f, 115966.07f, 116022.85f, 116079.16f, 116135.01f, 116190.4f, 116245.35f,
|
||||
116299.87f, 116353.945f, 116407.6f, 116460.84f, 116513.67f, 116566.09f, 116618.125f,
|
||||
116669.76f, 116721.01f
|
||||
};
|
||||
|
||||
// gVolRampingRhs144[k] = 1 / max(1, (256*k)^(1/18))
|
||||
f32 gVolRampingRhs144[128] = {
|
||||
1.0f, 0.734867f, 0.707107f, 0.691357f, 0.680395f, 0.672012f, 0.66524f, 0.659567f, 0.654692f,
|
||||
0.650422f, 0.646626f, 0.643211f, 0.64011f, 0.637269f, 0.634651f, 0.632223f, 0.629961f, 0.627842f,
|
||||
0.625852f, 0.623975f, 0.622199f, 0.620515f, 0.618913f, 0.617387f, 0.615929f, 0.614533f, 0.613196f,
|
||||
0.611912f, 0.610677f, 0.609487f, 0.60834f, 0.607233f, 0.606163f, 0.605128f, 0.604125f, 0.603153f,
|
||||
0.60221f, 0.601294f, 0.600403f, 0.599538f, 0.598695f, 0.597874f, 0.597074f, 0.596294f, 0.595533f,
|
||||
0.59479f, 0.594064f, 0.593355f, 0.592661f, 0.591983f, 0.591319f, 0.590669f, 0.590032f, 0.589408f,
|
||||
0.588796f, 0.588196f, 0.587608f, 0.58703f, 0.586463f, 0.585906f, 0.58536f, 0.584822f, 0.584294f,
|
||||
0.583775f, 0.583265f, 0.582762f, 0.582268f, 0.581782f, 0.581303f, 0.580832f, 0.580368f, 0.579911f,
|
||||
0.57946f, 0.579017f, 0.578579f, 0.578148f, 0.577722f, 0.577303f, 0.576889f, 0.576481f, 0.576078f,
|
||||
0.575681f, 0.575289f, 0.574902f, 0.574519f, 0.574142f, 0.573769f, 0.5734f, 0.573036f, 0.572677f,
|
||||
0.572321f, 0.57197f, 0.571623f, 0.57128f, 0.57094f, 0.570605f, 0.570273f, 0.569945f, 0.56962f,
|
||||
0.569299f, 0.568981f, 0.568667f, 0.568355f, 0.568047f, 0.567743f, 0.567441f, 0.567142f, 0.566846f,
|
||||
0.566553f, 0.566263f, 0.565976f, 0.565692f, 0.56541f, 0.565131f, 0.564854f, 0.56458f, 0.564309f,
|
||||
0.56404f, 0.563773f, 0.563509f, 0.563247f, 0.562987f, 0.56273f, 0.562475f, 0.562222f, 0.561971f,
|
||||
0.561722f, 0.561476f
|
||||
};
|
||||
|
||||
// gVolRampingLhs128[k] = 2^16 * max(1, (256*k)^(1/16))
|
||||
f32 gVolRampingLhs128[128] = {
|
||||
65536.0f, 92681.9f, 96785.28f, 99269.31f, 101070.33f, 102489.78f, 103664.336f,
|
||||
104667.914f, 105545.09f, 106324.92f, 107027.39f, 107666.84f, 108253.95f, 108796.87f,
|
||||
109301.95f, 109774.29f, 110217.98f, 110636.39f, 111032.33f, 111408.164f, 111765.9f,
|
||||
112107.234f, 112433.66f, 112746.46f, 113046.766f, 113335.555f, 113613.72f, 113882.02f,
|
||||
114141.164f, 114391.77f, 114634.414f, 114869.58f, 115097.74f, 115319.31f, 115534.68f,
|
||||
115744.19f, 115948.16f, 116146.875f, 116340.625f, 116529.66f, 116714.195f, 116894.46f,
|
||||
117070.64f, 117242.945f, 117411.52f, 117576.55f, 117738.17f, 117896.54f, 118051.77f,
|
||||
118204.0f, 118353.35f, 118499.92f, 118643.83f, 118785.16f, 118924.01f, 119060.47f,
|
||||
119194.625f, 119326.555f, 119456.336f, 119584.03f, 119709.71f, 119833.445f, 119955.29f,
|
||||
120075.31f, 120193.555f, 120310.08f, 120424.94f, 120538.17f, 120649.836f, 120759.97f,
|
||||
120868.62f, 120975.82f, 121081.62f, 121186.05f, 121289.14f, 121390.94f, 121491.47f,
|
||||
121590.766f, 121688.87f, 121785.79f, 121881.57f, 121976.24f, 122069.82f, 122162.33f,
|
||||
122253.805f, 122344.266f, 122433.73f, 122522.23f, 122609.77f, 122696.4f, 122782.11f,
|
||||
122866.93f, 122950.89f, 123033.99f, 123116.26f, 123197.72f, 123278.37f, 123358.24f,
|
||||
123437.34f, 123515.69f, 123593.3f, 123670.19f, 123746.36f, 123821.84f, 123896.63f,
|
||||
123970.76f, 124044.23f, 124117.04f, 124189.23f, 124260.78f, 124331.73f, 124402.07f,
|
||||
124471.83f, 124540.99f, 124609.59f, 124677.63f, 124745.12f, 124812.055f, 124878.47f,
|
||||
124944.34f, 125009.71f, 125074.57f, 125138.92f, 125202.79f, 125266.164f, 125329.06f,
|
||||
125391.5f, 125453.47f
|
||||
};
|
||||
|
||||
// gVolRampingRhs128[k] = 1 / max(1, (256*k)^(1/16))
|
||||
f32 gVolRampingRhs128[128] = {
|
||||
1.0f, 0.707107f, 0.677128f, 0.660184f, 0.64842f, 0.639439f, 0.632194f, 0.626133f, 0.620929f,
|
||||
0.616375f, 0.612329f, 0.608693f, 0.605391f, 0.60237f, 0.599587f, 0.597007f, 0.594604f, 0.592355f,
|
||||
0.590243f, 0.588251f, 0.586369f, 0.584583f, 0.582886f, 0.581269f, 0.579725f, 0.578247f, 0.576832f,
|
||||
0.575473f, 0.574166f, 0.572908f, 0.571696f, 0.570525f, 0.569394f, 0.5683f, 0.567241f, 0.566214f,
|
||||
0.565218f, 0.564251f, 0.563311f, 0.562398f, 0.561508f, 0.560642f, 0.559799f, 0.558976f, 0.558173f,
|
||||
0.55739f, 0.556625f, 0.555877f, 0.555146f, 0.554431f, 0.553732f, 0.553047f, 0.552376f, 0.551719f,
|
||||
0.551075f, 0.550443f, 0.549823f, 0.549216f, 0.548619f, 0.548033f, 0.547458f, 0.546892f, 0.546337f,
|
||||
0.545791f, 0.545254f, 0.544726f, 0.544206f, 0.543695f, 0.543192f, 0.542696f, 0.542209f, 0.541728f,
|
||||
0.541255f, 0.540788f, 0.540329f, 0.539876f, 0.539429f, 0.538988f, 0.538554f, 0.538125f, 0.537702f,
|
||||
0.537285f, 0.536873f, 0.536467f, 0.536065f, 0.535669f, 0.535277f, 0.534891f, 0.534509f, 0.534131f,
|
||||
0.533759f, 0.53339f, 0.533026f, 0.532666f, 0.53231f, 0.531958f, 0.53161f, 0.531266f, 0.530925f,
|
||||
0.530588f, 0.530255f, 0.529926f, 0.529599f, 0.529277f, 0.528957f, 0.528641f, 0.528328f, 0.528018f,
|
||||
0.527711f, 0.527407f, 0.527106f, 0.526808f, 0.526513f, 0.52622f, 0.525931f, 0.525644f, 0.525359f,
|
||||
0.525077f, 0.524798f, 0.524522f, 0.524247f, 0.523975f, 0.523706f, 0.523439f, 0.523174f, 0.522911f,
|
||||
0.522651f, 0.522393f
|
||||
};
|
||||
#include "volramping.c.in"
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_SH
|
||||
@@ -1034,6 +956,14 @@ s16 gAiBufferLengths[NUMAIBUFFERS];
|
||||
|
||||
u32 gAudioRandom;
|
||||
|
||||
#ifdef BETTER_REVERB
|
||||
u8 gBetterReverbPresetCount = ARRAY_COUNT(gBetterReverbSettings);
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
u8 gReverbDelaysArrCount = ARRAY_COUNT(sReverbDelaysArr);
|
||||
u8 gReverbMultsArrCount = ARRAY_COUNT(sReverbMultsArr);
|
||||
#endif // PUPPYPRINT_DEBUG
|
||||
#endif // BETTER_REVERB
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
s32 gAudioErrorFlags;
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXPAND_AUDIO_HEAP
|
||||
// Vanilla US/JP uses 7; Vanilla EU opts for 10 here effectively, though that one gets generated at runtime and doesn't use this value.
|
||||
// Total memory usage is calculated by 24*(2^VOL_RAMPING_EXPONENT) bytes. This is not technically on the heap, but it's memory nonetheless.
|
||||
#define VOL_RAMPING_EXPONENT 9
|
||||
|
||||
#define PERSISTENT_SEQ_MEM 0x8200
|
||||
#define PERSISTENT_BANK_MEM 0xDC00
|
||||
#define TEMPORARY_SEQ_MEM 0xE800
|
||||
@@ -29,6 +33,8 @@
|
||||
#define MAX_NUM_SOUNDBANKS 0x100
|
||||
#define EXT_AUDIO_INIT_POOL_SIZE 0x2000
|
||||
#else
|
||||
#define VOL_RAMPING_EXPONENT 7
|
||||
|
||||
#define PERSISTENT_SEQ_MEM 0x4100
|
||||
#define PERSISTENT_BANK_MEM 0x6E00
|
||||
#define TEMPORARY_SEQ_MEM 0x7400
|
||||
@@ -48,8 +54,16 @@ extern struct AudioSessionSettings gAudioSessionSettings;
|
||||
extern struct ReverbSettingsUS gReverbSettings[18];
|
||||
#endif
|
||||
#ifdef BETTER_REVERB
|
||||
extern u8 gBetterReverbPresetCount;
|
||||
extern struct BetterReverbSettings gBetterReverbSettings[];
|
||||
#endif
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
extern struct BetterReverbSettings gDebugBetterReverbSettings[2];
|
||||
extern u32 sReverbDelaysArr[][NUM_ALLPASS];
|
||||
extern u8 sReverbMultsArr[][NUM_ALLPASS / 3];
|
||||
extern u8 gReverbDelaysArrCount;
|
||||
extern u8 gReverbMultsArrCount;
|
||||
#endif // PUPPYPRINT_DEBUG
|
||||
#endif // BETTER_REVERB
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
extern f32 gPitchBendFrequencyScale[256];
|
||||
@@ -81,18 +95,22 @@ extern s16 euUnknownData_80301950[64];
|
||||
extern struct NoteSubEu gZeroNoteSub;
|
||||
extern struct NoteSubEu gDefaultNoteSub;
|
||||
#else
|
||||
#ifdef ENABLE_STEREO_HEADSET_EFFECTS
|
||||
extern u16 gHeadsetPanQuantization[10];
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENABLE_STEREO_HEADSET_EFFECTS
|
||||
extern f32 gHeadsetPanVolume[128];
|
||||
extern f32 gStereoPanVolume[128];
|
||||
#endif
|
||||
extern f32 gDefaultPanVolume[128];
|
||||
|
||||
extern f32 gVolRampingLhs136[128];
|
||||
extern f32 gVolRampingRhs136[128];
|
||||
extern f32 gVolRampingLhs144[128];
|
||||
extern f32 gVolRampingRhs144[128];
|
||||
extern f32 gVolRampingLhs128[128];
|
||||
extern f32 gVolRampingRhs128[128];
|
||||
extern f32 gVolRampingLhs136[1 << VOL_RAMPING_EXPONENT];
|
||||
extern f32 gVolRampingRhs136[1 << VOL_RAMPING_EXPONENT];
|
||||
extern f32 gVolRampingLhs144[1 << VOL_RAMPING_EXPONENT];
|
||||
extern f32 gVolRampingRhs144[1 << VOL_RAMPING_EXPONENT];
|
||||
extern f32 gVolRampingLhs128[1 << VOL_RAMPING_EXPONENT];
|
||||
extern f32 gVolRampingRhs128[1 << VOL_RAMPING_EXPONENT];
|
||||
|
||||
// non-constant .data
|
||||
extern s16 gTatumsPerBeat;
|
||||
|
||||
@@ -353,7 +353,9 @@ void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, UNUSED s16
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
f32 adsr_update(struct AdsrState *adsr) {
|
||||
#else
|
||||
s32 adsr_update(struct AdsrState *adsr) {
|
||||
s32 adsr_update(struct Note *note) {
|
||||
struct AdsrState *adsr = ¬e->adsr;
|
||||
u8 isInit = FALSE;
|
||||
#endif
|
||||
u8 action = adsr->action;
|
||||
u8 state = adsr->state;
|
||||
@@ -362,6 +364,10 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
return 0;
|
||||
|
||||
case ADSR_STATE_INITIAL:
|
||||
isInit = TRUE;
|
||||
// fallthrough
|
||||
|
||||
case ADSR_STATE_RESTART:
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
adsr->current = adsr->initial;
|
||||
adsr->target = adsr->initial;
|
||||
@@ -401,7 +407,7 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
break;
|
||||
#endif
|
||||
case ADSR_RESTART:
|
||||
adsr->state = ADSR_STATE_INITIAL;
|
||||
adsr->state = ADSR_STATE_RESTART;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -422,6 +428,11 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
adsr->target = adsr->target * adsr->target;
|
||||
adsr->velocity = (adsr->target - adsr->current) / adsr->delay;
|
||||
#else // !(VERSION_EU || VERSION_SH)
|
||||
if (adsr->delay <= 0) {
|
||||
adsr->delay = 1;
|
||||
note->initFullVelocity = isInit;
|
||||
}
|
||||
|
||||
adsr->target = BSWAP16(adsr->envelope[adsr->envIndex].arg);
|
||||
adsr->velocity = ((adsr->target - adsr->current) << 0x10) / adsr->delay;
|
||||
#endif // !(VERSION_EU || VERSION_SH)
|
||||
|
||||
@@ -15,7 +15,8 @@ enum ADSRStates {
|
||||
ADSR_STATE_HANG,
|
||||
ADSR_STATE_DECAY,
|
||||
ADSR_STATE_RELEASE,
|
||||
ADSR_STATE_SUSTAIN
|
||||
ADSR_STATE_SUSTAIN,
|
||||
ADSR_STATE_RESTART
|
||||
};
|
||||
|
||||
enum ADSRActions {
|
||||
@@ -25,10 +26,10 @@ enum ADSRActions {
|
||||
};
|
||||
|
||||
enum ADSRDelays {
|
||||
ADSR_DISABLE = 0,
|
||||
ADSR_HANG = -1,
|
||||
ADSR_GOTO = -2,
|
||||
ADSR_RESTART = -3,
|
||||
ADSR_DISABLE = -4,
|
||||
};
|
||||
|
||||
enum VibratoModes {
|
||||
@@ -52,7 +53,7 @@ void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, s16 *volOu
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
f32 adsr_update(struct AdsrState *adsr);
|
||||
#else
|
||||
s32 adsr_update(struct AdsrState *adsr);
|
||||
s32 adsr_update(struct Note *note);
|
||||
#endif
|
||||
|
||||
#endif // AUDIO_EFFECTS_H
|
||||
|
||||
@@ -232,7 +232,7 @@ struct MusicDynamic sMusicDynamics[8] = {
|
||||
#define STUB_LEVEL(_0, _1, _2, _3, echo1, echo2, echo3, _7, _8) { echo1, echo2, echo3 },
|
||||
#define DEFINE_LEVEL(_0, _1, _2, _3, _4, _5, echo1, echo2, echo3, _9, _10) { echo1, echo2, echo3 },
|
||||
|
||||
u8 sLevelAreaReverbs[LEVEL_COUNT][3] = {
|
||||
s8 sLevelAreaReverbs[LEVEL_COUNT][3] = {
|
||||
{ 0x00, 0x00, 0x00 }, // LEVEL_NONE
|
||||
#include "levels/level_defines.h"
|
||||
};
|
||||
@@ -1138,7 +1138,8 @@ static f32 get_sound_freq_scale(u8 bank, u8 item) {
|
||||
static u32 get_sound_reverb(UNUSED u8 bank, UNUSED u8 soundIndex, u8 channelIndex) {
|
||||
u8 area;
|
||||
u8 level;
|
||||
u8 reverb;
|
||||
s8 areaEcho;
|
||||
s16 reverb;
|
||||
|
||||
// Disable level reverb if NO_ECHO is set
|
||||
if (sSoundBanks[bank][soundIndex].soundBits & SOUND_NO_ECHO) {
|
||||
@@ -1152,18 +1153,27 @@ static u32 get_sound_reverb(UNUSED u8 bank, UNUSED u8 soundIndex, u8 channelInde
|
||||
}
|
||||
}
|
||||
|
||||
// reverb = reverb adjustment + level reverb + a volume-dependent value
|
||||
areaEcho = sLevelAreaReverbs[level][area];
|
||||
|
||||
if (gAreaData[gCurrAreaIndex].useEchoOverride && !(sSoundBanks[bank][soundIndex].soundBits & SOUND_NO_ECHO)) {
|
||||
areaEcho = gAreaData[gCurrAreaIndex].echoOverride;
|
||||
}
|
||||
|
||||
// reverb = reverb adjustment + level reverb (or level script override value) + a volume-dependent value
|
||||
// The volume-dependent value is 0 when volume is at maximum, and raises to
|
||||
// LOW_VOLUME_REVERB when the volume is 0
|
||||
reverb = (u8)(u8) gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[5]
|
||||
+ sLevelAreaReverbs[level][area]
|
||||
+ ((1.0f - gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume)
|
||||
* LOW_VOLUME_REVERB);
|
||||
reverb = (s16) ((u8) gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[5]) + areaEcho;
|
||||
|
||||
if (reverb > 0x7f) {
|
||||
// NOTE: In some cases, it may be better to apply this after ensuring reverb is non-negative so the result doesn't end up sounding way too dry.
|
||||
// This has been left as-is however because in most cases where negative reverb is even used, this is probably desirable anyway.
|
||||
reverb += (s16) ((1.0f - gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume) * LOW_VOLUME_REVERB);
|
||||
|
||||
if (reverb < 0 || areaEcho <= -0x80) {
|
||||
reverb = 0;
|
||||
} else if (reverb > 0x7f) {
|
||||
reverb = 0x7f;
|
||||
}
|
||||
return reverb;
|
||||
return (u8) reverb;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1985,7 +1995,6 @@ void sound_init(void) {
|
||||
sLowerBackgroundMusicVolume = FALSE;
|
||||
sSoundBanksThatLowerBackgroundMusic = 0;
|
||||
sCurrentBackgroundMusicSeqId = 0xff;
|
||||
gSoundMode = SOUND_MODE_STEREO;
|
||||
sBackgroundMusicQueueSize = 0;
|
||||
sBackgroundMusicMaxTargetVolume = TARGET_VOLUME_UNSET;
|
||||
D_80332120 = 0;
|
||||
@@ -2187,9 +2196,7 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) {
|
||||
|
||||
// Abort if the queue is already full.
|
||||
if (sBackgroundMusicQueueSize >= MAX_BACKGROUND_MUSIC_QUEUE_SIZE) {
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
append_puppyprint_log("Sequence queue full, aborting.");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "level_table.h"
|
||||
|
||||
// Sequence arguments, passed to seq_player_play_sequence. seqId may be bit-OR'ed with
|
||||
// SEQ_VARIATION; this will load the same sequence, but set a variation
|
||||
@@ -34,6 +35,8 @@ extern f32 gGlobalSoundSource[3];
|
||||
// defined in data.c, used by the game
|
||||
extern u32 gAudioRandom;
|
||||
|
||||
extern s8 sLevelAreaReverbs[LEVEL_COUNT][3];
|
||||
|
||||
struct SPTask *create_next_audio_frame_task(void);
|
||||
void play_sound(s32 soundBits, f32 *pos);
|
||||
void audio_signal_game_loop_tick(void);
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
#include "synthesis.h"
|
||||
#include "seqplayer.h"
|
||||
#include "effects.h"
|
||||
#include "game/game_init.h"
|
||||
#include "game/emutest.h"
|
||||
#include "game/puppyprint.h"
|
||||
#include "game/vc_check.h"
|
||||
#include "game/debug.h"
|
||||
#include "string.h"
|
||||
|
||||
@@ -1048,8 +1047,20 @@ void init_reverb_us(s32 presetId) {
|
||||
s32 reverbWindowSize = gReverbSettings[presetId].windowSize;
|
||||
gReverbDownsampleRate = gReverbSettings[presetId].downsampleRate;
|
||||
#ifdef BETTER_REVERB
|
||||
// This will likely crash if given an invalid preset value. Adding a safety check here isn't worth the usability interference.
|
||||
struct BetterReverbSettings *betterReverbPreset = &gBetterReverbSettings[gBetterReverbPreset];
|
||||
struct BetterReverbSettings *betterReverbPreset = &gBetterReverbSettings[gBetterReverbPresetValue];
|
||||
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
if ((s8) gBetterReverbPresetValue < 0 && (s8) gBetterReverbPresetValue >= -ARRAY_COUNT(gDebugBetterReverbSettings)) {
|
||||
betterReverbPreset = &gDebugBetterReverbSettings[ARRAY_COUNT(gDebugBetterReverbSettings) + (s8) gBetterReverbPresetValue];
|
||||
} else if (gBetterReverbPresetValue >= gBetterReverbPresetCount) {
|
||||
#else
|
||||
if (gBetterReverbPresetValue >= gBetterReverbPresetCount) {
|
||||
#endif
|
||||
aggress(gBetterReverbPresetCount > 0, "No BETTER_REVERB presets exist!");
|
||||
|
||||
assert(gBetterReverbPresetValue < gBetterReverbPresetCount, "BETTER_REVERB preset value exceeds total number of available presets!");
|
||||
betterReverbPreset = &gBetterReverbSettings[0];
|
||||
}
|
||||
|
||||
betterReverbLightweight = betterReverbPreset->useLightweightSettings;
|
||||
betterReverbDownsampleRate = betterReverbPreset->downsampleRate;
|
||||
@@ -1058,8 +1069,8 @@ void init_reverb_us(s32 presetId) {
|
||||
betterReverbWindowsSize = betterReverbPreset->windowSize;
|
||||
betterReverbRevIndex = betterReverbPreset->reverbIndex;
|
||||
betterReverbGainIndex = betterReverbPreset->gainIndex;
|
||||
gReverbMultsL = betterReverbPreset->reverbMultsL;
|
||||
gReverbMultsR = betterReverbPreset->reverbMultsR;
|
||||
gReverbMults[SYNTH_CHANNEL_LEFT] = betterReverbPreset->reverbMultsL;
|
||||
gReverbMults[SYNTH_CHANNEL_RIGHT] = betterReverbPreset->reverbMultsR;
|
||||
|
||||
if (betterReverbDownsampleRate <= 0) {
|
||||
toggleBetterReverb = FALSE;
|
||||
@@ -1071,9 +1082,10 @@ void init_reverb_us(s32 presetId) {
|
||||
|
||||
if (betterReverbWindowsSize >= 0) {
|
||||
reverbWindowSize = betterReverbWindowsSize;
|
||||
if (reverbWindowSize < (DEFAULT_LEN_2CH * 2) && betterReverbWindowsSize != 0) // Minimum window size to not overflow
|
||||
reverbWindowSize = (DEFAULT_LEN_2CH * 2);
|
||||
reverbWindowSize /= gReverbDownsampleRate;
|
||||
if (reverbWindowSize < DEFAULT_LEN_2CH && betterReverbWindowsSize != 0) // Minimum window size to not overflow
|
||||
reverbWindowSize = DEFAULT_LEN_2CH;
|
||||
reverbWindowSize = ALIGN16(reverbWindowSize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1138,7 +1150,7 @@ void init_reverb_us(s32 presetId) {
|
||||
if (!gSynthesisReverb.useReverb)
|
||||
toggleBetterReverb = FALSE;
|
||||
|
||||
if (betterReverbPreset->gain > 0)
|
||||
if (betterReverbPreset->gain >= 0)
|
||||
gSynthesisReverb.reverbGain = (u16) betterReverbPreset->gain;
|
||||
|
||||
if (!sAudioIsInitialized)
|
||||
@@ -1158,7 +1170,7 @@ void audio_reset_session(s32 reverbPresetId) {
|
||||
if (gAudioLoadLock != AUDIO_LOCK_UNINITIALIZED) {
|
||||
gAudioLoadLock = AUDIO_LOCK_LOADING;
|
||||
|
||||
if (!gIsVC) {
|
||||
if (!(gEmulator & EMU_WIIVC)) {
|
||||
gAudioFrameCount = 0;
|
||||
while (gAudioFrameCount < 1) {
|
||||
// spin
|
||||
@@ -1312,7 +1324,7 @@ void audio_reset_session(void) {
|
||||
gAudioBufferParameters.minAiBufferLength *= gAudioBufferParameters.presetUnk4;
|
||||
gAudioBufferParameters.updatesPerFrame *= gAudioBufferParameters.presetUnk4;
|
||||
|
||||
if (gIsConsole)
|
||||
if (gEmulator & EMU_CONSOLE)
|
||||
gMaxSimultaneousNotes = MAX_SIMULTANEOUS_NOTES_CONSOLE;
|
||||
else
|
||||
gMaxSimultaneousNotes = MAX_SIMULTANEOUS_NOTES_EMULATOR;
|
||||
@@ -1339,7 +1351,7 @@ void audio_reset_session(void) {
|
||||
gMinAiBufferLength = gSamplesPerFrameTarget - 0x10;
|
||||
gAudioUpdatesPerFrame = updatesPerFrame = gSamplesPerFrameTarget / 160 + 1;
|
||||
|
||||
if (gIsConsole)
|
||||
if (gEmulator & EMU_CONSOLE)
|
||||
gMaxSimultaneousNotes = MAX_SIMULTANEOUS_NOTES_CONSOLE;
|
||||
else
|
||||
gMaxSimultaneousNotes = MAX_SIMULTANEOUS_NOTES_EMULATOR;
|
||||
@@ -1437,13 +1449,7 @@ void audio_reset_session(void) {
|
||||
gAudioLoadLock = AUDIO_LOCK_NOT_LOADING;
|
||||
}
|
||||
#endif
|
||||
#ifdef PUPPYPRINT_DEBUG
|
||||
#ifdef PUPPYPRINT_DEBUG_CYCLES
|
||||
append_puppyprint_log("Audio Initialised in %dc.", (s32)(osGetTime() - first));
|
||||
#else
|
||||
append_puppyprint_log("Audio Initialised in %dus.", (s32)OS_CYCLES_TO_USEC(osGetTime() - first));
|
||||
#endif
|
||||
#endif
|
||||
append_puppyprint_log("Audio Initialised in %d" PP_CYCLE_STRING ".", (s32)PP_CYCLE_CONV(osGetTime() - first));
|
||||
|
||||
sAudioIsInitialized = TRUE;
|
||||
}
|
||||
|
||||
@@ -140,9 +140,11 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 id);
|
||||
#endif
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
void init_reverb_eu(void);
|
||||
s32 audio_shut_down_and_reset_step(void);
|
||||
void audio_reset_session(void);
|
||||
#else
|
||||
void init_reverb_us(s32 presetId);
|
||||
void audio_reset_session(s32 reverbPresetId);
|
||||
#endif
|
||||
void discard_bank(s32 bankId);
|
||||
|
||||
@@ -420,7 +420,11 @@ struct SequenceChannel {
|
||||
/*0x00, 0x00*/ u8 stopScript : 1;
|
||||
/*0x00, 0x00*/ u8 stopSomething2 : 1; // sets SequenceChannelLayer.stopSomething
|
||||
/*0x00, 0x00*/ u8 hasInstrument : 1;
|
||||
#ifdef ENABLE_STEREO_HEADSET_EFFECTS
|
||||
/*0x00, 0x00*/ u8 stereoHeadsetEffects : 1;
|
||||
#else
|
||||
/*0x00, 0x00*/ u8 paddingBit : 1;
|
||||
#endif
|
||||
/*0x00, ????*/ u8 largeNotes : 1; // notes specify duration and velocity
|
||||
/*0x00, ????*/ u8 unused : 1; // never read, set to 0
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
@@ -662,54 +666,57 @@ struct vNote {
|
||||
}; // size = 0xC0
|
||||
struct Note {
|
||||
/* U/J, EU */
|
||||
/*0x00*/ u8 enabled : 1;
|
||||
/*0x00*/ u8 needsInit : 1;
|
||||
/*0x00*/ u8 restart : 1;
|
||||
/*0x00*/ u8 finished : 1;
|
||||
/*0x00*/ u8 envMixerNeedsInit : 1;
|
||||
/*0x00*/ u8 stereoStrongRight : 1;
|
||||
/*0x00*/ u8 stereoStrongLeft : 1;
|
||||
/*0x00*/ u8 stereoHeadsetEffects : 1;
|
||||
/*0x01*/ u8 usesHeadsetPanEffects;
|
||||
/*0x02*/ u8 unk2;
|
||||
/*0x03*/ u8 sampleDmaIndex;
|
||||
/*0x04, 0x30*/ u8 priority;
|
||||
/*0x05*/ u8 sampleCount; // 0, 8, 16, 32 or 64
|
||||
/*0x06*/ u8 instOrWave;
|
||||
/*0x07*/ u8 bankId; // in NoteSubEu on EU
|
||||
/*0x00*/ u8 enabled : 1;
|
||||
/*0x00*/ u8 needsInit : 1;
|
||||
/*0x00*/ u8 restart : 1;
|
||||
/*0x00*/ u8 finished : 1;
|
||||
/*0x00*/ u8 envMixerNeedsInit : 1;
|
||||
/*0x00*/ u8 initFullVelocity : 1;
|
||||
#ifdef ENABLE_STEREO_HEADSET_EFFECTS
|
||||
/*0x00*/ u8 stereoHeadsetEffects : 1;
|
||||
/*0x00*/ u8 usesHeadsetPanEffects : 1;
|
||||
/*0x01*/ u8 stereoStrongRight : 1;
|
||||
/*0x01*/ u8 stereoStrongLeft : 1;
|
||||
#else
|
||||
/* */ u8 pad0[0x01];
|
||||
#endif
|
||||
/*0x02*/ u8 sampleDmaIndex;
|
||||
/*0x03*/ u8 priority;
|
||||
/*0x04*/ u8 sampleCount; // 0, 8, 16, 32 or 64
|
||||
/*0x05*/ u8 instOrWave;
|
||||
/*0x06*/ u8 bankId; // in NoteSubEu on EU
|
||||
/*0x07*/ u8 reverbVol; // Q1.7
|
||||
/*0x08*/ s16 adsrVolScale;
|
||||
/* */ u8 pad1[2];
|
||||
/*0x0C, 0xB3*/ u16 headsetPanRight;
|
||||
/*0x0E, 0xB4*/ u16 headsetPanLeft;
|
||||
/*0x10*/ u16 prevHeadsetPanRight;
|
||||
/*0x12*/ u16 prevHeadsetPanLeft;
|
||||
/*0x14*/ s32 samplePosInt;
|
||||
/*0x18, 0x38*/ f32 portamentoFreqScale;
|
||||
/*0x1C, 0x3C*/ f32 vibratoFreqScale;
|
||||
/*0x20*/ u16 samplePosFrac;
|
||||
/* */ u8 pad2[2];
|
||||
/*0x24*/ struct AudioBankSound *sound;
|
||||
/*0x28, 0x40*/ struct SequenceChannelLayer *prevParentLayer;
|
||||
/*0x2C, 0x44*/ struct SequenceChannelLayer *parentLayer;
|
||||
/*0x30, 0x48*/ struct SequenceChannelLayer *wantedParentLayer;
|
||||
/*0x34*/ struct NoteSynthesisBuffers *synthesisBuffers;
|
||||
/*0x38*/ f32 frequency;
|
||||
/*0x3C*/ u16 targetVolLeft; // Q1.15, but will always be non-negative
|
||||
/*0x3E*/ u16 targetVolRight; // Q1.15, but will always be non-negative
|
||||
/*0x40*/ u8 reverbVol; // Q1.7
|
||||
/*0x41*/ u8 unused1; // never read, set to 0x3f
|
||||
/* */ u8 pad3[2];
|
||||
/*0x44*/ struct NoteAttributes attributes;
|
||||
/*0x54, 0x58*/ struct AdsrState adsr;
|
||||
/*0x74, 0x7C*/ struct Portamento portamento;
|
||||
/*0x84, 0x8C*/ struct VibratoState vibratoState;
|
||||
/*0x0A*/ u16 samplePosFrac;
|
||||
/*0x0C*/ s32 samplePosInt;
|
||||
/*0x10*/ f32 portamentoFreqScale;
|
||||
/*0x14*/ f32 vibratoFreqScale;
|
||||
/*0x18*/ struct AudioBankSound *sound;
|
||||
/*0x1C*/ struct SequenceChannelLayer *prevParentLayer;
|
||||
/*0x20*/ struct SequenceChannelLayer *parentLayer;
|
||||
/*0x24*/ struct SequenceChannelLayer *wantedParentLayer;
|
||||
/*0x28*/ struct NoteSynthesisBuffers *synthesisBuffers;
|
||||
/*0x2C*/ f32 frequency;
|
||||
/*0x30*/ u16 targetVolLeft; // Q1.15, but will always be non-negative
|
||||
/*0x32*/ u16 targetVolRight; // Q1.15, but will always be non-negative
|
||||
/*0x34*/ struct NoteAttributes attributes;
|
||||
/*0x44*/ struct AdsrState adsr;
|
||||
/*0x64*/ struct Portamento portamento;
|
||||
/*0x74*/ struct VibratoState vibratoState;
|
||||
/*0x8C*/ struct AudioListItem listItem;
|
||||
/*0x9C*/ s16 curVolLeft; // Q1.15, but will always be non-negative
|
||||
/*0x9E*/ s16 curVolRight; // Q1.15, but will always be non-negative
|
||||
/*0xA0*/ s16 reverbVolShifted; // Q1.15
|
||||
/*0xA2*/ s16 unused2; // never read, set to 0
|
||||
/*0xA4, 0x00*/ struct AudioListItem listItem;
|
||||
/* */ u8 pad4[0xc];
|
||||
}; // size = 0xC0
|
||||
#ifdef ENABLE_STEREO_HEADSET_EFFECTS
|
||||
/*0xA2*/ u16 headsetPanRight;
|
||||
/*0xA4*/ u16 headsetPanLeft;
|
||||
/*0xA6*/ u16 prevHeadsetPanRight;
|
||||
/*0xA8*/ u16 prevHeadsetPanLeft;
|
||||
/* */ u8 align16Padding[0x06];
|
||||
#else
|
||||
/* */ u8 align16Padding[0x0E];
|
||||
#endif
|
||||
}; // size = 0xB0
|
||||
#endif
|
||||
|
||||
struct NoteSynthesisBuffers {
|
||||
@@ -742,8 +749,8 @@ struct BetterReverbSettings {
|
||||
u8 reverbIndex;
|
||||
u32 *delaysL;
|
||||
u32 *delaysR;
|
||||
s32 *reverbMultsL;
|
||||
s32 *reverbMultsR;
|
||||
u8 *reverbMultsL;
|
||||
u8 *reverbMultsR;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ s16 gTempoInternalToExternal;
|
||||
s8 gAudioUpdatesPerFrame;
|
||||
#endif
|
||||
|
||||
s8 gSoundMode;
|
||||
s8 gSoundMode = SOUND_MODE_STEREO;
|
||||
|
||||
#if defined(VERSION_EU)
|
||||
s8 gAudioUpdatesPerFrame;
|
||||
@@ -855,7 +855,6 @@ void audio_init() {
|
||||
gAudioFrameCount = 0;
|
||||
gAudioTaskIndex = 0;
|
||||
gCurrAiBufferIndex = 0;
|
||||
gSoundMode = 0;
|
||||
gAudioTask = NULL;
|
||||
gAudioTasks[0].task.t.data_size = 0;
|
||||
gAudioTasks[1].task.t.data_size = 0;
|
||||
|
||||
@@ -578,7 +578,7 @@ void process_notes(void) {
|
||||
}
|
||||
}
|
||||
|
||||
adsr_update(¬e->adsr);
|
||||
adsr_update(note);
|
||||
note_vibrato_update(note);
|
||||
attributes = ¬e->attributes;
|
||||
if (note->priority == NOTE_PRIORITY_STOPPING) {
|
||||
@@ -1156,7 +1156,9 @@ s32 note_init_for_layer(struct Note *note, struct SequenceChannelLayer *seqLayer
|
||||
}
|
||||
|
||||
note->bankId = seqLayer->seqChannel->bankId;
|
||||
#ifdef ENABLE_STEREO_HEADSET_EFFECTS
|
||||
note->stereoHeadsetEffects = seqLayer->seqChannel->stereoHeadsetEffects;
|
||||
#endif
|
||||
note->sound = seqLayer->sound;
|
||||
seqLayer->status = SOUND_LOAD_STATUS_DISCARDABLE; // "loaded"
|
||||
seqLayer->note = note;
|
||||
@@ -1410,9 +1412,12 @@ void note_init_all(void) {
|
||||
note->noteSubEu = gZeroNoteSub;
|
||||
#else
|
||||
note->enabled = FALSE;
|
||||
#ifdef ENABLE_STEREO_HEADSET_EFFECTS
|
||||
note->stereoStrongRight = FALSE;
|
||||
note->stereoStrongLeft = FALSE;
|
||||
note->stereoHeadsetEffects = FALSE;
|
||||
note->usesHeadsetPanEffects = FALSE;
|
||||
#endif
|
||||
#endif
|
||||
note->priority = NOTE_PRIORITY_DISABLED;
|
||||
#ifdef VERSION_SH
|
||||
@@ -1426,13 +1431,12 @@ void note_init_all(void) {
|
||||
note->vibratoState.active = FALSE;
|
||||
#else
|
||||
note->reverbVol = 0;
|
||||
note->usesHeadsetPanEffects = FALSE;
|
||||
note->initFullVelocity = FALSE;
|
||||
note->sampleCount = 0;
|
||||
note->instOrWave = 0;
|
||||
note->targetVolLeft = 0;
|
||||
note->targetVolRight = 0;
|
||||
note->frequency = 0.0f;
|
||||
note->unused1 = 0x3f;
|
||||
note->vibratoState.activeFlags = VIBMODE_NONE;
|
||||
#endif
|
||||
note->attributes.velocity = 0.0f;
|
||||
|
||||
@@ -27,7 +27,9 @@ void sequence_channel_init(struct SequenceChannel *seqChannel) {
|
||||
seqChannel->stopScript = FALSE;
|
||||
seqChannel->stopSomething2 = FALSE;
|
||||
seqChannel->hasInstrument = FALSE;
|
||||
#ifdef ENABLE_STEREO_HEADSET_EFFECTS
|
||||
seqChannel->stereoHeadsetEffects = FALSE;
|
||||
#endif
|
||||
seqChannel->transposition = 0;
|
||||
seqChannel->largeNotes = FALSE;
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
@@ -1867,7 +1869,12 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
#endif
|
||||
|
||||
case 0xd0: // chan_stereoheadseteffects
|
||||
#ifdef ENABLE_STEREO_HEADSET_EFFECTS
|
||||
seqChannel->stereoHeadsetEffects = m64_read_u8(state);
|
||||
#else
|
||||
// NOTE: Vanilla music does not use 0xd0, so this is safe to repurpose entirely when ENABLE_STEREO_HEADSET_EFFECTS is disabled.
|
||||
m64_read_u8(state);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0xd1: // chan_setnoteallocationpolicy
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,6 +17,12 @@
|
||||
#define MAX_UPDATES_PER_FRAME 4
|
||||
#endif
|
||||
|
||||
enum ChannelIndexes {
|
||||
SYNTH_CHANNEL_LEFT,
|
||||
SYNTH_CHANNEL_RIGHT,
|
||||
SYNTH_CHANNEL_STEREO_COUNT,
|
||||
};
|
||||
|
||||
#ifdef BETTER_REVERB
|
||||
|
||||
#define REVERB_WINDOW_SIZE_MAX 0x2000
|
||||
@@ -25,13 +31,13 @@
|
||||
/* ------------ BETTER REVERB GENERAL PARAMETERS ------------ */
|
||||
|
||||
#define NUM_ALLPASS 12 // Maximum number of delay filters to use with better reverb; do not change this value if you don't know what you're doing.
|
||||
#define BETTER_REVERB_PTR_SIZE ALIGN16(NUM_ALLPASS * sizeof(s32*) * 2) // Allocation space consumed by dynamically allocated pointers
|
||||
#define BETTER_REVERB_PTR_SIZE ALIGN16(NUM_ALLPASS * sizeof(s16*) * SYNTH_CHANNEL_STEREO_COUNT) // Allocation space consumed by dynamically allocated pointers
|
||||
|
||||
// Size determined by (all delaysL/R values * 8) / (2 ^ Minimum Downsample Factor).
|
||||
// Minimum size requirement determined by ((all delaysL and delaysR values) / (2 ^ (downsampleRate - 1)) * sizeof(s16) + BETTER_REVERB_PTR_SIZE).
|
||||
// The default value can be increased or decreased in conjunction with the values in delaysL/R.
|
||||
// This can be significantly decreased if a downsample rate of 1 is not being used or if filter count is less than NUM_ALLPASS,
|
||||
// as this default is configured to handle the emulator RCVI settings.
|
||||
#define BETTER_REVERB_SIZE ALIGN16(0x1E000 + BETTER_REVERB_PTR_SIZE)
|
||||
#define BETTER_REVERB_SIZE ALIGN16(0xEDE0 + BETTER_REVERB_PTR_SIZE)
|
||||
|
||||
|
||||
/* ------ BETTER REVERB LIGHTWEIGHT PARAMETER OVERRIDES ------ */
|
||||
@@ -48,7 +54,7 @@
|
||||
/* ------------ BETTER REVERB EXTERNED VARIABLES ------------ */
|
||||
|
||||
extern u8 toggleBetterReverb;
|
||||
extern u8 gBetterReverbPreset;
|
||||
extern u8 gBetterReverbPresetValue;
|
||||
extern u8 betterReverbLightweight;
|
||||
extern s8 betterReverbDownsampleRate;
|
||||
extern u8 monoReverb;
|
||||
@@ -56,8 +62,7 @@ extern s32 reverbFilterCount;
|
||||
extern s32 betterReverbWindowsSize;
|
||||
extern s32 betterReverbRevIndex;
|
||||
extern s32 betterReverbGainIndex;
|
||||
extern s32 *gReverbMultsL;
|
||||
extern s32 *gReverbMultsR;
|
||||
extern u8 *gReverbMults[SYNTH_CHANNEL_STEREO_COUNT];
|
||||
|
||||
|
||||
/* ------------ BETTER REVERB EXTERNED FUNCTIONS ------------ */
|
||||
|
||||
6287
src/audio/volramping.c.in
Normal file
6287
src/audio/volramping.c.in
Normal file
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,6 @@
|
||||
#include "game/main.h"
|
||||
#include "game/rumble_init.h"
|
||||
#include "game/version.h"
|
||||
#include "game/vc_check.h"
|
||||
#ifdef UNF
|
||||
#include "usb/usb.h"
|
||||
#include "usb/debug.h"
|
||||
@@ -23,8 +22,7 @@
|
||||
#include "game/puppyprint.h"
|
||||
#include "game/puppylights.h"
|
||||
#include "game/profiling.h"
|
||||
|
||||
#include "game/vc_check.h"
|
||||
#include "game/emutest.h"
|
||||
|
||||
// Message IDs
|
||||
enum MessageIDs {
|
||||
@@ -318,21 +316,6 @@ void alert_rcp_hung_up(void) {
|
||||
error("RCP is HUNG UP!! Oh! MY GOD!!");
|
||||
}
|
||||
|
||||
void check_cache_emulation() {
|
||||
// Disable interrupts to ensure that nothing evicts the variable from cache while we're using it.
|
||||
u32 saved = __osDisableInt();
|
||||
// Create a variable with an initial value of 1. This value will remain cached.
|
||||
volatile u8 sCachedValue = 1;
|
||||
// Overwrite the variable directly in RDRAM without going through cache.
|
||||
// This should preserve its value of 1 in dcache if dcache is emulated correctly.
|
||||
*(u8*)(K0_TO_K1(&sCachedValue)) = 0;
|
||||
// Read the variable back from dcache, if it's still 1 then cache is emulated correctly.
|
||||
// If it's zero, then dcache is not emulated correctly.
|
||||
gCacheEmulated = sCachedValue;
|
||||
// Restore interrupts
|
||||
__osRestoreInt(saved);
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the first and last values of the stack.
|
||||
* If they're different, that means an error has occured, so trigger a crash.
|
||||
@@ -366,7 +349,7 @@ void thread3_main(UNUSED void *arg) {
|
||||
setup_mesg_queues();
|
||||
alloc_pool();
|
||||
load_engine_code_segment();
|
||||
gIsVC = IS_VC();
|
||||
detect_emulator();
|
||||
#ifndef UNF
|
||||
crash_screen_init();
|
||||
#endif
|
||||
@@ -384,14 +367,8 @@ void thread3_main(UNUSED void *arg) {
|
||||
osSyncPrintf("Linker : %s\n", __linker__);
|
||||
#endif
|
||||
|
||||
if (IO_READ(DPC_CLOCK_REG) == 0) {
|
||||
gIsConsole = FALSE;
|
||||
if (!(gEmulator & EMU_CONSOLE)) {
|
||||
gBorderHeight = BORDER_HEIGHT_EMULATOR;
|
||||
if (!gIsVC) {
|
||||
check_cache_emulation();
|
||||
} else {
|
||||
gCacheEmulated = FALSE;
|
||||
}
|
||||
#ifdef RCVI_HACK
|
||||
VI.comRegs.vSync = 525*20;
|
||||
change_vi(&VI, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
@@ -400,7 +377,6 @@ void thread3_main(UNUSED void *arg) {
|
||||
osViSetSpecialFeatures(OS_VI_GAMMA_OFF);
|
||||
#endif
|
||||
} else {
|
||||
gIsConsole = TRUE;
|
||||
gBorderHeight = BORDER_HEIGHT_CONSOLE;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
|
||||
@@ -419,42 +419,6 @@ void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
void *load_segment_decompress_heap(u32 segment, u8 *srcStart, u8 *srcEnd) {
|
||||
UNUSED void *dest = NULL;
|
||||
|
||||
#ifdef GZIP
|
||||
u32 compSize = (srcEnd - 4 - srcStart);
|
||||
#else
|
||||
u32 compSize = ALIGN16(srcEnd - srcStart);
|
||||
#endif
|
||||
u8 *compressed = main_pool_alloc(compSize, MEMORY_POOL_RIGHT);
|
||||
#ifdef GZIP
|
||||
// Decompressed size from end of gzip
|
||||
u32 *size = (u32 *) (compressed + compSize);
|
||||
#endif
|
||||
if (compressed != NULL) {
|
||||
#ifdef UNCOMPRESSED
|
||||
dma_read(gDecompressionHeap, srcStart, srcEnd);
|
||||
#else
|
||||
dma_read(compressed, srcStart, srcEnd);
|
||||
#endif
|
||||
#ifdef GZIP
|
||||
expand_gzip(compressed, gDecompressionHeap, compSize, (u32)size);
|
||||
#elif RNC1
|
||||
Propack_UnpackM1(compressed, gDecompressionHeap);
|
||||
#elif RNC2
|
||||
Propack_UnpackM2(compressed, gDecompressionHeap);
|
||||
#elif YAY0
|
||||
slidstart(compressed, gDecompressionHeap);
|
||||
#elif MIO0
|
||||
decompress(compressed, gDecompressionHeap);
|
||||
#endif
|
||||
set_segment_base_addr(segment, gDecompressionHeap);
|
||||
main_pool_free(compressed);
|
||||
}
|
||||
return gDecompressionHeap;
|
||||
}
|
||||
|
||||
void load_engine_code_segment(void) {
|
||||
void *startAddr = (void *) _engineSegmentStart;
|
||||
u32 totalSize = _engineSegmentEnd - _engineSegmentStart;
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "config.h"
|
||||
#include "audio/synthesis.h"
|
||||
|
||||
ALIGNED8 u8 gDecompressionHeap[0xD000];
|
||||
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(AUDIO_HEAP_SIZE)];
|
||||
|
||||
ALIGNED8 u8 gIdleThreadStack[THREAD1_STACK];
|
||||
@@ -20,14 +19,8 @@ ALIGNED8 u8 gThread5Stack[THREAD5_STACK];
|
||||
ALIGNED8 u8 gThread6Stack[THREAD6_STACK];
|
||||
#endif
|
||||
// 0x400 bytes
|
||||
#if UNF
|
||||
ALIGNED16 u8 gGfxSPTaskStack[SP_DRAM_STACK_SIZE8];
|
||||
ALIGNED16 u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE];
|
||||
#else
|
||||
// 0xc00 bytes for f3dex, 0x900 otherwise
|
||||
ALIGNED8 u8 gGfxSPTaskStack[SP_DRAM_STACK_SIZE8];
|
||||
ALIGNED8 u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE];
|
||||
#endif // UNF
|
||||
__attribute__((aligned(32))) u8 gGfxSPTaskStack[SP_DRAM_STACK_SIZE8];
|
||||
__attribute__((aligned(32))) u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE];
|
||||
// 0x200 bytes
|
||||
ALIGNED8 struct SaveBuffer gSaveBuffer;
|
||||
// 0x190a0 bytes
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include "config.h"
|
||||
#include "audio/data.h"
|
||||
|
||||
extern u8 gDecompressionHeap[];
|
||||
|
||||
extern u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(AUDIO_HEAP_SIZE)];
|
||||
|
||||
extern u8 gIdleThreadStack[THREAD1_STACK];
|
||||
|
||||
@@ -359,7 +359,7 @@ static s32 bhv_cmd_set_int_unused(void) {
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
// Command 0x14: Sets the specified field to a random float in the given range.
|
||||
// Command 0x15: Sets the specified field to a random float in the given range.
|
||||
// Usage: SET_RANDOM_FLOAT(field, min, range)
|
||||
static s32 bhv_cmd_set_random_float(void) {
|
||||
u8 field = BHV_CMD_GET_2ND_U8(0);
|
||||
@@ -372,7 +372,7 @@ static s32 bhv_cmd_set_random_float(void) {
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
// Command 0x15: Sets the specified field to a random integer in the given range.
|
||||
// Command 0x16: Sets the specified field to a random integer in the given range.
|
||||
// Usage: SET_RANDOM_INT(field, min, range)
|
||||
static s32 bhv_cmd_set_random_int(void) {
|
||||
u8 field = BHV_CMD_GET_2ND_U8(0);
|
||||
@@ -385,7 +385,7 @@ static s32 bhv_cmd_set_random_int(void) {
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
// Command 0x13: Gets a random short, right shifts it the specified amount and adds min to it, then sets the specified field to that value.
|
||||
// Command 0x14: Gets a random short, right shifts it the specified amount and adds min to it, then sets the specified field to that value.
|
||||
// Usage: SET_INT_RAND_RSHIFT(field, min, rshift)
|
||||
static s32 bhv_cmd_set_int_rand_rshift(void) {
|
||||
u8 field = BHV_CMD_GET_2ND_U8(0);
|
||||
@@ -398,7 +398,7 @@ static s32 bhv_cmd_set_int_rand_rshift(void) {
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
// Command 0x16: Adds a random float in the given range to the specified field.
|
||||
// Command 0x17: Adds a random float in the given range to the specified field.
|
||||
// Usage: ADD_RANDOM_FLOAT(field, min, range)
|
||||
static s32 bhv_cmd_add_random_float(void) {
|
||||
u8 field = BHV_CMD_GET_2ND_U8(0);
|
||||
@@ -411,7 +411,7 @@ static s32 bhv_cmd_add_random_float(void) {
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
// Command 0x17: Gets a random short, right shifts it the specified amount and adds min to it, then adds the value to the specified field. Unused.
|
||||
// Command 0x18: Gets a random short, right shifts it the specified amount and adds min to it, then adds the value to the specified field. Unused.
|
||||
// Usage: ADD_INT_RAND_RSHIFT(field, min, rshift)
|
||||
static s32 bhv_cmd_add_int_rand_rshift(void) {
|
||||
u8 field = BHV_CMD_GET_2ND_U8(0);
|
||||
@@ -463,7 +463,20 @@ static s32 bhv_cmd_or_int(void) {
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
// Command 0x12: Performs a bit clear with the specified short. Unused.
|
||||
// Command 0x12: Performs a bitwise OR with the specified field and the given (32 bit) integer.
|
||||
// Usually used to set an object's flags which use values above 16 bits.
|
||||
// Usage: OR_LONG(field, value)
|
||||
static s32 bhv_cmd_or_long(void) {
|
||||
u8 field = BHV_CMD_GET_2ND_U8(0);
|
||||
u32 value = BHV_CMD_GET_U32(1);
|
||||
|
||||
cur_obj_or_int(field, value);
|
||||
|
||||
gCurBhvCommand += 2;
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
// Command 0x13: Performs a bit clear with the specified short. Unused.
|
||||
// Usage: BIT_CLEAR(field, value)
|
||||
static s32 bhv_cmd_bit_clear(void) {
|
||||
u8 field = BHV_CMD_GET_2ND_U8(0);
|
||||
@@ -510,7 +523,7 @@ static s32 bhv_cmd_drop_to_floor(void) {
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
// Command 0x18: No operation. Unused.
|
||||
// Command 0x19: No operation. Unused.
|
||||
// Usage: CMD_NOP_1(field)
|
||||
static s32 bhv_cmd_nop_1(void) {
|
||||
UNUSED u8 field = BHV_CMD_GET_2ND_U8(0);
|
||||
@@ -520,15 +533,6 @@ static s32 bhv_cmd_nop_1(void) {
|
||||
}
|
||||
|
||||
// Command 0x1A: No operation. Unused.
|
||||
// Usage: CMD_NOP_3(field)
|
||||
static s32 bhv_cmd_nop_3(void) {
|
||||
UNUSED u8 field = BHV_CMD_GET_2ND_U8(0);
|
||||
|
||||
gCurBhvCommand++;
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
// Command 0x19: No operation. Unused.
|
||||
// Usage: CMD_NOP_2(field)
|
||||
static s32 bhv_cmd_nop_2(void) {
|
||||
UNUSED u8 field = BHV_CMD_GET_2ND_U8(0);
|
||||
@@ -773,6 +777,7 @@ static BhvCommandProc BehaviorCmdTable[] = {
|
||||
/*BHV_CMD_ADD_INT */ bhv_cmd_add_int,
|
||||
/*BHV_CMD_SET_INT */ bhv_cmd_set_int,
|
||||
/*BHV_CMD_OR_INT */ bhv_cmd_or_int,
|
||||
/*BHV_CMD_OR_LONG */ bhv_cmd_or_long,
|
||||
/*BHV_CMD_BIT_CLEAR */ bhv_cmd_bit_clear,
|
||||
/*BHV_CMD_SET_INT_RAND_RSHIFT */ bhv_cmd_set_int_rand_rshift,
|
||||
/*BHV_CMD_SET_RANDOM_FLOAT */ bhv_cmd_set_random_float,
|
||||
@@ -781,7 +786,6 @@ static BhvCommandProc BehaviorCmdTable[] = {
|
||||
/*BHV_CMD_ADD_INT_RAND_RSHIFT */ bhv_cmd_add_int_rand_rshift,
|
||||
/*BHV_CMD_NOP_1 */ bhv_cmd_nop_1,
|
||||
/*BHV_CMD_NOP_2 */ bhv_cmd_nop_2,
|
||||
/*BHV_CMD_NOP_3 */ bhv_cmd_nop_3,
|
||||
/*BHV_CMD_SET_MODEL */ bhv_cmd_set_model,
|
||||
/*BHV_CMD_SPAWN_CHILD */ bhv_cmd_spawn_child,
|
||||
/*BHV_CMD_DEACTIVATE */ bhv_cmd_deactivate,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user