Re-enable keyboard.

Print a short message informing the user about game focus mode.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2020-12-23 17:43:54 +00:00
parent ad41cae876
commit cb2f9b6177
4 changed files with 21 additions and 4 deletions

View file

@ -68,7 +68,7 @@ Keyboard shortcuts
* ``ALT-DOWN``: vertical hires (bigger)
In order to properly appreciate the wider hi res graphics, open a big terminal window and choose a small font size.
Try ``CTRL-`` as well if ``ALT--` does not work: terminals do not report a consistent keycode for these combinations.
Try ``CTRL-`` as well if ``ALT-`` does not work: terminals do not report a consistent keycode for these combinations.
The joystick uses evdev (currently the device name is hardcoded).
@ -95,7 +95,9 @@ See [sa2](source/frontends/sa2/README.md).
There is an initial [libretro](https://docs.libretro.com/development/cores/developing-cores/) core.
Keyboard works, but a lot of keys overlap with RetroArch shortcuts. In the latest version the keyboard has been disabled and only the retro joypad works.
A retropad can be plugged in port 1 (with or without analog stick).
In order to have a better experience with the keyboard, one should probably enable *Game Focus Mode* (normally Scroll-Lock) to disable hotkeys.
Video works, but the vertical flip is done in software.

View file

@ -24,3 +24,11 @@ retro_audio_sample_t audio_cb;
retro_audio_sample_batch_t audio_batch_cb;
std::string retro_base_directory;
void display_message(const std::string & message)
{
retro_message rmsg;
rmsg.frames = 180;
rmsg.msg = message.c_str();
environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE, &rmsg);
}

View file

@ -13,3 +13,5 @@ extern retro_audio_sample_t audio_cb;
extern retro_audio_sample_batch_t audio_batch_cb;
extern std::string retro_base_directory;
void display_message(const std::string & message);

View file

@ -115,8 +115,8 @@ void retro_set_environment(retro_environment_t cb)
cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
// retro_keyboard_callback callback = {&Game::keyboardCallback};
// cb(RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK, &callback);
retro_keyboard_callback callback = {&Game::keyboardCallback};
cb(RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK, &callback);
}
void retro_set_audio_sample(retro_audio_sample_t cb)
@ -174,6 +174,11 @@ bool retro_load_game(const retro_game_info *info)
log_cb(RETRO_LOG_INFO, "Game path: %s:%d\n", info->path, ok);
if (ok)
{
display_message("Enable Game Focus Mode for better keyboard handling");
}
return ok;
}
catch (const std::exception & e)