Calling Function/Activating Functionality

Memory scanning, code injection, debugger internals and other gamemodding related discussion
Post Reply
User avatar
arlight1
Fearless Donors
Fearless Donors
Posts: 41
Joined: Tue Apr 25, 2017 12:04 am
Reputation: 5

Calling Function/Activating Functionality

Post by arlight1 » Sun May 14, 2017 8:14 pm

In Mass Effect Andromeda there is a skill the player can activate that allows the player to see all enemies through walls, makes them glow red, and increases bullet penetration.

I was able to find bytes that control whether enemies glow/are visible through walls. I did so by toggling the skill and searching a 0 or 1 depending on if I could see them. How can I make a script that does the same thing in place of activating the skill? I'd like to make it so that when I activate the script, all the enemies become visible in the same manner as activating the skill. Is there any way to do this?

Freezing the byte makes enemies still visible through walls as the skill expires, but new enemies are new addresses of bytes and must be found and toggled themselves. I've attempted tracing the code to find which comparison makes it run the code that enables that, but reversing the logic causes a crash. Any ideas?

Edit: Oh and the code that checks if the byte is a 0 or 1 and enables the functionality also handles other addresses that deal with rendering player body, world objects, etc. so a script that makes all the address to a 1 causes weird things to happen.

User avatar
++METHOS
Administration
Administration
Posts: 190
Joined: Thu Mar 02, 2017 9:02 pm
Reputation: 20

Re: Calling Function/Activating Functionality

Post by ++METHOS » Mon May 15, 2017 1:41 am

You need to learn how to properly segregate code. You have the instruction that checks for the toggle -- assuming that the boolean value works, as you say, then the instruction that handles those values is where you want to look at injecting your script. Last step of the CE tutorial covers this...but, there are better ways for setting up a compare. I have posted examples on this forum and on CEF.

User avatar
arlight1
Fearless Donors
Fearless Donors
Posts: 41
Joined: Tue Apr 25, 2017 12:04 am
Reputation: 5

Re: Calling Function/Activating Functionality

Post by arlight1 » Thu May 18, 2017 2:26 pm

++METHOS wrote:
Mon May 15, 2017 1:41 am
You need to learn how to properly segregate code. You have the instruction that checks for the toggle -- assuming that the boolean value works, as you say, then the instruction that handles those values is where you want to look at injecting your script. Last step of the CE tutorial covers this...but, there are better ways for setting up a compare. I have posted examples on this forum and on CEF.
My explanation of the problem was poor. I have the code that checks the booleans and makes something happen (enemies visible or not). I was able to inject there and force the bytes to stay at a value of 1 constantly. The problem is, that code is only called when the player activates a skill. Is there any way to make it happen prior to that? Would I have to go into calling functions/that code manually to force those booleans to toggle?

User avatar
++METHOS
Administration
Administration
Posts: 190
Joined: Thu Mar 02, 2017 9:02 pm
Reputation: 20

Re: Calling Function/Activating Functionality

Post by ++METHOS » Thu May 18, 2017 5:29 pm

Ah. I see. In that case, yes, you may need to call (or jump to) that sub-routine manually. There are a few ways to do this, but before making things complicated, I would first look to see if there are any values within the same data structure that are being accessed by a more desirable instruction that you hook instead.

In other words -- find one of the 'boolean' addresses and dissect its data structure. Within that structure, you'll be able to add ALL of the other addresses to your table and right-click on each one of them to see if there is an instruction that is constantly accessing them. If you find one, you can check to see if the instruction is also accessing all of the other 'boolean' data structures. If you find one that satisfies both requirements, you can hook that instruction instead, and you should be able to instantly/constantly manipulate all of the boolean values from there.

User avatar
arlight1
Fearless Donors
Fearless Donors
Posts: 41
Joined: Tue Apr 25, 2017 12:04 am
Reputation: 5

Re: Calling Function/Activating Functionality

Post by arlight1 » Fri May 19, 2017 12:24 am

++METHOS wrote:
Thu May 18, 2017 5:29 pm
Ah. I see. In that case, yes, you may need to call (or jump to) that sub-routine manually. There are a few ways to do this, but before making things complicated, I would first look to see if there are any values within the same data structure that are being accessed by a more desirable instruction that you hook instead.

In other words -- find one of the 'boolean' addresses and dissect its data structure. Within that structure, you'll be able to add ALL of the other addresses to your table and right-click on each one of them to see if there is an instruction that is constantly accessing them. If you find one, you can check to see if the instruction is also accessing all of the other 'boolean' data structures. If you find one that satisfies both requirements, you can hook that instruction instead, and you should be able to instantly/constantly manipulate all of the boolean values from there.
That's exactly what I was looking for! Thanks a lot for your help Methos. :D

User avatar
arlight1
Fearless Donors
Fearless Donors
Posts: 41
Joined: Tue Apr 25, 2017 12:04 am
Reputation: 5

Re: Calling Function/Activating Functionality

Post by arlight1 » Fri May 19, 2017 5:17 am

++METHOS wrote:
Thu May 18, 2017 5:29 pm
Ah. I see. In that case, yes, you may need to call (or jump to) that sub-routine manually. There are a few ways to do this, but before making things complicated, I would first look to see if there are any values within the same data structure that are being accessed by a more desirable instruction that you hook instead.

In other words -- find one of the 'boolean' addresses and dissect its data structure. Within that structure, you'll be able to add ALL of the other addresses to your table and right-click on each one of them to see if there is an instruction that is constantly accessing them. If you find one, you can check to see if the instruction is also accessing all of the other 'boolean' data structures. If you find one that satisfies both requirements, you can hook that instruction instead, and you should be able to instantly/constantly manipulate all of the boolean values from there.
As it turns out, there were some address in the structure that were constantly being accessed/written that only pertain to the address I want to modify. However, it doesn't affect ALL of them. There are plenty of instruction that constantly access the structure, unfortunately, when I do "Find out what addresses this instruction accesses" it returns many, like 50+. I guess I'm back to jumping to that sub-routine manually as you described :( how do I do this? This is something I have never touched in the past.

User avatar
++METHOS
Administration
Administration
Posts: 190
Joined: Thu Mar 02, 2017 9:02 pm
Reputation: 20

Re: Calling Function/Activating Functionality

Post by ++METHOS » Fri May 19, 2017 6:06 am

It was my understanding that you wanted to be able to set ALL Boolean values, not just the one. That being said, the instruction that you find should access many addresses. Can you clarify what it is that you are trying to do here?

By the way, when you check to see which instructions access an address, you can right-click inside of the debugger window to 'check if found opcodes...', and this will show you if any instructions access 1 or more addresses. This will save you much time, depending on what your are trying to do.

I would still recommend doing this the easy way, if possible. If you determine that it is not possible, then you can look at jumping to/calling whatever sub-routine is needed.

Post Reply

Who is online

Users browsing this forum: No registered users