Added support for EU audio

This commit is contained in:
KiritoDv
2025-01-31 18:20:12 -06:00
parent d4bda98c07
commit d824ec401b
12 changed files with 63 additions and 362 deletions
-1
View File
@@ -101,7 +101,6 @@ s16 gAiBuffLengths[3];
u32 gAudioRandom;
u32 D_80155D88;
volatile u32 gAudioResetTimer;
u8 gVoiceLanguage = 0;
u64 gAudioContextEnd[2];
ReverbSettings D_800C74D0[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x40, 0x4000, 0xD000, 0x3000 } };
+15 -13
View File
@@ -3,6 +3,7 @@
#include "sf64context.h"
#include "audiothread_cmd.h"
#include "audioseq_cmd.h"
#include "port/Engine.h"
void Audio_SetModulationAndPlaySfx(f32* sfxSource, u32 sfxId, f32 freqMod);
s32 Audio_GetCurrentVoice(void);
@@ -530,9 +531,9 @@ void Audio_SetSfxProperties(u8 bankId, u8 entryIndex, u8 channelId) {
}
break;
case SFX_BANK_SYSTEM:
if (AUDIO_EU) {
if (GameEngine_HasVersion(SF64_VER_EU)) {
if (entry->state == 2) {
AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, channelId, 1, gVoiceLanguage);
AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, channelId, 1, CVarGetInteger("gVoiceLanguage", 0));
}
}
if (sSfxChannelLayout == SFXCHAN_3) {
@@ -2398,7 +2399,7 @@ void Audio_StopPlayerNoise(u8 playerId) {
break;
case FORM_LANDMASTER:
sfxId = NA_SE_TANK_ENGIN;
if (AUDIO_EU) {
if (GameEngine_HasVersion(SF64_VER_EU)) {
Audio_KillSfxBySourceAndId(gPlayer[playerId].sfx.srcPos, NA_SE_TANK_GO_UP);
}
break;
@@ -2728,13 +2729,14 @@ void Audio_KillAllSfx(void) {
}
void Audio_SetVoiceLanguage(u8 language) {
gVoiceLanguage = language;
if (gVoiceLanguage == 0) {
Audio_StartSequence(SEQ_PLAYER_VOICE, NA_BGM_VO, -1, 1);
} else {
// 0x42 sets voice language to Lylat ?
Audio_StartSequence(SEQ_PLAYER_VOICE, NA_BGM_VO_LYLAT, -1, 1);
switch (language) {
case 0:
default:
Audio_StartSequence(SEQ_PLAYER_VOICE, NA_BGM_VO, -1, 1);
break;
case 1:
Audio_StartSequence(SEQ_PLAYER_VOICE, NA_BGM_VO_LYLAT, -1, 1);
break;
}
}
@@ -2755,7 +2757,7 @@ void Audio_InitSounds(void) {
Audio_ResetSfxChannelState();
Audio_ResetActiveSequencesAndVolume();
Audio_ResetSfx();
if (AUDIO_EU) {
if (GameEngine_HasVersion(SF64_VER_EU)) {
AUDIOCMD_GLOBAL_SYNC_LOAD_SEQ_PARTS(NA_BGM_VO_LYLAT, 0);
}
Audio_StartSequence(SEQ_PLAYER_VOICE, NA_BGM_VO, -1, 1);
@@ -2767,8 +2769,8 @@ void Audio_RestartSeqPlayers(void) {
s32 pad2;
u16 fadeIn = 1;
if (AUDIO_EU) {
if (gVoiceLanguage == 0) {
if (GameEngine_HasVersion(SF64_VER_EU)) {
if (CVarGetInteger("gVoiceLanguage", 0) == 0) {
Audio_StartSequence(SEQ_PLAYER_VOICE, NA_BGM_VO, -1, 1);
} else {
Audio_StartSequence(SEQ_PLAYER_VOICE, NA_BGM_VO_LYLAT, -1, 1);
-1
View File
@@ -5,7 +5,6 @@
#include "assets/ast_audio.h"
#include "port/Engine.h"
#include "endianness.h"
#include "port/Engine.h"
#include "port/resource/loaders/AudioLoader.h"
s32 D_80146D80;
+9
View File
@@ -542,6 +542,15 @@ int GameEngine::ShowYesNoBox(const char* title, const char* box) {
return ret;
}
bool GameEngine::HasVersion(SF64Version ver){
auto versions = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions();
return std::find(versions.begin(), versions.end(), ver) != versions.end();
}
extern "C" bool GameEngine_HasVersion(SF64Version ver) {
return GameEngine::HasVersion(ver);
}
extern "C" uint32_t GameEngine_GetSampleRate() {
auto player = Ship::Context::GetInstance()->GetAudio()->GetAudioPlayer();
if (player == nullptr) {
+8
View File
@@ -10,6 +10,12 @@ struct GamePool {
void* memory;
};
typedef enum {
SF64_VER_US = 0x94F1D5A7,
SF64_VER_EU = 0x6EE9ADE7,
SF64_VER_JP = 0x3728D3E1
} SF64Version;
#ifdef __cplusplus
#include <vector>
#include <SDL2/SDL.h>
@@ -45,6 +51,7 @@ class GameEngine {
static int ShowYesNoBox(const char* title, const char* box);
static void ShowMessage(const char* title, const char* message, SDL_MessageBoxFlags type = SDL_MESSAGEBOX_ERROR);
static bool HasVersion(SF64Version ver);
};
extern "C" void* GameEngine_Malloc(size_t size);
@@ -56,6 +63,7 @@ extern "C" void* GameEngine_Malloc(size_t size);
#else
#include <stdint.h>
bool GameEngine_HasVersion(SF64Version ver);
void GameEngine_ProcessGfxCommands(Gfx* commands);
float GameEngine_GetAspectRatio();
uint8_t GameEngine_OTRSigCheck(char* imgData);
+2
View File
@@ -14,6 +14,8 @@ std::unordered_map<std::string, std::string> mGameList = {
{ "f7475fb11e7e6830f82883412638e8390791ab87", "Star Fox 64 (U) (V1.1) (Uncompressed)" },
{ "9bd71afbecf4d0a43146e4e7a893395e19bf3220", "Star Fox 64 (J) (V1.0)" },
{ "d064229a32cc05ab85e2381ce07744eb3ffaf530", "Star Fox 64 (J) (V1.0) (Uncompressed)" },
{ "05b307b8804f992af1a1e2fbafbd588501fdf799", "Star Fox 64 (E) (V1.0)" },
{ "09f5d5c14219fc77a36c5a6ad5e63f7abd8b3385", "Star Fox 64 (E) (V1.0) (Uncompressed)" },
};
bool GameExtractor::SelectGameFromUI() {
+19
View File
@@ -107,6 +107,10 @@ static const char* filters[3] = {
"Linear", "None"
};
static const char* voiceLangs[] = {
"Original", /*"Japanese",*/ "Lylat"
};
void DrawSettingsMenu(){
if(UIWidgets::BeginMenu("Settings")){
if (UIWidgets::BeginMenu("Audio")) {
@@ -166,6 +170,21 @@ void DrawSettingsMenu(){
ImGui::EndMenu();
}
if(GameEngine::HasVersion(SF64_VER_EU)){
UIWidgets::Spacer(0);
if (UIWidgets::BeginMenu("Language")) {
if (UIWidgets::CVarCombobox("Voices", "gVoiceLanguage", voiceLangs,
{
.tooltip = "Changes the language of the voice acting in the game",
.defaultIndex = 0,
})) {
Audio_SetVoiceLanguage(CVarGetInteger("gVoiceLanguage", 0));
};
ImGui::Dummy(ImVec2(ImGui::CalcTextSize(voiceLangs[0]).x + 55, 0.0f));
ImGui::EndMenu();
}
}
UIWidgets::Spacer(0);
if (UIWidgets::BeginMenu("Controller")) {