RPCS3 / rpcs3

PS3 emulator/debugger
https://rpcs3.net/
GNU General Public License v2.0
14.5k stars 1.85k forks source link

[Feature request] Constant write, pointers and conditionals for patches #15513

Open zzamizz opened 3 weeks ago

zzamizz commented 3 weeks ago

Quick summary

Details

Constant write

Patches in RPCS3 currently only write the value once, which is fine for every single patch currently as they only edit game code with assembly. However for mods it is very limiting to not be able to freeze a certain (live) in-game value through a patch.

"Freezing an address" means ticking on the "Active" tickbox on an address in Cheat Engine. It will constant write a value into the address and won't let anything else write into it furthermore.

Pointers

Here's an example of how it could be formatted: - [ bep32, 0x0034839C, 0x64, 0x30, 0x3FC00000 ] The line above specifies a base address of 0x0034839C, with 0x64 as first offset and 0x30 as second offset, then writes 0x3FC00000 into the pointed address.

Conditionals

Tests an address' value before executing a line after it. This is how the PCSX2 emulator does it: patch=1,EE,E0010301,extended,004302A4 patch=1,EE,20CF402C,extended,014019C0

Here's an example of NetCheat's conditional value type:

E -- comparison mask unset Reads the number of bytes v contains from a and ands it with v. If that logical AND v is equal to v it will execute the count >number (hex) of lines below it. So pretty much if the bits in v, are set in a, it will execute. D comparisons will execute if the bits in v are the only bits set at a. if ((intB & intA) == intA) From misc.ArrayCompare E type codes must be constantly written!

E[COUNT] aaaaaaaa vvvvvvvv

Example: E2 00B122F8 00000044 0 010D4568 3E000000 1 0125CCA4 Activated

Finishing thoughts

I personally think it has been a long time coming for these features being added to RPCS3's patch system. For any doubt, I'd strongly recommend looking at NetCheat/Artemis for PS3, which has been utilizing these value types for many years: https://github.com/Dnawrkshp/NetCheatPS3/blob/master/Code%20types.txt https://ps3.aldostools.org/codelist.html