Merge branch 'master' of https://github.com/water111/jak-project into w/cfg_2_ir

This commit is contained in:
water 2020-10-03 10:42:52 -04:00
commit 649a8879e5
18 changed files with 121 additions and 73 deletions

View file

@ -38,7 +38,7 @@ jobs:
- name: Build Project
run: |
cd build
make -j
make -j4
- name: Run Tests
timeout-minutes: 5
run: ./test_code_coverage.sh

5
.gitmodules vendored
View file

@ -1,3 +1,6 @@
[submodule "third-party/googletest"]
path = third-party/googletest
url = https://github.com/google/googletest.git
url = https://github.com/google/googletest.git
[submodule "third-party/spdlog"]
path = third-party/spdlog
url = https://github.com/gabime/spdlog.git

View file

@ -2,6 +2,10 @@
cmake_minimum_required(VERSION 3.16)
project(jak)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()
set(CMAKE_CXX_STANDARD 14)
# Set default compile flags for GCC
@ -49,6 +53,14 @@ endif()
# includes relative to top level jak-project folder
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
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)
# build asset packer/unpacker
add_subdirectory(asset_tool)
@ -85,6 +97,9 @@ add_subdirectory(third-party/minilzo)
# build format library
add_subdirectory(third-party/fmt)
# build spdlog library
add_subdirectory(third-party/spdlog)
# windows memory management lib
IF (WIN32)
add_subdirectory(third-party/mman)

View file

@ -637,4 +637,4 @@ Object Interpreter::eval_error(const Object& form,
throw_eval_error(form, "Error: " + args.unnamed.at(0).as_string()->data);
return EmptyListObject::make_new();
}
} // namespace goos
} // namespace goos

View file

@ -81,12 +81,12 @@ add_executable(gk main.cpp)
IF (WIN32)
# set stuff for windows
target_link_libraries(runtime mman cross_sockets common_util)
target_link_libraries(gk cross_sockets mman common_util runtime)
target_link_libraries(runtime mman cross_sockets common_util spdlog)
target_link_libraries(gk cross_sockets mman common_util runtime spdlog)
ELSE()
# set stuff for other systems
target_link_libraries(runtime pthread cross_sockets common_util)
target_link_libraries(gk cross_sockets pthread common_util runtime)
target_link_libraries(runtime pthread cross_sockets common_util spdlog)
target_link_libraries(gk cross_sockets pthread common_util runtime spdlog)
ENDIF()

View file

@ -16,6 +16,7 @@
#include "game/common/ramdisk_rpc_types.h"
#include "game/common/loader_rpc_types.h"
#include "game/common/play_rpc_types.h"
#include "third-party/spdlog/include/spdlog/spdlog.h"
using namespace ee;
@ -175,9 +176,8 @@ void BeginLoadingDGO(const char* name, Ptr<u8> buffer1, Ptr<u8> buffer2, Ptr<u8>
// 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::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,
@ -299,7 +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<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);
u32 oldShowStall = sShowStallMsg;
// remember where the heap top point is so we can clear temporary allocations
@ -348,7 +348,7 @@ void load_and_link_dgo_from_c(const char* name, Ptr<kheapinfo> heap, u32 linkFla
char objName[64];
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);
link_and_exec(obj, objName, objSize, heap, linkFlag); // link now!
// inform IOP we are done
@ -357,4 +357,4 @@ void load_and_link_dgo_from_c(const char* name, Ptr<kheapinfo> heap, u32 linkFla
}
}
sShowStallMsg = oldShowStall;
}
}

View file

