Пример #1
0
        public static void OpenFileInME3(IMEPackage pcc, bool canHotLoad = false, bool shouldPad = true)
        {
            var    tempMapName  = GameController.TempMapName;
            string tempDir      = ME3Directory.CookedPCPath;
            string tempFilePath = Path.Combine(tempDir, $"{tempMapName}.pcc");

            pcc.Save(tempFilePath);
            if (shouldPad)
            {
                if (!InteropHelper.TryPadFile(tempFilePath))
                {
                    //if file was too big to pad, hotloading is impossible
                    canHotLoad = false;
                }
            }

            if (GameController.TryGetME3Process(out Process me3Process) && canHotLoad)
            {
                IntPtr handle = me3Process.MainWindowHandle;
                GameController.ExecuteConsoleCommands(handle, MEGame.ME3, $"at {tempMapName}");
                return;
            }

            me3Process?.Kill();
            int resX = 1000;
            int resY = 800;
            int posX = (int)(SystemParameters.PrimaryScreenWidth - (resX + 100));
            int posY = (int)(SystemParameters.PrimaryScreenHeight - resX) / 2;

            AutoTOCWPF.GenerateAllTOCs();
            Process.Start(ME3Directory.ExecutablePath, $"{tempMapName} -nostartupmovies -Windowed ResX={resX} ResY={resY} WindowPosX={posX} WindowPosY={posY}");
        }
Пример #2
0
        public static void InstallDLC_MOD_Interop()
        {
            if (Directory.Exists(ModInstallPath))
            {
                FileSystemHelper.DeleteFilesAndFoldersRecursively(ModInstallPath);
            }
            Dictionary <string, string> fileMap = MELoadedFiles.GetFilesLoadedInGame(MEGame.ME3, true);

            string sourcePath = Path.Combine(App.ExecFolder, modName);

            FileSystem.CopyDirectory(sourcePath, ModInstallPath);
            PadCamPathFile();

            InteropHelper.InstallInteropASI();
            string consoleExtASIWritePath = Path.Combine(ME3Directory.ExecutableFolder, "asi", consoleExtASIName);

            if (File.Exists(consoleExtASIWritePath))
            {
                File.Delete(consoleExtASIWritePath);
            }
            File.Copy(Path.Combine(App.ExecFolder, consoleExtASIName), consoleExtASIWritePath);

            const string bioPGlobalFileName   = "BioP_Global.pcc";
            const string bioPGlobalNCFileName = "BioP_Global_NC.pcc";
            var          sourceFiles          = new List <(string filePath, string md5)>
            {
                AugmentAndInstall(bioPGlobalFileName),
                AugmentAndInstall(bioPGlobalNCFileName)
            };

            File.WriteAllText(InstallInfoPath, JsonConvert.SerializeObject(new InstallInfo
            {
                InstallTime = DateTime.Now,
                Version     = CURRENT_VERSION,
                SourceFiles = sourceFiles
            }));
            AutoTOCWPF.GenerateAllTOCs();

            (string, string) AugmentAndInstall(string fileName)
            {
                string existingFile = fileMap[fileName];

                using (IMEPackage pcc = MEPackageHandler.OpenMEPackage(existingFile))
                {
                    AugmentMapToLoadLiveEditor(pcc);
                    pcc.Save(Path.Combine(ModInstallPath, "CookedPCConsole", fileName));
                }
                return(existingFile, InteropHelper.CalculateMD5(existingFile));
            }
        }