mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 13:47:57 +03:00
return Vibration data through CPadInterface
This commit is contained in:
parent
3cc0dbb1ab
commit
85059b988c
6 changed files with 21 additions and 1 deletions
|
@ -9,5 +9,6 @@ public:
|
|||
virtual ~CPadInterface() = default;
|
||||
virtual void SetButtonState(unsigned int, PS2::CControllerInfo::BUTTON, bool, uint8*) = 0;
|
||||
virtual void SetAxisState(unsigned int, PS2::CControllerInfo::BUTTON, uint8, uint8*) = 0;
|
||||
virtual void GetVibration(unsigned int, uint8& largeMotor, uint8& smallMotor) = 0;
|
||||
static uint32 GetButtonMask(PS2::CControllerInfo::BUTTON);
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
void CPH_GenericInput::Update(uint8* ram)
|
||||
{
|
||||
std::map<unsigned int, std::pair<uint8, uint8>> vibMap;
|
||||
std::map<unsigned int, std::pair<uint8, uint8>> vibrationMap;
|
||||
for(auto* interface : m_interfaces)
|
||||
{
|
||||
for(unsigned int pad = 0; pad < CInputBindingManager::MAX_PADS; pad++)
|
||||
|
@ -22,6 +22,9 @@ void CPH_GenericInput::Update(uint8* ram)
|
|||
interface->SetButtonState(pad, button, value != 0, ram);
|
||||
}
|
||||
}
|
||||
// Only Sio2 currently provides vibration information
|
||||
auto& [largeMotor, smallMotor] = vibrationMap[pad];
|
||||
interface->GetVibration(pad, largeMotor, smallMotor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace Iop
|
|||
//CPadInterface
|
||||
void SetButtonState(unsigned int, PS2::CControllerInfo::BUTTON, bool, uint8*) override;
|
||||
void SetAxisState(unsigned int, PS2::CControllerInfo::BUTTON, uint8, uint8*) override;
|
||||
void GetVibration(unsigned int, uint8& largeMotor, uint8& smallMotor) override {};
|
||||
|
||||
//CGunListener
|
||||
void SetGunPosition(float, float) override;
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace Iop
|
|||
void LoadState(Framework::CZipArchiveReader&) override;
|
||||
void SetButtonState(unsigned int, PS2::CControllerInfo::BUTTON, bool, uint8*) override;
|
||||
void SetAxisState(unsigned int, PS2::CControllerInfo::BUTTON, uint8, uint8*) override;
|
||||
void GetVibration(unsigned int padId, uint8& largeMotor, uint8& smallMotor) override {};
|
||||
|
||||
enum MODULE_ID
|
||||
{
|
||||
|
|
|
@ -343,6 +343,10 @@ void CSio2::ProcessController(unsigned int portId, size_t outputOffset, uint32 d
|
|||
//Pad data goes here
|
||||
m_outputBuffer[outputOffset + 0x03] = static_cast<uint8>(padState.buttonState >> 8);
|
||||
m_outputBuffer[outputOffset + 0x04] = static_cast<uint8>(padState.buttonState & 0xFF);
|
||||
|
||||
padState.smallMotor = m_inputBuffer[0x03] & 0x01;
|
||||
padState.largeMotor = m_inputBuffer[0x04];
|
||||
|
||||
if(dstSize >= 9)
|
||||
{
|
||||
//Analog stuff
|
||||
|
@ -661,3 +665,10 @@ void CSio2::DisassembleWrite(uint32 address, uint32 value)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CSio2::GetVibration(unsigned int padId, uint8& largeMotor, uint8& smallMotor)
|
||||
{
|
||||
auto& padState = m_padState[padId];
|
||||
largeMotor = padState.largeMotor;
|
||||
smallMotor = padState.smallMotor;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace Iop
|
|||
|
||||
void SetButtonState(unsigned int, PS2::CControllerInfo::BUTTON, bool, uint8*) override;
|
||||
void SetAxisState(unsigned int, PS2::CControllerInfo::BUTTON, uint8, uint8*) override;
|
||||
void GetVibration(unsigned int padId, uint8& largeMotor, uint8& smallMotor) override;
|
||||
|
||||
private:
|
||||
enum REGISTERS
|
||||
|
@ -72,6 +73,8 @@ namespace Iop
|
|||
uint8 pollMask[3];
|
||||
uint16 buttonState;
|
||||
uint8 analogStickState[4];
|
||||
uint8 smallMotor;
|
||||
uint8 largeMotor;
|
||||
};
|
||||
|
||||
typedef std::deque<uint8> ByteBufferType;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue