From 5472f3d13af21b4b639b23e8906b7ab0da411fad Mon Sep 17 00:00:00 2001 From: MysterD Date: Sat, 19 Sep 2020 02:12:49 -0700 Subject: [PATCH] Add development flag for easier testing --- Makefile | 8 ++++++++ compile.sh | 2 +- debug.sh | 2 +- network.sh | 4 ++-- src/pc/controller/controller_keyboard_debug.c | 4 +++- src/pc/network/network_player.c | 2 ++ 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ccca86e8..4cd3a0f8 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,8 @@ DISCORDRPC ?= 0 DISCORD_SDK ?= 1 # Enable docker build workarounds DOCKERBUILD ?= 0 +# Enable development/testing flags +DEVELOPMENT ?= 0 # Various workarounds for weird toolchains @@ -634,6 +636,12 @@ ifeq ($(DISCORD_SDK),1) CFLAGS += -DDISCORD_SDK endif +# Check for development option +ifeq ($(DEVELOPMENT),1) + CC_CHECK += -DDEVELOPMENT + CFLAGS += -DDEVELOPMENT +endif + # Check for texture fix option ifeq ($(TEXTURE_FIX),1) CC_CHECK += -DTEXTURE_FIX diff --git a/compile.sh b/compile.sh index e1432f75..454cc17d 100644 --- a/compile.sh +++ b/compile.sh @@ -1 +1 @@ -make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 STRICT=1 && winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break debug_breakpoint_here' -ex 'run' -ex 'quit' \ No newline at end of file +make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 DEVELOPMENT=1 STRICT=1 && winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break debug_breakpoint_here' -ex 'run' -ex 'quit' \ No newline at end of file diff --git a/debug.sh b/debug.sh index 252afdd6..fc99454e 100644 --- a/debug.sh +++ b/debug.sh @@ -1 +1 @@ -make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 STRICT=1 && winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break debug_breakpoint_here' \ No newline at end of file +make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 DEVELOPMENT=1 STRICT=1 && winpty cgdb ./build/us_pc/sm64.us.f3dex2e.exe -ex 'break debug_breakpoint_here' \ No newline at end of file diff --git a/network.sh b/network.sh index 7a5c0434..97e9b5dc 100755 --- a/network.sh +++ b/network.sh @@ -1,8 +1,8 @@ set -e if [ $# -eq 0 ]; then - make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 STRICT=1 -j + make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 DEVELOPMENT=1 STRICT=1 -j else - make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 -j + make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 DEVELOPMENT=1 -j fi # find file diff --git a/src/pc/controller/controller_keyboard_debug.c b/src/pc/controller/controller_keyboard_debug.c index f2ec4836..19aa6295 100644 --- a/src/pc/controller/controller_keyboard_debug.c +++ b/src/pc/controller/controller_keyboard_debug.c @@ -5,7 +5,7 @@ #ifdef DEBUG -static u8 warpToLevel = LEVEL_LLL; +static u8 warpToLevel = LEVEL_CCM; #define SCANCODE_0 0x0B #define SCANCODE_3 0x04 @@ -98,9 +98,11 @@ void debug_keyboard_on_key_down(int scancode) { scancode = scancode; switch (scancode) { case SCANCODE_3: debug_breakpoint_here(); break; +#ifdef DEVELOPMENT case SCANCODE_6: debug_warp_level(warpToLevel); break; case SCANCODE_7: debug_warp_area(); break; case SCANCODE_0: debug_suicide(); break; +#endif } } diff --git a/src/pc/network/network_player.c b/src/pc/network/network_player.c index c7ea8bec..8885392c 100644 --- a/src/pc/network/network_player.c +++ b/src/pc/network/network_player.c @@ -20,6 +20,7 @@ void network_player_update(void) { network_send_keep_alive(); } +#ifndef DEVELOPMENT if (gNetworkType == NT_SERVER) { for (int i = 1; i < MAX_PLAYERS; i++) { struct NetworkPlayer* np = &gNetworkPlayers[i]; @@ -44,6 +45,7 @@ void network_player_update(void) { network_shutdown(); } } +#endif } u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex) {