From 1a3dd25c10dab39186f5c50f980384fa7a408c1f Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Fri, 29 Mar 2024 08:49:47 +1000 Subject: [PATCH] fix compilation with the HEADLESS compile flag (#9) --- src/pc/gfx/gfx_dummy.c | 4 ++-- src/pc/lua/smlua_hooks.c | 8 ++++++-- src/pc/pc_main.c | 7 ++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/pc/gfx/gfx_dummy.c b/src/pc/gfx/gfx_dummy.c index 77bd07f8..aed6594b 100644 --- a/src/pc/gfx/gfx_dummy.c +++ b/src/pc/gfx/gfx_dummy.c @@ -129,11 +129,11 @@ static void gfx_dummy_renderer_unload_shader(UNUSED struct ShaderProgram *old_pr static void gfx_dummy_renderer_load_shader(UNUSED struct ShaderProgram *new_prg) { } -static struct ShaderProgram *gfx_dummy_renderer_create_and_load_new_shader(UNUSED uint32_t shader_id) { +static struct ShaderProgram *gfx_dummy_renderer_create_and_load_new_shader(UNUSED struct ColorCombiner* cc) { return NULL; } -static struct ShaderProgram *gfx_dummy_renderer_lookup_shader(UNUSED uint32_t shader_id) { +static struct ShaderProgram *gfx_dummy_renderer_lookup_shader(UNUSED struct ColorCombiner* cc) { return NULL; } diff --git a/src/pc/lua/smlua_hooks.c b/src/pc/lua/smlua_hooks.c index bbcd86af..e296b9ab 100644 --- a/src/pc/lua/smlua_hooks.c +++ b/src/pc/lua/smlua_hooks.c @@ -30,7 +30,8 @@ static struct { f64 disp; } sLuaProfilerCounters[MAX_PROFILED_MODS]; -static void lua_profiler_start_counter(struct Mod *mod) { +static void lua_profiler_start_counter(UNUSED struct Mod *mod) { +#ifndef WAPI_DUMMY for (s32 i = 0; i != MIN(MAX_PROFILED_MODS, gActiveMods.entryCount); ++i) { if (gActiveMods.entries[i] == mod) { f64 freq = SDL_GetPerformanceFrequency(); @@ -39,9 +40,11 @@ static void lua_profiler_start_counter(struct Mod *mod) { return; } } +#endif } -static void lua_profiler_stop_counter(struct Mod *mod) { +static void lua_profiler_stop_counter(UNUSED struct Mod *mod) { +#ifndef WAPI_DUMMY for (s32 i = 0; i != MIN(MAX_PROFILED_MODS, gActiveMods.entryCount); ++i) { if (gActiveMods.entries[i] == mod) { f64 freq = SDL_GetPerformanceFrequency(); @@ -51,6 +54,7 @@ static void lua_profiler_stop_counter(struct Mod *mod) { return; } } +#endif } void lua_profiler_update_counters(void) { diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index 605612ef..c24df7cc 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -385,11 +385,16 @@ int main(int argc, char *argv[]) { // Render the rom setup screen if (!main_rom_handler()) { +#if !defined(WAPI_DXGI) && !defined(WAPI_DUMMY) render_rom_setup_screen(); // Holds the game load until a valid rom is provided +#else + printf("ERROR: could not find valid vanilla us sm64 rom in game's user folder\n"); + return 0; +#endif } // Start the thread for setting up the game -#ifndef WAPI_DXGI +#if !defined(WAPI_DXGI) && !defined(WAPI_DUMMY) bool threadSuccess = false; if (pthread_mutex_init(&gLoadingThreadMutex, NULL) == 0) { if (pthread_create(&gLoadingThreadId, NULL, main_game_init, (void*) 1) == 0) {