mirror of
https://github.com/libretro/Play-.git
synced 2025-02-26 06:25:30 +00:00
94 lines
1.7 KiB
C++
94 lines
1.7 KiB
C++
#ifndef _IOP_SIO2_H_
|
|
#define _IOP_SIO2_H_
|
|
|
|
#include "Types.h"
|
|
#include "Iop_Intc.h"
|
|
#include "../PadListener.h"
|
|
#include <deque>
|
|
|
|
namespace Iop
|
|
{
|
|
class CSio2 : public CPadListener
|
|
{
|
|
public:
|
|
enum
|
|
{
|
|
ADDR_BEGIN = 0x1F808200,
|
|
ADDR_END = 0x1F8082FF
|
|
};
|
|
|
|
CSio2(Iop::CIntc&);
|
|
virtual ~CSio2();
|
|
|
|
void Reset();
|
|
|
|
uint32 ReadRegister(uint32);
|
|
void WriteRegister(uint32, uint32);
|
|
|
|
virtual void SetButtonState(unsigned int, PS2::CControllerInfo::BUTTON, bool, uint8*);
|
|
virtual void SetAxisState(unsigned int, PS2::CControllerInfo::BUTTON, uint8, uint8*);
|
|
|
|
private:
|
|
enum REGISTERS
|
|
{
|
|
REG_BASE = 0x1F808200,
|
|
REG_BASE_END = 0x1F80823F,
|
|
|
|
REG_PORT0_CTRL1 = 0x1F808240,
|
|
REG_PORT0_CTRL2 = 0x1F808244,
|
|
|
|
REG_PORT1_CTRL1 = 0x1F808248,
|
|
REG_PORT1_CTRL2 = 0x1F80824C,
|
|
|
|
REG_PORT2_CTRL1 = 0x1F808250,
|
|
REG_PORT2_CTRL2 = 0x1F808254,
|
|
|
|
REG_PORT3_CTRL1 = 0x1F808258,
|
|
REG_PORT3_CTRL2 = 0x1F80825C,
|
|
|
|
REG_DATA_OUT = 0x1F808260,
|
|
REG_DATA_IN = 0x1F808264,
|
|
|
|
REG_CTRL = 0x1F808268,
|
|
REG_STAT6C = 0x1F80826C,
|
|
};
|
|
|
|
enum
|
|
{
|
|
MAX_REGS = 16
|
|
};
|
|
|
|
enum
|
|
{
|
|
MAX_PADS = 2
|
|
};
|
|
|
|
struct PADSTATE
|
|
{
|
|
bool configMode;
|
|
uint8 mode;
|
|
uint8 pollMask[3];
|
|
uint16 buttonState;
|
|
uint8 analogStickState[4];
|
|
};
|
|
|
|
typedef std::deque<uint8> ByteBufferType;
|
|
|
|
void ProcessCommand();
|
|
|
|
void DisassembleRead(uint32, uint32);
|
|
void DisassembleWrite(uint32, uint32);
|
|
|
|
Iop::CIntc& m_intc;
|
|
|
|
unsigned int m_currentRegIndex;
|
|
uint32 m_regs[MAX_REGS];
|
|
ByteBufferType m_inputBuffer;
|
|
ByteBufferType m_outputBuffer;
|
|
|
|
PADSTATE m_padState[MAX_PADS];
|
|
};
|
|
}
|
|
|
|
#endif
|