fix: ImHex still opening files when multiple builtin plugins are detected

This commit is contained in:
WerWolv 2023-01-31 11:38:26 +01:00
parent d09982d99f
commit 3bad5e1d9c
3 changed files with 14 additions and 6 deletions

View File

@ -89,7 +89,7 @@ namespace hex::init {
}
bool WindowSplash::loop() {
auto splash = romfs::get("splash.png");
auto splash = romfs::get("splash.png");
ImGui::Texture splashTexture = ImGui::Texture(reinterpret_cast<const ImU8 *>(splash.data()), splash.size());
if (!splashTexture.isValid()) {

View File

@ -55,8 +55,6 @@ int main(int argc, char **argv, char **envp) {
// Main window
{
Window window;
if (argc == 1)
; // No arguments provided
else if (argc >= 2) {
@ -66,6 +64,7 @@ int main(int argc, char **argv, char **envp) {
}
}
Window window;
window.loop();
}

View File

@ -98,14 +98,23 @@ namespace hex {
Window::Window() {
stacktrace::initialize();
constexpr static auto openEmergencyPopup = [](const std::string &title){
TaskManager::doLater([title] {
for (const auto &provider : ImHexApi::Provider::getProviders())
ImHexApi::Provider::remove(provider, false);
ImGui::OpenPopup(title.c_str());
});
};
{
for (const auto &[argument, value] : ImHexApi::System::getInitArguments()) {
if (argument == "no-plugins") {
TaskManager::doLater([] { ImGui::OpenPopup("No Plugins"); });
openEmergencyPopup("No Plugins");
} else if (argument == "no-builtin-plugin") {
TaskManager::doLater([] { ImGui::OpenPopup("No Builtin Plugin"); });
openEmergencyPopup("No Builtin Plugin");
} else if (argument == "multiple-builtin-plugins") {
TaskManager::doLater([] { ImGui::OpenPopup("Multiple Builtin Plugins"); });
openEmergencyPopup("Multiple Builtin Plugins");
}
}
}