MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / SendCommandByte

Method SendCommandByte

pcsx2/SIO/Pad/PadPopn.cpp:502–568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

500}
501
502u8 PadPopn::SendCommandByte(u8 commandByte)
503{
504 u8 ret = 0;
505
506 switch (this->commandBytesReceived)
507 {
508 case 0:
509 ret = 0x00;
510 break;
511 case 1:
512 this->currentCommand = static_cast<Pad::Command>(commandByte);
513
514 if (this->currentCommand != Pad::Command::POLL && this->currentCommand != Pad::Command::CONFIG && !this->isInConfig)
515 {
516 Console.Warning("%s(%02X) Config-only command was sent to a pad outside of config mode!", __FUNCTION__, commandByte);
517 }
518
519 ret = this->isInConfig ? static_cast<u8>(Pad::Mode::CONFIG) : static_cast<u8>(this->currentMode);
520 break;
521 case 2:
522 ret = 0x5a;
523 break;
524 default:
525 switch (this->currentCommand)
526 {
527 case Pad::Command::MYSTERY:
528 ret = Mystery(commandByte);
529 break;
530 case Pad::Command::BUTTON_QUERY:
531 ret = ButtonQuery(commandByte);
532 break;
533 case Pad::Command::POLL:
534 ret = Poll(commandByte);
535 break;
536 case Pad::Command::CONFIG:
537 ret = Config(commandByte);
538 break;
539 case Pad::Command::MODE_SWITCH:
540 ret = ModeSwitch(commandByte);
541 break;
542 case Pad::Command::STATUS_INFO:
543 ret = StatusInfo(commandByte);
544 break;
545 case Pad::Command::CONST_1:
546 ret = Constant1(commandByte);
547 break;
548 case Pad::Command::CONST_2:
549 ret = Constant2(commandByte);
550 break;
551 case Pad::Command::CONST_3:
552 ret = Constant3(commandByte);
553 break;
554 case Pad::Command::VIBRATION_MAP:
555 ret = VibrationMap(commandByte);
556 break;
557 case Pad::Command::RESPONSE_BYTES:
558 ret = ResponseBytes(commandByte);
559 break;

Callers 2

PadMethod · 0.45
SetTxDataMethod · 0.45

Calls 2

ResponseBytesEnum · 0.85
WarningMethod · 0.45

Tested by

no test coverage detected