mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Start getting rid of driver_funcs.h macros
This commit is contained in:
parent
5a2d59d0e3
commit
e851d279f8
20
driver.c
20
driver.c
@ -249,7 +249,7 @@ void init_osk(void)
|
||||
find_osk_driver();
|
||||
|
||||
//FIXME - refactor params later based on semantics
|
||||
driver.osk_data = osk_init_func(0);
|
||||
driver.osk_data = driver.osk->init(0);
|
||||
|
||||
if (!driver.osk_data)
|
||||
{
|
||||
@ -364,7 +364,7 @@ void init_camera(void)
|
||||
|
||||
find_camera_driver();
|
||||
|
||||
driver.camera_data = camera_init_func(
|
||||
driver.camera_data = driver.camera->init(
|
||||
*g_settings.camera.device ? g_settings.camera.device : NULL,
|
||||
g_extern.system.camera_callback.caps,
|
||||
g_settings.camera.width ? g_settings.camera.width : g_extern.system.camera_callback.width,
|
||||
@ -495,7 +495,7 @@ void init_location(void)
|
||||
|
||||
find_location_driver();
|
||||
|
||||
driver.location_data = location_init_func();
|
||||
driver.location_data = driver.location->init();
|
||||
|
||||
if (!driver.location_data)
|
||||
{
|
||||
@ -1109,7 +1109,7 @@ void init_audio(void)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
driver.audio_data = audio_init_func(*g_settings.audio.device ? g_settings.audio.device : NULL,
|
||||
driver.audio_data = driver.audio->init(*g_settings.audio.device ? g_settings.audio.device : NULL,
|
||||
g_settings.audio.out_rate, g_settings.audio.latency);
|
||||
}
|
||||
|
||||
@ -1489,9 +1489,9 @@ void init_video_input(void)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
driver.video_data = video_init_func(&video, &driver.input, &driver.input_data);
|
||||
driver.video_data = driver.video->init(&video, &driver.input, &driver.input_data);
|
||||
|
||||
if (driver.video_data == NULL)
|
||||
if (!driver.video_data)
|
||||
{
|
||||
RARCH_ERR("Cannot open video driver ... Exiting ...\n");
|
||||
rarch_fail(1, "init_video_input()");
|
||||
@ -1521,7 +1521,7 @@ void init_video_input(void)
|
||||
#endif
|
||||
|
||||
// Video driver didn't provide an input driver so we use configured one.
|
||||
if (driver.input == NULL)
|
||||
if (!driver.input)
|
||||
{
|
||||
|
||||
RARCH_LOG("Graphics driver did not initialize an input driver. Attempting to pick a suitable driver.\n");
|
||||
@ -1533,7 +1533,7 @@ void init_video_input(void)
|
||||
|
||||
if (driver.input)
|
||||
{
|
||||
driver.input_data = input_init_func();
|
||||
driver.input_data = driver.input->init();
|
||||
if (!driver.input_data)
|
||||
{
|
||||
RARCH_ERR("Cannot initialize input driver. Exiting ...\n");
|
||||
@ -1563,11 +1563,11 @@ void uninit_video_input(void)
|
||||
#endif
|
||||
|
||||
if (!driver.input_data_own && driver.input_data != driver.video_data && driver.input && driver.input->free)
|
||||
input_free_func();
|
||||
driver.input->free(driver.input_data);
|
||||
|
||||
|
||||
if (!driver.video_data_own && driver.video_data && driver.video && driver.video->free)
|
||||
video_free_func();
|
||||
driver.video->free(driver.video_data);
|
||||
|
||||
deinit_pixel_converter();
|
||||
|
||||
|
@ -18,14 +18,6 @@
|
||||
#ifndef _RARCH_DRIVER_FUNCS_H
|
||||
#define _RARCH_DRIVER_FUNCS_H
|
||||
|
||||
#define camera_init_func(device, caps, width, height) driver.camera->init(device, caps, width, height)
|
||||
|
||||
#define location_init_func() driver.location->init()
|
||||
|
||||
#define osk_init_func(unknown) driver.osk->init(unknown)
|
||||
|
||||
#define audio_init_func(device, rate, latency) driver.audio->init(device, rate, latency)
|
||||
#define audio_write_func(buf, size) driver.audio->write(driver.audio_data, buf, size)
|
||||
#define audio_stop_func() driver.audio->stop(driver.audio_data)
|
||||
#define audio_start_func() driver.audio->start(driver.audio_data)
|
||||
#define audio_set_nonblock_state_func(state) driver.audio->set_nonblock_state(driver.audio_data, state)
|
||||
@ -34,10 +26,6 @@
|
||||
#define audio_write_avail_func() driver.audio->write_avail(driver.audio_data)
|
||||
#define audio_buffer_size_func() driver.audio->buffer_size(driver.audio_data)
|
||||
|
||||
#define video_init_func(video_info, input, input_data) \
|
||||
driver.video->init(video_info, input, input_data)
|
||||
#define video_frame_func(data, width, height, pitch, msg) \
|
||||
driver.video->frame(driver.video_data, data, width, height, pitch, msg)
|
||||
#define video_set_nonblock_state_func(state) driver.video->set_nonblock_state(driver.video_data, state)
|
||||
#define video_alive_func() driver.video->alive(driver.video_data)
|
||||
#define video_focus_func() driver.video->focus(driver.video_data)
|
||||
@ -47,12 +35,6 @@
|
||||
#define video_viewport_info_func(info) driver.video->viewport_info(driver.video_data, info)
|
||||
#define video_read_viewport_func(buffer) driver.video->read_viewport(driver.video_data, buffer)
|
||||
#define video_overlay_interface_func(iface) driver.video->overlay_interface(driver.video_data, iface)
|
||||
#define video_free_func() driver.video->free(driver.video_data)
|
||||
#define input_init_func() driver.input->init()
|
||||
#define input_poll_func() driver.input->poll(driver.input_data)
|
||||
#define input_input_state_func(retro_keybinds, port, device, index, id) \
|
||||
driver.input->input_state(driver.input_data, retro_keybinds, port, device, index, id)
|
||||
#define input_free_func() driver.input->free(driver.input_data)
|
||||
|
||||
static inline bool input_key_pressed_func(int key)
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ void menu_poll_bind_state(struct menu_bind_state *state)
|
||||
|
||||
unsigned i, b, a, h;
|
||||
memset(state->state, 0, sizeof(state->state));
|
||||
state->skip = input_input_state_func(NULL, 0, RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN);
|
||||
state->skip = driver.input->input_state(driver.input_data, NULL, 0, RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN);
|
||||
|
||||
const rarch_joypad_driver_t *joypad = NULL;
|
||||
if (driver.input && driver.input_data && driver.input->get_joypad_driver)
|
||||
@ -326,7 +326,7 @@ uint64_t menu_input(void)
|
||||
{
|
||||
for (i = 0; i < RETRO_DEVICE_ID_JOYPAD_R2; i++)
|
||||
{
|
||||
input_state |= input_input_state_func(binds,
|
||||
input_state |= driver.input->input_state(driver.input_data, binds,
|
||||
0, RETRO_DEVICE_JOYPAD, 0, i) ? (1ULL << i) : 0;
|
||||
#ifdef HAVE_OVERLAY
|
||||
input_state |= (driver.overlay_state.buttons & (UINT64_C(1) << i)) ? (1ULL << i) : 0;
|
||||
|
@ -103,7 +103,7 @@ static PyObject *py_read_input(PyObject *self, PyObject *args)
|
||||
if (player > MAX_PLAYERS || player < 1 || key >= RARCH_FIRST_META_KEY)
|
||||
return NULL;
|
||||
|
||||
int16_t res = driver.block_libretro_input ? 0 : input_input_state_func(py_binds, player - 1, RETRO_DEVICE_JOYPAD, 0, key);
|
||||
int16_t res = driver.block_libretro_input ? 0 : driver.input->input_state(driver.input_data, py_binds, player - 1, RETRO_DEVICE_JOYPAD, 0, key);
|
||||
return PyBool_FromLong(res);
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ static PyObject *py_read_analog(PyObject *self, PyObject *args)
|
||||
if (player > MAX_PLAYERS || player < 1 || index > 1 || id > 1)
|
||||
return NULL;
|
||||
|
||||
int16_t res = input_input_state_func(py_binds, player - 1, RETRO_DEVICE_ANALOG, index, id);
|
||||
int16_t res = driver.input->input_state(driver.input_data, py_binds, player - 1, RETRO_DEVICE_ANALOG, index, id);
|
||||
return PyFloat_FromDouble((double)res / 0x7fff);
|
||||
}
|
||||
|
||||
|
@ -255,8 +255,8 @@ static void update_input(state_tracker_t *tracker)
|
||||
{
|
||||
for (i = 4; i < 16; i++)
|
||||
{
|
||||
state[0] |= (input_input_state_func(binds, 0, RETRO_DEVICE_JOYPAD, 0, buttons[i - 4]) ? 1 : 0) << i;
|
||||
state[1] |= (input_input_state_func(binds, 1, RETRO_DEVICE_JOYPAD, 0, buttons[i - 4]) ? 1 : 0) << i;
|
||||
state[0] |= (driver.input->input_state(driver.input_data, binds, 0, RETRO_DEVICE_JOYPAD, 0, buttons[i - 4]) ? 1 : 0) << i;
|
||||
state[1] |= (driver.input->input_state(driver.input_data, binds, 1, RETRO_DEVICE_JOYPAD, 0, buttons[i - 4]) ? 1 : 0) << i;
|
||||
}
|
||||
}
|
||||
|
||||
|
18
retroarch.c
18
retroarch.c
@ -464,7 +464,7 @@ static void video_frame(const void *data, unsigned width, unsigned height, size_
|
||||
pitch = opitch;
|
||||
}
|
||||
|
||||
if (!video_frame_func(data, width, height, pitch, msg))
|
||||
if (!driver.video->frame(driver.video_data, data, width, height, pitch, msg))
|
||||
g_extern.video_active = false;
|
||||
}
|
||||
|
||||
@ -563,7 +563,7 @@ static bool audio_flush(const int16_t *data, size_t samples)
|
||||
output_size = sizeof(int16_t);
|
||||
}
|
||||
|
||||
if (audio_write_func(output_data, output_frames * output_size * 2) < 0)
|
||||
if (driver.audio->write(driver.audio_data, output_data, output_frames * output_size * 2) < 0)
|
||||
{
|
||||
RARCH_ERR("Audio backend failed to write. Will continue without sound.\n");
|
||||
return false;
|
||||
@ -627,12 +627,12 @@ static inline void input_poll_overlay(void)
|
||||
RARCH_DEVICE_POINTER_SCREEN : RETRO_DEVICE_POINTER;
|
||||
|
||||
for (i = 0;
|
||||
input_input_state_func(NULL, 0, device, i, RETRO_DEVICE_ID_POINTER_PRESSED);
|
||||
driver.input->input_state(driver.input_data, NULL, 0, device, i, RETRO_DEVICE_ID_POINTER_PRESSED);
|
||||
i++)
|
||||
{
|
||||
int16_t x = input_input_state_func(NULL, 0,
|
||||
int16_t x = driver.input->input_state(driver.input_data, NULL, 0,
|
||||
device, i, RETRO_DEVICE_ID_POINTER_X);
|
||||
int16_t y = input_input_state_func(NULL, 0,
|
||||
int16_t y = driver.input->input_state(driver.input_data, NULL, 0,
|
||||
device, i, RETRO_DEVICE_ID_POINTER_Y);
|
||||
|
||||
input_overlay_state_t polled_data;
|
||||
@ -715,7 +715,7 @@ static inline void input_poll_overlay(void)
|
||||
|
||||
void rarch_input_poll(void)
|
||||
{
|
||||
input_poll_func();
|
||||
driver.input->poll(driver.input_data);
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (driver.overlay)
|
||||
@ -770,7 +770,7 @@ static int16_t input_state(unsigned port, unsigned device, unsigned index, unsig
|
||||
};
|
||||
|
||||
if (!driver.block_libretro_input && (id < RARCH_FIRST_META_KEY || device == RETRO_DEVICE_KEYBOARD))
|
||||
res = input_input_state_func(binds, port, device, index, id);
|
||||
res = driver.input->input_state(driver.input_data, binds, port, device, index, id);
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (device == RETRO_DEVICE_JOYPAD && port == 0)
|
||||
@ -2010,7 +2010,7 @@ static void set_fullscreen(bool fullscreen)
|
||||
|
||||
// Poll input to avoid possibly stale data to corrupt things.
|
||||
if (driver.input)
|
||||
input_poll_func();
|
||||
driver.input->poll(driver.input_data);
|
||||
}
|
||||
|
||||
bool rarch_check_fullscreen(void)
|
||||
@ -2355,7 +2355,7 @@ static void check_turbo(void)
|
||||
{
|
||||
for (i = 0; i < MAX_PLAYERS; i++)
|
||||
g_extern.turbo_frame_enable[i] =
|
||||
input_input_state_func(binds, i, RETRO_DEVICE_JOYPAD, 0, RARCH_TURBO_ENABLE);
|
||||
driver.input->input_state(driver.input_data, binds, i, RETRO_DEVICE_JOYPAD, 0, RARCH_TURBO_ENABLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user