divahook: Add an option to disable slider emulation

This commit is contained in:
5d3b9130281102eb36519ddd0a2c6868ff061a3b 2019-12-29 13:28:32 -04:00
parent 37252be684
commit d32f6ab18b
5 changed files with 26 additions and 3 deletions

View File

@ -12,6 +12,13 @@
#include "platform/config.h"
#include "platform/platform.h"
void slider_config_load(struct slider_config *cfg, const wchar_t *filename) {
assert(cfg != NULL);
assert(filename != NULL);
cfg->enable = GetPrivateProfileIntW(L"slider", L"enable", 1, filename);
}
void diva_hook_config_load(
struct diva_hook_config *cfg,
const wchar_t *filename)
@ -22,4 +29,5 @@ void diva_hook_config_load(
platform_config_load(&cfg->platform, filename);
amex_config_load(&cfg->amex, filename);
aime_config_load(&cfg->aime, filename);
slider_config_load(&cfg->slider, filename);
}

View File

@ -6,14 +6,18 @@
#include "board/sg-reader.h"
#include "divahook/slider.h"
#include "platform/platform.h"
struct diva_hook_config {
struct platform_config platform;
struct amex_config amex;
struct aime_config aime;
struct slider_config slider;
};
void slider_config_load(struct slider_config *cfg, const wchar_t *filename);
void diva_hook_config_load(
struct diva_hook_config *cfg,
const wchar_t *filename);

View File

@ -63,7 +63,7 @@ static DWORD CALLBACK diva_pre_startup(void)
return EXIT_FAILURE;
}
hr = slider_hook_init();
hr = slider_hook_init(&diva_hook_cfg.slider);
if (FAILED(hr)) {
return EXIT_FAILURE;

View File

@ -37,8 +37,13 @@ static struct uart slider_uart;
static uint8_t slider_written_bytes[520];
static uint8_t slider_readable_bytes[520];
HRESULT slider_hook_init(void)
HRESULT slider_hook_init(const struct slider_config *cfg)
{
assert(cfg != NULL);
if (!cfg->enable) {
return S_FALSE;
}
InitializeCriticalSection(&slider_lock);
uart_init(&slider_uart, 11);

View File

@ -2,4 +2,10 @@
#include <windows.h>
HRESULT slider_hook_init(void);
#include <stdbool.h>
struct slider_config {
bool enable;
};
HRESULT slider_hook_init(const struct slider_config *cfg);