This commit is contained in:
twinaphex 2015-03-23 07:34:18 +01:00
parent 7f6c71dabc
commit d6981c3aad
2 changed files with 36 additions and 12 deletions

View File

@ -461,7 +461,9 @@ bool audio_driver_mute_toggle(void)
static int audio_driver_write_avail(void)
{
driver_t *driver = driver_get_ptr();
if (driver && driver->audio && driver->audio->write_avail)
if (driver
&& driver->audio
&& driver->audio->write_avail)
return driver->audio->write_avail(driver->audio_data);
return 0;
}
@ -501,7 +503,9 @@ void audio_driver_readjust_input_rate(void)
bool audio_driver_alive(void)
{
driver_t *driver = driver_get_ptr();
if (driver && driver->audio && driver->audio->alive)
if (driver
&& driver->audio
&& driver->audio->alive)
return driver->audio->alive(driver->audio_data);
return false;
}
@ -509,7 +513,9 @@ bool audio_driver_alive(void)
bool audio_driver_start(void)
{
driver_t *driver = driver_get_ptr();
if (driver && driver->audio && driver->audio->start)
if (driver
&& driver->audio
&& driver->audio->start)
return driver->audio->start(driver->audio_data);
return false;
}
@ -517,7 +523,9 @@ bool audio_driver_start(void)
bool audio_driver_stop(void)
{
driver_t *driver = driver_get_ptr();
if (driver && driver->audio && driver->audio->stop)
if (driver
&& driver->audio
&& driver->audio->stop)
return driver->audio->stop(driver->audio_data);
return false;
}
@ -525,14 +533,18 @@ bool audio_driver_stop(void)
void audio_driver_set_nonblock_state(bool toggle)
{
driver_t *driver = driver_get_ptr();
if (driver && driver->audio && driver->audio->set_nonblock_state)
if (driver
&& driver->audio
&& driver->audio->set_nonblock_state)
driver->audio->set_nonblock_state(driver->audio_data, toggle);
}
ssize_t audio_driver_write(const void *buf, size_t size)
{
driver_t *driver = driver_get_ptr();
if (driver && driver->audio && driver->audio->write)
if (driver
&& driver->audio
&& driver->audio->write)
return driver->audio->write(driver->audio_data, buf, size);
return 0;
}

View File

@ -219,7 +219,9 @@ int16_t input_driver_state(const struct retro_keybind **retro_keybinds,
unsigned port, unsigned device, unsigned index, unsigned id)
{
driver_t *driver = driver_get_ptr();
if (driver->input && driver->input_data && driver->input->set_rumble)
if (driver->input
&& driver->input_data
&& driver->input->set_rumble)
return driver->input->input_state(driver->input_data, retro_keybinds,
port, device, index, id);
return 0;
@ -228,7 +230,9 @@ int16_t input_driver_state(const struct retro_keybind **retro_keybinds,
void input_driver_poll(void)
{
driver_t *driver = driver_get_ptr();
if (driver->input && driver->input_data && driver->input->poll)
if (driver->input
&& driver->input_data
&& driver->input->poll)
driver->input->poll(driver->input_data);
}
@ -236,7 +240,9 @@ bool input_driver_key_pressed(int key)
{
driver_t *driver = driver_get_ptr();
if (driver && driver->input && driver->input->key_pressed)
if (driver
&& driver->input
&& driver->input->key_pressed)
return driver->input->key_pressed(driver->input_data, key);
return false;
}
@ -245,7 +251,9 @@ const rarch_joypad_driver_t * input_driver_get_joypad_driver(void)
{
driver_t *driver = driver_get_ptr();
if (driver && driver->input && driver->input->get_joypad_driver)
if (driver
&& driver->input
&& driver->input->get_joypad_driver)
return driver->input->get_joypad_driver(driver->input_data);
return NULL;
}
@ -263,7 +271,9 @@ bool input_driver_grab_mouse(bool state)
{
driver_t *driver = driver_get_ptr();
if (driver && driver->input && driver->input->grab_mouse)
if (driver
&& driver->input
&& driver->input->grab_mouse)
{
driver->input->grab_mouse(driver->input_data, state);
return true;
@ -284,6 +294,8 @@ void input_driver_free(void)
{
driver_t *driver = driver_get_ptr();
if (driver && driver->input && driver->input->free)
if (driver
&& driver->input
&& driver->input->free)
driver->input->free(driver->input_data);
}