예제 #1
0
 public static int[] GetAllBases(H2Memory H2)
 {
     int[] Storage = new int[2048];
     for (int i = 0; i < 2048; i++)
         Storage[i] = H2.H2Mem.ReadInt(false, ((H2.HType == H2Type.Halo2Vista) ? 0x3003CF3C : 0x3003CAE8) + (i * 12) + 8);
     return Storage;
 }
예제 #2
0
 /// <summary>
 /// Patches the Ammo subtraction
 /// </summary>
 public static void PatchAmmo(H2Memory H2)
 {
     if (Patched)
     /*
     mov [ecx+06],ax
     to
     nop nop nop nop
         */
     H2.H2Mem.WriteMem(0x15F3EA, new byte[] { 0x90, 0x90, 0x90, 0x90 }, true);
     /*
      add [eax],di
      to
      nop nop nop
      */
     H2.H2Mem.WriteMem(0x15EDA1, new byte[] { 0x90, 0x90, 0x90 }, true);
     /*
     sub [eax+08],si
     to
     nop nop nop nop
     */
     H2.H2Mem.WriteMem(0x160173, new byte[] { 0x90, 0x90, 0x90, 0x90 }, true);
     /*
      movss [edi+00000184],xmm0
      to
      nop nop nop nop nop nop nop nop
      */
     H2.H2Mem.WriteMem(0x15f7c6, new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }, true);
 }
