mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-03 08:26:01 +00:00
fix build state not saving
This commit is contained in:
parent
e9608e0f7e
commit
53fffdb802
@ -102,7 +102,7 @@ class ShutdownException : public std::runtime_error {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct UIData {
|
struct UIData {
|
||||||
static inline std::string GamePath, ProfilePath, CachePath, PublicKey, UserRole, Username;
|
static inline std::string GamePath, ProfilePath, CachePath, Build, PublicKey, UserRole, Username;
|
||||||
static inline bool LoginAuth{false}, Console{false};
|
static inline bool LoginAuth{false}, Console{false};
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,6 +169,7 @@ void MySettingsFrame::UpdateInfo() {
|
|||||||
ctrlProfileDirectory->SetPath(UIData::ProfilePath);
|
ctrlProfileDirectory->SetPath(UIData::ProfilePath);
|
||||||
ctrlCacheDirectory->SetPath(UIData::CachePath);
|
ctrlCacheDirectory->SetPath(UIData::CachePath);
|
||||||
checkConsole->SetValue(UIData::Console);
|
checkConsole->SetValue(UIData::Console);
|
||||||
|
choiceController->SetStringSelection(UIData::Build);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////// Update Game Directory Function ///////////
|
/////////// Update Game Directory Function ///////////
|
||||||
@ -195,7 +196,7 @@ void LoadConfig() {
|
|||||||
if (fs::exists("Launcher.toml")) {
|
if (fs::exists("Launcher.toml")) {
|
||||||
toml::parse_result config = toml::parse_file("Launcher.toml");
|
toml::parse_result config = toml::parse_file("Launcher.toml");
|
||||||
auto ui = config["UI"];
|
auto ui = config["UI"];
|
||||||
auto build = config["Build"];
|
auto Build = config["Build"];
|
||||||
auto GamePath = config["GamePath"];
|
auto GamePath = config["GamePath"];
|
||||||
auto ProfilePath = config["ProfilePath"];
|
auto ProfilePath = config["ProfilePath"];
|
||||||
auto CachePath = config["CachePath"];
|
auto CachePath = config["CachePath"];
|
||||||
@ -215,9 +216,12 @@ void LoadConfig() {
|
|||||||
|
|
||||||
if (Console.is_boolean()) {
|
if (Console.is_boolean()) {
|
||||||
UIData::Console = Console.as_boolean()->get();
|
UIData::Console = Console.as_boolean()->get();
|
||||||
wxMessageBox(std::to_string(UIData::Console), "DEBUG");
|
|
||||||
} else wxMessageBox("Unable to retrieve console state!", "Error");
|
} else wxMessageBox("Unable to retrieve console state!", "Error");
|
||||||
|
|
||||||
|
if (Build.is_string()) {
|
||||||
|
UIData::Build = Build.as_string()->get();
|
||||||
|
} else wxMessageBox("Unable to retrieve build state!", "Error");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
std::ofstream tml("Launcher.toml");
|
std::ofstream tml("Launcher.toml");
|
||||||
if (tml.is_open()) {
|
if (tml.is_open()) {
|
||||||
@ -792,6 +796,7 @@ void MySettingsFrame::OnChangedCacheDir(wxFileDirPickerEvent& event) {
|
|||||||
void MySettingsFrame::OnChangedBuild(wxCommandEvent& event) {
|
void MySettingsFrame::OnChangedBuild(wxCommandEvent& event) {
|
||||||
std::string key = reinterpret_cast<wxChoice*> (event.GetEventObject())->GetString(event.GetSelection());
|
std::string key = reinterpret_cast<wxChoice*> (event.GetEventObject())->GetString(event.GetSelection());
|
||||||
UpdateConfig("Build", key);
|
UpdateConfig("Build", key);
|
||||||
|
UIData::Build = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////// AutoDetect Game Function ///////////
|
/////////// AutoDetect Game Function ///////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user