diff --git a/configure.py b/configure.py index 313d24f55c..147b7150e7 100755 --- a/configure.py +++ b/configure.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +print("You do not need to run configure.py for Dusk! This file is here to avoid conflicts with decomp.") +print("Use CMake to configure your build instead.") +exit(1) + ### # Generates build files for the project. # This file also includes the project configuration, diff --git a/libs/JSystem/src/JFramework/JFWDisplay.cpp b/libs/JSystem/src/JFramework/JFWDisplay.cpp index 26788f9f38..a726889863 100644 --- a/libs/JSystem/src/JFramework/JFWDisplay.cpp +++ b/libs/JSystem/src/JFramework/JFWDisplay.cpp @@ -5,6 +5,7 @@ #include #include #include +#include "SDL3/SDL_timer.h" #include "JSystem/J2DGraph/J2DOrthoGraph.h" #include "JSystem/JFramework/JFWDisplay.h" #include "JSystem/JKernel/JKRHeap.h" @@ -384,6 +385,12 @@ static void waitForTick(u32 p1, u16 p2) { JSUList JFWAlarm::sList(false); +#if TARGET_PC +void JFWDisplay::threadSleep(s64 time) { + SDL_DelayNS(OSTicksToMicroseconds(time) * 1'000); +} +#else + static void JFWThreadAlarmHandler(OSAlarm* p_alarm, OSContext* p_ctx) { JFWAlarm* alarm = static_cast(p_alarm); alarm->removeLink(); @@ -401,6 +408,7 @@ void JFWDisplay::threadSleep(s64 time) { OSSuspendThread(alarm.getThread()); OSRestoreInterrupts(status); } +#endif static void dummy() { JUTXfb::getManager()->setDisplayingXfbIndex(0); diff --git a/libs/JSystem/src/JKernel/JKRThread.cpp b/libs/JSystem/src/JKernel/JKRThread.cpp index 103e6bbcbc..31c2cbe6e5 100644 --- a/libs/JSystem/src/JKernel/JKRThread.cpp +++ b/libs/JSystem/src/JKernel/JKRThread.cpp @@ -88,7 +88,11 @@ void JKRThread::setCommon_heapSpecified(JKRHeap* heap, u32 stack_size, int param mThreadRecord = (OSThread*)JKRAllocFromHeap(mHeap, sizeof(OSThread), 0x20); JUT_ASSERT(168, mThreadRecord); - OSCreateThread(mThreadRecord, start, this, (u8*)mStackMemory + mStackSize, mStackSize, param_3, 1); +#if TARGET_PC + OSCreateThread(mThreadRecord, start, this, (u8*)mStackMemory + mStackSize, mStackSize, param_3, 0); +#else + OSCreateThread(mThreadRecord, start, this, (u8*)mStackMemory + mStackSize, mStackSize, param_3, OS_THREAD_ATTR_DETACH); +#endif } void* JKRThread::start(void* thread) { diff --git a/src/dusk/OSThread.cpp b/src/dusk/OSThread.cpp index af339e8656..d5d73df243 100644 --- a/src/dusk/OSThread.cpp +++ b/src/dusk/OSThread.cpp @@ -41,7 +41,7 @@ struct PCThreadData { bool suspended = false; ~PCThreadData() { - if (dusk::IsShuttingDown) { + if (dusk::IsShuttingDown && nativeThread.joinable()) { // Don't care about threads if we're shutting down. nativeThread.detach(); }