mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 22:19:02 +00:00
gui/input: let pad handlers know whether they are part of emulation
Also fix unique_ptr vs shared_ptr nonsense in pad_threads
This commit is contained in:
parent
fc698a4df2
commit
06025cd19d
26 changed files with 74 additions and 129 deletions
|
|
@ -1,7 +1,6 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/system_config.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Emu/Cell/lv2/sys_process.h"
|
||||
#include "Emu/Cell/lv2/sys_sync.h"
|
||||
|
|
@ -166,11 +165,7 @@ void cellPad_NotifyStateChange(usz index, u64 /*state*/, bool locked)
|
|||
|
||||
extern void pad_state_notify_state_change(usz index, u32 state)
|
||||
{
|
||||
// Prevents accidental calls from pad handlers while the emulation is not running.
|
||||
if (Emu.IsRunning())
|
||||
{
|
||||
send_sys_io_connect_event(index, state);
|
||||
}
|
||||
send_sys_io_connect_event(index, state);
|
||||
}
|
||||
|
||||
error_code cellPadInit(ppu_thread& ppu, u32 max_connect)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
class NullPadHandler final : public PadHandlerBase
|
||||
{
|
||||
public:
|
||||
NullPadHandler() : PadHandlerBase(pad_handler::null)
|
||||
NullPadHandler(bool emulation) : PadHandlerBase(pad_handler::null, emulation)
|
||||
{
|
||||
b_has_pressure_intensity_button = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ cfg_input g_cfg_input;
|
|||
|
||||
extern void pad_state_notify_state_change(usz index, u32 state);
|
||||
|
||||
PadHandlerBase::PadHandlerBase(pad_handler type) : m_type(type)
|
||||
PadHandlerBase::PadHandlerBase(pad_handler type, bool emulation) : m_type(type), m_emulation(emulation)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -747,7 +747,11 @@ void PadHandlerBase::process()
|
|||
input_log.success("%s device %d connected", m_type, i);
|
||||
|
||||
pad->m_port_status |= CELL_PAD_STATUS_CONNECTED + CELL_PAD_STATUS_ASSIGN_CHANGES;
|
||||
pad_state_notify_state_change(i, CELL_PAD_STATUS_CONNECTED);
|
||||
|
||||
if (m_emulation)
|
||||
{
|
||||
pad_state_notify_state_change(i, CELL_PAD_STATUS_CONNECTED);
|
||||
}
|
||||
|
||||
last_connection_status[i] = true;
|
||||
connected_devices++;
|
||||
|
|
@ -771,7 +775,11 @@ void PadHandlerBase::process()
|
|||
input_log.success("%s device %d connected by force", m_type, i);
|
||||
|
||||
pad->m_port_status |= CELL_PAD_STATUS_CONNECTED + CELL_PAD_STATUS_ASSIGN_CHANGES;
|
||||
pad_state_notify_state_change(i, CELL_PAD_STATUS_CONNECTED);
|
||||
|
||||
if (m_emulation)
|
||||
{
|
||||
pad_state_notify_state_change(i, CELL_PAD_STATUS_CONNECTED);
|
||||
}
|
||||
|
||||
last_connection_status[i] = true;
|
||||
connected_devices++;
|
||||
|
|
@ -786,7 +794,10 @@ void PadHandlerBase::process()
|
|||
pad->m_port_status &= ~CELL_PAD_STATUS_CONNECTED;
|
||||
pad->m_port_status |= CELL_PAD_STATUS_ASSIGN_CHANGES;
|
||||
|
||||
pad_state_notify_state_change(i, CELL_PAD_STATUS_DISCONNECTED);
|
||||
if (m_emulation)
|
||||
{
|
||||
pad_state_notify_state_change(i, CELL_PAD_STATUS_DISCONNECTED);
|
||||
}
|
||||
|
||||
last_connection_status[i] = false;
|
||||
connected_devices--;
|
||||
|
|
|
|||
|
|
@ -248,6 +248,7 @@ public:
|
|||
|
||||
pad_handler m_type;
|
||||
bool m_is_init = false;
|
||||
bool m_emulation = false;
|
||||
|
||||
std::string name_string() const;
|
||||
usz max_devices() const;
|
||||
|
|
@ -265,7 +266,7 @@ public:
|
|||
void convert_stick_values(u16& x_out, u16& y_out, const s32& x_in, const s32& y_in, const s32& deadzone, const s32& padsquircling) const;
|
||||
|
||||
virtual bool Init() { return true; }
|
||||
PadHandlerBase(pad_handler type = pad_handler::null);
|
||||
PadHandlerBase(pad_handler type = pad_handler::null, bool emulation = false);
|
||||
virtual ~PadHandlerBase() = default;
|
||||
// Sets window to config the controller(optional)
|
||||
virtual void SetPadData(const std::string& /*padId*/, u8 /*player_id*/, u8 /*large_motor*/, u8 /*small_motor*/, s32 /*r*/, s32 /*g*/, s32 /*b*/, bool /*player_led*/, bool /*battery_led*/, u32 /*battery_led_brightness*/) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue