mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 09:40:06 +00:00
Get rid of some unnecessary function callback wrapper functions
This commit is contained in:
parent
0bb1de9561
commit
a0924a414f
14
core.h
14
core.h
@ -141,14 +141,6 @@ typedef struct retro_ctx_environ_info
|
||||
retro_environment_t env;
|
||||
} retro_ctx_environ_info_t;
|
||||
|
||||
typedef struct retro_ctx_frame_info
|
||||
{
|
||||
const void *data;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
size_t pitch;
|
||||
} retro_ctx_frame_info_t;
|
||||
|
||||
typedef struct retro_callbacks
|
||||
{
|
||||
retro_video_refresh_t frame_cb;
|
||||
@ -185,10 +177,6 @@ bool core_unload_game(void);
|
||||
|
||||
bool core_reset(void);
|
||||
|
||||
void core_frame(retro_ctx_frame_info_t *info);
|
||||
|
||||
bool core_poll(void);
|
||||
|
||||
bool core_set_environment(retro_ctx_environ_info_t *info);
|
||||
|
||||
bool core_serialize_size(retro_ctx_size_info_t *info);
|
||||
@ -249,6 +237,8 @@ bool core_is_inited(void);
|
||||
|
||||
bool core_is_game_loaded(void);
|
||||
|
||||
extern struct retro_callbacks retro_ctx;
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
46
core_impl.c
46
core_impl.c
@ -44,9 +44,22 @@
|
||||
#include "gfx/video_driver.h"
|
||||
#include "audio/audio_driver.h"
|
||||
|
||||
static struct retro_callbacks retro_ctx;
|
||||
struct retro_callbacks retro_ctx;
|
||||
struct retro_core_t current_core;
|
||||
|
||||
static void retro_run_null(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void retro_frame_null(const void *data, unsigned width,
|
||||
unsigned height, size_t pitch)
|
||||
{
|
||||
}
|
||||
|
||||
static void retro_input_poll_null(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void core_input_state_poll_maybe(void)
|
||||
{
|
||||
if (current_core.poll_type == POLL_TYPE_NORMAL)
|
||||
@ -133,11 +146,11 @@ bool core_deinit(void *data)
|
||||
if (!cbs)
|
||||
return false;
|
||||
|
||||
cbs->frame_cb = NULL;
|
||||
cbs->frame_cb = retro_frame_null;
|
||||
cbs->sample_cb = NULL;
|
||||
cbs->sample_batch_cb = NULL;
|
||||
cbs->state_cb = NULL;
|
||||
cbs->poll_cb = NULL;
|
||||
cbs->poll_cb = retro_input_poll_null;
|
||||
|
||||
current_core.inited = false;
|
||||
|
||||
@ -244,10 +257,6 @@ void core_uninit_symbols(void)
|
||||
current_core.symbols_inited = false;
|
||||
}
|
||||
|
||||
static void retro_run_null(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool core_init_symbols(enum rarch_core_type *type)
|
||||
{
|
||||
if (!type)
|
||||
@ -308,9 +317,7 @@ bool core_get_system_info(struct retro_system_info *system)
|
||||
|
||||
bool core_unserialize(retro_ctx_serialize_info_t *info)
|
||||
{
|
||||
if (!info)
|
||||
return false;
|
||||
if (!current_core.retro_unserialize(info->data_const, info->size))
|
||||
if (!info || !current_core.retro_unserialize(info->data_const, info->size))
|
||||
return false;
|
||||
|
||||
#if HAVE_NETWORKING
|
||||
@ -322,9 +329,7 @@ bool core_unserialize(retro_ctx_serialize_info_t *info)
|
||||
|
||||
bool core_serialize(retro_ctx_serialize_info_t *info)
|
||||
{
|
||||
if (!info)
|
||||
return false;
|
||||
if (!current_core.retro_serialize(info->data, info->size))
|
||||
if (!info || !current_core.retro_serialize(info->data, info->size))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@ -347,21 +352,6 @@ void core_set_serialization_quirks(uint64_t quirks)
|
||||
current_core.serialization_quirks_v = quirks;
|
||||
}
|
||||
|
||||
void core_frame(retro_ctx_frame_info_t *info)
|
||||
{
|
||||
if (retro_ctx.frame_cb)
|
||||
retro_ctx.frame_cb(
|
||||
info->data, info->width, info->height, info->pitch);
|
||||
}
|
||||
|
||||
bool core_poll(void)
|
||||
{
|
||||
if (!retro_ctx.poll_cb)
|
||||
return false;
|
||||
retro_ctx.poll_cb();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool core_set_environment(retro_ctx_environ_info_t *info)
|
||||
{
|
||||
if (!info)
|
||||
|
@ -1363,23 +1363,16 @@ void video_driver_set_pixel_format(enum retro_pixel_format fmt)
|
||||
**/
|
||||
bool video_driver_cached_frame(void)
|
||||
{
|
||||
retro_ctx_frame_info_t info;
|
||||
void *recording = recording_driver_get_data_ptr();
|
||||
|
||||
/* Cannot allow recording when pushing duped frames. */
|
||||
recording_data = NULL;
|
||||
|
||||
/* Not 100% safe, since the library might have
|
||||
* freed the memory, but no known implementations do this.
|
||||
* It would be really stupid at any rate ...
|
||||
*/
|
||||
info.data = (frame_cache_data != RETRO_HW_FRAME_BUFFER_VALID)
|
||||
? frame_cache_data : NULL;
|
||||
info.width = frame_cache_width;
|
||||
info.height = frame_cache_height;
|
||||
info.pitch = frame_cache_pitch;
|
||||
|
||||
core_frame(&info);
|
||||
retro_ctx.frame_cb(
|
||||
(frame_cache_data != RETRO_HW_FRAME_BUFFER_VALID)
|
||||
? frame_cache_data : NULL,
|
||||
frame_cache_width,
|
||||
frame_cache_height, frame_cache_pitch);
|
||||
|
||||
recording_data = recording;
|
||||
|
||||
|
@ -2664,7 +2664,7 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||
unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS));
|
||||
uint64_t current_input = 0;
|
||||
|
||||
core_poll();
|
||||
retro_ctx.poll_cb();
|
||||
|
||||
current_input =
|
||||
#ifdef HAVE_MENU
|
||||
|
Loading…
x
Reference in New Issue
Block a user