diff --git a/config/RSBE01_02/splits.txt b/config/RSBE01_02/splits.txt index 5e32758..1739d0c 100644 --- a/config/RSBE01_02/splits.txt +++ b/config/RSBE01_02/splits.txt @@ -58,6 +58,9 @@ sora/gf/gf_keep_fb.cpp: sora/gf/gf_memory_util.cpp: .text start:0x80026474 end:0x80026478 +sora/gf/gf_thread.cpp: + .text start:0x8002F5B8 end:0x8002F6F4 + sora/gf/gf_system_callback.cpp: .text start:0x80038684 end:0x800387AC .ctors start:0x80406508 end:0x8040650C diff --git a/config/RSBE01_02/symbols.txt b/config/RSBE01_02/symbols.txt index 4903364..3f090de 100644 --- a/config/RSBE01_02/symbols.txt +++ b/config/RSBE01_02/symbols.txt @@ -2695,9 +2695,9 @@ fn_8002F048 = .text:0x8002F048; // type:function size:0xA4 fn_8002F0EC = .text:0x8002F0EC; // type:function size:0x9C fn_8002F188 = .text:0x8002F188; // type:function size:0x32C fn_8002F4B4 = .text:0x8002F4B4; // type:function size:0x104 -fn_8002F5B8 = .text:0x8002F5B8; // type:function size:0x70 -fn_8002F628 = .text:0x8002F628; // type:function size:0x98 -fn_8002F6C0 = .text:0x8002F6C0; // type:function size:0x34 +__dt__8gfThreadFv = .text:0x8002F5B8; // type:function size:0x70 +createThread__8gfThreadFP10gfRunnableUlUlQ25Heaps8HeapType = .text:0x8002F628; // type:function size:0x98 +startThread__8gfThreadFPv = .text:0x8002F6C0; // type:function size:0x34 fn_8002F6F4 = .text:0x8002F6F4; // type:function size:0x2F4 fn_8002F9E8 = .text:0x8002F9E8; // type:function size:0x40C fn_8002FDF4 = .text:0x8002FDF4; // type:function size:0x54 diff --git a/configure.py b/configure.py index 3ab97fc..8a25575 100755 --- a/configure.py +++ b/configure.py @@ -300,6 +300,7 @@ def MatchingFor(*versions): Object(Matching, "sora/gf/gf_gameframe_counter.cpp"), Object(Matching, "sora/gf/gf_keep_fb.cpp"), Object(Matching, "sora/gf/gf_memory_util.cpp"), + Object(Matching, "sora/gf/gf_thread.cpp"), Object(Matching, "sora/mt/mt_prng.cpp", extra_cflags=["-RTTI off"]), Object(Matching, "sora/st/module.cpp"), Object(Matching, "sora/ef/ef_screen_handle.cpp"), diff --git a/include/lib/BrawlHeaders b/include/lib/BrawlHeaders index 630b0f2..2dcad7a 160000 --- a/include/lib/BrawlHeaders +++ b/include/lib/BrawlHeaders @@ -1 +1 @@ -Subproject commit 630b0f2e4fe99431c0cf4c37c9fcac1032b21ea1 +Subproject commit 2dcad7ac820e433f0a83cfdda63280c2793bd95e diff --git a/src/sora/gf/gf_thread.cpp b/src/sora/gf/gf_thread.cpp new file mode 100644 index 0000000..c1f2784 --- /dev/null +++ b/src/sora/gf/gf_thread.cpp @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include + +gfThread::~gfThread() { + u32 discard; + OSJoinThread(&m_thread, &discard); + gfHeapManager::free(m_stackLow); +} + +void gfThread::createThread(gfRunnable* startRoutine, u32 priority, u32 stackSize, Heaps::HeapType heap) { + unk32C = 0; + m_stackSize = stackSize; + m_priority = priority; + m_stackHi = nullptr; + m_attach = 0; + if (startRoutine) { + m_startRoutine = startRoutine; + } else { + m_startRoutine = this; + } + void* stack = gfHeapManager::alloc(heap, stackSize); + m_stackLow = stack; + m_stackHi = static_cast(stack) + stackSize; + OSCreateThread(&m_thread, startThread, this, m_stackHi, m_stackSize, m_priority, m_attach); +} + +void* gfThread::startThread(void* arg) { + static_cast(arg)->m_startRoutine->run(); + return nullptr; +}