Refactor hotkey checks

This commit is contained in:
twinaphex 2019-06-08 15:19:15 +02:00
parent 548e1380d7
commit 5d301f321d
3 changed files with 178 additions and 222 deletions

296
command.c
View File

@ -1749,6 +1749,45 @@ bool command_event(enum event_command cmd, void *data)
switch (cmd) switch (cmd)
{ {
case CMD_EVENT_BSV_RECORDING_TOGGLE:
if (!recording_is_enabled())
command_event(CMD_EVENT_RECORD_INIT, NULL);
else
command_event(CMD_EVENT_RECORD_DEINIT, NULL);
bsv_movie_check();
break;
case CMD_EVENT_AI_SERVICE_TOGGLE:
/* TODO/FIXME - implement */
break;
case CMD_EVENT_NETPLAY_GAME_WATCH:
#ifdef HAVE_NETWORKING
netplay_driver_ctl(RARCH_NETPLAY_CTL_GAME_WATCH, NULL);
#endif
break;
case CMD_EVENT_STREAMING_TOGGLE:
if (streaming_is_enabled())
command_event(CMD_EVENT_RECORD_DEINIT, NULL);
else
{
streaming_set_state(true);
command_event(CMD_EVENT_RECORD_INIT, NULL);
}
break;
case CMD_EVENT_RECORDING_TOGGLE:
if (recording_is_enabled())
command_event(CMD_EVENT_RECORD_DEINIT, NULL);
else
command_event(CMD_EVENT_RECORD_INIT, NULL);
break;
case CMD_EVENT_OSK_TOGGLE:
if (input_keyboard_ctl(
RARCH_INPUT_KEYBOARD_CTL_IS_LINEFEED_ENABLED, NULL))
input_keyboard_ctl(
RARCH_INPUT_KEYBOARD_CTL_UNSET_LINEFEED_ENABLED, NULL);
else
input_keyboard_ctl(
RARCH_INPUT_KEYBOARD_CTL_SET_LINEFEED_ENABLED, NULL);
break;
case CMD_EVENT_SET_PER_GAME_RESOLUTION: case CMD_EVENT_SET_PER_GAME_RESOLUTION:
#if defined(GEKKO) #if defined(GEKKO)
{ {
@ -1791,9 +1830,9 @@ bool command_event(enum event_command cmd, void *data)
#endif #endif
if (!libretro_get_system_info( if (!libretro_get_system_info(
core_path, core_path,
system, system,
&system_info->load_no_content)) &system_info->load_no_content))
return false; return false;
info_find.path = core_path; info_find.path = core_path;
@ -1807,21 +1846,21 @@ bool command_event(enum event_command cmd, void *data)
} }
break; break;
case CMD_EVENT_LOAD_CORE: case CMD_EVENT_LOAD_CORE:
{ {
bool success = false; bool success = false;
subsystem_current_count = 0; subsystem_current_count = 0;
content_clear_subsystem(); content_clear_subsystem();
success = command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL); success = command_event(CMD_EVENT_LOAD_CORE_PERSIST, NULL);
(void)success; (void)success;
#ifndef HAVE_DYNAMIC #ifndef HAVE_DYNAMIC
command_event(CMD_EVENT_QUIT, NULL); command_event(CMD_EVENT_QUIT, NULL);
#else #else
if (!success) if (!success)
return false; return false;
#endif #endif
break; break;
} }
case CMD_EVENT_LOAD_STATE: case CMD_EVENT_LOAD_STATE:
/* Immutable - disallow savestate load when /* Immutable - disallow savestate load when
* we absolutely cannot change game state. */ * we absolutely cannot change game state. */
@ -1966,8 +2005,8 @@ bool command_event(enum event_command cmd, void *data)
rcheevos_toggle_hardcore_mode(); rcheevos_toggle_hardcore_mode();
#endif #endif
break; break;
/* this fallthrough is on purpose, it should do /* this fallthrough is on purpose, it should do
a CMD_EVENT_REINIT too */ a CMD_EVENT_REINIT too */
case CMD_EVENT_REINIT_FROM_TOGGLE: case CMD_EVENT_REINIT_FROM_TOGGLE:
retroarch_unset_forced_fullscreen(); retroarch_unset_forced_fullscreen();
case CMD_EVENT_REINIT: case CMD_EVENT_REINIT:
@ -2048,21 +2087,21 @@ TODO: Add a setting for these tweaks */
case CMD_EVENT_AUTOSAVE_INIT: case CMD_EVENT_AUTOSAVE_INIT:
command_event(CMD_EVENT_AUTOSAVE_DEINIT, NULL); command_event(CMD_EVENT_AUTOSAVE_DEINIT, NULL);
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
{
#ifdef HAVE_NETWORKING
/* Only enable state manager if netplay is not underway
TODO: Add a setting for these tweaks */
settings_t *settings = config_get_ptr();
if (settings->uints.autosave_interval != 0
&& !netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
#endif
{ {
if (autosave_init()) #ifdef HAVE_NETWORKING
runloop_set(RUNLOOP_ACTION_AUTOSAVE); /* Only enable state manager if netplay is not underway
else TODO: Add a setting for these tweaks */
runloop_unset(RUNLOOP_ACTION_AUTOSAVE); settings_t *settings = config_get_ptr();
if (settings->uints.autosave_interval != 0
&& !netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
#endif
{
if (autosave_init())
runloop_set(RUNLOOP_ACTION_AUTOSAVE);
else
runloop_unset(RUNLOOP_ACTION_AUTOSAVE);
}
} }
}
#endif #endif
break; break;
case CMD_EVENT_AUTOSAVE_STATE: case CMD_EVENT_AUTOSAVE_STATE:
@ -2117,9 +2156,9 @@ TODO: Add a setting for these tweaks */
{ {
#if defined(GEKKO) #if defined(GEKKO)
/* Avoid a crash at startup or even when toggling overlay in rgui */ /* Avoid a crash at startup or even when toggling overlay in rgui */
uint64_t memory_used = frontend_driver_get_used_memory(); uint64_t memory_used = frontend_driver_get_used_memory();
if(memory_used > (72 * 1024 * 1024)) if(memory_used > (72 * 1024 * 1024))
break; break;
#endif #endif
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
command_event(CMD_EVENT_OVERLAY_DEINIT, NULL); command_event(CMD_EVENT_OVERLAY_DEINIT, NULL);
@ -2387,53 +2426,53 @@ TODO: Add a setting for these tweaks */
ui_companion_driver_toggle(false); ui_companion_driver_toggle(false);
break; break;
case CMD_EVENT_ADD_TO_FAVORITES: case CMD_EVENT_ADD_TO_FAVORITES:
{
struct string_list *str_list = (struct string_list*)data;
if (str_list)
{ {
if (str_list->size >= 6) struct string_list *str_list = (struct string_list*)data;
if (str_list)
{ {
struct playlist_entry entry = {0}; if (str_list->size >= 6)
{
struct playlist_entry entry = {0};
entry.path = str_list->elems[0].data; /* content_path */ entry.path = str_list->elems[0].data; /* content_path */
entry.label = str_list->elems[1].data; /* content_label */ entry.label = str_list->elems[1].data; /* content_label */
entry.core_path = str_list->elems[2].data; /* core_path */ entry.core_path = str_list->elems[2].data; /* core_path */
entry.core_name = str_list->elems[3].data; /* core_name */ entry.core_name = str_list->elems[3].data; /* core_name */
entry.crc32 = str_list->elems[4].data; /* crc32 */ entry.crc32 = str_list->elems[4].data; /* crc32 */
entry.db_name = str_list->elems[5].data; /* db_name */ entry.db_name = str_list->elems[5].data; /* db_name */
/* Write playlist entry */ /* Write playlist entry */
command_playlist_push_write( command_playlist_push_write(
g_defaults.content_favorites, g_defaults.content_favorites,
&entry &entry
); );
runloop_msg_queue_push(msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
}
} }
break;
} }
break;
}
case CMD_EVENT_RESET_CORE_ASSOCIATION: case CMD_EVENT_RESET_CORE_ASSOCIATION:
{ {
const char *core_name = "DETECT"; const char *core_name = "DETECT";
const char *core_path = "DETECT"; const char *core_path = "DETECT";
size_t *playlist_index = (size_t*)data; size_t *playlist_index = (size_t*)data;
struct playlist_entry entry = {0}; struct playlist_entry entry = {0};
/* the update function reads our entry as const, so these casts are safe */ /* the update function reads our entry as const, so these casts are safe */
entry.core_path = (char*)core_path; entry.core_path = (char*)core_path;
entry.core_name = (char*)core_name; entry.core_name = (char*)core_name;
command_playlist_update_write( command_playlist_update_write(
NULL, NULL,
*playlist_index, *playlist_index,
&entry); &entry);
runloop_msg_queue_push(msg_hash_to_str(MSG_RESET_CORE_ASSOCIATION), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO); runloop_msg_queue_push(msg_hash_to_str(MSG_RESET_CORE_ASSOCIATION), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
break; break;
} }
case CMD_EVENT_RESTART_RETROARCH: case CMD_EVENT_RESTART_RETROARCH:
if (!frontend_driver_set_fork(FRONTEND_FORK_RESTART)) if (!frontend_driver_set_fork(FRONTEND_FORK_RESTART))
return false; return false;
@ -2595,7 +2634,7 @@ TODO: Add a setting for these tweaks */
case CMD_EVENT_NETWORK_INIT: case CMD_EVENT_NETWORK_INIT:
network_init(); network_init();
break; break;
/* init netplay manually */ /* init netplay manually */
case CMD_EVENT_NETPLAY_INIT: case CMD_EVENT_NETPLAY_INIT:
{ {
char *hostname = (char *) data; char *hostname = (char *) data;
@ -2604,22 +2643,22 @@ TODO: Add a setting for these tweaks */
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
if (!init_netplay(NULL, hostname ? hostname : if (!init_netplay(NULL, hostname ? hostname :
settings->paths.netplay_server, settings->paths.netplay_server,
settings->uints.netplay_port)) settings->uints.netplay_port))
{ {
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
return false; return false;
} }
/* Disable rewind & sram autosave if it was enabled /* Disable rewind & sram autosave if it was enabled
TODO: Add a setting for these tweaks */ TODO: Add a setting for these tweaks */
state_manager_event_deinit(); state_manager_event_deinit();
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
autosave_deinit(); autosave_deinit();
#endif #endif
} }
break; break;
/* init netplay via lobby when content is loaded */ /* init netplay via lobby when content is loaded */
case CMD_EVENT_NETPLAY_INIT_DIRECT: case CMD_EVENT_NETPLAY_INIT_DIRECT:
{ {
/* buf is expected to be address|port */ /* buf is expected to be address|port */
@ -2634,12 +2673,12 @@ TODO: Add a setting for these tweaks */
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
RARCH_LOG("[netplay] connecting to %s:%d (direct)\n", RARCH_LOG("[netplay] connecting to %s:%d (direct)\n",
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data) hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : settings->uints.netplay_port); ? atoi(hostname->elems[1].data) : settings->uints.netplay_port);
if (!init_netplay(NULL, hostname->elems[0].data, if (!init_netplay(NULL, hostname->elems[0].data,
!string_is_empty(hostname->elems[1].data) !string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : settings->uints.netplay_port)) ? atoi(hostname->elems[1].data) : settings->uints.netplay_port))
{ {
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
string_list_free(hostname); string_list_free(hostname);
@ -2649,14 +2688,14 @@ TODO: Add a setting for these tweaks */
string_list_free(hostname); string_list_free(hostname);
/* Disable rewind if it was enabled /* Disable rewind if it was enabled
TODO: Add a setting for these tweaks */ TODO: Add a setting for these tweaks */
state_manager_event_deinit(); state_manager_event_deinit();
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
autosave_deinit(); autosave_deinit();
#endif #endif
} }
break; break;
/* init netplay via lobby when content is not loaded */ /* init netplay via lobby when content is not loaded */
case CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED: case CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED:
{ {
static struct string_list *hostname = NULL; static struct string_list *hostname = NULL;
@ -2665,18 +2704,18 @@ TODO: Add a setting for these tweaks */
char *buf = (char *)data; char *buf = (char *)data;
RARCH_LOG("[netplay] buf %s\n", buf); RARCH_LOG("[netplay] buf %s\n", buf);
hostname = string_split(buf, "|"); hostname = string_split(buf, "|");
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
RARCH_LOG("[netplay] connecting to %s:%d (deferred)\n", RARCH_LOG("[netplay] connecting to %s:%d (deferred)\n",
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data) hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : settings->uints.netplay_port); ? atoi(hostname->elems[1].data) : settings->uints.netplay_port);
if (!init_netplay_deferred(hostname->elems[0].data, if (!init_netplay_deferred(hostname->elems[0].data,
!string_is_empty(hostname->elems[1].data) !string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : settings->uints.netplay_port)) ? atoi(hostname->elems[1].data) : settings->uints.netplay_port))
{ {
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL); command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
string_list_free(hostname); string_list_free(hostname);
@ -2686,67 +2725,64 @@ TODO: Add a setting for these tweaks */
string_list_free(hostname); string_list_free(hostname);
/* Disable rewind if it was enabled /* Disable rewind if it was enabled
TODO: Add a setting for these tweaks */ TODO: Add a setting for these tweaks */
state_manager_event_deinit(); state_manager_event_deinit();
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
autosave_deinit(); autosave_deinit();
#endif #endif
} }
break; break;
case CMD_EVENT_NETPLAY_GAME_WATCH:
netplay_driver_ctl(RARCH_NETPLAY_CTL_GAME_WATCH, NULL);
break;
case CMD_EVENT_NETPLAY_ENABLE_HOST: case CMD_EVENT_NETPLAY_ENABLE_HOST:
{
#ifdef HAVE_MENU
bool contentless = false;
bool is_inited = false;
content_get_status(&contentless, &is_inited);
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_SERVER, NULL);
/* If we haven't yet started, this will load on its own */
if (!is_inited)
{ {
runloop_msg_queue_push( #ifdef HAVE_MENU
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED), bool contentless = false;
1, 480, true, bool is_inited = false;
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return false;
}
/* Enable Netplay itself */ content_get_status(&contentless, &is_inited);
if (!command_event(CMD_EVENT_NETPLAY_INIT, NULL))
return false; if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_DATA_INITED, NULL))
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_ENABLE_SERVER, NULL);
/* If we haven't yet started, this will load on its own */
if (!is_inited)
{
runloop_msg_queue_push(
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_START_WHEN_LOADED),
1, 480, true,
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
return false;
}
/* Enable Netplay itself */
if (!command_event(CMD_EVENT_NETPLAY_INIT, NULL))
return false;
#endif #endif
break; break;
} }
case CMD_EVENT_NETPLAY_DISCONNECT: case CMD_EVENT_NETPLAY_DISCONNECT:
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
netplay_driver_ctl(RARCH_NETPLAY_CTL_DISCONNECT, NULL); netplay_driver_ctl(RARCH_NETPLAY_CTL_DISCONNECT, NULL);
netplay_driver_ctl(RARCH_NETPLAY_CTL_DISABLE, NULL); netplay_driver_ctl(RARCH_NETPLAY_CTL_DISABLE, NULL);
/* Re-enable rewind if it was enabled /* Re-enable rewind if it was enabled
TODO: Add a setting for these tweaks */ TODO: Add a setting for these tweaks */
if (settings->bools.rewind_enable) if (settings->bools.rewind_enable)
command_event(CMD_EVENT_REWIND_INIT, NULL); command_event(CMD_EVENT_REWIND_INIT, NULL);
if (settings->uints.autosave_interval != 0) if (settings->uints.autosave_interval != 0)
command_event(CMD_EVENT_AUTOSAVE_INIT, NULL); command_event(CMD_EVENT_AUTOSAVE_INIT, NULL);
break; break;
} }
case CMD_EVENT_NETPLAY_HOST_TOGGLE: case CMD_EVENT_NETPLAY_HOST_TOGGLE:
if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) && if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) &&
netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL)) netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL))
command_event(CMD_EVENT_NETPLAY_DISCONNECT, NULL); command_event(CMD_EVENT_NETPLAY_DISCONNECT, NULL);
else if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) && else if (netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL) &&
!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL) && !netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_SERVER, NULL) &&
netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_CONNECTED, NULL)) netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_CONNECTED, NULL))
command_event(CMD_EVENT_NETPLAY_DISCONNECT, NULL); command_event(CMD_EVENT_NETPLAY_DISCONNECT, NULL);
else else
command_event(CMD_EVENT_NETPLAY_ENABLE_HOST, NULL); command_event(CMD_EVENT_NETPLAY_ENABLE_HOST, NULL);
@ -2949,9 +2985,9 @@ TODO: Add a setting for these tweaks */
* any other: toggle * any other: toggle
*/ */
if (mode == 1) if (mode == 1)
game_focus_state = true; game_focus_state = true;
else if (mode != -1) else if (mode != -1)
game_focus_state = !game_focus_state; game_focus_state = !game_focus_state;
RARCH_LOG("%s: %s.\n", RARCH_LOG("%s: %s.\n",
"Game focus is: ", "Game focus is: ",

View File

@ -245,7 +245,12 @@ enum event_command
CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET, CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET,
CMD_EVENT_DISCORD_INIT, CMD_EVENT_DISCORD_INIT,
CMD_EVENT_DISCORD_DEINIT, CMD_EVENT_DISCORD_DEINIT,
CMD_EVENT_DISCORD_UPDATE CMD_EVENT_DISCORD_UPDATE,
CMD_EVENT_OSK_TOGGLE,
CMD_EVENT_RECORDING_TOGGLE,
CMD_EVENT_STREAMING_TOGGLE,
CMD_EVENT_AI_SERVICE_TOGGLE,
CMD_EVENT_BSV_RECORDING_TOGGLE
}; };
bool command_set_shader(const char *arg); bool command_set_shader(const char *arg);

