예제 #1
0
 private void StubForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!UnityWatch.CloseTarget(false))
     {
         e.Cancel = true;
     }
 }
예제 #2
0
        private void BtnTargetSettings_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                Control c      = (Control)sender;
                Point   locate = new Point(c.Location.X + e.Location.X, ((Control)sender).Location.Y + e.Location.Y);

                ContextMenuStrip columnsMenu = new ContextMenuStrip();


                ((ToolStripMenuItem)columnsMenu.Items.Add("Big endian", null, new EventHandler((ob, ev) => {
                    UnityWatch.currentFileInfo.bigEndian = !UnityStub.UnityWatch.currentFileInfo.bigEndian;

                    if (VanguardCore.vanguardConnected)
                    {
                        UnityWatch.UpdateDomains();
                    }
                }))).Checked = UnityWatch.currentFileInfo.bigEndian;

                ((ToolStripMenuItem)columnsMenu.Items.Add("Auto-Uncorrupt", null, new EventHandler((ob, ev) => {
                    UnityWatch.currentFileInfo.autoUncorrupt = !UnityWatch.currentFileInfo.autoUncorrupt;
                }))).Checked = UnityWatch.currentFileInfo.autoUncorrupt;

                ((ToolStripMenuItem)columnsMenu.Items.Add("Use Caching + Multithreading", null, new EventHandler((ob, ev) => {
                    UnityWatch.currentFileInfo.useCacheAndMultithread = !UnityWatch.currentFileInfo.useCacheAndMultithread;
                }))).Checked = UnityWatch.currentFileInfo.useCacheAndMultithread;

                columnsMenu.Show(this, locate);
            }
        }
예제 #3
0
        private void StubForm_Load(object sender, EventArgs e)
        {
            cbTargetType.SelectedIndex = 0;

            Colors.SetRTCColor(Color.Aquamarine, this);

            UnityWatch.Start();
        }
예제 #4
0
 private void BtnReleaseTarget_Click(object sender, EventArgs e)
 {
     if (!UnityWatch.CloseTarget())
     {
         return;
     }
     DisableInterface();
 }
예제 #5
0
        private void BtnBrowseTarget_Click(object sender, EventArgs e)
        {
            if (!UnityWatch.LoadTarget())
            {
                return;
            }

            if (!VanguardCore.vanguardConnected)
            {
                VanguardCore.Start();
            }

            EnableInterface();
        }
예제 #6
0
        internal static bool CloseTarget(bool updateDomains = true)
        {
            if (UnityWatch.currentFileInfo.targetInterface != null)
            {
                UnityWatch.KillProcess();
                if (!UnityWatch.RestoreTarget())
                {
                    MessageBox.Show("Unable to restore the backup. Aborting!");
                    return(false);
                }

                UnityWatch.currentFileInfo.targetInterface.CloseStream();
                UnityWatch.currentFileInfo.targetInterface = null;
            }

            if (updateDomains)
            {
                UpdateDomains();
            }
            return(true);
        }
예제 #7
0
        public void EnableInterface()
        {
            var diff = lbTarget.Location.X - btnBrowseTarget.Location.X;

            originalLbTargetLocation = lbTarget.Location;
            lbTarget.Location        = btnBrowseTarget.Location;
            lbTarget.Visible         = true;

            btnTargetSettings.Visible = false;

            btnBrowseTarget.Visible = false;
            originalLbTargetSize    = lbTarget.Size;
            lbTarget.Size           = new Size(lbTarget.Size.Width + diff, lbTarget.Size.Height);
            btnUnloadTarget.Visible = true;
            cbTargetType.Enabled    = false;

            //lbTargetExecution.Enabled = true;
            //pnTargetExecution.Enabled = true;

            UnityWatch.EnableInterface();

            lbTarget.Text       = UnityWatch.currentFileInfo.selectedTargetType.ToString() + " target loaded";
            lbTargetStatus.Text = UnityWatch.currentFileInfo.selectedTargetType.ToString() + " target loaded";
        }
예제 #8
0
 private void BtnRestoreBackup_Click(object sender, EventArgs e)
 {
     UnityWatch.KillProcess();
     UnityWatch.currentFileInfo.targetInterface?.CloseStream();
     UnityWatch.currentFileInfo.targetInterface?.RestoreBackup();
 }
