From eb174fb8baa8410bfc617ab637eea2ee32cd8bde Mon Sep 17 00:00:00 2001 From: CrazyRedMachine Date: Sat, 23 Dec 2023 17:09:31 -0500 Subject: [PATCH] fix msvc compilation --- board/led15093.c | 4 ++-- hooklib/procaddr.c | 10 ++++++++-- meson.build | 23 +---------------------- 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/board/led15093.c b/board/led15093.c index 606ce276..153def99 100644 --- a/board/led15093.c +++ b/board/led15093.c @@ -440,8 +440,8 @@ static HRESULT led15093_req_set_timeout(int board, const struct led15093_req_set resp.cmd = LED_15093_CMD_SET_TIMEOUT; resp.report = v->report_code; - resp.count_upper = (req->count >> 8) & 0xff; - resp.count_lower = req->count & 0xff; + resp.count_upper = 0; + resp.count_lower = req->count; return led15093_frame_encode(&led15093_per_board_vars[board].boarduart.readable, &resp, sizeof(resp.hdr) + resp.hdr.nbytes); } diff --git a/hooklib/procaddr.c b/hooklib/procaddr.c index 2409f28c..69c296ba 100644 --- a/hooklib/procaddr.c +++ b/hooklib/procaddr.c @@ -1,7 +1,6 @@ #include #include #include -#include #include "hooklib/procaddr.h" @@ -83,6 +82,13 @@ static void proc_addr_hook_init(void) _countof(win32_hooks)); } +#define PATH_MAX 1024 +char *gnu_basename(char *path) +{ + char *base = strrchr(path, '/'); + return base ? base+1 : path; +} + FARPROC WINAPI my_GetProcAddress(HMODULE hModule, const char *name) { uintptr_t ordinal = (uintptr_t) name; @@ -92,7 +98,7 @@ FARPROC WINAPI my_GetProcAddress(HMODULE hModule, const char *name) FARPROC result = next_GetProcAddress(hModule, name); GetModuleFileNameA(hModule, mod_path, PATH_MAX); - mod_name = basename(mod_path); + mod_name = gnu_basename(mod_path); for (int i = 0; i < proc_addr_hook_count; i++) { diff --git a/meson.build b/meson.build index c4936be2..d2b7a07a 100644 --- a/meson.build +++ b/meson.build @@ -13,7 +13,6 @@ add_project_arguments( '-DWIN32_LEAN_AND_MEAN', '-D_WIN32_WINNT=_WIN32_WINNT_WIN7', '-DMINGW_HAS_SECURE_API=1', - '-Wno-unused', language: 'c', ) @@ -56,28 +55,8 @@ subdir('gfxhook') subdir('aimeio') subdir('chuniio') subdir('divaio') -subdir('carolio') -subdir('idzio') -subdir('idacio') -subdir('swdcio') -subdir('mu3io') -subdir('mai2io') -subdir('cmio') -subdir('mercuryio') -subdir('cxbio') -subdir('fgoio') subdir('chunihook') subdir('divahook') -subdir('carolhook') -subdir('idzhook') -subdir('idachook') -subdir('swdchook') -subdir('minihook') subdir('chusanhook') -subdir('mu3hook') -subdir('mai2hook') -subdir('cmhook') -subdir('mercuryhook') -subdir('cxbhook') -subdir('fgohook') +