예제 #1
0
 private void comboGameModes_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboGameModes.SelectedIndex > 0)
     {
         GoogleAnalyticsApi.TrackEvent("MainForm.cs", "comboGameModes_SelectedIndexChanged", comboGameModes.SelectedItem.ToString());
     }
 }
예제 #2
0
 private void SavePatch()
 {
     GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "SavePatch", txtPatchTitle.Text);
     lblStatusBar.Text = "Saving Patch....";
     MagicPatches.Patch patch = new MagicPatches.Patch
     {
         title              = txtPatchTitle.Text,
         author             = txtPatchAuthor.Text,
         description        = txtPatchDescription.Text,
         pattern            = txtPatternBytesSearch.Text,
         match              = txtPatternMatch.Text,
         offset             = Convert.ToInt32(txtPatternOffset.Text),
         patch              = txtBytesToPatch.Text,
         recursivePatch     = chkPatchReplaceAll.Checked,
         patchOnStartup     = chkRunOnStartup.Checked,
         patchBeforeStartup = chkPatchBeforeStartup.Checked
     };
     if (patches.PatchList.ElementAtOrDefault(listPatches.SelectedIndex) != null)
     {
         patches.PatchList.RemoveAt(listPatches.SelectedIndex);
     }
     patches.PatchList.Add(patch);
     lastSelected = txtPatchTitle.Text;
     WritePatchesToDisk();
 }
예제 #3
0
 private void memoryViewerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "memoryViewerToolStripMenuItem_Click", "");
     if (!MemoryView.FormShowing)
     {
         MemoryView mv = new MemoryView();
         mv.Show();
     }
 }
예제 #4
0
        private void FrostWatcher()
        {
            string FrostLogFile = Application.StartupPath + "/Frost/launcherUpdater.log";

            if (File.Exists(FrostLogFile))
            {
                File.Delete(FrostLogFile);
            }
            while (WeRunningYup)
            {
                try
                {
                    bool LaunchRequest = false;
                    if (File.Exists(FrostLogFile))
                    {
                        var forstProcessess = Process.GetProcesses().Where(pr => pr.ProcessName.Contains("frost"));

                        foreach (var process in forstProcessess)
                        {
                            process.WaitForExit();
                        }
                        string FrostLog = File.ReadAllText(FrostLogFile);
                        File.Delete(FrostLogFile + "-DarkBackup.log");
                        File.Move(FrostLogFile, FrostLogFile + "-DarkBackup.log");

                        if (FrostLog != "")
                        {
                            string launchOptions = FrostLog.Split(new[] { '\r', '\n' }).FirstOrDefault().Split(new[] { "halo_online.exe" }, StringSplitOptions.None)[1];
                            this.Invoke(new MethodInvoker(delegate
                            {
                                txt4gameArguments.Text = launchOptions;
                            }));
                            LaunchRequest = true;
                        }
                    }
                    if (LaunchRequest)
                    {
                        this.Invoke(new MethodInvoker(delegate
                        {
                            splash = new Forms.Splash();
                            splash.Show();
                        }));
                        inLauncherLoop = true;
                        Thread launcherLoop = new Thread(KillFrostLauncherLoop);
                        launcherLoop.Start();
                        GoogleAnalyticsApi.TrackEvent("MainForm.cs", "FrostWatcher", "Started Halo Online from 4game");
                        LaunchHaloOnline();
                        inLauncherLoop = false;
                    }
                }
                catch (Exception e)
                {
                    GoogleAnalyticsApi.TrackEvent("Errors", "FrostWatcher", e.Message);
                }
            }
        }
예제 #5
0
        private void PatchEditor_Load(object sender, EventArgs e)
        {
            LogFile.WriteToLog("------------ Loaded PatchEditor ------------");
            FormShowing = true;
            GoogleAnalyticsApi.TrackPageview("PatchEditor.cs", "PatchEditor_Load", "");
            lblStatusBar.Text = "Loading Patches....";
            Thread loadPatches = new Thread(LoadPatches);

            loadPatches.Start();
        }
예제 #6
0
 private void TestPatchWrite()
 {
     if (listPatternResults.Items.Count > 0)
     {
         MagicPatches.Patch tmpPatch = new MagicPatches.Patch
         {
             title              = txtPatchTitle.Text,
             author             = txtPatchAuthor.Text,
             description        = txtPatchDescription.Text,
             pattern            = txtPatternBytesSearch.Text,
             match              = txtPatternMatch.Text,
             offset             = Convert.ToInt32(txtPatternOffset.Text),
             patch              = txtBytesToPatch.Text,
             recursivePatch     = chkPatchReplaceAll.Checked,
             patchOnStartup     = chkRunOnStartup.Checked,
             patchBeforeStartup = chkPatchBeforeStartup.Checked
         };
         if (tmpPatch.recursivePatch)
         {
             if (MagicPatches.PatchRecursive(tmpPatch))
             {
                 GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "TestPatchWrite", "Patch Successful");
                 MessageBox.Show("Patch Successful");
             }
             else
             {
                 GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "TestPatchWrite", "Patch Failed.");
                 MessageBox.Show("Patch Failed.");
             }
         }
         else
         {
             this.Invoke((MethodInvoker) delegate()
             {
                 if (listPatternResults.SelectedItems.Count > 0)
                 {
                     string item         = listPatternResults.SelectedItems[0].ToString();
                     CurrentPatchAddress = (IntPtr)Convert.ToInt32(item, 16);
                     MagicPatches.PatchSingleAddress(tmpPatch, CurrentPatchAddress);
                 }
                 else
                 {
                     MessageBox.Show("If you're not running a full run, you need to select an address in the patch test results.");
                 }
                 btnPatternScanStop.Enabled = false;
                 btnTestPatchWrite.Enabled  = true;
                 btnTestPatchWrite.Text     = "Test Patch";
             });
         }
     }
     else
     {
         MessageBox.Show("You need to run a pattern scan test before you can test writing.");
     }
 }
예제 #7
0
        private void btnLaunchHaloOnline_Click(object sender, EventArgs e)
        {
            btnLaunchHaloOnline.Enabled = false;
            btnLaunchHaloOnline.Text    = "Launching...";
            GoogleAnalyticsApi.TrackEvent("MainForm.cs", "btnLaunchHaloOnline_Click", "");
            splash = new Forms.Splash();
            splash.Show();
            Thread startHalo = new Thread(LaunchHaloOnline);

            startHalo.Start();
        }
예제 #8
0
        private void btnShowHud_Click(object sender, EventArgs e)
        {
            GoogleAnalyticsApi.TrackEvent("MainForm.cs", "btnShowHud_Click", "");
            btnShowHud.Text    = "Scanning";
            btnShowHud.Enabled = false;

            MagicPatches.RunPatch("Hud Show");

            btnShowHud.Text    = "Show Hud";
            btnShowHud.Enabled = true;
        }
예제 #9
0
        private void downloadLatestPatchesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "downloadLatestPatchesToolStripMenuItem_Click", "");
            DialogResult dialogResult = MessageBox.Show("Are you sure you want to download the latest Patch File? This will overwrite any changes you've made! Please backup your changes before hitting OK.", "Replace Patches?", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                Program.GetLatestPatchJson(true);
                LoadPatches();
            }
        }
예제 #10
0
        public static void LoadMemoryView()
        {
            GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "LoadMemoryView", "");
            byte[] someBytes = new byte[512];

            IntPtr pw = Memory.OpenProcess(0x001F0FFF, true, MainForm.HaloOnline.Id);

            int readAt = (int)PatchEditor.CurrentPatchAddress;

            someBytes = Memory.ReadMemory((int)pw, readAt, 512);
            bv.SetBytes(someBytes);
        }
예제 #11
0
        private void WritePatchesToDisk()
        {
            GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "WritePatchesToDisk", "");
            string jsonPatch = JsonConvert.SerializeObject(patches, Formatting.Indented);

            File.WriteAllText(Program.PatchFile, jsonPatch);
            LoadPatches();                                             //reload patches in tag editor
            Thread loadPatches = new Thread(MagicPatches.LoadPatches); //reload patches in main app

            loadPatches.Start();
            lblStatusBar.Text = "Patches Saved";
        }
예제 #12
0
 private void MemoryView_Load(object sender, EventArgs e)
 {
     LogFile.WriteToLog("------------ Loaded Memory View ------------");
     GoogleAnalyticsApi.TrackPageview("PatchEditor.cs", "MemoryView_Load", "");
     FormShowing = true;
     bv          = new ByteViewer();
     bv.Dock     = DockStyle.Fill;
     Controls.Add(bv);
     if (MainForm.HaloIsRunning)
     {
         LoadMemoryView();
     }
 }
예제 #13
0
 private void btnPatchEditor_click(object sender, EventArgs e)
 {
     GoogleAnalyticsApi.TrackEvent("MainForm.cs", "btnPatchEditor_click", "");
     if (!PatchEditor.FormShowing)
     {
         patchy = new PatchEditor();
         patchy.Show();
     }
     else
     {
         patchy.Focus();
     }
 }
예제 #14
0
        private void btnDeletePatch_Click(object sender, EventArgs e)
        {
            GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "btnDeletePatch_Click", "");
            DialogResult dialogResult = MessageBox.Show("Are you sure you want to remove the patch named \"" + listPatches.SelectedItems[0].ToString() + "\"", "Delete Patch?", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                int index = listPatches.SelectedIndex;
                patches.PatchList.RemoveAt(index);
                listPatches.SelectedIndex = index - 1;
                WritePatchesToDisk();
            }
        }
예제 #15
0
        private void btnDarkLoad_Click(object sender, EventArgs e)
        {
            GoogleAnalyticsApi.TrackEvent("MainForm.cs", "btnDarkLoad_Click", "");
            if (listMapNames.SelectedIndex == -1)
            {
                MessageBox.Show("Please select a map to load on the side list.", "DarkLoader");
                return;
            }
            forceLoading        = true;
            btnDarkLoad.Text    = "Scanning";
            btnDarkLoad.Enabled = false;

            Thread forceLoadMap = new Thread(ForceLoadMap);

            forceLoadMap.Start();
        }
예제 #16
0
 private void btnTestPatchWrite_click(object sender, EventArgs e)
 {
     GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "btnTestPatchWrite_click", "");
     if (MainForm.HaloIsRunning)
     {
         MagicPatches.PatchLoopRun  = true;
         btnPatternScanStop.Enabled = true;
         btnTestPatchWrite.Enabled  = false;
         btnTestPatchWrite.Text     = "Writing...";
         Thread testPatchWrite = new Thread(TestPatchWrite);
         testPatchWrite.Start();
     }
     else
     {
         MessageBox.Show("Halo isn't running, I can't test a patch write!");
     }
 }
예제 #17
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!File.Exists(Application.StartupPath + @"\maps\tags.dat"))
            {
                GoogleAnalyticsApi.TrackEvent("Idiot Check", "User started DarkLoader from the wrong folder", "");
                MessageBox.Show("Please load DarkLoader from your Halo Online Installation Directory.", "Halo.Click - DarkLoader");
                Application.Exit();
            }
            else
            {
                GetVersionJson();
                GetLatestPatchJson();
                Application.Run(new MainForm());
            }
        }
예제 #18
0
 private void btnPatchScanTest_click(object sender, EventArgs e)
 {
     GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "btnPatchScanTest_click", "");
     if (MainForm.HaloIsRunning)
     {
         MagicPatches.PatchLoopRun  = true;
         btnPatternScanStop.Enabled = true;
         btnPatchScanTest.Enabled   = false;
         btnPatchScanTest.Text      = "Scanning...";
         listPatternResults.Items.Clear();
         Thread patchScanTest = new Thread(PatchScanTest);
         patchScanTest.Start();
     }
     else
     {
         MessageBox.Show("Halo isn't running, I can't search for a patch!");
     }
 }
예제 #19
0
 private void listPatternResults_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listPatternResults.SelectedItems.Count > 0)
     {
         string item = listPatternResults.SelectedItems[0].ToString();
         CurrentPatchAddress = (IntPtr)Convert.ToInt32(item, 16);
         GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "listPatternResults_SelectedIndexChanged", item);
     }
     if (!MemoryView.FormShowing)
     {
         MemoryView mv = new MemoryView();
         mv.Show();
     }
     else
     {
         MemoryView.LoadMemoryView();
     }
 }
예제 #20
0
        private void CheckForUpdates()
        {
            GoogleAnalyticsApi.TrackEvent("MainForm.cs", "CheckForUpdates", "");
            var url = "https://raw.githubusercontent.com/dark-c0de/DarkLoader/master/DarkLoader-Versions.json";

            try
            {
                var versionJson = (new WebClient()).DownloadString(url);
                FileVersions.NewFiles = JsonConvert.DeserializeObject <FileVersions.Files>(versionJson);
                FileVersions.OldFiles = JsonConvert.DeserializeObject <FileVersions.Files>(File.ReadAllText("DarkLoader-Versions.json"));
                FileVersions.File file           = FileVersions.FindNewByFilename("DarkLoader.exe");
                Version           newVersion     = Version.Parse(file.version);
                Version           currentVersion = Version.Parse(Application.ProductVersion);
                if (currentVersion < newVersion)
                {
                    this.Invoke(new MethodInvoker(delegate { this.Text = "DarkLoader - Update Available!"; }));

                    DialogResult result1 = MessageBox.Show("There's a new version of DarkLoader available. Would you like to download it?", "Oh goody!", MessageBoxButtons.YesNo);
                    if (result1 == DialogResult.Yes)
                    {
                        Process.Start(file.url);
                    }
                }

                FileVersions.File patchesNew = FileVersions.FindNewByFilename("DarkLoader-Patches.json");
                FileVersions.File patchesOld = FileVersions.FindOldByFilename("DarkLoader-Patches.json");

                if (Convert.ToInt32(patchesNew.version) > Convert.ToInt32(patchesOld.version))
                {
                    DialogResult result1 = MessageBox.Show("There's new patches available for DarkLoader. Would you like to download them?", "Oh goody!", MessageBoxButtons.YesNo);
                    if (result1 == DialogResult.Yes)
                    {
                        DialogResult dialogResult = MessageBox.Show("Are you sure you want to download the latest Patch File? This will overwrite any changes you've made! If you haven't made any, you'll be fine. If you have, please backup your changes before hitting OK.", "Replace Patches?", MessageBoxButtons.YesNo);
                        if (dialogResult == DialogResult.Yes)
                        {
                            Program.GetLatestPatchJson(true);
                        }
                    }
                }
            }
            catch (Exception e) {
                GoogleAnalyticsApi.TrackEvent("Errors", "CheckForUpdates", e.Message);
            }
        }
예제 #21
0
 public static void GetVersionJson(bool force = false)
 {
     GoogleAnalyticsApi.TrackEvent("Program.cs", "GetVersionJson", "");
     //If they don't have a version, let's download the latest from GitHub
     if (!File.Exists("DarkLoader-Versions.json") || force)
     {
         var url = "https://raw.githubusercontent.com/dark-c0de/DarkLoader/master/DarkLoader-Versions.json";
         try
         {
             var versionFile = (new WebClient()).DownloadString(url);
             File.WriteAllText("DarkLoader-Versions.json", versionFile);
         }
         catch (Exception e)
         {
             GoogleAnalyticsApi.TrackEvent("Errors", "GetVersionJson", e.Message);
             MessageBox.Show("There was an error downloading the latest version file. Firewall?\n\n" + e.Message);
         }
     }
 }
예제 #22
0
 private void btnNewPatch_Click(object sender, EventArgs e)
 {
     GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "btnNewPatch_Click", "");
     listPatches.Items.Add("New Patch");
     lastSelected = "New Patch";
     listPatches.SelectedIndex     = listPatches.Items.Count - 1;
     txtPatchTitle.Text            = "New Patch";
     txtPatchAuthor.Text           = "";
     txtPatchDescription.Text      = "";
     txtPatternBytesSearch.Text    = "";
     txtPatternMatch.Text          = "";
     txtPatternOffset.Text         = "0";
     txtBytesToPatch.Text          = "";
     chkPatchReplaceAll.Checked    = false;
     chkRunOnStartup.Checked       = false;
     chkPatchBeforeStartup.Checked = false;
     listPatternResults.Items.Clear();
     SavePatch();
 }
예제 #23
0
        private void PatchScanTest()
        {
            IntPtr PatchReturnAddress;

            byte[] searchBytePattern = HelperFunctions.StringToByteArray(txtPatternBytesSearch.Text);
            string match             = txtPatternMatch.Text;
            int    offset            = Convert.ToInt32(txtPatternOffset.Text);

            PatchReturnAddress = MagicPatches.ScanForPattern(MainForm.HaloOnline, searchBytePattern, match, offset);

            if (PatchReturnAddress == null || PatchReturnAddress.ToInt32() <= 0)
            {
                GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "PatchScanTest", "No results, bad patch?");
                MessageBox.Show("No results, bad patch?");
            }
            else
            {
                GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "PatchScanTest", "Found Results!");
                while (PatchReturnAddress.ToInt32() > 0)
                {
                    this.Invoke((MethodInvoker) delegate()
                    {
                        listPatternResults.Items.Add(PatchReturnAddress.ToString("X"));
                    });
                    IntPtr startOffset = PatchReturnAddress + 0x1;
                    PatchReturnAddress = MagicPatches.ScanForPattern(MainForm.HaloOnline, searchBytePattern, match, offset, startOffset);
                }
            }
            this.Invoke((MethodInvoker) delegate()
            {
                lblPatternResultCount.Text = listPatternResults.Items.Count.ToString() + " Results";
                btnPatchScanTest.Enabled   = true;
                btnPatchScanTest.Text      = "Test Pattern";
                SetProgressBarValue(0, 0, 100);
            });
        }
예제 #24
0
        private void LoadPatches()
        {
            GoogleAnalyticsApi.TrackEvent("PatchEditor.cs", "LoadPatches", "");
            if (!File.Exists(Program.PatchFile))
            {
                File.WriteAllText(Program.PatchFile, "{}");
            }
            string patchList = File.ReadAllText(Program.PatchFile);

            patches           = JsonConvert.DeserializeObject <MagicPatches.Patches>(patchList);
            patches.PatchList = patches.PatchList.OrderBy(patch => patch.title).ToList();
            this.Invoke((MethodInvoker) delegate()
            {
                listPatches.Items.Clear();
                listPatternResults.Items.Clear();
                foreach (var patch in patches.PatchList)
                {
                    listPatches.Items.Add(patch.title);
                }
                lblStatusBar.Text         = "Loaded Patches";
                int patchLocation         = patches.PatchList.FindIndex(patch => patch.title == lastSelected);
                listPatches.SelectedIndex = patchLocation;
            });
        }
예제 #25
0
 private void btn4gamePlay_Click(object sender, EventArgs e)
 {
     GoogleAnalyticsApi.TrackEvent("MainForm.cs", "btn4gamePlay_Click", "");
     MessageBox.Show("Login to 4game and hit Play like you would normally load Halo Online. DarkLoader will catch it and DarkLoad so you can play online.");
     Process.Start("https://ru.4game.com/halo/play/");
 }
예제 #26
0
 private void btnIssues_Click(object sender, EventArgs e)
 {
     GoogleAnalyticsApi.TrackEvent("MainForm.cs", "btnIssues_Click", "");
     Process.Start("https://github.com/dark-c0de/DarkLoader/issues", "");
 }
예제 #27
0
        private void LaunchHaloOnline()
        {
            var darkLoadedProcesses = Process.GetProcesses().Where(pr => pr.ProcessName.Contains("darkloaded"));

            foreach (var process in darkLoadedProcesses)
            {
                process.Kill();
                process.WaitForExit();
            }
            if (!HaloIsRunning)
            {
                try
                {
                    byte[] HaloExeBytes = File.ReadAllBytes(Application.StartupPath + @"\" + HaloOnlineEXE + ".exe");

                    string tmpExe     = Path.Combine(Application.StartupPath, "darkloaded.exe");
                    string gameShield = Path.Combine(Application.StartupPath, "gameShieldDll.dll");

                    MagicPatches.ExePatches(HaloExeBytes);

                    File.WriteAllBytes(tmpExe, HaloExeBytes);
                    Thread.Sleep(100);
                    if (File.Exists(gameShield))
                    {
                        if (File.Exists(gameShield + ".nope"))
                        {
                            File.Delete(gameShield + ".nope");
                        }
                        File.Move(gameShield, gameShield + ".nope");
                    }
                    HaloOnline = new System.Diagnostics.Process();
                    HaloOnline.StartInfo.FileName         = tmpExe;
                    HaloOnline.StartInfo.WorkingDirectory = Application.StartupPath;
                    HaloOnline.StartInfo.Arguments        = txtHaloLaunchArguments.Text + " " + txt4gameArguments.Text + " -launcher";

                    HaloOnline.Start();

                    Thread.Sleep(3000);
                    Memory.SuspendProcess(HaloOnline.Id);
                    MagicPatches.RunStartupPatches();
                    Memory.ResumeProcess(HaloOnline.Id);
                    this.Invoke(new MethodInvoker(delegate
                    {
                        splash.Hide();
                    }));
                }
                catch (Exception e)
                {
                    this.Invoke(new MethodInvoker(delegate
                    {
                        splash.Hide();
                    }));
                    GoogleAnalyticsApi.TrackEvent("MainForm.cs", "LaunchHaloOnline", e.Message);
                    MessageBox.Show("Failed to start Halo Online!\n\n" + e.Message, "Something bad happened.");
                }
            }
            else
            {
                this.Invoke(new MethodInvoker(delegate
                {
                    splash.Hide();
                }));
                GoogleAnalyticsApi.TrackEvent("MainForm.cs", "LaunchHaloOnline", "Halo Already Running");
                MessageBox.Show("Halo Online is already running!", "DarkLoader uh...");
            }
            this.Invoke(new MethodInvoker(delegate
            {
                btnLaunchHaloOnline.Enabled = true;
                btnLaunchHaloOnline.Text    = "Launch Halo Online";
            }));
        }
예제 #28
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     GoogleAnalyticsApi.TrackEvent("MainForm.cs", "MainForm_FormClosing", "");
     WeRunningYup = false;
 }
예제 #29
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            LogFile.WriteToLog("------------- Started DarkLoader -------------");
            GoogleAnalyticsApi.TrackPageview("MainForm.cs", "MainForm_Load", "");

            txtHaloLaunchArguments.Text = Properties.Settings.Default.HOLaunchArguments;
            Thread loadPatches = new Thread(MagicPatches.LoadPatches);

            loadPatches.Start();
            WeRunningYup = true;

            //Set Default Game Mode combo boxes to
            comboGameModes.SelectedIndex = 2;
            comboGameTypes.SelectedIndex = 0;

            //Are we running the new halo_online.exe build? If so, set the exe name accordingly.
            if (File.Exists(Application.StartupPath + @"\halo_online.exe"))
            {
                HaloOnlineEXE = "halo_online";
            }

            //Let's load the maps up and pull out their info
            string        HaloMapDir = Application.StartupPath + @"\maps\";
            DirectoryInfo d          = new DirectoryInfo(HaloMapDir);

            foreach (var file in d.GetFiles("*.map"))
            {
                byte[] MapHeader    = new byte[756];
                byte[] BuildVersion = new byte[32]; //0.4.1.327043 cert_MS26_new
                byte[] MapName      = new byte[36];
                byte[] MapTagDir    = new byte[256];
                using (BinaryReader reader = new BinaryReader(new FileStream(HaloMapDir + file.Name, FileMode.Open, FileAccess.Read)))
                {
                    reader.BaseStream.Seek(0, SeekOrigin.Begin);
                    reader.Read(MapHeader, 0, 756);

                    int MapTagDirOffset = HelperFunctions.SearchBytes(MapHeader, Encoding.ASCII.GetBytes("level"));

                    reader.BaseStream.Seek(284, SeekOrigin.Begin);
                    reader.Read(BuildVersion, 0, 32);
                    reader.BaseStream.Seek(MapTagDirOffset - 36, SeekOrigin.Begin);
                    reader.Read(MapName, 0, 36);
                    reader.BaseStream.Seek(MapTagDirOffset, SeekOrigin.Begin);
                    reader.Read(MapTagDir, 0, 256);
                }
                listMapNames.Items.Add(System.Text.Encoding.UTF8.GetString(MapName).Replace("\0", ""));
                listMapInfo.Items.Add(System.Text.Encoding.UTF8.GetString(BuildVersion).Replace("\0", "") + " " + System.Text.Encoding.UTF8.GetString(MapTagDir).Replace("\0", ""));
            }

            //Let's keep an eye out for Halo starting and stopping.
            Thread haloWatcher = new Thread(IsHaloRunning);

            haloWatcher.Start();

            //Let's keep an eye out for frost so we can kill it and hijack the session tokens
            Thread frostWatcher = new Thread(FrostWatcher);

            frostWatcher.Start();

            //Let's make sure people are running the greatest latest turd available
            if (!Program.IsDebug)
            {
                Thread checkUpdates = new Thread(CheckForUpdates);
                checkUpdates.Start();
            }
        }