예제 #9
0
        internal static bool LoadTarget()
        {
            FileInterface.identity = FileInterfaceIdentity.HASHED_PREFIX;

            string filename = null;

            OpenFileDialog OpenFileDialog1;

            OpenFileDialog1 = new OpenFileDialog();

            OpenFileDialog1.Title            = "Select the Game Executable";
            OpenFileDialog1.Filter           = "Executable Files|*.exe";
            OpenFileDialog1.RestoreDirectory = true;
            if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if (OpenFileDialog1.FileName.ToString().Contains('^'))
                {
                    MessageBox.Show("You can't use a file that contains the character ^ ");
                    return(false);
                }

                filename = OpenFileDialog1.FileName;
            }
            else
            {
                return(false);
            }

            if (!CloseTarget(false))
            {
                return(false);
            }

            FileInfo unityExeFile = new FileInfo(filename);

            UnityWatch.currentFileInfo.targetShortName = unityExeFile.Name;
            UnityWatch.currentFileInfo.targetFullName  = unityExeFile.FullName;

            DirectoryInfo unityFolder = unityExeFile.Directory;

            var allFiles = DirSearch(unityFolder.FullName).ToArray();

            if (allFiles.FirstOrDefault(it => it.ToUpper().Contains("UNITY")) == null)
            {
                MessageBox.Show("Could not find unity files");
                return(false);
            }

            var allDllFiles      = allFiles.Where(it => it.ToUpper().EndsWith(".DLL")).ToArray();
            var allUnityDllFiles = allDllFiles.Where(it => it.ToUpper().Contains("UNITY")).ToArray();
            var unityEngineDll   = allDllFiles.Where(it => it.ToUpper().Contains("UNITYENGINE.DLL")).ToArray();


            List <string> targetFiles = new List <string>();

            switch (UnityWatch.currentFileInfo.selectedTargetType)
            {
            case TargetType.UNITYEXE:
                targetFiles.Add(unityExeFile.FullName);
                break;

            case TargetType.UNITYEXE_ALLDLL:
                targetFiles.Add(unityExeFile.FullName);
                targetFiles.AddRange(allDllFiles);
                break;

            case TargetType.UNITYEXE_UNITYDLL:
                targetFiles.Add(unityExeFile.FullName);
                targetFiles.AddRange(allUnityDllFiles);
                break;

            case TargetType.UNITYEXE_KNOWNDLL:
                targetFiles.Add(unityExeFile.FullName);

                var allKnownGames = allDllFiles.Where(it =>
                                                      it.ToUpper().Contains("PHYSICS") ||
                                                      it.ToUpper().Contains("CLOTH") ||
                                                      it.ToUpper().Contains("ANIMATION") ||
                                                      it.ToUpper().Contains("PARTICLE") ||
                                                      it.ToUpper().Contains("TERRAIN") ||
                                                      it.ToUpper().Contains("VEHICLES") ||
                                                      it.ToUpper().Contains("UNITYENGINE.DLL")
                                                      ).ToArray();

                targetFiles.AddRange(allKnownGames);

                break;

            case TargetType.ALLTHEGAME:
                targetFiles.AddRange(allFiles);
                break;

            case TargetType.UNITYENGINE:
                targetFiles.AddRange(unityEngineDll);
                break;
            }

            string multipleFiles = "";

            for (int i = 0; i < targetFiles.Count; i++)
            {
                multipleFiles += targetFiles[i];

                if (i < targetFiles.Count - 1)
                {
                    multipleFiles += "|";
                }
            }

            var mfi = new MultipleFileInterface(multipleFiles, UnityWatch.currentFileInfo.bigEndian, UnityWatch.currentFileInfo.useAutomaticBackups);

            if (UnityWatch.currentFileInfo.useCacheAndMultithread)
            {
                mfi.getMemoryDump();
            }

            UnityWatch.currentFileInfo.targetInterface = mfi;

            Executor.unityExeFile = unityExeFile.FullName;

            StockpileManagerEmuSide.UnCorruptBL = null;

            if (VanguardCore.vanguardConnected)
            {
                UnityWatch.UpdateDomains();
            }

            return(true);
        }