static void TestPAK() { PakLoader loader = new PakLoader(@"F:\Epic Games\SatisfactoryEarlyAccess\FactoryGame\Content\Paks\FactoryGame-WindowsNoEditor.pak"); if (!loader.Load(null)) return; // string asset_path = "Equipment/Medkit/Equip_MedKit"; // string asset_path = "Resource/Equipment/Medkit/Desc_Medkit"; // string asset_path = "Resource/BP_HealthGainDescriptor"; // string asset_path = "Prototype/WAT/Desc_WAT2"; // string asset_path = "Resource/Environment/CrashSites/Desc_HardDrive"; // string asset_path = "Resource/Parts/HardDrive/FBX/HardDrive"; // string asset_path = "World/Benefit/DropPod/BP_HardDriveSettings"; // string asset_path = "Resource/Parts/NuclearWaste/Desc_NuclearWaste"; // string asset_path = "Resource/Parts/GenericBiomass/Desc_Vines"; // string asset_path = "Resource/RawResources/SAM/Desc_SAM"; string asset_path = "Resource/BP_ResourceSettings"; // string asset_path = ""; // string asset_path = ""; // string asset_path = ""; var asset = loader.ReadObject("FactoryGame/Content/FactoryGame/" + asset_path); if (asset != null) { string export = Path.Combine(@"E:\GitHub\satisfactory-savegame-tool-ng\__internal", asset_path.Split('/').Last()) + ".dump"; CoreLib.Dumper dumper = new CoreLib.Dumper(export); asset.DumpTo(dumper); dumper.Close(); } var raw = loader.ReadAsset("FactoryGame/Content/FactoryGame/" + asset_path); if (raw != null) { string export = Path.Combine(@"E:\GitHub\satisfactory-savegame-tool-ng\__internal", asset_path.Split('/').Last()) + ".raw"; using (FileStream strm = File.Create(export)) { strm.Write(raw, 0, raw.Length); strm.Flush(); strm.Close(); } } }
internal bool Load(string pakfile, ICallback callback) { // Before loading .pak, check cache folder and load all files if (callback != null) { callback.Update((long)0, "Loading image cache", null); } _CachePath = null; try { _CachePath = Path.Combine(Config.Root.pak_loader.cachepath, _Version.ToString()); if (!Directory.Exists(_CachePath)) { Directory.CreateDirectory(_CachePath); } } catch { _CachePath = null; } if (_CachePath == null) { return(false); } var files = Directory.EnumerateFiles(_CachePath); foreach (string file in files) { if (callback != null) { callback.Update((long)0, null, file); } BitmapSource bitmap = ImageHandler.LoadImageFromFile(file); if (bitmap == null) { continue; } // Freeze and add to cache bitmap.Freeze(); string name = Path.GetFileNameWithoutExtension(file); _Cache.Add(name, bitmap); } if (File.Exists(pakfile)) { _Loader = new PakLoader(pakfile); if (_Loader == null) { return(false); } if (callback != null) { callback.Start((long)0, "Loading " + pakfile, ""); } if (!_Loader.Load(callback)) { return(false); } if (_Loader.Index.Count == 0) { return(false); } } if (callback != null) { callback.Stop("", "Done"); } return(true); }