[Sorry, that was my fault ]
I'm currently writing my own PAD plugin (native integration with real DualShock controller using STM32+USB custom class). https://github.com/L-proger/pcsx2/tree/develop/RealPad plugin name is "RealPad". (latest code from below is not yet pushed to github).
Everything works fine, and I can play any games, but now I am implementing the PADfreeze function and have encountered one problem:
I'm testing my PAD plugin with Silent Hill 2 game [SLES_511.56] and i am experiencing the wrong PADstartPoll + PADpoll sequence.
"Current" command is always recording in my plugin for debugging and "freeze" purposes and clears at "PADstartPoll" event so that i can determine at any moment which bytes transmitted since the last PADstartPoll call.
As far as i know, PS2 will not issue any poll sequence longer that 21 bytes. Therefore, i allocated receive/transmit buffers of size == 21 bytes.
And i'm getting "assert" at loading of game (at Konami logo):
Last successful command is:
0x01, 0x43, 0x00, 0x01, 0x00 .... (others are zeroes, total length == 21 byte) (Enter "config" mode command)
And after that i got PADpoll call with parameter: 0x42 (regular polling command). So, as i can see, my plugin did not receive "PADstartPoll" command!
Of course this leads to "assert" in my code. (marked as "<----- Problem here" in code above).
Is this some kind of "normal" behaviour of PS2 or bug in PCSX2?
p.s. I don't really believe that this is the "normal" behavior of PS2, because it can't read peripheral device without selecting a specific device (pin 6 of gamepad connector, "ATT") on SPI bus (DS2 interface).
I'm currently writing my own PAD plugin (native integration with real DualShock controller using STM32+USB custom class). https://github.com/L-proger/pcsx2/tree/develop/RealPad plugin name is "RealPad". (latest code from below is not yet pushed to github).
Everything works fine, and I can play any games, but now I am implementing the PADfreeze function and have encountered one problem:
I'm testing my PAD plugin with Silent Hill 2 game [SLES_511.56] and i am experiencing the wrong PADstartPoll + PADpoll sequence.
"Current" command is always recording in my plugin for debugging and "freeze" purposes and clears at "PADstartPoll" event so that i can determine at any moment which bytes transmitted since the last PADstartPoll call.
As far as i know, PS2 will not issue any poll sequence longer that 21 bytes. Therefore, i allocated receive/transmit buffers of size == 21 bytes.
Code:
uint8_t UsbGamepad::beginPoll() {
_state.finalizeCurrentCommand(); //Set "length" field of Command = 0
auto result = transfer({ UsbRequestType::PollBegin, 0x01 }).data;
_state.currentCommand.append(0x01, result); //Record byte transfer to current command
return result;
}
uint8_t UsbGamepad::poll(uint8_t data) {
auto result = transfer({ UsbRequestType::Poll, data }).data;
_state.currentCommand.append(data, result); //Record byte transfer to current command
return result;
}
And i'm getting "assert" at loading of game (at Konami logo):
Code:
class Command {
public:
static constexpr std::uint8_t MaxCommandLength = 21;
std::uint8_t length = 0;
std::uint8_t txBuffer[MaxCommandLength] = {};
std::uint8_t rxBuffer[MaxCommandLength] = {};
void append(uint8_t txValue, uint8_t rxValue) {
assert(length < MaxCommandLength); // <----- Problem here
txBuffer[length] = txValue;
rxBuffer[length] = rxValue;
length++;
}
...
};
Last successful command is:
0x01, 0x43, 0x00, 0x01, 0x00 .... (others are zeroes, total length == 21 byte) (Enter "config" mode command)
And after that i got PADpoll call with parameter: 0x42 (regular polling command). So, as i can see, my plugin did not receive "PADstartPoll" command!
Of course this leads to "assert" in my code. (marked as "<----- Problem here" in code above).
Is this some kind of "normal" behaviour of PS2 or bug in PCSX2?
p.s. I don't really believe that this is the "normal" behavior of PS2, because it can't read peripheral device without selecting a specific device (pin 6 of gamepad connector, "ATT") on SPI bus (DS2 interface).