Skip to content

Commit cdd3567

Browse files
committed
rename
1 parent c6be34c commit cdd3567

11 files changed

+136
-136
lines changed

Common/ControllerStates/NintendoSwitch2_WiredController_State.c

Lines changed: 0 additions & 26 deletions
This file was deleted.

Common/ControllerStates/NintendoSwitch2_WiredController_State.h

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* Nintendo Switch - Wired Controller State
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
#include <string.h>
8+
#include "NintendoSwitch_WiredController_State.h"
9+
10+
11+
const pabb_NintendoSwitch_WiredController_State pabb_NintendoSwitch_WiredController_State_NEUTRAL_STATE = {
12+
.buttons0 = 0,
13+
.buttons1 = 0,
14+
.dpad_byte = 8,
15+
.left_joystick_x = 128,
16+
.left_joystick_y = 128,
17+
.right_joystick_x = 128,
18+
.right_joystick_y = 128,
19+
};
20+
21+
bool pabb_NintendoSwitch_WiredController_State_equals(
22+
const pabb_NintendoSwitch_WiredController_State* state0,
23+
const pabb_NintendoSwitch_WiredController_State* state1
24+
){
25+
return memcmp(state0, state1, sizeof(pabb_NintendoSwitch_WiredController_State)) == 0;
26+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* Nintendo Switch - Wired Controller State
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
#ifndef PokemonAutomation_NintendoSwitch_WiredController_State_H
8+
#define PokemonAutomation_NintendoSwitch_WiredController_State_H
9+
10+
#include <stdbool.h>
11+
#include <stdint.h>
12+
13+
#ifdef __cplusplus
14+
extern "C" {
15+
#endif
16+
17+
18+
19+
typedef struct{
20+
uint8_t buttons0;
21+
uint8_t buttons1;
22+
uint8_t dpad_byte;
23+
uint8_t left_joystick_x;
24+
uint8_t left_joystick_y;
25+
uint8_t right_joystick_x;
26+
uint8_t right_joystick_y;
27+
} pabb_NintendoSwitch_WiredController_State;
28+
29+
extern const pabb_NintendoSwitch_WiredController_State pabb_NintendoSwitch_WiredController_State_NEUTRAL_STATE;
30+
31+
bool pabb_NintendoSwitch_WiredController_State_equals(
32+
const pabb_NintendoSwitch_WiredController_State* state0,
33+
const pabb_NintendoSwitch_WiredController_State* state1
34+
);
35+
36+
37+
38+
#ifdef __cplusplus
39+
}
40+
#endif
41+
#endif

Common/SerialPABotBase/SerialPABotBase_Messages_NS2_WiredController.h

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* SerialPABotBase Messages (Nintendo Switch Wired Controller)
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
#ifndef PokemonAutomation_SerialPABotBase_Messages_NS_WiredController_H
8+
#define PokemonAutomation_SerialPABotBase_Messages_NS_WiredController_H
9+
10+
#include "../ControllerStates/NintendoSwitch_WiredController_State.h"
11+
#include "SerialPABotBase_Protocol.h"
12+
13+
#if _WIN32
14+
#pragma pack(push, 1)
15+
#define PABB_PACK
16+
#elif __GNUC__
17+
#define PABB_PACK __attribute__((packed))
18+
#else
19+
#define PABB_PACK
20+
#endif
21+
22+
23+
#ifdef __cplusplus
24+
namespace PokemonAutomation{
25+
namespace SerialPABotBase{
26+
#endif
27+
28+
29+
#define PABB_MSG_COMMAND_NS_WIRED_CONTROLLER_STATE 0x90
30+
typedef struct{
31+
seqnum_t seqnum;
32+
uint16_t milliseconds;
33+
pabb_NintendoSwitch_WiredController_State report;
34+
} PABB_PACK pabb_Message_Command_NS_WiredController_State;
35+
36+
37+
38+
#ifdef __cplusplus
39+
}
40+
}
41+
#endif
42+
43+
44+
#if _WIN32
45+
#pragma pack(pop)
46+
#endif
47+
48+
#endif

SerialPrograms/Source/Controllers/SerialPABotBase/Connection/MessageConverter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "MessageConverter.h"
1717

1818
#include "Controllers/SerialPABotBase/SerialPABotBase_Routines_HID_Keyboard.h"
19-
#include "Controllers/SerialPABotBase/SerialPABotBase_Routines_NS2_WiredController.h"
19+
#include "Controllers/SerialPABotBase/SerialPABotBase_Routines_NS_WiredController.h"
2020
#include "Controllers/SerialPABotBase/SerialPABotBase_Routines_NS1_OemControllers.h"
2121

2222
namespace PokemonAutomation{
@@ -499,7 +499,7 @@ const std::map<uint8_t, MessageConverter>& make_MESSAGE_MAP(){
499499
register_message_converters_framework_other_requests();
500500

501501
SerialPABotBase::register_message_converters_HID_Keyboard();
502-
SerialPABotBase::register_message_converters_NS2_WiredController();
502+
SerialPABotBase::register_message_converters_NS_WiredController();
503503
SerialPABotBase::register_message_converters_NS1_OemControllers();
504504

505505
return converter_map();

SerialPrograms/Source/Controllers/SerialPABotBase/SerialPABotBase_Routines_NS2_WiredController.cpp renamed to SerialPrograms/Source/Controllers/SerialPABotBase/SerialPABotBase_Routines_NS_WiredController.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
/* SerialPABotBase (Nintendo Switch 2 Wired Controller)
1+
/* SerialPABotBase (Nintendo Switch Wired Controller)
22
*
33
* From: https://github.com/PokemonAutomation/
44
*
55
*/
66

77
#include <sstream>
8-
#include "Common/SerialPABotBase/SerialPABotBase_Messages_NS2_WiredController.h"
8+
#include "Common/SerialPABotBase/SerialPABotBase_Messages_NS_WiredController.h"
99
#include "Controllers/SerialPABotBase/Connection/MessageConverter.h"
1010
#include "CommonFramework/GlobalSettingsPanel.h"
1111
//#include "NintendoSwitch/Controllers/NintendoSwitch_ControllerButtons.h"
@@ -15,18 +15,18 @@ namespace SerialPABotBase{
1515

1616

1717

18-
void register_message_converters_NS2_WiredController(){
18+
void register_message_converters_NS_WiredController(){
1919
register_message_converter(
20-
PABB_MSG_COMMAND_NS2_WIRED_CONTROLLER_STATE,
20+
PABB_MSG_COMMAND_NS_WIRED_CONTROLLER_STATE,
2121
[](const std::string& body){
2222
// Disable this by default since it's very spammy.
2323
if (!GlobalSettings::instance().LOG_EVERYTHING){
2424
return std::string();
2525
}
2626
std::ostringstream ss;
27-
ss << "PABB_MSG_COMMAND_NS2_WIRED_CONTROLLER_STATE: ";
28-
if (body.size() != sizeof(pabb_Message_Command_NS2_WiredController_State)){ ss << "(invalid size)" << std::endl; return ss.str(); }
29-
const auto* params = (const pabb_Message_Command_NS2_WiredController_State*)body.c_str();
27+
ss << "PABB_MSG_COMMAND_NS_WIRED_CONTROLLER_STATE: ";
28+
if (body.size() != sizeof(pabb_Message_Command_NS_WiredController_State)){ ss << "(invalid size)" << std::endl; return ss.str(); }
29+
const auto* params = (const pabb_Message_Command_NS_WiredController_State*)body.c_str();
3030
ss << "seqnum = " << (uint64_t)params->seqnum;
3131
ss << ", milliseconds = " << params->milliseconds;
3232

SerialPrograms/Source/Controllers/SerialPABotBase/SerialPABotBase_Routines_NS2_WiredController.h renamed to SerialPrograms/Source/Controllers/SerialPABotBase/SerialPABotBase_Routines_NS_WiredController.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
/* SerialPABotBase (Nintendo Switch 2 Wired Controller)
1+
/* SerialPABotBase (Nintendo Switch Wired Controller)
22
*
33
* From: https://github.com/PokemonAutomation/
44
*
55
*/
66

7-
#ifndef PokemonAutomation_SerialPABotBase_NS2_WiredController_H
8-
#define PokemonAutomation_SerialPABotBase_NS2_WiredController_H
7+
#ifndef PokemonAutomation_SerialPABotBase_NS_WiredController_H
8+
#define PokemonAutomation_SerialPABotBase_NS_WiredController_H
99

10-
#include "Common/SerialPABotBase/SerialPABotBase_Messages_NS2_WiredController.h"
10+
#include "Common/SerialPABotBase/SerialPABotBase_Messages_NS_WiredController.h"
1111
#include "Controllers/SerialPABotBase/Connection/BotBaseMessage.h"
1212

1313
namespace PokemonAutomation{
1414
namespace SerialPABotBase{
1515

1616

17-
void register_message_converters_NS2_WiredController();
17+
void register_message_converters_NS_WiredController();
1818

1919

2020

2121
class DeviceRequest_NS2_WiredController_ControllerStateMs : public BotBaseRequest{
2222
public:
23-
pabb_Message_Command_NS2_WiredController_State params;
23+
pabb_Message_Command_NS_WiredController_State params;
2424
DeviceRequest_NS2_WiredController_ControllerStateMs(
2525
uint16_t milliseconds,
2626
uint16_t buttons,
@@ -46,7 +46,7 @@ class DeviceRequest_NS2_WiredController_ControllerStateMs : public BotBaseReques
4646
params.report.right_joystick_y = right_joystick_y;
4747
}
4848
virtual BotBaseMessage message() const override{
49-
return BotBaseMessage(PABB_MSG_COMMAND_NS2_WIRED_CONTROLLER_STATE, params);
49+
return BotBaseMessage(PABB_MSG_COMMAND_NS_WIRED_CONTROLLER_STATE, params);
5050
}
5151
};
5252

SerialPrograms/Source/NintendoSwitch/Controllers/SerialPABotBase/NintendoSwitch_SerialPABotBase_WiredController.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "CommonFramework/Options/Environment/ThemeSelectorOption.h"
99
#include "Controllers/SerialPABotBase/SerialPABotBase.h"
1010
#include "Controllers/SerialPABotBase/SerialPABotBase_Routines_Protocol.h"
11-
#include "Controllers/SerialPABotBase/SerialPABotBase_Routines_NS2_WiredController.h"
11+
#include "Controllers/SerialPABotBase/SerialPABotBase_Routines_NS_WiredController.h"
1212
#include "NintendoSwitch_SerialPABotBase_WiredController.h"
1313

1414
//#include <iostream>

0 commit comments

Comments
 (0)