notaz.gp2x.de
/
libpicofe.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add disassembler reg-names-std option
[libpicofe.git]
/
in_sdl.c
diff --git
a/in_sdl.c
b/in_sdl.c
index
ce57536
..
2cdbd3f
100644
(file)
--- a/
in_sdl.c
+++ b/
in_sdl.c
@@
-5,6
+5,7
@@
* (at your option):
* - GNU GPL, version 2 or later.
* - GNU LGPL, version 2.1 or later.
* (at your option):
* - GNU GPL, version 2 or later.
* - GNU LGPL, version 2.1 or later.
+ * - MAME license.
* See the COPYING file in the top-level directory.
*/
* See the COPYING file in the top-level directory.
*/
@@
-25,6
+26,8
@@
struct in_sdl_state {
keybits_t keystate[SDLK_LAST / KEYBITS_WORD_BITS + 1];
};
keybits_t keystate[SDLK_LAST / KEYBITS_WORD_BITS + 1];
};
+static void (*ext_event_handler)(void *event);
+
static const char * const in_sdl_keys[SDLK_LAST] = {
[SDLK_BACKSPACE] = "backspace",
[SDLK_TAB] = "tab",
static const char * const in_sdl_keys[SDLK_LAST] = {
[SDLK_BACKSPACE] = "backspace",
[SDLK_TAB] = "tab",
@@
-120,7
+123,6
@@
static const char * const in_sdl_keys[SDLK_LAST] = {
[SDLK_DOWN] = "down",
[SDLK_RIGHT] = "right",
[SDLK_LEFT] = "left",
[SDLK_DOWN] = "down",
[SDLK_RIGHT] = "right",
[SDLK_LEFT] = "left",
- [SDLK_DOWN] = "down",
[SDLK_INSERT] = "insert",
[SDLK_HOME] = "home",
[SDLK_END] = "end",
[SDLK_INSERT] = "insert",
[SDLK_HOME] = "home",
[SDLK_END] = "end",
@@
-237,7
+239,7
@@
static int handle_event(struct in_sdl_state *state, SDL_Event *event,
int *kc_out, int *down_out)
{
if (event->type != SDL_KEYDOWN && event->type != SDL_KEYUP)
int *kc_out, int *down_out)
{
if (event->type != SDL_KEYDOWN && event->type != SDL_KEYUP)
- return
0
;
+ return
-1
;
update_keystate(state->keystate, event->key.keysym.sym,
event->type == SDL_KEYDOWN);
update_keystate(state->keystate, event->key.keysym.sym,
event->type == SDL_KEYDOWN);
@@
-291,6
+293,8
@@
static int handle_joy_event(struct in_sdl_state *state, SDL_Event *event,
down = event->jbutton.state == SDL_PRESSED;
ret = 1;
break;
down = event->jbutton.state == SDL_PRESSED;
ret = 1;
break;
+ default:
+ return -1;
}
if (ret)
}
if (ret)
@@
-327,6
+331,12
@@
static int collect_events(struct in_sdl_state *state, int *one_kc, int *one_down
else
ret = handle_event(state,
&events[i], one_kc, one_down);
else
ret = handle_event(state,
&events[i], one_kc, one_down);
+ if (ret == -1) {
+ if (ext_event_handler != NULL)
+ ext_event_handler(&events[i]);
+ continue;
+ }
+
retval |= ret;
if (one_kc != NULL && ret)
goto out;
retval |= ret;
if (one_kc != NULL && ret)
goto out;
@@
-460,8
+470,9
@@
static const in_drv_t in_sdl_drv = {
.menu_translate = in_sdl_menu_translate,
};
.menu_translate = in_sdl_menu_translate,
};
-void in_sdl_init(const struct in_default_bind *defbinds)
+void in_sdl_init(const struct in_default_bind *defbinds,
+ void (*handler)(void *event))
{
in_register_driver(&in_sdl_drv, defbinds);
{
in_register_driver(&in_sdl_drv, defbinds);
+ ext_event_handler = handler;
}
}
-