Skip to content

Commit fed80dc

Browse files
authored
Merge pull request #671 from PokemonAutomation/main
Pull fixes.
2 parents 1282a65 + 804625a commit fed80dc

27 files changed

+707
-88
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* Nintendo Switch 2 - Wired Controller State
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
#include <string.h>
8+
#include "NintendoSwitch2_WiredController_State.h"
9+
10+
11+
const pa_NintendoSwitch2_WiredController_State pa_NintendoSwitch2_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 pa_NintendoSwitch2_WiredController_State_equals(
22+
const pa_NintendoSwitch2_WiredController_State* state0,
23+
const pa_NintendoSwitch2_WiredController_State* state1
24+
){
25+
return memcmp(state0, state1, sizeof(pa_NintendoSwitch2_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 2 - Wired Controller State
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
#ifndef PokemonAutomation_NintendoSwitch2_WiredController_State_H
8+
#define PokemonAutomation_NintendoSwitch2_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+
} pa_NintendoSwitch2_WiredController_State;
28+
29+
extern const pa_NintendoSwitch2_WiredController_State pa_NintendoSwitch2_WiredController_State_NEUTRAL_STATE;
30+
31+
bool pa_NintendoSwitch2_WiredController_State_equals(
32+
const pa_NintendoSwitch2_WiredController_State* state0,
33+
const pa_NintendoSwitch2_WiredController_State* state1
34+
);
35+
36+
37+
38+
#ifdef __cplusplus
39+
}
40+
#endif
41+
#endif
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* Nintendo Switch - Wireless Controller State
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
8+
#include <string.h>
9+
#include "NintendoSwitch_WirelessController_State.h"
10+
11+
12+
const pa_NintendoSwitch_WirelessController_State0x30 pa_NintendoSwitch_WirelessController_State0x30_NEUTRAL_STATE = {
13+
.buttons = {
14+
.button3 = 0,
15+
.button4 = 0,
16+
.button5 = 0,
17+
.left_joystick = {0x00, 0x08, 0x80},
18+
.right_joystick = {0x00, 0x08, 0x80},
19+
.vibrator = 0x80,
20+
},
21+
.gyro = {},
22+
};
23+
24+
bool pa_NintendoSwitch_WirelessController_State0x30_equals(
25+
const pa_NintendoSwitch_WirelessController_State0x30* state0,
26+
const pa_NintendoSwitch_WirelessController_State0x30* state1
27+
){
28+
return memcmp(state0, state1, sizeof(pa_NintendoSwitch_WirelessController_State0x30)) == 0;
29+
}
30+
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/* Nintendo Switch - Wireless Controller State
2+
*
3+
* From: https://github.com/PokemonAutomation/
4+
*
5+
*/
6+
7+
#ifndef PokemonAutomation_NintendoSwitch_WirelessController_State_H
8+
#define PokemonAutomation_NintendoSwitch_WirelessController_State_H
9+
10+
#include <stdbool.h>
11+
#include <stdint.h>
12+
13+
#ifdef __cplusplus
14+
extern "C" {
15+
#endif
16+
17+
18+
19+
20+
typedef struct{
21+
uint8_t button3;
22+
uint8_t button4;
23+
uint8_t button5;
24+
uint8_t left_joystick[3];
25+
uint8_t right_joystick[3];
26+
uint8_t vibrator;
27+
} pa_NintendoSwitch_WirelessController_State0x30_Buttons;
28+
29+
typedef struct{
30+
int16_t accel_x;
31+
int16_t accel_y;
32+
int16_t accel_z;
33+
int16_t rotation_x;
34+
int16_t rotation_y;
35+
int16_t rotation_z;
36+
} pa_NintendoSwitch_WirelessController_State0x30_Gyro;
37+
38+
typedef struct{
39+
pa_NintendoSwitch_WirelessController_State0x30_Gyro time0;
40+
pa_NintendoSwitch_WirelessController_State0x30_Gyro time1;
41+
pa_NintendoSwitch_WirelessController_State0x30_Gyro time2;
42+
} pa_NintendoSwitch_WirelessController_State0x30_GyroX3;
43+
44+
typedef struct{
45+
pa_NintendoSwitch_WirelessController_State0x30_Buttons buttons;
46+
pa_NintendoSwitch_WirelessController_State0x30_GyroX3 gyro;
47+
} pa_NintendoSwitch_WirelessController_State0x30;
48+
49+
50+
51+
52+
extern const pa_NintendoSwitch_WirelessController_State0x30 pa_NintendoSwitch_WirelessController_State0x30_NEUTRAL_STATE;
53+
54+
bool pa_NintendoSwitch_WirelessController_State0x30_equals(
55+
const pa_NintendoSwitch_WirelessController_State0x30* state0,
56+
const pa_NintendoSwitch_WirelessController_State0x30* state1
57+
);
58+
59+
60+
61+
#ifdef __cplusplus
62+
}
63+
#endif
64+
#endif

Common/Cpp/Concurrency/ComputationThreadPoolCore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#define PokemonAutomation_ComputationThreadPoolCore_H
1818

1919
#include <functional>
20-
#include <list>
20+
//#include <list>
2121
#include <deque>
2222
#include <thread>
2323
#include "Common/Cpp/CpuUtilization/CpuUtilization.h"

Common/SerialPABotBase/SerialPABotBase_Messages_ESP32.h

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef PokemonAutomation_SerialPABotBase_Messages_ESP32_H
88
#define PokemonAutomation_SerialPABotBase_Messages_ESP32_H
99

10+
#include "../Controllers/NintendoSwitch_WirelessController_State.h"
1011
#include "SerialPABotBase_Protocol.h"
1112

1213
#if _WIN32
@@ -32,30 +33,6 @@ typedef struct{
3233
uint8_t right_grip[3];
3334
} PABB_NintendoSwitch_ControllerColors;
3435

35-
typedef struct{
36-
uint8_t button3;
37-
uint8_t button4;
38-
uint8_t button5;
39-
uint8_t left_joystick[3];
40-
uint8_t right_joystick[3];
41-
uint8_t vibrator;
42-
} PABB_NintendoSwitch_ButtonState;
43-
44-
typedef struct{
45-
int16_t accel_x;
46-
int16_t accel_y;
47-
int16_t accel_z;
48-
int16_t rotation_x;
49-
int16_t rotation_y;
50-
int16_t rotation_z;
51-
} PABB_NintendoSwitch_GyroState;
52-
53-
typedef struct{
54-
PABB_NintendoSwitch_GyroState time0;
55-
PABB_NintendoSwitch_GyroState time1;
56-
PABB_NintendoSwitch_GyroState time2;
57-
} PABB_NintendoSwitch_GyroStateX3;
58-
5936

6037

6138

@@ -82,16 +59,15 @@ typedef struct{
8259
typedef struct{
8360
seqnum_t seqnum;
8461
uint16_t milliseconds;
85-
PABB_NintendoSwitch_ButtonState buttons;
62+
pa_NintendoSwitch_WirelessController_State0x30_Buttons buttons;
8663
} PABB_PACK pabb_Message_ESP32_CommandButtonState;
8764

8865

8966
#define PABB_MSG_ESP32_CONTROLLER_STATE_FULL 0xa1
9067
typedef struct{
9168
seqnum_t seqnum;
9269
uint16_t milliseconds;
93-
PABB_NintendoSwitch_ButtonState buttons;
94-
PABB_NintendoSwitch_GyroStateX3 gyro;
70+
pa_NintendoSwitch_WirelessController_State0x30 state;
9571
} PABB_PACK pabb_Message_ESP32_CommandFullState;
9672

9773

Common/SerialPABotBase/SerialPABotBase_Messages_NS2_WiredController.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef PokemonAutomation_SerialPABotBase_Messages_NS2_WiredController_H
88
#define PokemonAutomation_SerialPABotBase_Messages_NS2_WiredController_H
99

10+
#include "../Controllers/NintendoSwitch2_WiredController_State.h"
1011
#include "SerialPABotBase_Protocol.h"
1112

1213
#if _WIN32
@@ -26,19 +27,10 @@ namespace SerialPABotBase{
2627

2728

2829
#define PABB_MSG_REPORT_NS2_WIRED_CONTROLLER 0x90
29-
typedef struct{
30-
uint8_t buttons0;
31-
uint8_t buttons1;
32-
uint8_t dpad_byte;
33-
uint8_t left_joystick_x;
34-
uint8_t left_joystick_y;
35-
uint8_t right_joystick_x;
36-
uint8_t right_joystick_y;
37-
} pabb_Report_NS2_WiredController;
3830
typedef struct{
3931
seqnum_t seqnum;
4032
uint16_t milliseconds;
41-
pabb_Report_NS2_WiredController report;
33+
pa_NintendoSwitch2_WiredController_State report;
4234
} PABB_PACK pabb_Message_Report_NS2_WiredController;
4335

4436

SerialPrograms/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ file(GLOB MAIN_SOURCES
6262
../Common/CRC32.cpp
6363
../Common/CRC32.h
6464
../Common/Compiler.h
65+
../Common/Controllers/NintendoSwitch2_WiredController_State.h
66+
../Common/Controllers/NintendoSwitch_WirelessController_State.h
6567
../Common/Cpp/AbstractLogger.h
6668
../Common/Cpp/BitmapConversion.cpp
6769
../Common/Cpp/BitmapConversion.h
@@ -903,12 +905,18 @@ file(GLOB MAIN_SOURCES
903905
Source/ML/DataLabeling/ML_SegmentAnythingModelConstants.h
904906
Source/ML/ML_Panels.cpp
905907
Source/ML/ML_Panels.h
908+
Source/ML/Models/ML_ONNXRuntimeHelpers.cpp
909+
Source/ML/Models/ML_ONNXRuntimeHelpers.h
910+
Source/ML/Models/ML_YOLOv5Model.cpp
911+
Source/ML/Models/ML_YOLOv5Model.h
906912
Source/ML/Programs/ML_LabelImages.cpp
907913
Source/ML/Programs/ML_LabelImages.h
908914
Source/ML/Programs/ML_LabelImagesOverlayManager.cpp
909915
Source/ML/Programs/ML_LabelImagesOverlayManager.h
910916
Source/ML/Programs/ML_LabelImagesWidget.cpp
911917
Source/ML/Programs/ML_LabelImagesWidget.h
918+
Source/ML/Programs/ML_RunYOLO.cpp
919+
Source/ML/Programs/ML_RunYOLO.h
912920
Source/ML/UI/ML_ImageAnnotationCommandRow.cpp
913921
Source/ML/UI/ML_ImageAnnotationCommandRow.h
914922
Source/ML/UI/ML_ImageAnnotationDisplayOption.cpp

SerialPrograms/Source/CommonFramework/Globals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace PokemonAutomation{
2626
const bool IS_BETA_VERSION = true;
2727
const int PROGRAM_VERSION_MAJOR = 0;
2828
const int PROGRAM_VERSION_MINOR = 55;
29-
const int PROGRAM_VERSION_PATCH = 2;
29+
const int PROGRAM_VERSION_PATCH = 3;
3030

3131
const std::string PROGRAM_VERSION_BASE =
3232
"v" + std::to_string(PROGRAM_VERSION_MAJOR) +

SerialPrograms/Source/CommonFramework/ImageTypes/ImageViewRGB32.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class ImageViewRGB32 : public ImageViewPlanar32{
5757
QImage to_QImage_owning() const; // Return a copy that owns its own buffer. (slow)
5858
QImage scaled_to_QImage(size_t width, size_t height) const;
5959

60+
// convert to cv::Mat with BGRA color channel order
6061
cv::Mat to_opencv_Mat() const;
6162

6263
private:

0 commit comments

Comments
 (0)