board/sg-reader.c: Configurate sg_reader

This commit is contained in:
Tau 2019-06-03 22:28:44 -04:00
parent 924c1d8fdb
commit e06be9fc7b
9 changed files with 34 additions and 6 deletions

View File

@ -6,6 +6,7 @@
#include "aimeio/aimeio.h"
#include "board/config.h"
#include "board/sg-led.h"
#include "board/sg-nfc.h"
#include "board/sg-reader.h"
@ -43,10 +44,18 @@ static uint8_t sg_reader_readable_bytes[520];
static struct sg_nfc sg_reader_nfc;
static struct sg_led sg_reader_led;
HRESULT sg_reader_hook_init(unsigned int port_no)
HRESULT sg_reader_hook_init(
const struct aime_config *cfg,
unsigned int port_no)
{
HRESULT hr;
assert(cfg != NULL);
if (!cfg->enable) {
return S_FALSE;
}
hr = aime_io_init();
if (FAILED(hr)) {

View File

@ -2,4 +2,8 @@
#include <windows.h>
HRESULT sg_reader_hook_init(unsigned int port_no);
#include "board/config.h"
HRESULT sg_reader_hook_init(
const struct aime_config *cfg,
unsigned int port_no);

View File

@ -1,5 +1,8 @@
#include <windows.h>
#include <stdbool.h>
#include "board/config.h"
#include "board/sg-reader.h"
#include "hook/process.h"
@ -9,6 +12,8 @@
#include "util/dprintf.h"
// Emulating an AiMe reader is the only thing this hook DLL does
static const struct aime_config app_aime_config = { .enable = true };
static process_entry_t app_startup;
static DWORD CALLBACK app_pre_startup(void)
@ -18,7 +23,7 @@ static DWORD CALLBACK app_pre_startup(void)
spike_hook_init("cardspike.txt");
serial_hook_init();
sg_reader_hook_init(12);
sg_reader_hook_init(&app_aime_config, 12);
dprintf("--- End %s ---\n", __func__);

View File

@ -3,6 +3,8 @@
#include "amex/config.h"
#include "board/config.h"
#include "divahook/config.h"
#include "platform/config.h"
@ -16,4 +18,5 @@ void diva_hook_config_load(
nu_config_load(&cfg->nu, filename);
amex_config_load(&cfg->amex, filename);
aime_config_load(&cfg->aime, filename);
}

View File

@ -9,6 +9,7 @@
struct diva_hook_config {
struct nu_config nu;
struct amex_config amex;
struct aime_config aime;
};
void diva_hook_config_load(

View File

@ -48,7 +48,7 @@ static DWORD CALLBACK diva_pre_startup(void)
diva_jvs_init();
}
sg_reader_hook_init(10);
sg_reader_hook_init(&diva_hook_cfg.aime, 10);
slider_hook_init();
/* Initialize debug helpers */

View File

@ -2,6 +2,8 @@
#include "amex/config.h"
#include "board/config.h"
#include "idzhook/config.h"
#include "platform/config.h"
@ -15,4 +17,5 @@ void idz_hook_config_load(
nu_config_load(&cfg->nu, filename);
amex_config_load(&cfg->amex, filename);
aime_config_load(&cfg->aime, filename);
}

View File

@ -4,11 +4,14 @@
#include "amex/config.h"
#include "board/config.h"
#include "platform/config.h"
struct idz_hook_config {
struct nu_config nu;
struct amex_config amex;
struct aime_config aime;
};
void idz_hook_config_load(

View File

@ -43,12 +43,12 @@ static DWORD CALLBACK idz_pre_startup(void)
platform_hook_init_nu(&idz_hook_cfg.nu, "SDDF", "AAV2", idz_hook_mod);
amex_hook_init(&idz_hook_cfg.amex);
sg_reader_hook_init(10);
if (idz_hook_cfg.amex.jvs.enable) {
idz_jvs_init();
}
sg_reader_hook_init(&idz_hook_cfg.aime, 10);
/* Initialize debug helpers */
spike_hook_init("idzspike.txt");