mirror of
https://github.com/hedge-dev/UnleashedRecomp
synced 2026-09-03 18:43:35 -04:00
options_menu: reboot on language change
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "imgui_utils.h"
|
||||
#include <user/config.h>
|
||||
|
||||
static bool g_isFading;
|
||||
static bool g_isFadeIn;
|
||||
|
||||
static float g_startTime;
|
||||
@@ -21,8 +22,13 @@ void Fader::Draw()
|
||||
|
||||
if (time >= g_duration)
|
||||
{
|
||||
if (g_endCallback && time >= g_duration + g_endCallbackDelay)
|
||||
g_endCallback();
|
||||
if (time >= g_duration + g_endCallbackDelay)
|
||||
{
|
||||
if (g_endCallback)
|
||||
g_endCallback();
|
||||
|
||||
g_isFading = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -36,9 +42,14 @@ void Fader::Draw()
|
||||
ImGui::GetForegroundDrawList()->AddRectFilled({ 0, 0 }, ImGui::GetIO().DisplaySize, colour);
|
||||
}
|
||||
|
||||
static void DoFade(float duration, std::function<void()> endCallback, float endCallbackDelay)
|
||||
static void DoFade(bool isFadeIn, float duration, std::function<void()> endCallback, float endCallbackDelay)
|
||||
{
|
||||
if (g_isFading)
|
||||
return;
|
||||
|
||||
Fader::s_isVisible = true;
|
||||
g_isFading = true;
|
||||
g_isFadeIn = isFadeIn;
|
||||
g_startTime = ImGui::GetTime();
|
||||
g_duration = duration;
|
||||
g_endCallback = endCallback;
|
||||
@@ -52,12 +63,10 @@ void Fader::SetFadeColour(ImU32 colour)
|
||||
|
||||
void Fader::FadeIn(float duration, std::function<void()> endCallback, float endCallbackDelay)
|
||||
{
|
||||
g_isFadeIn = true;
|
||||
DoFade(duration, endCallback, endCallbackDelay);
|
||||
DoFade(true, duration, endCallback, endCallbackDelay);
|
||||
}
|
||||
|
||||
void Fader::FadeOut(float duration, std::function<void()> endCallback, float endCallbackDelay)
|
||||
{
|
||||
g_isFadeIn = false;
|
||||
DoFade(duration, endCallback, endCallbackDelay);
|
||||
DoFade(false, duration, endCallback, endCallbackDelay);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <kernel/memory.h>
|
||||
#include <locale/locale.h>
|
||||
#include <ui/button_guide.h>
|
||||
#include <app.h>
|
||||
|
||||
#include <patches/audio_patches.h>
|
||||
|
||||
@@ -66,6 +67,7 @@ static std::string* g_inaccessibleReason;
|
||||
|
||||
static bool g_isEnterKeyBuffered = false;
|
||||
static bool g_canReset = false;
|
||||
static bool g_isLanguageOptionChanged = false;
|
||||
|
||||
static double g_appearTime = 0.0;
|
||||
|
||||
@@ -475,6 +477,7 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
||||
{
|
||||
g_leftWasHeld = false;
|
||||
g_rightWasHeld = false;
|
||||
|
||||
// remember value
|
||||
s_oldValue = config->Value;
|
||||
|
||||
@@ -493,6 +496,7 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
||||
{
|
||||
// released lock, restore old value
|
||||
config->Value = s_oldValue;
|
||||
|
||||
g_lockedOnOption = false;
|
||||
|
||||
Game_PlaySound("sys_worldmap_cansel");
|
||||
@@ -1012,6 +1016,8 @@ void OptionsMenu::Draw()
|
||||
DrawScanlineBars();
|
||||
DrawSettingsPanel();
|
||||
DrawInfoPanel();
|
||||
|
||||
s_isRestartRequired = Config::Language != App::s_language;
|
||||
}
|
||||
|
||||
void OptionsMenu::Open(bool isPause, SWA::EMenuType pauseMenuType)
|
||||
|
||||
@@ -7,6 +7,7 @@ class OptionsMenu
|
||||
public:
|
||||
inline static bool s_isVisible = false;
|
||||
inline static bool s_isPause = false;
|
||||
inline static bool s_isRestartRequired = false;
|
||||
|
||||
inline static SWA::EMenuType s_pauseMenuType;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user