Input/Overlays: show pressure intensity toggle hint

This commit is contained in:
Megamouse 2024-07-06 18:52:47 +02:00
parent d23ac6f598
commit f0713c8940
11 changed files with 49 additions and 16 deletions

View File

@ -558,7 +558,7 @@ void PadHandlerBase::get_mapping(const pad_ensemble& binding)
// Find out if special buttons are pressed (introduced by RPCS3).
// These buttons will have a delay of one cycle, but whatever.
const bool adjust_pressure = pad->get_pressure_intensity_button_active(cfg->pressure_intensity_toggle_mode.get());
const bool adjust_pressure = pad->get_pressure_intensity_button_active(cfg->pressure_intensity_toggle_mode.get(), pad->m_player_id);
const u32 pressure_intensity_deadzone = cfg->pressure_intensity_deadzone.get();
// Translate any corresponding keycodes to our normal DS3 buttons and triggers

View File

@ -1,5 +1,7 @@
#include "stdafx.h"
#include "pad_types.h"
#include "Emu/system_config.h"
#include "Emu/RSX/Overlays/overlay_message.h"
template <>
void fmt_class_string<pad_button>::format(std::string& out, u64 arg)
@ -157,7 +159,7 @@ u32 get_axis_keycode(u32 offset, u16 value)
}
}
bool Pad::get_pressure_intensity_button_active(bool is_toggle_mode)
bool Pad::get_pressure_intensity_button_active(bool is_toggle_mode, u32 player_id)
{
if (m_pressure_intensity_button_index < 0)
{
@ -175,6 +177,19 @@ bool Pad::get_pressure_intensity_button_active(bool is_toggle_mode)
if (pressed)
{
m_pressure_intensity_toggled = !m_pressure_intensity_toggled;
if (g_cfg.misc.show_pressure_intensity_toggle_hint)
{
const std::string player_id_string = std::to_string(player_id + 1);
if (m_pressure_intensity_toggled)
{
rsx::overlays::queue_message(get_localized_string(localized_string_id::RSX_OVERLAYS_PRESSURE_INTENSITY_TOGGLED_ON, player_id_string.c_str()), 3'000'000);
}
else
{
rsx::overlays::queue_message(get_localized_string(localized_string_id::RSX_OVERLAYS_PRESSURE_INTENSITY_TOGGLED_OFF, player_id_string.c_str()), 3'000'000);
}
}
}
}

View File

@ -31,6 +31,8 @@ enum class localized_string_id
RSX_OVERLAYS_LIST_SELECT,
RSX_OVERLAYS_LIST_CANCEL,
RSX_OVERLAYS_LIST_DENY,
RSX_OVERLAYS_PRESSURE_INTENSITY_TOGGLED_OFF,
RSX_OVERLAYS_PRESSURE_INTENSITY_TOGGLED_ON,
CELL_GAME_ERROR_BROKEN_GAMEDATA,
CELL_GAME_ERROR_BROKEN_HDDGAME,

View File

@ -340,6 +340,7 @@ struct cfg_root : cfg::node
cfg::_bool show_trophy_popups{ this, "Show trophy popups", true, true };
cfg::_bool show_shader_compilation_hint{ this, "Show shader compilation hint", true, true };
cfg::_bool show_ppu_compilation_hint{ this, "Show PPU compilation hint", true, true };
cfg::_bool show_pressure_intensity_toggle_hint{ this, "Show pressure intensity toggle hint", true, true };
cfg::_bool use_native_interface{ this, "Use native user interface", true };
cfg::string gdb_server{ this, "GDB Server", "127.0.0.1:2345" };
cfg::_bool silence_all_logs{ this, "Silence All Logs", false, true };

View File

@ -1084,7 +1084,7 @@ void evdev_joystick_handler::apply_input_events(const std::shared_ptr<Pad>& pad)
// Find out if special buttons are pressed (introduced by RPCS3).
// These buttons will have a delay of one cycle, but whatever.
const bool adjust_pressure = pad->get_pressure_intensity_button_active(cfg->pressure_intensity_toggle_mode.get());
const bool adjust_pressure = pad->get_pressure_intensity_button_active(cfg->pressure_intensity_toggle_mode.get(), pad->m_player_id);
const u32 pressure_intensity_deadzone = cfg->pressure_intensity_deadzone.get();
const auto update_values = [&](bool& pressed, u16& final_value, bool is_stick_value, u32 code, u16 val)

View File

@ -122,7 +122,7 @@ void keyboard_pad_handler::Key(const u32 code, bool pressed, u16 value)
}
}
const bool adjust_pressure = pad.get_pressure_intensity_button_active(m_pressure_intensity_toggle_mode);
const bool adjust_pressure = pad.get_pressure_intensity_button_active(m_pressure_intensity_toggle_mode, pad.m_player_id);
const bool adjust_pressure_changed = pad.m_adjust_pressure_last != adjust_pressure;
if (adjust_pressure_changed)

