Hello fellow stack overflowers,
I'm up to create a program that plays the home teams goalhymn when it actually scored a goal in the football simulator FIFA 19.
I know there is no open API for the game itself. The only method I see to use is to actually poll the result from the memory. I do not know if this does comply with the end user license agreement of the game, but I have not in mind to actually cheat in any way.
For research I found and looked up the Cheat Engine Table from https://github.com/xAranaktu/FIFA-19---Career-Mode-Cheat-Table. It gives the ability to read or write the match score via Cheat Engine.
Sadly, I'm having trouble to reverse engineer the table. I've found the bit of code that reads the value from memory. But I'm having a hard time figuring out what each line does.
[ENABLE]
aobscanmodule(INJECT_matchScore,FIFA19.exe,48 8B 41 20 48 89 42 20 8B 41 28 89 42 28 41 8B 54) // should be unique
alloc(matchscore_cave,$1000,"FIFA19.exe"+2578D85)
alloc(ptrHomeTeamScore, 8)
registersymbol(ptrHomeTeamScore)
ptrHomeTeamScore:
dq 00
alloc(ptrAwayTeamScore, 8)
registersymbol(ptrAwayTeamScore)
ptrAwayTeamScore:
dq 00
label(code_matchscore)
label(home_matchscore)
label(away_matchscore)
label(return_matchscore)
matchscore_cave:
pushf
cmp rdx, 00
je home_matchscore
cmp rdx, 01
je away_matchscore
jmp code_matchscore
home_matchscore:
mov [ptrHomeTeamScore], rcx
jmp code_matchscore
away_matchscore:
mov [ptrAwayTeamScore], rcx
jmp code_matchscore
code_matchscore:
mov r8d,[rcx+0000011C]
popf
jmp return_matchscore
INJECT_matchScore+5B:
jmp matchscore_cave
nop
nop
return_matchscore:
registersymbol(INJECT_matchScore)
I have basic knowledge of what a pointer, a stack is and what assembler does. But I cannot understand the things going on here. Maybe you can give me a line by line description of what's going on.
Thank you in advance.