Skip to content

Commit 593502c

Browse files
committed
fix
1 parent 69faf8c commit 593502c

4 files changed

Lines changed: 29 additions & 2 deletions

File tree

Common/PABotBase2/PABotBase2CC_MessageDumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ MessageLogger::MessageLogger(){
427427
PABB2_MESSAGE_OPCODE_CQ_REPLACE_ON_NEXT,
428428
false,
429429
[](const MessageHeader* header){
430-
std::string str = "PABB2_MESSAGE_OPCODE_CQ_COMMAND_FINISHED";
430+
std::string str = "PABB2_MESSAGE_OPCODE_CQ_REPLACE_ON_NEXT";
431431
return str;
432432
}
433433
);

SerialPrograms/Source/Controllers/PABotBase2/PABotBase2_DeviceHandle.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ DeviceHandle::~DeviceHandle(){
4444
m_connection.remove_listener(*this);
4545
}
4646

47+
48+
void DeviceHandle::add_message_logger(
49+
uint8_t opcode,
50+
bool always_print,
51+
std::string(*tostr)(const MessageHeader*)
52+
){
53+
m_message_loggers.add_message(opcode, always_print, tostr);
54+
}
55+
4756
bool DeviceHandle::cancel(std::exception_ptr exception) noexcept{
4857
if (CancellableScope::cancel(std::move(exception))){
4958
return true;

SerialPrograms/Source/Controllers/PABotBase2/PABotBase2_DeviceHandle.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ class DeviceHandle final : public CancellableScope, private StreamListener{
3636
);
3737
virtual ~DeviceHandle();
3838

39+
void add_message_logger(
40+
uint8_t opcode,
41+
bool always_print,
42+
std::string(*tostr)(const MessageHeader*)
43+
);
44+
3945
template <typename MessageHandler, class... Args>
4046
void add_message_handler(Args&&... args){
4147
auto ret = m_message_handlers.emplace(

SerialPrograms/Source/NintendoSwitch/Controllers/PABotBase2/NintendoSwitch_PABotBase2_WiredController.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,19 @@ PABotBase2_WiredController::PABotBase2_WiredController(
3333
{
3434
using namespace PABotBase2;
3535

36-
// No extra message handling needed.
36+
// Add controller-specific messages.
37+
connection.device().add_message_logger(
38+
PABB2_MESSAGE_CMD_NS_WIRED_CONTROLLER_STATE,
39+
false,
40+
[](const MessageHeader* header){
41+
const auto* message = (const pabb2_Message_Command_NS_WiredController_State*)header;
42+
std::string str;
43+
str += "PABB2_MESSAGE_CMD_NS_WIRED_CONTROLLER_STATE: id = ";
44+
str += std::to_string(message->id);
45+
str += ", ms = " + std::to_string(message->milliseconds);
46+
return str;
47+
}
48+
);
3749

3850
switch (reset_mode){
3951
case PokemonAutomation::ControllerResetMode::DO_NOT_RESET:

0 commit comments

Comments
 (0)