mirror of
https://gitea.tendokyu.moe/Dniel97/segatools.git
synced 2024-11-30 15:54:27 +01:00
Add led support for mercuryio.dll
This commit is contained in:
parent
005f010861
commit
c28c36dc99
@ -34,6 +34,7 @@ $(BUILD_DIR_ZIP)/mercury.zip:
|
||||
$(V)mkdir -p $(BUILD_DIR_ZIP)/mercury/DEVICE
|
||||
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
|
||||
$(BUILD_DIR_64)/mercuryhook/mercuryhook.dll \
|
||||
$(BUILD_DIR_64)/mercuryio/mercuryio.dll \
|
||||
$(DIST_DIR)/mercury/segatools.ini \
|
||||
$(DIST_DIR)/mercury/start.bat \
|
||||
$(BUILD_DIR_ZIP)/mercury
|
||||
|
7
dist/mercury/segatools.ini
vendored
7
dist/mercury/segatools.ini
vendored
@ -43,3 +43,10 @@ coin=0x24
|
||||
volup=0x26
|
||||
voldown=0x28
|
||||
|
||||
[touch]
|
||||
; Enable or disable touch hook
|
||||
enable=1
|
||||
|
||||
;[mercuryio]
|
||||
; Use mercuryio.dll
|
||||
;path=mercuryio.dll
|
@ -23,6 +23,7 @@ static void dll_hook_insert_hooks(HMODULE target);
|
||||
static FARPROC WINAPI my_GetProcAddress(HMODULE hModule, const char *name);
|
||||
static FARPROC (WINAPI *next_GetProcAddress)(HMODULE hModule, const char *name);
|
||||
static int my_USBIntLED_Init();
|
||||
static int my_USBIntLED_set();
|
||||
|
||||
static const struct hook_symbol win32_hooks[] = {
|
||||
{
|
||||
@ -59,6 +60,10 @@ FARPROC WINAPI my_GetProcAddress(HMODULE hModule, const char *name)
|
||||
if (strcmp(name, "USBIntLED_Init") == 0) {
|
||||
result = (FARPROC) my_USBIntLED_Init;
|
||||
}
|
||||
|
||||
if (strcmp(name, "USBIntLED_set") == 0) {
|
||||
result = (FARPROC) my_USBIntLED_set;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -70,3 +75,10 @@ static int my_USBIntLED_Init()
|
||||
dprintf("Elisabeth: my_USBIntLED_Init hit!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int my_USBIntLED_set(int data1, struct led_data data2)
|
||||
{
|
||||
assert(mercury_dll.set_leds != NULL);
|
||||
mercury_dll.set_leds(data2);
|
||||
return 1;
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
struct led_data {
|
||||
DWORD unitCount;
|
||||
uint8_t rgba[480 * 4];
|
||||
};
|
||||
|
||||
HRESULT elisabeth_hook_init();
|
||||
|
@ -27,6 +27,9 @@ const struct dll_bind_sym mercury_dll_syms[] = {
|
||||
}, {
|
||||
.sym = "mercury_io_touch_start",
|
||||
.off = offsetof(struct mercury_dll, touch_start),
|
||||
}, {
|
||||
.sym = "mercury_io_touch_set_leds",
|
||||
.off = offsetof(struct mercury_dll, set_leds),
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include "mercuryio/mercuryio.h"
|
||||
#include "mercuryhook/elisabeth.h"
|
||||
|
||||
struct mercury_dll {
|
||||
uint16_t api_version;
|
||||
@ -12,6 +13,7 @@ struct mercury_dll {
|
||||
void (*get_gamebtns)(uint8_t *gamebtn);
|
||||
HRESULT (*touch_init)(void);
|
||||
void (*touch_start)(mercury_io_touch_callback_t callback);
|
||||
void (*set_leds)(struct led_data data);
|
||||
};
|
||||
|
||||
struct mercury_dll_config {
|
||||
|
@ -16,5 +16,6 @@ EXPORTS
|
||||
mercury_io_get_opbtns
|
||||
mercury_io_touch_init
|
||||
mercury_io_touch_start
|
||||
mercury_io_touch_set_leds
|
||||
mercury_io_init
|
||||
mercury_io_poll
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "mercuryio/mercuryio.h"
|
||||
#include "mercuryio/config.h"
|
||||
#include "mercuryhook/elisabeth.h"
|
||||
|
||||
static unsigned int __stdcall mercury_io_touch_thread_proc(void *ctx);
|
||||
|
||||
@ -90,6 +91,11 @@ void mercury_io_touch_start(mercury_io_touch_callback_t callback)
|
||||
);
|
||||
}
|
||||
|
||||
void mercury_io_touch_set_leds(struct led_data data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static unsigned int __stdcall mercury_io_touch_thread_proc(void *ctx)
|
||||
{
|
||||
mercury_io_touch_callback_t callback;
|
||||
|
11
mercuryio/mercuryio.def
Normal file
11
mercuryio/mercuryio.def
Normal file
@ -0,0 +1,11 @@
|
||||
LIBRARY mercuryio
|
||||
|
||||
EXPORTS
|
||||
mercury_io_get_api_version
|
||||
mercury_io_init
|
||||
mercury_io_poll
|
||||
mercury_io_get_opbtns
|
||||
mercury_io_get_gamebtns
|
||||
mercury_io_touch_init
|
||||
mercury_io_touch_start
|
||||
mercury_io_touch_set_leds
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mercuryhook/elisabeth.h"
|
||||
|
||||
enum {
|
||||
MERCURY_IO_OPBTN_TEST = 0x01,
|
||||
MERCURY_IO_OPBTN_SERVICE = 0x02,
|
||||
@ -64,3 +66,5 @@ void mercury_io_get_gamebtns(uint8_t *gamebtn);
|
||||
HRESULT mercury_io_touch_init(void);
|
||||
|
||||
void mercury_io_touch_start(mercury_io_touch_callback_t callback);
|
||||
|
||||
void mercury_io_touch_set_leds(struct led_data data);
|
||||
|
@ -11,3 +11,12 @@ mercuryio_lib = static_library(
|
||||
'config.h',
|
||||
],
|
||||
)
|
||||
|
||||
shared_library(
|
||||
'mercuryio',
|
||||
name_prefix : '',
|
||||
vs_module_defs : 'mercuryio.def',
|
||||
link_with : [
|
||||
mercuryio_lib,
|
||||
],
|
||||
)
|
Loading…
Reference in New Issue
Block a user