Page 1 of 1
Correctly using autoAssemble()?
Posted: Mon May 06, 2024 8:58 pm
by Send
My script is writing my symbol to the address, but it's not executing any code in autoAssemble(). New to LUA, any tips?
Code: Select all
{$lua}
if syntaxcheck then return end
[ENABLE]
scan = "GameAssembly.dll+173031B"
registerSymbol("switch",scan)
mem = allocateMemory(0x1000)
registerSymbol("newmem",mem)
autoAssemble([[
label(return)
newmem:
movss xmm8,(float)50.0
movss [rbx+3C],xmm8
jmp return
switch:
jmp newmem
nop
return:
]])
[DISABLE]
writeBytes(scan, 0xF3, 0x44, 0x0F, 0x11, 0x43, 0x3C)
unregisterSymbol("newmem")
unregisterSymbol("switch")
deAlloc(mem, 0x1000)
scan = nil
mem = nil
Re: Correctly using autoAssemble()?
Posted: Mon May 06, 2024 9:49 pm
by SunBeam
There is no assembly mnemonic that would directly write a float into a SSE2 instruction: "movss xmm8,float_val". You need a memory immediate address that holds the float you want, which you would then read it from:
Code: Select all
{$lua}
if syntaxcheck then return end
[ENABLE]
scan = "GameAssembly.dll+173031B"
registerSymbol("switch",scan)
mem = allocateMemory(0x1000)
registerSymbol("newmem",mem)
autoAssemble([[
label(return)
label(flVal)
newmem:
movss xmm8,[flVal]
movss [rbx+3C],xmm8
jmp return
flVal:
dd (float)50.0
switch:
jmp newmem
nop
return:
]])
[DISABLE]
writeBytes(scan, 0xF3, 0x44, 0x0F, 0x11, 0x43, 0x3C)
unregisterSymbol("newmem")
unregisterSymbol("switch")
deAlloc(mem, 0x1000)
scan = nil
mem = nil
Re: Correctly using autoAssemble()?
Posted: Mon May 06, 2024 11:43 pm
by Send
SunBeam wrote: ↑Mon May 06, 2024 9:49 pm
The one time I deviate away from the usual mov/movss xmm#,[new], lol. Appreciate ya!
The issue is, it's registering my symbol, but not executing the newmem just on this one specific address.
All of my other scripts with similar (without the direct float as in the example above) functions execute newmem. Now to figure out why they crash with lua and work with regular asm.
Re: Correctly using autoAssemble()?
Posted: Tue May 07, 2024 1:22 am
by SunBeam
You don't need to do the last two:
And this is incorrect:
It's just
deAlloc(getAddress("mem")) ([DISABLE] won't read the symbols from [ENABLE]; you need to declare them as global, before the [ENABLE]). No need for a size when deallocating.
Re: Correctly using autoAssemble()?
Posted: Wed May 08, 2024 12:44 am
by Send
SunBeam wrote: ↑Tue May 07, 2024 1:22 am
You don't need to do the last two:
And this is incorrect:
It's just
deAlloc(getAddress("mem")) ([DISABLE] won't read the symbols from [ENABLE]; you need to declare them as global, before the [ENABLE]). No need for a size when deallocating.
Thanks again brother, I'll keep at it.