Exemplo n.º 1
0
            public override List <GameAsset> Load(LeakerInstance instance)
            {
                var results = new List <GameAsset>();

                foreach (int index in new int[] { (int)AssetPool.soundglobals, (int)AssetPool.soundbank })
                {
                    var poolInfo = instance.Reader.ReadStruct <AssetPoolInfo>(instance.Game.BaseAddress + instance.Game.AssetPoolsAddresses[instance.Game.ProcessIndex] + (index * 24));

                    StartAddress = poolInfo.PoolPtr;
                    AssetSize    = poolInfo.AssetSize;
                    AssetCount   = poolInfo.PoolSize;

                    for (int i = 0; i < AssetCount; i++)
                    {
                        var header = instance.Reader.ReadStruct <SoundAsset>(StartAddress + (i * AssetSize));

                        if (IsNullAsset(header.NamePointer))
                        {
                            continue;
                        }

                        results.Add(new GameAsset()
                        {
                            Name          = instance.Reader.ReadNullTerminatedString(header.NamePointer).Split(':')[0],
                            HeaderAddress = StartAddress + (i * AssetSize),
                            AssetPool     = this,
                            Type          = Name,
                            Information   = string.Format("Aliases: {0}", header.AliasCount)
                        });
                    }
                }

                return(results);
            }
Exemplo n.º 2
0
            public override LeakerStatus Export(GameAsset asset, LeakerInstance instance)
            {
                var header = instance.Reader.ReadStruct <RawFileAsset>(asset.HeaderAddress);

                if (asset.Name != instance.Reader.ReadNullTerminatedString(header.NamePointer))
                {
                    return(LeakerStatus.MemoryChanged);
                }

                string path = Path.Combine("exported_files", instance.Game.Name, asset.Name);

                // Create path
                Directory.CreateDirectory(Path.GetDirectoryName(path));

                MemoryStream DecodedCodeStream = Decode(instance.Reader.ReadBytes(header.RawDataPtr + 2, header.compressedLength - 2));

                try
                {
                    using (var outputStream = new FileStream(path, FileMode.Create))
                    {
                        DecodedCodeStream.CopyTo(outputStream);
                    }
                }
                catch
                {
                    return(LeakerStatus.Exception);
                }

                return(LeakerStatus.Success);
            }
Exemplo n.º 3
0
            public override LeakerStatus Export(GameAsset asset, LeakerInstance instance)
            {
                var header = instance.Reader.ReadStruct <SoundAsset>(asset.HeaderAddress);

                if (asset.Name != instance.Reader.ReadNullTerminatedString(header.NamePointer).Split(':')[0])
                {
                    return(LeakerStatus.MemoryChanged);
                }

                Directory.CreateDirectory(instance.SoundZoneFolder);

                using (var writer = new StreamWriter(Path.Combine(instance.SoundZoneFolder, asset.Name + ".alias.csv")))
                {
                    writer.WriteLine("Name,Secondary,FileSpec,");
                    for (int j = 0; j < header.AliasCount; j++)
                    {
                        var aliasData = instance.Reader.ReadStruct <SoundAlias>(header.AliasesPointer + (j * 32));
                        for (int k = 0; k < aliasData.EntriesCount; k++)
                        {
                            var aliasEntryData = instance.Reader.ReadStruct <SoundAliasEntry>(aliasData.EntriesPointer + (k * 0xE8));
                            writer.WriteLine("{0},{1},{2},",
                                             instance.Reader.ReadNullTerminatedString(aliasEntryData.NamePtr),
                                             instance.Reader.ReadNullTerminatedString(aliasEntryData.SecondaryPointer),
                                             instance.Reader.ReadNullTerminatedString(aliasEntryData.FileSpec));
                        }
                    }
                }

                return(LeakerStatus.Success);
            }
Exemplo n.º 4
0
            public override List <GameAsset> Load(LeakerInstance instance)
            {
                var results = new List <GameAsset>();

                var poolInfo = instance.Reader.ReadStruct <AssetPoolInfo>(instance.Game.BaseAddress + instance.Game.AssetPoolsAddresses[instance.Game.ProcessIndex] + (Index * 24));

                StartAddress = poolInfo.PoolPtr;
                AssetSize    = poolInfo.AssetSize;
                AssetCount   = poolInfo.PoolSize;

                for (int i = 0; i < AssetCount; i++)
                {
                    var header = instance.Reader.ReadStruct <TTFAsset>(StartAddress + (i * AssetSize));

                    if (IsNullAsset(header.NamePointer))
                    {
                        continue;
                    }

                    results.Add(new GameAsset()
                    {
                        Name          = instance.Reader.ReadNullTerminatedString(header.NamePointer),
                        HeaderAddress = StartAddress + (i * AssetSize),
                        AssetPool     = this,
                        Type          = Name,
                        Information   = string.Format("Size: 0x{0:X}", header.AssetSize)
                    });
                }

                return(results);
            }
Exemplo n.º 5
0
            public override List <GameAsset> Load(LeakerInstance instance)
            {
                var results = new List <GameAsset>();

                // Never finished this s***e

                /*var poolInfo = instance.Reader.ReadStruct<AssetPoolInfo>(instance.Game.BaseAddress + instance.Game.AssetPoolsAddresses[instance.Game.ProcessIndex] + (Index * 24));
                 *
                 * StartAddress = poolInfo.PoolPtr;
                 * AssetSize = poolInfo.AssetSize;
                 * AssetCount = poolInfo.PoolSize;
                 *
                 * for (int i = 0; i < AssetCount; i++)
                 * {
                 *  var header = instance.Reader.ReadStruct<GfxMap>(StartAddress + (i * AssetSize));
                 *
                 *  if (IsNullAsset(header.NamePointer))
                 *      continue;
                 *
                 *  var RawData = instance.Reader.ReadBytes(StartAddress + (i * AssetSize), (int)AssetSize);
                 *  string exportName = Path.Combine("iw8_maps", instance.Reader.ReadNullTerminatedString(header.NamePointer));
                 *  Directory.CreateDirectory(Path.GetDirectoryName(exportName));
                 *  File.WriteAllBytes(exportName, RawData);
                 *
                 *  RawData = instance.Reader.ReadBytes(header.unk3, 100000);
                 *  exportName = Path.Combine("iw8_maps", instance.Reader.ReadNullTerminatedString(header.NamePointer) + "stdsfgdfg");
                 *  Directory.CreateDirectory(Path.GetDirectoryName(exportName));
                 *  File.WriteAllBytes(exportName, RawData);
                 *
                 *  Console.WriteLine(instance.Reader.ReadNullTerminatedString(header.MapNamePointer));
                 * }*/

                return(results);
            }
Exemplo n.º 6
0
            public override List <GameAsset> Load(LeakerInstance instance)
            {
                var results = new List <GameAsset>();

                var poolInfo = instance.Reader.ReadStruct <AssetPoolInfo>(instance.Game.BaseAddress + instance.Game.AssetPoolsAddresses[instance.Game.ProcessIndex] + (Index * 24));

                StartAddress = poolInfo.PoolPtr;
                AssetSize    = poolInfo.AssetSize;
                AssetCount   = poolInfo.PoolSize;

                Dictionary <string, int> dictionary = new Dictionary <string, int>();

                for (int i = 0; i < AssetCount; i++)
                {
                    var header = instance.Reader.ReadStruct <LocalizeAsset>(StartAddress + (i * AssetSize));

                    if (IsNullAsset(header.NamePointer))
                    {
                        continue;
                    }
                    // Not optimized at all but idc
                    string name     = instance.Reader.ReadNullTerminatedString(header.NamePointer);
                    int    idx      = name.IndexOf('/');
                    string fileName = name.Substring(0, idx);

                    if (dictionary.TryGetValue(fileName, out int value))
                    {
                        dictionary.Remove(fileName);
                        dictionary.Add(fileName, value + 1);
                    }
                    else
                    {
                        dictionary.Add(fileName, 0);
                    }
                }

                foreach (var file in dictionary)
                {
                    results.Add(new GameAsset()
                    {
                        Name          = file.Key,
                        HeaderAddress = StartAddress,
                        AssetPool     = this,
                        Type          = Name,
                        Information   = string.Format("Strings: 0x{0:X}", file.Value)
                    });
                }

                return(results);
            }
Exemplo n.º 7
0
            public override LeakerStatus Export(GameAsset asset, LeakerInstance instance)
            {
                var header = instance.Reader.ReadStruct <WeaponAsset>(asset.HeaderAddress);

                if (asset.Name != instance.Reader.ReadNullTerminatedString(header.NamePointer))
                {
                    return(LeakerStatus.MemoryChanged);
                }

                string path = Path.Combine("exported_files", instance.Game.Name, asset.Name);

                // Create path
                Directory.CreateDirectory(Path.GetDirectoryName(path));



                return(LeakerStatus.Success);
            }
Exemplo n.º 8
0
            public override LeakerStatus Export(GameAsset asset, LeakerInstance instance)
            {
                string path = Path.Combine("exported_files", instance.Game.Name, "localizedstrings", asset.Name + ".str");

                Directory.CreateDirectory(Path.GetDirectoryName(path));
                var result = new StringBuilder();

                result.AppendLine("VERSION				\"1\"");
                result.AppendLine("CONFIG				\"C:\\projects\\cod\\t7\\bin\\StringEd.cfg\"");
                result.AppendLine("FILENOTES		    \"Dumped via ModernWarfareLeaker by JariK\"");
                result.AppendLine();

                var result2 = new StringBuilder();

                for (int i = 0; i < AssetCount; i++)
                {
                    var header = instance.Reader.ReadStruct <LocalizeAsset>(StartAddress + (i * AssetSize));

                    if (IsNullAsset(header.NamePointer))
                    {
                        continue;
                    }

                    string name     = instance.Reader.ReadNullTerminatedString(header.NamePointer);
                    int    idx      = name.IndexOf('/');
                    string fileName = name.Substring(0, idx);

                    if (asset.Name == fileName)
                    {
                        result.AppendLine(String.Format("REFERENCE            {0}", name.Substring(idx + 1)));
                        result.AppendLine(String.Format("LANG_ENGLISH         \"{0}\"", instance.Reader.ReadNullTerminatedString(header.RawDataPtr)));
                        result.AppendLine();
                        result2.AppendLine(name + "," + instance.Reader.ReadNullTerminatedString(header.RawDataPtr));
                    }
                }
                result.AppendLine();
                result.AppendLine("ENDMARKER");
                // Write result
                File.WriteAllText(path, result.ToString());
                //File.WriteAllText(path + "2", result2.ToString());

                return(LeakerStatus.Success);
            }
