Go through static variable retro_ctx for libretro backend

functions
This commit is contained in:
twinaphex 2014-09-23 03:55:19 +02:00
parent 10b6384bb2
commit 63680ca5b4
4 changed files with 17 additions and 24 deletions

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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();