diff --git a/driver.h b/driver.h index db451704d2..a14d9a743d 100644 --- a/driver.h +++ b/driver.h @@ -440,7 +440,6 @@ typedef struct driver menu_handle_t *menu; const menu_ctx_driver_t *menu_ctx; #endif - bool threaded_video; /* If set during context deinit, the driver should keep diff --git a/libretro_version_1.c b/libretro_version_1.c index a334d0170f..9ff25775be 100644 --- a/libretro_version_1.c +++ b/libretro_version_1.c @@ -226,7 +226,15 @@ static size_t audio_sample_batch_rewind(const int16_t *data, size_t frames) return frames; } -void retro_init_libretro_cbs(void) +void retro_set_default_callbacks(struct retro_callbacks* cbs) +{ + cbs->frame_cb = video_frame; + cbs->sample_cb = audio_sample; + cbs->sample_batch_cb = audio_sample_batch; + cbs->state_cb = input_state; +} + +void retro_init_libretro_cbs(struct retro_callbacks* cbs) { pretro_set_video_refresh(video_frame); pretro_set_audio_sample(audio_sample); @@ -234,6 +242,8 @@ void retro_init_libretro_cbs(void) pretro_set_input_state(input_state); pretro_set_input_poll(rarch_input_poll); + retro_set_default_callbacks(cbs); + #ifdef HAVE_NETPLAY if (!g_extern.netplay) return; @@ -255,20 +265,6 @@ void retro_init_libretro_cbs(void) #endif } -void retro_video_frame(const void *data, unsigned width, - unsigned height, size_t pitch) -{ - video_frame(data, width, height, pitch); -} - -void retro_set_default_callbacks(struct retro_callbacks* cbs) -{ - cbs->frame_cb = video_frame; - cbs->sample_cb = audio_sample; - cbs->sample_batch_cb = audio_sample_batch; - cbs->state_cb = input_state; -} - void retro_set_rewind_callbacks(void) { if (g_extern.frame_is_reverse) diff --git a/retro.h b/retro.h index f50c56c703..ce96d74a74 100644 --- a/retro.h +++ b/retro.h @@ -28,13 +28,8 @@ struct retro_callbacks retro_input_state_t state_cb; }; -void retro_init_libretro_cbs(void); - -void retro_video_frame(const void *data, unsigned width, - unsigned height, size_t pitch); - +void retro_init_libretro_cbs(struct retro_callbacks* cbs); void retro_set_default_callbacks(struct retro_callbacks* cbs); - void retro_set_rewind_callbacks(void); #endif diff --git a/retroarch.c b/retroarch.c index 24c06f6f36..295c7fdaa0 100644 --- a/retroarch.c +++ b/retroarch.c @@ -57,6 +57,8 @@ #include "msvc/msvc_compat.h" #endif +struct retro_callbacks retro_ctx; + /* To avoid continous switching if we hold the button down, we require * that the button must go from pressed to unpressed back to pressed * to be able to toggle between then. @@ -443,7 +445,8 @@ void rarch_render_cached_frame(void) * freed the memory, but no known implementations do this. * It would be really stupid at any rate ... */ - retro_video_frame(frame, + if (retro_ctx.frame_cb) + retro_ctx.frame_cb(frame, g_extern.frame_cache.width, g_extern.frame_cache.height, g_extern.frame_cache.pitch); @@ -2854,7 +2857,7 @@ int rarch_main_init(int argc, char *argv[]) #endif } - retro_init_libretro_cbs(); + retro_init_libretro_cbs(&retro_ctx); init_system_av_info(); init_drivers();