Skip to content

Commit

Permalink
fix wad v2
Browse files Browse the repository at this point in the history
  • Loading branch information
moonshadow565 committed Oct 15, 2022
1 parent f809331 commit 7af89e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/rlib/ar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ auto Ar::process(IO const& io, offset_cb cb, Entry const& top_entry) const -> vo
}

auto Ar::push_error(Entry const& top_entry, char const* func, char const* expr) const -> void {
auto msg = fmt::format(": {} @ {:#x}:+{:#x}", expr, top_entry.offset, top_entry.size);
if (!no_error) {
auto msg = fmt::format("{} @ {:#x}:+{:#x}", expr, top_entry.offset, top_entry.size);
::throw_error(func, msg.c_str());
} else {
errors.push_back(fmt::format("{}: {} @ {:#x}:+{:#x}", func, expr, top_entry.offset, top_entry.size));
errors.push_back(func + msg);
}
}
4 changes: 2 additions & 2 deletions lib/rlib/ar_wad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct Ar::WAD::Desc {
std::uint8_t type : 4 = 1;
std::uint8_t subchunks : 4 = {};
std::uint8_t pad[3] = {};
std::uint64_t checksum = {};
};

auto Ar::process_try_wad(IO const& io, offset_cb cb, Entry const& top_entry) const -> bool {
Expand Down Expand Up @@ -49,7 +50,7 @@ auto Ar::process_try_wad(IO const& io, offset_cb cb, Entry const& top_entry) con
rlib_ar_assert(reader.read(desc_size, std::uint16_t{}));
rlib_ar_assert(reader.read(desc_count, std::uint32_t{}));
rlib_ar_assert(toc_start == reader.offset());
rlib_ar_assert(desc_size == 24);
rlib_ar_assert(desc_size <= sizeof(WAD::Desc));
break;
// Version 3 changed how signatures are done and pinned entry size
case 3:
Expand All @@ -71,7 +72,6 @@ auto Ar::process_try_wad(IO const& io, offset_cb cb, Entry const& top_entry) con
for (std::size_t i = 0; i != desc_count; ++i) {
auto desc = WAD::Desc{};
rlib_ar_assert(reader.read_raw(&desc, desc_size));
rlib_ar_assert(reader.skip(desc_size - sizeof(WAD::Desc)));
rlib_ar_assert(desc.offset >= toc_start);
rlib_ar_assert(reader.contains(desc.offset, desc.size_compressed));
entries[i] = {
Expand Down

0 comments on commit 7af89e6

Please sign in to comment.