mirror of
https://github.com/izzy2lost/Ghostship.git
synced 2026-06-19 01:17:03 -07:00
Implemented clang-format among move to use the oot one
This commit is contained in:
+17
-12
@@ -1,18 +1,23 @@
|
||||
IndentWidth: 4
|
||||
Language: Cpp
|
||||
AlignAfterOpenBracket: Align
|
||||
SortIncludes: false
|
||||
ColumnLimit: 104
|
||||
PointerAlignment: Right
|
||||
AllowShortFunctionsOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
SpaceAfterCStyleCast: true
|
||||
UseTab: Never
|
||||
ColumnLimit: 120
|
||||
PointerAlignment: Left
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
SpaceAfterCStyleCast: false
|
||||
Cpp11BracedListStyle: false
|
||||
IndentCaseLabels: true
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignOperands: true
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
AllowShortBlocksOnASingleLine: true
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: false
|
||||
AlignEscapedNewlines: Left
|
||||
AlignTrailingComments: true
|
||||
UseTab: Never
|
||||
SortIncludes: false
|
||||
@@ -0,0 +1,49 @@
|
||||
Using Namespace System
|
||||
$url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6/LLVM-14.0.6-win64.exe"
|
||||
$llvmInstallerPath = ".\LLVM-14.0.6-win64.exe"
|
||||
$clangFormatFilePath = ".\clang-format.exe"
|
||||
$requiredVersion = "clang-format version 14.0.6"
|
||||
$currentVersion = ""
|
||||
|
||||
function Test-7ZipInstalled {
|
||||
$sevenZipPath = "C:\Program Files\7-Zip\7z.exe"
|
||||
return Test-Path $sevenZipPath -PathType Leaf
|
||||
}
|
||||
|
||||
if (Test-Path $clangFormatFilePath) {
|
||||
$currentVersion = & $clangFormatFilePath --version
|
||||
if (-not ($currentVersion -eq $requiredVersion)) {
|
||||
# Delete the existing file if the version is incorrect
|
||||
Remove-Item $clangFormatFilePath -Force
|
||||
}
|
||||
}
|
||||
|
||||
if (-not (Test-Path $clangFormatFilePath) -or ($currentVersion -ne $requiredVersion)) {
|
||||
if (-not (Test-7ZipInstalled)) {
|
||||
Write-Host "7-Zip is not installed. Please install 7-Zip and run the script again."
|
||||
exit
|
||||
}
|
||||
|
||||
$wc = New-Object net.webclient
|
||||
$wc.Downloadfile($url, $PSScriptRoot + $llvmInstallerPath)
|
||||
|
||||
$sevenZipPath = "C:\Program Files\7-Zip\7z.exe"
|
||||
$specificFileInArchive = "bin\clang-format.exe"
|
||||
& "$sevenZipPath" e $llvmInstallerPath $specificFileInArchive
|
||||
|
||||
Remove-Item $llvmInstallerPath -Force
|
||||
}
|
||||
|
||||
$basePath = (Resolve-Path .).Path
|
||||
$files = Get-ChildItem -Path $basePath -Recurse -File `
|
||||
| Where-Object { ($_.Extension -eq '.c' -or $_.Extension -eq '.cpp' -or `
|
||||
(($_.Extension -eq '.h' -or $_.Extension -eq '.hpp') -and `
|
||||
(-not ($_.FullName -like "*\src\*" -or $_.FullName -like "*\include\*")))) -and `
|
||||
(-not ($_.FullName -like "*\assets\*" -or $_.FullName -like "*\build\*")) }
|
||||
|
||||
for ($i = 0; $i -lt $files.Length; $i++) {
|
||||
$file = $files[$i]
|
||||
$relativePath = $file.FullName.Substring($basePath.Length + 1)
|
||||
Write-Host "Formatting [$($i+1)/$($files.Length)] $relativePath"
|
||||
.\clang-format.exe -i $file.FullName
|
||||
}
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
# this line does quite a bit, so let's break it down
|
||||
#
|
||||
# find soh
|
||||
# use "find" to look in the "soh" directory
|
||||
# this ensures we don't try to format stuff in the submodules
|
||||
#
|
||||
# -type f
|
||||
# only look for files
|
||||
#
|
||||
# -name "*.c" -o -name "*.cpp"
|
||||
# find all .c and .cpp files
|
||||
#
|
||||
# ( -name "*.h" -o -name "*.hpp" ) ! -path "soh/src/**.h" ! -path "soh/include/**.h"
|
||||
# find all .h and .hpp files that aren't in soh/src or soh/include
|
||||
# this is because zret decomp only runs clang-format on c files
|
||||
# https://github.com/zeldaret/mm/blob/b7e5468ca16315a7e322055eff3d97fe980bbc25/format.py#L182
|
||||
#
|
||||
# ! -path "soh/assets/*"
|
||||
# asset headers are autogenerated, don't fight them
|
||||
#
|
||||
# -print0
|
||||
# separate paths with NUL bytes, avoiding issues with spaces in paths
|
||||
#
|
||||
# | xargs -0 clang-format-14 -i -verbose
|
||||
# use xargs to take each path we've found
|
||||
# and pass it as an argument to clang-format
|
||||
# verbose to print files being formatted and X out of Y status
|
||||
|
||||
# Autodetect the command
|
||||
if command -v clang-format-14 &> /dev/null; then
|
||||
CLANG_FORMAT="clang-format-14"
|
||||
else
|
||||
CLANG_FORMAT="clang-format"
|
||||
fi
|
||||
|
||||
find src -type f \( -name "*.c" -o -name "*.cpp" -o \( \( -name "*.h" -o -name "*.hpp" \) ! -path "src/*" ! -path "include/*" \) \) ! -path "assets/*" -print0 | xargs -0 $CLANG_FORMAT -i --verbose
|
||||
@@ -4,31 +4,31 @@
|
||||
#ifdef VERSION_SH
|
||||
|
||||
struct ReverbSettingsEU sReverbSettings[] = {
|
||||
{0x01, 0x30, 0x2fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000},
|
||||
{0x01, 0x28, 0x47ff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000},
|
||||
{0x01, 0x40, 0x2fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000},
|
||||
{0x01, 0x38, 0x3fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000},
|
||||
{0x01, 0x30, 0x4fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000},
|
||||
{0x01, 0x28, 0x37ff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000},
|
||||
{ 0x01, 0x30, 0x2fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000 },
|
||||
{ 0x01, 0x28, 0x47ff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000 },
|
||||
{ 0x01, 0x40, 0x2fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000 },
|
||||
{ 0x01, 0x38, 0x3fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000 },
|
||||
{ 0x01, 0x30, 0x4fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000 },
|
||||
{ 0x01, 0x28, 0x37ff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000 },
|
||||
};
|
||||
|
||||
struct AudioSessionSettingsEU gAudioSessionPresets[] = {
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
|
||||
0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
|
||||
0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[2], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
|
||||
0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[3], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
|
||||
0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[4], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
|
||||
0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00004000, 0x00006e00,
|
||||
0x00000000, 0x00003f00, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00004100, 0x00006e00,
|
||||
0x00000000, 0x00004400, 0x00002a80, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x14, 0x01, 0x00, &sReverbSettings[5], 0x7fff, 0x0000, 0x00003500, 0x00006280,
|
||||
0x00000000, 0x00004000, 0x00001b00, 0x00000000, 0x00000000, 0x00000000 }
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, 0x00000000,
|
||||
0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, 0x00000000,
|
||||
0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[2], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, 0x00000000,
|
||||
0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[3], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, 0x00000000,
|
||||
0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[4], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, 0x00000000,
|
||||
0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00004000, 0x00006e00, 0x00000000,
|
||||
0x00003f00, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00004100, 0x00006e00, 0x00000000,
|
||||
0x00004400, 0x00002a80, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x14, 0x01, 0x00, &sReverbSettings[5], 0x7fff, 0x0000, 0x00003500, 0x00006280, 0x00000000,
|
||||
0x00004000, 0x00001b00, 0x00000000, 0x00000000, 0x00000000 }
|
||||
};
|
||||
|
||||
s8 gUnusedCount80333EE8 = UNUSED_COUNT_80333EE8;
|
||||
|
||||
@@ -19,23 +19,23 @@
|
||||
#define PORTAMENTO_MODE_4 4
|
||||
#define PORTAMENTO_MODE_5 5
|
||||
|
||||
void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
struct SequencePlayer *seqPlayer; // sp5C, t4
|
||||
struct SequenceChannel *seqChannel; // sp58, t5
|
||||
struct M64ScriptState *state;
|
||||
struct Portamento *portamento;
|
||||
struct AudioBankSound *sound;
|
||||
struct Instrument *instrument;
|
||||
struct Drum *drum;
|
||||
void seq_channel_layer_process_script(struct SequenceChannelLayer* layer) {
|
||||
struct SequencePlayer* seqPlayer; // sp5C, t4
|
||||
struct SequenceChannel* seqChannel; // sp58, t5
|
||||
struct M64ScriptState* state;
|
||||
struct Portamento* portamento;
|
||||
struct AudioBankSound* sound;
|
||||
struct Instrument* instrument;
|
||||
struct Drum* drum;
|
||||
s32 temp_a0_5;
|
||||
u8 sameSound;
|
||||
u8 cmd; // a0 sp3E, EU s2
|
||||
u8 cmdSemitone; // sp3D, t0
|
||||
u16 sp3A; // t2, a0, a1
|
||||
f32 tuning; // f0
|
||||
s32 vel; // sp30, t3
|
||||
s32 usedSemitone; // a1
|
||||
f32 freqScale; // sp28, f0
|
||||
u8 cmd; // a0 sp3E, EU s2
|
||||
u8 cmdSemitone; // sp3D, t0
|
||||
u16 sp3A; // t2, a0, a1
|
||||
f32 tuning; // f0
|
||||
s32 vel; // sp30, t3
|
||||
s32 usedSemitone; // a1
|
||||
f32 freqScale; // sp28, f0
|
||||
f32 sp24;
|
||||
f32 temp_f12;
|
||||
f32 temp_f2;
|
||||
@@ -50,7 +50,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
|
||||
sameSound = TRUE;
|
||||
|
||||
if(layer == NULL) {
|
||||
if (layer == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -80,10 +80,10 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
seqPlayer = (*seqChannel).seqPlayer;
|
||||
for (;;) {
|
||||
state = &layer->scriptState;
|
||||
// M64_READ_U8(state, cmd);
|
||||
// cmd = m64_read_u8(state);
|
||||
// M64_READ_U8(state, cmd);
|
||||
// cmd = m64_read_u8(state);
|
||||
{
|
||||
u8 *_ptr_pc;
|
||||
u8* _ptr_pc;
|
||||
_ptr_pc = (*state).pc++;
|
||||
cmd = *_ptr_pc;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
if (cmd == 0xc1) {
|
||||
layer->velocitySquare = (f32)(temp_a0_5 * temp_a0_5);
|
||||
} else {
|
||||
layer->pan = (f32) temp_a0_5 / US_FLOAT(128.0);
|
||||
layer->pan = (f32)temp_a0_5 / US_FLOAT(128.0);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -150,7 +150,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
case 0xc4: // layer_somethingon
|
||||
case 0xc5: // layer_somethingoff
|
||||
//! copt needs a ternary:
|
||||
//layer->continuousNotes = (cmd == 0xc4) ? TRUE : FALSE;
|
||||
// layer->continuousNotes = (cmd == 0xc4) ? TRUE : FALSE;
|
||||
{
|
||||
u8 setting;
|
||||
if (cmd == 0xc4) {
|
||||
@@ -244,7 +244,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
layer->noteDuration = *((*state).pc++);
|
||||
goto l1090;
|
||||
}
|
||||
l1090:
|
||||
l1090:
|
||||
cmdSemitone = cmd - (cmd & 0xc0);
|
||||
layer->velocitySquare = vel * vel;
|
||||
} else {
|
||||
@@ -262,17 +262,15 @@ l1090:
|
||||
sp3A = layer->playPercentage;
|
||||
goto l1138;
|
||||
}
|
||||
l1138:
|
||||
l1138:
|
||||
|
||||
cmdSemitone = cmd - (cmd & 0xc0);
|
||||
}
|
||||
|
||||
layer->delay = sp3A;
|
||||
layer->duration = layer->noteDuration * sp3A / 256;
|
||||
if ((seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_STOP_NOTES) != 0)
|
||||
|| seqChannel->stopSomething2
|
||||
|| !seqChannel->hasInstrument
|
||||
) {
|
||||
if ((seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_STOP_NOTES) != 0) ||
|
||||
seqChannel->stopSomething2 || !seqChannel->hasInstrument) {
|
||||
layer->stopSomething = TRUE;
|
||||
} else {
|
||||
if (seqChannel->instOrWave == 0) { // drum
|
||||
@@ -319,9 +317,9 @@ l1138:
|
||||
}
|
||||
|
||||
if (instrument != NULL) {
|
||||
sound = (u8) usedSemitone < instrument->normalRangeLo ? &instrument->lowNotesSound
|
||||
: (u8) usedSemitone <= instrument->normalRangeHi ?
|
||||
&instrument->normalNotesSound : &instrument->highNotesSound;
|
||||
sound = (u8)usedSemitone < instrument->normalRangeLo ? &instrument->lowNotesSound
|
||||
: (u8)usedSemitone <= instrument->normalRangeHi ? &instrument->normalNotesSound
|
||||
: &instrument->highNotesSound;
|
||||
|
||||
sameSound = (sound == (*layer).sound);
|
||||
layer->sound = sound;
|
||||
@@ -349,12 +347,12 @@ l1138:
|
||||
sp24 = temp_f12;
|
||||
goto l13cc;
|
||||
}
|
||||
l13cc:
|
||||
l13cc:
|
||||
portamento->extent = sp24 / freqScale - US_FLOAT(1.0);
|
||||
if (PORTAMENTO_IS_SPECIAL((*layer).portamento)) {
|
||||
portamento->speed = US_FLOAT(32512.0) * FLOAT_CAST((*seqPlayer).tempo)
|
||||
/ ((f32)(*layer).delay * (f32) gTempoInternalToExternal
|
||||
* FLOAT_CAST((*layer).portamentoTime));
|
||||
portamento->speed = US_FLOAT(32512.0) * FLOAT_CAST((*seqPlayer).tempo) /
|
||||
((f32)(*layer).delay * (f32)gTempoInternalToExternal *
|
||||
FLOAT_CAST((*layer).portamentoTime));
|
||||
} else {
|
||||
portamento->speed = US_FLOAT(127.0) / FLOAT_CAST((*layer).portamentoTime);
|
||||
}
|
||||
@@ -364,9 +362,9 @@ l13cc:
|
||||
layer->portamentoTargetNote = cmdSemitone;
|
||||
}
|
||||
} else if (instrument != NULL) {
|
||||
sound = cmdSemitone < instrument->normalRangeLo ?
|
||||
&instrument->lowNotesSound : cmdSemitone <= instrument->normalRangeHi ?
|
||||
&instrument->normalNotesSound : &instrument->highNotesSound;
|
||||
sound = cmdSemitone < instrument->normalRangeLo ? &instrument->lowNotesSound
|
||||
: cmdSemitone <= instrument->normalRangeHi ? &instrument->normalNotesSound
|
||||
: &instrument->highNotesSound;
|
||||
|
||||
sameSound = (sound == (*layer).sound);
|
||||
layer->sound = sound;
|
||||
|
||||
+403
-573
File diff suppressed because it is too large
Load Diff
+44
-45
@@ -13,7 +13,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 recalculateVolume) {
|
||||
void sequence_channel_process_sound(struct SequenceChannel* seqChannel, s32 recalculateVolume) {
|
||||
f32 channelVolume;
|
||||
s32 i;
|
||||
|
||||
@@ -34,7 +34,7 @@ void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 reca
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
struct SequenceChannelLayer *layer = seqChannel->layers[i];
|
||||
struct SequenceChannelLayer* layer = seqChannel->layers[i];
|
||||
if (layer != NULL && layer->enabled && layer->note != NULL) {
|
||||
if (layer->notePropertiesNeedInit) {
|
||||
layer->noteFreqScale = layer->freqScale * seqChannel->freqScale;
|
||||
@@ -57,13 +57,14 @@ void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 reca
|
||||
seqChannel->changes.as_u8 = 0;
|
||||
}
|
||||
#else
|
||||
static void sequence_channel_process_sound(struct SequenceChannel *seqChannel) {
|
||||
static void sequence_channel_process_sound(struct SequenceChannel* seqChannel) {
|
||||
f32 channelVolume;
|
||||
f32 panLayerWeight;
|
||||
f32 panFromChannel;
|
||||
s32 i;
|
||||
|
||||
channelVolume = (seqChannel->volume * (seqChannel->volumeScale * seqChannel->seqPlayer->fadeVolume)) * seqChannel->seqPlayer->gameVolume;
|
||||
channelVolume = (seqChannel->volume * (seqChannel->volumeScale * seqChannel->seqPlayer->fadeVolume)) *
|
||||
seqChannel->seqPlayer->gameVolume;
|
||||
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0) {
|
||||
channelVolume *= seqChannel->seqPlayer->muteVolumeScale;
|
||||
}
|
||||
@@ -72,8 +73,9 @@ static void sequence_channel_process_sound(struct SequenceChannel *seqChannel) {
|
||||
panLayerWeight = US_FLOAT(1.0) - seqChannel->panChannelWeight;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
struct SequenceChannelLayer *layer = seqChannel->layers[i];
|
||||
if (layer != NULL && layer->enabled && layer->note != NULL || (layer != NULL && seqChannel->seqPlayer->recalculateVolume)) {
|
||||
struct SequenceChannelLayer* layer = seqChannel->layers[i];
|
||||
if (layer != NULL && layer->enabled && layer->note != NULL ||
|
||||
(layer != NULL && seqChannel->seqPlayer->recalculateVolume)) {
|
||||
layer->noteFreqScale = layer->freqScale * seqChannel->freqScale;
|
||||
layer->noteVelocity = layer->velocitySquare * channelVolume;
|
||||
layer->notePan = (layer->pan * panLayerWeight) + panFromChannel;
|
||||
@@ -82,7 +84,7 @@ static void sequence_channel_process_sound(struct SequenceChannel *seqChannel) {
|
||||
}
|
||||
#endif
|
||||
|
||||
void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
|
||||
void sequence_player_process_sound(struct SequencePlayer* seqPlayer) {
|
||||
s32 i;
|
||||
|
||||
if (seqPlayer->fadeRemainingFrames != 0) {
|
||||
@@ -130,8 +132,7 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
|
||||
|
||||
// Process channels
|
||||
for (i = 0; i < CHANNELS_MAX; i++) {
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(seqPlayer->channels[i]) == TRUE
|
||||
&& seqPlayer->channels[i]->enabled == TRUE) {
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(seqPlayer->channels[i]) == TRUE && seqPlayer->channels[i]->enabled == TRUE) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
sequence_channel_process_sound(seqPlayer->channels[i], seqPlayer->recalculateVolume);
|
||||
#else
|
||||
@@ -145,7 +146,7 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
|
||||
#endif
|
||||
}
|
||||
|
||||
f32 get_portamento_freq_scale(struct Portamento *p) {
|
||||
f32 get_portamento_freq_scale(struct Portamento* p) {
|
||||
u32 v0;
|
||||
f32 result;
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
@@ -155,7 +156,7 @@ f32 get_portamento_freq_scale(struct Portamento *p) {
|
||||
#endif
|
||||
|
||||
p->cur += p->speed;
|
||||
v0 = (u32) p->cur;
|
||||
v0 = (u32)p->cur;
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
if (v0 > 127)
|
||||
@@ -175,14 +176,14 @@ f32 get_portamento_freq_scale(struct Portamento *p) {
|
||||
}
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
s16 get_vibrato_pitch_change(struct VibratoState *vib) {
|
||||
s16 get_vibrato_pitch_change(struct VibratoState* vib) {
|
||||
s32 index;
|
||||
vib->time += (s32) vib->rate;
|
||||
vib->time += (s32)vib->rate;
|
||||
index = (vib->time >> 10) & 0x3F;
|
||||
return vib->curve[index] >> 8;
|
||||
}
|
||||
#else
|
||||
s8 get_vibrato_pitch_change(struct VibratoState *vib) {
|
||||
s8 get_vibrato_pitch_change(struct VibratoState* vib) {
|
||||
s32 index;
|
||||
vib->time += vib->rate;
|
||||
|
||||
@@ -208,7 +209,7 @@ s8 get_vibrato_pitch_change(struct VibratoState *vib) {
|
||||
}
|
||||
#endif
|
||||
|
||||
f32 get_vibrato_freq_scale(struct VibratoState *vib) {
|
||||
f32 get_vibrato_freq_scale(struct VibratoState* vib) {
|
||||
s32 pitchChange;
|
||||
f32 extent;
|
||||
f32 result;
|
||||
@@ -220,30 +221,29 @@ f32 get_vibrato_freq_scale(struct VibratoState *vib) {
|
||||
|
||||
if (vib->extentChangeTimer) {
|
||||
if (vib->extentChangeTimer == 1) {
|
||||
vib->extent = (s32) vib->seqChannel->vibratoExtentTarget;
|
||||
vib->extent = (s32)vib->seqChannel->vibratoExtentTarget;
|
||||
} else {
|
||||
vib->extent +=
|
||||
((s32) vib->seqChannel->vibratoExtentTarget - vib->extent) / (s32) vib->extentChangeTimer;
|
||||
vib->extent += ((s32)vib->seqChannel->vibratoExtentTarget - vib->extent) / (s32)vib->extentChangeTimer;
|
||||
}
|
||||
|
||||
vib->extentChangeTimer--;
|
||||
} else if (vib->seqChannel->vibratoExtentTarget != (s32) vib->extent) {
|
||||
} else if (vib->seqChannel->vibratoExtentTarget != (s32)vib->extent) {
|
||||
if ((vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay) == 0) {
|
||||
vib->extent = (s32) vib->seqChannel->vibratoExtentTarget;
|
||||
vib->extent = (s32)vib->seqChannel->vibratoExtentTarget;
|
||||
}
|
||||
}
|
||||
|
||||
if (vib->rateChangeTimer) {
|
||||
if (vib->rateChangeTimer == 1) {
|
||||
vib->rate = (s32) vib->seqChannel->vibratoRateTarget;
|
||||
vib->rate = (s32)vib->seqChannel->vibratoRateTarget;
|
||||
} else {
|
||||
vib->rate += ((s32) vib->seqChannel->vibratoRateTarget - vib->rate) / (s32) vib->rateChangeTimer;
|
||||
vib->rate += ((s32)vib->seqChannel->vibratoRateTarget - vib->rate) / (s32)vib->rateChangeTimer;
|
||||
}
|
||||
|
||||
vib->rateChangeTimer--;
|
||||
} else if (vib->seqChannel->vibratoRateTarget != (s32) vib->rate) {
|
||||
} else if (vib->seqChannel->vibratoRateTarget != (s32)vib->rate) {
|
||||
if ((vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay) == 0) {
|
||||
vib->rate = (s32) vib->seqChannel->vibratoRateTarget;
|
||||
vib->rate = (s32)vib->seqChannel->vibratoRateTarget;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ f32 get_vibrato_freq_scale(struct VibratoState *vib) {
|
||||
}
|
||||
|
||||
pitchChange = get_vibrato_pitch_change(vib);
|
||||
extent = (f32) vib->extent / US_FLOAT(4096.0);
|
||||
extent = (f32)vib->extent / US_FLOAT(4096.0);
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
result = US_FLOAT(1.0) + extent * (gPitchBendFrequencyScale[pitchChange + 128] - US_FLOAT(1.0));
|
||||
@@ -262,7 +262,7 @@ f32 get_vibrato_freq_scale(struct VibratoState *vib) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void note_vibrato_update(struct Note *note) {
|
||||
void note_vibrato_update(struct Note* note) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
if (note->portamento.mode != 0) {
|
||||
note->portamentoFreqScale = get_portamento_freq_scale(¬e->portamento);
|
||||
@@ -280,11 +280,11 @@ void note_vibrato_update(struct Note *note) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void note_vibrato_init(struct Note *note) {
|
||||
struct VibratoState *vib;
|
||||
UNUSED struct SequenceChannel *seqChannel;
|
||||
void note_vibrato_init(struct Note* note) {
|
||||
struct VibratoState* vib;
|
||||
UNUSED struct SequenceChannel* seqChannel;
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
struct NotePlaybackState *seqPlayerState = (struct NotePlaybackState *) ¬e->priority;
|
||||
struct NotePlaybackState* seqPlayerState = (struct NotePlaybackState*)¬e->priority;
|
||||
#endif
|
||||
|
||||
note->vibratoFreqScale = 1.0f;
|
||||
@@ -293,9 +293,8 @@ void note_vibrato_init(struct Note *note) {
|
||||
vib = ¬e->vibratoState;
|
||||
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
if (note->parentLayer->seqChannel->vibratoExtentStart == 0
|
||||
&& note->parentLayer->seqChannel->vibratoExtentTarget == 0
|
||||
&& note->parentLayer->portamento.mode == 0) {
|
||||
if (note->parentLayer->seqChannel->vibratoExtentStart == 0 &&
|
||||
note->parentLayer->seqChannel->vibratoExtentTarget == 0 && note->parentLayer->portamento.mode == 0) {
|
||||
vib->active = FALSE;
|
||||
return;
|
||||
}
|
||||
@@ -343,7 +342,7 @@ void note_vibrato_init(struct Note *note) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, UNUSED s16 *volOut) {
|
||||
void adsr_init(struct AdsrState* adsr, struct AdsrEnvelope* envelope, UNUSED s16* volOut) {
|
||||
adsr->action = 0;
|
||||
adsr->state = ADSR_STATE_DISABLED;
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
@@ -363,9 +362,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) {
|
||||
f32 adsr_update(struct AdsrState* adsr) {
|
||||
#else
|
||||
s32 adsr_update(struct AdsrState *adsr) {
|
||||
s32 adsr_update(struct AdsrState* adsr) {
|
||||
#endif
|
||||
u8 action = adsr->action;
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
@@ -398,7 +397,7 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
// fallthrough
|
||||
|
||||
#ifdef VERSION_SH
|
||||
restart:
|
||||
restart:
|
||||
#endif
|
||||
case ADSR_STATE_LOOP:
|
||||
adsr->delay = BSWAP16(adsr->envelope[adsr->envIndex].delay);
|
||||
@@ -425,17 +424,17 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
if (adsr->delay >= 4) {
|
||||
adsr->delay = adsr->delay * gAudioBufferParameters.updatesPerFrame
|
||||
#ifdef VERSION_SH
|
||||
/ gAudioBufferParameters.presetUnk4
|
||||
/ gAudioBufferParameters.presetUnk4
|
||||
#endif
|
||||
/ 4;
|
||||
/ 4;
|
||||
}
|
||||
#if defined(VERSION_SH)
|
||||
if (adsr->delay == 0) {
|
||||
adsr->delay = 1;
|
||||
}
|
||||
adsr->target = (f32) BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0f;
|
||||
adsr->target = (f32)BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0f;
|
||||
#elif defined(VERSION_EU)
|
||||
adsr->target = (f32) BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0;
|
||||
adsr->target = (f32)BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0;
|
||||
#endif
|
||||
adsr->target = adsr->target * adsr->target;
|
||||
adsr->velocity = (adsr->target - adsr->current) / adsr->delay;
|
||||
@@ -498,10 +497,10 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
adsr->state = ADSR_STATE_DISABLED;
|
||||
}
|
||||
#else
|
||||
if (adsr->current < 100) {
|
||||
adsr->current = 0;
|
||||
adsr->state = ADSR_STATE_DISABLED;
|
||||
}
|
||||
if (adsr->current < 100) {
|
||||
adsr->current = 0;
|
||||
adsr->state = ADSR_STATE_DISABLED;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
+185
-218
File diff suppressed because it is too large
Load Diff
+157
-151
File diff suppressed because it is too large
Load Diff
+47
-56
@@ -14,19 +14,19 @@
|
||||
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
||||
|
||||
struct SharedDma {
|
||||
/*0x0*/ u8 *buffer; // target, points to pre-allocated buffer
|
||||
/*0x0*/ u8* buffer; // target, points to pre-allocated buffer
|
||||
/*0x4*/ uintptr_t source; // device address
|
||||
/*0x8*/ u16 sizeUnused; // set to bufSize, never read
|
||||
/*0xA*/ u16 bufSize; // size of buffer
|
||||
/*0xC*/ u8 unused2; // set to 0, never read
|
||||
/*0xD*/ u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0
|
||||
/*0xE*/ u8 ttl; // duration after which the DMA can be discarded
|
||||
}; // size = 0x10
|
||||
}; // size = 0x10
|
||||
|
||||
// EU only
|
||||
void port_eu_init(void);
|
||||
|
||||
struct Note *gNotes;
|
||||
struct Note* gNotes;
|
||||
|
||||
struct SequencePlayer gSequencePlayers[SEQUENCE_PLAYERS];
|
||||
struct SequenceChannel gSequenceChannels[SEQUENCE_CHANNELS];
|
||||
@@ -46,8 +46,8 @@ OSIoMesg gAudioDmaIoMesg;
|
||||
|
||||
struct SharedDma sSampleDmas[0x60];
|
||||
u32 gSampleDmaNumListItems; // sh: 0x803503D4
|
||||
u32 sSampleDmaListSize1; // sh: 0x803503D8
|
||||
u32 sUnused80226B40; // set to 0, never read, sh: 0x803503DC
|
||||
u32 sSampleDmaListSize1; // sh: 0x803503D8
|
||||
u32 sUnused80226B40; // set to 0, never read, sh: 0x803503DC
|
||||
|
||||
// Circular buffer of DMAs with ttl = 0. tail <= head, wrapping around mod 256.
|
||||
u8 sSampleDmaReuseQueue1[256];
|
||||
@@ -90,17 +90,16 @@ s8 gAudioUpdatesPerFrame;
|
||||
extern u64 gAudioGlobalsStartMarker;
|
||||
extern u64 gAudioGlobalsEndMarker;
|
||||
|
||||
ALSeqFile *get_audio_file_header(s32 arg0);
|
||||
ALSeqFile* get_audio_file_header(s32 arg0);
|
||||
|
||||
#include <stdio.h>
|
||||
/**
|
||||
* Performs an immediate DMA copy
|
||||
*/
|
||||
void audio_dma_copy_immediate(uintptr_t devAddr, void *vAddr, size_t nbytes) {
|
||||
void audio_dma_copy_immediate(uintptr_t devAddr, void* vAddr, size_t nbytes) {
|
||||
eu_stubbed_printf_3("Romcopy %x -> %x ,size %x\n", devAddr, vAddr, nbytes);
|
||||
osInvalDCache(vAddr, nbytes);
|
||||
osPiStartDma(&gAudioDmaIoMesg, OS_MESG_PRI_HIGH, OS_READ, devAddr, vAddr, nbytes,
|
||||
&gAudioDmaMesgQueue);
|
||||
osPiStartDma(&gAudioDmaIoMesg, OS_MESG_PRI_HIGH, OS_READ, devAddr, vAddr, nbytes, &gAudioDmaMesgQueue);
|
||||
osRecvMesg(&gAudioDmaMesgQueue, NULL, OS_MESG_NOBLOCK);
|
||||
eu_stubbed_printf_0("Romcopyend\n");
|
||||
}
|
||||
@@ -127,7 +126,7 @@ u8 audioString49[] = "BANK LOAD MISS! FOR %d\n";
|
||||
/**
|
||||
* Performs an asynchronus (normal priority) DMA copy
|
||||
*/
|
||||
void audio_dma_copy_async(uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *queue, OSIoMesg *mesg) {
|
||||
void audio_dma_copy_async(uintptr_t devAddr, void* vAddr, size_t nbytes, OSMesgQueue* queue, OSIoMesg* mesg) {
|
||||
osInvalDCache(vAddr, nbytes);
|
||||
osPiStartDma(mesg, OS_MESG_PRI_NORMAL, OS_READ, devAddr, vAddr, nbytes, queue);
|
||||
}
|
||||
@@ -136,7 +135,8 @@ void audio_dma_copy_async(uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQ
|
||||
* Performs a partial asynchronous (normal priority) DMA copy. This is limited
|
||||
* to 0x1000 bytes transfer at once.
|
||||
*/
|
||||
void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remaining, OSMesgQueue *queue, OSIoMesg *mesg) {
|
||||
void audio_dma_partial_copy_async(uintptr_t* devAddr, u8** vAddr, ssize_t* remaining, OSMesgQueue* queue,
|
||||
OSIoMesg* mesg) {
|
||||
#if defined(VERSION_EU)
|
||||
ssize_t transfer = (*remaining >= 0x1000 ? 0x1000 : *remaining);
|
||||
#else
|
||||
@@ -154,30 +154,30 @@ void decrease_sample_dma_ttls() {
|
||||
|
||||
for (i = 0; i < sSampleDmaListSize1; i++) {
|
||||
#if defined(VERSION_EU)
|
||||
struct SharedDma *temp = &sSampleDmas[i];
|
||||
struct SharedDma* temp = &sSampleDmas[i];
|
||||
#else
|
||||
struct SharedDma *temp = sSampleDmas + i;
|
||||
struct SharedDma* temp = sSampleDmas + i;
|
||||
#endif
|
||||
if (temp->ttl != 0) {
|
||||
temp->ttl--;
|
||||
if (temp->ttl == 0) {
|
||||
temp->reuseIndex = sSampleDmaReuseQueueHead1;
|
||||
sSampleDmaReuseQueue1[sSampleDmaReuseQueueHead1++] = (u8) i;
|
||||
sSampleDmaReuseQueue1[sSampleDmaReuseQueueHead1++] = (u8)i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) {
|
||||
#if defined(VERSION_EU)
|
||||
struct SharedDma *temp = &sSampleDmas[i];
|
||||
struct SharedDma* temp = &sSampleDmas[i];
|
||||
#else
|
||||
struct SharedDma *temp = sSampleDmas + i;
|
||||
struct SharedDma* temp = sSampleDmas + i;
|
||||
#endif
|
||||
if (temp->ttl != 0) {
|
||||
temp->ttl--;
|
||||
if (temp->ttl == 0) {
|
||||
temp->reuseIndex = sSampleDmaReuseQueueHead2;
|
||||
sSampleDmaReuseQueue2[sSampleDmaReuseQueueHead2++] = (u8) i;
|
||||
sSampleDmaReuseQueue2[sSampleDmaReuseQueueHead2++] = (u8)i;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,9 +185,9 @@ void decrease_sample_dma_ttls() {
|
||||
sUnused80226B40 = 0;
|
||||
}
|
||||
|
||||
void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
void* dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8* dmaIndexRef) {
|
||||
s32 hasDma = FALSE;
|
||||
struct SharedDma *dma;
|
||||
struct SharedDma* dma;
|
||||
uintptr_t dmaDevAddr;
|
||||
u32 transfer;
|
||||
u32 i;
|
||||
@@ -199,21 +199,19 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) {
|
||||
dma = &sSampleDmas[i];
|
||||
bufferPos = devAddr - dma->source;
|
||||
if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) {
|
||||
if (0 <= bufferPos && (size_t)bufferPos <= dma->bufSize - size) {
|
||||
// We already have a DMA request for this memory range.
|
||||
if (dma->ttl == 0 && sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2) {
|
||||
// Move the DMA out of the reuse queue, by swapping it with the
|
||||
// tail, and then incrementing the tail.
|
||||
if (dma->reuseIndex != sSampleDmaReuseQueueTail2) {
|
||||
sSampleDmaReuseQueue2[dma->reuseIndex] =
|
||||
sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2];
|
||||
sSampleDmas[sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2]].reuseIndex =
|
||||
dma->reuseIndex;
|
||||
sSampleDmaReuseQueue2[dma->reuseIndex] = sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2];
|
||||
sSampleDmas[sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2]].reuseIndex = dma->reuseIndex;
|
||||
}
|
||||
sSampleDmaReuseQueueTail2++;
|
||||
}
|
||||
dma->ttl = 60;
|
||||
*dmaIndexRef = (u8) i;
|
||||
*dmaIndexRef = (u8)i;
|
||||
return &dma->buffer[(devAddr - dma->source)];
|
||||
}
|
||||
}
|
||||
@@ -234,20 +232,17 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
dma = sSampleDmas + *dmaIndexRef;
|
||||
#endif
|
||||
bufferPos = devAddr - dma->source;
|
||||
if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) {
|
||||
if (0 <= bufferPos && (size_t)bufferPos <= dma->bufSize - size) {
|
||||
// We already have DMA for this memory range.
|
||||
if (dma->ttl == 0) {
|
||||
// Move the DMA out of the reuse queue, by swapping it with the
|
||||
// tail, and then incrementing the tail.
|
||||
if (dma->reuseIndex != sSampleDmaReuseQueueTail1) {
|
||||
#if defined(VERSION_EU)
|
||||
if (1) {
|
||||
}
|
||||
if (1) {}
|
||||
#endif
|
||||
sSampleDmaReuseQueue1[dma->reuseIndex] =
|
||||
sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1];
|
||||
sSampleDmas[sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1]].reuseIndex =
|
||||
dma->reuseIndex;
|
||||
sSampleDmaReuseQueue1[dma->reuseIndex] = sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1];
|
||||
sSampleDmas[sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1]].reuseIndex = dma->reuseIndex;
|
||||
}
|
||||
sSampleDmaReuseQueueTail1++;
|
||||
}
|
||||
@@ -277,20 +272,19 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
osInvalDCache(dma->buffer, transfer);
|
||||
#endif
|
||||
#if defined(VERSION_EU)
|
||||
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount++], OS_MESG_PRI_NORMAL,
|
||||
OS_READ, dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
|
||||
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount++], OS_MESG_PRI_NORMAL, OS_READ, dmaDevAddr,
|
||||
dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
|
||||
*dmaIndexRef = dmaIndex;
|
||||
return (devAddr - dmaDevAddr) + dma->buffer;
|
||||
#else
|
||||
gCurrAudioFrameDmaCount++;
|
||||
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount - 1], OS_MESG_PRI_NORMAL,
|
||||
OS_READ, dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
|
||||
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount - 1], OS_MESG_PRI_NORMAL, OS_READ, dmaDevAddr,
|
||||
dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
|
||||
*dmaIndexRef = dmaIndex;
|
||||
return (devAddr - dmaDevAddr) + dma->buffer;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void init_sample_dma_buffers(UNUSED s32 arg0) {
|
||||
s32 i;
|
||||
#if defined(VERSION_EU)
|
||||
@@ -330,9 +324,9 @@ void init_sample_dma_buffers(UNUSED s32 arg0) {
|
||||
out1:
|
||||
#endif
|
||||
|
||||
for (i = 0; (u32) i < gSampleDmaNumListItems; i++) {
|
||||
sSampleDmaReuseQueue1[i] = (u8) i;
|
||||
sSampleDmas[i].reuseIndex = (u8) i;
|
||||
for (i = 0; (u32)i < gSampleDmaNumListItems; i++) {
|
||||
sSampleDmaReuseQueue1[i] = (u8)i;
|
||||
sSampleDmas[i].reuseIndex = (u8)i;
|
||||
}
|
||||
|
||||
for (j = gSampleDmaNumListItems; j < 0x100; j++) {
|
||||
@@ -340,7 +334,7 @@ out1:
|
||||
}
|
||||
|
||||
sSampleDmaReuseQueueTail1 = 0;
|
||||
sSampleDmaReuseQueueHead1 = (u8) gSampleDmaNumListItems;
|
||||
sSampleDmaReuseQueueHead1 = (u8)gSampleDmaNumListItems;
|
||||
sSampleDmaListSize1 = gSampleDmaNumListItems;
|
||||
|
||||
#if defined(VERSION_EU)
|
||||
@@ -368,8 +362,8 @@ out1:
|
||||
out2:
|
||||
#endif
|
||||
|
||||
for (i = sSampleDmaListSize1; (u32) i < gSampleDmaNumListItems; i++) {
|
||||
sSampleDmaReuseQueue2[i - sSampleDmaListSize1] = (u8) i;
|
||||
for (i = sSampleDmaListSize1; (u32)i < gSampleDmaNumListItems; i++) {
|
||||
sSampleDmaReuseQueue2[i - sSampleDmaListSize1] = (u8)i;
|
||||
sSampleDmas[i].reuseIndex = (u8)(i - sSampleDmaListSize1);
|
||||
}
|
||||
|
||||
@@ -390,11 +384,11 @@ uint8_t* load_sequence_immediate(s32 seqId, s32 arg1) {
|
||||
return GameEngine_LoadSequence(seqId)->data;
|
||||
}
|
||||
|
||||
struct CtlEntry* load_banks_immediate(s32 seqId, u8 *outDefaultBank) {
|
||||
struct CtlEntry* load_banks_immediate(s32 seqId, u8* outDefaultBank) {
|
||||
u32 bankId;
|
||||
struct AudioSequenceData *seqData = GameEngine_LoadSequence(seqId);
|
||||
struct CtlEntry *output;
|
||||
for(size_t i = 0; i < seqData->bankCount; i++) {
|
||||
struct AudioSequenceData* seqData = GameEngine_LoadSequence(seqId);
|
||||
struct CtlEntry* output;
|
||||
for (size_t i = 0; i < seqData->bankCount; i++) {
|
||||
output = GameEngine_LoadBank(bankId = seqData->banks[i]);
|
||||
}
|
||||
*outDefaultBank = bankId;
|
||||
@@ -438,7 +432,7 @@ void load_sequence(u32 player, u32 seqId, s32 loadAsync) {
|
||||
}
|
||||
|
||||
void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
|
||||
struct SequencePlayer *seqPlayer = &gSequencePlayers[player];
|
||||
struct SequencePlayer* seqPlayer = &gSequencePlayers[player];
|
||||
|
||||
if (seqId >= gSequenceCount) {
|
||||
return;
|
||||
@@ -473,7 +467,7 @@ void audio_init() {
|
||||
s32 i, j;
|
||||
UNUSED s32 lim1; // lim1 unused in EU
|
||||
UNUSED u32 size;
|
||||
UNUSED u64 *ptr64;
|
||||
UNUSED u64* ptr64;
|
||||
UNUSED s32 pad2;
|
||||
|
||||
gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED;
|
||||
@@ -488,15 +482,13 @@ void audio_init() {
|
||||
memset(gAudioHeap, 0, gAudioHeapSize);
|
||||
#else
|
||||
for (i = 0; i < gAudioHeapSize / 8; i++) {
|
||||
((u64 *) gAudioHeap)[i] = 0;
|
||||
((u64*)gAudioHeap)[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
D_EU_802298D0 = 20.03042f;
|
||||
gRefreshRate = 50;
|
||||
port_eu_init();
|
||||
if (k) {
|
||||
}
|
||||
if (k) {}
|
||||
#endif
|
||||
|
||||
eu_stubbed_printf_1("AudioHeap is %x\n", gAudioHeapSize);
|
||||
@@ -513,8 +505,7 @@ void audio_init() {
|
||||
gAudioTasks[0].task.t.data_size = 0;
|
||||
gAudioTasks[1].task.t.data_size = 0;
|
||||
osCreateMesgQueue(&gAudioDmaMesgQueue, &gAudioDmaMesg, 1);
|
||||
osCreateMesgQueue(&gCurrAudioFrameDmaQueue, gCurrAudioFrameDmaMesgBufs,
|
||||
ARRAY_COUNT(gCurrAudioFrameDmaMesgBufs));
|
||||
osCreateMesgQueue(&gCurrAudioFrameDmaQueue, gCurrAudioFrameDmaMesgBufs, ARRAY_COUNT(gCurrAudioFrameDmaMesgBufs));
|
||||
gCurrAudioFrameDmaCount = 0;
|
||||
gSampleDmaNumListItems = 0;
|
||||
|
||||
@@ -523,7 +514,7 @@ void audio_init() {
|
||||
for (i = 0; i < NUMAIBUFFERS; i++) {
|
||||
gAiBuffers[i] = soundAlloc(&gAudioInitPool, AIBUFFER_LEN);
|
||||
|
||||
for (j = 0; j < (s32) (AIBUFFER_LEN / sizeof(s16)); j++) {
|
||||
for (j = 0; j < (s32)(AIBUFFER_LEN / sizeof(s16)); j++) {
|
||||
gAiBuffers[i][j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
+240
-251
File diff suppressed because it is too large
Load Diff
+253
-211
File diff suppressed because it is too large
Load Diff
+139
-144
File diff suppressed because it is too large
Load Diff
+28
-31
@@ -24,7 +24,7 @@ typedef s32 FadeT;
|
||||
|
||||
extern volatile u8 gAudioResetStatus;
|
||||
extern u8 gAudioResetPresetIdToLoad;
|
||||
extern OSMesgQueue *OSMesgQueues[];
|
||||
extern OSMesgQueue* OSMesgQueues[];
|
||||
extern struct EuAudioCmd sAudioCmd[0x100];
|
||||
|
||||
void func_8031D690(s32 player, FadeT fadeInTime);
|
||||
@@ -33,13 +33,13 @@ void decrease_sample_dma_ttls(void);
|
||||
s32 audio_shut_down_and_reset_step(void);
|
||||
void func_802ad7ec(u32);
|
||||
|
||||
struct SPTask *create_next_audio_frame_task(void) {
|
||||
struct SPTask* create_next_audio_frame_task(void) {
|
||||
u32 samplesRemainingInAI;
|
||||
s32 writtenCmds;
|
||||
s32 index;
|
||||
OSTask_t *task;
|
||||
OSTask_t* task;
|
||||
s32 flags;
|
||||
s16 *currAiBuffer;
|
||||
s16* currAiBuffer;
|
||||
s32 oldDmaCount;
|
||||
OSMesg sp30;
|
||||
OSMesg sp2C;
|
||||
@@ -50,7 +50,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
osSendMesg(OSMesgQueues[0], (OSMesg) gAudioFrameCount, 0);
|
||||
osSendMesg(OSMesgQueues[0], (OSMesg)gAudioFrameCount, 0);
|
||||
|
||||
gAudioTaskIndex ^= 1;
|
||||
gCurrAiBufferIndex++;
|
||||
@@ -70,14 +70,14 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
|
||||
decrease_sample_dma_ttls();
|
||||
if (osRecvMesg(OSMesgQueues[2], &sp30, 0) != -1) {
|
||||
gAudioResetPresetIdToLoad = (u8) (s32) sp30;
|
||||
gAudioResetPresetIdToLoad = (u8)(s32)sp30;
|
||||
gAudioResetStatus = 5;
|
||||
}
|
||||
|
||||
if (gAudioResetStatus != 0) {
|
||||
if (audio_shut_down_and_reset_step() == 0) {
|
||||
if (gAudioResetStatus == 0) {
|
||||
osSendMesg(OSMesgQueues[3], (OSMesg) (s32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
|
||||
osSendMesg(OSMesgQueues[3], (OSMesg)(s32)gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -88,8 +88,10 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
index = gCurrAiBufferIndex;
|
||||
currAiBuffer = gAiBuffers[index];
|
||||
|
||||
gAiBufferLengths[index] = ((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI +
|
||||
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE;
|
||||
gAiBufferLengths[index] =
|
||||
((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI + EXTRA_BUFFERED_AI_SAMPLES_TARGET) &
|
||||
~0xf) +
|
||||
SAMPLES_TO_OVERPRODUCE;
|
||||
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength) {
|
||||
gAiBufferLengths[index] = gAudioBufferParameters.minAiBufferLength;
|
||||
}
|
||||
@@ -98,7 +100,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
}
|
||||
|
||||
if (osRecvMesg(OSMesgQueues[1], &sp2C, OS_MESG_NOBLOCK) != -1) {
|
||||
func_802ad7ec((u32) sp2C);
|
||||
func_802ad7ec((u32)sp2C);
|
||||
}
|
||||
|
||||
flags = 0;
|
||||
@@ -114,7 +116,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
task->type = M_AUDTASK;
|
||||
task->flags = flags;
|
||||
task->ucode_boot = rspF3DBootStart;
|
||||
task->ucode_boot_size = (u8 *) rspF3DBootEnd - (u8 *) rspF3DBootStart;
|
||||
task->ucode_boot_size = (u8*)rspF3DBootEnd - (u8*)rspF3DBootStart;
|
||||
task->ucode = rspAspMainStart;
|
||||
task->ucode_data = rspAspMainDataStart;
|
||||
task->ucode_size = 0x800; // (this size is ignored)
|
||||
@@ -130,7 +132,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
return gAudioTask;
|
||||
}
|
||||
|
||||
void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
void eu_process_audio_cmd(struct EuAudioCmd* cmd) {
|
||||
s32 i;
|
||||
|
||||
switch (cmd->u.s.op) {
|
||||
@@ -148,8 +150,7 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE) {
|
||||
if (cmd->u2.as_s32 == 0) {
|
||||
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
}
|
||||
}
|
||||
@@ -177,7 +178,7 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
|
||||
const char undefportcmd[] = "Undefined Port Command %d\n";
|
||||
|
||||
extern OSMesgQueue *OSMesgQueues[];
|
||||
extern OSMesgQueue* OSMesgQueues[];
|
||||
extern u8 D_EU_80302010;
|
||||
extern u8 D_EU_80302014;
|
||||
extern OSMesg OSMesg0;
|
||||
@@ -192,7 +193,6 @@ void seq_player_fade_to_zero_volume(s32 player, FadeT fadeOutTime) {
|
||||
gSequencePlayers[player].fadeVelocity = -(gSequencePlayers[player].fadeVolume / fadeOutTime);
|
||||
gSequencePlayers[player].state = 2;
|
||||
gSequencePlayers[player].fadeRemainingFrames = fadeOutTime;
|
||||
|
||||
}
|
||||
|
||||
void func_8031D690(s32 player, FadeT fadeInTime) {
|
||||
@@ -214,19 +214,19 @@ void port_eu_init_queues(void) {
|
||||
osCreateMesgQueue(OSMesgQueues[3], &OSMesg3, 1);
|
||||
}
|
||||
|
||||
void func_802ad6f0(s32 arg0, s32 *arg1) {
|
||||
struct EuAudioCmd *cmd = &sAudioCmd[D_EU_80302010 & 0xff];
|
||||
void func_802ad6f0(s32 arg0, s32* arg1) {
|
||||
struct EuAudioCmd* cmd = &sAudioCmd[D_EU_80302010 & 0xff];
|
||||
cmd->u.first = arg0;
|
||||
cmd->u2.as_u32 = *arg1;
|
||||
D_EU_80302010++;
|
||||
}
|
||||
|
||||
void func_802ad728(u32 arg0, f32 arg1) {
|
||||
func_802ad6f0(arg0, (s32*) &arg1);
|
||||
func_802ad6f0(arg0, (s32*)&arg1);
|
||||
}
|
||||
|
||||
void func_802ad74c(u32 arg0, u32 arg1) {
|
||||
func_802ad6f0(arg0, (s32*) &arg1);
|
||||
func_802ad6f0(arg0, (s32*)&arg1);
|
||||
}
|
||||
|
||||
void func_802ad770(u32 arg0, s8 arg1) {
|
||||
@@ -235,29 +235,27 @@ void func_802ad770(u32 arg0, s8 arg1) {
|
||||
}
|
||||
|
||||
void func_802ad7a0(void) {
|
||||
osSendMesg(OSMesgQueues[1],
|
||||
(OSMesg)(u32)((D_EU_80302014 & 0xff) << 8 | (D_EU_80302010 & 0xff)),
|
||||
OS_MESG_NOBLOCK);
|
||||
osSendMesg(OSMesgQueues[1], (OSMesg)(u32)((D_EU_80302014 & 0xff) << 8 | (D_EU_80302010 & 0xff)), OS_MESG_NOBLOCK);
|
||||
D_EU_80302014 = D_EU_80302010;
|
||||
}
|
||||
|
||||
void func_802ad7ec(u32 arg0) {
|
||||
struct EuAudioCmd *cmd;
|
||||
struct SequencePlayer *seqPlayer;
|
||||
struct SequenceChannel *chan;
|
||||
struct EuAudioCmd* cmd;
|
||||
struct SequencePlayer* seqPlayer;
|
||||
struct SequenceChannel* chan;
|
||||
u8 end = arg0 & 0xff;
|
||||
u8 i = (arg0 >> 8) & 0xff;
|
||||
|
||||
for (;;) {
|
||||
if (i == end) break;
|
||||
if (i == end)
|
||||
break;
|
||||
cmd = &sAudioCmd[i++ & 0xff];
|
||||
|
||||
if (cmd->u.s.arg1 < SEQUENCE_PLAYERS) {
|
||||
seqPlayer = &gSequencePlayers[cmd->u.s.arg1];
|
||||
if ((cmd->u.s.op & 0x80) != 0) {
|
||||
eu_process_audio_cmd(cmd);
|
||||
}
|
||||
else if ((cmd->u.s.op & 0x40) != 0) {
|
||||
} else if ((cmd->u.s.op & 0x40) != 0) {
|
||||
switch (cmd->u.s.op) {
|
||||
case 0x41:
|
||||
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
|
||||
@@ -276,8 +274,7 @@ void func_802ad7ec(u32 arg0) {
|
||||
seqPlayer->seqVariationEu[cmd->u.s.arg3] = cmd->u2.as_s8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
|
||||
} else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
|
||||
chan = seqPlayer->channels[cmd->u.s.arg2];
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(chan)) {
|
||||
switch (cmd->u.s.op) {
|
||||
|
||||
+45
-49
@@ -14,22 +14,22 @@
|
||||
#define SAMPLES_TO_OVERPRODUCE 0x10
|
||||
|
||||
extern s32 D_SH_80314FC8;
|
||||
extern struct SPTask *D_SH_80314FCC;
|
||||
extern struct SPTask* D_SH_80314FCC;
|
||||
extern u8 D_SH_80315098;
|
||||
extern u8 D_SH_8031509C;
|
||||
extern OSMesgQueue *D_SH_80350F68;
|
||||
extern OSMesgQueue* D_SH_80350F68;
|
||||
|
||||
void func_8031D690(s32 playerIndex, s32 numFrames);
|
||||
void seq_player_fade_to_zero_volume(s32 arg0, s32 numFrames);
|
||||
void func_802ad7ec(u32 arg0);
|
||||
|
||||
struct SPTask *create_next_audio_frame_task(void) {
|
||||
struct SPTask* create_next_audio_frame_task(void) {
|
||||
u32 samplesRemainingInAI;
|
||||
s32 writtenCmds;
|
||||
s32 index;
|
||||
OSTask_t *task;
|
||||
OSTask_t* task;
|
||||
s32 flags;
|
||||
s16 *currAiBuffer;
|
||||
s16* currAiBuffer;
|
||||
s32 oldDmaCount;
|
||||
s32 sp38;
|
||||
s32 sp34;
|
||||
@@ -42,7 +42,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
osSendMesg(D_SH_80350F38, (OSMesg) gAudioFrameCount, OS_MESG_NOBLOCK);
|
||||
osSendMesg(D_SH_80350F38, (OSMesg)gAudioFrameCount, OS_MESG_NOBLOCK);
|
||||
|
||||
gAudioTaskIndex ^= 1;
|
||||
gCurrAiBufferIndex++;
|
||||
@@ -57,23 +57,22 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
}
|
||||
|
||||
oldDmaCount = gCurrAudioFrameDmaCount;
|
||||
if (oldDmaCount > AUDIO_FRAME_DMA_QUEUE_SIZE) {
|
||||
}
|
||||
if (oldDmaCount > AUDIO_FRAME_DMA_QUEUE_SIZE) {}
|
||||
gCurrAudioFrameDmaCount = 0;
|
||||
|
||||
decrease_sample_dma_ttls();
|
||||
func_sh_802f41e4(gAudioResetStatus);
|
||||
if (osRecvMesg(D_SH_80350F88, (OSMesg *) &sp38, OS_MESG_NOBLOCK) != -1) {
|
||||
if (osRecvMesg(D_SH_80350F88, (OSMesg*)&sp38, OS_MESG_NOBLOCK) != -1) {
|
||||
if (gAudioResetStatus == 0) {
|
||||
gAudioResetStatus = 5;
|
||||
}
|
||||
gAudioResetPresetIdToLoad = (u8) sp38;
|
||||
gAudioResetPresetIdToLoad = (u8)sp38;
|
||||
}
|
||||
|
||||
if (gAudioResetStatus != 0) {
|
||||
if (audio_shut_down_and_reset_step() == 0) {
|
||||
if (gAudioResetStatus == 0) {
|
||||
osSendMesg(D_SH_80350FA8, (OSMesg) (s32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
|
||||
osSendMesg(D_SH_80350FA8, (OSMesg)(s32)gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
|
||||
}
|
||||
D_SH_80314FCC = 0;
|
||||
return NULL;
|
||||
@@ -87,12 +86,14 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
}
|
||||
|
||||
gAudioTask = &gAudioTasks[gAudioTaskIndex];
|
||||
gAudioCmd = (u64 *) gAudioCmdBuffers[gAudioTaskIndex];
|
||||
gAudioCmd = (u64*)gAudioCmdBuffers[gAudioTaskIndex];
|
||||
index = gCurrAiBufferIndex;
|
||||
currAiBuffer = gAiBuffers[index];
|
||||
|
||||
gAiBufferLengths[index] = (s16) ((((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI) +
|
||||
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE);
|
||||
gAiBufferLengths[index] = (s16)((((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI) +
|
||||
EXTRA_BUFFERED_AI_SAMPLES_TARGET) &
|
||||
~0xf) +
|
||||
SAMPLES_TO_OVERPRODUCE);
|
||||
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength) {
|
||||
gAiBufferLengths[index] = gAudioBufferParameters.minAiBufferLength;
|
||||
}
|
||||
@@ -100,16 +101,16 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
gAiBufferLengths[index] = gAudioBufferParameters.maxAiBufferLength;
|
||||
}
|
||||
|
||||
if (osRecvMesg(D_SH_80350F68, (OSMesg *) &sp34, 0) != -1) {
|
||||
if (osRecvMesg(D_SH_80350F68, (OSMesg*)&sp34, 0) != -1) {
|
||||
do {
|
||||
func_802ad7ec(sp34);
|
||||
} while (osRecvMesg(D_SH_80350F68, (OSMesg *) &sp34, 0) != -1);
|
||||
} while (osRecvMesg(D_SH_80350F68, (OSMesg*)&sp34, 0) != -1);
|
||||
}
|
||||
|
||||
flags = 0;
|
||||
gAudioCmd = synthesis_execute(gAudioCmd, &writtenCmds, currAiBuffer, gAiBufferLengths[index]);
|
||||
gAudioRandom = (u32) (osGetCount() * (gAudioRandom + gAudioFrameCount));
|
||||
gAudioRandom = (u32) (gAiBuffers[index][gAudioFrameCount & 0xFF] + gAudioRandom);
|
||||
gAudioRandom = (u32)(osGetCount() * (gAudioRandom + gAudioFrameCount));
|
||||
gAudioRandom = (u32)(gAiBuffers[index][gAudioFrameCount & 0xFF] + gAudioRandom);
|
||||
|
||||
index = gAudioTaskIndex;
|
||||
gAudioTask->msgqueue = NULL;
|
||||
@@ -119,7 +120,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
task->type = M_AUDTASK;
|
||||
task->flags = flags;
|
||||
task->ucode_boot = rspF3DBootStart;
|
||||
task->ucode_boot_size = (u8 *) rspF3DStart - (u8 *) rspF3DBootStart;
|
||||
task->ucode_boot_size = (u8*)rspF3DStart - (u8*)rspF3DBootStart;
|
||||
task->ucode = rspAspMainStart;
|
||||
task->ucode_data = rspAspMainDataStart;
|
||||
task->ucode_size = 0x1000;
|
||||
@@ -146,10 +147,10 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
void eu_process_audio_cmd(struct EuAudioCmd* cmd) {
|
||||
s32 i;
|
||||
struct Note *note;
|
||||
struct NoteSubEu *sub;
|
||||
struct Note* note;
|
||||
struct NoteSubEu* sub;
|
||||
|
||||
switch (cmd->u.s.op) {
|
||||
case 0x81:
|
||||
@@ -166,8 +167,7 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE) {
|
||||
if (cmd->u2.as_s32 == 0) {
|
||||
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
}
|
||||
}
|
||||
@@ -224,7 +224,7 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
}
|
||||
|
||||
void seq_player_fade_to_zero_volume(s32 arg0, s32 fadeOutTime) {
|
||||
struct SequencePlayer *player;
|
||||
struct SequencePlayer* player;
|
||||
|
||||
if (fadeOutTime == 0) {
|
||||
fadeOutTime = 1;
|
||||
@@ -232,11 +232,11 @@ void seq_player_fade_to_zero_volume(s32 arg0, s32 fadeOutTime) {
|
||||
player = &gSequencePlayers[arg0];
|
||||
player->state = 2;
|
||||
player->fadeRemainingFrames = fadeOutTime;
|
||||
player->fadeVelocity = -(player->fadeVolume / (f32) fadeOutTime);
|
||||
player->fadeVelocity = -(player->fadeVolume / (f32)fadeOutTime);
|
||||
}
|
||||
|
||||
void func_8031D690(s32 playerIndex, s32 fadeInTime) {
|
||||
struct SequencePlayer *player;
|
||||
struct SequencePlayer* player;
|
||||
|
||||
if (fadeInTime != 0) {
|
||||
player = &gSequencePlayers[playerIndex];
|
||||
@@ -262,8 +262,8 @@ void port_eu_init_queues(void) {
|
||||
}
|
||||
|
||||
extern struct EuAudioCmd sAudioCmd[0x100];
|
||||
void func_802ad6f0(s32 arg0, s32 *arg1) {
|
||||
struct EuAudioCmd *cmd = &sAudioCmd[D_SH_80350F18 & 0xff];
|
||||
void func_802ad6f0(s32 arg0, s32* arg1) {
|
||||
struct EuAudioCmd* cmd = &sAudioCmd[D_SH_80350F18 & 0xff];
|
||||
cmd->u.first = arg0;
|
||||
cmd->u2.as_u32 = *arg1;
|
||||
D_SH_80350F18++;
|
||||
@@ -273,11 +273,11 @@ void func_802ad6f0(s32 arg0, s32 *arg1) {
|
||||
}
|
||||
|
||||
void func_802ad728(u32 arg0, f32 arg1) {
|
||||
func_802ad6f0(arg0, (s32 *) &arg1);
|
||||
func_802ad6f0(arg0, (s32*)&arg1);
|
||||
}
|
||||
|
||||
void func_802ad74c(u32 arg0, u32 arg1) {
|
||||
func_802ad6f0(arg0, (s32 *) &arg1);
|
||||
func_802ad6f0(arg0, (s32*)&arg1);
|
||||
}
|
||||
|
||||
void func_802ad770(u32 arg0, s8 arg1) {
|
||||
@@ -304,9 +304,9 @@ void func_sh_802f6540(void) {
|
||||
}
|
||||
|
||||
void func_802ad7ec(u32 arg0) {
|
||||
struct EuAudioCmd *cmd;
|
||||
struct SequencePlayer *seqPlayer;
|
||||
struct SequenceChannel *chan;
|
||||
struct EuAudioCmd* cmd;
|
||||
struct SequencePlayer* seqPlayer;
|
||||
struct SequenceChannel* chan;
|
||||
u8 end;
|
||||
|
||||
UNUSED static char shindouDebugPrint134[] = "Continue Port\n";
|
||||
@@ -333,16 +333,13 @@ void func_802ad7ec(u32 arg0) {
|
||||
if (cmd->u.s.op == 0xf8) {
|
||||
D_SH_8031509C = 1;
|
||||
break;
|
||||
}
|
||||
else if ((cmd->u.s.op & 0xf0) == 0xf0) {
|
||||
} else if ((cmd->u.s.op & 0xf0) == 0xf0) {
|
||||
eu_process_audio_cmd(cmd);
|
||||
}
|
||||
else if (cmd->u.s.arg1 < SEQUENCE_PLAYERS) {
|
||||
} else if (cmd->u.s.arg1 < SEQUENCE_PLAYERS) {
|
||||
seqPlayer = &gSequencePlayers[cmd->u.s.arg1];
|
||||
if ((cmd->u.s.op & 0x80) != 0) {
|
||||
eu_process_audio_cmd(cmd);
|
||||
}
|
||||
else if ((cmd->u.s.op & 0x40) != 0) {
|
||||
} else if ((cmd->u.s.op & 0x40) != 0) {
|
||||
switch (cmd->u.s.op) {
|
||||
case 0x41:
|
||||
if (seqPlayer->fadeVolumeScale != cmd->u2.as_f32) {
|
||||
@@ -367,8 +364,7 @@ void func_802ad7ec(u32 arg0) {
|
||||
seqPlayer->seqVariationEu[cmd->u.s.arg3] = cmd->u2.as_s8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
|
||||
} else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
|
||||
chan = seqPlayer->channels[cmd->u.s.arg2];
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(chan)) {
|
||||
switch (cmd->u.s.op) {
|
||||
@@ -421,18 +417,18 @@ void func_802ad7ec(u32 arg0) {
|
||||
}
|
||||
}
|
||||
|
||||
u32 func_sh_802f6878(s32 *arg0) {
|
||||
u32 func_sh_802f6878(s32* arg0) {
|
||||
u32 sp1C;
|
||||
|
||||
if (osRecvMesg(&gUnkQueue1, (OSMesg *) &sp1C, 0) == -1) {
|
||||
if (osRecvMesg(&gUnkQueue1, (OSMesg*)&sp1C, 0) == -1) {
|
||||
*arg0 = 0;
|
||||
return 0U;
|
||||
}
|
||||
*arg0 = (s32) (sp1C & 0xFFFFFF);
|
||||
*arg0 = (s32)(sp1C & 0xFFFFFF);
|
||||
return sp1C >> 0x18;
|
||||
}
|
||||
|
||||
u8 *func_sh_802f68e0(u32 index, u32 *a1) {
|
||||
u8* func_sh_802f68e0(u32 index, u32* a1) {
|
||||
return func_sh_802f3220(index, a1);
|
||||
}
|
||||
|
||||
@@ -440,7 +436,7 @@ s32 func_sh_802f6900(void) {
|
||||
s32 ret;
|
||||
s32 sp18;
|
||||
|
||||
ret = osRecvMesg(D_SH_80350FA8, (OSMesg *) &sp18, 0);
|
||||
ret = osRecvMesg(D_SH_80350FA8, (OSMesg*)&sp18, 0);
|
||||
|
||||
if (ret == -1) {
|
||||
return 0;
|
||||
@@ -471,8 +467,8 @@ void func_sh_802f69cc(void) {
|
||||
}
|
||||
|
||||
s32 func_sh_802f6a08(s32 playerIndex, s32 channelIndex, s32 soundScriptIOIndex) {
|
||||
struct SequenceChannel *seqChannel;
|
||||
struct SequencePlayer *player;
|
||||
struct SequenceChannel* seqChannel;
|
||||
struct SequencePlayer* player;
|
||||
|
||||
player = &gSequencePlayers[playerIndex];
|
||||
if (player->enabled) {
|
||||
|
||||
+217
-224
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@ char shindouDebugPrint1[] = "Terminate-Canceled Channel %d,Phase %d\n";
|
||||
char shindouDebugPrint2[] = "S->W\n";
|
||||
char shindouDebugPrint3[] = "W->S\n";
|
||||
char shindouDebugPrint4[] = "S-Resample Pitch %x (old %d -> delay %d)\n";
|
||||
s32 shindouDebugPrintPadding1[] = {0,0,0};
|
||||
s32 shindouDebugPrintPadding1[] = { 0, 0, 0 };
|
||||
|
||||
// heap.c
|
||||
char shindouDebugPrint5[] = "Warning:Kill Note %x \n";
|
||||
@@ -14,7 +14,7 @@ char shindouDebugPrint6[] = "Kill Voice %d (ID %d) %d\n";
|
||||
char shindouDebugPrint7[] = "Warning: Running Sequence's data disappear!\n";
|
||||
char shindouDebugPrint8[] = "%x %x %x\n";
|
||||
char shindouDebugPrint9[] = "Audio:Memory:Heap OverFlow : Not Allocate %d!\n";
|
||||
char shindouDebugPrint10[] = "%x %x %x\n"; // Again
|
||||
char shindouDebugPrint10[] = "%x %x %x\n"; // Again
|
||||
char shindouDebugPrint11[] = "Audio:Memory:Heap OverFlow : Not Allocate %d!\n"; // Again
|
||||
char shindouDebugPrint12[] = "Audio:Memory:DataHeap Not Allocate \n";
|
||||
char shindouDebugPrint13[] = "StayHeap Not Allocate %d\n";
|
||||
@@ -65,7 +65,7 @@ char shindouDebugPrint57[] = "Request--------Single-Stay, %d\n";
|
||||
char shindouDebugPrint58[] = "Try Kill %d \n";
|
||||
char shindouDebugPrint59[] = "Try Kill %x %x\n";
|
||||
char shindouDebugPrint60[] = "Try Kill %x %x %x\n";
|
||||
s32 shindouDebugPrintPadding[] = {0, 0, 0};
|
||||
s32 shindouDebugPrintPadding[] = { 0, 0, 0 };
|
||||
|
||||
// load.c
|
||||
char shindouDebugPrint61[] = "CAUTION:WAVE CACHE FULL %d";
|
||||
@@ -140,7 +140,7 @@ char shindouDebugPrint127[] = "Spec Change Override. %d -> %d\n";
|
||||
char shindouDebugPrint128[] = "Audio:now-max tasklen is %d / %d\n";
|
||||
char shindouDebugPrint129[] = "Audio:Warning:ABI Tasklist length over (%d)\n";
|
||||
s32 D_SH_80314FC8 = 0x80;
|
||||
struct SPTask *D_SH_80314FCC = NULL;
|
||||
struct SPTask* D_SH_80314FCC = NULL;
|
||||
char shindouDebugPrint130[] = "BGLOAD Start %d\n";
|
||||
char shindouDebugPrint131[] = "Error: OverFlow Your Request\n";
|
||||
char shindouDebugPrint132[] = "---AudioSending (%d->%d) \n";
|
||||
|
||||
+281
-266
File diff suppressed because it is too large
Load Diff
+156
-155
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,6 @@ ALIGNED8 struct SaveBuffer gSaveBuffer;
|
||||
// 0x190a0 bytes
|
||||
struct GfxPool gGfxPools[2];
|
||||
|
||||
|
||||
// Yield buffer for audio, 0x400 bytes. Stubbed out post-JP since the audio
|
||||
// task never yields.
|
||||
#ifdef VERSION_JP
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user