chore: Apply code formatting to entire code base

This commit is contained in:
icex2 2023-04-06 14:49:57 +02:00 committed by icex2
parent 47bfb4e9b2
commit b0564b97c6
15 changed files with 152 additions and 116 deletions

View File

@ -152,7 +152,7 @@ static HRESULT ezusb_ioctl(struct irp *irp)
// Save the IO buffer that is used by the ezusb client backend and shared
// with the game's main thread
write_buffer_orig = (uint8_t*) irp->write.bytes;
write_buffer_orig = (uint8_t *) irp->write.bytes;
read_buffer_orig = irp->read.bytes;
// Prepare our own thread locally managed and non shared buffers for any
@ -162,20 +162,22 @@ static HRESULT ezusb_ioctl(struct irp *irp)
// Sanity check and visibility, in case this ever overflows
if (irp->write.nbytes > sizeof(write_buffer_local)) {
log_fatal("Insufficient local write buffer available for ioctl, local "
log_fatal(
"Insufficient local write buffer available for ioctl, local "
"size %d, ioctl buffer size %d",
sizeof(write_buffer_local),
irp->write.nbytes);
}
if (irp->read.nbytes > sizeof(read_buffer_local)) {
log_fatal("Insufficient local read buffer available for ioctl, local "
log_fatal(
"Insufficient local read buffer available for ioctl, local "
"size %d, ioctl buffer size %d",
sizeof(read_buffer_local),
irp->read.nbytes);
}
// Temporarily hook our local buffers to the irp
// Temporarily hook our local buffers to the irp
irp->write.bytes = write_buffer_local;
irp->read.bytes = read_buffer_local;
@ -248,7 +250,7 @@ static HRESULT ezusb_ioctl(struct irp *irp)
memcpy(read_buffer_orig, read_buffer_local, irp->read.nbytes);
// Re-store the original irp buffer state
irp->write.bytes = (const uint8_t*) write_buffer_orig;
irp->write.bytes = (const uint8_t *) write_buffer_orig;
irp->read.bytes = read_buffer_orig;
return res;

View File

@ -73,11 +73,11 @@ static uint8_t ezusb_iidx_emu_msg_read_cur_node = 0;
/* ------------------------------------------------------------------------ */
struct ezusb_emu_msg_hook *ezusb_iidx_emu_msg_init(
enum ezusb_iidx_emu_msg_io_board_type io_board_type)
struct ezusb_emu_msg_hook *
ezusb_iidx_emu_msg_init(enum ezusb_iidx_emu_msg_io_board_type io_board_type)
{
if (io_board_type < 0 ||
io_board_type >= EZUSB_IIDX_EMU_MSG_IO_BOARD_TYPE_COUNT) {
io_board_type >= EZUSB_IIDX_EMU_MSG_IO_BOARD_TYPE_COUNT) {
log_fatal("Invalid io board type %d specified", io_board_type);
}
@ -94,8 +94,8 @@ struct ezusb_emu_msg_hook *ezusb_iidx_emu_msg_init(
ezusb_iidx_emu_node_handler = ezusb_iidx_emu_msg_nodes;
log_info("Initialized, io board type: %d",
ezusb_iidx_emu_msg_io_board_type);
log_info(
"Initialized, io board type: %d", ezusb_iidx_emu_msg_io_board_type);
return &ezusb_iidx_emu_msg_hook;
}
@ -186,7 +186,8 @@ static HRESULT ezusb_iidx_emu_msg_interrupt_read(struct iobuf *read)
case EZUSB_IIDX_EMU_MSG_IO_BOARD_TYPE_COUNT:
default:
log_fatal("Illegal state, unhandled board type: %d",
log_fatal(
"Illegal state, unhandled board type: %d",
ezusb_iidx_emu_msg_io_board_type);
break;
}

View File

@ -26,8 +26,8 @@ enum ezusb_iidx_emu_msg_io_board_type {
* @return ezusb_emu_msg_hook structure with hook calls for ezusb msg
* dispatching
*/
struct ezusb_emu_msg_hook *ezusb_iidx_emu_msg_init(
enum ezusb_iidx_emu_msg_io_board_type io_board_type);
struct ezusb_emu_msg_hook *
ezusb_iidx_emu_msg_init(enum ezusb_iidx_emu_msg_io_board_type io_board_type);
/**
* Init the fully emulated IIDX msg backend for a EZUSB (C02) board. This

View File

@ -161,8 +161,10 @@ _Static_assert(
sizeof(struct ezusb_iidx_emu_node_serial_get_version_resp) == 13,
"ezusb_iidx_emu_node_serial_get_version_resp is the wrong size");
_Static_assert(
sizeof(struct ezusb_iidx_emu_node_serial_keyboard_get_buffer_size_resp) == 2,
"ezusb_iidx_emu_node_serial_keyboard_get_buffer_size_resp is the wrong size");
sizeof(struct ezusb_iidx_emu_node_serial_keyboard_get_buffer_size_resp) ==
2,
"ezusb_iidx_emu_node_serial_keyboard_get_buffer_size_resp is the wrong "
"size");
_Static_assert(
sizeof(struct ezusb_iidx_emu_node_serial_keyboard_read_data_req) == 1,
"ezusb_iidx_emu_node_serial_keyboard_read_data_req is the wrong size");
@ -173,10 +175,12 @@ _Static_assert(
sizeof(struct ezusb_iidx_emu_node_serial_card_slot_state_req) == 1,
"ezusb_iidx_emu_node_serial_card_slot_state_req is the wrong size");
_Static_assert(
sizeof(struct ezusb_iidx_emu_node_serial_card_read_resp) == 1 + MAG_CARD_DATA_SIZE,
sizeof(struct ezusb_iidx_emu_node_serial_card_read_resp) ==
1 + MAG_CARD_DATA_SIZE,
"ezusb_iidx_emu_node_serial_card_read_resp is the wrong size");
_Static_assert(
sizeof(struct ezusb_iidx_emu_node_serial_card_write_req) == MAG_CARD_DATA_SIZE,
sizeof(struct ezusb_iidx_emu_node_serial_card_write_req) ==
MAG_CARD_DATA_SIZE,
"ezusb_iidx_emu_node_serial_card_write_req is the wrong size");
_Static_assert(
sizeof(struct ezusb_iidx_emu_node_serial_common_req) == 0,
@ -460,8 +464,10 @@ calc_serial_buffer_checksum(const uint8_t *buffer, uint16_t length)
static struct ezusb_iidx_emu_node_serial_msg *create_generic_node_response_ok(
const struct ezusb_iidx_emu_node_serial_msg *msg_in, uint16_t *msg_out_len)
{
*msg_out_len = NODE_SERIAL_MSG_HEADER_SIZE + sizeof(struct ezusb_iidx_emu_node_serial_common_status_resp);
struct ezusb_iidx_emu_node_serial_msg *resp = xmalloc(sizeof(struct ezusb_iidx_emu_node_serial_msg));
*msg_out_len = NODE_SERIAL_MSG_HEADER_SIZE +
sizeof(struct ezusb_iidx_emu_node_serial_common_status_resp);
struct ezusb_iidx_emu_node_serial_msg *resp =
xmalloc(sizeof(struct ezusb_iidx_emu_node_serial_msg));
resp->msg_cmd = CMD_NODE_RESP;
resp->node_id = msg_in->node_id;
resp->node_cmd = msg_in->node_cmd;
@ -484,7 +490,10 @@ static struct ezusb_iidx_emu_node_serial_msg *process_serial_msg(
switch (msg_in->node_cmd) {
case H8_CMD_NODE_ENUM: {
log_misc("H8_CMD_NODE_ENUM");
*msg_out_len = NODE_SERIAL_MSG_HEADER_SIZE + sizeof(struct ezusb_iidx_emu_node_serial_node_enum_resp);
*msg_out_len =
NODE_SERIAL_MSG_HEADER_SIZE +
sizeof(
struct ezusb_iidx_emu_node_serial_node_enum_resp);
struct ezusb_iidx_emu_node_serial_msg *resp =
xmalloc(sizeof(struct ezusb_iidx_emu_node_serial_msg));
resp->msg_cmd = CMD_H8_RESP;
@ -499,7 +508,10 @@ static struct ezusb_iidx_emu_node_serial_msg *process_serial_msg(
case H8_CMD_GET_VERSION: {
log_misc("H8_CMD_GET_VERSION: %d", msg_in->node_id);
*msg_out_len = NODE_SERIAL_MSG_HEADER_SIZE + sizeof(struct ezusb_iidx_emu_node_serial_get_version_resp);
*msg_out_len =
NODE_SERIAL_MSG_HEADER_SIZE +
sizeof(
struct ezusb_iidx_emu_node_serial_get_version_resp);
struct ezusb_iidx_emu_node_serial_msg *resp =
xmalloc(sizeof(struct ezusb_iidx_emu_node_serial_msg));
resp->msg_cmd = CMD_H8_RESP;
@ -524,7 +536,9 @@ static struct ezusb_iidx_emu_node_serial_msg *process_serial_msg(
case H8_CMD_PROG_EXEC: {
log_misc("H8_CMD_PROG_EXEC: %d", msg_in->node_id);
*msg_out_len = NODE_SERIAL_MSG_HEADER_SIZE + sizeof(struct ezusb_iidx_emu_node_serial_common_status_resp);
*msg_out_len = NODE_SERIAL_MSG_HEADER_SIZE +
sizeof(struct
ezusb_iidx_emu_node_serial_common_status_resp);
struct ezusb_iidx_emu_node_serial_msg *resp =
xmalloc(sizeof(struct ezusb_iidx_emu_node_serial_msg));
resp->msg_cmd = CMD_H8_RESP;
@ -600,7 +614,9 @@ static struct ezusb_iidx_emu_node_serial_msg *process_serial_msg(
case NODE_CMD_CARD_RW_UNIT_GET_STATUS: {
/* report front and back sensor states */
*msg_out_len = NODE_SERIAL_MSG_HEADER_SIZE + sizeof(struct ezusb_iidx_emu_node_serial_common_status_resp);
*msg_out_len = NODE_SERIAL_MSG_HEADER_SIZE +
sizeof(struct
ezusb_iidx_emu_node_serial_common_status_resp);
struct ezusb_iidx_emu_node_serial_msg *resp =
xmalloc(sizeof(struct ezusb_iidx_emu_node_serial_msg));
resp->msg_cmd = CMD_NODE_RESP;
@ -719,7 +735,10 @@ static struct ezusb_iidx_emu_node_serial_msg *process_serial_msg(
}
case NODE_CMD_CARD_READ: {
*msg_out_len = NODE_SERIAL_MSG_HEADER_SIZE + sizeof(struct ezusb_iidx_emu_node_serial_card_read_resp);
*msg_out_len =
NODE_SERIAL_MSG_HEADER_SIZE +
sizeof(
struct ezusb_iidx_emu_node_serial_card_read_resp);
struct ezusb_iidx_emu_node_serial_msg *resp =
xmalloc(sizeof(struct ezusb_iidx_emu_node_serial_msg));
resp->msg_cmd = CMD_NODE_RESP;
@ -871,7 +890,11 @@ static struct ezusb_iidx_emu_node_serial_msg *process_serial_msg(
}
case NODE_CMD_KEYBOARD_GET_BUFFER_SIZE: {
*msg_out_len = NODE_SERIAL_MSG_HEADER_SIZE + sizeof(struct ezusb_iidx_emu_node_serial_keyboard_get_buffer_size_resp);
*msg_out_len =
NODE_SERIAL_MSG_HEADER_SIZE +
sizeof(
struct
ezusb_iidx_emu_node_serial_keyboard_get_buffer_size_resp);
struct ezusb_iidx_emu_node_serial_msg *resp =
xmalloc(sizeof(struct ezusb_iidx_emu_node_serial_msg));
resp->msg_cmd = CMD_NODE_RESP;

View File

@ -171,7 +171,7 @@ static HRESULT ezusb_ioctl(struct irp *irp)
// Save the IO buffer that is used by the ezusb client backend and shared
// with the game's main thread
write_buffer_orig = (uint8_t*) irp->write.bytes;
write_buffer_orig = (uint8_t *) irp->write.bytes;
read_buffer_orig = irp->read.bytes;
// Prepare our own thread locally managed and non shared buffers for any
@ -181,20 +181,22 @@ static HRESULT ezusb_ioctl(struct irp *irp)
// Sanity check and visibility, in case this ever overflows
if (irp->write.nbytes > sizeof(write_buffer_local)) {
log_fatal("Insufficient local write buffer available for ioctl, local "
log_fatal(
"Insufficient local write buffer available for ioctl, local "
"size %d, ioctl buffer size %d",
sizeof(write_buffer_local),
irp->write.nbytes);
}
if (irp->read.nbytes > sizeof(read_buffer_local)) {
log_fatal("Insufficient local read buffer available for ioctl, local "
log_fatal(
"Insufficient local read buffer available for ioctl, local "
"size %d, ioctl buffer size %d",
sizeof(read_buffer_local),
irp->read.nbytes);
}
// Temporarily hook our local buffers to the irp
// Temporarily hook our local buffers to the irp
irp->write.bytes = write_buffer_local;
irp->read.bytes = read_buffer_local;
@ -267,7 +269,7 @@ static HRESULT ezusb_ioctl(struct irp *irp)
memcpy(read_buffer_orig, read_buffer_local, irp->read.nbytes);
// Re-store the original irp buffer state
irp->write.bytes = (const uint8_t*) write_buffer_orig;
irp->write.bytes = (const uint8_t *) write_buffer_orig;
irp->read.bytes = read_buffer_orig;
return hr;

View File

@ -164,8 +164,6 @@ static HRESULT ezusb2_popn_emu_msg_bulk_read(struct iobuf *read)
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
}
if (!ezusb2_popn_emu_msg_nodes[ezusb2_popn_emu_msg_read_cur_node]) {
log_warning(
"Bulk read unsupported on cur_node = %d",

View File

@ -262,13 +262,15 @@ static void chart_patch_execute_patch_checksum()
log_warning("Could not find checksum row for %s", chart_patch_file_1_name);
}
static enum song_data_path_format chart_patch_is_song_data_path(const wchar_t *path, wchar_t *song_id)
static enum song_data_path_format
chart_patch_is_song_data_path(const wchar_t *path, wchar_t *song_id)
{
log_assert(path);
log_assert(song_id);
// Song data path for 09 to 17
// data folder next to revision folder and working dir set to revision folder
// data folder next to revision folder and working dir set to revision
// folder
if (swscanf(
path,
// Ensure to match %lc and not %c to extract wide string chars
@ -328,19 +330,21 @@ static enum song_data_path_format chart_patch_is_song_data_path(const wchar_t *p
return SONG_DATA_PATH_INVALID;
}
static void chart_patch_get_song_chart_file_name(const wchar_t *song_id, wchar_t *chart_file_name)
static void chart_patch_get_song_chart_file_name(
const wchar_t *song_id, wchar_t *chart_file_name)
{
log_assert(song_id);
log_assert(chart_file_name);
log_assert(wcslen(song_id) == 4);
memcpy(chart_file_name, song_id, sizeof(wchar_t) * 4);
chart_file_name[4] = L'.';
chart_file_name[5] = L'1';
chart_file_name[6] = L'\0';
}
static enum song_data_file_type chart_patch_get_song_data_file_type(const wchar_t *path, const wchar_t *song_id)
static enum song_data_file_type
chart_patch_get_song_data_file_type(const wchar_t *path, const wchar_t *song_id)
{
wchar_t chart_file[7];
@ -360,75 +364,60 @@ static enum song_data_file_type chart_patch_get_song_data_file_type(const wchar_
return SONG_DATA_FILE_TYPE_UNKNKOWN;
}
static void chart_patch_get_path_dot_1_file(const wchar_t *song_id, enum song_data_path_format path_format, wchar_t *path)
static void chart_patch_get_path_dot_1_file(
const wchar_t *song_id,
enum song_data_path_format path_format,
wchar_t *path)
{
switch (path_format) {
case SONG_DATA_PATH_09_TO_17:
// Note: These use %s also for wide strings!
wsprintfW(
path,
L"..\\data\\sd_data\\%s\\%s.1",
song_id,
song_id);
wsprintfW(path, L"..\\data\\sd_data\\%s\\%s.1", song_id, song_id);
break;
case SONG_DATA_PATH_18:
// Note: These use %s also for wide strings!
wsprintfW(
path,
L".\\data\\sd_data\\%s\\%s.1",
song_id,
song_id);
wsprintfW(path, L".\\data\\sd_data\\%s\\%s.1", song_id, song_id);
break;
case SONG_DATA_PATH_19:
// Note: These use %s also for wide strings!
wsprintfW(
path,
L".\\data\\sound\\%s\\%s.1",
song_id,
song_id);
wsprintfW(path, L".\\data\\sound\\%s\\%s.1", song_id, song_id);
break;
case SONG_DATA_FILE_TYPE_UNKNKOWN:
default:
log_fatal("Illegal state");
break;
}
}
}
static void chart_patch_get_path_checksum_file(const wchar_t *song_id, enum song_data_path_format path_format, wchar_t *path)
static void chart_patch_get_path_checksum_file(
const wchar_t *song_id,
enum song_data_path_format path_format,
wchar_t *path)
{
switch (path_format) {
case SONG_DATA_PATH_09_TO_17:
// Note: These use %s also for wide strings!
wsprintfW(
path,
L"..\\data\\sd_data\\%s\\osprey.bin",
song_id);
wsprintfW(path, L"..\\data\\sd_data\\%s\\osprey.bin", song_id);
break;
case SONG_DATA_PATH_18:
// Note: These use %s also for wide strings!
wsprintfW(
path,
L".\\data\\sd_data\\%s\\osprey.bin",
song_id);
wsprintfW(path, L".\\data\\sd_data\\%s\\osprey.bin", song_id);
break;
case SONG_DATA_PATH_19:
// Note: These use %s also for wide strings!
wsprintfW(
path,
L".\\data\\sound\\%s\\osprey.bin",
song_id);
wsprintfW(path, L".\\data\\sound\\%s\\osprey.bin", song_id);
break;
case SONG_DATA_FILE_TYPE_UNKNKOWN:
default:
log_fatal("Illegal state");
break;
}
}
}
static bool chart_patch_file_trap(struct irp *irp)
@ -452,14 +441,20 @@ static bool chart_patch_file_trap(struct irp *irp)
files */
path_format = chart_patch_is_song_data_path(irp->open_filename, song_id);
if (path_format != SONG_DATA_PATH_INVALID) {
EnterCriticalSection(&chart_patch_lock);
file_type = chart_patch_get_song_data_file_type(irp->open_filename, song_id);
file_type =
chart_patch_get_song_data_file_type(irp->open_filename, song_id);
// %S for printing wide strings
log_misc("Trapping song ID %S, path format %d, file type %d, path %S", song_id, path_format, file_type, irp->open_filename);
log_misc(
"Trapping song ID %S, path format %d, file type %d, path %S",
song_id,
path_format,
file_type,
irp->open_filename);
/* Block a second open call to either .1 or checksum file if detouring
is already active */
@ -489,12 +484,16 @@ static bool chart_patch_file_trap(struct irp *irp)
return true;
}
if (file_type == SONG_DATA_FILE_TYPE_DOT_1 || file_type == SONG_DATA_FILE_TYPE_CHECKSUM) {
log_misc("Preparing in-memory chart data for song ID %S...", song_id);
if (file_type == SONG_DATA_FILE_TYPE_DOT_1 ||
file_type == SONG_DATA_FILE_TYPE_CHECKSUM) {
log_misc(
"Preparing in-memory chart data for song ID %S...", song_id);
chart_patch_get_song_chart_file_name(song_id, chart_file_name);
chart_patch_get_path_dot_1_file(song_id, path_format, buffer_1_path);
chart_patch_get_path_checksum_file(song_id, path_format, buffer_checksum_path);
chart_patch_get_path_dot_1_file(
song_id, path_format, buffer_1_path);
chart_patch_get_path_checksum_file(
song_id, path_format, buffer_checksum_path);
if (!chart_patch_file_load(
irp, &chart_patch_file_1, buffer_1_path)) {
@ -522,7 +521,7 @@ static bool chart_patch_file_trap(struct irp *irp)
break;
case SONG_DATA_FILE_TYPE_CHECKSUM:
irp->fd = chart_patch_file_checksum.fd;
irp->fd = chart_patch_file_checksum.fd;
chart_patch_file_checksum.active = true;
break;

View File

@ -8,7 +8,8 @@
#include "util/log.h"
#include "util/mem.h"
#define IIDXHOOK_UTIL_CONFIG_EZUSB_API_CALL_MONITORING_KEY "ezusb.api_call_monitoring"
#define IIDXHOOK_UTIL_CONFIG_EZUSB_API_CALL_MONITORING_KEY \
"ezusb.api_call_monitoring"
#define IIDXHOOK_UTIL_CONFIG_EZUSB_IO_BOARD_TYPE_KEY "ezusb.io_board_type"
#define IIDXHOOK_UTIL_CONFIG_EZUSB_DEFAULT_API_CALL_MONITORING_VALUE false

View File

@ -41,7 +41,7 @@ static void settings_build_new_path(
const char *orig_path, char *new_path, size_t new_path_len)
{
size_t settings_path_len;
char* orig_appended_path;
char *orig_appended_path;
settings_path_len = strlen(settings_path);
@ -50,13 +50,14 @@ static void settings_build_new_path(
strcpy(new_path, settings_path);
strcat(new_path, orig_path);
/* Fix only the part of the original path which comes after the leading settings path */
/* Fix only the part of the original path which comes after the leading
* settings path */
orig_appended_path = new_path + settings_path_len;
/* Duplicate \ in paths is fine because the win32 file API applies path
normalization */
/* Fixes some paths resulting in a mix of / and \ leading to crashes
/* Fixes some paths resulting in a mix of / and \ leading to crashes
on iidx 18 and 19, e.g. settings.bin saving in operator menu */
str_replace(orig_appended_path, '/', '\\');
@ -77,7 +78,10 @@ BOOL WINAPI my_CreateDirectoryA(
settings_build_new_path(lpPathName, new_path, sizeof(new_path));
log_misc("(CreateDir) Remapped settings path %s -> %s", lpPathName, new_path);
log_misc(
"(CreateDir) Remapped settings path %s -> %s",
lpPathName,
new_path);
return real_CreateDirectoryA(new_path, lpSecurityAttributes);
}

View File

@ -27,8 +27,8 @@
#include "iidxhook-util/chart-patch.h"
#include "iidxhook-util/clock.h"
#include "iidxhook-util/config-ezusb.h"
#include "iidxhook-util/config-eamuse.h"
#include "iidxhook-util/config-ezusb.h"
#include "iidxhook-util/config-gfx.h"
#include "iidxhook-util/config-misc.h"
#include "iidxhook-util/config-sec.h"

View File

@ -19,11 +19,11 @@
static int my_usbStart(int val);
static int my_usbSecurityInit();
static int my_usbSecuritySelectDone();
static int my_usbGetPCBID(char* buffer);
static int my_usbGetSecurity(char* buffer);
static int my_usbGetSecurityKey(char* buffer);
static int my_usbBootSecurity(
const char* boot_code, int seed_1, int seed_2, int seed_3);
static int my_usbGetPCBID(char *buffer);
static int my_usbGetSecurity(char *buffer);
static int my_usbGetSecurityKey(char *buffer);
static int
my_usbBootSecurity(const char *boot_code, int seed_1, int seed_2, int seed_3);
static int my_usbSetupSecurityComplete(int val1, int val2, int val3, int val4);
static int my_usbMute(int val);
static int my_usbFirmResult();
@ -31,12 +31,13 @@ static int my_usbFirmResult();
static int (*real_usbStart)(int val);
static int (*real_usbSecurityInit)();
static int (*real_usbSecuritySelectDone)();
static int (*real_usbGetPCBID)(char* buffer);
static int (*real_usbGetSecurity)(char* buffer);
static int (*real_usbGetSecurityKey)(char* buffer);
static int (*real_usbGetPCBID)(char *buffer);
static int (*real_usbGetSecurity)(char *buffer);
static int (*real_usbGetSecurityKey)(char *buffer);
static int (*real_usbBootSecurity)(
const char* boot_code, int seed_1, int seed_2, int seed_3);
static int (*real_usbSetupSecurityComplete)(int val1, int val2, int val3, int val4);
const char *boot_code, int seed_1, int seed_2, int seed_3);
static int (*real_usbSetupSecurityComplete)(
int val1, int val2, int val3, int val4);
static int (*real_usbMute)(int val);
static int (*real_usbFirmResult)();
@ -55,25 +56,23 @@ static const struct hook_symbol ezusb_mon_hook_syms[] = {
{.name = "usbGetPCBID",
.patch = my_usbGetPCBID,
.link = (void **) &real_usbGetPCBID},
{.name = "usbGetSecurity",
{.name = "usbGetSecurity",
.patch = my_usbGetSecurity,
.link = (void **) &real_usbGetSecurity},
{.name = "usbGetSecurity",
{.name = "usbGetSecurity",
.patch = my_usbGetSecurity,
.link = (void **) &real_usbGetSecurity},
{.name = "usbGetSecurityKey",
{.name = "usbGetSecurityKey",
.patch = my_usbGetSecurityKey,
.link = (void **) &real_usbGetSecurityKey},
{.name = "usbBootSecurity",
{.name = "usbBootSecurity",
.patch = my_usbBootSecurity,
.link = (void **) &real_usbBootSecurity},
{.name = "usbSetupSecurityComplete",
{.name = "usbSetupSecurityComplete",
.patch = my_usbSetupSecurityComplete,
.link = (void **) &real_usbSetupSecurityComplete},
{.name = "usbMute",
.patch = my_usbMute,
.link = (void **) &real_usbMute},
{.name = "usbFirmResult",
{.name = "usbMute", .patch = my_usbMute, .link = (void **) &real_usbMute},
{.name = "usbFirmResult",
.patch = my_usbFirmResult,
.link = (void **) &real_usbFirmResult},
};
@ -90,7 +89,7 @@ static int my_usbStart(int val)
log_misc("AFTER usbStart, res: %d", res);
return res;
return res;
}
static int my_usbSecurityInit()
@ -119,7 +118,7 @@ static int my_usbSecuritySelectDone()
return res;
}
static int my_usbGetPCBID(char* buffer)
static int my_usbGetPCBID(char *buffer)
{
int res;
@ -132,7 +131,7 @@ static int my_usbGetPCBID(char* buffer)
return res;
}
static int my_usbGetSecurity(char* buffer)
static int my_usbGetSecurity(char *buffer)
{
int res;
@ -145,7 +144,7 @@ static int my_usbGetSecurity(char* buffer)
return res;
}
static int my_usbGetSecurityKey(char* buffer)
static int my_usbGetSecurityKey(char *buffer)
{
int res;
@ -158,14 +157,17 @@ static int my_usbGetSecurityKey(char* buffer)
return res;
}
static int my_usbBootSecurity(
const char* boot_code, int seed_1, int seed_2, int seed_3)
static int
my_usbBootSecurity(const char *boot_code, int seed_1, int seed_2, int seed_3)
{
int res;
log_misc(
"BEFORE usbBootSecurity, boot_code %s, seed_1 %d, seed_2 %d, seed_3 %d",
boot_code, seed_1, seed_2, seed_3);
boot_code,
seed_1,
seed_2,
seed_3);
res = real_usbBootSecurity(boot_code, seed_1, seed_2, seed_3);
@ -180,7 +182,10 @@ static int my_usbSetupSecurityComplete(int val1, int val2, int val3, int val4)
log_misc(
"BEFORE usbSetupSecurityComplete, val1 %d, val2 %d, val3 %d, val4 %d",
val1, val2, val3, val4);
val1,
val2,
val3,
val4);
res = real_usbSetupSecurityComplete(val1, val2, val3, val4);

View File

@ -3,7 +3,7 @@
/**
* Monitor and log call traces of ezusb.dll calls.
*
*
* This only works on 9th and 10th Style that have the ezusb.dll linked
* dynamically. Any later version has the library linked staticly
*/

View File

@ -29,8 +29,8 @@
#include "iidxhook-util/acio.h"
#include "iidxhook-util/chart-patch.h"
#include "iidxhook-util/clock.h"
#include "iidxhook-util/config-ezusb.h"
#include "iidxhook-util/config-eamuse.h"
#include "iidxhook-util/config-ezusb.h"
#include "iidxhook-util/config-gfx.h"
#include "iidxhook-util/config-misc.h"
#include "iidxhook-util/config-sec.h"

View File

@ -12,8 +12,8 @@
#include "util/log.h"
#include "util/str.h"
static void* (*real_avs_fs_open)(const char* path, int mode, int flags);
static void* my_avs_fs_open(const char* path, int mode, int flags);
static void *(*real_avs_fs_open)(const char *path, int mode, int flags);
static void *my_avs_fs_open(const char *path, int mode, int flags);
static const struct hook_symbol iidxhook5_ifs_snd_redir_hook_syms[] = {
{.name = "XC058ba50000b6", // avs_fs_open
@ -21,9 +21,9 @@ static const struct hook_symbol iidxhook5_ifs_snd_redir_hook_syms[] = {
.link = (void **) &real_avs_fs_open},
};
static void* my_avs_fs_open(const char* path, int mode, int flags)
static void *my_avs_fs_open(const char *path, int mode, int flags)
{
void* handle;
void *handle;
char redir_path[MAX_PATH];
// Trap virtual path /sd00/*, /sd01/*, /sd02/*, /sd03/* that contain

View File

@ -21,7 +21,8 @@ static bool patch_memory_check_data(
for (size_t i = 0; i < len; i++) {
if (dest[i] != data_expected[i]) {
log_warning(
"Memcheck error: base %lluX + address %lluX + offset %d: expected %X, found %X",
"Memcheck error: base %lluX + address %lluX + offset %d: "
"expected %X, found %X",
(uint64_t) base_address,
(uint64_t) address,
// this cast is technically wrong