This commit is contained in:
twinaphex 2021-09-20 21:08:53 +02:00
parent 295aa84a9e
commit d2af43d457
3 changed files with 72 additions and 85 deletions

View File

@ -178,8 +178,6 @@ enum frontend_architecture frontend_driver_get_cpu_architecture(void);
const void *frontend_driver_get_cpu_architecture_str( const void *frontend_driver_get_cpu_architecture_str(
char *frontend_architecture, size_t size); char *frontend_architecture, size_t size);
environment_get_t frontend_driver_environment_get_ptr(void);
bool frontend_driver_has_get_video_driver_func(void); bool frontend_driver_has_get_video_driver_func(void);
const struct video_driver *frontend_driver_get_video_driver(void); const struct video_driver *frontend_driver_get_video_driver(void);

View File

@ -346,8 +346,7 @@ bool input_driver_set_rumble_gain(
driver_state->primary_joypad->set_rumble_gain(i, gain); driver_state->primary_joypad->set_rumble_gain(i, gain);
return true; return true;
} }
else return false;
return false;
} }
/**************************************/ /**************************************/
@ -510,83 +509,82 @@ bool input_driver_toggle_button_combo(
return true; return true;
break; break;
case INPUT_TOGGLE_HOLD_START: case INPUT_TOGGLE_HOLD_START:
{
static rarch_timer_t timer = {0};
if (!BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_START))
{ {
/* timer only runs while start is held down */ static rarch_timer_t timer = {0};
timer.timer_end = true;
timer.timer_begin = false; if (!BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_START))
timer.timeout_end = 0; {
return false; /* timer only runs while start is held down */
timer.timer_end = true;
timer.timer_begin = false;
timer.timeout_end = 0;
return false;
}
/* User started holding down the start button, start the timer */
if (!timer.timer_begin)
{
uint64_t current_usec = cpu_features_get_time_usec();
timer.timeout_us = HOLD_BTN_DELAY_SEC * 1000000;
timer.current = current_usec;
timer.timeout_end = timer.current + timer.timeout_us;
timer.timer_begin = true;
timer.timer_end = false;
}
timer.current = current_time;
timer.timeout_us = (timer.timeout_end - timer.current);
if (!timer.timer_end && (timer.timeout_us <= 0))
{
/* start has been held down long enough,
* stop timer and enter menu */
timer.timer_end = true;
timer.timer_begin = false;
timer.timeout_end = 0;
return true;
}
} }
break;
/* User started holding down the start button, start the timer */
if (!timer.timer_begin)
{
uint64_t current_usec = cpu_features_get_time_usec();
timer.timeout_us = HOLD_BTN_DELAY_SEC * 1000000;
timer.current = current_usec;
timer.timeout_end = timer.current + timer.timeout_us;
timer.timer_begin = true;
timer.timer_end = false;
}
timer.current = current_time;
timer.timeout_us = (timer.timeout_end - timer.current);
if (!timer.timer_end && (timer.timeout_us <= 0))
{
/* start has been held down long enough,
* stop timer and enter menu */
timer.timer_end = true;
timer.timer_begin = false;
timer.timeout_end = 0;
return true;
}
return false;
}
case INPUT_TOGGLE_HOLD_SELECT: case INPUT_TOGGLE_HOLD_SELECT:
{
static rarch_timer_t timer = {0};
if (!BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_SELECT))
{ {
/* timer only runs while select is held down */ static rarch_timer_t timer = {0};
timer.timer_end = true;
timer.timer_begin = false; if (!BIT256_GET_PTR(p_input, RETRO_DEVICE_ID_JOYPAD_SELECT))
timer.timeout_end = 0; {
return false; /* timer only runs while select is held down */
timer.timer_end = true;
timer.timer_begin = false;
timer.timeout_end = 0;
return false;
}
/* user started holding down the select button, start the timer */
if (!timer.timer_begin)
{
uint64_t current_usec = cpu_features_get_time_usec();
timer.timeout_us = HOLD_BTN_DELAY_SEC * 1000000;
timer.current = current_usec;
timer.timeout_end = timer.current + timer.timeout_us;
timer.timer_begin = true;
timer.timer_end = false;
}
timer.current = current_time;
timer.timeout_us = (timer.timeout_end - timer.current);
if (!timer.timer_end && (timer.timeout_us <= 0))
{
/* select has been held down long enough,
* stop timer and enter menu */
timer.timer_end = true;
timer.timer_begin = false;
timer.timeout_end = 0;
return true;
}
} }
break;
/* user started holding down the select button, start the timer */
if (!timer.timer_begin)
{
uint64_t current_usec = cpu_features_get_time_usec();
timer.timeout_us = HOLD_BTN_DELAY_SEC * 1000000;
timer.current = current_usec;
timer.timeout_end = timer.current + timer.timeout_us;
timer.timer_begin = true;
timer.timer_end = false;
}
timer.current = current_time;
timer.timeout_us = (timer.timeout_end - timer.current);
if (!timer.timer_end && (timer.timeout_us <= 0))
{
/* select has been held down long enough,
* stop timer and enter menu */
timer.timer_end = true;
timer.timer_begin = false;
timer.timeout_end = 0;
return true;
}
return false;
}
default: default:
case INPUT_TOGGLE_NONE: case INPUT_TOGGLE_NONE:
break; break;

View File

@ -32773,15 +32773,6 @@ void frontend_driver_free(void)
p_rarch->current_frontend_ctx = NULL; p_rarch->current_frontend_ctx = NULL;
} }
environment_get_t frontend_driver_environment_get_ptr(void)
{
struct rarch_state *p_rarch = &rarch_st;
frontend_ctx_driver_t *frontend = p_rarch->current_frontend_ctx;
if (frontend)
return frontend->environment_get;
return NULL;
}
bool frontend_driver_has_get_video_driver_func(void) bool frontend_driver_has_get_video_driver_func(void)
{ {
struct rarch_state *p_rarch = &rarch_st; struct rarch_state *p_rarch = &rarch_st;