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.
This commit is contained in:
John Chadwick 2020-11-07 12:31:18 -08:00 committed by Screwtapello
parent 083406f404
commit c15877a7b7
1 changed files with 3 additions and 3 deletions

View File

@ -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 ...)");