//
#include "profile.h"
-#include <QtGui>
#include "gamepad.h"
#include "log.h"
#include "settings.h"
int numberOfProfiles;
int numberOfDevices;
char deviceNames[MAX_DEVICES][128];
+static int numberOfProfilesSave;
// This is so that new devices have something reasonable to show for default
uint32_t defaultMap[21] = {
//
void SaveProfiles(void)
{
+ numberOfProfilesSave = numberOfProfiles;
memcpy(&profileBackup, &profile, sizeof(Profile) * MAX_PROFILES);
}
void RestoreProfiles(void)
{
memcpy(&profile, &profileBackup, sizeof(Profile) * MAX_PROFILES);
+ numberOfProfiles = numberOfProfilesSave;
}
for(int i=1; i<numberOfDevices; i++)
{
set->setArrayIndex(i - 1);
- strcpy(deviceNames[i], set->value("deviceName").toString().toAscii().data());
+ strcpy(deviceNames[i], set->value("deviceName").toString().toUtf8().data());
#ifdef DEBUG_PROFILES
printf("Read device name: %s\n", deviceNames[i]);
#endif
{
set->setArrayIndex(i);
profile[i].device = set->value("deviceNum").toInt();
- strcpy(profile[i].mapName, set->value("mapName").toString().toAscii().data());
+ strcpy(profile[i].mapName, set->value("mapName").toString().toUtf8().data());
profile[i].preferredSlot = set->value("preferredSlot").toInt();
for(int j=0; j<21; j++)
*/
void AutoConnectProfiles(void)
{
- int foundProfiles[MAX_PROFILES];
+// int foundProfiles[MAX_PROFILES];
controller1Profile = -1;
controller2Profile = -1;
gamepadIDSlot1 = -1;
}
// Connect the keyboard device (lowest priority)
+ // N.B.: The keyboard is always mapped to profile #0, so we can locate it
+ // easily. :-)
int slot = profile[0].preferredSlot;
if ((slot == CONTROLLER1) && (gamepadIDSlot1 == -1))