예제 #3
0
파일: Poke.cs 프로젝트: Kantanomo/Ambiguous
 private static bool GoodToGo(Map Map)
 {
     try
     {
         string tmp = H2Memory_class.Map.CurrentMap(H2);
         if (Map.Header.MapName.Trim('\0') == tmp || Map.Header.MapName.Trim('\0') == "shared")
             return true;
         else
             return false;
     }
     catch (Exception)
     {
         if (MessageBox.Show("Halo 2 has either restarted or exited, would you like to rescan for it?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             H2 = new H2Memory(H2Type.Halo2Vista, false);
             if (H2.H2Found)
             {
                 MessageBox.Show("Halo 2 was found :)");
                 return true;
             }
             else
             {
                 MessageBox.Show("Halo 2 was not found");
                 return false;
             }
         }
         else
             return false;
     }
 }
예제 #4
0
 public static int[] GetAllWeapons(H2Memory H2)
 {
     List<int> Storage = new List<int>();
     for (int i = 0; i < 2048; i++)
     {
         int DynamicBase = H2.H2Mem.ReadInt(false, ((H2.HType == H2Type.Halo2Vista) ? 0x3003CF3C : 0x3003CAE8) + (i * 12) + 8);
         int DynamicC = H2.H2Mem.ReadInt(false, DynamicBase);
         if (Regex.IsMatch(((Weapon)DynamicC).ToString(), "[a-zA-Z]"))
             Storage.Add(DynamicBase);
     }
     return Storage.ToArray();
 }
예제 #5
0
 /// <summary>
 /// Patches xlive.dll integrity check
 /// </summary>
 /// <param name="H2">H2Memory Class</param>
 public static void PatchChecks(H2Memory H2)
 {
     Int32 xliveBase = H2.H2Mem.DLLBaseAddress("xlive.dll");
     //Thanks to Kiwi who made this code because i couldn't find mine!
     for (Int32 i = 0; i <= 0x351000; i += 1)
     {
         byte[] Magic = H2.H2Mem.ReadMem(xliveBase + i, 16, false);
         if (Magic[0] == 0x8b && Magic[1] == 0xec && Magic[2] == 0x83 && Magic[3] == 0xec && Magic[4] == 0x20 && Magic[5] == 0x53 && Magic[6] == 0x56 && Magic[7] == 0x57 && Magic[8] == 0x8d && Magic[9] == 0x45 && Magic[10] == 0xe0 && Magic[11] == 0x33 && Magic[12] == 0xf6 && Magic[13] == 0x50 && Magic[14] == 0xff && Magic[15] == 0x75)//(Magic[15] == 0x74 || Magic[15] == 0x75 || Magic[15] == 0x7F))
         {
             byte[] mBytes = { 0xc2, 0xc, 0x0 };
             H2.H2Mem.WriteMem((xliveBase + i) - 3, mBytes, false);
             Patched = true;
             break;
         }
         else if (Magic[0] == 0x8b && Magic[1] == 0xec && Magic[2] == 0x83 && Magic[3] == 0xec && Magic[4] == 0x20 && Magic[5] == 0x53 && Magic[6] == 0x56 && Magic[7] == 0x57 && Magic[8] == 0x8d && Magic[9] == 0x45 && Magic[10] == 0xe0 && Magic[11] == 0x33 && Magic[12] == 0xf6 && Magic[13] == 0xc2 && Magic[14] == 0xc && Magic[15] == 0x0)
             Patched = true;
     }
 }
예제 #6
0
 private static bool GoodToGo(Map Map)
 {
     try
     {
         string tmp = H2Memory_class.Map.CurrentMap(H2);
         if (Map.Header.MapName.Trim('\0') == tmp || Map.Header.MapName.Trim('\0') == "shared")
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         if (MessageBox.Show("Halo 2 has either restarted or exited, would you like to rescan for it?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             H2 = new H2Memory(H2Type.Halo2Vista, false);
             if (H2.H2Found)
             {
                 MessageBox.Show("Halo 2 was found :)");
                 return(true);
             }
             else
             {
                 MessageBox.Show("Halo 2 was not found");
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
 }
예제 #7
0
 /// <summary>
 /// Gets the WeaponBase that matches the player camera
 /// </summary>
 public static WeaponBase GetPlayerWeaponOut(H2Memory H2, int PlayerCamera)
 {
     for (int j = 0; j < 2048; j++)
     {
         int DynamicBase = H2.H2Mem.ReadInt(false, ((H2.HType == H2Type.Halo2Vista) ? 0x3003CF3C : 0x3003CAE8) + (j * 12) + 8);
         int DynamicS = H2.H2Mem.ReadInt(false, DynamicBase +0x14);
         if (DynamicS == PlayerCamera)
             return new WeaponBase(H2, DynamicBase);
     }
     return new WeaponBase();
 }
예제 #8
0
파일: Tag.cs 프로젝트: Kantanomo/H2Memory
 public Tag(TagType Type, uint Ident, int RawMetaOffset, int RawMetaSize, int MetaOffset, string path, ref H2Memory H2Memory)
 {
     this.Type = Type;
     this.Identifier = Ident;
     this.RawMetaOffset = RawMetaOffset;
     this.RawMetaSize = RawMetaSize;
     this.MetaOffset = MetaOffset;
     this.Path = path;
     this.H2Memory = H2Memory;
 }
예제 #9
0
 /// <summary>
 /// Removes automatic check for autocorrecting player speed multiplyer
 /// </summary>
 /// <param name="H2">H2Memory Class</param>
 public static void PatchSpeed(H2Memory H2)
 {
     /*
        movss [edi+00000180],xmm0
        to
        nop nop nop nop nop nop nop nop nop
       */
     if (Patched)
         H2.H2Mem.WriteMem(((H2.HType == H2Type.Halo2Vista) ? 0x6AB7f : 0x6A3BA), new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }, true);
 }
예제 #10
0
 /// <summary>
 /// mov byte ptr [eax],ff / mov byte ptr [eax-01],ff
 /// to
 /// nop nop nop nop nop nop nop
 /// </summary>
 /// <param name="H2">H2Memory Class</param>
 public static void PatchRank(H2Memory H2)
 {
     if (Patched)
             H2.H2Mem.WriteMem(0x1B2C29, new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }, true);
 }
예제 #11
0
 /// <summary>
 /// Gets the current map
 /// </summary>
 /// <returns>name of the map</returns>
 public static string CurrentMap(H2Memory H2)
 {
     #region Halo2Vista
     if (H2.HType == H2Type.Halo2Vista) return H2.H2Mem.ReadStringAscii(true, 0x47cf0c, 32);
     #endregion
     #region H2Server
     if (H2.HType == H2Type.H2server)
         if (MainMenuCheck(H2)) return "mainmenu";
         else return H2.H2Mem.ReadStringAscii(true, 0x4A2B74, 32);
     #endregion //NEEDS WORK
     return string.Empty;
 }
예제 #12
0
 /// <summary>
 /// Patches Grenade reduction
 /// </summary>
 public static void PathGrenades(H2Memory H2)
 {
     /*
      add byte ptr [eax+esi+00000252],ff
      to
      nop nop nop nop nop nop nop nop
      */
     H2.H2Mem.WriteMem(0x1666A8, new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 , 0x90}, true);
 }
예제 #13
0
 /// <summary>
 /// Gets the dynamic player address by index
 /// </summary>
 public static int GetPlayerDynamic(H2Memory H2, int index)
 {
     int TempSight = H2.H2Mem.ReadInt(false, ((H2.HType == H2Type.Halo2Vista) ? 0x30002B44 : 0x300026F0) + (index * 0x204));
     if (TempSight != -1 && TempSight != 0)
         for (int j = 0; j < 2048; j++)
         {
             int DynamicBase = H2.H2Mem.ReadInt(false, ((H2.HType == H2Type.Halo2Vista) ? 0x3003CF3C : 0x3003CAE8) + (j * 12) + 8);
             int DynamicS = H2.H2Mem.ReadInt(false, DynamicBase + 0x3F8);
             if (DynamicS == TempSight)
                 return DynamicBase;
         }
     return -1;
 }
예제 #14
0
 public WeaponSet(H2Memory H2, Weapon WeaponClass)
 {
     foreach (int i in DynamicObjTable.GetWeaponSet(H2, WeaponClass))
         List.Add(new WeaponBase(H2,i));
 }
예제 #15
0
 /// <summary>
 /// Gets a List of Offsets for every type of the given weaponclass
 /// </summary>
 public static int[] GetWeaponSet(H2Memory H2, Weapon WeaponClass)
 {
     List<int> Storage = new List<int>();
         for (int j = 0; j < 2048; j++)
         {
             int DynamicBase = H2.H2Mem.ReadInt(false, ((H2.HType == H2Type.Halo2Vista) ? 0x3003CF3C : 0x3003CAE8) + (j * 12) + 8);
             int DynamicC = H2.H2Mem.ReadInt(false, DynamicBase);
             if (DynamicC == (int)WeaponClass)
                 Storage.Add(DynamicBase);
         }
     return Storage.ToArray();
 }
예제 #16
0
 public WeaponBase(H2Memory H2, int Offset)
 {
     this.Offset = Offset;
     this.H2 = H2;
     try {WeaponClass = (Weapon)H2.H2Mem.ReadInt(false, Offset);} catch(Exception) {WeaponClass = Weapon.Unknown;};
 }
예제 #17
0
 /// <summary>
 /// Checks if the current map is the mainmenu
 /// </summary>
 /// <returns>Returns true if the map is mainmenu</returns>
 public static bool MainMenuCheck(H2Memory H2)
 {
     #region Halo2Vista
     if (H2.HType == H2Type.Halo2Vista)
     {
         if (H2.H2Mem.ReadStringUnicode(true, 0x47cf0c, 32) != "mainmenu") return true;
         else return false;
     }
     #endregion
     #region H2Server
     if (H2.HType == H2Type.H2server)
     {
         if (H2.H2Mem.ReadInt(true, 0x3C40AC) != 3) return true;
         else return false;
     }
     #endregion
     return false;
 }
예제 #18
0
 /// <summary>
 /// Overloaded constructor
 /// </summary>
 public Player(H2Memory  H2, int index)
 {
     this.Mem = H2.H2Mem;
     this.H2 = H2;
     this.HType = H2.HType;
     this.index = index * 0x204;
     if (HType == H2Type.Halo2Vista)
     {
         if ((Mem.ReadInt(true, 0x5057AC)).ToString() == "0") Offset = 0x50D334;
         else Offset = 0x5057AC;
     }
 }
예제 #19
0
 public Camera(H2Memory H2)
 {
     this.H2 = H2;
 }
예제 #20
0
 /// <summary>
 /// Resets the current map to default
 /// </summary>
 public static void ResetMap(H2Memory H2)
 {
     H2.H2Mem.WriteInt(false, ((H2.HType == H2Type.Halo2Vista) ? 0x300056C4 : 0x30005270), 0);
 }