Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Diagnostics;
- using System.Drawing;
- using System.Globalization;
- using System.IO;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Halo_Online_Launcher
- {
- public partial class Form1 : Form
- {
- // Kernel Imports
- [DllImport("kernel32.dll")]
- static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [Out] byte[] lpBuffer, int dwSize, out int lpNumberOfBytesRead);
- [DllImport("kernel32.dll")]
- static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, int nSize, out int lpNumberOfBytesWritten);
- [DllImport("kernel32.dll")]
- static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
- [DllImport("kernel32.dll")]
- [return: MarshalAs(UnmanagedType.Bool)]
- static extern bool CloseHandle(IntPtr hObject);
- public Form1()
- {
- // Draw form
- InitializeComponent();
- // Load settings
- string[] lines = File.ReadAllLines("settings.hol");
- dir_val.Text = lines[0].Replace("dir=", "");
- acc_email.Text = lines[1].Replace("email=", "");
- acc_pass.Text = lines[2].Replace("password=", "");
- }
- private void dir_set_Click(object sender, EventArgs e)
- {
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- fbd.Description = "Select your Halo Online installation folder.";
- if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- dir_val.Text = fbd.SelectedPath;
- }
- private void launch_Click(object sender, EventArgs e)
- {
- // Save settings
- File.WriteAllText("settings.hol", "dir=" + dir_val.Text + Environment.NewLine + "email=" + acc_email.Text + Environment.NewLine + "password=" + acc_pass.Text);
- // Check for files
- if (!File.Exists(dir_val.Text + "\\eldorado.exe"))
- 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)
- Process.Start("https://mega.co.nz/#!LcdAhSQK!6XVCyyTBusTQU3CUHDdofXFgIvbyqXHnYy_5fsFv5AM");
- if (!File.Exists(dir_val.Text + "\\HaloFreeLoader.exe"))
- if (MessageBox.Show("You're missing \"HaloFreeLoader.exe\", would you like to download it now?", "Missing File", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
- Process.Start("https://github.com/emoose/HaloFreeLoader/releases");
- // Launch Halo Online
- ProcessStartInfo psi_e = new ProcessStartInfo();
- psi_e.FileName = "eldorado.exe";
- psi_e.WorkingDirectory = dir_val.Text;
- psi_e.Arguments = "--account " + acc_email.Text + " --sign-in-code " + acc_pass.Text;
- Process.Start(psi_e);
- // Forceload map
- Thread.Sleep(5000);
- string str = "";
- if (map.Text == "")
- str = "mainmenu";
- else if (map.Text == "Guardian" || map.Text == "Riverworld")
- str = map.Text.ToLower();
- else
- str = "s3d_" + map.Text.ToLower();
- Process[] processes = Process.GetProcessesByName("eldorado");
- while (processes.Length < 1)
- processes = Process.GetProcessesByName("eldorado");
- IntPtr handle = OpenProcess(0x001F0FFF, true, processes[0].Id);
- int buffer = 0;
- WriteProcessMemory(handle, (IntPtr)0x5056D0, new byte[] { 0xC3 }, 1, out buffer);
- WriteProcessMemory(handle, (IntPtr)0x6D26DF, new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90 }, 5, out buffer);
- while (true)
- {
- byte[] wait = new byte[1];
- ReadProcessMemory(handle, (IntPtr)0x23917F0, wait, 1, out buffer);
- if (wait[0] == 0)
- break;
- }
- byte[] pbMap = Encoding.ASCII.GetBytes("maps\\" + str);
- WriteProcessMemory(handle, (IntPtr)0x23917F0, new byte[] { 1 }, 1, out buffer);
- WriteProcessMemory(handle, (IntPtr)0x2391800, new byte[] { 2, 0, 0, 0 }, 4, out buffer);
- WriteProcessMemory(handle, (IntPtr)0x2391824, pbMap, pbMap.Length, out buffer);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement