From 15658043aa77ec47a659e297e97ee8daa54ea5b2 Mon Sep 17 00:00:00 2001 From: BroGamer <64546358+BroGamer4256@users.noreply.github.com> Date: Wed, 22 Jun 2022 13:36:55 +1200 Subject: [PATCH] Fix build script --- Makefile | 2 ++ src/dllmain.c | 30 +++++++++++++++--------------- src/helpers.c | 2 +- src/poll.h | 2 ++ 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index ead7972..29ecd9a 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ options: ${TARGET}/%.o: %.c @echo BUILD $@ @${CC} -c ${CFLAGS} $< -o $@ + @clang-tidy -header-filter=.* -system-headers $< -- ${CFLAGS} .PHONY: SDL SDL: @@ -54,6 +55,7 @@ patches: dist-no-7z: options ${OUT} patches mkdir -p out/plugins cp ${TARGET}/${OUT}.dll out/ + mv out/${OUT}.dll out/bnusio.dll cp ${TARGET}/patches.*.dll out/plugins cp dist/* out/ diff --git a/src/dllmain.c b/src/dllmain.c index eaf67fb..94635c1 100644 --- a/src/dllmain.c +++ b/src/dllmain.c @@ -24,21 +24,21 @@ u16 drumMin = 0xFFFF; #define ON_HIT(bind) IsButtonTapped (bind) ? drumMax == drumMin ? drumMax : (u16)(rand () % drumMax + drumMin) : 0 -struct Keybindings EXIT = { .keycodes = { VK_ESCAPE } }; -struct Keybindings COIN_ADD = { .keycodes = { VK_RETURN }, .buttons = { SDL_CONTROLLER_BUTTON_START } }; -struct Keybindings TEST = { .keycodes = { VK_F1 } }; -struct Keybindings SERVICE = { .keycodes = { VK_F2 } }; -struct Keybindings DEBUG_UP = { .keycodes = { VK_UP } }; -struct Keybindings DEBUG_DOWN = { .keycodes = { VK_DOWN } }; -struct Keybindings DEBUG_ENTER = { .keycodes = { VK_RETURN } }; -struct Keybindings P1_LEFT_BLUE = { .keycodes = { 'D' } }; -struct Keybindings P1_LEFT_RED = { .keycodes = { 'F' } }; -struct Keybindings P1_RIGHT_RED = { .keycodes = { 'J' } }; -struct Keybindings P1_RIGHT_BLUE = { .keycodes = { 'K' } }; -struct Keybindings P2_LEFT_BLUE = {}; -struct Keybindings P2_LEFT_RED = {}; -struct Keybindings P2_RIGHT_RED = {}; -struct Keybindings P2_RIGHT_BLUE = {}; +Keybindings EXIT = { .keycodes = { VK_ESCAPE } }; +Keybindings COIN_ADD = { .keycodes = { VK_RETURN }, .buttons = { SDL_CONTROLLER_BUTTON_START } }; +Keybindings TEST = { .keycodes = { VK_F1 } }; +Keybindings SERVICE = { .keycodes = { VK_F2 } }; +Keybindings DEBUG_UP = { .keycodes = { VK_UP } }; +Keybindings DEBUG_DOWN = { .keycodes = { VK_DOWN } }; +Keybindings DEBUG_ENTER = { .keycodes = { VK_RETURN } }; +Keybindings P1_LEFT_BLUE = { .keycodes = { 'D' } }; +Keybindings P1_LEFT_RED = { .keycodes = { 'F' } }; +Keybindings P1_RIGHT_RED = { .keycodes = { 'J' } }; +Keybindings P1_RIGHT_BLUE = { .keycodes = { 'K' } }; +Keybindings P2_LEFT_BLUE = {}; +Keybindings P2_LEFT_RED = {}; +Keybindings P2_RIGHT_RED = {}; +Keybindings P2_RIGHT_BLUE = {}; u16 __fastcall bnusio_GetAnalogIn (u8 which) { switch (which) { diff --git a/src/helpers.c b/src/helpers.c index fec1515..6691c40 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -8,7 +8,7 @@ configPath (char *name) { static char buffer[MAX_PATH]; GetModuleFileNameA (NULL, buffer, MAX_PATH); *(strrchr (buffer, '\\') + 1) = 0; - strcat (buffer, name); + strcat_s (buffer, MAX_PATH, name); return buffer; } diff --git a/src/poll.h b/src/poll.h index afd5928..54d61ba 100644 --- a/src/poll.h +++ b/src/poll.h @@ -41,6 +41,8 @@ struct Keybindings { enum Scroll scroll[2]; }; +typedef struct Keybindings Keybindings; + enum EnumType { none, keycode, button, axis, scroll }; struct ConfigValue {