mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 13:47:57 +03:00
Rename CPadListener->CPadInterface
This commit is contained in:
parent
0ea90b563a
commit
3cc0dbb1ab
11 changed files with 74 additions and 73 deletions
|
@ -454,8 +454,8 @@ set(COMMON_SRC_FILES
|
|||
OpticalMedia.h
|
||||
PadHandler.cpp
|
||||
PadHandler.h
|
||||
PadListener.cpp
|
||||
PadListener.h
|
||||
PadInterface.cpp
|
||||
PadInterface.h
|
||||
Pch.cpp
|
||||
Pch.h
|
||||
PH_Generic.cpp
|
||||
|
|
|
@ -19,7 +19,7 @@ CPadHandler::FactoryFunction CPH_Generic::GetFactoryFunction()
|
|||
|
||||
void CPH_Generic::Update(uint8* ram)
|
||||
{
|
||||
for(auto& listener : m_listeners)
|
||||
for(auto& interface : m_interfaces)
|
||||
{
|
||||
for(unsigned int i = 0; i < PS2::CControllerInfo::MAX_BUTTONS; i++)
|
||||
{
|
||||
|
@ -27,11 +27,11 @@ void CPH_Generic::Update(uint8* ram)
|
|||
if(PS2::CControllerInfo::IsAxis(button))
|
||||
{
|
||||
float buttonValue = ((m_axisStates[i] + 1.0f) / 2.0f) * 255.f;
|
||||
listener->SetAxisState(0, button, static_cast<uint8>(buttonValue), ram);
|
||||
interface->SetAxisState(0, button, static_cast<uint8>(buttonValue), ram);
|
||||
}
|
||||
else
|
||||
{
|
||||
listener->SetButtonState(0, button, m_buttonStates[i], ram);
|
||||
interface->SetButtonState(0, button, m_buttonStates[i], ram);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include "PadHandler.h"
|
||||
|
||||
void CPadHandler::InsertListener(CPadListener* pListener)
|
||||
void CPadHandler::InsertListener(CPadInterface* pListener)
|
||||
{
|
||||
m_listeners.push_back(pListener);
|
||||
m_interfaces.push_back(pListener);
|
||||
}
|
||||
|
||||
void CPadHandler::RemoveAllListeners()
|
||||
{
|
||||
m_listeners.clear();
|
||||
m_interfaces.clear();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _PADHANDLER_H_
|
||||
#define _PADHANDLER_H_
|
||||
|
||||
#include "PadListener.h"
|
||||
#include "PadInterface.h"
|
||||
#include <list>
|
||||
#include <functional>
|
||||
|
||||
|
@ -13,12 +13,12 @@ public:
|
|||
CPadHandler() = default;
|
||||
virtual ~CPadHandler() = default;
|
||||
virtual void Update(uint8*) = 0;
|
||||
void InsertListener(CPadListener*);
|
||||
void InsertListener(CPadInterface*);
|
||||
void RemoveAllListeners();
|
||||
|
||||
protected:
|
||||
typedef std::list<CPadListener*> ListenerList;
|
||||
ListenerList m_listeners;
|
||||
typedef std::list<CPadInterface*> ListenerList;
|
||||
ListenerList m_interfaces;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include <assert.h>
|
||||
#include "PadListener.h"
|
||||
#include "PadInterface.h"
|
||||
|
||||
using namespace PS2;
|
||||
|
||||
uint32 CPadListener::GetButtonMask(CControllerInfo::BUTTON button)
|
||||
uint32 CPadInterface::GetButtonMask(CControllerInfo::BUTTON button)
|
||||
{
|
||||
static uint32 buttonMask[CControllerInfo::MAX_BUTTONS] =
|
||||
{
|
|
@ -3,10 +3,10 @@
|
|||
#include "Types.h"
|
||||
#include "ControllerInfo.h"
|
||||
|
||||
class CPadListener
|
||||
class CPadInterface
|
||||
{
|
||||
public:
|
||||
virtual ~CPadListener() = default;
|
||||
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;
|
||||
static uint32 GetButtonMask(PS2::CControllerInfo::BUTTON);
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
void CPH_GenericInput::Update(uint8* ram)
|
||||
{
|
||||
for(auto* listener : m_listeners)
|
||||
std::map<unsigned int, std::pair<uint8, uint8>> vibMap;
|
||||
for(auto* interface : m_interfaces)
|
||||
{
|
||||
for(unsigned int pad = 0; pad < CInputBindingManager::MAX_PADS; pad++)
|
||||
{
|
||||
|
@ -14,11 +15,11 @@ void CPH_GenericInput::Update(uint8* ram)
|
|||
uint32 value = binding->GetValue();
|
||||
if(PS2::CControllerInfo::IsAxis(button))
|
||||
{
|
||||
listener->SetAxisState(pad, button, value & 0xFF, ram);
|
||||
interface->SetAxisState(pad, button, value & 0xFF, ram);
|
||||
}
|
||||
else
|
||||
{
|
||||
listener->SetButtonState(pad, button, value != 0, ram);
|
||||
interface->SetButtonState(pad, button, value != 0, ram);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "Iop_Module.h"
|
||||
#include "Iop_SifMan.h"
|
||||
#include "../SifModuleAdapter.h"
|
||||
#include "../PadListener.h"
|
||||
#include "../PadInterface.h"
|
||||
#include "../GunListener.h"
|
||||
#include "filesystem_def.h"
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace Iop
|
|||
class CAcRam;
|
||||
}
|
||||
|
||||
class CNamcoArcade : public CModule, public CPadListener, public CGunListener
|
||||
class CNamcoArcade : public CModule, public CPadInterface, public CGunListener
|
||||
{
|
||||
public:
|
||||
enum class JVS_MODE
|
||||
|
@ -42,7 +42,7 @@ namespace Iop
|
|||
void SetButton(unsigned int, PS2::CControllerInfo::BUTTON);
|
||||
void SetLightGunXform(const std::array<float, 4>&);
|
||||
|
||||
//CPadListener
|
||||
//CPadInterface
|
||||
void SetButtonState(unsigned int, PS2::CControllerInfo::BUTTON, bool, uint8*) override;
|
||||
void SetAxisState(unsigned int, PS2::CControllerInfo::BUTTON, uint8, uint8*) override;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "Iop_Module.h"
|
||||
#include "Iop_SifMan.h"
|
||||
#include "Iop_SifModuleProvider.h"
|
||||
#include "../PadListener.h"
|
||||
#include "../PadInterface.h"
|
||||
#include <functional>
|
||||
#include "zip/ZipArchiveWriter.h"
|
||||
#include "zip/ZipArchiveReader.h"
|
||||
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace Iop
|
||||
{
|
||||
class CPadMan : public CModule, public CPadListener, public CSifModule, public CSifModuleProvider
|
||||
class CPadMan : public CModule, public CPadInterface, public CSifModule, public CSifModuleProvider
|
||||
{
|
||||
public:
|
||||
CPadMan() = default;
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
#include "Types.h"
|
||||
#include "Iop_Intc.h"
|
||||
#include "../PadListener.h"
|
||||
#include "../PadInterface.h"
|
||||
#include <deque>
|
||||
|
||||
namespace Iop
|
||||
{
|
||||
class CSio2 : public CPadListener
|
||||
class CSio2 : public CPadInterface
|
||||
{
|
||||
public:
|
||||
enum
|
||||
|
|
|
@ -48,19 +48,19 @@ void CPH_Libretro_Input::UpdateInputState()
|
|||
void CPH_Libretro_Input::Update(uint8* ram)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_input_mutex);
|
||||
for(auto* listener : m_listeners)
|
||||
for(auto* interface : m_interfaces)
|
||||
{
|
||||
for(unsigned int i = 0; i < PS2::CControllerInfo::MAX_BUTTONS; i++)
|
||||
{
|
||||
auto currentButtonId = static_cast<PS2::CControllerInfo::BUTTON>(i);
|
||||
if(PS2::CControllerInfo::IsAxis(currentButtonId))
|
||||
{
|
||||
listener->SetAxisState(0, currentButtonId, m_axis_btn_state[currentButtonId], ram);
|
||||
interface->SetAxisState(0, currentButtonId, m_axis_btn_state[currentButtonId], ram);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 val = m_btns_state & (1 << g_ds2_to_retro_btn_map[currentButtonId]);
|
||||
listener->SetButtonState(0, currentButtonId, val != 0, ram);
|
||||
interface->SetButtonState(0, currentButtonId, val != 0, ram);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue