feat: bemanitools 6 initial refactoring drop, alpha 1

**THIS IS A HIGHLY WORK/DEVELOPMENT IN PROGRESS VERSION**

**THINGS ARE BROKEN AND EVERYTHING IS SUBJECT TO CHANGE**

First cut after massive refactoring with most critical and fundamental changes implemented.
We need to start somewhere, and this might be as good as anything else, so we can get started
with testing, bug fixing and iterating for the next releases.

The following list is non-exhaustive, does not guarantee anything does work, yet, and is supposed
to give a high level idea of what all of this is about. Updated documentation will reflect all of
this at some later point in time in more detail.

* A common "core" now abstracts logging, thread, property and configuration infrastructure and
  provides a common interface. This is used by bemanitools internally as well as all tools, hooks
  and APIs provided and don't depend on the game, version of the game or AVS version available
  anymore
* New bemanitools (public) API
  * Versioned API allowing for handling incremental API changes as well as breaking changes by
    providing a new/different version when necessary
  * Unified interfaces for bemanitools core API, i.e. logging, threads, configuration
  * SDK with examples (TBD)
  * Dogfooding approach: Bemanitools uses its own (public) API to implement and provide fundamental
    features like configurable keyboard implementations for IO or hooks for different games and
    versions
* All bemanitools hooks and IO libraries have been or are about to be re-worked to use the new APIs
* New hook API allows for more fine grained runtime control when stages of the hook are to be
  executed, i.e. pre AVS, before main game, iat hooking instead of relying purely on DllMain
  (which is still a compatible option though)
* launcher as a replacement for bootstrap: Bring it significantly closer to the original bootstrap
  by supporting completely vanilla data and bootstrap.xml configurations to run the games. Note
  that bemanitools does not include any code or means to run DRM'd data, only decrypted
* inject is also being reworked to use as much of the same "infrastructure" as launcher to provide
  a more seamless bootstrapping process for games that keeps pre-eapki data as vanilla as possible
Summary:

Test Plan:
Summary:

Test Plan:
Summary:

Test Plan:
Summary:

