102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
hooks.c File Reference
#include "hooks_private.h"
#include "mss_private.h"
#include "sidecar_private.h"
#include <dttr_log.h>
#include <dttr_pcdogs.h>
#include <SDL3/SDL.h>

Go to the source code of this file.

Functions

static int32_t audio_init_system ()
static int32_t audio_init_system_detour ()
static int32_t audio_stop_all_sounds_detour ()
static int32_t audio_init_level_audio_detour ()
static int32_t audio_stop_all_samples_detour ()
static bool has_playback_devices ()
static bool has_audio_driver ()
static int32_t run_guarded_audio_hook (int32_t(*original)(), bool stop_all_samples)
static void handle_audio_device_removed ()
static void handle_audio_device_added ()
void dttr_audio_handle_device_event (const SDL_Event *event)
bool dttr_audio_init (const DTTR_Mods_Context *ctx)
void dttr_audio_cleanup (const DTTR_Mods_Context *)

Variables

static DTTR_PCDOGS_F_Audio_InitializeSystem_proto audio_init_system_original
static DTTR_PCDOGS_F_Audio_StopAllSounds_proto audio_stop_all_sounds_original
static DTTR_PCDOGS_F_Audio_InitializeLevelAudio_proto audio_init_level_audio_original
static DTTR_PCDOGS_F_Audio_StopAllSamples_proto audio_stop_all_samples_original
static DTTR_Core_PatchGroupaudio_patch_group

Function Documentation

◆ audio_init_level_audio_detour()

int32_t audio_init_level_audio_detour ( )
static

Definition at line 101 of file hooks.c.

References audio_init_level_audio_original, and run_guarded_audio_hook().

Referenced by dttr_audio_init().

◆ audio_init_system()

int32_t audio_init_system ( )
static

◆ audio_init_system_detour()

int32_t audio_init_system_detour ( )
static

Definition at line 91 of file hooks.c.

References audio_init_system().

Referenced by dttr_audio_init().

◆ audio_stop_all_samples_detour()

int32_t audio_stop_all_samples_detour ( )
static

Definition at line 106 of file hooks.c.

References audio_stop_all_samples_original, and run_guarded_audio_hook().

Referenced by dttr_audio_init().

◆ audio_stop_all_sounds_detour()

int32_t audio_stop_all_sounds_detour ( )
static

Definition at line 96 of file hooks.c.

References audio_stop_all_sounds_original, and run_guarded_audio_hook().

Referenced by dttr_audio_init().

◆ dttr_audio_cleanup()

◆ dttr_audio_handle_device_event()

void dttr_audio_handle_device_event ( const SDL_Event * event)

Definition at line 111 of file hooks.c.

References event, handle_audio_device_added(), and handle_audio_device_removed().

Referenced by dttr_sidecar_handle_sdl_event().

◆ dttr_audio_init()

◆ handle_audio_device_added()

void handle_audio_device_added ( )
static

Definition at line 65 of file hooks.c.

References audio_init_system(), DTTR_LOG_ERROR, DTTR_LOG_INFO, and has_audio_driver().

Referenced by dttr_audio_handle_device_event().

◆ handle_audio_device_removed()

void handle_audio_device_removed ( )
static

◆ has_audio_driver()

◆ has_playback_devices()

bool has_playback_devices ( )
static

Definition at line 22 of file hooks.c.

References count.

Referenced by audio_init_system(), and handle_audio_device_removed().

◆ run_guarded_audio_hook()

int32_t run_guarded_audio_hook ( int32_t(* original )(),
bool stop_all_samples )
static

Variable Documentation

◆ audio_init_level_audio_original

DTTR_PCDOGS_F_Audio_InitializeLevelAudio_proto audio_init_level_audio_original
static

Definition at line 11 of file hooks.c.

Referenced by audio_init_level_audio_detour(), dttr_audio_cleanup(), and dttr_audio_init().

◆ audio_init_system_original

DTTR_PCDOGS_F_Audio_InitializeSystem_proto audio_init_system_original
static

Definition at line 9 of file hooks.c.

Referenced by audio_init_system(), dttr_audio_cleanup(), and dttr_audio_init().

◆ audio_patch_group

DTTR_Core_PatchGroup* audio_patch_group
static

Definition at line 13 of file hooks.c.

Referenced by dttr_audio_cleanup(), and dttr_audio_init().

◆ audio_stop_all_samples_original

DTTR_PCDOGS_F_Audio_StopAllSamples_proto audio_stop_all_samples_original
static

Definition at line 12 of file hooks.c.

Referenced by audio_stop_all_samples_detour(), dttr_audio_cleanup(), and dttr_audio_init().

◆ audio_stop_all_sounds_original

DTTR_PCDOGS_F_Audio_StopAllSounds_proto audio_stop_all_sounds_original
static

Definition at line 10 of file hooks.c.

Referenced by audio_stop_all_sounds_detour(), dttr_audio_cleanup(), and dttr_audio_init().