Overview
The ResAssetEntry class represents resource assets in the Frostbite engine. Resource assets contain binary data such as textures, meshes, animations, and other game resources.
Class Definition
public class ResAssetEntry : AssetEntry
{
public override string Type => (( ResourceType ) ResType ). ToString ();
public override string AssetType => "res" ;
public ulong ResRid ;
public uint ResType ;
public byte [] ResMeta ;
}
Location: FrostySdk/Managers/AssetManager.cs:379
Properties
Resource ID - unique 64-bit identifier for the resource. Used for lookups and references.
Resource type enumeration value. Cast to ResourceType enum for readable type name.
Resource metadata - format varies by resource type. Contains resource-specific configuration.
Overrides base property to return the resource type name (e.g., "Texture", "MeshSet")
Returns "res" to identify this as a resource asset entry.
Inherited Properties
See EbxAssetEntry for complete list of base properties including:
Name, Filename, Path, DisplayName
Sha1, Size, OriginalSize
IsModified, IsDirty, IsAdded
Bundles, LinkedAssets
Resource Types
The ResourceType enum defines all supported resource types:
Show Common Resource Types
Standard texture resource (DDS format)
Texture atlas for UI or sprites
Havok physics collision/simulation data
Scalable vector graphics image
Raw unprocessed file data
Show Graphics Resource Types
Dx11ShaderProgramDatabase
DirectX 11 shader database
DirectX 12 PC RVM database
Enlighten lighting database
Show Physics & Animation Types
Character ragdoll physics data
ANT animation runtime resource
Compressed animation clip
Methods
Resource entries inherit all methods from AssetEntry:
AddToBundle(int bid) - Add to bundle
AddToBundles(IEnumerable<int>) - Add to multiple bundles
IsInBundle(int bid) - Check bundle membership
EnumerateBundles(bool addedOnly) - Iterate bundles
LinkAsset(AssetEntry) - Link to other assets
See EbxAssetEntry for detailed method documentation.
Usage Examples
Reading a Resource
ResAssetEntry entry = assetManager . GetResEntry ( "textures/ui/icon" );
if ( entry != null )
{
Console . WriteLine ( $"Type: { entry . Type } " );
Console . WriteLine ( $"ResRid: 0x { entry . ResRid : X16 } " );
Console . WriteLine ( $"Size: { entry . OriginalSize / 1024.0 : F2 } KB" );
// Get resource type
ResourceType resType = ( ResourceType ) entry . ResType ;
Console . WriteLine ( $"Resource Type: { resType } " );
}
Getting Resource by RID
ulong resRid = 0x123456789ABCDEF0 ;
ResAssetEntry entry = assetManager . GetResEntry ( resRid );
Modifying a Resource
// Modify by resource ID
ulong resRid = entry . ResRid ;
byte [] newData = /* ... your modified resource data ... */ ;
byte [] newMeta = /* ... optional new metadata ... */ ;
assetManager . ModifyRes ( resRid , newData , newMeta );
// Or modify by name
assetManager . ModifyRes ( "textures/ui/icon" , newData , newMeta );
Working with Texture Resources
ResAssetEntry texEntry = assetManager . GetResEntry ( "characters/hero/diffuse" );
if (( ResourceType ) texEntry . ResType == ResourceType . Texture )
{
// Load the texture resource
using ( NativeReader reader = new NativeReader (
assetManager . GetRes ( texEntry )))
{
Texture texture = new Texture ( reader );
// Modify texture data
byte [] newPixelData = /* ... */ ;
texture . SetData ( 0 , newPixelData );
// Save back
assetManager . ModifyRes ( texEntry . ResRid , texture . SaveBytes ());
}
}
Enumerating Resources by Type
// Get all texture resources
uint textureType = ( uint ) ResourceType . Texture ;
foreach ( ResAssetEntry entry in assetManager . EnumerateRes (
resType : textureType ))
{
Console . WriteLine ( $"Texture: { entry . Name } " );
}
ResAssetEntry entry = assetManager . GetResEntry ( "meshes/character" );
if ( entry . ResMeta != null && entry . ResMeta . Length > 0 )
{
// Parse resource-specific metadata
using ( var reader = new NativeReader ( new MemoryStream ( entry . ResMeta )))
{
// Read metadata fields based on resource type
if (( ResourceType ) entry . ResType == ResourceType . MeshSet )
{
// Parse mesh metadata
}
}
}
Adding a New Resource
string name = "textures/custom/mytexture" ;
ResourceType resType = ResourceType . Texture ;
byte [] resMeta = /* ... texture metadata ... */ ;
byte [] data = /* ... texture data ... */ ;
int [] bundles = { bundleId };
ResAssetEntry newRes = assetManager . AddRes (
name , resType , resMeta , data , bundles );
Console . WriteLine ( $"Created resource with RID: 0x { newRes . ResRid : X16 } " );
Linking to EBX
// Resources are typically linked to EBX assets
EbxAssetEntry ebx = assetManager . GetEbxEntry ( "meshes/character" );
ResAssetEntry res = assetManager . GetResEntry ( "meshes/character" );
ebx . LinkAsset ( res );
// Now modifications to the resource mark the EBX as modified too
res . IsDirty = true ;
Console . WriteLine ( $"EBX is modified: { ebx . IsModified } " ); // True
Storage Locations
Resources can be stored in different locations:
Stored in CAS (Content-Addressable Storage) archive files
Embedded in binary superbundle files
Cached locally (for patched/modified data)
Modified Resource Data
When a resource is modified, data is stored in ModifiedEntry:
if ( entry . HasModifiedData )
{
ModifiedAssetEntry mod = entry . ModifiedEntry ;
// Modified data properties
byte [] data = mod . Data ; // Compressed modified data
long originalSize = mod . OriginalSize ; // Uncompressed size
Sha1 sha1 = mod . Sha1 ; // SHA-1 of modified data
byte [] resMeta = mod . ResMeta ; // Modified metadata
bool isInline = mod . IsInline ; // Inline in bundle?
}