Exemplo n.º 9
0
        public bool ValidateAddresses(LeakerInstance instance)
        {
            BaseAddress = instance.Reader.GetBaseAddress();

            foreach (var assetPoolsAddress in AssetPoolsAddresses)
            {
                if (instance.Reader.ReadNullTerminatedString(instance.Reader.ReadInt64(instance.Reader
                                                                                       .ReadStruct <AssetPoolInfo>(BaseAddress + assetPoolsAddress + 24 * 9).PoolPtr)) ==
                    "axis_guide_createfx")
                {
                    return(true);
                }
            }

            // Scan for it
            var assetDBScan = instance.Reader.FindBytes(
                new byte?[] { 0x48, 0x8D, 0x04, 0x40, 0x4C, 0x8D, 0x8E, null, null, null, null, 0x4D, 0x8D, 0x0C, 0xC1, 0x8D, 0x42, 0xFF },
                instance.Reader.GetBaseAddress(),
                instance.Reader.GetBaseAddress() + instance.Reader.GetModuleMemorySize(),
                true);
            var stringDBScan = instance.Reader.FindBytes(
                new byte?[] { 0x4D, 0x8B, 0xC7, 0x48, 0x03, 0x1D, null, null, null, null, 0x49, 0x8B, 0xD5 },
                instance.Reader.GetBaseAddress(),
                instance.Reader.GetBaseAddress() + instance.Reader.GetModuleMemorySize(),
                true);

            // Validate results
            if (assetDBScan.Length > 0 && stringDBScan.Length > 0)
            {
                AssetPoolsAddresses = new long[] { instance.Reader.ReadInt32(assetDBScan[0] + 0x7) };
                long stringDBAddress = instance.Reader.ReadInt32(stringDBScan[0] + 0x6) + (stringDBScan[0] + 0xA);
                //Console.WriteLine("{0:X}", assetPoolsAddress);
                if (instance.Reader.ReadNullTerminatedString(instance.Reader.ReadInt64(instance.Reader
                                                                                       .ReadStruct <AssetPoolInfo>(BaseAddress + AssetPoolsAddresses[0] + 24 * 9).PoolPtr)) ==
                    "axis_guide_createfx")
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 10
0
            public override LeakerStatus Export(GameAsset asset, LeakerInstance instance)
            {
                var header = instance.Reader.ReadStruct <TTFAsset>(asset.HeaderAddress);

                if (asset.Name != instance.Reader.ReadNullTerminatedString(header.NamePointer))
                {
                    return(LeakerStatus.MemoryChanged);
                }

                string path = Path.Combine("exported_files", instance.Game.Name, asset.Name);

                // Create path
                Directory.CreateDirectory(Path.GetDirectoryName(path));

                byte[] buffer = instance.Reader.ReadBytes(header.RawDataPtr, (int)header.AssetSize);

                File.WriteAllBytes(path, buffer);

                return(LeakerStatus.Success);
            }
Exemplo n.º 11
0
            public override LeakerStatus Export(GameAsset asset, LeakerInstance instance)
            {
                var header = instance.Reader.ReadStruct <StringTableAsset>(asset.HeaderAddress);

                if (asset.Name != instance.Reader.ReadNullTerminatedString(header.NamePointer))
                {
                    return(LeakerStatus.MemoryChanged);
                }

                string path = Path.Combine("exported_files", instance.Game.Name, asset.Name);

                // Create path
                Directory.CreateDirectory(Path.GetDirectoryName(path));
                // Output result
                var result = new StringBuilder();

                // Loop through rows
                int index = 0;

                for (int x = 0; x < header.RowCount; x++)
                {
                    // Loop through columns for this row
                    for (int y = 0; y < header.ColumnCount; y++)
                    {
                        int    stringIndex = instance.Reader.ReadInt16(header.CellsPointer + (2 * index));
                        string str         = instance.Reader.ReadNullTerminatedString(instance.Reader.ReadInt64(header.StringsPtr + (8 * stringIndex)));
                        result.Append(str + ",");
                        index++;
                    }
                    // Create new line
                    result.AppendLine();
                }
                // Write result
                File.WriteAllText(path, result.ToString());

                return(LeakerStatus.Success);
            }
Exemplo n.º 12
0
            public override LeakerStatus Export(GameAsset asset, LeakerInstance instance)
            {
                var header = instance.Reader.ReadStruct <ScriptFileAsset>(asset.HeaderAddress);

                if (asset.Name != instance.Reader.ReadNullTerminatedString(header.NamePointer))
                {
                    return(LeakerStatus.MemoryChanged);
                }

                string addedScriptFolder = Path.Combine(asset.Name.Contains("scripts") ? "" : "scripts", asset.Name);
                string path = Path.Combine("exported_files", instance.Game.Name, addedScriptFolder);

                // Create path
                Directory.CreateDirectory(Path.GetDirectoryName(path));

                MemoryStream DecodedCodeStream = Decode(instance.Reader.ReadBytes(header.buffer + 2, header.compressedLength - 2));

                using (var outputStream = new FileStream(path, FileMode.Create))
                {
                    DecodedCodeStream.CopyTo(outputStream);
                }

                return(LeakerStatus.Success);
            }
Exemplo n.º 13
0
 public override List <GameAsset> Load(LeakerInstance instance)
 {
     // Never finished this s***e
     return(new List <GameAsset>());
 }
Exemplo n.º 14
0
 /// <summary>
 /// Loads Assets from the given Asset Pool
 /// </summary>
 public abstract List <GameAsset> Load(LeakerInstance instance);
Exemplo n.º 15
0
            public List <GameAsset> Load(LeakerInstance instance, int i)
            {
                var results = new List <GameAsset>();

                var poolInfo = instance.Reader.ReadStruct <AssetPoolInfo>(instance.Game.BaseAddress + instance.Game.AssetPoolsAddresses[instance.Game.ProcessIndex] + (Index * 24));

                StartAddress = poolInfo.PoolPtr;
                AssetSize    = poolInfo.AssetSize;
                AssetCount   = poolInfo.PoolSize;

                for (i = 0; i < AssetCount; i++)
                {
                    var header = instance.Reader.ReadStruct <WeaponAsset>(StartAddress + (i * AssetSize));

                    if (IsNullAsset(header.NamePointer))
                    {
                        continue;
                    }

                    /*var RawData = instance.Reader.ReadBytes(StartAddress + (i * AssetSize), (int)AssetSize);
                     * string exportName = Path.Combine("iw8_weapon", instance.Reader.ReadNullTerminatedString(header.NamePointer));
                     * Directory.CreateDirectory(Path.GetDirectoryName(exportName));
                     * File.WriteAllBytes(exportName, RawData);*/

                    if (instance.Reader.ReadNullTerminatedString(header.NamePointer) == "iw8_ar_akilo47_mp")
                    {
                        /*long pos = StartAddress + (i * AssetSize);
                         * for (int j = 0; j < AssetSize; j += 8)
                         * {
                         *  Console.WriteLine(instance.Reader.ReadNullTerminatedString(instance.Reader.ReadInt64(instance.Reader.ReadInt64((pos + j) )) + 8));
                         * }*/

                        var    RawData    = instance.Reader.ReadBytes(instance.Reader.ReadInt64(header.WeaponAttachmentTypes[1].AttachmentPointer), (int)968);
                        string exportName = Path.Combine("iw8_weapon", instance.Reader.ReadNullTerminatedString(header.NamePointer) + "att");
                        Directory.CreateDirectory(Path.GetDirectoryName(exportName));
                        File.WriteAllBytes(exportName, RawData);
                        long pos = instance.Reader.ReadInt64(header.WeaponAttachmentTypes[1].AttachmentPointer);
                        for (int j = 0; j < 968; j += 8)
                        {
                            Console.WriteLine(instance.Reader.ReadNullTerminatedString(instance.Reader.ReadInt64(pos + j)));
                        }

                        var Att = instance.Reader.ReadStruct <AttachmentAsset>(
                            instance.Reader.ReadInt64(header.WeaponAttachmentTypes[1].AttachmentPointer));
                        Console.WriteLine(instance.Reader.ReadNullTerminatedString(instance.Reader.ReadInt64(instance.Reader.ReadInt64(Att.WorldModelPointer))));

                        /*for (int d = 0; d < header.WeaponAttachmentTypes[1].AttachmentCount; d++)
                         * {
                         *  Console.WriteLine(instance.Reader.ReadNullTerminatedString(instance.Reader.ReadInt64(instance.Reader.ReadInt64((header.WeaponAttachmentTypes[1].AttachmentPointer + d* 8) ))));
                         * }*/
                    }

                    var result = new StringBuilder();
                    result.AppendLine("Weapon: " + instance.Reader.ReadNullTerminatedString(header.NamePointer));

                    result.AppendLine("\nAttachments:");
                    foreach (var AttackmentType in header.WeaponAttachmentTypes)
                    {
                        for (int d = 0; d < AttackmentType.AttachmentCount; d++)
                        {
                            var attachmentAsset = instance.Reader.ReadStruct <AttachmentAsset>(instance.Reader.ReadInt64(AttackmentType.AttachmentPointer + d * 8));
                            result.AppendLine("Attachment: " +
                                              instance.Reader.ReadNullTerminatedString(attachmentAsset.NamePointer));
                            string worldModel = instance.Reader.ReadNullTerminatedString(instance.Reader.ReadInt64(instance.Reader.ReadInt64(attachmentAsset.WorldModelPointer)));
                            string viewModel  = instance.Reader.ReadNullTerminatedString(instance.Reader.ReadInt64(instance.Reader.ReadInt64(attachmentAsset.ViewModelPointer)));
                            if (worldModel != "")
                            {
                                result.AppendLine("Worldmodel: " + worldModel);
                            }
                            if (viewModel != "")
                            {
                                result.AppendLine("Viewmodel: " + viewModel);
                            }
                            result.AppendLine();
                        }
                    }
                    string path = Path.Combine("exported_files", instance.Game.Name, "weapon", instance.Reader.ReadNullTerminatedString(header.NamePointer) + ".txt");
                    Directory.CreateDirectory(Path.GetDirectoryName(path));

                    File.WriteAllText(path, result.ToString());

                    results.Add(new GameAsset()
                    {
                        Name          = instance.Reader.ReadNullTerminatedString(header.NamePointer),
                        HeaderAddress = StartAddress + (i * AssetSize),
                        AssetPool     = this,
                        Type          = Name,
                        Information   = string.Format("Size: 0x{0:X}", 5)
                    });
                }

                return(results);
            }
Exemplo n.º 16
0
 /// <summary>
 /// Exports the given asset from the game
 /// </summary>
 public abstract LeakerStatus Export(GameAsset asset, LeakerInstance instance);
Exemplo n.º 17
0
 public override LeakerStatus Export(GameAsset asset, LeakerInstance instance)
 {
     return(LeakerStatus.Success);
 }