View File

@ -3873,77 +3873,16 @@ static enum runloop_state runloop_check_state(
HOTKEY_CHECK(RARCH_MUTE, CMD_EVENT_AUDIO_MUTE_TOGGLE); HOTKEY_CHECK(RARCH_MUTE, CMD_EVENT_AUDIO_MUTE_TOGGLE);
/* Check if we have pressed the OSK toggle button */ /* Check if we have pressed the OSK toggle button */
{ HOTKEY_CHECK(RARCH_OSK, CMD_EVENT_OSK_TOGGLE);
static bool old_pressed = false;
bool pressed = BIT256_GET(current_input, RARCH_OSK);
if (pressed && !old_pressed)
{
if (input_keyboard_ctl(
RARCH_INPUT_KEYBOARD_CTL_IS_LINEFEED_ENABLED, NULL))
input_keyboard_ctl(
RARCH_INPUT_KEYBOARD_CTL_UNSET_LINEFEED_ENABLED, NULL);
else
input_keyboard_ctl(
RARCH_INPUT_KEYBOARD_CTL_SET_LINEFEED_ENABLED, NULL);
}
old_pressed = pressed;
}
/* Check if we have pressed the recording toggle button */ /* Check if we have pressed the recording toggle button */
{ HOTKEY_CHECK(RARCH_RECORDING_TOGGLE, CMD_EVENT_RECORDING_TOGGLE);
static bool old_pressed = false;
bool pressed = BIT256_GET(
current_input, RARCH_RECORDING_TOGGLE);
if (pressed && !old_pressed)
{
if (recording_is_enabled())
command_event(CMD_EVENT_RECORD_DEINIT, NULL);
else
command_event(CMD_EVENT_RECORD_INIT, NULL);
}
old_pressed = pressed;
}
/* Check if we have pressed the AI Service toggle button */ /* Check if we have pressed the AI Service toggle button */
{ HOTKEY_CHECK(RARCH_AI_SERVICE, CMD_EVENT_AI_SERVICE_TOGGLE);
static bool old_pressed = false;
bool pressed = BIT256_GET(
current_input, RARCH_AI_SERVICE);
if (pressed && !old_pressed)
{
#if 0
/* TODO/FIXME */
command_event(CMD_EVENT_RECORD_INIT, NULL);
#endif
}
old_pressed = pressed;
}
/* Check if we have pressed the streaming toggle button */ /* Check if we have pressed the streaming toggle button */
{ HOTKEY_CHECK(RARCH_STREAMING_TOGGLE, CMD_EVENT_STREAMING_TOGGLE);
static bool old_pressed = false;
bool pressed = BIT256_GET(
current_input, RARCH_STREAMING_TOGGLE);
if (pressed && !old_pressed)
{
if (streaming_is_enabled())
command_event(CMD_EVENT_RECORD_DEINIT, NULL);
else
{
streaming_set_state(true);
command_event(CMD_EVENT_RECORD_INIT, NULL);
}
}
old_pressed = pressed;
}
if (BIT256_GET(current_input, RARCH_VOLUME_UP)) if (BIT256_GET(current_input, RARCH_VOLUME_UP))
command_event(CMD_EVENT_VOLUME_UP, NULL); command_event(CMD_EVENT_VOLUME_UP, NULL);
@ -3952,16 +3891,7 @@ static enum runloop_state runloop_check_state(
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
/* Check Netplay */ /* Check Netplay */
{ HOTKEY_CHECK(RARCH_NETPLAY_GAME_WATCH, CMD_EVENT_NETPLAY_GAME_WATCH);
static bool old_netplay_watch = false;
bool netplay_watch = BIT256_GET(
current_input, RARCH_NETPLAY_GAME_WATCH);
if (netplay_watch && !old_netplay_watch)
netplay_driver_ctl(RARCH_NETPLAY_CTL_GAME_WATCH, NULL);
old_netplay_watch = netplay_watch;
}
#endif #endif
/* Check if we have pressed the pause button */ /* Check if we have pressed the pause button */
@ -4209,22 +4139,7 @@ static enum runloop_state runloop_check_state(
} }
/* Check movie record toggle */ /* Check movie record toggle */
{ HOTKEY_CHECK(RARCH_BSV_RECORD_TOGGLE, CMD_EVENT_BSV_RECORDING_TOGGLE);
static bool old_pressed = false;
bool pressed = BIT256_GET(
current_input, RARCH_BSV_RECORD_TOGGLE);
if (pressed && !old_pressed)
{
if (!recording_is_enabled())
command_event(CMD_EVENT_RECORD_INIT, NULL);
else
command_event(CMD_EVENT_RECORD_DEINIT, NULL);
bsv_movie_check();
}
old_pressed = pressed;
}
/* Check shader prev/next */ /* Check shader prev/next */
{ {