public void Deserialize(IUnrealStream stream) { #if APB if (stream.Package.Build == UnrealPackage.GameBuild.BuildName.APB && stream.Package.LicenseeVersion >= 32) { stream.Skip(16); } #endif ExportsCount = stream.ReadInt32(); NamesCount = stream.ReadInt32(); if (stream.Version >= VNetObjectsCount) { NetObjectsCount = stream.ReadInt32(); } }
public void Deserialize( IUnrealStream stream ) { #if APB if( stream.Package.Build == UnrealPackage.GameBuild.BuildName.APB && stream.Package.LicenseeVersion >= 32 ) { stream.Skip( 16 ); } #endif ExportsCount = stream.ReadInt32(); NamesCount = stream.ReadInt32(); if( stream.Version >= VNetObjectsCount ) { NetObjectsCount = stream.ReadInt32(); } }
public void Deserialize(IUnrealStream stream) { if (stream.Version >= 63) { // Offset to (Width = ...) WidthOffset = stream.ReadUInt32(); long opos = stream.Position; stream.Seek(WidthOffset, System.IO.SeekOrigin.Begin); Width = stream.ReadUInt32(); Height = stream.ReadUInt32(); stream.Seek(opos, System.IO.SeekOrigin.Begin); } int mipMapSize = stream.ReadIndex(); Pixels = new int[mipMapSize]; switch (Owner._Format.Decompile().Substring(6)) { case "TEXF_RGBA8": case "5": for (int i = 0; i < mipMapSize; ++i) { Pixels[i] = stream.ReadInt32(); } break; case "TEXF_DXT1": case "3": for (int i = 0; i < mipMapSize / 2; ++i) { byte c = stream.ReadByte(); Pixels[i++] = c & 0xF0; Pixels[i] = c & 0x0F; } // PostProcess: // 4x4 4bit per pixel, 16bit per color: 5bits red; 6bits green; 5bits blue. // break; } // Width, Height. See above! stream.Skip(8); BitsWidth = stream.ReadByte(); BitsHeight = stream.ReadByte(); }
protected virtual void DeserializeMethodOne(IUnrealStream stream, bool skipEndParms = false) { // Array DeserializeNext(); if (stream.Version > ArrayMethodSizeParmsVersion) { // Size stream.Skip(2); Decompiler.AlignSize(sizeof(ushort)); } // Param 1 DeserializeNext(); if (stream.Version > ArrayMethodEndParmsVersion && !skipEndParms) { // EndParms DeserializeNext(); } }
protected virtual void DeserializeMethodOne( IUnrealStream stream, bool skipEndParms = false ) { // Array DeserializeNext(); if( stream.Version > ArrayMethodSizeParmsVersion ) { // Size stream.Skip( 2 ); Decompiler.AlignSize( sizeof(ushort) ); } // Param 1 DeserializeNext(); if( stream.Version > ArrayMethodEndParmsVersion && !skipEndParms ) { // EndParms DeserializeNext(); } }
public void Deserialize(IUnrealStream stream) { ClassIndex = stream.ReadObjectIndex(); SuperIndex = stream.ReadObjectIndex(); OuterIndex = stream.ReadInt32(); // ObjectIndex, though always written as 32bits regardless of build. #if BIOSHOCK if (stream.Package.Build == UnrealPackage.GameBuild.BuildName.Bioshock && stream.Version >= 132) { stream.Skip(sizeof(int)); } #endif ObjectName = stream.ReadNameReference(); if (stream.Version >= VArchetype) { ArchetypeIndex = stream.ReadInt32(); } _ObjectFlagsOffset = stream.Position; ObjectFlags = stream.ReadUInt32(); if (stream.Version >= VObjectFlagsToULONG #if BIOSHOCK || (stream.Package.Build == UnrealPackage.GameBuild.BuildName.Bioshock && stream.Package.LicenseeVersion >= 40) #endif ) { ObjectFlags = (ObjectFlags << 32) | stream.ReadUInt32(); } SerialSize = stream.ReadIndex(); if (SerialSize > 0 || stream.Version >= VSerialSizeConditionless) { SerialOffset = stream.ReadIndex(); } #if BIOSHOCK if (stream.Package.Build == UnrealPackage.GameBuild.BuildName.Bioshock && stream.Version >= 130) { stream.Skip(sizeof(int)); } #endif if (stream.Version < 220) { return; } if (stream.Version < 543 #if ALPHAPROTOCOL && stream.Package.Build != UnrealPackage.GameBuild.BuildName.AlphaProtcol #endif ) { int componentMapCount = stream.ReadInt32(); stream.Skip(componentMapCount * 12); //if( componentMapCount > 0 ) //{ // Components = new Dictionary<int, int>( componentMapCount ); // for( int i = 0; i < componentMapCount; ++ i ) // { // Components.Add( stream.ReadNameIndex(), stream.ReadObjectIndex() ); // } //} } if (stream.Version < 247) { return; } ExportFlags = stream.ReadUInt32(); if (stream.Version < 322) { return; } #if BIOSHOCK if (stream.Package.Build == UnrealPackage.GameBuild.BuildName.Bioshock_Infinite) { var unk = stream.ReadUInt32(); if (unk == 1) { var flags = stream.ReadUInt32(); if ((flags & 1) != 0x0) { stream.ReadUInt32(); } stream.Skip(16); // guid stream.ReadUInt32(); // 01000020 } return; } #endif #if MKKE if (stream.Package.Build != UnrealPackage.GameBuild.BuildName.MKKE) { #endif int netObjectCount = stream.ReadInt32(); stream.Skip(netObjectCount * 4); //if( netObjectCount > 0 ) //{ // NetObjects = new List<int>( netObjectCount ); // for( int i = 0; i < netObjectCount; ++ i ) // { // NetObjects.Add( stream.ReadObjectIndex() ); // } //} #if MKKE } #endif stream.Skip(16); // Package guid if (stream.Version > 486) // 475? 486(> Stargate Worlds) { stream.Skip(4); // Package flags } }
public void Deserialize( IUnrealStream stream ) { if( stream.Version >= 63 ) { // Offset to (Width = ...) WidthOffset = stream.ReadUInt32(); long opos = stream.Position; stream.Seek( WidthOffset, System.IO.SeekOrigin.Begin ); Width = stream.ReadUInt32(); Height = stream.ReadUInt32(); stream.Seek( opos, System.IO.SeekOrigin.Begin ); } int mipMapSize = stream.ReadIndex(); Pixels = new int[mipMapSize]; switch( Owner._Format.Decompile().Substring( 6 ) ) { case "TEXF_RGBA8": case "5": for( int i = 0; i < mipMapSize; ++ i ) { Pixels[i] = stream.ReadInt32(); } break; case "TEXF_DXT1": case "3": for( int i = 0; i < mipMapSize / 2; ++ i ) { byte c = stream.ReadByte(); Pixels[i ++] = c & 0xF0; Pixels[i] = c & 0x0F; } // PostProcess: // 4x4 4bit per pixel, 16bit per color: 5bits red; 6bits green; 5bits blue. // break; } // Width, Height. See above! stream.Skip( 8 ); BitsWidth = stream.ReadByte(); BitsHeight = stream.ReadByte(); }
public void Deserialize( IUnrealStream stream ) { #if HAWKEN if( stream.Package.Build == GameBuild.BuildName.Hawken ) { stream.Skip( 4 ); } #endif NamesCount = stream.ReadUInt32(); NamesOffset = stream.ReadUInt32(); ExportsCount = stream.ReadUInt32(); ExportsOffset = stream.ReadUInt32(); #if APB if( stream.Package.Build == GameBuild.BuildName.APB ) { stream.Skip( 24 ); } #endif ImportsCount = stream.ReadUInt32(); ImportsOffset = stream.ReadUInt32(); Console.WriteLine( "\tNames Count:" + NamesCount + "\tNames Offset:" + NamesOffset + "\r\n\tExports Count:" + ExportsCount + "\tExports Offset:" + ExportsOffset + "\r\n\tImports Count:" + ImportsCount + "\tImports Offset:" + ImportsOffset ); if( stream.Version < 415 ) return; DependsOffset = stream.ReadUInt32(); if( stream.Version >= 584 #if TRANSFORMERS || (stream.Package.Build == GameBuild.BuildName.Transformers && stream.Version >= 535) #endif ) { // Additional tables, like thumbnail, and guid data. if( stream.Version >= 623 #if BIOSHOCK && stream.Package.Build != GameBuild.BuildName.Bioshock_Infinite #endif #if TRANSFORMERS && stream.Package.Build != GameBuild.BuildName.Transformers // FIXME: This is not skipped Gildor's UModel game support odd? #endif ) { stream.Skip( 12 ); } stream.Skip( 4 ); } }
public void Deserialize( IUnrealStream stream ) { #if HAWKEN if( stream.Package.Build == GameBuild.BuildName.Hawken ) { stream.Skip( 4 ); } #endif NamesCount = stream.ReadUInt32(); NamesOffset = stream.ReadUInt32(); ExportsCount = stream.ReadUInt32(); ExportsOffset = stream.ReadUInt32(); #if APB if( stream.Package.Build == GameBuild.BuildName.APB ) { stream.Skip( 24 ); } #endif ImportsCount = stream.ReadUInt32(); ImportsOffset = stream.ReadUInt32(); Console.WriteLine( "\tNames Count:" + NamesCount + "\tNames Offset:" + NamesOffset + "\r\n\tExports Count:" + ExportsCount + "\tExports Offset:" + ExportsOffset + "\r\n\tImports Count:" + ImportsCount + "\tImports Offset:" + ImportsOffset ); if( stream.Version < 415 ) return; DependsOffset = stream.ReadUInt32(); if( stream.Version >= 584 ) { // Additional tables, like thumbnail, and guid data. if( stream.Version >= 623 #if BIOSHOCK && stream.Package.Build != GameBuild.BuildName.Bioshock_Infinite #endif ) { stream.Skip( 12 ); } stream.Skip( 4 ); } }
public void Deserialize(IUnrealStream stream) { ClassIndex = stream.ReadObjectIndex(); SuperIndex = stream.ReadObjectIndex(); OuterIndex = stream.ReadInt32(); // ObjectIndex, though always written as 32bits regardless of build. ObjectName = stream.ReadNameReference(); if (stream.Version >= VArchetype) { ArchetypeIndex = stream.ReadInt32(); } _ObjectFlagsOffset = stream.Position; ObjectFlags = stream.ReadUInt64(); //if( stream.Version >= VObjectFlagsToULONG ) //{ // //ObjectFlags = (ObjectFlags << 32) | stream.ReadUInt32(); // ObjectFlags = (ObjectFlags << 32) | stream.ReadUInt64(); //} SerialSize = stream.ReadIndex(); SerialOffset = (int)stream.ReadInt64(); if (stream.Version < 220) { return; } if (stream.Version < 543) { int componentMapCount = stream.ReadInt32(); stream.Skip(componentMapCount * 12); //if( componentMapCount > 0 ) //{ // Components = new Dictionary<int, int>( componentMapCount ); // for( int i = 0; i < componentMapCount; ++ i ) // { // Components.Add( stream.ReadNameIndex(), stream.ReadObjectIndex() ); // } //} } if (stream.Version < 247) { return; } ExportFlags = stream.ReadUInt32(); if (stream.Version < 322) { return; } int netObjectCount = stream.ReadInt32(); stream.Skip(netObjectCount * 4); //if( netObjectCount > 0 ) //{ // NetObjects = new List<int>( netObjectCount ); // for( int i = 0; i < netObjectCount; ++ i ) // { // NetObjects.Add( stream.ReadObjectIndex() ); // } //} stream.Skip(16); // Package guid if (stream.Version > 486) // 475? 486(> Stargate Worlds) { stream.Skip(4); // Package flags } }
public void Deserialize( IUnrealStream stream ) { ClassIndex = stream.ReadObjectIndex(); SuperIndex = stream.ReadObjectIndex(); OuterIndex = stream.ReadInt32(); // ObjectIndex, though always written as 32bits regardless of build. #if BIOSHOCK if( stream.Package.Build == UnrealPackage.GameBuild.BuildName.Bioshock && stream.Version >= 132 ) { stream.Skip( sizeof(int) ); } #endif ObjectName = stream.ReadNameReference(); if( stream.Version >= VArchetype ) { ArchetypeIndex = stream.ReadInt32(); } _ObjectFlagsOffset = stream.Position; ObjectFlags = stream.ReadUInt32(); if( stream.Version >= VObjectFlagsToULONG #if BIOSHOCK || (stream.Package.Build == UnrealPackage.GameBuild.BuildName.Bioshock && stream.Package.LicenseeVersion >= 40) #endif ) { ObjectFlags = (ObjectFlags << 32) | stream.ReadUInt32(); } SerialSize = stream.ReadIndex(); if( SerialSize > 0 || stream.Version >= VSerialSizeConditionless ) { SerialOffset = stream.ReadIndex(); } #if BIOSHOCK if( stream.Package.Build == UnrealPackage.GameBuild.BuildName.Bioshock && stream.Version >= 130 ) { stream.Skip( sizeof(int) ); } #endif if( stream.Version < 220 ) return; if( stream.Version < 543 #if ALPHAPROTOCOL && stream.Package.Build != UnrealPackage.GameBuild.BuildName.AlphaProtcol #endif #if TRANSFORMERS && (stream.Package.Build != UnrealPackage.GameBuild.BuildName.Transformers || stream.Package.LicenseeVersion < 37) #endif ) { int componentMapCount = stream.ReadInt32(); stream.Skip( componentMapCount * 12 ); //if( componentMapCount > 0 ) //{ // Components = new Dictionary<int, int>( componentMapCount ); // for( int i = 0; i < componentMapCount; ++ i ) // { // Components.Add( stream.ReadNameIndex(), stream.ReadObjectIndex() ); // } //} } if( stream.Version < 247 ) return; ExportFlags = stream.ReadUInt32(); if( stream.Version < 322 ) return; #if TRANSFORMERS if( stream.Package.Build == UnrealPackage.GameBuild.BuildName.Transformers && stream.Package.LicenseeVersion >= 116 ) { var flag = stream.ReadByte(); if( flag == 0 ) { return; } } #endif #if BIOSHOCK if( stream.Package.Build == UnrealPackage.GameBuild.BuildName.Bioshock_Infinite ) { var unk = stream.ReadUInt32(); if( unk == 1 ) { var flags = stream.ReadUInt32(); if( (flags & 1) != 0x0 ) { stream.ReadUInt32(); } stream.Skip( 16 ); // guid stream.ReadUInt32(); // 01000020 } return; } #endif #if MKKE if( stream.Package.Build != UnrealPackage.GameBuild.BuildName.MKKE ) { #endif int netObjectCount = stream.ReadInt32(); stream.Skip( netObjectCount * 4 ); //if( netObjectCount > 0 ) //{ // NetObjects = new List<int>( netObjectCount ); // for( int i = 0; i < netObjectCount; ++ i ) // { // NetObjects.Add( stream.ReadObjectIndex() ); // } //} #if MKKE } #endif stream.Skip( 16 ); // Package guid if( stream.Version > 486 ) // 475? 486(> Stargate Worlds) { stream.Skip( 4 ); // Package flags } }