Coder Social home page Coder Social logo

cue4parse's Introduction

CUE4Parse

C# Parser for Unreal Engine packages & assets

Usage

FileProvider

DefaultFileProvider

This file provider lets you load packages locally from a given directory.

var provider = new DefaultFileProvider(gameDirectory, SearchOption.TopDirectoryOnly, new VersionContainer(EGame.GAME_UE5_1)); // Make sure the UE version matches with the game.
provider.Initialize();
StreamedFileProvider

This file provider lets you load packages from their stream and gives you more control over what one you want to load.

var provider = new StreamedFileProvider(gameName, new VersionContainer(EGame.GAME_UE5_1)); // gameName is not useful for most cases & make sure the UE version matches with the game.
provider.Initialize(fileName, new []{fileStream}); // foreach file you wanna load
// the 'fileStream' array must contains both .utoc AND .ucas streams in case you're loading an IO Store Package

Mounting

The next step is mounting files you loaded, you can do so by using the SubmitKey method. You must provide a GUID of one of the packages and its working aes key.

Provider.SubmitKey(guid, aesKey);

Localization

Depending on the game, assets can be loaded using different languages (usually English by default). In order to load them in another language, use the following code. Keep in mind that languages hardcoded in CUE4Parse are a small amount of languages used by the most popular games, you might have to add your own language in the code to support the game you're loading.

Provider.LoadLocalization(language);

Extract

All Exports

To get a json string of all exports included in the asset

var exports = Provider.LoadObjectExports(fullPath);
var json = JsonConvert.SerializeObject(exports, Formatting.Indented);
One Export

To get a json string of one export included in the asset

var export = Provider.LoadObject(fullPathWithExportName); // FortniteGame/Content/Athena/Items/Cosmetics/Backpacks/BID_718_ProgressiveJonesy.FortCosmeticCharacterPartVariant_0
var json = JsonConvert.SerializeObject(export, Formatting.Indented);

Export

An asset usually has its data split between multiple other assets. In order to grab them all, use TrySavePackage which will out a IReadOnlyDictionary<string, byte[]> for you to loop through.

if (Provider.TrySavePackage(fullPath, out var assets))
{
    foreach (var kvp in assets)
    {
        File.WriteAllBytes(Path.Combine(directory, kvp.Key), kvp.Value);
    }
}

Requirements

Building CUE4Parse

  1. Clone repository and initialize submodules

    git clone https://github.com/FabianFG/CUE4Parse
    cd CUE4Parse
    git submodule update --init --recursive
    
  2. Build

    dotnet build
    

Contributing

Contributions are always welcome in order to maintain the project!

Authors

cue4parse's People

Contributors

4sval avatar amrsatrio avatar entraptaa avatar ezfndev avatar fabianfg avatar floxay avatar gmatrixgames avatar halfuwu avatar jacocococo avatar kein avatar longerwarrior avatar minshug avatar notofficer avatar thoo0224 avatar will747 avatar xtigerhyperx avatar yretenai avatar

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.