Xenoveritas / abuse

Abuse SDL port originally from Crack-Dot-Com and released into the public domain
Other
126 stars 24 forks source link

Fixed game crashing on MacOS when pressing Mac's CMD(⌘) button #15

Closed deviant-syndrome closed 2 years ago

deviant-syndrome commented 3 years ago

When pressing the cmd-key, game crashes, even if no action is mapped to it. The crash happens in /imlib/jwindow.cpp:

void WindowManager::get_event(Event &ev)
{
  Get(ev);

  if (ev.type==EV_KEY)
    key_state[ev.key]=1;   // ev.key is out of array bounds
  ...
}

The proposed solution is to use SDLK_LGUI and SDLK_LGUI bindings for this mac-specific key from SDL library and map then to standard keyboard layout Abuse input routine can operate (keys.h file). Unfortunately, it seems to be no direct mapping of Mac CMD to that layout, taking in account that they are also mirrored, so I mapped them both to JK_COMMAND (I do not even remember seeing it on the standard DOS keyboard)

This can be altered at maintainer's discretion.
Thank you.