public GameViewModel(IMvxNavigationService navigationService, FakeDAL dal, GameBuild game) { this.navigationService = navigationService; this.dal = dal; this.game = game; this.Name = game.Name; builds = new MvxObservableCollection <BuildViewModel>(dal.Get <Build>() .Where(x => x.Game.id == game.id) .Select(Create)); Builds = builds; ViewBuildCommand = new MvxAsyncCommand <BuildViewModel>(async b => await navigationService.Navigate(b)); NewBuildCommand = new MvxAsyncCommand(async() => { Busy = true; await RaisePropertyChanged("Busy"); var bvm = await Task.Run(() => { var build = new Build { Name = "New Build", Game = game }; dal.Save(build); return(Create(build)); }); builds.Add(bvm); Busy = false; await RaisePropertyChanged("Busy"); await navigationService.Navigate(bvm); }); }
public bool Verify( GameBuild gb, UnrealPackage package ) { if( _VerifyEqual ? package.Version != _MinVersion || package.LicenseeVersion != _MinLicensee : package.Version < _MinVersion || package.Version > _MaxVersion || package.LicenseeVersion < _MinLicensee || package.LicenseeVersion > _MaxLicensee ) return false; gb.Version = package.Version; gb.LicenseeVersion = package.LicenseeVersion; if( _IsConsoleCompressed < 2 ) { gb.IsConsoleCompressed = _IsConsoleCompressed == 1; } if( _IsXenonCompressed < 2 ) { gb.IsXenonCompressed = _IsXenonCompressed == 1; } return true; }
public static void LoadMap(LevelOption Level_Map, GameBuild build) { string xboxName = AppSettings.Settings.IP_and_XDK_Name; if (xboxName != "") { XboxDebugCommunicator communicator = new XboxDebugCommunicator(xboxName); try { communicator.Connect(); } catch (Exception ex) { throw new Exception("Not Connected"); } EndianIO nio = new EndianIO(communicator.ReturnXboxMemoryStream(), EndianType.BigEndian); nio.Open(); communicator.Freeze(); if (build == GameBuild.PreBeta) { nio.Out.BaseStream.Position = 0x83b8dea8L; } else { nio.Out.BaseStream.Position = 0x8357d140L; } nio.Out.WriteAsciiString(beta_mapScenarioPaths[(int)Level_Map], 0x100); if (build == GameBuild.PreBeta) { nio.Out.BaseStream.Position = 0x83b7fe78L; } else { nio.Out.BaseStream.Position = 0x8356f110L; } if (Level_Map <= LevelOption.boneyard) { nio.Out.Write((int)AppSettings.Settings.Force_Load_MapType); } else { byte[] buffer = new byte[4]; buffer[3] = 2; nio.Out.Write(buffer); } if (build == GameBuild.PreBeta) { nio.Out.BaseStream.Position = 0x83b7fe6eL; } else { nio.Out.BaseStream.Position = 0x8356f106L; } nio.Out.Write((byte)1); communicator.Unfreeze(); nio.Close(); communicator.Disconnect(); } else { MessageBox.Show("XDK name not set. Please set it in settings before continuing."); } }
public void Deserialize( UPackageStream stream ) { // Read as one variable due Big Endian Encoding. Version = stream.ReadUInt32(); LicenseeVersion = (ushort)(Version >> 16); Version = (Version & 0xFFFFU); Console.WriteLine( "\tPackage Version:" + Version + "/" + LicenseeVersion ); Build = new GameBuild( this ); Console.WriteLine( "\tBuild:" + Build.Name ); stream.BuildDetected( Build ); if( Version >= VHeaderSize ) { #if BIOSHOCK if( Build == GameBuild.BuildName.Bioshock_Infinite ) { var unk = stream.ReadInt32(); } #endif #if MKKE if( Build == GameBuild.BuildName.MKKE ) { stream.Skip( 8 ); } #endif #if TRANSFORMERS if( Build == GameBuild.BuildName.Transformers && LicenseeVersion >= 55 ) { if( LicenseeVersion >= 181 ) { stream.Skip( 16 ); } stream.Skip( 4 ); } #endif // Offset to the first class(not object) in the package. HeaderSize = stream.ReadUInt32(); Console.WriteLine( "\tHeader Size: " + HeaderSize ); if( Version >= VGroup ) { // UPK content category e.g. Weapons, Sounds or Meshes. Group = stream.ReadText(); } } // Bitflags such as AllowDownload. PackageFlags = stream.ReadUInt32(); Console.WriteLine( "\tPackage Flags:" + PackageFlags ); // Summary data such as ObjectCount. _TablesData = new TablesData(); _TablesData.Deserialize( stream ); if( Version < 68 ) { int heritageCount = stream.ReadInt32(); int heritageOffset = stream.ReadInt32(); stream.Seek( heritageOffset, SeekOrigin.Begin ); _Heritages = new List<ushort>( heritageCount ); for( var i = 0; i < heritageCount; ++ i ) { _Heritages.Add( stream.ReadUShort() ); } } else { #if THIEFDEADLYSHADOWS if( Build == GameBuild.BuildName.Thief_DS ) { stream.Skip( 4 ); } #endif #if BORDERLANDS if( Build == GameBuild.BuildName.Borderlands ) { stream.Skip( 4 ); } #endif #if MKKE if( Build == GameBuild.BuildName.MKKE ) { stream.Skip( 4 ); } #endif GUID = stream.ReadGuid(); Console.Write( "\r\n\tGUID:" + GUID + "\r\n" ); #if TERA if( Build == GameBuild.BuildName.Tera ) { stream.Position -= 4; } #endif #if MKKE if( Build != GameBuild.BuildName.MKKE ) { #endif int generationCount = stream.ReadInt32(); Generations = new UArray<UGenerationTableItem>( stream, generationCount ); Console.WriteLine( "Deserialized {0} generations", Generations.Count ); #if MKKE } #endif #if TERA if( Build == GameBuild.BuildName.Tera ) { _TablesData.NamesCount = (uint)Generations.Last().NamesCount; } #endif if( Version >= VEngineVersion ) { // The Engine Version this package was created with EngineVersion = stream.ReadInt32(); Console.WriteLine( "\tEngineVersion:" + EngineVersion ); if( Version >= VCOOKEDPACKAGES ) { // The Cooker Version this package was cooked with CookerVersion = stream.ReadInt32(); Console.WriteLine( "\tCookerVersion:" + CookerVersion ); // Read compressed info? if( Version >= VCompression ) { if( IsCooked() ) { CompressionFlags = stream.ReadUInt32(); Console.WriteLine( "\tCompressionFlags:" + CompressionFlags ); CompressedChunks = new UArray<CompressedChunk>{Capacity = stream.ReadInt32()}; //long uncookedSize = stream.Position; if( CompressedChunks.Capacity > 0 ) { CompressedChunks.Deserialize( stream, CompressedChunks.Capacity ); return; //try //{ // UPackageStream outStream = new UPackageStream( packagePath + ".dec", System.IO.FileMode.Create, FileAccess.ReadWrite ); // //File.SetAttributes( packagePath + ".dec", FileAttributes.Temporary ); // outStream.Package = pkg; // outStream._BigEndianCode = stream._BigEndianCode; // var headerBytes = new byte[uncookedSize]; // stream.Seek( 0, SeekOrigin.Begin ); // stream.Read( headerBytes, 0, (int)uncookedSize ); // outStream.Write( headerBytes, 0, (int)uncookedSize ); // foreach( var chunk in pkg.CompressedChunks ) // { // chunk.Decompress( stream, outStream ); // } // outStream.Flush(); // pkg.Stream = outStream; // stream = outStream; // return pkg; //} //catch( Exception e ) //{ // throw new DecompressPackageException(); //} } } } } } } // Read the name table if( _TablesData.NamesCount > 0 ) { Console.WriteLine( "P: " + stream.Position + " NP: " + _TablesData.NamesOffset ); stream.Seek( _TablesData.NamesOffset, SeekOrigin.Begin ); Names = new List<UNameTableItem>( (int)_TablesData.NamesCount ); for( var i = 0; i < _TablesData.NamesCount; ++ i ) { var nameEntry = new UNameTableItem{Offset = (int)stream.Position, Index = i}; nameEntry.Deserialize( stream ); nameEntry.Size = (int)(stream.Position - nameEntry.Offset); Names.Add( nameEntry ); } Console.WriteLine( "Deserialized {0} names", Names.Count ); } // Read Import Table if( _TablesData.ImportsCount > 0 ) { Console.WriteLine( "P: " + stream.Position + " IP: " + _TablesData.ImportsOffset ); stream.Seek( _TablesData.ImportsOffset, SeekOrigin.Begin ); Imports = new List<UImportTableItem>( (int)_TablesData.ImportsCount ); for( var i = 0; i < _TablesData.ImportsCount; ++ i ) { var imp = new UImportTableItem{Offset = (int)stream.Position, Index = i, Owner = this}; imp.Deserialize( stream ); imp.Size = (int)(stream.Position - imp.Offset); Imports.Add( imp ); } Console.WriteLine( "Deserialized {0} imports", Imports.Count ); } // Read Export Table if( _TablesData.ExportsCount > 0 ) { Console.WriteLine( "P: " + stream.Position + " EP: " + _TablesData.ExportsOffset ); stream.Seek( _TablesData.ExportsOffset, SeekOrigin.Begin ); Exports = new List<UExportTableItem>( (int)_TablesData.ExportsCount ); for( var i = 0; i < _TablesData.ExportsCount; ++ i ) { var exp = new UExportTableItem{Offset = (int)stream.Position, Index = i, Owner = this}; // For the GetObjectName like functions try { exp.Deserialize( stream ); } catch { Console.WriteLine( "Failed to deserialize export object at index:" + i ); break; } finally { exp.Size = (int)(stream.Position - exp.Offset); Exports.Add( exp ); } } Console.WriteLine( "Deserialized {0} exports", Exports.Count ); } /*if( pkg.Data.DependsOffset > 0 ) { stream.Seek( pkg.Data.DependsOffset, SeekOrigin.Begin ); pkg._DependsTableList = new List<UnrealDependsTable>( (int)pkg.Data.DependsCount ); for( var i = 0; i < pkg.Data.DependsCount; ++ i ) { var dep = new UnrealDependsTable{TableOffset = stream.Position, TableIndex = i, Owner = pkg}; dep.Deserialize( stream ); dep.TableSize = (int)(stream.Position - dep.TableOffset); pkg.DependsTableList.Add( dep ); } Console.WriteLine( "Deserialized {0} dependencies", pkg.DependsTableList.Count ); }*/ HeaderSize = stream.Position; }