Skip to content

Commit a8a9455

Browse files
committed
expose is_entrypoint API (also rename main => entrypoint) (N64Recomp#147)
1 parent c043dc3 commit a8a9455

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

ultramodern/include/ultramodern/ultramodern.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ enum class ThreadPriority {
9696
void set_native_thread_name(const std::string& name);
9797
void set_native_thread_priority(ThreadPriority pri);
9898
PTR(OSThread) this_thread();
99-
void set_main_thread();
99+
void set_entrypoint_thread();
100+
bool is_entrypoint_thread();
100101
bool is_game_thread();
101102
void submit_rsp_task(RDRAM_ARG PTR(OSTask) task);
102103
void send_si_message();

ultramodern/src/threads.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@ std::string ultramodern::threads::get_game_thread_name(const OSThread* t) {
2929

3030
extern "C" void bootproc();
3131

32-
thread_local bool is_main_thread = false;
32+
thread_local bool is_entrypoint_thread = false;
3333
// Whether this thread is part of the game (i.e. the start thread or one spawned by osCreateThread)
3434
thread_local bool is_game_thread = false;
3535
thread_local PTR(OSThread) thread_self = NULLPTR;
3636

37-
void ultramodern::set_main_thread() {
37+
void ultramodern::set_entrypoint_thread() {
3838
::is_game_thread = true;
39-
is_main_thread = true;
39+
::is_entrypoint_thread = true;
40+
}
41+
42+
bool ultramodern::is_entrypoint_thread() {
43+
return ::is_entrypoint_thread;
4044
}
4145

4246
bool ultramodern::is_game_thread() {
@@ -45,7 +49,7 @@ bool ultramodern::is_game_thread() {
4549

4650
#if 0
4751
int main(int argc, char** argv) {
48-
ultramodern::set_main_thread();
52+
ultramodern::set_entrypoint_thread();
4953

5054
bootproc();
5155
}

ultramodern/src/ultrainit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void ultramodern::set_callbacks(
2222
}
2323

2424
void ultramodern::preinit(RDRAM_ARG ultramodern::renderer::WindowHandle window_handle) {
25-
ultramodern::set_main_thread();
25+
ultramodern::set_entrypoint_thread();
2626
ultramodern::init_events(PASS_RDRAM window_handle);
2727
ultramodern::init_timers(PASS_RDRAM1);
2828
ultramodern::init_audio();

0 commit comments

Comments
 (0)