|
6 | 6 |
|
7 | 7 | #include "Common/Cpp/Exceptions.h" |
8 | 8 | #include "Common/SerialPABotBase/SerialPABotBase_Protocol_IDs.h" |
| 9 | +#include "CommonFramework/Globals.h" |
| 10 | +#include "CommonFramework/GlobalSettingsPanel.h" |
9 | 11 | #include "SerialPABotBase.h" |
10 | 12 |
|
11 | 13 | namespace PokemonAutomation{ |
@@ -44,6 +46,32 @@ const std::map<uint32_t, std::map<pabb_ProgramID, uint8_t>>& SUPPORTED_VERSIONS( |
44 | 46 | } |
45 | 47 |
|
46 | 48 |
|
| 49 | +bool controller_is_valid(uint32_t id){ |
| 50 | + switch (id){ |
| 51 | + case PABB_CID_NONE: |
| 52 | + case PABB_CID_StandardHid_Keyboard: |
| 53 | + case PABB_CID_NintendoSwitch_WiredController: |
| 54 | + case PABB_CID_NintendoSwitch2_WiredController: |
| 55 | + case PABB_CID_NintendoSwitch_WirelessProController: |
| 56 | + case PABB_CID_NintendoSwitch_WirelessLeftJoycon: |
| 57 | + case PABB_CID_NintendoSwitch_WirelessRightJoycon: |
| 58 | + return true; |
| 59 | + case PABB_CID_NintendoSwitch_WiredProController: |
| 60 | + case PABB_CID_NintendoSwitch_WiredLeftJoycon: |
| 61 | + case PABB_CID_NintendoSwitch_WiredRightJoycon: |
| 62 | + return IS_BETA_VERSION || PreloadSettings::instance().DEVELOPER_MODE; |
| 63 | + case PABB_CID_NintendoSwitch2_WiredProController: |
| 64 | + case PABB_CID_NintendoSwitch2_WiredLeftJoycon: |
| 65 | + case PABB_CID_NintendoSwitch2_WiredRightJoycon: |
| 66 | + case PABB_CID_NintendoSwitch2_WirelessProController: |
| 67 | + case PABB_CID_NintendoSwitch2_WirelessLeftJoycon: |
| 68 | + case PABB_CID_NintendoSwitch2_WirelessRightJoycon: |
| 69 | + return PreloadSettings::instance().DEVELOPER_MODE; |
| 70 | + } |
| 71 | + return false; |
| 72 | +} |
| 73 | + |
| 74 | + |
47 | 75 |
|
48 | 76 | ControllerType id_to_controller_type(uint32_t id){ |
49 | 77 | switch (id){ |
@@ -82,15 +110,12 @@ ControllerType id_to_controller_type(uint32_t id){ |
82 | 110 | return ControllerType::NintendoSwitch2_WirelessLeftJoycon; |
83 | 111 | case PABB_CID_NintendoSwitch2_WirelessRightJoycon: |
84 | 112 | return ControllerType::NintendoSwitch2_WirelessRightJoycon; |
85 | | - |
86 | | - default: |
87 | | - return ControllerType::None; |
88 | 113 | } |
89 | 114 |
|
90 | | -// throw InternalProgramError( |
91 | | -// nullptr, PA_CURRENT_FUNCTION, |
92 | | -// "Invalid Controller ID: " + std::to_string(id) |
93 | | -// ); |
| 115 | + throw InternalProgramError( |
| 116 | + nullptr, PA_CURRENT_FUNCTION, |
| 117 | + "Invalid Controller ID: " + std::to_string(id) |
| 118 | + ); |
94 | 119 | } |
95 | 120 | uint32_t controller_type_to_id(ControllerType controller_type){ |
96 | 121 | switch (controller_type){ |
|
0 commit comments