mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
Implemented master volume slider
This commit is contained in:
parent
0b5281d652
commit
a1a05f83dc
10 changed files with 25 additions and 14 deletions
|
|
@ -455,6 +455,7 @@ BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/op
|
|||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/options_menu/thumbnails/invert_camera_x.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/options_menu/thumbnails/invert_camera_x.dds" ARRAY_NAME "g_invert_camera_x" COMPRESSION_TYPE "zstd")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/options_menu/thumbnails/invert_camera_y.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/options_menu/thumbnails/invert_camera_y.dds" ARRAY_NAME "g_invert_camera_y" COMPRESSION_TYPE "zstd")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/options_menu/thumbnails/language.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/options_menu/thumbnails/language.dds" ARRAY_NAME "g_language" COMPRESSION_TYPE "zstd")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/options_menu/thumbnails/master_volume.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/options_menu/thumbnails/master_volume.dds" ARRAY_NAME "g_master_volume" COMPRESSION_TYPE "zstd")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/options_menu/thumbnails/monitor.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/options_menu/thumbnails/monitor.dds" ARRAY_NAME "g_monitor" COMPRESSION_TYPE "zstd")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/options_menu/thumbnails/motion_blur_off.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/options_menu/thumbnails/motion_blur_off.dds" ARRAY_NAME "g_motion_blur_off" COMPRESSION_TYPE "zstd")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/options_menu/thumbnails/motion_blur_original.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/options_menu/thumbnails/motion_blur_original.dds" ARRAY_NAME "g_motion_blur_original" COMPRESSION_TYPE "zstd")
|
||||
|
|
|
|||
|
|
@ -99,6 +99,11 @@ CONFIG_DEFINE_LOCALE(AllowDPadMovement)
|
|||
{ ELanguage::English, { "Allow D-Pad Movement", "Allow the player to also be controlled using the directional pad." } }
|
||||
};
|
||||
|
||||
CONFIG_DEFINE_LOCALE(MasterVolume)
|
||||
{
|
||||
{ ELanguage::English, { "Master Volume", "Adjust the overall volume." } }
|
||||
};
|
||||
|
||||
CONFIG_DEFINE_LOCALE(MusicVolume)
|
||||
{
|
||||
{ ELanguage::English, { "Music Volume", "Adjust the volume for the music." } }
|
||||
|
|
|
|||
|
|
@ -53,15 +53,15 @@ void AudioPatches::Update(float deltaTime)
|
|||
}
|
||||
else
|
||||
{
|
||||
*pMusicVolume = std::lerp(*pMusicVolume, Config::MusicVolume, time);
|
||||
*pMusicVolume = std::lerp(*pMusicVolume, Config::MusicVolume * Config::MasterVolume, time);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*pMusicVolume = Config::MusicVolume;
|
||||
*pMusicVolume = Config::MusicVolume * Config::MasterVolume;
|
||||
}
|
||||
|
||||
*pEffectsVolume = Config::EffectsVolume;
|
||||
*pEffectsVolume = Config::EffectsVolume * Config::MasterVolume;
|
||||
}
|
||||
|
||||
// Stub volume setter.
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ PPC_FUNC(sub_823B49D8)
|
|||
{
|
||||
__imp__sub_823B49D8(ctx, base);
|
||||
|
||||
SDL_User_EvilSonic(GameWindow::s_pWindow, true);
|
||||
SDL_User_EvilSonic(true);
|
||||
}
|
||||
|
||||
// SWA::Player::CEvilSonicContext::Dtor
|
||||
|
|
@ -135,5 +135,5 @@ PPC_FUNC(sub_823B4590)
|
|||
{
|
||||
__imp__sub_823B4590(ctx, base);
|
||||
|
||||
SDL_User_EvilSonic(GameWindow::s_pWindow, false);
|
||||
SDL_User_EvilSonic(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,25 +147,26 @@ int Window_OnSDLEvent(void*, SDL_Event* event)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void GameWindow::Init(const char *sdlVideoDriver)
|
||||
void GameWindow::Init(const char* sdlVideoDriver)
|
||||
{
|
||||
#ifdef __linux__
|
||||
SDL_SetHint("SDL_APP_ID", "io.github.hedge_dev.unleashedrecomp");
|
||||
#endif
|
||||
|
||||
int videoRes = SDL_VideoInit(sdlVideoDriver);
|
||||
if (videoRes != 0 && sdlVideoDriver != nullptr)
|
||||
if (SDL_VideoInit(sdlVideoDriver) != 0 && sdlVideoDriver)
|
||||
{
|
||||
fmt::println("Failed to initialize the specified SDL Video Driver {}. Falling back to default.", sdlVideoDriver);
|
||||
LOGFN_ERROR("Failed to initialise the SDL video driver: \"{}\". Falling back to default.", sdlVideoDriver);
|
||||
SDL_VideoInit(nullptr);
|
||||
}
|
||||
|
||||
const char* videoDriverName = SDL_GetCurrentVideoDriver();
|
||||
if (videoDriverName != nullptr)
|
||||
fmt::println("SDL Video Driver: {}", videoDriverName);
|
||||
auto videoDriverName = SDL_GetCurrentVideoDriver();
|
||||
|
||||
if (videoDriverName)
|
||||
LOGFN("SDL video driver: \"{}\"", videoDriverName);
|
||||
|
||||
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
|
||||
SDL_AddEventWatch(Window_OnSDLEvent, s_pWindow);
|
||||
|
||||
#ifdef _WIN32
|
||||
SetProcessDPIAware();
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -825,6 +825,7 @@ static void DrawConfigOptions()
|
|||
break;
|
||||
|
||||
case 2: // AUDIO
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::MasterVolume, true);
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::MusicVolume, true);
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::EffectsVolume, true);
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::VoiceLanguage, OptionsMenu::s_pauseMenuType == SWA::eMenuType_WorldMap, cmnReason);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include <res/images/options_menu/thumbnails/invert_camera_x.dds.h>
|
||||
#include <res/images/options_menu/thumbnails/invert_camera_y.dds.h>
|
||||
#include <res/images/options_menu/thumbnails/language.dds.h>
|
||||
#include <res/images/options_menu/thumbnails/master_volume.dds.h>
|
||||
#include <res/images/options_menu/thumbnails/monitor.dds.h>
|
||||
#include <res/images/options_menu/thumbnails/motion_blur_off.dds.h>
|
||||
#include <res/images/options_menu/thumbnails/motion_blur_original.dds.h>
|
||||
|
|
@ -77,6 +78,7 @@ void LoadThumbnails()
|
|||
g_configThumbnails[&Config::AllowBackgroundInput] = LOAD_ZSTD_TEXTURE(g_allow_background_input);
|
||||
g_configThumbnails[&Config::AllowDPadMovement] = LOAD_ZSTD_TEXTURE(g_allow_dpad_movement);
|
||||
g_configThumbnails[&Config::ControllerIcons] = LOAD_ZSTD_TEXTURE(g_controller_icons);
|
||||
g_configThumbnails[&Config::MasterVolume] = LOAD_ZSTD_TEXTURE(g_master_volume);
|
||||
g_configThumbnails[&Config::MusicVolume] = LOAD_ZSTD_TEXTURE(g_music_volume);
|
||||
g_configThumbnails[&Config::EffectsVolume] = LOAD_ZSTD_TEXTURE(g_effects_volume);
|
||||
g_configThumbnails[&Config::VoiceLanguage] = LOAD_ZSTD_TEXTURE(g_voice_language);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ inline void SDL_MoveEvent(SDL_Window* pWindow, int x, int y)
|
|||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
inline void SDL_User_EvilSonic(SDL_Window* pWindow, bool isCtor)
|
||||
inline void SDL_User_EvilSonic(bool isCtor)
|
||||
{
|
||||
SDL_Event event{};
|
||||
event.type = SDL_USER_EVILSONIC;
|
||||
|
|
|
|||
|
|
@ -602,6 +602,7 @@ public:
|
|||
CONFIG_DEFINE_LOCALISED("Input", bool, AllowDPadMovement, false);
|
||||
CONFIG_DEFINE_ENUM_LOCALISED("Input", EControllerIcons, ControllerIcons, EControllerIcons::Auto);
|
||||
|
||||
CONFIG_DEFINE_LOCALISED("Audio", float, MasterVolume, 1.0f);
|
||||
CONFIG_DEFINE_LOCALISED("Audio", float, MusicVolume, 1.0f);
|
||||
CONFIG_DEFINE_LOCALISED("Audio", float, EffectsVolume, 1.0f);
|
||||
CONFIG_DEFINE_ENUM_LOCALISED("Audio", EVoiceLanguage, VoiceLanguage, EVoiceLanguage::English);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit a9f556b4435cd7217411219dea23760624266ef2
|
||||
Subproject commit d95ba20a3b5d8def44731a18850e9a550f426a34
|
||||
Loading…
Add table
Reference in a new issue