Skip to content

Commit

Permalink
Fix save_files API always returning the backup file path
Browse files Browse the repository at this point in the history
  • Loading branch information
timoschwarzer committed Sep 3, 2024
1 parent 1a4b280 commit e516377
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions projects/Core/api/system/save_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ namespace core::api::save_files {
}

auto save_info = SaveGameController::GetSaveFileInfo(game::save_controller(), slot_index, backup_index);
auto path = save_info->fields.m_FullBackupSaveFilePath;
auto path_str = il2cpp::convert_csstring(path);
return System::IO::File::ReadAllBytes(path);

return System::IO::File::ReadAllBytes(
backup_index >= 0
? save_info->fields.m_FullBackupSaveFilePath
: save_info->fields.m_FullSaveFilePath
);
}

std::vector<std::byte> get_bytes(int slot_index, int backup_index) {
Expand Down
2 changes: 1 addition & 1 deletion projects/Randomizer/ui/main_menu_seed_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ namespace randomizer::main_menu_seed_info {

auto seed_meta_data = std::make_shared<seed::SaveSlotSeedMetaData>();
const auto read_slots = core::save_meta::read_save_meta_slots_from_byte_array(
core::api::save_files::get_byte_array(index, -1),
core::api::save_files::get_byte_array(index),
{
{SaveMetaSlot::SeedMetaData, seed_meta_data}
}
Expand Down

0 comments on commit e516377

Please sign in to comment.