2019-09-29 03:29:12 +00:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stddef.h>
|
2019-09-29 20:37:18 +00:00
|
|
|
#include <stdio.h>
|
2019-09-29 03:29:12 +00:00
|
|
|
#include <stdlib.h>
|
2019-09-29 20:37:18 +00:00
|
|
|
#include <wchar.h>
|
2019-09-29 03:29:12 +00:00
|
|
|
|
|
|
|
#include "idzio/config.h"
|
|
|
|
|
|
|
|
void idz_di_config_load(struct idz_di_config *cfg, const wchar_t *filename)
|
|
|
|
{
|
2019-09-29 20:37:18 +00:00
|
|
|
wchar_t key[8];
|
|
|
|
int i;
|
|
|
|
|
2019-09-29 03:29:12 +00:00
|
|
|
assert(cfg != NULL);
|
|
|
|
assert(filename != NULL);
|
|
|
|
|
|
|
|
GetPrivateProfileStringW(
|
|
|
|
L"dinput",
|
|
|
|
L"deviceName",
|
|
|
|
L"",
|
|
|
|
cfg->device_name,
|
|
|
|
_countof(cfg->device_name),
|
|
|
|
filename);
|
|
|
|
|
2019-09-29 20:37:18 +00:00
|
|
|
GetPrivateProfileStringW(
|
|
|
|
L"dinput",
|
|
|
|
L"shifterName",
|
|
|
|
L"",
|
|
|
|
cfg->shifter_name,
|
|
|
|
_countof(cfg->shifter_name),
|
|
|
|
filename);
|
|
|
|
|
2019-09-29 03:29:12 +00:00
|
|
|
GetPrivateProfileStringW(
|
|
|
|
L"dinput",
|
|
|
|
L"brakeAxis",
|
|
|
|
L"RZ",
|
|
|
|
cfg->brake_axis,
|
|
|
|
_countof(cfg->brake_axis),
|
|
|
|
filename);
|
|
|
|
|
|
|
|
GetPrivateProfileStringW(
|
|
|
|
L"dinput",
|
|
|
|
L"accelAxis",
|
|
|
|
L"Y",
|
|
|
|
cfg->accel_axis,
|
|
|
|
_countof(cfg->accel_axis),
|
|
|
|
filename);
|
|
|
|
|
|
|
|
cfg->start = GetPrivateProfileIntW(L"dinput", L"start", 0, 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);
|
2019-09-29 20:37:18 +00:00
|
|
|
|
2019-11-22 00:59:08 +00:00
|
|
|
cfg->reverse_brake_axis = GetPrivateProfileIntW(
|
|
|
|
L"dinput",
|
|
|
|
L"reverseBrakeAxis",
|
|
|
|
0,
|
|
|
|
filename);
|
|
|
|
cfg->reverse_accel_axis = GetPrivateProfileIntW(
|
|
|
|
L"dinput",
|
|
|
|
L"reverseAccelAxis",
|
|
|
|
0,
|
|
|
|
filename);
|
|
|
|
|
2019-09-29 20:37:18 +00:00
|
|
|
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);
|
|
|
|
}
|
2019-10-22 02:12:05 +00:00
|
|
|
|
2019-09-29 03:29:12 +00:00
|
|
|
}
|
|
|
|
|
2019-11-22 00:59:08 +00:00
|
|
|
void idz_xi_config_load(struct idz_xi_config *cfg, const wchar_t *filename)
|
|
|
|
{
|
|
|
|
assert(cfg != NULL);
|
|
|
|
assert(filename != NULL);
|
|
|
|
|
|
|
|
cfg->single_stick_steering = GetPrivateProfileIntW(
|
|
|
|
L"io3",
|
|
|
|
L"singleStickSteering",
|
|
|
|
0,
|
|
|
|
filename);
|
2023-08-15 15:20:27 +00:00
|
|
|
|
|
|
|
cfg->linear_steering = GetPrivateProfileIntW(
|
|
|
|
L"io3",
|
|
|
|
L"linearSteering",
|
|
|
|
0,
|
|
|
|
filename);
|
2019-11-22 00:59:08 +00:00
|
|
|
}
|
|
|
|
|
2019-09-29 03:29:12 +00:00
|
|
|
void idz_io_config_load(struct idz_io_config *cfg, const wchar_t *filename)
|
|
|
|
{
|
|
|
|
assert(cfg != NULL);
|
|
|
|
assert(filename != NULL);
|
|
|
|
|
|
|
|
cfg->vk_test = GetPrivateProfileIntW(L"io3", L"test", '1', filename);
|
|
|
|
cfg->vk_service = GetPrivateProfileIntW(L"io3", L"service", '2', filename);
|
|
|
|
cfg->vk_coin = GetPrivateProfileIntW(L"io3", L"coin", '3', filename);
|
2019-11-24 17:59:02 +00:00
|
|
|
cfg->restrict_ = GetPrivateProfileIntW(L"io3", L"restrict", 97, filename);
|
2019-09-29 03:29:12 +00:00
|
|
|
|
|
|
|
GetPrivateProfileStringW(
|
|
|
|
L"io3",
|
|
|
|
L"mode",
|
|
|
|
L"xinput",
|
|
|
|
cfg->mode,
|
|
|
|
_countof(cfg->mode),
|
|
|
|
filename);
|
|
|
|
|
|
|
|
idz_shifter_config_load(&cfg->shifter, filename);
|
|
|
|
idz_di_config_load(&cfg->di, filename);
|
2019-11-22 00:59:08 +00:00
|
|
|
idz_xi_config_load(&cfg->xi, filename);
|
2019-09-29 03:29:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void idz_shifter_config_load(
|
|
|
|
struct idz_shifter_config *cfg,
|
|
|
|
const wchar_t *filename)
|
|
|
|
{
|
|
|
|
assert(cfg != NULL);
|
|
|
|
assert(filename != NULL);
|
|
|
|
|
|
|
|
cfg->auto_neutral = GetPrivateProfileIntW(
|
|
|
|
L"io3",
|
|
|
|
L"autoNeutral",
|
|
|
|
0,
|
|
|
|
filename);
|
|
|
|
}
|