Skip to content

Commit b6aa81d

Browse files
committed
Rename BotBase. Move ConsoleHandle into NintendoSwitch namespace.
1 parent 57aa0e2 commit b6aa81d

File tree

98 files changed

+209
-161
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+209
-161
lines changed

ClientSource/Connection/BotBase.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ namespace PokemonAutomation{
1717

1818
void BotBaseContext::wait_for_all_requests() const{
1919
m_lifetime_sanitizer.check_usage();
20-
m_botbase.wait_for_all_requests(this);
20+
m_controller.wait_for_all_requests(this);
2121
}
2222
void BotBaseContext::cancel_now(){
2323
m_lifetime_sanitizer.check_usage();
2424
CancellableScope::cancel(nullptr);
25-
m_botbase.stop_all_commands();
25+
m_controller.stop_all_commands();
2626
}
2727
void BotBaseContext::cancel_lazy(){
2828
m_lifetime_sanitizer.check_usage();
2929
CancellableScope::cancel(nullptr);
30-
m_botbase.next_command_interrupt();
30+
m_controller.next_command_interrupt();
3131
}
3232

3333
bool BotBaseContext::cancel(std::exception_ptr exception) noexcept{
@@ -36,23 +36,23 @@ bool BotBaseContext::cancel(std::exception_ptr exception) noexcept{
3636
return true;
3737
}
3838
try{
39-
m_botbase.stop_all_commands();
39+
m_controller.stop_all_commands();
4040
}catch (...){}
4141
return false;
4242
}
4343

4444
bool BotBaseContext::try_issue_request(const BotBaseRequest& request) const{
4545
m_lifetime_sanitizer.check_usage();
46-
return m_botbase.try_issue_request(request, this);
46+
return m_controller.try_issue_request(request, this);
4747
}
4848
void BotBaseContext::issue_request(const BotBaseRequest& request) const{
4949
m_lifetime_sanitizer.check_usage();
50-
m_botbase.issue_request(request, this);
50+
m_controller.issue_request(request, this);
5151
}
5252

5353
BotBaseMessage BotBaseContext::issue_request_and_wait(const BotBaseRequest& request) const{
5454
m_lifetime_sanitizer.check_usage();
55-
return m_botbase.issue_request_and_wait(request, this);
55+
return m_controller.issue_request_and_wait(request, this);
5656
}
5757

5858

ClientSource/Connection/BotBase.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class BotBaseContext;
1919

2020

2121

22-
class BotBase{
22+
class BotBaseController{
2323
public:
2424
using ContextType = BotBaseContext;
2525

@@ -31,7 +31,7 @@ class BotBase{
3131
};
3232

3333
public:
34-
virtual ~BotBase() = default;
34+
virtual ~BotBaseController() = default;
3535

3636
virtual Logger& logger() = 0;
3737
virtual State state() const = 0;
@@ -84,14 +84,14 @@ class ControllerContext : public CancellableScope{
8484
// A wrapper for BotBase that allows for asynchronous cancelling.
8585
class BotBaseContext final : public ControllerContext{
8686
public:
87-
using ControllerType = BotBase;
87+
using ControllerType = BotBaseController;
8888

8989
public:
90-
BotBaseContext(BotBase& botbase)
91-
: m_botbase(botbase)
90+
BotBaseContext(BotBaseController& botbase)
91+
: m_controller(botbase)
9292
{}
93-
BotBaseContext(CancellableScope& parent, BotBase& botbase)
94-
: m_botbase(botbase)
93+
BotBaseContext(CancellableScope& parent, BotBaseController& botbase)
94+
: m_controller(botbase)
9595
{
9696
attach(parent);
9797
}
@@ -102,8 +102,8 @@ class BotBaseContext final : public ControllerContext{
102102

103103
virtual void wait_for_all_requests() const override;
104104

105-
operator BotBase&() const{ return m_botbase; }
106-
BotBase& controller() const{ return m_botbase; }
105+
operator BotBaseController&() const{ return m_controller; }
106+
BotBaseController& controller() const{ return m_controller; }
107107

108108
// Stop all commands in this context now.
109109
virtual void cancel_now() override;
@@ -127,7 +127,7 @@ class BotBaseContext final : public ControllerContext{
127127

128128

129129
private:
130-
BotBase& m_botbase;
130+
BotBaseController& m_controller;
131131
LifetimeSanitizer m_lifetime_sanitizer;
132132
};
133133

ClientSource/Connection/PABotBase.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
namespace PokemonAutomation{
4141

4242

43-
class PABotBase : public BotBase, private PABotBaseConnection{
43+
class PABotBase : public BotBaseController, private PABotBaseConnection{
4444
// static const size_t MAX_PENDING_REQUESTS = PABB_DEVICE_QUEUE_SIZE;
4545
static const seqnum_t MAX_SEQNUM_GAP = (seqnum_t)-1 >> 2;
4646

@@ -89,9 +89,9 @@ class PABotBase : public BotBase, private PABotBaseConnection{
8989
public:
9090
// For Command Implementations
9191

92-
// using BotBase::try_issue_request;
93-
using BotBase::issue_request;
94-
using BotBase::issue_request_and_wait;
92+
// using BotBaseController::try_issue_request;
93+
using BotBaseController::issue_request;
94+
using BotBaseController::issue_request_and_wait;
9595

9696

9797
private:

Common/Microcontroller/DeviceRoutines.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,29 @@ namespace PokemonAutomation{
1010
namespace Microcontroller{
1111

1212

13-
uint32_t protocol_version(BotBase& botbase){
13+
uint32_t protocol_version(BotBaseController& botbase){
1414
pabb_MsgAckRequestI32 response;
1515
botbase.issue_request_and_wait(
1616
DeviceRequest_protocol_version()
1717
).convert<PABB_MSG_ACK_REQUEST_I32>(botbase.logger(), response);
1818
return response.data;
1919
}
20-
uint32_t program_version(BotBase& botbase){
20+
uint32_t program_version(BotBaseController& botbase){
2121
pabb_MsgAckRequestI32 response;
2222
botbase.issue_request_and_wait(
2323
DeviceRequest_program_version()
2424
).convert<PABB_MSG_ACK_REQUEST_I32>(botbase.logger(), response);
2525
return response.data;
2626
}
27-
uint8_t device_queue_size(BotBase& botbase){
27+
uint8_t device_queue_size(BotBaseController& botbase){
2828
pabb_MsgAckRequestI8 response;
2929
botbase.issue_request_and_wait(
3030
DeviceRequest_queue_size()
3131
).convert<PABB_MSG_ACK_REQUEST_I8>(botbase.logger(), response);
3232
return response.data;
3333

3434
}
35-
uint8_t program_id(BotBase& botbase){
35+
uint8_t program_id(BotBaseController& botbase){
3636
pabb_MsgAckRequestI8 response;
3737
botbase.issue_request_and_wait(
3838
DeviceRequest_program_id()

Common/Microcontroller/DeviceRoutines.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
namespace PokemonAutomation{
1515
namespace Microcontroller{
1616

17-
uint32_t protocol_version(BotBase& botbase);
18-
uint32_t program_version(BotBase& botbase);
19-
uint8_t device_queue_size(BotBase& botbase);
20-
uint8_t program_id(BotBase& botbase);
17+
uint32_t protocol_version(BotBaseController& botbase);
18+
uint32_t program_version(BotBaseController& botbase);
19+
uint8_t device_queue_size(BotBaseController& botbase);
20+
uint8_t program_id(BotBaseController& botbase);
2121

2222

2323
class DeviceRequest_seqnum_reset : public BotBaseRequest{

SerialPrograms/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,7 @@ file(GLOB MAIN_SOURCES
791791
Source/NintendoSwitch/Commands/NintendoSwitch_Messages_Device.h
792792
Source/NintendoSwitch/Commands/NintendoSwitch_Messages_PushButtons.h
793793
Source/NintendoSwitch/Commands/NintendoSwitch_Messages_Superscalar.h
794+
Source/NintendoSwitch/Controllers/NintendoSwitch_Controller.h
794795
Source/NintendoSwitch/DevPrograms/BoxDraw.cpp
795796
Source/NintendoSwitch/DevPrograms/BoxDraw.h
796797
Source/NintendoSwitch/DevPrograms/TestProgramComputer.cpp

SerialPrograms/SerialPrograms.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,6 +1516,7 @@ HEADERS += \
15161516
Source/NintendoSwitch/Commands/NintendoSwitch_Messages_Device.h \
15171517
Source/NintendoSwitch/Commands/NintendoSwitch_Messages_PushButtons.h \
15181518
Source/NintendoSwitch/Commands/NintendoSwitch_Messages_Superscalar.h \
1519+
Source/NintendoSwitch/Controllers/NintendoSwitch_Controller.h \
15191520
Source/NintendoSwitch/DevPrograms/BoxDraw.h \
15201521
Source/NintendoSwitch/DevPrograms/TestProgramComputer.h \
15211522
Source/NintendoSwitch/DevPrograms/TestProgramSwitch.h \

SerialPrograms/Source/CommonFramework/Tools/BotBaseHandle.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ BotBaseHandle::~BotBaseHandle(){
108108
emit on_not_connected("");
109109
}
110110

111-
BotBase* BotBaseHandle::botbase(){
112-
BotBase* ret = m_botbase.get();
111+
BotBaseController* BotBaseHandle::botbase(){
112+
BotBaseController* ret = m_botbase.get();
113113
if (ret == nullptr){
114114
m_logger.log("BotBaseHandle::botbase() called with null botbase...", COLOR_RED);
115115
}

SerialPrograms/Source/CommonFramework/Tools/BotBaseHandle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class BotBaseHandle : public QObject{
5252
public:
5353
// Not thread-safe with stop() or reset(). The returned pointer
5454
// will only be valid until the next call to stop()/reset().
55-
BotBase* botbase();
55+
BotBaseController* botbase();
5656

5757
// Safe to call anywhere anytime. If called asynchronously with
5858
// stop()/reset(), the result may be immediately out-of-date.

SerialPrograms/Source/CommonFramework/Tools/InterruptableCommands.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void AsyncCommandSession<ControllerType>::stop_session_and_rethrow(){
205205

206206

207207

208-
template class AsyncCommandSession<BotBase>;
208+
template class AsyncCommandSession<BotBaseController>;
209209

210210

211211

0 commit comments

Comments
 (0)