forked from TeamTofuShop/segatools
board/io4.c: add configuration section to enable/disable emulation
This commit is contained in:
@ -31,3 +31,11 @@ void aime_config_load(struct aime_config *cfg, const wchar_t *filename)
|
||||
aime_dll_config_load(&cfg->dll, filename);
|
||||
cfg->enable = GetPrivateProfileIntW(L"aime", L"enable", 1, filename);
|
||||
}
|
||||
|
||||
void io4_config_load(struct io4_config *cfg, const wchar_t *filename)
|
||||
{
|
||||
assert(cfg != NULL);
|
||||
assert(filename != NULL);
|
||||
|
||||
cfg->enable = GetPrivateProfileIntW(L"io4", L"enable", 1, filename);
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "board/io4.h"
|
||||
#include "board/sg-reader.h"
|
||||
|
||||
void aime_config_load(struct aime_config *cfg, const wchar_t *filename);
|
||||
void io4_config_load(struct io4_config *cfg, const wchar_t *filename);
|
||||
|
11
board/io4.c
11
board/io4.c
@ -8,6 +8,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "board/config.h"
|
||||
#include "board/guid.h"
|
||||
#include "board/io4.h"
|
||||
|
||||
@ -97,12 +98,20 @@ static uint8_t io4_system_status;
|
||||
static const struct io4_ops *io4_ops;
|
||||
static void *io4_ops_ctx;
|
||||
|
||||
HRESULT io4_hook_init(const struct io4_ops *ops, void *ctx)
|
||||
HRESULT io4_hook_init(
|
||||
const struct io4_config *cfg,
|
||||
const struct io4_ops *ops,
|
||||
void *ctx)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
assert(cfg != NULL);
|
||||
assert(ops != NULL);
|
||||
|
||||
if (!cfg->enable) {
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
async_init(&io4_async, NULL);
|
||||
|
||||
hr = iohook_open_nul_fd(&io4_fd);
|
||||
|
@ -11,6 +11,10 @@ enum {
|
||||
IO4_BUTTON_SERVICE = 1 << 6,
|
||||
};
|
||||
|
||||
struct io4_config {
|
||||
bool enable;
|
||||
};
|
||||
|
||||
struct io4_state {
|
||||
uint16_t adcs[8];
|
||||
uint16_t spinners[4];
|
||||
@ -22,4 +26,7 @@ struct io4_ops {
|
||||
HRESULT (*poll)(void *ctx, struct io4_state *state);
|
||||
};
|
||||
|
||||
HRESULT io4_hook_init(const struct io4_ops *ops, void *ctx);
|
||||
HRESULT io4_hook_init(
|
||||
const struct io4_config *cfg,
|
||||
const struct io4_ops *ops,
|
||||
void *ctx);
|
||||
|
Reference in New Issue
Block a user