From 9d3877e448b6d985a82aa1ef521ca77fd33dc669 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Wed, 8 Apr 2026 13:30:50 +0200 Subject: [PATCH 1/3] Fix JKRDecomp crash I caused By changing more things :sloggers: --- libs/JSystem/src/JKernel/JKRThread.cpp | 6 +++++- src/dusk/OSThread.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) 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(); } From 4ad00e3f043e9d9bf682bab687356305b418f47b Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Wed, 8 Apr 2026 01:06:42 +0200 Subject: [PATCH 2/3] Make waitForTick properly sleep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was spinwaiting 💀 --- libs/JSystem/src/JFramework/JFWDisplay.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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); From b81769d1c86da504d5b7888bfa10e73ca484da59 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Thu, 9 Apr 2026 19:01:58 +0200 Subject: [PATCH 3/3] Make configure.py explicitly refuse since it's not needed anymore Avoid people getting confused if they try to run it. --- configure.py | 4 ++++ 1 file changed, 4 insertions(+) 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,