public void StartPlaybackInput(byte[] input)
        {
            garouMem.WriteBytes(this.inputListMemory, input);

            byte[] pXInputRead      = garouMem.ReadBytes(ADDRESS_P2_INPUT_READ, 6);
            byte[] inputListAddress = MemoryHandler.PtrToBytes(this.inputListMemory);

            List <byte> instruction = new List <byte>(new byte[] {
                0x50,                                                                                                 // push eax 0
                0x53,                                                                                                 // push ebx 1
                0x52,                                                                                                 // push edx 2
                0x31, 0xC0,                                                                                           // xor eax eax 3
                0x31, 0xDB,                                                                                           // xor ebx ebx 5
                0x31, 0xD2,                                                                                           // xor edx edx 7
                0xB8, inputListAddress[0], inputListAddress[1], inputListAddress[2], inputListAddress[3],             // mov eax, COMMAND 9
                0x66, 0x8B, 0x1D, inputListAddress[0], inputListAddress[1], inputListAddress[2], inputListAddress[3], // movzx bl, (word) [COMMAND] 14
                0x8D, 0x8B, inputListAddress[0], inputListAddress[1], inputListAddress[2], inputListAddress[3],       // lea edx, [COMMAND+ebx] 21
                0x8A, 0x19,                                                                                           // mov bl, [ecx] 27
                0x80, 0xFB, 0x00,                                                                                     // cmp bl, 0x00 29
                0x74, 0x0C,                                                                                           // JE 0x0C(12) bytes 32
                0x0F, 0x1F, 0x40, 0x00,                                                                               // nop dword ptr [eax] ; multibyte nop 34
                0x88, 0x1D, pXInputRead[2], pXInputRead[3], pXInputRead[4], pXInputRead[5],                           // mov [Garou.exe+285FD8], bl 38
                0xFF, 0x00,                                                                                           // inc [eax] 44
                0x5A,                                                                                                 // pop edx  45
                0x5B,                                                                                                 // pop ebx  46
                0x58,                                                                                                 // pop eax  47
            });

            originalInstruction = pXInputRead;
            garouMem.WriteBytes(inputListMemory, new byte[] { 0x02, 0x00 });
            injectedFunction = garouMem.CreateCodeCave(ADDRESS_P2_INPUT_READ, instruction.ToArray(), 6);
        }
Beispiel #2
0
        public Program()
        {
            Console.Title = String.Format("{0} - v {1}", PROJECT_NAME, VERSION);
            MemoryHandler mem = new MemoryHandler();

            if (!mem.OpenProcess("Garou"))
            {
                throw new ProcessNotAccessibleException();
            }

            p1InputHistory = new InputHistory();
            p2InputHistory = new InputHistory();
            cheats         = new Cheats(mem);
            inputHandler   = new InputHandler(mem);
            overlay        = new Overlay();
        }
        public void StartRecordInput()
        {
            byte[] pXInputRead      = garouMem.ReadBytes(ADDRESS_P1_INPUT_READ, 6);
            byte[] inputListAddress = MemoryHandler.PtrToBytes(this.inputListMemory);
            byte[] commandLength    = BitConverter.GetBytes(INPUT_RECORD_MAX_SIZE);

            List <byte> instruction = new List <byte>(new byte[] {
                0x50,                                                                                                 // push eax 0
                0x53,                                                                                                 // push ebx 1
                0x52,                                                                                                 // push edx 2
                0x31, 0xC0,                                                                                           // xor eax eax 3
                0x31, 0xDB,                                                                                           // xor ebx ebx 5
                0x31, 0xD2,                                                                                           // xor edx edx 7
                0xB8, inputListAddress[0], inputListAddress[1], inputListAddress[2], inputListAddress[3],             // mov eax, COMMAND 9
                0x66, 0x8B, 0x1D, inputListAddress[0], inputListAddress[1], inputListAddress[2], inputListAddress[3], // movzx bl, (word) [COMMAND] 14
                0x8D, 0x93, inputListAddress[0], inputListAddress[1], inputListAddress[2], inputListAddress[3],       // lea edx, [COMMAND+ebx] 21
                0x81, 0xFB, commandLength[0], commandLength[1], commandLength[2], commandLength[3],                   // cmp ebx,MAX_COMMAND_INPUT_LENGTH 27
                0x74, 0x0D,                                                                                           // je 0x0D(47)  33
                0x0F, 0x1F, 0x40, 0x00,                                                                               // nop dword ptr [eax+00] ; multibyte nop  35
                0x89, 0x0A,                                                                                           // mov [edx],ecx 39
                0xFF, 0x00,                                                                                           // inc [eax] 41
                0xEB, 0x0E,                                                                                           // jmp 0x0E 43
                0x0F, 0x1F, 0x00,                                                                                     // nop dword ptr [eax] ; multibyte nop 45
                0xC7, 0x02, 0x00, 0x00, 0x00, 0x00,                                                                   // mov [edx], 0x00 48
                0xEB, 0x03,                                                                                           // jmp 0x03 54
                0x0F, 0x1F, 0x00,                                                                                     // nop dword ptr [eax] ; multibyte nop 56
                0x5A,                                                                                                 // pop edx  59
                0x5B,                                                                                                 // pop ebx  60
                0x58,                                                                                                 // pop eax  61
                0x89, 0x0D, pXInputRead[2], pXInputRead[3], pXInputRead[4], pXInputRead[5],                           // mov [ADDRESS_P2_INPUT],ecx 62
            });

            originalInstruction = pXInputRead;
            garouMem.WriteBytes(inputListMemory, new byte[] { 0x02, 0x00 });
            injectedFunction = garouMem.CreateCodeCave(ADDRESS_P1_INPUT_READ, instruction.ToArray(), 6);
        }
 public InputHandler(MemoryHandler garouMem)
 {
     this.garouMem        = garouMem;
     this.inputListMemory = this.garouMem.MemoryAlloc(UIntPtr.Zero, INPUT_LIST_MEMORY_SIZE);
 }