Knightmare077 wrote: ↑Thu Mar 26, 2020 1:24 am
This method used by Emoose may fix many executables
Looking forward to what you find out sun. I know once a injection file is made , the process of setting multiple cvars becomes easy.
Rather than bothering with coding a DLL I find the longer path a bit more interesting
I've managed to map out the various functions in the DOOM 2016 .cfg file reading block + setting commands/CVars
Soon you will be able to edit your .cfg, then activate a script in the table that re-loads the file, so it can execute stuff or reset CVars on the fly.
Just need now to extract the little bits of pieces of interest and compile a function with just that ASM
So far so good, I can load the file in memory and free it:
Code: Select all
[ENABLE]
alloc( LoadDOOMCfgThread, 0x1000, DOOMx64.exe )
registersymbol( LoadDOOMCfgThread )
CreateThread( LoadDOOMCfgThread )
label( LoadDOOMCfgThreadOff )
registersymbol( LoadDOOMCfgThreadOff )
label( LoadDOOMCfgThread_loop )
LoadDOOMCfgThread:
sub rsp,28
LoadDOOMCfgThread_loop:
mov rcx,A
call Sleep
cmp [LoadDOOMCfgThreadOff],1
jne short @f
add rsp,28
mov [LoadDOOMCfgThreadOff],2
ret
@@:
// VK_NUMPAD DEL
mov rcx,6E
call GetAsyncKeyState
test ax,ax
je short @f
call short LoadDOOMCfg
mov rcx,C8
call Sleep
@@:
jmp LoadDOOMCfgThread_loop
align 10 CC
//*******************************
//* Functions *
//*******************************
LoadDOOMCfg:
//sub rsp,28
sub rsp,40
lea rbp,[rsp-58D8]
mov eax,59D8
sub rsp,rax
xor r15d,r15d
mov rcx,[DOOMx64.exe+3EB98A8] // fileSystem
mov rax,[rcx]
mov [rsp+20],r15d
xor r9d,r9d
lea r8,[rbp-68]
lea rdx,[DOOMx64.exe+27187A8] // "DOOMConfig.cfg"
call qword ptr [rax+C8] // idFileSystemLocal::ReadFile
mov rdx,[rbp-68]
test rdx,rdx
je short @f
mov rcx,[DOOMx64.exe+3EB98A8] // fileSystem
mov r8,[rcx]
call qword ptr [r8+D0] // idFileSystemLocal::FreeFile
@@:
add rsp,5A18
//add rsp,28
ret
align 10 CC
LoadDOOMCfgThreadOff:
dd 0
[DISABLE]
{$lua}
if( syntaxcheck == false ) then --actual execution
local starttime = getTickCount()
if readInteger( "LoadDOOMCfgThreadOff" ) == 0 then --could be 2 already
writeInteger( "LoadDOOMCfgThreadOff", 1 ) --tell the thread to kill itself
end
while( getTickCount() < starttime + 1000 ) and ( readInteger( "LoadDOOMCfgThreadOff" ) ~= 2 ) do --wait till it has finished
sleep( 20 )
end
if( getTickCount() > starttime + 1000 ) then --could happen when the window is shown
showMessage( 'Disabling the thread failed!' )
error( 'Thread disabling failed!' )
end
sleep( 1 )
end
{$asm}
unregistersymbol( LoadDOOMCfgThreadOff )
unregistersymbol( LoadDOOMCfgThread )
dealloc( LoadDOOMCfgThread )
Now to test a simplified file with just 1-2 CVars in it; the below should suffice:
Code: Select all
configVersion 7
//========================================
ai_death_FadeDelay 60000
g_infiniteAmmo 1
And patch in the rest of the code.
Once complete, this will be ported afterwards to Eternal.
BR,
Sun