chore: Apply code formatting on entire codebase for consistent style

This commit is contained in:
icex2
2023-04-06 15:39:53 +02:00
committed by icex2
parent a1a849aef3
commit 031836ef0e
186 changed files with 2446 additions and 1979 deletions
+2 -1
View File
@@ -44,7 +44,8 @@ void jbhook_util_ac_io_port_fini(void)
ac_io_emu_fini(&ac_io_emu);
}
void jbhook_util_ac_io_set_iccb(void) {
void jbhook_util_ac_io_set_iccb(void)
{
ac_io_emu_icca_set_version(&ac_io_emu_icca, v150);
ac_io_emu_icca_set_product_code(&ac_io_emu_icca, AC_IO_EMU_PROD_CODE_ICCB);
}
+11 -15
View File
@@ -1,9 +1,9 @@
#define LOG_MODULE "eamuse-hook"
#include <iphlpapi.h>
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iphlpapi.h>
#include <stdbool.h>
#include <stdint.h>
@@ -30,11 +30,8 @@ static int STDCALL my_getaddrinfo(
const ADDRINFOA *pHints,
PADDRINFOA *ppResult);
static DWORD WINAPI my_GetIpAddrTable(
PMIB_IPADDRTABLE pIpAddrTable,
PULONG pdwSize,
BOOL bOrder
);
static DWORD WINAPI
my_GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable, PULONG pdwSize, BOOL bOrder);
static const struct hook_symbol eamuse_hook_syms[] = {
{
@@ -73,7 +70,8 @@ static int STDCALL my_getaddrinfo(
return real_getaddrinfo(pNodeName, pServiceName, pHints, ppResult);
}
static DWORD get_best_ip(void) {
static DWORD get_best_ip(void)
{
PIP_ADAPTER_INFO info = NULL;
struct net_addr addr;
// fallback to a very obviously wrong value
@@ -86,11 +84,11 @@ static DWORD get_best_ip(void) {
info = malloc(sz);
if(GetAdaptersInfo(info, &sz) != NO_ERROR) {
if (GetAdaptersInfo(info, &sz) != NO_ERROR) {
goto CLEANUP;
}
if(!net_str_parse(info->IpAddressList.IpAddress.String, &addr)) {
if (!net_str_parse(info->IpAddressList.IpAddress.String, &addr)) {
goto CLEANUP;
}
@@ -114,16 +112,14 @@ CLEANUP:
* check. By also hooking this function, the IP addresses of the two calls will
* agree.
*/
static DWORD WINAPI my_GetIpAddrTable(
PMIB_IPADDRTABLE pIpAddrTable,
PULONG pdwSize,
BOOL bOrder
) {
static DWORD WINAPI
my_GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable, PULONG pdwSize, BOOL bOrder)
{
ULONG in = *pdwSize;
// 1 element return table
*pdwSize = sizeof(MIB_IPADDRTABLE) + sizeof(MIB_IPADDRROW);
if(in < *pdwSize) {
if (in < *pdwSize) {
return ERROR_INSUFFICIENT_BUFFER;
}
+8 -8
View File
@@ -14,24 +14,24 @@ static UINT WINAPI hook_GetACP();
static UINT WINAPI hook_GetOEMCP();
static const struct hook_symbol locale_hook_syms[] = {
{.name = "GetOEMCP",
.patch = hook_GetACP},
{.name = "GetOEMCP",
.patch = hook_GetOEMCP},
{.name = "GetOEMCP", .patch = hook_GetACP},
{.name = "GetOEMCP", .patch = hook_GetOEMCP},
};
static UINT WINAPI hook_GetACP() {
static UINT WINAPI hook_GetACP()
{
return CODEPAGE_SHIFT_JIS;
}
static UINT WINAPI hook_GetOEMCP() {
static UINT WINAPI hook_GetOEMCP()
{
return CODEPAGE_SHIFT_JIS;
}
void jbhook_util_locale_hook_init(void)
{
hook_table_apply(NULL, "kernel32.dll", locale_hook_syms, lengthof(locale_hook_syms));
hook_table_apply(
NULL, "kernel32.dll", locale_hook_syms, lengthof(locale_hook_syms));
log_info("Inserted locale hooks");
}
+3 -3
View File
@@ -130,7 +130,7 @@ static uint32_t jbhook_command_handle(
// on is 0x00, off is either 0x10 or 0x20 depending on whether it's
// during gameplay (0x10) or test menu (0x20). Both seem to have the
// same effect
jb_io_set_coin_blocker(*(uint8_t*)payload == 0x00);
jb_io_set_coin_blocker(*(uint8_t *) payload == 0x00);
// this actually returns the coinstock, don't care for it
memset(resp, 0, 4);
@@ -145,8 +145,8 @@ static uint32_t jbhook_command_handle(
// always fallback to ALL if input is unknown
enum jb_io_panel_mode mode = JB_IO_PANEL_MODE_ALL;
if(req->is_single) {
switch(req->mode) {
if (req->is_single) {
switch (req->mode) {
case 0x0001:
mode = JB_IO_PANEL_MODE_TOP_LEFT;
break;