diff --git a/plugins/win-capture/game-capture.c b/plugins/win-capture/game-capture.c index 55adeb4be..2d3229fae 100644 --- a/plugins/win-capture/game-capture.c +++ b/plugins/win-capture/game-capture.c @@ -273,9 +273,10 @@ static inline HMODULE kernel32(void) static inline HANDLE open_process(DWORD desired_access, bool inherit_handle, DWORD process_id) { - static HANDLE(WINAPI * open_process_proc)(DWORD, BOOL, DWORD) = NULL; + typedef HANDLE(WINAPI * PFN_OpenProcess)(DWORD, BOOL, DWORD); + PFN_OpenProcess open_process_proc = NULL; if (!open_process_proc) - open_process_proc = get_obfuscated_func( + open_process_proc = (PFN_OpenProcess)get_obfuscated_func( kernel32(), "NuagUykjcxr", 0x1B694B59451ULL); return open_process_proc(desired_access, inherit_handle, process_id); @@ -457,6 +458,9 @@ static inline bool capture_needs_reset(struct game_capture_config *cfg1, static bool hotkey_start(void *data, obs_hotkey_pair_id id, obs_hotkey_t *hotkey, bool pressed) { + UNUSED_PARAMETER(id); + UNUSED_PARAMETER(hotkey); + struct game_capture *gc = data; if (pressed && gc->config.mode == CAPTURE_MODE_HOTKEY) { @@ -473,6 +477,9 @@ static bool hotkey_start(void *data, obs_hotkey_pair_id id, static bool hotkey_stop(void *data, obs_hotkey_pair_id id, obs_hotkey_t *hotkey, bool pressed) { + UNUSED_PARAMETER(id); + UNUSED_PARAMETER(hotkey); + struct game_capture *gc = data; if (pressed && gc->config.mode == CAPTURE_MODE_HOTKEY) { diff --git a/plugins/win-capture/window-capture.c b/plugins/win-capture/window-capture.c index 933fd21a0..d307ee6be 100644 --- a/plugins/win-capture/window-capture.c +++ b/plugins/win-capture/window-capture.c @@ -26,19 +26,33 @@ #define WC_CHECK_TIMER 1.0f +typedef BOOL (*PFN_winrt_capture_supported)(); +typedef BOOL (*PFN_winrt_capture_cursor_toggle_supported)(); +typedef struct winrt_capture *(*PFN_winrt_capture_init)(BOOL cursor, + HWND window, + BOOL client_area); +typedef void (*PFN_winrt_capture_free)(struct winrt_capture *capture); + +typedef BOOL (*PFN_winrt_capture_active)(const struct winrt_capture *capture); +typedef void (*PFN_winrt_capture_show_cursor)(struct winrt_capture *capture, + BOOL visible); +typedef void (*PFN_winrt_capture_render)(struct winrt_capture *capture, + gs_effect_t *effect); +typedef uint32_t (*PFN_winrt_capture_width)(const struct winrt_capture *capture); +typedef uint32_t (*PFN_winrt_capture_height)( + const struct winrt_capture *capture); + struct winrt_exports { - BOOL *(*winrt_capture_supported)(); - BOOL *(*winrt_capture_cursor_toggle_supported)(); - struct winrt_capture *(*winrt_capture_init)(BOOL cursor, HWND window, - BOOL client_area); - void (*winrt_capture_free)(struct winrt_capture *capture); - BOOL *(*winrt_capture_active)(const struct winrt_capture *capture); - void (*winrt_capture_show_cursor)(struct winrt_capture *capture, - BOOL visible); - void (*winrt_capture_render)(struct winrt_capture *capture, - gs_effect_t *effect); - uint32_t (*winrt_capture_width)(const struct winrt_capture *capture); - uint32_t (*winrt_capture_height)(const struct winrt_capture *capture); + PFN_winrt_capture_supported winrt_capture_supported; + PFN_winrt_capture_cursor_toggle_supported + winrt_capture_cursor_toggle_supported; + PFN_winrt_capture_init winrt_capture_init; + PFN_winrt_capture_free winrt_capture_free; + PFN_winrt_capture_active winrt_capture_active; + PFN_winrt_capture_show_cursor winrt_capture_show_cursor; + PFN_winrt_capture_render winrt_capture_render; + PFN_winrt_capture_width winrt_capture_width; + PFN_winrt_capture_height winrt_capture_height; }; enum window_capture_method { @@ -191,16 +205,16 @@ static const char *wc_getname(void *unused) return TEXT_WINDOW_CAPTURE; } -#define WINRT_IMPORT(func) \ - do { \ - exports->func = os_dlsym(module, #func); \ - if (!exports->func) { \ - success = false; \ - blog(LOG_ERROR, \ - "Could not load function '%s' from " \ - "module '%s'", \ - #func, module_name); \ - } \ +#define WINRT_IMPORT(func) \ + do { \ + exports->func = (PFN_##func)os_dlsym(module, #func); \ + if (!exports->func) { \ + success = false; \ + blog(LOG_ERROR, \ + "Could not load function '%s' from " \ + "module '%s'", \ + #func, module_name); \ + } \ } while (false) static bool load_winrt_imports(struct winrt_exports *exports, void *module,