@ -25,7 +25,7 @@
#include "game/sce/libcdvd_ee.h"
#include "game/sce/stubs.h"
#include "common/symbols.h"
#include "third-party/spdlog/include/spdlog/spdlog.h"
using namespace ee;
/*!
@ -148,13 +148,13 @@ void InitParms(int argc, const char* const* argv) {
* DONE, EXACT
*/
void InitCD() {
printf("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());
}
/*!
@ -172,22 +172,22 @@ 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...");
}
}
@ -238,7 +238,7 @@ 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);
if (rv < 0) {
@ -270,7 +270,7 @@ 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);
if (rv < 0) {
@ -281,7 +281,7 @@ void InitIOP() {
if (rv < 0) {
MsgErr("MC driver init failed %d\n", rv);
} else {
printf("InitIOP OK\n");
spdlog::info("InitIOP OK");
}
}
@ -302,8 +302,8 @@ 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<u8>(HEAP_START), global_heap_size);
// initialize the debug heap, if appropriate
@ -312,8 +312,8 @@ int InitMachine() {
kinitheap(kdebugheap, Ptr<u8>(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 {
// if no debug, we make the kheapinfo structure NULL so GOAL knows not to use it.
kdebugheap.offset = 0;
@ -338,9 +338,9 @@ 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
clear_print();
@ -350,9 +350,9 @@ int InitMachine() {
return goal_status;
}
printf("InitListenerConnect\n");
spdlog::info("InitListenerConnect");
InitListenerConnect();
printf("InitCheckListener\n");
spdlog::info("InitCheckListener");
InitCheckListener();
Msg(6, "kernel: machine started\n");
return 0;
@ -619,7 +619,7 @@ void InitMachineScheme() {
new_pair(s7.offset + FIX_SYM_GLOBAL_HEAP, *((s7 + FIX_SYM_PAIR_TYPE).cast<u32>()),
make_string_from_c("common"), kernel_packages->value);
printf("calling play!\n");
spdlog::info("calling fake play~");
call_goal_function_by_name("play");
}
}

View file

@ -19,6 +19,7 @@
#include "common/symbols.h"
#include "common/versions.h"
#include "common/goal_constants.h"
#include "third-party/spdlog/include/spdlog/spdlog.h"
//! Controls link mode when EnableMethodSet = 0, MasterDebug = 1, DiskBoot = 0. Will enable a
//! warning message if EnableMethodSet = 1
@ -1895,8 +1896,10 @@ s32 InitHeapAndSymbol() {
(kernel_version >> 3) & 0xffff);
return -1;
} else {
printf("Got correct kernel version %d.%d\n", kernel_version >> 0x13,
(kernel_version >> 3) & 0xffff);
spdlog::info("Got correct kernel version {}.{}", kernel_version >> 0x13,
(kernel_version >> 3) & 0xffff);
// printf("Got correct kernel version %d.%d\n", kernel_version >> 0x13,
// (kernel_version >> 3) & 0xffff);
}
}

View file

@ -5,14 +5,18 @@
#include <cstdio>
#include "runtime.h"
#include "common/versions.h"
#include "third-party/spdlog/include/spdlog/spdlog.h"
#include "third-party/spdlog/include/spdlog/sinks/basic_file_sink.h"
int main(int argc, char** argv) {
while (true) {
spdlog::set_level(spdlog::level::debug);
// 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);
if (exec_runtime(argc, argv) == 2) {
return 0;
}
}
return 0;
}
}

View file

@ -16,6 +16,7 @@
#include "isocommon.h"
#include "overlord.h"
#include "common/util/FileUtil.h"
#include "third-party/spdlog/include/spdlog/spdlog.h"
using namespace iop;
@ -215,7 +216,8 @@ 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
// 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.
for (uint32_t i = 0; i < MAX_OPEN_FILES; i++) {
@ -229,7 +231,8 @@ LoadStackEntry* FS_Open(FileRecord* fr, int32_t offset) {
return selected;
}
}
printf("[OVERLORD ISO CD] Failed to FS_Open %s\n", fr->name);
// printf("[OVERLORD ISO CD] Failed to FS_Open %s\n", fr->name);
spdlog::warn("[OVERLORD] Failed to FS Open {}", fr->name);
ExitIOP();
return nullptr;
}
@ -240,7 +243,8 @@ 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
// 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++) {
if (!sLoadStack[i].fr) {
@ -250,7 +254,8 @@ LoadStackEntry* FS_OpenWad(FileRecord* fr, int32_t offset) {
return selected;
}
}
printf("[OVERLORD ISO CD] Failed to FS_OpenWad %s\n", fr->name);
// printf("[OVERLORD ISO CD] Failed to FS_OpenWad %s\n", fr->name);
spdlog::warn("[OVERLORD] Failed to FS_OpenWad {}", fr->name);
ExitIOP();
return nullptr;
}
@ -260,7 +265,8 @@ 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);
// printf("[OVERLORD] FS Close %s\n", fd->fr->name);
spdlog::debug("[OVERLORD] FS_Close {}", fd->fr->name);
// close the FD
fd->fr = nullptr;
@ -279,7 +285,8 @@ 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");
// printf("[OVERLORD ISO CD] negative length warning!\n");
spdlog::warn("[OVERLORD ISO CD] Negative length warning!");
real_size = len + 0x7ff;
}

View file

@ -4,6 +4,7 @@
* This is a huge mess
*/
#include "third-party/spdlog/include/spdlog/spdlog.h"
#include <assert.h>
#include <cstring>
#include <cstdio>
@ -492,9 +493,11 @@ u32 RunDGOStateMachine(IsoMessage* _cmd, IsoBufferHeader* buffer) {
// if we are done with header
if (cmd->bytes_processed == sizeof(DgoHeader)) {
printf("[Overlord DGO] Got DGO file header for %s with %d objects\n",
cmd->dgo_header.name,
cmd->dgo_header.object_count); // added
// printf("[Overlord DGO] Got DGO file header for %s with %d objects\n",
// cmd->dgo_header.name,
// cmd->dgo_header.object_count); // added
spdlog::info("[Overlord DGO] Got DGO file header for {} with {} objects",
cmd->dgo_header.name, cmd->dgo_header.object_count);
cmd->bytes_processed = 0;
cmd->objects_loaded = 0;
if (cmd->dgo_header.object_count == 1) {
@ -923,4 +926,4 @@ void CancelDGO(RPC_Dgo_Cmd* cmd) {
// TODO - VAG_MarkLoopStart
// TODO - VAG_MarkLoopEnd
// TODO - VAG_MarkNonloopStart
// TODO - VAG_MarkNonloopEnd
// TODO - VAG_MarkNonloopEnd

View file

@ -1,5 +1,6 @@
#include "iso_api.h"
#include "game/sce/iop.h"
#include "third-party/spdlog/include/spdlog/spdlog.h"
using namespace iop;
@ -7,7 +8,8 @@ using namespace iop;
* Load a File to IOP memory (blocking)
*/
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::debug("[OVERLORD] LoadISOFileToIOP {}, {}/{} bytes", file->name, length, file->size);
IsoCommandLoadSingle cmd;
cmd.cmd_id = LOAD_TO_IOP_CMD_ID;
cmd.messagebox_to_reply = 0;
@ -27,7 +29,8 @@ void LoadISOFileToIOP(FileRecord* file, void* addr, uint32_t length) {
* Load a File to IOP memory (blocking)
*/
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::debug("[OVERLORD] LoadISOFileToEE {}, {}/{} bytes", file->name, length, file->size);
IsoCommandLoadSingle cmd;
cmd.cmd_id = LOAD_TO_EE_CMD_ID;
cmd.messagebox_to_reply = 0;
@ -41,4 +44,4 @@ void LoadISOFileToEE(FileRecord* file, uint32_t addr, uint32_t length) {
if (cmd.status) {
cmd.length_to_copy = 0;
}
}
}

View file

@ -68,7 +68,7 @@ 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
if (!server.init()) {
@ -76,11 +76,13 @@ void deci2_runner(SystemThreadInterface& iface) {
}
printf("[DECI2] waiting for listener...\n");
// spdlog::debug("[DECI2] Waiting for listener..."); --> disabled temporarily, some weird race
// condition?
bool saw_listener = false;
while (!iface.get_want_exit()) {
if (server.check_for_listener()) {
if (!saw_listener) {
printf("[DECI2] Connected!\n");
spdlog::debug("[DECI2] Connected!");
}
saw_listener = true;
// we have a listener, run!
@ -117,19 +119,19 @@ 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));
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 mapped at 0x{:016x}", (u64)(g_ee_main_mem));
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);
// prevent access to the first 1 MB of memory.
@ -151,7 +153,7 @@ 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
iop::LIBRARY_kill();
@ -167,7 +169,7 @@ 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);
iop::LIBRARY_register(&iop);
@ -190,12 +192,12 @@ 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;
}
@ -257,6 +259,7 @@ u32 exec_runtime(int argc, char** argv) {
// join and exit
tm.join();
printf("GOAL Runtime Shutdown (code %d)\n", MasterExit);
// printf("GOAL Runtime Shutdown (code %d)\n", MasterExit);
spdlog::info("GOAL Runtime Shutdown (code {})", MasterExit);
return MasterExit;
}

View file

@ -69,7 +69,8 @@ s32 sceDeci2Open(u16 protocol, void* opt, void (*handler)(s32 event, s32 param,
drv.id = protocol_count + 1;
drv.active = true;
protocols[protocol_count++] = drv;
printf("[DECI2] Add new protocol driver %d for 0x%x\n", drv.id, drv.protocol);
// printf("[DECI2] Add new protocol driver %d for 0x%x\n", drv.id, drv.protocol);
spdlog::info("[DECI2] Add new protocol driver {} for 0x{}", drv.id, drv.protocol);
server->unlock();
if (protocol_count == 1) {

View file

@ -4,6 +4,7 @@
#define JAK1_IOP_H
#include "common/common_types.h"
#include "third-party/spdlog/include/spdlog/spdlog.h"
#define SMEM_Low (0)
#define SMEM_High (1)

View file

@ -19,6 +19,7 @@
#include <condition_variable>
#include <functional>
#include "game/system/deci_common.h"
#include "third-party/spdlog/include/spdlog/spdlog.h"
class Deci2Server {
public:

View file

@ -3,6 +3,7 @@
#endif
#include "SystemThread.h"
#include "third-party/spdlog/include/spdlog/spdlog.h"
//////////////////////
// Thread Manager //
@ -13,7 +14,8 @@
*/
SystemThread& SystemThreadManager::create_thread(const std::string& name) {
if (thread_count >= MAX_SYSTEM_THREADS) {
throw std::runtime_error("Out of System Threads! Please increase MAX_SYSTEM_THREADS");
spdlog::critical("Out of System Threads! MAX_SYSTEM_THREADS is ", MAX_SYSTEM_THREADS);
throw std::runtime_error("Out of System Threads! Please increase MAX_SYSTEM_THREADS");
}
auto& thread = threads[thread_count];
@ -49,7 +51,7 @@ 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();
}
}
@ -59,7 +61,7 @@ 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();
}
@ -73,7 +75,7 @@ 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;
}
@ -81,7 +83,8 @@ void* bootstrap_thread_func(void* x) {
* Start a thread and wait for its initialization
*/
void SystemThread::start(std::function<void(SystemThreadInterface&)> f) {
printf("# Initialize %s...\n", name.c_str());
spdlog::debug("# Initialize {}...", name.c_str());
function = f;
thread = std::thread(bootstrap_thread_func, this);
running = true;
@ -118,7 +121,7 @@ void SystemThreadInterface::initialization_complete() {
std::unique_lock<std::mutex> 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());
}
/*!

1
third-party/spdlog vendored Submodule

@ -0,0 +1 @@
Subproject commit cbe9448650176797739dbab13961ef4c07f4290f