From 0f2828da40baa52f72093ae231bd7e34dfbaed92 Mon Sep 17 00:00:00 2001 From: Will Toohey Date: Mon, 3 Jan 2022 16:48:12 +1000 Subject: [PATCH] jbhook: make errors right-side-up as well --- src/main/jbhook-util/gfx.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/jbhook-util/gfx.c b/src/main/jbhook-util/gfx.c index c55b1a6..c8c8c53 100644 --- a/src/main/jbhook-util/gfx.c +++ b/src/main/jbhook-util/gfx.c @@ -27,6 +27,8 @@ static void (__stdcall *real_glFlush)(void); static void hook_glBindFramebufferEXT(GLenum target, GLuint framebuffer); static void (*real_glBindFramebufferEXT)(GLenum target, GLuint framebuffer); +static void hook_infodispcore_set_angle(void* this, int angle); + static const struct hook_symbol jbhook1_opengl_hook_syms[] = { {.name = "glFlush", .patch = hook_glFlush, @@ -39,6 +41,12 @@ static const struct hook_symbol jbhook1_glhelper_hook_syms[] = { .link = (void **) &real_glBindFramebufferEXT}, }; +// on knit/copious, this gives us right-side-up errors, too! +static const struct hook_symbol jbhook_infodisp_hook_syms[] = { + {.name = "?set_angle@infodispcore@@QAEXH@Z", + .patch = hook_infodispcore_set_angle}, +}; + static DWORD STDCALL my_GetGlyphOutline( HDC hdc, UINT uChar, @@ -117,9 +125,19 @@ void jbhook_util_gfx_install_vertical_hooks(void) { jbhook1_glhelper_hook_syms, lengthof(jbhook1_glhelper_hook_syms)); + hook_table_apply( + NULL, + "infodisp.dll", + jbhook_infodisp_hook_syms, + lengthof(jbhook_infodisp_hook_syms)); + log_info("Inserted vertical display hooks"); } +static void hook_infodispcore_set_angle(void* this, int angle) { + // ignore +} + // Welcome to OpenGL land! There is a ton of boilerplate needed here "just" to // rotate the render output