View File

@ -174,6 +174,7 @@ enum class emu_settings_type
UseNativeInterface,
ShowShaderCompilationHint,
ShowPPUCompilationHint,
ShowPressureIntensityToggleHint,
WindowTitleFormat,
PauseDuringHomeMenu,
@ -354,18 +355,19 @@ inline static const QMap<emu_settings_type, cfg_location> settings_location =
{ emu_settings_type::SDLMappings, { "Input/Output", "Load SDL GameController Mappings" }},
// Misc
{ emu_settings_type::ExitRPCS3OnFinish, { "Miscellaneous", "Exit RPCS3 when process finishes" }},
{ emu_settings_type::StartOnBoot, { "Miscellaneous", "Automatically start games after boot" }},
{ emu_settings_type::PauseOnFocusLoss, { "Miscellaneous", "Pause emulation on RPCS3 focus loss" }},
{ emu_settings_type::StartGameFullscreen, { "Miscellaneous", "Start games in fullscreen mode"}},
{ emu_settings_type::PreventDisplaySleep, { "Miscellaneous", "Prevent display sleep while running games"}},
{ emu_settings_type::ShowTrophyPopups, { "Miscellaneous", "Show trophy popups"}},
{ emu_settings_type::UseNativeInterface, { "Miscellaneous", "Use native user interface"}},
{ emu_settings_type::ShowShaderCompilationHint, { "Miscellaneous", "Show shader compilation hint"}},
{ emu_settings_type::ShowPPUCompilationHint, { "Miscellaneous", "Show PPU compilation hint"}},
{ emu_settings_type::SilenceAllLogs, { "Miscellaneous", "Silence All Logs" }},
{ emu_settings_type::WindowTitleFormat, { "Miscellaneous", "Window Title Format" }},
{ emu_settings_type::PauseDuringHomeMenu, { "Miscellaneous", "Pause Emulation During Home Menu" }},
{ emu_settings_type::ExitRPCS3OnFinish, { "Miscellaneous", "Exit RPCS3 when process finishes" }},
{ emu_settings_type::StartOnBoot, { "Miscellaneous", "Automatically start games after boot" }},
{ emu_settings_type::PauseOnFocusLoss, { "Miscellaneous", "Pause emulation on RPCS3 focus loss" }},
{ emu_settings_type::StartGameFullscreen, { "Miscellaneous", "Start games in fullscreen mode"}},
{ emu_settings_type::PreventDisplaySleep, { "Miscellaneous", "Prevent display sleep while running games"}},
{ emu_settings_type::ShowTrophyPopups, { "Miscellaneous", "Show trophy popups"}},
{ emu_settings_type::UseNativeInterface, { "Miscellaneous", "Use native user interface"}},
{ emu_settings_type::ShowShaderCompilationHint, { "Miscellaneous", "Show shader compilation hint"}},
{ emu_settings_type::ShowPPUCompilationHint, { "Miscellaneous", "Show PPU compilation hint"}},
{ emu_settings_type::ShowPressureIntensityToggleHint, { "Miscellaneous", "Show pressure intensity toggle hint"}},
{ emu_settings_type::SilenceAllLogs, { "Miscellaneous", "Silence All Logs" }},
{ emu_settings_type::WindowTitleFormat, { "Miscellaneous", "Window Title Format" }},
{ emu_settings_type::PauseDuringHomeMenu, { "Miscellaneous", "Pause Emulation During Home Menu" }},
// Networking
{ emu_settings_type::InternetStatus, { "Net", "Internet enabled"}},

