diff --git a/librecomp/include/recomp_overlays.h b/librecomp/include/recomp_overlays.h index 1589e30..97c5942 100644 --- a/librecomp/include/recomp_overlays.h +++ b/librecomp/include/recomp_overlays.h @@ -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); diff --git a/librecomp/src/overlays.cpp b/librecomp/src/overlays.cpp index a091470..12764cf 100644 --- a/librecomp/src/overlays.cpp +++ b/librecomp/src/overlays.cpp @@ -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) { diff --git a/librecomp/src/patch_loading.cpp b/librecomp/src/patch_loading.cpp index 0e8effd..e456a51 100644 --- a/librecomp/src/patch_loading.cpp +++ b/librecomp/src/patch_loading.cpp @@ -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); } diff --git a/librecomp/src/pi.cpp b/librecomp/src/pi.cpp index ea16f3b..2234f82 100644 --- a/librecomp/src/pi.cpp +++ b/librecomp/src/pi.cpp @@ -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"); } diff --git a/librecomp/src/recomp.cpp b/librecomp/src/recomp.cpp index 139cb48..2f77f7c 100644 --- a/librecomp/src/recomp.cpp +++ b/librecomp/src/recomp.cpp @@ -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; diff --git a/ultramodern/src/ultrainit.cpp b/ultramodern/src/ultrainit.cpp index 9dd19a2..4fca62a 100644 --- a/ultramodern/src/ultrainit.cpp +++ b/ultramodern/src/ultrainit.cpp @@ -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(); }