From 7003a9c8a33edc46ccc4b8e6f8cc983262e16ad0 Mon Sep 17 00:00:00 2001 From: emilyd Date: Fri, 21 Jul 2023 09:07:21 +0300 Subject: [PATCH 1/6] debug pause function --- source/debug.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 source/debug.c diff --git a/source/debug.c b/source/debug.c new file mode 100644 index 0000000..4267b1a --- /dev/null +++ b/source/debug.c @@ -0,0 +1,9 @@ +// debug features for libreshop_client +#include + +void debug_pause() { + while(1) { + WPAD_ScanPads(); + if (WPAD_ButtonsDown(0)) break; + } +} -- 2.30.2 From df309053898f36025098d7bccdb780e75a4e295f Mon Sep 17 00:00:00 2001 From: emilyd Date: Fri, 21 Jul 2023 09:07:34 +0300 Subject: [PATCH 2/6] debugging header file --- source/debug.h | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 source/debug.h diff --git a/source/debug.h b/source/debug.h new file mode 100644 index 0000000..d92d22b --- /dev/null +++ b/source/debug.h @@ -0,0 +1,6 @@ +#ifndef DEBUG_H +#define DEBUG_H + +void debug_pause(); + +#endif -- 2.30.2 From 630133f77a449e847b4aac7883af45a47de24697 Mon Sep 17 00:00:00 2001 From: emilyd Date: Fri, 21 Jul 2023 09:12:42 +0300 Subject: [PATCH 3/6] add commented out debug header to main.c --- source/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/main.c b/source/main.c index 2547f5a..95a5b22 100644 --- a/source/main.c +++ b/source/main.c @@ -6,6 +6,9 @@ #include "sandia/sandia.h" +// Uncomment if this is a development build +//#include "debug.h" + static void *xfb = NULL; static GXRModeObj *rmode = NULL; -- 2.30.2 From 51a1bf7f0e680febfaacb102be14d4def30182ff Mon Sep 17 00:00:00 2001 From: emilyd Date: Fri, 21 Jul 2023 09:31:35 +0300 Subject: [PATCH 4/6] add warning if user is on a debug build --- source/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/main.c b/source/main.c index 95a5b22..c9d9877 100644 --- a/source/main.c +++ b/source/main.c @@ -71,6 +71,9 @@ int main(int argc, char **argv) { printheader(); logprint(0, "Welcome to LibreShop!\n"); +#ifdef DEBUG_H + logprint(2, "Warning! You are running a DEBUG build.\n"); +#endif logprint(0, "Initializing network.\n"); ret = if_config(localip, netmask, gateway, TRUE, 20); -- 2.30.2 From d9593f3fa0063f1f332aeb8aea90b9804ecf2fb6 Mon Sep 17 00:00:00 2001 From: emilyd Date: Fri, 21 Jul 2023 09:32:06 +0300 Subject: [PATCH 5/6] add noisy debug_pause variation --- source/debug.c | 8 ++++++++ source/debug.h | 1 + 2 files changed, 9 insertions(+) diff --git a/source/debug.c b/source/debug.c index 4267b1a..e90429c 100644 --- a/source/debug.c +++ b/source/debug.c @@ -1,4 +1,6 @@ // debug features for libreshop_client +#include +#include #include void debug_pause() { @@ -7,3 +9,9 @@ void debug_pause() { if (WPAD_ButtonsDown(0)) break; } } + +void debug_npause() { + printf("Press any button to continue...\n"); + VIDEO_WaitVSync(); + debug_pause(); +} diff --git a/source/debug.h b/source/debug.h index d92d22b..4ba7dba 100644 --- a/source/debug.h +++ b/source/debug.h @@ -2,5 +2,6 @@ #define DEBUG_H void debug_pause(); +void debug_npause(); #endif -- 2.30.2 From 0ebd26d5612d5f3fa9b23ec9a63c7c2bb63ecd97 Mon Sep 17 00:00:00 2001 From: emilyd Date: Fri, 21 Jul 2023 09:33:58 +0300 Subject: [PATCH 6/6] add breaks to switch statement, oops... --- source/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/main.c b/source/main.c index c9d9877..cf9e66d 100644 --- a/source/main.c +++ b/source/main.c @@ -29,8 +29,10 @@ void logprint(int type, char *message) { break; case 2: printf("\x1b[34m[\x1b[31m--\x1b[34m]"); + break; case 3: printf("\x1b[31m!!\x1b[34m]"); + break; default: printf(" "); } -- 2.30.2