From de285d7dbec39038c69c83b0518489e338a930aa Mon Sep 17 00:00:00 2001 From: Samuel Walker Date: Thu, 27 Mar 2025 17:20:57 -0600 Subject: [PATCH] Setup debug definition --- CMakeLists.txt | 3 ++- main.c | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a957779..080f915 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ cmake_minimum_required(VERSION 3.10) set(MAKE_TOOLCHAIN_FILE $PS2SDK/ps2dev.cmake) +set(CMAKE_C_FLAGS_DEBUG -DDEBUG) project(helloworld) add_executable(helloworld.elf main.c) -target_link_libraries(helloworld.elf -ldebug) \ No newline at end of file +target_link_libraries(helloworld.elf debug -ldebug) \ No newline at end of file diff --git a/main.c b/main.c index 11c1f12..17514ef 100644 --- a/main.c +++ b/main.c @@ -4,12 +4,20 @@ #include #include +void debug_msg(const char* msg) { +#ifdef DEBUG + scr_printf(msg); +#endif +} + int main() { +#ifdef DEBUG sceSifInitRpc(0); init_scr(); - scr_printf("Hello PS2!"); +#endif + debug_msg("Hello PS2!!!\n"); sleep(5); return 0;