Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

Merge pull request #9771 from ameerj/host-thread-id

liamwhite0af0887f0155
diff --cc src/core/hle/kernel/kernel.cpp
index 3a68a56332,ece20a6439..2ff253183b
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@@ -367,23 -363,20 +367,24 @@@ struct KernelCore::Impl
}
}
- void MakeCurrentProcess(KProcess* process) {
- current_process = process;
+ void InitializeGlobalData(KernelCore& kernel) {
+ object_name_global_data = std::make_unique<KObjectNameGlobalData>(kernel);
+ }
+
+ void MakeApplicationProcess(KProcess* process) {
+ application_process = process;
}
- static inline thread_local u32 host_thread_id = UINT32_MAX;
-
- /// Gets the host thread ID for the caller, allocating a new one if this is the first time
- u32 GetHostThreadId(std::size_t core_id) {
- if (host_thread_id == UINT32_MAX) {
- // The first four slots are reserved for CPU core threads
- ASSERT(core_id < Core::Hardware::NUM_CPU_CORES);
- host_thread_id = static_cast<u32>(core_id);
- }
+ static inline thread_local u8 host_thread_id = UINT8_MAX;
+
+ /// Sets the host thread ID for the caller.
+ u32 SetHostThreadId(std::size_t core_id) {
+ // This should only be called during core init.
+ ASSERT(host_thread_id == UINT8_MAX);
+
+ // The first four slots are reserved for CPU core threads
+ ASSERT(core_id < Core::Hardware::NUM_CPU_CORES);
+ host_thread_id = static_cast<u8>(core_id);
return host_thread_id;
}