mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-02-05 13:49:52 +00:00
Dark Messiah of Might and Magic GCF extraction fails due to the next index being one past the final entry index #19
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @HeroponRikiBestest on GitHub (Nov 30, 2025).
Seems to impact most if not all of the GCF files, in all releases of Dark Messiah of Might and Magic on redump. For this output, I'm using
mm_engine_pub.gcfsince it's one of the smallest ones and should be present on every release.When running get_files for the GCFs, the wrapper enters this loop
4b39ee8d00/SabreTools.Serialization/Wrappers/GCF.cs (L95)with a valid starting index. However, after it's been added to the block entries, it tries to get the index of the next block. The index it gets is 22781. The size of Model.BlockEntries for this GCF is 22781, so this will fail with an out of bounds exception. I assume it's not coincidence that it just happens to be the exact size of the array, but I don't know enough about GCFs to say why.
Console output:
@mnadareski commented on GitHub (Dec 2, 2025):
This should be caught by the condition of the
whileloop. If the next entry index is the block count, it's meant to break, as is documented in the model as well. The issue you're seeing is implying that the index is either not getting set or the value is not the block count, both of which are not good.@HeroponRikiBestest commented on GitHub (Dec 2, 2025):
The condition is the while loop isn't to check Model.BlockCount's size, it's to check Model.DataBlockHeader.BlockCount, which for this gcf is 812384356. Since it's not 22781, it's not caught by the condition of the while loop.
@HeroponRikiBestest commented on GitHub (Dec 4, 2025):
Fixed as of latest commits