More work. Must press calibrate to figure out the min and max first. Triggers are annoying in Linux, because each is treated as a different axis from 0 to 255. but Windows it's from -255 to 25. It keeps setting the pressed button to the l-Trigger in Linux because of this. Must do more work.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1381 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Sonicadvance1
2008-12-03 02:33:02 +00:00
parent ab36429fb0
commit 395129d2c4
4 changed files with 81 additions and 15 deletions

View File

@ -599,14 +599,12 @@ int Search_Devices()
joyinfo[i].NumHats = SDL_JoystickNumHats(joyinfo[i].joy);
joyinfo[i].Name = SDL_JoystickName(i);
#ifdef _DEBUG
fprintf(pFile, "ID: %d\n", i);
fprintf(pFile, "Name: %s\n", joyinfo[i].Name);
fprintf(pFile, "Buttons: %d\n", joyinfo[i].NumButtons);
fprintf(pFile, "Axes: %d\n", joyinfo[i].NumAxes);
fprintf(pFile, "Hats: %d\n", joyinfo[i].NumHats);
fprintf(pFile, "Balls: %d\n\n", joyinfo[i].NumBalls);
#endif
printf("ID: %d\n", i);
printf("Name: %s\n", joyinfo[i].Name);
printf("Buttons: %d\n", joyinfo[i].NumButtons);
printf("Axises: %d\n", joyinfo[i].NumAxes);
printf("Hats: %d\n", joyinfo[i].NumHats);
printf("Balls: %d\n\n", joyinfo[i].NumBalls);
// Close if opened
if(SDL_JoystickOpened(i))
@ -690,6 +688,14 @@ void SaveConfig()
file.Set(SectionName, "joy_id", joysticks[i].ID);
file.Set(SectionName, "controllertype", joysticks[i].controllertype);
file.Set(SectionName, "eventnum", joysticks[i].eventnum);
for(int a = 0; a < MAX_AXISES; a++)
{
char Section[32];
sprintf(Section, "SAxis%dMin", a);
file.Set(SectionName, Section, (int)joysticks[i].sData[a].Min);
sprintf(Section, "SAxis%dMax", a);
file.Set(SectionName, Section, (int)joysticks[i].sData[a].Max);
}
}
file.Save("nJoy.ini");
@ -730,6 +736,18 @@ void LoadConfig()
file.Get(SectionName, "joy_id", &joysticks[i].ID, 0);
file.Get(SectionName, "controllertype", &joysticks[i].controllertype, 0);
file.Get(SectionName, "eventnum", &joysticks[i].eventnum, 0);
for(int a = 0; a < MAX_AXISES; a++)
{
char Section[32];
int Min;
int Max;
sprintf(Section, "SAxis%dMin", a);
file.Get(SectionName, Section, &Min, 0);
sprintf(Section, "SAxis%dMax", a);
file.Get(SectionName, Section, &Max, 0);
joysticks[i].sData[a].Min = Min;
joysticks[i].sData[a].Max = Max;
}
}
}