Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[SOLVED] LUA autoAssemble help!

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
holaboludo
How do I cheat?
Reputation: 0

Joined: 22 Oct 2018
Posts: 2

PostPosted: Mon Oct 04, 2021 4:46 pm    Post subject: [SOLVED] LUA autoAssemble help! Reply with quote

Grettings! I'd like to someone proficient in AA programming to explain me (and give me an example if possible) on how to use CE's autoAssemble command (including enabling and disabling).

I'm currently writing a "free-camera" script that when activated performs multiple LUA AOBscans and write data to specific offsets as well create memory records for them regardless of if the ASM AOBscan and code injection was successful or not.
What I want my script to do is to perform these actions IF the AOBscan was successful, otherwise print an error. I have learned of this autoAssemble function which can return the activation/code injection status as a boolean value but I have trouble implementing it and when I try to execute it I get either "ACCESS VIOLATION" or "UNKNOWN" errors.

The original script is quite long so here is a simplified snippet of the current code. The target application of the script is the PCSX2 emulator.

Code:

[ENABLE]
{$lua}

disable_code = [[
aobscan(GAMEPLAY_CAM_CONTROL, long array of bytes)
registersymbol(GAMEPLAY_CAM_CONTROL)

GAMEPLAY_CAM_CONTROL + 0xC0:
   db 90 90 90

[DISABLE]
GAMEPLAY_CAM_CONTROL + 0xC0:
   db 0F 29 31
unregistersymbol(GAMEPLAY_CAM_CONTROL)
]]

if autoAssemble(disable_code) then

   --[[Disable menu and HUD]]

   --[[Set array of bytes to search]]
   array = "B0 C5 3C 00 01 01 00 ??"
   --[[Start search]]
   ms = createMemScan()
   ms.firstScan(soExactValue, vtByteArray, nil,array, nil, 0x20900000,0x21f00000,"",1,"4",true,nil,nil,nil)
   ms.waitTillDone()
   fl = createFoundList(ms)
   fl.initialize()
   --[[Process found results and create cheat table with entries]]
   if (fl~=nil) then
      al = getAddressList()
      for i = 1, 1 do
         zaddress = getAddress(fl[0])

         mntrsnprncy = al.createMemoryRecord()

         menutransparency = zaddress + 0x05

         writeBytes(menutransparency, 00)

         mntrsnprncy.Description = "Pause menu transparency"
         mntrsnprncy.setAddress(menutransparency)
         mntrsnprncy.Type = vtByte
         mntrsnprncy.appendToEntry(header)

      end
      fl.destroy()
      fl=nil
   else
      ms.destroy()
   end
   ms.destroy()

else
   print("AoBscan error.")
end

--[[disable script]]
autoAssemble(disable_code, disableInfo)


{$asm}


I have tried to understand some of the autoAssemble command examples posted by other users in the forum but my lack of programming experience (as you have noticed in the example script posted above) gets in the way.

Thanks for any help and I apologize for any grammatical mistakes, as I'm not a native english speaker Embarassed .


Last edited by holaboludo on Sat Oct 09, 2021 12:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
Frouk
Expert Cheater
Reputation: 1

Joined: 22 Jun 2021
Posts: 237

PostPosted: Fri Oct 08, 2021 1:45 pm    Post subject: Reply with quote

You don't need to put '[DISABLE]'
Instead use
Code:
function gameplayCamControl(toggle)
if toggle then
local s = [[
//Put enable section without '[ENABLE]'
]]
autoAssemble(s)
end
if not toggle then
local s = [[
//Put disable section without '[DISABLE]'
]]
autoAssemble(s)
end
end

If you want to call function use:
Code:
gameplayCamControl(true) --if you want to disable replace true to false

You can use in lua:
Code:
aOBScan(arr)--Returns list of strings if found one or more address

_________________
void(*Haxing)(int Game)
Back to top
View user's profile Send private message
holaboludo
How do I cheat?
Reputation: 0

Joined: 22 Oct 2018
Posts: 2

PostPosted: Sat Oct 09, 2021 12:55 pm    Post subject: Reply with quote

Frouk wrote:
You don't need to put '[DISABLE]'
Instead use
Code:
function gameplayCamControl(toggle)
if toggle then
local s = [[
//Put enable section without '[ENABLE]'
]]
autoAssemble(s)
end
if not toggle then
local s = [[
//Put disable section without '[DISABLE]'
]]
autoAssemble(s)
end
end

If you want to call function use:
Code:
gameplayCamControl(true) --if you want to disable replace true to false

You can use in lua:
Code:
aOBScan(arr)--Returns list of strings if found one or more address


Thanks for the explanation, Frouk! I now understand how to use the autoAssemble function as well able to impement it in my script. Thanks a lot again!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites