#include "GameSettings.h" // Audio #include #include #include #include #include #include "Cvar.h" #include "GlobalCtx2.h" #include "ImGuiImpl.h" #include "../../soh/include/z64audio.h" #include "Hooks.h" #include "../../soh/soh/Enhancements/debugconsole.h" #include "Window.h" #include "Lib/Fast3D/gfx_rendering_api.h" #define ABS(var) var < 0 ? -(var) : var using namespace Ship; namespace Game { bool DeSyncAudio = false; void UpdateAudio() { Audio_SetGameVolume(SEQ_BGM_MAIN, CVar_GetFloat("gMainMusicVolume", 1)); Audio_SetGameVolume(SEQ_BGM_SUB, CVar_GetFloat("gSubMusicVolume", 1)); Audio_SetGameVolume(SEQ_FANFARE, CVar_GetFloat("gSFXMusicVolume", 1)); Audio_SetGameVolume(SEQ_SFX, CVar_GetFloat("gFanfareVolume", 1)); } void LoadSettings() { DebugConsole_LoadCVars(); } void SaveSettings() { DebugConsole_SaveCVars(); } void InitSettings() { Ship::RegisterHook(UpdateAudio); Ship::RegisterHook([] { gfx_get_current_rendering_api()->set_texture_filter((FilteringMode) CVar_GetS32("gTextureFilter", FILTER_THREE_POINT)); SohImGui::console->opened = CVar_GetS32("gConsoleEnabled", 0); SohImGui::controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0); UpdateAudio(); }); } void SetSeqPlayerVolume(SeqPlayers playerId, float volume) { Audio_SetGameVolume(playerId, volume); } }