From 25085ca6dea737e5349e9017939ec5b0fb6b9c03 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 9 May 2019 19:21:18 +0100 Subject: [PATCH] Fix DoConfig's gamepad button mapping It didn't match the real DoConfig at all --- DoConfig/DoConfig.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DoConfig/DoConfig.cpp b/DoConfig/DoConfig.cpp index effb1fa7..185ca7b6 100644 --- a/DoConfig/DoConfig.cpp +++ b/DoConfig/DoConfig.cpp @@ -107,6 +107,9 @@ void activatejoy(Fl_Widget*, void*){ joystuffcontainer->activate(); } } + +const unsigned int button_lookup[8] = {0, 1, 2, 5, 3, 4, 6, 7}; + void read_Config(){ std::fstream fd; fd.open("Config.dat", std::ios::in | std::ios::binary); @@ -135,7 +138,7 @@ void read_Config(){ for(char i=0;i<8;i++){ const unsigned long button = CharsToLong(config.buttons[i]); if(button<9 && button>0){ - joyRows[i]->value(button); + joyRows[button_lookup[i]]->value(button-1); } } } @@ -148,7 +151,7 @@ void write_Config(Fl_Widget*, void*){ LongToChars(displaychoice->value(), config.display); LongToChars(joychoice->value(), config.useJoy); for(char i =0;i<8;i++){ - LongToChars(joyRows[i]->value(), config.buttons[i]); + LongToChars(joyRows[button_lookup[i]]->value()+1, config.buttons[i]); } std::fstream fd; fd.open("Config.dat", std::ios::out | std::ios::binary);