Windows threading fixes

Further cripple Deci2Listener pending Windows implementation, finish converting POSIX threads to std::thread. Hardcoded pathing in overlord\fake_iso.cpp until environment variables can be implemented for Windows.

Currently loads KERNEL.CGO and links gcommon object file, but crashes when executing due to Windows/Linux differences.
This commit is contained in:
doctaweed
2020-08-28 11:59:20 -06:00
parent 92976234a1
commit 2138beb150
5 changed files with 23 additions and 10 deletions
+1 -1
View File
@@ -153,7 +153,7 @@ void InitCD() {
/*!
* Initialize the I/O Processor
* Removed calls to exit(0) if loading modules fails.
* Removed calls to exit(0) if loading modules fails.
*/
void InitIOP() {
// before doing anything with the I/O Processor, we need to set up SIF RPC
+10 -5
View File
@@ -79,14 +79,20 @@ static const char* next_dir = nullptr;
*/
int FS_Init(u8* buffer) {
(void)buffer;
// get path to next/. Will be set in the gk.sh launch script.
next_dir = std::getenv("NEXT_DIR"); // todo windows?
// get path to next/. Will be set in the gk.sh launch script. This is for Linux only
/*
next_dir = std::getenv("NEXT_DIR"); // todo windows?
assert(next_dir);
// get path to next/data/fake_iso.txt, the map file.
char fakeiso_path[512];
strcpy(fakeiso_path, next_dir);
strcat(fakeiso_path, "/game/fake_iso.txt"); // todo windows paths?
*/
char fakeiso_path[] = "C:\\Users\\Shalen\\Documents\\GitHub\\jak-project-windows-proj\\game\\fake_iso.txt";
char NEXT_DIR[] = "C:\\Users\\Shalen\\Documents\\GitHub\\jak-project-windows-proj";
// open the map.
FILE* fp = fopen(fakeiso_path, "r");
@@ -96,7 +102,7 @@ int FS_Init(u8* buffer) {
rewind(fp);
char* fakeiso = (char*)malloc(len);
if (fread(fakeiso, len, 1, fp) != 1) {
assert(false);
assert(true);
}
// loop over lines
@@ -190,8 +196,7 @@ FileRecord* FS_FindIN(const char* iso_name) {
static const char* get_file_path(FileRecord* fr) {
assert(fr->location < fake_iso_entry_count);
static char path_buffer[1024];
strcpy(path_buffer, next_dir);
strcat(path_buffer, "/");
strcpy(path_buffer, "C:\\Users\\Shalen\\Documents\\GitHub\\jak-project\\");
strcat(path_buffer, fake_iso_entries[fr->location].file_path);
return path_buffer;
}
+10 -2
View File
@@ -39,6 +39,10 @@
u8* g_ee_main_mem = nullptr;
/*!
* runtime.cpp - Deci2Listener has been disabled for now, pending rewriting for Windows.
*/
namespace {
/*!
@@ -48,7 +52,11 @@ namespace {
void deci2_runner(SystemThreadInterface& interfaces) {
// // callback function so the server knows when to give up and shutdown
interfaces.initialization_complete();
while (true) {
}
// // callback function so the server knows when to give up and shutdown
// std::function<bool()> shutdown_callback = [&]() { return interfaces.get_want_exit(); };
//
// // create and register server
@@ -237,7 +245,7 @@ void exec_runtime(int argc, char** argv) {
// step 3: start the EE!
iop_thread.start(iop_runner);
ee_thread.start(ee_runner);
//deci_thread.start(deci2_runner);
deci_thread.start(deci2_runner);
// step 4: wait for EE to signal a shutdown, which will cause the DECI thread to join.
deci_thread.join();
+1 -1
View File
@@ -19,7 +19,7 @@ s32 IOP_Kernel::CreateThread(std::string name, u32 (*func)()) {
if(func) {
_currentThread = ID;
// create OS thread, will run the setupThread function
//threads.back().thread = new std::thread(&IOP_Kernel::setupThread, this, ID); --- quick hack to make the build
threads.back().thread = new std::thread(&IOP_Kernel::setupThread, this, ID);
// wait for thread to finish setup.
threads.back().waitForReturnToKernel();
// ensure we are back in the kernel.
+1 -1
View File
@@ -83,7 +83,7 @@ void* bootstrap_thread_func(void* x) {
void SystemThread::start(std::function<void(SystemThreadInterface&)> f) {
printf("# Initialize %s...\n", name.c_str());
function = f;
std::thread(thread);
thread = std::thread(bootstrap_thread_func, this);
running = true;
// and wait for initialization