From b0217073b5726c737c79fc4071e980ccb733aa23 Mon Sep 17 00:00:00 2001 From: Pistonight Date: Wed, 9 Sep 2026 02:05:49 -0700 Subject: [PATCH] os: fix ThreadType size for newer sdk versions --- include/nn/os/os_ThreadTypes.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/nn/os/os_ThreadTypes.h b/include/nn/os/os_ThreadTypes.h index 2794d507..d5161596 100644 --- a/include/nn/os/os_ThreadTypes.h +++ b/include/nn/os/os_ThreadTypes.h @@ -38,7 +38,10 @@ struct ThreadType { ThreadFunction _threadFunction; FiberType* _currentFiber; FiberType* _initialFiber; + // may be inaccurate: SDK 4.4.0 and 5.4.150 has the field while 7.3.2 and 20.5.6 does not +#if NN_SDK_VER < NN_MAKE_VER(6, 0, 0) uint32_t _lockHistory; +#endif uintptr_t _tlsValueArray[32]; char _threadNameBuffer[32]; const char* _namePointer; @@ -47,9 +50,13 @@ struct ThreadType { detail::InternalThreadHandle _handle; }; #ifdef SWITCH +#if NN_SDK_VER < NN_MAKE_VER(6, 0, 0) // see _lockHistory above static_assert(sizeof(ThreadType) == 0x1C0, "Wrong size"); +#else +static_assert(sizeof(ThreadType) == 0x1B8, "Wrong size"); +#endif #endif } // namespace os -} // namespace nn \ No newline at end of file +} // namespace nn