mirror of
https://gitea.tendokyu.moe/TeamTofuShop/segatools.git
synced 2026-09-27 09:53:55 +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>
94 lines
2.0 KiB
C
94 lines
2.0 KiB
C
#include <assert.h>
|
|
#include <stddef.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "amex/amex.h"
|
|
#include "amex/config.h"
|
|
#include "gfxhook/config.h"
|
|
|
|
#include "board/config.h"
|
|
#include "board/sg-reader.h"
|
|
|
|
#include "carolhook/config.h"
|
|
|
|
#include "platform/config.h"
|
|
#include "platform/platform.h"
|
|
#include "util/io-path.h"
|
|
|
|
void carol_dll_config_load(
|
|
struct carol_dll_config *cfg,
|
|
const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
io_path_config_load(
|
|
cfg->path,
|
|
_countof(cfg->path),
|
|
L"carolio",
|
|
L"path",
|
|
L"SEGATOOLS_CAROLIO_PATH",
|
|
L"carolio.dll",
|
|
filename);
|
|
}
|
|
|
|
void touch_config_load(
|
|
struct touch_config *cfg,
|
|
const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
cfg->enable = GetPrivateProfileIntW(
|
|
L"touch",
|
|
L"enable",
|
|
1,
|
|
filename);
|
|
}
|
|
|
|
void controlbd_config_load(
|
|
struct controlbd_config *cfg,
|
|
const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
cfg->enable = GetPrivateProfileIntW(
|
|
L"controlbd",
|
|
L"enable",
|
|
1,
|
|
filename);
|
|
}
|
|
|
|
void ledbd_config_load(
|
|
struct ledbd_config *cfg,
|
|
const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
cfg->enable = GetPrivateProfileIntW(
|
|
L"ledbd",
|
|
L"enable",
|
|
1,
|
|
filename);
|
|
}
|
|
|
|
|
|
void carol_hook_config_load(
|
|
struct carol_hook_config *cfg,
|
|
const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
platform_config_load(&cfg->platform, filename);
|
|
amex_config_load(&cfg->amex, filename);
|
|
aime_config_load(&cfg->aime, filename);
|
|
carol_dll_config_load(&cfg->dll, filename);
|
|
gfx_config_load(&cfg->gfx, filename);
|
|
touch_config_load(&cfg->touch, filename);
|
|
controlbd_config_load(&cfg->controlbd, filename);
|
|
ledbd_config_load(&cfg->ledbd, filename);
|
|
}
|