Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New in-game menu button action: "Quick menu" + fix quitting RetroArch from arcade games #1620

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions src/keymon/menuButtonAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ bool terminate_retroarch(void)
// send signal
kill(pid, SIGCONT);
usleep(100000);
kill(pid, SIGTERM);
system("sendUDP QUIT");
// wait for terminate
sprintf(fname, "/proc/%d", pid);

Expand All @@ -105,11 +105,12 @@ bool terminate_drastic(void)

if (pid) {
// If swap L<>L2 is on, the off button combo becomes 1 + 15 instead of 1 + 18
if(temp_flag_get("drastic_swap_l1l2")) {
if (temp_flag_get("drastic_swap_l1l2")) {
system("sendkeys 1 1, 15 1");
usleep(200000); // 0.2s
system("sendkeys 1 0, 15 0");
} else {
}
else {
system("sendkeys 1 1, 18 1");
usleep(200000); // 0.2s
system("sendkeys 1 0, 18 0");
Expand Down Expand Up @@ -157,13 +158,15 @@ void action_MainUI_resumeGame(void)

void action_RA_gameSwitcher(void)
{
temp_flag_set(".displaySavingMessage", true);
screenshot_system();
set_gameSwitcher();
terminate_retroarch();
}

void action_RA_exitToMenu(void)
{
temp_flag_set(".displaySavingMessage", true);
screenshot_system();
terminate_retroarch();
}
Expand All @@ -175,15 +178,22 @@ void action_RA_quickSwitch(void)
terminate_retroarch();
}

void action_RA_toggleMenu(void)
{
system("sendUDP MENU_TOGGLE");
}

void action_drastic_gameSwitcher(void)
{
temp_flag_set(".displaySavingMessage", true);
screenshot_system();
set_gameSwitcher();
terminate_drastic();
}

void action_drastic_exitToMenu(void)
{
temp_flag_set(".displaySavingMessage", true);
screenshot_system();
terminate_drastic();
}
Expand Down Expand Up @@ -221,6 +231,9 @@ void activate_RA_action(int action_id)
case 3:
action_RA_quickSwitch();
break;
case 4:
action_RA_toggleMenu();
break;
default:
break;
}
Expand Down Expand Up @@ -250,11 +263,9 @@ void menuButtonEvent_singlePress(void)
activate_MainUI_action(settings.mainui_single_press);
break;
case MODE_GAME:
temp_flag_set(".displaySavingMessage", true);
activate_RA_action(settings.ingame_single_press);
break;
case MODE_DRASTIC:
temp_flag_set(".displaySavingMessage", true);
activate_drastic_action(settings.ingame_single_press);
break;
default:
Expand All @@ -272,13 +283,11 @@ void menuButtonEvent_longPress(void)
case MODE_GAME:
if (settings.ingame_long_press != 0)
short_pulse();
temp_flag_set(".displaySavingMessage", true);
activate_RA_action(settings.ingame_long_press);
break;
case MODE_DRASTIC:
if (settings.ingame_long_press != 0)
short_pulse();
temp_flag_set(".displaySavingMessage", true);
activate_drastic_action(settings.ingame_long_press);
break;
default:
Expand Down
6 changes: 3 additions & 3 deletions src/tweaks/formatters.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
{ \
"Context menu", "GameSwitcher", "Resume game" \
}
#define BUTTON_INGAME_LABELS \
{ \
"Off", "GameSwitcher", "Exit to menu", "Quick switch" \
#define BUTTON_INGAME_LABELS \
{ \
"Off", "GameSwitcher", "Exit to menu", "Quick switch", "Quick menu" \
}

#define THEME_TOGGLE_LABELS \
Expand Down
6 changes: 3 additions & 3 deletions src/tweaks/menus.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void menu_buttonActionInGameMenu(void *_)
(ListItem){
.label = "Single press",
.item_type = MULTIVALUE,
.value_max = 3,
.value_max = 4,
.value_labels = BUTTON_INGAME_LABELS,
.value = settings.ingame_single_press,
.action_id = 3,
Expand All @@ -283,7 +283,7 @@ void menu_buttonActionInGameMenu(void *_)
(ListItem){
.label = "Long press",
.item_type = MULTIVALUE,
.value_max = 3,
.value_max = 4,
.value_labels = BUTTON_INGAME_LABELS,
.value = settings.ingame_long_press,
.action_id = 4,
Expand All @@ -294,7 +294,7 @@ void menu_buttonActionInGameMenu(void *_)
(ListItem){
.label = "Double press",
.item_type = MULTIVALUE,
.value_max = 3,
.value_max = 4,
.value_labels = BUTTON_INGAME_LABELS,
.value = settings.ingame_double_press,
.action_id = 5,
Expand Down
Loading