Asm call to mono-address

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
miraikolus
Expert Cheater
Expert Cheater
Posts: 52
Joined: Fri Jan 04, 2019 12:09 am
Reputation: 12

Asm call to mono-address

Post by miraikolus »

Now, I believe the following (simplified) should work, but is there anything better? celua and web didn't show anything but who knows .. some combination ..

Code: Select all

label(jitAddress)
registersymbol(jitAddress)
Jump:To:Address: //thanks to mono features
jitAddress:

newmem:
mov r11,[jitAddress]
call r11
Btw, can any1 explain me the purpose of the following (debugging only?):

Code: Select all

lea rax,[rax+rcx*8+20]
mov rax, [rax]

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1480
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 736

Re: Asm call to mono-address

Post by TheyCallMeTim13 »

Googled "ce mono lua", which lead to Mono - Lua Functions, and there listed is Mono:Lua:mono invoke method. So not really sure what you're trying to do it that wasn't it.

As for the ASM, it's using LEA (load effective address) to set RAX to the address, then moving the value at that address to RAX.
mov rax,[rax+rcx*8+20] is the same thing and would be faster.

miraikolus
Expert Cheater
Expert Cheater
Posts: 52
Joined: Fri Jan 04, 2019 12:09 am
Reputation: 12

Re: Asm call to mono-address

Post by miraikolus »

What I do want to do is easy, call a function I do know does what i want (on above code - of course i'd do checks & co, set parameters before, thus "simplified"). Now in LUA, there are few methods to resolve, at last i'll prob need registerSymbol while addr. needs to be conv. to int.
But I am act. looking for a more simple instruction in code, i mean both options do get executed before actual asm, but above will require less.

Yeah, I do know what lea does. I just don't get why unity does that ... is there some debug=0 val/cons not set or ....? (yeah this question is something different and requires some ... history with unity compil. & asm.

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1480
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 736

Re: Asm call to mono-address

Post by TheyCallMeTim13 »

miraikolus wrote:
Fri May 15, 2020 11:18 pm
What I do want to do is easy, call a function I do know does what i want (on above code - of course i'd do checks & co, set parameters before, thus "simplified"). Now in LUA, there are few methods to resolve, at last i'll prob need registerSymbol while addr. needs to be conv. to int.
But I am act. looking for a more simple instruction in code, i mean both options do get executed before actual asm, but above will require less.
...
I don't know if it's a language barrier or what. But that was painful to try and read, and after three tries I still don't understand what you're trying to say here.

As far as getting the address of a symbol just use getAddress or getAddressSafe.
miraikolus wrote:
Fri May 15, 2020 11:18 pm
...

Yeah, I do know what lea does. I just don't get why unity does that ...
Probably just something the compiler does.
miraikolus wrote:
Fri May 15, 2020 11:18 pm
... is there some debug=0 val/cons not set or ....? (yeah this question is something different and requires some ... history with unity compil. & asm.
Maybe but I have no idea, not really knowledgeable with the Unity Engine. But it might be defined and used in a way that the code that uses it is only compiled in a development version, thus it wouldn't even be in the release version; which would make for better optimization of the game at release. But again, not really sure.

panraven
Table Makers
Table Makers
Posts: 49
Joined: Fri Mar 03, 2017 12:03 am
Reputation: 32

Re: Asm call to mono-address

Post by panraven »

You can enclose the symbolic address with double quote to force interpret the content as address,
it should work in general not just mono.
call "Jump:To:Address"
--
the memory addressing like [rax+rcx*8+20] may be a form to access an item in an array type.
For instance, it is the item with size 8 (so *8) base zero index rcx whose 1st element is in address rax+20.
For mono, usually the array length may be locate -8 offset from its 1st element, eg. rax+18 .
But it should be read in context with up and down codes.

Lea may also to do simple constant multiply on registers, usually several Lea run together.

miraikolus
Expert Cheater
Expert Cheater
Posts: 52
Joined: Fri Jan 04, 2019 12:09 am
Reputation: 12

Re: Asm call to mono-address

Post by miraikolus »

But it might be defined and used in a way that the code that uses it is only compiled in a development version, thus it wouldn't even be in the release version; which would make for better optimization of the game at release. But again, not really sure.
That's what i mean, it is a released game. So I do wonder why. May they just forgot to disable those dev flags. But any way, that was just my curiosity.
panraven wrote:
Sat May 16, 2020 1:21 am
call "Jump:To:Address"
.... right clear. I never had to use that for unity up to now. But it's clear that this is an option. Thanks, that's what I did need.

As for the other options - thanks for the note. But I do know generally and in that game exactly what each of the registers stand for and instructions do. It was just as written to TheyCallMeTim13, that I don't know why the extra effort. Yeah, sometimes you want to get the addr ... mostly to store in some other memory addr . But storing in a register, next you do store the pointed addr into same register is .....
Any way, those explanations might do help others.

Post Reply

Who is online

Users browsing this forum: No registered users