View previous topic :: View next topic |
Author |
Message |
FauDrei Advanced Cheater
Reputation: 4
Joined: 20 Nov 2013 Posts: 69 Location: bachLai
|
Posted: Wed Sep 13, 2017 4:48 am Post subject: "global" define for all scripts in CE table |
|
|
Regards.
Is there a way to create within CE table a script/file with defines/code that will be available to all the scripts within the same CE table?
AA's include(defines_file.CEA) line in all the scripts method works, but it requires additional CEA file to be present in the same directory as the main CT file, and I would like to avoid having two or more separate files per one CE table.
Thanks.
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 467
Joined: 09 May 2003 Posts: 25704 Location: The netherlands
|
Posted: Wed Sep 13, 2017 5:33 am Post subject: |
|
|
easiest is just put the defines_file in the first entry of your table which once checked shows all other cheats
else try a lua block and a lua script in the main code of your table
main table lua code:
Code: |
definesloaded=false
function registerDefines()
if definesloaded==false then
definesloaded=autoAssemble([[
//your code
]])
end
end
|
and in your cheat entries with aa script then have as first code:
Code: |
{$lua}
registerDefines()
{$asm}
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
FauDrei Advanced Cheater
Reputation: 4
Joined: 20 Nov 2013 Posts: 69 Location: bachLai
|
Posted: Wed Sep 13, 2017 7:32 am Post subject: |
|
|
Dark Byte wrote: | easiest is just put the defines_file in the first entry of your table which once checked shows all other cheats... |
Thanks Dark Byte, but I am not sure I understand this...
I do have 1st "main" script that allows activation of other scripts, but if I put defines there and activate this "main" script - other scripts still do not "see" those defines and would not activate.
Is there something I am missing? I have also tried adding defines.CEA file to my CE table (Table > Add file) and using include(defines.CEA) in table scripts, but include does not see defines.CEA attached to the table.
|
|
Back to top |
|
 |
FreeER Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Wed Sep 13, 2017 6:35 pm Post subject: |
|
|
make sure you use registersymbol for anything you want accessible to other scripts, the autoAssemble will make sure it exists but it's not much different from just adding it to the table and manually enabling it before anything else.
If it's just a bunch of defines, for idk offsets because you haven't setup a structure, not aobscans/allocs/code then you might want something like
Code: | -- have defines in 1 place
function getDefines()
return [[
//your code
]]
end |
Code: | {$lua}
return registerDefines() -- returned string used as AA code in this location
{$asm}
|
|
|
Back to top |
|
 |
FauDrei Advanced Cheater
Reputation: 4
Joined: 20 Nov 2013 Posts: 69 Location: bachLai
|
Posted: Thu Sep 14, 2017 2:19 am Post subject: |
|
|
So, if I understood correctly, beside lua or registersymbol for each define, there is no elegant AA way to have global defines in each (sub)script.
OK.
FreeER wrote: | ...because you haven't setup a structure... |
How do you setup/register a structure?
...or even better (more useful): is there a way and how do you use in AA structures defined in Structure dissect window?
For example... If I have structure like this:
...and have the Unit structure address in RCX... How do I access Unit.state.hp?
Thanks for help.
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 467
Joined: 09 May 2003 Posts: 25704 Location: The netherlands
|
Posted: Thu Sep 14, 2017 2:57 am Post subject: |
|
|
registersymbol IS a global
also, if you have setup a structure, you can reference offsets in it using structurename.elementname
so in your case, assuming you also have defined state as a separate structure
Code: |
push rax
mov rax,[rcx+Unit.state]
mov [rax+State.hp],(float)1
pop rax
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
FauDrei Advanced Cheater
Reputation: 4
Joined: 20 Nov 2013 Posts: 69 Location: bachLai
|
Posted: Thu Sep 14, 2017 3:02 am Post subject: |
|
|
This is great.
Thanks.
|
|
Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 61
Joined: 01 Oct 2008 Posts: 958
|
Posted: Thu Sep 14, 2017 5:16 am Post subject: |
|
|
If it is for field usage of mono class, may try this script, need ce 6.7.
The chain of fields should only work for class not structure.
There is unknown bug which somehow disappeared when I comment out some extra script, not sure it is bug free.
Code: |
local function findClass(class)
if type(class)=='string' then
local n,c = '',class
if class:find":" then n,c = class:match"^(.-):(.*)"end
class = mono_findClass(n,c)
end
return class
end
local function field2class(f)
if f.monotype == MONO_TYPE_CLASS then
return mono_type_getClass(f.field)
end
end
local function class2field(class)
local fs,field = mono_class_enumFields(findClass(class)),{}
for i=1,#fs do
local fi = fs[i]
field[fi.name] = fi
end
return field
end
local autofield
autofield= {
__len = function(me)return rawget(me,me).offset end,
__bnot = function(me)return rawget(me,me).offset end,
__index = function(self,k)
me = rawget(self,self)
if me.class and not me.field then
me.class = findClass(me.class)
me.field = class2field(me.class)
end
local f = me.field[k]
if not f then return end
local out = {offset = f.offset, class = field2class(f) }
if out.class then
out.field = class2field(out.class)
end
local this = {}
this[this] = out
return setmetatable(this,autofield)
end}
function monoAutoField(class)
if LaunchMonoDataCollector()==0 then return end
local self = {}
self[self] = {class=class}
return setmetatable(self,autofield)
end
|
usage:
make a global lua variable for the target class like:
Code: |
--sample game, Practical Flee
UM = monoAutoField"UnitManager"
|
then in AA, it can be use as:
Code: |
mov esi,[edi+$#UM.latheWeapon] // edi is base of class UnitManager
mov ebx,[esi+$#UM.latheWeapon.ammo] // esi is base of field latheWeapon, which is of class LatheWeapon
|
In memory record, it can be set as pointer address
offset 0: #UM.latheWeapon.ammo
offset 1: #UM.latheWeapon
base: some_base
(ie, no $)
'#'(length) can be replace with '~' (bitwise not), they are necessary to duel behavior of the field chain both as meta table and number.
bye~
_________________
- Retarded. |
|
Back to top |
|
 |
|