shithub: cstory

Download patch

ref: 25085ca6dea737e5349e9017939ec5b0fb6b9c03
parent: e4b120959c66f6b828541a8fba9d58efc0105862
author: Clownacy <Clownacy@users.noreply.github.com>
date: Thu May 9 15:21:18 EDT 2019

Fix DoConfig's gamepad button mapping

It didn't match the real DoConfig at all

--- a/DoConfig/DoConfig.cpp
+++ b/DoConfig/DoConfig.cpp
@@ -107,6 +107,9 @@
 		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 @@
 	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 @@
 	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);