mirror of
https://gitea.tendokyu.moe/TeamTofuShop/segatools.git
synced 2026-09-28 04:48:00 +03:00
## Summary Adds a unified mechanism for locating third-party IO DLLs through environment variables, on top of the existing per-game `[xxxio] path=` INI setting. ## Changes For each IO DLL, the path is resolved in this order: 1. The section-specific INI value, e.g. `[mai2io] path=`. 2. The section-specific environment variable, e.g. `SEGATOOLS_MAI2IO_PATH`. 3. `SEGATOOLS_IO_ROOT` joined with the default IO DLL filename, e.g. `%SEGATOOLS_IO_ROOT%\mai2io.dll`. 4. Empty path, which keeps the built-in IO implementation (unchanged default). INI and environment-variable paths are run through Windows environment-variable expansion, so values such as `%SEGATOOLS_IO_ROOT%\mai2io.dll` are valid in the INI directly. Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/119 Co-authored-by: グローランプ <130208311+Gl0w1amp@users.noreply.github.com> Co-committed-by: グローランプ <130208311+Gl0w1amp@users.noreply.github.com>
98 lines
2.6 KiB
C
98 lines
2.6 KiB
C
#include <assert.h>
|
|
#include <stddef.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "board/config.h"
|
|
#include "board/sg-reader.h"
|
|
|
|
#include "hooklib/config.h"
|
|
#include "hooklib/dvd.h"
|
|
|
|
#include "swdchook/config.h"
|
|
#include "swdchook/swdc-dll.h"
|
|
|
|
#include "platform/config.h"
|
|
#include "platform/platform.h"
|
|
#include "util/io-path.h"
|
|
|
|
|
|
void led15070_config_load(struct led15070_config *cfg, const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
wchar_t tmpstr[16];
|
|
|
|
cfg->enable = GetPrivateProfileIntW(L"led15070", L"enable", 1, filename);
|
|
cfg->port_no[0] = GetPrivateProfileIntW(L"led15070", L"portNo1", 0, filename);
|
|
cfg->port_no[1] = GetPrivateProfileIntW(L"led15070", L"portNo2", 0, filename);
|
|
cfg->fw_ver = GetPrivateProfileIntW(L"led15070", L"fwVer", 0x90, filename);
|
|
/* TODO: Unknown, no firmware file available */
|
|
cfg->fw_sum = GetPrivateProfileIntW(L"led15070", L"fwSum", 0xdead, filename);
|
|
|
|
GetPrivateProfileStringW(
|
|
L"led15070",
|
|
L"boardNumber",
|
|
L"15070-04",
|
|
tmpstr,
|
|
_countof(tmpstr),
|
|
filename);
|
|
|
|
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] = ' ';
|
|
}
|
|
|
|
GetPrivateProfileStringW(
|
|
L"led15070",
|
|
L"eepromPath",
|
|
L"DEVICE",
|
|
cfg->eeprom_path,
|
|
_countof(cfg->eeprom_path),
|
|
filename);
|
|
}
|
|
|
|
void swdc_dll_config_load(
|
|
struct swdc_dll_config *cfg,
|
|
const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
io_path_config_load(
|
|
cfg->path,
|
|
_countof(cfg->path),
|
|
L"swdcio",
|
|
L"path",
|
|
L"SEGATOOLS_SWDCIO_PATH",
|
|
L"swdcio.dll",
|
|
filename);
|
|
}
|
|
|
|
void zinput_config_load(struct zinput_config *cfg, const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
cfg->enable = GetPrivateProfileIntW(L"zinput", L"enable", 1, filename);
|
|
}
|
|
|
|
void swdc_hook_config_load(
|
|
struct swdc_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);
|
|
swdc_dll_config_load(&cfg->dll, filename);
|
|
zinput_config_load(&cfg->zinput, filename);
|
|
dvd_config_load(&cfg->dvd, filename);
|
|
io4_config_load(&cfg->io4, filename);
|
|
ffb_config_load(&cfg->ffb, filename);
|
|
led15070_config_load(&cfg->led15070, filename);
|
|
vfd_config_load(&cfg->vfd, filename);
|
|
}
|