diff --git a/libretro_version_1.c b/libretro_version_1.c index 9ff25775be..06a1d2785e 100644 --- a/libretro_version_1.c +++ b/libretro_version_1.c @@ -17,6 +17,7 @@ #include "boolean.h" #include "libretro.h" +#include "retro.h" #include #include #include @@ -226,16 +227,26 @@ static size_t audio_sample_batch_rewind(const int16_t *data, size_t frames) return frames; } -void retro_set_default_callbacks(struct retro_callbacks* cbs) +void retro_set_default_callbacks(void *data) { - cbs->frame_cb = video_frame; - cbs->sample_cb = audio_sample; + struct retro_callbacks *cbs = (struct retro_callbacks*)data; + + if (!cbs) + return; + + cbs->frame_cb = video_frame; + cbs->sample_cb = audio_sample; cbs->sample_batch_cb = audio_sample_batch; - cbs->state_cb = input_state; + cbs->state_cb = input_state; } -void retro_init_libretro_cbs(struct retro_callbacks* cbs) +void retro_init_libretro_cbs(void *data) { + struct retro_callbacks *cbs = (struct retro_callbacks*)data; + + if (!cbs) + return; + pretro_set_video_refresh(video_frame); pretro_set_audio_sample(audio_sample); pretro_set_audio_sample_batch(audio_sample_batch); diff --git a/retro.h b/retro.h index ce96d74a74..e5e7eff43f 100644 --- a/retro.h +++ b/retro.h @@ -20,16 +20,16 @@ #include "libretro.h" -struct retro_callbacks +typedef struct retro_callbacks { retro_video_refresh_t frame_cb; retro_audio_sample_t sample_cb; retro_audio_sample_batch_t sample_batch_cb; retro_input_state_t state_cb; -}; +} retro_callbacks_t; -void retro_init_libretro_cbs(struct retro_callbacks* cbs); -void retro_set_default_callbacks(struct retro_callbacks* cbs); +void retro_init_libretro_cbs(void *data); +void retro_set_default_callbacks(void *data); void retro_set_rewind_callbacks(void); #endif