From a1247917df061c5de3045d508b0e696fdc75f408 Mon Sep 17 00:00:00 2001 From: pyroesp Date: Fri, 28 Jul 2023 20:27:19 +0200 Subject: [PATCH] advanced: calculate the new_buttons_on on each call of subbutton_func with pad and old_pad --- extras/menus/advancedvsh/advanced.c | 12 ++++++++---- extras/menus/advancedvsh/include/advanced.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/extras/menus/advancedvsh/advanced.c b/extras/menus/advancedvsh/advanced.c index 3bcf79685..2b27c0d08 100644 --- a/extras/menus/advancedvsh/advanced.c +++ b/extras/menus/advancedvsh/advanced.c @@ -1,5 +1,6 @@ #include "common.h" #include +#include #include #include "systemctrl.h" @@ -368,11 +369,9 @@ int submenu_setup(void) { } -int submenu_ctrl(void) { +int submenu_ctrl(u32 button_on) { int direction; - u32 button_on; vsh_Menu *vsh = vsh_menu_pointer(); - button_on = vsh->buttons.new_buttons_on; if ((button_on & PSP_CTRL_SELECT) || (button_on & PSP_CTRL_HOME) || button_decline(button_on)) { @@ -506,6 +505,9 @@ int submenu_ctrl(void) { void subbutton_func(vsh_Menu *vsh) { int res; + SceCtrlData pad = vsh->buttons.pad; + u32 new_buttons_on = ~vsh->buttons.old_pad.Buttons & vsh->buttons.pad.Buttons; + // submenu control switch(vsh->status.submenu_mode) { case 0: @@ -513,7 +515,7 @@ void subbutton_func(vsh_Menu *vsh) { vsh->status.submenu_mode = 1; break; case 1: - res = submenu_ctrl(); + res = submenu_ctrl(new_buttons_on); if (res != 0) { sub_stop_stock = res; @@ -526,4 +528,6 @@ void subbutton_func(vsh_Menu *vsh) { vsh->status.sub_stop_flag = sub_stop_stock; break; } + + scePaf_memcpy(&vsh->buttons.old_pad, &pad, sizeof(SceCtrlData)); } diff --git a/extras/menus/advancedvsh/include/advanced.h b/extras/menus/advancedvsh/include/advanced.h index 1dff4678f..5c37c3e5b 100644 --- a/extras/menus/advancedvsh/include/advanced.h +++ b/extras/menus/advancedvsh/include/advanced.h @@ -57,7 +57,7 @@ enum { int submenu_draw(void); int submenu_find_longest_string(void); int submenu_setup(void); -int submenu_ctrl(void); +int submenu_ctrl(u32 button_on); void subbutton_func(vsh_Menu *vsh);