From d4050d3e39389329cfd571e5c4663aeb8a4c486a Mon Sep 17 00:00:00 2001 From: Michael Theall Date: Sun, 17 Nov 2024 01:19:41 -0600 Subject: [PATCH] Update to Dear ImGui v1.91.5 --- CMakeLists.txt | 14 +++++++++----- imgui.patch | 16 ++++++++++++++++ source/3ds/imgui_ctru.cpp | 4 ++-- source/switch/imgui_nx.cpp | 4 ++-- 4 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 imgui.patch diff --git a/CMakeLists.txt b/CMakeLists.txt index 67af808..a1d6724 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.12) -project(ftpd VERSION 3.2.0) +project(ftpd VERSION 3.2.1) if(CMAKE_EXPORT_COMPILE_COMMANDS) list(APPEND CMAKE_C_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}) @@ -8,16 +8,20 @@ if(CMAKE_EXPORT_COMPILE_COMMANDS) endif() include(FetchContent) +cmake_policy(SET CMP0169 OLD) FetchContent_Declare(gsl - GIT_REPOSITORY https://github.com/microsoft/GSL.git - GIT_TAG v4.0.0 + URL https://github.com/microsoft/GSL/archive/refs/tags/v4.1.0.tar.gz + URL_HASH MD5=7e6883a254e73a8b2368a0d26efe68a7 + DOWNLOAD_EXTRACT_TIMESTAMP FALSE ) FetchContent_Populate(gsl) FetchContent_Declare(imgui - GIT_REPOSITORY https://github.com/ocornut/imgui.git - GIT_TAG v1.91.4 + URL https://github.com/ocornut/imgui/archive/refs/tags/v1.91.5.tar.gz + URL_HASH MD5=264b2c35eaa1ab1595eb9afe080b4e1a + DOWNLOAD_EXTRACT_TIMESTAMP FALSE + PATCH_COMMAND patch -i ${CMAKE_CURRENT_SOURCE_DIR}/imgui.patch ) FetchContent_Populate(imgui) diff --git a/imgui.patch b/imgui.patch new file mode 100644 index 0000000..fa128a1 --- /dev/null +++ b/imgui.patch @@ -0,0 +1,16 @@ +--- imgui.cpp ++++ imgui.cpp +@@ -13711,7 +13711,13 @@ + g.NavWindowingListWindow = FindWindowByName("###NavWindowingList"); + const ImGuiViewport* viewport = GetMainViewport(); + SetNextWindowSizeConstraints(ImVec2(viewport->Size.x * 0.20f, viewport->Size.y * 0.20f), ImVec2(FLT_MAX, FLT_MAX)); ++#ifdef __3DS__ ++ // center on top screen ++ ImVec2 center = viewport->GetCenter(); ++ SetNextWindowPos(ImVec2(center.x, center.y * 0.5f), ImGuiCond_Always, ImVec2(0.5f, 0.5f)); ++#else + SetNextWindowPos(viewport->GetCenter(), ImGuiCond_Always, ImVec2(0.5f, 0.5f)); ++#endif + PushStyleVar(ImGuiStyleVar_WindowPadding, g.Style.WindowPadding * 2.0f); + Begin("###NavWindowingList", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings); + if (g.ContextName[0] != 0) diff --git a/source/3ds/imgui_ctru.cpp b/source/3ds/imgui_ctru.cpp index a786933..7fd95eb 100644 --- a/source/3ds/imgui_ctru.cpp +++ b/source/3ds/imgui_ctru.cpp @@ -173,8 +173,8 @@ void updateKeyboard (ImGuiIO &io_) swkbdInit (&kbd, SWKBD_TYPE_NORMAL, 2, -1); swkbdSetButton (&kbd, SWKBD_BUTTON_LEFT, "Cancel", false); swkbdSetButton (&kbd, SWKBD_BUTTON_RIGHT, "OK", true); - swkbdSetInitialText ( - &kbd, std::string (textState.InitialTextA.Data, textState.InitialTextA.Size).c_str ()); + swkbdSetInitialText (&kbd, + std::string (textState.TextToRevertTo.Data, textState.TextToRevertTo.Size).c_str ()); if (textState.Flags & ImGuiInputTextFlags_Password) swkbdSetPasswordMode (&kbd, SWKBD_PASSWORD_HIDE_DELAY); diff --git a/source/switch/imgui_nx.cpp b/source/switch/imgui_nx.cpp index 43d0792..8fe3ecb 100644 --- a/source/switch/imgui_nx.cpp +++ b/source/switch/imgui_nx.cpp @@ -1571,8 +1571,8 @@ void updateKeyboard (HidKeyboardState const &kbState_, ImGuiIO &io_) SwkbdConfig kbd; swkbdCreate (&kbd, 0); swkbdConfigMakePresetDefault (&kbd); - swkbdConfigSetInitialText ( - &kbd, std::string (textState.InitialTextA.Data, textState.InitialTextA.Size).c_str ()); + swkbdConfigSetInitialText (&kbd, + std::string (textState.TextToRevertTo.Data, textState.TextToRevertTo.Size).c_str ()); char buffer[32]; if (R_SUCCEEDED (swkbdShow (&kbd, buffer, sizeof (buffer))))