From 3b05bd75c6ee627eb020d53a71295dae05fd8bff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gallet?= Date: Tue, 31 Jan 2023 14:52:32 +0100 Subject: [PATCH] Remove hud compile option --- configure.ac | 50 ++++++--------- src/library/BusyLoopDetection.cpp | 4 -- src/library/DeterministicTimer.cpp | 4 -- src/library/checkpoint/SaveStateManager.cpp | 2 - src/library/eglwrappers.cpp | 5 -- src/library/frame.cpp | 62 +------------------ src/library/frame.h | 4 -- src/library/glxwrappers.cpp | 4 -- src/library/renderhud/RenderHUD.cpp | 3 - src/library/renderhud/RenderHUD.h | 2 - .../renderhud/RenderHUD_Base_Linux.cpp | 3 - src/library/renderhud/RenderHUD_Base_Linux.h | 2 - .../renderhud/RenderHUD_Base_MacOS.cpp | 3 - src/library/renderhud/RenderHUD_Base_MacOS.h | 3 - src/library/renderhud/RenderHUD_GL.cpp | 3 - src/library/renderhud/RenderHUD_GL.h | 3 - src/library/renderhud/RenderHUD_SDL1.cpp | 3 - src/library/renderhud/RenderHUD_SDL1.h | 3 - .../renderhud/RenderHUD_SDL2_renderer.cpp | 3 - .../renderhud/RenderHUD_SDL2_renderer.h | 3 - .../renderhud/RenderHUD_SDL2_surface.cpp | 3 - .../renderhud/RenderHUD_SDL2_surface.h | 3 - src/library/renderhud/RenderHUD_VDPAU.cpp | 3 - src/library/renderhud/RenderHUD_VDPAU.h | 3 - src/library/renderhud/RenderHUD_XShm.cpp | 3 - src/library/renderhud/RenderHUD_XShm.h | 3 - src/library/renderhud/SurfaceARGB.cpp | 3 - src/library/renderhud/SurfaceARGB.h | 2 - src/library/renderhud/SurfaceXImage.cpp | 3 - src/library/renderhud/SurfaceXImage.h | 2 - src/library/renderhud/sdl_ttf.cpp | 3 - src/library/renderhud/sdl_ttf.h | 2 - src/library/sdl/sdlrender.cpp | 4 -- src/library/sdl/sdlwindows.cpp | 34 +--------- src/library/vdpauwrappers.cpp | 6 -- src/library/vulkanwrappers.cpp | 4 -- src/library/xlib/xshm.cpp | 4 -- 37 files changed, 23 insertions(+), 231 deletions(-) diff --git a/configure.ac b/configure.ac index 9536e0f1..da9449eb 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,6 @@ AM_SILENT_RULES([yes]) dnl **** Configure options **** -AC_ARG_ENABLE([hud], AS_HELP_STRING([--disable-hud], [Disable the HUD])) AC_ARG_WITH([i386], AS_HELP_STRING([--with-i386],[Build libTAS with support for 32-bit executables])) AC_ARG_ENABLE([i386-lib], AS_HELP_STRING([--enable-i386-lib],[Build 32-bit version of libTAS library])) @@ -118,12 +117,10 @@ AS_IF([test "x$have_libswresample" = "xyes"], [ AC_SUBST(LIBSWRESAMPLE_CFLAGS) ]) -AS_IF([test "x$enable_hud" != "xno"], [ - CPPFLAGS='-I/usr/include/freetype2' - AC_CHECK_HEADERS([fontconfig/fontconfig.h ft2build.h], [], [enable_hud=no]) - AC_SEARCH_LIBS([FcInitLoadConfigAndFonts], [fontconfig], [], [enable_hud=no]) - AC_SEARCH_LIBS([FT_Open_Face], [freetype], [], [enable_hud=no]) -]) +CPPFLAGS='-I/usr/include/freetype2' +AC_CHECK_HEADERS([fontconfig/fontconfig.h ft2build.h], [], [AC_MSG_ERROR(The fontconfig and freetype headers are required!)]) +AC_SEARCH_LIBS([FcInitLoadConfigAndFonts], [fontconfig], [], [AC_MSG_ERROR(The fontconfig library is required!)]) +AC_SEARCH_LIBS([FT_Open_Face], [freetype], [], [AC_MSG_ERROR(The freetype library is required!)]) LIBRARY_LIBS=$LIBS LIBS= @@ -133,40 +130,33 @@ dnl **** Check for 32-bit libraries for libTAS library **** save_CXX="$CXX" case $host in - x86_64*|amd64*) + x86_64*|amd64*) if [test "x$with_i386" = "xyes"] || [test "x$enable_i386_lib" = "xyes"] then - AC_LANG_PUSH([C++]) - CXX="$CXX -m32" + AC_LANG_PUSH([C++]) + CXX="$CXX -m32" - dnl Look at different functions to avoid caching - AC_SEARCH_LIBS([dlclose], [dl dld]) - AC_SEARCH_LIBS([XCloseDisplay], [X11], [], [AC_MSG_ERROR(The x11 library is required!)]) - unset ac_cv_search_XGetXCBConnection - AC_SEARCH_LIBS([XGetXCBConnection], [X11-xcb], [], [AC_MSG_ERROR(The x11-xcb library is required!)]) - AC_SEARCH_LIBS([pthread_exit], [pthread], [], [AC_MSG_ERROR(The pthread library is required!)]) - AC_SEARCH_LIBS([snd_pcm_close], [asound], [], [AC_MSG_ERROR(The asound library is required!)]) + dnl Look at different functions to avoid caching + AC_SEARCH_LIBS([dlclose], [dl dld]) + AC_SEARCH_LIBS([XCloseDisplay], [X11], [], [AC_MSG_ERROR(The 32-bit x11 library is required!)]) + unset ac_cv_search_XGetXCBConnection + AC_SEARCH_LIBS([XGetXCBConnection], [X11-xcb], [], [AC_MSG_ERROR(The 32-bit x11-xcb library is required!)]) + AC_SEARCH_LIBS([pthread_exit], [pthread], [], [AC_MSG_ERROR(The 32-bit pthread library is required!)]) + AC_SEARCH_LIBS([snd_pcm_close], [asound], [], [AC_MSG_ERROR(The 32-bit asound library is required!)]) - AS_IF([test "x$enable_hud" != "xno"], [ - AC_SEARCH_LIBS([FcConfigAppFontAddFile], [fontconfig], [], [enable_hud=no]) - AC_SEARCH_LIBS([FT_Bitmap_Convert], [freetype], [], [enable_hud=no]) - ]) + AC_SEARCH_LIBS([FcConfigAppFontAddFile], [fontconfig], [], [AC_MSG_ERROR(The 32-bit fontconfig library is required!)]) + AC_SEARCH_LIBS([FT_Bitmap_Convert], [freetype], [], [AC_MSG_ERROR(The 32-bit freetype library is required!)]) - LIBRARY32_LIBS=$LIBS - LIBS= + LIBRARY32_LIBS=$LIBS + LIBS= - CXX="$save_CXX" - AC_LANG_POP([C++]) + CXX="$save_CXX" + AC_LANG_POP([C++]) fi ;; esac -AS_IF([test "x$enable_hud" != "xno"], [ - AC_DEFINE([LIBTAS_ENABLE_HUD], [1], [HUD is enabled]) - AC_MSG_NOTICE([HUD is enabled]) -]) - dnl **** Export date and commit **** AS_IF([test "x$enable_release_build" != "xyes"], [ diff --git a/src/library/BusyLoopDetection.cpp b/src/library/BusyLoopDetection.cpp index dcd01443..3eb93a24 100644 --- a/src/library/BusyLoopDetection.cpp +++ b/src/library/BusyLoopDetection.cpp @@ -220,12 +220,8 @@ void BusyLoopDetection::increment(int type) if (timecall_count > 20) { debuglogstdio(LCF_TIMESET, "Still softlocking, advance one frame"); std::function dummy_draw; -#ifdef LIBTAS_ENABLE_HUD static RenderHUD dummy; frameBoundary(dummy_draw, dummy); -#else - frameBoundary(dummy_draw); -#endif } } } diff --git a/src/library/DeterministicTimer.cpp b/src/library/DeterministicTimer.cpp index e9b1eca3..22e17508 100644 --- a/src/library/DeterministicTimer.cpp +++ b/src/library/DeterministicTimer.cpp @@ -213,12 +213,8 @@ void DeterministicTimer::addDelay(struct timespec delayTicks) * This decrements addedDelay by (basically) how much it advances ticks */ std::function dummy_draw; - #ifdef LIBTAS_ENABLE_HUD static RenderHUD dummy; frameBoundary(dummy_draw, dummy); - #else - frameBoundary(dummy_draw); - #endif } } } diff --git a/src/library/checkpoint/SaveStateManager.cpp b/src/library/checkpoint/SaveStateManager.cpp index ddbeba67..5efa690c 100644 --- a/src/library/checkpoint/SaveStateManager.cpp +++ b/src/library/checkpoint/SaveStateManager.cpp @@ -666,9 +666,7 @@ void SaveStateManager::printError(int err) if (err < 0) { debuglogstdio(LCF_CHECKPOINT | LCF_ERROR, errors[-err]); -#ifdef LIBTAS_ENABLE_HUD RenderHUD::insertMessage(errors[-err]); -#endif } } diff --git a/src/library/eglwrappers.cpp b/src/library/eglwrappers.cpp index aff91469..06b08211 100644 --- a/src/library/eglwrappers.cpp +++ b/src/library/eglwrappers.cpp @@ -356,14 +356,9 @@ EGLBoolean eglSwapBuffers( EGLDisplay dpy, EGLSurface surface ) DEBUGLOGCALL(LCF_WINDOW | LCF_OGL); /* Start the frame boundary and pass the function to draw */ -#ifdef LIBTAS_ENABLE_HUD - // static RenderHUD_GL renderHUD; static RenderHUD_GL renderHUD; renderHUD.setGLES(bindAPI == EGL_OPENGL_ES_API); frameBoundary([&] () {orig::eglSwapBuffers(dpy, surface);}, renderHUD); -#else - frameBoundary([&] () {orig::eglSwapBuffers(dpy, surface);}); -#endif return EGL_TRUE; } diff --git a/src/library/frame.cpp b/src/library/frame.cpp index c90cfbf3..1ee885d7 100644 --- a/src/library/frame.cpp +++ b/src/library/frame.cpp @@ -67,11 +67,7 @@ static uint64_t nondraw_framecount = 0; /* Did we do at least one savestate? */ static bool didASavestate = false; -#ifdef LIBTAS_ENABLE_HUD static void receive_messages(std::function draw, RenderHUD& hud); -#else -static void receive_messages(std::function draw); -#endif /* Compute real and logical fps */ static void computeFPS(float& fps, float& lfps) @@ -216,11 +212,7 @@ static void sendFrameCountTime() sendData(&ticks_val, sizeof(uint64_t)); } -#ifdef LIBTAS_ENABLE_HUD void frameBoundary(std::function draw, RenderHUD& hud) -#else -void frameBoundary(std::function draw) -#endif { static float fps, lfps = 0; @@ -329,10 +321,8 @@ void frameBoundary(std::function draw) sendMessage(MSGB_START_FRAMEBOUNDARY); /* Reset ramwatches and lua drawings */ -#ifdef LIBTAS_ENABLE_HUD RenderHUD::resetWatches(); RenderHUD::resetLua(); -#endif /* Receive messages from the program */ int message = receiveMessage(); @@ -343,9 +333,7 @@ void frameBoundary(std::function draw) { /* Get ramwatch from the program */ std::string ramwatch = receiveString(); -#ifdef LIBTAS_ENABLE_HUD RenderHUD::insertWatch(ramwatch); -#endif break; } case MSGN_LUA_RESOLUTION: @@ -366,9 +354,7 @@ void frameBoundary(std::function draw) uint32_t fg, bg; receiveData(&fg, sizeof(uint32_t)); receiveData(&bg, sizeof(uint32_t)); -#ifdef LIBTAS_ENABLE_HUD RenderHUD::insertLuaText(x, y, text, fg, bg); -#endif break; } case MSGN_LUA_PIXEL: @@ -378,9 +364,7 @@ void frameBoundary(std::function draw) receiveData(&y, sizeof(int)); uint32_t color; receiveData(&color, sizeof(uint32_t)); -#ifdef LIBTAS_ENABLE_HUD RenderHUD::insertLuaPixel(x, y, color); -#endif break; } case MSGN_LUA_RECT: @@ -394,9 +378,7 @@ void frameBoundary(std::function draw) uint32_t outline, fill; receiveData(&outline, sizeof(uint32_t)); receiveData(&fill, sizeof(uint32_t)); -#ifdef LIBTAS_ENABLE_HUD RenderHUD::insertLuaRect(x, y, w, h, thickness, outline, fill); -#endif break; } case MSGN_LUA_LINE: @@ -408,9 +390,7 @@ void frameBoundary(std::function draw) receiveData(&y1, sizeof(int)); uint32_t color; receiveData(&color, sizeof(uint32_t)); -#ifdef LIBTAS_ENABLE_HUD RenderHUD::insertLuaLine(x0, y0, x1, y1, color); -#endif break; } case MSGN_LUA_ELLIPSE: @@ -422,9 +402,7 @@ void frameBoundary(std::function draw) receiveData(&radius_y, sizeof(int)); uint32_t color; receiveData(&color, sizeof(uint32_t)); -#ifdef LIBTAS_ENABLE_HUD RenderHUD::insertLuaEllipse(center_x, center_y, radius_x, radius_y, color); -#endif break; } } @@ -442,13 +420,11 @@ void frameBoundary(std::function draw) /* If we want HUD to appear in encodes, we need to draw it before saving * the window surface/texture/etc. This has the small drawback that we * won't be able to remove HUD messages during that frame. */ -#ifdef LIBTAS_ENABLE_HUD if (!Global::skipping_draw && draw && Global::shared_config.osd_encode) { AllInputs preview_ai; preview_ai.emptyInputs(); hud.drawAll(framecount, nondraw_framecount, ai, preview_ai); } -#endif if (!Global::skipping_draw) { if (draw) { @@ -479,13 +455,11 @@ void frameBoundary(std::function draw) } } -#ifdef LIBTAS_ENABLE_HUD if (!Global::skipping_draw && draw && !Global::shared_config.osd_encode) { AllInputs preview_ai; preview_ai.emptyInputs(); hud.drawAll(framecount, nondraw_framecount, ai, preview_ai); } -#endif /* Actual draw command */ if (!Global::skipping_draw && draw) { @@ -494,11 +468,7 @@ void frameBoundary(std::function draw) } /* Receive messages from the program */ -#ifdef LIBTAS_ENABLE_HUD - receive_messages(draw, hud); -#else - receive_messages(draw); -#endif + receive_messages(draw, hud); /* No more socket messages here, unlocking the socket. */ unlockSocket(); @@ -631,29 +601,19 @@ static void pushQuitEvent(void) } -#ifdef LIBTAS_ENABLE_HUD static void screen_redraw(std::function draw, RenderHUD& hud, AllInputs preview_ai) -#else -static void screen_redraw(std::function draw, AllInputs preview_ai) -#endif { if (!Global::skipping_draw && draw) { ScreenCapture::copySurfaceToScreen(); -#ifdef LIBTAS_ENABLE_HUD hud.drawAll(framecount, nondraw_framecount, ai, preview_ai); -#endif GlobalNoLog gnl; NATIVECALL(draw()); } } -#ifdef LIBTAS_ENABLE_HUD static void receive_messages(std::function draw, RenderHUD& hud) -#else -static void receive_messages(std::function draw) -#endif { AllInputs preview_ai; preview_ai.emptyInputs(); @@ -664,13 +624,11 @@ static void receive_messages(std::function draw) while (1) { int slot = SaveStateManager::waitChild(); if (slot < 0) break; -#ifdef LIBTAS_ENABLE_HUD std::string msg = "State "; msg += std::to_string(slot); msg += " saved"; RenderHUD::insertMessage(msg.c_str()); screen_redraw(draw, hud, preview_ai); -#endif } while (1) @@ -701,13 +659,11 @@ static void receive_messages(std::function draw) while (1) { int slot = SaveStateManager::waitChild(); if (slot < 0) break; -#ifdef LIBTAS_ENABLE_HUD std::string msg = "State "; msg += std::to_string(slot); msg += " saved"; RenderHUD::insertMessage(msg.c_str()); screen_redraw(draw, hud, preview_ai); -#endif } } int status; @@ -746,20 +702,12 @@ static void receive_messages(std::function draw) break; case MSGN_EXPOSE: -#ifdef LIBTAS_ENABLE_HUD screen_redraw(draw, hud, preview_ai); -#else - screen_redraw(draw, preview_ai); -#endif break; case MSGN_PREVIEW_INPUTS: receiveData(&preview_ai, sizeof(AllInputs)); -#ifdef LIBTAS_ENABLE_HUD screen_redraw(draw, hud, preview_ai); -#else - screen_redraw(draw, preview_ai); -#endif break; case MSGN_SAVESTATE_PATH: @@ -810,18 +758,13 @@ static void receive_messages(std::function draw) sendFrameCountTime(); /* Screen should have changed after loading */ -#ifdef LIBTAS_ENABLE_HUD screen_redraw(draw, hud, preview_ai); -#else - screen_redraw(draw, preview_ai); -#endif } else if (status == 0) { /* Tell the program that the saving succeeded */ sendMessage(MSGB_SAVING_SUCCEEDED); /* Print the successful message, unless we are saving in a fork */ -#ifdef LIBTAS_ENABLE_HUD if (!(Global::shared_config.savestate_settings & SharedConfig::SS_FORK)) { if (Global::shared_config.osd & SharedConfig::OSD_MESSAGES) { std::string msg; @@ -832,7 +775,6 @@ static void receive_messages(std::function draw) screen_redraw(draw, hud, preview_ai); } } -#endif } else { @@ -866,10 +808,8 @@ static void receive_messages(std::function draw) break; case MSGN_OSD_MSG: -#ifdef LIBTAS_ENABLE_HUD RenderHUD::insertMessage(receiveString().c_str()); screen_redraw(draw, hud, preview_ai); -#endif break; case MSGN_END_FRAMEBOUNDARY: diff --git a/src/library/frame.h b/src/library/frame.h index 1fcdbd88..04808941 100644 --- a/src/library/frame.h +++ b/src/library/frame.h @@ -38,11 +38,7 @@ extern uint64_t framecount; * but can be called also by the timer when we need to advance time to avoid a * game softlock (game expect time to pass). */ -#ifdef LIBTAS_ENABLE_HUD void frameBoundary(std::function draw, RenderHUD& hud); -#else -void frameBoundary(std::function draw); -#endif } diff --git a/src/library/glxwrappers.cpp b/src/library/glxwrappers.cpp index 5d29401d..78c37e1b 100644 --- a/src/library/glxwrappers.cpp +++ b/src/library/glxwrappers.cpp @@ -465,12 +465,8 @@ void glXSwapBuffers( Display *dpy, XID drawable ) DEBUGLOGCALL(LCF_WINDOW | LCF_OGL); /* Start the frame boundary and pass the function to draw */ -#ifdef LIBTAS_ENABLE_HUD static RenderHUD_GL renderHUD; frameBoundary([&] () {orig::glXSwapBuffers(dpy, drawable);}, renderHUD); -#else - frameBoundary([&] () {orig::glXSwapBuffers(dpy, drawable);}); -#endif } static int swapInterval = 0; diff --git a/src/library/renderhud/RenderHUD.cpp b/src/library/renderhud/RenderHUD.cpp index a077cb2b..326e4b2d 100644 --- a/src/library/renderhud/RenderHUD.cpp +++ b/src/library/renderhud/RenderHUD.cpp @@ -18,7 +18,6 @@ */ #include "RenderHUD.h" -#ifdef LIBTAS_ENABLE_HUD #include "../logging.h" #include "../hook.h" @@ -404,5 +403,3 @@ void RenderHUD::drawAll(uint64_t framecount, uint64_t nondraw_framecount, const } } - -#endif diff --git a/src/library/renderhud/RenderHUD.h b/src/library/renderhud/RenderHUD.h index a38cf248..1706e2fd 100644 --- a/src/library/renderhud/RenderHUD.h +++ b/src/library/renderhud/RenderHUD.h @@ -20,7 +20,6 @@ #ifdef __unix__ #include "config.h" #endif -#ifdef LIBTAS_ENABLE_HUD #ifndef LIBTAS_RENDERHUD_H_INCL #define LIBTAS_RENDERHUD_H_INCL @@ -237,4 +236,3 @@ class RenderHUD } #endif -#endif diff --git a/src/library/renderhud/RenderHUD_Base_Linux.cpp b/src/library/renderhud/RenderHUD_Base_Linux.cpp index 3a3fa6de..22604215 100644 --- a/src/library/renderhud/RenderHUD_Base_Linux.cpp +++ b/src/library/renderhud/RenderHUD_Base_Linux.cpp @@ -18,7 +18,6 @@ */ #include "RenderHUD_Base_Linux.h" -#ifdef LIBTAS_ENABLE_HUD #include "../logging.h" #include "../hook.h" @@ -153,5 +152,3 @@ void RenderHUD_Base_Linux::renderText(const char* text, Color fg_color, Color bg } } - -#endif diff --git a/src/library/renderhud/RenderHUD_Base_Linux.h b/src/library/renderhud/RenderHUD_Base_Linux.h index 1713cb2d..faf3b8ef 100644 --- a/src/library/renderhud/RenderHUD_Base_Linux.h +++ b/src/library/renderhud/RenderHUD_Base_Linux.h @@ -18,7 +18,6 @@ */ #include "RenderHUD.h" -#ifdef LIBTAS_ENABLE_HUD #ifndef LIBTAS_RENDERHUD_BASE_LINUX_H_INCL #define LIBTAS_RENDERHUD_BASE_LINUX_H_INCL @@ -60,4 +59,3 @@ class RenderHUD_Base_Linux : public RenderHUD } #endif -#endif diff --git a/src/library/renderhud/RenderHUD_Base_MacOS.cpp b/src/library/renderhud/RenderHUD_Base_MacOS.cpp index ddb872d2..ff187746 100644 --- a/src/library/renderhud/RenderHUD_Base_MacOS.cpp +++ b/src/library/renderhud/RenderHUD_Base_MacOS.cpp @@ -18,7 +18,6 @@ */ #include "RenderHUD_Base_MacOS.h" -#ifdef LIBTAS_ENABLE_HUD #include "../logging.h" #include "../hook.h" @@ -127,5 +126,3 @@ void RenderHUD_Base_MacOS::renderText(const char* text, Color fg_color, Color bg } } - -#endif diff --git a/src/library/renderhud/RenderHUD_Base_MacOS.h b/src/library/renderhud/RenderHUD_Base_MacOS.h index 4e73612c..aa1d8b59 100644 --- a/src/library/renderhud/RenderHUD_Base_MacOS.h +++ b/src/library/renderhud/RenderHUD_Base_MacOS.h @@ -19,8 +19,6 @@ #include "RenderHUD.h" -#ifdef LIBTAS_ENABLE_HUD - #ifndef LIBTAS_RENDERHUD_BASE_MACOS_H_INCL #define LIBTAS_RENDERHUD_BASE_MACOS_H_INCL @@ -58,4 +56,3 @@ class RenderHUD_Base_MacOS : public RenderHUD } #endif -#endif diff --git a/src/library/renderhud/RenderHUD_GL.cpp b/src/library/renderhud/RenderHUD_GL.cpp index 785a021e..6e60533c 100644 --- a/src/library/renderhud/RenderHUD_GL.cpp +++ b/src/library/renderhud/RenderHUD_GL.cpp @@ -18,7 +18,6 @@ */ #include "RenderHUD_GL.h" -#ifdef LIBTAS_ENABLE_HUD #include "../logging.h" #include "../hook.h" @@ -437,5 +436,3 @@ void RenderHUD_GL::renderSurface(std::unique_ptr surf, int x, int y } } - -#endif diff --git a/src/library/renderhud/RenderHUD_GL.h b/src/library/renderhud/RenderHUD_GL.h index 9eeb74b1..714c3ab2 100644 --- a/src/library/renderhud/RenderHUD_GL.h +++ b/src/library/renderhud/RenderHUD_GL.h @@ -26,8 +26,6 @@ #include "RenderHUD_Base_MacOS.h" #endif -#ifdef LIBTAS_ENABLE_HUD - #define GL_GLEXT_PROTOTYPES #ifdef __unix__ #include @@ -72,4 +70,3 @@ class RenderHUD_GL : public RenderHUD_Base_MacOS } #endif -#endif diff --git a/src/library/renderhud/RenderHUD_SDL1.cpp b/src/library/renderhud/RenderHUD_SDL1.cpp index 49fa32cd..dd11a653 100644 --- a/src/library/renderhud/RenderHUD_SDL1.cpp +++ b/src/library/renderhud/RenderHUD_SDL1.cpp @@ -18,7 +18,6 @@ */ #include "RenderHUD_SDL1.h" -#ifdef LIBTAS_ENABLE_HUD #include // SDL_Rect #include "../../external/SDL1.h" // SDL1::SDL_Surface @@ -70,5 +69,3 @@ void RenderHUD_SDL1::renderSurface(std::unique_ptr surf, int x, int } } - -#endif diff --git a/src/library/renderhud/RenderHUD_SDL1.h b/src/library/renderhud/RenderHUD_SDL1.h index 4872e8f6..39efb552 100644 --- a/src/library/renderhud/RenderHUD_SDL1.h +++ b/src/library/renderhud/RenderHUD_SDL1.h @@ -26,8 +26,6 @@ #include "RenderHUD_Base_MacOS.h" #endif -#ifdef LIBTAS_ENABLE_HUD - namespace libtas { #ifdef __unix__ class RenderHUD_SDL1 : public RenderHUD_Base_Linux @@ -42,4 +40,3 @@ class RenderHUD_SDL1 : public RenderHUD_Base_MacOS } #endif -#endif diff --git a/src/library/renderhud/RenderHUD_SDL2_renderer.cpp b/src/library/renderhud/RenderHUD_SDL2_renderer.cpp index 796e001a..2a4f26c9 100644 --- a/src/library/renderhud/RenderHUD_SDL2_renderer.cpp +++ b/src/library/renderhud/RenderHUD_SDL2_renderer.cpp @@ -18,7 +18,6 @@ */ #include "RenderHUD_SDL2_renderer.h" -#ifdef LIBTAS_ENABLE_HUD #include "../logging.h" #include "../hook.h" @@ -102,5 +101,3 @@ void RenderHUD_SDL2_renderer::renderSurface(std::unique_ptr surf, i } } - -#endif diff --git a/src/library/renderhud/RenderHUD_SDL2_renderer.h b/src/library/renderhud/RenderHUD_SDL2_renderer.h index b92267d7..07b48069 100644 --- a/src/library/renderhud/RenderHUD_SDL2_renderer.h +++ b/src/library/renderhud/RenderHUD_SDL2_renderer.h @@ -26,8 +26,6 @@ #include "RenderHUD_Base_MacOS.h" #endif -#ifdef LIBTAS_ENABLE_HUD - #include // SDL_Renderer namespace libtas { @@ -51,4 +49,3 @@ class RenderHUD_SDL2_renderer : public RenderHUD_Base_MacOS } #endif -#endif diff --git a/src/library/renderhud/RenderHUD_SDL2_surface.cpp b/src/library/renderhud/RenderHUD_SDL2_surface.cpp index 64d7e1e3..0b12a22e 100644 --- a/src/library/renderhud/RenderHUD_SDL2_surface.cpp +++ b/src/library/renderhud/RenderHUD_SDL2_surface.cpp @@ -18,7 +18,6 @@ */ #include "RenderHUD_SDL2_surface.h" -#ifdef LIBTAS_ENABLE_HUD #include "../logging.h" #include "../hook.h" @@ -53,5 +52,3 @@ void RenderHUD_SDL2_surface::renderSurface(std::unique_ptr surf, in } } - -#endif diff --git a/src/library/renderhud/RenderHUD_SDL2_surface.h b/src/library/renderhud/RenderHUD_SDL2_surface.h index d143e458..dd769079 100644 --- a/src/library/renderhud/RenderHUD_SDL2_surface.h +++ b/src/library/renderhud/RenderHUD_SDL2_surface.h @@ -26,8 +26,6 @@ #include "RenderHUD_Base_MacOS.h" #endif -#ifdef LIBTAS_ENABLE_HUD - namespace libtas { #ifdef __unix__ class RenderHUD_SDL2_surface : public RenderHUD_Base_Linux @@ -42,4 +40,3 @@ class RenderHUD_SDL2_surface : public RenderHUD_Base_MacOS } #endif -#endif diff --git a/src/library/renderhud/RenderHUD_VDPAU.cpp b/src/library/renderhud/RenderHUD_VDPAU.cpp index d1ea741d..75211b68 100644 --- a/src/library/renderhud/RenderHUD_VDPAU.cpp +++ b/src/library/renderhud/RenderHUD_VDPAU.cpp @@ -18,7 +18,6 @@ */ #include "RenderHUD_VDPAU.h" -#ifdef LIBTAS_ENABLE_HUD #include "../logging.h" #include "../hook.h" @@ -85,5 +84,3 @@ void RenderHUD_VDPAU::renderSurface(std::unique_ptr surf, int x, in } } - -#endif diff --git a/src/library/renderhud/RenderHUD_VDPAU.h b/src/library/renderhud/RenderHUD_VDPAU.h index 88f48e06..9e5a51d2 100644 --- a/src/library/renderhud/RenderHUD_VDPAU.h +++ b/src/library/renderhud/RenderHUD_VDPAU.h @@ -26,8 +26,6 @@ #include "RenderHUD_Base_MacOS.h" #endif -#ifdef LIBTAS_ENABLE_HUD - #include "../vdpauwrappers.h" namespace libtas { @@ -50,4 +48,3 @@ class RenderHUD_VDPAU : public RenderHUD_Base_MacOS } #endif -#endif diff --git a/src/library/renderhud/RenderHUD_XShm.cpp b/src/library/renderhud/RenderHUD_XShm.cpp index 411b9e1d..73babe10 100644 --- a/src/library/renderhud/RenderHUD_XShm.cpp +++ b/src/library/renderhud/RenderHUD_XShm.cpp @@ -18,7 +18,6 @@ */ #include "RenderHUD_XShm.h" -#ifdef LIBTAS_ENABLE_HUD #include "SurfaceARGB.h" #include "SurfaceXImage.h" @@ -42,5 +41,3 @@ void RenderHUD_XShm::renderSurface(std::unique_ptr surf, int x, int } } - -#endif diff --git a/src/library/renderhud/RenderHUD_XShm.h b/src/library/renderhud/RenderHUD_XShm.h index c4fcf835..59ce0463 100644 --- a/src/library/renderhud/RenderHUD_XShm.h +++ b/src/library/renderhud/RenderHUD_XShm.h @@ -26,8 +26,6 @@ #include "RenderHUD_Base_MacOS.h" #endif -#ifdef LIBTAS_ENABLE_HUD - namespace libtas { #ifdef __unix__ class RenderHUD_XShm : public RenderHUD_Base_Linux @@ -41,4 +39,3 @@ class RenderHUD_XShm : public RenderHUD_Base_MacOS } #endif -#endif diff --git a/src/library/renderhud/SurfaceARGB.cpp b/src/library/renderhud/SurfaceARGB.cpp index 825f0e05..aaba425b 100644 --- a/src/library/renderhud/SurfaceARGB.cpp +++ b/src/library/renderhud/SurfaceARGB.cpp @@ -18,7 +18,6 @@ */ #include "SurfaceARGB.h" -#ifdef LIBTAS_ENABLE_HUD #include "../logging.h" @@ -237,5 +236,3 @@ uint32_t SurfaceARGB::colorToValue(Color color) } - -#endif diff --git a/src/library/renderhud/SurfaceARGB.h b/src/library/renderhud/SurfaceARGB.h index c603da54..708f22df 100644 --- a/src/library/renderhud/SurfaceARGB.h +++ b/src/library/renderhud/SurfaceARGB.h @@ -20,7 +20,6 @@ #ifdef __unix__ #include "config.h" #endif -#ifdef LIBTAS_ENABLE_HUD #ifndef LIBTAS_SURFACEARGB_H_INCL #define LIBTAS_SURFACEARGB_H_INCL @@ -87,4 +86,3 @@ class SurfaceARGB } #endif -#endif diff --git a/src/library/renderhud/SurfaceXImage.cpp b/src/library/renderhud/SurfaceXImage.cpp index 135e771a..22d145a0 100644 --- a/src/library/renderhud/SurfaceXImage.cpp +++ b/src/library/renderhud/SurfaceXImage.cpp @@ -18,7 +18,6 @@ */ #include "SurfaceXImage.h" -#ifdef LIBTAS_ENABLE_HUD #include "../logging.h" @@ -92,5 +91,3 @@ void SurfaceXImage::blit(const SurfaceARGB* src, int x, int y) } } - -#endif diff --git a/src/library/renderhud/SurfaceXImage.h b/src/library/renderhud/SurfaceXImage.h index bbe21597..055702d3 100644 --- a/src/library/renderhud/SurfaceXImage.h +++ b/src/library/renderhud/SurfaceXImage.h @@ -18,7 +18,6 @@ */ #include "config.h" -#ifdef LIBTAS_ENABLE_HUD #ifndef LIBTAS_SURFACEXIMAGE_H_INCL #define LIBTAS_SURFACEXIMAGE_H_INCL @@ -46,4 +45,3 @@ class SurfaceXImage } #endif -#endif diff --git a/src/library/renderhud/sdl_ttf.cpp b/src/library/renderhud/sdl_ttf.cpp index 7d89e415..0981f2f6 100644 --- a/src/library/renderhud/sdl_ttf.cpp +++ b/src/library/renderhud/sdl_ttf.cpp @@ -22,7 +22,6 @@ /* Code modified by Clément Gallet */ #include "sdl_ttf.h" -#ifdef LIBTAS_ENABLE_HUD #include #include @@ -1734,5 +1733,3 @@ int TTF_GetFontKerningSizeGlyphs(TTF_Font *font, uint16_t previous_ch, uint16_t } } - -#endif diff --git a/src/library/renderhud/sdl_ttf.h b/src/library/renderhud/sdl_ttf.h index ee13cf9e..9826cb4b 100644 --- a/src/library/renderhud/sdl_ttf.h +++ b/src/library/renderhud/sdl_ttf.h @@ -34,7 +34,6 @@ #ifdef __unix__ #include "config.h" #endif -#ifdef LIBTAS_ENABLE_HUD #include "SurfaceARGB.h" #include @@ -186,5 +185,4 @@ int TTF_GetFontKerningSizeGlyphs(TTF_Font *font, uint16_t previous_ch, uint16_t } -#endif #endif /* _SDL_TTF_H */ diff --git a/src/library/sdl/sdlrender.cpp b/src/library/sdl/sdlrender.cpp index 30e139c4..4bf207c8 100644 --- a/src/library/sdl/sdlrender.cpp +++ b/src/library/sdl/sdlrender.cpp @@ -82,13 +82,9 @@ DECLARE_ORIG_POINTER(SDL_RenderGetScale) DEBUGLOGCALL(LCF_SDL | LCF_WINDOW); /* Start the frame boundary and pass the function to draw */ -#ifdef LIBTAS_ENABLE_HUD static RenderHUD_SDL2_renderer renderHUD; renderHUD.setRenderer(renderer); frameBoundary([&] () {orig::SDL_RenderPresent(renderer);}, renderHUD); -#else - frameBoundary([&] () {orig::SDL_RenderPresent(renderer);}); -#endif } static int logical_w = 0; diff --git a/src/library/sdl/sdlwindows.cpp b/src/library/sdl/sdlwindows.cpp index b2680b26..626ec245 100644 --- a/src/library/sdl/sdlwindows.cpp +++ b/src/library/sdl/sdlwindows.cpp @@ -83,12 +83,8 @@ static bool windowFullscreen = false; DEBUGLOGCALL(LCF_SDL | LCF_OGL | LCF_WINDOW); /* Start the frame boundary and pass the function to draw */ -#ifdef LIBTAS_ENABLE_HUD static RenderHUD_GL renderHUD_GL; frameBoundary([] () {orig::SDL_GL_SwapBuffers();}, renderHUD_GL); -#else - frameBoundary([] () {orig::SDL_GL_SwapBuffers();}); -#endif } /* Override */ void SDL_GL_SwapWindow(SDL_Window* window) @@ -101,12 +97,8 @@ static bool windowFullscreen = false; DEBUGLOGCALL(LCF_SDL | LCF_OGL | LCF_WINDOW); /* Start the frame boundary and pass the function to draw */ -#ifdef LIBTAS_ENABLE_HUD static RenderHUD_GL renderHUD_GL; frameBoundary([&] () {orig::SDL_GL_SwapWindow(window);}, renderHUD_GL); -#else - frameBoundary([&] () {orig::SDL_GL_SwapWindow(window);}); -#endif } void* SDL_GL_CreateContext(SDL_Window *window) @@ -147,10 +139,8 @@ void SDL_GL_DeleteContext(SDL_GLContext context) DEBUGLOGCALL(LCF_SDL | LCF_OGL | LCF_WINDOW); LINK_NAMESPACE_SDL2(SDL_GL_DeleteContext); - #ifdef LIBTAS_ENABLE_HUD - /* Delete texture and fbo in the OSD */ - RenderHUD_GL::fini(); - #endif + /* Delete texture and fbo in the OSD */ + RenderHUD_GL::fini(); /* Games can destroy the GL context without closing the window. It still * invalidates GL objects, so we must close the screen capture. */ @@ -489,12 +479,8 @@ void SDL_GL_DeleteContext(SDL_GLContext context) DEBUGLOGCALL(LCF_SDL | LCF_WINDOW); /* Start the frame boundary and pass the function to draw */ -#ifdef LIBTAS_ENABLE_HUD static RenderHUD_SDL1 renderHUD; frameBoundary([&] () {orig::SDL_Flip(screen);}, renderHUD); -#else - frameBoundary([&] () {orig::SDL_Flip(screen);}); -#endif return 0; } @@ -510,12 +496,8 @@ OVERRIDE void SDL_UpdateRects(SDL1::SDL_Surface *screen, int numrects, SDL1::SDL debuglogstdio(LCF_SDL | LCF_WINDOW, "%s call with %d rects", __func__, numrects); /* Start the frame boundary and pass the function to draw */ -#ifdef LIBTAS_ENABLE_HUD static RenderHUD_SDL1 renderHUD; frameBoundary([&] () {orig::SDL_UpdateRect(screen, 0, 0, 0, 0);}, renderHUD); -#else - frameBoundary([&] () {orig::SDL_UpdateRect(screen, 0, 0, 0, 0);}); -#endif } /* Override */ void SDL_UpdateRect(SDL1::SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h) @@ -528,12 +510,8 @@ OVERRIDE void SDL_UpdateRects(SDL1::SDL_Surface *screen, int numrects, SDL1::SDL debuglogstdio(LCF_SDL | LCF_WINDOW, "%s call with pos (%d,%d) and size (%u,%u)", __func__, x, y, w, h); /* Start the frame boundary and pass the function to draw */ -#ifdef LIBTAS_ENABLE_HUD static RenderHUD_SDL1 renderHUD; frameBoundary([&] () {orig::SDL_UpdateRect(screen, 0, 0, 0, 0);}, renderHUD); -#else - frameBoundary([&] () {orig::SDL_UpdateRect(screen, 0, 0, 0, 0);}); -#endif } /* Override */ SDL1::SDL_GrabMode SDL_WM_GrabInput(SDL1::SDL_GrabMode mode) @@ -597,12 +575,8 @@ OVERRIDE void SDL_UpdateRects(SDL1::SDL_Surface *screen, int numrects, SDL1::SDL ScreenCapture::init(); /* Start the frame boundary and pass the function to draw */ -#ifdef LIBTAS_ENABLE_HUD static RenderHUD_SDL2_surface renderHUD; frameBoundary([&] () {orig::SDL_UpdateWindowSurface(window);}, renderHUD); -#else - frameBoundary([&] () {orig::SDL_UpdateWindowSurface(window);}); -#endif return 0; } @@ -622,12 +596,8 @@ OVERRIDE void SDL_UpdateRects(SDL1::SDL_Surface *screen, int numrects, SDL1::SDL ScreenCapture::init(); /* Start the frame boundary and pass the function to draw */ -#ifdef LIBTAS_ENABLE_HUD static RenderHUD_SDL2_surface renderHUD; frameBoundary([&] () {orig::SDL_UpdateWindowSurface(window);}, renderHUD); -#else - frameBoundary([&] () {orig::SDL_UpdateWindowSurface(window);}); -#endif return 0; } diff --git a/src/library/vdpauwrappers.cpp b/src/library/vdpauwrappers.cpp index 35f9bb6e..723728c7 100644 --- a/src/library/vdpauwrappers.cpp +++ b/src/library/vdpauwrappers.cpp @@ -107,9 +107,7 @@ VdpStatus VdpPresentationQueueCreate(VdpDevice device, VdpPresentationQueueTarge Global::game_info.video |= GameInfo::VDPAU; Global::game_info.tosend = true; -#ifdef LIBTAS_ENABLE_HUD RenderHUD_VDPAU::setDevice(device); -#endif return orig::VdpPresentationQueueCreate(device, presentation_queue_target, presentation_queue); } @@ -150,13 +148,9 @@ VdpStatus VdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue, V ScreenCapture::resize(uw, uh); /* Start the frame boundary and pass the function to draw */ -#ifdef LIBTAS_ENABLE_HUD static RenderHUD_VDPAU renderHUD; renderHUD.setSurface(surface); frameBoundary([&] () {orig::VdpPresentationQueueDisplay(presentation_queue, surface, clip_width, clip_height, earliest_presentation_time);}, renderHUD); -#else - frameBoundary([&] () {orig::VdpPresentationQueueDisplay(presentation_queue, surface, clip_width, clip_height, earliest_presentation_time);}); -#endif return VDP_STATUS_OK; } diff --git a/src/library/vulkanwrappers.cpp b/src/library/vulkanwrappers.cpp index 98b6f260..45a02715 100644 --- a/src/library/vulkanwrappers.cpp +++ b/src/library/vulkanwrappers.cpp @@ -303,7 +303,6 @@ VkResult vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* pPresentInfo) orig::vkGetSwapchainImagesKHR(vk::device, vk::swapchain, &count, vk::swapchainImgs.data()); /* Start the frame boundary and pass the function to draw */ -#ifdef LIBTAS_ENABLE_HUD static RenderHUD renderHUD; frameBoundary([&] () { static bool first = true; @@ -327,9 +326,6 @@ VkResult vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* pPresentInfo) orig::vkQueuePresentKHR(queue, &pi); } }, renderHUD); -#else - frameBoundary([&] () {orig::vkQueuePresentKHR(queue, pPresentInfo);}); -#endif return VK_SUCCESS; } diff --git a/src/library/xlib/xshm.cpp b/src/library/xlib/xshm.cpp index 86d71d5c..1dcc1ff4 100644 --- a/src/library/xlib/xshm.cpp +++ b/src/library/xlib/xshm.cpp @@ -99,12 +99,8 @@ OVERRIDE Bool XShmPutImage( ScreenCapture::resize(image->width, image->height); /* Start the frame boundary and pass the function to draw */ -#ifdef LIBTAS_ENABLE_HUD static RenderHUD_XShm renderHUD; frameBoundary([&] () {orig::XShmPutImage(dpy, d, gc, image, src_x, src_y, dst_x, dst_y, src_width, src_height, send_event);}, renderHUD); -#else - frameBoundary([&] () {orig::XShmPutImage(dpy, d, gc, image, src_x, src_y, dst_x, dst_y, src_width, src_height, send_event);}); -#endif return True; // return orig::XShmPutImage(dpy, d, gc, image, src_x, src_y, dst_x, dst_y, src_width, src_height, send_event);