mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2024-11-28 00:10:51 +01:00
chore: Apply code formatting on entire codebase for consistent style
This commit is contained in:
parent
a1a849aef3
commit
031836ef0e
@ -8,8 +8,8 @@
|
||||
#define AC_IO_CMD_PANB_START_AUTO_INPUT 0x0115
|
||||
|
||||
#define AC_IO_PANB_NUM_NODES 4
|
||||
#define AC_IO_PANB_MAX_KEYS (7*AC_IO_PANB_NUM_NODES)
|
||||
#define AC_IO_PANB_MAX_KEYPAIRS (AC_IO_PANB_MAX_KEYS/2)
|
||||
#define AC_IO_PANB_MAX_KEYS (7 * AC_IO_PANB_NUM_NODES)
|
||||
#define AC_IO_PANB_MAX_KEYPAIRS (AC_IO_PANB_MAX_KEYS / 2)
|
||||
|
||||
struct ac_io_panb_keypair {
|
||||
uint8_t key2 : 4;
|
||||
@ -38,5 +38,4 @@ struct ac_io_panb_poll_out {
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -5,8 +5,8 @@
|
||||
#include "aciodrv/device.h"
|
||||
#include "aciodrv/panb.h"
|
||||
|
||||
#include "util/thread.h"
|
||||
#include "util/log.h"
|
||||
#include "util/thread.h"
|
||||
|
||||
static int auto_poll_proc(void *auto_poll_param);
|
||||
static int auto_poll_threadid;
|
||||
@ -17,9 +17,9 @@ static struct ac_io_panb_keypair _keypair[AC_IO_PANB_MAX_KEYPAIRS];
|
||||
static CRITICAL_SECTION auto_poll_stop_lock;
|
||||
static bool auto_poll_stop;
|
||||
|
||||
static int auto_poll_proc(void * param)
|
||||
static int auto_poll_proc(void *param)
|
||||
{
|
||||
struct aciodrv_device_ctx * device = (struct aciodrv_device_ctx *) param;
|
||||
struct aciodrv_device_ctx *device = (struct aciodrv_device_ctx *) param;
|
||||
struct ac_io_panb_poll_in poll_in;
|
||||
bool stop;
|
||||
|
||||
@ -49,7 +49,8 @@ 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 = thread_create(auto_poll_proc, (void *)device, 0x4000, 0);
|
||||
auto_poll_threadid =
|
||||
thread_create(auto_poll_proc, (void *) device, 0x4000, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -63,11 +64,11 @@ bool aciodrv_proc_panb_get_state(uint8_t *button_state)
|
||||
LeaveCriticalSection(&keypair_lock);
|
||||
|
||||
/* splice the keypairs into separate button values */
|
||||
for (int i=0; i<AC_IO_PANB_MAX_KEYPAIRS; i++) {
|
||||
for (int i = 0; i < AC_IO_PANB_MAX_KEYPAIRS; i++) {
|
||||
uint8_t but1 = keypair[i].key1;
|
||||
uint8_t but2 = keypair[i].key2;
|
||||
button_state[2*i] = but1;
|
||||
button_state[2*i+1] = but2;
|
||||
button_state[2 * i] = but1;
|
||||
button_state[2 * i + 1] = but2;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -4,14 +4,15 @@
|
||||
#include "aciodrv/panb.h"
|
||||
|
||||
/**
|
||||
* Initialize a PANB device. This will take care of setting up the auto-poll and processing
|
||||
* the poll messages in a separate thread (this is necessary as failing to process messages
|
||||
* fast enough will cause the device to malfunction).
|
||||
* Initialize a PANB device. This will take care of setting up the auto-poll and
|
||||
* processing the poll messages in a separate thread (this is necessary as
|
||||
* failing to process messages fast enough will cause the device to
|
||||
* malfunction).
|
||||
*
|
||||
* @param device Context of opened device
|
||||
* @return True if successful, false on error.
|
||||
* @note This function spawns a thread. Caller must call aciodrv_proc_panb_fini to properly
|
||||
* terminate.
|
||||
* @note This function spawns a thread. Caller must call aciodrv_proc_panb_fini
|
||||
* to properly terminate.
|
||||
*/
|
||||
bool aciodrv_proc_panb_init(struct aciodrv_device_ctx *device);
|
||||
|
||||
@ -19,13 +20,15 @@ bool aciodrv_proc_panb_init(struct aciodrv_device_ctx *device);
|
||||
* Retrieve latest known button state from the PANB device.
|
||||
*
|
||||
* @param button_state 28 cell array to store button state
|
||||
* (mandatory, upon calling the array contains values between 0 to 15 indicating the keys velocity).
|
||||
* (mandatory, upon calling the array contains values between 0 to 15
|
||||
* indicating the keys velocity).
|
||||
* @return True on success, false on error.
|
||||
*/
|
||||
bool aciodrv_proc_panb_get_state(uint8_t *button_state);
|
||||
|
||||
/**
|
||||
* Properly terminate the thread and reset the device (this is the only way to stop the auto polling).
|
||||
* Properly terminate the thread and reset the device (this is the only way to
|
||||
* stop the auto polling).
|
||||
*/
|
||||
void aciodrv_proc_panb_fini(struct aciodrv_device_ctx *device);
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "util/mem.h"
|
||||
|
||||
/* Enable to dump all data to the logger */
|
||||
//#define AC_IO_MSG_LOG
|
||||
// #define AC_IO_MSG_LOG
|
||||
|
||||
#define ACIO_MAX_NODES_PER_PORT 16
|
||||
|
||||
@ -87,8 +87,11 @@ static bool aciodrv_device_init(struct aciodrv_device_ctx *device)
|
||||
}
|
||||
|
||||
#ifdef AC_IO_MSG_LOG
|
||||
static void
|
||||
aciodrv_device_log_buffer(struct aciodrv_device_ctx *device, const char *msg, const uint8_t *buffer, int length)
|
||||
static void aciodrv_device_log_buffer(
|
||||
struct aciodrv_device_ctx *device,
|
||||
const char *msg,
|
||||
const uint8_t *buffer,
|
||||
int length)
|
||||
{
|
||||
char str[4096];
|
||||
|
||||
@ -97,7 +100,8 @@ aciodrv_device_log_buffer(struct aciodrv_device_ctx *device, const char *msg, co
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool aciodrv_device_send(struct aciodrv_device_ctx *device, const uint8_t *buffer, int length)
|
||||
static bool aciodrv_device_send(
|
||||
struct aciodrv_device_ctx *device, const uint8_t *buffer, int length)
|
||||
{
|
||||
uint8_t send_buf[512];
|
||||
int send_buf_pos = 0;
|
||||
@ -138,15 +142,20 @@ static bool aciodrv_device_send(struct aciodrv_device_ctx *device, const uint8_t
|
||||
aciodrv_device_log_buffer(device, "Send (2)", send_buf, send_buf_pos);
|
||||
#endif
|
||||
|
||||
if (aciodrv_port_write(device->fd, send_buf, send_buf_pos) != send_buf_pos) {
|
||||
log_warning("[%p] Sending data with length %d failed", device->fd, send_buf_pos);
|
||||
if (aciodrv_port_write(device->fd, send_buf, send_buf_pos) !=
|
||||
send_buf_pos) {
|
||||
log_warning(
|
||||
"[%p] Sending data with length %d failed",
|
||||
device->fd,
|
||||
send_buf_pos);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int aciodrv_device_receive(struct aciodrv_device_ctx *device, uint8_t *buffer, int max_resp_size)
|
||||
static int aciodrv_device_receive(
|
||||
struct aciodrv_device_ctx *device, uint8_t *buffer, int max_resp_size)
|
||||
{
|
||||
uint8_t recv_buf[512];
|
||||
int recv_size = 0;
|
||||
@ -161,7 +170,6 @@ static int aciodrv_device_receive(struct aciodrv_device_ctx *device, uint8_t *bu
|
||||
read = aciodrv_port_read(device->fd, recv_buf, 1);
|
||||
} while (recv_buf[0] == AC_IO_SOF);
|
||||
|
||||
|
||||
if (read > 0) {
|
||||
/* recv_buf[0] is already the first byte of the message.
|
||||
now read until nothing's left */
|
||||
@ -189,8 +197,8 @@ static int aciodrv_device_receive(struct aciodrv_device_ctx *device, uint8_t *bu
|
||||
/* next byte is our real data
|
||||
overwrite escape byte */
|
||||
do {
|
||||
read = aciodrv_port_read(
|
||||
device->fd, recv_buf + recv_size, 1);
|
||||
read =
|
||||
aciodrv_port_read(device->fd, recv_buf + recv_size, 1);
|
||||
} while (read == 0);
|
||||
|
||||
if (read < 0) {
|
||||
@ -204,7 +212,8 @@ static int aciodrv_device_receive(struct aciodrv_device_ctx *device, uint8_t *bu
|
||||
|
||||
if (recv_size > offsetof(struct ac_io_message, cmd.nbytes)) {
|
||||
// header + data + checksum
|
||||
expected_size = offsetof(struct ac_io_message, cmd.raw) + ((struct ac_io_message*)recv_buf)->cmd.nbytes + 1;
|
||||
expected_size = offsetof(struct ac_io_message, cmd.raw) +
|
||||
((struct ac_io_message *) recv_buf)->cmd.nbytes + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,7 +224,11 @@ static int aciodrv_device_receive(struct aciodrv_device_ctx *device, uint8_t *bu
|
||||
|
||||
/* recv_size - 1: omit checksum for checksum calc */
|
||||
if ((recv_size - 1) > max_resp_size) {
|
||||
log_warning("[%p] Expected %d got %d", device->fd, max_resp_size - 6, recv_buf[4]);
|
||||
log_warning(
|
||||
"[%p] Expected %d got %d",
|
||||
device->fd,
|
||||
max_resp_size - 6,
|
||||
recv_buf[4]);
|
||||
return -1;
|
||||
}
|
||||
for (int i = 0; i < recv_size - 1; i++) {
|
||||
@ -254,9 +267,7 @@ static uint8_t aciodrv_device_enum_nodes(struct aciodrv_device_ctx *device)
|
||||
msg.cmd.count = 0;
|
||||
|
||||
if (!aciodrv_send_and_recv(
|
||||
device,
|
||||
&msg,
|
||||
offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
device, &msg, offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
log_warning("Enumerating nodes failed");
|
||||
return 0;
|
||||
}
|
||||
@ -266,7 +277,10 @@ static uint8_t aciodrv_device_enum_nodes(struct aciodrv_device_ctx *device)
|
||||
return msg.cmd.count;
|
||||
}
|
||||
|
||||
static bool aciodrv_device_get_version(struct aciodrv_device_ctx *device, uint8_t node_id, struct aciodrv_device_node_version *version)
|
||||
static bool aciodrv_device_get_version(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id,
|
||||
struct aciodrv_device_node_version *version)
|
||||
{
|
||||
struct ac_io_message msg;
|
||||
|
||||
@ -299,7 +313,10 @@ static bool aciodrv_device_get_version(struct aciodrv_device_ctx *device, uint8_
|
||||
msg.cmd.version.date,
|
||||
msg.cmd.version.time);
|
||||
|
||||
memcpy(version->product, msg.cmd.version.product_code, ACIO_NODE_PRODUCT_CODE_LEN);
|
||||
memcpy(
|
||||
version->product,
|
||||
msg.cmd.version.product_code,
|
||||
ACIO_NODE_PRODUCT_CODE_LEN);
|
||||
version->type = ac_io_u32(msg.cmd.version.type);
|
||||
version->major = msg.cmd.version.major;
|
||||
version->minor = msg.cmd.version.minor;
|
||||
@ -308,7 +325,8 @@ static bool aciodrv_device_get_version(struct aciodrv_device_ctx *device, uint8_
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool aciodrv_device_start_node(struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
static bool
|
||||
aciodrv_device_start_node(struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
{
|
||||
struct ac_io_message msg;
|
||||
|
||||
@ -317,9 +335,7 @@ static bool aciodrv_device_start_node(struct aciodrv_device_ctx *device, uint8_t
|
||||
msg.cmd.nbytes = 0;
|
||||
|
||||
if (!aciodrv_send_and_recv(
|
||||
device,
|
||||
&msg,
|
||||
offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
device, &msg, offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
log_warning("Starting node %d failed", node_id);
|
||||
return false;
|
||||
}
|
||||
@ -334,7 +350,8 @@ struct aciodrv_device_ctx *aciodrv_device_open(const char *port_path, int baud)
|
||||
return aciodrv_device_open_path(port_path, baud);
|
||||
}
|
||||
|
||||
struct aciodrv_device_ctx *aciodrv_device_open_path(const char *port_path, int baud)
|
||||
struct aciodrv_device_ctx *
|
||||
aciodrv_device_open_path(const char *port_path, int baud)
|
||||
{
|
||||
HANDLE port = aciodrv_port_open(port_path, baud);
|
||||
|
||||
@ -342,7 +359,8 @@ struct aciodrv_device_ctx *aciodrv_device_open_path(const char *port_path, int b
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct aciodrv_device_ctx *device = xmalloc(sizeof(struct aciodrv_device_ctx));
|
||||
struct aciodrv_device_ctx *device =
|
||||
xmalloc(sizeof(struct aciodrv_device_ctx));
|
||||
|
||||
memset(device, 0, sizeof(struct aciodrv_device_ctx));
|
||||
device->fd = port;
|
||||
@ -384,16 +402,23 @@ uint8_t aciodrv_device_get_node_count(struct aciodrv_device_ctx *device)
|
||||
return device->node_count;
|
||||
}
|
||||
|
||||
bool aciodrv_device_get_node_product_ident(struct aciodrv_device_ctx *device, uint8_t node_id, char product[ACIO_NODE_PRODUCT_CODE_LEN])
|
||||
bool aciodrv_device_get_node_product_ident(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id,
|
||||
char product[ACIO_NODE_PRODUCT_CODE_LEN])
|
||||
{
|
||||
if (device->node_count == 0 || node_id > device->node_count) {
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(product, device->node_versions[node_id].product, ACIO_NODE_PRODUCT_CODE_LEN);
|
||||
memcpy(
|
||||
product,
|
||||
device->node_versions[node_id].product,
|
||||
ACIO_NODE_PRODUCT_CODE_LEN);
|
||||
return true;
|
||||
}
|
||||
uint32_t aciodrv_device_get_node_product_type(struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
uint32_t aciodrv_device_get_node_product_type(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
{
|
||||
if (device->node_count == 0 || node_id > device->node_count) {
|
||||
return 0;
|
||||
@ -402,7 +427,9 @@ uint32_t aciodrv_device_get_node_product_type(struct aciodrv_device_ctx *device,
|
||||
return device->node_versions[node_id].type;
|
||||
}
|
||||
|
||||
const struct aciodrv_device_node_version *aciodrv_device_get_node_product_version(struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
const struct aciodrv_device_node_version *
|
||||
aciodrv_device_get_node_product_version(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
{
|
||||
if (device->node_count == 0 || node_id > device->node_count) {
|
||||
return NULL;
|
||||
@ -430,7 +457,10 @@ bool aciodrv_send(struct aciodrv_device_ctx *device, struct ac_io_message *msg)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool aciodrv_recv(struct aciodrv_device_ctx *device, struct ac_io_message *msg, int max_resp_size)
|
||||
bool aciodrv_recv(
|
||||
struct aciodrv_device_ctx *device,
|
||||
struct ac_io_message *msg,
|
||||
int max_resp_size)
|
||||
{
|
||||
#ifdef AC_IO_MSG_LOG
|
||||
log_info("[%p] Beginning recv: (%d b)", device->fd, max_resp_size);
|
||||
@ -441,7 +471,10 @@ bool aciodrv_recv(struct aciodrv_device_ctx *device, struct ac_io_message *msg,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool aciodrv_send_and_recv(struct aciodrv_device_ctx *device, struct ac_io_message *msg, int max_resp_size)
|
||||
bool aciodrv_send_and_recv(
|
||||
struct aciodrv_device_ctx *device,
|
||||
struct ac_io_message *msg,
|
||||
int max_resp_size)
|
||||
{
|
||||
if (!aciodrv_send(device, msg)) {
|
||||
return false;
|
||||
|
@ -28,11 +28,13 @@ struct aciodrv_device_node_version {
|
||||
*/
|
||||
struct aciodrv_device_ctx *aciodrv_device_open(const char *port_path, int baud)
|
||||
#ifdef __GNUC__
|
||||
__attribute__((deprecated("Use aciomgr instead if device is shareable, else aciodrv_device_open_path")))
|
||||
__attribute__((deprecated("Use aciomgr instead if device is shareable, "
|
||||
"else aciodrv_device_open_path")))
|
||||
#endif
|
||||
;
|
||||
;
|
||||
|
||||
struct aciodrv_device_ctx *aciodrv_device_open_path(const char *port_path, int baud);
|
||||
struct aciodrv_device_ctx *
|
||||
aciodrv_device_open_path(const char *port_path, int baud);
|
||||
|
||||
/**
|
||||
* Get the node count on the opened device.
|
||||
@ -51,7 +53,10 @@ uint8_t aciodrv_device_get_node_count(struct aciodrv_device_ctx *device);
|
||||
* @return True on success, false on error. If True the variable product
|
||||
* contains the identifier of the queried node.
|
||||
*/
|
||||
bool aciodrv_device_get_node_product_ident(struct aciodrv_device_ctx *device, uint8_t node_id, char product[ACIO_NODE_PRODUCT_CODE_LEN]);
|
||||
bool aciodrv_device_get_node_product_ident(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id,
|
||||
char product[ACIO_NODE_PRODUCT_CODE_LEN]);
|
||||
|
||||
/**
|
||||
* Get the product identifier of an enumerated node.
|
||||
@ -60,7 +65,8 @@ bool aciodrv_device_get_node_product_ident(struct aciodrv_device_ctx *device, ui
|
||||
* @param node_id Id of the node. Needs to be in range of the total node count.
|
||||
* @return product type ID on success, or 0 on failure
|
||||
*/
|
||||
uint32_t aciodrv_device_get_node_product_type(struct aciodrv_device_ctx *device, uint8_t node_id);
|
||||
uint32_t aciodrv_device_get_node_product_type(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id);
|
||||
|
||||
/**
|
||||
* Get the product version of an enumerated node.
|
||||
@ -69,7 +75,9 @@ uint32_t aciodrv_device_get_node_product_type(struct aciodrv_device_ctx *device,
|
||||
* @param node_id Id of the node. Needs to be in range of the total node count.
|
||||
* @return Pointer to the version struct
|
||||
*/
|
||||
const struct aciodrv_device_node_version *aciodrv_device_get_node_product_version(struct aciodrv_device_ctx *device, uint8_t node_id);
|
||||
const struct aciodrv_device_node_version *
|
||||
aciodrv_device_get_node_product_version(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id);
|
||||
|
||||
/**
|
||||
* Send a message to the ACIO bus and receive an answer.
|
||||
@ -82,7 +90,10 @@ const struct aciodrv_device_node_version *aciodrv_device_get_node_product_versio
|
||||
* @param resp_size Size of the expecting response.
|
||||
* @return True on success, false on error.
|
||||
*/
|
||||
bool aciodrv_send_and_recv(struct aciodrv_device_ctx *device, struct ac_io_message *msg, int max_resp_size);
|
||||
bool aciodrv_send_and_recv(
|
||||
struct aciodrv_device_ctx *device,
|
||||
struct ac_io_message *msg,
|
||||
int max_resp_size);
|
||||
|
||||
/**
|
||||
* Send a message to the ACIO bus.
|
||||
@ -90,7 +101,8 @@ bool aciodrv_send_and_recv(struct aciodrv_device_ctx *device, struct ac_io_messa
|
||||
* @param device Context of opened device
|
||||
* @param msg Msg to send to the bus.
|
||||
* @return True on success, false on error.
|
||||
* @note Prefer the use of aciodrv_send_and_recv when possible. This is for commands which don't trigger a reply.
|
||||
* @note Prefer the use of aciodrv_send_and_recv when possible. This is for
|
||||
* commands which don't trigger a reply.
|
||||
*/
|
||||
bool aciodrv_send(struct aciodrv_device_ctx *device, struct ac_io_message *msg);
|
||||
|
||||
@ -101,9 +113,13 @@ bool aciodrv_send(struct aciodrv_device_ctx *device, struct ac_io_message *msg);
|
||||
* @param msg Msg to send to the bus. Make sure that the buffer
|
||||
* is big enough to receive the response.
|
||||
* @return True on success, false on error.
|
||||
* @note Prefer the use of aciodrv_send_and_recv when possible. This is for unsollicited incoming messages.
|
||||
* @note Prefer the use of aciodrv_send_and_recv when possible. This is for
|
||||
* unsollicited incoming messages.
|
||||
*/
|
||||
bool aciodrv_recv(struct aciodrv_device_ctx *device, struct ac_io_message *msg, int max_resp_size);
|
||||
bool aciodrv_recv(
|
||||
struct aciodrv_device_ctx *device,
|
||||
struct ac_io_message *msg,
|
||||
int max_resp_size);
|
||||
|
||||
/**
|
||||
* Reset an opened device.
|
||||
|
@ -9,9 +9,7 @@
|
||||
|
||||
#include "util/log.h"
|
||||
|
||||
bool aciodrv_h44b_init(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id)
|
||||
bool aciodrv_h44b_init(struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
{
|
||||
// unlike input devices like KFCA, H44B has no watchdog or special init code
|
||||
// requirements - shared ACIO node initialisation is enough
|
||||
@ -34,9 +32,7 @@ bool aciodrv_h44b_lights(
|
||||
msg.cmd.h44b_output = *lights;
|
||||
|
||||
if (!aciodrv_send_and_recv(
|
||||
device,
|
||||
&msg,
|
||||
offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
device, &msg, offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
log_warning("Polling of node %d failed", node_id + 1);
|
||||
return false;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef ACIODRV_H44B_H
|
||||
#define ACIODRV_H44B_H
|
||||
|
||||
#include "aciodrv/device.h"
|
||||
#include "acio/h44b.h"
|
||||
#include "aciodrv/device.h"
|
||||
|
||||
/**
|
||||
* Initialize an H44B node.
|
||||
|
@ -8,8 +8,7 @@
|
||||
#include "util/log.h"
|
||||
|
||||
static bool aciodrv_icca_queue_loop_start(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id)
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
{
|
||||
struct ac_io_message msg;
|
||||
|
||||
@ -21,9 +20,7 @@ static bool aciodrv_icca_queue_loop_start(
|
||||
msg.cmd.status = 0;
|
||||
|
||||
if (!aciodrv_send_and_recv(
|
||||
device,
|
||||
&msg,
|
||||
offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
device, &msg, offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
log_warning("Starting queue loop failed");
|
||||
return false;
|
||||
}
|
||||
@ -137,9 +134,7 @@ bool aciodrv_icca_read_card(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool aciodrv_icca_is_slotted(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id)
|
||||
bool aciodrv_icca_is_slotted(struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
{
|
||||
const struct aciodrv_device_node_version *version;
|
||||
version = aciodrv_device_get_node_product_version(device, node_id);
|
||||
@ -157,8 +152,7 @@ bool aciodrv_icca_is_slotted(
|
||||
}
|
||||
|
||||
bool aciodrv_icca_poll_felica(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id)
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
{
|
||||
struct ac_io_message msg;
|
||||
|
||||
|
@ -85,8 +85,7 @@ bool aciodrv_icca_read_card(
|
||||
* @see driver.h
|
||||
*/
|
||||
bool aciodrv_icca_is_slotted(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id);
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id);
|
||||
|
||||
/**
|
||||
* Polls the felica chip on wavepass readers. This will cause the state of the
|
||||
@ -105,7 +104,6 @@ bool aciodrv_icca_is_slotted(
|
||||
* @see driver.h
|
||||
*/
|
||||
bool aciodrv_icca_poll_felica(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id);
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id);
|
||||
|
||||
#endif
|
||||
|
@ -7,9 +7,8 @@
|
||||
|
||||
#include "util/log.h"
|
||||
|
||||
static bool aciodrv_kfca_watchdog_start(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id)
|
||||
static bool
|
||||
aciodrv_kfca_watchdog_start(struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
{
|
||||
struct ac_io_message msg;
|
||||
|
||||
@ -25,11 +24,15 @@ static bool aciodrv_kfca_watchdog_start(
|
||||
|
||||
if (!aciodrv_send_and_recv(
|
||||
device, &msg, offsetof(struct ac_io_message, cmd.raw) + 2)) {
|
||||
log_warning("Starting watchdog failed"); return false;
|
||||
log_warning("Starting watchdog failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
log_warning("Started watchdog of node %d, sz: %d, status: %d",
|
||||
node_id, msg.cmd.nbytes, msg.cmd.status);
|
||||
log_warning(
|
||||
"Started watchdog of node %d, sz: %d, status: %d",
|
||||
node_id,
|
||||
msg.cmd.nbytes,
|
||||
msg.cmd.status);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -56,9 +59,7 @@ bool aciodrv_kfca_amp(
|
||||
msg.cmd.raw[3] = subwoofer;
|
||||
|
||||
if (!aciodrv_send_and_recv(
|
||||
device,
|
||||
&msg,
|
||||
offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
device, &msg, offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
log_warning("Setting AMP failed");
|
||||
return false;
|
||||
}
|
||||
@ -68,9 +69,7 @@ bool aciodrv_kfca_amp(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool aciodrv_kfca_init(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id)
|
||||
bool aciodrv_kfca_init(struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
{
|
||||
log_assert(device);
|
||||
|
||||
|
@ -5,10 +5,11 @@
|
||||
#include "aciodrv/device.h"
|
||||
#include "aciodrv/panb.h"
|
||||
|
||||
#include "util/thread.h"
|
||||
#include "util/log.h"
|
||||
#include "util/thread.h"
|
||||
|
||||
bool aciodrv_panb_start_auto_input(struct aciodrv_device_ctx *device, uint8_t node_id, uint8_t node_count)
|
||||
bool aciodrv_panb_start_auto_input(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id, uint8_t node_count)
|
||||
{
|
||||
log_assert(device);
|
||||
struct ac_io_message msg;
|
||||
@ -33,30 +34,36 @@ bool aciodrv_panb_start_auto_input(struct aciodrv_device_ctx *device, uint8_t no
|
||||
return true;
|
||||
}
|
||||
|
||||
bool aciodrv_panb_recv_poll(struct aciodrv_device_ctx *device, struct ac_io_panb_poll_in *poll_in)
|
||||
bool aciodrv_panb_recv_poll(
|
||||
struct aciodrv_device_ctx *device, struct ac_io_panb_poll_in *poll_in)
|
||||
{
|
||||
log_assert(device);
|
||||
struct ac_io_message msg;
|
||||
struct ac_io_panb_poll_in *poll_res = (struct ac_io_panb_poll_in *) &msg.cmd.raw;
|
||||
struct ac_io_panb_poll_in *poll_res =
|
||||
(struct ac_io_panb_poll_in *) &msg.cmd.raw;
|
||||
|
||||
msg.cmd.code = ac_io_u16(AC_IO_CMD_PANB_POLL_REPLY);
|
||||
msg.cmd.nbytes = sizeof(struct ac_io_panb_poll_in);
|
||||
|
||||
if (!aciodrv_recv(device,
|
||||
&msg, offsetof(struct ac_io_message, cmd.raw) + msg.cmd.nbytes + 1)) {
|
||||
if (!aciodrv_recv(
|
||||
device,
|
||||
&msg,
|
||||
offsetof(struct ac_io_message, cmd.raw) + msg.cmd.nbytes + 1)) {
|
||||
log_warning("Getting state failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (poll_in != NULL){
|
||||
if (poll_in != NULL) {
|
||||
memcpy(poll_in, poll_res, sizeof(struct ac_io_panb_poll_in));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool aciodrv_panb_send_lamp(struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id, struct ac_io_panb_poll_out *state)
|
||||
bool aciodrv_panb_send_lamp(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id,
|
||||
struct ac_io_panb_poll_out *state)
|
||||
{
|
||||
log_assert(device);
|
||||
struct ac_io_message msg;
|
||||
|
@ -11,33 +11,37 @@
|
||||
* @param node_count The number of nodes to poll.
|
||||
* @return True if successful, false on error.
|
||||
* @note node_id should be 0, PANB internally manages the other nodes.
|
||||
* @note Upon calling, the device will stop replying to commands and just keep sending
|
||||
* AC_IO_CMD_PANB_POLL_REPLY messages indefinitely. Failure to retrieve them fast enough
|
||||
* will cause the device to malfunction. It is thus advised to make use of the aciodrv-proc
|
||||
* module to spawn a thread that will handle these messages and provide an easy access to the
|
||||
* latest input state.
|
||||
* @note This module is supposed to be used in combination with the common
|
||||
* device driver foundation.
|
||||
* @see driver.h
|
||||
*/
|
||||
bool aciodrv_panb_start_auto_input(struct aciodrv_device_ctx *device, uint8_t node_id, uint8_t node_count);
|
||||
|
||||
/**
|
||||
* Retrieve a AC_IO_CMD_PANB_POLL_REPLY message from a PANB device. This assumes that there
|
||||
* is such message incoming (ie. that start_auto_input has been called prior).
|
||||
*
|
||||
* @param device Context of opened device.
|
||||
* @param poll_in Buffer to hold the received message, or NULL.
|
||||
* @return True if successful, false on error.
|
||||
* @note node_id should be 0, PANB internally manages the other nodes.
|
||||
* @note Failure to retrieve the incoming messages fast enough will cause the device to malfunction.
|
||||
* It is thus advised to make use of the aciodrv-proc module to spawn a thread that will handle these
|
||||
* @note Upon calling, the device will stop replying to commands and just keep
|
||||
* sending AC_IO_CMD_PANB_POLL_REPLY messages indefinitely. Failure to retrieve
|
||||
* them fast enough will cause the device to malfunction. It is thus advised to
|
||||
* make use of the aciodrv-proc module to spawn a thread that will handle these
|
||||
* messages and provide an easy access to the latest input state.
|
||||
* @note This module is supposed to be used in combination with the common
|
||||
* device driver foundation.
|
||||
* @see driver.h
|
||||
*/
|
||||
bool aciodrv_panb_recv_poll(struct aciodrv_device_ctx *device, struct ac_io_panb_poll_in *poll_in);
|
||||
bool aciodrv_panb_start_auto_input(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id, uint8_t node_count);
|
||||
|
||||
/**
|
||||
* Retrieve a AC_IO_CMD_PANB_POLL_REPLY message from a PANB device. This assumes
|
||||
* that there is such message incoming (ie. that start_auto_input has been
|
||||
* called prior).
|
||||
*
|
||||
* @param device Context of opened device.
|
||||
* @param poll_in Buffer to hold the received message, or NULL.
|
||||
* @return True if successful, false on error.
|
||||
* @note node_id should be 0, PANB internally manages the other nodes.
|
||||
* @note Failure to retrieve the incoming messages fast enough will cause the
|
||||
* device to malfunction. It is thus advised to make use of the aciodrv-proc
|
||||
* module to spawn a thread that will handle these messages and provide an easy
|
||||
* access to the latest input state.
|
||||
* @note This module is supposed to be used in combination with the common
|
||||
* device driver foundation.
|
||||
* @see driver.h
|
||||
*/
|
||||
bool aciodrv_panb_recv_poll(
|
||||
struct aciodrv_device_ctx *device, struct ac_io_panb_poll_in *poll_in);
|
||||
|
||||
/**
|
||||
* Light lamps on a PANB device.
|
||||
@ -51,6 +55,9 @@ bool aciodrv_panb_recv_poll(struct aciodrv_device_ctx *device, struct ac_io_panb
|
||||
* device driver foundation.
|
||||
* @see driver.h
|
||||
*/
|
||||
bool aciodrv_panb_send_lamp(struct aciodrv_device_ctx *device, uint8_t node_id, struct ac_io_panb_poll_out *state);
|
||||
bool aciodrv_panb_send_lamp(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id,
|
||||
struct ac_io_panb_poll_out *state);
|
||||
|
||||
#endif
|
@ -148,7 +148,8 @@ int aciodrv_port_write(HANDLE port_fd, const void *bytes, int nbytes)
|
||||
}
|
||||
|
||||
if (!WriteFile(port_fd, bytes, nbytes, &nwrit, NULL)) {
|
||||
log_warning("[%p] WriteFile failed: err = %lu", port_fd, GetLastError());
|
||||
log_warning(
|
||||
"[%p] WriteFile failed: err = %lu", port_fd, GetLastError());
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -8,9 +8,7 @@
|
||||
#include "util/log.h"
|
||||
|
||||
static bool aciodrv_rvol_change_expand_mode(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id,
|
||||
uint8_t mode)
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id, uint8_t mode)
|
||||
{
|
||||
struct ac_io_message msg;
|
||||
|
||||
@ -28,15 +26,12 @@ static bool aciodrv_rvol_change_expand_mode(
|
||||
return false;
|
||||
}
|
||||
|
||||
log_info("I/O expand mode set %d, mode: %d",
|
||||
node_id, mode);
|
||||
log_info("I/O expand mode set %d, mode: %d", node_id, mode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool aciodrv_rvol_init(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id)
|
||||
bool aciodrv_rvol_init(struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
{
|
||||
log_assert(device);
|
||||
|
||||
|
@ -147,7 +147,7 @@ void ac_io_emu_icca_dispatch_request(
|
||||
break;
|
||||
|
||||
case AC_IO_ICCA_CMD_SET_SLOT_STATE: {
|
||||
if(icca->version == v150) {
|
||||
if (icca->version == v150) {
|
||||
ac_io_emu_icca_send_state(icca, req, 0, false);
|
||||
} else {
|
||||
struct ac_io_icca_misc *misc =
|
||||
@ -267,8 +267,7 @@ static void ac_io_emu_icca_cmd_send_version(
|
||||
} else {
|
||||
// probably log invalid version here
|
||||
log_warning(
|
||||
"Unknown ICCA version: %d emulation requested",
|
||||
icca->version);
|
||||
"Unknown ICCA version: %d emulation requested", icca->version);
|
||||
}
|
||||
|
||||
resp.cmd.version.revision = 0x00;
|
||||
@ -487,7 +486,7 @@ ac_io_emu_icca_cipher(struct ac_io_emu_icca *icca, uint8_t *data, size_t length)
|
||||
|
||||
// process data
|
||||
data[i] =
|
||||
(uint8_t)(icca->cipher_keys[0] >> (((3 - count4) << 3)) ^ data[i]);
|
||||
(uint8_t) (icca->cipher_keys[0] >> (((3 - count4) << 3)) ^ data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -512,7 +511,7 @@ static void ac_io_emu_icca_cipher_set_key(
|
||||
resp.cmd.raw[0] = (reader_key >> 24) & 0xFF;
|
||||
resp.cmd.raw[1] = (reader_key >> 16) & 0xFF;
|
||||
resp.cmd.raw[2] = (reader_key >> 8) & 0xFF;
|
||||
resp.cmd.raw[3] = (reader_key) & 0xFF;
|
||||
resp.cmd.raw[3] = (reader_key) &0xFF;
|
||||
|
||||
// so I looked these constants up, this isn't actually a secure key
|
||||
// generator it's actually Marsaglia's "KISS" algorithm with different
|
||||
|
@ -105,7 +105,6 @@ struct aciomgr_port_dispatcher *aciomgr_port_init(const char *path, int baud)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
struct aciomgr_port_dispatcher *entry;
|
||||
|
||||
EnterCriticalSection(&mgr_cs);
|
||||
|
@ -29,7 +29,6 @@ bool aciotest_bi2a_sdvx_handler_update(
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
pin.raw[0] = ac_io_u16(pin.raw[0]);
|
||||
pin.raw[1] = ac_io_u16(pin.raw[1]);
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
#include "aciodrv/icca.h"
|
||||
|
||||
|
||||
#define IDLE_RESPONSES_BETWEEN_FELICA_POLLS 5
|
||||
|
||||
struct icca_handler_ctx {
|
||||
@ -19,7 +18,7 @@ bool aciotest_icca_handler_init(
|
||||
{
|
||||
*ctx = malloc(sizeof(struct icca_handler_ctx));
|
||||
|
||||
struct icca_handler_ctx *icca_ctx = (struct icca_handler_ctx*)*ctx;
|
||||
struct icca_handler_ctx *icca_ctx = (struct icca_handler_ctx *) *ctx;
|
||||
icca_ctx->init = false;
|
||||
|
||||
icca_ctx->slotted_reader = true;
|
||||
@ -34,7 +33,7 @@ bool aciotest_icca_handler_init(
|
||||
bool aciotest_icca_handler_update(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id, void *ctx)
|
||||
{
|
||||
struct icca_handler_ctx *icca_ctx = (struct icca_handler_ctx*)ctx;
|
||||
struct icca_handler_ctx *icca_ctx = (struct icca_handler_ctx *) ctx;
|
||||
|
||||
if (icca_ctx->init == false) {
|
||||
icca_ctx->init = true;
|
||||
|
@ -85,8 +85,8 @@ int main(int argc, char **argv)
|
||||
|
||||
log_to_writer(log_writer_stdout, NULL);
|
||||
|
||||
|
||||
struct aciodrv_device_ctx *device = aciodrv_device_open_path(argv[1], atoi(argv[2]));
|
||||
struct aciodrv_device_ctx *device =
|
||||
aciodrv_device_open_path(argv[1], atoi(argv[2]));
|
||||
|
||||
if (!device) {
|
||||
printf("Opening acio device failed\n");
|
||||
|
@ -3,27 +3,29 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "aciodrv/panb.h"
|
||||
#include "aciodrv-proc/panb.h"
|
||||
#include "aciodrv/panb.h"
|
||||
|
||||
struct panb_handler_ctx {
|
||||
bool running;
|
||||
};
|
||||
|
||||
bool aciotest_panb_handler_init(struct aciodrv_device_ctx *device, uint8_t node_id, void **ctx)
|
||||
bool aciotest_panb_handler_init(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id, void **ctx)
|
||||
{
|
||||
if (node_id != 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
*ctx = malloc(sizeof(struct panb_handler_ctx));
|
||||
struct panb_handler_ctx *panb_ctx = (struct panb_handler_ctx*)*ctx;
|
||||
struct panb_handler_ctx *panb_ctx = (struct panb_handler_ctx *) *ctx;
|
||||
panb_ctx->running = true;
|
||||
|
||||
return aciodrv_proc_panb_init(device);
|
||||
}
|
||||
|
||||
bool aciotest_panb_handler_update(struct aciodrv_device_ctx *device, uint8_t node_id, void *ctx)
|
||||
bool aciotest_panb_handler_update(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id, void *ctx)
|
||||
{
|
||||
uint8_t button[AC_IO_PANB_MAX_KEYS];
|
||||
struct ac_io_panb_poll_out state;
|
||||
@ -44,7 +46,7 @@ bool aciotest_panb_handler_update(struct aciodrv_device_ctx *device, uint8_t nod
|
||||
|
||||
printf(">>> PANB:\nPress first and last keys to close device\n");
|
||||
|
||||
for (int i=0; i<AC_IO_PANB_MAX_KEYS; i++) {
|
||||
for (int i = 0; i < AC_IO_PANB_MAX_KEYS; i++) {
|
||||
printf("%01X ", button[i]);
|
||||
}
|
||||
printf("\n");
|
||||
@ -55,17 +57,17 @@ bool aciotest_panb_handler_update(struct aciodrv_device_ctx *device, uint8_t nod
|
||||
* makes it fall into a state where it doesn't send anything anymore
|
||||
* and won't even respond to a reset, thus requiring a power cycle.
|
||||
*/
|
||||
if (button[0] && button[AC_IO_PANB_MAX_KEYS-1]) {
|
||||
if (button[0] && button[AC_IO_PANB_MAX_KEYS - 1]) {
|
||||
aciodrv_proc_panb_fini(device);
|
||||
panb_ctx->running = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* light the panel */
|
||||
for (int i=0; i<AC_IO_PANB_MAX_KEYS; i++) {
|
||||
state.key[i].green = (button[i])? 0x7F : 0;
|
||||
for (int i = 0; i < AC_IO_PANB_MAX_KEYS; i++) {
|
||||
state.key[i].green = (button[i]) ? 0x7F : 0;
|
||||
state.key[i].red = 0;
|
||||
state.key[i].blue = (button[i])? 0x23 : 0;
|
||||
state.key[i].blue = (button[i]) ? 0x23 : 0;
|
||||
}
|
||||
|
||||
if (!aciodrv_panb_send_lamp(device, node_id, &state)) {
|
||||
|
@ -6,7 +6,9 @@
|
||||
|
||||
#include "aciodrv/device.h"
|
||||
|
||||
bool aciotest_panb_handler_init(struct aciodrv_device_ctx *device, uint8_t node_id, void **ctx);
|
||||
bool aciotest_panb_handler_update(struct aciodrv_device_ctx *device, uint8_t node_id, void *ctx);
|
||||
bool aciotest_panb_handler_init(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id, void **ctx);
|
||||
bool aciotest_panb_handler_update(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id, void *ctx);
|
||||
|
||||
#endif
|
@ -54,8 +54,7 @@ bool aciotest_rvol_handler_update(
|
||||
selected_light,
|
||||
pin.spinners[2] / 2,
|
||||
pin.spinners[3] / 2,
|
||||
pin.spinners[4] / 2
|
||||
);
|
||||
pin.spinners[4] / 2);
|
||||
|
||||
memset(&pout, 0, sizeof(pout));
|
||||
|
||||
|
@ -51,17 +51,17 @@ LSTATUS my_RegCloseKey(HKEY hKey);
|
||||
|
||||
LSTATUS (*real_RegOpenKeyA)(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult);
|
||||
|
||||
LSTATUS (*real_RegEnumKeyA)
|
||||
LSTATUS(*real_RegEnumKeyA)
|
||||
(HKEY hKey, DWORD dwIndex, LPSTR lpName, DWORD cchName);
|
||||
|
||||
LSTATUS (*real_RegOpenKeyExA)
|
||||
LSTATUS(*real_RegOpenKeyExA)
|
||||
(HKEY hKey,
|
||||
LPCSTR lpSubKey,
|
||||
DWORD ulOptions,
|
||||
REGSAM samDesired,
|
||||
PHKEY phkResult);
|
||||
|
||||
LSTATUS (*real_RegQueryValueExA)
|
||||
LSTATUS(*real_RegQueryValueExA)
|
||||
(HKEY hKey,
|
||||
LPCSTR lpValueName,
|
||||
LPDWORD lpReserved,
|
||||
|
@ -10,8 +10,7 @@
|
||||
|
||||
#define ASIOHOOK_CONFIG_IO_DEFAULT_FORCE_ASIO_VALUE false
|
||||
#define ASIOHOOK_CONFIG_IO_DEFAULT_FORCE_WASAPI_VALUE false
|
||||
#define ASIOHOOK_CONFIG_IO_DEFAULT_ASIO_DEVICE_NAME_VALUE \
|
||||
"XONAR SOUND CARD(64)"
|
||||
#define ASIOHOOK_CONFIG_IO_DEFAULT_ASIO_DEVICE_NAME_VALUE "XONAR SOUND CARD(64)"
|
||||
|
||||
void asiohook_config_init(struct cconfig *config)
|
||||
{
|
||||
|
@ -105,7 +105,6 @@ bool ddr_io_init(
|
||||
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);
|
||||
|
@ -70,7 +70,8 @@ enum iidx_io_panel_light {
|
||||
IIDX_IO_PANEL_LIGHT_EFFECT = 3,
|
||||
};
|
||||
|
||||
/* Bit mapping for the top lamps from left to right when facing cabinet screen */
|
||||
/* 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,
|
||||
|
@ -106,7 +106,8 @@ void jb_io_set_rgb_led(
|
||||
|
||||
bool jb_io_write_lights(void);
|
||||
|
||||
/* Select operating mode for the panel. Should be immediately sent to the IOPCB */
|
||||
/* 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);
|
||||
|
||||
|
@ -103,8 +103,6 @@ uint16_t sdvx_io_get_spinner_pos(uint8_t spinner_no);
|
||||
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);
|
||||
uint8_t primary, uint8_t headphone, uint8_t subwoofer);
|
||||
|
||||
#endif
|
||||
|
@ -14,9 +14,8 @@
|
||||
// in all inputs and outputs (over sub IO) other than 14 keys to not work.
|
||||
static const uint8_t _BIO2DR_BI2A_IIDX_INIT_DATA = 0x2D;
|
||||
|
||||
static bool bio2drv_bi2a_iidx_init_io(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id)
|
||||
static bool
|
||||
bio2drv_bi2a_iidx_init_io(struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
{
|
||||
struct ac_io_message msg;
|
||||
|
||||
@ -28,9 +27,7 @@ static bool bio2drv_bi2a_iidx_init_io(
|
||||
msg.cmd.param = _BIO2DR_BI2A_IIDX_INIT_DATA;
|
||||
|
||||
if (!aciodrv_send_and_recv(
|
||||
device,
|
||||
&msg,
|
||||
offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
device, &msg, offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
log_warning("Init node failed");
|
||||
return 0;
|
||||
}
|
||||
@ -41,8 +38,7 @@ static bool bio2drv_bi2a_iidx_init_io(
|
||||
}
|
||||
|
||||
static bool bio2drv_bi2a_iidx_watchdog_start(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id)
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
{
|
||||
log_assert(device);
|
||||
|
||||
|
@ -15,9 +15,7 @@
|
||||
* device driver foundation.
|
||||
* @see driver.h
|
||||
*/
|
||||
bool bio2drv_bi2a_iidx_init(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id);
|
||||
bool bio2drv_bi2a_iidx_init(struct aciodrv_device_ctx *device, uint8_t node_id);
|
||||
|
||||
/**
|
||||
* Poll the BI2A board
|
||||
|
@ -12,7 +12,8 @@
|
||||
static const uint8_t _BIO2DR_BI2A_SDVX_INIT_DATA = 0x3B;
|
||||
|
||||
// this is probably InitIO
|
||||
static bool bio2drv_bi2a_sdvx_init_io(struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
static bool
|
||||
bio2drv_bi2a_sdvx_init_io(struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
{
|
||||
struct ac_io_message msg;
|
||||
|
||||
@ -24,9 +25,7 @@ static bool bio2drv_bi2a_sdvx_init_io(struct aciodrv_device_ctx *device, uint8_t
|
||||
msg.cmd.param = _BIO2DR_BI2A_SDVX_INIT_DATA;
|
||||
|
||||
if (!aciodrv_send_and_recv(
|
||||
device,
|
||||
&msg,
|
||||
offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
device, &msg, offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
log_warning("Init node failed");
|
||||
return 0;
|
||||
}
|
||||
@ -36,7 +35,8 @@ static bool bio2drv_bi2a_sdvx_init_io(struct aciodrv_device_ctx *device, uint8_t
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool bio2drv_bi2a_sdvx_watchdog_start(struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
static bool bio2drv_bi2a_sdvx_watchdog_start(
|
||||
struct aciodrv_device_ctx *device, uint8_t node_id)
|
||||
{
|
||||
log_assert(device);
|
||||
|
||||
@ -95,9 +95,7 @@ bool bio2drv_bi2a_sdvx_amp(
|
||||
msg.cmd.raw[3] = right;
|
||||
|
||||
if (!aciodrv_send_and_recv(
|
||||
device,
|
||||
&msg,
|
||||
offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
device, &msg, offsetof(struct ac_io_message, cmd.raw) + 1)) {
|
||||
log_warning("Setting AMP failed");
|
||||
return false;
|
||||
}
|
||||
|
@ -15,9 +15,7 @@
|
||||
* device driver foundation.
|
||||
* @see driver.h
|
||||
*/
|
||||
bool bio2drv_bi2a_sdvx_init(
|
||||
struct aciodrv_device_ctx *device,
|
||||
uint8_t node_id);
|
||||
bool bio2drv_bi2a_sdvx_init(struct aciodrv_device_ctx *device, uint8_t node_id);
|
||||
|
||||
/**
|
||||
* Poll the board
|
||||
|
@ -50,10 +50,10 @@ static bool check_property(
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool check_id(
|
||||
HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA PDeviceInfoData)
|
||||
static bool check_id(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA PDeviceInfoData)
|
||||
{
|
||||
if (CM_Get_Device_IDA(PDeviceInfoData->DevInst, work_buffer, sizeof(work_buffer), 0)) {
|
||||
if (CM_Get_Device_IDA(
|
||||
PDeviceInfoData->DevInst, work_buffer, sizeof(work_buffer), 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,8 @@ static void bio2_emu_bi2a_send_status(
|
||||
ac_io_emu_response_push(emu, &resp, 0);
|
||||
}
|
||||
|
||||
static int16_t tt_mult_delta(size_t tt_no) {
|
||||
static int16_t tt_mult_delta(size_t tt_no)
|
||||
{
|
||||
int16_t current_tt = iidx_io_ep2_get_turntable(tt_no);
|
||||
int16_t delta = get_wrapped_delta_s16(current_tt, tt_last[tt_no], 256);
|
||||
|
||||
|
@ -382,8 +382,8 @@ static INT_PTR lights_handle_pulse_tick(HWND hwnd)
|
||||
}
|
||||
|
||||
bias = (float) (ui->lights[light_no].value_min);
|
||||
scale =
|
||||
(float) (ui->lights[light_no].value_max - ui->lights[light_no].value_min);
|
||||
scale = (float) (ui->lights[light_no].value_max -
|
||||
ui->lights[light_no].value_min);
|
||||
|
||||
/* Intensity perception is non-linear. Pulse quadratically. */
|
||||
|
||||
|
@ -117,14 +117,14 @@ int main(int argc, char **argv)
|
||||
if (!mapper_config_load(schema->name)) {
|
||||
log_info("Initializing empty config for %s", schema->name);
|
||||
|
||||
mapper_set_nlights((uint8_t)(max_light + 1));
|
||||
mapper_set_nlights((uint8_t) (max_light + 1));
|
||||
mapper_set_nanalogs((uint8_t) schema->nanalogs);
|
||||
} else {
|
||||
// make sure that these are right
|
||||
|
||||
if (mapper_get_nlights() != (max_light + 1)) {
|
||||
log_info("Updating nlights for %s", schema->name);
|
||||
mapper_set_nlights((uint8_t)(max_light + 1));
|
||||
mapper_set_nlights((uint8_t) (max_light + 1));
|
||||
}
|
||||
|
||||
if (mapper_get_nanalogs() != schema->nanalogs) {
|
||||
|
@ -24,7 +24,7 @@ void spinner_init(HINSTANCE inst)
|
||||
wcx.cbSize = sizeof(wcx);
|
||||
wcx.lpfnWndProc = spinner_wnd_proc;
|
||||
wcx.hInstance = inst;
|
||||
wcx.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
wcx.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
|
||||
wcx.lpszClassName = spinner_cls;
|
||||
|
||||
RegisterClassEx(&wcx);
|
||||
|
@ -18,8 +18,10 @@
|
||||
#define D3D9EXHOOK_CONFIG_GFX_FORCED_REFRESHRATE_KEY "gfx.forced_refresh_rate"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEVICE_ADAPTER_KEY "gfx.device_adapter"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_FORCE_ORIENTATION_KEY "gfx.force_orientation"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_FORCE_SCREEN_RES_WIDTH_KEY "gfx.force_screen_res.width"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_FORCE_SCREEN_RES_HEIGHT_KEY "gfx.force_screen_res.height"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_FORCE_SCREEN_RES_WIDTH_KEY \
|
||||
"gfx.force_screen_res.width"
|
||||
#define D3D9EXHOOK_CONFIG_GFX_FORCE_SCREEN_RES_HEIGHT_KEY \
|
||||
"gfx.force_screen_res.height"
|
||||
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_FRAMED_VALUE false
|
||||
#define D3D9EXHOOK_CONFIG_GFX_DEFAULT_WINDOWED_VALUE false
|
||||
@ -103,15 +105,19 @@ void d3d9exhook_config_gfx_init(struct cconfig *config)
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_FORCE_SCREEN_RES_WIDTH_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCE_SCREEN_RES_WIDTH_VALUE,
|
||||
"Force a screen resolution (width), -1 to disable. Use this if the game does not auto "
|
||||
"detect your monitor's resolution properly, e.g. 1368x768 instead of 1280x720.");
|
||||
"Force a screen resolution (width), -1 to disable. Use this if the "
|
||||
"game does not auto "
|
||||
"detect your monitor's resolution properly, e.g. 1368x768 instead of "
|
||||
"1280x720.");
|
||||
|
||||
cconfig_util_set_int(
|
||||
config,
|
||||
D3D9EXHOOK_CONFIG_GFX_FORCE_SCREEN_RES_HEIGHT_KEY,
|
||||
D3D9EXHOOK_CONFIG_GFX_DEFAULT_FORCE_SCREEN_RES_HEIGHT_VALUE,
|
||||
"Force a screen resolution (height), -1 to disable. Use this if the game does not auto "
|
||||
"detect your monitor's resolution properly, e.g. 1368x768 instead of 1280x720.");
|
||||
"Force a screen resolution (height), -1 to disable. Use this if the "
|
||||
"game does not auto "
|
||||
"detect your monitor's resolution properly, e.g. 1368x768 instead of "
|
||||
"1280x720.");
|
||||
}
|
||||
|
||||
void d3d9exhook_config_gfx_get(
|
||||
|
@ -52,10 +52,8 @@ static HRESULT STDCALL my_EnumAdapterModes(
|
||||
UINT Mode,
|
||||
D3DDISPLAYMODE *pMode);
|
||||
|
||||
static UINT STDCALL my_GetAdapterModeCount(
|
||||
IDirect3D9Ex *self,
|
||||
UINT Adapter,
|
||||
D3DFORMAT Format);
|
||||
static UINT STDCALL
|
||||
my_GetAdapterModeCount(IDirect3D9Ex *self, UINT Adapter, D3DFORMAT Format);
|
||||
|
||||
static HRESULT STDCALL my_Direct3DCreate9Ex(UINT sdk_ver, IDirect3D9Ex **api);
|
||||
|
||||
@ -305,7 +303,8 @@ static HRESULT STDCALL my_CreateDeviceEx(
|
||||
|
||||
if (fdm) {
|
||||
log_misc(
|
||||
"CreateDeviceEx display mode: size %d, width %d, height %d, refresh rate %d, format %d, "
|
||||
"CreateDeviceEx display mode: size %d, width %d, height %d, "
|
||||
"refresh rate %d, format %d, "
|
||||
"scan line ordering %d",
|
||||
fdm->Size,
|
||||
fdm->Width,
|
||||
@ -318,7 +317,8 @@ static HRESULT STDCALL my_CreateDeviceEx(
|
||||
log_misc(
|
||||
"D3D9EX presenter parameters: BackBufferWidth %d, BackBufferHeight "
|
||||
"%d, BackBufferFormat %d, "
|
||||
"BackBufferCount %d, MultiSampleType %d, MultiSampleQuality %ld, SwapEffect %d, "
|
||||
"BackBufferCount %d, MultiSampleType %d, MultiSampleQuality %ld, "
|
||||
"SwapEffect %d, "
|
||||
"hDeviceWindow %p, Windowed %d, "
|
||||
"EnableAutoDepthStencil "
|
||||
"%d, AutoDepthStencilFormat %d, Flags %lX, "
|
||||
@ -343,8 +343,10 @@ static HRESULT STDCALL my_CreateDeviceEx(
|
||||
adapter = d3d9ex_device_adapter;
|
||||
}
|
||||
|
||||
if (d3d9ex_force_screen_res_width > 0 && d3d9ex_force_screen_res_height > 0) {
|
||||
log_info("Overriding screen resolution/back buffer of %dx%d -> %dx%d",
|
||||
if (d3d9ex_force_screen_res_width > 0 &&
|
||||
d3d9ex_force_screen_res_height > 0) {
|
||||
log_info(
|
||||
"Overriding screen resolution/back buffer of %dx%d -> %dx%d",
|
||||
pp->BackBufferWidth,
|
||||
pp->BackBufferHeight,
|
||||
d3d9ex_force_screen_res_width,
|
||||
@ -445,7 +447,7 @@ static HRESULT STDCALL my_EnumAdapterModes(
|
||||
IDirect3D9Ex *real = com_proxy_downcast(self)->real;
|
||||
HRESULT hr;
|
||||
|
||||
if (d3d9ex_device_adapter>= 0) {
|
||||
if (d3d9ex_device_adapter >= 0) {
|
||||
Adapter = d3d9ex_device_adapter;
|
||||
}
|
||||
|
||||
@ -461,15 +463,13 @@ static HRESULT STDCALL my_EnumAdapterModes(
|
||||
return hr;
|
||||
}
|
||||
|
||||
static UINT STDCALL my_GetAdapterModeCount(
|
||||
IDirect3D9Ex *self,
|
||||
UINT Adapter,
|
||||
D3DFORMAT Format)
|
||||
static UINT STDCALL
|
||||
my_GetAdapterModeCount(IDirect3D9Ex *self, UINT Adapter, D3DFORMAT Format)
|
||||
{
|
||||
IDirect3D9Ex *real = com_proxy_downcast(self)->real;
|
||||
UINT res;
|
||||
|
||||
if (d3d9ex_device_adapter>= 0) {
|
||||
if (d3d9ex_device_adapter >= 0) {
|
||||
Adapter = d3d9ex_device_adapter;
|
||||
}
|
||||
|
||||
@ -555,7 +555,8 @@ void d3d9ex_configure(struct d3d9exhook_config_gfx *gfx_config)
|
||||
d3d9ex_force_screen_res_height = gfx_config->force_screen_res.height;
|
||||
|
||||
if (d3d9ex_force_screen_res_width * d3d9ex_force_screen_res_height > 0) {
|
||||
log_warning("Force screen res: Only one, either width or height, is > 0."
|
||||
log_warning(
|
||||
"Force screen res: Only one, either width or height, is > 0."
|
||||
" Force screen res not activate");
|
||||
}
|
||||
}
|
||||
|
@ -34,9 +34,7 @@ static struct ac_io_emu_hdxs com4_hdxs;
|
||||
static struct ac_io_emu_icca com4_icca[2];
|
||||
|
||||
static uint32_t check_panel_light(
|
||||
const struct ac_io_hdxs_output *output,
|
||||
uint8_t panel_idx,
|
||||
uint8_t out_idx)
|
||||
const struct ac_io_hdxs_output *output, uint8_t panel_idx, uint8_t out_idx)
|
||||
{
|
||||
if (output->lights[panel_idx].bit) {
|
||||
return 1 << out_idx;
|
||||
@ -45,7 +43,8 @@ static uint32_t check_panel_light(
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t upscale_light(uint8_t in_7bit) {
|
||||
static uint8_t upscale_light(uint8_t in_7bit)
|
||||
{
|
||||
if (in_7bit < 0x10) {
|
||||
return in_7bit * 2;
|
||||
} else {
|
||||
@ -54,18 +53,24 @@ static uint8_t upscale_light(uint8_t in_7bit) {
|
||||
}
|
||||
}
|
||||
|
||||
static void lights_dispatcher(
|
||||
struct ac_io_emu_hdxs *emu, const struct ac_io_message *req)
|
||||
static void
|
||||
lights_dispatcher(struct ac_io_emu_hdxs *emu, const struct ac_io_message *req)
|
||||
{
|
||||
const struct ac_io_hdxs_output *output = &req->cmd.hdxs_output;
|
||||
|
||||
uint32_t lights = 0;
|
||||
lights |= check_panel_light(output, AC_IO_HDXS_OUT_P1_START, LIGHT_HD_P1_START);
|
||||
lights |= check_panel_light(output, AC_IO_HDXS_OUT_P1_UP_DOWN, LIGHT_HD_P1_UP_DOWN);
|
||||
lights |= check_panel_light(output, AC_IO_HDXS_OUT_P1_LEFT_RIGHT, LIGHT_HD_P1_LEFT_RIGHT);
|
||||
lights |= check_panel_light(output, AC_IO_HDXS_OUT_P2_START, LIGHT_HD_P2_START);
|
||||
lights |= check_panel_light(output, AC_IO_HDXS_OUT_P2_UP_DOWN, LIGHT_HD_P2_UP_DOWN);
|
||||
lights |= check_panel_light(output, AC_IO_HDXS_OUT_P2_LEFT_RIGHT, LIGHT_HD_P2_LEFT_RIGHT);
|
||||
lights |=
|
||||
check_panel_light(output, AC_IO_HDXS_OUT_P1_START, LIGHT_HD_P1_START);
|
||||
lights |= check_panel_light(
|
||||
output, AC_IO_HDXS_OUT_P1_UP_DOWN, LIGHT_HD_P1_UP_DOWN);
|
||||
lights |= check_panel_light(
|
||||
output, AC_IO_HDXS_OUT_P1_LEFT_RIGHT, LIGHT_HD_P1_LEFT_RIGHT);
|
||||
lights |=
|
||||
check_panel_light(output, AC_IO_HDXS_OUT_P2_START, LIGHT_HD_P2_START);
|
||||
lights |= check_panel_light(
|
||||
output, AC_IO_HDXS_OUT_P2_UP_DOWN, LIGHT_HD_P2_UP_DOWN);
|
||||
lights |= check_panel_light(
|
||||
output, AC_IO_HDXS_OUT_P2_LEFT_RIGHT, LIGHT_HD_P2_LEFT_RIGHT);
|
||||
|
||||
ddr_io_set_lights_hdxs_panel(lights);
|
||||
|
||||
@ -73,9 +78,12 @@ static void lights_dispatcher(
|
||||
size_t light_idx = i * 3;
|
||||
|
||||
// these are 7 bit, upscale them to 8 bit
|
||||
uint8_t r = upscale_light(output->lights[light_idx + AC_IO_HDXS_RED].analog);
|
||||
uint8_t g = upscale_light(output->lights[light_idx + AC_IO_HDXS_GREEN].analog);
|
||||
uint8_t b = upscale_light(output->lights[light_idx + AC_IO_HDXS_BLUE].analog);
|
||||
uint8_t r =
|
||||
upscale_light(output->lights[light_idx + AC_IO_HDXS_RED].analog);
|
||||
uint8_t g =
|
||||
upscale_light(output->lights[light_idx + AC_IO_HDXS_GREEN].analog);
|
||||
uint8_t b =
|
||||
upscale_light(output->lights[light_idx + AC_IO_HDXS_BLUE].analog);
|
||||
|
||||
ddr_io_set_lights_hdxs_rgb(i, r, g, b);
|
||||
}
|
||||
|
@ -185,8 +185,7 @@ static void gfx_d3d9_patch_window(struct hook_d3d9_irp *irp)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gfx_d3d9_fix_window_size_and_pos(struct hook_d3d9_irp *irp)
|
||||
static void gfx_d3d9_fix_window_size_and_pos(struct hook_d3d9_irp *irp)
|
||||
{
|
||||
log_assert(irp);
|
||||
log_assert(irp->op == HOOK_D3D9_IRP_OP_CREATE_WINDOW_EX);
|
||||
@ -215,8 +214,7 @@ gfx_d3d9_fix_window_size_and_pos(struct hook_d3d9_irp *irp)
|
||||
}
|
||||
}
|
||||
|
||||
static void gfx_d3d9_create_device_apply_window_mode(
|
||||
struct hook_d3d9_irp *irp)
|
||||
static void gfx_d3d9_create_device_apply_window_mode(struct hook_d3d9_irp *irp)
|
||||
{
|
||||
log_assert(irp);
|
||||
log_assert(irp->op == HOOK_D3D9_IRP_OP_CTX_CREATE_DEVICE);
|
||||
@ -231,8 +229,7 @@ static void gfx_d3d9_create_device_apply_window_mode(
|
||||
}
|
||||
}
|
||||
|
||||
static void gfx_d3d9_reset_apply_window_mode(
|
||||
struct hook_d3d9_irp *irp)
|
||||
static void gfx_d3d9_reset_apply_window_mode(struct hook_d3d9_irp *irp)
|
||||
{
|
||||
log_assert(irp);
|
||||
log_assert(irp->op == HOOK_D3D9_IRP_OP_DEV_RESET);
|
||||
|
@ -64,8 +64,14 @@ void p3io_ddr_init_with_plugs(
|
||||
memcpy(&p3io_ddr_mcode, mcode, sizeof(struct security_mcode));
|
||||
memcpy(&p3io_ddr_pcbid, pcbid, sizeof(struct security_id));
|
||||
memcpy(&p3io_ddr_eamid, eamid, sizeof(struct security_id));
|
||||
memcpy(&p3io_black_sign_key, black_sign_key, sizeof(struct security_rp_sign_key));
|
||||
memcpy(&p3io_white_sign_key, white_sign_key, sizeof(struct security_rp_sign_key));
|
||||
memcpy(
|
||||
&p3io_black_sign_key,
|
||||
black_sign_key,
|
||||
sizeof(struct security_rp_sign_key));
|
||||
memcpy(
|
||||
&p3io_white_sign_key,
|
||||
white_sign_key,
|
||||
sizeof(struct security_rp_sign_key));
|
||||
|
||||
/* COM4 isn't a real COM port, we configure the core P3IO emulator code to
|
||||
generate IRPs addressed to COM4 and then we possibly intercept them in
|
||||
|
@ -15,9 +15,9 @@
|
||||
#include "hook/iohook.h"
|
||||
|
||||
#include "util/crc.h"
|
||||
#include "util/fs.h"
|
||||
#include "util/iobuf.h"
|
||||
#include "util/log.h"
|
||||
#include "util/fs.h"
|
||||
#include "util/str.h"
|
||||
|
||||
#define USBMEM_DEVICE_COUNT 2
|
||||
@ -95,7 +95,8 @@ void usbmem_init(const char *path_p1, const char *path_p2, const bool enabled)
|
||||
GetFullPathNameA(path_p2, sizeof(usb_data_path[1]), usb_data_path[1], NULL);
|
||||
log_misc("USB memory data path (P2): %s", usb_data_path[1]);
|
||||
|
||||
if (enabled && !path_exists(usb_data_path[0]) && !path_exists(usb_data_path[1])) {
|
||||
if (enabled && !path_exists(usb_data_path[0]) &&
|
||||
!path_exists(usb_data_path[1])) {
|
||||
log_warning("USB memory data path does not exist, disabling");
|
||||
usbmem_enabled = false;
|
||||
}
|
||||
@ -177,16 +178,22 @@ static HRESULT usbmem_write(struct irp *irp)
|
||||
log_assert(irp->write.bytes != NULL);
|
||||
|
||||
src = &irp->write;
|
||||
nbytes = src->nbytes > USBMEM_COMMAND_BUF_SIZE ? USBMEM_COMMAND_BUF_SIZE : src->nbytes;
|
||||
nbytes = src->nbytes > USBMEM_COMMAND_BUF_SIZE ? USBMEM_COMMAND_BUF_SIZE :
|
||||
src->nbytes;
|
||||
memcpy(request, src->bytes, nbytes);
|
||||
request[nbytes - 1] = '\0'; /* This is always a CR. */
|
||||
|
||||
if (!usbmem_pending && target_device_id >= 0 && target_device_id < USBMEM_DEVICE_COUNT && usbmem_state[target_device_id].file_type == USBMEM_FILE_TYPE_READ) {
|
||||
if (!usbmem_pending && target_device_id >= 0 &&
|
||||
target_device_id < USBMEM_DEVICE_COUNT &&
|
||||
usbmem_state[target_device_id].file_type == USBMEM_FILE_TYPE_READ) {
|
||||
memset(usbmem_response, 0, sizeof(usbmem_response));
|
||||
|
||||
// log_misc("Read progress %08x/%08x bytes", usbmem_state[target_device_id].buffer_index, usbmem_state[target_device_id].buffer_len);
|
||||
// log_misc("Read progress %08x/%08x bytes",
|
||||
// usbmem_state[target_device_id].buffer_index,
|
||||
// usbmem_state[target_device_id].buffer_len);
|
||||
|
||||
if (usbmem_state[target_device_id].buffer_index < usbmem_state[target_device_id].buffer_len) {
|
||||
if (usbmem_state[target_device_id].buffer_index <
|
||||
usbmem_state[target_device_id].buffer_len) {
|
||||
usbmem_response_length = sizeof(usbmem_response);
|
||||
usbmem_response[0] = 0x02; // 1 = 0x80 buffer, 2 = 0x400 buffer
|
||||
usbmem_response[1] = usbmem_state[target_device_id].buffer_frame;
|
||||
@ -201,16 +208,23 @@ static HRESULT usbmem_write(struct irp *irp)
|
||||
} else {
|
||||
size_t len = sizeof(usbmem_response) - 5;
|
||||
|
||||
if (usbmem_state[target_device_id].buffer_index + len > usbmem_state[target_device_id].buffer_len)
|
||||
len = usbmem_state[target_device_id].buffer_len - usbmem_state[target_device_id].buffer_index;
|
||||
if (usbmem_state[target_device_id].buffer_index + len >
|
||||
usbmem_state[target_device_id].buffer_len)
|
||||
len = usbmem_state[target_device_id].buffer_len -
|
||||
usbmem_state[target_device_id].buffer_index;
|
||||
|
||||
memcpy(usbmem_response + 3, usbmem_state[target_device_id].buffer + usbmem_state[target_device_id].buffer_index, len);
|
||||
memcpy(
|
||||
usbmem_response + 3,
|
||||
usbmem_state[target_device_id].buffer +
|
||||
usbmem_state[target_device_id].buffer_index,
|
||||
len);
|
||||
usbmem_state[target_device_id].buffer_index += len;
|
||||
}
|
||||
|
||||
usbmem_state[target_device_id].buffer_frame++;
|
||||
|
||||
uint16_t crc = crc16_msb(usbmem_response + 3, sizeof(usbmem_response) - 5, 0);
|
||||
uint16_t crc =
|
||||
crc16_msb(usbmem_response + 3, sizeof(usbmem_response) - 5, 0);
|
||||
usbmem_response[sizeof(usbmem_response) - 2] = crc >> 8;
|
||||
usbmem_response[sizeof(usbmem_response) - 1] = crc & 0xff;
|
||||
} else {
|
||||
@ -221,7 +235,8 @@ static HRESULT usbmem_write(struct irp *irp)
|
||||
log_misc(">%s", request);
|
||||
|
||||
// Try to detect device ID
|
||||
// The only commands without a device ID are "sver", "start", and "init".
|
||||
// The only commands without a device ID are "sver", "start", and
|
||||
// "init".
|
||||
char target_device_val = request[strlen(request) - 1];
|
||||
char *target_device_id_ptr = strstr(request, " ");
|
||||
if (target_device_id_ptr != NULL) {
|
||||
@ -241,18 +256,22 @@ static HRESULT usbmem_write(struct irp *irp)
|
||||
target_device_id = target_device_val == 'b' ? 0 : 1;
|
||||
|
||||
if (!usbmem_enabled) {
|
||||
// Ignore all other USB device specific commands and pretend a device isn't plugged in
|
||||
// when USB memory emulation is disabled.
|
||||
// Ignore all other USB device specific commands and pretend a
|
||||
// device isn't plugged in when USB memory emulation is
|
||||
// disabled.
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "fail");
|
||||
} else if (usbmem_state[target_device_id].errored) {
|
||||
// If the device went through the entire process once and the file didn't exist
|
||||
// then just force it to be disabled until the game is restarted because otherwise
|
||||
// it'll get stuck in a loop.
|
||||
// TODO: This could be better emulated by using a keybind to simulate inserting and
|
||||
// ejecting the USB drive to additionally clear the error flag.
|
||||
// If the device went through the entire process once and the
|
||||
// file didn't exist then just force it to be disabled until the
|
||||
// game is restarted because otherwise it'll get stuck in a
|
||||
// loop.
|
||||
// TODO: This could be better emulated by using a keybind to
|
||||
// simulate inserting and ejecting the USB drive to additionally
|
||||
// clear the error flag.
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "fail");
|
||||
} else if (str_eq(request, "on_a") || str_eq(request, "on_b")) {
|
||||
usbmem_state[target_device_id].connected = path_exists(usbmem_state[target_device_id].basepath);
|
||||
usbmem_state[target_device_id].connected =
|
||||
path_exists(usbmem_state[target_device_id].basepath);
|
||||
usbmem_state[target_device_id].errored = false;
|
||||
|
||||
usbmem_reset_file_state(target_device_id);
|
||||
@ -260,21 +279,32 @@ static HRESULT usbmem_write(struct irp *irp)
|
||||
if (usbmem_state[target_device_id].connected)
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "done");
|
||||
else
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "not connected");
|
||||
str_cpy(
|
||||
usbmem_response,
|
||||
sizeof(usbmem_response),
|
||||
"not connected");
|
||||
} else if (str_eq(request, "offa") || str_eq(request, "offb")) {
|
||||
if (usbmem_state[target_device_id].connected)
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "done");
|
||||
else
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "not connected");
|
||||
str_cpy(
|
||||
usbmem_response,
|
||||
sizeof(usbmem_response),
|
||||
"not connected");
|
||||
|
||||
usbmem_state[target_device_id].connected = false;
|
||||
usbmem_reset_file_state(target_device_id);
|
||||
} else if (str_eq(request, "opna") || str_eq(request, "opnb")) {
|
||||
bool basepath_exists = path_exists(usbmem_state[target_device_id].basepath);
|
||||
bool basepath_exists =
|
||||
path_exists(usbmem_state[target_device_id].basepath);
|
||||
|
||||
if (!usbmem_state[target_device_id].connected || !basepath_exists) {
|
||||
if (!usbmem_state[target_device_id].connected ||
|
||||
!basepath_exists) {
|
||||
usbmem_state[target_device_id].opened = false;
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "not connected");
|
||||
str_cpy(
|
||||
usbmem_response,
|
||||
sizeof(usbmem_response),
|
||||
"not connected");
|
||||
} else {
|
||||
usbmem_state[target_device_id].opened = true;
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "done");
|
||||
@ -283,82 +313,132 @@ static HRESULT usbmem_write(struct irp *irp)
|
||||
if (usbmem_state[target_device_id].opened)
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "done");
|
||||
else
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "not connected");
|
||||
str_cpy(
|
||||
usbmem_response,
|
||||
sizeof(usbmem_response),
|
||||
"not connected");
|
||||
|
||||
usbmem_state[target_device_id].opened = false;
|
||||
usbmem_reset_file_state(target_device_id);
|
||||
} else if (strncmp(request, "cda ", 4) == 0 || strncmp(request, "cdb ", 4) == 0) {
|
||||
} else if (
|
||||
strncmp(request, "cda ", 4) == 0 ||
|
||||
strncmp(request, "cdb ", 4) == 0) {
|
||||
char *path = request + 4;
|
||||
|
||||
if (!usbmem_state[target_device_id].connected || !usbmem_state[target_device_id].opened) {
|
||||
if (!usbmem_state[target_device_id].connected ||
|
||||
!usbmem_state[target_device_id].opened) {
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "done");
|
||||
} else if (path[1] == ':') {
|
||||
// Absolute path
|
||||
char temp[MAX_PATH];
|
||||
snprintf(temp, sizeof(temp), "%s\\%s", usbmem_state[target_device_id].basepath, path + 3);
|
||||
snprintf(
|
||||
temp,
|
||||
sizeof(temp),
|
||||
"%s\\%s",
|
||||
usbmem_state[target_device_id].basepath,
|
||||
path + 3);
|
||||
|
||||
if (!path_exists(temp)) {
|
||||
log_warning("Couldn't find path %s", temp);
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "done");
|
||||
str_cpy(
|
||||
usbmem_response, sizeof(usbmem_response), "done");
|
||||
} else {
|
||||
log_misc("Changing path to %s", temp);
|
||||
str_cpy(usbmem_state[target_device_id].path, sizeof(usbmem_state[target_device_id].path), temp);
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "done");
|
||||
str_cpy(
|
||||
usbmem_state[target_device_id].path,
|
||||
sizeof(usbmem_state[target_device_id].path),
|
||||
temp);
|
||||
str_cpy(
|
||||
usbmem_response, sizeof(usbmem_response), "done");
|
||||
}
|
||||
} else {
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "fail");
|
||||
}
|
||||
} else if (strncmp(request, "rda ", 4) == 0 || strncmp(request, "rdb ", 4) == 0) {
|
||||
} else if (
|
||||
strncmp(request, "rda ", 4) == 0 ||
|
||||
strncmp(request, "rdb ", 4) == 0) {
|
||||
usbmem_reset_file_state(target_device_id);
|
||||
|
||||
if (!usbmem_state[target_device_id].connected || !usbmem_state[target_device_id].opened) {
|
||||
if (!usbmem_state[target_device_id].connected ||
|
||||
!usbmem_state[target_device_id].opened) {
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "fail");
|
||||
} else {
|
||||
char temp[MAX_PATH] = {0};
|
||||
char *filename = request + 4;
|
||||
|
||||
snprintf(temp, sizeof(temp), "%s\\%s", usbmem_state[target_device_id].path, filename);
|
||||
snprintf(
|
||||
temp,
|
||||
sizeof(temp),
|
||||
"%s\\%s",
|
||||
usbmem_state[target_device_id].path,
|
||||
filename);
|
||||
|
||||
if (usbmem_state[target_device_id].buffer) {
|
||||
free(usbmem_state[target_device_id].buffer);
|
||||
usbmem_state[target_device_id].buffer = NULL;
|
||||
}
|
||||
|
||||
usbmem_state[target_device_id].file_type = USBMEM_FILE_TYPE_NONE;
|
||||
usbmem_state[target_device_id].file_type =
|
||||
USBMEM_FILE_TYPE_NONE;
|
||||
usbmem_state[target_device_id].buffer_len = 0;
|
||||
usbmem_state[target_device_id].buffer_index = 0;
|
||||
usbmem_state[target_device_id].buffer_frame = 0;
|
||||
memset(usbmem_state[target_device_id].filename, 0, sizeof(usbmem_state[target_device_id].filename));
|
||||
memset(
|
||||
usbmem_state[target_device_id].filename,
|
||||
0,
|
||||
sizeof(usbmem_state[target_device_id].filename));
|
||||
|
||||
if (!path_exists(temp)) {
|
||||
log_warning("Couldn't find file %s", temp);
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "fail");
|
||||
str_cpy(
|
||||
usbmem_response, sizeof(usbmem_response), "fail");
|
||||
usbmem_state[target_device_id].errored = true;
|
||||
} else {
|
||||
bool loaded = file_load(temp, (void**)&usbmem_state[target_device_id].buffer,
|
||||
&usbmem_state[target_device_id].buffer_len, false);
|
||||
bool loaded = file_load(
|
||||
temp,
|
||||
(void **) &usbmem_state[target_device_id].buffer,
|
||||
&usbmem_state[target_device_id].buffer_len,
|
||||
false);
|
||||
|
||||
if (loaded) {
|
||||
log_misc("Reading file %s", temp);
|
||||
usbmem_state[target_device_id].file_type = USBMEM_FILE_TYPE_READ;
|
||||
usbmem_state[target_device_id].file_type =
|
||||
USBMEM_FILE_TYPE_READ;
|
||||
|
||||
str_cpy(usbmem_state[target_device_id].filename, sizeof(usbmem_state[target_device_id].filename), filename);
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "start");
|
||||
str_cpy(
|
||||
usbmem_state[target_device_id].filename,
|
||||
sizeof(usbmem_state[target_device_id].filename),
|
||||
filename);
|
||||
str_cpy(
|
||||
usbmem_response,
|
||||
sizeof(usbmem_response),
|
||||
"start");
|
||||
} else {
|
||||
log_warning("Couldn't read file %s", temp);
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "fail");
|
||||
str_cpy(
|
||||
usbmem_response,
|
||||
sizeof(usbmem_response),
|
||||
"fail");
|
||||
usbmem_state[target_device_id].errored = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (strncmp(request, "wra ", 4) == 0 || strncmp(request, "wrb ", 4) == 0) {
|
||||
} else if (
|
||||
strncmp(request, "wra ", 4) == 0 ||
|
||||
strncmp(request, "wrb ", 4) == 0) {
|
||||
// Open file for writing
|
||||
usbmem_reset_file_state(target_device_id);
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "not supported");
|
||||
} else if (strncmp(request, "wha ", 4) == 0 || strncmp(request, "whb ", 4) == 0) {
|
||||
str_cpy(
|
||||
usbmem_response, sizeof(usbmem_response), "not supported");
|
||||
} else if (
|
||||
strncmp(request, "wha ", 4) == 0 ||
|
||||
strncmp(request, "whb ", 4) == 0) {
|
||||
// Something relating to writing?
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "not supported");
|
||||
} else if (strncmp(request, "lma ", 4) == 0 || strncmp(request, "lmb ", 4) == 0) {
|
||||
str_cpy(
|
||||
usbmem_response, sizeof(usbmem_response), "not supported");
|
||||
} else if (
|
||||
strncmp(request, "lma ", 4) == 0 ||
|
||||
strncmp(request, "lmb ", 4) == 0) {
|
||||
// What is "lm"?
|
||||
str_cpy(usbmem_response, sizeof(usbmem_response), "done");
|
||||
} else {
|
||||
|
@ -84,8 +84,9 @@ static void my_avs_boot(
|
||||
char nvram_path[MAX_PATH] = {0};
|
||||
char raw_path[MAX_PATH] = {0};
|
||||
|
||||
// Using the full path as part of the AVS paths seems to break on long paths.
|
||||
// So instead, just take the launcher folder relative to the main game directory.
|
||||
// Using the full path as part of the AVS paths seems to break on long
|
||||
// paths. So instead, just take the launcher folder relative to the main
|
||||
// game directory.
|
||||
char *launcher_folder;
|
||||
ddrhook1_get_launcher_path_parts(NULL, &launcher_folder);
|
||||
|
||||
@ -104,10 +105,8 @@ static void my_avs_boot(
|
||||
|
||||
log_misc("avs paths: %s %s\n", nvram_path, raw_path);
|
||||
|
||||
avs_boot_replace_property_str(
|
||||
config, "/fs/nvram/device", nvram_path);
|
||||
avs_boot_replace_property_str(
|
||||
config, "/fs/raw/device", raw_path);
|
||||
avs_boot_replace_property_str(config, "/fs/nvram/device", nvram_path);
|
||||
avs_boot_replace_property_str(config, "/fs/raw/device", raw_path);
|
||||
#endif
|
||||
|
||||
real_avs_boot(
|
||||
|
@ -26,7 +26,8 @@ void ddrhook1_config_ddrhook1_init(struct cconfig *config)
|
||||
config,
|
||||
DDRHOOK1_CONFIG_DDRHOOK1_USE_COM4_EMU_KEY,
|
||||
DDRHOOK1_CONFIG_DDRHOOK1_DEFAULT_USE_COM4_EMU_VALUE,
|
||||
"Don't emulate P3IO COM4 and its downstream devices, use the Windows COM4 port instead");
|
||||
"Don't emulate P3IO COM4 and its downstream devices, use the Windows "
|
||||
"COM4 port instead");
|
||||
cconfig_util_set_bool(
|
||||
config,
|
||||
DDRHOOK1_CONFIG_DDRHOOK1_STANDARD_DEF_KEY,
|
||||
|
@ -41,8 +41,7 @@ void ddrhook1_config_security_get(
|
||||
char *tmp_default;
|
||||
char mcode[9];
|
||||
|
||||
tmp_default =
|
||||
security_mcode_to_str(&security_mcode_ddr_x);
|
||||
tmp_default = security_mcode_to_str(&security_mcode_ddr_x);
|
||||
|
||||
if (!cconfig_util_get_str(
|
||||
config,
|
||||
|
@ -53,8 +53,10 @@ static const hook_d3d9_irp_handler_t ddrhook1_d3d9_handlers[] = {
|
||||
gfx_d3d9_irp_handler,
|
||||
};
|
||||
|
||||
static DWORD STDCALL my_GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize);
|
||||
static DWORD(STDCALL *real_GetModuleFileNameA)(HMODULE hModule, LPSTR lpFilename, DWORD nSize);
|
||||
static DWORD STDCALL
|
||||
my_GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize);
|
||||
static DWORD(STDCALL *real_GetModuleFileNameA)(
|
||||
HMODULE hModule, LPSTR lpFilename, DWORD nSize);
|
||||
|
||||
static bool ddrhook1_init_check = false;
|
||||
|
||||
@ -144,7 +146,9 @@ my_GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize)
|
||||
#endif
|
||||
&security_rp_sign_key_white_eamuse);
|
||||
extio_init();
|
||||
usbmem_init(config_ddrhook1.usbmem_path_p1, config_ddrhook1.usbmem_path_p2,
|
||||
usbmem_init(
|
||||
config_ddrhook1.usbmem_path_p1,
|
||||
config_ddrhook1.usbmem_path_p2,
|
||||
config_ddrhook1.usbmem_enabled);
|
||||
spike_init();
|
||||
com4_init();
|
||||
@ -189,7 +193,8 @@ BOOL WINAPI DllMain(HMODULE self, DWORD reason, void *ctx)
|
||||
ddrhook1_master_insert_hooks(NULL);
|
||||
ddrhook1_filesystem_hook_init();
|
||||
|
||||
hook_d3d9_init(ddrhook1_d3d9_handlers, lengthof(ddrhook1_d3d9_handlers));
|
||||
hook_d3d9_init(
|
||||
ddrhook1_d3d9_handlers, lengthof(ddrhook1_d3d9_handlers));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -14,9 +14,8 @@
|
||||
#include "util/str.h"
|
||||
|
||||
static BOOL STDCALL my_SetCurrentDirectoryA(LPCSTR lpPathName);
|
||||
static HANDLE STDCALL my_FindFirstFileW(
|
||||
LPCWSTR lpFileName,
|
||||
LPWIN32_FIND_DATAA lpFindFileData);
|
||||
static HANDLE STDCALL
|
||||
my_FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
|
||||
static HANDLE STDCALL my_CreateFileW(
|
||||
LPCWSTR lpFileName,
|
||||
DWORD dwDesiredAccess,
|
||||
@ -30,8 +29,7 @@ static BOOL WINAPI my_CreateDirectoryW(
|
||||
|
||||
static BOOL(STDCALL *real_SetCurrentDirectoryA)(LPCSTR lpPathName);
|
||||
static HANDLE(STDCALL *real_FindFirstFileW)(
|
||||
LPCWSTR lpFileName,
|
||||
LPWIN32_FIND_DATAA lpFindFileData);
|
||||
LPCWSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
|
||||
static HANDLE(STDCALL *real_CreateFileW)(
|
||||
LPCWSTR lpFileName,
|
||||
DWORD dwDesiredAccess,
|
||||
@ -44,29 +42,25 @@ static BOOL(WINAPI *real_CreateDirectoryW)(
|
||||
LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
|
||||
|
||||
static const struct hook_symbol filesystem_hook_syms[] = {
|
||||
{
|
||||
.name = "CreateFileW",
|
||||
{.name = "CreateFileW",
|
||||
.patch = my_CreateFileW,
|
||||
.link = (void **) &real_CreateFileW
|
||||
},
|
||||
.link = (void **) &real_CreateFileW},
|
||||
{
|
||||
.name = "SetCurrentDirectoryA",
|
||||
.patch = my_SetCurrentDirectoryA,
|
||||
.link = (void **) &real_SetCurrentDirectoryA,
|
||||
},
|
||||
{
|
||||
.name = "FindFirstFileW",
|
||||
{.name = "FindFirstFileW",
|
||||
.patch = my_FindFirstFileW,
|
||||
.link = (void **) &real_FindFirstFileW
|
||||
},
|
||||
{
|
||||
.name = "CreateDirectoryW",
|
||||
.link = (void **) &real_FindFirstFileW},
|
||||
{.name = "CreateDirectoryW",
|
||||
.patch = my_CreateDirectoryW,
|
||||
.link = (void **) &real_CreateDirectoryW
|
||||
},
|
||||
.link = (void **) &real_CreateDirectoryW},
|
||||
};
|
||||
|
||||
void ddrhook1_get_launcher_path_parts(char **output_path, char **output_foldername) {
|
||||
void ddrhook1_get_launcher_path_parts(
|
||||
char **output_path, char **output_foldername)
|
||||
{
|
||||
char module_path[MAX_PATH];
|
||||
char launcher_path[MAX_PATH];
|
||||
|
||||
@ -82,7 +76,9 @@ void ddrhook1_get_launcher_path_parts(char **output_path, char **output_folderna
|
||||
return;
|
||||
|
||||
char *filename_ptr = NULL;
|
||||
if (GetFullPathNameA(module_path, sizeof(launcher_path), launcher_path, &filename_ptr) == 0)
|
||||
if (GetFullPathNameA(
|
||||
module_path, sizeof(launcher_path), launcher_path, &filename_ptr) ==
|
||||
0)
|
||||
return;
|
||||
|
||||
if (filename_ptr != NULL)
|
||||
@ -98,7 +94,8 @@ void ddrhook1_get_launcher_path_parts(char **output_path, char **output_folderna
|
||||
|
||||
int idx_folder = 0;
|
||||
for (idx_folder = strlen(launcher_path); idx_folder - 1 > 0; idx_folder--) {
|
||||
if (launcher_path[idx_folder - 1] == '\\' || launcher_path[idx_folder - 1] == '/') {
|
||||
if (launcher_path[idx_folder - 1] == '\\' ||
|
||||
launcher_path[idx_folder - 1] == '/') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -109,7 +106,7 @@ void ddrhook1_get_launcher_path_parts(char **output_path, char **output_folderna
|
||||
if (len < 0)
|
||||
len = 0;
|
||||
|
||||
*output_foldername = (char*)xmalloc(len + 2);
|
||||
*output_foldername = (char *) xmalloc(len + 2);
|
||||
memset(*output_foldername, 0, len + 1);
|
||||
strncpy(*output_foldername, launcher_path + idx_folder, len);
|
||||
}
|
||||
@ -120,7 +117,7 @@ void ddrhook1_get_launcher_path_parts(char **output_path, char **output_folderna
|
||||
if (len > strlen(launcher_path))
|
||||
len = strlen(launcher_path);
|
||||
|
||||
*output_path = (char*)xmalloc(len + 1);
|
||||
*output_path = (char *) xmalloc(len + 1);
|
||||
memset(*output_path, 0, len + 1);
|
||||
strncpy(*output_path, launcher_path, len);
|
||||
}
|
||||
@ -135,9 +132,12 @@ static wchar_t *ddrhook1_filesystem_get_path(LPCWSTR path)
|
||||
// log_misc("path: %s", tmp);
|
||||
// free(tmp);
|
||||
|
||||
// Deal with hardcoded paths: D:/HDX, E:/conf, E:/conf/nvram, E:/conf/raw, F:/update, ...
|
||||
if (wstr_insensitive_eq(path, L"D:/HDX") || wstr_insensitive_eq(path, L"D:\\HDX")
|
||||
|| wstr_insensitive_eq(path, L"D:/JDX") || wstr_insensitive_eq(path, L"D:\\JDX")) {
|
||||
// Deal with hardcoded paths: D:/HDX, E:/conf, E:/conf/nvram, E:/conf/raw,
|
||||
// F:/update, ...
|
||||
if (wstr_insensitive_eq(path, L"D:/HDX") ||
|
||||
wstr_insensitive_eq(path, L"D:\\HDX") ||
|
||||
wstr_insensitive_eq(path, L"D:/JDX") ||
|
||||
wstr_insensitive_eq(path, L"D:\\JDX")) {
|
||||
char *_new_path;
|
||||
ddrhook1_get_launcher_path_parts(&_new_path, NULL);
|
||||
|
||||
@ -145,8 +145,10 @@ static wchar_t *ddrhook1_filesystem_get_path(LPCWSTR path)
|
||||
new_path = str_widen(_new_path);
|
||||
return new_path;
|
||||
}
|
||||
} else if (wcslen(path) >= 7 && (wcsnicmp(path, L"E:/conf", 7) == 0
|
||||
|| wcsnicmp(path, L"E:\\conf", 7) == 0)) {
|
||||
} else if (
|
||||
wcslen(path) >= 7 &&
|
||||
(wcsnicmp(path, L"E:/conf", 7) == 0 ||
|
||||
wcsnicmp(path, L"E:\\conf", 7) == 0)) {
|
||||
char *launcher_folder;
|
||||
wchar_t *sub_path;
|
||||
|
||||
@ -155,15 +157,17 @@ static wchar_t *ddrhook1_filesystem_get_path(LPCWSTR path)
|
||||
|
||||
if (sub_path && launcher_folder) {
|
||||
wchar_t *launcher_folder_w = str_widen(launcher_folder);
|
||||
new_path = (wchar_t*)xmalloc(MAX_PATH * sizeof(wchar_t));
|
||||
swprintf(new_path, MAX_PATH, L"%s\\%s", launcher_folder_w, sub_path);
|
||||
new_path = (wchar_t *) xmalloc(MAX_PATH * sizeof(wchar_t));
|
||||
swprintf(
|
||||
new_path, MAX_PATH, L"%s\\%s", launcher_folder_w, sub_path);
|
||||
free(launcher_folder_w);
|
||||
return new_path;
|
||||
}
|
||||
} else if (wstr_insensitive_eq(path, L"F:/update")
|
||||
|| wstr_insensitive_eq(path, L"F:\\update")
|
||||
|| wstr_insensitive_eq(path, L".\\F:/update")
|
||||
|| wstr_insensitive_eq(path, L".\\F:\\update")) {
|
||||
} else if (
|
||||
wstr_insensitive_eq(path, L"F:/update") ||
|
||||
wstr_insensitive_eq(path, L"F:\\update") ||
|
||||
wstr_insensitive_eq(path, L".\\F:/update") ||
|
||||
wstr_insensitive_eq(path, L".\\F:\\update")) {
|
||||
char *launcher_folder;
|
||||
wchar_t *sub_path;
|
||||
|
||||
@ -172,33 +176,40 @@ static wchar_t *ddrhook1_filesystem_get_path(LPCWSTR path)
|
||||
|
||||
if (sub_path && launcher_folder) {
|
||||
wchar_t *launcher_folder_w = str_widen(launcher_folder);
|
||||
new_path = (wchar_t*)xmalloc(MAX_PATH * sizeof(wchar_t));
|
||||
swprintf(new_path, MAX_PATH, L"%s\\%s", launcher_folder_w, sub_path);
|
||||
new_path = (wchar_t *) xmalloc(MAX_PATH * sizeof(wchar_t));
|
||||
swprintf(
|
||||
new_path, MAX_PATH, L"%s\\%s", launcher_folder_w, sub_path);
|
||||
free(launcher_folder_w);
|
||||
return new_path;
|
||||
}
|
||||
} else if (wcslen(path) >= 24 && (wcsnicmp(path, L"D:/JDX/JDX-001/contents/", 24) == 0
|
||||
|| wcsnicmp(path, L"D:\\JDX\\JDX-001\\contents\\", 24) == 0)) {
|
||||
} else if (
|
||||
wcslen(path) >= 24 &&
|
||||
(wcsnicmp(path, L"D:/JDX/JDX-001/contents/", 24) == 0 ||
|
||||
wcsnicmp(path, L"D:\\JDX\\JDX-001\\contents\\", 24) == 0)) {
|
||||
char *content_path;
|
||||
|
||||
ddrhook1_get_launcher_path_parts(&content_path, NULL);
|
||||
|
||||
if (content_path) {
|
||||
wchar_t *content_path_w = str_widen(content_path);
|
||||
new_path = (wchar_t*)xmalloc(MAX_PATH * sizeof(wchar_t));
|
||||
new_path = (wchar_t *) xmalloc(MAX_PATH * sizeof(wchar_t));
|
||||
swprintf(new_path, MAX_PATH, L"%s\\%s", content_path_w, path + 24);
|
||||
free(content_path_w);
|
||||
return new_path;
|
||||
}
|
||||
} else if (wcslen(path) >= 7 && (wcsnicmp(path, L"D:/HDX/", 7) == 0 || wcsnicmp(path, L"D:\\HDX\\", 7) == 0
|
||||
|| wcsnicmp(path, L"D:/JDX/", 7) == 0 || wcsnicmp(path, L"D:\\JDX\\", 7) == 0)) {
|
||||
} else if (
|
||||
wcslen(path) >= 7 &&
|
||||
(wcsnicmp(path, L"D:/HDX/", 7) == 0 ||
|
||||
wcsnicmp(path, L"D:\\HDX\\", 7) == 0 ||
|
||||
wcsnicmp(path, L"D:/JDX/", 7) == 0 ||
|
||||
wcsnicmp(path, L"D:\\JDX\\", 7) == 0)) {
|
||||
char *content_path;
|
||||
|
||||
ddrhook1_get_launcher_path_parts(&content_path, NULL);
|
||||
|
||||
if (content_path) {
|
||||
wchar_t *content_path_w = str_widen(content_path);
|
||||
new_path = (wchar_t*)xmalloc(MAX_PATH * sizeof(wchar_t));
|
||||
new_path = (wchar_t *) xmalloc(MAX_PATH * sizeof(wchar_t));
|
||||
swprintf(new_path, MAX_PATH, L"%s\\%s", content_path_w, path + 7);
|
||||
free(content_path_w);
|
||||
return new_path;
|
||||
@ -225,7 +236,10 @@ static BOOL STDCALL my_SetCurrentDirectoryA(LPCSTR lpPathName)
|
||||
|
||||
if (new_path != NULL) {
|
||||
bool r = real_SetCurrentDirectoryA(new_path);
|
||||
log_misc("SetCurrentDirectoryA remapped path %s -> %s", lpPathName, new_path);
|
||||
log_misc(
|
||||
"SetCurrentDirectoryA remapped path %s -> %s",
|
||||
lpPathName,
|
||||
new_path);
|
||||
free(new_path);
|
||||
return r;
|
||||
}
|
||||
@ -233,16 +247,13 @@ static BOOL STDCALL my_SetCurrentDirectoryA(LPCSTR lpPathName)
|
||||
return real_SetCurrentDirectoryA(lpPathName);
|
||||
}
|
||||
|
||||
static HANDLE STDCALL my_FindFirstFileW(
|
||||
LPCWSTR lpFileName,
|
||||
LPWIN32_FIND_DATAA lpFindFileData)
|
||||
static HANDLE STDCALL
|
||||
my_FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
|
||||
{
|
||||
wchar_t *new_path = ddrhook1_filesystem_get_path(lpFileName);
|
||||
|
||||
if (new_path) {
|
||||
HANDLE r = real_FindFirstFileW(
|
||||
new_path,
|
||||
lpFindFileData);
|
||||
HANDLE r = real_FindFirstFileW(new_path, lpFindFileData);
|
||||
|
||||
char *tmp;
|
||||
wstr_narrow(new_path, &tmp);
|
||||
@ -253,9 +264,7 @@ static HANDLE STDCALL my_FindFirstFileW(
|
||||
return r;
|
||||
}
|
||||
|
||||
return real_FindFirstFileW(
|
||||
lpFileName,
|
||||
lpFindFileData);
|
||||
return real_FindFirstFileW(lpFileName, lpFindFileData);
|
||||
}
|
||||
|
||||
static HANDLE STDCALL my_CreateFileW(
|
||||
@ -321,7 +330,10 @@ BOOL WINAPI my_CreateDirectoryW(
|
||||
void ddrhook1_filesystem_hook_init()
|
||||
{
|
||||
hook_table_apply(
|
||||
NULL, "kernel32.dll", filesystem_hook_syms, lengthof(filesystem_hook_syms));
|
||||
NULL,
|
||||
"kernel32.dll",
|
||||
filesystem_hook_syms,
|
||||
lengthof(filesystem_hook_syms));
|
||||
|
||||
log_info("Inserted filesystem hooks");
|
||||
}
|
@ -75,7 +75,7 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
case 'a':
|
||||
/* Specify a USB memory path for P1 */
|
||||
if (i + 1 < argc) {
|
||||
strcpy(usbmem_data_path_p1, argv[i+1]);
|
||||
strcpy(usbmem_data_path_p1, argv[i + 1]);
|
||||
usbmem_enabled = true;
|
||||
i++; // Move forward one to skip the path parameter
|
||||
}
|
||||
@ -85,7 +85,7 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
case 'b':
|
||||
/* Specify a USB memory path for P2 */
|
||||
if (i + 1 < argc) {
|
||||
strcpy(usbmem_data_path_p2, argv[i+1]);
|
||||
strcpy(usbmem_data_path_p2, argv[i + 1]);
|
||||
usbmem_enabled = true;
|
||||
i++; // Move forward one to skip the path parameter
|
||||
}
|
||||
@ -134,7 +134,8 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
eam_io_set_loggers(
|
||||
log_body_misc, log_body_info, log_body_warning, log_body_fatal);
|
||||
|
||||
ok = eam_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy);
|
||||
ok =
|
||||
eam_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy);
|
||||
|
||||
if (!ok) {
|
||||
return false;
|
||||
|
@ -16,7 +16,6 @@ static HMODULE(STDCALL *real_LoadLibraryA)(const char *name);
|
||||
|
||||
static HMODULE STDCALL my_LoadLibraryA(const char *name);
|
||||
|
||||
|
||||
static const hook_d3d9_irp_handler_t ddrhook2_d3d9_handlers[] = {
|
||||
gfx_d3d9_irp_handler,
|
||||
};
|
||||
|
@ -43,20 +43,49 @@ static const struct ddr_io_smx_pad_map ddr_io_smx_pad_map[] = {
|
||||
|
||||
#define DDR_IO_SMX_LIGHT_VALUES_PER_PANEL 75
|
||||
#define DDR_IO_SMX_NUMBER_OF_PANELS 18
|
||||
#define DDR_IO_SMX_TOTAL_LIGHT_VALUES DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * DDR_IO_SMX_NUMBER_OF_PANELS
|
||||
#define DDR_IO_SMX_TOTAL_LIGHT_VALUES \
|
||||
DDR_IO_SMX_LIGHT_VALUES_PER_PANEL *DDR_IO_SMX_NUMBER_OF_PANELS
|
||||
|
||||
static const struct ddr_io_smx_light_map ddr_io_smx_light_map[] = {
|
||||
/* Light L/R blue and U/D red to match DDR pad color scheme */
|
||||
|
||||
{1 << LIGHT_P1_UP, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 1, 0xFF, 0x00, 0x00},
|
||||
{1 << LIGHT_P1_LEFT, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 3, 0x00, 0x00, 0xFF},
|
||||
{1 << LIGHT_P1_RIGHT, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 5, 0x00, 0x00, 0xFF},
|
||||
{1 << LIGHT_P1_DOWN, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 7, 0xFF, 0x00, 0x00},
|
||||
{1 << LIGHT_P1_LEFT,
|
||||
DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 3,
|
||||
0x00,
|
||||
0x00,
|
||||
0xFF},
|
||||
{1 << LIGHT_P1_RIGHT,
|
||||
DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 5,
|
||||
0x00,
|
||||
0x00,
|
||||
0xFF},
|
||||
{1 << LIGHT_P1_DOWN,
|
||||
DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 7,
|
||||
0xFF,
|
||||
0x00,
|
||||
0x00},
|
||||
|
||||
{1 << LIGHT_P2_UP, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 10, 0xFF, 0x00, 0x00},
|
||||
{1 << LIGHT_P2_LEFT, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 12, 0x00, 0x00, 0xFF},
|
||||
{1 << LIGHT_P2_RIGHT, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 14, 0x00, 0x00, 0xFF},
|
||||
{1 << LIGHT_P2_DOWN, DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 16, 0xFF, 0x00, 0x00},
|
||||
{1 << LIGHT_P2_UP,
|
||||
DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 10,
|
||||
0xFF,
|
||||
0x00,
|
||||
0x00},
|
||||
{1 << LIGHT_P2_LEFT,
|
||||
DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 12,
|
||||
0x00,
|
||||
0x00,
|
||||
0xFF},
|
||||
{1 << LIGHT_P2_RIGHT,
|
||||
DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 14,
|
||||
0x00,
|
||||
0x00,
|
||||
0xFF},
|
||||
{1 << LIGHT_P2_DOWN,
|
||||
DDR_IO_SMX_LIGHT_VALUES_PER_PANEL * 16,
|
||||
0xFF,
|
||||
0x00,
|
||||
0x00},
|
||||
};
|
||||
|
||||
static _Atomic uint32_t ddr_io_smx_pad_state[2];
|
||||
|
@ -8,9 +8,9 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "aciomgr/manager.h"
|
||||
#include "aciodrv/device.h"
|
||||
#include "aciodrv/icca.h"
|
||||
#include "aciomgr/manager.h"
|
||||
|
||||
#include "bemanitools/eamio.h"
|
||||
|
||||
@ -23,7 +23,8 @@
|
||||
#define NUMBER_OF_EMULATED_READERS 2
|
||||
#define INVALID_NODE_ID -1
|
||||
|
||||
static const uint8_t eam_io_keypad_mappings[16] = {EAM_IO_KEYPAD_DECIMAL,
|
||||
static const uint8_t eam_io_keypad_mappings[16] = {
|
||||
EAM_IO_KEYPAD_DECIMAL,
|
||||
EAM_IO_KEYPAD_3,
|
||||
EAM_IO_KEYPAD_6,
|
||||
EAM_IO_KEYPAD_9,
|
||||
@ -119,7 +120,8 @@ bool eam_io_init(
|
||||
for (uint8_t i = 0; i < NUMBER_OF_EMULATED_READERS; i++) {
|
||||
icca_node_id[i] = INVALID_NODE_ID;
|
||||
|
||||
for (uint8_t nid = 0; nid < aciomgr_get_node_count(acio_manager_ctx); ++nid) {
|
||||
for (uint8_t nid = 0; nid < aciomgr_get_node_count(acio_manager_ctx);
|
||||
++nid) {
|
||||
if (check_if_icca(nid)) {
|
||||
bool existing_reader = false;
|
||||
|
||||
@ -139,7 +141,8 @@ bool eam_io_init(
|
||||
icca_is_slotted[i] = aciodrv_icca_is_slotted(device, nid);
|
||||
icca_last_nonbusy_state[i] = 0;
|
||||
|
||||
log_misc("ICC reader %d is_slotted: %d", nid, icca_is_slotted[i]);
|
||||
log_misc(
|
||||
"ICC reader %d is_slotted: %d", nid, icca_is_slotted[i]);
|
||||
|
||||
if (!aciodrv_icca_init(device, icca_node_id[i])) {
|
||||
log_warning("Initializing icca %d failed", i);
|
||||
@ -195,17 +198,20 @@ uint8_t eam_io_get_sensor_state(uint8_t unit_no)
|
||||
sensors |= (1 << EAM_IO_SENSOR_FRONT);
|
||||
}
|
||||
} else {
|
||||
// wavepass readers always report (EAM_IO_SENSOR_BACK + EAM_IO_SENSOR_FRONT) + type
|
||||
// but because we can't report status_code back directly
|
||||
// and libacio actually just ignores the sensor_state other then the type
|
||||
// we just return this state like we're a slotted reader so the emulation takes card of it
|
||||
if (eam_io_icca_state[unit_no].status_code == AC_IO_ICCA_STATUS_GOT_UID) {
|
||||
// wavepass readers always report (EAM_IO_SENSOR_BACK +
|
||||
// EAM_IO_SENSOR_FRONT) + type but because we can't report status_code
|
||||
// back directly and libacio actually just ignores the sensor_state
|
||||
// other then the type we just return this state like we're a slotted
|
||||
// reader so the emulation takes card of it
|
||||
if (eam_io_icca_state[unit_no].status_code ==
|
||||
AC_IO_ICCA_STATUS_GOT_UID) {
|
||||
sensors |= (1 << EAM_IO_SENSOR_BACK);
|
||||
sensors |= (1 << EAM_IO_SENSOR_FRONT);
|
||||
}
|
||||
|
||||
// continue reporting last state during busy
|
||||
if (eam_io_icca_state[unit_no].status_code == AC_IO_ICCA_STATUS_BUSY_NEW) {
|
||||
if (eam_io_icca_state[unit_no].status_code ==
|
||||
AC_IO_ICCA_STATUS_BUSY_NEW) {
|
||||
sensors = icca_last_nonbusy_state[unit_no];
|
||||
} else {
|
||||
icca_last_nonbusy_state[unit_no] = sensors;
|
||||
@ -243,18 +249,28 @@ bool eam_io_card_slot_cmd(uint8_t unit_no, uint8_t cmd)
|
||||
switch (cmd) {
|
||||
case EAM_IO_CARD_SLOT_CMD_CLOSE:
|
||||
response = aciodrv_icca_set_state(
|
||||
device, icca_node_id[unit_no], AC_IO_ICCA_SLOT_STATE_CLOSE, NULL);
|
||||
device,
|
||||
icca_node_id[unit_no],
|
||||
AC_IO_ICCA_SLOT_STATE_CLOSE,
|
||||
NULL);
|
||||
|
||||
case EAM_IO_CARD_SLOT_CMD_OPEN:
|
||||
response = aciodrv_icca_set_state(
|
||||
device, icca_node_id[unit_no], AC_IO_ICCA_SLOT_STATE_OPEN, NULL);
|
||||
device,
|
||||
icca_node_id[unit_no],
|
||||
AC_IO_ICCA_SLOT_STATE_OPEN,
|
||||
NULL);
|
||||
|
||||
case EAM_IO_CARD_SLOT_CMD_EJECT:
|
||||
response = aciodrv_icca_set_state(
|
||||
device, icca_node_id[unit_no], AC_IO_ICCA_SLOT_STATE_EJECT, NULL);
|
||||
device,
|
||||
icca_node_id[unit_no],
|
||||
AC_IO_ICCA_SLOT_STATE_EJECT,
|
||||
NULL);
|
||||
|
||||
case EAM_IO_CARD_SLOT_CMD_READ:
|
||||
response = aciodrv_icca_read_card(device, icca_node_id[unit_no], NULL) &&
|
||||
response =
|
||||
aciodrv_icca_read_card(device, icca_node_id[unit_no], NULL) &&
|
||||
aciodrv_icca_get_state(
|
||||
device, icca_node_id[unit_no], &eam_io_icca_state[unit_no]);
|
||||
|
||||
@ -281,17 +297,18 @@ bool eam_io_poll(uint8_t unit_no)
|
||||
|
||||
if (response && !icca_is_slotted[unit_no]) {
|
||||
// we handle wavepass a bit differently to handle polling felica
|
||||
if (eam_io_icca_state[unit_no].status_code != AC_IO_ICCA_STATUS_BUSY_NEW) {
|
||||
if (eam_io_icca_state[unit_no].status_code !=
|
||||
AC_IO_ICCA_STATUS_BUSY_NEW) {
|
||||
++icca_poll_counter[unit_no];
|
||||
}
|
||||
|
||||
// we must manually call this every few polls to actually update the felica state
|
||||
// we don't do it every poll, since card polling isn't that time sensitive of an operation
|
||||
// libacio does it every 5ish polls after the last AC_IO_ICCA_STATUS_BUSY_NEW message
|
||||
// we must manually call this every few polls to actually update the
|
||||
// felica state we don't do it every poll, since card polling isn't that
|
||||
// time sensitive of an operation libacio does it every 5ish polls after
|
||||
// the last AC_IO_ICCA_STATUS_BUSY_NEW message
|
||||
if (icca_poll_counter[unit_no] >= IDLE_RESPONSES_BETWEEN_FELICA_POLLS) {
|
||||
response = aciodrv_icca_poll_felica(
|
||||
aciomgr_port_checkout(acio_manager_ctx),
|
||||
icca_node_id[unit_no]);
|
||||
aciomgr_port_checkout(acio_manager_ctx), icca_node_id[unit_no]);
|
||||
aciomgr_port_checkin(acio_manager_ctx);
|
||||
|
||||
icca_poll_counter[unit_no] = 0;
|
||||
|
@ -333,7 +333,7 @@ bool eam_impl_get_sensor_state(struct eam *eam, uint8_t unit_no)
|
||||
}
|
||||
|
||||
if (unit->sensor_hot) {
|
||||
if ((int32_t)(unit->sensor_time - now) > 0) {
|
||||
if ((int32_t) (unit->sensor_time - now) > 0) {
|
||||
result = true;
|
||||
} else {
|
||||
unit->sensor_time = 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef EZUSB_EMU_CONF_H
|
||||
#define EZUSB_EMU_CONF_H
|
||||
|
||||
//#define EZUSB_EMU_DEBUG_DUMP
|
||||
//#define EZUSB_EMU_FW_DUMP
|
||||
// #define EZUSB_EMU_DEBUG_DUMP
|
||||
// #define EZUSB_EMU_FW_DUMP
|
||||
|
||||
#endif
|
@ -2,7 +2,8 @@
|
||||
|
||||
const struct ezusb_emu_desc_device ezusb_emu_desc_device = {
|
||||
.setupapi =
|
||||
{.device_guid = {0xAE18AA60,
|
||||
{.device_guid =
|
||||
{0xAE18AA60,
|
||||
0x7F6A,
|
||||
0x11D4,
|
||||
{0x97, 0xDD, 0x00, 0x01, 0x02, 0x29, 0xB9, 0x59}},
|
||||
|
@ -16,8 +16,10 @@
|
||||
static struct security_mcode ezusb_iidx_emu_node_security_plug_boot_version;
|
||||
static uint32_t ezusb_iidx_emu_node_security_plug_boot_seeds[3];
|
||||
|
||||
static struct security_rp_sign_key ezusb_iidx_emu_node_security_plug_black_sign_key;
|
||||
static struct security_rp_sign_key ezusb_iidx_emu_node_security_plug_white_sign_key;
|
||||
static struct security_rp_sign_key
|
||||
ezusb_iidx_emu_node_security_plug_black_sign_key;
|
||||
static struct security_rp_sign_key
|
||||
ezusb_iidx_emu_node_security_plug_white_sign_key;
|
||||
|
||||
static struct security_mcode ezusb_iidx_emu_node_security_plug_black_mcode;
|
||||
static struct security_mcode ezusb_iidx_emu_node_security_plug_white_mcode;
|
||||
@ -223,8 +225,9 @@ uint8_t ezusb_iidx_emu_node_security_plug_process_cmd_v2(
|
||||
|
||||
// pop'n music only ever uses slot 2 (white) and slot 4 (black).
|
||||
// If the configuration does not match then it will error out.
|
||||
// IIDX uses slots 2 and 3 and detects what is plugged into each slot so ordering isn't important.
|
||||
// IIDX also reads slot 1's data section but doesn't care what dongle it is?
|
||||
// IIDX uses slots 2 and 3 and detects what is plugged into each slot so
|
||||
// ordering isn't important. IIDX also reads slot 1's data section but
|
||||
// doesn't care what dongle it is?
|
||||
case EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_1:
|
||||
log_misc("EZUSB_IIDX_SECPLUG_CMD_V2_SELECT_DONGLE_1");
|
||||
ezusb_iidx_emu_node_security_plug_active_dongle_slot =
|
||||
|
@ -12,8 +12,8 @@
|
||||
#include "ezusb-emu/node-security-plug.h"
|
||||
#include "ezusb-emu/node-sram.h"
|
||||
#include "ezusb-emu/node-wdt.h"
|
||||
#include "ezusb-emu/nodes.h"
|
||||
#include "ezusb-emu/node.h"
|
||||
#include "ezusb-emu/nodes.h"
|
||||
|
||||
/* All IIDX games */
|
||||
const struct ezusb_iidx_emu_node ezusb_iidx_emu_node_coin = {
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include "hook/iohook.h"
|
||||
|
||||
#include "ezusb-emu/msg.h"
|
||||
#include "ezusb-emu/nodes.h"
|
||||
#include "ezusb-emu/node-coin.h"
|
||||
#include "ezusb-emu/nodes.h"
|
||||
|
||||
#include "ezusb-iidx/msg.h"
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "msg.h"
|
||||
|
||||
//#define DEBUG_DUMP
|
||||
// #define DEBUG_DUMP
|
||||
|
||||
/* For debugging */
|
||||
#ifdef DEBUG_DUMP
|
||||
|
@ -59,10 +59,9 @@ struct ezusb_iidx_msg_interrupt_read_packet {
|
||||
1: Not used
|
||||
2: Not used
|
||||
3: Not used
|
||||
4: C02/D01 board identifier, 1 = C02, 0 = D01 (on active low). This defines how the game has
|
||||
to flash the FPGA board since D01 needs a different firmware (see result of FPGA CHECK on
|
||||
game bootup)
|
||||
5: Not used
|
||||
4: C02/D01 board identifier, 1 = C02, 0 = D01 (on active low). This
|
||||
defines how the game has to flash the FPGA board since D01 needs a
|
||||
different firmware (see result of FPGA CHECK on game bootup) 5: Not used
|
||||
6: usb mute?
|
||||
7: Not used
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef EZUSB2_EMU_CONF_H
|
||||
#define EZUSB_2EMU_CONF_H
|
||||
|
||||
//#define EZUSB2_EMU_DEBUG_DUMP
|
||||
//#define EZUSB2_EMU_FW_DUMP
|
||||
// #define EZUSB2_EMU_DEBUG_DUMP
|
||||
// #define EZUSB2_EMU_FW_DUMP
|
||||
|
||||
#endif
|
@ -2,7 +2,8 @@
|
||||
|
||||
const struct ezusb_emu_desc_device ezusb2_emu_desc_device = {
|
||||
.setupapi =
|
||||
{.device_guid = {0xAE18AA60,
|
||||
{.device_guid =
|
||||
{0xAE18AA60,
|
||||
0x7F6A,
|
||||
0x11D4,
|
||||
{0x97, 0xDD, 0x00, 0x01, 0x02, 0x29, 0xB9, 0x59}},
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
#include "ezusb-emu/msg.h"
|
||||
|
||||
#include "ezusb-emu/nodes.h"
|
||||
#include "ezusb-emu/node-none.h"
|
||||
#include "ezusb-emu/node-coin.h"
|
||||
#include "ezusb-emu/node-none.h"
|
||||
#include "ezusb-emu/node-security-mem.h"
|
||||
#include "ezusb-emu/node-security-plug.h"
|
||||
#include "ezusb-emu/nodes.h"
|
||||
|
||||
#include "ezusb2-popn/msg.h"
|
||||
|
||||
@ -66,7 +66,10 @@ struct ezusb_emu_msg_hook *ezusb2_popn_emu_msg_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
memset(&ezusb2_popn_emu_msg_history[0], 0xff, sizeof(ezusb2_popn_emu_msg_history));
|
||||
memset(
|
||||
&ezusb2_popn_emu_msg_history[0],
|
||||
0xff,
|
||||
sizeof(ezusb2_popn_emu_msg_history));
|
||||
|
||||
return &ezusb2_popn_emu_msg_hook;
|
||||
}
|
||||
@ -94,11 +97,17 @@ static HRESULT ezusb2_popn_emu_msg_interrupt_read(struct iobuf *read)
|
||||
msg_resp->unk7 = 0xdf;
|
||||
msg_resp->unk8 = ezusb2_popn_emu_msg_seq_no;
|
||||
|
||||
memcpy(&msg_resp->button_history[0], &ezusb2_popn_emu_msg_history[0], sizeof(uint16_t) * 10);
|
||||
memcpy(
|
||||
&msg_resp->button_history[0],
|
||||
&ezusb2_popn_emu_msg_history[0],
|
||||
sizeof(uint16_t) * 10);
|
||||
|
||||
read->pos = sizeof(*msg_resp);
|
||||
|
||||
memmove(&ezusb2_popn_emu_msg_history[1], &ezusb2_popn_emu_msg_history[0], sizeof(uint16_t) * 9);
|
||||
memmove(
|
||||
&ezusb2_popn_emu_msg_history[1],
|
||||
&ezusb2_popn_emu_msg_history[0],
|
||||
sizeof(uint16_t) * 9);
|
||||
ezusb2_popn_emu_msg_history[0] = msg_resp->io.button;
|
||||
|
||||
return S_OK;
|
||||
@ -126,7 +135,8 @@ static HRESULT ezusb2_popn_emu_msg_interrupt_write(struct const_iobuf *write)
|
||||
popn_io_set_top_lights(msg_req->lamp & 0x1f);
|
||||
popn_io_set_side_lights((msg_req->lamp >> 8) & 0xf);
|
||||
popn_io_set_button_lights((msg_req->lamp >> 20) & 0xfff);
|
||||
popn_io_set_coin_counter_light(((msg_req->lamp >> 12) & 0xf) == 0); // Active low
|
||||
popn_io_set_coin_counter_light(
|
||||
((msg_req->lamp >> 12) & 0xf) == 0); // Active low
|
||||
popn_io_set_coin_blocker_light(((msg_req->lamp >> 16) & 0xf) == 0xf);
|
||||
|
||||
/* Remember node for next bulk read */
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <windows.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <setupapi.h>
|
||||
|
||||
@ -23,8 +23,7 @@ static HMODULE real_pe = NULL;
|
||||
|
||||
BOOL WINAPI DllMain(HMODULE self, DWORD reason, void *ctx)
|
||||
{
|
||||
if (reason == DLL_PROCESS_ATTACH && real_pe == NULL)
|
||||
{
|
||||
if (reason == DLL_PROCESS_ATTACH && real_pe == NULL) {
|
||||
pe_hijack_entrypoint(EZUSB_REAL_DLL_FILENAME, &real_entrypoint);
|
||||
|
||||
real_pe = GetModuleHandleA(EZUSB_REAL_DLL_FILENAME);
|
||||
|
@ -1,17 +1,21 @@
|
||||
#include <windows.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "util/log.h"
|
||||
|
||||
struct CoinParam;
|
||||
struct EEP_HISTORY;
|
||||
|
||||
typedef int32_t (*usb_boot_security_t)(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
|
||||
typedef int32_t (*usb_boot_security_all_t)(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
|
||||
typedef int32_t (*usb_boot_security_all_r_t)(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
|
||||
typedef int32_t (*usb_boot_security_t)(
|
||||
uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
|
||||
typedef int32_t (*usb_boot_security_all_t)(
|
||||
uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
|
||||
typedef int32_t (*usb_boot_security_all_r_t)(
|
||||
uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
|
||||
typedef int32_t (*usb_check_alive_t)();
|
||||
typedef int32_t (*usb_check_security_t)(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
|
||||
typedef int32_t (*usb_check_security_t)(
|
||||
uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
|
||||
typedef int32_t (*usb_check_security_eep_t)(int32_t param1);
|
||||
typedef int32_t (*usb_check_security_new_t)(int32_t param1);
|
||||
typedef int32_t (*usb_coin_blocker_t)(int32_t param1);
|
||||
@ -54,12 +58,30 @@ typedef int32_t (*usb_security_test_t)(int32_t param1);
|
||||
typedef int32_t (*usb_security_write_t)(uint8_t *param1);
|
||||
typedef int32_t (*usb_security_write_done_t)();
|
||||
typedef int32_t (*usb_set_ext_io_t)(int32_t param1);
|
||||
typedef int32_t (*usb_setup_eeprom_t)(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
|
||||
typedef int32_t (*usb_setup_eeprom_new_t)(int32_t param1, uint8_t *param2, int32_t param3, int32_t param4, int32_t param5);
|
||||
typedef int32_t (*usb_setup_security_t)(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
|
||||
typedef int32_t (*usb_setup_security_complete_t)(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
|
||||
typedef int32_t (*usb_setup_security_complete_new_t)(int32_t param1, uint8_t *param2, int32_t param3, int32_t param4, int32_t param5);
|
||||
typedef int32_t (*usb_setup_security_new_t)(int32_t param1, uint8_t *param2, int32_t param3, int32_t param4, int32_t param5);
|
||||
typedef int32_t (*usb_setup_eeprom_t)(
|
||||
uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
|
||||
typedef int32_t (*usb_setup_eeprom_new_t)(
|
||||
int32_t param1,
|
||||
uint8_t *param2,
|
||||
int32_t param3,
|
||||
int32_t param4,
|
||||
int32_t param5);
|
||||
typedef int32_t (*usb_setup_security_t)(
|
||||
uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
|
||||
typedef int32_t (*usb_setup_security_complete_t)(
|
||||
uint8_t *param1, int32_t param2, int32_t param3, int32_t param4);
|
||||
typedef int32_t (*usb_setup_security_complete_new_t)(
|
||||
int32_t param1,
|
||||
uint8_t *param2,
|
||||
int32_t param3,
|
||||
int32_t param4,
|
||||
int32_t param5);
|
||||
typedef int32_t (*usb_setup_security_new_t)(
|
||||
int32_t param1,
|
||||
uint8_t *param2,
|
||||
int32_t param3,
|
||||
int32_t param4,
|
||||
int32_t param5);
|
||||
typedef int32_t (*usb_start_t)(int32_t param1);
|
||||
typedef int32_t (*usb_start_with_file_t)(char *param1);
|
||||
typedef int32_t (*usb_wdt_reset_t)();
|
||||
@ -138,195 +160,254 @@ void ezusb2_proxy_initialize(HMODULE pe)
|
||||
|
||||
proxy_is_initialized = true;
|
||||
|
||||
real_usb_boot_security = (usb_boot_security_t)GetProcAddress(pe, "?usbBootSecurity@@YAHPAEHHH@Z");
|
||||
real_usb_boot_security = (usb_boot_security_t) GetProcAddress(
|
||||
pe, "?usbBootSecurity@@YAHPAEHHH@Z");
|
||||
log_assert(real_usb_boot_security);
|
||||
|
||||
real_usb_boot_security_all = (usb_boot_security_all_t)GetProcAddress(pe, "?usbBootSecurityAll@@YAHPAEHHH@Z");
|
||||
real_usb_boot_security_all = (usb_boot_security_all_t) GetProcAddress(
|
||||
pe, "?usbBootSecurityAll@@YAHPAEHHH@Z");
|
||||
log_assert(real_usb_boot_security_all);
|
||||
|
||||
real_usb_boot_security_all_r = (usb_boot_security_all_r_t)GetProcAddress(pe, "?usbBootSecurityAllR@@YAHPAEHHH@Z");
|
||||
real_usb_boot_security_all_r = (usb_boot_security_all_r_t) GetProcAddress(
|
||||
pe, "?usbBootSecurityAllR@@YAHPAEHHH@Z");
|
||||
log_assert(real_usb_boot_security_all_r);
|
||||
|
||||
real_usb_check_alive = (usb_check_alive_t)GetProcAddress(pe, "?usbCheckAlive@@YAHXZ");
|
||||
real_usb_check_alive =
|
||||
(usb_check_alive_t) GetProcAddress(pe, "?usbCheckAlive@@YAHXZ");
|
||||
log_assert(real_usb_check_alive);
|
||||
|
||||
real_usb_check_security = (usb_check_security_t)GetProcAddress(pe, "?usbCheckSecurity@@YAHPAEHHH@Z");
|
||||
real_usb_check_security = (usb_check_security_t) GetProcAddress(
|
||||
pe, "?usbCheckSecurity@@YAHPAEHHH@Z");
|
||||
log_assert(real_usb_check_security);
|
||||
|
||||
real_usb_check_security_eep = (usb_check_security_eep_t)GetProcAddress(pe, "?usbCheckSecurityEep@@YAHH@Z");
|
||||
real_usb_check_security_eep = (usb_check_security_eep_t) GetProcAddress(
|
||||
pe, "?usbCheckSecurityEep@@YAHH@Z");
|
||||
log_assert(real_usb_check_security_eep);
|
||||
|
||||
real_usb_check_security_new = (usb_check_security_new_t)GetProcAddress(pe, "?usbCheckSecurityNew@@YAHH@Z");
|
||||
real_usb_check_security_new = (usb_check_security_new_t) GetProcAddress(
|
||||
pe, "?usbCheckSecurityNew@@YAHH@Z");
|
||||
log_assert(real_usb_check_security_new);
|
||||
|
||||
real_usb_coin_blocker = (usb_coin_blocker_t)GetProcAddress(pe, "?usbCoinBlocker@@YAHH@Z");
|
||||
real_usb_coin_blocker =
|
||||
(usb_coin_blocker_t) GetProcAddress(pe, "?usbCoinBlocker@@YAHH@Z");
|
||||
log_assert(real_usb_coin_blocker);
|
||||
|
||||
real_usb_coin_get2 = (usb_coin_get2_t)GetProcAddress(pe, "?usbCoinGet2@@YAHPAUCoinParam@@@Z");
|
||||
real_usb_coin_get2 = (usb_coin_get2_t) GetProcAddress(
|
||||
pe, "?usbCoinGet2@@YAHPAUCoinParam@@@Z");
|
||||
log_assert(real_usb_coin_get2);
|
||||
|
||||
real_usb_coin_get = (usb_coin_get_t)GetProcAddress(pe, "?usbCoinGet@@YAHH@Z");
|
||||
real_usb_coin_get =
|
||||
(usb_coin_get_t) GetProcAddress(pe, "?usbCoinGet@@YAHH@Z");
|
||||
log_assert(real_usb_coin_get);
|
||||
|
||||
real_usb_coin_meter_down = (usb_coin_meter_down_t)GetProcAddress(pe, "?usbCoinMeterDown@@YAHH@Z");
|
||||
real_usb_coin_meter_down =
|
||||
(usb_coin_meter_down_t) GetProcAddress(pe, "?usbCoinMeterDown@@YAHH@Z");
|
||||
log_assert(real_usb_coin_meter_down);
|
||||
|
||||
real_usb_coin_meter_up = (usb_coin_meter_up_t)GetProcAddress(pe, "?usbCoinMeterUp@@YAHH@Z");
|
||||
real_usb_coin_meter_up =
|
||||
(usb_coin_meter_up_t) GetProcAddress(pe, "?usbCoinMeterUp@@YAHH@Z");
|
||||
log_assert(real_usb_coin_meter_up);
|
||||
|
||||
real_usb_coin_mode = (usb_coin_mode_t)GetProcAddress(pe, "?usbCoinMode@@YAHH@Z");
|
||||
real_usb_coin_mode =
|
||||
(usb_coin_mode_t) GetProcAddress(pe, "?usbCoinMode@@YAHH@Z");
|
||||
log_assert(real_usb_coin_mode);
|
||||
|
||||
real_usb_coin_up = (usb_coin_up_t)GetProcAddress(pe, "?usbCoinUp@@YAHH@Z");
|
||||
real_usb_coin_up = (usb_coin_up_t) GetProcAddress(pe, "?usbCoinUp@@YAHH@Z");
|
||||
log_assert(real_usb_coin_up);
|
||||
|
||||
real_usb_eep_read = (usb_eep_read_t)GetProcAddress(pe, "?usbEepRead@@YAHXZ");
|
||||
real_usb_eep_read =
|
||||
(usb_eep_read_t) GetProcAddress(pe, "?usbEepRead@@YAHXZ");
|
||||
log_assert(real_usb_eep_read);
|
||||
|
||||
real_usb_eep_read_done = (usb_eep_read_done_t)GetProcAddress(pe, "?usbEepReadDone@@YAHPAE@Z");
|
||||
real_usb_eep_read_done =
|
||||
(usb_eep_read_done_t) GetProcAddress(pe, "?usbEepReadDone@@YAHPAE@Z");
|
||||
log_assert(real_usb_eep_read_done);
|
||||
|
||||
real_usb_eep_test = (usb_eep_test_t)GetProcAddress(pe, "?usbEepTest@@YAHXZ");
|
||||
real_usb_eep_test =
|
||||
(usb_eep_test_t) GetProcAddress(pe, "?usbEepTest@@YAHXZ");
|
||||
log_assert(real_usb_eep_test);
|
||||
|
||||
real_usb_eep_write = (usb_eep_write_t)GetProcAddress(pe, "?usbEepWrite@@YAHPAE@Z");
|
||||
real_usb_eep_write =
|
||||
(usb_eep_write_t) GetProcAddress(pe, "?usbEepWrite@@YAHPAE@Z");
|
||||
log_assert(real_usb_eep_write);
|
||||
|
||||
real_usb_eep_write_done = (usb_eep_write_done_t)GetProcAddress(pe, "?usbEepWriteDone@@YAHXZ");
|
||||
real_usb_eep_write_done =
|
||||
(usb_eep_write_done_t) GetProcAddress(pe, "?usbEepWriteDone@@YAHXZ");
|
||||
log_assert(real_usb_eep_write_done);
|
||||
|
||||
real_usb_end = (usb_end_t)GetProcAddress(pe, "?usbEnd@@YAHXZ");
|
||||
real_usb_end = (usb_end_t) GetProcAddress(pe, "?usbEnd@@YAHXZ");
|
||||
log_assert(real_usb_end);
|
||||
|
||||
real_usb_factory_mode_init = (usb_factory_mode_init_t)GetProcAddress(pe, "?usbFactoryModeInit@@YAHPAE@Z");
|
||||
real_usb_factory_mode_init = (usb_factory_mode_init_t) GetProcAddress(
|
||||
pe, "?usbFactoryModeInit@@YAHPAE@Z");
|
||||
log_assert(real_usb_factory_mode_init);
|
||||
|
||||
real_usb_firm_result = (usb_firm_result_t)GetProcAddress(pe, "?usbFirmResult@@YAHXZ");
|
||||
real_usb_firm_result =
|
||||
(usb_firm_result_t) GetProcAddress(pe, "?usbFirmResult@@YAHXZ");
|
||||
log_assert(real_usb_firm_result);
|
||||
|
||||
real_usb_get_error = (usb_get_error_t)GetProcAddress(pe, "?usbGetError@@YAHPAD@Z");
|
||||
real_usb_get_error =
|
||||
(usb_get_error_t) GetProcAddress(pe, "?usbGetError@@YAHPAD@Z");
|
||||
log_assert(real_usb_get_error);
|
||||
|
||||
real_usb_get_keyid = (usb_get_keyid_t)GetProcAddress(pe, "?usbGetKEYID@@YAHPAEH@Z");
|
||||
real_usb_get_keyid =
|
||||
(usb_get_keyid_t) GetProcAddress(pe, "?usbGetKEYID@@YAHPAEH@Z");
|
||||
log_assert(real_usb_get_keyid);
|
||||
|
||||
real_usb_get_mute = (usb_get_mute_t)GetProcAddress(pe, "?usbGetMute@@YAHXZ");
|
||||
real_usb_get_mute =
|
||||
(usb_get_mute_t) GetProcAddress(pe, "?usbGetMute@@YAHXZ");
|
||||
log_assert(real_usb_get_mute);
|
||||
|
||||
real_usb_get_pcbid = (usb_get_pcbid_t)GetProcAddress(pe, "?usbGetPCBID@@YAHPAE@Z");
|
||||
real_usb_get_pcbid =
|
||||
(usb_get_pcbid_t) GetProcAddress(pe, "?usbGetPCBID@@YAHPAE@Z");
|
||||
log_assert(real_usb_get_pcbid);
|
||||
|
||||
real_usb_get_security = (usb_get_security_t)GetProcAddress(pe, "?usbGetSecurity@@YAHHPAE@Z");
|
||||
real_usb_get_security =
|
||||
(usb_get_security_t) GetProcAddress(pe, "?usbGetSecurity@@YAHHPAE@Z");
|
||||
log_assert(real_usb_get_security);
|
||||
|
||||
real_usb_is_hi_speed = (usb_is_hi_speed_t)GetProcAddress(pe, "?usbIsHiSpeed@@YAHXZ");
|
||||
real_usb_is_hi_speed =
|
||||
(usb_is_hi_speed_t) GetProcAddress(pe, "?usbIsHiSpeed@@YAHXZ");
|
||||
log_assert(real_usb_is_hi_speed);
|
||||
|
||||
real_usb_lamp = (usb_lamp_t)GetProcAddress(pe, "?usbLamp@@YAHH@Z");
|
||||
real_usb_lamp = (usb_lamp_t) GetProcAddress(pe, "?usbLamp@@YAHH@Z");
|
||||
log_assert(real_usb_lamp);
|
||||
|
||||
real_usb_mute = (usb_mute_t)GetProcAddress(pe, "?usbMute@@YAHH@Z");
|
||||
real_usb_mute = (usb_mute_t) GetProcAddress(pe, "?usbMute@@YAHH@Z");
|
||||
log_assert(real_usb_mute);
|
||||
|
||||
real_usb_pad_read = (usb_pad_read_t)GetProcAddress(pe, "?usbPadRead@@YAHPAK@Z");
|
||||
real_usb_pad_read =
|
||||
(usb_pad_read_t) GetProcAddress(pe, "?usbPadRead@@YAHPAK@Z");
|
||||
log_assert(real_usb_pad_read);
|
||||
|
||||
real_usb_pad_read_last = (usb_pad_read_last_t)GetProcAddress(pe, "?usbPadReadLast@@YAHPAE@Z");
|
||||
real_usb_pad_read_last =
|
||||
(usb_pad_read_last_t) GetProcAddress(pe, "?usbPadReadLast@@YAHPAE@Z");
|
||||
log_assert(real_usb_pad_read_last);
|
||||
|
||||
real_usb_read_eep_history = (usb_read_eep_history_t)GetProcAddress(pe, "?usbReadEepHistory@@YAHPAUEEP_HISTORY@@@Z");
|
||||
real_usb_read_eep_history = (usb_read_eep_history_t) GetProcAddress(
|
||||
pe, "?usbReadEepHistory@@YAHPAUEEP_HISTORY@@@Z");
|
||||
log_assert(real_usb_read_eep_history);
|
||||
|
||||
real_usb_security_get_id = (usb_security_get_id_t)GetProcAddress(pe, "?usbSecurityGetId@@YAHXZ");
|
||||
real_usb_security_get_id =
|
||||
(usb_security_get_id_t) GetProcAddress(pe, "?usbSecurityGetId@@YAHXZ");
|
||||
log_assert(real_usb_security_get_id);
|
||||
|
||||
real_usb_security_get_id_done = (usb_security_get_id_done_t)GetProcAddress(pe, "?usbSecurityGetIdDone@@YAHPAE@Z");
|
||||
real_usb_security_get_id_done = (usb_security_get_id_done_t) GetProcAddress(
|
||||
pe, "?usbSecurityGetIdDone@@YAHPAE@Z");
|
||||
log_assert(real_usb_security_get_id_done);
|
||||
|
||||
real_usb_security_init = (usb_security_init_t)GetProcAddress(pe, "?usbSecurityInit@@YAHXZ");
|
||||
real_usb_security_init =
|
||||
(usb_security_init_t) GetProcAddress(pe, "?usbSecurityInit@@YAHXZ");
|
||||
log_assert(real_usb_security_init);
|
||||
|
||||
real_usb_security_init_done = (usb_security_init_done_t)GetProcAddress(pe, "?usbSecurityInitDone@@YAHXZ");
|
||||
real_usb_security_init_done = (usb_security_init_done_t) GetProcAddress(
|
||||
pe, "?usbSecurityInitDone@@YAHXZ");
|
||||
log_assert(real_usb_security_init_done);
|
||||
|
||||
real_usb_security_read = (usb_security_read_t)GetProcAddress(pe, "?usbSecurityRead@@YAHXZ");
|
||||
real_usb_security_read =
|
||||
(usb_security_read_t) GetProcAddress(pe, "?usbSecurityRead@@YAHXZ");
|
||||
log_assert(real_usb_security_read);
|
||||
|
||||
real_usb_security_read_done = (usb_security_read_done_t)GetProcAddress(pe, "?usbSecurityReadDone@@YAHPAE@Z");
|
||||
real_usb_security_read_done = (usb_security_read_done_t) GetProcAddress(
|
||||
pe, "?usbSecurityReadDone@@YAHPAE@Z");
|
||||
log_assert(real_usb_security_read_done);
|
||||
|
||||
real_usb_security_search = (usb_security_search_t)GetProcAddress(pe, "?usbSecuritySearch@@YAHXZ");
|
||||
real_usb_security_search =
|
||||
(usb_security_search_t) GetProcAddress(pe, "?usbSecuritySearch@@YAHXZ");
|
||||
log_assert(real_usb_security_search);
|
||||
|
||||
real_usb_security_search_done = (usb_security_search_done_t)GetProcAddress(pe, "?usbSecuritySearchDone@@YAHXZ");
|
||||
real_usb_security_search_done = (usb_security_search_done_t) GetProcAddress(
|
||||
pe, "?usbSecuritySearchDone@@YAHXZ");
|
||||
log_assert(real_usb_security_search_done);
|
||||
|
||||
real_usb_security_select = (usb_security_select_t)GetProcAddress(pe, "?usbSecuritySelect@@YAHH@Z");
|
||||
real_usb_security_select = (usb_security_select_t) GetProcAddress(
|
||||
pe, "?usbSecuritySelect@@YAHH@Z");
|
||||
log_assert(real_usb_security_select);
|
||||
|
||||
real_usb_security_select_done = (usb_security_select_done_t)GetProcAddress(pe, "?usbSecuritySelectDone@@YAHXZ");
|
||||
real_usb_security_select_done = (usb_security_select_done_t) GetProcAddress(
|
||||
pe, "?usbSecuritySelectDone@@YAHXZ");
|
||||
log_assert(real_usb_security_select_done);
|
||||
|
||||
real_usb_security_test = (usb_security_test_t)GetProcAddress(pe, "?usbSecurityTest@@YAHH@Z");
|
||||
real_usb_security_test =
|
||||
(usb_security_test_t) GetProcAddress(pe, "?usbSecurityTest@@YAHH@Z");
|
||||
log_assert(real_usb_security_test);
|
||||
|
||||
real_usb_security_write = (usb_security_write_t)GetProcAddress(pe, "?usbSecurityWrite@@YAHPAE@Z");
|
||||
real_usb_security_write = (usb_security_write_t) GetProcAddress(
|
||||
pe, "?usbSecurityWrite@@YAHPAE@Z");
|
||||
log_assert(real_usb_security_write);
|
||||
|
||||
real_usb_security_write_done = (usb_security_write_done_t)GetProcAddress(pe, "?usbSecurityWriteDone@@YAHXZ");
|
||||
real_usb_security_write_done = (usb_security_write_done_t) GetProcAddress(
|
||||
pe, "?usbSecurityWriteDone@@YAHXZ");
|
||||
log_assert(real_usb_security_write_done);
|
||||
|
||||
real_usb_set_ext_io = (usb_set_ext_io_t)GetProcAddress(pe, "?usbSetExtIo@@YAHH@Z");
|
||||
real_usb_set_ext_io =
|
||||
(usb_set_ext_io_t) GetProcAddress(pe, "?usbSetExtIo@@YAHH@Z");
|
||||
log_assert(real_usb_set_ext_io);
|
||||
|
||||
real_usb_setup_eeprom = (usb_setup_eeprom_t)GetProcAddress(pe, "?usbSetupEeprom@@YAHPAEHHH@Z");
|
||||
real_usb_setup_eeprom =
|
||||
(usb_setup_eeprom_t) GetProcAddress(pe, "?usbSetupEeprom@@YAHPAEHHH@Z");
|
||||
log_assert(real_usb_setup_eeprom);
|
||||
|
||||
real_usb_setup_eeprom_new = (usb_setup_eeprom_new_t)GetProcAddress(pe, "?usbSetupEepromNew@@YAHHPAEHHH@Z");
|
||||
real_usb_setup_eeprom_new = (usb_setup_eeprom_new_t) GetProcAddress(
|
||||
pe, "?usbSetupEepromNew@@YAHHPAEHHH@Z");
|
||||
log_assert(real_usb_setup_eeprom_new);
|
||||
|
||||
real_usb_setup_security = (usb_setup_security_t)GetProcAddress(pe, "?usbSetupSecurity@@YAHPAEHHH@Z");
|
||||
real_usb_setup_security = (usb_setup_security_t) GetProcAddress(
|
||||
pe, "?usbSetupSecurity@@YAHPAEHHH@Z");
|
||||
log_assert(real_usb_setup_security);
|
||||
|
||||
real_usb_setup_security_complete = (usb_setup_security_complete_t)GetProcAddress(pe, "?usbSetupSecurityComplete@@YAHPAEHHH@Z");
|
||||
real_usb_setup_security_complete =
|
||||
(usb_setup_security_complete_t) GetProcAddress(
|
||||
pe, "?usbSetupSecurityComplete@@YAHPAEHHH@Z");
|
||||
log_assert(real_usb_setup_security_complete);
|
||||
|
||||
real_usb_setup_security_complete_new = (usb_setup_security_complete_new_t)GetProcAddress(pe, "?usbSetupSecurityCompleteNew@@YAHHPAEHHH@Z");
|
||||
real_usb_setup_security_complete_new =
|
||||
(usb_setup_security_complete_new_t) GetProcAddress(
|
||||
pe, "?usbSetupSecurityCompleteNew@@YAHHPAEHHH@Z");
|
||||
log_assert(real_usb_setup_security_complete_new);
|
||||
|
||||
real_usb_setup_security_new = (usb_setup_security_new_t)GetProcAddress(pe, "?usbSetupSecurityNew@@YAHHPAEHHH@Z");
|
||||
real_usb_setup_security_new = (usb_setup_security_new_t) GetProcAddress(
|
||||
pe, "?usbSetupSecurityNew@@YAHHPAEHHH@Z");
|
||||
log_assert(real_usb_setup_security_new);
|
||||
|
||||
real_usb_start = (usb_start_t)GetProcAddress(pe, "?usbStart@@YAHH@Z");
|
||||
real_usb_start = (usb_start_t) GetProcAddress(pe, "?usbStart@@YAHH@Z");
|
||||
log_assert(real_usb_start);
|
||||
|
||||
real_usb_start_with_file = (usb_start_with_file_t)GetProcAddress(pe, "?usbStartWithFile@@YAHPAD@Z");
|
||||
real_usb_start_with_file = (usb_start_with_file_t) GetProcAddress(
|
||||
pe, "?usbStartWithFile@@YAHPAD@Z");
|
||||
log_assert(real_usb_start_with_file);
|
||||
|
||||
real_usb_wdt_reset = (usb_wdt_reset_t)GetProcAddress(pe, "?usbWdtReset@@YAHXZ");
|
||||
real_usb_wdt_reset =
|
||||
(usb_wdt_reset_t) GetProcAddress(pe, "?usbWdtReset@@YAHXZ");
|
||||
log_assert(real_usb_wdt_reset);
|
||||
|
||||
real_usb_wdt_start = (usb_wdt_start_t)GetProcAddress(pe, "?usbWdtStart@@YAHH@Z");
|
||||
real_usb_wdt_start =
|
||||
(usb_wdt_start_t) GetProcAddress(pe, "?usbWdtStart@@YAHH@Z");
|
||||
log_assert(real_usb_wdt_start);
|
||||
|
||||
real_usb_wdt_start_done = (usb_wdt_start_done_t)GetProcAddress(pe, "?usbWdtStartDone@@YAHXZ");
|
||||
real_usb_wdt_start_done =
|
||||
(usb_wdt_start_done_t) GetProcAddress(pe, "?usbWdtStartDone@@YAHXZ");
|
||||
log_assert(real_usb_wdt_start_done);
|
||||
|
||||
real_usb_wdt_stop = (usb_wdt_stop_t)GetProcAddress(pe, "?usbWdtStop@@YAHXZ");
|
||||
real_usb_wdt_stop =
|
||||
(usb_wdt_stop_t) GetProcAddress(pe, "?usbWdtStop@@YAHXZ");
|
||||
log_assert(real_usb_wdt_stop);
|
||||
}
|
||||
|
||||
int32_t proxy_usb_boot_security(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
|
||||
int32_t proxy_usb_boot_security(
|
||||
uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
|
||||
{
|
||||
return real_usb_boot_security(param1, param2, param3, param4);
|
||||
}
|
||||
|
||||
int32_t proxy_usb_boot_security_all(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
|
||||
int32_t proxy_usb_boot_security_all(
|
||||
uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
|
||||
{
|
||||
return real_usb_boot_security_all(param1, param2, param3, param4);
|
||||
}
|
||||
|
||||
int32_t proxy_usb_boot_security_all_r(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
|
||||
int32_t proxy_usb_boot_security_all_r(
|
||||
uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
|
||||
{
|
||||
return real_usb_boot_security_all_r(param1, param2, param3, param4);
|
||||
}
|
||||
@ -336,7 +417,8 @@ int32_t proxy_usb_check_alive()
|
||||
return real_usb_check_alive();
|
||||
}
|
||||
|
||||
int32_t proxy_usb_check_security(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
|
||||
int32_t proxy_usb_check_security(
|
||||
uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
|
||||
{
|
||||
return real_usb_check_security(param1, param2, param3, param4);
|
||||
}
|
||||
@ -551,32 +633,51 @@ int32_t proxy_usb_set_ext_io(int32_t param1)
|
||||
return real_usb_set_ext_io(param1);
|
||||
}
|
||||
|
||||
int32_t proxy_usb_setup_eeprom(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
|
||||
int32_t proxy_usb_setup_eeprom(
|
||||
uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
|
||||
{
|
||||
return real_usb_setup_eeprom(param1, param2, param3, param4);
|
||||
}
|
||||
|
||||
int32_t proxy_usb_setup_eeprom_new(int32_t param1, uint8_t *param2, int32_t param3, int32_t param4, int32_t param5)
|
||||
int32_t proxy_usb_setup_eeprom_new(
|
||||
int32_t param1,
|
||||
uint8_t *param2,
|
||||
int32_t param3,
|
||||
int32_t param4,
|
||||
int32_t param5)
|
||||
{
|
||||
return real_usb_setup_eeprom_new(param1, param2, param3, param4, param5);
|
||||
}
|
||||
|
||||
int32_t proxy_usb_setup_security(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
|
||||
int32_t proxy_usb_setup_security(
|
||||
uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
|
||||
{
|
||||
return real_usb_setup_security(param1, param2, param3, param4);
|
||||
}
|
||||
|
||||
int32_t proxy_usb_setup_security_complete(uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
|
||||
int32_t proxy_usb_setup_security_complete(
|
||||
uint8_t *param1, int32_t param2, int32_t param3, int32_t param4)
|
||||
{
|
||||
return real_usb_setup_security_complete(param1, param2, param3, param4);
|
||||
}
|
||||
|
||||
int32_t proxy_usb_setup_security_complete_new(int32_t param1, uint8_t *param2, int32_t param3, int32_t param4, int32_t param5)
|
||||
int32_t proxy_usb_setup_security_complete_new(
|
||||
int32_t param1,
|
||||
uint8_t *param2,
|
||||
int32_t param3,
|
||||
int32_t param4,
|
||||
int32_t param5)
|
||||
{
|
||||
return real_usb_setup_security_complete_new(param1, param2, param3, param4, param5);
|
||||
return real_usb_setup_security_complete_new(
|
||||
param1, param2, param3, param4, param5);
|
||||
}
|
||||
|
||||
int32_t proxy_usb_setup_security_new(int32_t param1, uint8_t *param2, int32_t param3, int32_t param4, int32_t param5)
|
||||
int32_t proxy_usb_setup_security_new(
|
||||
int32_t param1,
|
||||
uint8_t *param2,
|
||||
int32_t param3,
|
||||
int32_t param4,
|
||||
int32_t param5)
|
||||
{
|
||||
return real_usb_setup_security_new(param1, param2, param3, param4, param5);
|
||||
}
|
||||
|
@ -125,11 +125,12 @@ typedef struct _SET_TRANSFER_SIZE_INFO {
|
||||
//
|
||||
#ifdef WIN_98_DDK
|
||||
#define DEVICE_TYPE_FROM_CTL_CODE(ctrlCode) \
|
||||
(((ULONG)(ctrlCode & 0xffff0000)) >> 16)
|
||||
(((ULONG) (ctrlCode & 0xffff0000)) >> 16)
|
||||
#endif
|
||||
#define FUNCTION_FROM_CTL_CODE(ctrlCode) (((ULONG)(ctrlCode & 0x00003FFC)) >> 2)
|
||||
#define ACCESS_FROM_CTL_CODE(ctrlCode) (((ULONG)(ctrlCode & 0x000C0000)) >> 14)
|
||||
//#define METHOD_FROM_CTL_CODE(ctrlCode) (((ULONG)(ctrlCode &
|
||||
#define FUNCTION_FROM_CTL_CODE(ctrlCode) \
|
||||
(((ULONG) (ctrlCode & 0x00003FFC)) >> 2)
|
||||
#define ACCESS_FROM_CTL_CODE(ctrlCode) (((ULONG) (ctrlCode & 0x000C0000)) >> 14)
|
||||
// #define METHOD_FROM_CTL_CODE(ctrlCode) (((ULONG)(ctrlCode &
|
||||
// 0x00000003)))
|
||||
|
||||
#define IOCTL_ADAPT_INDEX 0x0000
|
||||
|
@ -65,8 +65,8 @@ bool hid_report_out_set_bit(
|
||||
uint16_t usage_hi;
|
||||
uint16_t usage_lo;
|
||||
|
||||
usage_hi = (uint16_t)(usage >> 16);
|
||||
usage_lo = (uint16_t)(usage >> 0);
|
||||
usage_hi = (uint16_t) (usage >> 16);
|
||||
usage_lo = (uint16_t) (usage >> 0);
|
||||
count = 1;
|
||||
|
||||
if (value) {
|
||||
@ -118,8 +118,8 @@ bool hid_report_out_set_value(
|
||||
uint16_t usage_hi;
|
||||
uint16_t usage_lo;
|
||||
|
||||
usage_hi = (uint16_t)(usage >> 16);
|
||||
usage_lo = (uint16_t)(usage >> 0);
|
||||
usage_hi = (uint16_t) (usage >> 16);
|
||||
usage_lo = (uint16_t) (usage >> 0);
|
||||
|
||||
status = HidP_SetUsageValue(
|
||||
HidP_Output,
|
||||
|
@ -202,9 +202,9 @@ static void analog_mapping_update(struct analog_mapping *am)
|
||||
|
||||
if (am->absolute) {
|
||||
tmp = (value - am->affine_bias) / am->affine_scale;
|
||||
am->pos = (uint8_t)((tmp + 0.5) * 256.0);
|
||||
am->pos = (uint8_t) ((tmp + 0.5) * 256.0);
|
||||
} else {
|
||||
am->pos += (int8_t)(value * exp(am->sensitivity / 256.0));
|
||||
am->pos += (int8_t) (value * exp(am->sensitivity / 256.0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ static void light_mapping_send(struct light_mapping *lm, const struct mapper *m)
|
||||
|
||||
intensity = m->lights[lm->game_light];
|
||||
tmp = (intensity / 256.0) * lm->affine_scale;
|
||||
value = (int32_t)(tmp + 0.5) + lm->affine_bias;
|
||||
value = (int32_t) (tmp + 0.5) + lm->affine_bias;
|
||||
|
||||
hid_stub_set_light(lm->dest.hid, lm->dest.light_no, value);
|
||||
}
|
||||
@ -432,7 +432,7 @@ uint8_t mapper_impl_get_npages(struct mapper *m)
|
||||
}
|
||||
}
|
||||
|
||||
return (uint8_t)(max_page + 1);
|
||||
return (uint8_t) (max_page + 1);
|
||||
}
|
||||
|
||||
action_iter_t mapper_impl_iterate_actions(struct mapper *m)
|
||||
|
@ -10,11 +10,8 @@
|
||||
|
||||
/* This does not handle escaped double quotes inside args correctly yet */
|
||||
|
||||
static HRESULT args_push(
|
||||
int *argc,
|
||||
char ***argv,
|
||||
const char *begin,
|
||||
const char *end)
|
||||
static HRESULT
|
||||
args_push(int *argc, char ***argv, const char *begin, const char *end)
|
||||
{
|
||||
int tmp_argc;
|
||||
char **tmp_argv;
|
||||
@ -70,7 +67,7 @@ HRESULT args_recover(int *argc_out, char ***argv_out)
|
||||
argv = NULL;
|
||||
quote = false;
|
||||
|
||||
for (begin = pos = GetCommandLine() ; *pos ; pos++) {
|
||||
for (begin = pos = GetCommandLine(); *pos; pos++) {
|
||||
switch (*pos) {
|
||||
case '"':
|
||||
if (!quote) {
|
||||
@ -129,7 +126,7 @@ void args_free(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < argc ; i++) {
|
||||
for (i = 0; i < argc; i++) {
|
||||
free(argv[i]);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <windows.h>
|
||||
#include <unknwn.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
@ -8,63 +8,84 @@
|
||||
#include "hook/com-proxy.h"
|
||||
|
||||
static void com_proxy_free(struct com_proxy *proxy);
|
||||
static HRESULT STDMETHODCALLTYPE com_proxy_query_interface(
|
||||
IUnknown *unk,
|
||||
REFIID iid,
|
||||
void **iface);
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
com_proxy_query_interface(IUnknown *unk, REFIID iid, void **iface);
|
||||
static ULONG STDMETHODCALLTYPE com_proxy_addref(IUnknown *unk);
|
||||
static ULONG STDMETHODCALLTYPE com_proxy_release(IUnknown *unk);
|
||||
|
||||
#ifdef __amd64
|
||||
|
||||
/***** 64-BIT TRAMPOLINE *****/
|
||||
/***** 64-BIT TRAMPOLINE *****/
|
||||
|
||||
#define SLOT_OFFSET 0x0A
|
||||
static const uint8_t com_proxy_tramp[] = {
|
||||
/* mov rcx, [rcx+8] ; Get this->real */
|
||||
0x48, 0x8B, 0x49, 0x08,
|
||||
0x48,
|
||||
0x8B,
|
||||
0x49,
|
||||
0x08,
|
||||
|
||||
/* mov rax, [rcx] ; Get this->vtbl */
|
||||
0x48, 0x8B, 0x01,
|
||||
0x48,
|
||||
0x8B,
|
||||
0x01,
|
||||
|
||||
/* mov rax, [rax+XX] ; Get vtbl->slot_XX */
|
||||
0x48, 0x8B, 0x80, -1, -1, -1, -1,
|
||||
0x48,
|
||||
0x8B,
|
||||
0x80,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
|
||||
/* jmp rax ; Continue to slot_XX */
|
||||
0xFF, 0xE0,
|
||||
0xFF,
|
||||
0xE0,
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
/***** 32-BIT TRAMPOLINE *****/
|
||||
/***** 32-BIT TRAMPOLINE *****/
|
||||
|
||||
#define SLOT_OFFSET 0x0F
|
||||
static const uint8_t com_proxy_tramp[] = {
|
||||
/* mov eax, [esp+4] ; Get this */
|
||||
0x8B, 0x44, 0x24, 0x04,
|
||||
0x8B,
|
||||
0x44,
|
||||
0x24,
|
||||
0x04,
|
||||
|
||||
/* mov eax, [eax+4] ; Get this->real */
|
||||
0x8B, 0x40, 0x04,
|
||||
0x8B,
|
||||
0x40,
|
||||
0x04,
|
||||
|
||||
/* mov [esp+4], eax ; Replace this with this->real on stack */
|
||||
0x89, 0x44, 0x24, 0x04,
|
||||
0x89,
|
||||
0x44,
|
||||
0x24,
|
||||
0x04,
|
||||
|
||||
/* mov ecx, [eax] ; Get this->vtbl */
|
||||
0x8B, 0x08,
|
||||
0x8B,
|
||||
0x08,
|
||||
|
||||
/* mov ecx, [ecx+XX] ; Get vtbl->slot_XX */
|
||||
0x8B, 0x89, -1, -1, -1, -1,
|
||||
0x8B,
|
||||
0x89,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
|
||||
/* jmp ecx ; Continue to slot_XX */
|
||||
0xFF, 0xE1
|
||||
};
|
||||
0xFF,
|
||||
0xE1};
|
||||
|
||||
#endif
|
||||
|
||||
HRESULT com_proxy_wrap(
|
||||
struct com_proxy **out,
|
||||
void *real,
|
||||
size_t vtbl_size)
|
||||
HRESULT com_proxy_wrap(struct com_proxy **out, void *real, size_t vtbl_size)
|
||||
{
|
||||
struct com_proxy *proxy;
|
||||
void **vtbl;
|
||||
@ -119,7 +140,7 @@ HRESULT com_proxy_wrap(
|
||||
|
||||
/* Populate trampoline code for remaining vtbl entries */
|
||||
|
||||
for (i = 3 /* Skip IUnknown */ ; i < nslots ; i++) {
|
||||
for (i = 3 /* Skip IUnknown */; i < nslots; i++) {
|
||||
cur_tramp = proxy->tramps + i * sizeof(com_proxy_tramp);
|
||||
|
||||
/* Copy template */
|
||||
@ -160,10 +181,8 @@ static void com_proxy_free(struct com_proxy *proxy)
|
||||
free(proxy);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE com_proxy_query_interface(
|
||||
IUnknown *unk,
|
||||
REFIID iid,
|
||||
void **iface)
|
||||
static HRESULT STDMETHODCALLTYPE
|
||||
com_proxy_query_interface(IUnknown *unk, REFIID iid, void **iface)
|
||||
{
|
||||
struct com_proxy *proxy;
|
||||
IUnknown *obj;
|
||||
|
@ -49,7 +49,4 @@ struct com_proxy {
|
||||
unless you provide a custom QueryInterface implementation to prevent them
|
||||
from doing so. */
|
||||
|
||||
HRESULT com_proxy_wrap(
|
||||
struct com_proxy **out,
|
||||
void *real,
|
||||
size_t vtbl_size);
|
||||
HRESULT com_proxy_wrap(struct com_proxy **out, void *real, size_t vtbl_size);
|
||||
|
@ -72,13 +72,12 @@ static HRESULT(STDCALL *real_DrawPrimitiveUP)(
|
||||
UINT stride);
|
||||
|
||||
static HRESULT(STDCALL *real_Reset)(
|
||||
IDirect3DDevice9 *self,
|
||||
D3DPRESENT_PARAMETERS *pp);
|
||||
IDirect3DDevice9 *self, D3DPRESENT_PARAMETERS *pp);
|
||||
|
||||
static HRESULT (STDCALL *real_SetViewport)(
|
||||
static HRESULT(STDCALL *real_SetViewport)(
|
||||
IDirect3DDevice9 *self, const D3DVIEWPORT9 *pViewport);
|
||||
|
||||
static HRESULT (STDCALL *real_SetVertexShader)(
|
||||
static HRESULT(STDCALL *real_SetVertexShader)(
|
||||
IDirect3DDevice9 *self, IDirect3DVertexShader9 *pShader);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------
|
||||
@ -146,15 +145,14 @@ static HRESULT STDCALL my_DrawPrimitiveUP(
|
||||
const void *data,
|
||||
UINT stride);
|
||||
|
||||
static HRESULT STDCALL my_Reset(
|
||||
IDirect3DDevice9 *self,
|
||||
D3DPRESENT_PARAMETERS *pp);
|
||||
static HRESULT STDCALL
|
||||
my_Reset(IDirect3DDevice9 *self, D3DPRESENT_PARAMETERS *pp);
|
||||
|
||||
static HRESULT STDCALL my_SetViewport(
|
||||
IDirect3DDevice9 *self, const D3DVIEWPORT9 *pViewport);
|
||||
static HRESULT STDCALL
|
||||
my_SetViewport(IDirect3DDevice9 *self, const D3DVIEWPORT9 *pViewport);
|
||||
|
||||
static HRESULT STDCALL my_SetVertexShader(
|
||||
IDirect3DDevice9 *self, IDirect3DVertexShader9 *pShader);
|
||||
static HRESULT STDCALL
|
||||
my_SetVertexShader(IDirect3DDevice9 *self, IDirect3DVertexShader9 *pShader);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
@ -214,8 +212,7 @@ hook_d3d9_irp_handler_real_dev_set_render_state(struct hook_d3d9_irp *irp);
|
||||
static HRESULT
|
||||
hook_d3d9_irp_handler_real_dev_draw_primitive_up(struct hook_d3d9_irp *irp);
|
||||
|
||||
static HRESULT
|
||||
hook_d3d9_irp_handler_real_dev_reset(struct hook_d3d9_irp *irp);
|
||||
static HRESULT hook_d3d9_irp_handler_real_dev_reset(struct hook_d3d9_irp *irp);
|
||||
|
||||
static HRESULT
|
||||
hook_d3d9_irp_handler_real_dev_set_viewport(struct hook_d3d9_irp *irp);
|
||||
@ -247,8 +244,7 @@ static const hook_d3d9_irp_handler_t hook_d3d9_irp_real_handlers[] = {
|
||||
hook_d3d9_irp_handler_real_dev_set_render_state,
|
||||
[HOOK_D3D9_IRP_OP_DEV_DRAW_PRIMITIVE_UP] =
|
||||
hook_d3d9_irp_handler_real_dev_draw_primitive_up,
|
||||
[HOOK_D3D9_IRP_OP_DEV_RESET] =
|
||||
hook_d3d9_irp_handler_real_dev_reset,
|
||||
[HOOK_D3D9_IRP_OP_DEV_RESET] = hook_d3d9_irp_handler_real_dev_reset,
|
||||
[HOOK_D3D9_IRP_OP_DEV_SET_VIEWPORT] =
|
||||
hook_d3d9_irp_handler_real_dev_set_viewport,
|
||||
[HOOK_D3D9_IRP_OP_DEV_SET_VERTEX_SHADER] =
|
||||
@ -523,8 +519,8 @@ static HRESULT STDCALL my_DrawPrimitiveUP(
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL my_SetViewport(
|
||||
IDirect3DDevice9 *self, const D3DVIEWPORT9 *pViewport)
|
||||
static HRESULT STDCALL
|
||||
my_SetViewport(IDirect3DDevice9 *self, const D3DVIEWPORT9 *pViewport)
|
||||
{
|
||||
struct hook_d3d9_irp irp;
|
||||
HRESULT hr;
|
||||
@ -540,8 +536,8 @@ static HRESULT STDCALL my_SetViewport(
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL my_SetVertexShader(
|
||||
IDirect3DDevice9 *self, IDirect3DVertexShader9 *pShader)
|
||||
static HRESULT STDCALL
|
||||
my_SetVertexShader(IDirect3DDevice9 *self, IDirect3DVertexShader9 *pShader)
|
||||
{
|
||||
struct hook_d3d9_irp irp;
|
||||
HRESULT hr;
|
||||
@ -557,9 +553,8 @@ static HRESULT STDCALL my_SetVertexShader(
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT STDCALL my_Reset(
|
||||
IDirect3DDevice9 *self,
|
||||
D3DPRESENT_PARAMETERS *pp)
|
||||
static HRESULT STDCALL
|
||||
my_Reset(IDirect3DDevice9 *self, D3DPRESENT_PARAMETERS *pp)
|
||||
{
|
||||
struct hook_d3d9_irp irp;
|
||||
HRESULT hr;
|
||||
@ -827,14 +822,11 @@ hook_d3d9_irp_handler_real_dev_draw_primitive_up(struct hook_d3d9_irp *irp)
|
||||
irp->args.dev_draw_primitive_up.stride);
|
||||
}
|
||||
|
||||
static HRESULT
|
||||
hook_d3d9_irp_handler_real_dev_reset(struct hook_d3d9_irp *irp)
|
||||
static HRESULT hook_d3d9_irp_handler_real_dev_reset(struct hook_d3d9_irp *irp)
|
||||
{
|
||||
log_assert(irp);
|
||||
|
||||
return real_Reset(
|
||||
irp->args.dev_reset.self,
|
||||
irp->args.dev_reset.pp);
|
||||
return real_Reset(irp->args.dev_reset.self, irp->args.dev_reset.pp);
|
||||
}
|
||||
|
||||
static HRESULT
|
||||
@ -843,8 +835,7 @@ hook_d3d9_irp_handler_real_dev_set_viewport(struct hook_d3d9_irp *irp)
|
||||
log_assert(irp);
|
||||
|
||||
return real_SetViewport(
|
||||
irp->args.dev_set_viewport.self,
|
||||
irp->args.dev_set_viewport.pViewport);
|
||||
irp->args.dev_set_viewport.self, irp->args.dev_set_viewport.pViewport);
|
||||
}
|
||||
|
||||
static HRESULT
|
||||
|
@ -12,17 +12,28 @@ uint32_t hr_to_win32_error(HRESULT hr)
|
||||
return HRESULT_CODE(hr);
|
||||
} else {
|
||||
switch (hr) {
|
||||
case E_ABORT: return ERROR_OPERATION_ABORTED;
|
||||
case E_ACCESSDENIED: return ERROR_ACCESS_DENIED;
|
||||
case E_FAIL: return ERROR_GEN_FAILURE;
|
||||
case E_HANDLE: return ERROR_INVALID_HANDLE;
|
||||
case E_INVALIDARG: return ERROR_INVALID_PARAMETER;
|
||||
case E_NOINTERFACE: return ERROR_INVALID_FUNCTION;
|
||||
case E_NOTIMPL: return ERROR_NOT_SUPPORTED;
|
||||
case E_OUTOFMEMORY: return ERROR_OUTOFMEMORY;
|
||||
case E_POINTER: return ERROR_INVALID_ADDRESS;
|
||||
case E_UNEXPECTED: return ERROR_INTERNAL_ERROR;
|
||||
default: return ERROR_INTERNAL_ERROR;
|
||||
case E_ABORT:
|
||||
return ERROR_OPERATION_ABORTED;
|
||||
case E_ACCESSDENIED:
|
||||
return ERROR_ACCESS_DENIED;
|
||||
case E_FAIL:
|
||||
return ERROR_GEN_FAILURE;
|
||||
case E_HANDLE:
|
||||
return ERROR_INVALID_HANDLE;
|
||||
case E_INVALIDARG:
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
case E_NOINTERFACE:
|
||||
return ERROR_INVALID_FUNCTION;
|
||||
case E_NOTIMPL:
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
case E_OUTOFMEMORY:
|
||||
return ERROR_OUTOFMEMORY;
|
||||
case E_POINTER:
|
||||
return ERROR_INVALID_ADDRESS;
|
||||
case E_UNEXPECTED:
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
default:
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,9 @@
|
||||
#undef WIN32_NO_STATUS
|
||||
#include <winternl.h>
|
||||
|
||||
#include <winnt.h>
|
||||
#include <devioctl.h>
|
||||
#include <ntstatus.h>
|
||||
#include <winnt.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
@ -21,10 +21,8 @@
|
||||
/* Helpers */
|
||||
|
||||
static void iohook_init(void);
|
||||
static BOOL iohook_overlapped_result(
|
||||
uint32_t *syncout,
|
||||
OVERLAPPED *ovl,
|
||||
uint32_t value);
|
||||
static BOOL
|
||||
iohook_overlapped_result(uint32_t *syncout, OVERLAPPED *ovl, uint32_t value);
|
||||
|
||||
static HRESULT iohook_invoke_real(struct irp *irp);
|
||||
static HRESULT iohook_invoke_real_open(struct irp *irp);
|
||||
@ -98,9 +96,9 @@ static BOOL WINAPI iohook_DeviceIoControl(
|
||||
|
||||
/* Links */
|
||||
|
||||
static BOOL (WINAPI *next_CloseHandle)(HANDLE fd);
|
||||
static BOOL(WINAPI *next_CloseHandle)(HANDLE fd);
|
||||
|
||||
static HANDLE (WINAPI *next_CreateFileA)(
|
||||
static HANDLE(WINAPI *next_CreateFileA)(
|
||||
const char *lpFileName,
|
||||
uint32_t dwDesiredAccess,
|
||||
uint32_t dwShareMode,
|
||||
@ -109,7 +107,7 @@ static HANDLE (WINAPI *next_CreateFileA)(
|
||||
uint32_t dwFlagsAndAttributes,
|
||||
HANDLE hTemplateFile);
|
||||
|
||||
static HANDLE (WINAPI *next_CreateFileW)(
|
||||
static HANDLE(WINAPI *next_CreateFileW)(
|
||||
const wchar_t *filename,
|
||||
uint32_t access,
|
||||
uint32_t share,
|
||||
@ -118,7 +116,7 @@ static HANDLE (WINAPI *next_CreateFileW)(
|
||||
uint32_t flags,
|
||||
HANDLE tmpl);
|
||||
|
||||
static BOOL (WINAPI *next_DeviceIoControl)(
|
||||
static BOOL(WINAPI *next_DeviceIoControl)(
|
||||
HANDLE fd,
|
||||
uint32_t code,
|
||||
void *in_bytes,
|
||||
@ -128,33 +126,29 @@ static BOOL (WINAPI *next_DeviceIoControl)(
|
||||
uint32_t *out_returned,
|
||||
OVERLAPPED *ovl);
|
||||
|
||||
static BOOL (WINAPI *next_ReadFile)(
|
||||
HANDLE fd,
|
||||
void *buf,
|
||||
uint32_t nbytes,
|
||||
uint32_t *nread,
|
||||
OVERLAPPED *ovl);
|
||||
static BOOL(WINAPI *next_ReadFile)(
|
||||
HANDLE fd, void *buf, uint32_t nbytes, uint32_t *nread, OVERLAPPED *ovl);
|
||||
|
||||
static BOOL (WINAPI *next_WriteFile)(
|
||||
static BOOL(WINAPI *next_WriteFile)(
|
||||
HANDLE fd,
|
||||
const void *buf,
|
||||
uint32_t nbytes,
|
||||
uint32_t *nwrit,
|
||||
OVERLAPPED *ovl);
|
||||
|
||||
static DWORD (WINAPI *next_SetFilePointer)(
|
||||
static DWORD(WINAPI *next_SetFilePointer)(
|
||||
HANDLE hFile,
|
||||
int32_t lDistanceToMove,
|
||||
int32_t *lpDistanceToMoveHigh,
|
||||
uint32_t dwMoveMethod);
|
||||
|
||||
static BOOL (WINAPI *next_SetFilePointerEx)(
|
||||
static BOOL(WINAPI *next_SetFilePointerEx)(
|
||||
HANDLE hFile,
|
||||
int64_t liDistanceToMove,
|
||||
uint64_t *lpNewFilePointer,
|
||||
uint32_t dwMoveMethod);
|
||||
|
||||
static BOOL (WINAPI *next_FlushFileBuffers)(HANDLE fd);
|
||||
static BOOL(WINAPI *next_FlushFileBuffers)(HANDLE fd);
|
||||
|
||||
/* Hook symbol table */
|
||||
|
||||
@ -163,35 +157,43 @@ static const struct hook_symbol iohook_kernel32_syms[] = {
|
||||
.name = "CloseHandle",
|
||||
.patch = iohook_CloseHandle,
|
||||
.link = (void *) &next_CloseHandle,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
.name = "CreateFileA",
|
||||
.patch = iohook_CreateFileA,
|
||||
.link = (void *) &next_CreateFileA,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
.name = "CreateFileW",
|
||||
.patch = iohook_CreateFileW,
|
||||
.link = (void *) &next_CreateFileW,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
.name = "DeviceIoControl",
|
||||
.patch = iohook_DeviceIoControl,
|
||||
.link = (void *) &next_DeviceIoControl,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
.name = "ReadFile",
|
||||
.patch = iohook_ReadFile,
|
||||
.link = (void *) &next_ReadFile,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
.name = "WriteFile",
|
||||
.patch = iohook_WriteFile,
|
||||
.link = (void *) &next_WriteFile,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
.name = "SetFilePointer",
|
||||
.patch = iohook_SetFilePointer,
|
||||
.link = (void *) &next_SetFilePointer,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
.name = "SetFilePointerEx",
|
||||
.patch = iohook_SetFilePointerEx,
|
||||
.link = (void *) &next_SetFilePointerEx,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
.name = "FlushFileBuffers",
|
||||
.patch = iohook_FlushFileBuffers,
|
||||
.link = (void *) &next_FlushFileBuffers,
|
||||
@ -268,15 +270,12 @@ static void iohook_init(void)
|
||||
kernel32 = GetModuleHandleW(L"kernel32.dll");
|
||||
|
||||
if (next_CreateFileW == NULL) {
|
||||
next_CreateFileW = (void *) GetProcAddress(
|
||||
kernel32,
|
||||
"CreateFileW");
|
||||
next_CreateFileW = (void *) GetProcAddress(kernel32, "CreateFileW");
|
||||
}
|
||||
|
||||
if (next_SetFilePointerEx == NULL) {
|
||||
next_SetFilePointerEx = (void *) GetProcAddress(
|
||||
kernel32,
|
||||
"SetFilePointerEx");
|
||||
next_SetFilePointerEx =
|
||||
(void *) GetProcAddress(kernel32, "SetFilePointerEx");
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&iohook_lock);
|
||||
@ -351,10 +350,8 @@ HRESULT iohook_push_handler(iohook_fn_t fn)
|
||||
return hr;
|
||||
}
|
||||
|
||||
static BOOL iohook_overlapped_result(
|
||||
uint32_t *syncout,
|
||||
OVERLAPPED *ovl,
|
||||
uint32_t value)
|
||||
static BOOL
|
||||
iohook_overlapped_result(uint32_t *syncout, OVERLAPPED *ovl, uint32_t value)
|
||||
{
|
||||
if (ovl != NULL) {
|
||||
ovl->Internal = STATUS_SUCCESS;
|
||||
@ -514,10 +511,7 @@ static HRESULT iohook_invoke_real_seek(struct irp *irp)
|
||||
assert(irp != NULL);
|
||||
|
||||
ok = next_SetFilePointerEx(
|
||||
irp->fd,
|
||||
irp->seek_offset,
|
||||
&irp->seek_pos,
|
||||
irp->seek_origin);
|
||||
irp->fd, irp->seek_offset, &irp->seek_pos, irp->seek_origin);
|
||||
|
||||
if (!ok) {
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
@ -620,7 +614,8 @@ static HANDLE WINAPI iohook_CreateFileA(
|
||||
dwDesiredAccess,
|
||||
dwShareMode,
|
||||
lpSecurityAttributes,
|
||||
dwCreationDisposition, dwFlagsAndAttributes,
|
||||
dwCreationDisposition,
|
||||
dwFlagsAndAttributes,
|
||||
hTemplateFile);
|
||||
|
||||
end:
|
||||
@ -738,9 +733,7 @@ static BOOL WINAPI iohook_ReadFile(
|
||||
assert(irp.read.pos <= irp.read.nbytes);
|
||||
|
||||
return iohook_overlapped_result(
|
||||
lpNumberOfBytesRead,
|
||||
lpOverlapped,
|
||||
irp.read.pos);
|
||||
lpNumberOfBytesRead, lpOverlapped, irp.read.pos);
|
||||
}
|
||||
|
||||
static BOOL WINAPI iohook_WriteFile(
|
||||
@ -786,9 +779,7 @@ static BOOL WINAPI iohook_WriteFile(
|
||||
assert(irp.write.pos <= irp.write.nbytes);
|
||||
|
||||
return iohook_overlapped_result(
|
||||
lpNumberOfBytesWritten,
|
||||
lpOverlapped,
|
||||
irp.write.pos);
|
||||
lpNumberOfBytesWritten, lpOverlapped, irp.write.pos);
|
||||
}
|
||||
|
||||
static DWORD WINAPI iohook_SetFilePointer(
|
||||
@ -816,10 +807,10 @@ static DWORD WINAPI iohook_SetFilePointer(
|
||||
with sign-extension vs zero-extension here. */
|
||||
|
||||
if (lpDistanceToMoveHigh != NULL) {
|
||||
irp.seek_offset = ((( int64_t) *lpDistanceToMoveHigh) << 32) |
|
||||
((uint64_t) lDistanceToMove ) ;
|
||||
irp.seek_offset = (((int64_t) *lpDistanceToMoveHigh) << 32) |
|
||||
((uint64_t) lDistanceToMove);
|
||||
} else {
|
||||
irp.seek_offset = ( int64_t) lDistanceToMove;
|
||||
irp.seek_offset = (int64_t) lDistanceToMove;
|
||||
}
|
||||
|
||||
hr = iohook_invoke_next(&irp);
|
||||
@ -963,7 +954,5 @@ static BOOL WINAPI iohook_DeviceIoControl(
|
||||
}
|
||||
|
||||
return iohook_overlapped_result(
|
||||
lpBytesReturned,
|
||||
lpOverlapped,
|
||||
irp.read.pos);
|
||||
lpBytesReturned, lpOverlapped, irp.read.pos);
|
||||
}
|
||||
|
@ -41,9 +41,9 @@ typedef HRESULT (*iohook_fn_t)(struct irp *irp);
|
||||
|
||||
HANDLE iohook_open_dummy_fd(void)
|
||||
#ifdef __GNUC__
|
||||
__attribute__((deprecated("Use iohook_open_nul_fd instead")))
|
||||
__attribute__((deprecated("Use iohook_open_nul_fd instead")))
|
||||
#endif
|
||||
;
|
||||
;
|
||||
|
||||
HRESULT iohook_open_nul_fd(HANDLE *fd);
|
||||
HRESULT iohook_push_handler(iohook_fn_t fn);
|
||||
|
@ -94,10 +94,7 @@ const pe_iid_t *pe_iid_get_next(HMODULE pe, const pe_iid_t *iid)
|
||||
}
|
||||
|
||||
HRESULT pe_iid_get_iat_entry(
|
||||
HMODULE pe,
|
||||
const pe_iid_t *iid,
|
||||
size_t n,
|
||||
struct pe_iat_entry *entry)
|
||||
HMODULE pe, const pe_iid_t *iid, size_t n, struct pe_iat_entry *entry)
|
||||
{
|
||||
const IMAGE_IMPORT_BY_NAME *import;
|
||||
intptr_t *import_rvas;
|
||||
@ -153,7 +150,7 @@ void *pe_get_export(HMODULE pe, const char *name, uint16_t ord)
|
||||
target_rvas = pe_offsetc(pe, ied->AddressOfFunctions);
|
||||
|
||||
if (name != NULL) {
|
||||
for (i = 0 ; i < ied->NumberOfNames ; i++) {
|
||||
for (i = 0; i < ied->NumberOfNames; i++) {
|
||||
if (name_rvas[i] == 0) {
|
||||
/* Ordinal-only export, cannot match against this */
|
||||
continue;
|
||||
@ -196,11 +193,7 @@ HRESULT pe_patch(void *dest, const void *src, size_t nbytes)
|
||||
assert(dest != NULL);
|
||||
assert(src != NULL);
|
||||
|
||||
ok = VirtualProtect(
|
||||
dest,
|
||||
nbytes,
|
||||
PAGE_EXECUTE_READWRITE,
|
||||
&old_protect);
|
||||
ok = VirtualProtect(dest, nbytes, PAGE_EXECUTE_READWRITE, &old_protect);
|
||||
|
||||
if (!ok) {
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
@ -208,11 +201,7 @@ HRESULT pe_patch(void *dest, const void *src, size_t nbytes)
|
||||
|
||||
memcpy(dest, src, nbytes);
|
||||
|
||||
ok = VirtualProtect(
|
||||
dest,
|
||||
nbytes,
|
||||
old_protect,
|
||||
&old_protect);
|
||||
ok = VirtualProtect(dest, nbytes, old_protect, &old_protect);
|
||||
|
||||
if (!ok) {
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
@ -252,7 +241,8 @@ const pe_thunk_t *pe_thunk_get_next(const pe_thunk_t *thunk)
|
||||
return thunk_next;
|
||||
}
|
||||
|
||||
void *pe_thunk_get_resolved_function(HMODULE target_pe, HMODULE import_pe, const pe_thunk_t *thunk)
|
||||
void *pe_thunk_get_resolved_function(
|
||||
HMODULE target_pe, HMODULE import_pe, const pe_thunk_t *thunk)
|
||||
{
|
||||
void *addr;
|
||||
|
||||
@ -262,11 +252,12 @@ void *pe_thunk_get_resolved_function(HMODULE target_pe, HMODULE import_pe, const
|
||||
|
||||
if (thunk->u1.AddressOfData != 0) {
|
||||
if (IMAGE_SNAP_BY_ORDINAL(thunk->u1.Ordinal)) {
|
||||
LPCSTR functionOrdinal = (LPCSTR)IMAGE_ORDINAL(thunk->u1.Ordinal);
|
||||
addr = (void *)GetProcAddress(import_pe, functionOrdinal);
|
||||
LPCSTR functionOrdinal = (LPCSTR) IMAGE_ORDINAL(thunk->u1.Ordinal);
|
||||
addr = (void *) GetProcAddress(import_pe, functionOrdinal);
|
||||
} else {
|
||||
PIMAGE_IMPORT_BY_NAME functionName = pe_offset(target_pe, thunk->u1.AddressOfData);
|
||||
addr = (void *)GetProcAddress(import_pe, functionName->Name);
|
||||
PIMAGE_IMPORT_BY_NAME functionName =
|
||||
pe_offset(target_pe, thunk->u1.AddressOfData);
|
||||
addr = (void *) GetProcAddress(import_pe, functionName->Name);
|
||||
}
|
||||
} else {
|
||||
addr = NULL;
|
||||
@ -277,7 +268,8 @@ void *pe_thunk_get_resolved_function(HMODULE target_pe, HMODULE import_pe, const
|
||||
|
||||
void pe_resolve_imports(HMODULE target_pe)
|
||||
{
|
||||
for (const pe_iid_t *iid = pe_iid_get_first(target_pe); iid != NULL; iid = pe_iid_get_next(target_pe, iid)) {
|
||||
for (const pe_iid_t *iid = pe_iid_get_first(target_pe); iid != NULL;
|
||||
iid = pe_iid_get_next(target_pe, iid)) {
|
||||
const char *iid_name;
|
||||
HMODULE imported_pe;
|
||||
|
||||
@ -285,13 +277,16 @@ void pe_resolve_imports(HMODULE target_pe)
|
||||
imported_pe = LoadLibraryA(iid_name);
|
||||
assert(imported_pe != NULL);
|
||||
|
||||
for (const pe_thunk_t *thunk = pe_thunk_get_first(target_pe, iid); thunk != NULL; thunk = pe_thunk_get_next(thunk)) {
|
||||
for (const pe_thunk_t *thunk = pe_thunk_get_first(target_pe, iid);
|
||||
thunk != NULL;
|
||||
thunk = pe_thunk_get_next(thunk)) {
|
||||
void *addr;
|
||||
|
||||
addr = pe_thunk_get_resolved_function(target_pe, imported_pe, thunk);
|
||||
addr =
|
||||
pe_thunk_get_resolved_function(target_pe, imported_pe, thunk);
|
||||
|
||||
if (addr != NULL) {
|
||||
pe_patch((void*)&thunk->u1.Function, &addr, sizeof(PDWORD));
|
||||
pe_patch((void *) &thunk->u1.Function, &addr, sizeof(PDWORD));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
typedef IMAGE_IMPORT_DESCRIPTOR pe_iid_t;
|
||||
typedef IMAGE_THUNK_DATA pe_thunk_t;
|
||||
|
||||
typedef DWORD (CALLBACK *dll_entry_t)(HMODULE self, DWORD reason, void *ctx);
|
||||
typedef DWORD(CALLBACK *dll_entry_t)(HMODULE self, DWORD reason, void *ctx);
|
||||
|
||||
struct pe_iat_entry {
|
||||
const char *name;
|
||||
@ -21,10 +21,7 @@ const pe_iid_t *pe_iid_get_first(HMODULE pe);
|
||||
const char *pe_iid_get_name(HMODULE pe, const pe_iid_t *iid);
|
||||
const pe_iid_t *pe_iid_get_next(HMODULE pe, const pe_iid_t *iid);
|
||||
HRESULT pe_iid_get_iat_entry(
|
||||
HMODULE pe,
|
||||
const pe_iid_t *iid,
|
||||
size_t n,
|
||||
struct pe_iat_entry *entry);
|
||||
HMODULE pe, const pe_iid_t *iid, size_t n, struct pe_iat_entry *entry);
|
||||
void *pe_get_export(HMODULE pe, const char *name, uint16_t ord);
|
||||
void *pe_get_entry_point(HMODULE pe);
|
||||
HRESULT pe_patch(void *dest, const void *src, size_t nbytes);
|
||||
|
@ -12,24 +12,18 @@
|
||||
#include "hook/pe.h"
|
||||
#include "hook/process.h"
|
||||
|
||||
static bool thread_match_startup(
|
||||
const CONTEXT *ctx,
|
||||
void *ntstart,
|
||||
void *exe_entry)
|
||||
static bool
|
||||
thread_match_startup(const CONTEXT *ctx, void *ntstart, void *exe_entry)
|
||||
{
|
||||
#ifdef _M_AMD64
|
||||
return ctx->Rip == (DWORD64) ntstart &&
|
||||
ctx->Rcx == (DWORD64) exe_entry;
|
||||
return ctx->Rip == (DWORD64) ntstart && ctx->Rcx == (DWORD64) exe_entry;
|
||||
#else
|
||||
return ctx->Eip == (DWORD) ntstart &&
|
||||
ctx->Eax == (DWORD) exe_entry;
|
||||
return ctx->Eip == (DWORD) ntstart && ctx->Eax == (DWORD) exe_entry;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void thread_patch_startup(
|
||||
process_entry_t new_entry,
|
||||
process_entry_t *orig_entry,
|
||||
CONTEXT *ctx)
|
||||
process_entry_t new_entry, process_entry_t *orig_entry, CONTEXT *ctx)
|
||||
{
|
||||
#ifdef _M_AMD64
|
||||
*orig_entry = (void *) ctx->Rcx;
|
||||
@ -41,9 +35,7 @@ static void thread_patch_startup(
|
||||
}
|
||||
|
||||
static HRESULT process_hijack_try_thread(
|
||||
process_entry_t new_entry,
|
||||
process_entry_t *orig_entry,
|
||||
DWORD thread_id)
|
||||
process_entry_t new_entry, process_entry_t *orig_entry, DWORD thread_id)
|
||||
{
|
||||
CONTEXT ctx;
|
||||
HMODULE exe;
|
||||
@ -85,10 +77,8 @@ static HRESULT process_hijack_try_thread(
|
||||
goto end;
|
||||
}
|
||||
|
||||
thread = OpenThread(
|
||||
THREAD_GET_CONTEXT | THREAD_SET_CONTEXT,
|
||||
FALSE,
|
||||
thread_id);
|
||||
thread =
|
||||
OpenThread(THREAD_GET_CONTEXT | THREAD_SET_CONTEXT, FALSE, thread_id);
|
||||
|
||||
if (thread == NULL) {
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
@ -134,9 +124,8 @@ end:
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT process_hijack_startup(
|
||||
process_entry_t new_entry,
|
||||
process_entry_t *orig_entry)
|
||||
HRESULT
|
||||
process_hijack_startup(process_entry_t new_entry, process_entry_t *orig_entry)
|
||||
{
|
||||
THREADENTRY32 thread;
|
||||
HANDLE snap;
|
||||
@ -175,9 +164,7 @@ HRESULT process_hijack_startup(
|
||||
}
|
||||
|
||||
hr = process_hijack_try_thread(
|
||||
new_entry,
|
||||
orig_entry,
|
||||
thread.th32ThreadID);
|
||||
new_entry, orig_entry, thread.th32ThreadID);
|
||||
|
||||
if (hr == S_OK) {
|
||||
/* Main thread successfully hijacked, finish up */
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
typedef DWORD (CALLBACK *process_entry_t)(void);
|
||||
typedef DWORD(CALLBACK *process_entry_t)(void);
|
||||
|
||||
HRESULT process_hijack_startup(
|
||||
process_entry_t new_entry,
|
||||
process_entry_t *orig_entry);
|
||||
HRESULT
|
||||
process_hijack_startup(process_entry_t new_entry, process_entry_t *orig_entry);
|
||||
|
@ -13,9 +13,7 @@ static const char apiset_prefix[] = "api-ms-win-core-";
|
||||
static const size_t apiset_prefix_len = sizeof(apiset_prefix) - 1;
|
||||
|
||||
static void hook_table_apply_to_all(
|
||||
const char *depname,
|
||||
const struct hook_symbol *syms,
|
||||
size_t nsyms);
|
||||
const char *depname, const struct hook_symbol *syms, size_t nsyms);
|
||||
|
||||
static void hook_table_apply_to_iid(
|
||||
HMODULE target,
|
||||
@ -24,25 +22,18 @@ static void hook_table_apply_to_iid(
|
||||
size_t nsyms);
|
||||
|
||||
static bool hook_table_match_module(
|
||||
HMODULE target,
|
||||
const char *iid_name,
|
||||
const char *depname);
|
||||
HMODULE target, const char *iid_name, const char *depname);
|
||||
|
||||
static bool hook_table_match_proc(
|
||||
const struct pe_iat_entry *iate,
|
||||
const struct hook_symbol *sym);
|
||||
const struct pe_iat_entry *iate, const struct hook_symbol *sym);
|
||||
|
||||
static void hook_table_apply_to_all(
|
||||
const char *depname,
|
||||
const struct hook_symbol *syms,
|
||||
size_t nsyms)
|
||||
const char *depname, const struct hook_symbol *syms, size_t nsyms)
|
||||
{
|
||||
const peb_dll_t *dll;
|
||||
HMODULE pe;
|
||||
|
||||
for ( dll = peb_dll_get_first() ;
|
||||
dll != NULL ;
|
||||
dll = peb_dll_get_next(dll)) {
|
||||
for (dll = peb_dll_get_first(); dll != NULL; dll = peb_dll_get_next(dll)) {
|
||||
pe = peb_dll_get_base(dll);
|
||||
|
||||
if (pe == NULL) {
|
||||
@ -71,8 +62,7 @@ void hook_table_apply(
|
||||
|
||||
hook_table_apply_to_all(depname, syms, nsyms);
|
||||
} else {
|
||||
for ( iid = pe_iid_get_first(target) ;
|
||||
iid != NULL ;
|
||||
for (iid = pe_iid_get_first(target); iid != NULL;
|
||||
iid = pe_iid_get_next(target, iid)) {
|
||||
iid_name = pe_iid_get_name(target, iid);
|
||||
|
||||
@ -97,7 +87,7 @@ static void hook_table_apply_to_iid(
|
||||
i = 0;
|
||||
|
||||
while (pe_iid_get_iat_entry(target, iid, i++, &iate) == S_OK) {
|
||||
for (j = 0 ; j < nsyms ; j++) {
|
||||
for (j = 0; j < nsyms; j++) {
|
||||
sym = &syms[j];
|
||||
|
||||
if (hook_table_match_proc(&iate, sym)) {
|
||||
@ -112,9 +102,7 @@ static void hook_table_apply_to_iid(
|
||||
}
|
||||
|
||||
static bool hook_table_match_module(
|
||||
HMODULE target,
|
||||
const char *iid_name,
|
||||
const char *depname)
|
||||
HMODULE target, const char *iid_name, const char *depname)
|
||||
{
|
||||
HMODULE kernel32;
|
||||
int result;
|
||||
@ -163,11 +151,9 @@ static bool hook_table_match_module(
|
||||
}
|
||||
|
||||
static bool hook_table_match_proc(
|
||||
const struct pe_iat_entry *iate,
|
||||
const struct hook_symbol *sym)
|
||||
const struct pe_iat_entry *iate, const struct hook_symbol *sym)
|
||||
{
|
||||
if ( sym->name != NULL &&
|
||||
iate->name != NULL &&
|
||||
if (sym->name != NULL && iate->name != NULL &&
|
||||
strcmp(sym->name, iate->name) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ static CRITICAL_SECTION hooked_files_cs;
|
||||
BOOL my_GetFileInformationByHandle(
|
||||
HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation);
|
||||
|
||||
BOOL (*real_GetFileInformationByHandle)
|
||||
BOOL(*real_GetFileInformationByHandle)
|
||||
(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation);
|
||||
|
||||
static const struct hook_symbol memfile_hook_kernel32_syms[] = {
|
||||
|
@ -31,7 +31,7 @@ static HANDLE _device_handle;
|
||||
static struct iobuf _buffer;
|
||||
static struct iobuf _buffer_unescaped;
|
||||
|
||||
static void _unescape_acio_buffer(struct iobuf* in, struct iobuf* out)
|
||||
static void _unescape_acio_buffer(struct iobuf *in, struct iobuf *out)
|
||||
{
|
||||
log_assert(in);
|
||||
log_assert(out);
|
||||
@ -128,62 +128,74 @@ static HRESULT _iohook_handler(struct irp *irp)
|
||||
return result;
|
||||
|
||||
case IRP_OP_WRITE:
|
||||
// Use write as a trigger to evaluate buffered data of previous reads.
|
||||
// Good enough to check for some button press combincation to exit the game
|
||||
// Not implementing a full acio stack for performance reasons
|
||||
// and to keep the complexity of this rather low for such crude feature.
|
||||
// Use write as a trigger to evaluate buffered data of previous
|
||||
// reads. Good enough to check for some button press
|
||||
// combincation to exit the game Not implementing a full acio
|
||||
// stack for performance reasons and to keep the complexity of
|
||||
// this rather low for such crude feature.
|
||||
|
||||
// Un-escape the buffer to prepare it for further evaluation
|
||||
_buffer_unescaped.pos = 0;
|
||||
_unescape_acio_buffer(&_buffer, &_buffer_unescaped);
|
||||
|
||||
struct ac_io_message *msg = (struct ac_io_message*) _buffer_unescaped.bytes;
|
||||
struct ac_io_message *msg =
|
||||
(struct ac_io_message *) _buffer_unescaped.bytes;
|
||||
|
||||
if (msg->addr == (AC_IO_RESPONSE_FLAG | _ACIO_NODE_BIO2) &&
|
||||
ac_io_u16(msg->cmd.code) == BIO2_BI2A_CMD_POLL) {
|
||||
struct bi2a_iidx_state_in *state_in = (struct bi2a_iidx_state_in*) msg->cmd.raw;
|
||||
struct bi2a_iidx_state_in *state_in =
|
||||
(struct bi2a_iidx_state_in *) msg->cmd.raw;
|
||||
|
||||
if (state_in->PANEL.y_start1 && state_in->PANEL.y_start2 &&
|
||||
state_in->PANEL.y_vefx && state_in->PANEL.y_effect) {
|
||||
log_info("Exit hook triggered");
|
||||
|
||||
// Last opportunity to write some output data to switch off lights
|
||||
// Hacky, since we don't have an acio stack but some checks to
|
||||
// protect from bad things happening
|
||||
// Last opportunity to write some output data to switch
|
||||
// off lights Hacky, since we don't have an acio stack
|
||||
// but some checks to protect from bad things happening
|
||||
|
||||
if (irp->write.nbytes >=
|
||||
_SIZE_ACIO_WRITE_SOF +
|
||||
if (irp->write.nbytes >= _SIZE_ACIO_WRITE_SOF +
|
||||
_SIZE_ACIO_WRITE_MSG_HEADER +
|
||||
sizeof(struct bi2a_iidx_state_out)) {
|
||||
log_misc("Switching off lights");
|
||||
|
||||
// +_SIZE_ACIO_WRITE_SOF: Skip leading 0xAA
|
||||
struct ac_io_message *msg_out =
|
||||
(struct ac_io_message*) (irp->write.bytes + _SIZE_ACIO_WRITE_SOF);
|
||||
(struct ac_io_message *) (irp->write.bytes +
|
||||
_SIZE_ACIO_WRITE_SOF);
|
||||
|
||||
// Guard assumption that reading poll is always followed by a writing
|
||||
// poll (according to traffic dumps from iidx 27, that's the case)
|
||||
// Guard assumption that reading poll is always
|
||||
// followed by a writing poll (according to traffic
|
||||
// dumps from iidx 27, that's the case)
|
||||
if (msg_out->addr == _ACIO_NODE_BIO2 &&
|
||||
ac_io_u16(msg_out->cmd.code) == BIO2_BI2A_CMD_POLL &&
|
||||
msg_out->cmd.count == sizeof(struct bi2a_iidx_state_out)) {
|
||||
ac_io_u16(msg_out->cmd.code) ==
|
||||
BIO2_BI2A_CMD_POLL &&
|
||||
msg_out->cmd.count ==
|
||||
sizeof(struct bi2a_iidx_state_out)) {
|
||||
struct bi2a_iidx_state_out *state_out =
|
||||
(struct bi2a_iidx_state_out*) msg_out->cmd.raw;
|
||||
(struct bi2a_iidx_state_out *)
|
||||
msg_out->cmd.raw;
|
||||
|
||||
_switch_off_all_lights(state_out);
|
||||
|
||||
result = iohook_invoke_next(irp);
|
||||
|
||||
if (result != S_OK) {
|
||||
log_warning("Writing output to switch lights off failed: %lX",
|
||||
log_warning(
|
||||
"Writing output to switch lights off "
|
||||
"failed: %lX",
|
||||
result);
|
||||
}
|
||||
} else {
|
||||
log_warning("Skipping switching off lights, write output not "
|
||||
log_warning(
|
||||
"Skipping switching off lights, write "
|
||||
"output not "
|
||||
"identified as a poll message");
|
||||
}
|
||||
} else {
|
||||
log_warning(
|
||||
"Skipped switching off lights due to insufficient buffer size");
|
||||
"Skipped switching off lights due to "
|
||||
"insufficient buffer size");
|
||||
}
|
||||
|
||||
Sleep(1000);
|
||||
@ -222,18 +234,14 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
|
||||
|
||||
char buffer[MAX_PATH];
|
||||
|
||||
if (!bio2drv_detect(
|
||||
DETECT_DEVICEID,
|
||||
0,
|
||||
buffer,
|
||||
sizeof(buffer))) {
|
||||
if (!bio2drv_detect(DETECT_DEVICEID, 0, buffer, sizeof(buffer))) {
|
||||
log_warning("Autodetecting IIDX BIO2 failed, disabling exit hook");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
log_info("BIO2 device found: %s", buffer);
|
||||
|
||||
wchar_t* buffer_widen = str_widen(buffer);
|
||||
wchar_t *buffer_widen = str_widen(buffer);
|
||||
|
||||
wcscpy(_device_path, buffer_widen);
|
||||
free(buffer_widen);
|
||||
|
@ -33,7 +33,6 @@ static struct ac_io_emu_icca iidxhook_util_acio_emu_icca[2];
|
||||
static bool iidxhook_util_icca_override_version;
|
||||
static enum ac_io_emu_icca_version iidxhook_util_icca_override_version_value;
|
||||
|
||||
|
||||
void iidxhook_util_acio_override_version(enum ac_io_emu_icca_version version)
|
||||
{
|
||||
iidxhook_util_icca_override_version = true;
|
||||
@ -56,8 +55,7 @@ void iidxhook_util_acio_init(bool legacy_mode)
|
||||
if (iidxhook_util_icca_override_version) {
|
||||
ac_io_emu_icca_set_version(
|
||||
&iidxhook_util_acio_emu_icca[i],
|
||||
iidxhook_util_icca_override_version_value
|
||||
);
|
||||
iidxhook_util_icca_override_version_value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
*/
|
||||
void iidxhook_util_acio_init(bool legacy_mode);
|
||||
|
||||
|
||||
/**
|
||||
* Use the specified ICCA emulation version
|
||||
*/
|
||||
|
@ -24,7 +24,8 @@ void iidxhook_config_io_init(struct cconfig *config)
|
||||
config,
|
||||
IIDXHOOK_UTIL_CONFIG_IO_DISABLE_IO_EMU_KEY,
|
||||
IIDXHOOK_UTIL_CONFIG_IO_DEFAULT_DISABLE_IO_EMU_VALUE,
|
||||
"Disable ezusb IO emulation and enable usage of real ezusb1/2 IO hardware");
|
||||
"Disable ezusb IO emulation and enable usage of real ezusb1/2 IO "
|
||||
"hardware");
|
||||
}
|
||||
|
||||
void iidxhook_config_io_get(
|
||||
|
@ -30,7 +30,8 @@ void iidxhook_config_misc_init(struct cconfig *config)
|
||||
config,
|
||||
IIDXHOOK_CONFIG_MISC_SETTINGS_PATH_STUB_KEY,
|
||||
IIDXHOOK_CONFIG_MISC_DEFAULT_SETTINGS_PATH_STUB_VALUE,
|
||||
"Path to store the settings, e.g. bookkeeping, operator settings. d:, e: and f: drive configuration/settings data");
|
||||
"Path to store the settings, e.g. bookkeeping, operator settings. d:, "
|
||||
"e: and f: drive configuration/settings data");
|
||||
}
|
||||
|
||||
void iidxhook_config_misc_get(
|
||||
|
@ -65,7 +65,7 @@ static struct {
|
||||
D3DTEXTUREFILTERTYPE filter;
|
||||
} iidxhook_util_d3d9_back_buffer_scaling;
|
||||
|
||||
static IDirect3DVertexShader9* vertex_shader;
|
||||
static IDirect3DVertexShader9 *vertex_shader;
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------
|
||||
*/
|
||||
@ -679,8 +679,8 @@ iidxhook_util_d3d9_iidx11_to_17_fix_uvs_bg_videos(struct hook_d3d9_irp *irp)
|
||||
(vertices[3].x >= 493.0f && vertices[3].x <= 494.0f &&
|
||||
vertices[3].y >= 404.0f && vertices[3].y <= 408.0f))) {
|
||||
/* fix UVs
|
||||
1.0f / 512 fixes the diagonal seam connecting the two triangles
|
||||
which is visible on some GPUs (why? idk)
|
||||
1.0f / 512 fixes the diagonal seam connecting the two
|
||||
triangles which is visible on some GPUs (why? idk)
|
||||
*/
|
||||
vertices[0].tu = 0.0f + 1.0f / 512;
|
||||
vertices[0].tv = 1.0f;
|
||||
@ -910,28 +910,36 @@ iidxhook_util_d3d9_iidx18_and_19_fix_diagonal_tearing(struct hook_d3d9_irp *irp)
|
||||
HRESULT hr;
|
||||
|
||||
log_assert(irp);
|
||||
log_assert(irp->op == HOOK_D3D9_IRP_OP_DEV_SET_VIEWPORT || irp->op == HOOK_D3D9_IRP_OP_DEV_SET_VERTEX_SHADER);
|
||||
log_assert(
|
||||
irp->op == HOOK_D3D9_IRP_OP_DEV_SET_VIEWPORT ||
|
||||
irp->op == HOOK_D3D9_IRP_OP_DEV_SET_VERTEX_SHADER);
|
||||
|
||||
if (!iidxhook_util_d3d9_config.iidx18_and_19_diagonal_tearing_fix)
|
||||
{
|
||||
if (!iidxhook_util_d3d9_config.iidx18_and_19_diagonal_tearing_fix) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (irp->op == HOOK_D3D9_IRP_OP_DEV_SET_VIEWPORT)
|
||||
{
|
||||
if (irp->op == HOOK_D3D9_IRP_OP_DEV_SET_VIEWPORT) {
|
||||
const D3DVIEWPORT9 *pViewport = irp->args.dev_set_viewport.pViewport;
|
||||
const float fix_offset[2] = {-1.0F / (float)pViewport->Width, -1.0F / (float)pViewport->Height};
|
||||
const float fix_offset[2] = {
|
||||
-1.0F / (float) pViewport->Width,
|
||||
-1.0F / (float) pViewport->Height};
|
||||
|
||||
hr = IDirect3DDevice9_SetVertexShaderConstantF(irp->args.dev_set_viewport.self, 63, fix_offset, lengthof(fix_offset));
|
||||
hr = IDirect3DDevice9_SetVertexShaderConstantF(
|
||||
irp->args.dev_set_viewport.self,
|
||||
63,
|
||||
fix_offset,
|
||||
lengthof(fix_offset));
|
||||
if (hr != S_OK) {
|
||||
log_warning("SetVertexShaderConstantF failed: %lX", hr);
|
||||
}
|
||||
}
|
||||
|
||||
if (irp->op == HOOK_D3D9_IRP_OP_DEV_SET_VERTEX_SHADER)
|
||||
{
|
||||
if (irp->op == HOOK_D3D9_IRP_OP_DEV_SET_VERTEX_SHADER) {
|
||||
if (!vertex_shader) {
|
||||
hr = IDirect3DDevice9_CreateVertexShader(irp->args.dev_set_vertex_shader.self, (const DWORD*) g_vs11_vs_main, &vertex_shader);
|
||||
hr = IDirect3DDevice9_CreateVertexShader(
|
||||
irp->args.dev_set_vertex_shader.self,
|
||||
(const DWORD *) g_vs11_vs_main,
|
||||
&vertex_shader);
|
||||
if (hr != S_OK) {
|
||||
log_fatal("CreateVertexShader failed: %lX", hr);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ void settings_hook_init(void)
|
||||
log_info("Inserted settings hooks, settings path: %s", settings_path);
|
||||
}
|
||||
|
||||
void settings_hook_set_path(const char* path)
|
||||
void settings_hook_set_path(const char *path)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
@ -161,7 +161,8 @@ settings_hook_dispatch_irp(struct irp *irp)
|
||||
new_path_folder[settings_path_len + 2] = '\0';
|
||||
|
||||
if (!path_exists(new_path_folder)) {
|
||||
log_misc("Creating local settings folder %s", new_path_folder);
|
||||
log_misc(
|
||||
"Creating local settings folder %s", new_path_folder);
|
||||
CreateDirectoryA(new_path_folder, NULL);
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ void settings_hook_init(void);
|
||||
*
|
||||
* @param path Destination path for storage, relative or absolute.
|
||||
*/
|
||||
void settings_hook_set_path(const char* path);
|
||||
void settings_hook_set_path(const char *path);
|
||||
|
||||
/**
|
||||
* iohook dispatch function
|
||||
|
@ -34,74 +34,32 @@
|
||||
// approximately 8 instruction slots used
|
||||
#endif
|
||||
|
||||
const BYTE g_vs11_vs_main[] =
|
||||
{
|
||||
1, 1, 254, 255, 254, 255,
|
||||
59, 0, 67, 84, 65, 66,
|
||||
28, 0, 0, 0, 191, 0,
|
||||
0, 0, 1, 1, 254, 255,
|
||||
3, 0, 0, 0, 28, 0,
|
||||
0, 0, 0, 1, 0, 0,
|
||||
184, 0, 0, 0, 88, 0,
|
||||
0, 0, 2, 0, 4, 0,
|
||||
1, 0, 18, 0, 104, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
120, 0, 0, 0, 2, 0,
|
||||
63, 0, 1, 0, 254, 0,
|
||||
132, 0, 0, 0, 0, 0,
|
||||
0, 0, 148, 0, 0, 0,
|
||||
2, 0, 0, 0, 4, 0,
|
||||
2, 0, 168, 0, 0, 0,
|
||||
0, 0, 0, 0, 67, 111,
|
||||
108, 111, 114, 77, 117, 108,
|
||||
116, 105, 112, 108, 121, 0,
|
||||
171, 171, 1, 0, 3, 0,
|
||||
1, 0, 4, 0, 1, 0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
70, 105, 120, 79, 102, 102,
|
||||
115, 101, 116, 0, 171, 171,
|
||||
1, 0, 3, 0, 1, 0,
|
||||
2, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 87, 111,
|
||||
114, 108, 100, 86, 105, 101,
|
||||
119, 80, 114, 111, 106, 101,
|
||||
99, 116, 105, 111, 110, 0,
|
||||
3, 0, 3, 0, 4, 0,
|
||||
4, 0, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 118, 115,
|
||||
95, 49, 95, 49, 0, 77,
|
||||
105, 99, 114, 111, 115, 111,
|
||||
102, 116, 32, 40, 82, 41,
|
||||
32, 72, 76, 83, 76, 32,
|
||||
83, 104, 97, 100, 101, 114,
|
||||
32, 67, 111, 109, 112, 105,
|
||||
108, 101, 114, 32, 49, 48,
|
||||
46, 49, 0, 171, 31, 0,
|
||||
0, 0, 0, 0, 0, 128,
|
||||
0, 0, 15, 144, 31, 0,
|
||||
0, 0, 10, 0, 0, 128,
|
||||
1, 0, 15, 144, 31, 0,
|
||||
0, 0, 5, 0, 0, 128,
|
||||
2, 0, 15, 144, 9, 0,
|
||||
0, 0, 0, 0, 4, 192,
|
||||
0, 0, 228, 144, 2, 0,
|
||||
228, 160, 5, 0, 0, 0,
|
||||
0, 0, 15, 208, 1, 0,
|
||||
228, 144, 4, 0, 228, 160,
|
||||
9, 0, 0, 0, 0, 0,
|
||||
1, 128, 0, 0, 228, 144,
|
||||
0, 0, 228, 160, 9, 0,
|
||||
0, 0, 0, 0, 2, 128,
|
||||
0, 0, 228, 144, 1, 0,
|
||||
228, 160, 9, 0, 0, 0,
|
||||
0, 0, 4, 128, 0, 0,
|
||||
228, 144, 3, 0, 228, 160,
|
||||
4, 0, 0, 0, 0, 0,
|
||||
3, 192, 63, 0, 228, 160,
|
||||
0, 0, 170, 128, 0, 0,
|
||||
228, 128, 1, 0, 0, 0,
|
||||
0, 0, 8, 192, 0, 0,
|
||||
170, 128, 1, 0, 0, 0,
|
||||
0, 0, 3, 224, 2, 0,
|
||||
228, 144, 255, 255, 0, 0
|
||||
};
|
||||
const BYTE g_vs11_vs_main[] = {
|
||||
1, 1, 254, 255, 254, 255, 59, 0, 67, 84, 65, 66, 28, 0, 0,
|
||||
0, 191, 0, 0, 0, 1, 1, 254, 255, 3, 0, 0, 0, 28, 0,
|
||||
0, 0, 0, 1, 0, 0, 184, 0, 0, 0, 88, 0, 0, 0, 2,
|
||||
0, 4, 0, 1, 0, 18, 0, 104, 0, 0, 0, 0, 0, 0, 0,
|
||||
120, 0, 0, 0, 2, 0, 63, 0, 1, 0, 254, 0, 132, 0, 0,
|
||||
0, 0, 0, 0, 0, 148, 0, 0, 0, 2, 0, 0, 0, 4, 0,
|
||||
2, 0, 168, 0, 0, 0, 0, 0, 0, 0, 67, 111, 108, 111, 114,
|
||||
77, 117, 108, 116, 105, 112, 108, 121, 0, 171, 171, 1, 0, 3, 0,
|
||||
1, 0, 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 70, 105, 120,
|
||||
79, 102, 102, 115, 101, 116, 0, 171, 171, 1, 0, 3, 0, 1, 0,
|
||||
2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 87, 111, 114, 108, 100,
|
||||
86, 105, 101, 119, 80, 114, 111, 106, 101, 99, 116, 105, 111, 110, 0,
|
||||
3, 0, 3, 0, 4, 0, 4, 0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 118, 115, 95, 49, 95, 49, 0, 77, 105, 99, 114, 111, 115, 111,
|
||||
102, 116, 32, 40, 82, 41, 32, 72, 76, 83, 76, 32, 83, 104, 97,
|
||||
100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, 49, 48,
|
||||
46, 49, 0, 171, 31, 0, 0, 0, 0, 0, 0, 128, 0, 0, 15,
|
||||
144, 31, 0, 0, 0, 10, 0, 0, 128, 1, 0, 15, 144, 31, 0,
|
||||
0, 0, 5, 0, 0, 128, 2, 0, 15, 144, 9, 0, 0, 0, 0,
|
||||
0, 4, 192, 0, 0, 228, 144, 2, 0, 228, 160, 5, 0, 0, 0,
|
||||
0, 0, 15, 208, 1, 0, 228, 144, 4, 0, 228, 160, 9, 0, 0,
|
||||
0, 0, 0, 1, 128, 0, 0, 228, 144, 0, 0, 228, 160, 9, 0,
|
||||
0, 0, 0, 0, 2, 128, 0, 0, 228, 144, 1, 0, 228, 160, 9,
|
||||
0, 0, 0, 0, 0, 4, 128, 0, 0, 228, 144, 3, 0, 228, 160,
|
||||
4, 0, 0, 0, 0, 0, 3, 192, 63, 0, 228, 160, 0, 0, 170,
|
||||
128, 0, 0, 228, 128, 1, 0, 0, 0, 0, 0, 8, 192, 0, 0,
|
||||
170, 128, 1, 0, 0, 0, 0, 0, 3, 224, 2, 0, 228, 144, 255,
|
||||
255, 0, 0};
|
||||
|
@ -28,8 +28,8 @@
|
||||
#include "iidxhook-util/config-eamuse.h"
|
||||
#include "iidxhook-util/config-gfx.h"
|
||||
#include "iidxhook-util/config-io.h"
|
||||
#include "iidxhook-util/config-sec.h"
|
||||
#include "iidxhook-util/config-misc.h"
|
||||
#include "iidxhook-util/config-sec.h"
|
||||
#include "iidxhook-util/d3d9.h"
|
||||
#include "iidxhook-util/settings.h"
|
||||
|
||||
@ -80,9 +80,11 @@ iidxhook4_cn_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx)
|
||||
d3d9_config.scale_back_buffer_filter = config_gfx->scale_back_buffer_filter;
|
||||
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
|
||||
d3d9_config.device_adapter = config_gfx->device_adapter;
|
||||
d3d9_config.iidx18_and_19_diagonal_tearing_fix = config_gfx->diagonal_tearing_fix;
|
||||
d3d9_config.iidx18_and_19_diagonal_tearing_fix =
|
||||
config_gfx->diagonal_tearing_fix;
|
||||
d3d9_config.iidx14_to_19_nvidia_fix = true;
|
||||
d3d9_config.iidx18_and_19_diagonal_tearing_fix = config_gfx->diagonal_tearing_fix;
|
||||
d3d9_config.iidx18_and_19_diagonal_tearing_fix =
|
||||
config_gfx->diagonal_tearing_fix;
|
||||
|
||||
if (config_gfx->monitor_check == 0) {
|
||||
log_info("Auto monitor check enabled");
|
||||
@ -158,9 +160,10 @@ my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId)
|
||||
log_info("Initializing iidxhook...");
|
||||
|
||||
/**
|
||||
* This game is using a black round plug for game license management instead of a black usb dongle.
|
||||
* No white dongle hooks applies since the game does not have network functionality.
|
||||
* Also, card readers are not used/checked; no card reader hooks required.
|
||||
* This game is using a black round plug for game license management instead
|
||||
* of a black usb dongle. No white dongle hooks applies since the game does
|
||||
* not have network functionality. Also, card readers are not used/checked;
|
||||
* no card reader hooks required.
|
||||
*/
|
||||
ezusb_iidx_emu_node_security_plug_set_boot_version(
|
||||
&config_sec.boot_version);
|
||||
|
@ -1,8 +1,8 @@
|
||||
#define LOG_MODULE "path"
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "hook/table.h"
|
||||
|
||||
@ -48,12 +48,10 @@ static HANDLE(WINAPI *real_CreateFileW)(
|
||||
DWORD dwFlagsAndAttributes,
|
||||
HANDLE hTemplateFile);
|
||||
|
||||
static HANDLE WINAPI my_FindFirstFileA(
|
||||
LPCSTR lpFileName,
|
||||
LPWIN32_FIND_DATAA lpFindFileData);
|
||||
static HANDLE WINAPI
|
||||
my_FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
|
||||
static HANDLE(WINAPI *real_FindFirstFileA)(
|
||||
LPCSTR lpFileName,
|
||||
LPWIN32_FIND_DATAA lpFindFileData);
|
||||
LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
|
||||
|
||||
static const struct hook_symbol iidxhook4_cn_path_hook_syms[] = {
|
||||
{.name = "CreateFileA",
|
||||
@ -131,9 +129,8 @@ static HANDLE WINAPI my_CreateFileW(
|
||||
hTemplateFile);
|
||||
}
|
||||
|
||||
static HANDLE WINAPI my_FindFirstFileA(
|
||||
LPCSTR lpFileName,
|
||||
LPWIN32_FIND_DATAA lpFindFileData)
|
||||
static HANDLE WINAPI
|
||||
my_FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
|
||||
{
|
||||
if (lpFileName != NULL && strstr(lpFileName, PATH_A) == lpFileName) {
|
||||
char relative_path[MAX_PATH] = ".";
|
||||
|
@ -72,7 +72,8 @@ iidxhook4_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx)
|
||||
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
|
||||
d3d9_config.device_adapter = config_gfx->device_adapter;
|
||||
d3d9_config.iidx14_to_19_nvidia_fix = true;
|
||||
d3d9_config.iidx18_and_19_diagonal_tearing_fix = config_gfx->diagonal_tearing_fix;
|
||||
d3d9_config.iidx18_and_19_diagonal_tearing_fix =
|
||||
config_gfx->diagonal_tearing_fix;
|
||||
|
||||
if (config_gfx->monitor_check == 0) {
|
||||
log_info("Auto monitor check enabled");
|
||||
@ -144,7 +145,8 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
iidx_io_set_loggers(
|
||||
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
|
||||
|
||||
if (!iidx_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
if (!iidx_io_init(
|
||||
avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
log_fatal("Initializing IIDX IO backend failed");
|
||||
}
|
||||
} else {
|
||||
@ -157,7 +159,8 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
eam_io_set_loggers(
|
||||
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
|
||||
|
||||
if (!eam_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
if (!eam_io_init(
|
||||
avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
log_fatal("Initializing card reader backend failed");
|
||||
}
|
||||
} else {
|
||||
|
@ -28,8 +28,8 @@
|
||||
#include "iidxhook-util/config-eamuse.h"
|
||||
#include "iidxhook-util/config-gfx.h"
|
||||
#include "iidxhook-util/config-io.h"
|
||||
#include "iidxhook-util/config-sec.h"
|
||||
#include "iidxhook-util/config-misc.h"
|
||||
#include "iidxhook-util/config-sec.h"
|
||||
#include "iidxhook-util/d3d9.h"
|
||||
#include "iidxhook-util/settings.h"
|
||||
|
||||
@ -81,7 +81,8 @@ iidxhook5_cn_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx)
|
||||
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
|
||||
d3d9_config.device_adapter = config_gfx->device_adapter;
|
||||
d3d9_config.iidx14_to_19_nvidia_fix = true;
|
||||
d3d9_config.iidx18_and_19_diagonal_tearing_fix = config_gfx->diagonal_tearing_fix;
|
||||
d3d9_config.iidx18_and_19_diagonal_tearing_fix =
|
||||
config_gfx->diagonal_tearing_fix;
|
||||
|
||||
iidxhook_util_d3d9_configure(&d3d9_config);
|
||||
|
||||
@ -139,9 +140,10 @@ static ATOM WINAPI my_RegisterClassA(const WNDCLASSA *lpWndClass)
|
||||
log_info("Initializing iidxhook...");
|
||||
|
||||
/**
|
||||
* This game is using a black round plug for game license management instead of a black usb dongle.
|
||||
* No white dongle hooks applies since the game does not have network functionality.
|
||||
* Also, card readers are not used/checked; no card reader hooks required.
|
||||
* This game is using a black round plug for game license management instead
|
||||
* of a black usb dongle. No white dongle hooks applies since the game does
|
||||
* not have network functionality. Also, card readers are not used/checked;
|
||||
* no card reader hooks required.
|
||||
*/
|
||||
ezusb_iidx_emu_node_security_plug_set_boot_version(
|
||||
&config_sec.boot_version);
|
||||
|
@ -1,8 +1,8 @@
|
||||
#define LOG_MODULE "path"
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "hook/table.h"
|
||||
|
||||
@ -31,12 +31,10 @@ static HANDLE(WINAPI *real_CreateFileW)(
|
||||
DWORD dwFlagsAndAttributes,
|
||||
HANDLE hTemplateFile);
|
||||
|
||||
static HANDLE WINAPI my_FindFirstFileA(
|
||||
LPCSTR lpFileName,
|
||||
LPWIN32_FIND_DATAA lpFindFileData);
|
||||
static HANDLE WINAPI
|
||||
my_FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
|
||||
static HANDLE(WINAPI *real_FindFirstFileA)(
|
||||
LPCSTR lpFileName,
|
||||
LPWIN32_FIND_DATAA lpFindFileData);
|
||||
LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
|
||||
|
||||
static const struct hook_symbol iidxhook5_cn_path_hook_syms[] = {
|
||||
{.name = "CreateFileW",
|
||||
@ -79,9 +77,8 @@ static HANDLE WINAPI my_CreateFileW(
|
||||
hTemplateFile);
|
||||
}
|
||||
|
||||
static HANDLE WINAPI my_FindFirstFileA(
|
||||
LPCSTR lpFileName,
|
||||
LPWIN32_FIND_DATAA lpFindFileData)
|
||||
static HANDLE WINAPI
|
||||
my_FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
|
||||
{
|
||||
if (lpFileName != NULL && strstr(lpFileName, PATH_A) == lpFileName) {
|
||||
char relative[MAX_PATH] = ".";
|
||||
|
@ -72,7 +72,8 @@ iidxhook5_setup_d3d9_hooks(const struct iidxhook_config_gfx *config_gfx)
|
||||
d3d9_config.forced_refresh_rate = config_gfx->forced_refresh_rate;
|
||||
d3d9_config.device_adapter = config_gfx->device_adapter;
|
||||
d3d9_config.iidx14_to_19_nvidia_fix = true;
|
||||
d3d9_config.iidx18_and_19_diagonal_tearing_fix = config_gfx->diagonal_tearing_fix;
|
||||
d3d9_config.iidx18_and_19_diagonal_tearing_fix =
|
||||
config_gfx->diagonal_tearing_fix;
|
||||
|
||||
if (config_gfx->monitor_check == 0) {
|
||||
log_info("Auto monitor check enabled");
|
||||
@ -144,7 +145,8 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
iidx_io_set_loggers(
|
||||
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
|
||||
|
||||
if (!iidx_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
if (!iidx_io_init(
|
||||
avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
log_fatal("Initializing IIDX IO backend failed");
|
||||
}
|
||||
} else {
|
||||
@ -157,7 +159,8 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
eam_io_set_loggers(
|
||||
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
|
||||
|
||||
if (!eam_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
if (!eam_io_init(
|
||||
avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
log_fatal("Initializing card reader backend failed");
|
||||
}
|
||||
} else {
|
||||
|
@ -115,7 +115,8 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
iidx_io_set_loggers(
|
||||
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
|
||||
|
||||
if (!iidx_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
if (!iidx_io_init(
|
||||
avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
log_fatal("Initializing IIDX IO backend failed");
|
||||
}
|
||||
} else {
|
||||
@ -128,7 +129,8 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
eam_io_set_loggers(
|
||||
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
|
||||
|
||||
if (!eam_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
if (!eam_io_init(
|
||||
avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
log_fatal("Initializing card reader backend failed");
|
||||
}
|
||||
} else {
|
||||
|
@ -115,7 +115,8 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
iidx_io_set_loggers(
|
||||
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
|
||||
|
||||
if (!iidx_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
if (!iidx_io_init(
|
||||
avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
log_fatal("Initializing IIDX IO backend failed");
|
||||
}
|
||||
} else {
|
||||
@ -128,7 +129,8 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
eam_io_set_loggers(
|
||||
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
|
||||
|
||||
if (!eam_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
if (!eam_io_init(
|
||||
avs_thread_create, avs_thread_join, avs_thread_destroy)) {
|
||||
log_fatal("Initializing card reader backend failed");
|
||||
}
|
||||
} else {
|
||||
|
@ -23,8 +23,8 @@
|
||||
#include "iidxhook-util/d3d9.h"
|
||||
#include "iidxhook-util/log-server.h"
|
||||
|
||||
#include "bio2emu/emu.h"
|
||||
#include "bio2emu-iidx/bi2a.h"
|
||||
#include "bio2emu/emu.h"
|
||||
|
||||
#include "camhook/cam.h"
|
||||
#include "camhook/config-cam.h"
|
||||
|
@ -61,7 +61,8 @@ static struct bio2emu_port bio2_emu = {
|
||||
.dispatcher = bio2_emu_bi2a_dispatch_request,
|
||||
};
|
||||
|
||||
static bool load_configs() {
|
||||
static bool load_configs()
|
||||
{
|
||||
struct cconfig *config;
|
||||
config = cconfig_init();
|
||||
|
||||
@ -167,7 +168,8 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
if (!iidxhook9_config_io.lightning_mode) {
|
||||
bio2emu_init();
|
||||
bio2_emu_bi2a_set_tt_multiplier(iidxhook9_config_io.tt_multiplier);
|
||||
bio2_emu_bi2a_init(&bio2_emu, iidxhook9_config_io.disable_poll_limiter);
|
||||
bio2_emu_bi2a_init(
|
||||
&bio2_emu, iidxhook9_config_io.disable_poll_limiter);
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,8 +267,7 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (avs_is_active()){
|
||||
if (avs_is_active()) {
|
||||
// if AVS is loaded, we're likely too late to be a prehook
|
||||
// so we warn the user
|
||||
// and switch the current logging context to AVS so it shows up in logs
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user