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 


Is there a way to make trainer for both 32 and 64 bit game?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 96

PostPosted: Tue Nov 29, 2016 3:27 am    Post subject: Is there a way to make trainer for both 32 and 64 bit game? Reply with quote

Some unity game may publish two version,and right now I have to make 2 seperate trainer for each version,so Is there a way to make it all in one?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25288
Location: The netherlands

PostPosted: Tue Nov 29, 2016 4:16 am    Post subject: Reply with quote

you can write two trainers and combine them into one. just check to see if the target is 64 or 32 bit, and then inject the apropriate script
_________________
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
View user's profile Send private message MSN Messenger
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Tue Nov 29, 2016 4:29 am    Post subject: Reply with quote

Look here for examples.
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Tue Nov 29, 2016 7:11 am    Post subject: Reply with quote

The [32-bit] etc tags only work for target-self (ce process)?

Code:

local script = [[
globalalloc(__,$4000)
[32-bit]
__+10:
db 32
[/32-bit]
[64-bit]
__+20:
db 64
[/64-bit]
]]
print(tostring(autoAssemble(script,true)))
print(tostring(autoAssemble(script,false)))
--output:
true
false


Could it be extended to not limiting to ce script?

bye~

_________________
- Retarded.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Tue Nov 29, 2016 8:20 am    Post subject: Reply with quote

Edit:

Yes. For now only targetself and AACustomTypes.
Code:
    if targetself then
      Stripcpuspecificcode(tempstrings);


We can write a function which will iterate all scripts and strip cpu specific code...
Or just use {$Lua} blocks with function targetIs64Bit()




Quote:
Could it be extended to not limiting to ce script

I think it is possible to add something similar for "not selftarget"'s.

Below script should add those tags:
Code:
local function stripCPUspecificCode(origscript, syntaxcheck)
  local inexcludedbitblock=false
  if targetIs64Bit() then
    for i=0,origscript.Count-1 do
      local s = origscript[i]:lower()
      if s:match('^%s*%[32%-bit]')  then origscript[i]=''; inexcludedbitblock=true
  elseif s:match('^%s*%[/32%-bit]') then origscript[i]=''; inexcludedbitblock=false
  elseif s:match('^%s*%[64%-bit]')  then origscript[i]=''
  elseif s:match('^%s*%[/64%-bit]') then origscript[i]='' end
      if inexcludedbitblock         then origscript[i]='' end
    end
  else
    for i=0,origscript.Count-1 do
      local s = origscript[i]:lower()
      if s:match('^%s*%[64%-bit]')  then origscript[i]=''; inexcludedbitblock=true
  elseif s:match('^%s*%[/64%-bit]') then origscript[i]=''; inexcludedbitblock=false
  elseif s:match('^%s*%[32%-bit]')  then origscript[i]=''
  elseif s:match('^%s*%[/32%-bit]') then origscript[i]='' end
      if inexcludedbitblock         then origscript[i]='' end
    end
  end
end

if addedFeature_StripCPUspecificCode==nil then
 addedFeature_StripCPUspecificCode = registerAutoAssemblerPrologue(stripCPUspecificCode)
end

_________________


Last edited by mgr.inz.Player on Wed Nov 30, 2016 7:36 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Tue Nov 29, 2016 7:07 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
Edit:
...
Below script should add those tags:
Code:
local function stripCPUspecificCode(origscript, syntaxcheck)
...
end


Thanks , it work tested on ce 64/32 on 64/32 target.

Curious that Prologue is not applied on target-self script, but registerAutoAssemblerCommand is applied both on target-self and not~

bye~

ADDED:
the for i should start with 0, or if the tag start at 1st line, the tag will not be remove an cause script not executed.

_________________
- Retarded.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Wed Nov 30, 2016 7:36 am    Post subject: Reply with quote

"the for i should start with 0"
You are right. A typo. Fixed.

_________________
Back to top
View user's profile Send private message MSN Messenger
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 96

PostPosted: Wed Nov 30, 2016 11:43 am    Post subject: Reply with quote

any cheattable using this?I try to write lua and asm,but something went wrong.

Code:

{$lua}
LaunchMonoDataCollector()
mono_symbolLookupCallback("HealthBar:HealthBarChange")


{$asm}

define(InfHP_Entry,"HealthBar:HealthBarChange"+14c)
define(InfHP_bytes, D9 80 6C 03 00 00)

[ENABLE]
assert(InfHP_Entry, InfHP_bytes)
globalalloc(InfHP_Code,0x1000)

InfHP_Code:

//This will be wrong if I check 64bit
{$lua}
if targetIs64Bit() == nil then

{$asm}
mov [eax+00000370], (float)200.0
mov [eax+0000036c], (float)200.0

{$lua}
end


//fld dword ptr [eax+00000370]
//fstp dword ptr [eax+0000036c]
fld dword ptr [eax+0000036c]


jmp InfHP_Exit

label(InfHP_Exit)

InfHP_Entry:
jmp InfHP_Code
nop

InfHP_Exit:

[DISABLE]
InfHP_Entry:
db InfHP_bytes




If I don't check 64 bit,it works all right.
So what's wrong?how can I make it correct?

Code:

{$lua}
LaunchMonoDataCollector()
mono_symbolLookupCallback("HealthBar:HealthBarChange")


{$asm}

define(InfHP_Entry,"HealthBar:HealthBarChange"+14c)
define(InfHP_bytes, D9 80 6C 03 00 00)

[ENABLE]
assert(InfHP_Entry, InfHP_bytes)
globalalloc(InfHP_Code,0x1000)

InfHP_Code:




{$asm}
mov [eax+00000370], (float)200.0
mov [eax+0000036c], (float)200.0




//fld dword ptr [eax+00000370]
//fstp dword ptr [eax+0000036c]
fld dword ptr [eax+0000036c]


jmp InfHP_Exit

label(InfHP_Exit)

InfHP_Entry:
jmp InfHP_Code
nop

InfHP_Exit:

[DISABLE]
InfHP_Entry:
db InfHP_bytes
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Wed Nov 30, 2016 12:20 pm    Post subject: Reply with quote

Lua code is executed first. Then all lines with Lua code are removed (or replaced with text Lua code returns).
Then AA script is analyzed and then executed.

Code:
...
...

InfHP_Code:

{$lua}
  if targetIs64Bit() then
    return [[//code for game,
             //if it is a 64bit application
             mov [rax+44],(float)1000]]
  else
    return [[//code for game,
             //if it is a 32bit application
             mov [ecx+20],(float)1000]]
  end
{$asm}

fld dword ptr [eax+0000036c]
jmp InfHP_Exit


...
...

_________________
Back to top
View user's profile Send private message MSN Messenger
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Wed Nov 30, 2016 12:26 pm    Post subject: Reply with quote

targetIs64Bit() return true or false,
In Lua 'nil' and 'false' behave the same in boolean operation, but they are not the same value, so equality test false == nil will return false.
Since targetIs64Bit() return either true or false,
targetIs64Bit() == nil will never be true.

Use "if targetIs64Bit() then ... " should make the proper test.

-----

Also , each {$lua}....{$asm} block should form complete scope.
The following is not valid
Code:

{$lua}
if targetIs64Bit() == nil then --- no end in this block, syntax error

{$asm}
mov [eax+00000370], (float)200.0
mov [eax+0000036c], (float)200.0

{$lua}
end        --  only end in this block, syntax error


Lua block can act as textual template if the Lua block return a string:

Code:

{$lua}
if targetIs64Bit() then
--  [[ ]]  is lua long text quote
  return [[
   AA 64-bit code
]]
else
  return [[
   AA 32-bit code
]]
end
{$asm}




Why not try mgr.inz.Player's solution?

_________________
- Retarded.
Back to top
View user's profile Send private message
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 96

PostPosted: Wed Nov 30, 2016 2:06 pm    Post subject: Reply with quote

Thanks guys,works well in CE right now.

The final problem is How to generate an exe trainer for both 32 and 64 bit version?

Generate generic trainer lua script from table
This seems only one type of process can be used.32 or 64 only one can be selected.
How to export trainer for both version?
Where should I change or customize?The process name may and may not be the same.Most of them are the same.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Wed Nov 30, 2016 2:23 pm    Post subject: Reply with quote

If you select "64bit", it will work for 32bit and 64bit targets. But only on 64 bit OS.

If you select "32bit", it will work on both OSes, 32bit and 64bit. But only for 32 bit targets.


Or generate "tiny". End user must have CE installed.

_________________
Back to top
View user's profile Send private message MSN Messenger
mindoff
Advanced Cheater
Reputation: 0

Joined: 12 Jun 2016
Posts: 96

PostPosted: Wed Nov 30, 2016 3:25 pm    Post subject: Reply with quote

Thank you so much,mgr.inz.Player.
select 64 bit is what I need Very Happy
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 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