mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
Add RARCH_CMD_DISK_EJECT_TOGGLE/RARCH_CMD_DISK_NEXT
This commit is contained in:
parent
cc277fcf76
commit
5c09e6be84
8
cheats.c
8
cheats.c
@ -381,6 +381,9 @@ static void cheat_manager_update(cheat_manager_t *handle)
|
|||||||
|
|
||||||
void cheat_manager_toggle(cheat_manager_t *handle)
|
void cheat_manager_toggle(cheat_manager_t *handle)
|
||||||
{
|
{
|
||||||
|
if (!handle)
|
||||||
|
return;
|
||||||
|
|
||||||
handle->cheats[handle->ptr].state ^= true;
|
handle->cheats[handle->ptr].state ^= true;
|
||||||
cheat_manager_apply_cheats(handle);
|
cheat_manager_apply_cheats(handle);
|
||||||
cheat_manager_update(handle);
|
cheat_manager_update(handle);
|
||||||
@ -388,12 +391,17 @@ void cheat_manager_toggle(cheat_manager_t *handle)
|
|||||||
|
|
||||||
void cheat_manager_index_next(cheat_manager_t *handle)
|
void cheat_manager_index_next(cheat_manager_t *handle)
|
||||||
{
|
{
|
||||||
|
if (!handle)
|
||||||
|
return;
|
||||||
handle->ptr = (handle->ptr + 1) % handle->size;
|
handle->ptr = (handle->ptr + 1) % handle->size;
|
||||||
cheat_manager_update(handle);
|
cheat_manager_update(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cheat_manager_index_prev(cheat_manager_t *handle)
|
void cheat_manager_index_prev(cheat_manager_t *handle)
|
||||||
{
|
{
|
||||||
|
if (!handle)
|
||||||
|
return;
|
||||||
|
|
||||||
if (handle->ptr == 0)
|
if (handle->ptr == 0)
|
||||||
handle->ptr = handle->size - 1;
|
handle->ptr = handle->size - 1;
|
||||||
else
|
else
|
||||||
|
@ -156,6 +156,8 @@ enum basic_event
|
|||||||
RARCH_CMD_TEMPORARY_CONTENT_DEINIT,
|
RARCH_CMD_TEMPORARY_CONTENT_DEINIT,
|
||||||
RARCH_CMD_SUBSYSTEM_FULLPATHS_DEINIT,
|
RARCH_CMD_SUBSYSTEM_FULLPATHS_DEINIT,
|
||||||
RARCH_CMD_LOG_FILE_DEINIT,
|
RARCH_CMD_LOG_FILE_DEINIT,
|
||||||
|
RARCH_CMD_DISK_EJECT_TOGGLE,
|
||||||
|
RARCH_CMD_DISK_NEXT,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum action_state
|
enum action_state
|
||||||
|
63
retroarch.c
63
retroarch.c
@ -2240,11 +2240,8 @@ static bool do_state_checks(
|
|||||||
|
|
||||||
if (BIND_PRESSED(trigger_input, RARCH_SAVE_STATE_KEY))
|
if (BIND_PRESSED(trigger_input, RARCH_SAVE_STATE_KEY))
|
||||||
rarch_main_command(RARCH_CMD_SAVE_STATE);
|
rarch_main_command(RARCH_CMD_SAVE_STATE);
|
||||||
else if (!g_extern.bsv.movie) /* Immutable */
|
else if (BIND_PRESSED(trigger_input, RARCH_LOAD_STATE_KEY))
|
||||||
{
|
rarch_main_command(RARCH_CMD_LOAD_STATE);
|
||||||
if (BIND_PRESSED(trigger_input, RARCH_LOAD_STATE_KEY))
|
|
||||||
rarch_main_command(RARCH_CMD_LOAD_STATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
check_rewind_func(input);
|
check_rewind_func(input);
|
||||||
|
|
||||||
@ -2255,27 +2252,17 @@ static bool do_state_checks(
|
|||||||
|
|
||||||
check_shader_dir_func(trigger_input);
|
check_shader_dir_func(trigger_input);
|
||||||
|
|
||||||
if (g_extern.cheat)
|
if (BIND_PRESSED(trigger_input, RARCH_CHEAT_INDEX_PLUS))
|
||||||
{
|
cheat_manager_index_next(g_extern.cheat);
|
||||||
if (BIND_PRESSED(trigger_input, RARCH_CHEAT_INDEX_PLUS))
|
else if (BIND_PRESSED(trigger_input, RARCH_CHEAT_INDEX_MINUS))
|
||||||
cheat_manager_index_next(g_extern.cheat);
|
cheat_manager_index_prev(g_extern.cheat);
|
||||||
else if (BIND_PRESSED(trigger_input, RARCH_CHEAT_INDEX_MINUS))
|
else if (BIND_PRESSED(trigger_input, RARCH_CHEAT_TOGGLE))
|
||||||
cheat_manager_index_prev(g_extern.cheat);
|
cheat_manager_toggle(g_extern.cheat);
|
||||||
else if (BIND_PRESSED(trigger_input, RARCH_CHEAT_TOGGLE))
|
|
||||||
cheat_manager_toggle(g_extern.cheat);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_extern.system.disk_control.get_num_images)
|
if (BIND_PRESSED(trigger_input, RARCH_DISK_EJECT_TOGGLE))
|
||||||
{
|
rarch_main_command(RARCH_CMD_DISK_EJECT_TOGGLE);
|
||||||
const struct retro_disk_control_callback *control =
|
else if (BIND_PRESSED(trigger_input, RARCH_DISK_NEXT))
|
||||||
(const struct retro_disk_control_callback*)
|
rarch_main_command(RARCH_CMD_DISK_NEXT);
|
||||||
&g_extern.system.disk_control;
|
|
||||||
|
|
||||||
if (BIND_PRESSED(trigger_input, RARCH_DISK_EJECT_TOGGLE))
|
|
||||||
check_disk_eject(control);
|
|
||||||
else if (BIND_PRESSED(trigger_input, RARCH_DISK_NEXT))
|
|
||||||
check_disk_next(control);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BIND_PRESSED(trigger_input, RARCH_RESET))
|
if (BIND_PRESSED(trigger_input, RARCH_RESET))
|
||||||
rarch_main_command(RARCH_CMD_RESET);
|
rarch_main_command(RARCH_CMD_RESET);
|
||||||
@ -2768,8 +2755,8 @@ void rarch_main_command(unsigned cmd)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case RARCH_CMD_LOAD_STATE:
|
case RARCH_CMD_LOAD_STATE:
|
||||||
/* Disallow savestate load when we absolutely
|
/* Immutable - disallow savestate load when
|
||||||
* cannot change game state. */
|
* we absolutely cannot change game state. */
|
||||||
if (g_extern.bsv.movie)
|
if (g_extern.bsv.movie)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -3170,6 +3157,28 @@ void rarch_main_command(unsigned cmd)
|
|||||||
fclose(g_extern.log_file);
|
fclose(g_extern.log_file);
|
||||||
g_extern.log_file = NULL;
|
g_extern.log_file = NULL;
|
||||||
break;
|
break;
|
||||||
|
case RARCH_CMD_DISK_EJECT_TOGGLE:
|
||||||
|
if (g_extern.system.disk_control.get_num_images)
|
||||||
|
{
|
||||||
|
const struct retro_disk_control_callback *control =
|
||||||
|
(const struct retro_disk_control_callback*)
|
||||||
|
&g_extern.system.disk_control;
|
||||||
|
|
||||||
|
if (control)
|
||||||
|
check_disk_eject(control);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RARCH_CMD_DISK_NEXT:
|
||||||
|
if (g_extern.system.disk_control.get_num_images)
|
||||||
|
{
|
||||||
|
const struct retro_disk_control_callback *control =
|
||||||
|
(const struct retro_disk_control_callback*)
|
||||||
|
&g_extern.system.disk_control;
|
||||||
|
|
||||||
|
if (!control)
|
||||||
|
check_disk_next(control);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user