Skip to content

Commit

Permalink
Move init_saving to recomp:start from ultramodern::preinit and …
Browse files Browse the repository at this point in the history
…some other fixes
  • Loading branch information
AngheloAlf committed May 30, 2024
1 parent 61b88e4 commit 04e6ab5
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions librecomp/include/recomp_overlays.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions librecomp/src/overlays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -158,7 +156,7 @@ void init_overlays() {
}
);

load_patch_functions();
recomp::load_patch_functions();
}

extern "C" recomp_func_t * get_function(int32_t addr) {
Expand Down
4 changes: 2 additions & 2 deletions librecomp/src/patch_loading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 2 additions & 0 deletions librecomp/src/pi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
2 changes: 2 additions & 0 deletions librecomp/src/recomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@ void recomp::start(ultramodern::WindowHandle window_handle, const recomp::rsp::c
recomp::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;

Expand Down
1 change: 0 additions & 1 deletion ultramodern/src/ultrainit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 04e6ab5

Please sign in to comment.