diff --git a/rpcs3/Emu/Cell/Modules/cellGem.cpp b/rpcs3/Emu/Cell/Modules/cellGem.cpp index ff596cbc34..cb0e1dfb3e 100644 --- a/rpcs3/Emu/Cell/Modules/cellGem.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGem.cpp @@ -956,9 +956,10 @@ static inline void pos_to_gem_state(u32 gem_num, gem_config::gem_controller& con static constexpr f32 PI = 3.14159265f; const auto degree_to_rad = [](f32 degree) -> f32 { return degree * PI / 180.0f; }; - const f32 max_angle_per_side = g_cfg.io.fake_move_rotation_cone / 2.0f; - const f32 roll = -degree_to_rad((image_y - half_height) / half_height * max_angle_per_side); // This is actually the pitch - const f32 pitch = -degree_to_rad((image_x - half_width) / half_width * max_angle_per_side); // This is actually the yaw + const f32 max_angle_per_side_h = g_cfg.io.fake_move_rotation_cone_h / 2.0f; + const f32 max_angle_per_side_v = g_cfg.io.fake_move_rotation_cone_v / 2.0f; + const f32 roll = -degree_to_rad((image_y - half_height) / half_height * max_angle_per_side_v); // This is actually the pitch + const f32 pitch = -degree_to_rad((image_x - half_width) / half_width * max_angle_per_side_h); // This is actually the yaw const f32 yaw = degree_to_rad(0.0f); const f32 cr = std::cos(roll * 0.5f); const f32 sr = std::sin(roll * 0.5f); diff --git a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_settings.cpp b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_settings.cpp index 0639e41ea7..fe82f81253 100644 --- a/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_settings.cpp +++ b/rpcs3/Emu/RSX/Overlays/HomeMenu/overlay_home_menu_settings.cpp @@ -83,7 +83,8 @@ namespace rsx add_dropdown(&g_cfg.io.pad_mode, localized_string_id::HOME_MENU_SETTINGS_INPUT_PAD_MODE); add_unsigned_slider(&g_cfg.io.pad_sleep, localized_string_id::HOME_MENU_SETTINGS_INPUT_PAD_SLEEP, " µs", 100); - add_unsigned_slider(&g_cfg.io.fake_move_rotation_cone, localized_string_id::HOME_MENU_SETTINGS_INPUT_FAKE_MOVE_ROTATION_CONE, "°", 1); + add_unsigned_slider(&g_cfg.io.fake_move_rotation_cone_h, localized_string_id::HOME_MENU_SETTINGS_INPUT_FAKE_MOVE_ROTATION_CONE_H, "°", 1); + add_unsigned_slider(&g_cfg.io.fake_move_rotation_cone_v, localized_string_id::HOME_MENU_SETTINGS_INPUT_FAKE_MOVE_ROTATION_CONE_V, "°", 1); apply_layout(); } diff --git a/rpcs3/Emu/localized_string_id.h b/rpcs3/Emu/localized_string_id.h index 4a380422b9..2e560284d6 100644 --- a/rpcs3/Emu/localized_string_id.h +++ b/rpcs3/Emu/localized_string_id.h @@ -223,7 +223,8 @@ enum class localized_string_id HOME_MENU_SETTINGS_INPUT_CAMERA_FLIP, HOME_MENU_SETTINGS_INPUT_PAD_MODE, HOME_MENU_SETTINGS_INPUT_PAD_SLEEP, - HOME_MENU_SETTINGS_INPUT_FAKE_MOVE_ROTATION_CONE, + HOME_MENU_SETTINGS_INPUT_FAKE_MOVE_ROTATION_CONE_H, + HOME_MENU_SETTINGS_INPUT_FAKE_MOVE_ROTATION_CONE_V, HOME_MENU_SETTINGS_ADVANCED, HOME_MENU_SETTINGS_ADVANCED_PREFERRED_SPU_THREADS, HOME_MENU_SETTINGS_ADVANCED_MAX_CPU_PREEMPTIONS, diff --git a/rpcs3/Emu/system_config.h b/rpcs3/Emu/system_config.h index 04a4ce5399..b476d62941 100644 --- a/rpcs3/Emu/system_config.h +++ b/rpcs3/Emu/system_config.h @@ -283,7 +283,8 @@ struct cfg_root : cfg::node cfg::string midi_devices{this, "Emulated Midi devices", "ßßß@@@ßßß@@@ßßß@@@"}; cfg::_bool load_sdl_mappings{ this, "Load SDL GameController Mappings", true }; cfg::_bool debug_overlay{ this, "IO Debug overlay", false, true }; - cfg::uint<1, 180> fake_move_rotation_cone{ this, "Fake Move Rotation Cone", 10, true }; + cfg::uint<1, 180> fake_move_rotation_cone_h{ this, "Fake Move Rotation Cone", 10, true }; + cfg::uint<1, 180> fake_move_rotation_cone_v{ this, "Fake Move Rotation Cone (Vertical)", 10, true }; } io{ this }; diff --git a/rpcs3/rpcs3qt/flow_layout.cpp b/rpcs3/rpcs3qt/flow_layout.cpp index 02fcbd1a34..92fe956b28 100644 --- a/rpcs3/rpcs3qt/flow_layout.cpp +++ b/rpcs3/rpcs3qt/flow_layout.cpp @@ -79,7 +79,8 @@ flow_layout::~flow_layout() void flow_layout::clear() { - for (QLayoutItem* item : m_item_list) + // We can't use a ranged loop here, since deleting the widget will call takeAt on the layout. So let's also use takeAt. + while (QLayoutItem* item = takeAt(0)) { if (item) { diff --git a/rpcs3/rpcs3qt/localized_emu.h b/rpcs3/rpcs3qt/localized_emu.h index 7b4dbd72f9..9dbc9ee3f3 100644 --- a/rpcs3/rpcs3qt/localized_emu.h +++ b/rpcs3/rpcs3qt/localized_emu.h @@ -244,7 +244,8 @@ private: case localized_string_id::HOME_MENU_SETTINGS_INPUT_CAMERA_FLIP: return tr("Camera Flip", "Input"); case localized_string_id::HOME_MENU_SETTINGS_INPUT_PAD_MODE: return tr("Pad Handler Mode", "Input"); case localized_string_id::HOME_MENU_SETTINGS_INPUT_PAD_SLEEP: return tr("Pad Handler Sleep", "Input"); - case localized_string_id::HOME_MENU_SETTINGS_INPUT_FAKE_MOVE_ROTATION_CONE: return tr("Fake PS Move Rotation Cone", "Input"); + case localized_string_id::HOME_MENU_SETTINGS_INPUT_FAKE_MOVE_ROTATION_CONE_H: return tr("Fake PS Move Rotation Cone (Horizontal)", "Input"); + case localized_string_id::HOME_MENU_SETTINGS_INPUT_FAKE_MOVE_ROTATION_CONE_V: return tr("Fake PS Move Rotation Cone (Vertical)", "Input"); case localized_string_id::HOME_MENU_SETTINGS_ADVANCED: return tr("Advanced"); case localized_string_id::HOME_MENU_SETTINGS_ADVANCED_PREFERRED_SPU_THREADS: return tr("Preferred SPU Threads", "Advanced"); case localized_string_id::HOME_MENU_SETTINGS_ADVANCED_MAX_CPU_PREEMPTIONS: return tr("Max Power Saving CPU-Preemptions", "Advanced"); diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index ace07fdba5..6d17c7e9a5 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -94,7 +94,7 @@ void remove_item(QComboBox* box, int data_value, int def_value) extern const std::map g_prx_list; -settings_dialog::settings_dialog(std::shared_ptr gui_settings, std::shared_ptr emu_settings, const int& tab_index, QWidget* parent, const GameInfo* game, bool create_cfg_from_global_cfg) +settings_dialog::settings_dialog(std::shared_ptr gui_settings, std::shared_ptr emu_settings, int tab_index, QWidget* parent, const GameInfo* game, bool create_cfg_from_global_cfg) : QDialog(parent) , m_tab_index(tab_index) , ui(new Ui::settings_dialog) @@ -2607,14 +2607,11 @@ void settings_dialog::ApplyStylesheet(bool reset) } } -int settings_dialog::exec() +void settings_dialog::open() { - // singleShot Hack to fix following bug: - // If we use setCurrentIndex now we will miraculously see a resize of the dialog as soon as we - // switch to the cpu tab after conjuring the settings_dialog with another tab opened first. - // Weirdly enough this won't happen if we change the tab order so that anything else is at index 0. - ui->tab_widget_settings->setCurrentIndex(0); - QTimer::singleShot(0, [this]{ ui->tab_widget_settings->setCurrentIndex(m_tab_index); }); + QDialog::open(); + + ui->tab_widget_settings->setCurrentIndex(m_tab_index); // Open a dialog if your config file contained invalid entries QTimer::singleShot(10, [this] @@ -2640,8 +2637,6 @@ int settings_dialog::exec() } } }); - - return QDialog::exec(); } void settings_dialog::SubscribeDescription(QLabel* description) diff --git a/rpcs3/rpcs3qt/settings_dialog.h b/rpcs3/rpcs3qt/settings_dialog.h index 203fd1c8f9..0513227e80 100644 --- a/rpcs3/rpcs3qt/settings_dialog.h +++ b/rpcs3/rpcs3qt/settings_dialog.h @@ -21,9 +21,9 @@ class settings_dialog : public QDialog Q_OBJECT public: - explicit settings_dialog(std::shared_ptr gui_settings, std::shared_ptr emu_settings, const int& tab_index = 0, QWidget* parent = nullptr, const GameInfo* game = nullptr, bool create_cfg_from_global_cfg = true); + explicit settings_dialog(std::shared_ptr gui_settings, std::shared_ptr emu_settings, int tab_index = 0, QWidget* parent = nullptr, const GameInfo* game = nullptr, bool create_cfg_from_global_cfg = true); ~settings_dialog(); - int exec() override; + void open() override; Q_SIGNALS: void GuiStylesheetRequest(); void GuiRepaintRequest();