diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/GlobalHotkeysJoystick.cpp | 41 | ||||
-rw-r--r-- | src/Overlay.cpp | 12 | ||||
-rw-r--r-- | src/Theme.cpp | 6 | ||||
-rw-r--r-- | src/gui/GlobalSettingsPage.cpp | 2 |
4 files changed, 56 insertions, 5 deletions
diff --git a/src/GlobalHotkeysJoystick.cpp b/src/GlobalHotkeysJoystick.cpp index d005aa9..822a73a 100644 --- a/src/GlobalHotkeysJoystick.cpp +++ b/src/GlobalHotkeysJoystick.cpp @@ -7,6 +7,8 @@ namespace gsr { static constexpr int button_pressed = 1; + static constexpr int cross_button = 0; + static constexpr int triangle_button = 2; static constexpr int options_button = 9; static constexpr int playstation_button = 10; static constexpr int axis_up_down = 7; @@ -104,6 +106,20 @@ namespace gsr { it->second("save_replay"); } + if(save_1_min_replay) { + save_1_min_replay = false; + auto it = bound_actions_by_id.find("save_1_min_replay"); + if(it != bound_actions_by_id.end()) + it->second("save_1_min_replay"); + } + + if(save_10_min_replay) { + save_10_min_replay = false; + auto it = bound_actions_by_id.find("save_10_min_replay"); + if(it != bound_actions_by_id.end()) + it->second("save_10_min_replay"); + } + if(take_screenshot) { take_screenshot = false; auto it = bound_actions_by_id.find("take_screenshot"); @@ -186,10 +202,27 @@ namespace gsr { return; if((event.type & JS_EVENT_BUTTON) == JS_EVENT_BUTTON) { - if(event.number == playstation_button) - playstation_button_pressed = event.value == button_pressed; - else if(playstation_button_pressed && event.number == options_button && event.value == button_pressed) - toggle_show = true; + switch(event.number) { + case playstation_button: { + playstation_button_pressed = event.value == button_pressed; + break; + } + case options_button: { + if(playstation_button_pressed && event.value == button_pressed) + toggle_show = true; + break; + } + case cross_button: { + if(playstation_button_pressed && event.value == button_pressed) + save_1_min_replay = true; + break; + } + case triangle_button: { + if(playstation_button_pressed && event.value == button_pressed) + save_10_min_replay = true; + break; + } + } } else if((event.type & JS_EVENT_AXIS) == JS_EVENT_AXIS && playstation_button_pressed) { const int trigger_threshold = 16383; const bool prev_up_pressed = up_pressed; diff --git a/src/Overlay.cpp b/src/Overlay.cpp index c91ac47..76fe831 100644 --- a/src/Overlay.cpp +++ b/src/Overlay.cpp @@ -385,6 +385,16 @@ namespace gsr { overlay->save_replay(); }); + global_hotkeys_js->bind_action("save_1_min_replay", [overlay](const std::string &id) { + fprintf(stderr, "pressed %s\n", id.c_str()); + overlay->save_replay_1_min(); + }); + + global_hotkeys_js->bind_action("save_10_min_replay", [overlay](const std::string &id) { + fprintf(stderr, "pressed %s\n", id.c_str()); + overlay->save_replay_10_min(); + }); + global_hotkeys_js->bind_action("take_screenshot", [overlay](const std::string &id) { fprintf(stderr, "pressed %s\n", id.c_str()); overlay->take_screenshot(); @@ -1707,7 +1717,7 @@ namespace gsr { const std::string video_filepath = filepath_get_filename(line); if(starts_with(video_filepath, "Video_")) { - on_stop_recording(0, video_filepath); + on_stop_recording(0, line); return; } diff --git a/src/Theme.cpp b/src/Theme.cpp index cafaf62..6c384e3 100644 --- a/src/Theme.cpp +++ b/src/Theme.cpp @@ -135,6 +135,12 @@ namespace gsr { if(!theme->ps4_dpad_right_texture.load_from_file((resources_path + "images/ps4_dpad_right.png").c_str(), mgl::Texture::LoadOptions{false, false, MGL_TEXTURE_SCALE_LINEAR_MIPMAP})) goto error; + if(!theme->ps4_cross_texture.load_from_file((resources_path + "images/ps4_cross.png").c_str(), mgl::Texture::LoadOptions{false, false, MGL_TEXTURE_SCALE_LINEAR_MIPMAP})) + goto error; + + if(!theme->ps4_triangle_texture.load_from_file((resources_path + "images/ps4_triangle.png").c_str(), mgl::Texture::LoadOptions{false, false, MGL_TEXTURE_SCALE_LINEAR_MIPMAP})) + goto error; + return true; error: diff --git a/src/gui/GlobalSettingsPage.cpp b/src/gui/GlobalSettingsPage.cpp index 109e72d..ccebb92 100644 --- a/src/gui/GlobalSettingsPage.cpp +++ b/src/gui/GlobalSettingsPage.cpp @@ -420,6 +420,8 @@ namespace gsr { list_ptr->add_widget(create_joystick_hotkey_text(&get_theme().ps4_home_texture, &get_theme().ps4_options_texture, get_theme().body_font.get_character_size(), "to show/hide the UI")); list_ptr->add_widget(create_joystick_hotkey_text(&get_theme().ps4_home_texture, &get_theme().ps4_dpad_up_texture, get_theme().body_font.get_character_size(), "to take a screenshot")); list_ptr->add_widget(create_joystick_hotkey_text(&get_theme().ps4_home_texture, &get_theme().ps4_dpad_down_texture, get_theme().body_font.get_character_size(), "to save a replay")); + list_ptr->add_widget(create_joystick_hotkey_text(&get_theme().ps4_home_texture, &get_theme().ps4_cross_texture, get_theme().body_font.get_character_size(), "to save a 1 minute replay")); + list_ptr->add_widget(create_joystick_hotkey_text(&get_theme().ps4_home_texture, &get_theme().ps4_triangle_texture, get_theme().body_font.get_character_size(), "to save a 10 minute replay")); list_ptr->add_widget(create_joystick_hotkey_text(&get_theme().ps4_home_texture, &get_theme().ps4_dpad_left_texture, get_theme().body_font.get_character_size(), "to start/stop recording")); list_ptr->add_widget(create_joystick_hotkey_text(&get_theme().ps4_home_texture, &get_theme().ps4_dpad_right_texture, get_theme().body_font.get_character_size(), "to turn replay on/off")); return subsection; |