(input_overlay.c) remove more hacks

This commit is contained in:
twinaphex 2016-11-27 15:17:44 +01:00
parent 7f339a8f84
commit 267fdbe21e
4 changed files with 16 additions and 19 deletions

View File

@ -2046,7 +2046,7 @@ bool command_event(enum event_command cmd, void *data)
break; break;
case CMD_EVENT_OVERLAY_NEXT: case CMD_EVENT_OVERLAY_NEXT:
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
input_overlay_next(settings->input.overlay_opacity); input_overlay_next(overlay_ptr, settings->input.overlay_opacity);
#endif #endif
break; break;
case CMD_EVENT_DSP_FILTER_DEINIT: case CMD_EVENT_DSP_FILTER_DEINIT:
@ -2189,7 +2189,7 @@ bool command_event(enum event_command cmd, void *data)
break; break;
case CMD_EVENT_OVERLAY_SET_ALPHA_MOD: case CMD_EVENT_OVERLAY_SET_ALPHA_MOD:
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
input_overlay_set_alpha_mod(settings->input.overlay_opacity); input_overlay_set_alpha_mod(overlay_ptr, settings->input.overlay_opacity);
#endif #endif
break; break;
case CMD_EVENT_AUDIO_REINIT: case CMD_EVENT_AUDIO_REINIT:

View File

@ -636,7 +636,7 @@ static INLINE bool input_keys_pressed_internal(unsigned i,
} }
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
if (input_overlay_key_pressed(i)) if (overlay_ptr && input_overlay_key_pressed(overlay_ptr, i))
return true; return true;
#endif #endif
@ -741,7 +741,7 @@ static INLINE bool input_menu_keys_pressed_internal(unsigned i)
} }
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
if (input_overlay_key_pressed(i)) if (overlay_ptr && input_overlay_key_pressed(overlay_ptr, i))
return true; return true;
#endif #endif

View File

@ -206,7 +206,7 @@ static void input_overlay_load_active(input_overlay_t *ol, float opacity)
ol->iface->load(ol->iface_data, ol->active->load_images, ol->iface->load(ol->iface_data, ol->active->load_images,
ol->active->load_images_size); ol->active->load_images_size);
input_overlay_set_alpha_mod(opacity); input_overlay_set_alpha_mod(ol, opacity);
input_overlay_set_vertex_geom(ol); input_overlay_set_vertex_geom(ol);
if (ol->iface->full_screen) if (ol->iface->full_screen)
@ -392,7 +392,7 @@ static void input_overlay_post_poll(input_overlay_t *ol, float opacity)
{ {
size_t i; size_t i;
input_overlay_set_alpha_mod(opacity); input_overlay_set_alpha_mod(ol, opacity);
for (i = 0; i < ol->active->size; i++) for (i = 0; i < ol->active->size; i++)
{ {
@ -433,7 +433,7 @@ static void input_overlay_poll_clear(input_overlay_t *ol, float opacity)
ol->blocked = false; ol->blocked = false;
input_overlay_set_alpha_mod(opacity); input_overlay_set_alpha_mod(ol, opacity);
for (i = 0; i < ol->active->size; i++) for (i = 0; i < ol->active->size; i++)
{ {
@ -456,9 +456,8 @@ static void input_overlay_poll_clear(input_overlay_t *ol, float opacity)
* Switch to the next available overlay * Switch to the next available overlay
* screen. * screen.
**/ **/
void input_overlay_next(float opacity) void input_overlay_next(input_overlay_t *ol, float opacity)
{ {
input_overlay_t *ol = overlay_ptr;
if (!ol) if (!ol)
return; return;
@ -570,10 +569,9 @@ abort_load:
* Sets a modulating factor for alpha channel. Default is 1.0. * Sets a modulating factor for alpha channel. Default is 1.0.
* The alpha factor is applied for all overlays. * The alpha factor is applied for all overlays.
**/ **/
void input_overlay_set_alpha_mod(float mod) void input_overlay_set_alpha_mod(input_overlay_t *ol, float mod)
{ {
unsigned i; unsigned i;
input_overlay_t *ol = overlay_ptr;
if (!ol) if (!ol)
return; return;
@ -589,9 +587,8 @@ bool input_overlay_is_alive(input_overlay_t *ol)
return false; return false;
} }
bool input_overlay_key_pressed(int key) bool input_overlay_key_pressed(input_overlay_t *ol, int key)
{ {
input_overlay_t *ol = overlay_ptr;
input_overlay_state_t *ol_state = ol ? &ol->overlay_state : NULL; input_overlay_state_t *ol_state = ol ? &ol->overlay_state : NULL;
if (!ol) if (!ol)
return false; return false;
@ -694,9 +691,9 @@ void input_poll_overlay(input_overlay_t *ol, float opacity)
if (ol_state->analog[j]) if (ol_state->analog[j])
continue; continue;
if (input_overlay_key_pressed(bind_plus)) if (input_overlay_key_pressed(ol, bind_plus))
ol_state->analog[j] += 0x7fff; ol_state->analog[j] += 0x7fff;
if (input_overlay_key_pressed(bind_minus)) if (input_overlay_key_pressed(ol, bind_minus))
ol_state->analog[j] -= 0x7fff; ol_state->analog[j] -= 0x7fff;
} }
@ -749,7 +746,7 @@ void input_state_overlay(int16_t *ret, unsigned port, unsigned device, unsigned
switch (device) switch (device)
{ {
case RETRO_DEVICE_JOYPAD: case RETRO_DEVICE_JOYPAD:
if (input_overlay_key_pressed(id)) if (input_overlay_key_pressed(ol, id))
*ret |= 1; *ret |= 1;
break; break;
case RETRO_DEVICE_KEYBOARD: case RETRO_DEVICE_KEYBOARD:

View File

@ -208,7 +208,7 @@ void input_overlay_init(void);
* Sets a modulating factor for alpha channel. Default is 1.0. * Sets a modulating factor for alpha channel. Default is 1.0.
* The alpha factor is applied for all overlays. * The alpha factor is applied for all overlays.
**/ **/
void input_overlay_set_alpha_mod(float mod); void input_overlay_set_alpha_mod(input_overlay_t *ol, float mod);
/** /**
* input_overlay_set_scale_factor: * input_overlay_set_scale_factor:
@ -224,7 +224,7 @@ void input_overlay_set_scale_factor(input_overlay_t *ol, float scale);
* Switch to the next available overlay * Switch to the next available overlay
* screen. * screen.
**/ **/
void input_overlay_next(float opacity); void input_overlay_next(input_overlay_t *ol, float opacity);
/* /*
* input_poll_overlay: * input_poll_overlay:
@ -238,7 +238,7 @@ void input_state_overlay(int16_t *ret,
unsigned port, unsigned device, unsigned idx, unsigned port, unsigned device, unsigned idx,
unsigned id); unsigned id);
bool input_overlay_key_pressed(int key); bool input_overlay_key_pressed(input_overlay_t *ol, int key);
bool input_overlay_is_alive(input_overlay_t *ol); bool input_overlay_is_alive(input_overlay_t *ol);