So first off I forgot to put in a "readFloat" call, and I used the wrong pointer size (32 not 64) sorry for that.
And then you are not storing the address, just float values, you need to store the address
Code: Select all
[ENABLE]
alloc(newmem,2048,"something.exe"+5000000)
globalAlloc(storedvalue, 8)
label(stored)
label(returnhere)
label(originalcode)
label(exit)
newmem:
mov [storedvalue],(float)1.4 // this is way it doesn't work the address needs to be stored here
cmp [storedvalue+4],0
jne stored
push eax
mov eax,[r14]
mov [storedvalue+4],eax
pop eax
stored:
mov [r14],(float)1
originalcode:
comiss xmm6,[r14]
exit:
jmp returnhere
"something.exe"+5000000:
jmp newmem
nop
nop
nop
returnhere:
[DISABLE]
dealloc(newmem)
"something.exe"+5000000:
comiss xmm6,[r14]
//Alt: db 41 23 7B B6 6E 03 00 00
luaCall(writeFloat('[storedvalue]', '[storedvalue+4]'))
Here you are writing to what ever float 1.4 is in hex in the Lua call to writeFloat.
So try this:
Code: Select all
[ENABLE]
alloc(newmem,2048,"something.exe"+5000000)
globalAlloc(storedvalue, C)
label(stored)
label(returnhere)
label(originalcode)
label(exit)
newmem:
mov [storedvalue],r14 // here the address is stored so you can access it in the disable section
cmp [storedvalue+8],0
jne stored
push eax
mov eax,[r14]
mov [storedvalue+8],eax
pop eax
stored:
mov [r14],(float)1
originalcode:
comiss xmm6,[r14]
exit:
jmp returnhere
"something.exe"+5000000:
jmp newmem
nop
nop
nop
returnhere:
[DISABLE]
dealloc(newmem)
"something.exe"+5000000:
comiss xmm6,[r14]
//Alt: db 41 23 7B B6 6E 03 00 00
luaCall(writeFloat('[storedvalue]', readFloat('[storedvalue+8]')))
// writeFloat({ address to write to }, { value to write })
//readFloat({ address to read from })
So the Lua call at the end of Disable, writes to the address stored at "storedvalue", and writes the value stored at "storedvalue+8".
You can even add "[storedvalue]" (8 byte as hex) and "[storedvalue+8]" (float) as addresses to the address list to help in debugging.