Skip to content

Instantly share code, notes, and snippets.

@jchv
Created November 7, 2020 20:25
Show Gist options
  • Save jchv/d655f830be8f4a4cd67bdb1e0bd84199 to your computer and use it in GitHub Desktop.
Save jchv/d655f830be8f4a4cd67bdb1e0bd84199 to your computer and use it in GitHub Desktop.
Fix for some bsnes input settings bugs (being tested.)
diff --git a/bsnes/target-bsnes/settings/input.cpp b/bsnes/target-bsnes/settings/input.cpp
index 13b04b7a..fd76ac78 100644
--- a/bsnes/target-bsnes/settings/input.cpp
+++ b/bsnes/target-bsnes/settings/input.cpp
@@ -68,12 +68,11 @@ auto InputSettings::updateControls() -> void {
assignMouse3.setVisible(false);
if(activeMapping) {
- auto& input = activeDevice().mappings[batched.left().offset()];
- if(input.isDigital()) {
+ if(activeMapping->isDigital()) {
assignMouse1.setVisible().setText("Mouse Left");
assignMouse2.setVisible().setText("Mouse Middle");
assignMouse3.setVisible().setText("Mouse Right");
- } else if(input.isAnalog()) {
+ } else if(activeMapping->isAnalog()) {
assignMouse1.setVisible().setText("Mouse X-axis");
assignMouse2.setVisible().setText("Mouse Y-axis");
}
@@ -146,6 +145,7 @@ auto InputSettings::assignMapping(TableViewCell cell) -> void {
inputManager.poll(); //clear any pending events first
for(auto mapping : mappingList.batched()) {
+ refreshMappings(); //clear existing 'assign...' text
activeMapping = activeDevice().mappings[mapping.offset()];
activeBinding = max(0, (int)cell.offset() - 1);
mappingList.item(mapping.offset()).cell(1 + activeBinding).setIcon(Icon::Go::Right).setText("(assign ...)");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment