<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="19">
  <CheatEntries>
    <CheatEntry>
      <ID>79</ID>
      <Description>"Скрип HOME/END версия 1 "</Description>
      <LastState/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>{ Game   : ePSXe ENG.exe
  Version:
  Date   : 2016-02-02
  Author : User

  This script does blah blah blah
}

[ENABLE]
aobscan(INJECT,88 1C 08 81 E2 FC FF 1F 00) // should be unique
alloc(newmem,$1000)
label(code)
label(code1)
label(return)
label(flagUp)
registersymbol(INJECT)

newmem:
  cmp [00A47010],1
  jne code1
  cmp [flagUp],0
  jne code1
  pushad
  push 0
  push 0
  push 0
  push #36             // Home
  call keybd_event
  push 0
  push 2
  push 0
  push #36
  call keybd_event
  mov [flagUp],1
  popad
  jmp code

code1:
  cmp [00A47010],0
  jne code
  cmp [flagUp],1
  jne code
  pushad
  push 0
  push 0
  push 0
  push #35             // End
  call keybd_event
  push 0
  push 2
  push 0
  push #35
  call keybd_event
  mov [flagUp],0
  popad

code:
  mov [eax+ecx],bl
  and edx,001FFFFC
  jmp return

flagUp:
dd 0

INJECT:
  jmp newmem
  nop
  nop
  nop
  nop
return:


[DISABLE]

INJECT:
  db 88 1C 08 81 E2 FC FF 1F 00

unregistersymbol(INJECT)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: 02C802B4

02C8028B: 81 FA 00 00 80 1F     -  cmp edx,1F800000
02C80291: 74 62                 -  je 02C802F5
02C80293: 8B 0D 84 0A 51 00     -  mov ecx,["ePSXe ENG.exe"+110A84]
02C80299: F7 C1 00 00 01 00     -  test ecx,10000
02C8029F: 75 53                 -  jne 02C802F4
02C802A1: 8B C8                 -  mov ecx,eax
02C802A3: 89 C2                 -  mov edx,eax
02C802A5: C1 E9 10              -  shr ecx,10
02C802A8: 25 FF FF 00 00        -  and eax,0000FFFF
02C802AD: 8B 0C 8D 40 AF 82 00  -  mov ecx,[ecx*4+"ePSXe ENG.exe"+42AF40]
// ---------- INJECTING HERE ----------
02C802B4: 88 1C 08              -  mov [eax+ecx],bl
02C802B7: 81 E2 FC FF 1F 00     -  and edx,001FFFFC
// ---------- DONE INJECTING  ----------
02C802BD: BB 20 00 E9 02        -  mov ebx,02E90020
02C802C2: 03 DA                 -  add ebx,edx
02C802C4: 8B 03                 -  mov eax,[ebx]
02C802C6: 3D 40 00 C8 02        -  cmp eax,02C80040
02C802CB: 75 01                 -  jne 02C802CE
02C802CD: C3                    -  ret
02C802CE: B8 40 00 C8 02        -  mov eax,02C80040
02C802D3: 8B 0C 10              -  mov ecx,[eax+edx]
02C802D6: B8 20 00 12 03        -  mov eax,03120020
02C802DB: 8B 04 10              -  mov eax,[eax+edx]
}
</AssemblerScript>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols>
    <SymbolEntry>
      <Name>INJECT</Name>
      <Address>011C07E1</Address>
    </SymbolEntry>
  </UserdefinedSymbols>
</CheatTable>
