Wacca: Add toggle for LED board hooks

This commit is contained in:
Hay1tsme 2023-02-12 20:40:41 -05:00
parent b2db1f230b
commit 87ecd639a2
6 changed files with 35 additions and 5 deletions

View File

@ -43,10 +43,14 @@ coin=0x24
volup=0x26
voldown=0x28
; Hooks related to the touch boards
[touch]
; Enable or disable touch hook
enable=1
; Hooks related to the LED board (codenamed Elisabeth)
[elisabeth]
enable=1
;[mercuryio]
; Use mercuryio.dll
;path=mercuryio.dll
;path=mercuryio.dll

View File

@ -41,6 +41,21 @@ void touch_config_load(
filename);
}
void elisabeth_config_load(
struct elisabeth_config *cfg,
const wchar_t *filename)
{
assert(cfg != NULL);
assert(filename != NULL);
cfg->enable = GetPrivateProfileIntW(
L"elisabeth",
L"enable",
1,
filename);
}
void mercury_hook_config_load(
struct mercury_hook_config *cfg,
const wchar_t *filename)
@ -55,4 +70,5 @@ void mercury_hook_config_load(
gfx_config_load(&cfg->gfx, filename);
mercury_dll_config_load(&cfg->dll, filename);
touch_config_load(&cfg->touch, filename);
elisabeth_config_load(&cfg->elisabeth, filename);
}

View File

@ -9,6 +9,7 @@
#include "mercuryhook/mercury-dll.h"
#include "mercuryhook/touch.h"
#include "mercuryhook/elisabeth.h"
#include "platform/config.h"
@ -20,6 +21,7 @@ struct mercury_hook_config {
struct gfx_config gfx;
struct mercury_dll_config dll;
struct touch_config touch;
struct elisabeth_config elisabeth;
};
void mercury_dll_config_load(

View File

@ -83,7 +83,7 @@ static DWORD CALLBACK mercury_pre_startup(void)
}
/* Start elisabeth Hooks for the LED and IO Board DLLs */
elisabeth_hook_init();
elisabeth_hook_init(&mercury_hook_cfg.elisabeth);
touch_hook_init(&mercury_hook_cfg.touch);

View File

@ -33,8 +33,11 @@ static const struct hook_symbol win32_hooks[] = {
}
};
HRESULT elisabeth_hook_init()
HRESULT elisabeth_hook_init(struct elisabeth_config *cfg)
{
if (!cfg->enable) {
return S_OK;
}
dll_hook_insert_hooks(NULL);
dprintf("Elisabeth: Init\n");
return S_OK;

View File

@ -1,8 +1,13 @@
#pragma once
#include <stdbool.h>
struct led_data {
DWORD unitCount;
uint8_t rgba[480 * 4];
};
HRESULT elisabeth_hook_init();
struct elisabeth_config {
bool enable;
};
HRESULT elisabeth_hook_init(struct elisabeth_config *cfg);