Remove old prints + fix log types

Up next is the transition to a git submodule, should be simple enough
This commit is contained in:
Shay 2020-10-02 12:36:22 -06:00
parent 27ba6022bd
commit 59eedf6518
8 changed files with 13 additions and 58 deletions

View file

@ -176,10 +176,8 @@ void BeginLoadingDGO(const char* name, Ptr<u8> buffer1, Ptr<u8> buffer2, Ptr<u8>
// file name // file name
strcpy(sMsg[msgID].name, name); strcpy(sMsg[msgID].name, name);
// printf("[Begin Loading DGO RPC] %s, 0x%x, 0x%x, 0x%x\n", name, buffer1.offset, buffer2.offset, spdlog::debug("[Begin Loading DGO RPC] {}, 0x{}, 0x{}, 0x{}", name, buffer1.offset,
// currentHeap.offset); buffer2.offset, currentHeap.offset);
spdlog::info("[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. // this RPC will return once we have loaded the first object file.
// but we call async, so we don't block here. // 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, 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 * 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<kheapinfo> heap, u32 linkFlag, s32 bufferSize) { void load_and_link_dgo_from_c(const char* name, Ptr<kheapinfo> heap, u32 linkFlag, s32 bufferSize) {
// printf("[Load and Link DGO From C] %s\n", name); spdlog::debug("[Load and Link DGO From C] {}", name);
spdlog::info("[Load and Link DGO From C] {}", name);
u32 oldShowStall = sShowStallMsg; u32 oldShowStall = sShowStallMsg;
// remember where the heap top point is so we can clear temporary allocations // 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<kheapinfo> heap, u32 linkFla
char objName[64]; char objName[64];
strcpy(objName, (dgoObj + 4).cast<char>().c()); // name from dgo object header strcpy(objName, (dgoObj + 4).cast<char>().c()); // name from dgo object header
// printf("[link and exec] %s %d\n", objName, lastObjectLoaded); spdlog::debug("[link and exec] {} {}", objName, lastObjectLoaded);
spdlog::info("[link and exec] {} {}", objName, lastObjectLoaded);
link_and_exec(obj, objName, objSize, heap, linkFlag); // link now! link_and_exec(obj, objName, objSize, heap, linkFlag); // link now!
// inform IOP we are done // inform IOP we are done

View file

@ -148,15 +148,12 @@ void InitParms(int argc, const char* const* argv) {
* DONE, EXACT * DONE, EXACT
*/ */
void InitCD() { void InitCD() {
// printf("Initializing CD drive\nThis may take a while ...\n"); spdlog::info("Initializing CD drive\nThis may take a while...\n");
spdlog::debug("Initializing CD drive\nThis may take a while...\n");
sceCdInit(SCECdINIT); sceCdInit(SCECdINIT);
sceCdMmode(SCECdDVD); sceCdMmode(SCECdDVD);
while (sceCdDiskReady(0) == SCECdNotReady) { while (sceCdDiskReady(0) == SCECdNotReady) {
// printf("Drive not ready ... insert a disk!\n");
spdlog::debug("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()); spdlog::debug("Disk type {}\n", sceCdGetDiskType());
} }
@ -175,27 +172,21 @@ void InitIOP() {
if (!reboot) { if (!reboot) {
// reboot with development IOP kernel // reboot with development IOP kernel
// printf("Rebooting IOP...\n");
spdlog::debug("Rebooting IOP..."); spdlog::debug("Rebooting IOP...");
while (!sceSifRebootIop("host0:/usr/local/sce/iop/modules/ioprp221.img")) { while (!sceSifRebootIop("host0:/usr/local/sce/iop/modules/ioprp221.img")) {
// printf("Failed, retrying...\n");
spdlog::debug("Failed, retrying"); spdlog::debug("Failed, retrying");
} }
while (!sceSifSyncIop()) { while (!sceSifSyncIop()) {
// printf("Syncing...\n");
spdlog::debug("Syncing..."); spdlog::debug("Syncing...");
} }
} else { } else {
// reboot with IOP kernel off of the disk // reboot with IOP kernel off of the disk
// reboot with development IOP kernel // reboot with development IOP kernel
// printf("Rebooting IOP...\n");
spdlog::debug("Rebooting IOP..."); spdlog::debug("Rebooting IOP...");
while (!sceSifRebootIop("cdrom0:\\DRIVERS\\IOPRP221.IMG;1")) { while (!sceSifRebootIop("cdrom0:\\DRIVERS\\IOPRP221.IMG;1")) {
// printf("Failed, retrying...\n");
spdlog::debug("Failed, retrying"); spdlog::debug("Failed, retrying");
} }
while (!sceSifSyncIop()) { while (!sceSifSyncIop()) {
// printf("Syncing...\n");
spdlog::debug("Syncing..."); spdlog::debug("Syncing...");
} }
} }
@ -247,7 +238,6 @@ void InitIOP() {
sceSifLoadModule("host0:/usr/home/src/989snd10/iop/989ERR.IRX", 0, nullptr); sceSifLoadModule("host0:/usr/home/src/989snd10/iop/989ERR.IRX", 0, nullptr);
// printf("Initializing CD library\n");
spdlog::debug("Initializing CD library..."); spdlog::debug("Initializing CD library...");
auto rv = sceSifLoadModule("host0:binee/overlord.irx", cmd + len + 1 - overlord_boot_command, auto rv = sceSifLoadModule("host0:binee/overlord.irx", cmd + len + 1 - overlord_boot_command,
overlord_boot_command); overlord_boot_command);
@ -280,7 +270,6 @@ void InitIOP() {
MsgErr("loading 989snd.irx failed\n"); MsgErr("loading 989snd.irx failed\n");
} }
// printf("Initializing CD library in ISO_CD mode\n");
spdlog::debug("Initializing CD library in ISO_CD mode..."); spdlog::debug("Initializing CD library in ISO_CD mode...");
auto rv = sceSifLoadModule("cdrom0:\\\\DRIVERS\\\\OVERLORD.IRX;1", auto rv = sceSifLoadModule("cdrom0:\\\\DRIVERS\\\\OVERLORD.IRX;1",
cmd + len + 1 - overlord_boot_command, overlord_boot_command); cmd + len + 1 - overlord_boot_command, overlord_boot_command);
@ -292,8 +281,7 @@ void InitIOP() {
if (rv < 0) { if (rv < 0) {
MsgErr("MC driver init failed %d\n", rv); MsgErr("MC driver init failed %d\n", rv);
} else { } else {
// printf("InitIOP OK\n"); spdlog::info("InitIOP OK");
spdlog::debug("InitIOP OK");
} }
} }
@ -314,8 +302,6 @@ int InitMachine() {
// initialize the global heap // initialize the global heap
u32 global_heap_size = GLOBAL_HEAP_END - HEAP_START; u32 global_heap_size = GLOBAL_HEAP_END - HEAP_START;
float size_mb = ((float)global_heap_size) / (float)(1 << 20); 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, spdlog::info("gkernel: global heap 0x{} to 0x{} (size {} MB)", HEAP_START, GLOBAL_HEAP_END,
size_mb); size_mb);
kinitheap(kglobalheap, Ptr<u8>(HEAP_START), global_heap_size); kinitheap(kglobalheap, Ptr<u8>(HEAP_START), global_heap_size);
@ -326,8 +312,6 @@ int InitMachine() {
kinitheap(kdebugheap, Ptr<u8>(DEBUG_HEAP_START), debug_heap_size); kinitheap(kdebugheap, Ptr<u8>(DEBUG_HEAP_START), debug_heap_size);
float debug_size_mb = ((float)debug_heap_size) / (float)(1 << 20); 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); 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, spdlog::info("gkernel: global heap 0x{} to 0x{} (size {} MB, gap {} MB)", DEBUG_HEAP_START,
debug_heap_end, debug_size_mb, gap_size_mb); debug_heap_end, debug_size_mb, gap_size_mb);
} else { } else {
@ -354,10 +338,8 @@ int InitMachine() {
InitGoalProto(); InitGoalProto();
} }
// printf("InitSound\n");
spdlog::info("InitSound"); spdlog::info("InitSound");
InitSound(); // do nothing! InitSound(); // do nothing!
// printf("InitRPC\n");
spdlog::info("InitRPC"); spdlog::info("InitRPC");
InitRPC(); // connect to IOP InitRPC(); // connect to IOP
reset_output(); // reset output buffers reset_output(); // reset output buffers
@ -369,10 +351,8 @@ int InitMachine() {
} }
spdlog::info("InitListenerConnect"); spdlog::info("InitListenerConnect");
// printf("InitListenerConnect\n");
InitListenerConnect(); InitListenerConnect();
spdlog::info("InitCheckListener"); spdlog::info("InitCheckListener");
// printf("InitCheckListener\n");
InitCheckListener(); InitCheckListener();
Msg(6, "kernel: machine started\n"); Msg(6, "kernel: machine started\n");
return 0; return 0;

View file

@ -11,11 +11,8 @@
int main(int argc, char** argv) { int main(int argc, char** argv) {
while (true) { while (true) {
spdlog::set_level(spdlog::level::debug); 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 // 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::info("gk {}.{} OK!\n", versions::GOAL_VERSION_MAJOR, versions::GOAL_VERSION_MINOR);
spdlog::debug("gk {}.{} OK!\n", versions::GOAL_VERSION_MAJOR, versions::GOAL_VERSION_MINOR);
if (exec_runtime(argc, argv) == 2) { if (exec_runtime(argc, argv) == 2) {
return 0; return 0;

View file

@ -217,7 +217,7 @@ uint32_t FS_GetLength(FileRecord* fr) {
*/ */
LoadStackEntry* FS_Open(FileRecord* fr, int32_t offset) { LoadStackEntry* FS_Open(FileRecord* fr, int32_t offset) {
// printf("[OVERLORD] FS Open %s\n", fr->name); // Added // 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; LoadStackEntry* selected = nullptr;
// find first unused spot on load stack. // find first unused spot on load stack.
for (uint32_t i = 0; i < MAX_OPEN_FILES; i++) { 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) { LoadStackEntry* FS_OpenWad(FileRecord* fr, int32_t offset) {
// printf("[OVERLORD] FS Open %s\n", fr->name); // Added // 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; LoadStackEntry* selected = nullptr;
for (uint32_t i = 0; i < MAX_OPEN_FILES; i++) { for (uint32_t i = 0; i < MAX_OPEN_FILES; i++) {
if (!sLoadStack[i].fr) { if (!sLoadStack[i].fr) {
@ -266,7 +266,7 @@ LoadStackEntry* FS_OpenWad(FileRecord* fr, int32_t offset) {
*/ */
void FS_Close(LoadStackEntry* fd) { void FS_Close(LoadStackEntry* fd) {
// printf("[OVERLORD] FS Close %s\n", fd->fr->name); // 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 // close the FD
fd->fr = nullptr; fd->fr = nullptr;

View file

@ -9,7 +9,7 @@ using namespace iop;
*/ */
void LoadISOFileToIOP(FileRecord* file, void* addr, uint32_t length) { void LoadISOFileToIOP(FileRecord* file, void* addr, uint32_t length) {
// printf("[OVERLORD] LoadISOFileToIOP %s, %d/%d bytes\n", file->name, length, file->size); // 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; IsoCommandLoadSingle cmd;
cmd.cmd_id = LOAD_TO_IOP_CMD_ID; cmd.cmd_id = LOAD_TO_IOP_CMD_ID;
cmd.messagebox_to_reply = 0; 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) { void LoadISOFileToEE(FileRecord* file, uint32_t addr, uint32_t length) {
// printf("[OVERLORD] LoadISOFileToEE %s, %d/%d bytes\n", file->name, length, file->size); // 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; IsoCommandLoadSingle cmd;
cmd.cmd_id = LOAD_TO_EE_CMD_ID; cmd.cmd_id = LOAD_TO_EE_CMD_ID;
cmd.messagebox_to_reply = 0; cmd.messagebox_to_reply = 0;

View file

@ -68,7 +68,6 @@ void deci2_runner(SystemThreadInterface& iface) {
iface.initialization_complete(); iface.initialization_complete();
// in our own thread, wait for the EE to register the first protocol driver // 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"); spdlog::debug("[DECI2] Waiting for EE to register protos");
server.wait_for_protos_ready(); server.wait_for_protos_ready();
// then allow the server to accept connections // then allow the server to accept connections
@ -83,7 +82,6 @@ void deci2_runner(SystemThreadInterface& iface) {
while (!iface.get_want_exit()) { while (!iface.get_want_exit()) {
if (server.check_for_listener()) { if (server.check_for_listener()) {
if (!saw_listener) { if (!saw_listener) {
printf("[DECI2] Connected!\n");
spdlog::debug("[DECI2] Connected!"); spdlog::debug("[DECI2] Connected!");
} }
saw_listener = true; saw_listener = true;
@ -121,24 +119,18 @@ void ee_runner(SystemThreadInterface& iface) {
} }
if (g_ee_main_mem == (u8*)(-1)) { 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)); spdlog::debug("Failed to initialize main memory! {}", strerror(errno));
iface.initialization_complete(); iface.initialization_complete();
return; 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)); 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, spdlog::debug("Main memory size 0x{} bytes ({} MB)", EE_MAIN_MEM_SIZE,
(double)EE_MAIN_MEM_SIZE / (1 << 20)); (double)EE_MAIN_MEM_SIZE / (1 << 20));
// printf("[EE] Initialization complete!\n");
spdlog::debug("[EE] Initialization complete!"); spdlog::debug("[EE] Initialization complete!");
iface.initialization_complete(); iface.initialization_complete();
// printf("[EE] Run!\n");
spdlog::debug("[EE] Run!"); spdlog::debug("[EE] Run!");
memset((void*)g_ee_main_mem, 0, EE_MAIN_MEM_SIZE); memset((void*)g_ee_main_mem, 0, EE_MAIN_MEM_SIZE);
@ -161,7 +153,6 @@ void ee_runner(SystemThreadInterface& iface) {
kprint_init_globals(); kprint_init_globals();
goal_main(g_argc, g_argv); goal_main(g_argc, g_argv);
// printf("[EE] Done!\n");
spdlog::debug("[EE] Done!"); spdlog::debug("[EE] Done!");
// // kill the IOP todo // // kill the IOP todo
@ -178,7 +169,6 @@ void ee_runner(SystemThreadInterface& iface) {
*/ */
void iop_runner(SystemThreadInterface& iface) { void iop_runner(SystemThreadInterface& iface) {
IOP iop; IOP iop;
// printf("[IOP] Restart!\n");
spdlog::debug("[IOP] Restart!"); spdlog::debug("[IOP] Restart!");
iop.reset_allocator(); iop.reset_allocator();
ee::LIBRARY_sceSif_register(&iop); ee::LIBRARY_sceSif_register(&iop);
@ -202,14 +192,11 @@ void iop_runner(SystemThreadInterface& iface) {
iface.initialization_complete(); iface.initialization_complete();
// printf("[IOP] Wait for OVERLORD to be started...\n");
spdlog::debug("[IOP] Wait for OVERLORD to start..."); spdlog::debug("[IOP] Wait for OVERLORD to start...");
iop.wait_for_overlord_start_cmd(); iop.wait_for_overlord_start_cmd();
if (iop.status == IOP_OVERLORD_INIT) { if (iop.status == IOP_OVERLORD_INIT) {
// printf("[IOP] Run!\n");
spdlog::debug("[IOP] Run!"); spdlog::debug("[IOP] Run!");
} else { } else {
// printf("[IOP] shutdown!\n");
spdlog::debug("[IOP] Shutdown!"); spdlog::debug("[IOP] Shutdown!");
return; return;
} }

View file

@ -3,6 +3,7 @@
#endif #endif
#include "SystemThread.h" #include "SystemThread.h"
#include "third-party/spdlog/include/spdlog/spdlog.h"
////////////////////// //////////////////////
// Thread Manager // // Thread Manager //
@ -50,7 +51,6 @@ void SystemThreadManager::print_stats() {
*/ */
void SystemThreadManager::shutdown() { void SystemThreadManager::shutdown() {
for (int i = 0; i < thread_count; i++) { 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()); spdlog::debug("# Stop {}", threads[i].name.c_str());
threads[i].stop(); threads[i].stop();
} }
@ -61,7 +61,6 @@ void SystemThreadManager::shutdown() {
*/ */
void SystemThreadManager::join() { void SystemThreadManager::join() {
for (int i = 0; i < thread_count; i++) { 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()); spdlog::debug(" # Join {}", threads[i].name.c_str());
if (threads[i].running) { if (threads[i].running) {
threads[i].join(); threads[i].join();
@ -76,7 +75,6 @@ void* bootstrap_thread_func(void* x) {
SystemThread* thd = (SystemThread*)x; SystemThread* thd = (SystemThread*)x;
SystemThreadInterface iface(thd); SystemThreadInterface iface(thd);
thd->function(iface); thd->function(iface);
// printf("[SYSTEM] Thread %s is returning\n", thd->name.c_str());
spdlog::debug("[SYSTEM] Thread {} is returning", thd->name.c_str()); spdlog::debug("[SYSTEM] Thread {} is returning", thd->name.c_str());
return nullptr; return nullptr;
} }
@ -85,7 +83,6 @@ void* bootstrap_thread_func(void* x) {
* Start a thread and wait for its initialization * Start a thread and wait for its initialization
*/ */
void SystemThread::start(std::function<void(SystemThreadInterface&)> f) { void SystemThread::start(std::function<void(SystemThreadInterface&)> f) {
// printf("# Initialize %s...\n", name.c_str());
spdlog::debug("# Initialize {}...", name.c_str()); spdlog::debug("# Initialize {}...", name.c_str());
function = f; function = f;
@ -124,7 +121,6 @@ void SystemThreadInterface::initialization_complete() {
std::unique_lock<std::mutex> mlk(thread.initialization_mutex); std::unique_lock<std::mutex> mlk(thread.initialization_mutex);
thread.initialization_complete = true; thread.initialization_complete = true;
thread.initialization_cv.notify_all(); thread.initialization_cv.notify_all();
// printf("# %s initialized\n", thread.name.c_str());
spdlog::debug("# {} initialized", thread.name.c_str()); spdlog::debug("# {} initialized", thread.name.c_str());
} }

View file

@ -14,7 +14,6 @@
#include <mutex> #include <mutex>
#include <thread> #include <thread>
#include <condition_variable> #include <condition_variable>
#include "third-party/spdlog/include/spdlog/spdlog.h"
#include "Timer.h" #include "Timer.h"