mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73fdc3c6ea | ||
|
|
cae0f772d5 | ||
|
|
51547dc941 | ||
|
|
1508efac7a | ||
|
|
16dc239e0f | ||
|
|
899f00ed2f | ||
|
|
9ebfffd346 | ||
|
|
76b2c09450 | ||
|
|
69246de145 | ||
|
|
aee4b4fdf6 | ||
|
|
a6a78cef00 | ||
|
|
30b25a39a7 | ||
|
|
1f0b5e1ee1 | ||
|
|
d6658c3471 | ||
|
|
398eecaa1d | ||
|
|
b6616c1a0f | ||
|
|
5d3315f51c | ||
|
|
ec7298f0c0 | ||
|
|
92c2018f71 | ||
|
|
956952021d |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,6 +7,7 @@ build*/
|
|||||||
local/
|
local/
|
||||||
venv/
|
venv/
|
||||||
.cache/
|
.cache/
|
||||||
|
install/
|
||||||
|
|
||||||
*.mgc
|
*.mgc
|
||||||
*.kdev4
|
*.kdev4
|
||||||
|
|||||||
@@ -666,12 +666,15 @@ macro(setupCompilerFlags target)
|
|||||||
addCCXXFlag("-Wno-unknown-pragmas" ${target})
|
addCCXXFlag("-Wno-unknown-pragmas" ${target})
|
||||||
|
|
||||||
# Enable hardening flags
|
# Enable hardening flags
|
||||||
addCommonFlag("-U_FORTIFY_SOURCE" ${target})
|
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
addCommonFlag("-D_FORTIFY_SOURCE=3" ${target})
|
addCommonFlag("-U_FORTIFY_SOURCE" ${target})
|
||||||
|
addCommonFlag("-D_FORTIFY_SOURCE=3" ${target})
|
||||||
|
|
||||||
if (NOT EMSCRIPTEN)
|
if (NOT EMSCRIPTEN)
|
||||||
addCommonFlag("-fstack-protector-strong" ${target})
|
addCommonFlag("-fstack-protector-strong" ${target})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||||
@@ -800,8 +803,8 @@ macro(addBundledLibraries)
|
|||||||
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/lunasvg EXCLUDE_FROM_ALL)
|
add_subdirectory(${THIRD_PARTY_LIBS_FOLDER}/lunasvg EXCLUDE_FROM_ALL)
|
||||||
set(LUNASVG_LIBRARIES lunasvg)
|
set(LUNASVG_LIBRARIES lunasvg)
|
||||||
else()
|
else()
|
||||||
find_package(LunaSVG REQUIRED)
|
find_package(lunasvg REQUIRED)
|
||||||
set(LUNASVG_LIBRARIES lunasvg)
|
set(LUNASVG_LIBRARIES lunasvg::lunasvg)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT USE_SYSTEM_LLVM)
|
if (NOT USE_SYSTEM_LLVM)
|
||||||
@@ -925,11 +928,17 @@ function(generateSDKDirectory)
|
|||||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/sdk/ DESTINATION "${SDK_PATH}")
|
install(DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/sdk/ DESTINATION "${SDK_PATH}")
|
||||||
install(TARGETS libimhex ARCHIVE DESTINATION "${SDK_PATH}/lib")
|
install(TARGETS libimhex ARCHIVE DESTINATION "${SDK_PATH}/lib")
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/plugins/ui DESTINATION "${SDK_PATH}/lib" PATTERN "**/source/*" EXCLUDE)
|
install(DIRECTORY ${CMAKE_SOURCE_DIR}/plugins/ui/include DESTINATION "${SDK_PATH}/lib/ui/include")
|
||||||
install(TARGETS ui ARCHIVE DESTINATION "${SDK_PATH}/lib")
|
install(FILES ${CMAKE_SOURCE_DIR}/plugins/ui/CMakeLists.txt DESTINATION "${SDK_PATH}/lib/ui/")
|
||||||
|
if (WIN32)
|
||||||
|
install(TARGETS ui ARCHIVE DESTINATION "${SDK_PATH}/lib")
|
||||||
|
endif()
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/plugins/fonts DESTINATION "${SDK_PATH}/lib" PATTERN "**/source/*" EXCLUDE)
|
install(DIRECTORY ${CMAKE_SOURCE_DIR}/plugins/fonts/include DESTINATION "${SDK_PATH}/lib/fonts/include")
|
||||||
install(TARGETS fonts ARCHIVE DESTINATION "${SDK_PATH}/lib")
|
install(FILES ${CMAKE_SOURCE_DIR}/plugins/fonts/CMakeLists.txt DESTINATION "${SDK_PATH}/lib/fonts/")
|
||||||
|
if (WIN32)
|
||||||
|
install(TARGETS fonts ARCHIVE DESTINATION "${SDK_PATH}/lib")
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(addIncludesFromLibrary target library)
|
function(addIncludesFromLibrary target library)
|
||||||
|
|||||||
1
dist/rpm/imhex.spec
vendored
1
dist/rpm/imhex.spec
vendored
@@ -128,6 +128,5 @@ cp -a lib/third_party/xdgpp/LICENSE %{buildroot
|
|||||||
%{_datadir}/mime/packages/%{name}.xml
|
%{_datadir}/mime/packages/%{name}.xml
|
||||||
%{_libdir}/libimhex.so*
|
%{_libdir}/libimhex.so*
|
||||||
%{_libdir}/%{name}/
|
%{_libdir}/%{name}/
|
||||||
%{_libdir}/*.hexpluglib
|
|
||||||
/usr/lib/debug/%{_libdir}/*.debug
|
/usr/lib/debug/%{_libdir}/*.debug
|
||||||
%{_metainfodir}/net.werwolv.%{name}.metainfo.xml
|
%{_metainfodir}/net.werwolv.%{name}.metainfo.xml
|
||||||
2
lib/external/pattern_language
vendored
2
lib/external/pattern_language
vendored
Submodule lib/external/pattern_language updated: 72e9b93c8f...9833500589
@@ -327,6 +327,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SetNextWindowPos(position, ImGuiCond_Always, pivot);
|
ImGui::SetNextWindowPos(position, ImGuiCond_Always, pivot);
|
||||||
|
ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID);
|
||||||
if (ImGui::Begin("##TutorialMessage", nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoFocusOnAppearing)) {
|
if (ImGui::Begin("##TutorialMessage", nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoFocusOnAppearing)) {
|
||||||
ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindowRead());
|
ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindowRead());
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ namespace hex {
|
|||||||
void drawImGui();
|
void drawImGui();
|
||||||
void drawWithShader();
|
void drawWithShader();
|
||||||
|
|
||||||
|
void unlockFrameRate();
|
||||||
|
void forceNewFrame();
|
||||||
|
|
||||||
GLFWwindow *m_window = nullptr;
|
GLFWwindow *m_window = nullptr;
|
||||||
|
|
||||||
std::string m_windowTitle, m_windowTitleFull;
|
std::string m_windowTitle, m_windowTitleFull;
|
||||||
@@ -64,17 +67,22 @@ namespace hex {
|
|||||||
std::list<std::string> m_popupsToOpen;
|
std::list<std::string> m_popupsToOpen;
|
||||||
std::set<int> m_pressedKeys;
|
std::set<int> m_pressedKeys;
|
||||||
|
|
||||||
std::atomic<bool> m_unlockFrameRate = true;
|
|
||||||
|
|
||||||
ImGuiExt::ImHexCustomData m_imguiCustomData;
|
ImGuiExt::ImHexCustomData m_imguiCustomData;
|
||||||
|
|
||||||
u32 m_searchBarPosition = 0;
|
u32 m_searchBarPosition = 0;
|
||||||
bool m_emergencyPopupOpen = false;
|
bool m_emergencyPopupOpen = false;
|
||||||
|
|
||||||
std::jthread m_frameRateThread;
|
std::jthread m_frameRateThread;
|
||||||
|
std::chrono::duration<double, std::nano> m_remainingUnlockedTime;
|
||||||
|
|
||||||
|
std::mutex m_sleepMutex;
|
||||||
std::atomic<bool> m_sleepFlag;
|
std::atomic<bool> m_sleepFlag;
|
||||||
std::condition_variable m_sleepCondVar;
|
std::condition_variable m_sleepCondVar;
|
||||||
std::mutex m_sleepMutex;
|
|
||||||
|
std::mutex m_wakeupMutex;
|
||||||
|
std::atomic<bool> m_wakeupFlag;
|
||||||
|
std::condition_variable m_wakeupCondVar;
|
||||||
|
|
||||||
|
|
||||||
gl::Shader m_postProcessingShader;
|
gl::Shader m_postProcessingShader;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,12 +42,18 @@ namespace hex::messaging {
|
|||||||
|
|
||||||
static auto listenerThread = std::jthread([](const std::stop_token &stopToken){
|
static auto listenerThread = std::jthread([](const std::stop_token &stopToken){
|
||||||
std::vector<u8> buffer(0xFFFF);
|
std::vector<u8> buffer(0xFFFF);
|
||||||
while (!stopToken.stop_requested()) {
|
|
||||||
|
while (true) {
|
||||||
int result = ::read(fifo, buffer.data(), buffer.size());
|
int result = ::read(fifo, buffer.data(), buffer.size());
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
EventNativeMessageReceived::post(std::vector<u8>{ buffer.begin(), buffer.begin() + result });
|
EventNativeMessageReceived::post(std::vector<u8>{ buffer.begin(), buffer.begin() + result });
|
||||||
} else {
|
}
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
|
||||||
|
if (stopToken.stop_requested())
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (result <= 0) {
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ namespace hex {
|
|||||||
FILE *pipe = popen("dbus-send --session --print-reply --dest=org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read string:'org.freedesktop.appearance' string:'color-scheme' 2>&1", "r");
|
FILE *pipe = popen("dbus-send --session --print-reply --dest=org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read string:'org.freedesktop.appearance' string:'color-scheme' 2>&1", "r");
|
||||||
if (pipe == nullptr) return;
|
if (pipe == nullptr) return;
|
||||||
|
|
||||||
while (fgets(buffer.data(), buffer.size(), pipe) != nullptr)
|
while (fgets(buffer.data(), buffer.size() - 1, pipe) != nullptr)
|
||||||
result += buffer.data();
|
result += buffer.data();
|
||||||
|
|
||||||
auto exitCode = WEXITSTATUS(pclose(pipe));
|
auto exitCode = WEXITSTATUS(pclose(pipe));
|
||||||
|
|||||||
@@ -204,17 +204,20 @@ namespace hex {
|
|||||||
|
|
||||||
i64 sleepTicks = 0;
|
i64 sleepTicks = 0;
|
||||||
i64 sleepMilliSeconds = 0;
|
i64 sleepMilliSeconds = 0;
|
||||||
if (delta >= 0) {
|
if (period > 0) {
|
||||||
sleepTicks = delta / period;
|
if (delta >= 0) {
|
||||||
} else {
|
sleepTicks = delta / period;
|
||||||
sleepTicks = -1 + delta / period;
|
} else {
|
||||||
|
sleepTicks = -1 + delta / period;
|
||||||
|
}
|
||||||
|
|
||||||
|
sleepMilliSeconds = delta - (period * sleepTicks);
|
||||||
|
const double sleepTime = std::round(1000.0 * double(sleepMilliSeconds) / double(performanceFrequency.QuadPart));
|
||||||
|
if (sleepTime >= 0.0) {
|
||||||
|
Sleep(DWORD(sleepTime));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sleepMilliSeconds = delta - (period * sleepTicks);
|
|
||||||
const double sleepTime = std::round(1000.0 * double(sleepMilliSeconds) / double(performanceFrequency.QuadPart));
|
|
||||||
if (sleepTime >= 0.0) {
|
|
||||||
Sleep(DWORD(sleepTime));
|
|
||||||
}
|
|
||||||
timeEndPeriod(granularity);
|
timeEndPeriod(granularity);
|
||||||
|
|
||||||
return WVR_REDRAW;
|
return WVR_REDRAW;
|
||||||
@@ -614,7 +617,7 @@ namespace hex {
|
|||||||
|
|
||||||
glfwSetFramebufferSizeCallback(m_window, [](GLFWwindow* window, int width, int height) {
|
glfwSetFramebufferSizeCallback(m_window, [](GLFWwindow* window, int width, int height) {
|
||||||
auto *win = static_cast<Window *>(glfwGetWindowUserPointer(window));
|
auto *win = static_cast<Window *>(glfwGetWindowUserPointer(window));
|
||||||
win->m_unlockFrameRate = true;
|
win->unlockFrameRate();
|
||||||
|
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
ImHexApi::System::impl::setMainWindowSize(width, height);
|
ImHexApi::System::impl::setMainWindowSize(width, height);
|
||||||
|
|||||||
@@ -100,6 +100,9 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Window::~Window() {
|
Window::~Window() {
|
||||||
|
m_frameRateThread.request_stop();
|
||||||
|
m_frameRateThread.join();
|
||||||
|
|
||||||
EventProviderDeleted::unsubscribe(this);
|
EventProviderDeleted::unsubscribe(this);
|
||||||
RequestCloseImHex::unsubscribe(this);
|
RequestCloseImHex::unsubscribe(this);
|
||||||
RequestUpdateWindowTitle::unsubscribe(this);
|
RequestUpdateWindowTitle::unsubscribe(this);
|
||||||
@@ -311,7 +314,7 @@ namespace hex {
|
|||||||
|
|
||||||
// Unlock frame rate if any mouse button is being held down to allow drag scrolling to be smooth
|
// Unlock frame rate if any mouse button is being held down to allow drag scrolling to be smooth
|
||||||
if (ImGui::IsAnyMouseDown())
|
if (ImGui::IsAnyMouseDown())
|
||||||
m_unlockFrameRate = true;
|
this->unlockFrameRate();
|
||||||
|
|
||||||
// Unlock frame rate if any modifier key is held down since they don't generate key repeat events
|
// Unlock frame rate if any modifier key is held down since they don't generate key repeat events
|
||||||
if (
|
if (
|
||||||
@@ -320,12 +323,12 @@ namespace hex {
|
|||||||
ImGui::IsKeyPressed(ImGuiKey_LeftSuper) || ImGui::IsKeyPressed(ImGuiKey_RightSuper) ||
|
ImGui::IsKeyPressed(ImGuiKey_LeftSuper) || ImGui::IsKeyPressed(ImGuiKey_RightSuper) ||
|
||||||
ImGui::IsKeyPressed(ImGuiKey_LeftAlt) || ImGui::IsKeyPressed(ImGuiKey_RightAlt)
|
ImGui::IsKeyPressed(ImGuiKey_LeftAlt) || ImGui::IsKeyPressed(ImGuiKey_RightAlt)
|
||||||
) {
|
) {
|
||||||
m_unlockFrameRate = true;
|
this->unlockFrameRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unlock frame rate if there's more than one viewport since these don't call the glfw callbacks registered here
|
// Unlock frame rate if there's more than one viewport since these don't call the glfw callbacks registered here
|
||||||
if (ImGui::GetPlatformIO().Viewports.size() > 1)
|
if (ImGui::GetPlatformIO().Viewports.size() > 1)
|
||||||
m_unlockFrameRate = true;
|
this->unlockFrameRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide the window as soon as the render loop exits to make the window
|
// Hide the window as soon as the render loop exits to make the window
|
||||||
@@ -334,6 +337,9 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window::frameBegin() {
|
void Window::frameBegin() {
|
||||||
|
// Run all deferred calls
|
||||||
|
TaskManager::runDeferredCalls();
|
||||||
|
|
||||||
ImGui_ImplOpenGL3_NewFrame();
|
ImGui_ImplOpenGL3_NewFrame();
|
||||||
ImGui_ImplGlfw_NewFrame();
|
ImGui_ImplGlfw_NewFrame();
|
||||||
|
|
||||||
@@ -353,7 +359,7 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const auto &font = ImHexApi::Fonts::getFont("hex.fonts.font.default");
|
auto font = ImHexApi::Fonts::getFont("hex.fonts.font.default");
|
||||||
|
|
||||||
if (font == nullptr) {
|
if (font == nullptr) {
|
||||||
const auto &io = ImGui::GetIO();
|
const auto &io = ImGui::GetIO();
|
||||||
@@ -362,13 +368,15 @@ namespace hex {
|
|||||||
ImFontConfig cfg;
|
ImFontConfig cfg;
|
||||||
cfg.OversampleH = cfg.OversampleV = 1, cfg.PixelSnapH = true;
|
cfg.OversampleH = cfg.OversampleV = 1, cfg.PixelSnapH = true;
|
||||||
cfg.SizePixels = ImHexApi::Fonts::DefaultFontSize;
|
cfg.SizePixels = ImHexApi::Fonts::DefaultFontSize;
|
||||||
io.Fonts->AddFontDefault(&cfg);
|
font = io.Fonts->AddFontDefault(&cfg);
|
||||||
ImGui_ImplOpenGL3_CreateFontsTexture();
|
ImGui_ImplOpenGL3_CreateFontsTexture();
|
||||||
io.Fonts->ClearInputData();
|
io.Fonts->ClearInputData();
|
||||||
io.Fonts->ClearTexData();
|
io.Fonts->ClearTexData();
|
||||||
} else {
|
} else {
|
||||||
currentFont = font->ContainerAtlas;
|
currentFont = font->ContainerAtlas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::SetCurrentFont(font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -682,9 +690,6 @@ namespace hex {
|
|||||||
return banner->shouldClose();
|
return banner->shouldClose();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run all deferred calls
|
|
||||||
TaskManager::runDeferredCalls();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::frame() {
|
void Window::frame() {
|
||||||
@@ -927,6 +932,23 @@ namespace hex {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::unlockFrameRate() {
|
||||||
|
{
|
||||||
|
std::scoped_lock lock(m_wakeupMutex);
|
||||||
|
m_remainingUnlockedTime = std::chrono::seconds(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->forceNewFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window::forceNewFrame() {
|
||||||
|
std::scoped_lock lock(m_wakeupMutex);
|
||||||
|
m_wakeupFlag = true;
|
||||||
|
m_wakeupCondVar.notify_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Window::initGLFW() {
|
void Window::initGLFW() {
|
||||||
auto initialWindowProperties = ImHexApi::System::getInitialWindowProperties();
|
auto initialWindowProperties = ImHexApi::System::getInitialWindowProperties();
|
||||||
glfwSetErrorCallback([](int error, const char *desc) {
|
glfwSetErrorCallback([](int error, const char *desc) {
|
||||||
@@ -1027,7 +1049,7 @@ namespace hex {
|
|||||||
if (win == nullptr)
|
if (win == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
win->m_unlockFrameRate = true;
|
win->unlockFrameRate();
|
||||||
};
|
};
|
||||||
|
|
||||||
static const auto isMainWindow = [](GLFWwindow *window) {
|
static const auto isMainWindow = [](GLFWwindow *window) {
|
||||||
@@ -1163,7 +1185,7 @@ namespace hex {
|
|||||||
Duration passedTime = {};
|
Duration passedTime = {};
|
||||||
|
|
||||||
std::chrono::steady_clock::time_point startTime = {}, endTime = {};
|
std::chrono::steady_clock::time_point startTime = {}, endTime = {};
|
||||||
Duration requestedFrameTime = {}, remainingUnlockedTime = {};
|
Duration requestedFrameTime = {};
|
||||||
float targetFps = 0;
|
float targetFps = 0;
|
||||||
|
|
||||||
const auto nativeFps = []() -> float {
|
const auto nativeFps = []() -> float {
|
||||||
@@ -1182,32 +1204,36 @@ namespace hex {
|
|||||||
|
|
||||||
targetFps = ImHexApi::System::getTargetFPS();
|
targetFps = ImHexApi::System::getTargetFPS();
|
||||||
|
|
||||||
if (m_unlockFrameRate.exchange(false)) {
|
|
||||||
remainingUnlockedTime = std::chrono::seconds(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the target frame rate is below 15, use the current monitor's refresh rate
|
// If the target frame rate is below 15, use the current monitor's refresh rate
|
||||||
if (targetFps < 15) {
|
if (targetFps < 15) {
|
||||||
targetFps = nativeFps;
|
targetFps = nativeFps;
|
||||||
}
|
}
|
||||||
|
|
||||||
passedTime += iterationTime;
|
passedTime += iterationTime;
|
||||||
if (remainingUnlockedTime > std::chrono::nanoseconds(0)) {
|
{
|
||||||
remainingUnlockedTime -= iterationTime;
|
|
||||||
} else {
|
|
||||||
targetFps = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
requestedFrameTime = (Duration(1.0E9) / targetFps) / 1.3;
|
|
||||||
if (passedTime >= requestedFrameTime) {
|
|
||||||
std::scoped_lock lock(m_sleepMutex);
|
std::scoped_lock lock(m_sleepMutex);
|
||||||
m_sleepFlag = true;
|
|
||||||
m_sleepCondVar.notify_all();
|
|
||||||
|
|
||||||
passedTime = {};
|
if (m_remainingUnlockedTime > std::chrono::nanoseconds(0)) {
|
||||||
|
m_remainingUnlockedTime -= iterationTime;
|
||||||
|
} else {
|
||||||
|
targetFps = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
requestedFrameTime = (Duration(1.0E9) / targetFps) / 1.3;
|
||||||
|
if (passedTime >= requestedFrameTime) {
|
||||||
|
m_sleepFlag = true;
|
||||||
|
m_sleepCondVar.notify_all();
|
||||||
|
|
||||||
|
passedTime = {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
{
|
||||||
|
std::unique_lock lock(m_wakeupMutex);
|
||||||
|
m_wakeupCondVar.wait_for(lock, requestedFrameTime, [&] {
|
||||||
|
return m_wakeupFlag || stopToken.stop_requested();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
endTime = std::chrono::steady_clock::now();
|
endTime = std::chrono::steady_clock::now();
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 644 B After Width: | Height: | Size: 4.6 KiB |
@@ -1000,7 +1000,7 @@
|
|||||||
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
||||||
"hex.builtin.welcome.learn.pattern.title": "Pattern Language Dokumentation",
|
"hex.builtin.welcome.learn.pattern.title": "Pattern Language Dokumentation",
|
||||||
"hex.builtin.welcome.learn.plugins.desc": "Erweitere ImHex mit neuen Funktionen mit Plugins",
|
"hex.builtin.welcome.learn.plugins.desc": "Erweitere ImHex mit neuen Funktionen mit Plugins",
|
||||||
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
|
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
|
||||||
"hex.builtin.welcome.learn.plugins.title": "Plugins API",
|
"hex.builtin.welcome.learn.plugins.title": "Plugins API",
|
||||||
"hex.builtin.welcome.quick_settings.simplified": "Simple Ansicht",
|
"hex.builtin.welcome.quick_settings.simplified": "Simple Ansicht",
|
||||||
"hex.builtin.welcome.start.create_file": "Neue Datei erstellen",
|
"hex.builtin.welcome.start.create_file": "Neue Datei erstellen",
|
||||||
|
|||||||
@@ -1143,7 +1143,7 @@
|
|||||||
"hex.builtin.welcome.learn.imhex.link": "https://docs.werwolv.net/imhex/",
|
"hex.builtin.welcome.learn.imhex.link": "https://docs.werwolv.net/imhex/",
|
||||||
"hex.builtin.welcome.learn.imhex.title": "ImHex Documentation",
|
"hex.builtin.welcome.learn.imhex.title": "ImHex Documentation",
|
||||||
"hex.builtin.welcome.learn.plugins.desc": "Extend ImHex with additional features using plugins",
|
"hex.builtin.welcome.learn.plugins.desc": "Extend ImHex with additional features using plugins",
|
||||||
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
|
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
|
||||||
"hex.builtin.welcome.learn.plugins.title": "Plugins API",
|
"hex.builtin.welcome.learn.plugins.title": "Plugins API",
|
||||||
"hex.builtin.popup.create_workspace.title": "Create new Workspace",
|
"hex.builtin.popup.create_workspace.title": "Create new Workspace",
|
||||||
"hex.builtin.popup.create_workspace.desc": "Enter a name for the new Workspace",
|
"hex.builtin.popup.create_workspace.desc": "Enter a name for the new Workspace",
|
||||||
|
|||||||
@@ -994,7 +994,7 @@
|
|||||||
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
||||||
"hex.builtin.welcome.learn.pattern.title": "Documentación de Pattern Language",
|
"hex.builtin.welcome.learn.pattern.title": "Documentación de Pattern Language",
|
||||||
"hex.builtin.welcome.learn.plugins.desc": "Extienda ImHex con características adicionales mediante plugins",
|
"hex.builtin.welcome.learn.plugins.desc": "Extienda ImHex con características adicionales mediante plugins",
|
||||||
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
|
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
|
||||||
"hex.builtin.welcome.learn.plugins.title": "API de Plugins",
|
"hex.builtin.welcome.learn.plugins.title": "API de Plugins",
|
||||||
"hex.builtin.welcome.quick_settings.simplified": "",
|
"hex.builtin.welcome.quick_settings.simplified": "",
|
||||||
"hex.builtin.welcome.start.create_file": "Crear Nuevo Archivo",
|
"hex.builtin.welcome.start.create_file": "Crear Nuevo Archivo",
|
||||||
|
|||||||
@@ -1015,7 +1015,7 @@
|
|||||||
"hex.builtin.welcome.learn.imhex.link": "https://docs.werwolv.net/imhex/",
|
"hex.builtin.welcome.learn.imhex.link": "https://docs.werwolv.net/imhex/",
|
||||||
"hex.builtin.welcome.learn.imhex.title": "ImHex dokumentáció",
|
"hex.builtin.welcome.learn.imhex.title": "ImHex dokumentáció",
|
||||||
"hex.builtin.welcome.learn.plugins.desc": "ImHex funkcióinak bővítése bővítményekkel",
|
"hex.builtin.welcome.learn.plugins.desc": "ImHex funkcióinak bővítése bővítményekkel",
|
||||||
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
|
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
|
||||||
"hex.builtin.welcome.learn.plugins.title": "Bővítmény API",
|
"hex.builtin.welcome.learn.plugins.title": "Bővítmény API",
|
||||||
"hex.builtin.popup.create_workspace.title": "Új munkaterület létrehozása",
|
"hex.builtin.popup.create_workspace.title": "Új munkaterület létrehozása",
|
||||||
"hex.builtin.popup.create_workspace.desc": "Adjon nevet az új munkaterületnek",
|
"hex.builtin.popup.create_workspace.desc": "Adjon nevet az új munkaterületnek",
|
||||||
|
|||||||
@@ -995,7 +995,7 @@
|
|||||||
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
||||||
"hex.builtin.welcome.learn.pattern.title": "Documentazione dei Pattern",
|
"hex.builtin.welcome.learn.pattern.title": "Documentazione dei Pattern",
|
||||||
"hex.builtin.welcome.learn.plugins.desc": "Espandi l'utilizzo di ImHex con i Plugin",
|
"hex.builtin.welcome.learn.plugins.desc": "Espandi l'utilizzo di ImHex con i Plugin",
|
||||||
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
|
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
|
||||||
"hex.builtin.welcome.learn.plugins.title": "Plugins API",
|
"hex.builtin.welcome.learn.plugins.title": "Plugins API",
|
||||||
"hex.builtin.welcome.quick_settings.simplified": "",
|
"hex.builtin.welcome.quick_settings.simplified": "",
|
||||||
"hex.builtin.welcome.start.create_file": "Crea un nuovo File",
|
"hex.builtin.welcome.start.create_file": "Crea un nuovo File",
|
||||||
|
|||||||
@@ -995,7 +995,7 @@
|
|||||||
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
||||||
"hex.builtin.welcome.learn.pattern.title": "ImHexオリジナル言語について",
|
"hex.builtin.welcome.learn.pattern.title": "ImHexオリジナル言語について",
|
||||||
"hex.builtin.welcome.learn.plugins.desc": "ImHexの機能を拡張する",
|
"hex.builtin.welcome.learn.plugins.desc": "ImHexの機能を拡張する",
|
||||||
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
|
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
|
||||||
"hex.builtin.welcome.learn.plugins.title": "プラグインAPI",
|
"hex.builtin.welcome.learn.plugins.title": "プラグインAPI",
|
||||||
"hex.builtin.welcome.quick_settings.simplified": "",
|
"hex.builtin.welcome.quick_settings.simplified": "",
|
||||||
"hex.builtin.welcome.start.create_file": "新規ファイルを作成",
|
"hex.builtin.welcome.start.create_file": "新規ファイルを作成",
|
||||||
|
|||||||
@@ -995,7 +995,7 @@
|
|||||||
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
||||||
"hex.builtin.welcome.learn.pattern.title": "패턴 언어 문서",
|
"hex.builtin.welcome.learn.pattern.title": "패턴 언어 문서",
|
||||||
"hex.builtin.welcome.learn.plugins.desc": "플러그인을 사용하여 추가 기능으로 ImHex를 확장하세요",
|
"hex.builtin.welcome.learn.plugins.desc": "플러그인을 사용하여 추가 기능으로 ImHex를 확장하세요",
|
||||||
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
|
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
|
||||||
"hex.builtin.welcome.learn.plugins.title": "플러그인 API",
|
"hex.builtin.welcome.learn.plugins.title": "플러그인 API",
|
||||||
"hex.builtin.welcome.quick_settings.simplified": "단순화",
|
"hex.builtin.welcome.quick_settings.simplified": "단순화",
|
||||||
"hex.builtin.welcome.start.create_file": "새 파일 만들기",
|
"hex.builtin.welcome.start.create_file": "새 파일 만들기",
|
||||||
|
|||||||
@@ -995,7 +995,7 @@
|
|||||||
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
||||||
"hex.builtin.welcome.learn.pattern.title": "Documentação da linguagem padrão",
|
"hex.builtin.welcome.learn.pattern.title": "Documentação da linguagem padrão",
|
||||||
"hex.builtin.welcome.learn.plugins.desc": "Estenda o ImHex com recursos adicionais usando plugins",
|
"hex.builtin.welcome.learn.plugins.desc": "Estenda o ImHex com recursos adicionais usando plugins",
|
||||||
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
|
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
|
||||||
"hex.builtin.welcome.learn.plugins.title": "Plugins API",
|
"hex.builtin.welcome.learn.plugins.title": "Plugins API",
|
||||||
"hex.builtin.welcome.quick_settings.simplified": "",
|
"hex.builtin.welcome.quick_settings.simplified": "",
|
||||||
"hex.builtin.welcome.start.create_file": "Criar Novo Arquivo",
|
"hex.builtin.welcome.start.create_file": "Criar Novo Arquivo",
|
||||||
|
|||||||
@@ -1111,7 +1111,7 @@
|
|||||||
"hex.builtin.welcome.learn.imhex.link": "https://docs.werwolv.net/imhex/",
|
"hex.builtin.welcome.learn.imhex.link": "https://docs.werwolv.net/imhex/",
|
||||||
"hex.builtin.welcome.learn.imhex.title": "Документация ImHex",
|
"hex.builtin.welcome.learn.imhex.title": "Документация ImHex",
|
||||||
"hex.builtin.welcome.learn.plugins.desc": "Расширьте возможности ImHex с помощью плагинов",
|
"hex.builtin.welcome.learn.plugins.desc": "Расширьте возможности ImHex с помощью плагинов",
|
||||||
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
|
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
|
||||||
"hex.builtin.welcome.learn.plugins.title": "API плагинов",
|
"hex.builtin.welcome.learn.plugins.title": "API плагинов",
|
||||||
"hex.builtin.popup.create_workspace.title": "Создать новое пространство",
|
"hex.builtin.popup.create_workspace.title": "Создать новое пространство",
|
||||||
"hex.builtin.popup.create_workspace.desc": "Введите имя нового пространства",
|
"hex.builtin.popup.create_workspace.desc": "Введите имя нового пространства",
|
||||||
|
|||||||
@@ -1058,7 +1058,7 @@
|
|||||||
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
||||||
"hex.builtin.welcome.learn.pattern.title": "模式文档",
|
"hex.builtin.welcome.learn.pattern.title": "模式文档",
|
||||||
"hex.builtin.welcome.learn.plugins.desc": "通过插件扩展 ImHex 获得更多功能",
|
"hex.builtin.welcome.learn.plugins.desc": "通过插件扩展 ImHex 获得更多功能",
|
||||||
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
|
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
|
||||||
"hex.builtin.welcome.learn.plugins.title": "插件 API",
|
"hex.builtin.welcome.learn.plugins.title": "插件 API",
|
||||||
"hex.builtin.welcome.nightly_build": "你正在运行ImHex的夜间构建。\n\n请在GitHub问题跟踪器上报告您遇到的任何错误!",
|
"hex.builtin.welcome.nightly_build": "你正在运行ImHex的夜间构建。\n\n请在GitHub问题跟踪器上报告您遇到的任何错误!",
|
||||||
"hex.builtin.welcome.quick_settings.simplified": "简化",
|
"hex.builtin.welcome.quick_settings.simplified": "简化",
|
||||||
|
|||||||
@@ -995,7 +995,7 @@
|
|||||||
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
"hex.builtin.welcome.learn.pattern.link": "https://docs.werwolv.net/pattern-language/",
|
||||||
"hex.builtin.welcome.learn.pattern.title": "模式語言說明文件",
|
"hex.builtin.welcome.learn.pattern.title": "模式語言說明文件",
|
||||||
"hex.builtin.welcome.learn.plugins.desc": " 使用外掛程式來拓展 ImHex 的功能",
|
"hex.builtin.welcome.learn.plugins.desc": " 使用外掛程式來拓展 ImHex 的功能",
|
||||||
"hex.builtin.welcome.learn.plugins.link": "https://github.com/WerWolv/ImHex/wiki/Plugins-Development-Guide",
|
"hex.builtin.welcome.learn.plugins.link": "https://docs.werwolv.net/imhex/common/extending-imhex",
|
||||||
"hex.builtin.welcome.learn.plugins.title": "外掛程式 API",
|
"hex.builtin.welcome.learn.plugins.title": "外掛程式 API",
|
||||||
"hex.builtin.welcome.quick_settings.simplified": "",
|
"hex.builtin.welcome.quick_settings.simplified": "",
|
||||||
"hex.builtin.welcome.start.create_file": "建立新檔案",
|
"hex.builtin.welcome.start.create_file": "建立新檔案",
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ namespace hex::plugin::builtin {
|
|||||||
if (ImHexApi::System::isBorderlessWindowModeEnabled()) {
|
if (ImHexApi::System::isBorderlessWindowModeEnabled()) {
|
||||||
#if defined(OS_WINDOWS)
|
#if defined(OS_WINDOWS)
|
||||||
ImGui::SetCursorPosX(5_scaled);
|
ImGui::SetCursorPosX(5_scaled);
|
||||||
ImGui::Image(*s_logoTexture, s_logoTexture->getSize() * u32(1_scaled));
|
ImGui::Image(*s_logoTexture, s_logoTexture->getSize() * 0.1_scaled);
|
||||||
ImGui::SetCursorPosX(5_scaled);
|
ImGui::SetCursorPosX(5_scaled);
|
||||||
ImGui::InvisibleButton("##logo", ImVec2(menuBarHeight, menuBarHeight));
|
ImGui::InvisibleButton("##logo", ImVec2(menuBarHeight, menuBarHeight));
|
||||||
if (ImGui::IsItemHovered() && ImGui::IsAnyMouseDown())
|
if (ImGui::IsItemHovered() && ImGui::IsAnyMouseDown())
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ namespace hex::plugin::diffing {
|
|||||||
column.provider = -1;
|
column.provider = -1;
|
||||||
column.hexEditor.setSelectionUnchecked(std::nullopt, std::nullopt);
|
column.hexEditor.setSelectionUnchecked(std::nullopt, std::nullopt);
|
||||||
column.diffTree.clear();
|
column.diffTree.clear();
|
||||||
|
column.differences.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,32 +355,34 @@ namespace hex::plugin::diffing {
|
|||||||
// Draw changes
|
// Draw changes
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Indent();
|
ImGui::Indent();
|
||||||
switch (typeA) {
|
if (a.provider != -1 && b.provider != -1) {
|
||||||
case DifferenceType::Insertion:
|
switch (typeA) {
|
||||||
data.resize(std::min<u64>(17, (regionA.end - regionA.start) + 1));
|
case DifferenceType::Insertion:
|
||||||
providers[a.provider]->read(regionA.start, data.data(), data.size());
|
data.resize(std::min<u64>(17, (regionA.end - regionA.start) + 1));
|
||||||
drawByteString(data);
|
providers[a.provider]->read(regionA.start, data.data(), data.size());
|
||||||
break;
|
drawByteString(data);
|
||||||
case DifferenceType::Mismatch:
|
break;
|
||||||
data.resize(std::min<u64>(17, (regionA.end - regionA.start) + 1));
|
case DifferenceType::Mismatch:
|
||||||
providers[a.provider]->read(regionA.start, data.data(), data.size());
|
data.resize(std::min<u64>(17, (regionA.end - regionA.start) + 1));
|
||||||
drawByteString(data);
|
providers[a.provider]->read(regionA.start, data.data(), data.size());
|
||||||
|
drawByteString(data);
|
||||||
|
|
||||||
ImGui::SameLine(0, 0);
|
ImGui::SameLine(0, 0);
|
||||||
ImGuiExt::TextFormatted(" {} ", ICON_VS_ARROW_RIGHT);
|
ImGuiExt::TextFormatted(" {} ", ICON_VS_ARROW_RIGHT);
|
||||||
ImGui::SameLine(0, 0);
|
ImGui::SameLine(0, 0);
|
||||||
|
|
||||||
data.resize(std::min<u64>(17, (regionB.end - regionB.start) + 1));
|
data.resize(std::min<u64>(17, (regionB.end - regionB.start) + 1));
|
||||||
providers[b.provider]->read(regionB.start, data.data(), data.size());
|
providers[b.provider]->read(regionB.start, data.data(), data.size());
|
||||||
drawByteString(data);
|
drawByteString(data);
|
||||||
break;
|
break;
|
||||||
case DifferenceType::Deletion:
|
case DifferenceType::Deletion:
|
||||||
data.resize(std::min<u64>(17, (regionB.end - regionB.start) + 1));
|
data.resize(std::min<u64>(17, (regionB.end - regionB.start) + 1));
|
||||||
providers[b.provider]->read(regionB.start, data.data(), data.size());
|
providers[b.provider]->read(regionB.start, data.data(), data.size());
|
||||||
drawByteString(data);
|
drawByteString(data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ImGui::Unindent();
|
ImGui::Unindent();
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ namespace hex::plugin::disasm {
|
|||||||
|
|
||||||
// Create a capstone disassembler instance
|
// Create a capstone disassembler instance
|
||||||
if (currArchitecture->start()) {
|
if (currArchitecture->start()) {
|
||||||
|
ON_SCOPE_EXIT {
|
||||||
|
currArchitecture->end();
|
||||||
|
};
|
||||||
|
|
||||||
std::vector<u8> buffer(1_MiB, 0x00);
|
std::vector<u8> buffer(1_MiB, 0x00);
|
||||||
|
|
||||||
const u64 codeOffset = region.getStartAddress() - m_imageBaseAddress;
|
const u64 codeOffset = region.getStartAddress() - m_imageBaseAddress;
|
||||||
@@ -93,8 +97,6 @@ namespace hex::plugin::disasm {
|
|||||||
if (hadError) break;
|
if (hadError) break;
|
||||||
hadError = true;
|
hadError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
currArchitecture->end();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -136,59 +138,64 @@ namespace hex::plugin::disasm {
|
|||||||
auto ®ion = m_regionToDisassemble.get(provider);
|
auto ®ion = m_regionToDisassemble.get(provider);
|
||||||
auto &range = m_range.get(provider);
|
auto &range = m_range.get(provider);
|
||||||
|
|
||||||
// Draw region selection picker
|
ImGui::BeginDisabled(m_disassemblerTask.isRunning());
|
||||||
ui::regionSelectionPicker(®ion, provider, &range, true, true);
|
|
||||||
|
|
||||||
ImGuiExt::Header("hex.disassembler.view.disassembler.position"_lang);
|
|
||||||
|
|
||||||
// Draw base address input
|
|
||||||
{
|
{
|
||||||
auto &address = m_imageLoadAddress.get(provider);
|
// Draw region selection picker
|
||||||
ImGuiExt::InputHexadecimal("hex.disassembler.view.disassembler.image_load_address"_lang, &address, ImGuiInputTextFlags_CharsHexadecimal);
|
ui::regionSelectionPicker(®ion, provider, &range, true, true);
|
||||||
ImGui::SameLine();
|
|
||||||
ImGuiExt::HelpHover("hex.disassembler.view.disassembler.image_load_address.hint"_lang, ICON_VS_INFO);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw code region start address input
|
ImGuiExt::Header("hex.disassembler.view.disassembler.position"_lang);
|
||||||
ImGui::BeginDisabled(m_range == ui::RegionType::EntireData);
|
|
||||||
{
|
// Draw base address input
|
||||||
auto &address = m_imageBaseAddress.get(provider);
|
{
|
||||||
ImGuiExt::InputHexadecimal("hex.disassembler.view.disassembler.image_base_address"_lang, &address, ImGuiInputTextFlags_CharsHexadecimal);
|
auto &address = m_imageLoadAddress.get(provider);
|
||||||
ImGui::SameLine();
|
ImGuiExt::InputHexadecimal("hex.disassembler.view.disassembler.image_load_address"_lang, &address, ImGuiInputTextFlags_CharsHexadecimal);
|
||||||
ImGuiExt::HelpHover("hex.disassembler.view.disassembler.image_base_address.hint"_lang, ICON_VS_INFO);
|
ImGui::SameLine();
|
||||||
|
ImGuiExt::HelpHover("hex.disassembler.view.disassembler.image_load_address.hint"_lang, ICON_VS_INFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw code region start address input
|
||||||
|
ImGui::BeginDisabled(m_range == ui::RegionType::EntireData);
|
||||||
|
{
|
||||||
|
auto &address = m_imageBaseAddress.get(provider);
|
||||||
|
ImGuiExt::InputHexadecimal("hex.disassembler.view.disassembler.image_base_address"_lang, &address, ImGuiInputTextFlags_CharsHexadecimal);
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGuiExt::HelpHover("hex.disassembler.view.disassembler.image_base_address.hint"_lang, ICON_VS_INFO);
|
||||||
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
|
// Draw settings
|
||||||
|
{
|
||||||
|
ImGuiExt::Header("hex.ui.common.settings"_lang);
|
||||||
|
|
||||||
|
// Draw architecture selector
|
||||||
|
const auto &architectures = ContentRegistry::Disassembler::impl::getArchitectures();
|
||||||
|
if (architectures.empty()) {
|
||||||
|
ImGuiExt::TextSpinner("hex.disassembler.view.disassembler.arch"_lang);
|
||||||
|
} else {
|
||||||
|
const auto &currArchitecture = m_currArchitecture.get(provider);
|
||||||
|
if (currArchitecture == nullptr) {
|
||||||
|
m_currArchitecture = architectures.begin()->second();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::BeginCombo("hex.disassembler.view.disassembler.arch"_lang, currArchitecture->getName().c_str())) {
|
||||||
|
for (const auto &[name, creator] : architectures) {
|
||||||
|
if (ImGui::Selectable(name.c_str(), name == currArchitecture->getName())) {
|
||||||
|
m_currArchitecture = creator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw sub-settings for each architecture
|
||||||
|
if (ImGuiExt::BeginBox()) {
|
||||||
|
currArchitecture->drawSettings();
|
||||||
|
}
|
||||||
|
ImGuiExt::EndBox();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
// Draw settings
|
|
||||||
{
|
|
||||||
ImGuiExt::Header("hex.ui.common.settings"_lang);
|
|
||||||
|
|
||||||
// Draw architecture selector
|
|
||||||
const auto &architectures = ContentRegistry::Disassembler::impl::getArchitectures();
|
|
||||||
if (architectures.empty()) {
|
|
||||||
ImGuiExt::TextSpinner("hex.disassembler.view.disassembler.arch"_lang);
|
|
||||||
} else {
|
|
||||||
const auto &currArchitecture = m_currArchitecture.get(provider);
|
|
||||||
if (currArchitecture == nullptr) {
|
|
||||||
m_currArchitecture = architectures.begin()->second();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::BeginCombo("hex.disassembler.view.disassembler.arch"_lang, currArchitecture->getName().c_str())) {
|
|
||||||
for (const auto &[name, creator] : architectures) {
|
|
||||||
if (ImGui::Selectable(name.c_str(), name == currArchitecture->getName())) {
|
|
||||||
m_currArchitecture = creator();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::EndCombo();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw sub-settings for each architecture
|
|
||||||
if (ImGuiExt::BeginBox()) {
|
|
||||||
currArchitecture->drawSettings();
|
|
||||||
}
|
|
||||||
ImGuiExt::EndBox();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw disassemble button
|
// Draw disassemble button
|
||||||
ImGui::BeginDisabled(m_disassemblerTask.isRunning() || region.getStartAddress() < m_imageBaseAddress);
|
ImGui::BeginDisabled(m_disassemblerTask.isRunning() || region.getStartAddress() < m_imageBaseAddress);
|
||||||
|
|||||||
@@ -37,13 +37,18 @@ namespace hex::fonts {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 index = 0;
|
||||||
for (const auto &[path, fontName] : hex::getFonts()) {
|
for (const auto &[path, fontName] : hex::getFonts()) {
|
||||||
|
ImGui::PushID(index);
|
||||||
if (ImGui::Selectable(limitStringLength(fontName, 50).c_str(), m_path == path)) {
|
if (ImGui::Selectable(limitStringLength(fontName, 50).c_str(), m_path == path)) {
|
||||||
m_path = path;
|
m_path = path;
|
||||||
m_pixelPerfectFont = false;
|
m_pixelPerfectFont = false;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
ImGui::SetItemTooltip("%s", fontName.c_str());
|
ImGui::SetItemTooltip("%s", fontName.c_str());
|
||||||
|
ImGui::PopID();
|
||||||
|
|
||||||
|
index += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndCombo();
|
ImGui::EndCombo();
|
||||||
|
|||||||
@@ -65,7 +65,9 @@ namespace hex::fonts {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadFont(widget, name, &font, ImHexApi::System::getGlobalScale() * ImHexApi::System::getBackingScaleFactor());
|
TaskManager::doLater([&name, &font, &widget] {
|
||||||
|
loadFont(widget, name, &font, ImHexApi::System::getGlobalScale() * ImHexApi::System::getBackingScaleFactor());
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
loadFont(widget.getWidget(), name, &font, ImHexApi::System::getGlobalScale() * ImHexApi::System::getBackingScaleFactor());
|
loadFont(widget.getWidget(), name, &font, ImHexApi::System::getGlobalScale() * ImHexApi::System::getBackingScaleFactor());
|
||||||
|
|||||||
Reference in New Issue
Block a user