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 -19
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;
@@ -61,32 +62,31 @@ HRESULT ac_io_bus_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_icca_dispatch_request(&ac_io_emu_icca, msg);
case 1:
ac_io_emu_icca_dispatch_request(&ac_io_emu_icca, msg);
break;
break;
case 2:
kfca_dispatch_request(msg);
case 2:
kfca_dispatch_request(msg);
break;
break;
case AC_IO_BROADCAST:
log_warning("Broadcast(?) message on SDVX ACIO bus?");
case AC_IO_BROADCAST:
log_warning("Broadcast(?) message on SDVX 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);
+5 -15
View File
@@ -12,8 +12,8 @@
#include "hooklib/rs232.h"
#include "sdvxhook/acio.h"
#include "sdvxhook/lcd.h"
#include "sdvxhook/gfx.h"
#include "sdvxhook/lcd.h"
#include "util/cmdline.h"
#include "util/defs.h"
@@ -38,10 +38,7 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *config)
log_info("Starting up SDVX IO backend");
sdvx_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 = sdvx_io_init(avs_thread_create, avs_thread_join, avs_thread_destroy);
@@ -52,10 +49,7 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *config)
log_info("Starting up card reader backend");
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);
@@ -104,14 +98,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;
}
@@ -140,4 +131,3 @@ BOOL WINAPI DllMain(HMODULE self, DWORD reason, void *ctx)
return TRUE;
}
+23 -16
View File
@@ -1,5 +1,5 @@
#include <windows.h>
#include <d3d9.h>
#include <windows.h>
#include <stdbool.h>
@@ -12,22 +12,25 @@
#include "util/defs.h"
#include "util/log.h"
static LRESULT CALLBACK my_WndProc(HWND hwnd, UINT msg, WPARAM wparam,
LPARAM lparam);
static LRESULT CALLBACK
my_WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
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 WNDPROC real_WndProc;
static IDirect3D9 * (STDCALL *real_Direct3DCreate9)(UINT sdk_ver);
static IDirect3D9 *(STDCALL *real_Direct3DCreate9)(UINT sdk_ver);
static const struct hook_symbol gfx_hooks[] = {
{
.name = "Direct3DCreate9",
.patch = my_Direct3DCreate9,
.link = (void **) &real_Direct3DCreate9
},
{.name = "Direct3DCreate9",
.patch = my_Direct3DCreate9,
.link = (void **) &real_Direct3DCreate9},
};
static bool gfx_confined;
@@ -64,8 +67,8 @@ static LRESULT gfx_unconfine(HWND hwnd)
return TRUE;
}
static LRESULT CALLBACK my_WndProc(HWND hwnd, UINT msg, WPARAM wparam,
LPARAM lparam)
static LRESULT CALLBACK
my_WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
switch (msg) {
case WM_SETFOCUS:
@@ -80,8 +83,13 @@ static LRESULT CALLBACK my_WndProc(HWND hwnd, UINT msg, WPARAM wparam,
}
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;
@@ -136,4 +144,3 @@ void gfx_set_windowed(void)
{
gfx_windowed = true;
}
+33 -32
View File
@@ -35,40 +35,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_0128(req);
case AC_IO_CMD_KFCA_AMP_CONTROL:
log_misc("AC_IO_CMD_KFCA_AMP_CONTROL(%d)", req->addr);
kfca_report_0128(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;
}
}
@@ -85,8 +87,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));
@@ -106,7 +110,8 @@ static void kfca_report_status(const struct ac_io_message *req, uint8_t status)
ac_io_emu_response_push(kfca_ac_io_emu, &resp, 0);
}
static void kfca_report_0128(const struct ac_io_message *req) {
static void kfca_report_0128(const struct ac_io_message *req)
{
struct ac_io_message resp;
resp.addr = req->addr | AC_IO_RESPONSE_FLAG;
@@ -132,7 +137,7 @@ static void kfca_poll(const struct ac_io_message *req)
sdvx_io_set_gpio_lights(ac_io_u32(pout->gpio));
for (i = 0 ; i < lengthof(pout->pwm) ; i++) {
for (i = 0; i < lengthof(pout->pwm); i++) {
sdvx_io_set_pwm_light(i, pout->pwm[i]);
}
@@ -148,10 +153,7 @@ static void kfca_poll(const struct ac_io_message *req)
ctx = req->addr | (req->cmd.code << 8) | (req->cmd.seq_no << 24);
ac_io_emu_response_push_thunk(
kfca_ac_io_emu,
kfca_poll_thunk,
(void *) ctx,
delay);
kfca_ac_io_emu, kfca_poll_thunk, (void *) ctx, delay);
}
static void kfca_poll_thunk(void *ctx_ptr, struct ac_io_message *resp)
@@ -192,4 +194,3 @@ static void kfca_poll_thunk(void *ctx_ptr, struct ac_io_message *resp)
pin->gpio[0] = ac_io_u16(sdvx_io_get_input_gpio(0));
pin->gpio[1] = ac_io_u16(sdvx_io_get_input_gpio(1));
}
+15 -9
View File
@@ -2,9 +2,9 @@
#include <windows.h>
#include <ntdef.h>
#include <devioctl.h>
#include <ntddser.h>
#include <ntdef.h>
#include <stdbool.h>
#include <string.h>
@@ -41,7 +41,8 @@ void lcd_fini(void)
lcd_fd = NULL;
}
HRESULT lcd_dispatch_irp(struct irp *irp)
HRESULT
lcd_dispatch_irp(struct irp *irp)
{
log_assert(irp != NULL);
@@ -50,12 +51,18 @@ HRESULT lcd_dispatch_irp(struct irp *irp)
}
switch (irp->op) {
case IRP_OP_OPEN: return lcd_open(irp);
case IRP_OP_CLOSE: return lcd_close(irp);
case IRP_OP_READ: return S_OK;
case IRP_OP_WRITE: return lcd_write(irp);
case IRP_OP_IOCTL: return S_OK;
default: return E_NOTIMPL;
case IRP_OP_OPEN:
return lcd_open(irp);
case IRP_OP_CLOSE:
return lcd_close(irp);
case IRP_OP_READ:
return S_OK;
case IRP_OP_WRITE:
return lcd_write(irp);
case IRP_OP_IOCTL:
return S_OK;
default:
return E_NOTIMPL;
}
}
@@ -102,4 +109,3 @@ static HRESULT lcd_write(struct irp *irp)
return S_OK;
}