mirror of
https://github.com/libretro/Play-.git
synced 2025-02-13 04:52:32 +00:00
Plugged SIO2 emulation module in the IOP subsystem.
We now allow PADMAD and DBCMAN modules coming from games to be emulated and receive SIF packets. Added a special case for the SetModeAndLock command in SIO2. Removed DBCMAN module emulation. git-svn-id: http://svn.purei.org/purei/trunk@1005 b36208d7-6611-0410-8bec-b1987f11c4a2
This commit is contained in:
parent
5bec64c569
commit
4233c33cfe
@ -576,7 +576,6 @@ void CPS2VM::SaveVMState(const char* sPath, unsigned int& result)
|
||||
m_intc.SaveState(archive);
|
||||
m_sif.SaveState(archive);
|
||||
m_vif.SaveState(archive);
|
||||
m_iopOs->GetDbcman()->SaveState(archive);
|
||||
m_iopOs->GetPadman()->SaveState(archive);
|
||||
//TODO: Save CDVDFSV state
|
||||
|
||||
@ -625,7 +624,6 @@ void CPS2VM::LoadVMState(const char* sPath, unsigned int& result)
|
||||
m_intc.LoadState(archive);
|
||||
m_sif.LoadState(archive);
|
||||
m_vif.LoadState(archive);
|
||||
m_iopOs->GetDbcman()->LoadState(archive);
|
||||
m_iopOs->GetPadman()->LoadState(archive);
|
||||
}
|
||||
catch(...)
|
||||
@ -809,11 +807,11 @@ void CPS2VM::LoadBIOS()
|
||||
|
||||
void CPS2VM::RegisterModulesInPadHandler()
|
||||
{
|
||||
if(m_pad == NULL) return;
|
||||
if(m_pad == NULL) return;
|
||||
|
||||
m_pad->RemoveAllListeners();
|
||||
m_pad->InsertListener(m_iopOs->GetDbcman());
|
||||
m_pad->InsertListener(m_iopOs->GetPadman());
|
||||
m_pad->RemoveAllListeners();
|
||||
m_pad->InsertListener(m_iopOs->GetPadman());
|
||||
m_pad->InsertListener(&m_iop.m_sio2);
|
||||
}
|
||||
|
||||
void CPS2VM::FillFakeIopRam()
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "../StructCollectionStateFile.h"
|
||||
|
||||
#ifdef _IOP_EMULATE_MODULES
|
||||
#include "Iop_DbcMan320.h"
|
||||
#include "Iop_Cdvdfsv.h"
|
||||
#include "Iop_McServ.h"
|
||||
#include "Iop_FileIo.h"
|
||||
@ -76,8 +75,8 @@ CIopBios::CIopBios(CMIPS& cpu, uint8* ram, uint32 ramSize)
|
||||
, m_ioman(NULL)
|
||||
, m_modload(NULL)
|
||||
#ifdef _IOP_EMULATE_MODULES
|
||||
, m_dbcman(NULL)
|
||||
, m_padman(NULL)
|
||||
, m_cdvdfsv(NULL)
|
||||
#endif
|
||||
, m_rescheduleNeeded(false)
|
||||
, m_threadFinishAddress(0)
|
||||
@ -200,13 +199,6 @@ void CIopBios::Reset(Iop::CSifMan* sifMan)
|
||||
{
|
||||
RegisterModule(new Iop::CMcServ(*m_sifMan));
|
||||
}
|
||||
{
|
||||
m_dbcman = new Iop::CDbcMan(*m_sifMan);
|
||||
RegisterModule(m_dbcman);
|
||||
}
|
||||
{
|
||||
RegisterModule(new Iop::CDbcMan320(*m_sifMan, *m_dbcman));
|
||||
}
|
||||
{
|
||||
m_padman = new Iop::CPadMan(*m_sifMan);
|
||||
RegisterModule(m_padman);
|
||||
@ -1399,11 +1391,6 @@ Iop::CCdvdman* CIopBios::GetCdvdman()
|
||||
|
||||
#ifdef _IOP_EMULATE_MODULES
|
||||
|
||||
Iop::CDbcMan* CIopBios::GetDbcman()
|
||||
{
|
||||
return m_dbcman;
|
||||
}
|
||||
|
||||
Iop::CPadMan* CIopBios::GetPadman()
|
||||
{
|
||||
return m_padman;
|
||||
@ -1787,7 +1774,6 @@ void CIopBios::DeleteModules()
|
||||
m_modload = NULL;
|
||||
m_sysmem = NULL;
|
||||
#ifdef _IOP_EMULATE_MODULES
|
||||
m_dbcman = NULL;
|
||||
m_padman = NULL;
|
||||
m_cdvdfsv = NULL;
|
||||
#endif
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Iop_Modload.h"
|
||||
#include "Iop_Dynamic.h"
|
||||
#ifdef _IOP_EMULATE_MODULES
|
||||
#include "Iop_DbcMan.h"
|
||||
#include "Iop_PadMan.h"
|
||||
#include "Iop_Cdvdfsv.h"
|
||||
#endif
|
||||
@ -122,7 +121,6 @@ public:
|
||||
Iop::CIoman* GetIoman();
|
||||
Iop::CCdvdman* GetCdvdman();
|
||||
#ifdef _IOP_EMULATE_MODULES
|
||||
Iop::CDbcMan* GetDbcman();
|
||||
Iop::CPadMan* GetPadman();
|
||||
Iop::CCdvdfsv* GetCdvdfsv();
|
||||
#endif
|
||||
@ -347,7 +345,6 @@ private:
|
||||
Iop::CSysmem* m_sysmem;
|
||||
Iop::CModload* m_modload;
|
||||
#ifdef _IOP_EMULATE_MODULES
|
||||
Iop::CDbcMan* m_dbcman;
|
||||
Iop::CPadMan* m_padman;
|
||||
Iop::CCdvdfsv* m_cdvdfsv;
|
||||
#endif
|
||||
|
@ -1,271 +0,0 @@
|
||||
#include <assert.h>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "IOP_DbcMan.h"
|
||||
#include "../Log.h"
|
||||
#include "../RegisterStateFile.h"
|
||||
|
||||
#define LOG_NAME ("iop_dbcman")
|
||||
|
||||
#define SOCKET_STATE_BASE_PATH ("iop_dbcman/socket_")
|
||||
#define SOCKET_STATE_EXTENSION (".xml")
|
||||
|
||||
using namespace Iop;
|
||||
using namespace std;
|
||||
using namespace Framework;
|
||||
using namespace boost;
|
||||
using namespace PS2;
|
||||
|
||||
CDbcMan::CDbcMan(CSifMan& sif) :
|
||||
m_nextSocketId(0),
|
||||
m_workAddress(0),
|
||||
m_buttonStatIndex(0x1C)
|
||||
{
|
||||
sif.RegisterModule(MODULE_ID, this);
|
||||
}
|
||||
|
||||
CDbcMan::~CDbcMan()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
string CDbcMan::GetId() const
|
||||
{
|
||||
return "dbcman";
|
||||
}
|
||||
|
||||
string CDbcMan::GetFunctionName(unsigned int) const
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
void CDbcMan::Invoke(CMIPS& context, unsigned int functionId)
|
||||
{
|
||||
throw runtime_error("Not implemented.");
|
||||
}
|
||||
|
||||
bool CDbcMan::Invoke(uint32 method, uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, uint8* ram)
|
||||
{
|
||||
switch(method)
|
||||
{
|
||||
case 0x80000901:
|
||||
CreateSocket(args, argsSize, ret, retSize, ram);
|
||||
break;
|
||||
case 0x80000904:
|
||||
SetWorkAddr(args, argsSize, ret, retSize, ram);
|
||||
break;
|
||||
case 0x8000091A:
|
||||
ReceiveData(args, argsSize, ret, retSize, ram);
|
||||
break;
|
||||
case 0x80000963:
|
||||
GetVersionInformation(args, argsSize, ret, retSize, ram);
|
||||
break;
|
||||
default:
|
||||
CLog::GetInstance().Print(LOG_NAME, "Unknown method invoked (0x%0.8X).\r\n", method);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CDbcMan::SaveState(CZipArchiveWriter& archive)
|
||||
{
|
||||
for(SocketMap::const_iterator socketIterator(m_sockets.begin());
|
||||
socketIterator != m_sockets.end(); socketIterator++)
|
||||
{
|
||||
uint32 id = socketIterator->first;
|
||||
const SOCKET& socket = socketIterator->second;
|
||||
string path = SOCKET_STATE_BASE_PATH + lexical_cast<string>(id) + SOCKET_STATE_EXTENSION;
|
||||
CRegisterStateFile* registerFile = new CRegisterStateFile(path.c_str());
|
||||
registerFile->SetRegister32("id", id);
|
||||
registerFile->SetRegister32("port", socket.nPort);
|
||||
registerFile->SetRegister32("slot", socket.nSlot);
|
||||
registerFile->SetRegister32("buffer1", socket.buf1);
|
||||
registerFile->SetRegister32("buffer2", socket.buf2);
|
||||
archive.InsertFile(registerFile);
|
||||
}
|
||||
}
|
||||
|
||||
void CDbcMan::LoadState(CZipArchiveReader& archive)
|
||||
{
|
||||
string regexString = SOCKET_STATE_BASE_PATH + string(".*") + SOCKET_STATE_EXTENSION;
|
||||
CZipArchiveReader::FileNameList fileList = archive.GetFileNameList(regexString.c_str());
|
||||
for(CZipArchiveReader::FileNameList::const_iterator fileIterator(fileList.begin());
|
||||
fileIterator != fileList.end(); fileIterator++)
|
||||
{
|
||||
CRegisterStateFile registerFile(*archive.BeginReadFile(fileIterator->c_str()));
|
||||
SOCKET socket;
|
||||
uint32 id = registerFile.GetRegister32("id");
|
||||
socket.nPort = registerFile.GetRegister32("port");
|
||||
socket.nSlot = registerFile.GetRegister32("slot");
|
||||
socket.buf1 = registerFile.GetRegister32("buffer1");
|
||||
socket.buf2 = registerFile.GetRegister32("buffer2");
|
||||
m_sockets[id] = socket;
|
||||
m_nextSocketId = max(id + 1, m_nextSocketId);
|
||||
}
|
||||
}
|
||||
|
||||
void CDbcMan::SetButtonState(unsigned int nPadNumber, CControllerInfo::BUTTON nButton, bool nPressed, uint8* ram)
|
||||
{
|
||||
uint32 buttonMask = GetButtonMask(nButton);
|
||||
uint32 buttonStatIndex = m_buttonStatIndex;
|
||||
|
||||
for(SocketMap::const_iterator socketIterator(m_sockets.begin());
|
||||
socketIterator != m_sockets.end(); socketIterator++)
|
||||
{
|
||||
const SOCKET& socket = socketIterator->second;
|
||||
if(socket.nPort != nPadNumber) continue;
|
||||
|
||||
uint8* buffer = &ram[socket.buf1];
|
||||
uint16 nStatus = (buffer[buttonStatIndex + 0] << 8) | (buffer[buttonStatIndex + 1]);
|
||||
nStatus &= (~buttonMask);
|
||||
if(!nPressed)
|
||||
{
|
||||
nStatus |= buttonMask;
|
||||
}
|
||||
|
||||
buffer[buttonStatIndex + 0] = static_cast<uint8>(nStatus >> 8);
|
||||
buffer[buttonStatIndex + 1] = static_cast<uint8>(nStatus >> 0);
|
||||
|
||||
// *(uint16*)&CPS2VM::m_pRAM[pSocket->nBuf1 + 0x1C] ^= 0x2010;
|
||||
// *(uint16*)&ram[socket.buf1 + 0x3C] ^= 0xFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
void CDbcMan::SetAxisState(unsigned int padNumber, CControllerInfo::BUTTON axis, uint8 axisValue, uint8* ram)
|
||||
{
|
||||
static const unsigned int s_axisIndex[4] =
|
||||
{
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7
|
||||
};
|
||||
|
||||
uint32 buttonStatIndex = m_buttonStatIndex;
|
||||
for(SocketMap::const_iterator socketIterator(m_sockets.begin());
|
||||
socketIterator != m_sockets.end(); socketIterator++)
|
||||
{
|
||||
const SOCKET& socket = socketIterator->second;
|
||||
if(socket.nPort != padNumber) continue;
|
||||
|
||||
uint8* buffer = &ram[socket.buf1];
|
||||
buffer[buttonStatIndex + s_axisIndex[axis]] = axisValue;
|
||||
}
|
||||
}
|
||||
|
||||
void CDbcMan::CreateSocket(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, uint8* ram)
|
||||
{
|
||||
assert(argsSize >= 0x30);
|
||||
assert(retSize >= 0x04);
|
||||
|
||||
uint32 nType1 = args[0x00];
|
||||
uint32 nType2 = args[0x01];
|
||||
uint32 nPort = args[0x02];
|
||||
uint32 nSlot = args[0x03];
|
||||
uint32 nBuf1 = args[0x0A];
|
||||
uint32 nBuf2 = args[0x0B];
|
||||
|
||||
SOCKET socket;
|
||||
socket.nPort = nPort;
|
||||
socket.nSlot = nSlot;
|
||||
socket.buf1 = nBuf1;
|
||||
socket.buf2 = nBuf2;
|
||||
|
||||
uint32 id = m_nextSocketId++;
|
||||
m_sockets[id] = socket;
|
||||
|
||||
ret[0x09] = id;
|
||||
|
||||
assert(m_workAddress != 0);
|
||||
*(reinterpret_cast<uint32*>(&ram[m_workAddress]) + id) = 1;
|
||||
|
||||
CLog::GetInstance().Print(LOG_NAME, "CreateSocket(type1 = 0x%0.8X, type2 = 0x%0.8X, port = %i, slot = %i, buf1 = 0x%0.8X, buf2 = 0x%0.8X);\r\n", \
|
||||
nType1, \
|
||||
nType2, \
|
||||
nPort, \
|
||||
nSlot, \
|
||||
nBuf1, \
|
||||
nBuf2);
|
||||
}
|
||||
|
||||
void CDbcMan::SetWorkAddr(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, uint8* ram)
|
||||
{
|
||||
assert(argsSize >= 0x90);
|
||||
assert(retSize >= 0x90);
|
||||
|
||||
//0 - Some number (0x0200) (size?)
|
||||
//1 - Address to bind with
|
||||
|
||||
m_workAddress = args[1];
|
||||
|
||||
//Set Ready (?) status
|
||||
*reinterpret_cast<uint32*>(&ram[m_workAddress]) = 1;
|
||||
|
||||
ret[0] = 0x00000000;
|
||||
|
||||
CLog::GetInstance().Print(LOG_NAME, "SetWorkAddr(addr = 0x%0.8X);\r\n", m_workAddress);
|
||||
}
|
||||
|
||||
void CDbcMan::ReceiveData(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, uint8* ram)
|
||||
{
|
||||
//Param Frame
|
||||
//0 - Socket ID
|
||||
//1 - Value passed in parameter to the library
|
||||
//2 - Some parameter (0x01, or some address)
|
||||
|
||||
uint32 nSocket = args[0];
|
||||
uint32 nFlags = args[1];
|
||||
uint32 nParam = args[2];
|
||||
|
||||
SocketMap::iterator socketIterator = m_sockets.find(nSocket);
|
||||
if(socketIterator != m_sockets.end())
|
||||
{
|
||||
SOCKET& socket(socketIterator->second);
|
||||
uint8* buffer = &ram[socket.buf1];
|
||||
|
||||
buffer[0x02] = 0x20;
|
||||
|
||||
*reinterpret_cast<uint32*>(&buffer[0x04]) = 0x01;
|
||||
|
||||
//For Guilty Gear
|
||||
*reinterpret_cast<uint32*>(&buffer[0x7C]) = 0x01;
|
||||
}
|
||||
|
||||
//Return frame
|
||||
//0 - Success Status
|
||||
//1 - ???
|
||||
//2 - Size of returned data
|
||||
//3+ - Data
|
||||
|
||||
ret[0] = 0;
|
||||
ret[2] = 0x1;
|
||||
ret[3] = 0x1;
|
||||
|
||||
CLog::GetInstance().Print(LOG_NAME, "ReceiveData(socket = 0x%0.8X, flags = 0x%0.8X, param = 0x%0.8X);\r\n", nSocket, nFlags, nParam);
|
||||
}
|
||||
|
||||
void CDbcMan::GetVersionInformation(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, uint8* ram)
|
||||
{
|
||||
assert(argsSize == 0x400);
|
||||
assert(retSize == 0x400);
|
||||
|
||||
ret[0] = 0x00000200;
|
||||
|
||||
CLog::GetInstance().Print(LOG_NAME, "GetVersionInformation();\r\n");
|
||||
}
|
||||
|
||||
CDbcMan::SOCKET* CDbcMan::GetSocket(uint32 socketId)
|
||||
{
|
||||
SocketMap::iterator socketIterator = m_sockets.find(socketId);
|
||||
if(socketIterator == m_sockets.end()) return NULL;
|
||||
return &socketIterator->second;
|
||||
}
|
||||
|
||||
uint32 CDbcMan::GetButtonStatIndex() const
|
||||
{
|
||||
return m_buttonStatIndex;
|
||||
}
|
||||
|
||||
void CDbcMan::SetButtonStatIndex(uint32 buttonStatIndex)
|
||||
{
|
||||
m_buttonStatIndex = buttonStatIndex;
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
#ifndef _IOP_DBCMAN_H_
|
||||
#define _IOP_DBCMAN_H_
|
||||
|
||||
#include <map>
|
||||
#include "Iop_Module.h"
|
||||
#include "Iop_SifMan.h"
|
||||
#include "../PadListener.h"
|
||||
#include "zip/ZipArchiveWriter.h"
|
||||
#include "zip/ZipArchiveReader.h"
|
||||
|
||||
namespace Iop
|
||||
{
|
||||
|
||||
class CDbcMan : public CModule, public CPadListener, public CSifModule
|
||||
{
|
||||
public:
|
||||
struct SOCKET
|
||||
{
|
||||
uint32 nPort;
|
||||
uint32 nSlot;
|
||||
uint32 buf1;
|
||||
uint32 buf2;
|
||||
};
|
||||
|
||||
CDbcMan(CSifMan&);
|
||||
virtual ~CDbcMan();
|
||||
std::string GetId() const;
|
||||
std::string GetFunctionName(unsigned int) const;
|
||||
void Invoke(CMIPS&, unsigned int);
|
||||
virtual bool Invoke(uint32, uint32*, uint32, uint32*, uint32, uint8*);
|
||||
virtual void SaveState(Framework::CZipArchiveWriter&);
|
||||
virtual void LoadState(Framework::CZipArchiveReader&);
|
||||
virtual void SetButtonState(unsigned int, PS2::CControllerInfo::BUTTON, bool, uint8*);
|
||||
virtual void SetAxisState(unsigned int, PS2::CControllerInfo::BUTTON, uint8, uint8*);
|
||||
|
||||
void CreateSocket(uint32*, uint32, uint32*, uint32, uint8*);
|
||||
void SetWorkAddr(uint32*, uint32, uint32*, uint32, uint8*);
|
||||
void ReceiveData(uint32*, uint32, uint32*, uint32, uint8*);
|
||||
void GetVersionInformation(uint32*, uint32, uint32*, uint32, uint8*);
|
||||
|
||||
uint32 GetButtonStatIndex() const;
|
||||
void SetButtonStatIndex(uint32);
|
||||
SOCKET* GetSocket(uint32);
|
||||
|
||||
private:
|
||||
enum MODULE_ID
|
||||
{
|
||||
MODULE_ID = 0x80000900
|
||||
};
|
||||
|
||||
typedef std::map<uint32, SOCKET> SocketMap;
|
||||
|
||||
SocketMap m_sockets;
|
||||
uint32 m_nextSocketId;
|
||||
uint32 m_workAddress;
|
||||
uint32 m_buttonStatIndex;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,140 +0,0 @@
|
||||
#include "Iop_DbcMan320.h"
|
||||
#include "../Log.h"
|
||||
|
||||
#define LOG_NAME ("iop_dbcman320")
|
||||
|
||||
using namespace Iop;
|
||||
|
||||
CDbcMan320::CDbcMan320(CSifMan& sif, CDbcMan& dbcMan) :
|
||||
m_dbcMan(dbcMan)
|
||||
{
|
||||
sif.RegisterModule(MODULE_ID, this);
|
||||
}
|
||||
|
||||
CDbcMan320::~CDbcMan320()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string CDbcMan320::GetId() const
|
||||
{
|
||||
return "dbcman320";
|
||||
}
|
||||
|
||||
std::string CDbcMan320::GetFunctionName(unsigned int) const
|
||||
{
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
void CDbcMan320::Invoke(CMIPS& context, unsigned int functionId)
|
||||
{
|
||||
throw std::runtime_error("Not implemented.");
|
||||
}
|
||||
|
||||
bool CDbcMan320::Invoke(uint32 method, uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, uint8* ram)
|
||||
{
|
||||
switch(method)
|
||||
{
|
||||
case 0x80001301:
|
||||
m_dbcMan.CreateSocket(args, argsSize, ret, retSize, ram);
|
||||
break;
|
||||
case 0x80001303:
|
||||
{
|
||||
InitializeSocket(args, argsSize, ret, retSize, ram);
|
||||
CLog::GetInstance().Print(LOG_NAME, "Function0x80001303.\r\n");
|
||||
// m_dbcMan.SetButtonStatIndex(0x2C);
|
||||
ret[0] = 0x1;
|
||||
}
|
||||
break;
|
||||
case 0x80001304:
|
||||
m_dbcMan.SetWorkAddr(args, argsSize, ret, retSize, ram);
|
||||
break;
|
||||
case 0x8000131A:
|
||||
ReceiveData(args, argsSize, ret, retSize, ram);
|
||||
break;
|
||||
case 0x80001363:
|
||||
GetVersionInformation(args, argsSize, ret, retSize, ram);
|
||||
break;
|
||||
default:
|
||||
CLog::GetInstance().Print(LOG_NAME, "Unknown method invoked (0x%0.8X).\r\n", method);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CDbcMan320::SaveState(Framework::CZipArchiveWriter& archive)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CDbcMan320::LoadState(Framework::CZipArchiveReader& archive)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CDbcMan320::ReceiveData(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, uint8* ram)
|
||||
{
|
||||
//Param Frame
|
||||
//0 - Socket ID
|
||||
//1 - Value passed in parameter to the library
|
||||
//2 - Some parameter (0x01, or some address)
|
||||
|
||||
uint32 nSocket = args[0];
|
||||
uint32 nFlags = args[1];
|
||||
uint32 nParam = args[2];
|
||||
|
||||
CDbcMan::SOCKET* socket = m_dbcMan.GetSocket(nSocket);
|
||||
if(socket != NULL)
|
||||
{
|
||||
uint8* buffer = &ram[socket->buf1];
|
||||
|
||||
//For Guilty Gear
|
||||
buffer[0x03] = 0x10;
|
||||
|
||||
//For Valkyrie Profile 2 - Size of the data to copy
|
||||
buffer[0x02] = 0x10;
|
||||
|
||||
*reinterpret_cast<uint32*>(&buffer[0x04]) = 0x01;
|
||||
|
||||
//For Guilty Gear
|
||||
*reinterpret_cast<uint32*>(&buffer[0x7C]) = 0x01;
|
||||
}
|
||||
|
||||
//Return frame
|
||||
//0 - Success Status
|
||||
//1 - ???
|
||||
//2 - Size of returned data
|
||||
//3+ - Data
|
||||
|
||||
ret[0] = 0;
|
||||
ret[2] = 0x1;
|
||||
ret[3] = 0x1;
|
||||
|
||||
CLog::GetInstance().Print(LOG_NAME, "ReceiveData(socket = 0x%0.8X, flags = 0x%0.8X, param = 0x%0.8X);\r\n", nSocket, nFlags, nParam);
|
||||
}
|
||||
|
||||
void CDbcMan320::GetVersionInformation(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, uint8* ram)
|
||||
{
|
||||
assert(argsSize == 0x90);
|
||||
assert(retSize == 0x90);
|
||||
|
||||
ret[0] = 0x00000320;
|
||||
|
||||
CLog::GetInstance().Print(LOG_NAME, "GetVersionInformation();\r\n");
|
||||
}
|
||||
|
||||
void CDbcMan320::InitializeSocket(uint32* args, uint32 argsSize, uint32* ret, uint32 retSize, uint8* ram)
|
||||
{
|
||||
uint32 nSocket = args[0];
|
||||
|
||||
CDbcMan::SOCKET* sock = m_dbcMan.GetSocket(nSocket);
|
||||
if(sock == NULL) return;
|
||||
|
||||
uint32 buttonStatIndex = m_dbcMan.GetButtonStatIndex();
|
||||
|
||||
uint8* buffer = &ram[sock->buf1];
|
||||
buffer[buttonStatIndex + 4] = 0x7F;
|
||||
buffer[buttonStatIndex + 5] = 0x7F;
|
||||
buffer[buttonStatIndex + 6] = 0x7F;
|
||||
buffer[buttonStatIndex + 7] = 0x7F;
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
#ifndef _IOP_DBCMAN320_H_
|
||||
#define _IOP_DBCMAN320_H_
|
||||
|
||||
#include "Iop_Module.h"
|
||||
#include "Iop_DbcMan.h"
|
||||
#include "Iop_SifMan.h"
|
||||
#include "zip/ZipArchiveWriter.h"
|
||||
#include "zip/ZipArchiveReader.h"
|
||||
|
||||
namespace Iop
|
||||
{
|
||||
class CDbcMan320 : public CModule, public CSifModule
|
||||
{
|
||||
public:
|
||||
CDbcMan320(CSifMan&, CDbcMan&);
|
||||
virtual ~CDbcMan320();
|
||||
std::string GetId() const;
|
||||
std::string GetFunctionName(unsigned int) const;
|
||||
void Invoke(CMIPS&, unsigned int);
|
||||
virtual bool Invoke(uint32, uint32*, uint32, uint32*, uint32, uint8*);
|
||||
virtual void SaveState(Framework::CZipArchiveWriter&);
|
||||
virtual void LoadState(Framework::CZipArchiveReader&);
|
||||
|
||||
private:
|
||||
enum MODULE_ID
|
||||
{
|
||||
MODULE_ID = 0x80001300
|
||||
};
|
||||
|
||||
void ReceiveData(uint32*, uint32, uint32*, uint32, uint8*);
|
||||
void GetVersionInformation(uint32*, uint32, uint32*, uint32, uint8*);
|
||||
void InitializeSocket(uint32*, uint32, uint32*, uint32, uint8*);
|
||||
|
||||
CDbcMan& m_dbcMan;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
@ -286,7 +286,21 @@ void CSifCmd::SifRegisterRpc(CMIPS& context)
|
||||
serverDataAddr, serverId, function, buffer, cfunction, cbuffer, queueAddr);
|
||||
|
||||
static const uint32 libSdServerId = 0x80000701;
|
||||
if(serverId == libSdServerId || ((serverId & 0x80000000) == 0))
|
||||
static const uint32 padManServerId0 = 0x80000100;
|
||||
static const uint32 padManServerId1 = 0x80000101;
|
||||
static const uint32 padManServerId2 = 0x8000010F;
|
||||
static const uint32 padManServerId3 = 0x0000011F;
|
||||
static const uint32 dbcManServerId0 = 0x80000900;
|
||||
static const uint32 dbcManServerId1 = 0x80001300;
|
||||
if(
|
||||
(serverId == libSdServerId) ||
|
||||
(serverId == padManServerId0) ||
|
||||
(serverId == padManServerId1) ||
|
||||
(serverId == padManServerId2) ||
|
||||
(serverId == padManServerId3) ||
|
||||
(serverId == dbcManServerId0) ||
|
||||
(serverId == dbcManServerId1) ||
|
||||
((serverId & 0x80000000) == 0))
|
||||
{
|
||||
CSifDynamic* module = new CSifDynamic(*this, serverDataAddr);
|
||||
m_servers.push_back(module);
|
||||
|
@ -237,17 +237,20 @@ void CSio2::ProcessCommand()
|
||||
break;
|
||||
case 0x44: //Set Mode & Lock
|
||||
{
|
||||
assert(dstSize == 9);
|
||||
assert(dstSize == 5 || dstSize == 9);
|
||||
uint8 mode = m_inputBuffer[3];
|
||||
uint8 lock = m_inputBuffer[4];
|
||||
//cmdBuffer[3] == 0x01 ? (u8)ID_ANALOG : (u8)ID_DIGITAL;
|
||||
//cmdBuffer[4] == 0x03 -> Mode Lock
|
||||
m_outputBuffer[outputOffset + 0x03] = 0x00;
|
||||
m_outputBuffer[outputOffset + 0x04] = 0x00;
|
||||
m_outputBuffer[outputOffset + 0x05] = 0x00;
|
||||
m_outputBuffer[outputOffset + 0x06] = 0x00;
|
||||
m_outputBuffer[outputOffset + 0x07] = 0x00;
|
||||
m_outputBuffer[outputOffset + 0x08] = 0x00;
|
||||
if(dstSize == 9)
|
||||
{
|
||||
m_outputBuffer[outputOffset + 0x05] = 0x00;
|
||||
m_outputBuffer[outputOffset + 0x06] = 0x00;
|
||||
m_outputBuffer[outputOffset + 0x07] = 0x00;
|
||||
m_outputBuffer[outputOffset + 0x08] = 0x00;
|
||||
}
|
||||
CLog::GetInstance().Print(LOG_NAME, "Pad %d: SetModeAndLock(mode = %d, lock = %d);\r\n", padId, mode, lock);
|
||||
}
|
||||
break;
|
||||
|
@ -25,6 +25,9 @@ CSubSystem::CSubSystem(bool ps2Mode)
|
||||
, m_spuCore1(m_spuRam, SPU_RAM_SIZE)
|
||||
, m_spu(m_spuCore0)
|
||||
, m_spu2(m_spuCore0, m_spuCore1)
|
||||
#ifdef _IOP_EMULATE_MODULES
|
||||
, m_sio2(m_intc)
|
||||
#endif
|
||||
, m_cpuArch(MIPS_REGSIZE_32)
|
||||
, m_copScu(MIPS_REGSIZE_32)
|
||||
{
|
||||
@ -110,6 +113,9 @@ void CSubSystem::Reset()
|
||||
m_spuCore1.Reset();
|
||||
m_spu.Reset();
|
||||
m_spu2.Reset();
|
||||
#ifdef _IOP_EMULATE_MODULES
|
||||
m_sio2.Reset();
|
||||
#endif
|
||||
m_counters.Reset();
|
||||
m_dmac.Reset();
|
||||
m_intc.Reset();
|
||||
@ -148,6 +154,12 @@ uint32 CSubSystem::ReadIoRegister(uint32 address)
|
||||
{
|
||||
return m_counters.ReadRegister(address);
|
||||
}
|
||||
#ifdef _IOP_EMULATE_MODULES
|
||||
else if(address >= CSio2::ADDR_BEGIN && address <= CSio2::ADDR_END)
|
||||
{
|
||||
return m_sio2.ReadRegister(address);
|
||||
}
|
||||
#endif
|
||||
else if(address >= CSpu2::REGS_BEGIN && address <= CSpu2::REGS_END)
|
||||
{
|
||||
return m_spu2.ReadRegister(address);
|
||||
@ -189,6 +201,12 @@ uint32 CSubSystem::WriteIoRegister(uint32 address, uint32 value)
|
||||
{
|
||||
m_counters.WriteRegister(address, value);
|
||||
}
|
||||
#ifdef _IOP_EMULATE_MODULES
|
||||
else if(address >= CSio2::ADDR_BEGIN && address <= CSio2::ADDR_END)
|
||||
{
|
||||
m_sio2.WriteRegister(address, value);
|
||||
}
|
||||
#endif
|
||||
else if(address >= CSpu2::REGS_BEGIN && address <= CSpu2::REGS_END)
|
||||
{
|
||||
return m_spu2.WriteRegister(address, value);
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "Iop_SpuBase.h"
|
||||
#include "Iop_Spu.h"
|
||||
#include "Iop_Spu2.h"
|
||||
#include "Iop_Sio2.h"
|
||||
#include "Iop_Dmac.h"
|
||||
#include "Iop_Intc.h"
|
||||
#include "Iop_RootCounters.h"
|
||||
@ -47,6 +48,9 @@ namespace Iop
|
||||
CSpuBase m_spuCore1;
|
||||
CSpu m_spu;
|
||||
CSpu2 m_spu2;
|
||||
#ifdef _IOP_EMULATE_MODULES
|
||||
CSio2 m_sio2;
|
||||
#endif
|
||||
CMIPS m_cpu;
|
||||
CMA_MIPSIV m_cpuArch;
|
||||
CCOP_SCU m_copScu;
|
||||
|
@ -193,8 +193,6 @@
|
||||
<ClCompile Include="..\Source\iop\IopBios.cpp" />
|
||||
<ClCompile Include="..\Source\iop\Iop_Cdvdfsv.cpp" />
|
||||
<ClCompile Include="..\Source\iop\Iop_Cdvdman.cpp" />
|
||||
<ClCompile Include="..\Source\iop\Iop_DbcMan.cpp" />
|
||||
<ClCompile Include="..\Source\iop\Iop_DbcMan320.cpp" />
|
||||
<ClCompile Include="..\Source\iop\Iop_Dmac.cpp" />
|
||||
<ClCompile Include="..\Source\iop\Iop_DmacChannel.cpp" />
|
||||
<ClCompile Include="..\Source\iop\Iop_Dynamic.cpp" />
|
||||
@ -376,8 +374,6 @@
|
||||
<ClInclude Include="..\Source\iop\Iop_BiosBase.h" />
|
||||
<ClInclude Include="..\Source\iop\Iop_Cdvdfsv.h" />
|
||||
<ClInclude Include="..\Source\iop\Iop_Cdvdman.h" />
|
||||
<ClInclude Include="..\Source\iop\Iop_DbcMan.h" />
|
||||
<ClInclude Include="..\Source\iop\Iop_DbcMan320.h" />
|
||||
<ClInclude Include="..\Source\iop\Iop_Dmac.h" />
|
||||
<ClInclude Include="..\Source\iop\Iop_DmacChannel.h" />
|
||||
<ClInclude Include="..\Source\iop\Iop_Dynamic.h" />
|
||||
|
@ -163,12 +163,6 @@
|
||||
<ClCompile Include="..\Source\iop\Iop_Cdvdman.cpp">
|
||||
<Filter>Source Files\Core\Iop\Modules</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Source\iop\Iop_DbcMan.cpp">
|
||||
<Filter>Source Files\Core\Iop\Modules</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Source\iop\Iop_DbcMan320.cpp">
|
||||
<Filter>Source Files\Core\Iop\Modules</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Source\iop\Iop_Dynamic.cpp">
|
||||
<Filter>Source Files\Core\Iop\Modules</Filter>
|
||||
</ClCompile>
|
||||
@ -705,18 +699,12 @@
|
||||
<ClInclude Include="..\Source\iop\IopBios.h">
|
||||
<Filter>Source Files\Core\Iop</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Source\iop\Iop_DbcMan320.h">
|
||||
<Filter>Source Files\Core\Iop\Modules</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Source\iop\Iop_Cdvdfsv.h">
|
||||
<Filter>Source Files\Core\Iop\Modules</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Source\iop\Iop_Cdvdman.h">
|
||||
<Filter>Source Files\Core\Iop\Modules</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Source\iop\Iop_DbcMan.h">
|
||||
<Filter>Source Files\Core\Iop\Modules</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Source\iop\Iop_Dynamic.h">
|
||||
<Filter>Source Files\Core\Iop\Modules</Filter>
|
||||
</ClInclude>
|
||||
|
Loading…
x
Reference in New Issue
Block a user