Skip to content

Commit 5b07449

Browse files
committed
Fix crash in keyboard controls. Clear nugget farmer for SBB.
1 parent 7678c56 commit 5b07449

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

SerialPrograms/Source/Controllers/KeyboardInput/GlobalQtKeyMap.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
#include <QKeyEvent>
8-
#include "Common/Cpp/Exceptions.h"
98
#include "Common/Cpp/Concurrency/SpinLock.h"
109
#include "GlobalQtKeyMap.h"
1110

@@ -23,16 +22,13 @@ void QtKeyMap::record(const QKeyEvent& event){
2322
m_map[native_key].insert(qkey);
2423
}
2524

26-
const std::set<Qt::Key>& QtKeyMap::get_QtKeys(uint32_t native_key) const{
25+
const std::set<Qt::Key>* QtKeyMap::get_QtKeys(uint32_t native_key) const{
2726
ReadSpinLock lg(m_lock);
2827
auto iter = m_map.find(native_key);
2928
if (iter == m_map.end()){
30-
throw InternalProgramError(
31-
nullptr, PA_CURRENT_FUNCTION,
32-
"Attempted to look up unrecognized native keyboard key: " + std::to_string(native_key)
33-
);
29+
return nullptr;
3430
}
35-
return iter->second;
31+
return &iter->second;
3632
}
3733

3834

SerialPrograms/Source/Controllers/KeyboardInput/GlobalQtKeyMap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class QtKeyMap{
2626

2727
void record(const QKeyEvent& event);
2828

29-
const std::set<Qt::Key>& get_QtKeys(uint32_t native_key) const;
29+
const std::set<Qt::Key>* get_QtKeys(uint32_t native_key) const;
3030

3131

3232
private:

SerialPrograms/Source/NintendoSwitch/Controllers/NintendoSwitch_ProController.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ class ProController::KeyboardManager : public KeyboardInputController{
5353
ControllerDeltas deltas;
5454
const QtKeyMap& qkey_map = QtKeyMap::instance();
5555
for (uint32_t native_key : pressed_keys){
56-
const std::set<Qt::Key>& qkeys = qkey_map.get_QtKeys(native_key);
57-
for (Qt::Key qkey : qkeys){
56+
const std::set<Qt::Key>* qkeys = qkey_map.get_QtKeys(native_key);
57+
if (qkeys == nullptr){
58+
continue;
59+
}
60+
for (Qt::Key qkey : *qkeys){
5861
auto iter = m_mapping.find(qkey);
5962
if (iter != m_mapping.end()){
6063
deltas += iter->second;

SerialPrograms/Source/PokemonLA/Programs/Farming/PokemonLA_NuggetFarmerHighlands.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
#include "PokemonLA/Programs/PokemonLA_RegionNavigation.h"
2323
#include "PokemonLA_NuggetFarmerHighlands.h"
2424

25-
#include <iostream>
26-
using std::cout;
27-
using std::endl;
25+
//#include <iostream>
26+
//using std::cout;
27+
//using std::endl;
2828

2929
namespace PokemonAutomation{
3030
namespace NintendoSwitch{
@@ -40,7 +40,8 @@ NuggetFarmerHighlands_Descriptor::NuggetFarmerHighlands_Descriptor()
4040
"Farm nuggets off the Miss Fortune sisters in the Coronet Highlands.",
4141
FeedbackType::VIDEO_AUDIO,
4242
AllowCommandsWhenRunning::DISABLE_COMMANDS,
43-
{SerialPABotBase::OLD_NINTENDO_SWITCH_DEFAULT_REQUIREMENTS}
43+
{ControllerFeature::NintendoSwitch_ProController},
44+
FasterIfTickPrecise::NOT_FASTER
4445
)
4546
{}
4647
class NuggetFarmerHighlands_Descriptor::Stats : public StatsTracker, public ShinyStatIncrementer{

0 commit comments

Comments
 (0)