diff --git a/launcher/src/client/configuration.cpp b/launcher/src/client/configuration.cpp index 7ed0b543f6..c94bd8bfee 100644 --- a/launcher/src/client/configuration.cpp +++ b/launcher/src/client/configuration.cpp @@ -2,9 +2,6 @@ #include #include #include -#include -#include -#include #include diff --git a/launcher/src/client/flags/flags.cpp b/launcher/src/client/flags/flags.cpp index 066b576fde..e471471559 100644 --- a/launcher/src/client/flags/flags.cpp +++ b/launcher/src/client/flags/flags.cpp @@ -21,6 +21,7 @@ static unsigned int find_indent_level(std::string &str) { return count / INDENT; } Flags::Flags(const std::string &data) { + FlagNode::reset_id_counter(); // Read Lines std::stringstream stream(data); std::string line; diff --git a/launcher/src/client/flags/flags.h b/launcher/src/client/flags/flags.h index b07ff3e41e..f9e5b7042e 100644 --- a/launcher/src/client/flags/flags.h +++ b/launcher/src/client/flags/flags.h @@ -28,6 +28,7 @@ public: // Internal static bool handle_line_prefix(const std::string &prefix, std::string &line); static std::unordered_map flag_prefixes; + static void reset_id_counter(); }; // All Flags diff --git a/launcher/src/client/flags/node.cpp b/launcher/src/client/flags/node.cpp index 1407814b19..bfa231e636 100644 --- a/launcher/src/client/flags/node.cpp +++ b/launcher/src/client/flags/node.cpp @@ -5,7 +5,10 @@ #include "flags.h" // Flag -static int next_id = 1; +static int next_id; +void FlagNode::reset_id_counter() { + next_id = 1; +} FlagNode::FlagNode(const std::string &name_) { name = name_; value = false; diff --git a/launcher/src/client/ui.cpp b/launcher/src/client/ui.cpp index f53e5d9509..2735d69e11 100644 --- a/launcher/src/client/ui.cpp +++ b/launcher/src/client/ui.cpp @@ -1,6 +1,7 @@ #include #include "configuration.h" +#include "cache.h" #include @@ -29,7 +30,7 @@ ConfigurationUI::ConfigurationUI(State &state_): // Render int ConfigurationUI::render() { const ImGuiStyle &style = ImGui::GetStyle(); - if (ImGui::BeginChild("Main", ImVec2(0, -ImGui::GetFrameHeightWithSpacing() /* Leave Room For One Line */), ImGuiChildFlags_None, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) { + if (ImGui::BeginChild("General", ImVec2(0, -ImGui::GetFrameHeightWithSpacing() /* Leave Room For One Line */), ImGuiChildFlags_None, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) { // Tabs if (ImGui::BeginTabBar("tab_bar", ImGuiTabBarFlags_None)) { if (ImGui::BeginTabItem("Main", nullptr, ImGuiTabItemFlags_None)) { @@ -98,6 +99,10 @@ void ConfigurationUI::draw_advanced() const { draw_category(category); } } + ImGui::Spacing(); + if (ImGui::Button("Reset All Settings")) { + state = State(empty_cache); + } } ImGui::EndChild(); } diff --git a/libreborn/include/libreborn/exec.h b/libreborn/include/libreborn/exec.h index 491e519e1f..d7b0bed74b 100644 --- a/libreborn/include/libreborn/exec.h +++ b/libreborn/include/libreborn/exec.h @@ -25,7 +25,7 @@ __attribute__((noreturn)) void safe_execvpe(const char *const argv[], const char // Run Command And Get Output std::vector *run_command(const char *const command[], int *exit_status); -#define is_exit_status_success(status) (WIFEXITED(status) && WEXITSTATUS(status) == 0) +bool is_exit_status_success(int status); // Get Exit Status String std::string get_exit_status_string(int status); \ No newline at end of file diff --git a/libreborn/src/util/exec.cpp b/libreborn/src/util/exec.cpp index b0175c5627..3e5d8391e9 100644 --- a/libreborn/src/util/exec.cpp +++ b/libreborn/src/util/exec.cpp @@ -120,7 +120,7 @@ __attribute__((noreturn)) void safe_execvpe(const char *const argv[], const char DEBUG(" %s", argv[i]); } // Run - int ret = execvpe(argv[0], (char *const *) argv, (char *const *) envp); + const int ret = execvpe(argv[0], (char *const *) argv, (char *const *) envp); if (ret == -1) { ERR("Unable To Execute Program: %s: %s", argv[0], strerror(errno)); } else { @@ -174,3 +174,15 @@ std::string get_exit_status_string(const int status) { return ""; } } + +// Check Exit Status +bool is_exit_status_success(const int status) { + if (WIFEXITED(status)) { + return WEXITSTATUS(status) == 0; + } else if (WIFSIGNALED(status)) { + const int signal_no = WTERMSIG(status); + return signal_no == SIGINT || signal_no == SIGTERM; + } else { + return false; + } +}