mirror of
https://github.com/N64Recomp/N64ModernRuntime.git
synced 2026-05-10 19:01:53 +00:00
Updates for game registering
This commit is contained in:
parent
e3e7024342
commit
7e66a9af84
2 changed files with 5 additions and 12 deletions
|
|
@ -16,7 +16,8 @@ namespace recomp {
|
||||||
std::span<const char> cache_data;
|
std::span<const char> cache_data;
|
||||||
bool is_enabled;
|
bool is_enabled;
|
||||||
|
|
||||||
void (*entrypoint)();
|
gpr entrypoint_address;
|
||||||
|
void (*entrypoint)(uint8_t* rdram, recomp_context* context);
|
||||||
|
|
||||||
std::u8string stored_filename() const;
|
std::u8string stored_filename() const;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -346,24 +346,16 @@ void run_thread_function(uint8_t* rdram, uint64_t addr, uint64_t sp, uint64_t ar
|
||||||
func(rdram, &ctx);
|
func(rdram, &ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recomp generation functions
|
|
||||||
extern "C" void recomp_entrypoint(uint8_t * rdram, recomp_context * ctx);
|
|
||||||
gpr get_entrypoint_address();
|
|
||||||
const char* get_rom_name();
|
|
||||||
|
|
||||||
void read_patch_data(uint8_t* rdram, gpr patch_data_address) {
|
void read_patch_data(uint8_t* rdram, gpr patch_data_address) {
|
||||||
for (size_t i = 0; i < patch_data.size(); i++) {
|
for (size_t i = 0; i < patch_data.size(); i++) {
|
||||||
MEM_B(i, patch_data_address) = patch_data[i];
|
MEM_B(i, patch_data_address) = patch_data[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(uint8_t* rdram, recomp_context* ctx) {
|
void init(uint8_t* rdram, recomp_context* ctx, gpr entrypoint) {
|
||||||
// Initialize the overlays
|
// Initialize the overlays
|
||||||
init_overlays();
|
init_overlays();
|
||||||
|
|
||||||
// Get entrypoint from recomp function
|
|
||||||
gpr entrypoint = get_entrypoint_address();
|
|
||||||
|
|
||||||
// Load overlays in the first 1MB
|
// Load overlays in the first 1MB
|
||||||
load_overlays(0x1000, (int32_t)entrypoint, 1024 * 1024);
|
load_overlays(0x1000, (int32_t)entrypoint, 1024 * 1024);
|
||||||
|
|
||||||
|
|
@ -483,9 +475,9 @@ void recomp::start(ultramodern::WindowHandle window_handle, const recomp::rsp::c
|
||||||
const recomp::GameEntry& game_entry = find_it->second;
|
const recomp::GameEntry& game_entry = find_it->second;
|
||||||
|
|
||||||
ultramodern::load_shader_cache(game_entry.cache_data);
|
ultramodern::load_shader_cache(game_entry.cache_data);
|
||||||
init(rdram, &context);
|
init(rdram, &context, game_entry.entrypoint_address);
|
||||||
try {
|
try {
|
||||||
recomp_entrypoint(rdram, &context);
|
game_entry.entrypoint(rdram, &context);
|
||||||
} catch (ultramodern::thread_terminated& terminated) {
|
} catch (ultramodern::thread_terminated& terminated) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue