1
0
mirror of https://gitea.tendokyu.moe/Dniel97/segatools.git synced 2024-11-24 05:20:10 +01:00

kemono: fix LED hooking, add button LEDs

This commit is contained in:
kyoubate-haruka 2024-09-12 13:25:19 +02:00
parent f18d074c5f
commit 599d5e3211
7 changed files with 42 additions and 3 deletions

View File

@ -21,6 +21,12 @@ static const struct hook_symbol kemono_kernel32_syms[] = {
};
void kemono_extra_hooks_init(){
HMODULE serialportapi = LoadLibraryA("Parade_Data/Plugins/SerialPortAPI.dll"); // HACK??
if (serialportapi != NULL){
iohook_apply_hooks(serialportapi);
serial_hook_apply_hooks(serialportapi);
dprintf("Kemono: Successfully pre-loaded SerialPortAPI\n");
}
}
void kemono_extra_hooks_load(HMODULE mod, const wchar_t* target_module) {

View File

@ -25,10 +25,12 @@ static void kemono_jvs_read_coin_counter(
void *ctx,
uint8_t slot_no,
uint16_t *out);
static void kemono_jvs_write_gpio(void *ctx, uint32_t state);
static const struct io3_ops kemono_jvs_io3_ops = {
.read_switches = kemono_jvs_read_switches,
.read_coin_counter = kemono_jvs_read_coin_counter,
.write_gpio = kemono_jvs_write_gpio
};
static struct io3 kemono_jvs_io3;
@ -131,3 +133,7 @@ static void kemono_jvs_read_coin_counter(
kemono_dll.jvs_read_coin_counter(out);
}
static void kemono_jvs_write_gpio(void *ctx, uint32_t state){
kemono_dll.jvs_write_gpio(state);
}

View File

@ -28,6 +28,10 @@ const struct dll_bind_sym kemono_dll_syms[] = {
{
.sym = "kemono_io_led_set_colors",
.off = offsetof(struct kemono_dll, led_set_leds),
},
{
.sym = "kemono_io_jvs_write_gpio",
.off = offsetof(struct kemono_dll, jvs_write_gpio),
}
};

View File

@ -16,6 +16,8 @@ struct kemono_dll {
HRESULT (*led_init)(void);
void (*led_set_leds)(uint8_t board, uint8_t *rgb);
void (*jvs_write_gpio)(uint32_t state);
};
struct kemono_dll_config {

View File

@ -17,6 +17,7 @@ EXPORTS
kemono_io_poll
kemono_io_led_init
kemono_io_led_set_colors
kemono_io_jvs_write_gpio
fwdlusb_open
fwdlusb_close
fwdlusb_listupPrinter

View File

@ -3,6 +3,7 @@
#include <limits.h>
#include <stdint.h>
#include <assert.h>
#include <util/dprintf.h>
#include "kemonoio/kemonoio.h"
#include "kemonoio/config.h"
@ -101,4 +102,8 @@ HRESULT kemono_io_led_init(void) {
void kemono_io_led_set_colors(uint8_t board, uint8_t *rgb) {
}
void kemono_io_jvs_write_gpio(uint32_t state){
}

View File

@ -57,10 +57,25 @@ void kemono_io_jvs_read_coin_counter(uint16_t *out);
All subsequent calls may originate from arbitrary threads and some may
overlap with each other. Ensuring synchronization inside your IO DLL is
your responsibility. */
your responsibility.
Minimum API version: 0x0100 */
HRESULT kemono_io_led_init(void);
/* Update the RGB LEDs.
Exact layout is TBD. */
void kemono_io_led_set_colors(uint8_t board, uint8_t *rgb);
The left side LED bar are indices 0 to 32.
The right side LED bar are indices 33 to 65.
Minimum API version: 0x0100 */
void kemono_io_led_set_colors(uint8_t board, uint8_t *rgb);
/* Update the button LEDs.
Button R: Bit 15
Button G: Bit 1
Button B: Bit 13
Start Button: Bit 11
Minimum API version: 0x0100 */
void kemono_io_jvs_write_gpio(uint32_t state);