mirror of
https://github.com/N64Recomp/N64ModernRuntime.git
synced 2026-05-11 03:12:15 +00:00
Move destroy_ui to gfx_callbacks_t and change recomp::start to require rsp_callbacks_t
This commit is contained in:
parent
0da09d45c1
commit
f5dd551e9e
6 changed files with 22 additions and 15 deletions
|
|
@ -38,7 +38,7 @@ namespace recomp {
|
|||
void set_rom_contents(std::vector<uint8_t>&& new_rom);
|
||||
void do_rom_read(uint8_t* rdram, gpr ram_address, uint32_t physical_addr, size_t num_bytes);
|
||||
void do_rom_pio(uint8_t* rdram, gpr ram_address, uint32_t physical_addr);
|
||||
void start(ultramodern::WindowHandle window_handle, const ultramodern::audio_callbacks_t& audio_callbacks, const ultramodern::input_callbacks_t& input_callbacks, const ultramodern::gfx_callbacks_t& gfx_callbacks);
|
||||
void start(ultramodern::WindowHandle window_handle, const ultramodern::audio_callbacks_t& audio_callbacks, const ultramodern::input_callbacks_t& input_callbacks, const ultramodern::gfx_callbacks_t& gfx_callbacks, const ultramodern::rsp::rsp_callbacks_t& rsp_callbacks_);
|
||||
void start_game(std::u8string game_id);
|
||||
void message_box(const char* message);
|
||||
std::filesystem::path get_app_folder_path();
|
||||
|
|
|
|||
|
|
@ -426,10 +426,11 @@ void ultramodern::quit() {
|
|||
current_game.reset();
|
||||
}
|
||||
|
||||
void recomp::start(ultramodern::WindowHandle window_handle, const ultramodern::audio_callbacks_t& audio_callbacks, const ultramodern::input_callbacks_t& input_callbacks, const ultramodern::gfx_callbacks_t& gfx_callbacks_) {
|
||||
void recomp::start(ultramodern::WindowHandle window_handle, const ultramodern::audio_callbacks_t& audio_callbacks, const ultramodern::input_callbacks_t& input_callbacks, const ultramodern::gfx_callbacks_t& gfx_callbacks_, const ultramodern::rsp::rsp_callbacks_t& rsp_callbacks_) {
|
||||
recomp::check_all_stored_roms();
|
||||
set_audio_callbacks(audio_callbacks);
|
||||
set_input_callbacks(input_callbacks);
|
||||
ultramodern::rsp::set_callbacks(rsp_callbacks_);
|
||||
|
||||
ultramodern::gfx_callbacks_t gfx_callbacks = gfx_callbacks_;
|
||||
|
||||
|
|
@ -499,6 +500,13 @@ void recomp::start(ultramodern::WindowHandle window_handle, const ultramodern::a
|
|||
gfx_callbacks.update_gfx(gfx_data);
|
||||
}
|
||||
}
|
||||
|
||||
// moved from ultarmodern/src/events.cpp/gfx_thread_func
|
||||
// TODO: is it fine to have it here?
|
||||
if (gfx_callbacks.destroy_ui != nullptr) {
|
||||
gfx_callbacks.destroy_ui();
|
||||
}
|
||||
|
||||
game_thread.join();
|
||||
ultramodern::join_event_threads();
|
||||
ultramodern::join_thread_cleaner_thread();
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@ namespace ultramodern {
|
|||
* Simulate a DMA copy from RDRAM (CPU) to DMEM (RSP).
|
||||
*
|
||||
* This function should fill the ultramodern's `dmem` by reading from the `rdram` parameter.
|
||||
*
|
||||
* IMPORTANTE: This callback is required and must be non-`nullptr` when initializing the user callbacks.
|
||||
*/
|
||||
void (*dma_rdram_to_dmem)(uint8_t* rdram, uint32_t dmem_addr, uint32_t dram_addr, uint32_t rd_len);
|
||||
|
||||
|
|
@ -41,8 +39,6 @@ namespace ultramodern {
|
|||
* The full OSTask (`task` parameter) is passed in case the `task_type` number is not enough information to distinguish out the exact microcode function.
|
||||
*
|
||||
* This function is allowed to return `nullptr` if no microcode matches the specified task. In this case a message will be printed to stderr and the program will exit.
|
||||
*
|
||||
* IMPORTANTE: This callback is required and must be non-`nullptr` when initializing the user callbacks.
|
||||
*/
|
||||
RspUcodeFunc* (*get_rsp_microcode)(uint32_t task_type, OSTask* task);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
# undef Success
|
||||
#endif
|
||||
|
||||
#include <ultramodern/rsp_stuff.hpp>
|
||||
|
||||
struct UltraThreadContext {
|
||||
std::thread host_thread;
|
||||
moodycamel::LightweightSemaphore running;
|
||||
|
|
@ -132,6 +134,7 @@ struct audio_callbacks_t {
|
|||
set_frequency_t* set_frequency;
|
||||
};
|
||||
|
||||
// TODO: This really isn't used by ultramodern. Should we move it to librecomp instead?
|
||||
// Input
|
||||
struct input_callbacks_t {
|
||||
using poll_input_t = void(void);
|
||||
|
|
@ -142,14 +145,21 @@ struct input_callbacks_t {
|
|||
set_rumble_t* set_rumble;
|
||||
};
|
||||
|
||||
// TODO: This really isn't used by ultramodern. Should we move it to librecomp instead?
|
||||
struct gfx_callbacks_t {
|
||||
using gfx_data_t = void*;
|
||||
using create_gfx_t = gfx_data_t();
|
||||
using create_window_t = WindowHandle(gfx_data_t);
|
||||
using update_gfx_t = void(gfx_data_t);
|
||||
using destroy_ui_t = void();
|
||||
|
||||
create_gfx_t* create_gfx;
|
||||
create_window_t* create_window;
|
||||
update_gfx_t* update_gfx;
|
||||
|
||||
// TODO: Since we have a destroy_ui we could provide an init_ui?
|
||||
// void (*init_ui)();
|
||||
destroy_ui_t* destroy_ui;
|
||||
};
|
||||
|
||||
bool is_game_started();
|
||||
|
|
|
|||
|
|
@ -14,10 +14,6 @@ namespace ultramodern {
|
|||
void (*update_rumble)();
|
||||
void (*update_supported_options)();
|
||||
|
||||
// TODO: Since we have a destroy_ui we could provide an init_ui?
|
||||
// void (*init_ui)();
|
||||
void (*destroy_ui)();
|
||||
|
||||
/**
|
||||
* Show an OS dialog with the given `msg`.
|
||||
* `msg` is non-`nullptr`.
|
||||
|
|
@ -26,12 +22,12 @@ namespace ultramodern {
|
|||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
void register_user_callbacks(UserCallbacks& callbacks);
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
const UserCallbacks& get_user_callbacks();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -337,9 +337,6 @@ void gfx_thread_func(uint8_t* rdram, moodycamel::LightweightSemaphore* thread_re
|
|||
}
|
||||
}
|
||||
|
||||
if (user_callbacks.destroy_ui != nullptr) {
|
||||
user_callbacks.destroy_ui();
|
||||
}
|
||||
rt64.shutdown();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue