Skip to content

Commit

Permalink
[RPKG] Fix crashes when loading WWEV files from H2016
Browse files Browse the repository at this point in the history
  • Loading branch information
grappigegovert committed May 9, 2024
1 parent 5cbca99 commit 281d3fe
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/rpkg_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,16 @@ int create_ogg_file_from_hash_in_rpkg(char* rpkg_file, char* hash_string, int co

std::memcpy(&wwev_file_count_test, &(*sound_data)[position], sizeof(bytes4));

if (wwev_file_count == -1 || wwev_file_count == 1 && wwev_file_count_test < 5000) {
// Hitman 2016 file format has an extra int32 here
// The 2000 in the check is a bit arbitrary, but I don't know anything better to test.
// Will give false negatives (2016 wwev detected as newer version) if there are more than 5000 embedded sounds
// Will give false positives (newer wwev detected as 2016 version) if there is exactly one embedded sound with a wem id lower than 5000
// -grappigegovert
wwev_file_count = wwev_file_count_test;
position += 4;
}

std::string wem_ogg_path = util::uint64_t_to_hex_string(rpkg.hash.at(it->second).hash_value);

if (command == 0) {
Expand Down

0 comments on commit 281d3fe

Please sign in to comment.