Files
scummvm/backends/imgui/scummvm.patch
T
2024-05-17 22:20:02 +02:00

158 lines
6.5 KiB
Diff

diff --color -ru ./backends/imgui_impl_opengl3.cpp ../scummvm/scummvm/backends/imgui/backends/imgui_impl_opengl3.cpp
--- ./backends/imgui_impl_opengl3.cpp 2024-05-17 21:59:13
+++ ../scummvm/scummvm/backends/imgui/backends/imgui_impl_opengl3.cpp 2024-05-17 22:13:02
@@ -111,7 +111,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>
@@ -163,6 +163,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 -ru ./backends/imgui_impl_opengl3.h ../scummvm/scummvm/backends/imgui/backends/imgui_impl_opengl3.h
--- ./backends/imgui_impl_opengl3.h 2024-05-17 21:59:13
+++ ../scummvm/scummvm/backends/imgui/backends/imgui_impl_opengl3.h 2024-05-17 22:19:04
@@ -26,7 +26,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
// Backend API
@@ -55,7 +55,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 -ru ./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 21:59:13
+++ ../scummvm/scummvm/backends/imgui/backends/imgui_impl_opengl3_loader.h 2024-05-17 22:13:02
@@ -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;
@@ -118,7 +123,7 @@
** included as <GL/glcorearb.h>.
**
** glcorearb.h includes only APIs in the latest OpenGL core profile
-** implementation together with APIs in newer ARB extensions which
+** implementation together with APIs in newer ARB extensions which
** can be supported by the core profile. It does not, and never will
** include functionality removed from the core profile, such as
** fixed-function vertex and fragment processing.
@@ -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 -ru ./backends/imgui_impl_sdl2.cpp ../scummvm/scummvm/backends/imgui/backends/imgui_impl_sdl2.cpp
--- ./backends/imgui_impl_sdl2.cpp 2024-05-17 21:59:13
+++ ../scummvm/scummvm/backends/imgui/backends/imgui_impl_sdl2.cpp 2024-05-17 22:13:02
@@ -77,9 +77,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__)
@@ -299,6 +301,11 @@
io.AddKeyEvent(ImGuiMod_Super, (sdl_key_mods & KMOD_GUI) != 0);
}
+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.
@@ -751,4 +758,5 @@
#pragma clang diagnostic pop
#endif
+#endif
#endif // #ifndef IMGUI_DISABLE
diff --color -ru ./backends/imgui_impl_sdl2.h ../scummvm/scummvm/backends/imgui/backends/imgui_impl_sdl2.h
--- ./backends/imgui_impl_sdl2.h 2024-05-17 21:59:13
+++ ../scummvm/scummvm/backends/imgui/backends/imgui_impl_sdl2.h 2024-05-17 22:14:06
@@ -19,7 +19,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;
@@ -36,6 +36,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 -ru ./imgui.h ../scummvm/scummvm/backends/imgui/imgui.h
--- ./imgui.h 2024-05-17 21:59:13
+++ ../scummvm/scummvm/backends/imgui/imgui.h 2024-05-17 22:13:02
@@ -99,8 +99,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)