idzio/di.c: Add positional shifter support

This commit is contained in:
Tau
2019-09-29 16:37:18 -04:00
parent bef6e9b4aa
commit 2214374bbd
3 changed files with 153 additions and 127 deletions

View File

@ -2,12 +2,17 @@
#include <assert.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include "idzio/config.h"
void idz_di_config_load(struct idz_di_config *cfg, const wchar_t *filename)
{
wchar_t key[8];
int i;
assert(cfg != NULL);
assert(filename != NULL);
@ -19,6 +24,14 @@ void idz_di_config_load(struct idz_di_config *cfg, const wchar_t *filename)
_countof(cfg->device_name),
filename);
GetPrivateProfileStringW(
L"dinput",
L"shifterName",
L"",
cfg->shifter_name,
_countof(cfg->shifter_name),
filename);
GetPrivateProfileStringW(
L"dinput",
L"brakeAxis",
@ -39,6 +52,11 @@ void idz_di_config_load(struct idz_di_config *cfg, const wchar_t *filename)
cfg->view_chg = GetPrivateProfileIntW(L"dinput", L"viewChg", 0, filename);
cfg->shift_dn = GetPrivateProfileIntW(L"dinput", L"shiftDn", 0, filename);
cfg->shift_up = GetPrivateProfileIntW(L"dinput", L"shiftUp", 0, filename);
for (i = 0 ; i < 6 ; i++) {
swprintf_s(key, _countof(key), L"gear%i", i + 1);
cfg->gear[i] = GetPrivateProfileIntW(L"dinput", key, i + 1, filename);
}
}
void idz_io_config_load(struct idz_io_config *cfg, const wchar_t *filename)