Skip to content

Commit

Permalink
advanced: calculate the new_buttons_on on each call of subbutton_func…
Browse files Browse the repository at this point in the history
… with pad and old_pad
  • Loading branch information
pyroesp committed Jul 28, 2023
1 parent 2d427c4 commit a124791
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions extras/menus/advancedvsh/advanced.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "common.h"
#include <psputility.h>
#include <pspctrl.h>
#include <time.h>

#include "systemctrl.h"
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -506,14 +505,17 @@ 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:
if ((vsh->buttons.pad.Buttons & ALL_CTRL) == 0)
vsh->status.submenu_mode = 1;
break;
case 1:
res = submenu_ctrl();
res = submenu_ctrl(new_buttons_on);

if (res != 0) {
sub_stop_stock = res;
Expand All @@ -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));
}
2 changes: 1 addition & 1 deletion extras/menus/advancedvsh/include/advanced.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);


Expand Down

0 comments on commit a124791

Please sign in to comment.