2014-12-06 13:29:38 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#include "settings.h"
|
|
|
|
|
|
|
|
struct settings settings;
|
|
|
|
|
|
|
|
struct settings defaultSettings = {
|
|
|
|
circlePad: joystick,
|
|
|
|
touch: mouse,
|
|
|
|
A: 'A',
|
|
|
|
B: 'B',
|
|
|
|
X: 'X',
|
|
|
|
Y: 'Y',
|
|
|
|
L: 'L',
|
|
|
|
R: 'R',
|
|
|
|
Left: VK_LEFT,
|
|
|
|
Right: VK_RIGHT,
|
|
|
|
Up: VK_UP,
|
|
|
|
Down: VK_DOWN,
|
|
|
|
Start: VK_RETURN,
|
|
|
|
Select: VK_BACK,
|
|
|
|
Tap: 'T',
|
|
|
|
};
|
|
|
|
|
|
|
|
bool readSettings(void) {
|
2014-12-07 13:48:14 +00:00
|
|
|
FILE *f;
|
|
|
|
size_t len = 0;
|
|
|
|
char *buffer = NULL;
|
|
|
|
|
2014-12-06 13:29:38 +00:00
|
|
|
memcpy(&settings, &defaultSettings, sizeof(struct settings));
|
2014-12-07 13:48:14 +00:00
|
|
|
|
|
|
|
f = fopen("3DSController.ini", "rb");
|
|
|
|
if(!f) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
fseek(f, 0, SEEK_END);
|
|
|
|
len = ftell(f);
|
|
|
|
rewind(f);
|
|
|
|
|
|
|
|
buffer = malloc(len);
|
|
|
|
if(!buffer) {
|
|
|
|
fclose(f);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fclose(f);
|
|
|
|
|
2014-12-06 13:29:38 +00:00
|
|
|
return true;
|
|
|
|
}
|