Skip to content

Fix UE 5.7 version mapping#152

Closed
kbelcher3 wants to merge 1 commit into
atenfyr:masterfrom
kbelcher3:fix-version-mapping
Closed

Fix UE 5.7 version mapping#152
kbelcher3 wants to merge 1 commit into
atenfyr:masterfrom
kbelcher3:fix-version-mapping

Conversation

@kbelcher3

Copy link
Copy Markdown

I noticed that the latest commit on master branch did not work with UE 5.7 games, but the commit corresponding to release 1.1.0 did. I found that reverting the change made to UAssetAPI/UnrealTypes/UE4VersionToObjectVersion.cs in this commit:

e6730b2

fixed the issue. An example stack trace:

Error:
System.InvalidOperationException: Invalid FString length: 1920300133
at UAssetAPI.UnrealBinaryReader.ReadFString() in /home/markov/coding/dotnet/UAssetAPI/UAssetAPI/AssetBinaryReader.cs:line 114
at UAssetAPI.FEngineVersion..ctor(UnrealBinaryReader reader) in /home/markov/coding/dotnet/UAssetAPI/UAssetAPI/UAsset.cs:line 174
at UAssetAPI.UAsset.ReadHeader(AssetBinaryReader reader) in /home/markov/coding/dotnet/UAssetAPI/UAssetAPI/UAsset.cs:line 1891
at UAssetAPI.UAsset.Read(AssetBinaryReader reader, Int32[] manualSkips, Int32[] forceReads) in /home/markov/coding/dotnet/UAssetAPI/UAssetAPI/UAsset.cs:line 1975
at UAssetAPI.UAsset..ctor(String path, EngineVersion engineVersion, Usmap mappings, CustomSerializationFlags customSerializationFlags, GameSpecificOverride gsOverride) in /home/markov/coding/dotnet/UAssetAPI/UAssetAPI/UAsset.cs:line 3370

This is the first pull request I've ever submitted, so I apologise if the quality is not up to par. But at least, I believe the problem to have been clearly identified, and a workable solution presented.

@atenfyr

atenfyr commented Jul 13, 2026

Copy link
Copy Markdown
Owner

this cannot be the correct fix because indeed 5.7 and 5.8 should both be "IMPORT_TYPE_HIERARCHIES" according to engine source code. your change also breaks assets from the existing 5.7 games in our unit tests (because 5.7 now has an incorrect object version with your change). as is explicitly requested in the pull request template, you need to create a separate issue for the bug you are fixing, so we can investigate ourselves in the event that the proposed fix in the PR is unworkable. please ensure that you review the issue template when you create your new issue. closing this PR since the proposed fix is unworkable

(a guess as to what your issue may be: you may wish to ensure that your copy of retoc is sufficiently up-to-date; the release version of retoc does not support 5.7 games, you instead need to build it from the latest commit)

@atenfyr atenfyr closed this Jul 13, 2026
@kbelcher3

kbelcher3 commented Jul 13, 2026

Copy link
Copy Markdown
Author

Most likely what's happening here is that not all 5.7 games are using IMPORT_TYPE_HIERARCHIES. The games I tested this for were VOID/BREAKER and Voin:

https://steamdb.info/app/2615540/
https://steamdb.info/app/2464530/

This would also explain why the release version of retoc is working for those games, but the latest commit is not. I suppose a more proper fix would be to have some logic to detect what header format the game is actually using, and adjust accordingly. My bad here for generalizing the result from two games to all 5.7 - but if you test these specific games, I'm fairly certain you'll be able to reproduce the error.

@atenfyr

atenfyr commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Most likely what's happening here is that not all 5.7 games are using IMPORT_TYPE_HIERARCHIES.

it's theoretically possible, but I don't have enough information to make such an assumption. i also doubt that you have enough information to make that assumption. just because this adjustment happens to fix this issue does not mean that it accurately reflects the actual mechanism of this serialization. this kind of mismatch is extremely likely to cause parsing issues with other assets that you may not have yet tested

https://steamdb.info/app/2615540/ https://steamdb.info/app/2464530/

This would also explain why the release version of retoc is working for those games, but the latest commit is not. I suppose a more proper fix would be to have some logic to detect what header format the game is actually using, and adjust accordingly. My bad here for generalizing the result from two games to all 5.7 - but if you test these specific games, I'm fairly certain you'll be able to reproduce the error.

i am unwilling to purchase these games in order to help debug your issue. if you are not willing to create a new issue as i requested you to do (which would contain uploaded problematic test assets and other context in order to replicate the issue), then there will be no further review of the problem

the release version of retoc (v0.1.5) does not work for UE 5.7. you cannot use this version of retoc for UE 5.7 games. this is a documented issue which has been fixed in later commits of retoc, but there is no published release with these fixes yet. this version of retoc produces assets with incorrect serialization that would not work properly in-game. the fact that these assets happened to be parsed without error by older versions of UAssetAPI is incorrect behavior

if you are using retoc v0.1.5 to extract assets for UE 5.7 games, then you need to update your copy of retoc to a build from the latest commit of retoc, and no adjustment to UAssetAPI is appropriate or will be made to resolve the issue. if not, then you should create a new issue containing copies of some problematic assets, a set of mappings, and other required context as requested in the default issue template

@kbelcher3

Copy link
Copy Markdown
Author

Thanks for the detailed explanation. It turns out the root cause was me failing to specify the engine version in retoc to-legacy, so the fixes for 5.7 did not apply and the extracted assets hence incorrectly serialized.

My apologies for wasting your time with this matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants