Implemented proper ROM selection menu

This commit is contained in:
Mr-Wiseguy
2024-03-03 21:00:49 -05:00
parent 302d88fd84
commit ca66fdddbb
16 changed files with 387 additions and 97 deletions
+6 -6
View File
@@ -218,7 +218,7 @@ void run_rsp_microcode(uint8_t* rdram, const OSTask* task, RspUcodeFunc* ucode_f
}
void task_thread_func(uint8_t* rdram, uint8_t* rom, std::atomic_flag* thread_ready) {
void task_thread_func(uint8_t* rdram, std::atomic_flag* thread_ready) {
ultramodern::set_native_thread_name("SP Task Thread");
ultramodern::set_native_thread_priority(ultramodern::ThreadPriority::Normal);
@@ -284,7 +284,7 @@ uint32_t ultramodern::get_target_framerate(uint32_t original) {
}
}
void gfx_thread_func(uint8_t* rdram, uint8_t* rom, std::atomic_flag* thread_ready, ultramodern::WindowHandle window_handle) {
void gfx_thread_func(uint8_t* rdram, std::atomic_flag* thread_ready, ultramodern::WindowHandle window_handle) {
bool enabled_instant_present = false;
using namespace std::chrono_literals;
@@ -293,7 +293,7 @@ void gfx_thread_func(uint8_t* rdram, uint8_t* rom, std::atomic_flag* thread_read
ultramodern::GraphicsConfig old_config;
RT64::Application* application = RT64Init(rom, rdram, window_handle, cur_config.load().developer_mode);
RT64::Application* application = RT64Init(rdram, window_handle, cur_config.load().developer_mode);
if (application == nullptr) {
throw std::runtime_error("Failed to initialize RT64!");
@@ -511,12 +511,12 @@ void ultramodern::send_si_message() {
osSendMesg(PASS_RDRAM events_context.si.mq, events_context.si.msg, OS_MESG_NOBLOCK);
}
void ultramodern::init_events(uint8_t* rdram, uint8_t* rom, ultramodern::WindowHandle window_handle) {
void ultramodern::init_events(uint8_t* rdram, ultramodern::WindowHandle window_handle) {
std::atomic_flag gfx_thread_ready;
std::atomic_flag task_thread_ready;
events_context.rdram = rdram;
events_context.sp.gfx_thread = std::thread{ gfx_thread_func, rdram, rom, &gfx_thread_ready, window_handle };
events_context.sp.task_thread = std::thread{ task_thread_func, rdram, rom, &task_thread_ready };
events_context.sp.gfx_thread = std::thread{ gfx_thread_func, rdram, &gfx_thread_ready, window_handle };
events_context.sp.task_thread = std::thread{ task_thread_func, rdram, &task_thread_ready };
// Wait for the two sp threads to be ready before continuing to prevent the game from
// running before we're able to handle RSP tasks.
+2 -2
View File
@@ -1,9 +1,9 @@
#include "ultra64.h"
#include "ultramodern.hpp"
void ultramodern::preinit(uint8_t* rdram, uint8_t* rom, ultramodern::WindowHandle window_handle) {
void ultramodern::preinit(uint8_t* rdram, ultramodern::WindowHandle window_handle) {
ultramodern::set_main_thread();
ultramodern::init_events(rdram, rom, window_handle);
ultramodern::init_events(rdram, window_handle);
ultramodern::init_timers(rdram);
ultramodern::init_audio();
ultramodern::save_init();
+2 -4
View File
@@ -51,10 +51,10 @@ constexpr int32_t cart_handle = 0x80800000;
constexpr int32_t flash_handle = (int32_t)(cart_handle + sizeof(OSPiHandle));
constexpr uint32_t save_size = 1024 * 1024 / 8; // Maximum save size, 1Mbit for flash
void preinit(uint8_t* rdram, uint8_t* rom, WindowHandle window_handle);
void preinit(uint8_t* rdram, WindowHandle window_handle);
void save_init();
void init_scheduler();
void init_events(uint8_t* rdram, uint8_t* rom, WindowHandle window_handle);
void init_events(uint8_t* rdram, WindowHandle window_handle);
void init_timers(RDRAM_ARG1);
void set_self_paused(RDRAM_ARG1);
void yield_self(RDRAM_ARG1);
@@ -129,8 +129,6 @@ struct gfx_callbacks_t {
create_window_t* create_window;
update_gfx_t* update_gfx;
};
void start(WindowHandle window_handle, const audio_callbacks_t& audio_callbacks, const input_callbacks_t& input_callbacks, const gfx_callbacks_t& gfx_callbacks);
void start_game(int game);
bool is_game_started();
void quit();
void join_event_threads();