1
0
mirror of synced 2024-11-27 23:10:49 +01:00
bananatools/board/usio.h
2023-09-18 04:00:09 -04:00

52 lines
1013 B
C

#pragma once
#include <windows.h>
#include <stdint.h>
#pragma pack(push,1)
enum {
/* System buttons in button[0] */
USIO_BUTTON_TEST = 1 << 7,
USIO_BUTTON_P1_ENTER = 1 << 9,
USIO_BUTTON_P1_DOWN = 1 << 12,
USIO_BUTTON_P1_UP = 1 << 13,
USIO_BUTTON_SERVICE = 1 << 14,
};
struct usio_config {
bool enable;
};
struct usio_coin_state {
uint16_t err;
uint16_t current_coin_count;
bool is_lock;
};
struct usio_state {
uint16_t err;
uint16_t pl_count;
uint16_t analog[8];
uint16_t encoders[4];
uint8_t op_btns;
uint16_t p1_btns;
uint16_t p2_btns;
struct usio_coin_state coins[2];
struct usio_coin_state service;
uint8_t gpio[32];
};
struct usio_ops {
HRESULT (*poll)(void *ctx, struct usio_state *state);
};
#pragma pack(pop)
HRESULT usio_hook_init(
const struct usio_config *cfg,
const struct usio_ops *ops,
void *ctx,
HMODULE target);
HRESULT usio_hook_proc_addr(HMODULE target);