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
+5 -4
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>
@@ -40,7 +40,8 @@ void ac_io_bus_fini(void)
ac_io_emu_fini(&ac_io_emu);
}
HRESULT ac_io_bus_dispatch_irp(struct irp *irp)
HRESULT
ac_io_bus_dispatch_irp(struct irp *irp)
{
const struct ac_io_message *msg;
HRESULT hr;
@@ -82,8 +83,8 @@ HRESULT ac_io_bus_dispatch_irp(struct irp *irp)
break;
default:
log_warning("ACIO message on unhandled bus address: %d",
msg->addr);
log_warning(
"ACIO message on unhandled bus address: %d", msg->addr);
break;
}
+4 -14
View File
@@ -38,10 +38,7 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *config)
log_info("Starting up BeatStream IO backend");
bst_io_set_loggers(
log_body_misc,
log_body_info,
log_body_warning,
log_body_fatal);
log_body_misc, log_body_info, log_body_warning, log_body_fatal);
ok = bst_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy);
@@ -50,10 +47,7 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *config)
}
eam_io_set_loggers(
log_body_misc,
log_body_info,
log_body_warning,
log_body_fatal);
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);
@@ -102,14 +96,11 @@ BOOL WINAPI DllMain(HMODULE self, 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);
args_recover(&argc, &argv);
for (i = 1 ; i < argc ; i++) {
for (i = 1; i < argc; i++) {
if (argv[i][0] != '-') {
continue;
}
@@ -133,4 +124,3 @@ BOOL WINAPI DllMain(HMODULE self, DWORD reason, void *ctx)
return TRUE;
}
+20 -17
View File
@@ -1,5 +1,5 @@
#include <windows.h>
#include <d3d9.h>
#include <windows.h>
#include <stdbool.h>
@@ -13,25 +13,33 @@
#include "util/log.h"
static HRESULT STDCALL my_CreateDevice(
IDirect3D9 *self, UINT adapter, D3DDEVTYPE type, HWND hwnd, DWORD flags,
D3DPRESENT_PARAMETERS *pp, IDirect3DDevice9 **pdev);
IDirect3D9 *self,
UINT adapter,
D3DDEVTYPE type,
HWND hwnd,
DWORD flags,
D3DPRESENT_PARAMETERS *pp,
IDirect3DDevice9 **pdev);
static IDirect3D9 *STDCALL my_Direct3DCreate9(UINT sdk_ver);
static IDirect3D9 * (STDCALL *real_Direct3DCreate9)(UINT sdk_ver);
static IDirect3D9 *(STDCALL *real_Direct3DCreate9)(UINT sdk_ver);
static const struct hook_symbol gfx_hook_syms[] = {
{
.name = "Direct3DCreate9",
.patch = my_Direct3DCreate9,
.link = (void **) &real_Direct3DCreate9
},
{.name = "Direct3DCreate9",
.patch = my_Direct3DCreate9,
.link = (void **) &real_Direct3DCreate9},
};
static bool gfx_windowed;
static HRESULT STDCALL my_CreateDevice(
IDirect3D9 *self, UINT adapter, D3DDEVTYPE type, HWND hwnd, DWORD flags,
D3DPRESENT_PARAMETERS *pp, IDirect3DDevice9 **pdev)
IDirect3D9 *self,
UINT adapter,
D3DDEVTYPE type,
HWND hwnd,
DWORD flags,
D3DPRESENT_PARAMETERS *pp,
IDirect3DDevice9 **pdev)
{
IDirect3D9 *real = COM_PROXY_UNWRAP(self);
HRESULT hr;
@@ -67,11 +75,7 @@ static IDirect3D9 *STDCALL my_Direct3DCreate9(UINT sdk_ver)
void gfx_init(void)
{
hook_table_apply(
NULL,
"d3d9.dll",
gfx_hook_syms,
lengthof(gfx_hook_syms));
hook_table_apply(NULL, "d3d9.dll", gfx_hook_syms, lengthof(gfx_hook_syms));
log_info("Inserted graphics hooks");
}
@@ -80,4 +84,3 @@ void gfx_set_windowed(void)
{
gfx_windowed = true;
}
+29 -26
View File
@@ -30,40 +30,42 @@ void kfca_dispatch_request(const struct ac_io_message *req)
cmd_code = ac_io_u16(req->cmd.code);
switch (cmd_code) {
case AC_IO_CMD_GET_VERSION:
log_misc("AC_IO_CMD_GET_VERSION(%d)", req->addr);
kfca_send_version(req);
case AC_IO_CMD_GET_VERSION:
log_misc("AC_IO_CMD_GET_VERSION(%d)", req->addr);
kfca_send_version(req);
break;
break;
case AC_IO_CMD_START_UP:
log_misc("AC_IO_CMD_START_UP(%d)", req->addr);
kfca_report_status(req, 0x00);
case AC_IO_CMD_START_UP:
log_misc("AC_IO_CMD_START_UP(%d)", req->addr);
kfca_report_status(req, 0x00);
break;
break;
case AC_IO_CMD_KFCA_POLL:
kfca_poll(req);
case AC_IO_CMD_KFCA_POLL:
kfca_poll(req);
break;
break;
case AC_IO_CMD_KFCA_WATCHDOG:
log_misc("AC_IO_CMD_KFCA_WATCHDOG(%d)", req->addr);
kfca_report_status(req, 0x00);
case AC_IO_CMD_KFCA_WATCHDOG:
log_misc("AC_IO_CMD_KFCA_WATCHDOG(%d)", req->addr);
kfca_report_status(req, 0x00);
break;
break;
case AC_IO_CMD_KFCA_AMP_CONTROL:
log_misc("AC_IO_CMD_KFCA_AMP_CONTROL(%d)", req->addr);
kfca_report_nil(req);
case AC_IO_CMD_KFCA_AMP_CONTROL:
log_misc("AC_IO_CMD_KFCA_AMP_CONTROL(%d)", req->addr);
kfca_report_nil(req);
break;
break;
default:
log_warning("Unknown ACIO message %04x on KFCA mode, addr=%d",
cmd_code, req->addr);
default:
log_warning(
"Unknown ACIO message %04x on KFCA mode, addr=%d",
cmd_code,
req->addr);
break;
break;
}
}
@@ -80,8 +82,10 @@ static void kfca_send_version(const struct ac_io_message *req)
resp.cmd.version.major = 0x01;
resp.cmd.version.minor = 0x01;
resp.cmd.version.revision = 0x00;
memcpy(resp.cmd.version.product_code, "KFCA",
sizeof(resp.cmd.version.product_code));
memcpy(
resp.cmd.version.product_code,
"KFCA",
sizeof(resp.cmd.version.product_code));
strncpy(resp.cmd.version.date, __DATE__, sizeof(resp.cmd.version.date));
strncpy(resp.cmd.version.time, __TIME__, sizeof(resp.cmd.version.time));
@@ -133,4 +137,3 @@ static void kfca_poll(const struct ac_io_message *req)
ac_io_emu_response_push(kfca_ac_io_emu, &resp, 0);
}
+43 -41
View File
@@ -16,47 +16,43 @@
/* ------------------------------------------------------------------------- */
static HANDLE STDCALL my_CreateFileA(
LPCSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile);
LPCSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile);
static HANDLE (STDCALL *real_CreateFileA)(
LPCSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile);
static HANDLE(STDCALL *real_CreateFileA)(
LPCSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile);
/* ------------------------------------------------------------------------- */
static const struct hook_symbol settings_hook_syms[] = {
{
.name = "CreateFileA",
.patch = my_CreateFileA,
.link = (void **) &real_CreateFileA
},
{.name = "CreateFileA",
.patch = my_CreateFileA,
.link = (void **) &real_CreateFileA},
};
/* ------------------------------------------------------------------------- */
static HANDLE STDCALL my_CreateFileA(
LPCSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile)
LPCSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile)
{
if ( lpFileName != NULL &&
lpFileName[0] == 'e' &&
lpFileName[1] == ':') {
if (lpFileName != NULL && lpFileName[0] == 'e' && lpFileName[1] == ':') {
HANDLE handle;
char new_path[MAX_PATH];
@@ -64,28 +60,34 @@ static HANDLE STDCALL my_CreateFileA(
new_path[1] = '\\';
log_misc("Remapped settings path %s", new_path);
handle = real_CreateFileA(new_path, dwDesiredAccess, dwShareMode,
lpSecurityAttributes, dwCreationDisposition,
dwFlagsAndAttributes, hTemplateFile);
handle = real_CreateFileA(
new_path,
dwDesiredAccess,
dwShareMode,
lpSecurityAttributes,
dwCreationDisposition,
dwFlagsAndAttributes,
hTemplateFile);
return handle;
}
return real_CreateFileA(lpFileName, dwDesiredAccess, dwShareMode,
lpSecurityAttributes, dwCreationDisposition,
dwFlagsAndAttributes, hTemplateFile);
return real_CreateFileA(
lpFileName,
dwDesiredAccess,
dwShareMode,
lpSecurityAttributes,
dwCreationDisposition,
dwFlagsAndAttributes,
hTemplateFile);
}
/* ------------------------------------------------------------------------- */
void settings_hook_init(void)
{
hook_table_apply(
NULL,
"kernel32.dll",
settings_hook_syms,
lengthof(settings_hook_syms));
NULL, "kernel32.dll", settings_hook_syms, lengthof(settings_hook_syms));
log_info("Inserted settings hooks");
}