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
+19 -18
View File
@@ -1,8 +1,8 @@
#include <windows.h>
#include <ntdef.h>
#include <devioctl.h>
#include <ntddser.h>
#include <ntdef.h>
#include <stdbool.h>
#include <stdint.h>
@@ -42,7 +42,8 @@ void ac_io_port_fini(void)
ac_io_emu_fini(&ac_io_emu);
}
HRESULT ac_io_port_dispatch_irp(struct irp *irp)
HRESULT
ac_io_port_dispatch_irp(struct irp *irp)
{
const struct ac_io_message *msg;
HRESULT hr;
@@ -63,31 +64,31 @@ HRESULT ac_io_port_dispatch_irp(struct irp *irp)
msg = ac_io_emu_request_peek(&ac_io_emu);
switch (msg->addr) {
case 0:
ac_io_emu_cmd_assign_addrs(&ac_io_emu, msg, 2);
case 0:
ac_io_emu_cmd_assign_addrs(&ac_io_emu, msg, 2);
break;
break;
case 1:
ac_io_emu_iccb_dispatch_request(&ac_io_emu_iccb, msg);
case 1:
ac_io_emu_iccb_dispatch_request(&ac_io_emu_iccb, msg);
break;
break;
case 2:
ac_io_emu_h44b_dispatch_request(&ac_io_emu_h44b, msg);
case 2:
ac_io_emu_h44b_dispatch_request(&ac_io_emu_h44b, msg);
break;
break;
case AC_IO_BROADCAST:
log_warning("Broadcast(?) message on jubeat ACIO bus?");
case AC_IO_BROADCAST:
log_warning("Broadcast(?) message on jubeat ACIO bus?");
break;
break;
default:
log_warning("ACIO message on unhandled bus address: %d",
msg->addr);
default:
log_warning(
"ACIO message on unhandled bus address: %d", msg->addr);
break;
break;
}
ac_io_emu_request_pop(&ac_io_emu);
+8 -22
View File
@@ -1,8 +1,8 @@
#include <windows.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "bemanitools/eamio.h"
@@ -52,15 +52,10 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
log_info("Starting up jubeat IO backend");
jb_io_set_loggers(
log_impl_misc,
log_impl_info,
log_impl_warning,
log_impl_fatal);
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
jb_io_ok = jb_io_init(
avs_thread_create,
avs_thread_join,
avs_thread_destroy);
jb_io_ok =
jb_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy);
if (!jb_io_ok) {
goto fail;
@@ -73,15 +68,10 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
log_info("Starting up card reader backend");
eam_io_set_loggers(
log_impl_misc,
log_impl_info,
log_impl_warning,
log_impl_fatal);
log_impl_misc, log_impl_info, log_impl_warning, log_impl_fatal);
eam_io_ok = eam_io_init(
avs_thread_create,
avs_thread_join,
avs_thread_destroy);
eam_io_ok =
eam_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy);
if (!eam_io_ok) {
goto fail;
@@ -136,10 +126,7 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
}
log_to_external(
log_body_misc,
log_body_info,
log_body_warning,
log_body_fatal);
log_body_misc, log_body_info, log_body_warning, log_body_fatal);
options_init_from_cmdline(&options);
@@ -159,4 +146,3 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
return TRUE;
}
+24 -16
View File
@@ -14,31 +14,42 @@
#include "util/log.h"
#include "util/str.h"
static const char* jbhook_eamuse_konami_url = "eamuse.konami.";
static const char *jbhook_eamuse_konami_url = "eamuse.konami.";
static int (STDCALL *real_getaddrinfo)(PCSTR pNodeName, PCSTR pServiceName,
const ADDRINFOA *pHints, PADDRINFOA *ppResult);
static int(STDCALL *real_getaddrinfo)(
PCSTR pNodeName,
PCSTR pServiceName,
const ADDRINFOA *pHints,
PADDRINFOA *ppResult);
static int STDCALL my_getaddrinfo(PCSTR pNodeName, PCSTR pServiceName,
const ADDRINFOA *pHints, PADDRINFOA *ppResult);
static int STDCALL my_getaddrinfo(
PCSTR pNodeName,
PCSTR pServiceName,
const ADDRINFOA *pHints,
PADDRINFOA *ppResult);
static const struct hook_symbol eamuse_hook_syms[] = {
{
.name = "getaddrinfo",
.ordinal = 176,
.patch = my_getaddrinfo,
.link = (void **) &real_getaddrinfo,
.name = "getaddrinfo",
.ordinal = 176,
.patch = my_getaddrinfo,
.link = (void **) &real_getaddrinfo,
},
};
static int STDCALL my_getaddrinfo(PCSTR pNodeName, PCSTR pServiceName,
const ADDRINFOA *pHints, PADDRINFOA *ppResult)
static int STDCALL my_getaddrinfo(
PCSTR pNodeName,
PCSTR pServiceName,
const ADDRINFOA *pHints,
PADDRINFOA *ppResult)
{
log_misc("my_getaddrinfo: %s, %s", pNodeName, pServiceName);
/* resolve eamuse.konami.fun/com to 127.0.0.1 to avoid lag spikes every
150 seconds which might happen in-game as well */
if (!strncmp(pNodeName, jbhook_eamuse_konami_url,
if (!strncmp(
pNodeName,
jbhook_eamuse_konami_url,
strlen(jbhook_eamuse_konami_url))) {
log_info("Resolve konami.eamuse.XXX -> localhost");
pNodeName = "localhost";
@@ -50,10 +61,7 @@ static int STDCALL my_getaddrinfo(PCSTR pNodeName, PCSTR pServiceName,
void jbhook_eamuse_hook_init(void)
{
hook_table_apply(
NULL,
"ws2_32.dll",
eamuse_hook_syms,
lengthof(eamuse_hook_syms));
NULL, "ws2_32.dll", eamuse_hook_syms, lengthof(eamuse_hook_syms));
log_info("Inserted eamuse hooks");
}
+35 -26
View File
@@ -17,30 +17,43 @@
#include "util/str.h"
#include "util/time.h"
static DWORD STDCALL my_GetGlyphOutline(HDC hdc, UINT uChar, UINT uFormat,
LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer,
const MAT2* lpmat2);
static DWORD STDCALL my_GetGlyphOutline(
HDC hdc,
UINT uChar,
UINT uFormat,
LPGLYPHMETRICS lpgm,
DWORD cbBuffer,
LPVOID lpvBuffer,
const MAT2 *lpmat2);
static DWORD (STDCALL* real_GetGlyphOutline)(HDC hdc, UINT uChar, UINT uFormat,
LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer,
const MAT2* lpmat2);
static DWORD(STDCALL *real_GetGlyphOutline)(
HDC hdc,
UINT uChar,
UINT uFormat,
LPGLYPHMETRICS lpgm,
DWORD cbBuffer,
LPVOID lpvBuffer,
const MAT2 *lpmat2);
static const struct hook_symbol gfx_hook_syms[] = {
{.name = "GetGlyphOutlineA",
.patch = my_GetGlyphOutline,
.link = (void **) &real_GetGlyphOutline},
{
.name = "GetGlyphOutlineA",
.patch = my_GetGlyphOutline,
.link = (void **) &real_GetGlyphOutline
},
{
.name = "IsDBCSLeadByteEx",
.patch = my_GetGlyphOutline, // !??
.link = (void **) &real_GetGlyphOutline // !??
.name = "IsDBCSLeadByteEx",
.patch = my_GetGlyphOutline, // !??
.link = (void **) &real_GetGlyphOutline // !??
},
};
static DWORD STDCALL my_GetGlyphOutline(HDC hdc, UINT uChar, UINT uFormat,
LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer,
const MAT2* lpmat2)
static DWORD STDCALL my_GetGlyphOutline(
HDC hdc,
UINT uChar,
UINT uFormat,
LPGLYPHMETRICS lpgm,
DWORD cbBuffer,
LPVOID lpvBuffer,
const MAT2 *lpmat2)
{
if (IsDBCSLeadByteEx(CP_ACP, uChar & 0xFF)) {
log_warning("!!!!!!!!");
@@ -50,20 +63,17 @@ static DWORD STDCALL my_GetGlyphOutline(HDC hdc, UINT uChar, UINT uFormat,
tmp[0] = uChar & 0xFF;
tmp[1] = (uChar >> 8) & 0xFF;
MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, tmp, 2, lpvBuffer, cbBuffer);
MultiByteToWideChar(
CP_ACP, MB_USEGLYPHCHARS, tmp, 2, lpvBuffer, cbBuffer);
}
return real_GetGlyphOutline(hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer,
lpmat2);
return real_GetGlyphOutline(
hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, lpmat2);
}
void gfx_hook_init(void)
{
hook_table_apply(
NULL,
"gdi32.dll",
gfx_hook_syms,
lengthof(gfx_hook_syms));
hook_table_apply(NULL, "gdi32.dll", gfx_hook_syms, lengthof(gfx_hook_syms));
log_info("Inserted gfx hooks");
}
@@ -71,4 +81,3 @@ void gfx_hook_init(void)
void gfx_set_windowed(bool framed)
{
}
+19 -13
View File
@@ -18,16 +18,19 @@ struct jbhook_io_p4io_outputs {
uint32_t outputs;
};
static void jbhook_io_jamma2_read(void* resp, uint32_t nbytes);
static uint32_t jbhook_command_handle(uint8_t cmd, const void* payload,
uint32_t payload_len, void* resp, uint32_t resp_max_len);
static void jbhook_io_jamma2_read(void *resp, uint32_t nbytes);
static uint32_t jbhook_command_handle(
uint8_t cmd,
const void *payload,
uint32_t payload_len,
void *resp,
uint32_t resp_max_len);
static const struct p4ioemu_device_msg_hook jbhook_io_msg = {
.jamma2_read = jbhook_io_jamma2_read,
.command_handle = jbhook_command_handle,
.roundplug_read_id = NULL,
.roundplug_read_mem = NULL
};
.roundplug_read_mem = NULL};
/*
0:0 ???
@@ -90,9 +93,9 @@ static const uint32_t jbhook_io_sys_button_mappings[] = {
(1 << 25),
};
static void jbhook_io_jamma2_read(void* resp, uint32_t nbytes)
static void jbhook_io_jamma2_read(void *resp, uint32_t nbytes)
{
uint32_t* inputs = (uint32_t*) resp;
uint32_t *inputs = (uint32_t *) resp;
uint16_t panels;
uint8_t buttons;
@@ -120,16 +123,19 @@ static void jbhook_io_jamma2_read(void* resp, uint32_t nbytes)
}
}
static uint32_t jbhook_command_handle(uint8_t cmd, const void* payload,
uint32_t payload_len, void* resp, uint32_t resp_max_len)
static uint32_t jbhook_command_handle(
uint8_t cmd,
const void *payload,
uint32_t payload_len,
void *resp,
uint32_t resp_max_len)
{
switch (cmd) {
case JUHOOK_IO_P4IO_CMD_OUTPUTS:
{
case JUHOOK_IO_P4IO_CMD_OUTPUTS: {
// const struct jbhook_io_p4io_outputs* req =
// (const struct jbhook_io_p4io_outputs*) payload;
//log_misc("JUHOOK_IO_P4IO_CMD_OUTPUTS: 0x%X", req->outputs);
// log_misc("JUHOOK_IO_P4IO_CMD_OUTPUTS: 0x%X", req->outputs);
/* coin blocker: off 0x20, on 0x00 */
@@ -143,7 +149,7 @@ static uint32_t jbhook_command_handle(uint8_t cmd, const void* payload,
}
}
const struct p4ioemu_device_msg_hook* jbhook_io_init(void)
const struct p4ioemu_device_msg_hook *jbhook_io_init(void)
{
return &jbhook_io_msg;
}
+1 -1
View File
@@ -3,6 +3,6 @@
#include "p4ioemu/device.h"
const struct p4ioemu_device_msg_hook* jbhook_io_init(void);
const struct p4ioemu_device_msg_hook *jbhook_io_init(void);
#endif
+25 -32
View File
@@ -2,9 +2,9 @@
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "util/cmdline.h"
#include "util/defs.h"
@@ -12,7 +12,7 @@
#include "util/log.h"
#include "util/str.h"
void options_init_from_cmdline(struct options* options)
void options_init_from_cmdline(struct options *options)
{
int argc;
char **argv;
@@ -22,7 +22,7 @@ void options_init_from_cmdline(struct options* options)
options_init(options);
ok = options_read_cmdline(options, argc, (const char**) argv);
ok = options_read_cmdline(options, argc, (const char **) argv);
args_free(argc, argv);
@@ -31,7 +31,7 @@ void options_init_from_cmdline(struct options* options)
}
}
void options_init(struct options* options)
void options_init(struct options *options)
{
options->windowed = false;
options->window_framed = false;
@@ -39,44 +39,37 @@ void options_init(struct options* options)
options->disable_cardemu = false;
}
bool options_read_cmdline(struct options* options, int argc,
const char **argv)
bool options_read_cmdline(struct options *options, int argc, const char **argv)
{
int i;
for (i = 0; i < argc; i++) {
if (argv[i][0] != '-') {
continue;
}
switch (argv[i][1]) {
case 'h':
{
case 'h': {
options_print_usage();
return false;
}
case 'w':
{
case 'w': {
options->windowed = true;
break;
}
case 'f':
{
case 'f': {
options->window_framed = true;
break;
}
case 'c':
{
case 'c': {
options->disable_cardemu = true;
break;
}
case 'p':
{
case 'p': {
options->disable_p4ioemu = true;
break;
}
@@ -88,22 +81,22 @@ bool options_read_cmdline(struct options* options, int argc,
void options_print_usage(void)
{
OutputDebugStringA(
"jbhook for jubeat, build " __DATE__ " " __TIME__ ", gitrev "
STRINGIFY(GITREV) "\n"
"Usage: launcher.exe -K jbhook.dll [game exec] <options> \n"
"\n"
" The following options can be specified after the game exec path:\n"
"\n"
" -h Print this usage message\n"
" -w Run the game windowed\n"
" -f Run the game in a framed window (needs -w option)\n"
" -c Disable card emulation (e.g. when running on a real cab)\n"
" -p Disable p4io emulation (e.g. when running on a real cab or on a bare p4io)\n"
);
OutputDebugStringA("jbhook for jubeat, build " __DATE__ " " __TIME__ ", gitrev " STRINGIFY(
GITREV) "\n"
"Usage: launcher.exe -K jbhook.dll [game exec] <options> \n"
"\n"
" The following options can be specified after the game exec path:\n"
"\n"
" -h Print this usage message\n"
" -w Run the game windowed\n"
" -f Run the game in a framed window (needs -w option)\n"
" -c Disable card emulation (e.g. when running on a "
"real cab)\n"
" -p Disable p4io emulation (e.g. when running on a "
"real cab or on a bare "
"p4io)\n");
}
void options_fini(struct options* options)
void options_fini(struct options *options)
{
}
+4 -5
View File
@@ -11,12 +11,11 @@ struct options {
bool disable_cardemu;
};
void options_init_from_cmdline(struct options* options);
void options_init_from_cmdline(struct options *options);
void options_init(struct options* options);
bool options_read_cmdline(struct options* options,
int argc, const char** argv);
void options_init(struct options *options);
bool options_read_cmdline(struct options *options, int argc, const char **argv);
void options_print_usage(void);
void options_fini(struct options* options);
void options_fini(struct options *options);
#endif