Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ultramodern/include/ultramodern/ultramodern.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 8 additions & 4 deletions ultramodern/src/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion ultramodern/src/ultrainit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading