From c15877a7b72b657143fbedc4714bf09f886ea4b7 Mon Sep 17 00:00:00 2001 From: John Chadwick Date: Sat, 7 Nov 2020 12:31:18 -0800 Subject: [PATCH] target-bsnes: Fixes for a couple of input settings bugs. - Fixes a bug where the program may crash or display improper buttons when changing the selected row during assignment. This appears to just be a mistake, accidentally using the 'batched' rows instead of the activeMapping row. - Fixes a bug where starting multiple assignments without finishing one leads to stale "Assigning..." text in some rows. This appears to be an oversight. Simply refreshing the mappings before starting an assignment fixes this. --- bsnes/target-bsnes/settings/input.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 ...)");