Test Plan:
This commit is contained in:
icex2
2024-08-15 11:34:31 +02:00
parent 106b908f17
commit 57e68f928a
692 changed files with 19534 additions and 8278 deletions
+42
View File
@@ -0,0 +1,42 @@
#ifndef BT_API_ACIO_MGR_H
#define BT_API_ACIO_MGR_H
#include <stdbool.h>
#include <stdint.h>
#define BT_ACIO_MGR_NODE_PRODUCT_CODE_LEN 4
typedef struct ac_io_message bt_acio_message_t;
typedef struct aciodrv_device_ctx bt_acio_drv_device_ctx_t;
typedef struct bt_acio_mgr_port_dispatcher bt_acio_mgr_port_dispatcher_t;
typedef bt_acio_mgr_port_dispatcher_t *(*bt_acio_mgr_port_init_t)(const char *path, uint32_t baud);
typedef void (*bt_acio_mgr_port_fini_t)(bt_acio_mgr_port_dispatcher_t *dispatcher);
typedef uint8_t (*bt_acio_mgr_node_count_get_t)(const bt_acio_mgr_port_dispatcher_t *dispatcher);
typedef bool (*bt_acio_mgr_node_product_ident_get_t)(
const bt_acio_mgr_port_dispatcher_t *dispatcher,
uint8_t node_id,
char product[BT_ACIO_MGR_NODE_PRODUCT_CODE_LEN]);
typedef bool (*bt_acio_mgr_port_packet_submit_t)(
bt_acio_mgr_port_dispatcher_t *dispatcher,
bt_acio_message_t *msg,
uint32_t max_resp_size);
typedef bt_acio_drv_device_ctx_t *(*bt_acio_mgr_port_checkout_t)(bt_acio_mgr_port_dispatcher_t *dispatcher);
typedef void (*bt_acio_mgr_port_checkin_t)(bt_acio_mgr_port_dispatcher_t *dispatcher);
typedef struct bt_acio_mgr_api {
uint16_t version;
struct {
// Required to be implemented
bt_acio_mgr_port_init_t port_init;
bt_acio_mgr_port_fini_t port_fini;
bt_acio_mgr_node_count_get_t node_count_get;
bt_acio_mgr_node_product_ident_get_t node_product_ident_get;
bt_acio_mgr_port_packet_submit_t port_packet_submit;
bt_acio_mgr_port_checkout_t port_checkout;
bt_acio_mgr_port_checkin_t port_checkin;
} v1;
} bt_acio_mgr_api_t;
#endif
+51
View File
@@ -0,0 +1,51 @@
#ifndef BT_API_CORE_CONFIG_H
#define BT_API_CORE_CONFIG_H
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct bt_core_config bt_core_config_t;
typedef enum bt_core_config_result {
BT_CORE_CONFIG_RESULT_SUCCESS = 0,
BT_CORE_CONFIG_RESULT_ERROR_INTERNAL = 1,
BT_CORE_CONFIG_RESULT_VALUE_NOT_FOUND = 2,
BT_CORE_CONFIG_RESULT_TYPE_MISMATCH = 3,
} bt_core_config_result_t;
typedef bt_core_config_result_t (*bt_core_config_s8_get_t)(const bt_core_config_t *config, const char *path, int8_t *value);
typedef bt_core_config_result_t (*bt_core_config_u8_get_t)(const bt_core_config_t *config, const char *path, uint8_t *value);
typedef bt_core_config_result_t (*bt_core_config_s16_get_t)(const bt_core_config_t *config, const char *path, int16_t *value);
typedef bt_core_config_result_t (*bt_core_config_u16_get_t)(const bt_core_config_t *config, const char *path, uint16_t *value);
typedef bt_core_config_result_t (*bt_core_config_s32_get_t)(const bt_core_config_t *config, const char *path, int32_t *value);
typedef bt_core_config_result_t (*bt_core_config_u32_get_t)(const bt_core_config_t *config, const char *path, uint32_t *value);
typedef bt_core_config_result_t (*bt_core_config_s64_get_t)(const bt_core_config_t *config, const char *path, int64_t *value);
typedef bt_core_config_result_t (*bt_core_config_u64_get_t)(const bt_core_config_t *config, const char *path, uint64_t *value);
typedef bt_core_config_result_t (*bt_core_config_float_get_t)(const bt_core_config_t *config, const char *path, float *value);
typedef bt_core_config_result_t (*bt_core_config_double_get_t)(const bt_core_config_t *config, const char *path, double *value);
typedef bt_core_config_result_t (*bt_core_config_bool_get_t)(const bt_core_config_t *config, const char *path, bool *value);
typedef bt_core_config_result_t (*bt_core_config_bin_get_t)(const bt_core_config_t *config, const char *path, void *value, size_t len);
typedef bt_core_config_result_t (*bt_core_config_str_get_t)(const bt_core_config_t *config, const char *path, char *value, size_t len);
typedef struct bt_core_config_api {
uint16_t version;
struct {
bt_core_config_s8_get_t s8_get;
bt_core_config_u8_get_t u8_get;
bt_core_config_s16_get_t s16_get;
bt_core_config_u16_get_t u16_get;
bt_core_config_s32_get_t s32_get;
bt_core_config_u32_get_t u32_get;
bt_core_config_s64_get_t s64_get;
bt_core_config_u64_get_t u64_get;
bt_core_config_float_get_t float_get;
bt_core_config_double_get_t double_get;
bt_core_config_bool_get_t bool_get;
bt_core_config_bin_get_t bin_get;
bt_core_config_str_get_t str_get;
} v1;
} bt_core_config_api_t;
#endif
+19
View File
@@ -0,0 +1,19 @@
#ifndef BT_API_CORE_LOG_H
#define BT_API_CORE_LOG_H
#include <stdint.h>
typedef void (*bt_core_log_message_t)(const char *module, const char *fmt, ...);
typedef struct bt_core_log_api {
uint16_t version;
struct {
bt_core_log_message_t misc;
bt_core_log_message_t info;
bt_core_log_message_t warning;
bt_core_log_message_t fatal;
} v1;
} bt_core_log_api_t;
#endif
+28
View File
@@ -0,0 +1,28 @@
#ifndef BT_API_CORE_THREAD_H
#define BT_API_CORE_THREAD_H
#include <stdint.h>
typedef enum bt_core_thread_result {
BT_CORE_THREAD_RESULT_SUCCESS = 0,
BT_CORE_THREAD_RESULT_ERROR_INTERNAL = 1,
} bt_core_thread_result_t;
typedef int bt_core_thread_id_t;
typedef bt_core_thread_result_t (*bt_core_thread_create_t)(
int (*proc)(void *), void *ctx, uint32_t stack_sz, unsigned int priority, bt_core_thread_id_t *thread_id);
typedef bt_core_thread_result_t (*bt_core_thread_join_t)(bt_core_thread_id_t thread_id, int *result);
typedef bt_core_thread_result_t (*bt_core_thread_destroy_t)(bt_core_thread_id_t thread_id);
typedef struct bt_core_thread_api {
uint16_t version;
struct {
bt_core_thread_create_t create;
bt_core_thread_join_t join;
bt_core_thread_destroy_t destroy;
} v1;
} bt_core_thread_api_t;
#endif
+41
View File
@@ -0,0 +1,41 @@
#ifndef BT_API_HOOK_H
#define BT_API_HOOK_H
#include <windows.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include "api/core/config.h"
typedef enum bt_io_bst_gpio_sys_bit {
BT_IO_BST_GPIO_SYS_COIN = 2,
BT_IO_BST_GPIO_SYS_TEST = 4,
BT_IO_BST_GPIO_SYS_SERVICE = 5,
} bt_io_bst_gpio_sys_bit_t;
typedef void (*bt_hook_iat_dll_name_get_t)(char *buffer, size_t size);
typedef bool (*bt_hook_pre_avs_init_t)(const bt_core_config_t *config);
// game module reference, either the exe or dll. allow for further targeted hooking/patching
// remark: you can't own the memory of the property_node config. whatever you need form that, make sure to copy the data and not just reference it.
// there is no guarantee the data is not free'd/gone after this call returns
// use the property api to iterate the data and parse it into your own custom configuration struct
// it is advised to also validate all parameters
// if no configuration was provided upon loading, the config_node contains an empty root node
typedef bool (*bt_hook_main_init_t)(HMODULE game_module, const bt_core_config_t *config);
typedef void (*bt_hook_main_fini_t)();
typedef struct bt_hook_api {
uint16_t version;
struct {
// Optional
bt_hook_iat_dll_name_get_t iat_dll_name_get;
bt_hook_pre_avs_init_t pre_avs_init;
bt_hook_main_init_t main_init;
bt_hook_main_fini_t main_fini;
} v1;
} bt_hook_api_t;
#endif
+28
View File
@@ -0,0 +1,28 @@
#ifndef BT_API_INPUT_H
#define BT_API_INPUT_H
#include <stdbool.h>
#include <stdint.h>
typedef bool (*bt_input_init_t)();
typedef void (*bt_input_fini_t)();
typedef bool (*bt_input_mapper_config_load_t)(const char *game_type);
typedef uint8_t (*bt_input_mapper_analog_read_t)(uint8_t analog);
typedef uint64_t (*bt_input_mapper_update_t)();
typedef void (*bt_input_mapper_light_write_t)(uint8_t light, uint8_t intensity);
typedef struct bt_input_api {
uint16_t version;
struct {
// Required to be implemented
bt_input_init_t init;
bt_input_fini_t fini;
bt_input_mapper_config_load_t mapper_config_load;
bt_input_mapper_analog_read_t mapper_analog_read;
bt_input_mapper_update_t mapper_update;
bt_input_mapper_light_write_t mapper_light_write;
} v1;
} bt_input_api_t;
#endif
+30
View File
@@ -0,0 +1,30 @@
#ifndef BT_API_IO_BST_H
#define BT_API_IO_BST_H
#include <stdbool.h>
#include <stdint.h>
typedef enum bt_io_bst_gpio_sys_bit {
BT_IO_BST_GPIO_SYS_COIN = 2,
BT_IO_BST_GPIO_SYS_TEST = 4,
BT_IO_BST_GPIO_SYS_SERVICE = 5,
} bt_io_bst_gpio_sys_bit_t;
typedef bool (*bt_io_bst_init_t)();
typedef void (*bt_io_bst_fini_t)();
typedef bool (*bt_io_bst_input_read_t)();
typedef uint8_t (*bt_io_bst_input_get_t)();
typedef struct bt_io_bst_api {
uint16_t version;
struct {
// Required to be implemented
bt_io_bst_init_t init;
bt_io_bst_fini_t fini;
bt_io_bst_input_read_t input_read;
bt_io_bst_input_get_t input_get;
} v1;
} bt_io_bst_api_t;
#endif
+106
View File
@@ -0,0 +1,106 @@
#ifndef BT_API_IO_DDR_H
#define BT_API_IO_DDR_H
#include <stdbool.h>
#include <stdint.h>
typedef enum bt_io_ddr_pad_bit {
BT_IO_DDR_TEST = 0x04,
BT_IO_DDR_COIN = 0x05,
BT_IO_DDR_SERVICE = 0x06,
BT_IO_DDR_P2_START = 0x08,
BT_IO_DDR_P2_UP = 0x09,
BT_IO_DDR_P2_DOWN = 0x0A,
BT_IO_DDR_P2_LEFT = 0x0B,
BT_IO_DDR_P2_RIGHT = 0x0C,
BT_IO_DDR_P2_MENU_LEFT = 0x0E,
BT_IO_DDR_P2_MENU_RIGHT = 0x0F,
BT_IO_DDR_P2_MENU_UP = 0x02,
BT_IO_DDR_P2_MENU_DOWN = 0x03,
BT_IO_DDR_P1_START = 0x10,
BT_IO_DDR_P1_UP = 0x11,
BT_IO_DDR_P1_DOWN = 0x12,
BT_IO_DDR_P1_LEFT = 0x13,
BT_IO_DDR_P1_RIGHT = 0x14,
BT_IO_DDR_P1_MENU_LEFT = 0x16,
BT_IO_DDR_P1_MENU_RIGHT = 0x17,
BT_IO_DDR_P1_MENU_UP = 0x00,
BT_IO_DDR_P1_MENU_DOWN = 0x01,
} bt_io_ddr_pad_bit_t;
// see the functions below for more information
typedef enum bt_io_ddr_p3io_light_bit {
BT_IO_DDR_P3IO_LIGHT_P1_MENU = 0x00,
BT_IO_DDR_P3IO_LIGHT_P2_MENU = 0x01,
BT_IO_DDR_P3IO_LIGHT_P2_LOWER_LAMP = 0x04,
BT_IO_DDR_P3IO_LIGHT_P2_UPPER_LAMP = 0x05,
BT_IO_DDR_P3IO_LIGHT_P1_LOWER_LAMP = 0x06,
BT_IO_DDR_P3IO_LIGHT_P1_UPPER_LAMP = 0x07,
} bt_io_ddr_p3io_light_bit_t;
typedef enum bt_io_ddr_hdxs_light_bit {
BT_IO_DDR_HDXS_LIGHT_HD_P1_START = 0x08,
BT_IO_DDR_HDXS_LIGHT_HD_P1_UP_DOWN = 0x09,
BT_IO_DDR_HDXS_LIGHT_HD_P1_LEFT_RIGHT = 0x0A,
BT_IO_DDR_HDXS_LIGHT_HD_P2_START = 0x0B,
BT_IO_DDR_HDXS_LIGHT_HD_P2_UP_DOWN = 0x0C,
BT_IO_DDR_HDXS_LIGHT_HD_P2_LEFT_RIGHT = 0x0D,
} bt_io_ddr_hdxs_light_bit_t;
// the indexing starts from 0x20 if you're looking in geninput
typedef enum bt_io_ddr_hdxs_rgb_light_idx {
BT_IO_DDR_HDXS_LIGHT_HD_P1_SPEAKER_F_R = 0x00,
BT_IO_DDR_HDXS_LIGHT_HD_P1_SPEAKER_F_G = 0x01,
BT_IO_DDR_HDXS_LIGHT_HD_P1_SPEAKER_F_B = 0x02,
BT_IO_DDR_HDXS_LIGHT_HD_P2_SPEAKER_F_R = 0x03,
BT_IO_DDR_HDXS_LIGHT_HD_P2_SPEAKER_F_G = 0x04,
BT_IO_DDR_HDXS_LIGHT_HD_P2_SPEAKER_F_B = 0x05,
BT_IO_DDR_HDXS_LIGHT_HD_P1_SPEAKER_W_R = 0x06,
BT_IO_DDR_HDXS_LIGHT_HD_P1_SPEAKER_W_G = 0x07,
BT_IO_DDR_HDXS_LIGHT_HD_P1_SPEAKER_W_B = 0x08,
BT_IO_DDR_HDXS_LIGHT_HD_P2_SPEAKER_W_R = 0x09,
BT_IO_DDR_HDXS_LIGHT_HD_P2_SPEAKER_W_G = 0x0A,
BT_IO_DDR_HDXS_LIGHT_HD_P2_SPEAKER_W_B = 0x0B,
} bt_io_ddr_hdxs_rgb_light_idx_t;
typedef enum bt_io_ddr_extio_light_bit {
BT_IO_DDR_EXTIO_LIGHT_NEONS = 0x0E,
BT_IO_DDR_EXTIO_LIGHT_P2_RIGHT = 0x13,
BT_IO_DDR_EXTIO_LIGHT_P2_LEFT = 0x14,
BT_IO_DDR_EXTIO_LIGHT_P2_DOWN = 0x15,
BT_IO_DDR_EXTIO_LIGHT_P2_UP = 0x16,
BT_IO_DDR_EXTIO_LIGHT_P1_RIGHT = 0x1B,
BT_IO_DDR_EXTIO_LIGHT_P1_LEFT = 0x1C,
BT_IO_DDR_EXTIO_LIGHT_P1_DOWN = 0x1D,
BT_IO_DDR_EXTIO_LIGHT_P1_UP = 0x1E
} bt_io_ddr_extio_light_bit_t;
typedef bool (*bt_io_ddr_init_t)();
typedef void (*bt_io_ddr_fini_t)();
typedef uint32_t (*bt_io_ddr_pad_read_t)();
typedef void (*bt_io_ddr_extio_lights_set_t)(uint32_t extio_lights);
typedef void (*bt_io_ddr_p3io_lights_set_t)(uint32_t p3io_lights);
typedef void (*bt_io_ddr_hdxs_lights_panel_set_t)(uint32_t hdxs_lights);
typedef void (*bt_io_ddr_hdxs_lights_rgb_set_t)(uint8_t idx, uint8_t r, uint8_t g, uint8_t b);
typedef struct bt_io_ddr_api {
uint16_t version;
struct {
// Required to be implemented
bt_io_ddr_init_t init;
bt_io_ddr_fini_t fini;
bt_io_ddr_pad_read_t pad_read;
bt_io_ddr_extio_lights_set_t extio_lights_set;
bt_io_ddr_p3io_lights_set_t p3io_lights_set;
bt_io_ddr_hdxs_lights_panel_set_t hdxs_lights_panel_set;
bt_io_ddr_hdxs_lights_rgb_set_t hdxs_lights_rgb_set;
} v1;
} bt_io_ddr_api_t;
#endif
+88
View File
@@ -0,0 +1,88 @@
#ifndef BT_API_IO_EAM_H
#define BT_API_IO_EAM_H
/* Card reader emulator API. You may replace the stock EAMIO.DLL supplied by
Bemanitools with your own custom implementation, which should implement the
interface contract defined in this header file. */
#include <stdbool.h>
#include <stdint.h>
/* Scan codes for the so-called "10 key" button panel on each card reader. Each
scan code corresponds to a bit position within the 16-bit bitfield that you
return from eam_io_get_keypad_state(). */
typedef enum bt_io_eam_keypad_scan_code {
BT_IO_EAM_KEYPAD_SCAN_CODE_0 = 0,
BT_IO_EAM_KEYPAD_SCAN_CODE_1 = 1,
BT_IO_EAM_KEYPAD_SCAN_CODE_4 = 2,
BT_IO_EAM_KEYPAD_SCAN_CODE_7 = 3,
BT_IO_EAM_KEYPAD_SCAN_CODE_00 = 4,
BT_IO_EAM_KEYPAD_SCAN_CODE_2 = 5,
BT_IO_EAM_KEYPAD_SCAN_CODE_5 = 6,
BT_IO_EAM_KEYPAD_SCAN_CODE_8 = 7,
BT_IO_EAM_KEYPAD_SCAN_CODE_DECIMAL = 8,
BT_IO_EAM_KEYPAD_SCAN_CODE_3 = 9,
BT_IO_EAM_KEYPAD_SCAN_CODE_6 = 10,
BT_IO_EAM_KEYPAD_SCAN_CODE_9 = 11,
BT_IO_EAM_KEYPAD_COUNT = 12, /* Not an actual scan code */
} bt_io_eam_keypad_scan_code_t;
/* Emulating the sensors of a slotted card reader. The reader has one
sensor at the front that detects if a card is getting inserted or
if the card is not fully removed. When the back sensor is triggered
the card is locked in the slot and its data is read. */
typedef enum bt_io_eam_sensor_state {
BT_IO_EAM_SENSOR_STATE_FRONT = 0,
BT_IO_EAM_SENSOR_STATE_BACK = 1,
} bt_io_eam_sensor_state_t;
/* Different commands for the (slotted) reader. The game triggers one
of these actions and the card slot as to execute it. When non-slotted
readers are emulated, these states are not used/set. */
typedef enum bt_io_eam_card_slot_cmd {
BT_IO_EAM_CARD_SLOT_CMD_CLOSE = 0,
BT_IO_EAM_CARD_SLOT_CMD_OPEN = 1,
BT_IO_EAM_CARD_SLOT_CMD_EJECT = 2,
BT_IO_EAM_CARD_SLOT_CMD_READ = 3,
} bt_io_eam_card_slot_cmd_t;
/* Emulating of the card type for new readers. */
typedef enum bt_io_eam_read_card_result {
BT_IO_EAM_READ_CARD_RESULT_NONE = 0,
BT_IO_EAM_READ_CARD_RESULT_ISO15696 = 1,
BT_IO_EAM_READ_CARD_RESULT_FELICA = 2,
} bt_io_eam_read_card_result_t;
typedef struct bt_io_eam_config_api bt_io_eam_config_api_t;
typedef bool (*bt_io_eam_init_t)();
typedef void (*bt_io_eam_fini_t)();
typedef uint16_t (*bt_io_eam_keypad_state_get_t)(uint8_t unit_no);
typedef uint8_t (*bt_io_eam_sensor_state_get_t)(uint8_t unit_no);
typedef uint8_t (*bt_io_eam_card_read_t)(uint8_t unit_no, uint8_t *card_id, uint8_t nbytes);
typedef bool (*bt_io_eam_card_slot_cmd_send_t)(uint8_t unit_no, uint8_t cmd);
typedef bool (*bt_io_eam_poll_t)(uint8_t unit_no);
typedef const bt_io_eam_config_api_t *(*bt_io_eam_config_api_get_t)();
typedef struct bt_io_eam_api {
uint16_t version;
struct {
// Required to be implemented
bt_io_eam_init_t init;
bt_io_eam_fini_t fini;
bt_io_eam_keypad_state_get_t keypad_state_get;
bt_io_eam_sensor_state_get_t sensor_state_get;
bt_io_eam_card_read_t card_read;
bt_io_eam_card_slot_cmd_send_t card_slot_cmd_send;
bt_io_eam_poll_t poll;
bt_io_eam_config_api_get_t config_api_get;
} v1;
} bt_io_eam_api_t;
#endif
+122
View File
@@ -0,0 +1,122 @@
#ifndef BT_API_IO_IIDX_H
#define BT_API_IO_IIDX_H
/* IO emulation provider for beatmania IIDX. */
#include <stdbool.h>
#include <stdint.h>
/* Bit mapping for the "pad" word */
typedef enum bt_io_iidx_sys_bit {
BT_IO_IIDX_SYS_TEST = 0x00,
BT_IO_IIDX_SYS_SERVICE = 0x01,
BT_IO_IIDX_SYS_COIN = 0x02
} bt_io_iidx_sys_bit_t;
typedef enum bt_io_iidx_panel_bit {
BT_IO_IIDX_PANEL_P1_START = 0x00,
BT_IO_IIDX_PANEL_P2_START = 0x01,
BT_IO_IIDX_PANEL_VEFX = 0x02,
BT_IO_IIDX_PANEL_EFFECT = 0x03
} bt_io_iidx_panel_bit_t;
typedef enum bt_io_iidx_key_bit {
BT_IO_IIDX_KEY_P1_1 = 0x00,
BT_IO_IIDX_KEY_P1_2 = 0x01,
BT_IO_IIDX_KEY_P1_3 = 0x02,
BT_IO_IIDX_KEY_P1_4 = 0x03,
BT_IO_IIDX_KEY_P1_5 = 0x04,
BT_IO_IIDX_KEY_P1_6 = 0x05,
BT_IO_IIDX_KEY_P1_7 = 0x06,
BT_IO_IIDX_KEY_P2_1 = 0x07,
BT_IO_IIDX_KEY_P2_2 = 0x08,
BT_IO_IIDX_KEY_P2_3 = 0x09,
BT_IO_IIDX_KEY_P2_4 = 0x0A,
BT_IO_IIDX_KEY_P2_5 = 0x0B,
BT_IO_IIDX_KEY_P2_6 = 0x0C,
BT_IO_IIDX_KEY_P2_7 = 0x0D
} bt_io_iidx_key_bit_t;
/* Bit mapping for the P1 and P2 deck lights */
typedef enum bt_io_iidx_deck_light {
BT_IO_IIDX_DECK_LIGHT_P1_1 = 0,
BT_IO_IIDX_DECK_LIGHT_P1_2 = 1,
BT_IO_IIDX_DECK_LIGHT_P1_3 = 2,
BT_IO_IIDX_DECK_LIGHT_P1_4 = 3,
BT_IO_IIDX_DECK_LIGHT_P1_5 = 4,
BT_IO_IIDX_DECK_LIGHT_P1_6 = 5,
BT_IO_IIDX_DECK_LIGHT_P1_7 = 6,
BT_IO_IIDX_DECK_LIGHT_P2_1 = 8,
BT_IO_IIDX_DECK_LIGHT_P2_2 = 9,
BT_IO_IIDX_DECK_LIGHT_P2_3 = 10,
BT_IO_IIDX_DECK_LIGHT_P2_4 = 11,
BT_IO_IIDX_DECK_LIGHT_P2_5 = 12,
BT_IO_IIDX_DECK_LIGHT_P2_6 = 13,
BT_IO_IIDX_DECK_LIGHT_P2_7 = 14,
} bt_io_iidx_deck_light_t;
/* Bit mapping for the front panel lights */
typedef enum bt_io_iidx_panel_light {
BT_IO_IIDX_PANEL_LIGHT_P1_START = 0,
BT_IO_IIDX_PANEL_LIGHT_P2_START = 1,
BT_IO_IIDX_PANEL_LIGHT_VEFX = 2,
BT_IO_IIDX_PANEL_LIGHT_EFFECT = 3,
} bt_io_iidx_panel_light_t;
/* Bit mapping for the top lamps from left to right when facing cabinet screen
*/
typedef enum bt_io_iidx_top_lamp {
BT_IO_IIDX_TOP_LAMP_LEFT_BLUE = 0,
BT_IO_IIDX_TOP_LAMP_LEFT_GREEN = 1,
BT_IO_IIDX_TOP_LAMP_LEFT_YELLOW = 2,
BT_IO_IIDX_TOP_LAMP_LEFT_RED = 3,
BT_IO_IIDX_TOP_LAMP_RIGHT_BLUE = 4,
BT_IO_IIDX_TOP_LAMP_RIGHT_GREEN = 5,
BT_IO_IIDX_TOP_LAMP_RIGHT_YELLOW = 6,
BT_IO_IIDX_TOP_LAMP_RIGHT_RED = 7,
} bt_io_iidx_top_lamp_t;
typedef bool (*bt_io_iidx_init_t)();
typedef void (*bt_io_iidx_fini_t)();
typedef void (*bt_io_iidx_ep1_deck_lights_set_t)(uint16_t deck_lights);
typedef void (*bt_io_iidx_ep1_panel_lights_set_t)(uint8_t panel_lights);
typedef void (*bt_io_iidx_ep1_top_lamps_set_t)(uint8_t top_lamps);
typedef void (*bt_io_iidx_ep1_top_neons_set_t)(bool top_neons);
typedef bool (*bt_io_iidx_ep1_send_t)();
typedef bool (*bt_io_iidx_ep2_recv_t)();
typedef uint8_t (*bt_io_iidx_ep2_turntable_get_t)(uint8_t player_no);
typedef uint8_t (*bt_io_iidx_ep2_slider_get_t)(uint8_t slider_no);
typedef uint8_t (*bt_io_iidx_ep2_sys_get_t)();
typedef uint8_t (*bt_io_iidx_ep2_panel_get_t)();
typedef uint16_t (*bt_io_iidx_ep2_keys_get_t)();
typedef bool (*bt_io_iidx_ep3_16seg_send_t)(const char *text);
typedef struct bt_io_iidx_api {
uint16_t version;
struct {
// Required to be implemented
bt_io_iidx_init_t init;
bt_io_iidx_fini_t fini;
bt_io_iidx_ep1_deck_lights_set_t ep1_deck_lights_set;
bt_io_iidx_ep1_panel_lights_set_t ep1_panel_lights_set;
bt_io_iidx_ep1_top_lamps_set_t ep1_top_lamps_set;
bt_io_iidx_ep1_top_neons_set_t ep1_top_neons_set;
bt_io_iidx_ep1_send_t ep1_send;
bt_io_iidx_ep2_recv_t ep2_recv;
bt_io_iidx_ep2_turntable_get_t ep2_turntable_get;
bt_io_iidx_ep2_slider_get_t ep2_slider_get;
bt_io_iidx_ep2_sys_get_t ep2_sys_get;
bt_io_iidx_ep2_panel_get_t ep2_panel_get;
bt_io_iidx_ep2_keys_get_t ep2_keys_get;
bt_io_iidx_ep3_16seg_send_t ep3_16seg_send;
} v1;
} bt_io_iidx_api_t;
#endif
+85
View File
@@ -0,0 +1,85 @@
#ifndef BT_API_IO_JB_H
#define BT_API_IO_JB_H
/* IO emulation provider for jubeat. */
#include <stdbool.h>
#include <stdint.h>
/* input bit mappings. Panels on the controller are
panel 1 top left corner down to panel 16 bottom right corner */
typedef enum bt_io_jb_panel_bit {
BT_IO_JB_PANEL_01 = 0x00,
BT_IO_JB_PANEL_02 = 0x01,
BT_IO_JB_PANEL_03 = 0x02,
BT_IO_JB_PANEL_04 = 0x03,
BT_IO_JB_PANEL_05 = 0x04,
BT_IO_JB_PANEL_06 = 0x05,
BT_IO_JB_PANEL_07 = 0x06,
BT_IO_JB_PANEL_08 = 0x07,
BT_IO_JB_PANEL_09 = 0x08,
BT_IO_JB_PANEL_10 = 0x09,
BT_IO_JB_PANEL_11 = 0x0A,
BT_IO_JB_PANEL_12 = 0x0B,
BT_IO_JB_PANEL_13 = 0x0C,
BT_IO_JB_PANEL_14 = 0x0D,
BT_IO_JB_PANEL_15 = 0x0E,
BT_IO_JB_PANEL_16 = 0x0F,
} bt_io_jb_panel_bit_t;
/* input "single button mode" mappings. Allows you to check each corner of each
button to determine any flaky inputs
*/
typedef enum bt_io_jb_panel_mode {
BT_IO_JB_PANEL_MODE_ALL = 0, // any of the four corners will trigger a panel
BT_IO_JB_PANEL_MODE_TOP_LEFT = 1,
BT_IO_JB_PANEL_MODE_TOP_RIGHT = 2,
BT_IO_JB_PANEL_MODE_BOTTOM_RIGHT = 3,
BT_IO_JB_PANEL_MODE_BOTTOM_LEFT = 4,
} bt_io_jb_panel_mode_t;
/* Bit mappings for "system" inputs */
typedef enum bt_io_jb_sys_bit {
BT_IO_JB_SYS_TEST = 0x00,
BT_IO_JB_SYS_SERVICE = 0x01,
BT_IO_JB_SYS_COIN = 0x02,
} bt_io_jb_sys_bit_t;
/* RGB led units to address */
typedef enum bt_io_jb_rgb_led {
BT_IO_JB_RGB_LED_FRONT = 0,
BT_IO_JB_RGB_LED_TOP = 1,
BT_IO_JB_RGB_LED_LEFT = 2,
BT_IO_JB_RGB_LED_RIGHT = 3,
BT_IO_JB_RGB_LED_TITLE = 4,
BT_IO_JB_RGB_LED_WOOFER = 5
} bt_io_jb_rgb_led_t;
typedef bool (*bt_io_jb_init_t)();
typedef void (*bt_io_jb_fini_t)();
typedef bool (*bt_io_jb_inputs_read_t)();
typedef uint8_t (*bt_io_jb_sys_inputs_get_t)();
typedef uint16_t (*bt_io_jb_panel_inputs_get_t)();
typedef void (*bt_io_jb_rgb_led_set_t)(bt_io_jb_rgb_led_t unit, uint8_t r, uint8_t g, uint8_t b);
typedef bool (*bt_io_jb_lights_write_t)();
typedef bool (*bt_io_jb_panel_mode_set_t)(bt_io_jb_panel_mode_t mode);
typedef bool (*bt_io_jb_coin_blocker_set_t)(bool blocked);
typedef struct bt_io_jb_api {
uint16_t version;
struct {
// Required to be implemented
bt_io_jb_init_t init;
bt_io_jb_fini_t fini;
bt_io_jb_inputs_read_t inputs_read;
bt_io_jb_sys_inputs_get_t sys_inputs_get;
bt_io_jb_panel_inputs_get_t panel_inputs_get;
bt_io_jb_rgb_led_set_t rgb_led_set;
bt_io_jb_lights_write_t lights_write;
bt_io_jb_panel_mode_set_t panel_mode_set;
bt_io_jb_coin_blocker_set_t coin_blocker_set;
} v1;
} bt_io_jb_api_t;
#endif
+80
View File
@@ -0,0 +1,80 @@
#ifndef BT_API_IO_POPN_H
#define BT_API_IO_POPN_H
/* IO emulation provider for pop'n music. */
#include <stdbool.h>
#include <stdint.h>
/* Bit mapping for the "buttons" word */
typedef enum bt_io_popn_sys_bit {
BT_IO_POPN_SYS_SERVICE = 0x06,
BT_IO_POPN_SYS_TEST = 0x07,
} bt_io_popn_sys_bit_t;
typedef enum bt_io_popn_button_bit {
BT_IO_POPN_BUTTON_1 = 0x08,
BT_IO_POPN_BUTTON_2 = 0x09,
BT_IO_POPN_BUTTON_3 = 0x0a,
BT_IO_POPN_BUTTON_4 = 0x0b,
BT_IO_POPN_BUTTON_5 = 0x0c,
BT_IO_POPN_BUTTON_6 = 0x0d,
BT_IO_POPN_BUTTON_7 = 0x0e,
BT_IO_POPN_BUTTON_8 = 0x0f,
BT_IO_POPN_BUTTON_9 = 0x10,
} bt_io_popn_button_bit_t;
typedef enum bt_io_popn_light_top_lamp_bit {
BT_IO_POPN_LIGHT_HI_LAMP1 = 0x00,
BT_IO_POPN_LIGHT_HI_LAMP2 = 0x01,
BT_IO_POPN_LIGHT_HI_LAMP3 = 0x02,
BT_IO_POPN_LIGHT_HI_LAMP4 = 0x03,
BT_IO_POPN_LIGHT_HI_LAMP5 = 0x04,
} bt_io_popn_light_top_lamp_bit_t;
typedef enum bt_io_popn_light_side_lamp_bit {
BT_IO_POPN_LIGHT_LEFT_LAMP1 = 0x00,
BT_IO_POPN_LIGHT_LEFT_LAMP2 = 0x01,
BT_IO_POPN_LIGHT_RIGHT_LAMP1 = 0x02,
BT_IO_POPN_LIGHT_RIGHT_LAMP2 = 0x03,
} bt_io_popn_light_side_lamp_bit_t;
typedef enum bt_io_popn_light_switch_lamp_bit {
BT_IO_POPN_LIGHT_SW_LAMP1 = 0x00, // Is actually 4 bits wide
BT_IO_POPN_LIGHT_SW_LAMP2 = 0x04,
BT_IO_POPN_LIGHT_SW_LAMP3 = 0x05,
BT_IO_POPN_LIGHT_SW_LAMP4 = 0x06,
BT_IO_POPN_LIGHT_SW_LAMP5 = 0x07,
BT_IO_POPN_LIGHT_SW_LAMP6 = 0x08,
BT_IO_POPN_LIGHT_SW_LAMP7 = 0x09,
BT_IO_POPN_LIGHT_SW_LAMP8 = 0x0a,
BT_IO_POPN_LIGHT_SW_LAMP9 = 0x0b,
} bt_io_popn_light_switch_lamp_bit_t;
typedef bool (*bt_io_popn_init_t)();
typedef void (*bt_io_popn_fini_t)();
typedef uint32_t (*bt_io_popn_buttons_get_t)();
typedef void (*bt_io_popn_top_lights_set_t)(uint32_t lights);
typedef void (*bt_io_popn_side_lights_set_t)(uint32_t lights);
typedef void (*bt_io_popn_button_lights_set_t)(uint32_t lights);
typedef void (*bt_io_popn_coin_blocker_light_set_t)(bool enabled);
typedef void (*bt_io_popn_coin_counter_light_set_t)(bool enabled);
typedef struct bt_io_popn_api {
uint16_t version;
struct {
// Required to be implemented
bt_io_popn_init_t init;
bt_io_popn_fini_t fini;
bt_io_popn_buttons_get_t buttons_get;
bt_io_popn_top_lights_set_t top_lights_set;
bt_io_popn_side_lights_set_t side_lights_set;
bt_io_popn_button_lights_set_t button_lights_set;
bt_io_popn_coin_blocker_light_set_t coin_blocker_light_set;
bt_io_popn_coin_counter_light_set_t coin_counter_light_set;
} v1;
} bt_io_popn_api_t;
#endif
+70
View File
@@ -0,0 +1,70 @@
#ifndef BT_API_IO_SDVX_H
#define BT_API_IO_SDVX_H
/* IO emulation provider for SOUND VOLTEX */
#include <stdbool.h>
#include <stdint.h>
typedef enum bt_io_sdvx_in_gpio_sys_bit {
BT_IO_SDVX_IN_GPIO_SYS_COIN = 2,
BT_IO_SDVX_IN_GPIO_SYS_SERVICE = 4,
BT_IO_SDVX_IN_GPIO_SYS_TEST = 5,
} bt_io_sdvx_in_gpio_sys_bit_t;
typedef enum bt_io_sdvx_in_gpio_0_bit {
BT_IO_SDVX_IN_GPIO_0_C = 0,
BT_IO_SDVX_IN_GPIO_0_B = 1,
BT_IO_SDVX_IN_GPIO_0_A = 2,
BT_IO_SDVX_IN_GPIO_0_START = 3,
BT_IO_SDVX_IN_GPIO_0_RECORDER = 4,
BT_IO_SDVX_IN_GPIO_0_HEADPHONE = 5,
} bt_io_sdvx_in_gpio_0_bit_t;
typedef enum bt_io_sdvx_in_gpio_1_bit {
BT_IO_SDVX_IN_GPIO_1_FX_R = 3,
BT_IO_SDVX_IN_GPIO_1_FX_L = 4,
BT_IO_SDVX_IN_GPIO_1_D = 5,
} bt_io_sdvx_in_gpio_1_bit_t;
typedef enum bt_io_sdvx_out_gpio_bit {
BT_IO_SDVX_OUT_GPIO_D = 0,
BT_IO_SDVX_OUT_GPIO_FX_L = 1,
BT_IO_SDVX_OUT_GPIO_FX_R = 2,
BT_IO_SDVX_OUT_GPIO_GENERATOR_B = 3,
BT_IO_SDVX_OUT_GPIO_START = 12,
BT_IO_SDVX_OUT_GPIO_A = 13,
BT_IO_SDVX_OUT_GPIO_B = 14,
BT_IO_SDVX_OUT_GPIO_C = 15,
} bt_io_sdvx_out_gpio_bit_t;
typedef bool (*bt_io_sdvx_init_t)();
typedef void (*bt_io_sdvx_fini_t)();
typedef void (*bt_io_sdvx_gpio_lights_set_t)(uint32_t gpio_lights);
typedef void (*bt_io_sdvx_pwm_light_set_t)(uint8_t light_no, uint8_t intensity);
typedef bool (*bt_io_sdvx_output_write_t)();
typedef bool (*bt_io_sdvx_input_read_t)();
typedef uint8_t (*bt_io_sdvx_input_gpio_sys_get_t)();
typedef uint16_t (*bt_io_sdvx_input_gpio_get_t)(uint8_t gpio_bank);
typedef uint16_t (*bt_io_sdvx_spinner_pos_get_t)(uint8_t spinner_no);
typedef bool (*bt_io_sdvx_amp_volume_set_t)(uint8_t primary, uint8_t headphone, uint8_t subwoofer);
typedef struct bt_io_sdvx_api {
uint16_t version;
struct {
// Required to be implemented
bt_io_sdvx_init_t init;
bt_io_sdvx_fini_t fini;
bt_io_sdvx_gpio_lights_set_t gpio_lights_set;
bt_io_sdvx_pwm_light_set_t pwm_light_set;
bt_io_sdvx_output_write_t output_write;
bt_io_sdvx_input_read_t input_read;
bt_io_sdvx_input_gpio_sys_get_t input_gpio_sys_get;
bt_io_sdvx_input_gpio_get_t input_gpio_get;
bt_io_sdvx_spinner_pos_get_t spinner_pos_get;
bt_io_sdvx_amp_volume_set_t amp_volume_set;
} v1;
} bt_io_sdvx_api_t;
#endif
+28
View File
@@ -0,0 +1,28 @@
#ifndef BT_API_IO_VEFX_H
#define BT_API_IO_VEFX_H
/* IO emulation provider for beatmania IIDX Effector Panel. */
#include <stdbool.h>
#include <stdint.h>
typedef bool (*bt_io_vefx_init_t)();
typedef void (*bt_io_vefx_fini_t)();
typedef bool (*bt_io_vefx_recv_t)(uint64_t *ppad);
typedef uint8_t (*bt_io_vefx_slider_get_t)(uint8_t slider_no);
typedef bool (*bt_io_vefx_16seg_send_t)(const char *text);
typedef struct bt_io_vefx_api {
uint16_t version;
struct {
// Required to be implemented
bt_io_vefx_init_t init;
bt_io_vefx_fini_t fini;
bt_io_vefx_recv_t recv;
bt_io_vefx_slider_get_t slider_get;
bt_io_vefx_16seg_send_t _16seg_send;
} v1;
} bt_io_vefx_api_t;
#endif
-31
View File
@@ -1,31 +0,0 @@
#ifndef BEMANITOOLS_API_THREAD_H
#define BEMANITOOLS_API_THREAD_H
#include <stdint.h>
#ifdef __GNUC__
/* Bemanitools is compiled with GCC (MinGW, specifically) as of version 5 */
#define LOG_CHECK_FMT __attribute__((format(printf, 2, 3)))
#else
/* Compile it out for MSVC plebs */
#define LOG_CHECK_FMT
#endif
/* An AVS-style logger function. Comes in four flavors: misc, info, warning,
and fatal, with increasing severity. Fatal loggers do not return, they
abort the running process after writing their message to the log.
"module" is an arbitrary short string identifying the source of the log
message. The name of the calling DLL is a good default choice for this
string, although you might want to identify a module within your DLL here
instead.
"fmt" is a printf-style format string. Depending on the context in which
your DLL is running you might end up calling a logger function exported
from libavs, which has its own printf implementation (including a number of
proprietary extensions), so don't use any overly exotic formats. */
typedef void (*btapi_log_formatter_t)(const char *module, const char *fmt, ...)
LOG_CHECK_FMT;
#endif
-20
View File
@@ -1,20 +0,0 @@
#ifndef BEMANITOOLS_API_THREAD_H
#define BEMANITOOLS_API_THREAD_H
#include <stdint.h>
/* An API for spawning threads. This API is defined by libavs, although
Bemanitools itself may supply compatible implementations of these functions
to your DLL, depending on the context in which it runs.
NOTE: You may only use the logging functions from a thread where Bemanitools
calls you, or a thread that you create using this API. Failure to observe
this restriction will cause the process to crash. This is a limitation of
libavs itself, not Bemanitools. */
typedef int (*btapi_thread_create_t)(
int (*proc)(void *), void *ctx, uint32_t stack_sz, unsigned int priority);
typedef void (*btapi_thread_join_t)(int thread_id, int *result);
typedef void (*btapi_thread_destroy_t)(int thread_id);
#endif
+6 -6
View File
@@ -142,7 +142,7 @@ typedef void (*avs_log_writer_t)(const char *chars, uint32_t nchars, void *ctx);
typedef void (*avs_log_writer_t)(void *ctx, const char *chars, uint32_t nchars);
#endif
typedef int (*avs_reader_t)(uint32_t context, void *bytes, size_t nbytes);
typedef size_t (*avs_reader_t)(uint32_t context, void *bytes, size_t nbytes);
#if AVS_VERSION >= 1600
/* "avs" and "std" heaps have been unified */
@@ -186,7 +186,7 @@ void avs_shutdown(void);
typedef uint32_t avs_desc;
typedef int avs_error;
#define AVS_IS_ERROR(x) x < 0
#define AVS_IS_ERROR(x) ((avs_error) x) < 0
void log_body_fatal(const char *module, const char *fmt, ...);
void log_body_info(const char *module, const char *fmt, ...);
@@ -223,12 +223,12 @@ void property_destroy(struct property *prop);
avs_error property_get_error(struct property *prop);
void property_clear_error(struct property *prop);
int property_psmap_import(
avs_error property_psmap_import(
struct property *prop,
struct property_node *root,
void *dest,
const struct property_psmap *psmap);
int property_psmap_export(
avs_error property_psmap_export(
struct property *prop,
struct property_node *root,
const void *src,
@@ -254,7 +254,7 @@ int property_node_refer(
enum property_type type,
void *bytes,
uint32_t nbytes);
void property_node_remove(struct property_node *node);
avs_error property_node_remove(struct property_node *node);
enum property_type property_node_type(struct property_node *node);
struct property_node *property_node_traversal(
struct property_node *node, enum property_node_traversal direction);
@@ -315,7 +315,7 @@ enum avs_seek_origin {
avs_desc avs_fs_open(const char *path, uint16_t mode, int flags);
int avs_fs_close(avs_desc desc);
size_t avs_fs_read(avs_desc desc, char *buf, uint32_t sz);
size_t avs_fs_read(avs_desc desc, void *buf, size_t sz);
int avs_fs_lseek(avs_desc desc, long pos, int whence);
int avs_fs_lstat(const char *path, struct avs_stat *st);
int avs_fs_copy(const char *src, const char *dest);
+4 -4
View File
@@ -26,8 +26,8 @@ EXPORTS
property_desc_to_buffer @246 NONAME
property_destroy @247 NONAME
property_insert_read @255 NONAME
property_clear_error @573 NONAME
property_get_error @573 NONAME
property_clear_error @244 NONAME
property_get_error @253 NONAME
property_node_create @266 NONAME
property_node_datasize @267 NONAME
property_node_name @274 NONAME
@@ -35,8 +35,8 @@ EXPORTS
property_node_refer @278 NONAME
property_node_remove @279 NONAME
property_node_type @282 NONAME
property_node_clone @280 NONAME
property_node_traversal @282 NONAME
property_node_clone @265 NONAME
property_node_traversal @281 NONAME
property_node_refdata @277 NONAME
property_query_size @290 NONAME
property_psmap_import @288 NONAME
+41 -41
View File
@@ -1,46 +1,46 @@
LIBRARY libavs-win32
EXPORTS
avs_boot @237 NONAME
avs_fs_close @276 NONAME
avs_fs_copy @283 NONAME
avs_fs_lseek @16 NONAME
avs_fs_lstat @97 NONAME
avs_fs_open @178 NONAME
avs_fs_read @306 NONAME
avs_fs_opendir @216 NONAME
avs_fs_readdir @130 NONAME
avs_fs_closedir @131 NONAME
avs_net_ctrl @15 NONAME
avs_shutdown @333 NONAME
avs_thread_create @183 NONAME
avs_thread_destroy @76 NONAME
avs_thread_exit @147 NONAME
avs_thread_join @92 NONAME
log_body_misc @44 NONAME
log_body_info @339 NONAME
log_body_warning @219 NONAME
log_body_fatal @128 NONAME
property_create @256 NONAME
property_desc_to_buffer @201 NONAME
property_destroy @264 NONAME
property_insert_read @23 NONAME
property_clear_error @573 NONAME
property_get_error @573 NONAME
property_node_create @316 NONAME
property_node_datasize @249 NONAME
property_node_name @255 NONAME
property_node_read @2 NONAME
property_node_refer @268 NONAME
property_node_remove @129 NONAME
property_node_type @329 NONAME
property_node_clone @130 NONAME
property_node_traversal @93 NONAME
avs_boot @237 NONAME == XC058ba50000f4
avs_fs_close @276 NONAME == XC058ba500011b
avs_fs_copy @283 NONAME == XC058ba5000122
avs_fs_lseek @16 NONAME == XC058ba500000f
avs_fs_lstat @97 NONAME == XC058ba5000063
avs_fs_open @178 NONAME == XC058ba50000b6
avs_fs_read @306 NONAME == XC058ba5000139
avs_fs_opendir @216 NONAME == XC058ba50000dd
avs_fs_readdir @130 NONAME == XC058ba5000086
avs_fs_closedir @131 NONAME == XC058ba5000087
avs_net_ctrl @15 NONAME == XC058ba500000e
avs_shutdown @333 NONAME == XC058ba5000154
avs_thread_create @183 NONAME == XC058ba50000bb
avs_thread_destroy @76 NONAME == XC058ba500004e
avs_thread_exit @147 NONAME == XC058ba5000097
avs_thread_join @92 NONAME == XC058ba500005e
log_body_misc @44 NONAME == XC058ba500002d
log_body_info @339 NONAME == XC058ba500015a
log_body_warning @219 NONAME == XC058ba50000e1
log_body_fatal @128 NONAME == XC058ba5000084
property_create @256 NONAME == XC058ba5000107
property_desc_to_buffer @201 NONAME == XC058ba50000cd
property_destroy @264 NONAME == XC058ba500010f
property_insert_read @23 NONAME == XC058ba5000016
property_clear_error @163 NONAME == XC058ba50000a7
property_get_error @295 NONAME == XC058ba500012e
property_node_create @316 NONAME == XC058ba5000143
property_node_datasize @249 NONAME == XC058ba5000100
property_node_name @255 NONAME == XC058ba5000106
property_node_read @2 NONAME == XC058ba5000001
property_node_refer @268 NONAME == XC058ba5000113
property_node_remove @129 NONAME == XC058ba5000085
property_node_type @329 NONAME == XC058ba5000150
property_node_clone @252 NONAME == XC058ba5000103
property_node_traversal @93 NONAME == XC058ba500005f
property_node_refdata @330 NONAME == XC058ba5000151
property_query_size @250 NONAME == XC058ba5000101
property_psmap_import @102 NONAME
property_psmap_export @110 NONAME
property_read_query_memsize @100 NONAME
property_search @244 NONAME
std_getenv @226 NONAME
std_setenv @114 NONAME
property_psmap_import @102 NONAME == XC058ba5000068
property_psmap_export @110 NONAME == XC058ba5000071
property_read_query_memsize @100 NONAME == XC058ba5000066
property_search @244 NONAME == XC058ba50000fb
std_getenv @226 NONAME == XC058ba50000e8
std_setenv @114 NONAME == XC058ba5000075
+2 -2
View File
@@ -25,8 +25,8 @@ EXPORTS
property_desc_to_buffer @201 NONAME == XC058ba50000cd
property_destroy @264 NONAME == XC058ba500010f
property_insert_read @23 NONAME == XC058ba5000016
property_clear_error @573 NONAME
property_get_error @573 NONAME
property_clear_error @163 NONAME == XC058ba50000a7
property_get_error @295 NONAME == XC058ba500012e
property_node_create @316 NONAME == XC058ba5000143
property_node_datasize @249 NONAME == XC058ba5000100
property_node_name @255 NONAME == XC058ba5000106
+5 -5
View File
@@ -6,8 +6,8 @@ EXPORTS
avs_fs_lseek @59 NONAME
avs_fs_lseek64 @60 NONAME
avs_fs_lstat @79 NONAME
avs_fs_open @58 NONAME
avs_fs_read @61 NONAME
avs_fs_open @58 NONAME == XCd229cc000090
avs_fs_read @61 NONAME == XCd229cc00010d
avs_fs_copy @81 NONAME
avs_fs_opendir @72 NONAME == XCd229cc0000f0
avs_fs_readdir @73 NONAME == XCd229cc0000bb
@@ -26,8 +26,8 @@ EXPORTS
property_desc_to_buffer @129 NONAME
property_destroy @128 NONAME
property_insert_read @131 NONAME
property_clear_error @573 NONAME
property_get_error @573 NONAME
property_clear_error @140 NONAME == XCd229cc00014b
property_get_error @141 NONAME == XCd229cc0000b5
property_node_create @145 NONAME
property_node_name @150 NONAME
property_node_read @154 NONAME == XCd229cc0000f3
@@ -41,7 +41,7 @@ EXPORTS
property_query_size @142 NONAME == XCd229cc000032
property_psmap_export @162 NONAME
property_psmap_import @161 NONAME
property_read_query_memsize @159 NONAME
property_read_query_memsize @159 NONAME == XCd229cc0000ff
property_search @144 NONAME
std_getenv @207 NONAME
std_setenv @208 NONAME
+4 -4
View File
@@ -5,8 +5,8 @@ EXPORTS
avs_fs_copy @81 NONAME
avs_fs_lseek @59 NONAME
avs_fs_lstat @79 NONAME
avs_fs_open @58 NONAME
avs_fs_read @61 NONAME
avs_fs_open @58 NONAME == XCnbrep7000039
avs_fs_read @61 NONAME == XCnbrep700003c
avs_fs_opendir @72 NONAME == XCnbrep7000047
avs_fs_readdir @73 NONAME == XCnbrep7000048
avs_fs_closedir @74 NONAME == XCnbrep7000049
@@ -19,8 +19,8 @@ EXPORTS
property_destroy @125 NONAME
property_desc_to_buffer @126 NONAME
property_insert_read @128 NONAME
property_clear_error @573 NONAME
property_get_error @573 NONAME
property_clear_error @137 NONAME == XCnbrep7000088
property_get_error @138 NONAME == XCnbrep7000089
property_search @141 NONAME
property_node_create @142 NONAME
property_node_name @147 NONAME == XCnbrep7000092
+11
View File
@@ -0,0 +1,11 @@
dlls += acio-mgr
libs_acio-mgr := \
aciodrv \
iface-core \
core \
util \
src_acio-mgr := \
dllmain.c \
mgr.c \
+20
View File
@@ -0,0 +1,20 @@
LIBRARY acio-mgr
EXPORTS
; Bemanitools 6 API
bt_module_core_log_api_set
bt_module_acio_mgr_api_get
; Not exporting as these are called in DllMain
; bt_acio_mgr_init
; bt_acio_mgr_fini
DllMain@12 @1 NONAME
; Direct API
bt_acio_mgr_port_init
bt_acio_mgr_port_fini
bt_acio_mgr_node_count_get
bt_acio_mgr_node_product_ident_get
bt_acio_mgr_port_packet_submit
bt_acio_mgr_port_checkout
bt_acio_mgr_port_checkin
@@ -1,15 +1,15 @@
#include <windows.h>
#include "manager-init.h"
#include "acio-mgr/internal.h"
BOOL WINAPI DllMain(HMODULE self, DWORD reason, void *ctx)
{
if (reason == DLL_PROCESS_ATTACH) {
_aciomgr_init();
bt_acio_mgr_init();
}
if (reason == DLL_PROCESS_DETACH) {
_aciomgr_fini();
bt_acio_mgr_fini();
}
return TRUE;
+7
View File
@@ -0,0 +1,7 @@
#ifndef ACIO_MGR_INTERNAL_T
#define ACIO_MGR_INTERNAL_T
void bt_acio_mgr_init();
void bt_acio_mgr_fini();
#endif
@@ -4,40 +4,43 @@
#include <stdatomic.h>
#include "aciomgr/manager-init.h"
#include "aciomgr/manager.h"
#include "acio/acio.h"
#include "aciodrv/device.h"
#include "core/log.h"
#include "acio-mgr/internal.h"
#include "api/core/log.h"
#include "iface-core/log.h"
#include "sdk/module/acio/mgr.h"
#include "sdk/module/core/log.h"
#include "util/array.h"
#define MAX_PORT_PATH_LENGTH 256
struct aciomgr_port_dispatcher {
typedef struct bt_acio_mgr_port_dispatcher {
CRITICAL_SECTION cs;
atomic_size_t references;
struct aciodrv_device_ctx *device;
char path[MAX_PORT_PATH_LENGTH];
int baud;
bool has_failure;
};
} bt_acio_mgr_port_dispatcher_t;
static void _aciomgr_setup_port_dispatcher(
struct aciomgr_port_dispatcher *dispatcher, const char *path, int baud);
static void _bt_acio_mgr_setup_port_dispatcher(
bt_acio_mgr_port_dispatcher_t *dispatcher, const char *path, int baud);
static void
_aciomgr_destroy_port_dispatcher(struct aciomgr_port_dispatcher *dispatcher);
_bt_acio_mgr_destroy_port_dispatcher(bt_acio_mgr_port_dispatcher_t *dispatcher);
// DLL-globals
static atomic_bool running;
static CRITICAL_SECTION mgr_cs;
static struct array active_ports;
static void _aciomgr_setup_port_dispatcher(
struct aciomgr_port_dispatcher *dispatcher, const char *path, int baud)
static void _bt_acio_mgr_setup_port_dispatcher(
bt_acio_mgr_port_dispatcher_t *dispatcher, const char *path, int baud)
{
InitializeCriticalSection(&dispatcher->cs);
@@ -56,17 +59,17 @@ static void _aciomgr_setup_port_dispatcher(
}
static void
_aciomgr_destroy_port_dispatcher(struct aciomgr_port_dispatcher *dispatcher)
_bt_acio_mgr_destroy_port_dispatcher(bt_acio_mgr_port_dispatcher_t *dispatcher)
{
aciodrv_device_close(dispatcher->device);
DeleteCriticalSection(&dispatcher->cs);
}
void _aciomgr_init()
void bt_acio_mgr_init()
{
if (running) {
log_warning("_aciomgr_init called when already running");
_aciomgr_fini();
bt_acio_mgr_fini();
}
InitializeCriticalSection(&mgr_cs);
array_init(&active_ports);
@@ -74,7 +77,7 @@ void _aciomgr_init()
running = true;
}
void _aciomgr_fini()
void bt_acio_mgr_fini()
{
if (!running) {
log_warning("_aciomgr_fini called when not running");
@@ -85,16 +88,8 @@ void _aciomgr_fini()
array_fini(&active_ports);
}
void aciomgr_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal)
{
core_log_impl_set(misc, warning, info, fatal);
}
struct aciomgr_port_dispatcher *aciomgr_port_init(const char *path, int baud)
bt_acio_mgr_port_dispatcher_t *
bt_acio_mgr_port_init(const char *path, uint32_t baud)
{
if (!running) {
log_warning("aciomgr_port_init: called when not running");
@@ -106,12 +101,12 @@ struct aciomgr_port_dispatcher *aciomgr_port_init(const char *path, int baud)
return NULL;
}
struct aciomgr_port_dispatcher *entry;
bt_acio_mgr_port_dispatcher_t *entry;
EnterCriticalSection(&mgr_cs);
for (size_t i = 0; i < active_ports.nitems; i++) {
entry = array_item(struct aciomgr_port_dispatcher, &active_ports, i);
entry = array_item(bt_acio_mgr_port_dispatcher_t, &active_ports, i);
if (strcmp(entry->path, path) == 0) {
// found
@@ -126,8 +121,8 @@ struct aciomgr_port_dispatcher *aciomgr_port_init(const char *path, int baud)
}
}
entry = array_append(struct aciomgr_port_dispatcher, &active_ports);
_aciomgr_setup_port_dispatcher(entry, path, baud);
entry = array_append(bt_acio_mgr_port_dispatcher_t, &active_ports);
_bt_acio_mgr_setup_port_dispatcher(entry, path, baud);
done:
if (!entry->has_failure) {
@@ -143,7 +138,7 @@ done:
return entry;
}
void aciomgr_port_fini(struct aciomgr_port_dispatcher *dispatcher)
void bt_acio_mgr_port_fini(bt_acio_mgr_port_dispatcher_t *dispatcher)
{
if (!running) {
log_warning("aciomgr_port_fini: called when not running");
@@ -155,30 +150,31 @@ void aciomgr_port_fini(struct aciomgr_port_dispatcher *dispatcher)
LeaveCriticalSection(&mgr_cs);
if (dispatcher->references == 0) {
_aciomgr_destroy_port_dispatcher(dispatcher);
_bt_acio_mgr_destroy_port_dispatcher(dispatcher);
}
}
// this function don't require the lock
uint8_t aciomgr_get_node_count(struct aciomgr_port_dispatcher *dispatcher)
uint8_t
bt_acio_mgr_node_count_get(const bt_acio_mgr_port_dispatcher_t *dispatcher)
{
return aciodrv_device_get_node_count(dispatcher->device);
}
// this function don't require the lock
bool aciomgr_get_node_product_ident(
struct aciomgr_port_dispatcher *dispatcher,
bool bt_acio_mgr_node_product_ident_get(
const bt_acio_mgr_port_dispatcher_t *dispatcher,
uint8_t node_id,
char product[ACIOMGR_NODE_PRODUCT_CODE_LEN])
char product[BT_ACIO_MGR_NODE_PRODUCT_CODE_LEN])
{
return aciodrv_device_get_node_product_ident(
dispatcher->device, node_id, product);
}
bool aciomgr_port_submit_packet(
struct aciomgr_port_dispatcher *dispatcher,
struct ac_io_message *msg,
int max_resp_size)
bool bt_acio_mgr_port_packet_submit(
bt_acio_mgr_port_dispatcher_t *dispatcher,
bt_acio_message_t *msg,
uint32_t max_resp_size)
{
// CS's although lightweight, may still be a burden, short circuit
if (dispatcher->references > 1) {
@@ -192,8 +188,8 @@ bool aciomgr_port_submit_packet(
return aciodrv_send_and_recv(dispatcher->device, msg, max_resp_size);
}
struct aciodrv_device_ctx *
aciomgr_port_checkout(struct aciomgr_port_dispatcher *dispatcher)
bt_acio_drv_device_ctx_t *
bt_acio_mgr_port_checkout(bt_acio_mgr_port_dispatcher_t *dispatcher)
{
if (dispatcher->references > 1) {
EnterCriticalSection(&dispatcher->cs);
@@ -202,9 +198,27 @@ aciomgr_port_checkout(struct aciomgr_port_dispatcher *dispatcher)
return dispatcher->device;
}
void aciomgr_port_checkin(struct aciomgr_port_dispatcher *dispatcher)
void bt_acio_mgr_port_checkin(bt_acio_mgr_port_dispatcher_t *dispatcher)
{
if (dispatcher->references > 1) {
LeaveCriticalSection(&dispatcher->cs);
}
}
void bt_module_core_log_api_set(const bt_core_log_api_t *api)
{
bt_core_log_api_set(api);
}
void bt_module_acio_mgr_api_get(bt_acio_mgr_api_t *api)
{
api->version = 1;
api->v1.port_init = bt_acio_mgr_port_init;
api->v1.port_fini = bt_acio_mgr_port_fini;
api->v1.node_count_get = bt_acio_mgr_node_count_get;
api->v1.node_product_ident_get = bt_acio_mgr_node_product_ident_get;
api->v1.port_packet_submit = bt_acio_mgr_port_packet_submit;
api->v1.port_checkout = bt_acio_mgr_port_checkout;
api->v1.port_checkin = bt_acio_mgr_port_checkin;
}
+15 -7
View File
@@ -5,9 +5,8 @@
#include "aciodrv/device.h"
#include "aciodrv/panb.h"
#include "core/thread.h"
#include "core/log.h"
#include "iface-core/log.h"
#include "iface-core/thread.h"
static int auto_poll_proc(void *auto_poll_param);
static int auto_poll_threadid;
@@ -41,6 +40,8 @@ static int auto_poll_proc(void *param)
bool aciodrv_proc_panb_init(struct aciodrv_device_ctx *device)
{
bt_core_thread_result_t result;
log_assert(device);
if (!aciodrv_panb_start_auto_input(device, 0, AC_IO_PANB_NUM_NODES)) {
@@ -50,8 +51,10 @@ bool aciodrv_proc_panb_init(struct aciodrv_device_ctx *device)
auto_poll_stop = false;
InitializeCriticalSection(&keypair_lock);
InitializeCriticalSection(&auto_poll_stop_lock);
auto_poll_threadid =
core_thread_create(auto_poll_proc, (void *) device, 0x4000, 0);
result = bt_core_thread_create(
auto_poll_proc, (void *) device, 0x4000, 0, &auto_poll_threadid);
bt_core_thread_fatal_on_error(result);
return true;
}
@@ -77,12 +80,17 @@ bool aciodrv_proc_panb_get_state(uint8_t *button_state)
void aciodrv_proc_panb_fini(struct aciodrv_device_ctx *device)
{
bt_core_thread_result_t result;
EnterCriticalSection(&auto_poll_stop_lock);
auto_poll_stop = true;
LeaveCriticalSection(&auto_poll_stop_lock);
core_thread_join(auto_poll_threadid, NULL);
core_thread_destroy(auto_poll_threadid);
result = bt_core_thread_join(auto_poll_threadid, NULL);
bt_core_thread_fatal_on_error(result);
result = bt_core_thread_destroy(auto_poll_threadid);
bt_core_thread_fatal_on_error(result);
DeleteCriticalSection(&keypair_lock);
DeleteCriticalSection(&auto_poll_stop_lock);
+1 -1
View File
@@ -7,7 +7,7 @@
#include "aciodrv/port.h"
#include "core/log.h"
#include "iface-core/log.h"
#include "util/hex.h"
#include "util/mem.h"
+1 -1
View File
@@ -7,7 +7,7 @@
#include "aciodrv/device.h"
#include "core/log.h"
#include "iface-core/log.h"
bool aciodrv_h44b_init(struct aciodrv_device_ctx *device, uint8_t node_id)
{
+1 -1
View File
@@ -5,7 +5,7 @@
#include "aciodrv/device.h"
#include "aciodrv/icca.h"
#include "core/log.h"
#include "iface-core/log.h"
static bool aciodrv_icca_queue_loop_start(
struct aciodrv_device_ctx *device, uint8_t node_id)
+1 -1
View File
@@ -5,7 +5,7 @@
#include "aciodrv/device.h"
#include "core/log.h"
#include "iface-core/log.h"
static bool
aciodrv_kfca_watchdog_start(struct aciodrv_device_ctx *device, uint8_t node_id)
+1 -1
View File
@@ -5,7 +5,7 @@
#include "aciodrv/device.h"
#include "aciodrv/panb.h"
#include "core/log.h"
#include "iface-core/log.h"
bool aciodrv_panb_start_auto_input(
struct aciodrv_device_ctx *device, uint8_t node_id, uint8_t node_count)
+1 -1
View File
@@ -6,7 +6,7 @@
#include <windows.h>
#include "core/log.h"
#include "iface-core/log.h"
HANDLE aciodrv_port_open(const char *port_path, int baud)
{
+1 -1
View File
@@ -5,7 +5,7 @@
#include "aciodrv/device.h"
#include "core/log.h"
#include "iface-core/log.h"
static bool aciodrv_rvol_change_expand_mode(
struct aciodrv_device_ctx *device, uint8_t node_id, uint8_t mode)
+1 -1
View File
@@ -5,7 +5,7 @@
#include "acioemu/addr.h"
#include "acioemu/emu.h"
#include "core/log.h"
#include "iface-core/log.h"
void ac_io_emu_cmd_assign_addrs(
struct ac_io_emu *emu, const struct ac_io_message *req, uint8_t node_count)
+1 -1
View File
@@ -14,7 +14,7 @@
#include "acioemu/emu.h"
#include "acioemu/pipe.h"
#include "core/log.h"
#include "iface-core/log.h"
#include "hook/iohook.h"
+4 -4
View File
@@ -11,7 +11,7 @@
#include "acioemu/emu.h"
#include "bemanitools/jbio.h"
#include "iface-io/jb.h"
#include "util/hex.h"
@@ -54,14 +54,14 @@ void ac_io_emu_h44b_dispatch_request(
case AC_IO_H44B_CMD_SET_OUTPUTS:
/* Not using the struct ac_io_h44b_output here */
for (int i = 0; i < 6; i++) {
jb_io_set_rgb_led(
(enum jb_io_rgb_led) i,
bt_io_jb_rgb_led_set(
(enum bt_io_jb_rgb_led) i,
req->cmd.raw[i * 3],
req->cmd.raw[i * 3 + 1],
req->cmd.raw[i * 3 + 2]);
}
jb_io_write_lights();
bt_io_jb_lights_write();
ac_io_emu_h44b_send_status(h44b, req, 0x00);
+2 -2
View File
@@ -6,14 +6,14 @@
#include "acioemu/emu.h"
#include "api/io/jb.h"
struct ac_io_emu_h44b {
struct ac_io_emu *emu;
uint8_t unit_no;
// TODO
};
void acioemu_h44b_init(void);
void ac_io_emu_h44b_init(
struct ac_io_emu_h44b *h44b, struct ac_io_emu *emu, uint8_t unit_no);
+1 -1
View File
@@ -6,7 +6,7 @@
#include "acioemu/emu.h"
#include "acioemu/hdxs.h"
#include "core/log.h"
#include "iface-core/log.h"
static void ac_io_emu_hdxs_cmd_send_version(
struct ac_io_emu_hdxs *hdxs, const struct ac_io_message *req);
+21 -19
View File
@@ -12,7 +12,7 @@
#include "acioemu/emu.h"
#include "acioemu/icca.h"
#include "bemanitools/eamio.h"
#include "iface-io/eam.h"
#include "util/crc.h"
#include "util/time.h"
@@ -58,6 +58,7 @@ void ac_io_emu_icca_init(
memset(icca, 0, sizeof(*icca));
icca->emu = emu;
icca->unit_no = unit_no;
// queue must be started
icca->fault = true;
@@ -156,20 +157,20 @@ void ac_io_emu_icca_dispatch_request(
switch (misc->subcmd) {
case AC_IO_ICCA_SUBCMD_CARD_SLOT_CLOSE:
cmd = EAM_IO_CARD_SLOT_CMD_CLOSE;
cmd = BT_IO_EAM_CARD_SLOT_CMD_CLOSE;
break;
case AC_IO_ICCA_SUBCMD_CARD_SLOT_OPEN:
cmd = EAM_IO_CARD_SLOT_CMD_OPEN;
cmd = BT_IO_EAM_CARD_SLOT_CMD_OPEN;
break;
case AC_IO_ICCA_SUBCMD_CARD_SLOT_EJECT:
cmd = EAM_IO_CARD_SLOT_CMD_EJECT;
cmd = BT_IO_EAM_CARD_SLOT_CMD_EJECT;
icca->engaged = false;
break;
case 3:
cmd = EAM_IO_CARD_SLOT_CMD_READ;
cmd = BT_IO_EAM_CARD_SLOT_CMD_READ;
break;
default:
@@ -182,7 +183,7 @@ void ac_io_emu_icca_dispatch_request(
}
if (cmd != 0xFF) {
if (!eam_io_card_slot_cmd(icca->unit_no, cmd)) {
if (!bt_io_eam_card_slot_cmd_send(icca->unit_no, cmd)) {
log_warning(
"Eamio failed to handle slot cmd %d for node %d",
cmd,
@@ -326,33 +327,34 @@ static void ac_io_emu_icca_send_state(
uint8_t sensor_state;
bool card_full_insert;
if (!eam_io_poll(icca->unit_no)) {
if (!bt_io_eam_poll(icca->unit_no)) {
log_warning("Polling eamio failed");
}
memset(&resp, 0, sizeof(resp));
keypad = eam_io_get_keypad_state(icca->unit_no);
sensor_state = eam_io_get_sensor_state(icca->unit_no);
keypad = bt_io_eam_keypad_state_get(icca->unit_no);
sensor_state = bt_io_eam_sensor_state_get(icca->unit_no);
keypad_rise = keypad & (icca->last_keypad ^ keypad);
card_full_insert = sensor_state & (1 << EAM_IO_SENSOR_FRONT) &&
sensor_state & (1 << EAM_IO_SENSOR_BACK);
card_full_insert = sensor_state & (1 << BT_IO_EAM_SENSOR_STATE_FRONT) &&
sensor_state & (1 << BT_IO_EAM_SENSOR_STATE_BACK);
if (sensor_state != icca->last_sensor) {
if (card_full_insert) {
if (!eam_io_card_slot_cmd(
icca->unit_no, EAM_IO_CARD_SLOT_CMD_READ)) {
if (!bt_io_eam_card_slot_cmd_send(
icca->unit_no, BT_IO_EAM_CARD_SLOT_CMD_READ)) {
log_warning(
"EAM_IO_CARD_SLOT_CMD_READ to unit %d failed",
"BT_IO_EAM_CARD_SLOT_CMD_READ to unit %d failed",
icca->unit_no);
}
icca->card_result =
eam_io_read_card(icca->unit_no, icca->uid, sizeof(icca->uid));
icca->card_result = bt_io_eam_card_read(
icca->unit_no, icca->uid, sizeof(icca->uid));
// fault if sensor says to read but we got no card
icca->fault = (icca->card_result == EAM_IO_CARD_NONE);
icca->fault =
(icca->card_result == BT_IO_EAM_READ_CARD_RESULT_NONE);
} else {
icca->fault = false;
}
@@ -385,11 +387,11 @@ static void ac_io_emu_icca_send_state(
body->sensor_state = 0;
if (sensor_state & (1 << EAM_IO_SENSOR_FRONT)) {
if (sensor_state & (1 << BT_IO_EAM_SENSOR_STATE_FRONT)) {
body->sensor_state |= AC_IO_ICCA_FLAG_FRONT_SENSOR;
}
if (sensor_state & (1 << EAM_IO_SENSOR_BACK)) {
if (sensor_state & (1 << BT_IO_EAM_SENSOR_STATE_BACK)) {
body->sensor_state |= AC_IO_ICCA_FLAG_REAR_SENSOR;
}
+3
View File
@@ -6,6 +6,8 @@
#include "acioemu/emu.h"
#include "api/io/eam.h"
enum ac_io_emu_icca_version {
v150 = 0x5,
v160 = 0x6,
@@ -20,6 +22,7 @@ enum ac_io_emu_icca_version {
struct ac_io_emu_icca {
struct ac_io_emu *emu;
uint8_t unit_no;
bool fault;
bool engaged;
uint8_t last_sensor;
+1 -1
View File
@@ -7,7 +7,7 @@
#include "acio/acio.h"
#include "core/log.h"
#include "iface-core/log.h"
#include "util/iobuf.h"
#include "util/list.h"
-10
View File
@@ -1,10 +0,0 @@
dlls += aciomgr
libs_aciomgr := \
core \
aciodrv \
util \
src_aciomgr := \
dllmain.c \
manager.c \
-12
View File
@@ -1,12 +0,0 @@
LIBRARY aciomgr
EXPORTS
aciomgr_set_loggers
aciomgr_port_init
aciomgr_port_fini
aciomgr_get_node_count
aciomgr_get_node_product_ident
aciomgr_port_submit_packet
aciomgr_port_checkout
aciomgr_port_checkin
DllMain@12 @1 NONAME
-8
View File
@@ -1,8 +0,0 @@
#ifndef ACIOMGR_MANAGER_INIT_H
#define ACIOMGR_MANAGER_INIT_H
// internal, used by DllMain
void _aciomgr_init();
void _aciomgr_fini();
#endif
+1
View File
@@ -6,6 +6,7 @@ libs_aciotest := \
aciodrv \
aciodrv-proc \
util \
iface-core
src_aciotest := \
icca.c \
+5 -6
View File
@@ -17,12 +17,10 @@
#include "core/log-bt-ext.h"
#include "core/log-bt.h"
#include "core/log.h"
#include "core/thread-crt-ext.h"
#include "core/log-sink-std.h"
#include "core/thread-crt.h"
#include "core/thread.h"
#include "core/log.h"
#include "iface-core/log.h"
static uint8_t aciotest_cnt = 0;
static uint8_t bi2a_mode = 255;
@@ -119,10 +117,11 @@ int main(int argc, char **argv)
}
}
core_thread_crt_ext_impl_set();
core_log_bt_ext_impl_set();
core_log_bt_core_api_set();
core_thread_crt_core_api_set();
core_log_bt_ext_init_with_stdout();
core_log_bt_level_set(CORE_LOG_BT_LOG_LEVEL_MISC);
struct aciodrv_device_ctx *device =
aciodrv_device_open_path(argv[1], atoi(argv[2]));
+2 -2
View File
@@ -12,11 +12,11 @@
#include "asio/asio-reghook.h"
#include "core/log.h"
#include "hook/com-proxy.h"
#include "hook/table.h"
#include "iface-core/log.h"
#include "util/defs.h"
#include "util/str.h"
#include "util/time.h"
+3 -3
View File
@@ -1,8 +1,8 @@
#include "asio/config-asio.h"
#include "cconfig/cconfig-util.h"
#include "core/log.h"
#include "asio/config-asio.h"
#include "iface-core/log.h"
#define ASIOHOOK_CONFIG_IO_FORCE_ASIO_KEY "asio.force_asio"
#define ASIOHOOK_CONFIG_IO_FORCE_WASAPI_KEY "asio.force_wasapi"
+13
View File
@@ -0,0 +1,13 @@
avslibs += avs-ext
libs_avs-ext := \
iface-core \
src_avs-ext := \
fs.c \
error.c \
log.c \
property-ext.c \
property-node.c \
property.c \
thread.c \
@@ -1,16 +1,20 @@
#include "avs-util/error.h"
#include "avs-ext/error.h"
#include "util/defs.h"
struct avs_util_avs_error_str {
struct avs_ext_error_str {
avs_error error;
const char *msg;
};
static const char *avs_util_error_unknown = "unknown error";
static const char *_avs_ext_error_unknown = "unknown error";
// Source: https://github.com/spicetools/spicetools
static const struct avs_util_avs_error_str AVS_UTIL_ERRORS[] = {
static const struct avs_ext_error_str _avs_ext_errors[] = {
{0x80070002, "cannot find file or directory"},
{0x80070009, "invalid data type"},
{0x80070012, "TODO unknown error code"},
{0x80070016, "invalid parameter"},
{0x80092000, "invalid type"},
{0x80092001, "type cannot use as array"},
{0x80092002, "invalid"},
@@ -85,25 +89,25 @@ static const struct avs_util_avs_error_str AVS_UTIL_ERRORS[] = {
{0x80092280, "finger-print differs"},
{0x800922C0, "operation is not supported"}};
const char *avs_util_error_str(avs_error error)
const char *avs_ext_error_str(avs_error error)
{
int i;
for (i = 0; i < lengthof(AVS_UTIL_ERRORS); i++) {
if (error == AVS_UTIL_ERRORS[i].error) {
return AVS_UTIL_ERRORS[i].msg;
for (i = 0; i < lengthof(_avs_ext_errors); i++) {
if (error == _avs_ext_errors[i].error) {
return _avs_ext_errors[i].msg;
}
}
return avs_util_error_unknown;
return _avs_ext_error_unknown;
}
const char *avs_util_property_error_get_and_clear(struct property *prop)
const char *avs_ext_property_error_get_and_clear(struct property *prop)
{
avs_error error;
error = property_get_error(prop);
property_clear_error(prop);
return avs_util_error_str(error);
return avs_ext_error_str(error);
}
+10
View File
@@ -0,0 +1,10 @@
#ifndef AVS_EXT_ERROR_H
#define AVS_EXT_ERROR_H
#include "imports/avs.h"
const char *avs_ext_error_str(avs_error error);
const char *avs_ext_error_property_error_get_and_clear(struct property *prop);
#endif
+33
View File
@@ -0,0 +1,33 @@
#define LOG_MODULE "avs-ext-fs"
#include "api/core/log.h"
#include "iface-core/log.h"
#include "imports/avs.h"
void avs_ext_fs_dir_list_log(
const char *path, bt_core_log_message_t log_message)
{
avs_desc desc;
const char *dirent_name;
desc = avs_fs_opendir(path);
if (!desc) {
log_warning("Opening directory '%s' failed", path);
return;
}
log_message(LOG_MODULE, "Directory contents of: %s", path);
dirent_name = avs_fs_readdir(desc);
while (dirent_name != NULL) {
log_message(LOG_MODULE, " %s", dirent_name);
dirent_name = avs_fs_readdir(desc);
}
avs_fs_closedir(desc);
}
+9
View File
@@ -0,0 +1,9 @@
#ifndef AVS_EXT_FS_H
#define AVS_EXT_FS_H
#include "api/core/log.h"
void avs_ext_fs_dir_list_log(
const char *path, bt_core_log_message_t log_message);
#endif
+27
View File
@@ -0,0 +1,27 @@
#include "api/core/log.h"
#include "avs-ext/log.h"
#include "iface-core/log.h"
#include "imports/avs.h"
static void _avs_ext_log_core_api_get(bt_core_log_api_t *api)
{
log_assert(api);
api->version = 1;
api->v1.misc = log_body_misc;
api->v1.info = log_body_info;
api->v1.warning = log_body_warning;
api->v1.fatal = log_body_fatal;
}
void avs_ext_log_core_api_set()
{
bt_core_log_api_t api;
_avs_ext_log_core_api_get(&api);
bt_core_log_api_set(&api);
}
+8
View File
@@ -0,0 +1,8 @@
#ifndef AVS_EXT_LOG_H
#define AVS_EXT_LOG_H
#include "api/core/log.h"
void avs_ext_log_core_api_set();
#endif
+71
View File
@@ -0,0 +1,71 @@
#include "avs-ext/error.h"
#include "avs-ext/property-internal.h"
#include "imports/avs.h"
#include "iface-core/log.h"
#include "main/core/property.h"
#include "util/mem.h"
#include "avs-ext/fs.h"
void avs_ext_property_ext_avs_file_load(
const char *path, core_property_t **property_)
{
avs_desc desc;
void *buffer;
int nbytes;
avs_error error;
struct property *prop;
avs_ext_property_internal_property_t *property;
log_assert(path);
log_assert(property_);
desc = avs_fs_open(path, AVS_FILE_READ, AVS_FILE_FLAG_SHARE_READ);
if (AVS_IS_ERROR(desc)) {
log_fatal(
"%s: Error opening avs property file: %s",
path,
avs_ext_error_str(desc));
}
nbytes = property_read_query_memsize(avs_fs_read, desc, 0, 0);
if (AVS_IS_ERROR(nbytes)) {
log_fatal(
"%s: Error querying avs property file: ",
path,
avs_ext_error_str(nbytes));
}
buffer = xmalloc(nbytes);
prop = property_create(
PROPERTY_FLAG_READ | PROPERTY_FLAG_WRITE | PROPERTY_FLAG_CREATE |
PROPERTY_FLAG_APPEND,
buffer,
nbytes);
avs_fs_lseek(desc, 0, AVS_SEEK_SET);
error = property_insert_read(prop, 0, avs_fs_read, desc);
if (AVS_IS_ERROR(error)) {
log_fatal(
"%s: Error reading avs property file: %s",
path,
avs_ext_error_str(error));
}
avs_fs_close(desc);
*property_ = xmalloc(sizeof(avs_ext_property_internal_property_t));
property = (avs_ext_property_internal_property_t *) *property_;
property->property = prop;
}
+9
View File
@@ -0,0 +1,9 @@
#ifndef AVS_EXT_PROPERTY_EXT_H
#define AVS_EXT_PROPERTY_EXT_H
#include "main/core/property.h"
void avs_ext_property_ext_avs_file_load(
const char *path, core_property_t **property);
#endif
+26
View File
@@ -0,0 +1,26 @@
#ifndef AVS_EXT_PROPERTY_INTERNAL_H
#define AVS_EXT_PROPERTY_INTERNAL_H
#include "core/property-node.h"
#include "core/property.h"
#include "imports/avs.h"
typedef struct avs_ext_property_internal_property {
struct property *property;
} avs_ext_property_internal_property_t;
_Static_assert(
sizeof(avs_ext_property_internal_property_t) <= sizeof(core_property_t),
"Not enough space for stack allocations");
typedef struct avs_ext_property_internal_node {
avs_ext_property_internal_property_t *property;
struct property_node *node;
} avs_ext_property_internal_node_t;
_Static_assert(
sizeof(avs_ext_property_internal_node_t) <= sizeof(core_property_node_t),
"Not enough space for stack allocations");
#endif
File diff suppressed because it is too large Load Diff
+16
View File
@@ -0,0 +1,16 @@
#ifndef AVS_EXT_PROPERTY_NODE_H
#define AVS_EXT_PROPERTY_NODE_H
#include "imports/avs.h"
#include "main/core/property-node.h"
void avs_ext_property_node_core_api_get(core_property_node_api_t *api);
void avs_ext_property_node_core_api_set();
// Don't use this unless you need to interface directly with avs
struct property_node *
avs_ext_property_node_avs_property_node_get(const core_property_node_t *node);
#endif
+389
View File
@@ -0,0 +1,389 @@
#define LOG_MODULE "avs-ext-property"
#include <windows.h>
#include <errno.h>
#include <stdio.h>
#include "avs-ext/error.h"
#include "avs-ext/property-internal.h"
#include "avs-ext/property-node.h"
#include "avs-ext/property.h"
#include "iface-core/log.h"
#include "imports/avs.h"
#include "util/mem.h"
#define AVS_PROPERTY_STRUCTURE_META_SIZE 576
typedef void (*avs_ext_property_rewinder_t)(uint32_t context);
struct avs_ext_property_str_read_handle {
const char *buffer;
size_t buffer_len;
size_t offset;
};
static void _avs_ext_property_free(core_property_t **property_);
static size_t
_avs_ext_property_str_read(uint32_t context, void *bytes, size_t nbytes)
{
int result;
struct avs_ext_property_str_read_handle *handle;
result = 0;
handle = TlsGetValue(context);
if (handle->offset < handle->buffer_len) {
result = min(nbytes, handle->buffer_len - handle->offset);
memcpy(bytes, (const void *) (handle->buffer + handle->offset), result);
handle->offset += result;
}
return result;
}
static void _avs_ext_property_str_rewind(uint32_t context)
{
struct avs_ext_property_str_read_handle *handle;
handle = TlsGetValue(context);
handle->offset = 0;
}
static size_t
_avs_ext_property_fread(uint32_t context, void *bytes, size_t nbytes)
{
FILE *f;
f = TlsGetValue(context);
return fread(bytes, 1, nbytes, f);
}
static void _avs_ext_property_frewind(uint32_t context)
{
FILE *f = TlsGetValue(context);
rewind(f);
}
static core_property_result_t _avs_ext_property_do_load(
avs_reader_t reader,
avs_ext_property_rewinder_t rewinder,
uint32_t context,
const char *name,
avs_ext_property_internal_property_t **property)
{
struct property *prop;
void *buffer;
int nbytes;
nbytes = property_read_query_memsize(reader, context, 0, 0);
if (nbytes < 0) {
return CORE_PROPERTY_RESULT_ERROR_INTERNAL;
}
buffer = xmalloc(nbytes);
prop = property_create(
PROPERTY_FLAG_READ | PROPERTY_FLAG_WRITE | PROPERTY_FLAG_CREATE |
PROPERTY_FLAG_APPEND,
buffer,
nbytes);
if (!prop) {
free(buffer);
return CORE_PROPERTY_RESULT_ERROR_ALLOC;
}
rewinder(context);
if (!property_insert_read(prop, 0, reader, context)) {
property_destroy(prop);
free(buffer);
return CORE_PROPERTY_RESULT_ERROR_READ;
}
*property = xmalloc(sizeof(avs_ext_property_internal_property_t));
(*property)->property = prop;
return CORE_PROPERTY_RESULT_SUCCESS;
}
static core_property_result_t
_avs_ext_property_create(size_t size, core_property_t **property_)
{
avs_ext_property_internal_property_t *property;
void *buffer;
struct property *prop;
if (size > UINT32_MAX) {
return CORE_PROPERTY_RESULT_ERROR_INTERNAL;
}
buffer = xmalloc(size);
prop = property_create(
PROPERTY_FLAG_READ | PROPERTY_FLAG_WRITE | PROPERTY_FLAG_CREATE |
PROPERTY_FLAG_APPEND,
buffer,
(uint32_t) size);
if (!prop) {
free(buffer);
return CORE_PROPERTY_RESULT_ERROR_ALLOC;
}
*property_ = xmalloc(sizeof(core_property_t));
property = (avs_ext_property_internal_property_t *) (*property_);
property->property = prop;
return CORE_PROPERTY_RESULT_SUCCESS;
}
static core_property_result_t
_avs_ext_property_file_load(const char *path, core_property_t **property)
{
FILE *file;
uint32_t f_keyhole;
core_property_result_t result;
file = fopen(path, "r");
if (!file) {
switch (errno) {
case EACCES:
return CORE_PROPERTY_RESULT_ERROR_PERMISSIONS;
case ENOENT:
return CORE_PROPERTY_RESULT_NOT_FOUND;
default:
return CORE_PROPERTY_RESULT_ERROR_INTERNAL;
}
}
/* AVS callbacks are only given a 32-bit context parameter, even in 64-bit
builds of AVS. We allocate a 32-bit TLS key and pass the context in this
manner instead. Inefficient, but it works. */
f_keyhole = TlsAlloc();
TlsSetValue(f_keyhole, file);
result = _avs_ext_property_do_load(
_avs_ext_property_fread,
_avs_ext_property_frewind,
f_keyhole,
path,
(avs_ext_property_internal_property_t **) property);
TlsFree(f_keyhole);
fclose(file);
return result;
}
static core_property_result_t
_avs_ext_property_str_load(const char *str, core_property_t **property)
{
struct avs_ext_property_str_read_handle read_handle;
uint32_t s_keyhole;
core_property_result_t result;
read_handle.buffer = str;
read_handle.buffer_len = strlen(str);
read_handle.offset = 0;
s_keyhole = TlsAlloc();
TlsSetValue(s_keyhole, &read_handle);
result = _avs_ext_property_do_load(
_avs_ext_property_str_read,
_avs_ext_property_str_rewind,
s_keyhole,
"<string>",
(avs_ext_property_internal_property_t **) property);
TlsFree(s_keyhole);
return result;
}
static core_property_result_t
_avs_ext_property_size(const core_property_t *property_, size_t *size)
{
avs_ext_property_internal_property_t *property;
avs_error error;
property = (avs_ext_property_internal_property_t *) property_;
// Returns the size of the actual data in the property structure only
// Hence, using that size only, allocating another buffer for a copy
// of this might fail or copying the data will fail because the buffer
// is too small
error = property_query_size(property->property);
if (AVS_IS_ERROR(error)) {
return CORE_PROPERTY_RESULT_ERROR_INTERNAL;
}
// Hack: *2 to have enough space and not cut off data when cloning/copying
// property data because...reasons? I haven't figured this one out and
// there doesn't seem to be an actual API call for that to return the
// "true" size that allows the caller to figure out how much memory
// they have to allocate to create a copy of the property structure
// with property_create and
*size = (AVS_PROPERTY_STRUCTURE_META_SIZE + error) * 2;
return CORE_PROPERTY_RESULT_SUCCESS;
}
static core_property_result_t _avs_ext_property_clone(
const core_property_t *property_, core_property_t **property_cloned_)
{
avs_ext_property_internal_property_t *property;
avs_ext_property_internal_property_t *property_cloned;
size_t size;
core_property_result_t result;
struct property_node *node;
avs_error error;
property = (avs_ext_property_internal_property_t *) property_;
result = _avs_ext_property_size(property_, &size);
if (CORE_PROPERTY_RESULT_IS_ERROR(result)) {
return result;
}
result = _avs_ext_property_create(size, property_cloned_);
property_cloned =
(avs_ext_property_internal_property_t *) *property_cloned_;
if (CORE_PROPERTY_RESULT_IS_ERROR(result)) {
return result;
}
node = property_search(property->property, NULL, "/");
if (!node) {
error = property_get_error(property_cloned->property);
if (AVS_IS_ERROR(error)) {
_avs_ext_property_free(property_cloned_);
return CORE_PROPERTY_RESULT_ERROR_INTERNAL;
}
}
if (!property_node_clone(property_cloned->property, NULL, node, true)) {
error = property_get_error(property_cloned->property);
if (AVS_IS_ERROR(error)) {
_avs_ext_property_free(property_cloned_);
return CORE_PROPERTY_RESULT_ERROR_INTERNAL;
}
}
return CORE_PROPERTY_RESULT_SUCCESS;
}
static void _avs_ext_property_log(
const core_property_t *property_, bt_core_log_message_t log_message)
{
avs_ext_property_internal_node_t node;
core_property_node_api_t node_api;
node.property = (avs_ext_property_internal_property_t *) (property_);
node.node = property_search(node.property->property, NULL, "/");
if (node.node == NULL) {
log_message(LOG_MODULE, "<EMPTY>");
return;
}
avs_ext_property_node_core_api_get(&node_api);
node_api.v1.log((const core_property_node_t *) &node, log_message);
}
static core_property_result_t _avs_ext_property_root_node_get(
const core_property_t *property_, core_property_node_t *node_)
{
avs_ext_property_internal_property_t *property;
avs_ext_property_internal_node_t *node;
property = (avs_ext_property_internal_property_t *) property_;
node = (avs_ext_property_internal_node_t *) node_;
memset(node, 0, sizeof(avs_ext_property_internal_node_t));
node->property = property;
node->node = property_search(property->property, NULL, "/");
if (node->node == NULL) {
return CORE_PROPERTY_RESULT_NOT_FOUND;
} else {
return CORE_PROPERTY_RESULT_SUCCESS;
}
}
static core_property_result_t _avs_ext_property_other_node_insert(
core_property_t *property_, const core_property_node_t *node_)
{
avs_ext_property_internal_property_t *property;
avs_ext_property_internal_node_t *node;
property = (avs_ext_property_internal_property_t *) property_;
node = (avs_ext_property_internal_node_t *) node_;
if (!property_node_clone(property->property, NULL, node->node, true)) {
return CORE_PROPERTY_NODE_RESULT_ERROR_INTERNAL;
} else {
return CORE_PROPERTY_NODE_RESULT_SUCCESS;
}
}
static void _avs_ext_property_free(core_property_t **property_)
{
avs_ext_property_internal_property_t *property;
void *buffer;
property = (avs_ext_property_internal_property_t *) (*property_);
buffer = property_desc_to_buffer(property->property);
property_destroy(property->property);
free(buffer);
free(*property_);
*property_ = NULL;
}
static void _avs_ext_property_core_api_get(core_property_api_t *api)
{
log_assert(api);
api->version = 1;
api->v1.create = _avs_ext_property_create;
api->v1.file_load = _avs_ext_property_file_load;
api->v1.str_load = _avs_ext_property_str_load;
api->v1.size = _avs_ext_property_size;
api->v1.clone = _avs_ext_property_clone;
api->v1.log = _avs_ext_property_log;
api->v1.root_node_get = _avs_ext_property_root_node_get;
api->v1.other_node_insert = _avs_ext_property_other_node_insert;
api->v1.free = _avs_ext_property_free;
}
void avs_ext_property_core_api_set()
{
core_property_api_t api;
_avs_ext_property_core_api_get(&api);
core_property_api_set(&api);
}
+8
View File
@@ -0,0 +1,8 @@
#ifndef AVS_EXT_PROPERTY_H
#define AVS_EXT_PROPERTY_H
#include "main/core/property.h"
void avs_ext_property_core_api_set();
#endif
+56
View File
@@ -0,0 +1,56 @@
#include "api/core/thread.h"
#include "api/core/log.h"
#include "avs-ext/thread.h"
#include "iface-core/log.h"
#include "iface-core/thread.h"
#include "imports/avs.h"
static bt_core_thread_result_t _avs_ext_thread_create(
int (*proc)(void *),
void *ctx,
uint32_t stack_sz,
unsigned int priority,
bt_core_thread_id_t *thread_id)
{
*thread_id = avs_thread_create(proc, ctx, stack_sz, priority);
return BT_CORE_THREAD_RESULT_SUCCESS;
}
static bt_core_thread_result_t
_avs_ext_thread_join(bt_core_thread_id_t thread_id, int *result)
{
avs_thread_join(thread_id, result);
return BT_CORE_THREAD_RESULT_SUCCESS;
}
static bt_core_thread_result_t
_avs_ext_thread_destroy(bt_core_thread_id_t thread_id)
{
avs_thread_destroy(thread_id);
return BT_CORE_THREAD_RESULT_SUCCESS;
}
static void _avs_ext_thread_core_api_get(bt_core_thread_api_t *api)
{
log_assert(api);
api->version = 1;
api->v1.create = _avs_ext_thread_create;
api->v1.join = _avs_ext_thread_join;
api->v1.destroy = _avs_ext_thread_destroy;
}
void avs_ext_thread_core_api_set()
{
bt_core_thread_api_t api;
_avs_ext_thread_core_api_get(&api);
bt_core_thread_api_set(&api);
}
+8
View File
@@ -0,0 +1,8 @@
#ifndef AVS_EXT_THREAD_H
#define AVS_EXT_THREAD_H
#include "api/core/thread.h"
void avs_ext_thread_core_api_set();
#endif
-7
View File
@@ -1,7 +0,0 @@
libs += avs-util
libs_avs-util := \
src_avs-util := \
core-interop.c \
error.c \
-16
View File
@@ -1,16 +0,0 @@
#include "core/log.h"
#include "core/thread.h"
#include "imports/avs.h"
void avs_util_core_interop_log_avs_impl_set()
{
core_log_impl_set(
log_body_misc, log_body_info, log_body_warning, log_body_fatal);
}
void avs_util_core_interop_thread_avs_impl_set()
{
core_thread_impl_set(
avs_thread_create, avs_thread_join, avs_thread_destroy);
}
-7
View File
@@ -1,7 +0,0 @@
#ifndef AVS_UTIL_CORE_INTEROP_H
#define AVS_UTIL_CORE_INTEROP_H
void avs_util_core_interop_log_avs_impl_set();
void avs_util_core_interop_thread_avs_impl_set();
#endif
-10
View File
@@ -1,10 +0,0 @@
#ifndef AVS_UTIL_ERROR_H
#define AVS_UTIL_ERROR_H
#include "imports/avs.h"
const char *avs_util_error_str(avs_error error);
const char *avs_util_property_error_get_and_clear(struct property *prop);
#endif
-54
View File
@@ -1,54 +0,0 @@
#ifndef BEMANITOOLS_SDVXIO_H
#define BEMANITOOLS_SDVXIO_H
/* IO emulation provider for BeatStream */
#include <stdbool.h>
#include <stdint.h>
#include "bemanitools/glue.h"
enum bst_io_in_gpio_sys_bit {
SDVX_IO_IN_GPIO_SYS_COIN = 2,
SDVX_IO_IN_GPIO_SYS_TEST = 4,
SDVX_IO_IN_GPIO_SYS_SERVICE = 5,
};
/* The first function that will be called on your DLL. You will be supplied
with four function pointers that may be used to log messages to the game's
log file. See comments in glue.h for further information. */
void bst_io_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal);
/* Initialize your BST IO emulation DLL. Thread management functions are
provided to you; you must use these functions to create your own threads if
you want to make use of the logging functions that are provided to
eam_io_set_loggers(). You will also need to pass these thread management
functions on to geninput if you intend to make use of that library.
See glue.h and geninput.h for further details. */
bool bst_io_init(
thread_create_t thread_create,
thread_join_t thread_join,
thread_destroy_t thread_destroy);
/* Shut down your SDVX IO emulation DLL */
void bst_io_fini(void);
/* Read input state. Returns true if successful. */
bool bst_io_read_input(void);
/* Get state of coin, test, service inputs */
uint8_t bst_io_get_input(void);
// TODO: Lighting
#endif
-129
View File
@@ -1,129 +0,0 @@
#ifndef BEMANITOOLS_DDRIO_H
#define BEMANITOOLS_DDRIO_H
#include <stdbool.h>
#include <stdint.h>
#include "bemanitools/glue.h"
enum ddr_pad_bit {
DDR_TEST = 0x04,
DDR_COIN = 0x05,
DDR_SERVICE = 0x06,
DDR_P2_START = 0x08,
DDR_P2_UP = 0x09,
DDR_P2_DOWN = 0x0A,
DDR_P2_LEFT = 0x0B,
DDR_P2_RIGHT = 0x0C,
DDR_P2_MENU_LEFT = 0x0E,
DDR_P2_MENU_RIGHT = 0x0F,
DDR_P2_MENU_UP = 0x02,
DDR_P2_MENU_DOWN = 0x03,
DDR_P1_START = 0x10,
DDR_P1_UP = 0x11,
DDR_P1_DOWN = 0x12,
DDR_P1_LEFT = 0x13,
DDR_P1_RIGHT = 0x14,
DDR_P1_MENU_LEFT = 0x16,
DDR_P1_MENU_RIGHT = 0x17,
DDR_P1_MENU_UP = 0x00,
DDR_P1_MENU_DOWN = 0x01,
};
// see the functions below for more information
enum p3io_light_bit {
LIGHT_P1_MENU = 0x00,
LIGHT_P2_MENU = 0x01,
LIGHT_P2_LOWER_LAMP = 0x04,
LIGHT_P2_UPPER_LAMP = 0x05,
LIGHT_P1_LOWER_LAMP = 0x06,
LIGHT_P1_UPPER_LAMP = 0x07,
};
enum hdxs_light_bit {
LIGHT_HD_P1_START = 0x08,
LIGHT_HD_P1_UP_DOWN = 0x09,
LIGHT_HD_P1_LEFT_RIGHT = 0x0A,
LIGHT_HD_P2_START = 0x0B,
LIGHT_HD_P2_UP_DOWN = 0x0C,
LIGHT_HD_P2_LEFT_RIGHT = 0x0D,
};
// the indexing starts from 0x20 if you're looking in geninput
enum hdxs_rgb_light_idx {
LIGHT_HD_P1_SPEAKER_F_R = 0x00,
LIGHT_HD_P1_SPEAKER_F_G = 0x01,
LIGHT_HD_P1_SPEAKER_F_B = 0x02,
LIGHT_HD_P2_SPEAKER_F_R = 0x03,
LIGHT_HD_P2_SPEAKER_F_G = 0x04,
LIGHT_HD_P2_SPEAKER_F_B = 0x05,
LIGHT_HD_P1_SPEAKER_W_R = 0x06,
LIGHT_HD_P1_SPEAKER_W_G = 0x07,
LIGHT_HD_P1_SPEAKER_W_B = 0x08,
LIGHT_HD_P2_SPEAKER_W_R = 0x09,
LIGHT_HD_P2_SPEAKER_W_G = 0x0A,
LIGHT_HD_P2_SPEAKER_W_B = 0x0B,
};
enum extio_light_bit {
LIGHT_NEONS = 0x0E,
LIGHT_P2_RIGHT = 0x13,
LIGHT_P2_LEFT = 0x14,
LIGHT_P2_DOWN = 0x15,
LIGHT_P2_UP = 0x16,
LIGHT_P1_RIGHT = 0x1B,
LIGHT_P1_LEFT = 0x1C,
LIGHT_P1_DOWN = 0x1D,
LIGHT_P1_UP = 0x1E
};
/* The first function that will be called on your DLL. You will be supplied
with four function pointers that may be used to log messages to the game's
log file. See comments in glue.h for further information. */
void ddr_io_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal);
/* Initialize your DDR IO emulation DLL. Thread management functions are
provided to you; you must use these functions to create your own threads if
you want to make use of the logging functions that are provided to
eam_io_set_loggers(). You will also need to pass these thread management
functions on to geninput if you intend to make use of that library.
See glue.h and geninput.h for further details. */
bool ddr_io_init(
thread_create_t thread_create,
thread_join_t thread_join,
thread_destroy_t thread_destroy);
/* used to poll the IO for input, note that this is also where lights are
flushed to the device for geninput */
uint32_t ddr_io_read_pad(void);
/* The following are optional to implement, and allow lights to be set and
emulated as needed */
/* used to set pad lights, as well as the bass neon on SD cabs */
void ddr_io_set_lights_extio(uint32_t extio_lights);
/* used to set SD panel lights, and HD spot lights */
void ddr_io_set_lights_p3io(uint32_t p3io_lights);
/* used to set HD cab front panel lights */
void ddr_io_set_lights_hdxs_panel(uint32_t hdxs_lights);
/* used to set HD cab speaker RGB lights */
void ddr_io_set_lights_hdxs_rgb(uint8_t idx, uint8_t r, uint8_t g, uint8_t b);
void ddr_io_fini(void);
#endif
-137
View File
@@ -1,137 +0,0 @@
#ifndef BEMANITOOLS_EAM_H
#define BEMANITOOLS_EAM_H
/* Card reader emulator API. You may replace the stock EAMIO.DLL supplied by
Bemanitools with your own custom implementation, which should implement the
interface contract defined in this header file. */
#include <stdbool.h>
#include <stdint.h>
#include "bemanitools/glue.h"
/* Scan codes for the so-called "10 key" button panel on each card reader. Each
scan code corresponds to a bit position within the 16-bit bitfield that you
return from eam_io_get_keypad_state(). */
enum eam_io_keypad_scan_code {
EAM_IO_KEYPAD_0 = 0,
EAM_IO_KEYPAD_1 = 1,
EAM_IO_KEYPAD_4 = 2,
EAM_IO_KEYPAD_7 = 3,
EAM_IO_KEYPAD_00 = 4,
EAM_IO_KEYPAD_2 = 5,
EAM_IO_KEYPAD_5 = 6,
EAM_IO_KEYPAD_8 = 7,
EAM_IO_KEYPAD_DECIMAL = 8,
EAM_IO_KEYPAD_3 = 9,
EAM_IO_KEYPAD_6 = 10,
EAM_IO_KEYPAD_9 = 11,
EAM_IO_KEYPAD_COUNT = 12, /* Not an actual scan code */
};
/* Emulating the sensors of a slotted card reader. The reader has one
sensor at the front that detects if a card is getting inserted or
if the card is not fully removed. When the back sensor is triggered
the card is locked in the slot and its data is read. */
enum eam_io_sensor_state {
EAM_IO_SENSOR_FRONT = 0,
EAM_IO_SENSOR_BACK = 1,
};
/* Different commands for the (slotted) reader. The game triggers one
of these actions and the card slot as to execute it. When non-slotted
readers are emulated, these states are not used/set. */
enum eam_io_card_slot_cmd {
EAM_IO_CARD_SLOT_CMD_CLOSE = 0,
EAM_IO_CARD_SLOT_CMD_OPEN = 1,
EAM_IO_CARD_SLOT_CMD_EJECT = 2,
EAM_IO_CARD_SLOT_CMD_READ = 3,
};
/* Emulating of the card type for new readers. */
enum eam_io_read_card_result {
EAM_IO_CARD_NONE = 0,
EAM_IO_CARD_ISO15696 = 1,
EAM_IO_CARD_FELICA = 2,
};
/* A private function pointer table returned by the stock EAMIO.DLL
implementation and consumed by config.exe. The contents of this table are
undocumented and subject to change without notice. */
struct eam_io_config_api;
/* The first function that will be called on your DLL. You will be supplied
with four function pointers that may be used to log messages to the game's
log file. See comments in glue.h for further information. */
void eam_io_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal);
/* Initialize your card reader emulation DLL. Thread management functions are
provided to you; you must use these functions to create your own threads if
you want to make use of the logging functions that are provided to
eam_io_set_loggers(). You will also need to pass these thread management
functions on to geninput if you intend to make use of that library.
See glue.h and geninput.h for further details. */
bool eam_io_init(
thread_create_t thread_create,
thread_join_t thread_join,
thread_destroy_t thread_destroy);
/* Shut down your card reader emulation DLL. */
void eam_io_fini(void);
/* Return the state of the number pad on your reader. This function will be
called frequently. See enum eam_io_keypad_scan_code above for the meaning of
each bit within the return value.
This function will be called even if the running game does not actually have
a number pad on the real cabinet (e.g. Jubeat).
unit_no is either 0 or 1. Games with only a single reader (jubeat, popn,
drummania) will only use unit_no 0. */
uint16_t eam_io_get_keypad_state(uint8_t unit_no);
/* Indicate which sensors (front and back) are triggered for a slotted reader
(refer to enum). To emulate non-slotted readers, just set both sensors
to on to indicate the card is in range of the reader. This function
will be called frequently. */
uint8_t eam_io_get_sensor_state(uint8_t unit_no);
/* Read a card ID. This function is only called when the return value of
eam_io_get_sensor_state() changes from false to true, so you may take your
time and perform file I/O etc, within reason. You must return exactly eight
bytes into the buffer pointed to by card_id. */
uint8_t eam_io_read_card(uint8_t unit_no, uint8_t *card_id, uint8_t nbytes);
/* Send a command to the card slot. This is called by the game to execute
certain actions on a slotted reader (refer to enum). When emulating
wave pass readers, this is function is never called. */
bool eam_io_card_slot_cmd(uint8_t unit_no, uint8_t cmd);
/* This function is called frequently. Update your device and states in here */
bool eam_io_poll(uint8_t unit_no);
/* Return a pointer to an internal configuration API for use by config.exe.
Custom implementations should return NULL. */
const struct eam_io_config_api *eam_io_get_config_api(void);
#endif
-47
View File
@@ -1,47 +0,0 @@
#ifndef BEMANITOOLS_GLUE_H
#define BEMANITOOLS_GLUE_H
/* Common definitions for integration bindings */
#include <stdint.h>
#ifdef __GNUC__
/* Bemanitools is compiled with GCC (MinGW, specifically) as of version 5 */
#define LOG_CHECK_FMT __attribute__((format(printf, 2, 3)))
#else
/* Compile it out for MSVC plebs */
#define LOG_CHECK_FMT
#endif
/* An AVS-style logger function. Comes in four flavors: misc, info, warning,
and fatal, with increasing severity. Fatal loggers do not return, they
abort the running process after writing their message to the log.
"module" is an arbitrary short string identifying the source of the log
message. The name of the calling DLL is a good default choice for this
string, although you might want to identify a module within your DLL here
instead.
"fmt" is a printf-style format string. Depending on the context in which
your DLL is running you might end up calling a logger function exported
from libavs, which has its own printf implementation (including a number of
proprietary extensions), so don't use any overly exotic formats. */
typedef void (*log_formatter_t)(const char *module, const char *fmt, ...)
LOG_CHECK_FMT;
/* An API for spawning threads. This API is defined by libavs, although
Bemanitools itself may supply compatible implementations of these functions
to your DLL, depending on the context in which it runs.
NOTE: You may only use the logging functions from a thread where Bemanitools
calls you, or a thread that you create using this API. Failure to observe
this restriction will cause the process to crash. This is a limitation of
libavs itself, not Bemanitools. */
typedef int (*thread_create_t)(
int (*proc)(void *), void *ctx, uint32_t stack_sz, unsigned int priority);
typedef void (*thread_join_t)(int thread_id, int *result);
typedef void (*thread_destroy_t)(int thread_id);
#endif
-174
View File
@@ -1,174 +0,0 @@
#ifndef BEMANITOOLS_IIDXIO_H
#define BEMANITOOLS_IIDXIO_H
/* IO emulation provider for beatmania IIDX. */
#include <stdbool.h>
#include <stdint.h>
#include "bemanitools/glue.h"
/* Bit mapping for the "pad" word */
enum iidx_io_sys_bit {
IIDX_IO_SYS_TEST = 0x00,
IIDX_IO_SYS_SERVICE = 0x01,
IIDX_IO_SYS_COIN = 0x02
};
enum iidx_io_panel_bit {
IIDX_IO_PANEL_P1_START = 0x00,
IIDX_IO_PANEL_P2_START = 0x01,
IIDX_IO_PANEL_VEFX = 0x02,
IIDX_IO_PANEL_EFFECT = 0x03
};
enum iidx_io_key_bit {
IIDX_IO_KEY_P1_1 = 0x00,
IIDX_IO_KEY_P1_2 = 0x01,
IIDX_IO_KEY_P1_3 = 0x02,
IIDX_IO_KEY_P1_4 = 0x03,
IIDX_IO_KEY_P1_5 = 0x04,
IIDX_IO_KEY_P1_6 = 0x05,
IIDX_IO_KEY_P1_7 = 0x06,
IIDX_IO_KEY_P2_1 = 0x07,
IIDX_IO_KEY_P2_2 = 0x08,
IIDX_IO_KEY_P2_3 = 0x09,
IIDX_IO_KEY_P2_4 = 0x0A,
IIDX_IO_KEY_P2_5 = 0x0B,
IIDX_IO_KEY_P2_6 = 0x0C,
IIDX_IO_KEY_P2_7 = 0x0D
};
/* Bit mapping for the P1 and P2 deck lights */
enum iidx_io_deck_light {
IIDX_IO_DECK_LIGHT_P1_1 = 0,
IIDX_IO_DECK_LIGHT_P1_2 = 1,
IIDX_IO_DECK_LIGHT_P1_3 = 2,
IIDX_IO_DECK_LIGHT_P1_4 = 3,
IIDX_IO_DECK_LIGHT_P1_5 = 4,
IIDX_IO_DECK_LIGHT_P1_6 = 5,
IIDX_IO_DECK_LIGHT_P1_7 = 6,
IIDX_IO_DECK_LIGHT_P2_1 = 8,
IIDX_IO_DECK_LIGHT_P2_2 = 9,
IIDX_IO_DECK_LIGHT_P2_3 = 10,
IIDX_IO_DECK_LIGHT_P2_4 = 11,
IIDX_IO_DECK_LIGHT_P2_5 = 12,
IIDX_IO_DECK_LIGHT_P2_6 = 13,
IIDX_IO_DECK_LIGHT_P2_7 = 14,
};
/* Bit mapping for the front panel lights */
enum iidx_io_panel_light {
IIDX_IO_PANEL_LIGHT_P1_START = 0,
IIDX_IO_PANEL_LIGHT_P2_START = 1,
IIDX_IO_PANEL_LIGHT_VEFX = 2,
IIDX_IO_PANEL_LIGHT_EFFECT = 3,
};
/* Bit mapping for the top lamps from left to right when facing cabinet screen
*/
enum iidx_io_top_lamp {
IIDX_IO_TOP_LAMP_LEFT_BLUE = 0,
IIDX_IO_TOP_LAMP_LEFT_GREEN = 1,
IIDX_IO_TOP_LAMP_LEFT_YELLOW = 2,
IIDX_IO_TOP_LAMP_LEFT_RED = 3,
IIDX_IO_TOP_LAMP_RIGHT_BLUE = 4,
IIDX_IO_TOP_LAMP_RIGHT_GREEN = 5,
IIDX_IO_TOP_LAMP_RIGHT_YELLOW = 6,
IIDX_IO_TOP_LAMP_RIGHT_RED = 7,
};
/* The first function that will be called on your DLL. You will be supplied
with four function pointers that may be used to log messages to the game's
log file. See comments in glue.h for further information. */
void iidx_io_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal);
/* Initialize your IIDX IO emulation DLL. Thread management functions are
provided to you; you must use these functions to create your own threads if
you want to make use of the logging functions that are provided to
eam_io_set_loggers(). You will also need to pass these thread management
functions on to geninput if you intend to make use of that library.
See glue.h and geninput.h for further details. */
bool iidx_io_init(
thread_create_t thread_create,
thread_join_t thread_join,
thread_destroy_t thread_destroy);
/* Shut down your IIDX IO emulation DLL */
void iidx_io_fini(void);
/* Set the deck lighting state. See enum iidx_io_deck_light above. */
void iidx_io_ep1_set_deck_lights(uint16_t deck_lights);
/* Set front panel lighting state. See enum iidx_io_panel_light above. */
void iidx_io_ep1_set_panel_lights(uint8_t panel_lights);
/* Set state of the eight halogens above the marquee. */
void iidx_io_ep1_set_top_lamps(uint8_t top_lamps);
/* Switch the top neons on or off. */
void iidx_io_ep1_set_top_neons(bool top_neons);
/* Transmit the lighting state to the lighting controller. This function is
called immediately after all of the other iidx_io_ep1_set_*() functions.
Return false in the event of an IO error. This will lock the game into an
IO error screen. */
bool iidx_io_ep1_send(void);
/* Read input state from the input controller. This function is called
immediately before all of the iidx_io_ep2_get_*() functions.
Return false in the event of an IO error. This will lock the game into an
IO error screen. */
bool iidx_io_ep2_recv(void);
/* Get absolute turntable position, expressed in 1/256ths of a rotation.
player_no is either 0 or 1. */
uint8_t iidx_io_ep2_get_turntable(uint8_t player_no);
/* Get slider position, where 0 is the bottom position and 15 is the topmost
position. slider_no is a number between 0 (leftmost) and 4 (rightmost). */
uint8_t iidx_io_ep2_get_slider(uint8_t slider_no);
/* Get the state of the system buttons. See enums above. */
uint8_t iidx_io_ep2_get_sys(void);
/* Get the state of the panel buttons. See enums above. */
uint8_t iidx_io_ep2_get_panel(void);
/* Get the state of the 14 key buttons. See enums above. */
uint16_t iidx_io_ep2_get_keys(void);
/* Write a nine-character string to the 16-segment display. This happens on a
different schedule to all of the other IO operations, so you should initiate
the communication as soon as this function is called */
bool iidx_io_ep3_write_16seg(const char *text);
#endif
-92
View File
@@ -1,92 +0,0 @@
#ifndef BEMANITOOLS_INPUT_H
#define BEMANITOOLS_INPUT_H
/* Generic input API. This header file defines the public API for geninput.dll.
You may use geninput to supply generic input mapping services for controls
that your custom IO DLLs do not natively provide. For instance, you might
want to make a custom IIDXIO.DLL that interfaces with your own 16-segment
LCD marquee device while still using the stock IIDXIO.DLL input and lighting
code, which uses the generic services provided by geninput.dll.
All other exports from geninput.dll are undocumented and subject to change
without notice. */
#include <stdbool.h>
#include <stdint.h>
#include "bemanitools/glue.h"
/* Supply logging functions to geninput. You should pass on the logging
functions that are supplied to your own custom DLLs.
This is the only function that can safely be called before input_init(). */
void input_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal);
/* Initialize the generic input subsystem. You must pass on the thread
management functions that have been supplied to your DLL.
Calling any geninput functions other than input_set_loggers() before calling
input_init() will probably crash the running process.
You will also need to call mapper_config_load() with the appropriate
game_type parameter, otherwise you will not receive any input, and any
attempts to set a light output level will have no effect. */
void input_init(
thread_create_t thread_create,
thread_join_t thread_join,
thread_destroy_t thread_destroy);
/* Shut down the generic input subsystem. After calling this function, no
geninput functions other than input_set_loggers() or input_init() may be
called. */
void input_fini(void);
/* Load input mappings for a particular game, as configured from config.exe.
Currently recognized game types are:
ddr: Dance Dance Revolution
dm: Drum Mania
gf: Guitar Freaks
iidx: beatmania IIDX
pnm: pop'n music
sdvx: Sound Voltex
ju: jubeat
Returns true if a suitable config file was found and successfully loaded. */
bool mapper_config_load(const char *game_type);
/* Return the absolute position of an analog spinner, expressed in 1/256ths of
a complete rotation. */
uint8_t mapper_read_analog(uint8_t analog);
/* Map the current state of all attached input devices to a 64-bit bit field.
The exact layout of this bit field varies between game types, although we
try to approximate the contents of each emulated IO PCB's own state packet
as closely as is reasonably practical. */
uint64_t mapper_update(void);
/* Set the intensity of any light on a controller corresponding to a particular
software-controlled light on an arcade cabinet, where 0 is off and 255 is
full intensity. Consult the header files for the light identifiers used for
each game type. The mappings between these light identifiers and the actual
lights on the user's controller (if any) are configured by the user by means
of the config.exe program.
Note that any calls to this function do not take effect until the next call
to mapper_update(). */
void mapper_write_light(uint8_t light, uint8_t intensity);
#endif
-120
View File
@@ -1,120 +0,0 @@
#ifndef BEMANITOOLS_JBIO_H
#define BEMANITOOLS_JBIO_H
/* IO emulation provider for jubeat. */
#include <stdbool.h>
#include <stdint.h>
#include "bemanitools/glue.h"
/* input bit mappings. Panels on the controller are
panel 1 top left corner down to panel 16 bottom right corner */
enum jb_io_panel_bit {
JB_IO_PANEL_01 = 0x00,
JB_IO_PANEL_02 = 0x01,
JB_IO_PANEL_03 = 0x02,
JB_IO_PANEL_04 = 0x03,
JB_IO_PANEL_05 = 0x04,
JB_IO_PANEL_06 = 0x05,
JB_IO_PANEL_07 = 0x06,
JB_IO_PANEL_08 = 0x07,
JB_IO_PANEL_09 = 0x08,
JB_IO_PANEL_10 = 0x09,
JB_IO_PANEL_11 = 0x0A,
JB_IO_PANEL_12 = 0x0B,
JB_IO_PANEL_13 = 0x0C,
JB_IO_PANEL_14 = 0x0D,
JB_IO_PANEL_15 = 0x0E,
JB_IO_PANEL_16 = 0x0F,
};
/* input "single button mode" mappings. Allows you to check each corner of each
button to determine any flaky inputs
*/
enum jb_io_panel_mode {
JB_IO_PANEL_MODE_ALL = 0, // any of the four corners will trigger a panel
JB_IO_PANEL_MODE_TOP_LEFT = 1,
JB_IO_PANEL_MODE_TOP_RIGHT = 2,
JB_IO_PANEL_MODE_BOTTOM_RIGHT = 3,
JB_IO_PANEL_MODE_BOTTOM_LEFT = 4,
};
/* Bit mappings for "system" inputs */
enum jb_io_sys_bit {
JB_IO_SYS_TEST = 0x00,
JB_IO_SYS_SERVICE = 0x01,
JB_IO_SYS_COIN = 0x02,
};
/* RGB led units to address */
enum jb_io_rgb_led {
JB_IO_RGB_LED_FRONT = 0,
JB_IO_RGB_LED_TOP = 1,
JB_IO_RGB_LED_LEFT = 2,
JB_IO_RGB_LED_RIGHT = 3,
JB_IO_RGB_LED_TITLE = 4,
JB_IO_RGB_LED_WOOFER = 5
};
/* The first function that will be called on your DLL. You will be supplied
with four function pointers that may be used to log messages to the game's
log file. See comments in glue.h for further information. */
void jb_io_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal);
/* Initialize your JB IO emulation DLL. Thread management functions are
provided to you; you must use these functions to create your own threads if
you want to make use of the logging functions that are provided to
jb_io_set_loggers(). You will also need to pass these thread management
functions on to geninput if you intend to make use of that library.
See glue.h and geninput.h for further details. */
bool jb_io_init(
thread_create_t thread_create,
thread_join_t thread_join,
thread_destroy_t thread_destroy);
/* Shut down your JB IO emulation DLL */
void jb_io_fini(void);
/* Read input state */
bool jb_io_read_inputs(void);
/* Get state of coin, test, service inputs */
uint8_t jb_io_get_sys_inputs(void);
/* Get panel button state. Will return either any button being pressed, or a
particular panel corner depending on previous call to jb_io_set_panel_mode */
uint16_t jb_io_get_panel_inputs(void);
/* Set state of a PWM (dimmable) light */
void jb_io_set_rgb_led(
enum jb_io_rgb_led unit, uint8_t r, uint8_t g, uint8_t b);
/* Transmit the light state to the IOPCB */
bool jb_io_write_lights(void);
/* Select operating mode for the panel. Should be immediately sent to the IOPCB
*/
bool jb_io_set_panel_mode(enum jb_io_panel_mode mode);
/* Open or close the coin chute - true will redirect all coins to the return
slot. Required for jb_io_set_panel_mode to operate correctly on p4io.
Should be immediately sent to the IOPCB */
bool jb_io_set_coin_blocker(bool blocked);
#endif
-108
View File
@@ -1,108 +0,0 @@
#ifndef BEMANITOOLS_POPNIO_H
#define BEMANITOOLS_POPNIO_H
/* IO emulation provider for pop'n music. */
#include <stdbool.h>
#include <stdint.h>
#include "bemanitools/glue.h"
/* Bit mapping for the "buttons" word */
enum popn_io_sys_bit {
POPN_IO_SYS_SERVICE = 0x06,
POPN_IO_SYS_TEST = 0x07,
};
enum popn_io_button_bit {
POPN_IO_BUTTON_1 = 0x08,
POPN_IO_BUTTON_2 = 0x09,
POPN_IO_BUTTON_3 = 0x0a,
POPN_IO_BUTTON_4 = 0x0b,
POPN_IO_BUTTON_5 = 0x0c,
POPN_IO_BUTTON_6 = 0x0d,
POPN_IO_BUTTON_7 = 0x0e,
POPN_IO_BUTTON_8 = 0x0f,
POPN_IO_BUTTON_9 = 0x10,
};
enum popn_io_light_top_lamp_bit {
POPN_LIGHT_HI_LAMP1 = 0x00,
POPN_LIGHT_HI_LAMP2 = 0x01,
POPN_LIGHT_HI_LAMP3 = 0x02,
POPN_LIGHT_HI_LAMP4 = 0x03,
POPN_LIGHT_HI_LAMP5 = 0x04,
};
enum popn_io_light_side_lamp_bit {
POPN_LIGHT_LEFT_LAMP1 = 0x00,
POPN_LIGHT_LEFT_LAMP2 = 0x01,
POPN_LIGHT_RIGHT_LAMP1 = 0x02,
POPN_LIGHT_RIGHT_LAMP2 = 0x03,
};
enum popn_io_light_switch_lamp_bit {
POPN_LIGHT_SW_LAMP1 = 0x00, // Is actually 4 bits wide
POPN_LIGHT_SW_LAMP2 = 0x04,
POPN_LIGHT_SW_LAMP3 = 0x05,
POPN_LIGHT_SW_LAMP4 = 0x06,
POPN_LIGHT_SW_LAMP5 = 0x07,
POPN_LIGHT_SW_LAMP6 = 0x08,
POPN_LIGHT_SW_LAMP7 = 0x09,
POPN_LIGHT_SW_LAMP8 = 0x0a,
POPN_LIGHT_SW_LAMP9 = 0x0b,
};
/* The first function that will be called on your DLL. You will be supplied
with four function pointers that may be used to log messages to the game's
log file. See comments in glue.h for further information. */
void popn_io_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal);
/* Initialize your pop'n music IO emulation DLL. Thread management functions are
provided to you; you must use these functions to create your own threads if
you want to make use of the logging functions that are provided to
eam_io_set_loggers(). You will also need to pass these thread management
functions on to geninput if you intend to make use of that library.
See glue.h and geninput.h for further details. */
bool popn_io_init(
thread_create_t thread_create,
thread_join_t thread_join,
thread_destroy_t thread_destroy);
/* Shut down your pop'n music IO emulation DLL */
void popn_io_fini(void);
/* Get the state of the buttons. See enums above. */
uint32_t popn_io_get_buttons(void);
/* Set the top light state. See enum popn_io_light_top_lamp_bit above. */
void popn_io_set_top_lights(uint32_t lights);
/* Set the side light state. See enum popn_io_light_side_lamp_bit above. */
void popn_io_set_side_lights(uint32_t lights);
/* Set the button light state. See enum popn_io_light_switch_lamp_bit above. */
void popn_io_set_button_lights(uint32_t lights);
/* Set the coin blocker light state. */
void popn_io_set_coin_blocker_light(bool enabled);
/* Set the coin counter light state. */
void popn_io_set_coin_counter_light(bool enabled);
#endif
-108
View File
@@ -1,108 +0,0 @@
#ifndef BEMANITOOLS_SDVXIO_H
#define BEMANITOOLS_SDVXIO_H
/* IO emulation provider for SOUND VOLTEX */
#include <stdbool.h>
#include <stdint.h>
#include "bemanitools/glue.h"
enum sdvx_io_in_gpio_sys_bit {
SDVX_IO_IN_GPIO_SYS_COIN = 2,
SDVX_IO_IN_GPIO_SYS_SERVICE = 4,
SDVX_IO_IN_GPIO_SYS_TEST = 5,
};
enum sdvx_io_in_gpio_0_bit {
SDVX_IO_IN_GPIO_0_C = 0,
SDVX_IO_IN_GPIO_0_B = 1,
SDVX_IO_IN_GPIO_0_A = 2,
SDVX_IO_IN_GPIO_0_START = 3,
SDVX_IO_IN_GPIO_0_RECORDER = 4,
SDVX_IO_IN_GPIO_0_HEADPHONE = 5,
};
enum sdvx_io_in_gpio_1_bit {
SDVX_IO_IN_GPIO_1_FX_R = 3,
SDVX_IO_IN_GPIO_1_FX_L = 4,
SDVX_IO_IN_GPIO_1_D = 5,
};
enum sdvx_io_out_gpio_bit {
SDVX_IO_OUT_GPIO_D = 0,
SDVX_IO_OUT_GPIO_FX_L = 1,
SDVX_IO_OUT_GPIO_FX_R = 2,
SDVX_IO_OUT_GPIO_GENERATOR_B = 3,
SDVX_IO_OUT_GPIO_START = 12,
SDVX_IO_OUT_GPIO_A = 13,
SDVX_IO_OUT_GPIO_B = 14,
SDVX_IO_OUT_GPIO_C = 15,
};
/* The first function that will be called on your DLL. You will be supplied
with four function pointers that may be used to log messages to the game's
log file. See comments in glue.h for further information. */
void sdvx_io_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal);
/* Initialize your SDVX IO emulation DLL. Thread management functions are
provided to you; you must use these functions to create your own threads if
you want to make use of the logging functions that are provided to
eam_io_set_loggers(). You will also need to pass these thread management
functions on to geninput if you intend to make use of that library.
See glue.h and geninput.h for further details. */
bool sdvx_io_init(
thread_create_t thread_create,
thread_join_t thread_join,
thread_destroy_t thread_destroy);
/* Shut down your SDVX IO emulation DLL */
void sdvx_io_fini(void);
/* Set state of the GPIO (on/off) lights (see bit definitions above) */
void sdvx_io_set_gpio_lights(uint32_t gpio_lights);
/* Set state of a PWM (dimmable) light channel. These come in groups of three
(red, green, blue). There are a six group of three PWM channels, for a
total of 18 channels (0 through 17). */
void sdvx_io_set_pwm_light(uint8_t light_no, uint8_t intensity);
/* Transmit the light state to the IOPCB */
bool sdvx_io_write_output(void);
/* Read input state */
bool sdvx_io_read_input(void);
/* Get state of coin, test, service inputs */
uint8_t sdvx_io_get_input_gpio_sys(void);
/* Get gameplay button state. Parameter selects GPIO bank 0 or 1. See bit
definitions above for details. */
uint16_t sdvx_io_get_input_gpio(uint8_t gpio_bank);
/* Get a 10-bit (!) spinner position, where spinner_no is 0 or 1.
High six bits are ignored. */
uint16_t sdvx_io_get_spinner_pos(uint8_t spinner_no);
/* Sets the volume of the digital amps if possible.
Range is between 0-96, where 0 is MAX and 96 is LOW. */
bool sdvx_io_set_amp_volume(
uint8_t primary, uint8_t headphone, uint8_t subwoofer);
#endif
-61
View File
@@ -1,61 +0,0 @@
#ifndef BEMANITOOLS_VEFXIO_H
#define BEMANITOOLS_VEFXIO_H
/* IO emulation provider for beatmania IIDX Effector Panel. */
#include <stdbool.h>
#include <stdint.h>
#include "bemanitools/glue.h"
/* The first function that will be called on your DLL. You will be supplied
with four function pointers that may be used to log messages to the game's
log file. See comments in glue.h for further information. */
void vefx_io_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal);
/* Initialize your IIDX IO emulation DLL. Thread management functions are
provided to you; you must use these functions to create your own threads if
you want to make use of the logging functions that are provided to
eam_io_set_loggers(). You will also need to pass these thread management
functions on to geninput if you intend to make use of that library.
See glue.h and geninput.h for further details. */
bool vefx_io_init(
thread_create_t thread_create,
thread_join_t thread_join,
thread_destroy_t thread_destroy);
/* Shut down your IIDX IO emulation DLL */
void vefx_io_fini(void);
/* Read input state from the input controller. This function is called
immediately before the vefx_io_get_slider() function.
Return false in the event of an IO error. This will lock the game into an
IO error screen.
If making a custom driver, ppad can be used to update regular IO if needed
See iidxio.c for mappings. */
bool vefx_io_recv(uint64_t *ppad);
/* Get slider position, where 0 is the bottom position and 15 is the topmost
position. slider_no is a number between 0 (leftmost) and 4 (rightmost). */
uint8_t vefx_io_get_slider(uint8_t slider_no);
/* Write a nine-character string to the 16-segment display. This happens on a
different schedule to all of the other IO operations, so you should initiate
the communication as soon as this function is called */
bool vefx_io_write_16seg(const char *text);
#endif
+1 -1
View File
@@ -7,7 +7,7 @@
#include "aciodrv/device.h"
#include "core/log.h"
#include "iface-core/log.h"
// Must be provided on init command. Actual meaning unknown right now.
// Not providing this will not initialize the IO correctly resulting
+1 -1
View File
@@ -7,7 +7,7 @@
#include "aciodrv/device.h"
#include "core/log.h"
#include "iface-core/log.h"
static const uint8_t _BIO2DR_BI2A_SDVX_INIT_DATA = 0x3B;
+3 -3
View File
@@ -1,8 +1,8 @@
#include "bio2drv/config-bio2.h"
#include "cconfig/cconfig-util.h"
#include "core/log.h"
#include "bio2drv/config-bio2.h"
#include "iface-core/log.h"
#define BIO2DRV_CONFIG_BIO2_AUTO_KEY "bio2.autodetect"
#define BIO2DRV_CONFIG_BIO2_PORT_KEY "bio2.port"
+4 -13
View File
@@ -6,13 +6,13 @@
#include <cfgmgr32.h>
#include <setupapi.h>
#include "bio2drv/detect.h"
#include "core/log.h"
#include <stdio.h>
#include <string.h>
#include "bio2drv/detect.h"
#include "iface-core/log.h"
DEFINE_GUID(
GUID_COM_BUS_ENUMERATOR,
0x4D36E978,
@@ -136,15 +136,6 @@ static bool get_device_by_filter(
return false;
}
void bio2drv_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal)
{
core_log_impl_set(misc, warning, info, fatal);
}
bool bio2drv_detect(
enum bio2drv_detect_mode mode, size_t index, char *path, size_t length)
{
-8
View File
@@ -3,20 +3,12 @@
#include <stdbool.h>
#include "bemanitools/glue.h"
enum bio2drv_detect_mode {
DETECT_DEVICEDESC = 0x1, // look for serial devices containing BIO2(VIDEO)
DETECT_FRIENDLYNAME = 0x2, // look for serial devices containing BIO2(VIDEO)
DETECT_DEVICEID = 0x3, // look for serial devices by vid/pid
};
void bio2drv_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal);
bool bio2drv_detect(
enum bio2drv_detect_mode mode, size_t devnum, char *path, size_t length);
+42 -41
View File
@@ -10,9 +10,10 @@
#include <string.h>
#include "acioemu/emu.h"
#include "util/math.h"
#include "bemanitools/iidxio.h"
#include "iface-io/iidx.h"
#include "util/math.h"
static int get_default_slider_valid(size_t idx);
static void bio2_emu_bi2a_cmd_send_version(
@@ -178,7 +179,7 @@ static void bio2_emu_bi2a_send_status(
static int16_t tt_mult_delta(size_t tt_no)
{
int16_t current_tt = iidx_io_ep2_get_turntable(tt_no);
int16_t current_tt = bt_io_iidx_ep2_turntable_get(tt_no);
int16_t delta = get_wrapped_delta_s16(current_tt, tt_last[tt_no], 256);
tt_last[tt_no] = current_tt;
@@ -233,17 +234,17 @@ bio2_emu_bi2a_send_state(struct ac_io_emu *emu, const struct ac_io_message *req)
}
}
iidx_io_ep1_set_deck_lights(packed_lights.deck_lights);
iidx_io_ep1_set_panel_lights(packed_lights.panel_lights);
iidx_io_ep1_set_top_lamps(packed_lights.top_lamps);
iidx_io_ep1_set_top_neons(req_bi2a->NEONLAMP.l_state);
bt_io_iidx_ep1_deck_lights_set(packed_lights.deck_lights);
bt_io_iidx_ep1_panel_lights_set(packed_lights.panel_lights);
bt_io_iidx_ep1_top_lamps_set(packed_lights.top_lamps);
bt_io_iidx_ep1_top_neons_set(req_bi2a->NEONLAMP.l_state);
if (!iidx_io_ep1_send()) {
if (!bt_io_iidx_ep1_send()) {
log_warning("BIO2: iidx_io_ep1_send error");
return bio2_emu_bi2a_send_status(emu, req, 0);
}
if (!iidx_io_ep3_write_16seg((const char *) req_bi2a->SEG16)) {
if (!bt_io_iidx_ep3_16seg_send((const char *) req_bi2a->SEG16)) {
log_warning("BIO2: iidx_io_ep3_write_16seg error");
return bio2_emu_bi2a_send_status(emu, req, 0);
}
@@ -256,7 +257,7 @@ bio2_emu_bi2a_send_state(struct ac_io_emu *emu, const struct ac_io_message *req)
Sleep(1);
}
if (!iidx_io_ep2_recv()) {
if (!bt_io_iidx_ep2_recv()) {
log_warning("BIO2: iidx_io_ep2_recv error");
return bio2_emu_bi2a_send_status(emu, req, 0);
}
@@ -268,52 +269,52 @@ bio2_emu_bi2a_send_state(struct ac_io_emu *emu, const struct ac_io_message *req)
body->TURNTABLE1 = tt_accum[0];
body->TURNTABLE2 = tt_accum[1];
} else {
body->TURNTABLE1 = iidx_io_ep2_get_turntable(0);
body->TURNTABLE2 = iidx_io_ep2_get_turntable(1);
body->TURNTABLE1 = bt_io_iidx_ep2_turntable_get(0);
body->TURNTABLE2 = bt_io_iidx_ep2_turntable_get(1);
}
body->SLIDER1.s_val = get_default_slider_valid(0) ?
default_sliders[0] :
iidx_io_ep2_get_slider(0);
bt_io_iidx_ep2_slider_get(0);
body->SLIDER2.s_val = get_default_slider_valid(1) ?
default_sliders[1] :
iidx_io_ep2_get_slider(1);
bt_io_iidx_ep2_slider_get(1);
body->SLIDER3.s_val = get_default_slider_valid(2) ?
default_sliders[2] :
iidx_io_ep2_get_slider(2);
bt_io_iidx_ep2_slider_get(2);
body->SLIDER4.s_val = get_default_slider_valid(3) ?
default_sliders[3] :
iidx_io_ep2_get_slider(3);
bt_io_iidx_ep2_slider_get(3);
body->SLIDER5.s_val = get_default_slider_valid(4) ?
default_sliders[4] :
iidx_io_ep2_get_slider(4);
bt_io_iidx_ep2_slider_get(4);
input_keys = iidx_io_ep2_get_keys();
input_sys = iidx_io_ep2_get_sys();
input_panel = iidx_io_ep2_get_panel();
body->P1SW1.b_val = (input_keys >> IIDX_IO_KEY_P1_1) & 1;
body->P1SW2.b_val = (input_keys >> IIDX_IO_KEY_P1_2) & 1;
body->P1SW3.b_val = (input_keys >> IIDX_IO_KEY_P1_3) & 1;
body->P1SW4.b_val = (input_keys >> IIDX_IO_KEY_P1_4) & 1;
body->P1SW5.b_val = (input_keys >> IIDX_IO_KEY_P1_5) & 1;
body->P1SW6.b_val = (input_keys >> IIDX_IO_KEY_P1_6) & 1;
body->P1SW7.b_val = (input_keys >> IIDX_IO_KEY_P1_7) & 1;
body->P2SW1.b_val = (input_keys >> IIDX_IO_KEY_P2_1) & 1;
body->P2SW2.b_val = (input_keys >> IIDX_IO_KEY_P2_2) & 1;
body->P2SW3.b_val = (input_keys >> IIDX_IO_KEY_P2_3) & 1;
body->P2SW4.b_val = (input_keys >> IIDX_IO_KEY_P2_4) & 1;
body->P2SW5.b_val = (input_keys >> IIDX_IO_KEY_P2_5) & 1;
body->P2SW6.b_val = (input_keys >> IIDX_IO_KEY_P2_6) & 1;
body->P2SW7.b_val = (input_keys >> IIDX_IO_KEY_P2_7) & 1;
input_keys = bt_io_iidx_ep2_keys_get();
input_sys = bt_io_iidx_ep2_sys_get();
input_panel = bt_io_iidx_ep2_panel_get();
body->P1SW1.b_val = (input_keys >> BT_IO_IIDX_KEY_P1_1) & 1;
body->P1SW2.b_val = (input_keys >> BT_IO_IIDX_KEY_P1_2) & 1;
body->P1SW3.b_val = (input_keys >> BT_IO_IIDX_KEY_P1_3) & 1;
body->P1SW4.b_val = (input_keys >> BT_IO_IIDX_KEY_P1_4) & 1;
body->P1SW5.b_val = (input_keys >> BT_IO_IIDX_KEY_P1_5) & 1;
body->P1SW6.b_val = (input_keys >> BT_IO_IIDX_KEY_P1_6) & 1;
body->P1SW7.b_val = (input_keys >> BT_IO_IIDX_KEY_P1_7) & 1;
body->P2SW1.b_val = (input_keys >> BT_IO_IIDX_KEY_P2_1) & 1;
body->P2SW2.b_val = (input_keys >> BT_IO_IIDX_KEY_P2_2) & 1;
body->P2SW3.b_val = (input_keys >> BT_IO_IIDX_KEY_P2_3) & 1;
body->P2SW4.b_val = (input_keys >> BT_IO_IIDX_KEY_P2_4) & 1;
body->P2SW5.b_val = (input_keys >> BT_IO_IIDX_KEY_P2_5) & 1;
body->P2SW6.b_val = (input_keys >> BT_IO_IIDX_KEY_P2_6) & 1;
body->P2SW7.b_val = (input_keys >> BT_IO_IIDX_KEY_P2_7) & 1;
body->PANEL.y_start1 = (input_panel >> IIDX_IO_PANEL_P1_START) & 1;
body->PANEL.y_start2 = (input_panel >> IIDX_IO_PANEL_P2_START) & 1;
body->PANEL.y_vefx = (input_panel >> IIDX_IO_PANEL_VEFX) & 1;
body->PANEL.y_effect = (input_panel >> IIDX_IO_PANEL_EFFECT) & 1;
body->PANEL.y_start1 = (input_panel >> BT_IO_IIDX_PANEL_P1_START) & 1;
body->PANEL.y_start2 = (input_panel >> BT_IO_IIDX_PANEL_P2_START) & 1;
body->PANEL.y_vefx = (input_panel >> BT_IO_IIDX_PANEL_VEFX) & 1;
body->PANEL.y_effect = (input_panel >> BT_IO_IIDX_PANEL_EFFECT) & 1;
body->SYSTEM.v_test = (input_sys >> IIDX_IO_SYS_TEST) & 1;
body->SYSTEM.v_service = (input_sys >> IIDX_IO_SYS_SERVICE) & 1;
body->SYSTEM.v_coin = (input_sys >> IIDX_IO_SYS_COIN) & 1;
body->SYSTEM.v_test = (input_sys >> BT_IO_IIDX_SYS_TEST) & 1;
body->SYSTEM.v_service = (input_sys >> BT_IO_IIDX_SYS_SERVICE) & 1;
body->SYSTEM.v_coin = (input_sys >> BT_IO_IIDX_SYS_COIN) & 1;
if (body->SYSTEM.v_coin) {
if (!coin_latch) {
+2 -2
View File
@@ -14,14 +14,14 @@
#include "acioemu/addr.h"
#include "acioemu/emu.h"
#include "core/log.h"
#include "hook/iohook.h"
#include "hooklib/rs232.h"
#include "bio2emu/emu.h"
#include "bio2emu/setupapi.h"
#include "iface-core/log.h"
#include "imports/avs.h"
#include "util/array.h"
+3 -3
View File
@@ -6,12 +6,12 @@
#include <cfgmgr32.h>
#include <setupapi.h>
#include "core/log.h"
#include "bio2emu/emu.h"
#include "bio2emu/setupapi.h"
#include "hook/table.h"
#include "bio2emu/emu.h"
#include "bio2emu/setupapi.h"
#include "iface-core/log.h"
#include "util/defs.h"
#include "util/str.h"
+7 -4
View File
@@ -3,15 +3,18 @@ avsdlls += bsthook
deplibs_bsthook := \
avs \
avslibs_bsthook := \
avs-ext \
libs_bsthook := \
avs-util \
util \
core \
acioemu \
bstio \
hook \
hooklib \
util \
eamio \
iface-io \
module \
iface-core \
src_bsthook := \
acio.c \
+1 -1
View File
@@ -19,7 +19,7 @@
#include "bsthook/acio.h"
#include "bsthook/kfca.h"
#include "core/log.h"
#include "iface-core/log.h"
#include "hook/iohook.h"
+3
View File
@@ -3,6 +3,9 @@
#include <windows.h>
#include "api/io/bst.h"
#include "api/io/eam.h"
#include "hook/iohook.h"
void ac_io_bus_init(void);
+55 -27
View File
@@ -2,13 +2,18 @@
#include <stdbool.h>
#include "avs-util/core-interop.h"
#include "avs-ext/log.h"
#include "avs-ext/thread.h"
#include "bemanitools/bstio.h"
#include "bemanitools/eamio.h"
#include "bsthook/acio.h"
#include "bsthook/gfx.h"
#include "bsthook/settings.h"
#include "core/log.h"
#include "core/thread.h"
#include "iface-core/config.h"
#include "iface-core/log.h"
#include "iface-core/thread.h"
#include "iface-io/bst.h"
#include "iface-io/eam.h"
#include "hook/iohook.h"
@@ -17,57 +22,74 @@
#include "imports/avs.h"
#include "bsthook/acio.h"
#include "bsthook/gfx.h"
#include "bsthook/settings.h"
#include "module/io-ext.h"
#include "util/cmdline.h"
#include "util/defs.h"
static module_io_t *_bsthook_module_io_bst;
static module_io_t *_bsthook_module_io_eam;
static bool my_dll_entry_init(char *sidcode, struct property_node *config);
static bool my_dll_entry_main(void);
static void _bsthook_io_bst_init(module_io_t **module)
{
bt_io_bst_api_t api;
module_io_ext_load_and_init(
"bstio.dll", "bt_module_io_bst_api_get", module);
module_io_api_get(*module, &api);
bt_io_bst_api_set(&api);
}
static void _bsthook_io_eam_init(module_io_t **module)
{
bt_io_eam_api_t api;
module_io_ext_load_and_init(
"eamio.dll", "bt_module_io_eam_api_get", module);
module_io_api_get(*module, &api);
bt_io_eam_api_set(&api);
}
static bool my_dll_entry_init(char *sidcode, struct property_node *config)
{
bool ok;
log_info("--- Begin bsthook dll_entry_init ---");
ac_io_bus_init();
log_info("Starting up BeatStream IO backend");
core_log_impl_assign(bst_io_set_loggers);
_bsthook_io_bst_init(&_bsthook_module_io_bst);
ok = bst_io_init(
core_thread_create_impl_get(),
core_thread_join_impl_get(),
core_thread_destroy_impl_get());
ok = bt_io_bst_init();
if (!ok) {
goto bst_io_fail;
}
core_log_impl_assign(eam_io_set_loggers);
_bsthook_io_eam_init(&_bsthook_module_io_eam);
ok = eam_io_init(
core_thread_create_impl_get(),
core_thread_join_impl_get(),
core_thread_destroy_impl_get());
ok = bt_io_eam_init();
if (!ok) {
goto eam_io_fail;
}
ac_io_bus_init();
log_info("--- End bsthook dll_entry_init ---");
return app_hook_invoke_init(sidcode, config);
eam_io_fail:
bst_io_fini();
bt_io_bst_fini();
bt_io_bst_api_clear();
module_io_free(&_bsthook_module_io_bst);
bst_io_fail:
ac_io_bus_fini();
return false;
}
@@ -79,10 +101,16 @@ static bool my_dll_entry_main(void)
result = app_hook_invoke_main();
log_info("Shutting down card reader backend");
eam_io_fini();
bt_io_eam_fini();
log_info("Shutting down SDVX IO backend");
bst_io_fini();
bt_io_eam_api_clear();
module_io_free(&_bsthook_module_io_eam);
log_info("Shutting down BeatStream IO backend");
bt_io_bst_fini();
bt_io_bst_api_clear();
module_io_free(&_bsthook_module_io_bst);
ac_io_bus_fini();
@@ -100,8 +128,8 @@ BOOL WINAPI DllMain(HMODULE self, DWORD reason, void *ctx)
}
// Use AVS APIs
avs_util_core_interop_thread_avs_impl_set();
avs_util_core_interop_log_avs_impl_set();
avs_ext_log_core_api_set();
avs_ext_thread_core_api_set();
args_recover(&argc, &argv);
+1 -1
View File
@@ -3,7 +3,7 @@
#include <stdbool.h>
#include "core/log.h"
#include "iface-core/log.h"
#include "hook/com-proxy.h"
#include "hook/pe.h"
+3 -3
View File
@@ -7,7 +7,7 @@
#include "acioemu/emu.h"
#include "bemanitools/bstio.h"
#include "iface-io/bst.h"
#include "util/defs.h"
@@ -122,7 +122,7 @@ static void kfca_poll(const struct ac_io_message *req)
struct ac_io_message resp;
struct ac_io_kfca_poll_in *pin;
bst_io_read_input();
bt_io_bst_input_read();
pin = &resp.cmd.kfca_poll_in;
@@ -133,7 +133,7 @@ static void kfca_poll(const struct ac_io_message *req)
memset(pin, 0, sizeof(*pin));
pin->gpio_sys = ac_io_u16(bst_io_get_input());
pin->gpio_sys = ac_io_u16(bt_io_bst_input_get());
ac_io_emu_response_push(kfca_ac_io_emu, &resp, 0);
}
+1 -1
View File
@@ -7,7 +7,7 @@
#include <stdio.h>
#include <string.h>
#include "core/log.h"
#include "iface-core/log.h"
#include "hook/table.h"
+5 -1
View File
@@ -1,7 +1,11 @@
dlls += bstio
libs_bstio := \
geninput \
module \
iface-core \
core \
iface \
util \
src_bstio := \
bstio.c \
+61 -24
View File
@@ -1,46 +1,83 @@
#define LOG_MODULE "bstio"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "bemanitools/bstio.h"
#include "bemanitools/glue.h"
#include "bemanitools/input.h"
#include "api/core/log.h"
#include "api/core/thread.h"
static uint8_t bst_io_gpio_sys;
#include "iface-core/log.h"
#include "iface-core/thread.h"
#include "iface/input.h"
void bst_io_set_loggers(
log_formatter_t misc,
log_formatter_t info,
log_formatter_t warning,
log_formatter_t fatal)
#include "module/input.h"
#include "main/module/input-ext.h"
#include "main/module/input.h"
#include "sdk/module/core/log.h"
#include "sdk/module/core/thread.h"
#include "sdk/module/input.h"
#include "sdk/module/io/bst.h"
static module_input_t *_bst_io_module_input;
static uint8_t _bst_io_gpio_sys;
bool bt_io_bst_init()
{
input_set_loggers(misc, info, warning, fatal);
bool result;
bt_input_api_t input_api;
module_input_ext_load_and_init("geninput.dll", &_bst_io_module_input);
module_input_api_get(_bst_io_module_input, &input_api);
bt_input_api_set(&input_api);
result = bt_input_init();
if (!result) {
return false;
}
return bt_input_mapper_config_load("bst");
}
bool bst_io_init(
thread_create_t thread_create,
thread_join_t thread_join,
thread_destroy_t thread_destroy)
void bt_io_bst_fini()
{
input_init(thread_create, thread_join, thread_destroy);
mapper_config_load("bst");
bt_input_fini();
bt_input_api_clear();
module_input_free(&_bst_io_module_input);
}
bool bt_io_bst_input_read()
{
_bst_io_gpio_sys = bt_input_mapper_update();
return true;
}
void bst_io_fini(void)
uint8_t bt_io_bst_input_get()
{
input_fini();
return _bst_io_gpio_sys;
}
bool bst_io_read_input(void)
void bt_module_core_log_api_set(const bt_core_log_api_t *api)
{
bst_io_gpio_sys = mapper_update();
return true;
bt_core_log_api_set(api);
}
uint8_t bst_io_get_input(void)
void bt_module_core_thread_api_set(const bt_core_thread_api_t *api)
{
return bst_io_gpio_sys;
bt_core_thread_api_set(api);
}
void bt_module_io_bst_api_get(bt_io_bst_api_t *api)
{
api->version = 1;
api->v1.init = bt_io_bst_init;
api->v1.fini = bt_io_bst_fini;
api->v1.input_read = bt_io_bst_input_read;
api->v1.input_get = bt_io_bst_input_get;
}
+10 -5
View File
@@ -1,8 +1,13 @@
LIBRARY bstio
EXPORTS
bst_io_fini
bst_io_get_input
bst_io_init
bst_io_read_input
bst_io_set_loggers
; Bemanitools 6 API
bt_module_core_log_api_set
bt_module_core_thread_api_set
bt_module_io_bst_api_get
; Direct API
bt_io_bst_init
bt_io_bst_fini
bt_io_bst_input_read
bt_io_bst_input_get
+2 -1
View File
@@ -17,8 +17,9 @@
#include "camhook/cam-detect.h"
#include "iface-core/log.h"
#include "util/defs.h"
#include "util/log.h"
#include "util/str.h"
EXTERN_GUID(
+4 -1
View File
@@ -19,11 +19,14 @@
#include "camhook/cam.h"
#include "core/log.h"
#include "iface-core/log.h"
#include "hook/com-proxy.h"
#include "hook/table.h"
#include "camhook/cam.h"
#include "camhook/cam-detect.h"
#include "util/defs.h"
#include "util/str.h"

Some files were not shown because too many files have changed in this diff Show More