aboutsummaryrefslogtreecommitdiff
path: root/source/nds/draw.c
diff options
context:
space:
mode:
authorNebuleon Fumika2013-01-22 04:16:15 -0500
committerNebuleon Fumika2013-01-22 04:16:15 -0500
commit2cf733eef4323886e00a1e4788a2b3e803a797d7 (patch)
treec9fd2375c0bc7b8cb76bae04e5f9bc3ef1f6970a /source/nds/draw.c
parentf81781ae8cc8e849d6c91410da7d8e511b7bae5a (diff)
downloadsnes9x2005-2cf733eef4323886e00a1e4788a2b3e803a797d7.tar.gz
snes9x2005-2cf733eef4323886e00a1e4788a2b3e803a797d7.tar.bz2
snes9x2005-2cf733eef4323886e00a1e4788a2b3e803a797d7.zip
Add three hotkeys: temporary fast-forward, sound toggle and return to menu. These hotkeys can be overridden per game so that the global version of the hotkey can be ignored.
* Language file fixups related to \n (newlines). * Pictochat fixups: shorten START and SELECT to ST and SEL. Should still be recognisable.
Diffstat (limited to 'source/nds/draw.c')
-rw-r--r--source/nds/draw.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/source/nds/draw.c b/source/nds/draw.c
index f373aa3..3eab510 100644
--- a/source/nds/draw.c
+++ b/source/nds/draw.c
@@ -883,24 +883,42 @@ u32 draw_hotkey_dialog(enum SCREEN_ID screen, u32 sy, char *clear, char *cancel)
ds2_flipScreen(screen, 2);
- // While there are no keys pressed, wait for keys.
+ // This function has been started by a key press. Wait for it to end.
struct key_buf inputdata;
do {
mdelay(1);
ds2_getrawInput(&inputdata);
+ } while (inputdata.key != 0);
+
+ // While there are no keys pressed, wait for keys.
+ do {
+ mdelay(1);
+ ds2_getrawInput(&inputdata);
} while (inputdata.key == 0);
// Now, while there are keys pressed, keep a tally of keys that have
// been pressed. (IGNORE TOUCH AND LID! Otherwise, closing the lid or
// touching to get to the menu will do stuff the user doesn't expect.
// Also ignore the direction pad because every game uses it.)
- u32 TotalKeys = inputdata.key;
+ u32 TotalKeys = 0;
do {
+ TotalKeys |= inputdata.key & ~(KEY_TOUCH | KEY_LID | KEY_UP | KEY_DOWN | KEY_LEFT | KEY_RIGHT);
+ // If there's a touch on either button, turn it into a
+ // clear (A) or cancel (B) request.
+ if (inputdata.key & KEY_TOUCH)
+ {
+ if (inputdata.y >= 128 && inputdata.y < 128 + ICON_BUTTON.y)
+ {
+ if (inputdata.x >= 49 && inputdata.x < 49 + ICON_BUTTON.x)
+ return KEY_A;
+ else if (inputdata.x >= 136 && inputdata.x < 136 + ICON_BUTTON.x)
+ return KEY_B;
+ }
+ }
mdelay(1);
ds2_getrawInput(&inputdata);
- TotalKeys |= inputdata.key & ~(KEY_TOUCH | KEY_LID | KEY_UP | KEY_DOWN | KEY_LEFT | KEY_RIGHT);
- } while (inputdata.key != 0);
+ } while (inputdata.key != 0 || TotalKeys == 0);
return TotalKeys;
}