diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | images/ps4_options.png | bin | 0 -> 801 bytes | |||
-rw-r--r-- | include/GlobalHotkeysJoystick.hpp | 2 | ||||
-rw-r--r-- | include/GsrInfo.hpp | 3 | ||||
-rw-r--r-- | include/Theme.hpp | 1 | ||||
-rw-r--r-- | src/GlobalHotkeysJoystick.cpp | 11 | ||||
-rw-r--r-- | src/GsrInfo.cpp | 11 | ||||
-rw-r--r-- | src/Overlay.cpp | 7 | ||||
-rw-r--r-- | src/Theme.cpp | 14 | ||||
-rw-r--r-- | src/gui/GlobalSettingsPage.cpp | 19 |
10 files changed, 51 insertions, 19 deletions
@@ -40,7 +40,7 @@ This might cause issues for you if you use input remapping software. To workarou # License This software is licensed under GPL3.0-only. Files under `fonts/` directory belong to the Noto Sans Google fonts project and they are licensed under `SIL Open Font License`.\ `images/default.cur` it part of the [Adwaita icon theme](https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/tree/master) which is licensed under `CC BY-SA 3.0`.\ -The D-Pad images under `images/` were created by [Julio Cacko](https://juliocacko.itch.io/free-input-prompts) and they are licensed under `CC0 1.0 Universal`.\ +The controller buttons under `images/` were created by [Julio Cacko](https://juliocacko.itch.io/free-input-prompts) and they are licensed under `CC0 1.0 Universal`.\ The PlayStation logo under `images/` was created by [ArksDigital](https://arks.itch.io/ps4-buttons) and it's are licensed under `CC BY 4.0`. # Reporting bugs, contributing patches, questions or donation diff --git a/images/ps4_options.png b/images/ps4_options.png Binary files differnew file mode 100644 index 0000000..99787fa --- /dev/null +++ b/images/ps4_options.png diff --git a/include/GlobalHotkeysJoystick.hpp b/include/GlobalHotkeysJoystick.hpp index 1effe3c..30a7689 100644 --- a/include/GlobalHotkeysJoystick.hpp +++ b/include/GlobalHotkeysJoystick.hpp @@ -24,6 +24,7 @@ namespace gsr { // take_screenshot // toggle_record // toggle_replay + // toggle_show bool bind_action(const std::string &id, GlobalHotkeyCallback callback) override; void poll_events() override; private: @@ -58,6 +59,7 @@ namespace gsr { bool take_screenshot = false; bool toggle_record = false; bool toggle_replay = false; + bool toggle_show = false; int hotplug_poll_index = -1; Hotplug hotplug; }; diff --git a/include/GsrInfo.hpp b/include/GsrInfo.hpp index b8f478c..156125b 100644 --- a/include/GsrInfo.hpp +++ b/include/GsrInfo.hpp @@ -69,7 +69,8 @@ namespace gsr { UNKNOWN, AMD, INTEL, - NVIDIA + NVIDIA, + BROADCOM }; struct GpuInfo { diff --git a/include/Theme.hpp b/include/Theme.hpp index bda8dd4..4305072 100644 --- a/include/Theme.hpp +++ b/include/Theme.hpp @@ -44,6 +44,7 @@ namespace gsr { mgl::Texture screenshot_texture; mgl::Texture ps4_home_texture; + mgl::Texture ps4_options_texture; mgl::Texture ps4_dpad_up_texture; mgl::Texture ps4_dpad_down_texture; mgl::Texture ps4_dpad_left_texture; diff --git a/src/GlobalHotkeysJoystick.cpp b/src/GlobalHotkeysJoystick.cpp index 066c8c9..50b1588 100644 --- a/src/GlobalHotkeysJoystick.cpp +++ b/src/GlobalHotkeysJoystick.cpp @@ -7,6 +7,7 @@ namespace gsr { static constexpr int button_pressed = 1; + static constexpr int options_button = 9; static constexpr int playstation_button = 10; static constexpr int axis_up_down = 7; static constexpr int axis_left_right = 6; @@ -123,6 +124,13 @@ namespace gsr { if(it != bound_actions_by_id.end()) it->second("toggle_replay"); } + + if(toggle_show) { + toggle_show = false; + auto it = bound_actions_by_id.find("toggle_show"); + if(it != bound_actions_by_id.end()) + it->second("toggle_show"); + } } void GlobalHotkeysJoystick::read_events() { @@ -180,12 +188,15 @@ namespace gsr { if((event.type & JS_EVENT_BUTTON) == JS_EVENT_BUTTON) { if(event.number == playstation_button) playstation_button_pressed = event.value == button_pressed; + else if(event.number == options_button && event.value == button_pressed) + toggle_show = true; } 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; const bool prev_down_pressed = down_pressed; const bool prev_left_pressed = left_pressed; const bool prev_right_pressed = right_pressed; + if(event.number == axis_up_down) { up_pressed = event.value <= -trigger_threshold; down_pressed = event.value >= trigger_threshold; diff --git a/src/GsrInfo.cpp b/src/GsrInfo.cpp index 73f54ee..5f8e00d 100644 --- a/src/GsrInfo.cpp +++ b/src/GsrInfo.cpp @@ -129,6 +129,8 @@ namespace gsr { gsr_info->gpu_info.vendor = GpuVendor::INTEL; else if(key_value->value == "nvidia") gsr_info->gpu_info.vendor = GpuVendor::NVIDIA; + else if(key_value->value == "broadcom") + gsr_info->gpu_info.vendor = GpuVendor::BROADCOM; } else if(key_value->key == "card_path") { gsr_info->gpu_info.card_path = key_value->value; } @@ -325,10 +327,11 @@ namespace gsr { static const char* gpu_vendor_to_string(GpuVendor vendor) { switch(vendor) { - case GpuVendor::UNKNOWN: return "unknown"; - case GpuVendor::AMD: return "amd"; - case GpuVendor::INTEL: return "intel"; - case GpuVendor::NVIDIA: return "nvidia"; + case GpuVendor::UNKNOWN: return "unknown"; + case GpuVendor::AMD: return "amd"; + case GpuVendor::INTEL: return "intel"; + case GpuVendor::NVIDIA: return "nvidia"; + case GpuVendor::BROADCOM: return "broadcom"; } return "unknown"; } diff --git a/src/Overlay.cpp b/src/Overlay.cpp index 63f9822..0be7375 100644 --- a/src/Overlay.cpp +++ b/src/Overlay.cpp @@ -272,7 +272,7 @@ namespace gsr { static void bind_linux_hotkeys(GlobalHotkeysLinux *global_hotkeys, Overlay *overlay) { global_hotkeys->bind_key_press( config_hotkey_to_hotkey(overlay->get_config().main_config.show_hide_hotkey), - "show_hide", [overlay](const std::string &id) { + "toggle_show", [overlay](const std::string &id) { fprintf(stderr, "pressed %s\n", id.c_str()); overlay->toggle_show(); }); @@ -334,6 +334,11 @@ namespace gsr { if(!global_hotkeys_js->start()) fprintf(stderr, "Warning: failed to start joystick hotkeys\n"); + global_hotkeys_js->bind_action("toggle_show", [overlay](const std::string &id) { + fprintf(stderr, "pressed %s\n", id.c_str()); + overlay->toggle_show(); + }); + global_hotkeys_js->bind_action("save_replay", [overlay](const std::string &id) { fprintf(stderr, "pressed %s\n", id.c_str()); overlay->save_replay(); diff --git a/src/Theme.cpp b/src/Theme.cpp index fd40c9b..2001f7d 100644 --- a/src/Theme.cpp +++ b/src/Theme.cpp @@ -10,10 +10,11 @@ namespace gsr { static mgl::Color gpu_vendor_to_color(GpuVendor vendor) { switch(vendor) { - case GpuVendor::UNKNOWN: return mgl::Color(221, 0, 49); - case GpuVendor::AMD: return mgl::Color(221, 0, 49); - case GpuVendor::INTEL: return mgl::Color(8, 109, 183); - case GpuVendor::NVIDIA: return mgl::Color(118, 185, 0); + case GpuVendor::UNKNOWN: return mgl::Color(221, 0, 49); + case GpuVendor::AMD: return mgl::Color(221, 0, 49); + case GpuVendor::INTEL: return mgl::Color(8, 109, 183); + case GpuVendor::NVIDIA: return mgl::Color(118, 185, 0); + case GpuVendor::BROADCOM: return mgl::Color(221, 0, 49); } return mgl::Color(221, 0, 49); } @@ -26,6 +27,8 @@ namespace gsr { vendor = GpuVendor::INTEL; else if(color_name == "nvidia") vendor = GpuVendor::NVIDIA; + else if(color_name == "broadcom") + vendor = GpuVendor::BROADCOM; return gpu_vendor_to_color(vendor); } @@ -114,6 +117,9 @@ namespace gsr { if(!theme->ps4_home_texture.load_from_file((resources_path + "images/ps4_home.png").c_str(), mgl::Texture::LoadOptions{false, false, true})) goto error; + if(!theme->ps4_options_texture.load_from_file((resources_path + "images/ps4_options.png").c_str(), mgl::Texture::LoadOptions{false, false, true})) + goto error; + if(!theme->ps4_dpad_up_texture.load_from_file((resources_path + "images/ps4_dpad_up.png").c_str(), mgl::Texture::LoadOptions{false, false, true})) goto error; diff --git a/src/gui/GlobalSettingsPage.cpp b/src/gui/GlobalSettingsPage.cpp index 3574d57..f8cdf20 100644 --- a/src/gui/GlobalSettingsPage.cpp +++ b/src/gui/GlobalSettingsPage.cpp @@ -35,20 +35,22 @@ extern "C" { namespace gsr { static const char* gpu_vendor_to_color_name(GpuVendor vendor) { switch(vendor) { - case GpuVendor::UNKNOWN: return "amd"; - case GpuVendor::AMD: return "amd"; - case GpuVendor::INTEL: return "intel"; - case GpuVendor::NVIDIA: return "nvidia"; + case GpuVendor::UNKNOWN: return "amd"; + case GpuVendor::AMD: return "amd"; + case GpuVendor::INTEL: return "intel"; + case GpuVendor::NVIDIA: return "nvidia"; + case GpuVendor::BROADCOM: return "broadcom"; } return "amd"; } static const char* gpu_vendor_to_string(GpuVendor vendor) { switch(vendor) { - case GpuVendor::UNKNOWN: return "Unknown"; - case GpuVendor::AMD: return "AMD"; - case GpuVendor::INTEL: return "Intel"; - case GpuVendor::NVIDIA: return "NVIDIA"; + case GpuVendor::UNKNOWN: return "Unknown"; + case GpuVendor::AMD: return "AMD"; + case GpuVendor::INTEL: return "Intel"; + case GpuVendor::NVIDIA: return "NVIDIA"; + case GpuVendor::BROADCOM: return "Broadcom"; } return "unknown"; } @@ -361,6 +363,7 @@ namespace gsr { list_ptr->add_widget(std::make_unique<Label>(&get_theme().body_font, "Enable controller hotkeys?", get_color_theme().text_color)); list_ptr->add_widget(create_enable_joystick_hotkeys_button()); list_ptr->add_widget(std::make_unique<LineSeparator>(LineSeparator::Orientation::HORIZONTAL, subsection->get_inner_size().x)); + 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_dpad_left_texture, get_theme().body_font.get_character_size(), "to start/stop recording")); |