std::stringoriginalBytes_V2="\x8B\x4D\x0C\x53\x8D\x9f\x2a\x03\x00\x00\x8D\x1C\x9E\x81\xF9\x76\xc4\x06\x00";//original assembly code of steamclient.dll that we want to hook (V2)
std::stringoriginalBytes_V4="\x8B\x45\x0C\x89\x45\xF4\x8D\x45\xF0\x50\x89\x7D\xF0";//original assembly code of steamclient.dll that we want to hook (V2)
/* ==
moveax,dwordptrss:[ebp+C]//appId of bindings to be switched gets moved into eax register
movdwordptrss:[ebp-C],eax
leaeax,dwordptrss:[ebp-10]
pusheax
movdwordptrss:[ebp-10],edi
*/
std::stringmask_V4="xxxxxxxxxxxxx";//mask for searching
&¤tBindings!=steamChordBindingsID)//we can grab them here, because bindings switch right after we have injected and the target changes focused window
moveax,dwordptrss:[ebp+0xc]//part of original steam code - appId of bindings to be switched gets moved into eax register
movcurrentBindings,eax//move into "currentBindings" variable
}
if(currentBindings!=desktopBindingsID//if the current bindings aren't desktop, big picture, or steam-chord bindings
&¤tBindings!=bigPictureBindingsID//they have to be our game bindings
&¤tBindings!=steamChordBindingsID)//we can grab them here, because bindings switch right after we have injected and the target changes focused window
{
enforceBindingsID=currentBindings;
}
if(currentBindings==desktopBindingsID)//if steam wants to set desktop-bindings
{
__asm
{
moveax,enforceBindingsID//move appid of bindings to enforce into eax register
}
}
__asm
{
cmpeax,0x6C476//part of original steam code - checks if bindings to be set are steamchord bindings
jmp[JMPBack]//jump back and continiue with original steam function
}//note: zero flag doesn't get altered by jmp instruction, previous compare still works fine
movecx,dwordptrss:[ebp+0xc]//part of original steam code - appId of bindings to be switched gets moved into eax register
movcurrentBindings,ecx//move into "currentBindings" variable
}
if(currentBindings!=desktopBindingsID//if the current bindings aren't desktop, big picture, or steam-chord bindings
&¤tBindings!=bigPictureBindingsID//they have to be our game bindings
&¤tBindings!=steamChordBindingsID)//we can grab them here, because bindings switch right after we have injected and the target changes focused window
{
enforceBindingsID=currentBindings;
}
if(currentBindings==desktopBindingsID)//if steam wants to set desktop-bindings
{
__asm
{
movecx,enforceBindingsID//move appid of bindings to enforce into eax register
}
}
__asm
{
pushebx//part of original steam code
leaebx,dwordptrds:[edi+0x32A]//part of original steam code
leaebx,dwordptrds:[esi+ebx*0x4]//part of original steam code
cmpecx,0x6C476//part of original steam code - checks if bindings to be set are steamchord bindings
jmp[JMPBack]//jump back and continiue with original steam function
}//note: zero flag doesn't get altered by jmp instruction, previous compare still works fine
moveax,dwordptrss:[ebp+0xC]//part of original steam code - appId of bindings to be switched gets moved into eax register
movcurrentBindings,eax//move into "currentBindings" variable
}
if(currentBindings!=desktopBindingsID//if the current bindings aren't desktop, big picture, or steam-chord bindings
&¤tBindings!=bigPictureBindingsID//they have to be our game bindings
&¤tBindings!=steamChordBindingsID)//we can grab them here, because bindings switch right after we have injected and the target changes focused window
{
enforceBindingsID=currentBindings;
}
if(currentBindings==desktopBindingsID)//if steam wants to set desktop-bindings
{
__asm
{
moveax,enforceBindingsID//move appid of bindings to enforce into eax register
}
}
__asm
{
jmp[JMPBack]//jump back and continiue with original steam function
moveax,dwordptrss:[ebp+0xC]//appId of bindings to be switched gets moved into ecx register
movcurrentBindings,eax//move into "currentBindings" variable
}
if(currentBindings!=desktopBindingsID//if the current bindings aren't desktop, big picture, or steam-chord bindings
&¤tBindings!=bigPictureBindingsID//they have to be our game bindings
&¤tBindings!=steamChordBindingsID)//we can grab them here, because bindings switch right after we have injected and the target changes focused window
{
enforceBindingsID=currentBindings;
}
if(currentBindings==desktopBindingsID)//if steam wants to set desktop-bindings