Example #1
0
 /// <summary>
 /// Selects a race.
 /// </summary>
 /// <param name="circuit">The race circuit number to select.</param>
 /// <param name="race">The race number to select.</param>
 public void SelectRace(int circuit, int race)
 {
     if (initialized)
     {
         memoryManager.WriteInt(memoryManager.CalculatePointer(memoryManager.ReadInt(MENU_BASE), SELECTED_CIRCUIT_OFFSETS), memoryManager.ReadInt(memoryManager.CalculatePointer(memoryManager.ReadInt(MENU_BASE), CIRCUIT_BASE_OFFSETS)) + 100 * circuit);
         memoryManager.WriteInt(memoryManager.CalculatePointer(memoryManager.ReadInt(MENU_BASE), SELECTED_RACE_OFFSETS), race);
     }
 }
Example #2
0
        private void UnpauseGame()
        {
            MemoryManager.WriteInt(MemoryManager.CalculatePointer(INRACE_BASEADDRESS, PAUSED_SELECTED_INDEX_OFFSET), 0);           // select index 0
            MemoryManager.WriteInt(MemoryManager.CalculatePointer(INRACE_BASEADDRESS, PAUSED_CURRENT_MENU_OFFSET), 0);             // set current menu to 0
            int         esi          = MemoryManager.ReadInt(INRACE_BASEADDRESS) + INRACE_ESI_OFFSET;
            List <byte> codetoinject = new List <byte>();

            codetoinject.Add(0xBE);
            codetoinject.AddRange(BitConverter.GetBytes(esi));                                                                                // mov esi,'esi'
            codetoinject.AddRange(new byte[] { 0x8B, 0xCE });                                                                                 // mov ecx,esi
            codetoinject.Add(0xE8);
            codetoinject.AddRange(BitConverter.GetBytes(UNPAUSE_FUNCTION_ADDRESS - (int)(MemoryManager.NewMemory + codetoinject.Count + 4))); // call function
            codetoinject.Add(0xC3);                                                                                                           // ret
            MemoryManager.WriteBytes(MemoryManager.NewMemory, codetoinject.ToArray());
            MemoryManager.CreateThread(MemoryManager.NewMemory);                                                                              // select menu item 0,0 (continue race)
        }
Example #3
0
        private void PauseGame()
        {
            MemoryManager.WriteInt(MemoryManager.CalculatePointer(INRACE_BASEADDRESS, INRACE_PAUSED_OFFSET), 1);             // 1) pause game
            int         esi          = MemoryManager.ReadInt(INRACE_BASEADDRESS) + INRACE_ESI_OFFSET;
            List <byte> codetoinject = new List <byte>();

            if (this.GetType() == typeof(Client_2001))
            {
                codetoinject.AddRange(new byte[] { 0x6A, 0x00 });                 // push 00
            }
            codetoinject.Add(0xBE);
            codetoinject.AddRange(BitConverter.GetBytes(esi));                                                                              // mov esi,'esi'
            codetoinject.AddRange(new byte[] { 0x8B, 0xCE });                                                                               // mov ecx,esi
            codetoinject.Add(0xE8);
            codetoinject.AddRange(BitConverter.GetBytes(PAUSE_FUNCTION_ADDRESS - (int)(MemoryManager.NewMemory + codetoinject.Count + 4))); // call function
            codetoinject.Add(0xC3);                                                                                                         // ret
            MemoryManager.WriteBytes(MemoryManager.NewMemory, codetoinject.ToArray());
            MemoryManager.CreateThread(MemoryManager.NewMemory);                                                                            // 2) stop music, open menu, etc.
        }