add SHIFT+VARS as video recording shortcut when USB is open

This commit is contained in:
Lephenixnoir 2021-08-11 01:43:53 +02:00
parent 439c3a5ad1
commit f59cc41490
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 28 additions and 0 deletions

View File

@ -95,6 +95,23 @@ struct menu menu_libs = {
// Global shortcuts
//---
/* Whether we're recording */
static bool getkey_recording = false;
static void getkey_record_video_frame(int onscreen)
{
#ifdef FX9860G
if(dgray_enabled())
usb_fxlink_videocapture_gray(true);
else
usb_fxlink_videocapture(onscreen);
#endif
#ifdef FXCG50
usb_fxlink_videocapture(onscreen);
#endif
}
static bool getkey_global_shortcuts(key_event_t e)
{
if(usb_is_open() && e.key == KEY_OPTN && !e.shift && !e.alpha) {
@ -111,6 +128,17 @@ static bool getkey_global_shortcuts(key_event_t e)
return true;
}
if(usb_is_open() && e.key == KEY_VARS && e.shift && !e.alpha) {
if(!getkey_recording) {
dupdate_set_hook(GINT_CALL(getkey_record_video_frame, (int)false));
getkey_record_video_frame(true);
getkey_recording = true;
}
else {
dupdate_set_hook(GINT_CALL_NULL);
getkey_recording = false;
}
}
return false;
}