aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNebuleon Fumika2013-01-19 23:01:36 -0500
committerNebuleon Fumika2013-01-19 23:01:36 -0500
commit0cd9ebfb8b8d85c500f823a412833b5da6e3fe15 (patch)
tree4e9ec77a9067e0977065dc34ee3572da22fbd231
parent88135c52f8367549d6c864df193018f5a6cb2b35 (diff)
downloadsnes9x2005-0cd9ebfb8b8d85c500f823a412833b5da6e3fe15.tar.gz
snes9x2005-0cd9ebfb8b8d85c500f823a412833b5da6e3fe15.tar.bz2
snes9x2005-0cd9ebfb8b8d85c500f823a412833b5da6e3fe15.zip
GUI touch handling improvements.
* Don't select items defined with type HIDEN_TYPE. That's for items like the card capacity display. * Don't change current_option and current_option_num until we're sure of what's going on. * Don't select an item from another menu if you touch a phantom menu item below the last one of the active menu. For example, Video & audio's item 5 would call up the ROM loading dialog. This is now fixed. * Handle NUMBER_SELECTION_TYPE and STRING_SELECTION_TYPE as invocations of CURSOR_RIGHT. This fixes the language selector not updating the language in the GUI when touched. * Handle ACTION_TYPE. This fixes the Load cheat file menu item not working when touched.
-rw-r--r--source/nds/gui.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/source/nds/gui.c b/source/nds/gui.c
index 1582b16..969925f 100644
--- a/source/nds/gui.c
+++ b/source/nds/gui.c
@@ -2566,7 +2566,7 @@ u32 menu(u16 *screen)
void save_screen_snapshot()
{
- if((gui_action == CURSOR_SELECT))
+ if(gui_action == CURSOR_SELECT)
{
if(bg_screenp != NULL)
{
@@ -3574,16 +3574,21 @@ u32 menu(u16 *screen)
// ___ 60 above or below these are ignored.
// . . . (+27) The row between 33 and 60 is [1], though!
// ___ 192
- current_option_num = (inputdata.y - 33) / 27 + 1;
+ u32 next_option_num = (inputdata.y - 33) / 27 + 1;
+ struct _MENU_OPTION_TYPE *next_option = current_menu->options + next_option_num;
- current_option = current_menu->options + current_option_num;
+ if (next_option_num >= current_menu->num_options)
+ break;
- if(!current_option)
+ if(!next_option)
break;
- if(current_option -> option_type & HIDEN_TYPE)
+ if(next_option -> option_type & HIDEN_TYPE)
break;
+ current_option_num = next_option_num;
+ current_option = current_menu->options + current_option_num;
+
if(current_menu->key_function)
{
gui_action = CURSOR_RIGHT;
@@ -3591,6 +3596,7 @@ u32 menu(u16 *screen)
}
else if(current_option->option_type & (NUMBER_SELECTION_TYPE | STRING_SELECTION_TYPE))
{
+ gui_action = CURSOR_RIGHT;
u32 current_option_val = *(current_option->current_option);
if(current_option_val < current_option->num_options -1)
@@ -3602,6 +3608,8 @@ u32 menu(u16 *screen)
if(current_option->action_function)
current_option->action_function();
}
+ else if(current_option->option_type & ACTION_TYPE)
+ current_option->action_function();
}
/* Save states */
else if(current_menu == (main_menu.options + 1)->sub_menu)