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
-1
View File
@@ -11,7 +11,6 @@
#define POPNHOOK1_CONFIG_GFX_WINDOW_WIDTH_KEY "gfx.window_width"
#define POPNHOOK1_CONFIG_GFX_WINDOW_HEIGHT_KEY "gfx.window_height"
#define POPNHOOK1_CONFIG_GFX_DEFAULT_FRAMED_VALUE false
#define POPNHOOK1_CONFIG_GFX_DEFAULT_WINDOWED_VALUE false
#define POPNHOOK1_CONFIG_GFX_DEFAULT_WINDOW_WIDTH_VALUE -1
+17 -21
View File
@@ -24,8 +24,8 @@ static const hook_d3d9_irp_handler_t popnhook1_d3d9_handlers[] = {
popnhook1_d3d9_irp_handler,
};
static void popnhook1_d3d9_validate_config(
const struct popnhook1_d3d9_config *config)
static void
popnhook1_d3d9_validate_config(const struct popnhook1_d3d9_config *config)
{
if (!config->windowed && config->framed) {
log_warning("Option framed does not have an effect without windowed");
@@ -58,8 +58,7 @@ void popnhook1_d3d9_init_config(struct popnhook1_d3d9_config *config)
config->texture_usage_fix = false;
}
void popnhook1_d3d9_configure(
const struct popnhook1_d3d9_config *config)
void popnhook1_d3d9_configure(const struct popnhook1_d3d9_config *config)
{
log_assert(config);
@@ -67,13 +66,10 @@ void popnhook1_d3d9_configure(
popnhook1_d3d9_validate_config(config);
memcpy(
&popnhook1_d3d9_config,
config,
sizeof(struct popnhook1_d3d9_config));
&popnhook1_d3d9_config, config, sizeof(struct popnhook1_d3d9_config));
}
static void
popnhook1_d3d9_fix_texture_usage(struct hook_d3d9_irp *irp)
static void popnhook1_d3d9_fix_texture_usage(struct hook_d3d9_irp *irp)
{
log_assert(irp);
log_assert(irp->op == HOOK_D3D9_IRP_OP_DEV_CREATE_TEXTURE);
@@ -82,14 +78,12 @@ popnhook1_d3d9_fix_texture_usage(struct hook_d3d9_irp *irp)
irp->args.dev_create_texture.usage = 0;
}
static void
popnhook1_d3d9_patch_window(struct hook_d3d9_irp *irp)
static void popnhook1_d3d9_patch_window(struct hook_d3d9_irp *irp)
{
log_assert(irp);
log_assert(irp->op == HOOK_D3D9_IRP_OP_CREATE_WINDOW_EX);
if (popnhook1_d3d9_config.windowed &&
popnhook1_d3d9_config.framed) {
if (popnhook1_d3d9_config.windowed && popnhook1_d3d9_config.framed) {
/* use a different style */
irp->args.create_window_ex.style |= WS_OVERLAPPEDWINDOW;
@@ -153,14 +147,12 @@ static void popnhook1_d3d9_calc_win_size_with_framed(
wp->cy = rect.bottom - rect.top;
}
static void
popnhook1_d3d9_fix_window_size_and_pos(struct hook_d3d9_irp *irp)
static void popnhook1_d3d9_fix_window_size_and_pos(struct hook_d3d9_irp *irp)
{
log_assert(irp);
log_assert(irp->op == HOOK_D3D9_IRP_OP_CREATE_WINDOW_EX);
if (popnhook1_d3d9_config.windowed &&
popnhook1_d3d9_config.framed) {
if (popnhook1_d3d9_config.windowed && popnhook1_d3d9_config.framed) {
/* we have to adjust the window size, because the window needs to be a
slightly bigger than the rendering resolution (window caption and
stuff is included in the window size) */
@@ -168,8 +160,12 @@ popnhook1_d3d9_fix_window_size_and_pos(struct hook_d3d9_irp *irp)
popnhook1_d3d9_calc_win_size_with_framed(
irp->args.create_window_ex.result,
irp->args.create_window_ex.x == CW_USEDEFAULT ? 0 : irp->args.create_window_ex.x,
irp->args.create_window_ex.y == CW_USEDEFAULT ? 0 : irp->args.create_window_ex.y,
irp->args.create_window_ex.x == CW_USEDEFAULT ?
0 :
irp->args.create_window_ex.x,
irp->args.create_window_ex.y == CW_USEDEFAULT ?
0 :
irp->args.create_window_ex.y,
irp->args.create_window_ex.width,
irp->args.create_window_ex.height,
&wp);
@@ -186,8 +182,8 @@ popnhook1_d3d9_fix_window_size_and_pos(struct hook_d3d9_irp *irp)
}
}
static void popnhook1_d3d9_fix_create_device_apply_window_mode(
struct hook_d3d9_irp *irp)
static void
popnhook1_d3d9_fix_create_device_apply_window_mode(struct hook_d3d9_irp *irp)
{
log_assert(irp);
log_assert(irp->op == HOOK_D3D9_IRP_OP_CTX_CREATE_DEVICE);
+2 -2
View File
@@ -28,8 +28,8 @@ struct popnhook1_d3d9_config {
uint16_t override_window_height;
/**
* Fix an issue with CreateTexture on later versions of Windows that prevents
* the games from launching.
* Fix an issue with CreateTexture on later versions of Windows that
* prevents the games from launching.
*/
bool texture_usage_fix;
};
+9 -7
View File
@@ -43,8 +43,8 @@
#include "security/rp-sign-key.h"
#define POPNHOOK1_INFO_HEADER \
"popnhook1 for pop'n music 15, 16, 17, 18" \
#define POPNHOOK1_INFO_HEADER \
"popnhook1 for pop'n music 15, 16, 17, 18" \
", build " __DATE__ " " __TIME__ ", gitrev " STRINGIFY(GITREV)
#define POPNHOOK1_CMD_USAGE \
"Usage: inject.exe popnhook1.dll <popn.exe> [options...]"
@@ -63,8 +63,7 @@ static const struct hook_symbol init_hook_syms[] = {
};
static void popnhook_setup_d3d9_hooks(
const struct popnhook1_config_gfx *config_gfx,
const bool texture_usage_fix)
const struct popnhook1_config_gfx *config_gfx, const bool texture_usage_fix)
{
struct popnhook1_d3d9_config d3d9_config;
@@ -119,9 +118,12 @@ static DWORD STDCALL my_GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo)
popnhook_setup_d3d9_hooks(
&config_gfx,
// pop'n music 16 requires a patch for the texture usage to not crash on newer Windows
memcmp(config_sec.black_plug_mcode.game, SECURITY_MCODE_GAME_POPN_16, sizeof(config_sec.black_plug_mcode.game)) == 0
);
// pop'n music 16 requires a patch for the texture usage to not crash on
// newer Windows
memcmp(
config_sec.black_plug_mcode.game,
SECURITY_MCODE_GAME_POPN_16,
sizeof(config_sec.black_plug_mcode.game)) == 0);
popnhook1_avs_boot_init();
popnhook1_avs_boot_set_eamuse_addr(&config_eamuse.server);
+11 -16
View File
@@ -24,9 +24,8 @@ static HANDLE STDCALL my_CreateFileA(
DWORD dwCreationDisposition,
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile);
static HANDLE STDCALL my_FindFirstFileA(
LPCSTR lpFileName,
LPWIN32_FIND_DATAA lpFindFileData);
static HANDLE STDCALL
my_FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
static HANDLE(STDCALL *real_CreateFileA)(
LPCSTR lpFileName,
@@ -37,8 +36,7 @@ static HANDLE(STDCALL *real_CreateFileA)(
DWORD dwFlagsAndAttributes,
HANDLE hTemplateFile);
static HANDLE(STDCALL *real_FindFirstFileA)(
LPCSTR lpFileName,
LPWIN32_FIND_DATAA lpFindFileData);
LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
/* ------------------------------------------------------------------------- */
@@ -55,8 +53,10 @@ static const struct hook_symbol settings_hook_syms[] = {
static char *popnhook1_filesystem_get_path(LPCSTR lpFileName)
{
if (lpFileName != NULL && (tolower(lpFileName[0]) == 'd' || tolower(lpFileName[0]) == 'e') && lpFileName[1] == ':') {
char *new_path = (char*)xmalloc(MAX_PATH);
if (lpFileName != NULL &&
(tolower(lpFileName[0]) == 'd' || tolower(lpFileName[0]) == 'e') &&
lpFileName[1] == ':') {
char *new_path = (char *) xmalloc(MAX_PATH);
char *data_ptr = strstr(lpFileName, "\\data\\");
if (data_ptr == NULL)
@@ -117,9 +117,8 @@ static HANDLE STDCALL my_CreateFileA(
return status;
}
static HANDLE STDCALL my_FindFirstFileA(
LPCSTR lpFileName,
LPWIN32_FIND_DATAA lpFindFileData)
static HANDLE STDCALL
my_FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
{
// pop'n 15 makes use of FindFirstFileA
char *new_path = popnhook1_filesystem_get_path(lpFileName);
@@ -127,14 +126,10 @@ static HANDLE STDCALL my_FindFirstFileA(
if (new_path != NULL) {
// log_misc("Remapped settings path 2 %s -> %s", lpFileName, new_path);
return real_FindFirstFileA(
new_path,
lpFindFileData);
return real_FindFirstFileA(new_path, lpFindFileData);
}
return real_FindFirstFileA(
lpFileName,
lpFindFileData);
return real_FindFirstFileA(lpFileName, lpFindFileData);
}
/* ------------------------------------------------------------------------- */