| 1 | #ifndef __PROFILE_H__ |
| 2 | #define __PROFILE_H__ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | class QComboBox; |
| 7 | class QSettings; |
| 8 | |
| 9 | #define MAX_PROFILES 64 // 64 profiles ought to be enough for everybody |
| 10 | #define CONTROLLER1 0x01 |
| 11 | #define CONTROLLER2 0x02 |
| 12 | |
| 13 | |
| 14 | struct Profile |
| 15 | { |
| 16 | int device; // Host device number (-1 == invalid profile) |
| 17 | char mapName[32]; // Human readable map name |
| 18 | int preferredSlot; // CONTROLLER1 and/or CONTROLLER2 |
| 19 | uint32_t map[21]; // Keys/buttons/axes |
| 20 | }; |
| 21 | |
| 22 | |
| 23 | // Function prototypes |
| 24 | void SaveProfiles(void); |
| 25 | void RestoreProfiles(void); |
| 26 | void ReadProfiles(QSettings *); |
| 27 | void WriteProfiles(QSettings *); |
| 28 | int GetFreeProfile(void); |
| 29 | void DeleteProfile(int); |
| 30 | int FindDeviceNumberForName(const char *); |
| 31 | int FindMappingsForDevice(int, QComboBox *); |
| 32 | int FindUsableProfiles(QComboBox *); |
| 33 | bool ConnectProfileToController(int, int); |
| 34 | void AutoConnectProfiles(void); |
| 35 | |
| 36 | |
| 37 | // Exported variables |
| 38 | extern Profile profile[]; |
| 39 | extern int controller1Profile; |
| 40 | extern int controller2Profile; |
| 41 | extern int gamepadIDSlot1; |
| 42 | extern int gamepadIDSlot2; |
| 43 | //extern int numberOfProfiles; |
| 44 | |
| 45 | #endif // __PROFILE_H__ |
| 46 | |