diff options
author | 2013-11-03 01:42:33 +0000 | |
---|---|---|
committer | 2013-11-03 01:42:33 +0000 | |
commit | cdc51864b0d6fc54120f71f9049985d7059a6d83 (patch) | |
tree | ba076f9d05a449e70d67fcded30b46ffab740388 /src/osd/sdl/input.c | |
parent | b6e5d7924573e2d08e4e5c62182b624785644387 (diff) |
Upstream changes needed to compile JSMESS [Justin Kerk, John Vilk, Justin de Vesine]
Out of whatsnew: there are still a few files being worked on, and the build scripts which are currently set up outside of the MAME source hierarchy. Always open to cleaner ways of doing things.
Diffstat (limited to 'src/osd/sdl/input.c')
-rw-r--r-- | src/osd/sdl/input.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/osd/sdl/input.c b/src/osd/sdl/input.c index 3d3a96e94f0..7efa2f198e6 100644 --- a/src/osd/sdl/input.c +++ b/src/osd/sdl/input.c @@ -41,6 +41,12 @@ #undef DELETE #endif +// Emscripten requires the SDL2 API for keyboard inputs, but nothing else +#ifdef SDLMAME_EMSCRIPTEN +#undef SDLMAME_SDL2 +#define SDLMAME_SDL2 1 +#endif + //============================================================ // PARAMETERS //============================================================ @@ -496,6 +502,13 @@ static kt_table sdl_key_trans_table[] = }; #endif +#if defined(SDLMAME_EMSCRIPTEN) +#undef GET_WINDOW +#undef GET_FOCUS_WINDOW +#define GET_WINDOW(ev) sdl_window_list +#define GET_FOCUS_WINDOW(ev) sdl_window_list +#endif + struct key_lookup_table { int code; @@ -722,7 +735,7 @@ static void sdlinput_register_joysticks(running_machine &machine) { char *joy_name; -#if (SDLMAME_SDL2) +#if (SDLMAME_SDL2) && (!defined(SDLMAME_EMSCRIPTEN)) joy = SDL_JoystickOpen(physical_stick); joy_name = remove_spaces(machine, SDL_JoystickName(joy)); SDL_JoystickClose(joy); @@ -1533,7 +1546,7 @@ INT32 normalize_absolute_axis(INT32 raw, INT32 rawmin, INT32 rawmax) // sdlinput_poll //============================================================ -#if (SDLMAME_SDL2) +#if (SDLMAME_SDL2) && (!defined(SDLMAME_EMSCRIPTEN)) INLINE sdl_window_info * window_from_id(Uint32 windowID) { sdl_window_info *w; @@ -1923,7 +1936,7 @@ void sdlinput_poll(running_machine &machine) devinfo->joystick.balls[event.jball.ball * 2] = event.jball.xrel * INPUT_RELATIVE_PER_PIXEL; devinfo->joystick.balls[event.jball.ball * 2 + 1] = event.jball.yrel * INPUT_RELATIVE_PER_PIXEL; break; -#if (!SDLMAME_SDL2) +#if (!SDLMAME_SDL2) || defined(SDLMAME_EMSCRIPTEN) case SDL_APPMOUSEFOCUS: app_has_mouse_focus = event.active.gain; if (!event.active.gain) @@ -2000,7 +2013,7 @@ void sdlinput_poll(running_machine &machine) #endif } } -#if (SDLMAME_SDL2) +#if (SDLMAME_SDL2) && (!defined(SDLMAME_EMSCRIPTEN)) resize_all_windows(); #endif } |