rpcs3 icon indicating copy to clipboard operation
rpcs3 copied to clipboard

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

Open zzamizz opened this issue 9 months ago • 0 comments

Quick summary

  • Constant write (otherwise known as "freezing" in Cheat Engine)
  • Pointers (add pointer write, lets specify pointer offsets and then write to the pointed address)
  • Conditionals ("if" statement, tests a certain value in an address before executing the next line)

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

  • 01 specifies the amount of lines that will be executed after the test passes.
  • 0301 is the value to be tested
  • 004302A4 is the address that is being tested So, as soon as address 0x004302A4 holds the value 0x301, the test passes and the value 0x014019C0 will be written into address 0x00CF402C

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

zzamizz avatar Apr 27 '24 10:04 zzamizz