diff options
author | Nebuleon Fumika | 2013-01-23 20:16:46 -0500 |
---|---|---|
committer | Nebuleon Fumika | 2013-01-23 20:16:46 -0500 |
commit | 433749b6ef1e2b070755c3bb7fc0d81b5ecaa7b1 (patch) | |
tree | 38600503fea7fa1607ebb1e7c501d1f4d41f88b8 /source/nds/draw.c | |
parent | 40596a7d6810c2d3bc2db28e8f9c2b825972d21d (diff) | |
parent | d57eea6b4fd4d5d642cb730f6291dabfb0c6a633 (diff) | |
download | snes9x2005-433749b6ef1e2b070755c3bb7fc0d81b5ecaa7b1.tar.gz snes9x2005-433749b6ef1e2b070755c3bb7fc0d81b5ecaa7b1.tar.bz2 snes9x2005-433749b6ef1e2b070755c3bb7fc0d81b5ecaa7b1.zip |
Merge branch 'master' into 8bitsound
Diffstat (limited to 'source/nds/draw.c')
-rw-r--r-- | source/nds/draw.c | 26 |
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; } |