Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zzamizz opened this issue Apr 27, 2024 · 0 comments
Open

Comments

@zzamizz
Copy link

zzamizz commented Apr 27, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant