2023-11-11 22:47:47 +01:00
|
|
|
#include <assert.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
#include "board/config.h"
|
|
|
|
|
|
|
|
#include "hooklib/config.h"
|
|
|
|
#include "hooklib/dvd.h"
|
|
|
|
|
|
|
|
#include "fgohook/config.h"
|
|
|
|
|
|
|
|
#include "platform/config.h"
|
|
|
|
|
|
|
|
void fgo_dll_config_load(
|
|
|
|
struct fgo_dll_config *cfg,
|
|
|
|
const wchar_t *filename)
|
|
|
|
{
|
|
|
|
assert(cfg != NULL);
|
|
|
|
assert(filename != NULL);
|
|
|
|
|
|
|
|
GetPrivateProfileStringW(
|
|
|
|
L"fgoio",
|
|
|
|
L"path",
|
|
|
|
L"",
|
|
|
|
cfg->path,
|
|
|
|
_countof(cfg->path),
|
|
|
|
filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ftdi_config_load(struct ftdi_config *cfg, const wchar_t *filename)
|
|
|
|
{
|
|
|
|
assert(cfg != NULL);
|
|
|
|
assert(filename != NULL);
|
|
|
|
|
|
|
|
cfg->enable = GetPrivateProfileIntW(L"ftdi", L"enable", 1, filename);
|
2023-11-25 23:00:05 +01:00
|
|
|
cfg->port_no = GetPrivateProfileIntW(L"ftdi", L"portNo", 0, filename);
|
2023-11-11 22:47:47 +01:00
|
|
|
}
|
|
|
|
|
2023-11-25 23:00:05 +01:00
|
|
|
void led15093_config_load(struct led15093_config *cfg, const wchar_t *filename)
|
2023-11-11 22:47:47 +01:00
|
|
|
{
|
|
|
|
assert(cfg != NULL);
|
|
|
|
assert(filename != NULL);
|
|
|
|
|
|
|
|
wchar_t tmpstr[16];
|
|
|
|
|
|
|
|
memset(cfg->board_number, ' ', sizeof(cfg->board_number));
|
|
|
|
memset(cfg->chip_number, ' ', sizeof(cfg->chip_number));
|
2023-11-25 23:00:05 +01:00
|
|
|
memset(cfg->boot_chip_number, ' ', sizeof(cfg->boot_chip_number));
|
|
|
|
|
|
|
|
cfg->enable = GetPrivateProfileIntW(L"led15093", L"enable", 1, filename);
|
2023-12-03 21:34:38 +01:00
|
|
|
cfg->port_no = GetPrivateProfileIntW(L"led15093", L"portNo", 0, filename);
|
2023-11-25 23:00:05 +01:00
|
|
|
cfg->high_baudrate = GetPrivateProfileIntW(L"led15093", L"highBaudrate", 0, filename);
|
|
|
|
cfg->fw_ver = GetPrivateProfileIntW(L"led15093", L"fwVer", 0xA0, filename);
|
2023-12-03 21:34:38 +01:00
|
|
|
cfg->fw_sum = GetPrivateProfileIntW(L"led15093", L"fwSum", 0xAA53, filename);
|
2023-11-25 23:00:05 +01:00
|
|
|
|
|
|
|
GetPrivateProfileStringW(
|
|
|
|
L"led15093",
|
|
|
|
L"boardNumber",
|
|
|
|
L"15093-06",
|
|
|
|
tmpstr,
|
|
|
|
_countof(tmpstr),
|
|
|
|
filename);
|
|
|
|
|
2023-11-11 22:47:47 +01:00
|
|
|
size_t n = wcstombs(cfg->board_number, tmpstr, sizeof(cfg->board_number));
|
|
|
|
for (int i = n; i < sizeof(cfg->board_number); i++)
|
|
|
|
{
|
|
|
|
cfg->board_number[i] = ' ';
|
|
|
|
}
|
2023-11-25 23:00:05 +01:00
|
|
|
|
|
|
|
GetPrivateProfileStringW(
|
|
|
|
L"led15093",
|
|
|
|
L"chipNumber",
|
|
|
|
L"6710A",
|
|
|
|
tmpstr,
|
|
|
|
_countof(tmpstr),
|
|
|
|
filename);
|
|
|
|
|
2023-11-11 22:47:47 +01:00
|
|
|
n = wcstombs(cfg->chip_number, tmpstr, sizeof(cfg->chip_number));
|
|
|
|
for (int i = n; i < sizeof(cfg->chip_number); i++)
|
|
|
|
{
|
|
|
|
cfg->chip_number[i] = ' ';
|
2023-11-25 23:00:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
GetPrivateProfileStringW(
|
|
|
|
L"led15093",
|
|
|
|
L"bootChipNumber",
|
|
|
|
L"6709 ",
|
|
|
|
tmpstr,
|
|
|
|
_countof(tmpstr),
|
|
|
|
filename);
|
|
|
|
|
|
|
|
n = wcstombs(cfg->boot_chip_number, tmpstr, sizeof(cfg->boot_chip_number));
|
|
|
|
for (int i = n; i < sizeof(cfg->boot_chip_number); i++)
|
|
|
|
{
|
|
|
|
cfg->boot_chip_number[i] = ' ';
|
|
|
|
}
|
2023-11-11 22:47:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void fgo_deck_config_load(
|
|
|
|
struct deck_config *cfg,
|
|
|
|
const wchar_t *filename)
|
|
|
|
{
|
|
|
|
assert(cfg != NULL);
|
|
|
|
assert(filename != NULL);
|
|
|
|
|
|
|
|
cfg->enable = GetPrivateProfileIntW(L"deck", L"enable", 1, filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
void fgo_hook_config_load(
|
|
|
|
struct fgo_hook_config *cfg,
|
|
|
|
const wchar_t *filename)
|
|
|
|
{
|
|
|
|
assert(cfg != NULL);
|
|
|
|
assert(filename != NULL);
|
|
|
|
|
|
|
|
platform_config_load(&cfg->platform, filename);
|
|
|
|
aime_config_load(&cfg->aime, filename);
|
|
|
|
dvd_config_load(&cfg->dvd, filename);
|
|
|
|
io4_config_load(&cfg->io4, filename);
|
|
|
|
touch_screen_config_load(&cfg->touch, filename);
|
|
|
|
printer_config_load(&cfg->printer, filename);
|
|
|
|
fgo_deck_config_load(&cfg->deck, filename);
|
|
|
|
ftdi_config_load(&cfg->ftdi, filename);
|
2023-11-25 23:00:05 +01:00
|
|
|
led15093_config_load(&cfg->led15093, filename);
|
2023-11-11 22:47:47 +01:00
|
|
|
fgo_dll_config_load(&cfg->dll, filename);
|
|
|
|
}
|