Compare commits
No commits in common. "master" and "master" have entirely different histories.
12
Package.mk
12
Package.mk
@ -64,17 +64,6 @@ $(BUILD_DIR_ZIP)/tekken.zip:
|
|||||||
$(V)strip $(BUILD_DIR_ZIP)/tekken/*.{exe,dll}
|
$(V)strip $(BUILD_DIR_ZIP)/tekken/*.{exe,dll}
|
||||||
$(V)cd $(BUILD_DIR_ZIP)/tekken ; zip -r ../tekken.zip *
|
$(V)cd $(BUILD_DIR_ZIP)/tekken ; zip -r ../tekken.zip *
|
||||||
|
|
||||||
$(BUILD_DIR_ZIP)/kizuna.zip:
|
|
||||||
$(V)echo ... $@
|
|
||||||
$(V)mkdir -p $(BUILD_DIR_ZIP)/kizuna
|
|
||||||
$(V)cp $(BUILD_DIR_64)/subprojects/capnhook/inject/inject.exe \
|
|
||||||
$(BUILD_DIR_64)/kizunahook/kizunahook.dll \
|
|
||||||
$(DIST_DIR)/kizuna/bananatools.ini \
|
|
||||||
$(DIST_DIR)/kizuna/start.bat \
|
|
||||||
$(BUILD_DIR_ZIP)/kizuna
|
|
||||||
$(V)strip $(BUILD_DIR_ZIP)/kizuna/*.{exe,dll}
|
|
||||||
$(V)cd $(BUILD_DIR_ZIP)/kizuna ; zip -r ../kizuna.zip *
|
|
||||||
|
|
||||||
$(BUILD_DIR_ZIP)/doc.zip: \
|
$(BUILD_DIR_ZIP)/doc.zip: \
|
||||||
$(DOC_DIR)/ferrumhook.md \
|
$(DOC_DIR)/ferrumhook.md \
|
||||||
$(DOC_DIR)/taikohook.md \
|
$(DOC_DIR)/taikohook.md \
|
||||||
@ -91,7 +80,6 @@ $(BUILD_DIR_ZIP)/bananatools.zip: \
|
|||||||
$(BUILD_DIR_ZIP)/sao.zip \
|
$(BUILD_DIR_ZIP)/sao.zip \
|
||||||
$(BUILD_DIR_ZIP)/mkac.zip \
|
$(BUILD_DIR_ZIP)/mkac.zip \
|
||||||
$(BUILD_DIR_ZIP)/tekken.zip \
|
$(BUILD_DIR_ZIP)/tekken.zip \
|
||||||
$(BUILD_DIR_ZIP)/kizuna.zip \
|
|
||||||
$(BUILD_DIR_ZIP)/doc.zip \
|
$(BUILD_DIR_ZIP)/doc.zip \
|
||||||
README.md \
|
README.md \
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ struct aime_io_config {
|
|||||||
wchar_t aime_path[MAX_PATH];
|
wchar_t aime_path[MAX_PATH];
|
||||||
wchar_t felica_path[MAX_PATH];
|
wchar_t felica_path[MAX_PATH];
|
||||||
bool felica_gen;
|
bool felica_gen;
|
||||||
bool aime_gen;
|
|
||||||
uint8_t vk_scan;
|
uint8_t vk_scan;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -41,11 +40,6 @@ static HRESULT aime_io_generate_felica(
|
|||||||
uint8_t *bytes,
|
uint8_t *bytes,
|
||||||
size_t nbytes);
|
size_t nbytes);
|
||||||
|
|
||||||
static HRESULT aime_io_generate_aime(
|
|
||||||
const wchar_t *path,
|
|
||||||
uint8_t *bytes,
|
|
||||||
size_t nbytes);
|
|
||||||
|
|
||||||
static void aime_io_config_read(
|
static void aime_io_config_read(
|
||||||
struct aime_io_config *cfg,
|
struct aime_io_config *cfg,
|
||||||
const wchar_t *filename)
|
const wchar_t *filename)
|
||||||
@ -68,16 +62,11 @@ static void aime_io_config_read(
|
|||||||
cfg->felica_path,
|
cfg->felica_path,
|
||||||
_countof(cfg->felica_path),
|
_countof(cfg->felica_path),
|
||||||
filename);
|
filename);
|
||||||
|
dprintf("NFC: felicaPath GetLastError %lx\n", GetLastError());
|
||||||
|
|
||||||
cfg->felica_gen = GetPrivateProfileIntW(
|
cfg->felica_gen = GetPrivateProfileIntW(
|
||||||
L"aime",
|
L"aime",
|
||||||
L"felicaGen",
|
L"felicaGen",
|
||||||
0,
|
|
||||||
filename);
|
|
||||||
|
|
||||||
cfg->aime_gen = GetPrivateProfileIntW(
|
|
||||||
L"aime",
|
|
||||||
L"aimeGen",
|
|
||||||
1,
|
1,
|
||||||
filename);
|
filename);
|
||||||
|
|
||||||
@ -147,7 +136,7 @@ static HRESULT aime_io_generate_felica(
|
|||||||
|
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
|
|
||||||
for (i = 0; i < nbytes; i++) {
|
for (i = 0 ; i < nbytes ; i++) {
|
||||||
bytes[i] = rand();
|
bytes[i] = rand();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +151,7 @@ static HRESULT aime_io_generate_felica(
|
|||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < nbytes; i++) {
|
for (i = 0 ; i < nbytes ; i++) {
|
||||||
fprintf(f, "%02X", bytes[i]);
|
fprintf(f, "%02X", bytes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,47 +163,6 @@ static HRESULT aime_io_generate_felica(
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT aime_io_generate_aime(
|
|
||||||
const wchar_t *path,
|
|
||||||
uint8_t *bytes,
|
|
||||||
size_t nbytes)
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
FILE *f;
|
|
||||||
|
|
||||||
assert(path != NULL);
|
|
||||||
assert(bytes != NULL);
|
|
||||||
assert(nbytes > 0);
|
|
||||||
|
|
||||||
srand(time(NULL));
|
|
||||||
|
|
||||||
/* AiMe IDs should not start with 3, due to a missing check for BananaPass IDs */
|
|
||||||
do {
|
|
||||||
for (i = 0; i < nbytes; i++) {
|
|
||||||
bytes[i] = rand() % 10 << 4 | rand() % 10;
|
|
||||||
}
|
|
||||||
} while (bytes[0] >> 4 == 3);
|
|
||||||
|
|
||||||
f = _wfopen(path, L"w");
|
|
||||||
|
|
||||||
if (f == NULL) {
|
|
||||||
dprintf("AimeIO DLL: %S: fopen failed: %i\n", path, (int) errno);
|
|
||||||
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < nbytes; i++) {
|
|
||||||
fprintf(f, "%02x", bytes[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(f, "\n");
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
dprintf("AimeIO DLL: Generated random AiMe ID\n");
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t aime_io_get_api_version(void)
|
uint16_t aime_io_get_api_version(void)
|
||||||
{
|
{
|
||||||
return 0x0100;
|
return 0x0100;
|
||||||
@ -222,7 +170,7 @@ uint16_t aime_io_get_api_version(void)
|
|||||||
|
|
||||||
HRESULT aime_io_init(void)
|
HRESULT aime_io_init(void)
|
||||||
{
|
{
|
||||||
aime_io_config_read(&aime_io_cfg, L".\\bananatools.ini");
|
aime_io_config_read(&aime_io_cfg, L".\\segatools.ini");
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -262,22 +210,6 @@ HRESULT aime_io_nfc_poll(uint8_t unit_no)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try generating AiMe IC (if enabled) */
|
|
||||||
|
|
||||||
if (aime_io_cfg.aime_gen) {
|
|
||||||
hr = aime_io_generate_aime(
|
|
||||||
aime_io_cfg.aime_path,
|
|
||||||
aime_io_aime_id,
|
|
||||||
sizeof(aime_io_aime_id));
|
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
aime_io_aime_id_present = true;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Try FeliCa IC */
|
/* Try FeliCa IC */
|
||||||
|
|
||||||
hr = aime_io_read_id_file(
|
hr = aime_io_read_id_file(
|
||||||
|
@ -71,13 +71,3 @@ void aime_config_load(struct aime_config *cfg, const wchar_t *filename)
|
|||||||
aime_dll_config_load(&cfg->dll, filename);
|
aime_dll_config_load(&cfg->dll, filename);
|
||||||
cfg->enable = GetPrivateProfileIntW(L"aime", L"enable", 1, filename);
|
cfg->enable = GetPrivateProfileIntW(L"aime", L"enable", 1, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vfd_config_load(struct vfd_config *cfg, const wchar_t *filename)
|
|
||||||
{
|
|
||||||
assert(cfg != NULL);
|
|
||||||
assert(filename != NULL);
|
|
||||||
|
|
||||||
cfg->enable = GetPrivateProfileIntW(L"vfd", L"enable", 1, filename);
|
|
||||||
cfg->port = GetPrivateProfileIntW(L"vfd", L"portNo", 0, filename);
|
|
||||||
cfg->utf_conversion = GetPrivateProfileIntW(L"vfd", L"utfConversion", 0, filename);
|
|
||||||
}
|
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
#include "board/bpreader.h"
|
#include "board/bpreader.h"
|
||||||
#include "board/qr.h"
|
#include "board/qr.h"
|
||||||
#include "board/sg-reader.h"
|
#include "board/sg-reader.h"
|
||||||
#include "board/vfd.h"
|
|
||||||
|
|
||||||
void bpreader_config_load(struct bpreader_config *cfg, const wchar_t *filename);
|
void bpreader_config_load(struct bpreader_config *cfg, const wchar_t *filename);
|
||||||
void usio_config_load(struct usio_config *cfg, const wchar_t *filename);
|
void usio_config_load(struct usio_config *cfg, const wchar_t *filename);
|
||||||
void qr_config_load(struct qr_config *cfg, const wchar_t *filename);
|
void qr_config_load(struct qr_config *cfg, const wchar_t *filename);
|
||||||
void aime_config_load(struct aime_config *cfg, const wchar_t *filename);
|
void aime_config_load(struct aime_config *cfg, const wchar_t *filename);
|
||||||
void vfd_config_load(struct vfd_config *cfg, const wchar_t *filename);
|
|
||||||
|
@ -39,9 +39,6 @@ board_lib = static_library(
|
|||||||
'sg-nfc-cmd.h',
|
'sg-nfc-cmd.h',
|
||||||
'sg-reader.c',
|
'sg-reader.c',
|
||||||
'sg-reader.h',
|
'sg-reader.h',
|
||||||
'vfd-cmd.h',
|
|
||||||
'vfd-frame.c',
|
|
||||||
'vfd-frame.h',
|
|
||||||
'vfd.c',
|
'vfd.c',
|
||||||
'vfd.h',
|
'vfd.h',
|
||||||
],
|
],
|
||||||
|
@ -25,13 +25,6 @@ struct sg_res_header {
|
|||||||
uint8_t payload_len;
|
uint8_t payload_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* struct to save the version string with its length
|
|
||||||
to fix NUL terminator issues */
|
|
||||||
struct version_info {
|
|
||||||
const char *version;
|
|
||||||
uint8_t length;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef HRESULT (*sg_dispatch_fn_t)(
|
typedef HRESULT (*sg_dispatch_fn_t)(
|
||||||
void *ctx,
|
void *ctx,
|
||||||
const void *req,
|
const void *req,
|
||||||
|
@ -27,18 +27,14 @@ static HRESULT sg_led_cmd_set_color(
|
|||||||
const struct sg_led *led,
|
const struct sg_led *led,
|
||||||
const struct sg_led_req_set_color *req);
|
const struct sg_led_req_set_color *req);
|
||||||
|
|
||||||
static const struct version_info led_version[] = {
|
static const uint8_t sg_led_info[] = {
|
||||||
{"15084\xFF\x10\x00\x12", 9},
|
'1', '5', '0', '8', '4', 0xFF, 0x10, 0x00, 0x12,
|
||||||
{"000-00000\xFF\x11\x40", 12},
|
|
||||||
// maybe the same?
|
|
||||||
{"000-00000\xFF\x11\x40", 12}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void sg_led_init(
|
void sg_led_init(
|
||||||
struct sg_led *led,
|
struct sg_led *led,
|
||||||
uint8_t addr,
|
uint8_t addr,
|
||||||
const struct sg_led_ops *ops,
|
const struct sg_led_ops *ops,
|
||||||
unsigned int gen,
|
|
||||||
void *ctx)
|
void *ctx)
|
||||||
{
|
{
|
||||||
assert(led != NULL);
|
assert(led != NULL);
|
||||||
@ -47,7 +43,6 @@ void sg_led_init(
|
|||||||
led->ops = ops;
|
led->ops = ops;
|
||||||
led->ops_ctx = ctx;
|
led->ops_ctx = ctx;
|
||||||
led->addr = addr;
|
led->addr = addr;
|
||||||
led->gen = gen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sg_led_transact(
|
void sg_led_transact(
|
||||||
@ -155,11 +150,8 @@ static HRESULT sg_led_cmd_get_info(
|
|||||||
struct sg_led_res_get_info *res)
|
struct sg_led_res_get_info *res)
|
||||||
{
|
{
|
||||||
sg_led_dprintf(led, "Get info\n");
|
sg_led_dprintf(led, "Get info\n");
|
||||||
|
sg_res_init(&res->res, req, sizeof(res->payload));
|
||||||
const struct version_info *fw = &led_version[led->gen - 1];
|
memcpy(res->payload, sg_led_info, sizeof(sg_led_info));
|
||||||
|
|
||||||
sg_res_init(&res->res, req, fw->length);
|
|
||||||
memcpy(res->payload, fw->version, fw->length);
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,12 @@ struct sg_led {
|
|||||||
const struct sg_led_ops *ops;
|
const struct sg_led_ops *ops;
|
||||||
void *ops_ctx;
|
void *ops_ctx;
|
||||||
uint8_t addr;
|
uint8_t addr;
|
||||||
unsigned int gen;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void sg_led_init(
|
void sg_led_init(
|
||||||
struct sg_led *led,
|
struct sg_led *led,
|
||||||
uint8_t addr,
|
uint8_t addr,
|
||||||
const struct sg_led_ops *ops,
|
const struct sg_led_ops *ops,
|
||||||
unsigned int gen,
|
|
||||||
void *ctx);
|
void *ctx);
|
||||||
|
|
||||||
void sg_led_transact(
|
void sg_led_transact(
|
||||||
|
@ -5,21 +5,18 @@
|
|||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SG_NFC_CMD_GET_FW_VERSION = 0x30,
|
SG_NFC_CMD_GET_FW_VERSION = 0x30,
|
||||||
SG_NFC_CMD_GET_HW_VERSION = 0x32,
|
SG_NFC_CMD_GET_HW_VERSION = 0x32,
|
||||||
SG_NFC_CMD_RADIO_ON = 0x40,
|
SG_NFC_CMD_RADIO_ON = 0x40,
|
||||||
SG_NFC_CMD_RADIO_OFF = 0x41,
|
SG_NFC_CMD_RADIO_OFF = 0x41,
|
||||||
SG_NFC_CMD_POLL = 0x42,
|
SG_NFC_CMD_POLL = 0x42,
|
||||||
SG_NFC_CMD_MIFARE_SELECT_TAG = 0x43,
|
SG_NFC_CMD_MIFARE_SELECT_TAG = 0x43,
|
||||||
SG_NFC_CMD_MIFARE_SET_KEY_AIME = 0x50,
|
SG_NFC_CMD_MIFARE_SET_KEY_BANA = 0x50,
|
||||||
SG_NFC_CMD_MIFARE_AUTHENTICATE_A = 0x51,
|
SG_NFC_CMD_MIFARE_READ_BLOCK = 0x52,
|
||||||
SG_NFC_CMD_MIFARE_READ_BLOCK = 0x52,
|
SG_NFC_CMD_MIFARE_SET_KEY_AIME = 0x54,
|
||||||
SG_NFC_CMD_MIFARE_SET_KEY_BANA = 0x54,
|
SG_NFC_CMD_MIFARE_AUTHENTICATE = 0x55, /* guess based on time sent */
|
||||||
SG_NFC_CMD_MIFARE_AUTHENTICATE_B = 0x55,
|
SG_NFC_CMD_RESET = 0x62,
|
||||||
SG_NFC_CMD_TO_UPDATE_MODE = 0x60,
|
SG_NFC_CMD_FELICA_ENCAP = 0x71,
|
||||||
SG_NFC_CMD_SEND_HEX_DATA = 0x61,
|
|
||||||
SG_NFC_CMD_RESET = 0x62,
|
|
||||||
SG_NFC_CMD_FELICA_ENCAP = 0x71,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sg_nfc_res_get_fw_version {
|
struct sg_nfc_res_get_fw_version {
|
||||||
@ -34,7 +31,7 @@ struct sg_nfc_res_get_hw_version {
|
|||||||
|
|
||||||
struct sg_nfc_req_mifare_set_key {
|
struct sg_nfc_req_mifare_set_key {
|
||||||
struct sg_req_header req;
|
struct sg_req_header req;
|
||||||
uint8_t key[6];
|
uint8_t key_a[6];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sg_nfc_req_mifare_50 {
|
struct sg_nfc_req_mifare_50 {
|
||||||
|
@ -60,33 +60,15 @@ static HRESULT sg_nfc_cmd_felica_encap(
|
|||||||
const struct sg_nfc_req_felica_encap *req,
|
const struct sg_nfc_req_felica_encap *req,
|
||||||
struct sg_nfc_res_felica_encap *res);
|
struct sg_nfc_res_felica_encap *res);
|
||||||
|
|
||||||
static HRESULT sg_nfc_cmd_send_hex_data(
|
|
||||||
struct sg_nfc *nfc,
|
|
||||||
const struct sg_req_header *req,
|
|
||||||
struct sg_res_header *res);
|
|
||||||
|
|
||||||
static HRESULT sg_nfc_cmd_dummy(
|
static HRESULT sg_nfc_cmd_dummy(
|
||||||
struct sg_nfc *nfc,
|
struct sg_nfc *nfc,
|
||||||
const struct sg_req_header *req,
|
const struct sg_req_header *req,
|
||||||
struct sg_res_header *res);
|
struct sg_res_header *res);
|
||||||
|
|
||||||
static const struct version_info hw_version[] = {
|
|
||||||
{"TN32MSEC003S H/W Ver3.0", 23},
|
|
||||||
{"837-15286", 9},
|
|
||||||
{"837-15396", 9}
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct version_info fw_version[] = {
|
|
||||||
{"TN32MSEC003S F/W Ver1.2", 23},
|
|
||||||
{"\x94", 1},
|
|
||||||
{"\x94", 1}
|
|
||||||
};
|
|
||||||
|
|
||||||
void sg_nfc_init(
|
void sg_nfc_init(
|
||||||
struct sg_nfc *nfc,
|
struct sg_nfc *nfc,
|
||||||
uint8_t addr,
|
uint8_t addr,
|
||||||
const struct sg_nfc_ops *ops,
|
const struct sg_nfc_ops *ops,
|
||||||
unsigned int gen,
|
|
||||||
void *ops_ctx)
|
void *ops_ctx)
|
||||||
{
|
{
|
||||||
assert(nfc != NULL);
|
assert(nfc != NULL);
|
||||||
@ -95,7 +77,6 @@ void sg_nfc_init(
|
|||||||
nfc->ops = ops;
|
nfc->ops = ops;
|
||||||
nfc->ops_ctx = ops_ctx;
|
nfc->ops_ctx = ops_ctx;
|
||||||
nfc->addr = addr;
|
nfc->addr = addr;
|
||||||
nfc->gen = gen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
@ -189,17 +170,12 @@ static HRESULT sg_nfc_dispatch(
|
|||||||
&req->felica_encap,
|
&req->felica_encap,
|
||||||
&res->felica_encap);
|
&res->felica_encap);
|
||||||
|
|
||||||
case SG_NFC_CMD_MIFARE_AUTHENTICATE_A:
|
case SG_NFC_CMD_MIFARE_AUTHENTICATE:
|
||||||
case SG_NFC_CMD_MIFARE_AUTHENTICATE_B:
|
|
||||||
case SG_NFC_CMD_SEND_HEX_DATA:
|
|
||||||
return sg_nfc_cmd_send_hex_data(nfc, &req->simple, &res->simple);
|
|
||||||
|
|
||||||
case SG_NFC_CMD_MIFARE_SELECT_TAG:
|
case SG_NFC_CMD_MIFARE_SELECT_TAG:
|
||||||
case SG_NFC_CMD_MIFARE_SET_KEY_AIME:
|
case SG_NFC_CMD_MIFARE_SET_KEY_AIME:
|
||||||
case SG_NFC_CMD_MIFARE_SET_KEY_BANA:
|
case SG_NFC_CMD_MIFARE_SET_KEY_BANA:
|
||||||
case SG_NFC_CMD_RADIO_ON:
|
case SG_NFC_CMD_RADIO_ON:
|
||||||
case SG_NFC_CMD_RADIO_OFF:
|
case SG_NFC_CMD_RADIO_OFF:
|
||||||
case SG_NFC_CMD_TO_UPDATE_MODE:
|
|
||||||
return sg_nfc_cmd_dummy(nfc, &req->simple, &res->simple);
|
return sg_nfc_cmd_dummy(nfc, &req->simple, &res->simple);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -226,11 +202,9 @@ static HRESULT sg_nfc_cmd_get_fw_version(
|
|||||||
const struct sg_req_header *req,
|
const struct sg_req_header *req,
|
||||||
struct sg_nfc_res_get_fw_version *res)
|
struct sg_nfc_res_get_fw_version *res)
|
||||||
{
|
{
|
||||||
const struct version_info *fw = &fw_version[nfc->gen - 1];
|
|
||||||
|
|
||||||
/* Dest version is not NUL terminated, this is intentional */
|
/* Dest version is not NUL terminated, this is intentional */
|
||||||
sg_res_init(&res->res, req, fw->length);
|
sg_res_init(&res->res, req, sizeof(res->version));
|
||||||
memcpy(res->version, fw->version, fw->length);
|
memcpy(res->version, "TN32MSEC003S F/W Ver1.2E", sizeof(res->version));
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -240,11 +214,9 @@ static HRESULT sg_nfc_cmd_get_hw_version(
|
|||||||
const struct sg_req_header *req,
|
const struct sg_req_header *req,
|
||||||
struct sg_nfc_res_get_hw_version *res)
|
struct sg_nfc_res_get_hw_version *res)
|
||||||
{
|
{
|
||||||
const struct version_info *hw = &hw_version[nfc->gen - 1];
|
|
||||||
|
|
||||||
/* Dest version is not NUL terminated, this is intentional */
|
/* Dest version is not NUL terminated, this is intentional */
|
||||||
sg_res_init(&res->res, req, hw->length);
|
sg_res_init(&res->res, req, sizeof(res->version));
|
||||||
memcpy(res->version, hw->version, hw->length);
|
memcpy(res->version, "TN32MSEC003S H/W Ver3.0J", sizeof(res->version));
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
@ -451,22 +423,6 @@ static HRESULT sg_nfc_cmd_felica_encap(
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT sg_nfc_cmd_send_hex_data(
|
|
||||||
struct sg_nfc *nfc,
|
|
||||||
const struct sg_req_header *req,
|
|
||||||
struct sg_res_header *res)
|
|
||||||
{
|
|
||||||
sg_res_init(res, req, 0);
|
|
||||||
|
|
||||||
/* Firmware checksum length? */
|
|
||||||
if (req->payload_len == 0x2b) {
|
|
||||||
/* The firmware is identical flag? */
|
|
||||||
res->status = 0x20;
|
|
||||||
}
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT sg_nfc_cmd_dummy(
|
static HRESULT sg_nfc_cmd_dummy(
|
||||||
struct sg_nfc *nfc,
|
struct sg_nfc *nfc,
|
||||||
const struct sg_req_header *req,
|
const struct sg_req_header *req,
|
||||||
|
@ -22,7 +22,6 @@ struct sg_nfc {
|
|||||||
const struct sg_nfc_ops *ops;
|
const struct sg_nfc_ops *ops;
|
||||||
void *ops_ctx;
|
void *ops_ctx;
|
||||||
uint8_t addr;
|
uint8_t addr;
|
||||||
unsigned int gen;
|
|
||||||
struct felica felica;
|
struct felica felica;
|
||||||
struct mifare mifare;
|
struct mifare mifare;
|
||||||
};
|
};
|
||||||
@ -31,7 +30,6 @@ void sg_nfc_init(
|
|||||||
struct sg_nfc *nfc,
|
struct sg_nfc *nfc,
|
||||||
uint8_t addr,
|
uint8_t addr,
|
||||||
const struct sg_nfc_ops *ops,
|
const struct sg_nfc_ops *ops,
|
||||||
unsigned int gen,
|
|
||||||
void *ops_ctx);
|
void *ops_ctx);
|
||||||
|
|
||||||
void sg_nfc_transact(
|
void sg_nfc_transact(
|
||||||
|
@ -48,7 +48,6 @@ static struct sg_led sg_reader_led;
|
|||||||
HRESULT sg_reader_hook_init(
|
HRESULT sg_reader_hook_init(
|
||||||
const struct aime_config *cfg,
|
const struct aime_config *cfg,
|
||||||
unsigned int port_no,
|
unsigned int port_no,
|
||||||
unsigned int gen,
|
|
||||||
HINSTANCE self)
|
HINSTANCE self)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
@ -66,25 +65,11 @@ HRESULT sg_reader_hook_init(
|
|||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cfg->gen != 0) {
|
sg_nfc_init(&sg_reader_nfc, 0x00, &sg_reader_nfc_ops, NULL);
|
||||||
gen = cfg->gen;
|
sg_led_init(&sg_reader_led, 0x08, &sg_reader_led_ops, NULL);
|
||||||
}
|
|
||||||
|
|
||||||
if (gen < 1 || gen > 3) {
|
|
||||||
dprintf("NFC Assembly: Invalid reader generation: %u\n", gen);
|
|
||||||
|
|
||||||
return E_INVALIDARG;
|
|
||||||
}
|
|
||||||
|
|
||||||
sg_nfc_init(&sg_reader_nfc, 0x00, &sg_reader_nfc_ops, gen, NULL);
|
|
||||||
sg_led_init(&sg_reader_led, 0x08, &sg_reader_led_ops, gen, NULL);
|
|
||||||
|
|
||||||
InitializeCriticalSection(&sg_reader_lock);
|
InitializeCriticalSection(&sg_reader_lock);
|
||||||
|
|
||||||
if (!cfg->high_baudrate) {
|
|
||||||
sg_reader_uart.baud.BaudRate = 38400;
|
|
||||||
}
|
|
||||||
|
|
||||||
uart_init(&sg_reader_uart, port_no);
|
uart_init(&sg_reader_uart, port_no);
|
||||||
sg_reader_uart.written.bytes = sg_reader_written_bytes;
|
sg_reader_uart.written.bytes = sg_reader_written_bytes;
|
||||||
sg_reader_uart.written.nbytes = sizeof(sg_reader_written_bytes);
|
sg_reader_uart.written.nbytes = sizeof(sg_reader_written_bytes);
|
||||||
|
@ -9,12 +9,9 @@
|
|||||||
struct aime_config {
|
struct aime_config {
|
||||||
struct aime_dll_config dll;
|
struct aime_dll_config dll;
|
||||||
bool enable;
|
bool enable;
|
||||||
bool high_baudrate;
|
|
||||||
unsigned int gen;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT sg_reader_hook_init(
|
HRESULT sg_reader_hook_init(
|
||||||
const struct aime_config *cfg,
|
const struct aime_config *cfg,
|
||||||
unsigned int port_no,
|
unsigned int port_no,
|
||||||
unsigned int gen,
|
|
||||||
HINSTANCE self);
|
HINSTANCE self);
|
||||||
|
@ -307,7 +307,7 @@ static int my_bnusio_SetCoinLock(uint8_t id, char value)
|
|||||||
|
|
||||||
static int my_bnusio_GetCoin(uint8_t id)
|
static int my_bnusio_GetCoin(uint8_t id)
|
||||||
{
|
{
|
||||||
// dprintf("USIO: GetCoin ID %d\n", id);
|
//dprintf("USIO: GetCoin ID %d\n", id);
|
||||||
usio_ops->poll(usio_ops_ctx, &state);
|
usio_ops->poll(usio_ops_ctx, &state);
|
||||||
if (id < 2) {
|
if (id < 2) {
|
||||||
return state.coins[id].current_coin_count;
|
return state.coins[id].current_coin_count;
|
||||||
@ -317,7 +317,7 @@ static int my_bnusio_GetCoin(uint8_t id)
|
|||||||
|
|
||||||
static int my_bnusio_GetCoinError(uint8_t id)
|
static int my_bnusio_GetCoinError(uint8_t id)
|
||||||
{
|
{
|
||||||
// dprintf("USIO: GetCoinErrorID %d\n", id);
|
//dprintf("USIO: GetCoinErrorID %d\n", id);
|
||||||
if (id >= _countof(state.coins)) {
|
if (id >= _countof(state.coins)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
123
board/vfd-cmd.h
123
board/vfd-cmd.h
@ -1,123 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "board/vfd-frame.h"
|
|
||||||
|
|
||||||
enum {
|
|
||||||
VFD_CMD_GET_VERSION = 0x5B,
|
|
||||||
VFD_CMD_RESET = 0x0B,
|
|
||||||
VFD_CMD_CLEAR_SCREEN = 0x0C,
|
|
||||||
VFD_CMD_SET_BRIGHTNESS = 0x20,
|
|
||||||
VFD_CMD_SET_SCREEN_ON = 0x21,
|
|
||||||
VFD_CMD_SET_H_SCROLL = 0x22,
|
|
||||||
VFD_CMD_DRAW_IMAGE = 0x2E,
|
|
||||||
VFD_CMD_SET_CURSOR = 0x30,
|
|
||||||
VFD_CMD_SET_ENCODING = 0x32,
|
|
||||||
VFD_CMD_SET_TEXT_WND = 0x40,
|
|
||||||
VFD_CMD_SET_TEXT_SPEED = 0x41,
|
|
||||||
VFD_CMD_WRITE_TEXT = 0x50,
|
|
||||||
VFD_CMD_ENABLE_SCROLL = 0x51,
|
|
||||||
VFD_CMD_DISABLE_SCROLL = 0x52,
|
|
||||||
VFD_CMD_ROTATE = 0x5D,
|
|
||||||
VFD_CMD_CREATE_CHAR = 0xA3,
|
|
||||||
VFD_CMD_CREATE_CHAR2 = 0xA4,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
VFD_ENC_GB2312 = 0,
|
|
||||||
VFD_ENC_BIG5 = 1,
|
|
||||||
VFD_ENC_SHIFT_JIS = 2,
|
|
||||||
VFD_ENC_KSC5601 = 3,
|
|
||||||
VFD_ENC_MAX = 3,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_hdr {
|
|
||||||
uint8_t sync;
|
|
||||||
uint8_t cmd;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_any {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
uint8_t payload[2054];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_board_info {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
uint8_t unk1;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_resp_board_info { // \x0201.20\x03
|
|
||||||
uint8_t unk1;
|
|
||||||
char version[5];
|
|
||||||
uint8_t unk2;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_reset {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_cls {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_brightness {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
uint8_t brightness;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_power {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
uint8_t power_state;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_hscroll {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
uint8_t x_pos;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_draw {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
uint16_t x0;
|
|
||||||
uint8_t y0;
|
|
||||||
uint16_t x1;
|
|
||||||
uint8_t y1;
|
|
||||||
uint8_t image[2048];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_cursor {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
uint16_t x;
|
|
||||||
uint8_t y;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_encoding {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
uint8_t encoding;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_wnd {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
uint16_t x0;
|
|
||||||
uint8_t y0;
|
|
||||||
uint16_t x1;
|
|
||||||
uint8_t y1;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_speed {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
uint8_t encoding;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_scroll {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_rotate {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
uint8_t unk1;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct vfd_req_create_char {
|
|
||||||
struct vfd_req_hdr hdr;
|
|
||||||
uint8_t type;
|
|
||||||
uint8_t pixels[32];
|
|
||||||
};
|
|
@ -1,88 +0,0 @@
|
|||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define SUPER_VERBOSE 1
|
|
||||||
|
|
||||||
#include "board/vfd-frame.h"
|
|
||||||
|
|
||||||
#include "hook/iobuf.h"
|
|
||||||
|
|
||||||
#include "util/dprintf.h"
|
|
||||||
|
|
||||||
static HRESULT vfd_frame_encode_byte(struct iobuf *dest, uint8_t byte);
|
|
||||||
|
|
||||||
/* Frame structure:
|
|
||||||
|
|
||||||
REQUEST:
|
|
||||||
[0] Sync byte (0x1A or 0x1B)
|
|
||||||
[1] Packet ID
|
|
||||||
[2...n-1] Data/payload
|
|
||||||
|
|
||||||
--- OR ---
|
|
||||||
|
|
||||||
if no sync byte is given, plain static text in the currently configured encoding is expected.
|
|
||||||
|
|
||||||
RESPONSE:
|
|
||||||
This thing never responds, unless it's VFD_CMD_GET_VERSION
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool vfd_frame_sync(struct const_iobuf *src) {
|
|
||||||
return src->bytes[src->pos] == VFD_SYNC_BYTE || src->bytes[src->pos] == VFD_SYNC_BYTE2;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT vfd_frame_encode(
|
|
||||||
struct iobuf *dest,
|
|
||||||
const void *ptr,
|
|
||||||
size_t nbytes) {
|
|
||||||
const uint8_t *src;
|
|
||||||
uint8_t byte;
|
|
||||||
size_t i;
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
assert(dest != NULL);
|
|
||||||
assert(dest->bytes != NULL || dest->nbytes == 0);
|
|
||||||
assert(dest->pos <= dest->nbytes);
|
|
||||||
assert(ptr != NULL);
|
|
||||||
|
|
||||||
src = ptr;
|
|
||||||
|
|
||||||
if (dest->pos >= dest->nbytes) {
|
|
||||||
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if SUPER_VERBOSE
|
|
||||||
dprintf("VFD: RX Buffer:\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i = 1; i < nbytes; i++) {
|
|
||||||
byte = src[i];
|
|
||||||
#if SUPER_VERBOSE
|
|
||||||
dprintf("%02x ", byte);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
hr = vfd_frame_encode_byte(dest, byte);
|
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#if SUPER_VERBOSE
|
|
||||||
dprintf("\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT vfd_frame_encode_byte(struct iobuf *dest, uint8_t byte) {
|
|
||||||
if (dest->pos + 1 > dest->nbytes) {
|
|
||||||
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
|
|
||||||
}
|
|
||||||
|
|
||||||
dest->bytes[dest->pos++] = byte;
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "hook/iobuf.h"
|
|
||||||
|
|
||||||
enum {
|
|
||||||
VFD_SYNC_BYTE = 0x1B,
|
|
||||||
VFD_SYNC_BYTE2 = 0x1A,
|
|
||||||
};
|
|
||||||
|
|
||||||
bool vfd_frame_sync(struct const_iobuf *src);
|
|
||||||
|
|
||||||
HRESULT vfd_frame_encode(
|
|
||||||
struct iobuf *dest,
|
|
||||||
const void *ptr,
|
|
||||||
size_t nbytes);
|
|
353
board/vfd.c
353
board/vfd.c
@ -4,19 +4,15 @@
|
|||||||
|
|
||||||
Part number in schematics is "VFD GP1232A02A FUTABA".
|
Part number in schematics is "VFD GP1232A02A FUTABA".
|
||||||
|
|
||||||
Credits:
|
Little else about this board is known. Black-holing the RS232 comms that it
|
||||||
|
receives seems to be sufficient for the time being. */
|
||||||
Haruka
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "board/config.h"
|
|
||||||
#include "board/vfd.h"
|
#include "board/vfd.h"
|
||||||
#include "board/vfd-cmd.h"
|
|
||||||
|
|
||||||
#include "hook/iohook.h"
|
#include "hook/iohook.h"
|
||||||
|
|
||||||
@ -25,51 +21,15 @@
|
|||||||
#include "util/dprintf.h"
|
#include "util/dprintf.h"
|
||||||
#include "util/dump.h"
|
#include "util/dump.h"
|
||||||
|
|
||||||
#define SUPER_VERBOSE 0
|
|
||||||
|
|
||||||
static HRESULT vfd_handle_irp(struct irp *irp);
|
static HRESULT vfd_handle_irp(struct irp *irp);
|
||||||
|
|
||||||
static struct uart vfd_uart;
|
static struct uart vfd_uart;
|
||||||
static uint8_t vfd_written[4096];
|
static uint8_t vfd_written[512];
|
||||||
static uint8_t vfd_readable[4096];
|
static uint8_t vfd_readable[512];
|
||||||
|
|
||||||
static int encoding = VFD_ENC_SHIFT_JIS;
|
HRESULT vfd_hook_init(unsigned int port_no)
|
||||||
|
|
||||||
HRESULT vfd_handle_get_version(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_reset(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_clear_screen(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_set_brightness(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_set_screen_on(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_set_h_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_draw_image(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_set_cursor(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_set_encoding(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_set_text_wnd(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_set_text_speed(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_write_text(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_enable_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_disable_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_rotate(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_create_char(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
HRESULT vfd_handle_create_char2(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart);
|
|
||||||
|
|
||||||
static bool utf_enabled;
|
|
||||||
|
|
||||||
HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port)
|
|
||||||
{
|
{
|
||||||
if (!cfg->enable){
|
uart_init(&vfd_uart, port_no);
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
utf_enabled = cfg->utf_conversion;
|
|
||||||
|
|
||||||
int port = cfg->port;
|
|
||||||
if (port == 0){
|
|
||||||
port = default_port;
|
|
||||||
}
|
|
||||||
|
|
||||||
dprintf("VFD: enabling (port=%d)\n", port);
|
|
||||||
uart_init(&vfd_uart, port);
|
|
||||||
vfd_uart.written.bytes = vfd_written;
|
vfd_uart.written.bytes = vfd_written;
|
||||||
vfd_uart.written.nbytes = sizeof(vfd_written);
|
vfd_uart.written.nbytes = sizeof(vfd_written);
|
||||||
vfd_uart.readable.bytes = vfd_readable;
|
vfd_uart.readable.bytes = vfd_readable;
|
||||||
@ -78,48 +38,6 @@ HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port)
|
|||||||
return iohook_push_handler(vfd_handle_irp);
|
return iohook_push_handler(vfd_handle_irp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* get_encoding_name(int b){
|
|
||||||
switch (b){
|
|
||||||
case 0: return "gb2312";
|
|
||||||
case 1: return "big5";
|
|
||||||
case 2: return "shift-jis";
|
|
||||||
case 3: return "ks_c_5601-1987";
|
|
||||||
default: return "unknown";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void print_vfd_text(const char* str, int len){
|
|
||||||
|
|
||||||
if (utf_enabled){
|
|
||||||
|
|
||||||
wchar_t encoded[1024];
|
|
||||||
memset(encoded, 0, 1024 * sizeof(wchar_t));
|
|
||||||
|
|
||||||
int codepage = 0;
|
|
||||||
if (encoding == VFD_ENC_GB2312){
|
|
||||||
codepage = 936;
|
|
||||||
} else if (encoding == VFD_ENC_BIG5){
|
|
||||||
codepage = 950;
|
|
||||||
} else if (encoding == VFD_ENC_SHIFT_JIS){
|
|
||||||
codepage = 932;
|
|
||||||
} else if (encoding == VFD_ENC_KSC5601) {
|
|
||||||
codepage = 949;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!MultiByteToWideChar(codepage, MB_USEGLYPHCHARS, str, len, encoded, 1024)){
|
|
||||||
dprintf("VFD: Text conversion failed: %ld", GetLastError());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dprintf("VFD: Text: %ls\n", encoded);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
dprintf("VFD: Text: %s\n", str);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT vfd_handle_irp(struct irp *irp)
|
static HRESULT vfd_handle_irp(struct irp *irp)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
@ -130,274 +48,15 @@ static HRESULT vfd_handle_irp(struct irp *irp)
|
|||||||
return iohook_invoke_next(irp);
|
return iohook_invoke_next(irp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (irp->op == IRP_OP_OPEN){
|
|
||||||
dprintf("VFD: Open\n");
|
|
||||||
} else if (irp->op == IRP_OP_CLOSE){
|
|
||||||
dprintf("VFD: Close\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = uart_handle_irp(&vfd_uart, irp);
|
hr = uart_handle_irp(&vfd_uart, irp);
|
||||||
|
|
||||||
if (FAILED(hr) || irp->op != IRP_OP_WRITE) {
|
if (FAILED(hr) || irp->op != IRP_OP_WRITE) {
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SUPER_VERBOSE
|
|
||||||
dprintf("VFD TX:\n");
|
dprintf("VFD TX:\n");
|
||||||
dump_iobuf(&vfd_uart.written);
|
dump_iobuf(&vfd_uart.written);
|
||||||
#endif
|
|
||||||
|
|
||||||
struct const_iobuf reader;
|
|
||||||
iobuf_flip(&reader, &vfd_uart.written);
|
|
||||||
|
|
||||||
struct iobuf* writer = &vfd_uart.readable;
|
|
||||||
for (; reader.pos < reader.nbytes ; ){
|
|
||||||
|
|
||||||
if (vfd_frame_sync(&reader)) {
|
|
||||||
|
|
||||||
reader.pos++; // get the sync byte out of the way
|
|
||||||
|
|
||||||
uint8_t cmd;
|
|
||||||
iobuf_read_8(&reader, &cmd);
|
|
||||||
|
|
||||||
if (cmd == VFD_CMD_GET_VERSION) {
|
|
||||||
hr = vfd_handle_get_version(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_RESET) {
|
|
||||||
hr = vfd_handle_reset(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_CLEAR_SCREEN) {
|
|
||||||
hr = vfd_handle_clear_screen(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_SET_BRIGHTNESS) {
|
|
||||||
hr = vfd_handle_set_brightness(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_SET_SCREEN_ON) {
|
|
||||||
hr = vfd_handle_set_screen_on(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_SET_H_SCROLL) {
|
|
||||||
hr = vfd_handle_set_h_scroll(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_DRAW_IMAGE) {
|
|
||||||
hr = vfd_handle_draw_image(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_SET_CURSOR) {
|
|
||||||
hr = vfd_handle_set_cursor(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_SET_ENCODING) {
|
|
||||||
hr = vfd_handle_set_encoding(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_SET_TEXT_WND) {
|
|
||||||
hr = vfd_handle_set_text_wnd(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_SET_TEXT_SPEED) {
|
|
||||||
hr = vfd_handle_set_text_speed(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_WRITE_TEXT) {
|
|
||||||
hr = vfd_handle_write_text(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_ENABLE_SCROLL) {
|
|
||||||
hr = vfd_handle_enable_scroll(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_DISABLE_SCROLL) {
|
|
||||||
hr = vfd_handle_disable_scroll(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_ROTATE) {
|
|
||||||
hr = vfd_handle_rotate(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_CREATE_CHAR) {
|
|
||||||
hr = vfd_handle_create_char(&reader, writer, &vfd_uart);
|
|
||||||
} else if (cmd == VFD_CMD_CREATE_CHAR2) {
|
|
||||||
hr = vfd_handle_create_char2(&reader, writer, &vfd_uart);
|
|
||||||
} else {
|
|
||||||
dprintf("VFD: Unknown command 0x%x\n", cmd);
|
|
||||||
dump_const_iobuf(&reader);
|
|
||||||
hr = S_FALSE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// if no sync byte is sent, we are just getting plain text...
|
|
||||||
|
|
||||||
if (reader.pos < reader.nbytes){
|
|
||||||
int len = 0;
|
|
||||||
|
|
||||||
// read chars until we hit a new sync byte or the data ends
|
|
||||||
while (reader.pos + len + 1 < reader.nbytes && reader.bytes[reader.pos + len] != VFD_SYNC_BYTE && reader.bytes[reader.pos + len] != VFD_SYNC_BYTE2){
|
|
||||||
len++;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* str = malloc(len);
|
|
||||||
memset(str, 0, len);
|
|
||||||
iobuf_read(&reader, str, len);
|
|
||||||
print_vfd_text(str, len);
|
|
||||||
free(str);
|
|
||||||
|
|
||||||
reader.pos += len;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SUCCEEDED(hr)){
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vfd_uart.written.pos = 0;
|
vfd_uart.written.pos = 0;
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT vfd_handle_get_version(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
dprintf("VFD: Get Version\n");
|
|
||||||
|
|
||||||
struct vfd_resp_board_info resp;
|
|
||||||
|
|
||||||
memset(&resp, 0, sizeof(resp));
|
|
||||||
resp.unk1 = 2;
|
|
||||||
strcpy(resp.version, "01.20");
|
|
||||||
resp.unk2 = 1;
|
|
||||||
|
|
||||||
return vfd_frame_encode(writer, &resp, sizeof(resp));
|
|
||||||
}
|
|
||||||
HRESULT vfd_handle_reset(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
dprintf("VFD: Reset\n");
|
|
||||||
|
|
||||||
encoding = VFD_ENC_SHIFT_JIS;
|
|
||||||
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
HRESULT vfd_handle_clear_screen(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
dprintf("VFD: Clear Screen\n");
|
|
||||||
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
HRESULT vfd_handle_set_brightness(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
uint8_t b;
|
|
||||||
iobuf_read_8(reader, &b);
|
|
||||||
|
|
||||||
if (b > 4){
|
|
||||||
dprintf("VFD: Brightness, invalid argument\n");
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
dprintf("VFD: Brightness, %d\n", b);
|
|
||||||
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
HRESULT vfd_handle_set_screen_on(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
uint8_t b;
|
|
||||||
iobuf_read_8(reader, &b);
|
|
||||||
|
|
||||||
if (b > 1){
|
|
||||||
dprintf("VFD: Screen Power, invalid argument\n");
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
dprintf("VFD: Screen Power, %d\n", b);
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
HRESULT vfd_handle_set_h_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
uint8_t x;
|
|
||||||
iobuf_read_8(reader, &x);
|
|
||||||
|
|
||||||
dprintf("VFD: Horizontal Scroll, X=%d\n", x);
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
HRESULT vfd_handle_draw_image(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
int w, h;
|
|
||||||
uint16_t x0, x1;
|
|
||||||
uint8_t y0, y1;
|
|
||||||
uint8_t image[2048];
|
|
||||||
|
|
||||||
iobuf_read_be16(reader, &x0);
|
|
||||||
iobuf_read_8(reader, &y0);
|
|
||||||
iobuf_read_be16(reader, &x1);
|
|
||||||
iobuf_read_8(reader, &y1);
|
|
||||||
w = x1 - x0;
|
|
||||||
h = y1 - y0;
|
|
||||||
iobuf_read(reader, image, w*h);
|
|
||||||
|
|
||||||
dprintf("VFD: Draw image, %dx%d\n", w, h);
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT vfd_handle_set_cursor(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
uint16_t x;
|
|
||||||
uint8_t y;
|
|
||||||
|
|
||||||
iobuf_read_be16(reader, &x);
|
|
||||||
iobuf_read_8(reader, &y);
|
|
||||||
|
|
||||||
dprintf("VFD: Set Cursor, x=%d,y=%d\n", x, y);
|
|
||||||
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT vfd_handle_set_encoding(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
uint8_t b;
|
|
||||||
iobuf_read_8(reader, &b);
|
|
||||||
|
|
||||||
dprintf("VFD: Set Encoding, %d (%s)\n", b, get_encoding_name(b));
|
|
||||||
|
|
||||||
if (b < 0 || b > VFD_ENC_MAX){
|
|
||||||
dprintf("Invalid encoding specified\n");
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
encoding = b;
|
|
||||||
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
HRESULT vfd_handle_set_text_wnd(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
uint16_t x0, x1;
|
|
||||||
uint8_t y0, y1;
|
|
||||||
|
|
||||||
iobuf_read_be16(reader, &x0);
|
|
||||||
iobuf_read_8(reader, &y0);
|
|
||||||
iobuf_read_be16(reader, &x1);
|
|
||||||
iobuf_read_8(reader, &y1);
|
|
||||||
|
|
||||||
dprintf("VFD: Set Text Window, p0:%d,%d, p1:%d,%d\n", x0, y0, x1, y1);
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
HRESULT vfd_handle_set_text_speed(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
uint8_t b;
|
|
||||||
iobuf_read_8(reader, &b);
|
|
||||||
|
|
||||||
dprintf("VFD: Set Text Speed, %d\n", b);
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
HRESULT vfd_handle_write_text(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
uint8_t len;
|
|
||||||
iobuf_read_8(reader, &len);
|
|
||||||
|
|
||||||
char* str = malloc(len);
|
|
||||||
iobuf_read(reader, str, len);
|
|
||||||
|
|
||||||
print_vfd_text(str, len);
|
|
||||||
free(str);
|
|
||||||
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
HRESULT vfd_handle_enable_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
dprintf("VFD: Enable Scrolling\n");
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
HRESULT vfd_handle_disable_scroll(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
dprintf("VFD: Disable Scrolling\n");
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
HRESULT vfd_handle_rotate(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
uint8_t b;
|
|
||||||
iobuf_read_8(reader, &b);
|
|
||||||
|
|
||||||
dprintf("VFD: Rotate, %d\n", b);
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
HRESULT vfd_handle_create_char(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
uint8_t b;
|
|
||||||
iobuf_read_8(reader, &b);
|
|
||||||
char buf[32];
|
|
||||||
|
|
||||||
iobuf_read(reader, buf, 32);
|
|
||||||
|
|
||||||
dprintf("VFD: Create character, %d\n", b);
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
HRESULT vfd_handle_create_char2(struct const_iobuf* reader, struct iobuf* writer, struct uart* vfd_uart){
|
|
||||||
uint8_t b, b2;
|
|
||||||
iobuf_read_8(reader, &b);
|
|
||||||
iobuf_read_8(reader, &b2);
|
|
||||||
char buf[16];
|
|
||||||
|
|
||||||
iobuf_read(reader, buf, 16);
|
|
||||||
|
|
||||||
dprintf("VFD: Create character, %d, %d\n", b, b2);
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
|
10
board/vfd.h
10
board/vfd.h
@ -2,12 +2,4 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
struct vfd_config {
|
HRESULT vfd_hook_init(unsigned int port_no);
|
||||||
bool enable;
|
|
||||||
int port;
|
|
||||||
bool utf_conversion;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
HRESULT vfd_hook_init(struct vfd_config *cfg, int default_port);
|
|
||||||
|
|
||||||
|
54
dist/kizuna/bananatools.ini
vendored
54
dist/kizuna/bananatools.ini
vendored
@ -1,54 +0,0 @@
|
|||||||
; Controls the virtual file system hooks. These redirect file i/o
|
|
||||||
; requests to a folder specified below, instead of the drive.
|
|
||||||
; These are all required, even if the game doesn't use one of them.
|
|
||||||
[vfs]
|
|
||||||
path=
|
|
||||||
|
|
||||||
[dns]
|
|
||||||
default=localhost
|
|
||||||
|
|
||||||
; Security dongle emulation, disable if you have a
|
|
||||||
; real dongle connected that you want to use
|
|
||||||
[dongle]
|
|
||||||
enable=1
|
|
||||||
serial=284013090501
|
|
||||||
|
|
||||||
; Set the network environment. Most games seem to want 192.168.123.X
|
|
||||||
[netenv]
|
|
||||||
enable=1
|
|
||||||
subnet=192.168.10.0
|
|
||||||
|
|
||||||
; Graphics hook, may cause crashes in some games
|
|
||||||
[gfx]
|
|
||||||
enable=1
|
|
||||||
windowed=1
|
|
||||||
framed=0
|
|
||||||
monitor=0
|
|
||||||
|
|
||||||
[misc]
|
|
||||||
systemVersion=SK2100-1-NA-SYS0-L02
|
|
||||||
|
|
||||||
; Control the AMCUS replacement class
|
|
||||||
[amcus]
|
|
||||||
enable=0
|
|
||||||
game_id=SDGG
|
|
||||||
game_cd=SK21
|
|
||||||
am_game_ver=1.00
|
|
||||||
cacfg_game_ver=33.02
|
|
||||||
server_uri=localhost
|
|
||||||
server_host=localhost
|
|
||||||
|
|
||||||
[reader]
|
|
||||||
enable=1
|
|
||||||
access_code=00000000000000000000
|
|
||||||
|
|
||||||
; USIO config
|
|
||||||
[usio]
|
|
||||||
enable=1
|
|
||||||
test=0x24
|
|
||||||
service=0x2E
|
|
||||||
coin=0x2D
|
|
||||||
up=0x26
|
|
||||||
down=0x28
|
|
||||||
enter=0x0D
|
|
||||||
|
|
10
dist/kizuna/start.bat
vendored
10
dist/kizuna/start.bat
vendored
@ -1,10 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
pushd %~dp0
|
|
||||||
|
|
||||||
start inject.exe -d -k kizunahook.dll AMCUS\AMAuthd.exe
|
|
||||||
inject.exe -d -k kizunahook.dll WindowsNoEditor\KizunaGame\Binaries\Win64\TKizunaGame-Win64-Shipping.exe
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo The game process has terminated
|
|
||||||
pause
|
|
6
dist/sao/bananatools.ini
vendored
6
dist/sao/bananatools.ini
vendored
@ -30,10 +30,10 @@ windowed=1
|
|||||||
framed=0
|
framed=0
|
||||||
monitor=0
|
monitor=0
|
||||||
|
|
||||||
; Aime reader
|
; Banapass reader
|
||||||
[aime]
|
[reader]
|
||||||
enable=1
|
enable=1
|
||||||
aimePath=DEVICE\\aime.txt
|
access_code=00000000000000000000
|
||||||
|
|
||||||
; Control the AMCUS replacement class
|
; Control the AMCUS replacement class
|
||||||
[amcus]
|
[amcus]
|
||||||
|
@ -420,10 +420,6 @@ static int WSAAPI hook_getaddrinfo(
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(pNodeName, "239.255.255.250") && !strcmp(pServiceName, "1900")) {
|
|
||||||
return next_getaddrinfo(pNodeName, pServiceName, pHints, ppResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
mbstowcs_s(&wstr_c, NULL, 0, pNodeName, 0);
|
mbstowcs_s(&wstr_c, NULL, 0, pNodeName, 0);
|
||||||
wstr = malloc(wstr_c * sizeof(wchar_t));
|
wstr = malloc(wstr_c * sizeof(wchar_t));
|
||||||
|
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
#include <assert.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include "kizunahook/config.h"
|
|
||||||
|
|
||||||
#include "platform/config.h"
|
|
||||||
|
|
||||||
void kizuna_dll_config_load(
|
|
||||||
struct kizuna_dll_config *cfg,
|
|
||||||
const wchar_t *filename)
|
|
||||||
{
|
|
||||||
assert(cfg != NULL);
|
|
||||||
assert(filename != NULL);
|
|
||||||
|
|
||||||
GetPrivateProfileStringW(
|
|
||||||
L"kizunaio",
|
|
||||||
L"path",
|
|
||||||
L"",
|
|
||||||
cfg->path,
|
|
||||||
_countof(cfg->path),
|
|
||||||
filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
void kizuna_hook_config_load(
|
|
||||||
struct kizuna_hook_config *cfg,
|
|
||||||
const wchar_t *filename)
|
|
||||||
{
|
|
||||||
assert(cfg != NULL);
|
|
||||||
assert(filename != NULL);
|
|
||||||
|
|
||||||
aime_config_load(&cfg->aime, filename);
|
|
||||||
platform_config_load(&cfg->platform, filename);
|
|
||||||
kizuna_dll_config_load(&cfg->dll, filename);
|
|
||||||
gfx_config_load(&cfg->gfx, filename);
|
|
||||||
usio_config_load(&cfg->usio, filename);
|
|
||||||
vfd_config_load(&cfg->vfd, filename);
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include "kizunahook/kizuna-dll.h"
|
|
||||||
|
|
||||||
#include "platform/config.h"
|
|
||||||
#include "gfxhook/config.h"
|
|
||||||
#include "amcus/config.h"
|
|
||||||
#include "board/config.h"
|
|
||||||
|
|
||||||
struct kizuna_hook_config {
|
|
||||||
struct platform_config platform;
|
|
||||||
struct aime_config aime;
|
|
||||||
struct kizuna_dll_config dll;
|
|
||||||
struct gfx_config gfx;
|
|
||||||
struct amcus_config amcus;
|
|
||||||
struct usio_config usio;
|
|
||||||
struct vfd_config vfd;
|
|
||||||
};
|
|
||||||
|
|
||||||
void kizuna_dll_config_load(
|
|
||||||
struct kizuna_dll_config *cfg,
|
|
||||||
const wchar_t *filename);
|
|
||||||
|
|
||||||
void kizuna_hook_config_load(
|
|
||||||
struct kizuna_hook_config *cfg,
|
|
||||||
const wchar_t *filename);
|
|
||||||
|
|
@ -1,104 +0,0 @@
|
|||||||
#include <windows.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "kizunahook/config.h"
|
|
||||||
#include "kizunahook/kizuna-dll.h"
|
|
||||||
#include "kizunahook/usio.h"
|
|
||||||
|
|
||||||
#include "amcus/amcus.h"
|
|
||||||
|
|
||||||
#include "hook/process.h"
|
|
||||||
|
|
||||||
#include "hooklib/serial.h"
|
|
||||||
#include "board/sg-reader.h"
|
|
||||||
#include "board/vfd.h"
|
|
||||||
|
|
||||||
#include "platform/platform.h"
|
|
||||||
#include "gfxhook/gfx.h"
|
|
||||||
#include "gfxhook/dxgi.h"
|
|
||||||
#include "gfxhook/d3d11.h"
|
|
||||||
|
|
||||||
#include "util/dprintf.h"
|
|
||||||
|
|
||||||
static HMODULE kizuna_hook_mod;
|
|
||||||
static process_entry_t kizuna_startup;
|
|
||||||
static struct kizuna_hook_config kizuna_hook_cfg;
|
|
||||||
|
|
||||||
static DWORD CALLBACK kizuna_pre_startup(void)
|
|
||||||
{
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
dprintf("--- Begin kizuna_pre_startup ---\n");
|
|
||||||
|
|
||||||
kizuna_hook_config_load(&kizuna_hook_cfg, L".\\bananatools.ini");
|
|
||||||
|
|
||||||
serial_hook_init();
|
|
||||||
|
|
||||||
struct dongle_info dinfo;
|
|
||||||
dinfo.pid = 0x0C00;
|
|
||||||
dinfo.vid = 0x0B9A;
|
|
||||||
|
|
||||||
hr = platform_hook_init(&kizuna_hook_cfg.platform, PLATFORM_BNA1, NULL, kizuna_hook_mod, dinfo);
|
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
ExitProcess(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = sg_reader_hook_init(&kizuna_hook_cfg.aime, 1, 3, kizuna_hook_mod);
|
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
ExitProcess(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = vfd_hook_init(&kizuna_hook_cfg.vfd, 2);
|
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
ExitProcess(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = kizuna_dll_init(&kizuna_hook_cfg.dll, kizuna_hook_mod);
|
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
ExitProcess(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = kizuna_usio_hook_init(&kizuna_hook_cfg.usio);
|
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
ExitProcess(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = amcus_hook_init(&kizuna_hook_cfg.amcus);
|
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
ExitProcess(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
gfx_hook_init(&kizuna_hook_cfg.gfx);
|
|
||||||
gfx_d3d11_hook_init(&kizuna_hook_cfg.gfx, kizuna_hook_mod);
|
|
||||||
gfx_dxgi_hook_init(&kizuna_hook_cfg.gfx, kizuna_hook_mod);
|
|
||||||
|
|
||||||
dprintf("--- End kizuna_pre_startup ---\n");
|
|
||||||
|
|
||||||
return kizuna_startup();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HMODULE mod, DWORD cause, void *ctx)
|
|
||||||
{
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
if (cause != DLL_PROCESS_ATTACH) {
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
kizuna_hook_mod = mod;
|
|
||||||
|
|
||||||
hr = process_hijack_startup(kizuna_pre_startup, &kizuna_startup);
|
|
||||||
|
|
||||||
if (!SUCCEEDED(hr)) {
|
|
||||||
dprintf("Failed to hijack process startup: %x\n", (int) hr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return SUCCEEDED(hr);
|
|
||||||
}
|
|
@ -1,106 +0,0 @@
|
|||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "kizunahook/kizuna-dll.h"
|
|
||||||
|
|
||||||
#include "util/dll-bind.h"
|
|
||||||
#include "util/dprintf.h"
|
|
||||||
|
|
||||||
const struct dll_bind_sym kizuna_dll_syms[] = {
|
|
||||||
{
|
|
||||||
.sym = "kizuna_io_init",
|
|
||||||
.off = offsetof(struct kizuna_dll, init),
|
|
||||||
}, {
|
|
||||||
.sym = "kizuna_io_read_coin_counter",
|
|
||||||
.off = offsetof(struct kizuna_dll, read_coin_counter),
|
|
||||||
}, {
|
|
||||||
.sym = "kizuna_io_get_opbtns",
|
|
||||||
.off = offsetof(struct kizuna_dll, get_opbtns),
|
|
||||||
}, {
|
|
||||||
.sym = "kizuna_io_get_analog",
|
|
||||||
.off = offsetof(struct kizuna_dll, get_analog),
|
|
||||||
}, {
|
|
||||||
.sym = "kizuna_io_get_gamebtns",
|
|
||||||
.off = offsetof(struct kizuna_dll, get_gamebtns),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct kizuna_dll kizuna_dll;
|
|
||||||
|
|
||||||
HRESULT kizuna_dll_init(const struct kizuna_dll_config *cfg, HINSTANCE self)
|
|
||||||
{
|
|
||||||
uint16_t (*get_api_version)(void);
|
|
||||||
const struct dll_bind_sym *sym;
|
|
||||||
HINSTANCE owned;
|
|
||||||
HINSTANCE src;
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
assert(cfg != NULL);
|
|
||||||
assert(self != NULL);
|
|
||||||
|
|
||||||
if (cfg->path[0] != L'\0') {
|
|
||||||
owned = LoadLibraryW(cfg->path);
|
|
||||||
|
|
||||||
if (owned == NULL) {
|
|
||||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
|
||||||
dprintf("Kizuna IO: Failed to load IO DLL: %lx: %S\n",
|
|
||||||
hr,
|
|
||||||
cfg->path);
|
|
||||||
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
dprintf("Kizuna IO: Using custom IO DLL: %S\n", cfg->path);
|
|
||||||
src = owned;
|
|
||||||
} else {
|
|
||||||
owned = NULL;
|
|
||||||
src = self;
|
|
||||||
}
|
|
||||||
|
|
||||||
get_api_version = (void *) GetProcAddress(src, "kizuna_io_get_api_version");
|
|
||||||
|
|
||||||
if (get_api_version != NULL) {
|
|
||||||
kizuna_dll.api_version = get_api_version();
|
|
||||||
} else {
|
|
||||||
kizuna_dll.api_version = 0x0100;
|
|
||||||
dprintf("Custom IO DLL does not expose kizuna_io_get_api_version, "
|
|
||||||
"assuming API version 1.0.\n"
|
|
||||||
"Please ask the developer to update their DLL.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (kizuna_dll.api_version >= 0x0200) {
|
|
||||||
hr = E_NOTIMPL;
|
|
||||||
dprintf("Kizuna IO: Custom IO DLL implements an unsupported "
|
|
||||||
"API version (%#04x). Please update Segatools.\n",
|
|
||||||
kizuna_dll.api_version);
|
|
||||||
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
sym = kizuna_dll_syms;
|
|
||||||
hr = dll_bind(&kizuna_dll, src, &sym, _countof(kizuna_dll_syms));
|
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
if (src != self) {
|
|
||||||
dprintf("Kizuna IO: Custom IO DLL does not provide function "
|
|
||||||
"\"%s\". Please contact your IO DLL's developer for "
|
|
||||||
"further assistance.\n",
|
|
||||||
sym->sym);
|
|
||||||
|
|
||||||
goto end;
|
|
||||||
} else {
|
|
||||||
dprintf("Internal error: could not reflect \"%s\"\n", sym->sym);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
owned = NULL;
|
|
||||||
|
|
||||||
end:
|
|
||||||
if (owned != NULL) {
|
|
||||||
FreeLibrary(owned);
|
|
||||||
}
|
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include "kizunaio/kizunaio.h"
|
|
||||||
|
|
||||||
struct kizuna_dll {
|
|
||||||
uint16_t api_version;
|
|
||||||
HRESULT (*init)(void);
|
|
||||||
HRESULT (*poll)(void);
|
|
||||||
void (*read_coin_counter)(uint16_t *coins, uint16_t *services);
|
|
||||||
void (*get_opbtns)(uint8_t *opbtn);
|
|
||||||
void (*get_gamebtns)(uint8_t *gamebtns);
|
|
||||||
void (*get_analog)(uint8_t *x, uint8_t *y);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct kizuna_dll_config {
|
|
||||||
wchar_t path[MAX_PATH];
|
|
||||||
};
|
|
||||||
|
|
||||||
extern struct kizuna_dll kizuna_dll;
|
|
||||||
|
|
||||||
HRESULT kizuna_dll_init(const struct kizuna_dll_config *cfg, HINSTANCE self);
|
|
@ -1,15 +0,0 @@
|
|||||||
LIBRARY kizunahook
|
|
||||||
|
|
||||||
EXPORTS
|
|
||||||
aime_io_get_api_version
|
|
||||||
aime_io_init
|
|
||||||
aime_io_led_set_color
|
|
||||||
aime_io_nfc_get_aime_id
|
|
||||||
aime_io_nfc_get_felica_id
|
|
||||||
aime_io_nfc_poll
|
|
||||||
kizuna_io_get_api_version
|
|
||||||
kizuna_io_init
|
|
||||||
kizuna_io_read_coin_counter
|
|
||||||
kizuna_io_get_analog
|
|
||||||
kizuna_io_get_gamebtns
|
|
||||||
kizuna_io_get_opbtns
|
|
@ -1,33 +0,0 @@
|
|||||||
shared_library(
|
|
||||||
'kizunahook',
|
|
||||||
name_prefix : '',
|
|
||||||
include_directories : inc,
|
|
||||||
implicit_include_directories : false,
|
|
||||||
vs_module_defs : 'kizunahook.def',
|
|
||||||
c_pch : '../precompiled.h',
|
|
||||||
dependencies : [
|
|
||||||
capnhook.get_variable('hook_dep'),
|
|
||||||
capnhook.get_variable('hooklib_dep'),
|
|
||||||
xinput_lib,
|
|
||||||
],
|
|
||||||
link_with : [
|
|
||||||
kizunaio_lib,
|
|
||||||
amcus_lib,
|
|
||||||
platform_lib,
|
|
||||||
util_lib,
|
|
||||||
hooklib_lib,
|
|
||||||
gfxhook_lib,
|
|
||||||
jvs_lib,
|
|
||||||
board_lib,
|
|
||||||
aimeio_lib
|
|
||||||
],
|
|
||||||
sources : [
|
|
||||||
'dllmain.c',
|
|
||||||
'config.c',
|
|
||||||
'config.h',
|
|
||||||
'kizuna-dll.c',
|
|
||||||
'kizuna-dll.h',
|
|
||||||
'usio.c',
|
|
||||||
'usio.h',
|
|
||||||
],
|
|
||||||
)
|
|
@ -1,103 +0,0 @@
|
|||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include "board/usio.h"
|
|
||||||
|
|
||||||
#include "kizunahook/kizuna-dll.h"
|
|
||||||
|
|
||||||
#include "util/dprintf.h"
|
|
||||||
|
|
||||||
bool kizuna_io_coin = false;
|
|
||||||
uint16_t kizuna_io_coins = 0;
|
|
||||||
|
|
||||||
static HRESULT kizuna_usio_poll(void *ctx, struct usio_state *state);
|
|
||||||
|
|
||||||
static const struct usio_ops kizuna_usio_ops = {
|
|
||||||
.poll = kizuna_usio_poll,
|
|
||||||
};
|
|
||||||
|
|
||||||
HRESULT kizuna_usio_hook_init(const struct usio_config *cfg)
|
|
||||||
{
|
|
||||||
HRESULT hr;
|
|
||||||
assert(kizuna_dll.init != NULL);
|
|
||||||
|
|
||||||
hr = usio_hook_init(cfg, &kizuna_usio_ops, NULL, NULL);
|
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
dprintf("Kizuna USIO: Init\n");
|
|
||||||
|
|
||||||
return kizuna_dll.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT kizuna_usio_poll(void *ctx, struct usio_state *state)
|
|
||||||
{
|
|
||||||
uint8_t opbtn_out = 0;
|
|
||||||
uint8_t gamebtn_out = 0;
|
|
||||||
uint8_t x = 128;
|
|
||||||
uint8_t y = 128;
|
|
||||||
uint8_t z = 128;
|
|
||||||
uint8_t r = 128;
|
|
||||||
uint16_t coin_ct = 0;
|
|
||||||
uint16_t service_ct = 0;
|
|
||||||
|
|
||||||
kizuna_dll.get_opbtns(&opbtn_out);
|
|
||||||
kizuna_dll.get_analog(&x, &y);
|
|
||||||
kizuna_dll.read_coin_counter(&coin_ct, &service_ct);
|
|
||||||
kizuna_dll.get_gamebtns(&gamebtn_out);
|
|
||||||
|
|
||||||
state->op_btns = 0;
|
|
||||||
state->p1_btns = 0;
|
|
||||||
state->p2_btns = 0;
|
|
||||||
|
|
||||||
if (opbtn_out & 0x01) {
|
|
||||||
state->op_btns |= 0x80; // Test
|
|
||||||
}
|
|
||||||
if (opbtn_out & 0x02) {
|
|
||||||
state->p1_btns |= 0x40; // Service
|
|
||||||
}
|
|
||||||
if (opbtn_out & 0x04) {
|
|
||||||
state->p1_btns |= 0x20; // Up
|
|
||||||
}
|
|
||||||
if (opbtn_out & 0x08) {
|
|
||||||
state->p1_btns |= 0x10; // Down
|
|
||||||
}
|
|
||||||
if (opbtn_out & 0x10) {
|
|
||||||
state->p1_btns |= 0x02; // Enter
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gamebtn_out & 0x01) {
|
|
||||||
state->p1_btns |= 0x2000;
|
|
||||||
}
|
|
||||||
if (gamebtn_out & 0x02) {
|
|
||||||
state->p1_btns |= 0x1000;
|
|
||||||
}
|
|
||||||
if (gamebtn_out & 0x04) {
|
|
||||||
state->p1_btns |= 0x0800;
|
|
||||||
}
|
|
||||||
if (gamebtn_out & 0x08) {
|
|
||||||
state->p1_btns |= 0x4000;
|
|
||||||
}
|
|
||||||
if (gamebtn_out & 0x10) {
|
|
||||||
state->p1_btns |= 0x01;
|
|
||||||
}
|
|
||||||
if (gamebtn_out & 0x20) {
|
|
||||||
state->p1_btns |= 0x8000;
|
|
||||||
}
|
|
||||||
|
|
||||||
state->analog[0] = x << 8;
|
|
||||||
state->analog[1] = y << 8;
|
|
||||||
state->analog[2] = z << 8;
|
|
||||||
state->analog[3] = r << 8;
|
|
||||||
|
|
||||||
state->coins[0].current_coin_count = coin_ct;
|
|
||||||
state->service.current_coin_count = service_ct;
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include "board/usio.h"
|
|
||||||
|
|
||||||
HRESULT kizuna_usio_hook_init(const struct usio_config *cfg);
|
|
@ -1,29 +0,0 @@
|
|||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "kizunaio/config.h"
|
|
||||||
|
|
||||||
void kizuna_io_config_load(struct kizuna_input_config *cfg, const wchar_t *filename)
|
|
||||||
{
|
|
||||||
cfg->test = GetPrivateProfileIntW(L"usio", L"test", VK_HOME, filename);
|
|
||||||
cfg->service = GetPrivateProfileIntW(L"usio", L"service", VK_DELETE, filename);
|
|
||||||
cfg->coin = GetPrivateProfileIntW(L"usio", L"coin", VK_INSERT, filename);
|
|
||||||
cfg->up = GetPrivateProfileIntW(L"usio", L"up", VK_UP, filename);
|
|
||||||
cfg->down = GetPrivateProfileIntW(L"usio", L"down", VK_DOWN, filename);
|
|
||||||
cfg->enter = GetPrivateProfileIntW(L"usio", L"enter", VK_RETURN, filename);
|
|
||||||
|
|
||||||
cfg->stick_up = GetPrivateProfileIntW(L"usio", L"stick_up", 'W', filename);
|
|
||||||
cfg->stick_left = GetPrivateProfileIntW(L"usio", L"stick_left", 'A', filename);
|
|
||||||
cfg->stick_down = GetPrivateProfileIntW(L"usio", L"stick_down", 'S', filename);
|
|
||||||
cfg->stick_right = GetPrivateProfileIntW(L"usio", L"stick_right", 'D', filename);
|
|
||||||
cfg->stick_btn1 = GetPrivateProfileIntW(L"usio", L"stick_btn1", 'R', filename);
|
|
||||||
cfg->stick_btn2 = GetPrivateProfileIntW(L"usio", L"stick_btn2", 'F', filename);
|
|
||||||
cfg->stick_btn3 = GetPrivateProfileIntW(L"usio", L"stick_btn3", 'V', filename);
|
|
||||||
|
|
||||||
cfg->btn1 = GetPrivateProfileIntW(L"usio", L"btn1", '1', filename);
|
|
||||||
cfg->btn2 = GetPrivateProfileIntW(L"usio", L"btn2", '2', filename);
|
|
||||||
cfg->btn3 = GetPrivateProfileIntW(L"usio", L"btn3", '3', filename);
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
|
||||||
struct kizuna_input_config {
|
|
||||||
uint8_t test;
|
|
||||||
uint8_t service;
|
|
||||||
uint8_t up;
|
|
||||||
uint8_t down;
|
|
||||||
uint8_t enter;
|
|
||||||
uint8_t coin;
|
|
||||||
|
|
||||||
uint8_t stick_up;
|
|
||||||
uint8_t stick_down;
|
|
||||||
uint8_t stick_left;
|
|
||||||
uint8_t stick_right;
|
|
||||||
|
|
||||||
uint8_t stick_btn1;
|
|
||||||
uint8_t stick_btn2;
|
|
||||||
uint8_t stick_btn3;
|
|
||||||
|
|
||||||
uint8_t btn1;
|
|
||||||
uint8_t btn2;
|
|
||||||
uint8_t btn3;
|
|
||||||
};
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
void kizuna_io_config_load(struct kizuna_input_config *cfg, const wchar_t *filename);
|
|
@ -1,132 +0,0 @@
|
|||||||
#include <windows.h>
|
|
||||||
#include <xinput.h>
|
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include "kizunaio/kizunaio.h"
|
|
||||||
#include "kizunaio/config.h"
|
|
||||||
|
|
||||||
#include "util/dprintf.h"
|
|
||||||
|
|
||||||
static bool kizuna_io_coin = false;
|
|
||||||
static bool kizuna_io_service = false;
|
|
||||||
static bool kizuna_test_toggle = false;
|
|
||||||
static bool kizuna_test_last_state = false;
|
|
||||||
static uint16_t kizuna_coin_ct = 0;
|
|
||||||
static uint16_t kizuna_service_ct = 0;
|
|
||||||
static struct kizuna_input_config cfg;
|
|
||||||
|
|
||||||
uint16_t kizuna_io_get_api_version(void)
|
|
||||||
{
|
|
||||||
return 0x0100;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT kizuna_io_init(void)
|
|
||||||
{
|
|
||||||
dprintf("Kizuna IO: Init\n");
|
|
||||||
kizuna_io_config_load(&cfg, L".\\bananatools.ini");
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void kizuna_io_get_opbtns(uint8_t *opbtn)
|
|
||||||
{
|
|
||||||
if ((GetAsyncKeyState(cfg.test) & 0x8000)) {
|
|
||||||
if (!kizuna_test_last_state) {
|
|
||||||
kizuna_test_toggle = !kizuna_test_toggle;
|
|
||||||
}
|
|
||||||
kizuna_test_last_state = true;
|
|
||||||
} else {
|
|
||||||
kizuna_test_last_state = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetAsyncKeyState(cfg.service) & 0x8000) {
|
|
||||||
*opbtn |= KIZUNA_IO_OPBTN_SERVICE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetAsyncKeyState(cfg.up) & 0x8000) {
|
|
||||||
*opbtn |= KIZUNA_IO_OPBTN_UP;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetAsyncKeyState(cfg.down) & 0x8000) {
|
|
||||||
*opbtn |= KIZUNA_IO_OPBTN_DOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetAsyncKeyState(cfg.enter) & 0x8000) {
|
|
||||||
*opbtn |= KIZUNA_IO_OPBTN_ENTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (kizuna_test_toggle) {
|
|
||||||
*opbtn |= KIZUNA_IO_OPBTN_TEST;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void kizuna_io_get_gamebtns(uint8_t *gamebtns)
|
|
||||||
{
|
|
||||||
*gamebtns = 0;
|
|
||||||
if (GetAsyncKeyState(cfg.btn1) & 0x8000) {
|
|
||||||
*gamebtns |= KIZUNA_IO_GAMEBTN_1;
|
|
||||||
}
|
|
||||||
if (GetAsyncKeyState(cfg.btn2) & 0x8000) {
|
|
||||||
*gamebtns |= KIZUNA_IO_GAMEBTN_2;
|
|
||||||
}
|
|
||||||
if (GetAsyncKeyState(cfg.btn3) & 0x8000) {
|
|
||||||
*gamebtns |= KIZUNA_IO_GAMEBTN_3;
|
|
||||||
}
|
|
||||||
if (GetAsyncKeyState(cfg.stick_btn1) & 0x8000) {
|
|
||||||
*gamebtns |= KIZUNA_IO_GAMEBTN_STICK1;
|
|
||||||
}
|
|
||||||
if (GetAsyncKeyState(cfg.stick_btn2) & 0x8000) {
|
|
||||||
*gamebtns |= KIZUNA_IO_GAMEBTN_STICK2;
|
|
||||||
}
|
|
||||||
if (GetAsyncKeyState(cfg.stick_btn3) & 0x8000) {
|
|
||||||
*gamebtns |= KIZUNA_IO_GAMEBTN_STICK3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void kizuna_io_get_analog(uint8_t *x, uint8_t *y)
|
|
||||||
{
|
|
||||||
*x = 128;
|
|
||||||
*y = 128;
|
|
||||||
if (GetAsyncKeyState(cfg.stick_up) & 0x8000) {
|
|
||||||
*y += 127;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetAsyncKeyState(cfg.stick_down) & 0x8000) {
|
|
||||||
*y -= 128;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetAsyncKeyState(cfg.stick_right) & 0x8000) {
|
|
||||||
*x += 127;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetAsyncKeyState(cfg.stick_left) & 0x8000) {
|
|
||||||
*x -= 128;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void kizuna_io_read_coin_counter(uint16_t *coins, uint16_t *services)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (GetAsyncKeyState(cfg.coin) & 0x8000) {
|
|
||||||
if (!kizuna_io_coin) {
|
|
||||||
kizuna_io_coin = true;
|
|
||||||
kizuna_coin_ct++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
kizuna_io_coin = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetAsyncKeyState(cfg.service) & 0x8000) {
|
|
||||||
if (!kizuna_io_service) {
|
|
||||||
kizuna_io_service = true;
|
|
||||||
kizuna_service_ct++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
kizuna_io_service = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
*coins = kizuna_coin_ct;
|
|
||||||
*services = kizuna_service_ct;
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
LIBRARY kizunahook
|
|
||||||
|
|
||||||
EXPORTS
|
|
||||||
kizuna_io_get_api_version
|
|
||||||
kizuna_io_init
|
|
||||||
kizuna_io_read_coin_counter
|
|
||||||
kizuna_io_get_analog
|
|
||||||
kizuna_io_get_gamebtns
|
|
||||||
kizuna_io_get_opbtns
|
|
@ -1,67 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "kizunaio/config.h"
|
|
||||||
|
|
||||||
enum {
|
|
||||||
KIZUNA_IO_OPBTN_TEST = 0x01,
|
|
||||||
KIZUNA_IO_OPBTN_SERVICE = 0x02,
|
|
||||||
KIZUNA_IO_OPBTN_UP = 0x04,
|
|
||||||
KIZUNA_IO_OPBTN_DOWN = 0x08,
|
|
||||||
KIZUNA_IO_OPBTN_ENTER = 0x10,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
KIZUNA_IO_GAMEBTN_1 = 0x0001,
|
|
||||||
KIZUNA_IO_GAMEBTN_2 = 0x0002,
|
|
||||||
KIZUNA_IO_GAMEBTN_3 = 0x0004,
|
|
||||||
KIZUNA_IO_GAMEBTN_STICK1 = 0x0008,
|
|
||||||
KIZUNA_IO_GAMEBTN_STICK2 = 0x0010,
|
|
||||||
KIZUNA_IO_GAMEBTN_STICK3 = 0x0020,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Get the version of the Pokken IO API that this DLL supports. This
|
|
||||||
function should return a positive 16-bit integer, where the high byte is
|
|
||||||
the major version and the low byte is the minor version (as defined by the
|
|
||||||
Semantic Versioning standard).
|
|
||||||
|
|
||||||
The latest API version as of this writing is 0x0100. */
|
|
||||||
|
|
||||||
uint16_t kizuna_io_get_api_version(void);
|
|
||||||
|
|
||||||
/* Initialize the IO DLL. This is the second function that will be called on
|
|
||||||
your DLL, after kizuna_io_get_api_version.
|
|
||||||
|
|
||||||
All subsequent calls to this API may originate from arbitrary threads.
|
|
||||||
|
|
||||||
Minimum API version: 0x0100 */
|
|
||||||
|
|
||||||
HRESULT kizuna_io_init(void);
|
|
||||||
|
|
||||||
|
|
||||||
/* Get the state of the cabinet's operator buttons as of the last poll. See
|
|
||||||
KIZUNA_IO_OPBTN enum above: this contains bit mask definitions for button
|
|
||||||
states returned in *opbtn. All buttons are active-high.
|
|
||||||
|
|
||||||
Minimum API version: 0x0100 */
|
|
||||||
|
|
||||||
void kizuna_io_get_opbtns(uint8_t *opbtn);
|
|
||||||
|
|
||||||
/* Get the state of the cabinet's gameplay buttons as of the last poll. See
|
|
||||||
KIZUNA_IO_GAMEBTN enum above for bit mask definitions. Inputs are split into
|
|
||||||
a left hand side set of inputs and a right hand side set of inputs: the bit
|
|
||||||
mappings are the same in both cases.
|
|
||||||
|
|
||||||
All buttons are active-high, even though some buttons' electrical signals
|
|
||||||
on a real cabinet are active-low.
|
|
||||||
|
|
||||||
Minimum API version: 0x0100 */
|
|
||||||
|
|
||||||
void kizuna_io_get_analog(uint8_t *x, uint8_t *y);
|
|
||||||
|
|
||||||
void kizuna_io_get_gamebtns(uint8_t *gamebtns);
|
|
||||||
|
|
||||||
void kizuna_io_read_coin_counter(uint16_t *coins, uint16_t *services);
|
|
@ -1,16 +0,0 @@
|
|||||||
kizunaio_lib = static_library(
|
|
||||||
'kizunaio',
|
|
||||||
name_prefix : '',
|
|
||||||
include_directories : inc,
|
|
||||||
implicit_include_directories : false,
|
|
||||||
c_pch : '../precompiled.h',
|
|
||||||
dependencies : [
|
|
||||||
xinput_lib,
|
|
||||||
],
|
|
||||||
sources : [
|
|
||||||
'kizunaio.c',
|
|
||||||
'kizunaio.h',
|
|
||||||
'config.c',
|
|
||||||
'config.h',
|
|
||||||
],
|
|
||||||
)
|
|
@ -61,7 +61,6 @@ subdir('exvs2io')
|
|||||||
subdir('saoio')
|
subdir('saoio')
|
||||||
subdir('mkacio')
|
subdir('mkacio')
|
||||||
subdir('tekkenio')
|
subdir('tekkenio')
|
||||||
subdir('kizunaio')
|
|
||||||
|
|
||||||
subdir('taikohook')
|
subdir('taikohook')
|
||||||
subdir('ferrumhook')
|
subdir('ferrumhook')
|
||||||
@ -69,4 +68,3 @@ subdir('exvs2hook')
|
|||||||
subdir('saohook')
|
subdir('saohook')
|
||||||
subdir('mkachook')
|
subdir('mkachook')
|
||||||
subdir('tekkenhook')
|
subdir('tekkenhook')
|
||||||
subdir('kizunahook')
|
|
||||||
|
@ -73,12 +73,6 @@ HRESULT dns_platform_hook_init(const struct dns_config *cfg)
|
|||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = dns_hook_push(L"dev-game.sk2.nbgi-amnet.jp", cfg->startup);
|
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if your ISP resolves bad domains, it will kill the network. These 2
|
// if your ISP resolves bad domains, it will kill the network. These 2
|
||||||
// *cannot* resolve
|
// *cannot* resolve
|
||||||
|
|
||||||
|
@ -406,10 +406,6 @@ static uint32_t WINAPI hook_GetBestRoute(
|
|||||||
(int) _byteswap_ulong(src_ip),
|
(int) _byteswap_ulong(src_ip),
|
||||||
(int) _byteswap_ulong(dest_ip));
|
(int) _byteswap_ulong(dest_ip));
|
||||||
|
|
||||||
if ((int) _byteswap_ulong(src_ip) == 0xdfffffff) {
|
|
||||||
return next_GetBestRoute(src_ip, dest_ip, route);
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(route, 0, sizeof(*route));
|
memset(route, 0, sizeof(*route));
|
||||||
|
|
||||||
/* This doesn't seem to get read? It just needs to succeed. */
|
/* This doesn't seem to get read? It just needs to succeed. */
|
||||||
|
@ -59,13 +59,12 @@ void sao_hook_config_load(
|
|||||||
assert(cfg != NULL);
|
assert(cfg != NULL);
|
||||||
assert(filename != NULL);
|
assert(filename != NULL);
|
||||||
|
|
||||||
aime_config_load(&cfg->aime, filename);
|
|
||||||
platform_config_load(&cfg->platform, filename);
|
platform_config_load(&cfg->platform, filename);
|
||||||
sao_dll_config_load(&cfg->dll, filename);
|
sao_dll_config_load(&cfg->dll, filename);
|
||||||
gfx_config_load(&cfg->gfx, filename);
|
gfx_config_load(&cfg->gfx, filename);
|
||||||
qr_config_load(&cfg->qr, filename);
|
qr_config_load(&cfg->qr, filename);
|
||||||
|
bpreader_config_load(&cfg->reader, filename);
|
||||||
usio_config_load(&cfg->usio, filename);
|
usio_config_load(&cfg->usio, filename);
|
||||||
systype_config_load(&cfg->systype, filename);
|
systype_config_load(&cfg->systype, filename);
|
||||||
sao_touch_config_load(&cfg->touch, filename);
|
sao_touch_config_load(&cfg->touch, filename);
|
||||||
vfd_config_load(&cfg->vfd, filename);
|
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,10 @@ struct sao_hook_config {
|
|||||||
struct gfx_config gfx;
|
struct gfx_config gfx;
|
||||||
struct amcus_config amcus;
|
struct amcus_config amcus;
|
||||||
struct qr_config qr;
|
struct qr_config qr;
|
||||||
|
struct bpreader_config reader;
|
||||||
struct usio_config usio;
|
struct usio_config usio;
|
||||||
struct systype_config systype;
|
struct systype_config systype;
|
||||||
struct sao_touch_config touch;
|
struct sao_touch_config touch;
|
||||||
struct vfd_config vfd;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void sao_dll_config_load(
|
void sao_dll_config_load(
|
||||||
|
@ -47,13 +47,13 @@ static DWORD CALLBACK sao_pre_startup(void)
|
|||||||
ExitProcess(EXIT_FAILURE);
|
ExitProcess(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = sg_reader_hook_init(&sao_hook_cfg.aime, 1, 3, sao_hook_mod);
|
hr = sg_reader_hook_init(&sao_hook_cfg.aime, 1, sao_hook_mod);
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
ExitProcess(EXIT_FAILURE);
|
ExitProcess(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = vfd_hook_init(&sao_hook_cfg.vfd, 2);
|
hr = vfd_hook_init(2);
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
ExitProcess(EXIT_FAILURE);
|
ExitProcess(EXIT_FAILURE);
|
||||||
@ -89,11 +89,6 @@ static DWORD CALLBACK sao_pre_startup(void)
|
|||||||
ExitProcess(EXIT_FAILURE);
|
ExitProcess(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize Unity native plugin DLL hooks
|
|
||||||
|
|
||||||
There seems to be an issue with other DLL hooks if `LoadLibraryW` is
|
|
||||||
hooked earlier in the `mu3hook` initialization. */
|
|
||||||
|
|
||||||
unity_hook_init();
|
unity_hook_init();
|
||||||
|
|
||||||
gfx_hook_init(&sao_hook_cfg.gfx);
|
gfx_hook_init(&sao_hook_cfg.gfx);
|
||||||
|
@ -11,7 +11,6 @@ shared_library(
|
|||||||
xinput_lib,
|
xinput_lib,
|
||||||
],
|
],
|
||||||
link_with : [
|
link_with : [
|
||||||
aimeio_lib,
|
|
||||||
saoio_lib,
|
saoio_lib,
|
||||||
amcus_lib,
|
amcus_lib,
|
||||||
platform_lib,
|
platform_lib,
|
||||||
@ -19,8 +18,7 @@ shared_library(
|
|||||||
hooklib_lib,
|
hooklib_lib,
|
||||||
gfxhook_lib,
|
gfxhook_lib,
|
||||||
jvs_lib,
|
jvs_lib,
|
||||||
board_lib,
|
board_lib
|
||||||
aimeio_lib
|
|
||||||
],
|
],
|
||||||
sources : [
|
sources : [
|
||||||
'dllmain.c',
|
'dllmain.c',
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
LIBRARY saohook
|
LIBRARY saohook
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
aime_io_get_api_version
|
|
||||||
aime_io_init
|
|
||||||
aime_io_led_set_color
|
|
||||||
aime_io_nfc_get_aime_id
|
|
||||||
aime_io_nfc_get_felica_id
|
|
||||||
aime_io_nfc_poll
|
|
||||||
sao_io_get_api_version
|
sao_io_get_api_version
|
||||||
sao_io_init
|
sao_io_init
|
||||||
sao_io_read_coin_counter
|
sao_io_read_coin_counter
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[wrap-git]
|
[wrap-git]
|
||||||
directory = capnhook
|
directory = capnhook
|
||||||
url = https://github.com/Hay1tsme/capnhook
|
url = https://github.com/Hay1tsme/capnhook
|
||||||
revision = f060250e1b92dcb06946eb77742f0ab51755e158
|
revision = dbdcd61b3a3043b08f86f959bd45df4967503a77
|
@ -45,4 +45,5 @@ void taiko_hook_config_load(
|
|||||||
network_config_load(&cfg->network, filename);
|
network_config_load(&cfg->network, filename);
|
||||||
bpreader_config_load(&cfg->reader, filename);
|
bpreader_config_load(&cfg->reader, filename);
|
||||||
usio_config_load(&cfg->usio, filename);
|
usio_config_load(&cfg->usio, filename);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "board/bpreader.h"
|
#include "board/bpreader.h"
|
||||||
#include "board/qr.h"
|
#include "board/qr.h"
|
||||||
|
#include "board/vfd.h"
|
||||||
|
|
||||||
#include "amcus/amcus.h"
|
#include "amcus/amcus.h"
|
||||||
|
|
||||||
@ -65,6 +66,12 @@ static DWORD CALLBACK taiko_pre_startup(void)
|
|||||||
ExitProcess(EXIT_FAILURE);
|
ExitProcess(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hr = vfd_hook_init(2);
|
||||||
|
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
ExitProcess(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
hr = bpreader_init(&taiko_hook_cfg.reader, 1);
|
hr = bpreader_init(&taiko_hook_cfg.reader, 1);
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user