mirror of
https://github.com/izzy2lost/libultraship.git
synced 2026-06-19 01:16:13 -07:00
Add ImGui patch for Gamepad Update, Stormlib patch tweak (#677)
* Add and implement patch to remove a return in the SDL implementation preventing gamepad update when menubar is closed. * Incorporate latest Stormlib patch tweak, and apply it to the gamepad patch as well. * Fix whitespacing.
This commit is contained in:
@@ -2,11 +2,22 @@ include(FetchContent)
|
||||
|
||||
find_package(OpenGL QUIET)
|
||||
|
||||
# When using the Visual Studio generator, it is necessary to suppress stderr output entirely so it does not interrupt the patch command.
|
||||
# Redirecting to nul is used here instead of the `--quiet` flag, as that flag was only recently introduced in git 2.25.0 (Jan 2022)
|
||||
if (CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
set(git_hide_output 2> nul)
|
||||
endif()
|
||||
|
||||
#=================== ImGui ===================
|
||||
set(sdl_gamepad_patch git apply ${CMAKE_CURRENT_SOURCE_DIR}/cmake/dependencies/patches/sdl-gamepad-fix.patch)
|
||||
|
||||
# Applies the patch or checks if it has already been applied successfully previously. Will error otherwise.
|
||||
set(sdl_apply_patch_if_needed ${sdl_gamepad_patch} ${git_hide_output} || ${sdl_gamepad_patch} --reverse --check)
|
||||
FetchContent_Declare(
|
||||
ImGui
|
||||
GIT_REPOSITORY https://github.com/ocornut/imgui.git
|
||||
GIT_TAG v1.90.6-docking
|
||||
PATCH_COMMAND ${sdl_apply_patch_if_needed}
|
||||
)
|
||||
FetchContent_MakeAvailable(ImGui)
|
||||
list(APPEND ADDITIONAL_LIB_INCLUDES ${imgui_SOURCE_DIR} ${imgui_SOURCE_DIR}/backends)
|
||||
@@ -34,9 +45,9 @@ target_include_directories(ImGui PUBLIC ${imgui_SOURCE_DIR} ${imgui_SOURCE_DIR}/
|
||||
# ========= StormLib =============
|
||||
if(NOT EXCLUDE_MPQ_SUPPORT)
|
||||
set(stormlib_patch_file ${CMAKE_CURRENT_SOURCE_DIR}/cmake/dependencies/patches/stormlib-optimizations.patch)
|
||||
|
||||
# Applies the patch or checks if it has already been applied successfully previously. Will error otherwise.
|
||||
# The `--quiet` flag is necessary to prevent stderr output from interupting the command when run inside Visual Studio.
|
||||
set(stormlib_apply_patch_if_needed git apply --quiet ${stormlib_patch_file} || git apply --reverse --check ${stormlib_patch_file})
|
||||
set(stormlib_apply_patch_if_needed git apply --quiet ${stormlib_patch_file} ${git_hide_output} || git apply --reverse --check ${stormlib_patch_file})
|
||||
|
||||
FetchContent_Declare(
|
||||
StormLib
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
backends/imgui_impl_sdl2.cpp | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/backends/imgui_impl_sdl2.cpp b/backends/imgui_impl_sdl2.cpp
|
||||
index 569b01d1..c2f84dca 100644
|
||||
--- a/backends/imgui_impl_sdl2.cpp
|
||||
+++ b/backends/imgui_impl_sdl2.cpp
|
||||
@@ -770,9 +770,6 @@ static void ImGui_ImplSDL2_UpdateGamepads()
|
||||
bd->WantUpdateGamepadsList = false;
|
||||
}
|
||||
|
||||
- // FIXME: Technically feeding gamepad shouldn't depend on this now that they are regular inputs.
|
||||
- if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
|
||||
- return;
|
||||
io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad;
|
||||
if (bd->Gamepads.Size == 0)
|
||||
return;
|
||||
Reference in New Issue
Block a user