public BatchModLibrary() { MemoryAnalyzer.AddTrackedMemoryItem(@"Batch Mod Installer Panel", new WeakReference(this)); DataContext = this; LoadCommands(); InitializeComponent(); }
public ConflictDetectorPanel() { MemoryAnalyzer.AddTrackedMemoryItem(@"Custom DLC Conflict Detector Panel", new WeakReference(this)); DataContext = this; LoadCommands(); InitializeComponent(); }
public OIGODisabler() { MemoryAnalyzer.AddTrackedMemoryItem(@"Origin in-game overlay disabler panel", new WeakReference(this)); DataContext = this; LoadCommands(); InitializeComponent(); }
public ModArchiveImporter(string file) { MemoryAnalyzer.AddTrackedMemoryItem($@"Mod Archive Importer ({Path.GetFileName(file)})", new WeakReference(this)); DataContext = this; LoadCommands(); ArchiveFilePath = file; InitializeComponent(); }
public ModMakerPanel() { MemoryAnalyzer.AddTrackedMemoryItem(@"ModMaker Panel", new WeakReference(this)); DataContext = this; LoadCommands(); InitializeComponent(); GetTopMods(); }
public GameTarget(Mod.MEGame game, string targetRootPath, bool currentRegistryActive, bool isCustomOption = false) { this.Game = game; this.RegistryActive = currentRegistryActive; this.IsCustomOption = isCustomOption; this.TargetPath = targetRootPath.TrimEnd('\\'); MemoryAnalyzer.AddTrackedMemoryItem($@"{game} GameTarget {TargetPath} - IsCustomOption: {isCustomOption}", new WeakReference(this)); ReloadGameTarget(); }
public InstallationInformation(List <GameTarget> targetsList, GameTarget selectedTarget) { MemoryAnalyzer.AddTrackedMemoryItem(@"Installation Information Panel", new WeakReference(this)); DataContext = this; InstallationTargets.AddRange(targetsList); LoadCommands(); InitializeComponent(); SelectedTarget = selectedTarget; }
public Conditionals() { // Gross, Windows forms! Can't use tracking base MemoryAnalyzer.AddTrackedMemoryItem(new MemoryAnalyzerObjectExtended("Conditionals Editor", new WeakReference(this))); Analytics.TrackEvent("Used tool", new Dictionary <string, string> { { "Toolname", "Conditionals Editor" } }); InitializeComponent(); }
/// <summary> /// This ASI Manager is a feature ported from ME3CMM and maintains synchronization with Mass Effect 3 Mod Manager's code for /// managing and installing ASIs. ASIs are useful for debugging purposes, which is why this feature is now /// part of ME3Explorer. /// /// Please do not change the logic for this code (at least, for Mass Effect 3) as it may break compatibility with Mass /// Effect 3 Mod Manager (e.g. dual same ASIs are installed) and the ME3Tweaks serverside components. /// </summary> public ASIManagerPanel() { MemoryAnalyzer.AddTrackedMemoryItem(@"ASI Manager", new WeakReference(this)); Log.Information(@"Opening ASI Manager"); DataContext = this; Directory.CreateDirectory(CachedASIsFolder); LoadCommands(); InitializeComponent(); }
public IStreamState Create(string name) { var statistics = new StatisticsCollector(); var sendSignal = new AsyncManualResetEvent(false); var bufferPool = CreateBufferPool(); var recordWriter = CreateRecordWriter(name, statistics, sendSignal); var memoryAnalyzer = new MemoryAnalyzer(globalMemoryManager, settings.GcSettings); return(new StreamState(name, bufferPool, memoryAnalyzer, recordWriter, statistics, sendSignal)); }
public ModInstaller(Mod modBeingInstalled, GameTarget gameTarget) { MemoryAnalyzer.AddTrackedMemoryItem(@"Mod Installer", new WeakReference(this)); Log.Information($@"Starting mod installer for mod: {modBeingInstalled.ModName} for game {modBeingInstalled.Game}"); DataContext = this; lastPercentUpdateTime = DateTime.Now; this.ModBeingInstalled = modBeingInstalled; this.gameTarget = gameTarget; Action = M3L.GetString(M3L.string_preparingToInstall); InitializeComponent(); }
public InterpEditor() : base("Interp Editor") { MemoryAnalyzer.AddTrackedMemoryItem(new MemoryAnalyzerObjectExtended("Interp Editor", new WeakReference(this))); LoadCommands(); DataContext = this; StatusText = "Select package file to load"; InitializeComponent(); RecentsController.InitRecentControl(Toolname, Recents_MenuItem, LoadFile); timelineControl.SelectionChanged += TimelineControlOnSelectionChanged; }
// trackTelemetry doesn't use conditional parameter to prevent us from making new windows and then tracking it with telemetry for things like a dialog/ /// <summary> /// Base constructor for tracking windows. Specify track telemetry if this is a tool - if this is not a tool (e.g. a dialog) SET IT TO FALSE to only perform memory tracking. /// </summary> public TrackingNotifyPropertyChangedWindowBase(string trackingName, bool trackTelemetry) { MemoryAnalyzer.AddTrackedMemoryItem(new MemoryAnalyzerObjectExtended($"[TrackingWindow] {trackingName}", new WeakReference(this))); if (trackTelemetry) { #if !DEBUG Analytics.TrackEvent("Opened tool", new Dictionary <string, string> { { "Toolname", trackingName } }); #endif } }
public static MergeMod1 ReadMergeMod(Stream mergeFileStream, string mergeModName, bool loadAssets) { // Version and magic will already be read by main value var manifest = mergeFileStream.ReadUnrealString(); var mm = JsonConvert.DeserializeObject <MergeMod1>(manifest); MemoryAnalyzer.AddTrackedMemoryItem($@"MergeMod1 {mergeModName}", new WeakReference(mm)); mm.MergeModFilename = mergeModName; // setup links foreach (var ff in mm.FilesToMergeInto) { ff.SetupParent(mm); ff.Validate(); } var assetCount = mergeFileStream.ReadInt32(); if (assetCount > 0) { for (int i = 0; i < assetCount; i++) { var assetMag = mergeFileStream.ReadStringASCII(4); if (assetMag != MMV1_ASSETMAGIC) { throw new Exception(M3L.GetString(M3L.string_error_mergefile_badMagic)); } MergeAsset ma = new MergeAsset(); var assetName = mergeFileStream.ReadUnrealString(); ma.FileSize = mergeFileStream.ReadInt32(); if (loadAssets) { // Read now ma.ReadAssetBinary(mergeFileStream); } else { // Will load at install time ma.FileOffset = (int)mergeFileStream.Position; mergeFileStream.Skip(ma.FileSize); } mm.Assets ??= new CaseInsensitiveDictionary <MergeAsset>(); mm.Assets[assetName] = ma; } } return(mm); }
public MixinManager() { MemoryAnalyzer.AddTrackedMemoryItem(@"Mixin Library Panel", new WeakReference(this)); DataContext = this; MixinHandler.LoadME3TweaksPackage(); AvailableOfficialMixins.ReplaceAll(MixinHandler.ME3TweaksPackageMixins.OrderBy(x => x.PatchName)); var backupPath = Utilities.GetGameBackupPath(Mod.MEGame.ME3); if (backupPath != null) { var dlcPath = MEDirectories.DLCPath(backupPath, Mod.MEGame.ME3); var headerTranslation = ModJob.GetHeadersToDLCNamesMap(Mod.MEGame.ME3); foreach (var mixin in AvailableOfficialMixins) { mixin.UIStatusChanging += MixinUIStatusChanging; if (mixin.TargetModule == ModJob.JobHeader.TESTPATCH) { string biogame = MEDirectories.BioGamePath(backupPath); var sfar = Path.Combine(biogame, @"Patches", @"PCConsole", @"Patch_001.sfar"); if (File.Exists(sfar)) { mixin.CanBeUsed = true; } } else if (mixin.TargetModule != ModJob.JobHeader.BASEGAME) { //DLC var resolvedPath = Path.Combine(dlcPath, headerTranslation[mixin.TargetModule]); if (Directory.Exists(resolvedPath)) { mixin.CanBeUsed = true; } } else { //BASEGAME mixin.CanBeUsed = true; } } } else { BottomLeftMessage = M3L.GetString(M3L.string_noGameBackupOfME3IsAvailableMixinsCannotBeUsedWithoutABackup); } ResetMixinsUIState(); LoadCommands(); InitializeComponent(); }
public BatchModQueueEditor(List <Mod> allMods, Window owner = null, BatchLibraryInstallQueue queueToEdit = null) { MemoryAnalyzer.AddTrackedMemoryItem(@"Batch Mod Queue Editor", new WeakReference(this)); Owner = owner; DataContext = this; this.allMods = allMods; LoadCommands(); InitializeComponent(); if (queueToEdit != null) { existingFilename = queueToEdit.BackingFilename; SetGameRadioUI(queueToEdit.Game); SelectedGame = queueToEdit.Game; GroupName = queueToEdit.QueueName; GroupDescription = queueToEdit.QueueDescription; ModsInGroup.ReplaceAll(queueToEdit.ModsToInstall); VisibleFilteredMods.RemoveRange(queueToEdit.ModsToInstall); } }
public static void AttemptResetMemoryManager() { bool isResetting = false; if (MixinMemoryStreamManager == null || (MixinMemoryStreamManager.LargePoolInUseSize == 0 && MixinMemoryStreamManager.SmallPoolInUseSize == 0)) { if (MixinMemoryStreamManager != null) { isResetting = true; } var MB = 1024 * 1024; MixinMemoryStreamManager = new RecyclableMemoryStreamManager(MB * 4, MB * 128, MB * 256); MixinMemoryStreamManager.GenerateCallStacks = true; MixinMemoryStreamManager.AggressiveBufferReturn = true; MemoryAnalyzer.AddTrackedMemoryItem(@"Mixin Memory Stream Manager", new WeakReference(MixinMemoryStreamManager)); } if (isResetting) { GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; GC.Collect(); } }
public PlotVarDB() { MemoryAnalyzer.AddTrackedMemoryItem(new MemoryAnalyzerObjectExtended("Plot Database", new WeakReference(this))); InitializeComponent(); this.plotVarTable.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; }
protected ExportLoaderControl(string memoryTrackerName) { MemoryAnalyzer.AddTrackedMemoryItem(new MemoryAnalyzerObjectExtended($"[EL] {memoryTrackerName}", new WeakReference(this))); }
private static IMEPackage LoadPackage(Stream stream, string filePath = null, bool useSharedCache = false, bool quickLoad = false) { ushort version = 0; ushort licenseVersion = 0; bool fullyCompressed = false; EndianReader er = new EndianReader(stream); if (stream.ReadUInt32() == UnrealPackageFile.packageTagBigEndian) { er.Endian = Endian.Big; } // This is stored as integer by cooker as it is flipped by size word in big endian uint versionLicenseePacked = er.ReadUInt32(); if ((versionLicenseePacked == 0x00020000 || versionLicenseePacked == 0x00010000) && er.Endian == Endian.Little && filePath != null) //can only load fully compressed packages from disk since we won't know what the .us file has { //block size - this is a fully compressed file. we must decompress it //for some reason fully compressed files use a little endian package tag var usfile = filePath + ".us"; if (File.Exists(usfile)) { fullyCompressed = true; } else if (File.Exists(filePath + ".UNCOMPRESSED_SIZE")) { fullyCompressed = true; } } if (!fullyCompressed) { version = (ushort)(versionLicenseePacked & 0xFFFF); licenseVersion = (ushort)(versionLicenseePacked >> 16); } IMEPackage pkg; if (fullyCompressed || (version == MEPackage.ME3UnrealVersion && (licenseVersion == MEPackage.ME3LicenseeVersion || licenseVersion == MEPackage.ME3Xenon2011DemoLicenseeVersion)) || version == MEPackage.ME3WiiUUnrealVersion && licenseVersion == MEPackage.ME3LicenseeVersion || version == MEPackage.ME2UnrealVersion && licenseVersion == MEPackage.ME2LicenseeVersion || //PC and Xbox share this version == MEPackage.ME2PS3UnrealVersion && licenseVersion == MEPackage.ME2PS3LicenseeVersion || version == MEPackage.ME2DemoUnrealVersion && licenseVersion == MEPackage.ME2LicenseeVersion || version == MEPackage.ME1UnrealVersion && licenseVersion == MEPackage.ME1LicenseeVersion || version == MEPackage.ME1PS3UnrealVersion && licenseVersion == MEPackage.ME1PS3LicenseeVersion || version == MEPackage.ME1XboxUnrealVersion && licenseVersion == MEPackage.ME1XboxLicenseeVersion) { stream.Position -= 8; //reset to start pkg = quickLoad ? MEConstructorQuickStreamDelegate(stream, filePath) : MEStreamConstructorDelegate(stream, filePath); MemoryAnalyzer.AddTrackedMemoryItem($"MEPackage {Path.GetFileName(filePath)}", new WeakReference(pkg)); } else if (version == 868 || version == 867 && licenseVersion == 0) { //UDK stream.Position -= 8; //reset to start pkg = UDKStreamConstructorDelegate(stream, filePath); MemoryAnalyzer.AddTrackedMemoryItem($"UDKPackage {Path.GetFileName(filePath)}", new WeakReference(pkg)); } else { throw new FormatException("Not an ME1, ME2, ME3, or UDK (2015) package file."); } if (useSharedCache) { pkg.noLongerUsed += Package_noLongerUsed; } return(pkg); }
/// <summary> /// Builds the installation queues for the mod. Item 1 is the unpacked job mappings (per modjob) along with the list of custom dlc folders being installed. Item 2 is the list of modjobs, their sfar paths, and the list of source files to install for SFAR jobs. /// </summary> /// <param name="gameTarget"></param> /// <returns></returns> public (Dictionary <ModJob, (Dictionary <string, InstallSourceFile> unpackedJobMapping, List <string> dlcFoldersBeingInstalled)>, List <(ModJob job, string sfarPath, Dictionary <string, InstallSourceFile>)>) GetInstallationQueues(GameTarget gameTarget) { if (IsInArchive) { #if DEBUG if (Archive.IsDisposed()) { Debug.WriteLine(@">>> ARCHIVE IS DISPOSED"); } #endif if (File.Exists(ArchivePath) && (Archive == null || Archive.IsDisposed())) { Archive = new SevenZipExtractor(ArchivePath); //load archive file for inspection } else if (Archive != null && Archive.GetBackingStream() is SevenZip.ArchiveEmulationStreamProxy aesp && aesp.Source is MemoryStream ms) { var isExe = ArchivePath.EndsWith(@".exe", StringComparison.InvariantCultureIgnoreCase); Archive = isExe ? new SevenZipExtractor(ms, InArchiveFormat.Nsis) : new SevenZipExtractor(ms); MemoryAnalyzer.AddTrackedMemoryItem($@"Re-opened SVE archive for {ModName}", new WeakReference(Archive)); } } var gameDLCPath = M3Directories.GetDLCPath(gameTarget); var customDLCMapping = Enumerable.FirstOrDefault <ModJob>(InstallationJobs, x => x.Header == ModJob.JobHeader.CUSTOMDLC)?.CustomDLCFolderMapping; if (customDLCMapping != null) { //Make clone so original value is not modified customDLCMapping = new Dictionary <string, string>(customDLCMapping); //prevent altering the source object } var unpackedJobInstallationMapping = new Dictionary <ModJob, (Dictionary <string, InstallSourceFile> mapping, List <string> dlcFoldersBeingInstalled)>(); var sfarInstallationJobs = new List <(ModJob job, string sfarPath, Dictionary <string, InstallSourceFile> installationMapping)>(); foreach (var job in InstallationJobs) { Log.Information($@"Preprocessing installation job: {job.Header}"); var alternateFiles = Enumerable.Where <AlternateFile>(job.AlternateFiles, x => x.IsSelected && x.Operation != AlternateFile.AltFileOperation.OP_NOTHING && x.Operation != AlternateFile.AltFileOperation.OP_NOINSTALL_MULTILISTFILES).ToList(); var alternateDLC = Enumerable.Where <AlternateDLC>(job.AlternateDLCs, x => x.IsSelected).ToList(); if (job.Header == ModJob.JobHeader.CUSTOMDLC) { #region Installation: CustomDLC //Key = destination file, value = source file to install var installationMapping = new Dictionary <string, InstallSourceFile>(); unpackedJobInstallationMapping[job] = (installationMapping, new List <string>()); foreach (var altdlc in alternateDLC) { if (altdlc.Operation == AlternateDLC.AltDLCOperation.OP_ADD_CUSTOMDLC) { customDLCMapping[altdlc.AlternateDLCFolder] = altdlc.DestinationDLCFolder; } } foreach (var mapping in customDLCMapping) { //Mapping is done as DESTINATIONFILE = SOURCEFILE so you can override keys var source = FilesystemInterposer.PathCombine(IsInArchive, ModPath, mapping.Key); var target = Path.Combine(gameDLCPath, mapping.Value); //get list of all normal files we will install var allSourceDirFiles = FilesystemInterposer.DirectoryGetFiles(source, "*", SearchOption.AllDirectories, Archive).Select(x => x.Substring(ModPath.Length).TrimStart('\\')).ToList(); unpackedJobInstallationMapping[job].dlcFoldersBeingInstalled.Add(target); //loop over every file foreach (var sourceFile in allSourceDirFiles) { //Check against alt files bool altApplied = false; foreach (var altFile in alternateFiles) { if (altFile.ModFile.Equals(sourceFile, StringComparison.InvariantCultureIgnoreCase)) { //Alt applies to this file switch (altFile.Operation) { case AlternateFile.AltFileOperation.OP_NOINSTALL: CLog.Information($@"Not installing {sourceFile} for Alternate File {altFile.FriendlyName} due to operation OP_NOINSTALL", Settings.LogModInstallation); //we simply don't map as we just do a continue below. altApplied = true; break; case AlternateFile.AltFileOperation.OP_SUBSTITUTE: CLog.Information($@"Repointing {sourceFile} to {altFile.AltFile} for Alternate File {altFile.FriendlyName} due to operation OP_SUBSTITUTE", Settings.LogModInstallation); if (job.JobDirectory != null && altFile.AltFile.StartsWith((string)job.JobDirectory)) { installationMapping[sourceFile] = new InstallSourceFile(altFile.AltFile.Substring(job.JobDirectory.Length).TrimStart('/', '\\')) { AltApplied = true, IsFullRelativeFilePath = true }; //use alternate file as key instead } else { installationMapping[sourceFile] = new InstallSourceFile(altFile.AltFile) { AltApplied = true, IsFullRelativeFilePath = true }; //use alternate file as key instead } altApplied = true; break; case AlternateFile.AltFileOperation.OP_INSTALL: //same logic as substitute, just different logging. CLog.Information($@"Adding {sourceFile} to install (from {altFile.AltFile}) as part of Alternate File {altFile.FriendlyName} due to operation OP_INSTALL", Settings.LogModInstallation); if (job.JobDirectory != null && altFile.AltFile.StartsWith((string)job.JobDirectory)) { installationMapping[sourceFile] = new InstallSourceFile(altFile.AltFile.Substring(job.JobDirectory.Length).TrimStart('/', '\\')) { AltApplied = true, IsFullRelativeFilePath = true }; //use alternate file as key instead } else { installationMapping[sourceFile] = new InstallSourceFile(altFile.AltFile) { AltApplied = true, IsFullRelativeFilePath = true }; //use alternate file as key instead } altApplied = true; break; } break; } } if (altApplied) { continue; //no further processing for file } var relativeDestStartIndex = sourceFile.IndexOf(mapping.Value); string destPath = sourceFile.Substring(relativeDestStartIndex); installationMapping[destPath] = new InstallSourceFile(sourceFile); //destination is mapped to source file that will replace it. } foreach (var altdlc in alternateDLC) { if (altdlc.Operation == AlternateDLC.AltDLCOperation.OP_ADD_FOLDERFILES_TO_CUSTOMDLC) { string alternatePathRoot = FilesystemInterposer.PathCombine(IsInArchive, ModPath, altdlc.AlternateDLCFolder); var filesToAdd = FilesystemInterposer.DirectoryGetFiles(alternatePathRoot, "*", SearchOption.AllDirectories, Archive).Select(x => x.Substring(ModPath.Length).TrimStart('\\')).ToList(); foreach (var fileToAdd in filesToAdd) { var destFile = Path.Combine(altdlc.DestinationDLCFolder, fileToAdd.Substring(altdlc.AlternateDLCFolder.Length).TrimStart('\\', '/')); CLog.Information($@"Adding extra CustomDLC file ({fileToAdd} => {destFile}) due to Alternate DLC {altdlc.FriendlyName}'s {altdlc.Operation}", Settings.LogModInstallation); installationMapping[destFile] = new InstallSourceFile(fileToAdd) { AltApplied = true }; } } else if (altdlc.Operation == AlternateDLC.AltDLCOperation.OP_ADD_MULTILISTFILES_TO_CUSTOMDLC) { string alternatePathRoot = FilesystemInterposer.PathCombine(IsInArchive, ModPath, altdlc.MultiListRootPath); foreach (var fileToAdd in altdlc.MultiListSourceFiles) { var sourceFile = FilesystemInterposer.PathCombine(IsInArchive, alternatePathRoot, fileToAdd).Substring(ModPath.Length).TrimStart('\\'); var destFile = Path.Combine(altdlc.DestinationDLCFolder, fileToAdd.TrimStart('\\', '/')); CLog.Information($@"Adding extra CustomDLC file (MultiList) ({sourceFile} => {destFile}) due to Alternate DLC {altdlc.FriendlyName}'s {altdlc.Operation}", Settings.LogModInstallation); installationMapping[destFile] = new InstallSourceFile(sourceFile) { AltApplied = true }; } } } // Process altfile removal of multilist, since it should be done last var fileRemoveAltFiles = Enumerable.Where <AlternateFile>(job.AlternateFiles, x => x.IsSelected && x.Operation == AlternateFile.AltFileOperation.OP_NOINSTALL_MULTILISTFILES); foreach (var altFile in fileRemoveAltFiles) { foreach (var multifile in altFile.MultiListSourceFiles) { CLog.Information($@"Attempting to remove multilist file {multifile} from install (from {altFile.MultiListTargetPath}) as part of Alternate File {altFile.FriendlyName} due to operation OP_NOINSTALL_MULTILISTFILES", Settings.LogModInstallation); string relativeSourcePath = altFile.MultiListRootPath + '\\' + multifile; var targetPath = altFile.MultiListTargetPath + '\\' + multifile; if (installationMapping.Remove(targetPath)) { CLog.Information($@" > Removed multilist file {targetPath} from installation", Settings.LogModInstallation); } } } } #endregion } else if (job.Header == ModJob.JobHeader.LOCALIZATION) { #region Installation: LOCALIZATION var installationMapping = new CaseInsensitiveDictionary <InstallSourceFile>(); unpackedJobInstallationMapping[job] = (installationMapping, new List <string>()); buildInstallationQueue(job, installationMapping, false); #endregion } else if (job.Header == ModJob.JobHeader.BASEGAME || job.Header == ModJob.JobHeader.BALANCE_CHANGES || job.Header == ModJob.JobHeader.ME1_CONFIG) { #region Installation: BASEGAME, BALANCE CHANGES, ME1 CONFIG var installationMapping = new CaseInsensitiveDictionary <InstallSourceFile>(); unpackedJobInstallationMapping[job] = (installationMapping, new List <string>()); buildInstallationQueue(job, installationMapping, false); #endregion } else if (Game == MEGame.ME3 && ModJob.ME3SupportedNonCustomDLCJobHeaders.Contains(job.Header)) //previous else if will catch BASEGAME { #region Installation: DLC Unpacked and SFAR (ME3 ONLY) if (M3Directories.IsOfficialDLCInstalled(job.Header, gameTarget)) { string sfarPath = job.Header == ModJob.JobHeader.TESTPATCH ? M3Directories.GetTestPatchSFARPath(gameTarget) : Path.Combine(gameDLCPath, ModJob.GetHeadersToDLCNamesMap(MEGame.ME3)[job.Header], @"CookedPCConsole", @"Default.sfar"); if (File.Exists(sfarPath)) { var installationMapping = new CaseInsensitiveDictionary <InstallSourceFile>(); if (new FileInfo(sfarPath).Length == 32) { //Unpacked unpackedJobInstallationMapping[job] = (installationMapping, new List <string>()); buildInstallationQueue(job, installationMapping, false); } else { //Packed //unpackedJobInstallationMapping[job] = installationMapping; buildInstallationQueue(job, installationMapping, true); sfarInstallationJobs.Add((job, sfarPath, installationMapping)); } } } else { Log.Warning($@"DLC not installed, skipping: {job.Header}"); } #endregion } else if (Game == MEGame.ME2 || Game == MEGame.ME1) { #region Installation: DLC Unpacked (ME1/ME2 ONLY) //Unpacked if (M3Directories.IsOfficialDLCInstalled(job.Header, gameTarget)) { var installationMapping = new CaseInsensitiveDictionary <InstallSourceFile>(); unpackedJobInstallationMapping[job] = (installationMapping, new List <string>()); buildInstallationQueue(job, installationMapping, false); } else { Log.Warning($@"DLC not installed, skipping: {job.Header}"); } #endregion } else { //?? Header throw new Exception(@"Unsupported installation job header! " + job.Header); } } return(unpackedJobInstallationMapping, sfarInstallationJobs); }
public PSAViewer() { MemoryAnalyzer.AddTrackedMemoryItem(new MemoryAnalyzerObjectExtended("PSA Viewer", new WeakReference(this))); InitializeComponent(); }
private static int Main(string[] args) { if (Environment.Is64BitProcess) { Environment.SetEnvironmentVariable("_NT_DEBUGGER_EXTENSION_PATH", @"C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\WINXP;C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\winext;C:\Program Files (x86)\Windows Kits\10\Debuggers\x64;"); } else { Environment.SetEnvironmentVariable("_NT_DEBUGGER_EXTENSION_PATH", @"C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\WINXP;C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\winext;C:\Program Files (x86)\Windows Kits\10\Debuggers\x86;"); } using (context = new DumpContext()) { Console.WriteLine("SuperDump - Windows dump analysis tool"); Console.WriteLine("--------------------------"); //check if symbol path is set if (string.IsNullOrEmpty(SYMBOL_PATH)) { Console.WriteLine("WARNING: Environment variable _NT_SYMBOL_PATH is not set!"); } if (args.Length < 1) { Console.WriteLine("no dump file was specified! Please enter dump path: "); DUMP_LOC = Console.ReadLine(); } else { DUMP_LOC = args[0]; } if (args.Length < 2) { Console.WriteLine("no output file was specified! Please enter output file: "); OUTPUT_LOC = Console.ReadLine(); } else { OUTPUT_LOC = args[1]; } string absoluteDumpFile = Path.GetFullPath(DUMP_LOC); Console.WriteLine(absoluteDumpFile); var logfile = new FileInfo(Path.Combine(Path.GetDirectoryName(OUTPUT_LOC), "superdump.log")); context.Printer = new FilePrinter(logfile.FullName); try { if (File.Exists(absoluteDumpFile)) { LoadDump(absoluteDumpFile); // do this as early as possible, as some WinDbg commands help us get the right DAC files var windbgAnalyzer = new WinDbgAnalyzer(context, Path.Combine(context.DumpDirectory, "windbg.log")); windbgAnalyzer.Analyze(); // start analysis var analysisResult = new SDResult(); analysisResult.IsManagedProcess = context.Target.ClrVersions.Count > 0; if (analysisResult.IsManagedProcess) { SetupCLRRuntime(); } var sysInfo = new SystemAnalyzer(context); analysisResult.SystemContext = sysInfo.systemInfo; var exceptionAnalyzer = new ExceptionAnalyzer(context, analysisResult); context.WriteInfo("--- Thread analysis ---"); ThreadAnalyzer threadAnalyzer = new ThreadAnalyzer(context); analysisResult.ExceptionRecord = threadAnalyzer.exceptions; analysisResult.ThreadInformation = threadAnalyzer.threads; analysisResult.DeadlockInformation = threadAnalyzer.deadlocks; analysisResult.LastExecutedThread = threadAnalyzer.GetLastExecutedThreadOSId(); context.WriteInfo("Last executed thread (engine id): " + threadAnalyzer.GetLastExecutedThreadEngineId().ToString()); var analyzer = new MemoryAnalyzer(context); analysisResult.MemoryInformation = analyzer.memDict; analysisResult.BlockingObjects = analyzer.blockingObjects; // this analyzer runs after all others to put tags onto taggableitems var tagAnalyzer = new TagAnalyzer(analysisResult); tagAnalyzer.Analyze(); //get non loaded symbols List <string> notLoadedSymbols = new List <string>(); foreach (var item in sysInfo.systemInfo.Modules) { if (item.PdbInfo == null || string.IsNullOrEmpty(item.PdbInfo.FileName) || string.IsNullOrEmpty(item.PdbInfo.Guid)) { notLoadedSymbols.Add(item.FileName); } } analysisResult.NotLoadedSymbols = notLoadedSymbols; // print to log sysInfo.PrintArchitecture(); sysInfo.PrintCLRVersions(); sysInfo.PrintAppDomains(); sysInfo.PrintModuleList(); threadAnalyzer.PrintManagedExceptions(); threadAnalyzer.PrintCompleteStackTrace(); analyzer.PrintExceptionsObjects(); // write to json analysisResult.WriteResultToJSONFile(OUTPUT_LOC); context.WriteInfo("--- End of output ---"); Console.WriteLine("done."); } else { throw new FileNotFoundException("File can not be found!"); } } catch (Exception e) { context.WriteError($"Exception happened: {e}"); return(1); } } return(0); }
/// <summary> /// Creates a new cache entry for the given texture. /// </summary> public PreviewTextureEntry(ExportEntry export) { MemoryAnalyzer.AddTrackedMemoryItem($"PreviewTexture {export.ObjectName}", new WeakReference(this)); TextureExport = export; }