View File

@ -65,6 +65,8 @@ private:
case localized_string_id::RSX_OVERLAYS_LIST_SELECT: return tr("Enter", "Enter Dialog List");
case localized_string_id::RSX_OVERLAYS_LIST_CANCEL: return tr("Back", "Cancel Dialog List");
case localized_string_id::RSX_OVERLAYS_LIST_DENY: return tr("Deny", "Deny Dialog List");
case localized_string_id::RSX_OVERLAYS_PRESSURE_INTENSITY_TOGGLED_OFF: return tr("Pressure intensity mode of player %0 disabled", "Pressure intensity toggled off").arg(std::forward<Args>(args)...);
case localized_string_id::RSX_OVERLAYS_PRESSURE_INTENSITY_TOGGLED_ON: return tr("Pressure intensity mode of player %0 enabled", "Pressure intensity toggled on").arg(std::forward<Args>(args)...);
case localized_string_id::CELL_GAME_ERROR_BROKEN_GAMEDATA: return tr("ERROR: Game data is corrupted. The application will continue.", "Game Error");
case localized_string_id::CELL_GAME_ERROR_BROKEN_HDDGAME: return tr("ERROR: HDD boot game is corrupted. The application will continue.", "Game Error");
case localized_string_id::CELL_GAME_ERROR_BROKEN_EXIT_GAMEDATA: return tr("ERROR: Game data is corrupted. The application will be terminated.", "Game Error");

View File

@ -1765,6 +1765,9 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
m_emu_settings->EnhanceCheckBox(ui->showPPUCompilationHint, emu_settings_type::ShowPPUCompilationHint);
SubscribeTooltip(ui->showPPUCompilationHint, tooltips.settings.show_ppu_compilation_hint);
m_emu_settings->EnhanceCheckBox(ui->showPressureIntensityToggleHint, emu_settings_type::ShowPressureIntensityToggleHint);
SubscribeTooltip(ui->showPressureIntensityToggleHint, tooltips.settings.show_pressure_intensity_toggle_hint);
m_emu_settings->EnhanceCheckBox(ui->pauseDuringHomeMenu, emu_settings_type::PauseDuringHomeMenu);
SubscribeTooltip(ui->pauseDuringHomeMenu, tooltips.settings.pause_during_home_menu);

View File

@ -2979,6 +2979,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showPressureIntensityToggleHint">
<property name="text">
<string>Show pressure intensity toggle hint</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="startGameFullscreen">
<property name="text">

View File

@ -140,6 +140,7 @@ public:
const QString hide_mouse_on_idle = tr("Hides the mouse cursor if no mouse movement is detected for the configured time.");
const QString show_shader_compilation_hint = tr("Shows 'Compiling shaders' hint using the native overlay.");
const QString show_ppu_compilation_hint = tr("Shows 'Compiling PPU modules' hint using the native overlay.");
const QString show_pressure_intensity_toggle_hint = tr("Shows pressure intensity toggle hint using the native overlay.");
const QString use_native_interface = tr("Enables use of native HUD within the game window that can interact with game controllers.\nWhen disabled, regular Qt dialogs are used instead.\nCurrently, the on-screen keyboard only supports the English key layout.");
const QString pause_during_home_menu = tr("When enabled, opening the home menu will also pause emulation.\nWhile most games pause themselves while the home menu is shown, some do not.\nIn that case it can be helpful to pause the emulation whenever the home menu is open.");