Move init_saving to recomp:start from ultramodern::preinit and some other fixes

This commit is contained in:
angie 2024-05-28 17:21:03 -04:00 committed by Angie
parent d38e10eac4
commit d1c40a4435
6 changed files with 10 additions and 8 deletions

View file

@ -16,8 +16,9 @@ namespace recomp {
size_t len;
};
extern void register_overlays(const overlay_section_table_data_t& sections, const overlays_by_index_t& overlays);
extern void register_patch_section(SectionTableEntry* code_sections);
void register_overlays(const overlay_section_table_data_t& sections, const overlays_by_index_t& overlays);
void register_patch_section(SectionTableEntry* code_sections);
void load_patch_functions();
};
extern "C" void load_overlays(uint32_t rom, int32_t ram_addr, uint32_t size);

View file

@ -142,8 +142,6 @@ extern "C" void unload_overlays(int32_t ram_addr, uint32_t size) {
}
}
void load_patch_functions();
void init_overlays() {
section_addresses = (int32_t *)malloc(sections_info.total_num_sections * sizeof(int32_t));
@ -158,7 +156,7 @@ void init_overlays() {
}
);
load_patch_functions();
recomp::load_patch_functions();
}
extern "C" recomp_func_t * get_function(int32_t addr) {

View file

@ -9,10 +9,10 @@ static SectionTableEntry* code_sections = nullptr;
void load_special_overlay(const SectionTableEntry& section, int32_t ram);
void register_patch_section(SectionTableEntry* sections) {
void recomp::register_patch_section(SectionTableEntry* sections) {
code_sections = sections;
}
void load_patch_functions() {
void recomp::load_patch_functions() {
load_special_overlay(code_sections[0], code_sections[0].ram_addr);
}

View file

@ -95,6 +95,8 @@ struct {
const std::u8string save_folder = u8"saves";
extern std::filesystem::path config_path;
std::filesystem::path get_save_file_path() {
return config_path / save_folder / (std::u8string{recomp::current_game_id()} + u8".bin");
}

View file

@ -450,6 +450,8 @@ void recomp::start(ultramodern::WindowHandle window_handle, const recomp::rsp::c
ultramodern::error_handling::message_box("Error opening stored ROM! Please restart this program.");
}
ultramodern::init_saving(rdram);
auto find_it = game_roms.find(current_game.value());
const recomp::GameEntry& game_entry = find_it->second;

View file

@ -22,7 +22,6 @@ void ultramodern::preinit(RDRAM_ARG ultramodern::WindowHandle window_handle) {
ultramodern::init_events(PASS_RDRAM window_handle);
ultramodern::init_timers(PASS_RDRAM1);
ultramodern::init_audio();
ultramodern::init_saving(PASS_RDRAM1);
ultramodern::init_thread_cleanup();
}