mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-04 00:47:23 +00:00
fix show console state not saving
This commit is contained in:
parent
ee99246428
commit
e9608e0f7e
@ -103,7 +103,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, PublicKey, UserRole, Username;
|
||||||
static inline bool LoginAuth{false};
|
static inline bool LoginAuth{false}, Console{false};
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -89,9 +89,10 @@ class MySettingsFrame : public wxFrame {
|
|||||||
void UpdateProfileDirectory(const std::string& path);
|
void UpdateProfileDirectory(const std::string& path);
|
||||||
void UpdateCacheDirectory(const std::string& path);
|
void UpdateCacheDirectory(const std::string& path);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxDirPickerCtrl* ctrlGameDirectory, *ctrlProfileDirectory, *ctrlCacheDirectory;
|
|
||||||
wxCheckBox* checkConsole;
|
wxCheckBox* checkConsole;
|
||||||
|
wxDirPickerCtrl* ctrlGameDirectory, *ctrlProfileDirectory, *ctrlCacheDirectory;
|
||||||
wxChoice* choiceController;
|
wxChoice* choiceController;
|
||||||
|
|
||||||
bool DarkMode = wxSystemSettings::GetAppearance().IsDark();
|
bool DarkMode = wxSystemSettings::GetAppearance().IsDark();
|
||||||
@ -167,6 +168,7 @@ void MySettingsFrame::UpdateInfo() {
|
|||||||
ctrlGameDirectory->SetPath(UIData::GamePath);
|
ctrlGameDirectory->SetPath(UIData::GamePath);
|
||||||
ctrlProfileDirectory->SetPath(UIData::ProfilePath);
|
ctrlProfileDirectory->SetPath(UIData::ProfilePath);
|
||||||
ctrlCacheDirectory->SetPath(UIData::CachePath);
|
ctrlCacheDirectory->SetPath(UIData::CachePath);
|
||||||
|
checkConsole->SetValue(UIData::Console);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////// Update Game Directory Function ///////////
|
/////////// Update Game Directory Function ///////////
|
||||||
@ -197,6 +199,7 @@ void LoadConfig() {
|
|||||||
auto GamePath = config["GamePath"];
|
auto GamePath = config["GamePath"];
|
||||||
auto ProfilePath = config["ProfilePath"];
|
auto ProfilePath = config["ProfilePath"];
|
||||||
auto CachePath = config["CachePath"];
|
auto CachePath = config["CachePath"];
|
||||||
|
auto Console = config["Console"];
|
||||||
|
|
||||||
if (GamePath.is_string()) {
|
if (GamePath.is_string()) {
|
||||||
UIData::GamePath = GamePath.as_string()->get();
|
UIData::GamePath = GamePath.as_string()->get();
|
||||||
@ -210,6 +213,11 @@ void LoadConfig() {
|
|||||||
UIData::CachePath = CachePath.as_string()->get();
|
UIData::CachePath = CachePath.as_string()->get();
|
||||||
} else wxMessageBox("Cache path not found!", "Error");
|
} else wxMessageBox("Cache path not found!", "Error");
|
||||||
|
|
||||||
|
if (Console.is_boolean()) {
|
||||||
|
UIData::Console = Console.as_boolean()->get();
|
||||||
|
wxMessageBox(std::to_string(UIData::Console), "DEBUG");
|
||||||
|
} else wxMessageBox("Unable to retrieve console state!", "Error");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
std::ofstream tml("Launcher.toml");
|
std::ofstream tml("Launcher.toml");
|
||||||
if (tml.is_open()) {
|
if (tml.is_open()) {
|
||||||
@ -292,11 +300,16 @@ void CheckKey() {
|
|||||||
} else UpdateKey("");
|
} else UpdateKey("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowsConsole (bool isChecked);
|
||||||
|
|
||||||
/////////// OnInit Function ///////////
|
/////////// OnInit Function ///////////
|
||||||
bool MyApp::OnInit() {
|
bool MyApp::OnInit() {
|
||||||
Log::Init();
|
Log::Init();
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
CheckKey();
|
CheckKey();
|
||||||
|
|
||||||
|
WindowsConsole(UIData::Console);
|
||||||
|
|
||||||
auto* MainFrame = new MyMainFrame();
|
auto* MainFrame = new MyMainFrame();
|
||||||
MyMainFrame::MainFrameInstance = MainFrame;
|
MyMainFrame::MainFrameInstance = MainFrame;
|
||||||
MainFrame->SetIcon(wxIcon("icons/BeamMP_black.png",wxBITMAP_TYPE_PNG));
|
MainFrame->SetIcon(wxIcon("icons/BeamMP_black.png",wxBITMAP_TYPE_PNG));
|
||||||
@ -748,6 +761,7 @@ void MySettingsFrame::OnClickConsole(wxCommandEvent& event) {
|
|||||||
WindowsConsole(checkConsole->IsChecked());
|
WindowsConsole(checkConsole->IsChecked());
|
||||||
bool status = event.IsChecked();
|
bool status = event.IsChecked();
|
||||||
UpdateConfig("Console", status);
|
UpdateConfig("Console", status);
|
||||||
|
UIData::Console = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////// OnChanged Game Path Event ///////////
|
/////////// OnChanged Game Path Event ///////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user