mirror of
https://gitea.tendokyu.moe/TeamTofuShop/segatools.git
synced 2026-10-09 10:09:46 +03:00
This adds a setting to the global configuration to allow only input when the game is focused. This prevents issues, such as triggering game buttons or service buttons while being tabbed out. Turned off by default. The implementation is not the best, but in the context how these games are structured, the most acceptable. It will keep scanning if the foreground window title fully matches (some games partially match, like FGO because due to the revision number in the title), and if found, will grab the HWND of that window and compare that from then on, to not tank performance due to constant string operations. Tested with FGO, chusan and ongeki. Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/segatools/pulls/83 Reviewed-by: Dniel97 <dniel97@noreply.gitea.tendokyu.moe> Co-authored-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com> Co-committed-by: kyoubate-haruka <46010460+kyoubate-haruka@users.noreply.github.com>
72 lines
1.6 KiB
C
72 lines
1.6 KiB
C
#include <windows.h>
|
|
|
|
#include <assert.h>
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "amex/amex.h"
|
|
#include "amex/config.h"
|
|
|
|
#include "board/config.h"
|
|
#include "board/sg-reader.h"
|
|
|
|
#include "cxbhook/config.h"
|
|
|
|
#include "gfxhook/config.h"
|
|
|
|
#include "hooklib/config.h"
|
|
|
|
#include "platform/config.h"
|
|
#include "platform/platform.h"
|
|
|
|
void cxb_dll_config_load(
|
|
struct cxb_dll_config *cfg,
|
|
const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
GetPrivateProfileStringW(
|
|
L"cxbio",
|
|
L"path",
|
|
L"",
|
|
cfg->path,
|
|
_countof(cfg->path),
|
|
filename);
|
|
}
|
|
|
|
void revio_config_load(struct revio_config *cfg, const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
cfg->enable = GetPrivateProfileIntW(L"revio", L"enable", 1, filename);
|
|
cfg->foreground = GetPrivateProfileIntW(L"revio", L"foreground", 0, filename);
|
|
}
|
|
|
|
void led_config_load(struct led_config *cfg, const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
cfg->enable = GetPrivateProfileIntW(L"led", L"enable", 1, filename);
|
|
}
|
|
|
|
void cxb_hook_config_load(
|
|
struct cxb_hook_config *cfg,
|
|
const wchar_t *filename)
|
|
{
|
|
assert(cfg != NULL);
|
|
assert(filename != NULL);
|
|
|
|
memset(cfg, 0, sizeof(*cfg));
|
|
|
|
platform_config_load(&cfg->platform, filename);
|
|
amex_config_load(&cfg->amex, filename);
|
|
aime_config_load(&cfg->aime, filename);
|
|
gfx_config_load(&cfg->gfx, filename);
|
|
cxb_dll_config_load(&cfg->dll, filename);
|
|
revio_config_load(&cfg->revio, filename);
|
|
led_config_load(&cfg->led, filename);
|
|
} |