diff options
-rw-r--r-- | images/ps4_cross.png | bin | 0 -> 1270 bytes | |||
-rw-r--r-- | images/ps4_triangle.png | bin | 0 -> 1446 bytes | |||
-rw-r--r-- | include/GlobalHotkeysJoystick.hpp | 4 | ||||
-rw-r--r-- | include/Theme.hpp | 2 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | project.conf | 2 | ||||
-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 |
10 files changed, 64 insertions, 7 deletions
diff --git a/images/ps4_cross.png b/images/ps4_cross.png Binary files differnew file mode 100644 index 0000000..fc14b2b --- /dev/null +++ b/images/ps4_cross.png diff --git a/images/ps4_triangle.png b/images/ps4_triangle.png Binary files differnew file mode 100644 index 0000000..ff07fcd --- /dev/null +++ b/images/ps4_triangle.png diff --git a/include/GlobalHotkeysJoystick.hpp b/include/GlobalHotkeysJoystick.hpp index 30a7689..fde5be2 100644 --- a/include/GlobalHotkeysJoystick.hpp +++ b/include/GlobalHotkeysJoystick.hpp @@ -21,6 +21,8 @@ namespace gsr { bool start(); // Currently valid ids: // save_replay + // save_1_min_replay + // save_10_min_replay // take_screenshot // toggle_record // toggle_replay @@ -56,6 +58,8 @@ namespace gsr { bool right_pressed = false; bool save_replay = false; + bool save_1_min_replay = false; + bool save_10_min_replay = false; bool take_screenshot = false; bool toggle_record = false; bool toggle_replay = false; diff --git a/include/Theme.hpp b/include/Theme.hpp index 670980f..249ad3d 100644 --- a/include/Theme.hpp +++ b/include/Theme.hpp @@ -50,6 +50,8 @@ namespace gsr { mgl::Texture ps4_dpad_down_texture; mgl::Texture ps4_dpad_left_texture; mgl::Texture ps4_dpad_right_texture; + mgl::Texture ps4_cross_texture; + mgl::Texture ps4_triangle_texture; double double_click_timeout_seconds = 0.4; diff --git a/meson.build b/meson.build index 6bc2b0f..5285197 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('gsr-ui', ['c', 'cpp'], version : '1.4.0', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends') +project('gsr-ui', ['c', 'cpp'], version : '1.5.0', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends') if get_option('buildtype') == 'debug' add_project_arguments('-g3', language : ['c', 'cpp']) diff --git a/project.conf b/project.conf index 3d5bc49..13a9681 100644 --- a/project.conf +++ b/project.conf @@ -1,7 +1,7 @@ [package] name = "gsr-ui" type = "executable" -version = "1.4.0" +version = "1.5.0" platforms = ["posix"] [lang.cpp] 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; |