1
0
mirror of synced 2024-11-30 16:24:27 +01:00
bananatools/board/usio.h

52 lines
1013 B
C
Raw Normal View History

#pragma once
#include <windows.h>
#include <stdint.h>
2023-07-29 08:51:58 +02:00
#pragma pack(push,1)
enum {
/* System buttons in button[0] */
2023-07-29 08:51:58 +02:00
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;
};
2023-07-29 08:51:58 +02:00
struct usio_coin_state {
uint16_t err;
uint16_t current_coin_count;
bool is_lock;
};
struct usio_state {
2023-07-29 08:51:58 +02:00
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);
};
2023-07-29 08:51:58 +02:00
#pragma pack(pop)
HRESULT usio_hook_init(
const struct usio_config *cfg,
const struct usio_ops *ops,
2023-07-29 08:51:58 +02:00
void *ctx,
HMODULE target);
2023-09-18 10:00:09 +02:00
HRESULT usio_hook_proc_addr(HMODULE target);