.pnach files with text strings?
#1
I'm trying to create a .pnach cheat file with text strings instead of numbers.  I've tried converting the text to numbers, but I get weird values like "11346653 //66" which don't work.  Is there a way to add addresses with text strings such as "20300045 splashscreen" into pnach files without converting them into numbers?
Reply

Sponsored links

#2
That is not how patches work. The pnach format is as follows:
Code:
patch=[mode],[cpu],[address],extended,[value]

A practical example:
Code:
patch=1,EE,20289db0,extended,24040000

[mode] is the method of which the patch is applied. 0 is only once at boot, 1 is every CPU cycle.
[cpu] is the PS2 CPU whose memory space should be modified. I have yet to see the IOP be patched, as it really only runs input/output devices and has little impact on gameplay in most cases.
[address] is the memory address to write to. This is a four byte, 32 bit integer in hexadecimal. Note since the PS2 memory space is not large enough to use the fourth, most significant byte, this byte is ignored when mapping to PS2 memory. Instead, the pnach format uses the leading digit to specify how many bytes to write at the address. Leading the address with 0 will only write the least significant byte, leading with 1 will write the two least significant bytes, and leading with 2 (as in my example) will write all four bytes.
[value] is the new contents for the above address. This is also a four byte, 32 bit integer in hexadecimal.

When patching, you are replacing arbitrary bytes of data with new ones. There is no magical "make this text please" option. If you are trying to replace string literals, you will need to convert your replacement text to the raw bytes that correspond to the characters in the text. A quick Google search is all it takes to find an ASCII table.
Reply
#3
I don't think I explained it well enough. For example, let's just say that address 20001000 is a String with a value of "levelone". How do I create a pnach file that changes that string to "testlevel"?
Reply
#4
Like pandubz explained you need convert ascii to hex. Assuming that string is at address 0x100000

patch=1,EE,20100000,extended,74736574 //tset
patch=1,EE,20100004,extended,6576656c //evel
patch=1,EE,00100008,extended,0000006c //l
// byte reversed because pnach require BE, and byte swap it to LE, strings are already BE in elf, so swap mess them.

Keep in mind that if string is longer than one you are replacing, you possible overwrite something else, and you also probably need 0 terminator at end. So last patch will be then:

patch=1,EE,10100008,extended,0000006c //l + 00 ascii C terminator.

Is better to replace strings directly on disc, and with same size as current string, otherwise you can be forced to move string to different part of memory. That require editing pointer, or code itself.
Reply




Users browsing this thread: 1 Guest(s)