mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
config: add exception handler
This commit is contained in:
parent
c8a7b65aa8
commit
bdfa5e874f
1 changed files with 41 additions and 34 deletions
|
|
@ -1,44 +1,51 @@
|
||||||
void Config::Load()
|
void Config::Load()
|
||||||
{
|
{
|
||||||
auto toml = toml::parse_file(TOML_FILE);
|
try
|
||||||
|
|
||||||
TOML_BEGIN_SECTION("System")
|
|
||||||
{
|
{
|
||||||
TOML_READ_ENUM(ELanguage, Language);
|
auto toml = toml::parse_file(TOML_FILE);
|
||||||
TOML_READ_ENUM(EScoreBehaviour, ScoreBehaviour);
|
|
||||||
TOML_READ_BOOLEAN(Hints);
|
|
||||||
TOML_READ_BOOLEAN(WerehogHubTransformVideo);
|
|
||||||
}
|
|
||||||
TOML_END_SECTION();
|
|
||||||
|
|
||||||
TOML_BEGIN_SECTION("Controls")
|
TOML_BEGIN_SECTION("System")
|
||||||
{
|
{
|
||||||
TOML_READ_BOOLEAN(XButtonHoming);
|
TOML_READ_ENUM(ELanguage, Language);
|
||||||
TOML_READ_BOOLEAN(UnleashCancel);
|
TOML_READ_ENUM(EScoreBehaviour, ScoreBehaviour);
|
||||||
}
|
TOML_READ_BOOLEAN(Hints);
|
||||||
TOML_END_SECTION();
|
TOML_READ_BOOLEAN(WerehogHubTransformVideo);
|
||||||
|
}
|
||||||
|
TOML_END_SECTION();
|
||||||
|
|
||||||
TOML_BEGIN_SECTION("Audio")
|
TOML_BEGIN_SECTION("Controls")
|
||||||
{
|
{
|
||||||
TOML_READ_BOOLEAN(WerehogBattleMusic);
|
TOML_READ_BOOLEAN(XButtonHoming);
|
||||||
}
|
TOML_READ_BOOLEAN(UnleashCancel);
|
||||||
TOML_END_SECTION();
|
}
|
||||||
|
TOML_END_SECTION();
|
||||||
|
|
||||||
TOML_BEGIN_SECTION("Video")
|
TOML_BEGIN_SECTION("Audio")
|
||||||
{
|
{
|
||||||
TOML_READ_INTEGER(WindowWidth);
|
TOML_READ_BOOLEAN(WerehogBattleMusic);
|
||||||
TOML_READ_INTEGER(WindowHeight);
|
}
|
||||||
TOML_READ_FLOAT(ResolutionScale);
|
TOML_END_SECTION();
|
||||||
TOML_READ_INTEGER(ShadowResolution);
|
|
||||||
TOML_READ_INTEGER(MSAA);
|
TOML_BEGIN_SECTION("Video")
|
||||||
TOML_READ_ENUM(EMovieScaleMode, MovieScaleMode);
|
{
|
||||||
TOML_READ_ENUM(EUIScaleMode, UIScaleMode);
|
TOML_READ_INTEGER(WindowWidth);
|
||||||
TOML_READ_BOOLEAN(AlphaToCoverage);
|
TOML_READ_INTEGER(WindowHeight);
|
||||||
TOML_READ_BOOLEAN(Fullscreen);
|
TOML_READ_FLOAT(ResolutionScale);
|
||||||
TOML_READ_BOOLEAN(VSync);
|
TOML_READ_INTEGER(ShadowResolution);
|
||||||
TOML_READ_INTEGER(BufferCount);
|
TOML_READ_INTEGER(MSAA);
|
||||||
|
TOML_READ_ENUM(EMovieScaleMode, MovieScaleMode);
|
||||||
|
TOML_READ_ENUM(EUIScaleMode, UIScaleMode);
|
||||||
|
TOML_READ_BOOLEAN(AlphaToCoverage);
|
||||||
|
TOML_READ_BOOLEAN(Fullscreen);
|
||||||
|
TOML_READ_BOOLEAN(VSync);
|
||||||
|
TOML_READ_INTEGER(BufferCount);
|
||||||
|
}
|
||||||
|
TOML_END_SECTION();
|
||||||
|
}
|
||||||
|
catch (toml::parse_error& err)
|
||||||
|
{
|
||||||
|
printf("Failed to parse configuration: %s\n", err.what());
|
||||||
}
|
}
|
||||||
TOML_END_SECTION();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::Save()
|
void Config::Save()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue