Coder Social home page Coder Social logo

atenfyr / uassetapi Goto Github PK

View Code? Open in Web Editor NEW
211.0 13.0 46.0 49.84 MB

A low-level .NET library for reading and writing Unreal Engine game assets.

Home Page: https://atenfyr.github.io/UAssetAPI/

License: MIT License

C# 100.00%
unreal-engine api c-sharp json modding modding-tools

uassetapi's Introduction

UAssetAPI

CI Status Issues License

UAssetAPI is a low-level .NET library for reading and writing Unreal Engine game assets.

Features

  • Low-level read/write capability for a wide variety of cooked and uncooked .uasset files from ~4.13 to 5.3
  • Support for more than 100 property types and 12 export types
  • Support for JSON export and import to a proprietary format that maintains binary equality
  • Support for reading and writing raw Kismet (blueprint) bytecode
  • Reading capability for the unofficial .usmap format to parse ambiguous and unversioned properties
  • Robust fail-safes for many properties and exports that fail serialization
  • Automatic reflection for new property types in other loaded assemblies

Usage

To get started using UAssetAPI, first build the API using the Build Instructions guide and learn how to perform basic operations on your cooked .uasset files using the Basic Usage guide.

UAssetGUI, a graphical wrapper around UAssetAPI which allows you to directly view and modify game assets by hand, is also available and can be downloaded for free on GitHub at https://github.com/atenfyr/UAssetGUI/releases.

Contributing

All contributions, whether through pull requests or issues, that you may make are greatly appreciated.

I am particularly interested in Unreal Engine 4 .uasset files that have their VerifyBinaryEquality() method return false (or display "failed to maintain binary equality" within UAssetGUI); if you encounter such an asset, feel free to submit an issue here with a copy of the asset in question along with the name of the game and the Unreal version that it was cooked with.

License

UAssetAPI and UAssetGUI are distributed under the MIT license, which you can view in detail in the LICENSE file.

uassetapi's People

Contributors

atenfyr avatar bananaturtlesandwich avatar benvlodgi avatar dependabot[bot] avatar longerwarrior avatar narknon avatar oh-yes-0-fps avatar rndtrash avatar trumank avatar wfjsw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uassetapi's Issues

Checksums?

Hey,

do every Uasset File got a Checksum? I just checking on a Game, it works fine with the Tool (most of the Time, except some small Files, I could sent in private if needed, since they are use 4.27.1 + own Source)

However, the Server refuses the connection, because it looking for a checkSum, so I am curious, if this is a field we could read from the File?

Cannot change bIsEnabled value

Describe the bug
Changed .uasset data bIsEnabled to true and packed file using unrealpak. But bIsEnabled is still false in the FModel.
When load .uasset "Failed to parse 11 exports!" happens,and modified .uasset causes game crash.

Screenshots
If applicable, add screenshots to help explain your problem.

179390673-81c9dfc6-b284-4a8d-b5b4-b6ef87204195
179390476-c4c81b56-b239-43ca-ad13-f111794e12f1
179390478-109e36f2-20ee-4415-b48e-b2fdf27b16eb
(After Modified)

Desktop (please complete the following information):

  • OS: Windows 11
  • Version: v1.0.0.0-alpha.6 (atenfyr/UAssetGUI@ebcdfce)
  • Game: Sword and Fairy 7
  • Game UE4 version: 4.25
  • File: Pal7\Content\UI\UMG\System\UMG_Photo.uasset

Additional context
UMG_Photo.zip

[Regression] Failed to parse 1 exports since 1.0.0.4

Describe the bug
Some assets are compatible with older versions like v1.0.0.3 but not with v1.0.0.4 nor the newest build (354f38f with atenfyr/UAssetGUI@e7b811d).

To Reproduce
Steps to reproduce the behavior:

  1. Extract the files from FashionDataTable.zip
  2. Open with UAssetGUI v1.0.0.3, everything work fine
  3. Open with UAssetGUI v1.0.0.4, see error

Unreal Engine version: 4.26

Desktop (please complete the following information):

  • OS: Windows 11 Beta 22632.1
  • Version or Commit: 354f38f

Failed to maintain binary equality

Describe the bug
This asset failed to maintain binary equality when editing.

To Reproduce
Steps to reproduce the behavior:

  1. Extract the two files in DT_Imitation.zip.
  2. Open with uassetGUI.
  3. See error.

Unreal Engine version: 4.26
Game: Tower of Fantasy

Desktop (please complete the following information):

  • OS: Windows 11
  • Version or Commit: 44401ba

Additional context
The game do run into some strange problems after modifying this asset.

Parsing unknown type & failed to parse export Unknown property type

Describe the bug
I found this error loading this file:

Unreal 4.18
[REDACTED]

-----------
Parsing unknown type /Game/Core/Environment/ACT01_SIP/Level/m01SIP_000_BG
Length: 0
Pos: 77335
Last type: MulticastDelegateProperty
-----------

Failed to parse export 148: System.FormatException: Unknown property type: /Game/Core/Environment/ACT01_SIP/Level/m01SIP_000_BG (on DefaultSceneRoot_GEN_VARIABLE at 77335)
  at UAssetAPI.MainSerializer.TypeToClass (UAssetAPI.FName type, UAssetAPI.FName name, UAssetAPI.UAsset asset, System.IO.BinaryReader reader, System.Int32 leng, System.Int32 duplicationIndex, System.Boolean includeHeader) [0x00b59] in Z:\GitHub\unreal-4-umap-preview\UAssetAPI\MainSerializer.cs:197 
  at UAssetAPI.MainSerializer.Read (UAssetAPI.UAsset asset, System.IO.BinaryReader reader, System.Boolean includeHeader) [0x0003f] in Z:\GitHub\unreal-4-umap-preview\UAssetAPI\MainSerializer.cs:222 
  at UAssetAPI.NormalExport.Read (System.IO.BinaryReader reader, System.Int32 nextStarting) [0x0001d] in Z:\GitHub\unreal-4-umap-preview\UAssetAPI\Export.cs:69 
  at UAssetAPI.UAsset.Read (System.IO.BinaryReader reader, System.Int32[] manualSkips, System.Int32[] forceReads) [0x007aa] in Z:\GitHub\unreal-4-umap-preview\UAssetAPI\UAsset.cs:829 
-----------
Parsing unknown type DelegateProperty
Length: 12
Pos: 92767
Last type: ObjectProperty
-----------
-----------
Parsing unknown type DelegateProperty
Length: 12
Pos: 92878
Last type: NameProperty
-----------
-----------
Parsing unknown type DelegateProperty
Length: 12
Pos: 92915
Last type: DelegateProperty
-----------
-----------
Parsing unknown type DelegateProperty
Length: 12
Pos: 93335
Last type: ObjectProperty
-----------
-----------
Parsing unknown type DelegateProperty
Length: 12
Pos: 93446
Last type: NameProperty
-----------
-------[...]

To Reproduce
Steps to reproduce the behavior:

UAsset uAsset = new UAsset(ATTACHED_FILE, UE4Version.VER_UE4_18);

Expected behavior
The UAsset should parse without errors

failed to maintain binary equality (UE4.23)

Describe the bug
"failed to maintain binary equality" when opening certain uasset files

To Reproduce
Steps to reproduce the behavior:

  1. Unpack FNAFVRHelpWanted.zip

  2. Open any of the included uasset files in UAssetGui

  3. See error

Screenshots
2023-11-19 (1)

Desktop (please complete the following information):

  • OS: Windows 10
  • Version or Commit: v1.0.0.0-alpha.8

Additional context
UE version: 4.23
Game: FNAFVRHelpWanted

Failed To Parse Export

Keep getting "Failed to parse 1 exports!" when trying to open any files from this game
Game: F1 Manager 2023
Engine: I believe run on 5.1 since using 5.1 below won't work at all

I attach few files to be tested
F1M23.zip

IO Store/Zen support

Support for Unreal Engine 5's UAssets such as Fortnite's would be a good addition

failed to maintain binary equality

Hi and Happy New Year.

I have this Failure when i try to open any UAssets from the Game "Space Hulk Deathwing Enhanced Edition". Engine Version from the Game is 4.14.3

Describe the bug

  1. Open with UassetGUI.exe
  2. Set Version to 4.14.3
  3. Open Uasset
  4. Failure Message: "failed to maintain binary equality"
    unknown_2022 01 06-18 30
    Blueprints.zip

I have this Failure Message when i ty to open the UMAPS Files: Failed to Parse this file! .....
unknown_2022 01 06-18 44
Maps1.zip

Desktop (please complete the following information):

  • OS: Windows 11
  • Version or Commit: v1.0.0.0-alpha.3 / e756426.

Thanks and have a nice day!

Unknown Property type Delegate Property

Importing a .umap file of an UE 4.22 game results in error. Any saves mess up level although audio and level seem to be running on a black skymap possibly.

uaserror

image

and

image

Failed to maintain binary equality

Game: Dark Deception
Unreal version: 4.24
UAssetGUI version: v1.0.0.0-alpha.6
OS: Windows 10 Pro

Describe the bug
When I'm opening the uasset file, firstly it says "Failed to parse 1 exports", then it says "Failed to maintain binary equality"
How can I fix this?

DarkDeceptionUasset.zip

Failed to maintain binary equality!

@atenfyr
i have a game called "sword art online fatal bullet"
try to open file attached
game engine : unreal engine 4.17

i have an error say "Failed to maintain binary equality! UassetAPI may not be able to parse this particular asset correctly , and you may not be able to load this file in-game if modified
Assets :
AVID.zip

SFV(UE4.7) DA_XXX_Setup Files (Failed to parse 1 export)

Game: StreetFighterV
Engine Ver: 4.7.6 (4.7)

I keep getting the (Failed to parse 1 export) when opening the setup files that include a BGM file path leading to Raw data only being displayed

The following files seem to work fine as they dont include a BGM path
DA_D04_Setup.uasset
DA_AS1_Setup.uasset
DA_AS4_Setup.uasset
DA_AS6_Setup.uasset
DA_B00_Setup.uasset

as for the rest of them dont seem to work, It would be greatly appreciated if you guys could take a look at these files
SFV_UE4.7_DA_XXX_Setup_Files.rar

(hopefully i did this right i have no idea what im doing on github half of the time)

F1 Manager 23 failed to maintain binary equality

Describe the bug
failed to maintain binary equality for uasset files.

To Reproduce
If applicable, provide a copy of the asset that can be used to reproduce the bug, along with the Unreal Engine version that the asset was cooked with and the game that it is from.
RaceSimDataAsset.zip

Screenshots
Snap 2023-08-02 at 12 03 24

Desktop (please complete the following information):

  • OS: Windows 10

Additional context
Game UE version should be 5.1

Thanks a million!

Export exports as json

Is your feature request related to a problem? Please describe.
I want to build my own cli tool to traverse the tables of a uasset and export certain things as json. For a prototype I'd also be happy with just exporting the structure of the entire asset similar to how saving to json works in the UAsset GUI

Describe the solution you'd like
I'm not sure this is an actual issue/request but I'd appreciate some docs/guidance on how to work with the data new UAsset() generates as the readme unfortunately didn't help much.

Appreciate any help/feedback!

System.NullReferenceException when opening a .uasset file

Tried to open some files from the game Will To Live Online, found myself with error System.NullReferenceException in line 203 of MainSerializer.cs

Steps to reproduce the behavior:

  1. Open UAssetGUI.exe
  2. Set UE4 version to 4.26
  3. Open file "NPS_TeleportCCD"
  4. Error!

Expected behavior
The file opens up correctly and I can see it

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 11 build 22000.co_release.210604-1628
  • Version or Commit: UAssetGUI v1.0.0.4 (GUI e7b811d - API 354f38f)

Additional context
Only happened with this file in specific, here I also add a similar file that works
Twofiles.zip

Failed to maintain binary equality

Game : Vampyr
Unreal : 4.15.3
UAssetGUI: v1.0.0.0-alpha.6
OS : Windows 10 Home (10.0.19044)

Heya! Got a game that the API seems to be having an issue parsing the uassets. Files attached.

Thank you for all your hard work!

VampyrUassets.zip

ArgumentOutOfRangeException

Describe the bug
I have a .umap and uexp combo packed in ue 4.24 that refuses to open in newer version above 1.0.0.5 with the error System.ArgumentOutOfRangeException: Non-negative number required.
Parameter name: count

To Reproduce
Steps to reproduce the behavior:

  1. Open the newest commit and or release of UAssetGui
  2. Open the attached file
  3. See error
    From UE 4.24, game is Project Wingman

Expected behavior
It should open

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Version or Commit: 1.0.0.7

Additional context
I dont know if this is an issue with the file, or maybe with the program, but it would be nice to still open if able and maybe point out the issue
Alternatively, if someone can find what is causing the issue so i can change it.
Thank you
C_M22.zip

Solution does not build as UAssetGUI is referenced in solution file but not included in repo

Describe the bug
A clean clone of this repository does not build successfully as the solution file references the UAssetGUI project, which is in its own repo and not referenced here. Is this supposed to be included as a submodule?

To Reproduce
Steps to reproduce the behavior:

  1. Clone this repository
  2. Run dotnet build (or attempt to build the solution with any other tool)
  3. The build will fail as the UAssetGUI project is not present

Expected behavior
Ideally, this repo should be able to be built, or the extra steps documented. If UAssetGUI was added as a submodule, anyone could just git submodule update --init and get the right version of UAssetGUI immediately present in their environment.

Desktop:

  • OS: any, but tested on Windows 10
  • Version or Commit: 1a43738

Game Crash after edit Uasset File

Hello!

Describe the bug
After modify one Uasset the Game crash after the Title Screen when start the Campaign.
When i pack back the .pak file with no modifiyed Uassets the Game starts normal. Its a problem with the modifiyed Uassets.

To Reproduce
Steps to reproduce the behavior:

  1. Set Uasset GUI to 4.26
  2. Open Uasset and modify it and save it.
  3. Copy the .uasset and .uexp in the extracted folder and pack back the Game .pak file
  4. Game Crash when using the edited Uasset.

Game: Necromunda Hired Gun
Engine Version 4.26.1.0 ( Note: its a pre Version between 4.26 and 4.26.2 or something like (?) Im not sure :D)
Necromunda Hired Gun 4.26.1.0.zip

Desktop (please complete the following information):

  • OS: [e.g. Windows 11]
  • Version or Commit: [863b6ef]

Additional context
Game crash with any other edited Uassets too.

Thanks and have a nice day!

How to support custom UE engine

Hi, first of all, thank you for doing such an excellent project. I want to know which files I should modify to support the custom UE engine? I would appreciate it if you could give us a brief explanation about this. By the way, the .uasset files I want to read belong to Tower Of Fantasy V2.0. The following link is an example file of this game.

https://drive.google.com/file/d/1wwzcY09aDpj3nKNd3Pc8bRAExHonbq8c/view?usp=sharing

Thank you again for your excellent work!

Material Exports Not Supported

Describe the bug
The following fail to parse correctly:
MaterialExpressionAdd, MaterialExpressionAppendVector, MaterialExpressionClamp, MaterialExpressionDesaturation, MaterialExpressionLinearInterpolate, MaterialExpressionMaterialFunctionCall, MaterialExpressionMultiply, MaterialExpressionStaticSwitchParameter, probably more MaterialExpression...'s

The following work:
MaterialExpressionComment, MaterialExpressionScalarParameter, MaterialExpressionTextureCoordinate, MaterialExpressionTextureSampleParameter2D, MaterialExpressionVectorParameter

Based on setting a breakpoint, the first property of the struct will get read in mostly right, but its not reading the correct number of bytes per property and thus the next properties will be a garbled mess.

MaterialExpressionComment Example:
image

MaterialExpressionAdd Example:
MaterialExpressionAdd_0.zip
image
Expected (from .T3D):

Begin Object Name="MaterialExpressionAdd_0"
  A=(Expression=MaterialExpressionTextureSampleParameter2D'"M_Base_Trim:MaterialExpressionTextureSampleParameter2D_2"',OutputIndex=1,Mask=1,MaskR=1)
  B=(Expression=MaterialExpressionTextureSampleParameter2D'"M_Base_Trim:MaterialExpressionTextureSampleParameter2D_2"',OutputIndex=2,Mask=1,MaskG=1)
  MaterialExpressionEditorX=-368
  MaterialExpressionEditorY=80
  MaterialExpressionGuid=C4E2389348ECEC059C2245B9DC52BF18
  Material=Material'"M_Base_Trim"'
End Object

It looks like it trips up on any property that has the format:
<PropertyValue>=(Expression=<Class>'"<Material>:<ExportName>"',<Key>=<Value>,...)

Sifting through the raw hex, I'm able to see for example, 0x0C is index 12 in the name array ("A", correct). 0x0F is name index 15, "B" for the second property, but in practice the reader tries to read the name index 5 bytes ahead of where 15 actually is. 0x43 corresponds to "Export Information" index 67 MaterialExpressionTextureSampleParameter2D_2. After the Export Object Index, it seems to have an array of 32bit values in the same order as listed in the T3D (ex. 1,1,1).

To Reproduce
Steps to reproduce the behavior:

  1. Open my supplied Material .uasset
  2. Set a breakpoint in UAsset.Read line 1317 and step in
  3. Notice the first property is correct, sequential ones aren't, thus exceptions are thrown and they fallback to Raw view

Material .uasset, also in .T3D form (which is text readable):
M_Base_Trim.zip

If applicable, provide a copy of the asset that can be used to reproduce the bug, along with the Unreal Engine version that the asset was cooked with and the game that it is from.

Expected behavior
Expected to parse all properties of each export struct.

Desktop:

  • OS: Windows 10 Latest
  • Version or Commit: 11/15/22 d9aa3575066cf1c82af68e9ad2ff86abe5254308
  • Asset is taken from a free asset in a 4.27 project, but UAssetGUI suggests its v4.16

Lies of P - Failed to parse 1 export

Some of the assets in this game are parsed by the library correctly (for example, SkillHitInfo), but others are not (for example, ItemInfo and SkillInfo). Here is a zip archieve with said .uassets with their .uexp's, up-to-date mappings and .json files generated by FModel (this program managed to parse them correctly):
broken_files_2.zip
Please look into it

Implementation of FFieldPathProperty

Is your feature request related to a problem? Please describe.

Property isn't parsed.

Describe the solution you'd like
Implement/parse the property.

Describe alternatives you've considered
Maybe trying to implement it myself.

Additional context

image

Secondary.zip

Parsing Error when trying to open Jedi Survivor .uasset file

Describe the bug
Get the following error when trying to load a .uasset file from the Jedi Survivor game:
image

I set the UE engine to be 4.26, which seems to be the correct version, but I also tried 4.21 which is the version for Jedi Fallen Order. I was able to open .uasset files from Fallen Order without any problem, but Jedi Survivor .uasset files give this parsing error.

BTW, I use FModel to extract the .uasset files from .pak files.

To Reproduce
Extract a .uasset from FModel for the Jedi Survivor game.

Expected behavior
It's supposed to open the .uasset file so I can edit the values.

Screenshots
image

Desktop (please complete the following information):

  • OS: Win 11
  • i7 8700K chipset
  • 32 GB RAM
    UE Engines 4.21 and 4.26 installed

Additional context
Add any other context about the problem here.

Verify Parsing: false on umap file

Describe the bug
I have a file that does not verify parsing:

[REDACTED] - issue solved

To Reproduce
Steps to reproduce the behavior:

AssetWriter y = new AssetWriter(@"PATH\TO\m01SIP_000_BG.umap", null, null); // no skips, no force reads
Console.WriteLine("Data preserved: " + (y.VerifyParsing() ? "YES" : "NO"));

Expected behavior
Please fix so parsing is verified.

Desktop (please complete the following information):

  • OS: Windows 7 64

BytePropertyData change which breaks reading of values

Describe the bug
A change has been made to how BytePropertyData works which makes it so reading the value will always return 0 (also the value type has been changed from integer to byte and as name maps can be normally larger than 256 and name map refs can be BytePropertyData this may be an issue)

To Reproduce
for some reason I can't attach the program I compiled myself sorry

Download this example file (happens with any I think) and create a new test program like this (include newtonsoft.json as a nuget package):

using UAssetAPI;
using UAssetAPI.PropertyTypes;

Console.Write("Enter the filepath to the asset you want to print the value of the ByteProperties (the version is assumed 4.25 for this example): ");
UAsset TestAsset = new UAsset(@Console.ReadLine().Replace("\"", ""), UE4Version.VER_UE4_25);
foreach (var export in TestAsset.Exports)
    if (export is NormalExport norm)
        foreach (var property in norm.Data)
            if (property is BytePropertyData ByteProperty)
                Console.WriteLine(ByteProperty.Value);
Console.ReadKey();

now reference this most recent dll and compile the program
You should get a result like this which only returns zeros:

now reference this older version and compile the program
You should get a result like this which returns what I assume to be the actual values:

Desktop:

Parsing master material exports

Is your feature request related to a problem? Please describe.
Is it possible to parse these export types?
Material, MaterialExpressionMaterialFunctionCall, MaterialExpressionStaticSwithParameter, MaterialExpressionTextureSampleParameter2D...

M_COM_DetailMaster_B.zip

Describe the solution you'd like
Looking to be able to pull basic information from master materials in order to replicate them.

[Paid Feature Request] UE 5.3 Support

Task: Update UAssetAPI for UE 5.3 Compatibility โ€“ $5,000 Bounty Pool!
We are officially announcing a bounty of $5,000 to update a crucial open-source tool for Unreal Engine modding, making them compatible with Unreal Engine 5.3: UAssetAPI. This bounty pool will be paid out to single individuals or shared between the top 3 contributors who successfully achieve this milestone.

How to Participate:

  • Fork the repository and begin working on updating the codebase for UE 5.3 compatibility
  • Submit with detailed descriptions of your updates and improvements
  • Ensure your code is thoroughly tested
  • Contact [email protected] to confirm

Bounty Distribution:
The $5,000 bounty pool will be paid out to single individuals or shared between the top 3 contributors who successfully achieve this milestone.

Help us make this essential modding tool compatible with UE 5.3 and earn your share of the bounty! If you have any questions, feel free to reach out via Github or email: [email protected]

Failed to maintain binary equality

Describe the bug
This asset failed to maintain binary equality when editing.

To Reproduce
Steps to reproduce the behavior:

  1. Extract files in
    Mappings.zip
  2. Open with uassetGUI.
  3. See error.

Unreal Engine version: 5.2
Game: Palworld

Screenshots
image
image

Desktop (please complete the following information):

  • OS: Windows 11
  • Version or Commit: 1.0.0.8

Unknown Error: Destination array is not long enough to copy all the items in the collection. Check array index and length.

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Open file
  2. Select the LightReference_BP.uasset file

Asset copy (needs to be unzipped): LightReference_BP.zip
Unreal Engine version: 4.20

Expected behavior
The file should load.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Version or Commit: V1.0.0.0-alpha.8

Allow user to register MapStructTypeOverride

MainGame_enUS.zip

The uasset above has a MapProperty named LinecodeTable with key type StructProperty.

I learned that the actual type of the key is char[13] but I had no way to make the uassetapi to use my custom StructPropertyData class.

To let deserializer to use my class, I had to edit this dictionary

public Dictionary<string, Tuple<FName, FName>> MapStructTypeOverride = new Dictionary<string, Tuple<FName, FName>>()
{
    { "ColorDatabase", new Tuple<FName, FName>(null, new FName("LinearColor")) },
    { "PlayerCharacterIDs", new Tuple<FName, FName>(new FName("Guid"), null) },
    { "LinecodeTable", new Tuple<FName, FName>(new FName("LineKey"), null) },
};

or manually load uasset and register the type override before reading uasset file.

UAsset main = new UAsset();
main.MapStructTypeOverride.Add("LinecodeTable", new Tuple<FName, FName>(new FName("LineKey"), null));

MemoryStream ms = new MemoryStream();
using (Stream file = File.OpenRead("Input/MainGame_enUS.uasset"))
{
    file.CopyTo(ms);
}
using (Stream file = File.OpenRead("Input/MainGame_enUS.uexp"))
{
    file.CopyTo(ms);
}

AssetBinaryReader abr = new AssetBinaryReader(ms, main);
main.FilePath = "Input/MainGame_enUS.uasset";
main.UseSeparateBulkDataFiles = true;

main.Read(abr);
            
Console.WriteLine("Data preserved: " + (main.VerifyBinaryEquality() ? "YES" : "NO"));

I think this library could use some more convenient way to register StructTypeOverride.

Example:

MainSerializer.RegisterMapStructOverride("LineCodeTable", "LineKey", null);
UAsset mainGame = new UAsset("Input/MainGame_enUS.uasset");

.umap failed to maintain binary equality

Issue
This .umap failed to maintain binary equality when edited with uassetAPI

To Reproduce

  1. Download the assets
  2. Open with uassetGUI with the version of UE4 set to 4.25
  3. see the failed to verify binary equality error

Desktop (please complete the following information):

  • OS: Windows 10
  • Version or Commit: this one

Context
If you are unable to or do not have enough time that is fine because my project does not solely rely on this one fil
Sealed_Land.zip

.uasset that fails to maintain binary equality

Some more uassets that fail to parse

Steps to reproduce the behavior:

  • Open the .uasset with uassetGUI/API
  • There's a warning saying binary equality cannot be maintained with the asset
  • Because of this properties in the assets can't be modified

Desktop (please complete the following information):

  • OS: Windows 10
  • Version or Commit: e756426

Files
Player_Character_BP.zip

Sorry about this it would just be great to be able to modify the player character

Clothing Asset/Cloth Data Export failing to read.

When loading a skeletal mesh with clothing the ClothingAsset will fail to read leaving just a raw export. I've tracked the issue down to 8 extra bytes in between 2 of the properties, LodData and LodMap, which causes LodMap and properties after it to become offset and thus causes to whole export to fail to read.

Forcing the MainSerializer.Read() to skip these 8 bytes will allow the cloth data to be read properly because makes the file unstable and crashes the game after saving.

This is the code I used in my testing to get the file to at least phrase in memory if it help, added after FName type = reader.ReadFName(); in MainSerializer.Read().

if (type.Value.Value == "LodMap")
{
    name = new FName("LodMap");
    type = reader.ReadFName();
}

Sample File: (Code Vein, UE Version 4.18)
https://mega.nz/file/owNHlRaQ#1P7scpm4qJ6O0hOkujrt__JO5b3snitz-pI1uwusjiU

UAssetAPI serializes and deserializes FNames differently than Unreal Engine

Describe the bug
UAssetAPI serializes and deserializes FNames differently than Unreal Engine.

To Reproduce
Steps to reproduce the behavior:

  1. Instantiate an FName by calling its static FromString method with the argument "HelloWorld_0".
  2. Call the ToString method on the FName.
  3. Note that it returns "HelloWorld_0(0)" instead of "HelloWorld_0".
  4. Evaluate the Value and Number properties of the FName.
  5. Note that they evaluate to an FString with the value "HelloWorld_0" and the int 0, respectively, instead of an FString with the value "HelloWorld" and the int 1.

Expected behavior
UAssetAPI should parse and serialize FNames in the same way that Unreal Engine does. (See Additional context.)

Desktop (please complete the following information):

  • OS: Windows 10
  • Version or Commit: 56815c9

Additional context
FNames are serialized as an index into a name list and an instance number. In Unreal Engine, when an FName is deserialized, non-zero instance numbers are decremented and appended to the name following an underscore. For example, an FName pointing to "HelloWorld" with an instance number of 2 would be deserialized as "HelloWorld_1" in Unreal Engine. UAsset API will instead deserialize this FName as "HelloWorld(2)".

For FNames with an instance number of 0, Unreal Engine does not append the instance number, however UAssetAPI does. For example, an FName pointing to "HelloWorld" with an instance number of 0 would be deserialized as "HelloWorld" in Unreal Engine. UAssetAPI will instead deserialize this FName as "HelloWorld(0)".

The reason that Unreal Engine uses FName instance numbers is to reduce the memory and file space needed to store similar names. For example, if you had several names that start with HelloWorld_ and end with different numbers, Unreal Engine can store these similar names as one entry in a table. So rather than having to store HelloWorld_0, HelloWorld_1, and HelloWorld_2 in the name list, Unreal Engine can just store HelloWorld once and use the name index and instance numbers when referencing similar names.

You can find more information in the FName documentation and in the ParseNumber function in UnrealNames.cpp. (Although I think the comments in older versions are clearer.)

Essentially, when an FName is serialized, Unreal Engine checks to see if the string ends with _ followed by either (a) a single 0 or (b) 1-9 followed by zero or more digits. If the string matches this pattern, then the digits are converted to a decimal number, incremented by one, and stored as the instance number, and everything before the _ is stored as the name to index. Otherwise, the full string is stored as the name to index and the instance number is stored as 0. Note that numeric suffixes cannot be prefixed with 0, i.e. HelloWorld_0 is a match and stored as Name = "HelloWorld", Number = 1, while HelloWorld_01 is not a match and is stored as Name = "HelloWorld_01", Number = 0.

The following regular expression can match strings that should be serialized with non-zero instance numbers.

/^(.+)_(0|[1-9]\d*)$/

If matched, group 1 contains the name and group 2 contains the number that should be parsed and incremented before storing as the instance number. If not matched, the whole string should be stored as the name and the instance number should be 0.

Sorry for the long description. Let me know if you want a PR.

Update to newer `csproj` format to support newer SDKs

Is your feature request related to a problem? Please describe.
The old 2015-style csproj files are unwieldy to work with and the dotnet CLI (and other modern build tools) often don't support them properly, making building this project unnecessarily difficult.

Describe the solution you'd like
Ideally, it should be possible to replicate all the current behaviour of the existing project file while also updating to correctly target .NET 6 and retaining Framework 4.6.x support. If you're interested in this, I'm also happy to put together a PR to update UAssetAPI to use the newer format as I've done this for my own fork (from a much earlier state of this repo).

Additional context
The newer formats are still fully supported by Visual Studio 2017 or later, but this would also make it easier to work with UAssetAPI for those not using Visual Studio (like myself).

I cant open this thing I need help

Nearly every visual studio (2019 2017 2015 ) is not working

This is whit 2015
C:\Users\nexus\Downloads\UAssetGUI-master\UAssetAPI\UAssetAPI\UAssetAPI.csproj : error : The project file could not be loaded. Could not find a part of the path 'C:\Users\nexus\Downloads\UAssetGUI-master\UAssetAPI\UAssetAPI\UAssetAPI.csproj'. C:\Users\nexus\Downloads\UAssetGUI-master\UAssetAPI\UAssetAPI\UAssetAPI.csproj

C:\Users\nexus\Downloads\UAssetGUI-master\UAssetAPI\UAssetAPI.Tests\UAssetAPI.Tests.csproj : error : The project file could not be loaded. Could not find a part of the path 'C:\Users\nexus\Downloads\UAssetGUI-master\UAssetAPI\UAssetAPI.Tests\UAssetAPI.Tests.csproj'. C:\Users\nexus\Downloads\UAssetGUI-master\UAssetAPI\UAssetAPI.Tests\UAssetAPI.Tests.csproj

C:\Users\nexus\Downloads\UAssetGUI-master\UAssetGUI\UAssetGUI.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Users\nexus\Downloads\UAssetGUI-master\UAssetGUI\UAssetGUI.csproj

C:\Users\nexus\Downloads\UAssetGUI-master\UAssetAPI\UAssetAPI.Benchmark\UAssetAPI.Benchmark.csproj : error : The project file could not be loaded. Could not find a part of the path 'C:\Users\nexus\Downloads\UAssetGUI-master\UAssetAPI\UAssetAPI.Benchmark\UAssetAPI.Benchmark.csproj'. C:\Users\nexus\Downloads\UAssetGUI-master\UAssetAPI\UAssetAPI.Benchmark\UAssetAPI.Benchmark.csproj

Encountered 1 unknown property types: Field Path Property

Hey :D

Describe the bug
"Encountered 1 unknown property types: Field Path Property" when open the UAsset with UAsset API. Game Engine Version is 4.26.1.0
Necromunda Hired Gun 4.26.1.0.zip

I think this Files have Values about Damage, Magazine Size and more from Weapons that i would like to change.

Desktop (please complete the following information):

  • OS: [e.g. Windows 11]
  • Version or Commit: [fc49e96]

Thanks and have a nice day!

failed to maintain equality (UE4.20)

Describe the bug

  • When UAssetGUI loads a Material uasset, "Failed to maintain equality" is displayed.

To Reproduce
Steps to reproduce the behavior:

  1. Save Material uasset file
  2. Open saved uasset file with UAssetGUI
  3. See error
uasset copy DXM_Materials.zip
Game Daemon X Machina
UE Version 4.20
UAssetGUI 1.0.0.7

Expected behavior
Success to maintain equality

Screenshots

Desktop

  • OS: Windows 10
  • UAssetGUI v1.0.0.7 (9418e64 - 5f31556)

Additional context

  • Above zip file contains all the Material uassets that occurs failure.
  • Probably this issue is duplicated with #45

Failed to maintain binary equality

The game is created by UE 5.2.1
I use UnrealPak.exe to export the contents.
But these resources can not import to Ue project.
When I try to open it with UAssetGUI, an error occurred:

 Failed to parse 1 export!
Failed to parse unversioned properties! 
Exports cannot be parsed for this asset unless a valid set of mappings is provided.
If you have a .usmap file for this game, go to Utils --> Import Mappings... and select your .usmap file to import.

Then I created usmap dump by using UnrealMappingsDumper:

Failed to maintain binary equality!
 UAssetAPI may not be able to parse this particular asset correctly, and you may not be able to load this file in-game if modified.

Sample With usmap Dump: CG_AKI_WakeUp_00.zip

Thanks.

BlueprintReplicationCondition does not always exist on UProperty

In UProperty.Read is this block of code (and there is similar in Write):

if (reader.Asset.GetCustomVersion<FReleaseObjectVersion>() >= FReleaseObjectVersion.PropertiesSerializeRepCondition)
{
    BlueprintReplicationCondition = (ELifetimeCondition)reader.ReadByte();
}

I am working with UE 4.27 blueprint assets from the game Icarus, and that byte is not present in properties that I encountered. That check returns true for any version from 4.22 onwards. However, I suspect the presence of this value depends on more than just the engine version. Perhaps it is only present of the property flag CPF_RepNotify is set?

not loading file

Describe the bug
it just won't load the file and just gives me an error message

To Reproduce
Steps to reproduce the behavior:

  1. open a file
  2. See error

Expected behavior
to load the file without any errors

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 11
  • Version or Commit: V1.0.0.0-alpha.8

Additional context

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.