mirror of
https://github.com/libretro/RetroArch.git
synced 2024-12-17 22:29:27 +00:00
Go through static variable retro_ctx for libretro backend
functions
This commit is contained in:
parent
10b6384bb2
commit
63680ca5b4
1
driver.h
1
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
|
||||
|
@ -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)
|
||||
|
7
retro.h
7
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
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user