diff --git a/game/kernel/kdgo.cpp b/game/kernel/kdgo.cpp index d5627a1ff..f92679519 100644 --- a/game/kernel/kdgo.cpp +++ b/game/kernel/kdgo.cpp @@ -176,10 +176,8 @@ void BeginLoadingDGO(const char* name, Ptr buffer1, Ptr buffer2, Ptr // file name strcpy(sMsg[msgID].name, name); - // printf("[Begin Loading DGO RPC] %s, 0x%x, 0x%x, 0x%x\n", name, buffer1.offset, buffer2.offset, - // currentHeap.offset); - spdlog::info("[Begin Loading DGO RPC] {}, 0x{}, 0x{}, 0x{}", name, buffer1.offset, buffer2.offset, - currentHeap.offset); + spdlog::debug("[Begin Loading DGO RPC] {}, 0x{}, 0x{}, 0x{}", name, buffer1.offset, + buffer2.offset, currentHeap.offset); // this RPC will return once we have loaded the first object file. // but we call async, so we don't block here. RpcCall(DGO_RPC_CHANNEL, DGO_RPC_LOAD_FNO, true, mess, sizeof(RPC_Dgo_Cmd), mess, @@ -301,8 +299,7 @@ void load_and_link_dgo(u64 name_gstr, u64 heap_info, u64 flag, u64 buffer_size) * This does not use the mutli-threaded linker and will block until the entire file is done.e */ void load_and_link_dgo_from_c(const char* name, Ptr heap, u32 linkFlag, s32 bufferSize) { - // printf("[Load and Link DGO From C] %s\n", name); - spdlog::info("[Load and Link DGO From C] {}", name); + spdlog::debug("[Load and Link DGO From C] {}", name); u32 oldShowStall = sShowStallMsg; // remember where the heap top point is so we can clear temporary allocations @@ -351,8 +348,7 @@ void load_and_link_dgo_from_c(const char* name, Ptr heap, u32 linkFla char objName[64]; strcpy(objName, (dgoObj + 4).cast().c()); // name from dgo object header - // printf("[link and exec] %s %d\n", objName, lastObjectLoaded); - spdlog::info("[link and exec] {} {}", objName, lastObjectLoaded); + spdlog::debug("[link and exec] {} {}", objName, lastObjectLoaded); link_and_exec(obj, objName, objSize, heap, linkFlag); // link now! // inform IOP we are done diff --git a/game/kernel/kmachine.cpp b/game/kernel/kmachine.cpp index 3514aeb97..fddc0e087 100644 --- a/game/kernel/kmachine.cpp +++ b/game/kernel/kmachine.cpp @@ -148,15 +148,12 @@ void InitParms(int argc, const char* const* argv) { * DONE, EXACT */ void InitCD() { - // printf("Initializing CD drive\nThis may take a while ...\n"); - spdlog::debug("Initializing CD drive\nThis may take a while...\n"); + spdlog::info("Initializing CD drive\nThis may take a while...\n"); sceCdInit(SCECdINIT); sceCdMmode(SCECdDVD); while (sceCdDiskReady(0) == SCECdNotReady) { - // printf("Drive not ready ... insert a disk!\n"); spdlog::debug("Drive not ready... insert a disk!\n"); } - // printf("Disk type %d\n", sceCdGetDiskType()); spdlog::debug("Disk type {}\n", sceCdGetDiskType()); } @@ -175,27 +172,21 @@ void InitIOP() { if (!reboot) { // reboot with development IOP kernel - // printf("Rebooting IOP...\n"); spdlog::debug("Rebooting IOP..."); while (!sceSifRebootIop("host0:/usr/local/sce/iop/modules/ioprp221.img")) { - // printf("Failed, retrying...\n"); spdlog::debug("Failed, retrying"); } while (!sceSifSyncIop()) { - // printf("Syncing...\n"); spdlog::debug("Syncing..."); } } else { // reboot with IOP kernel off of the disk // reboot with development IOP kernel - // printf("Rebooting IOP...\n"); spdlog::debug("Rebooting IOP..."); while (!sceSifRebootIop("cdrom0:\\DRIVERS\\IOPRP221.IMG;1")) { - // printf("Failed, retrying...\n"); spdlog::debug("Failed, retrying"); } while (!sceSifSyncIop()) { - // printf("Syncing...\n"); spdlog::debug("Syncing..."); } } @@ -247,7 +238,6 @@ void InitIOP() { sceSifLoadModule("host0:/usr/home/src/989snd10/iop/989ERR.IRX", 0, nullptr); - // printf("Initializing CD library\n"); spdlog::debug("Initializing CD library..."); auto rv = sceSifLoadModule("host0:binee/overlord.irx", cmd + len + 1 - overlord_boot_command, overlord_boot_command); @@ -280,7 +270,6 @@ void InitIOP() { MsgErr("loading 989snd.irx failed\n"); } - // printf("Initializing CD library in ISO_CD mode\n"); spdlog::debug("Initializing CD library in ISO_CD mode..."); auto rv = sceSifLoadModule("cdrom0:\\\\DRIVERS\\\\OVERLORD.IRX;1", cmd + len + 1 - overlord_boot_command, overlord_boot_command); @@ -292,8 +281,7 @@ void InitIOP() { if (rv < 0) { MsgErr("MC driver init failed %d\n", rv); } else { - // printf("InitIOP OK\n"); - spdlog::debug("InitIOP OK"); + spdlog::info("InitIOP OK"); } } @@ -314,8 +302,6 @@ int InitMachine() { // initialize the global heap u32 global_heap_size = GLOBAL_HEAP_END - HEAP_START; float size_mb = ((float)global_heap_size) / (float)(1 << 20); - // printf("gkernel: global heap - 0x%x to 0x%x (size %.3f MB)\n", HEAP_START, GLOBAL_HEAP_END, - // size_mb); spdlog::info("gkernel: global heap 0x{} to 0x{} (size {} MB)", HEAP_START, GLOBAL_HEAP_END, size_mb); kinitheap(kglobalheap, Ptr(HEAP_START), global_heap_size); @@ -326,8 +312,6 @@ int InitMachine() { kinitheap(kdebugheap, Ptr(DEBUG_HEAP_START), debug_heap_size); float debug_size_mb = ((float)debug_heap_size) / (float)(1 << 20); float gap_size_mb = ((float)DEBUG_HEAP_START - GLOBAL_HEAP_END) / (float)(1 << 20); - // printf("gkernel: debug heap - 0x%x to 0x%x (size %.3f MB, gap %.3f MB)\n", DEBUG_HEAP_START, - // debug_heap_end, debug_size_mb, gap_size_mb); spdlog::info("gkernel: global heap 0x{} to 0x{} (size {} MB, gap {} MB)", DEBUG_HEAP_START, debug_heap_end, debug_size_mb, gap_size_mb); } else { @@ -354,10 +338,8 @@ int InitMachine() { InitGoalProto(); } - // printf("InitSound\n"); spdlog::info("InitSound"); InitSound(); // do nothing! - // printf("InitRPC\n"); spdlog::info("InitRPC"); InitRPC(); // connect to IOP reset_output(); // reset output buffers @@ -369,10 +351,8 @@ int InitMachine() { } spdlog::info("InitListenerConnect"); - // printf("InitListenerConnect\n"); InitListenerConnect(); spdlog::info("InitCheckListener"); - // printf("InitCheckListener\n"); InitCheckListener(); Msg(6, "kernel: machine started\n"); return 0; diff --git a/game/main.cpp b/game/main.cpp index ae662742d..b8dc08cfb 100644 --- a/game/main.cpp +++ b/game/main.cpp @@ -11,11 +11,8 @@ int main(int argc, char** argv) { while (true) { spdlog::set_level(spdlog::level::debug); - spdlog::info("spdlog initialized"); - spdlog::debug("This is a debug-only message"); // run the runtime in a loop so we can reset the game and have it restart cleanly - // printf("gk %d.%d\n", versions::GOAL_VERSION_MAJOR, versions::GOAL_VERSION_MINOR); - spdlog::debug("gk {}.{} OK!\n", versions::GOAL_VERSION_MAJOR, versions::GOAL_VERSION_MINOR); + spdlog::info("gk {}.{} OK!\n", versions::GOAL_VERSION_MAJOR, versions::GOAL_VERSION_MINOR); if (exec_runtime(argc, argv) == 2) { return 0; diff --git a/game/overlord/fake_iso.cpp b/game/overlord/fake_iso.cpp index 50273a010..3dd867194 100644 --- a/game/overlord/fake_iso.cpp +++ b/game/overlord/fake_iso.cpp @@ -217,7 +217,7 @@ uint32_t FS_GetLength(FileRecord* fr) { */ LoadStackEntry* FS_Open(FileRecord* fr, int32_t offset) { // printf("[OVERLORD] FS Open %s\n", fr->name); // Added - spdlog::info("[OVERLORD] FS Open {}", fr->name); + spdlog::debug("[OVERLORD] FS Open {}", fr->name); LoadStackEntry* selected = nullptr; // find first unused spot on load stack. for (uint32_t i = 0; i < MAX_OPEN_FILES; i++) { @@ -244,7 +244,7 @@ LoadStackEntry* FS_Open(FileRecord* fr, int32_t offset) { */ LoadStackEntry* FS_OpenWad(FileRecord* fr, int32_t offset) { // printf("[OVERLORD] FS Open %s\n", fr->name); // Added - spdlog::info("[OVERLORD] FS_OpenWad {}", fr->name); + spdlog::debug("[OVERLORD] FS_OpenWad {}", fr->name); LoadStackEntry* selected = nullptr; for (uint32_t i = 0; i < MAX_OPEN_FILES; i++) { if (!sLoadStack[i].fr) { @@ -266,7 +266,7 @@ LoadStackEntry* FS_OpenWad(FileRecord* fr, int32_t offset) { */ void FS_Close(LoadStackEntry* fd) { // printf("[OVERLORD] FS Close %s\n", fd->fr->name); - spdlog::info("[OVERLORD] FS_Close {}", fd->fr->name); + spdlog::debug("[OVERLORD] FS_Close {}", fd->fr->name); // close the FD fd->fr = nullptr; diff --git a/game/overlord/iso_api.cpp b/game/overlord/iso_api.cpp index 65a7cf8f4..3ea3f3703 100644 --- a/game/overlord/iso_api.cpp +++ b/game/overlord/iso_api.cpp @@ -9,7 +9,7 @@ using namespace iop; */ void LoadISOFileToIOP(FileRecord* file, void* addr, uint32_t length) { // printf("[OVERLORD] LoadISOFileToIOP %s, %d/%d bytes\n", file->name, length, file->size); - spdlog::info("[OVERLORD] LoadISOFileToIOP {}, {}/{} bytes", file->name, length, file->size); + spdlog::debug("[OVERLORD] LoadISOFileToIOP {}, {}/{} bytes", file->name, length, file->size); IsoCommandLoadSingle cmd; cmd.cmd_id = LOAD_TO_IOP_CMD_ID; cmd.messagebox_to_reply = 0; @@ -30,7 +30,7 @@ void LoadISOFileToIOP(FileRecord* file, void* addr, uint32_t length) { */ void LoadISOFileToEE(FileRecord* file, uint32_t addr, uint32_t length) { // printf("[OVERLORD] LoadISOFileToEE %s, %d/%d bytes\n", file->name, length, file->size); - spdlog::info("[OVERLORD] LoadISOFileToEE {}, {}/{} bytes", file->name, length, file->size); + spdlog::debug("[OVERLORD] LoadISOFileToEE {}, {}/{} bytes", file->name, length, file->size); IsoCommandLoadSingle cmd; cmd.cmd_id = LOAD_TO_EE_CMD_ID; cmd.messagebox_to_reply = 0; diff --git a/game/runtime.cpp b/game/runtime.cpp index 5615776b4..eddd4491e 100644 --- a/game/runtime.cpp +++ b/game/runtime.cpp @@ -68,7 +68,6 @@ void deci2_runner(SystemThreadInterface& iface) { iface.initialization_complete(); // in our own thread, wait for the EE to register the first protocol driver - // printf("[DECI2] waiting for EE to register protos\n"); spdlog::debug("[DECI2] Waiting for EE to register protos"); server.wait_for_protos_ready(); // then allow the server to accept connections @@ -83,7 +82,6 @@ void deci2_runner(SystemThreadInterface& iface) { while (!iface.get_want_exit()) { if (server.check_for_listener()) { if (!saw_listener) { - printf("[DECI2] Connected!\n"); spdlog::debug("[DECI2] Connected!"); } saw_listener = true; @@ -121,24 +119,18 @@ void ee_runner(SystemThreadInterface& iface) { } if (g_ee_main_mem == (u8*)(-1)) { - // printf(" Failed to initialize main memory! %s\n", strerror(errno)); spdlog::debug("Failed to initialize main memory! {}", strerror(errno)); iface.initialization_complete(); return; } - // printf(" Main memory mapped at 0x%016llx\n", (u64)(g_ee_main_mem)); spdlog::debug("Main memory mapped at 0x{:016x}", (u64)(g_ee_main_mem)); - // printf(" Main memory size 0x%x bytes (%.3f MB)\n", EE_MAIN_MEM_SIZE, - // (double)EE_MAIN_MEM_SIZE / (1 << 20)); spdlog::debug("Main memory size 0x{} bytes ({} MB)", EE_MAIN_MEM_SIZE, (double)EE_MAIN_MEM_SIZE / (1 << 20)); - // printf("[EE] Initialization complete!\n"); spdlog::debug("[EE] Initialization complete!"); iface.initialization_complete(); - // printf("[EE] Run!\n"); spdlog::debug("[EE] Run!"); memset((void*)g_ee_main_mem, 0, EE_MAIN_MEM_SIZE); @@ -161,7 +153,6 @@ void ee_runner(SystemThreadInterface& iface) { kprint_init_globals(); goal_main(g_argc, g_argv); - // printf("[EE] Done!\n"); spdlog::debug("[EE] Done!"); // // kill the IOP todo @@ -178,7 +169,6 @@ void ee_runner(SystemThreadInterface& iface) { */ void iop_runner(SystemThreadInterface& iface) { IOP iop; - // printf("[IOP] Restart!\n"); spdlog::debug("[IOP] Restart!"); iop.reset_allocator(); ee::LIBRARY_sceSif_register(&iop); @@ -202,14 +192,11 @@ void iop_runner(SystemThreadInterface& iface) { iface.initialization_complete(); - // printf("[IOP] Wait for OVERLORD to be started...\n"); spdlog::debug("[IOP] Wait for OVERLORD to start..."); iop.wait_for_overlord_start_cmd(); if (iop.status == IOP_OVERLORD_INIT) { - // printf("[IOP] Run!\n"); spdlog::debug("[IOP] Run!"); } else { - // printf("[IOP] shutdown!\n"); spdlog::debug("[IOP] Shutdown!"); return; } diff --git a/game/system/SystemThread.cpp b/game/system/SystemThread.cpp index 80f8f87d9..790dca615 100644 --- a/game/system/SystemThread.cpp +++ b/game/system/SystemThread.cpp @@ -3,6 +3,7 @@ #endif #include "SystemThread.h" +#include "third-party/spdlog/include/spdlog/spdlog.h" ////////////////////// // Thread Manager // @@ -50,7 +51,6 @@ void SystemThreadManager::print_stats() { */ void SystemThreadManager::shutdown() { for (int i = 0; i < thread_count; i++) { - // printf("# Stop %s\n", threads[i].name.c_str()); spdlog::debug("# Stop {}", threads[i].name.c_str()); threads[i].stop(); } @@ -61,7 +61,6 @@ void SystemThreadManager::shutdown() { */ void SystemThreadManager::join() { for (int i = 0; i < thread_count; i++) { - // printf("# Join %s\n", threads[i].name.c_str()); spdlog::debug(" # Join {}", threads[i].name.c_str()); if (threads[i].running) { threads[i].join(); @@ -76,7 +75,6 @@ void* bootstrap_thread_func(void* x) { SystemThread* thd = (SystemThread*)x; SystemThreadInterface iface(thd); thd->function(iface); - // printf("[SYSTEM] Thread %s is returning\n", thd->name.c_str()); spdlog::debug("[SYSTEM] Thread {} is returning", thd->name.c_str()); return nullptr; } @@ -85,7 +83,6 @@ void* bootstrap_thread_func(void* x) { * Start a thread and wait for its initialization */ void SystemThread::start(std::function f) { - // printf("# Initialize %s...\n", name.c_str()); spdlog::debug("# Initialize {}...", name.c_str()); function = f; @@ -124,7 +121,6 @@ void SystemThreadInterface::initialization_complete() { std::unique_lock mlk(thread.initialization_mutex); thread.initialization_complete = true; thread.initialization_cv.notify_all(); - // printf("# %s initialized\n", thread.name.c_str()); spdlog::debug("# {} initialized", thread.name.c_str()); } diff --git a/game/system/SystemThread.h b/game/system/SystemThread.h index e6f9f6ebf..a2ab51282 100644 --- a/game/system/SystemThread.h +++ b/game/system/SystemThread.h @@ -14,7 +14,6 @@ #include #include #include -#include "third-party/spdlog/include/spdlog/spdlog.h" #include "Timer.h"