mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 13:47:57 +03:00
Add ioMode setting in arcadedefs.
Only relevant for Pac Man Battle Royale for now.
This commit is contained in:
parent
a226cafb05
commit
68ee945e5c
6 changed files with 133 additions and 71 deletions
|
@ -78,6 +78,11 @@ std::string CSys147::GetFunctionName(unsigned int functionId) const
|
|||
return "unknown";
|
||||
}
|
||||
|
||||
void CSys147::SetIoMode(IO_MODE ioMode)
|
||||
{
|
||||
m_ioMode = ioMode;
|
||||
}
|
||||
|
||||
void CSys147::SetButton(unsigned int switchIndex, unsigned int padNumber, PS2::CControllerInfo::BUTTON button)
|
||||
{
|
||||
m_switchBindings[{padNumber, button}] = switchIndex;
|
||||
|
@ -90,6 +95,9 @@ void CSys147::SetButtonState(unsigned int padNumber, PS2::CControllerInfo::BUTTO
|
|||
{
|
||||
m_switchStates[binding->second] = pressed ? 0xFF : 0x00;
|
||||
}
|
||||
|
||||
if(m_ioMode == IO_MODE::AI)
|
||||
{
|
||||
if(padNumber != 0) return;
|
||||
|
||||
//Player Switches
|
||||
|
@ -145,6 +153,7 @@ void CSys147::SetButtonState(unsigned int padNumber, PS2::CControllerInfo::BUTTO
|
|||
m_playerSwitchState |= playerSwitchMask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSys147::SetAxisState(unsigned int padNumber, PS2::CControllerInfo::BUTTON button, uint8 axisValue, uint8* ram)
|
||||
{
|
||||
|
@ -467,6 +476,11 @@ bool CSys147::Invoke99(uint32 method, uint32* args, uint32 argsSize, uint32* ret
|
|||
m_pendingReplies.emplace_back(reply);
|
||||
}
|
||||
else if(packet->command == 0x10)
|
||||
{
|
||||
//Some kind of I/O device related response
|
||||
//Animal Kaiser uses this for dispenser
|
||||
//Pac Man Battle Royale uses this for switch state
|
||||
if(m_ioMode == IO_MODE::AI)
|
||||
{
|
||||
{
|
||||
MODULE_99_PACKET reply = {};
|
||||
|
@ -489,6 +503,16 @@ bool CSys147::Invoke99(uint32 method, uint32* args, uint32 argsSize, uint32* ret
|
|||
m_pendingReplies.emplace_back(reply);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MODULE_99_PACKET reply = {};
|
||||
reply.type = 2;
|
||||
reply.command = 0x10;
|
||||
reply.data[0] = packet->data[0];
|
||||
reply.checksum = ComputePacketChecksum(reply);
|
||||
m_pendingReplies.emplace_back(reply);
|
||||
}
|
||||
}
|
||||
reinterpret_cast<uint16*>(ret)[0] = 1;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -13,6 +13,12 @@ namespace Iop
|
|||
class CSys147 : public CModule, public CPadInterface
|
||||
{
|
||||
public:
|
||||
enum class IO_MODE
|
||||
{
|
||||
DEFAULT,
|
||||
AI,
|
||||
};
|
||||
|
||||
CSys147(CSifMan&, const std::string&);
|
||||
virtual ~CSys147() = default;
|
||||
|
||||
|
@ -20,6 +26,7 @@ namespace Iop
|
|||
std::string GetFunctionName(unsigned int) const override;
|
||||
void Invoke(CMIPS&, unsigned int) override;
|
||||
|
||||
void SetIoMode(IO_MODE);
|
||||
void SetButton(unsigned int, unsigned int, PS2::CControllerInfo::BUTTON);
|
||||
|
||||
//CPadInterface
|
||||
|
@ -79,15 +86,18 @@ namespace Iop
|
|||
|
||||
std::string m_gameId;
|
||||
std::map<ButtonSelector, uint8> m_switchBindings;
|
||||
IO_MODE m_ioMode = IO_MODE::DEFAULT;
|
||||
|
||||
std::vector<MODULE_99_PACKET> m_pendingReplies;
|
||||
std::map<uint8, uint8> m_switchStates;
|
||||
|
||||
//AI board state
|
||||
uint16 m_systemSwitchState = ~0U;
|
||||
uint16 m_playerSwitchState = ~0U;
|
||||
|
||||
std::unique_ptr<Framework::CHttpServer> m_ioServer;
|
||||
std::mutex m_barcodeMutex;
|
||||
std::string m_currentBarcode;
|
||||
uint16 m_systemSwitchState = ~0U;
|
||||
uint16 m_playerSwitchState = ~0U;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,13 @@
|
|||
|
||||
struct ARCADE_MACHINE_DEF
|
||||
{
|
||||
enum DRIVER
|
||||
{
|
||||
UNKNOWN,
|
||||
NAMCO_SYSTEM_246,
|
||||
NAMCO_SYSTEM_147,
|
||||
};
|
||||
|
||||
enum class INPUT_MODE
|
||||
{
|
||||
DEFAULT,
|
||||
|
@ -17,11 +24,10 @@ struct ARCADE_MACHINE_DEF
|
|||
TOUCH,
|
||||
};
|
||||
|
||||
enum DRIVER
|
||||
enum class IO_MODE
|
||||
{
|
||||
UNKNOWN,
|
||||
NAMCO_SYSTEM_246,
|
||||
NAMCO_SYSTEM_147,
|
||||
DEFAULT,
|
||||
SYS147_AI,
|
||||
};
|
||||
|
||||
struct PATCH
|
||||
|
@ -43,6 +49,7 @@ struct ARCADE_MACHINE_DEF
|
|||
std::map<std::string, uint32> nandMounts;
|
||||
std::map<unsigned int, ButtonSelector> buttons;
|
||||
INPUT_MODE inputMode = INPUT_MODE::DEFAULT;
|
||||
IO_MODE ioMode = IO_MODE::DEFAULT;
|
||||
std::array<float, 4> screenPosXform = {65535, 0, 65535, 0};
|
||||
uint32 eeFreqScaleNumerator = 1;
|
||||
uint32 eeFreqScaleDenominator = 1;
|
||||
|
|
|
@ -48,6 +48,12 @@ static const std::pair<const char*, ARCADE_MACHINE_DEF::INPUT_MODE> g_inputModeV
|
|||
{ "drive", ARCADE_MACHINE_DEF::INPUT_MODE::DRIVE },
|
||||
{ "touch", ARCADE_MACHINE_DEF::INPUT_MODE::TOUCH },
|
||||
};
|
||||
|
||||
static const std::pair<const char*, ARCADE_MACHINE_DEF::IO_MODE> g_ioModeValues[] =
|
||||
{
|
||||
{ "default", ARCADE_MACHINE_DEF::IO_MODE::DEFAULT },
|
||||
{ "sys147_ai", ARCADE_MACHINE_DEF::IO_MODE::SYS147_AI },
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
template <typename ValueType>
|
||||
|
@ -183,6 +189,11 @@ ARCADE_MACHINE_DEF ReadArcadeMachineDefinition(const fs::path& arcadeDefPath)
|
|||
std::string inputModeString = defJson["inputMode"];
|
||||
def.inputMode = ParseEnumValue(inputModeString.c_str(), std::begin(g_inputModeValues), std::end(g_inputModeValues));
|
||||
}
|
||||
if(defJson.contains("ioMode"))
|
||||
{
|
||||
std::string ioModeString = defJson["ioMode"];
|
||||
def.ioMode = ParseEnumValue(ioModeString.c_str(), std::begin(g_ioModeValues), std::end(g_ioModeValues));
|
||||
}
|
||||
if(defJson.contains("screenPosXform"))
|
||||
{
|
||||
auto screenPosXformArray = defJson["screenPosXform"];
|
||||
|
|
|
@ -27,6 +27,15 @@ void CNamcoSys147Driver::PrepareEnvironment(CPS2VM* virtualMachine, const ARCADE
|
|||
|
||||
{
|
||||
auto sys147Module = std::make_shared<Iop::Namco::CSys147>(*iopBios->GetSifman(), def.id);
|
||||
switch(def.ioMode)
|
||||
{
|
||||
case ARCADE_MACHINE_DEF::IO_MODE::SYS147_AI:
|
||||
sys147Module->SetIoMode(Iop::Namco::CSys147::IO_MODE::AI);
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
iopBios->RegisterModule(sys147Module);
|
||||
iopBios->RegisterHleModuleReplacement("S147LINK", sys147Module);
|
||||
virtualMachine->m_pad->InsertListener(sys147Module.get());
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"atfile1": 131072
|
||||
}
|
||||
},
|
||||
"ioMode": "sys147_ai",
|
||||
"boot": "atfile0:pacmanBR.elf",
|
||||
"patches":
|
||||
[
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue