Files
scummvm/backends/imgui/scummvm.patch
T

221 lines
9.1 KiB
Diff

diff --color -rbu ./backends/imgui_impl_opengl3.cpp ../scummvm/scummvm/backends/imgui/backends/imgui_impl_opengl3.cpp
--- ./backends/imgui_impl_opengl3.cpp 2024-10-07 18:21:01
+++ ../scummvm/scummvm/backends/imgui/backends/imgui_impl_opengl3.cpp 2024-10-07 18:30:56
@@ -114,7 +114,7 @@
#define _CRT_SECURE_NO_WARNINGS
#endif
-#include "imgui.h"
+#include "backends/imgui/imgui.h"
#ifndef IMGUI_DISABLE
#include "imgui_impl_opengl3.h"
#include <stdio.h>
@@ -167,6 +167,7 @@
// - You may need to regenerate imgui_impl_opengl3_loader.h to add new symbols. See https://github.com/dearimgui/gl3w_stripped
// - You can temporarily use an unstripped version. See https://github.com/dearimgui/gl3w_stripped/releases
// Changes to this backend using new APIs should be accompanied by a regenerated stripped loader version.
+#define IMGL3W_SCUMMVM_LOADER
#define IMGL3W_IMPL
#include "imgui_impl_opengl3_loader.h"
#endif
diff --color -rbu ./backends/imgui_impl_opengl3.h ../scummvm/scummvm/backends/imgui/backends/imgui_impl_opengl3.h
--- ./backends/imgui_impl_opengl3.h 2024-10-07 18:21:01
+++ ../scummvm/scummvm/backends/imgui/backends/imgui_impl_opengl3.h 2024-10-07 18:30:56
@@ -27,7 +27,7 @@
// Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp.
#pragma once
-#include "imgui.h" // IMGUI_IMPL_API
+#include "backends/imgui/imgui.h" // IMGUI_IMPL_API
#ifndef IMGUI_DISABLE
// Follow "Getting Started" link and check examples/ folder to learn about using backends!
@@ -56,7 +56,7 @@
#endif
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__))
#define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es"
-#elif defined(__EMSCRIPTEN__) || defined(__amigaos4__)
+#elif defined(__EMSCRIPTEN__)
#define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100"
#else
// Otherwise imgui_impl_opengl3_loader.h will be used.
diff --color -rbu ./backends/imgui_impl_opengl3_loader.h ../scummvm/scummvm/backends/imgui/backends/imgui_impl_opengl3_loader.h
--- ./backends/imgui_impl_opengl3_loader.h 2024-05-17 22:26:35
+++ ../scummvm/scummvm/backends/imgui/backends/imgui_impl_opengl3_loader.h 2024-10-07 18:30:56
@@ -56,6 +56,11 @@
#ifndef __gl3w_h_
#define __gl3w_h_
+#if defined(IMGL3W_SCUMMVM_LOADER)
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "common/system.h"
+#endif
+
// Adapted from KHR/khrplatform.h to avoid including entire file.
#ifndef __khrplatform_h_
typedef float khronos_float_t;
@@ -614,7 +619,20 @@
#define GL3W_ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-#if defined(_WIN32)
+#if defined(IMGL3W_SCUMMVM_LOADER)
+static int open_libgl(void)
+{
+ return GL3W_OK;
+}
+
+static void close_libgl(void) { }
+
+static GL3WglProc get_proc(const char *proc)
+{
+ return (GL3WglProc)g_system->getOpenGLProcAddress(proc);
+}
+
+#elif defined(_WIN32)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
diff --color -rbu ./backends/imgui_impl_sdl2.cpp ../scummvm/scummvm/backends/imgui/backends/imgui_impl_sdl2.cpp
--- ./backends/imgui_impl_sdl2.cpp 2024-10-07 18:21:01
+++ ../scummvm/scummvm/backends/imgui/backends/imgui_impl_sdl2.cpp 2024-10-07 18:30:56
@@ -92,9 +92,11 @@
// 2017-08-25: Inputs: MousePos set to -FLT_MAX,-FLT_MAX when mouse is unavailable/missing (instead of -1,-1).
// 2016-10-15: Misc: Added a void* user_data parameter to Clipboard function handlers.
-#include "imgui.h"
+#include "backends/imgui/imgui.h"
#ifndef IMGUI_DISABLE
+#include "backends/platform/sdl/sdl.h"
#include "imgui_impl_sdl2.h"
+#if SDL_VERSION_ATLEAST(2, 0, 0)
// Clang warnings with -Weverything
#if defined(__clang__)
@@ -128,7 +128,8 @@
#define SDL_HAS_DISPLAY_EVENT SDL_VERSION_ATLEAST(2,0,9)
#define SDL_HAS_SHOW_WINDOW_ACTIVATION_HINT SDL_VERSION_ATLEAST(2,0,18)
#if SDL_HAS_VULKAN
-extern "C" { extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window* window, int* w, int* h); }
+//extern "C" { extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window* window, int* w, int* h); }
+#include <SDL_vulkan.h>
#elif
static const Uint32 SDL_WINDOW_VULKAN = 0x10000000;
#endif
@@ -346,6 +348,11 @@
return ImGui::FindViewportByPlatformHandle((void*)(intptr_t)window_id);
}
+bool ImGui_ImplSDL2_Ready()
+{
+ return ImGui_ImplSDL2_GetBackendData() != nullptr;
+}
+
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application, or clear/overwrite your copy of the mouse data.
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application, or clear/overwrite your copy of the keyboard data.
@@ -1201,4 +1208,5 @@
#pragma clang diagnostic pop
#endif
+#endif
#endif // #ifndef IMGUI_DISABLE
diff --color -rbu ./backends/imgui_impl_sdl2.h ../scummvm/scummvm/backends/imgui/backends/imgui_impl_sdl2.h
--- ./backends/imgui_impl_sdl2.h 2024-10-07 18:21:01
+++ ../scummvm/scummvm/backends/imgui/backends/imgui_impl_sdl2.h 2024-10-07 18:30:56
@@ -23,7 +23,7 @@
// - Introduction, links and more at the top of imgui.cpp
#pragma once
-#include "imgui.h" // IMGUI_IMPL_API
+#include "backends/imgui/imgui.h" // IMGUI_IMPL_API
#ifndef IMGUI_DISABLE
struct SDL_Window;
@@ -41,6 +41,7 @@
IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown();
IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame();
IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event);
+IMGUI_IMPL_API bool ImGui_ImplSDL2_Ready();
// Gamepad selection automatically starts in AutoFirst mode, picking first available SDL_Gamepad. You may override this.
// When using manual mode, caller is responsible for opening/closing gamepad.
diff --color -rbu ./backends/imgui_impl_sdlrenderer2.cpp ../scummvm/scummvm/backends/imgui/backends/imgui_impl_sdlrenderer2.cpp
--- ./backends/imgui_impl_sdlrenderer2.cpp 2024-05-22 17:43:07
+++ ../scummvm/scummvm/backends/imgui/backends/imgui_impl_sdlrenderer2.cpp 2024-10-07 18:30:56
@@ -30,7 +30,7 @@
// 2021-10-06: Backup and restore modified ClipRect/Viewport.
// 2021-09-21: Initial version.
-#include "imgui.h"
+#include "backends/imgui/imgui.h"
#ifndef IMGUI_DISABLE
#include "imgui_impl_sdlrenderer2.h"
#include <stdint.h> // intptr_t
diff --color -rbu ./backends/imgui_impl_sdlrenderer2.h ../scummvm/scummvm/backends/imgui/backends/imgui_impl_sdlrenderer2.h
--- ./backends/imgui_impl_sdlrenderer2.h 2024-10-07 18:21:01
+++ ../scummvm/scummvm/backends/imgui/backends/imgui_impl_sdlrenderer2.h 2024-10-07 18:30:56
@@ -22,8 +22,8 @@
// - Introduction, links and more at the top of imgui.cpp
#pragma once
+#include "backends/imgui/imgui.h" // IMGUI_IMPL_API
#ifndef IMGUI_DISABLE
-#include "imgui.h" // IMGUI_IMPL_API
struct SDL_Renderer;
diff --color -rbu ./imgui.h ../scummvm/scummvm/backends/imgui/imgui.h
--- ./imgui.h 2024-10-07 18:21:01
+++ ../scummvm/scummvm/backends/imgui/imgui.h 2024-10-07 18:30:56
@@ -105,8 +105,10 @@
#define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1)))
#define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0)))
#elif !defined(IMGUI_USE_STB_SPRINTF) && (defined(__clang__) || defined(__GNUC__))
-#define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1)))
-#define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0)))
+//#define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1)))
+//#define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0)))
+#define IM_FMTARGS(FMT)
+#define IM_FMTLIST(FMT)
#else
#define IM_FMTARGS(FMT)
#define IM_FMTLIST(FMT)
diff --color -rbu ./misc/freetype/imgui_freetype.cpp ../scummvm/scummvm/backends/imgui/misc/freetype/imgui_freetype.cpp
--- ./misc/freetype/imgui_freetype.cpp 2024-10-07 18:21:01
+++ ../scummvm/scummvm/backends/imgui/misc/freetype/imgui_freetype.cpp 2024-10-07 18:32:37
@@ -34,10 +34,10 @@
// FIXME: cfg.OversampleH, OversampleV are not supported (but perhaps not so necessary with this rasterizer).
-#include "imgui.h"
+#include "backends/imgui/imgui.h"
#ifndef IMGUI_DISABLE
#include "imgui_freetype.h"
-#include "imgui_internal.h" // ImMin,ImMax,ImFontAtlasBuild*,
+#include "backends/imgui/imgui_internal.h" // ImMin,ImMax,ImFontAtlasBuild*,
#include <stdint.h>
#include <ft2build.h>
#include FT_FREETYPE_H // <freetype/freetype.h>
@@ -396,7 +396,7 @@
#ifdef IMGUI_STB_RECT_PACK_FILENAME
#include IMGUI_STB_RECT_PACK_FILENAME
#else
-#include "imstb_rectpack.h"
+#include "backends/imgui/imstb_rectpack.h"
#endif
#endif
diff --color -rbu ./misc/freetype/imgui_freetype.h ../scummvm/scummvm/backends/imgui/misc/freetype/imgui_freetype.h
--- ./misc/freetype/imgui_freetype.h 2024-05-13 22:08:39
+++ ../scummvm/scummvm/backends/imgui/misc/freetype/imgui_freetype.h 2024-10-07 18:32:44
@@ -2,7 +2,7 @@
// (headers)
#pragma once
-#include "imgui.h" // IMGUI_API
+#include "backends/imgui/imgui.h" // IMGUI_API
#ifndef IMGUI_DISABLE
// Forward declarations