thethiny Cheater
Reputation: 0
Joined: 01 Apr 2012 Posts: 38 Location: earth
|
Posted: Sat Jul 16, 2016 6:57 pm Post subject: |
|
|
ParkourPenguin wrote: |
Now that you mention it, file+100 is probably more than 2GB away from newmem which causes the instruction cmp [BOOL],1 to fail (it's not encodable). Pass it back via a register (i.e. eax) instead, or just put it inline like I suggested.
|
Yeah I noticed that and I fixed it
ParkourPenguin wrote: |
I also just now noticed you're swapping rax and rcx by popping them in the wrong order. Elements are accessed from the stack on a last-in-first-out basis.
|
I also fixed this in the edit.
ParkourPenguin wrote: |
If PathFileExists always returns 0, then it's always failing to find the file specified. Try executing my example script in the game but instead of CE's path use '..\Loadr\FileName.txt',0 |
I got it, the Get Path thingy starts at the root directory, so I don't need the '..\', I fixed this by lea rcx,[DATA+3] instead of DATA
THANK YOU SO MUCH I NOW HAVE A FULLY WORKING DLC LOADER
here's the code for those interested:
I expanded it to support 128 characters.
Code: |
alloc(newmem,2048,"MK10.exe"+13FF5C4)
alloc(DATA,512)
label(returnhere)
label(originalcode)
label(exit)
label(file)
label(BOOL)
label(X0Backup)
DATA+90:
BOOL:
dd 424F4F4C
DATA+80:
X0Backup:
DB ?
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
movaps [X0Backup],xmm0 //BACKUP XMM0
movaps [DATA],xmm0
movaps xmm1,[rax-70]
movaps [DATA+10],xmm1
//Expand Max Charachter Size
movaps xmm0,[rax-60]
movaps [DATA+20],xmm0
movaps xmm1,[rax-50]
movaps [DATA+30],xmm1
movaps xmm0,[rax-40]
movaps [DATA+40],xmm0
movaps xmm1,[rax-30]
movaps [DATA+50],xmm1
movaps xmm0,[rax-20]
movaps [DATA+60],xmm0
movaps xmm1,[rax-10]
movaps [DATA+70],xmm1
cmp [DATA],'..\A'
jnz originalcode
cmp [DATA+4],'sset'
jnz originalcode
cmp Byte Ptr [DATA+8],'\'
jnz originalcode
mov [DATA+3],'Load'
mov Word Ptr [DATA+7],'r\'
call file //Try to open ..\Loadr\YourFile
cmp [BOOL],1
jnz originalcode
movaps xmm0,[DATA]
movaps xmm1,[DATA+10]
movaps [rdx-80],xmm0
movaps [rdx-70],xmm1
movaps xmm0,[DATA+20]
movaps xmm1,[DATA+30]
movaps [rdx-60],xmm0
movaps [rdx-50],xmm1
movaps xmm0,[DATA+40]
movaps xmm1,[DATA+50]
movaps [rdx-40],xmm0
movaps [rdx-30],xmm1
movaps xmm0,[DATA+60]
movaps xmm1,[DATA+70]
movaps [rdx-20],xmm0
movaps [rdx-10],xmm1
jmp "MK10.exe"+13FF600
file:
push rcx //Backup All 3 Registers
push rax
push rdx
sub rsp,20
lea rcx,[DATA+3]
call SHLWAPI.PathFileExistsA
mov [BOOL],eax
add rsp,20
pop rdx
pop rax
pop rcx
ret
originalcode:
movaps xmm0,[X0Backup] //RESTORE XMM0
movaps [rdx-80],xmm0
movaps xmm1,[rax-70]
exit:
jmp returnhere
"MK10.exe"+13FF5C4:
jmp newmem
nop
nop
nop
returnhere:
|
|
|