Apply clang-format code style to all source files

This commit is contained in:
icex2
2019-10-20 00:50:40 +02:00
parent c600e1a423
commit c3bc8782f4
401 changed files with 13844 additions and 11361 deletions
+14 -10
View File
@@ -8,25 +8,29 @@
#define IIDXHOOK_CONFIG_MISC_DEFAULT_DISTORTED_MS_BG_FIX_VALUE false
void iidxhook_config_iidxhook2_init(struct cconfig* config)
void iidxhook_config_iidxhook2_init(struct cconfig *config)
{
cconfig_util_set_bool(config,
cconfig_util_set_bool(
config,
IIDXHOOK_CONFIG_MISC_DISTORTED_MS_BG_FIX_KEY,
IIDXHOOK_CONFIG_MISC_DEFAULT_DISTORTED_MS_BG_FIX_VALUE,
"Fix broken 3D background on DistorteD's music select (if appearing "
"Fix broken 3D background on DistorteD's music select (if "
"appearing "
"completely black)");
}
void iidxhook_config_iidxhook2_get(
struct iidxhook_config_iidxhook2* config_iidxhook2,
struct cconfig* config)
struct iidxhook_config_iidxhook2 *config_iidxhook2, struct cconfig *config)
{
if (!cconfig_util_get_bool(config,
IIDXHOOK_CONFIG_MISC_DISTORTED_MS_BG_FIX_KEY,
&config_iidxhook2->distorted_ms_bg_fix,
if (!cconfig_util_get_bool(
config,
IIDXHOOK_CONFIG_MISC_DISTORTED_MS_BG_FIX_KEY,
&config_iidxhook2->distorted_ms_bg_fix,
IIDXHOOK_CONFIG_MISC_DEFAULT_DISTORTED_MS_BG_FIX_VALUE)) {
log_warning("Invalid value for key '%s' specified, fallback "
"to default '%d'", IIDXHOOK_CONFIG_MISC_DISTORTED_MS_BG_FIX_KEY,
log_warning(
"Invalid value for key '%s' specified, fallback "
"to default '%d'",
IIDXHOOK_CONFIG_MISC_DISTORTED_MS_BG_FIX_KEY,
IIDXHOOK_CONFIG_MISC_DEFAULT_DISTORTED_MS_BG_FIX_VALUE);
}
}
+2 -3
View File
@@ -7,10 +7,9 @@ struct iidxhook_config_iidxhook2 {
bool distorted_ms_bg_fix;
};
void iidxhook_config_iidxhook2_init(struct cconfig* config);
void iidxhook_config_iidxhook2_init(struct cconfig *config);
void iidxhook_config_iidxhook2_get(
struct iidxhook_config_iidxhook2* config_iidxhook2,
struct cconfig* config);
struct iidxhook_config_iidxhook2 *config_iidxhook2, struct cconfig *config);
#endif
+37 -31
View File
@@ -1,8 +1,8 @@
#include <windows.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdint.h>
#include <stdio.h>
#include "bemanitools/eamio.h"
#include "bemanitools/iidxio.h"
@@ -21,8 +21,8 @@
#include "hook/iohook.h"
#include "hook/table.h"
#include "hooklib/adapter.h"
#include "hooklib/acp.h"
#include "hooklib/adapter.h"
#include "hooklib/rs232.h"
#include "hooklib/setupapi.h"
@@ -44,7 +44,7 @@
#include "util/thread.h"
#define IIDXHOOK2_INFO_HEADER \
"iidxhook for DistorteD" \
"iidxhook for DistorteD" \
", build " __DATE__ " " __TIME__ ", gitrev " STRINGIFY(GITREV)
#define IIDXHOOK2_CMD_USAGE \
"Usage: inject.exe iidxhook2.dll <bm2dx.exe> [options...]"
@@ -61,24 +61,25 @@ static const hook_d3d9_irp_handler_t iidxhook_d3d9_handlers[] = {
};
static HANDLE STDCALL my_OpenProcess(DWORD, BOOL, DWORD);
static HANDLE (STDCALL *real_OpenProcess)(DWORD, BOOL, DWORD);
static HANDLE(STDCALL *real_OpenProcess)(DWORD, BOOL, DWORD);
static bool iidxhook_init_check;
static const struct hook_symbol init_hook_syms[] = {
{
.name = "OpenProcess",
.patch = my_OpenProcess,
.link = (void **) &real_OpenProcess
},
{.name = "OpenProcess",
.patch = my_OpenProcess,
.link = (void **) &real_OpenProcess},
};
static void iidxhook2_setup_d3d9_hooks(const struct iidxhook_config_gfx* config_gfx,
const struct iidxhook_config_iidxhook2* config_iidxhook2)
static void iidxhook2_setup_d3d9_hooks(
const struct iidxhook_config_gfx *config_gfx,
const struct iidxhook_config_iidxhook2 *config_iidxhook2)
{
struct iidxhook_util_d3d9_config d3d9_config;
log_warning("d3d8 hook module deprecated, using d3d9 hook modules requiring d3d8to9 to work!");
log_warning(
"d3d8 hook module deprecated, using d3d9 hook modules requiring "
"d3d8to9 to work!");
iidxhook_util_d3d9_init_config(&d3d9_config);
@@ -87,7 +88,8 @@ static void iidxhook2_setup_d3d9_hooks(const struct iidxhook_config_gfx* config_
d3d9_config.override_window_width = config_gfx->window_width;
d3d9_config.override_window_height = config_gfx->window_height;
d3d9_config.framerate_limit = config_gfx->frame_rate_limit;
d3d9_config.iidx13_fix_song_select_bg = config_iidxhook2->distorted_ms_bg_fix;
d3d9_config.iidx13_fix_song_select_bg =
config_iidxhook2->distorted_ms_bg_fix;
d3d9_config.iidx11_to_17_fix_uvs_bg_videos = config_gfx->bgvideo_uv_fix;
d3d9_config.scale_back_buffer_width = config_gfx->scale_back_buffer_width;
d3d9_config.scale_back_buffer_height = config_gfx->scale_back_buffer_height;
@@ -96,12 +98,17 @@ static void iidxhook2_setup_d3d9_hooks(const struct iidxhook_config_gfx* config_
if (config_gfx->monitor_check == 0) {
log_info("Auto monitor check enabled");
d3d9_config.iidx09_to_19_monitor_check_cb = iidxhook_util_chart_patch_set_refresh_rate;
iidxhook_util_chart_patch_init(IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_9_TO_13);
d3d9_config.iidx09_to_19_monitor_check_cb =
iidxhook_util_chart_patch_set_refresh_rate;
iidxhook_util_chart_patch_init(
IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_9_TO_13);
} else if (config_gfx->monitor_check > 0) {
log_info("Manual monitor check, resulting refresh rate: %f", config_gfx->monitor_check);
log_info(
"Manual monitor check, resulting refresh rate: %f",
config_gfx->monitor_check);
iidxhook_util_chart_patch_init(IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_9_TO_13);
iidxhook_util_chart_patch_init(
IIDXHOOK_UTIL_CHART_PATCH_TIMEBASE_9_TO_13);
iidxhook_util_chart_patch_set_refresh_rate(config_gfx->monitor_check);
}
@@ -114,10 +121,10 @@ static void iidxhook2_setup_d3d9_hooks(const struct iidxhook_config_gfx* config_
* This seems to be a good entry point to intercept
* before the game calls anything important
*/
HANDLE STDCALL my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle,
DWORD dwProcessId)
HANDLE STDCALL
my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId)
{
struct cconfig* config;
struct cconfig *config;
struct iidxhook_util_config_eamuse config_eamuse;
struct iidxhook_config_gfx config_gfx;
@@ -143,7 +150,10 @@ HANDLE STDCALL my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle,
iidxhook_config_misc_init(config);
iidxhook_config_sec_init(config);
if (!cconfig_hook_config_init(config, IIDXHOOK2_INFO_HEADER "\n" IIDXHOOK2_CMD_USAGE, CCONFIG_CMD_USAGE_OUT_DBG)) {
if (!cconfig_hook_config_init(
config,
IIDXHOOK2_INFO_HEADER "\n" IIDXHOOK2_CMD_USAGE,
CCONFIG_CMD_USAGE_OUT_DBG)) {
cconfig_finit(config);
exit(EXIT_FAILURE);
}
@@ -192,8 +202,8 @@ HANDLE STDCALL my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle,
/* Start up IIDXIO.DLL */
log_info("Starting IIDX IO backend");
iidx_io_set_loggers(log_impl_misc, log_impl_info, log_impl_warning,
log_impl_fatal);
iidx_io_set_loggers(
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
if (!iidx_io_init(thread_create, thread_join, thread_destroy)) {
log_fatal("Initializing IIDX IO backend failed");
@@ -202,8 +212,8 @@ HANDLE STDCALL my_OpenProcess(DWORD dwDesiredAccess, BOOL bInheritHandle,
/* Start up EAMIO.DLL */
log_misc("Initializing card reader backend");
eam_io_set_loggers(log_impl_misc, log_impl_info, log_impl_warning,
log_impl_fatal);
eam_io_set_loggers(
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
if (!eam_io_init(thread_create, thread_join, thread_destroy)) {
log_fatal("Initializing card reader backend failed");
@@ -236,7 +246,7 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
{
if (reason == DLL_PROCESS_ATTACH) {
#ifdef DEBUG_HOOKING
FILE* file = fopen("iidxhook.dllmain.log", "w+");
FILE *file = fopen("iidxhook.dllmain.log", "w+");
log_to_writer(log_writer_file, file);
#else
log_to_writer(log_writer_null, NULL);
@@ -245,10 +255,7 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
/* Bootstrap hook for further init tasks (see above) */
hook_table_apply(
NULL,
"kernel32.dll",
init_hook_syms,
lengthof(init_hook_syms));
NULL, "kernel32.dll", init_hook_syms, lengthof(init_hook_syms));
/* Actual hooks for game specific stuff */
@@ -268,4 +275,3 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
return TRUE;
}