From e83eeb3cca14848a8a44e2496a01d2852ad586a1 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Wed, 22 Jan 2025 21:49:13 +0100 Subject: [PATCH] cellGem: Move the cursor out of the screen (Time Crisis 4 needs this) --- rpcs3/Emu/Cell/Modules/cellGem.cpp | 35 ++++++++++++++++-------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellGem.cpp b/rpcs3/Emu/Cell/Modules/cellGem.cpp index 18d22e8537..d9585f1dcd 100644 --- a/rpcs3/Emu/Cell/Modules/cellGem.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGem.cpp @@ -1605,6 +1605,10 @@ static inline void pos_to_gem_image_state(u32 gem_num, gem_config::gem_controlle if (x_max <= 0) x_max = shared_data.width; if (y_max <= 0) y_max = shared_data.height; + // Move the cursor out of the screen if we're at the screen border (Time Crisis 4 needs this) + if (x_pos <= 0) x_pos -= x_max / 10; else if (x_pos >= x_max) x_pos += x_max / 10; + if (y_pos <= 0) y_pos -= y_max / 10; else if (y_pos >= y_max) y_pos += y_max / 10; + const f32 scaling_width = x_max / static_cast(shared_data.width); const f32 scaling_height = y_max / static_cast(shared_data.height); const f32 mmPerPixel = CELL_GEM_SPHERE_RADIUS_MM / controller.radius; @@ -1654,6 +1658,10 @@ static inline void pos_to_gem_state(u32 gem_num, gem_config::gem_controller& con if (x_max <= 0) x_max = shared_data.width; if (y_max <= 0) y_max = shared_data.height; + // Move the cursor out of the screen if we're at the screen border (Time Crisis 4 needs this) + if (x_pos <= 0) x_pos -= x_max / 10; else if (x_pos >= x_max) x_pos += x_max / 10; + if (y_pos <= 0) y_pos -= y_max / 10; else if (y_pos >= y_max) y_pos += y_max / 10; + const f32 scaling_width = x_max / static_cast(shared_data.width); const f32 scaling_height = y_max / static_cast(shared_data.height); const f32 mmPerPixel = CELL_GEM_SPHERE_RADIUS_MM / controller.radius; @@ -1744,7 +1752,7 @@ extern bool is_input_allowed(); * Unavoidably buttons conflict with DS3 mappings, which is problematic for some games. * \param gem_num gem index to use * \param digital_buttons Bitmask filled with CELL_GEM_CTRL_* values - * \param analog_t Analog value of Move's Trigger. Currently mapped to R2. + * \param analog_t Analog value of Move's Trigger. * \return true on success, false if controller is disconnected */ static void ds3_input_to_pad(const u32 gem_num, be_t& digital_buttons, be_t& analog_t) @@ -1824,22 +1832,17 @@ static inline void ds3_get_stick_values(u32 gem_num, const std::shared_ptr& const auto& cfg = ::at32(g_cfg_gem_fake.players, gem_num); cfg->handle_input(pad, true, [&](gem_btn btn, pad_button /*pad_btn*/, u16 value, bool pressed, bool& /*abort*/) - { - if (!pressed) - return; + { + if (!pressed) + return; - switch (btn) - { - case gem_btn::x_axis: - x_pos = value; - break; - case gem_btn::y_axis: - y_pos = value; - break; - default: - break; - } - }); + switch (btn) + { + case gem_btn::x_axis: x_pos = value; break; + case gem_btn::y_axis: y_pos = value; break; + default: break; + } + }); } template