diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-05-02 12:00:58 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-05-02 12:00:58 -0700 |
commit | fa95b24c889a0d24b63fbde77e5a430380c6930b (patch) | |
tree | 6e758d7c4402b6c77c4a46491b83bfdb27f0463b | |
parent | c7359d1c1113e480061906a6f4bb930936711c13 (diff) |
fix SDL.keyboardState size to add safe buffer zone
-rw-r--r-- | src/library_sdl.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index 911b83e2..a1fb871f 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -653,8 +653,8 @@ var LibrarySDL = { document.addEventListener("visibilitychange", SDL.receiveEvent); } window.onunload = SDL.receiveEvent; - SDL.keyboardState = _malloc(1024); // SDL needs 512, add some buffer to be safe - _memset(SDL.keyboardState, 0, 1024); + SDL.keyboardState = _malloc(0x10000); // Our SDL needs 512, but 64K is safe for older SDLs + _memset(SDL.keyboardState, 0, 0x10000); // Initialize this structure carefully for closure SDL.DOMEventToSDLEvent['keydown'] = 0x300 /* SDL_KEYDOWN */; SDL.DOMEventToSDLEvent['keyup'] = 0x301 /* SDL_KEYUP */; |