expose is_entrypoint API (also rename main => entrypoint) (#147)

This commit is contained in:
Garrett Smith 2026-05-26 21:35:34 -07:00 committed by GitHub
parent 03c3bd8d08
commit 192fb96efa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 6 deletions

View file

@ -96,7 +96,8 @@ enum class ThreadPriority {
void set_native_thread_name(const std::string& name);
void set_native_thread_priority(ThreadPriority pri);
PTR(OSThread) this_thread();
void set_main_thread();
void set_entrypoint_thread();
bool is_entrypoint_thread();
bool is_game_thread();
void submit_rsp_task(RDRAM_ARG PTR(OSTask) task);
void send_si_message();

View file

@ -29,14 +29,18 @@ std::string ultramodern::threads::get_game_thread_name(const OSThread* t) {
extern "C" void bootproc();
thread_local bool is_main_thread = false;
thread_local bool is_entrypoint_thread = false;
// Whether this thread is part of the game (i.e. the start thread or one spawned by osCreateThread)
thread_local bool is_game_thread = false;
thread_local PTR(OSThread) thread_self = NULLPTR;
void ultramodern::set_main_thread() {
void ultramodern::set_entrypoint_thread() {
::is_game_thread = true;
is_main_thread = true;
::is_entrypoint_thread = true;
}
bool ultramodern::is_entrypoint_thread() {
return ::is_entrypoint_thread;
}
bool ultramodern::is_game_thread() {
@ -45,7 +49,7 @@ bool ultramodern::is_game_thread() {
#if 0
int main(int argc, char** argv) {
ultramodern::set_main_thread();
ultramodern::set_entrypoint_thread();
bootproc();
}

View file

@ -22,7 +22,7 @@ void ultramodern::set_callbacks(
}
void ultramodern::preinit(RDRAM_ARG ultramodern::renderer::WindowHandle window_handle) {
ultramodern::set_main_thread();
ultramodern::set_entrypoint_thread();
ultramodern::init_events(PASS_RDRAM window_handle);
ultramodern::init_timers(PASS_RDRAM1);
ultramodern::init_audio();