mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 12:51:42 +00:00
config: implemented name and enum localisation
This commit is contained in:
parent
8a11917ce5
commit
5a110d3838
6 changed files with 566 additions and 229 deletions
|
|
@ -18,7 +18,7 @@ void Config::Load()
|
||||||
{
|
{
|
||||||
def->ReadValue(toml);
|
def->ReadValue(toml);
|
||||||
#if _DEBUG
|
#if _DEBUG
|
||||||
printf("%s (0x%llx)\n", def->GetDefinition().c_str(), def->GetValue());
|
printf("%s (0x%p)\n", def->GetDefinition().c_str(), def->GetValue());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,57 +1,59 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "config_detail.h"
|
#include "config_detail.h"
|
||||||
|
#include "config_locale.h"
|
||||||
|
|
||||||
class Config
|
class Config
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline static std::vector<IConfigDef*> Definitions{};
|
inline static std::vector<IConfigDef*> Definitions{};
|
||||||
|
|
||||||
CONFIG_DEFINE_ENUM("System", ELanguage, Language, ELanguage::English);
|
CONFIG_DEFINE_ENUM_LOCALISED("System", ELanguage, Language, ELanguage::English);
|
||||||
CONFIG_DEFINE("System", bool, Hints, true);
|
CONFIG_DEFINE_LOCALISED("System", bool, Hints, true);
|
||||||
CONFIG_DEFINE("System", bool, ControlTutorial, true);
|
CONFIG_DEFINE_LOCALISED("System", bool, ControlTutorial, true);
|
||||||
CONFIG_DEFINE_ENUM("System", EScoreBehaviour, ScoreBehaviour, EScoreBehaviour::CheckpointReset);
|
CONFIG_DEFINE_LOCALISED("System", bool, SaveScoreAtCheckpoints, false);
|
||||||
CONFIG_DEFINE("System", bool, UnleashOutOfControlDrain, true);
|
CONFIG_DEFINE_LOCALISED("System", bool, UnleashOutOfControlDrain, true);
|
||||||
CONFIG_DEFINE("System", bool, WerehogHubTransformVideo, true);
|
CONFIG_DEFINE_LOCALISED("System", bool, WerehogHubTransformVideo, true);
|
||||||
CONFIG_DEFINE_HIDE("System", bool, LogoSkip, false);
|
CONFIG_DEFINE_LOCALISED("System", bool, LogoSkip, false);
|
||||||
|
|
||||||
CONFIG_DEFINE("Controls", bool, CameraXInvert, false);
|
CONFIG_DEFINE_LOCALISED("Controls", bool, CameraXInvert, false);
|
||||||
CONFIG_DEFINE("Controls", bool, CameraYInvert, false);
|
CONFIG_DEFINE_LOCALISED("Controls", bool, CameraYInvert, false);
|
||||||
CONFIG_DEFINE("Controls", bool, XButtonHoming, true);
|
CONFIG_DEFINE_LOCALISED("Controls", bool, XButtonHoming, true);
|
||||||
CONFIG_DEFINE("Controls", bool, UnleashCancel, false);
|
CONFIG_DEFINE_LOCALISED("Controls", bool, UnleashCancel, false);
|
||||||
|
|
||||||
CONFIG_DEFINE("Audio", float, MusicVolume, 1.0f);
|
CONFIG_DEFINE_LOCALISED("Audio", float, MusicVolume, 1.0f);
|
||||||
CONFIG_DEFINE("Audio", float, SEVolume, 1.0f);
|
CONFIG_DEFINE_LOCALISED("Audio", float, SEVolume, 1.0f);
|
||||||
CONFIG_DEFINE_ENUM("Audio", EVoiceLanguage, VoiceLanguage, EVoiceLanguage::English);
|
CONFIG_DEFINE_ENUM_LOCALISED("Audio", EVoiceLanguage, VoiceLanguage, EVoiceLanguage::English);
|
||||||
CONFIG_DEFINE("Audio", bool, Subtitles, true);
|
CONFIG_DEFINE_LOCALISED("Audio", bool, Subtitles, true);
|
||||||
CONFIG_DEFINE("Audio", bool, WerehogBattleMusic, true);
|
CONFIG_DEFINE_LOCALISED("Audio", bool, WerehogBattleMusic, true);
|
||||||
|
|
||||||
CONFIG_DEFINE_ENUM("Video", EGraphicsAPI, GraphicsAPI, EGraphicsAPI::D3D12);
|
CONFIG_DEFINE_ENUM("Video", EGraphicsAPI, GraphicsAPI, EGraphicsAPI::D3D12);
|
||||||
CONFIG_DEFINE_HIDE("Video", int32_t, WindowX, WINDOWPOS_CENTRED);
|
CONFIG_DEFINE("Video", int32_t, WindowX, WINDOWPOS_CENTRED);
|
||||||
CONFIG_DEFINE_HIDE("Video", int32_t, WindowY, WINDOWPOS_CENTRED);
|
CONFIG_DEFINE("Video", int32_t, WindowY, WINDOWPOS_CENTRED);
|
||||||
CONFIG_DEFINE("Video", int32_t, WindowWidth, 1280);
|
CONFIG_DEFINE_LOCALISED("Video", int32_t, WindowWidth, 1280);
|
||||||
CONFIG_DEFINE("Video", int32_t, WindowHeight, 720);
|
CONFIG_DEFINE_LOCALISED("Video", int32_t, WindowHeight, 720);
|
||||||
CONFIG_DEFINE_ENUM_HIDE("Video", EWindowState, WindowState, EWindowState::Normal);
|
CONFIG_DEFINE_ENUM("Video", EWindowState, WindowState, EWindowState::Normal);
|
||||||
|
|
||||||
CONFIG_DEFINE_CALLBACK("Video", float, ResolutionScale, 1.0f,
|
CONFIG_DEFINE_CALLBACK("Video", float, ResolutionScale, 1.0f,
|
||||||
{
|
{
|
||||||
|
def->NameLocale = &g_ResolutionScale_locale;
|
||||||
def->Value = std::clamp(def->Value, 0.25f, 2.0f);
|
def->Value = std::clamp(def->Value, 0.25f, 2.0f);
|
||||||
});
|
});
|
||||||
|
|
||||||
CONFIG_DEFINE("Video", bool, Fullscreen, false);
|
CONFIG_DEFINE_LOCALISED("Video", bool, Fullscreen, false);
|
||||||
CONFIG_DEFINE("Video", bool, VSync, true);
|
CONFIG_DEFINE_LOCALISED("Video", bool, VSync, true);
|
||||||
CONFIG_DEFINE("Video", bool, TripleBuffering, true);
|
CONFIG_DEFINE_LOCALISED("Video", bool, TripleBuffering, true);
|
||||||
CONFIG_DEFINE("Video", int32_t, FPS, 60);
|
CONFIG_DEFINE("Video", int32_t, FPS, 60);
|
||||||
CONFIG_DEFINE("Video", float, Brightness, 0.5f);
|
CONFIG_DEFINE_LOCALISED("Video", float, Brightness, 0.5f);
|
||||||
CONFIG_DEFINE("Video", size_t, MSAA, 4);
|
CONFIG_DEFINE_LOCALISED("Video", size_t, MSAA, 4);
|
||||||
CONFIG_DEFINE_HIDE("Video", size_t, AnisotropicFiltering, 16);
|
CONFIG_DEFINE_LOCALISED("Video", size_t, AnisotropicFiltering, 16);
|
||||||
CONFIG_DEFINE_ENUM("Video", EShadowResolution, ShadowResolution, EShadowResolution::x4096);
|
CONFIG_DEFINE_ENUM_LOCALISED("Video", EShadowResolution, ShadowResolution, EShadowResolution::x4096);
|
||||||
CONFIG_DEFINE_ENUM("Video", EGITextureFiltering, GITextureFiltering, EGITextureFiltering::Bicubic);
|
CONFIG_DEFINE_ENUM_LOCALISED("Video", EGITextureFiltering, GITextureFiltering, EGITextureFiltering::Bicubic);
|
||||||
CONFIG_DEFINE("Video", bool, AlphaToCoverage, true);
|
CONFIG_DEFINE_LOCALISED("Video", bool, AlphaToCoverage, true);
|
||||||
CONFIG_DEFINE("Video", bool, MotionBlur, true);
|
CONFIG_DEFINE_LOCALISED("Video", bool, MotionBlur, true);
|
||||||
CONFIG_DEFINE("Video", bool, Xbox360ColourCorrection, false);
|
CONFIG_DEFINE_LOCALISED("Video", bool, Xbox360ColourCorrection, false);
|
||||||
CONFIG_DEFINE_ENUM("Video", EMovieScaleMode, MovieScaleMode, EMovieScaleMode::Fit);
|
CONFIG_DEFINE_ENUM_LOCALISED("Video", EMovieScaleMode, MovieScaleMode, EMovieScaleMode::Fit);
|
||||||
CONFIG_DEFINE_ENUM("Video", EUIScaleMode, UIScaleMode, EUIScaleMode::Centre);
|
CONFIG_DEFINE_ENUM_LOCALISED("Video", EUIScaleMode, UIScaleMode, EUIScaleMode::Centre);
|
||||||
|
|
||||||
static std::filesystem::path GetUserPath()
|
static std::filesystem::path GetUserPath()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,55 +7,178 @@
|
||||||
#define CONFIG_DEFINE(section, type, name, defaultValue) \
|
#define CONFIG_DEFINE(section, type, name, defaultValue) \
|
||||||
inline static ConfigDef<type> name{section, #name, defaultValue};
|
inline static ConfigDef<type> name{section, #name, defaultValue};
|
||||||
|
|
||||||
#define CONFIG_DEFINE_HIDE(section, type, name, defaultValue) \
|
#define CONFIG_DEFINE_LOCALISED(section, type, name, defaultValue) \
|
||||||
inline static ConfigDef<type, false> name{section, #name, defaultValue};
|
inline static ConfigDef<type> name{section, #name, &g_##name##_locale, defaultValue};
|
||||||
|
|
||||||
|
#define CONFIG_DEFINE_ENUM(section, type, name, defaultValue) \
|
||||||
|
inline static ConfigDef<type> name{section, #name, defaultValue, &g_##type##_template};
|
||||||
|
|
||||||
|
#define CONFIG_DEFINE_ENUM_LOCALISED(section, type, name, defaultValue) \
|
||||||
|
inline static ConfigDef<type> name{section, #name, &g_##name##_locale, defaultValue, &g_##type##_template, &g_##type##_locale};
|
||||||
|
|
||||||
|
#define CONFIG_DEFINE_CALLBACK(section, type, name, defaultValue, readCallback) \
|
||||||
|
inline static ConfigDef<type> name{section, #name, defaultValue, [](ConfigDef<type>* def) readCallback};
|
||||||
|
|
||||||
|
#define CONFIG_DEFINE_LOCALE(name) \
|
||||||
|
inline static std::unordered_map<ELanguage, std::string> g_##name##_locale =
|
||||||
|
|
||||||
|
#define CONFIG_DEFINE_ENUM_LOCALE(type) \
|
||||||
|
inline static std::unordered_map<ELanguage, std::unordered_map<type, std::string>> g_##type##_locale =
|
||||||
|
|
||||||
#define CONFIG_DEFINE_ENUM_TEMPLATE(type) \
|
#define CONFIG_DEFINE_ENUM_TEMPLATE(type) \
|
||||||
inline static std::unordered_map<std::string, type> g_##type##_template =
|
inline static std::unordered_map<std::string, type> g_##type##_template =
|
||||||
|
|
||||||
#define CONFIG_DEFINE_ENUM(section, type, name, defaultValue) \
|
|
||||||
inline static ConfigDef<type> name{section, #name, defaultValue, g_##type##_template};
|
|
||||||
|
|
||||||
#define CONFIG_DEFINE_ENUM_HIDE(section, type, name, defaultValue) \
|
|
||||||
inline static ConfigDef<type, false> name{section, #name, defaultValue, g_##type##_template};
|
|
||||||
|
|
||||||
#define CONFIG_DEFINE_IMPL(section, type, name, defaultValue, readImpl) \
|
|
||||||
inline static ConfigDef<type> name{section, #name, defaultValue, [](ConfigDef<type, true>* def, const toml::v3::table& table) readImpl};
|
|
||||||
|
|
||||||
#define CONFIG_DEFINE_CALLBACK(section, type, name, defaultValue, readCallback) \
|
|
||||||
inline static ConfigDef<type> name{section, #name, defaultValue, [](ConfigDef<type, true>* def) readCallback};
|
|
||||||
|
|
||||||
#define CONFIG_GET_DEFAULT(name) Config::name.DefaultValue
|
#define CONFIG_GET_DEFAULT(name) Config::name.DefaultValue
|
||||||
#define CONFIG_SET_DEFAULT(name) Config::name.MakeDefault();
|
#define CONFIG_SET_DEFAULT(name) Config::name.MakeDefault();
|
||||||
|
|
||||||
#define WINDOWPOS_CENTRED 0x2FFF0000
|
#define WINDOWPOS_CENTRED 0x2FFF0000
|
||||||
|
|
||||||
|
enum class ELanguage : uint32_t
|
||||||
|
{
|
||||||
|
English = 1,
|
||||||
|
Japanese,
|
||||||
|
German,
|
||||||
|
French,
|
||||||
|
Spanish,
|
||||||
|
Italian
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_TEMPLATE(ELanguage)
|
||||||
|
{
|
||||||
|
{ "English", ELanguage::English },
|
||||||
|
{ "Japanese", ELanguage::Japanese },
|
||||||
|
{ "German", ELanguage::German },
|
||||||
|
{ "French", ELanguage::French },
|
||||||
|
{ "Spanish", ELanguage::Spanish },
|
||||||
|
{ "Italian", ELanguage::Italian }
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class EVoiceLanguage : uint32_t
|
||||||
|
{
|
||||||
|
English,
|
||||||
|
Japanese
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_TEMPLATE(EVoiceLanguage)
|
||||||
|
{
|
||||||
|
{ "English", EVoiceLanguage::English },
|
||||||
|
{ "Japanese", EVoiceLanguage::Japanese }
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class EGraphicsAPI : uint32_t
|
||||||
|
{
|
||||||
|
D3D12,
|
||||||
|
Vulkan
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_TEMPLATE(EGraphicsAPI)
|
||||||
|
{
|
||||||
|
{ "D3D12", EGraphicsAPI::D3D12 },
|
||||||
|
{ "Vulkan", EGraphicsAPI::Vulkan }
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class EWindowState : uint32_t
|
||||||
|
{
|
||||||
|
Normal,
|
||||||
|
Maximised
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_TEMPLATE(EWindowState)
|
||||||
|
{
|
||||||
|
{ "Normal", EWindowState::Normal },
|
||||||
|
{ "Maximised", EWindowState::Maximised },
|
||||||
|
{ "Maximized", EWindowState::Maximised }
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class EShadowResolution : int32_t
|
||||||
|
{
|
||||||
|
Original = -1,
|
||||||
|
x512 = 512,
|
||||||
|
x1024 = 1024,
|
||||||
|
x2048 = 2048,
|
||||||
|
x4096 = 4096,
|
||||||
|
x8192 = 8192
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_TEMPLATE(EShadowResolution)
|
||||||
|
{
|
||||||
|
{ "Original", EShadowResolution::Original },
|
||||||
|
{ "512", EShadowResolution::x512 },
|
||||||
|
{ "1024", EShadowResolution::x1024 },
|
||||||
|
{ "2048", EShadowResolution::x2048 },
|
||||||
|
{ "4096", EShadowResolution::x4096 },
|
||||||
|
{ "8192", EShadowResolution::x8192 },
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class EGITextureFiltering : uint32_t
|
||||||
|
{
|
||||||
|
Bilinear,
|
||||||
|
Bicubic
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_TEMPLATE(EGITextureFiltering)
|
||||||
|
{
|
||||||
|
{ "Bilinear", EGITextureFiltering::Bilinear },
|
||||||
|
{ "Bicubic", EGITextureFiltering::Bicubic }
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class EMovieScaleMode : uint32_t
|
||||||
|
{
|
||||||
|
Stretch,
|
||||||
|
Fit,
|
||||||
|
Fill
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_TEMPLATE(EMovieScaleMode)
|
||||||
|
{
|
||||||
|
{ "Stretch", EMovieScaleMode::Stretch },
|
||||||
|
{ "Fit", EMovieScaleMode::Fit },
|
||||||
|
{ "Fill", EMovieScaleMode::Fill }
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class EUIScaleMode : uint32_t
|
||||||
|
{
|
||||||
|
Stretch,
|
||||||
|
Edge,
|
||||||
|
Centre
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_TEMPLATE(EUIScaleMode)
|
||||||
|
{
|
||||||
|
{ "Stretch", EUIScaleMode::Stretch },
|
||||||
|
{ "Edge", EUIScaleMode::Edge },
|
||||||
|
{ "Centre", EUIScaleMode::Centre },
|
||||||
|
{ "Center", EUIScaleMode::Centre }
|
||||||
|
};
|
||||||
|
|
||||||
class IConfigDef
|
class IConfigDef
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~IConfigDef() = default;
|
virtual ~IConfigDef() = default;
|
||||||
virtual void ReadValue(toml::v3::ex::parse_result& toml) = 0;
|
virtual void ReadValue(toml::v3::ex::parse_result& toml) = 0;
|
||||||
virtual void MakeDefault() = 0;
|
virtual void MakeDefault() = 0;
|
||||||
virtual bool IsMenuOption() const = 0;
|
|
||||||
virtual std::string_view GetSection() const = 0;
|
virtual std::string_view GetSection() const = 0;
|
||||||
virtual std::string_view GetName() const = 0;
|
virtual std::string_view GetName() const = 0;
|
||||||
|
virtual std::string GetNameLocalised() const = 0;
|
||||||
virtual void* GetValue() = 0;
|
virtual void* GetValue() = 0;
|
||||||
|
virtual std::string GetValueLocalised() const = 0;
|
||||||
virtual std::string GetDefinition(bool withSection = false) const = 0;
|
virtual std::string GetDefinition(bool withSection = false) const = 0;
|
||||||
virtual std::string ToString() const = 0;
|
virtual std::string ToString(bool strWithQuotes = true) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T, bool isMenuOption = true>
|
template<typename T>
|
||||||
class ConfigDef : public IConfigDef
|
class ConfigDef : public IConfigDef
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::string Section{};
|
std::string Section{};
|
||||||
std::string Name{};
|
std::string Name{};
|
||||||
|
std::unordered_map<ELanguage, std::string>* NameLocale;
|
||||||
T DefaultValue{};
|
T DefaultValue{};
|
||||||
T Value{ DefaultValue };
|
T Value{ DefaultValue };
|
||||||
std::unordered_map<std::string, T> EnumTemplate{};
|
std::unordered_map<std::string, T>* EnumTemplate;
|
||||||
std::map<T, std::string> EnumTemplateReverse{};
|
std::map<T, std::string> EnumTemplateReverse{};
|
||||||
std::function<void(ConfigDef<T, isMenuOption>*, const toml::v3::table&)> ReadImpl;
|
std::unordered_map<ELanguage, std::unordered_map<T, std::string>>* EnumLocale;
|
||||||
std::function<void(ConfigDef<T, isMenuOption>*)> ReadCallback;
|
std::function<void(ConfigDef<T>*)> ReadCallback;
|
||||||
|
|
||||||
ConfigDef(std::string section, std::string name, T defaultValue)
|
ConfigDef(std::string section, std::string name, T defaultValue)
|
||||||
: Section(section), Name(name), DefaultValue(defaultValue)
|
: Section(section), Name(name), DefaultValue(defaultValue)
|
||||||
|
|
@ -63,23 +186,52 @@ public:
|
||||||
Config::Definitions.emplace_back(this);
|
Config::Definitions.emplace_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigDef(std::string section, std::string name, T defaultValue, std::unordered_map<std::string, T> enumTemplate)
|
ConfigDef(std::string section, std::string name, std::unordered_map<ELanguage, std::string>* nameLocale, T defaultValue)
|
||||||
: Section(section), Name(name), DefaultValue(defaultValue), EnumTemplate(enumTemplate)
|
: Section(section), Name(name), NameLocale(nameLocale), DefaultValue(defaultValue)
|
||||||
{
|
{
|
||||||
for (const auto& pair : EnumTemplate)
|
Config::Definitions.emplace_back(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigDef
|
||||||
|
(
|
||||||
|
std::string section,
|
||||||
|
std::string name,
|
||||||
|
T defaultValue,
|
||||||
|
std::unordered_map<std::string, T>* enumTemplate
|
||||||
|
)
|
||||||
|
: Section(section), Name(name), DefaultValue(defaultValue), EnumTemplate(enumTemplate)
|
||||||
|
{
|
||||||
|
for (const auto& pair : *EnumTemplate)
|
||||||
EnumTemplateReverse[pair.second] = pair.first;
|
EnumTemplateReverse[pair.second] = pair.first;
|
||||||
|
|
||||||
Config::Definitions.emplace_back(this);
|
Config::Definitions.emplace_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigDef(std::string section, std::string name, T defaultValue, std::function<void(ConfigDef<T, isMenuOption>*)> readCallback)
|
ConfigDef
|
||||||
|
(
|
||||||
|
std::string section,
|
||||||
|
std::string name,
|
||||||
|
std::unordered_map<ELanguage, std::string>* nameLocale,
|
||||||
|
T defaultValue,
|
||||||
|
std::unordered_map<std::string, T>* enumTemplate,
|
||||||
|
std::unordered_map<ELanguage, std::unordered_map<T, std::string>>* enumLocale
|
||||||
|
)
|
||||||
|
: Section(section), Name(name), NameLocale(nameLocale), DefaultValue(defaultValue), EnumTemplate(enumTemplate), EnumLocale(enumLocale)
|
||||||
|
{
|
||||||
|
for (const auto& pair : *EnumTemplate)
|
||||||
|
EnumTemplateReverse[pair.second] = pair.first;
|
||||||
|
|
||||||
|
Config::Definitions.emplace_back(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigDef(std::string section, std::string name, T defaultValue, std::function<void(ConfigDef<T>*)> readCallback)
|
||||||
: Section(section), Name(name), DefaultValue(defaultValue), ReadCallback(readCallback)
|
: Section(section), Name(name), DefaultValue(defaultValue), ReadCallback(readCallback)
|
||||||
{
|
{
|
||||||
Config::Definitions.emplace_back(this);
|
Config::Definitions.emplace_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigDef(std::string section, std::string name, T defaultValue, std::function<void(ConfigDef<T, isMenuOption>*, const toml::v3::table&)> readImpl)
|
ConfigDef(std::string section, std::string name, std::unordered_map<ELanguage, std::string> nameLocale, T defaultValue, std::function<void(ConfigDef<T>*)> readCallback)
|
||||||
: Section(section), Name(name), DefaultValue(defaultValue), ReadImpl(readImpl)
|
: Section(section), Name(name), NameLocale(nameLocale), DefaultValue(defaultValue), ReadCallback(readCallback)
|
||||||
{
|
{
|
||||||
Config::Definitions.emplace_back(this);
|
Config::Definitions.emplace_back(this);
|
||||||
}
|
}
|
||||||
|
|
@ -90,30 +242,23 @@ public:
|
||||||
{
|
{
|
||||||
const auto& section = *pSection;
|
const auto& section = *pSection;
|
||||||
|
|
||||||
if (ReadImpl)
|
if constexpr (std::is_same<T, std::string>::value)
|
||||||
{
|
{
|
||||||
ReadImpl(this, section);
|
Value = section[Name].value_or<std::string>(DefaultValue);
|
||||||
|
}
|
||||||
|
else if constexpr (std::is_enum_v<T>)
|
||||||
|
{
|
||||||
|
auto it = EnumTemplate->begin();
|
||||||
|
|
||||||
|
Value = EnumTemplate->at(section[Name].value_or<std::string>(static_cast<std::string>(it->first)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if constexpr (std::is_same<T, std::string>::value)
|
Value = section[Name].value_or(DefaultValue);
|
||||||
{
|
|
||||||
Value = section[Name].value_or<std::string>(DefaultValue);
|
|
||||||
}
|
|
||||||
else if constexpr (std::is_enum_v<T>)
|
|
||||||
{
|
|
||||||
auto it = EnumTemplate.begin();
|
|
||||||
|
|
||||||
Value = EnumTemplate[section[Name].value_or<std::string>(static_cast<std::string>(it->first))];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Value = section[Name].value_or(DefaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ReadCallback)
|
|
||||||
ReadCallback(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ReadCallback)
|
||||||
|
ReadCallback(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,11 +267,6 @@ public:
|
||||||
Value = DefaultValue;
|
Value = DefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsMenuOption() const override
|
|
||||||
{
|
|
||||||
return isMenuOption;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string_view GetSection() const override
|
std::string_view GetSection() const override
|
||||||
{
|
{
|
||||||
return Section;
|
return Section;
|
||||||
|
|
@ -137,11 +277,68 @@ public:
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GetNameLocalised() const override
|
||||||
|
{
|
||||||
|
if (!NameLocale)
|
||||||
|
return Name;
|
||||||
|
|
||||||
|
if (!NameLocale->count(Config::Language))
|
||||||
|
{
|
||||||
|
if (NameLocale->count(ELanguage::English))
|
||||||
|
{
|
||||||
|
return NameLocale->at(ELanguage::English);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NameLocale->at(Config::Language);
|
||||||
|
}
|
||||||
|
|
||||||
void* GetValue() override
|
void* GetValue() override
|
||||||
{
|
{
|
||||||
return &Value;
|
return &Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GetValueLocalised() const override
|
||||||
|
{
|
||||||
|
auto language = Config::Language;
|
||||||
|
std::unordered_map<ELanguage, std::unordered_map<T, std::string>>* locale = nullptr;
|
||||||
|
|
||||||
|
if constexpr (std::is_enum_v<T>)
|
||||||
|
{
|
||||||
|
locale = EnumLocale;
|
||||||
|
}
|
||||||
|
else if constexpr (std::is_same_v<T, bool>)
|
||||||
|
{
|
||||||
|
locale = &g_bool_locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!locale)
|
||||||
|
return ToString(false);
|
||||||
|
|
||||||
|
if (!locale->count(language))
|
||||||
|
{
|
||||||
|
if (locale->count(ELanguage::English))
|
||||||
|
{
|
||||||
|
language = ELanguage::English;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ToString(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto strings = locale->at(language);
|
||||||
|
|
||||||
|
if (!strings.count(Value))
|
||||||
|
return ToString(false);
|
||||||
|
|
||||||
|
return strings.at(Value);
|
||||||
|
}
|
||||||
|
|
||||||
std::string GetDefinition(bool withSection = false) const override
|
std::string GetDefinition(bool withSection = false) const override
|
||||||
{
|
{
|
||||||
std::string result;
|
std::string result;
|
||||||
|
|
@ -154,20 +351,26 @@ public:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ToString() const override
|
std::string ToString(bool strWithQuotes = true) const override
|
||||||
{
|
{
|
||||||
std::string result = "\"N/A\"";
|
std::string result = "N/A";
|
||||||
|
|
||||||
if constexpr (std::is_same_v<T, std::string>)
|
if constexpr (std::is_same_v<T, std::string>)
|
||||||
{
|
{
|
||||||
result = std::format("\"{}\"", Value);
|
result = std::format("{}", Value);
|
||||||
|
|
||||||
|
if (strWithQuotes)
|
||||||
|
result = std::format("\"{}\"", result);
|
||||||
}
|
}
|
||||||
else if constexpr (std::is_enum_v<T>)
|
else if constexpr (std::is_enum_v<T>)
|
||||||
{
|
{
|
||||||
auto it = EnumTemplateReverse.find(Value);
|
auto it = EnumTemplateReverse.find(Value);
|
||||||
|
|
||||||
if (it != EnumTemplateReverse.end())
|
if (it != EnumTemplateReverse.end())
|
||||||
result = std::format("\"{}\"", it->second);
|
result = std::format("{}", it->second);
|
||||||
|
|
||||||
|
if (strWithQuotes)
|
||||||
|
result = std::format("\"{}\"", result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -195,133 +398,3 @@ public:
|
||||||
Value = other;
|
Value = other;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ELanguage : uint32_t
|
|
||||||
{
|
|
||||||
English = 1,
|
|
||||||
Japanese,
|
|
||||||
German,
|
|
||||||
French,
|
|
||||||
Spanish,
|
|
||||||
Italian
|
|
||||||
};
|
|
||||||
|
|
||||||
CONFIG_DEFINE_ENUM_TEMPLATE(ELanguage)
|
|
||||||
{
|
|
||||||
{ "English", ELanguage::English },
|
|
||||||
{ "Japanese", ELanguage::Japanese },
|
|
||||||
{ "German", ELanguage::German },
|
|
||||||
{ "French", ELanguage::French },
|
|
||||||
{ "Spanish", ELanguage::Spanish },
|
|
||||||
{ "Italian", ELanguage::Italian }
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class EScoreBehaviour : uint32_t
|
|
||||||
{
|
|
||||||
CheckpointReset,
|
|
||||||
CheckpointRetain
|
|
||||||
};
|
|
||||||
|
|
||||||
CONFIG_DEFINE_ENUM_TEMPLATE(EScoreBehaviour)
|
|
||||||
{
|
|
||||||
{ "CheckpointReset", EScoreBehaviour::CheckpointReset },
|
|
||||||
{ "CheckpointRetain", EScoreBehaviour::CheckpointRetain }
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class EVoiceLanguage : uint32_t
|
|
||||||
{
|
|
||||||
English,
|
|
||||||
Japanese
|
|
||||||
};
|
|
||||||
|
|
||||||
CONFIG_DEFINE_ENUM_TEMPLATE(EVoiceLanguage)
|
|
||||||
{
|
|
||||||
{ "English", EVoiceLanguage::English },
|
|
||||||
{ "Japanese", EVoiceLanguage::Japanese }
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class EGraphicsAPI : uint32_t
|
|
||||||
{
|
|
||||||
D3D12,
|
|
||||||
Vulkan
|
|
||||||
};
|
|
||||||
|
|
||||||
CONFIG_DEFINE_ENUM_TEMPLATE(EGraphicsAPI)
|
|
||||||
{
|
|
||||||
{ "D3D12", EGraphicsAPI::D3D12 },
|
|
||||||
{ "Vulkan", EGraphicsAPI::Vulkan }
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class EWindowState : uint32_t
|
|
||||||
{
|
|
||||||
Normal,
|
|
||||||
Maximised
|
|
||||||
};
|
|
||||||
|
|
||||||
CONFIG_DEFINE_ENUM_TEMPLATE(EWindowState)
|
|
||||||
{
|
|
||||||
{ "Normal", EWindowState::Normal },
|
|
||||||
{ "Maximised", EWindowState::Maximised },
|
|
||||||
{ "Maximized", EWindowState::Maximised }
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class EShadowResolution : int32_t
|
|
||||||
{
|
|
||||||
Original = -1,
|
|
||||||
x512 = 512,
|
|
||||||
x1024 = 1024,
|
|
||||||
x2048 = 2048,
|
|
||||||
x4096 = 4096,
|
|
||||||
x8192 = 8192
|
|
||||||
};
|
|
||||||
|
|
||||||
CONFIG_DEFINE_ENUM_TEMPLATE(EShadowResolution)
|
|
||||||
{
|
|
||||||
{ "Original", EShadowResolution::Original },
|
|
||||||
{ "512", EShadowResolution::x512 },
|
|
||||||
{ "1024", EShadowResolution::x1024 },
|
|
||||||
{ "2048", EShadowResolution::x2048 },
|
|
||||||
{ "4096", EShadowResolution::x4096 },
|
|
||||||
{ "8192", EShadowResolution::x8192 },
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class EGITextureFiltering : uint32_t
|
|
||||||
{
|
|
||||||
Linear,
|
|
||||||
Bicubic
|
|
||||||
};
|
|
||||||
|
|
||||||
CONFIG_DEFINE_ENUM_TEMPLATE(EGITextureFiltering)
|
|
||||||
{
|
|
||||||
{ "Linear", EGITextureFiltering::Linear },
|
|
||||||
{ "Bicubic", EGITextureFiltering::Bicubic }
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class EMovieScaleMode : uint32_t
|
|
||||||
{
|
|
||||||
Stretch,
|
|
||||||
Fit,
|
|
||||||
Fill
|
|
||||||
};
|
|
||||||
|
|
||||||
CONFIG_DEFINE_ENUM_TEMPLATE(EMovieScaleMode)
|
|
||||||
{
|
|
||||||
{ "Stretch", EMovieScaleMode::Stretch },
|
|
||||||
{ "Fit", EMovieScaleMode::Fit },
|
|
||||||
{ "Fill", EMovieScaleMode::Fill }
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class EUIScaleMode : uint32_t
|
|
||||||
{
|
|
||||||
Stretch,
|
|
||||||
Edge,
|
|
||||||
Centre
|
|
||||||
};
|
|
||||||
|
|
||||||
CONFIG_DEFINE_ENUM_TEMPLATE(EUIScaleMode)
|
|
||||||
{
|
|
||||||
{ "Stretch", EUIScaleMode::Stretch },
|
|
||||||
{ "Edge", EUIScaleMode::Edge },
|
|
||||||
{ "Centre", EUIScaleMode::Centre },
|
|
||||||
{ "Center", EUIScaleMode::Centre }
|
|
||||||
};
|
|
||||||
|
|
|
||||||
261
UnleashedRecomp/config_locale.h
Normal file
261
UnleashedRecomp/config_locale.h
Normal file
|
|
@ -0,0 +1,261 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "config_detail.h"
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_LOCALE(bool)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
ELanguage::English, { { true, "ON" }, { false, "OFF" } }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ELanguage::Japanese, { { true, "オン" }, { false, "オフ" } }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ELanguage::German, { { true, "EIN" }, { false, "AUS" } }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ELanguage::French, { { true, "OUI" }, { false, "NON" } }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ELanguage::Spanish, { { true, "SÍ" }, { false, "NO" } }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ELanguage::Italian, { { true, "SÌ" }, { false, "NO" } }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(Language)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Language" },
|
||||||
|
{ ELanguage::Japanese, "言語" },
|
||||||
|
{ ELanguage::German, "Sprache" },
|
||||||
|
{ ELanguage::French, "Langue" },
|
||||||
|
{ ELanguage::Spanish, "Idioma" },
|
||||||
|
{ ELanguage::Italian, "Lingua" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_LOCALE(ELanguage)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
ELanguage::English,
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "ENGLISH" },
|
||||||
|
{ ELanguage::Japanese, "日本語" },
|
||||||
|
{ ELanguage::German, "DEUTSCH" },
|
||||||
|
{ ELanguage::French, "FRANÇAIS" },
|
||||||
|
{ ELanguage::Spanish, "ESPAÑOL" },
|
||||||
|
{ ELanguage::Italian, "ITALIANO" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(Hints)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Hints" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(ControlTutorial)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Control Tutorial" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(SaveScoreAtCheckpoints)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Save Score at Checkpoints" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(UnleashOutOfControlDrain)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Decrease Unleash Gauge whilst Out Of Control" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(WerehogHubTransformVideo)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Werehog Transformation Video" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(LogoSkip)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Skip Intro Logos" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(CameraXInvert)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Invert Camera X" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(CameraYInvert)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Invert Camera Y" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(XButtonHoming)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Homing Attack on Boost" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(UnleashCancel)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Allow Cancelling Unleash" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(MusicVolume)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Music Volume" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(SEVolume)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "SE Volume" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(VoiceLanguage)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Voice Language" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_LOCALE(EVoiceLanguage)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
ELanguage::English,
|
||||||
|
{
|
||||||
|
{ EVoiceLanguage::English, "ENGLISH" },
|
||||||
|
{ EVoiceLanguage::Japanese, "日本語" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(Subtitles)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Subtitles" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(WerehogBattleMusic)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Werehog Battle Theme" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(WindowWidth)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Window Width" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(WindowHeight)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Window Height" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(ResolutionScale)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Resolution Scale" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(Fullscreen)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Fullscreen" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(VSync)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "V-Sync" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(TripleBuffering)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Triple Buffering" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(Brightness)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Brightness" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(MSAA)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Anti-Aliasing" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(AnisotropicFiltering)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Anisotropic Filtering" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(ShadowResolution)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Shadow Resolution" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_LOCALE(EShadowResolution)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
ELanguage::English,
|
||||||
|
{
|
||||||
|
{ EShadowResolution::Original, "ORIGINAL" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(GITextureFiltering)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "GI Texture Filtering" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_LOCALE(EGITextureFiltering)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
ELanguage::English,
|
||||||
|
{
|
||||||
|
{ EGITextureFiltering::Bilinear, "BILINEAR" },
|
||||||
|
{ EGITextureFiltering::Bicubic, "BICUBIC" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(AlphaToCoverage)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Transparency Anti-Aliasing" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(MotionBlur)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Motion Blur" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(Xbox360ColourCorrection)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Xbox 360 Colour Correction" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(MovieScaleMode)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "Movie Scale Mode" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_LOCALE(EMovieScaleMode)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
ELanguage::English,
|
||||||
|
{
|
||||||
|
{ EMovieScaleMode::Stretch, "STRETCH" },
|
||||||
|
{ EMovieScaleMode::Fit, "FIT" },
|
||||||
|
{ EMovieScaleMode::Fill, "FILL" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_LOCALE(UIScaleMode)
|
||||||
|
{
|
||||||
|
{ ELanguage::English, "UI Scale Mode" }
|
||||||
|
};
|
||||||
|
|
||||||
|
CONFIG_DEFINE_ENUM_LOCALE(EUIScaleMode)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
ELanguage::English,
|
||||||
|
{
|
||||||
|
{ EUIScaleMode::Stretch, "STRETCH" },
|
||||||
|
{ EUIScaleMode::Edge, "EDGE" },
|
||||||
|
{ EUIScaleMode::Centre, "CENTRE" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -15,7 +15,7 @@ PPC_FUNC(sub_82624308)
|
||||||
{
|
{
|
||||||
__imp__sub_82624308(ctx, base);
|
__imp__sub_82624308(ctx, base);
|
||||||
|
|
||||||
if (Config::ScoreBehaviour != EScoreBehaviour::CheckpointRetain)
|
if (!Config::SaveScoreAtCheckpoints)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto pGameDocument = SWA::CGameDocument::GetInstance();
|
auto pGameDocument = SWA::CGameDocument::GetInstance();
|
||||||
|
|
@ -33,7 +33,7 @@ PPC_FUNC(sub_8245F048)
|
||||||
{
|
{
|
||||||
__imp__sub_8245F048(ctx, base);
|
__imp__sub_8245F048(ctx, base);
|
||||||
|
|
||||||
if (Config::ScoreBehaviour != EScoreBehaviour::CheckpointRetain)
|
if (!Config::SaveScoreAtCheckpoints)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto pGameDocument = SWA::CGameDocument::GetInstance();
|
auto pGameDocument = SWA::CGameDocument::GetInstance();
|
||||||
|
|
|
||||||
|
|
@ -292,8 +292,8 @@ static void DrawCategories()
|
||||||
drawList->PushClipRect({ clipRectMin.x, clipRectMin.y + gridSize * 6.0f }, clipRectMax);
|
drawList->PushClipRect({ clipRectMin.x, clipRectMin.y + gridSize * 6.0f }, clipRectMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, bool isMenuOption = true>
|
template<typename T>
|
||||||
static void DrawConfigOption(int32_t rowIndex, const ConfigDef<T, isMenuOption>& config)
|
static void DrawConfigOption(int32_t rowIndex, const ConfigDef<T>& config)
|
||||||
{
|
{
|
||||||
auto drawList = ImGui::GetForegroundDrawList();
|
auto drawList = ImGui::GetForegroundDrawList();
|
||||||
auto clipRectMin = drawList->GetClipRectMin();
|
auto clipRectMin = drawList->GetClipRectMin();
|
||||||
|
|
@ -316,10 +316,12 @@ static void DrawConfigOption(int32_t rowIndex, const ConfigDef<T, isMenuOption>&
|
||||||
if (ImGui::IsMouseHoveringRect(min, max, false))
|
if (ImGui::IsMouseHoveringRect(min, max, false))
|
||||||
drawList->AddRectFilledMultiColor(min, max, COLOR0, COLOR0, COLOR1, COLOR1);
|
drawList->AddRectFilledMultiColor(min, max, COLOR0, COLOR0, COLOR1, COLOR1);
|
||||||
|
|
||||||
float size = Scale(26.0f);
|
auto configName = config.GetNameLocalised();
|
||||||
auto textSize = g_seuratFont->CalcTextSizeA(size, FLT_MAX, 0.0f, config.Name.c_str());
|
|
||||||
|
|
||||||
drawList->AddText(g_seuratFont, size, { min.x + gridSize, min.y + (optionHeight - textSize.y) / 2.0f }, IM_COL32_WHITE, config.GetName().data());
|
float size = Scale(26.0f);
|
||||||
|
auto textSize = g_seuratFont->CalcTextSizeA(size, FLT_MAX, 0.0f, configName.c_str());
|
||||||
|
|
||||||
|
drawList->AddText(g_seuratFont, size, { min.x + gridSize, min.y + (optionHeight - textSize.y) / 2.0f }, IM_COL32_WHITE, configName.c_str());
|
||||||
|
|
||||||
// Right side
|
// Right side
|
||||||
min = { max.x + (clipRectMax.x - max.x - valueWidth) / 2.0f, min.y + (optionHeight - valueHeight) / 2.0f };
|
min = { max.x + (clipRectMax.x - max.x - valueWidth) / 2.0f, min.y + (optionHeight - valueHeight) / 2.0f };
|
||||||
|
|
@ -333,8 +335,7 @@ static void DrawConfigOption(int32_t rowIndex, const ConfigDef<T, isMenuOption>&
|
||||||
|
|
||||||
SetShaderModifier(IMGUI_SHADER_MODIFIER_NONE);
|
SetShaderModifier(IMGUI_SHADER_MODIFIER_NONE);
|
||||||
|
|
||||||
auto valueText = config.ToString();
|
auto valueText = config.GetValueLocalised();
|
||||||
std::transform(valueText.begin(), valueText.end(), valueText.begin(), toupper);
|
|
||||||
|
|
||||||
size = Scale(20.0f);
|
size = Scale(20.0f);
|
||||||
textSize = g_newRodinFont->CalcTextSizeA(size, FLT_MAX, 0.0f, valueText.data());
|
textSize = g_newRodinFont->CalcTextSizeA(size, FLT_MAX, 0.0f, valueText.data());
|
||||||
|
|
@ -372,7 +373,7 @@ static void DrawConfigOptions()
|
||||||
DrawConfigOption(rowIndex++, Config::Language);
|
DrawConfigOption(rowIndex++, Config::Language);
|
||||||
DrawConfigOption(rowIndex++, Config::Hints);
|
DrawConfigOption(rowIndex++, Config::Hints);
|
||||||
DrawConfigOption(rowIndex++, Config::ControlTutorial);
|
DrawConfigOption(rowIndex++, Config::ControlTutorial);
|
||||||
DrawConfigOption(rowIndex++, Config::ScoreBehaviour);
|
DrawConfigOption(rowIndex++, Config::SaveScoreAtCheckpoints);
|
||||||
DrawConfigOption(rowIndex++, Config::UnleashOutOfControlDrain);
|
DrawConfigOption(rowIndex++, Config::UnleashOutOfControlDrain);
|
||||||
DrawConfigOption(rowIndex++, Config::WerehogHubTransformVideo);
|
DrawConfigOption(rowIndex++, Config::WerehogHubTransformVideo);
|
||||||
DrawConfigOption(rowIndex++, Config::LogoSkip);
|
DrawConfigOption(rowIndex++, Config::LogoSkip);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue