Advertisement
IAmXeClutch

[Project] Halo Online Launcher

Mar 29th, 2015
1,314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.64 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Diagnostics;
  6. using System.Drawing;
  7. using System.Globalization;
  8. using System.IO;
  9. using System.Linq;
  10. using System.Runtime.InteropServices;
  11. using System.Text;
  12. using System.Threading;
  13. using System.Threading.Tasks;
  14. using System.Windows.Forms;
  15.  
  16. namespace Halo_Online_Launcher
  17. {
  18.     public partial class Form1 : Form
  19.     {
  20.         // Kernel Imports
  21.         [DllImport("kernel32.dll")]
  22.         static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out] byte[] lpBuffer, int dwSize, out int lpNumberOfBytesRead);
  23.         [DllImport("kernel32.dll")]
  24.         static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, int nSize, out int lpNumberOfBytesWritten);
  25.         [DllImport("kernel32.dll")]
  26.         static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
  27.         [DllImport("kernel32.dll")]
  28.         [return: MarshalAs(UnmanagedType.Bool)]
  29.         static extern bool CloseHandle(IntPtr hObject);
  30.  
  31.         public Form1()
  32.         {
  33.             // Draw form
  34.             InitializeComponent();
  35.  
  36.             // Load settings
  37.             string[] lines = File.ReadAllLines("settings.hol");
  38.             dir_val.Text = lines[0].Replace("dir=", "");
  39.             acc_email.Text = lines[1].Replace("email=", "");
  40.             acc_pass.Text = lines[2].Replace("password=", "");
  41.         }
  42.  
  43.         private void dir_set_Click(object sender, EventArgs e)
  44.         {
  45.             FolderBrowserDialog fbd = new FolderBrowserDialog();
  46.             fbd.Description = "Select your Halo Online installation folder.";
  47.             if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  48.                 dir_val.Text = fbd.SelectedPath;
  49.         }
  50.  
  51.         private void launch_Click(object sender, EventArgs e)
  52.         {
  53.             // Save settings
  54.             File.WriteAllText("settings.hol", "dir=" + dir_val.Text + Environment.NewLine + "email=" + acc_email.Text + Environment.NewLine + "password=" + acc_pass.Text);
  55.  
  56.             // Check for files
  57.             if (!File.Exists(dir_val.Text + "\\eldorado.exe"))
  58.                 if (MessageBox.Show("You're missing \"eldorado.exe\", would you like to download the english version now?", "Missing File", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
  59.                     Process.Start("https://mega.co.nz/#!LcdAhSQK!6XVCyyTBusTQU3CUHDdofXFgIvbyqXHnYy_5fsFv5AM");
  60.             if (!File.Exists(dir_val.Text + "\\HaloFreeLoader.exe"))
  61.                 if (MessageBox.Show("You're missing \"HaloFreeLoader.exe\", would you like to download it now?", "Missing File", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
  62.                     Process.Start("https://github.com/emoose/HaloFreeLoader/releases");
  63.  
  64.             // Launch Halo Online
  65.             ProcessStartInfo psi_e = new ProcessStartInfo();
  66.             psi_e.FileName = "eldorado.exe";
  67.             psi_e.WorkingDirectory = dir_val.Text;
  68.             psi_e.Arguments = "--account " + acc_email.Text + " --sign-in-code " + acc_pass.Text;
  69.             Process.Start(psi_e);
  70.            
  71.             // Forceload map
  72.             Thread.Sleep(5000);
  73.             string str = "";
  74.             if (map.Text == "")
  75.                 str = "mainmenu";
  76.             else if (map.Text == "Guardian" || map.Text == "Riverworld")
  77.                 str = map.Text.ToLower();
  78.             else
  79.                 str = "s3d_" + map.Text.ToLower();
  80.             Process[] processes = Process.GetProcessesByName("eldorado");
  81.             while (processes.Length < 1)
  82.                 processes = Process.GetProcessesByName("eldorado");
  83.             IntPtr handle = OpenProcess(0x001F0FFF, true, processes[0].Id);
  84.             int buffer = 0;
  85.             WriteProcessMemory(handle, (IntPtr)0x5056D0, new byte[] { 0xC3 }, 1, out buffer);
  86.             WriteProcessMemory(handle, (IntPtr)0x6D26DF, new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90 }, 5, out buffer);
  87.             while (true)
  88.             {
  89.                 byte[] wait = new byte[1];
  90.                 ReadProcessMemory(handle, (IntPtr)0x23917F0, wait, 1, out buffer);
  91.                 if (wait[0] == 0)
  92.                     break;
  93.             }
  94.             byte[] pbMap = Encoding.ASCII.GetBytes("maps\\" + str);
  95.             WriteProcessMemory(handle, (IntPtr)0x23917F0, new byte[] { 1 }, 1, out buffer);
  96.             WriteProcessMemory(handle, (IntPtr)0x2391800, new byte[] { 2, 0, 0, 0 }, 4, out buffer);
  97.             WriteProcessMemory(handle, (IntPtr)0x2391824, pbMap, pbMap.Length, out buffer);
  98.         }
  99.     }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement