From 3d01b78ba07b5805cb112d29f51d310f46038661 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 3 Aug 2025 17:55:32 +0200 Subject: [PATCH] build: Allow building and running on 32 bit Windows --- CMakePresets.json | 14 +++++++++++++- .../imgui/backend/include/opengl_support.h | 9 +++------ .../imgui/backend/source/imgui_impl_opengl3.cpp | 6 +++--- .../source/content/tools/file_tool_splitter.cpp | 2 +- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 2681eae26..1ae409456 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -55,7 +55,19 @@ "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", "VCPKG_MANIFEST_DIR": "${sourceDir}/dist" } - } + }, + { + "name": "vs2022-x86", + "displayName": "Visual Studio 2022 x86", + "generator": "Visual Studio 17 2022", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_GENERATOR_PLATFORM": "Win32", + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "VCPKG_MANIFEST_DIR": "${sourceDir}/dist" + } + } ], "buildPresets": [ { diff --git a/lib/third_party/imgui/backend/include/opengl_support.h b/lib/third_party/imgui/backend/include/opengl_support.h index 8e77b3230..fd4d19504 100644 --- a/lib/third_party/imgui/backend/include/opengl_support.h +++ b/lib/third_party/imgui/backend/include/opengl_support.h @@ -1,11 +1,8 @@ #pragma once -#if !defined(WINGDIAPI) -#define WINGDIAPI extern "C" -#endif - -#if !defined(APIENTRY) - #define APIENTRY +#if defined(OS_WINDOWS) + #include + #include #endif #if defined(OS_WEB) diff --git a/lib/third_party/imgui/backend/source/imgui_impl_opengl3.cpp b/lib/third_party/imgui/backend/source/imgui_impl_opengl3.cpp index 879b6048f..44549e150 100644 --- a/lib/third_party/imgui/backend/source/imgui_impl_opengl3.cpp +++ b/lib/third_party/imgui/backend/source/imgui_impl_opengl3.cpp @@ -120,9 +120,9 @@ #endif // IMHEX PATCH BEGIN -#if !defined(WINGDIAPI) -#define WINGDIAPI extern "C" -#define APIENTRY +#if defined(WIN32) +#include +#include #endif // IMHEX PATCH END diff --git a/plugins/builtin/source/content/tools/file_tool_splitter.cpp b/plugins/builtin/source/content/tools/file_tool_splitter.cpp index a52961cee..b7a43330a 100644 --- a/plugins/builtin/source/content/tools/file_tool_splitter.cpp +++ b/plugins/builtin/source/content/tools/file_tool_splitter.cpp @@ -77,7 +77,7 @@ namespace hex::plugin::builtin { } } ImGui::EndDisabled(); - ImGui::BeginDisabled(splitterTask.isRunning() || selectedItem != sizes.size() - 1); + ImGui::BeginDisabled(splitterTask.isRunning() || selectedItem != (i64(sizes.size()) - 1)); { ImGui::InputScalar("###custom_size", ImGuiDataType_U64, &splitSize); ImGui::SameLine();