NOP'ing an instruction

TylerMods

Administrator
Staff member
Admin
Developer
Aug 11, 2019
16
12
3
This is the most basic thing to do in ASM when creating mods. Sometimes it's ok and it doesn't break anything, other times it is not ok and it breaks other things in the game. I am going to do a demonstration on this working just fine, continuing from my PS4 Reaper Memory Scanning Tutorial.

1600516024497.png so I have set my value to 99, reloaded twice and now have 97 as you seen before. We are going to stop this number from decreasing. Not only should this work for handgun ammo, it should work for all types of ammo. But that is no guarantee. Sometimes all of the same type of something is not linked to the same instruction in the ASM.

First thing I want to do is take the address from my memory scan that is relative to the value of my ammo.
1600516163135.png
My address here is 2009407DE. So I want to copy that address and paste it in the Memory Control Address Box.
1600516236441.png
Next you want to click the debugger tab located at the bottom left of the program.
1600516292847.png1600516301142.png
You should then get the following box.
1600516368087.png
For the Length... this is how many bytes you scanned for. I started with 1 and scanning for clip ammo but came to a realization so had to scan for inventory ammo and I scanned 2 bytes so I am going to do LEN_2.
1600516446554.png
EXEC - Every code that has the Execute permission, meaning you can execute it.
WRONLY - Every code that has the Write Only permission, meaning you can write changes to it.
RDWR - Every code that has the Read and Write permission, meaning you can read and write changes to it.

Typically we use WRONLY so I am going to here.
Once you click "Set". You can now use your item/lose your health/spend your money. Whatever you are looking for. In my case it would be, reload my inventory ammo into my gun.
1600518303062.png
If you successfully hit a watchpoint, this screen will pop up. These are called registers. Addresses and values are stored in these. The list on the right are for floats. Your game will freeze when you do this. Do not panic and reboot. It is not actually "frozen" so much as PS4 Reaper just has your game process paused... once you click No... your game will resume.
Just click the No box.
1600518522911.png
You will see in the debugger box, this row appears. Your instruction will not look the exact same. I want to take this address and put it in the Memory Control Address Box.
1600518597966.png
Then click the tools icon I have put a red square around.
1600518634218.png
This... is ASM. Aka. Assembly. The blue row will always be the row UNDER the address you put in the Memory Control Address Box.
Before I continue with the NOP... while we are here.. I want to show there is more than 1 way to get infinite ammo here.
I see the instruction "sub ecx, eax". Sub means subtract and it contains ecx where the instruction below it has cx at the end. So my guess is, that sub instruction is telling your game to subtract your ammo when you load it into your clip. If we change sub to add, it will add the ammo to your inventory instead of subtract it. If we nop it, it will probably stop it from decreasing. Let me explain why I would rather NOP this line instead of the main line. This is a sub only line. So if I nop it, it will prevent you from losing ammo but will still let you gain ammo. If I nop the mov line, it will most likely prevent you from losing AND gaining ammo.

So let's go ahead and nop this "sub ecx, eax" instruction. To do so, click on it.
1600519090417.png
Then right click it and click Assembler.
1600519101551.png
1600519120731.png
You now want to replace the highlighted text with "nop" and click Analyse.
1600519151942.png
You now see we have some bytes in the 2nd text box. If you get "invalid". It means your first text box has an invalid instruction in it.
You can now click Send Data.
1600519201487.png
This is your first pop-up. Click Yes.
1600519219783.png
Give your mod a name. I chose to name mine, "Infinite Inventory Ammo".
1600519263226.png
Head over to the Trainer Maker tab. You will see your mod you just made listed. Go ahead and check this box to enable it.
1600519311042.png
If the code was written to your PS4 Game. You will see this notification.
I have tested this code by shooting, reloading, then checking to see if my inventory ammo count has decreased, and it has not. So we are successful in making this cheat.

I would recommend after making a cheat, seeing what else it effects. See if it effects other items in your inventory. See if your Infinite Health also gives Infinite Stamina or even Infinite Items. A lot of times Ammo and Items will use the same instruction. It is important to pay attention to what is all effected so you can let the people that are going to use your mod know.

You can now save your mod you just created into a shn file that you can send to me, TylerMods and I will do what I do then upload it to the Web Trainer for all.
1600519984753.png
Click the save icon on the right.
1600520032816.png
You will get this. Enter the Game Name, Enter your name. Then select a Game Type. Then click Validate.
1600520082664.png
Choose where you want to save it and do so. Please do not edit the name of this file for my sake if you plan on sending it to me.

This completes our NOP'ing tutorial. I hope this is of help for you all :)
 
Last edited: