mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
refactor: Rework features that use external libraries into optional plugins (#1470)
This commit is contained in:
@@ -52,7 +52,7 @@ set_target_properties(main PROPERTIES
|
||||
|
||||
add_compile_definitions(IMHEX_PROJECT_NAME="${PROJECT_NAME}")
|
||||
|
||||
target_link_libraries(main PRIVATE libromfs-imhex libimhex ${GLFW_LIBRARIES} libwolv libpl plcli libpl-gen ${FMT_LIBRARIES})
|
||||
target_link_libraries(main PRIVATE libromfs-imhex libimhex libwolv libpl plcli libpl-gen ${FMT_LIBRARIES})
|
||||
if (WIN32)
|
||||
target_link_libraries(main PRIVATE usp10 wsock32 ws2_32 Dwmapi.lib)
|
||||
else ()
|
||||
|
||||
@@ -182,12 +182,23 @@ namespace hex::init {
|
||||
return !std::fs::relative(plugin.getPath(), executablePath->parent_path()).string().starts_with("..");
|
||||
};
|
||||
|
||||
// Load library plugins first since plugins might depend on them
|
||||
for (const auto &plugin : plugins) {
|
||||
if (!plugin.isLibraryPlugin()) continue;
|
||||
|
||||
// Initialize the plugin
|
||||
if (!plugin.initializePlugin()) {
|
||||
log::error("Failed to initialize library plugin {}", wolv::util::toUTF8String(plugin.getPath().filename()));
|
||||
}
|
||||
}
|
||||
|
||||
u32 builtinPlugins = 0;
|
||||
u32 loadErrors = 0;
|
||||
|
||||
// Load the builtin plugin first, so it can initialize everything that's necessary for ImHex to work
|
||||
for (const auto &plugin : plugins) {
|
||||
if (!plugin.isBuiltinPlugin()) continue;
|
||||
if (plugin.isLibraryPlugin()) continue;
|
||||
|
||||
if (!shouldLoadPlugin(plugin)) {
|
||||
log::debug("Skipping built-in plugin {}", plugin.getPath().string());
|
||||
@@ -209,6 +220,7 @@ namespace hex::init {
|
||||
// Load all other plugins
|
||||
for (const auto &plugin : plugins) {
|
||||
if (plugin.isBuiltinPlugin()) continue;
|
||||
if (plugin.isLibraryPlugin()) continue;
|
||||
|
||||
if (!shouldLoadPlugin(plugin)) {
|
||||
log::debug("Skipping plugin {}", plugin.getPath().string());
|
||||
|
||||
@@ -595,7 +595,7 @@ namespace hex {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted(wolv::util::toUTF8String(filePath).c_str());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted(wolv::io::fs::exists(filePath) ? ICON_VS_CHECK : ICON_VS_CLOSE);
|
||||
ImGui::TextUnformatted(wolv::io::fs::exists(filePath) ? "Yes" : "No");
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user