예제 #30
0
        private void ForceLoadMap()
        {
            //Do Magic
            try
            {
                IntPtr p = Memory.OpenProcess(0x001F0FFF, true, HaloOnline.Id);

                if (pAddr == null || pAddr.ToInt32() == 0)
                {
                    pAddr = MagicPatches.ScanForPattern(HaloOnline, new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6D, 0x61, 0x70, 0x73, 0x5C, 0x6D, 0x61, 0x69, 0x6E, 0x6D, 0x65, 0x6E, 0x75 }, "xxxxxxxxxxxxxxxxxxxxx", 0);

                    if (pAddr == null || pAddr.ToInt32() <= 0)
                    {
                        MessageBox.Show("DarkLoader failed to find the map loading code...\nThis could mean two things:\n\n1. You tried loading a map already and closed + opened HaloLoader on the same EXE (You have to keep it running!)\n2. This version of Halo Online is not supported.");
                        return;
                    }
                    //pAddr = 4BB300C
                    PtrMapName  = pAddr + 0xD;         //0x4BB3019
                    PtrMapReset = pAddr - 0x2C;        //0x4BB2FE0
                    PtrMapTime  = pAddr + 0x435;       //0x4BB3441
                    PtrMapType  = pAddr - 0x1C;        //0x4BB2FF0
                    PtrGameType = PtrMapReset + 0x33C; //0x4BB331C
                }
                //Pattern Scan Finds (4BB300C)
                //Map Title = Mainmenu (04BB3019)

                int lpNumberOfBytesWritten = 0;


                //Patch Multiplayer Loading

                /*
                 *   eldorado.Scaleform::Event::TryAcquireCancel+155147 - 8B CE                 - mov ecx,esi
                 *   eldorado.Scaleform::Event::TryAcquireCancel+155149 - 66 89 43 02           - mov [ebx+02],ax
                 *   eldorado.Scaleform::Event::TryAcquireCancel+15514D - E8 9E150000           - call eldorado.Scaleform::Event::TryAcquireCancel+1566F0
                 *   eldorado.Scaleform::Event::TryAcquireCancel+155152 - 8B 47 10              - mov eax,[edi+10]
                 *
                 * */

                if (MpPatchAddr == null || MpPatchAddr.ToInt32() <= 0)
                {
                    //New builds of Halo Online

                    MpPatchAddr = MagicPatches.ScanForPattern(HaloOnline, new byte[] { 0x8B, 0xCE, 0x66, 0x89, 0x43, 0x02, 0xE8, 0x9E, 0x15, 0x00, 0x00, 0x8B, 0x47, 0x10 }, "xxxxx??????xxx", 7);

                    if (MpPatchAddr == null || MpPatchAddr.ToInt32() <= 0)
                    {
                        //Original Halo Online - Eldewrito!
                        MpPatchAddr = MagicPatches.ScanForPattern(HaloOnline, new byte[] { 0x17, 0x56, 0x66, 0x89, 0x47, 0x02, 0xE8, 0x4C, 0xFB, 0xFF, 0xFF, 0x57, 0x53, 0x56 }, "xxxxx??????xxx", 7);
                    }

                    PtrMpPatch = MpPatchAddr - 0x1;
                }

                //Pointer finds 0xF605FE - actual is 0xF605FD

                if (PtrMpPatch.ToInt32() <= 0)
                {
                    GoogleAnalyticsApi.TrackEvent("MainForm.cs", "ForceLoadMap", "Failed to find PtrMpPatch!");
                    MessageBox.Show("Failed to find pointer... Go file a bug report.");
                    return;
                }
                this.btnDarkLoad.Invoke(new MethodInvoker(delegate { btnDarkLoad.Text = "Patching"; }));
                byte[] nop = { 0x90, 0x90, 0x90, 0x90, 0x90 };
                Memory.WriteProcessMemory(p, PtrMpPatch, nop, 5, out lpNumberOfBytesWritten);

                byte[] mapReset = { 0x1 };
                // sets map type
                byte[] mapType = { 0, 0, 0, 0 };
                // sets gametype
                byte[] gameType = { 0, 0, 0, 0 };
                // Infinite play time
                byte[] mapTime = { 0x0 };
                // Grab map name from selected listbox
                byte[] mapName = new byte[36];
                this.comboGameModes.Invoke(new MethodInvoker(delegate
                {
                    BitConverter.GetBytes(Convert.ToInt32(comboGameModes.SelectedIndex)).CopyTo(mapType, 0);
                    BitConverter.GetBytes(Convert.ToInt32(comboGameTypes.SelectedIndex)).CopyTo(gameType, 0);
                    Encoding.ASCII.GetBytes(listMapNames.SelectedItem.ToString()).CopyTo(mapName, 0);
                }));
                Memory.WriteProcessMemory(p, PtrGameType, gameType, 4, out lpNumberOfBytesWritten);
                Memory.WriteProcessMemory(p, PtrMapType, mapType, 4, out lpNumberOfBytesWritten);
                Memory.WriteProcessMemory(p, PtrMapName, mapName, mapName.Length, out lpNumberOfBytesWritten);
                Memory.WriteProcessMemory(p, PtrMapTime, mapTime, 1, out lpNumberOfBytesWritten);
                Memory.WriteProcessMemory(p, PtrMapReset, mapReset, 1, out lpNumberOfBytesWritten);
            }
            catch (Exception ex)
            {
                GoogleAnalyticsApi.TrackEvent("MainForm.cs", "ForceLoadMap", ex.Message);
                MessageBox.Show("Something went wrong...\n" + ex.Message, "DarkLoader Error");
            }
            this.btnDarkLoad.Invoke(new MethodInvoker(delegate
            {
                btnDarkLoad.Text    = "DarkLoad";
                btnDarkLoad.Enabled = true;
            }));
            forceLoading = false;
        }