Temp fix for spdlog + initial log to file implementation

Reduces verbose output by logging additional information to logs/game.log.
This commit is contained in:
doctashay
2020-10-06 16:03:33 -06:00
parent c5681a6cc7
commit 953e7c1ad5
7 changed files with 17 additions and 19 deletions
+4 -4
View File
@@ -55,11 +55,11 @@ include_directories(./)
# build spdlog as a shared library to improve compile times
# adding this as a SYSTEM include suppresses all the terrible warnings in spdlog
IF (WIN32)
include_directories(third-party/spdlog/include)
ELSE()
include_directories(SYSTEM third-party/spdlog/include)
# this makes spdlog generate a shared library that we can link against
set(SPDLOG_BUILD_SHARED ON)
# this makes the spdlog includes not use the header only version, making compiling faster
add_definitions(-DSPDLOG_COMPILED_LIB)
ENDIF()
# build asset packer/unpacker
add_subdirectory(asset_tool)
+2 -2
View File
@@ -148,11 +148,11 @@ void InitParms(int argc, const char* const* argv) {
* DONE, EXACT
*/
void InitCD() {
spdlog::info("Initializing CD drive\nThis may take a while...\n");
spdlog::info("Initializing CD drive. This may take a while...");
sceCdInit(SCECdINIT);
sceCdMmode(SCECdDVD);
while (sceCdDiskReady(0) == SCECdNotReady) {
spdlog::debug("Drive not ready... insert a disk!\n");
spdlog::debug("Drive not ready... insert a disk!");
}
spdlog::debug("Disk type {}\n", sceCdGetDiskType());
}
+6 -2
View File
@@ -11,9 +11,13 @@
int main(int argc, char** argv) {
while (true) {
spdlog::set_level(spdlog::level::debug);
auto my_logger = spdlog::basic_logger_mt("file_logger", "logs/basic-log.txt");
auto my_logger = spdlog::basic_logger_mt("GOAL Runtime", "logs/game.log");
spdlog::set_default_logger(my_logger);
spdlog::flush_on(spdlog::level::info);
// run the runtime in a loop so we can reset the game and have it restart cleanly
spdlog::info("gk {}.{} OK!\n", versions::GOAL_VERSION_MAJOR, versions::GOAL_VERSION_MINOR);
printf("\n");
spdlog::info("gk {}.{} OK!", versions::GOAL_VERSION_MAJOR, versions::GOAL_VERSION_MINOR);
if (exec_runtime(argc, argv) == 2) {
return 0;
-6
View File
@@ -216,7 +216,6 @@ uint32_t FS_GetLength(FileRecord* fr) {
* This is an ISO FS API Function
*/
LoadStackEntry* FS_Open(FileRecord* fr, int32_t offset) {
// printf("[OVERLORD] FS Open %s\n", fr->name); // Added
spdlog::debug("[OVERLORD] FS Open {}", fr->name);
LoadStackEntry* selected = nullptr;
// find first unused spot on load stack.
@@ -231,7 +230,6 @@ LoadStackEntry* FS_Open(FileRecord* fr, int32_t offset) {
return selected;
}
}
// printf("[OVERLORD ISO CD] Failed to FS_Open %s\n", fr->name);
spdlog::warn("[OVERLORD] Failed to FS Open {}", fr->name);
ExitIOP();
return nullptr;
@@ -243,7 +241,6 @@ LoadStackEntry* FS_Open(FileRecord* fr, int32_t offset) {
* This is an ISO FS API Function
*/
LoadStackEntry* FS_OpenWad(FileRecord* fr, int32_t offset) {
// printf("[OVERLORD] FS Open %s\n", fr->name); // Added
spdlog::debug("[OVERLORD] FS_OpenWad {}", fr->name);
LoadStackEntry* selected = nullptr;
for (uint32_t i = 0; i < MAX_OPEN_FILES; i++) {
@@ -254,7 +251,6 @@ LoadStackEntry* FS_OpenWad(FileRecord* fr, int32_t offset) {
return selected;
}
}
// printf("[OVERLORD ISO CD] Failed to FS_OpenWad %s\n", fr->name);
spdlog::warn("[OVERLORD] Failed to FS_OpenWad {}", fr->name);
ExitIOP();
return nullptr;
@@ -265,7 +261,6 @@ LoadStackEntry* FS_OpenWad(FileRecord* fr, int32_t offset) {
* This is an ISO FS API Function
*/
void FS_Close(LoadStackEntry* fd) {
// printf("[OVERLORD] FS Close %s\n", fd->fr->name);
spdlog::debug("[OVERLORD] FS_Close {}", fd->fr->name);
// close the FD
@@ -285,7 +280,6 @@ uint32_t FS_BeginRead(LoadStackEntry* fd, void* buffer, int32_t len) {
int32_t real_size = len;
if (len < 0) {
// not sure what this is about...
// printf("[OVERLORD ISO CD] negative length warning!\n");
spdlog::warn("[OVERLORD ISO CD] Negative length warning!");
real_size = len + 0x7ff;
}
+1 -1
View File
@@ -982,4 +982,4 @@ void CD_WaitReturn() {
}
} while (!CheckDiskID());
gNoCD = 0;
}
}
+3 -3
View File
@@ -179,11 +179,11 @@ u32 QueueMessage(IsoMessage* cmd, int32_t priority, const char* name) {
gPriStack[priority].cmds[gPriStack[priority].n] = cmd;
gPriStack[priority].names[gPriStack[priority].n] = name;
gPriStack[priority].n++;
printf("[OVERLORD] Queue %d (%d/%d), %s\n", priority, gPriStack[priority].n, PRI_STACK_LENGTH,
gPriStack[priority].names[gPriStack[priority].n - 1].c_str());
spdlog::debug("[OVERLORD] Queue {} ({}/{}), {}", priority, gPriStack[priority].n,
PRI_STACK_LENGTH, gPriStack[priority].names[gPriStack[priority].n - 1].c_str());
DisplayQueue();
} else {
printf("[OVERLORD ISO QUEUE] Failed to queue!\n");
spdlog::debug("[OVERLORD ISO QUEUE] Failed to queue!");
cmd->status = CMD_STATUS_FAILED_TO_QUEUE;
ReturnMessage(cmd);
}
+1 -1
View File
@@ -75,7 +75,7 @@ void deci2_runner(SystemThreadInterface& iface) {
throw std::runtime_error("DECI2 server init failed");
}
printf("[DECI2] waiting for listener...\n");
spdlog::debug("[DECI2] Waiting for listener...");
// spdlog::debug("[DECI2] Waiting for listener..."); --> disabled temporarily, some weird race
// condition?
bool saw_listener = false;