mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-23 22:35:45 +00:00
fs: Fix RomFS building when zero byte files are present
When zero byte files are present, the key (offset) for that file is identical to the file right after. A std::map isn't able to fit key-value pairs with identical keys (offsets), therefore, the solution is to use std::multimap which permits multiple entries with the same key. This most prominently fixes Pokemon Sword and Shield weather with any RomFS mod applied.
This commit is contained in:
parent
e60733aad3
commit
fd1c3aa14e
4 changed files with 10 additions and 10 deletions
|
@ -240,7 +240,7 @@ RomFSBuildContext::RomFSBuildContext(VirtualDir base_, VirtualDir ext_)
|
|||
|
||||
RomFSBuildContext::~RomFSBuildContext() = default;
|
||||
|
||||
std::map<u64, VirtualFile> RomFSBuildContext::Build() {
|
||||
std::multimap<u64, VirtualFile> RomFSBuildContext::Build() {
|
||||
const u64 dir_hash_table_entry_count = romfs_get_hash_table_count(num_dirs);
|
||||
const u64 file_hash_table_entry_count = romfs_get_hash_table_count(num_files);
|
||||
dir_hash_table_size = 4 * dir_hash_table_entry_count;
|
||||
|
@ -294,7 +294,7 @@ std::map<u64, VirtualFile> RomFSBuildContext::Build() {
|
|||
cur_dir->parent->child = cur_dir;
|
||||
}
|
||||
|
||||
std::map<u64, VirtualFile> out;
|
||||
std::multimap<u64, VirtualFile> out;
|
||||
|
||||
// Populate file tables.
|
||||
for (const auto& it : files) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue