fix: Restarting ImHex not working correctly
This commit is contained in:
parent
7e01ff451f
commit
0c0caf6942
@ -126,6 +126,7 @@ namespace hex {
|
|||||||
EVENT_DEF(RequestSetPatternLanguageCode, std::string);
|
EVENT_DEF(RequestSetPatternLanguageCode, std::string);
|
||||||
EVENT_DEF(RequestChangeWindowTitle, std::string);
|
EVENT_DEF(RequestChangeWindowTitle, std::string);
|
||||||
EVENT_DEF(RequestCloseImHex, bool);
|
EVENT_DEF(RequestCloseImHex, bool);
|
||||||
|
EVENT_DEF(RequestRestartImHex);
|
||||||
EVENT_DEF(RequestOpenFile, std::fs::path);
|
EVENT_DEF(RequestOpenFile, std::fs::path);
|
||||||
EVENT_DEF(RequestChangeTheme, u32);
|
EVENT_DEF(RequestChangeTheme, u32);
|
||||||
EVENT_DEF(RequestOpenPopup, std::string);
|
EVENT_DEF(RequestOpenPopup, std::string);
|
||||||
|
@ -20,11 +20,8 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void restartImHex() {
|
void restartImHex() {
|
||||||
|
EventManager::post<RequestRestartImHex>();
|
||||||
EventManager::post<RequestCloseImHex>(false);
|
EventManager::post<RequestCloseImHex>(false);
|
||||||
std::atexit([] {
|
|
||||||
auto &programArgs = ImHexApi::System::getProgramArguments();
|
|
||||||
execve(programArgs.argv[0], programArgs.argv, programArgs.envp);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -393,7 +390,7 @@ namespace hex {
|
|||||||
s_customFontPath = path;
|
s_customFontPath = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
static float s_fontSize = 13.0;
|
static float s_fontSize = DefaultFontSize;
|
||||||
void setFontSize(float size) {
|
void setFontSize(float size) {
|
||||||
s_fontSize = size;
|
s_fontSize = size;
|
||||||
}
|
}
|
||||||
|
@ -221,6 +221,7 @@ namespace hex::init {
|
|||||||
|
|
||||||
ContentRegistry::DataFormatter::getEntries().clear();
|
ContentRegistry::DataFormatter::getEntries().clear();
|
||||||
ContentRegistry::FileHandler::getEntries().clear();
|
ContentRegistry::FileHandler::getEntries().clear();
|
||||||
|
ContentRegistry::Hashes::impl::getHashes().clear();
|
||||||
|
|
||||||
{
|
{
|
||||||
auto &visualizers = ContentRegistry::HexEditor::impl::getVisualizers();
|
auto &visualizers = ContentRegistry::HexEditor::impl::getVisualizers();
|
||||||
|
@ -18,6 +18,13 @@ int main(int argc, char **argv, char **envp) {
|
|||||||
ImHexApi::System::impl::setBorderlessWindowMode(true);
|
ImHexApi::System::impl::setBorderlessWindowMode(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool shouldRestart = false;
|
||||||
|
|
||||||
|
EventManager::subscribe<RequestRestartImHex>([&]{ shouldRestart = true; });
|
||||||
|
|
||||||
|
do {
|
||||||
|
shouldRestart = false;
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
{
|
{
|
||||||
Window::initNative();
|
Window::initNative();
|
||||||
@ -55,5 +62,7 @@ int main(int argc, char **argv, char **envp) {
|
|||||||
window.loop();
|
window.loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} while (shouldRestart);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user