..:: PCSX2 Forums ::..

Full Version: Creating compact/condensed codes.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've been looking into creating compact codes, rather than having 50 lines for one particular code.

I know how it works for BSD (PS3 Bruteforce codes).

Example how it works for PS3 codes:

Code:
4TXXXXXX YYYYYYYY
4NNNWWWW VVVVVVVV

X= Address/Offset
Y= Value to write (Starting)
N=Times to Write
W=Increase Address By
V=Increase Value By
T=Address/Offset type
Normal/Pointer
0 / 8 = 8bit [FF]
1 / 9 = 16bit [FFFF]
2 / A = 32bit [FFFFFFFF]

So for example you have the codes:
Code:
20010A11 0000FFFF
20010A12 0000FFFF
20010A13 0000FFFF
20010A14 0000FFFF
20010A15 0000FFFF
20010A16 0000FFFF
20010A17 0000FFFF

This code would be compressed to:

Code:
42010A11 0000FFFF
40070001 00000000

(Starts at Offset 10A11, and writes it 7 times from that position, each time skipping only 1 byte, basically writing over all the offsets from the uncompressed code).

I've tried the same method for PCSX2 (RAW codes), but there seems to be a different method to it there. Does anyone know how it works exactly for the RAW codes in pnach files?


Let's take a code here for example for Star Ocean 3 (Max IC Skills for Fayt):

Code:
00501E50 000000FF
00501E51 000000FF
00501E52 000000FF
00501E53 000000FF
00501E54 000000FF
00501E55 000000FF
00501E56 000000FF
00501E57 000000FF

If I went with the 'PS3' style, it'd become:

Code:
40501E50 000000FF
40080001 00000000

But this isn't the case with PCSX2 RAW codes. If I could figure this one out I could create some updated codes that are normally really long.

I know it should be doable, because I've seen it done on some Codebreaker codes. (particularly CBv7+ codes). These can all be converted to proper RAW codes and they'll work flawlessly. I just can't figure out how they've done it.
I am surely not an expert but how would the program know that in the first line (4TXXXXXX YYYYYYYY) you want to find the address XXXXXX and in the second line (4NNNWWWW VVVVVVVV) the dynamic offset NNNWWWW and not the direct address NNWWWW?

To my knowledge each line is treated completely separated...


Edit:

Ah wait... obviously the 4 indicates connected lines? Then disregard me...

It is actually explained here

So it would be more like:
Code:
42010A11 00070001
0000FFFF 00000000
That's where the "NNN" part is for.

You're basically telling the program to write 3 times, with a byte difference of xx times (WWWW)

[12 characters have 9999 to their current HP]
Code:
100000AA 0000270F
100000AB 0000270F
100000AC 0000270F
100000AD 0000270F
100000AE 0000270F
100000AF 0000270F
100000B0 0000270F
100000B1 0000270F
100000B2 0000270F
100000B3 0000270F
100000B4 0000270F
100000B5 0000270F

[Compressed]
Code:
410000AA 0000270F
400[C]000[1] 00000000

C = 12 lines of code originally (In hex, not dec)
1 = Every time you're writing 1 byte further. So it writes at AA, AB, AC, etc.

If I were to set that to 2 instead, it would write at AA, AC, AE, etc.


I've seen some codes out there for codebreaker that did the same method. On old CB codes (prior to v7), you'd have like 12 lines of code, and then with v7+ they were able to compress/compact that same code using an alternate method similar to the BSD method that I described above. That's basically how you're telling the program to write to various offsets.


But yeah, I'm not an expert on the compact codes either. That's why I'm hoping it can be figured out to make more advanced codes that don't require 500 lines of code. Wink


[Edit]
Wow.. just as I posted this I noticed your Edit, oops.
(10-04-2014, 02:39 PM)xRyudo Wrote: [ -> ]Wow.. just as I posted this I noticed your Edit, oops.

well my first post was obviously wrong...

Does it work now?
From what I read(I didn't read it all),I've seen some errors.

4 type codes are always modifying 4 addresses
The second digit as you said it,is not the code type,after the digit 4 is the address of the code excluding the first digit of it.

For example:
01A00000 12345678
11A00000 12345678
21A00000 12345678

Will always be
41A00000
and will act as
21A00000


4aaaaaaa xxxxyyyy
dddddddd 00000000
Starting with the address specified by aaaaaaa, this code will write to xxxx addresses. The next address is determined by incrementing the current address by (yyyy * 4). The value specified by dddddddd is written to each calculated address. Also known as a "Patch Code."

And here is a nice tool
http://www.codemasters-project.net/porta...hp?view.43
According to that tool you linked..

Code:
00501E50 000000FF
00501E51 000000FF
00501E52 000000FF
00501E53 000000FF
00501E54 000000FF
00501E55 000000FF
00501E56 000000FF
00501E57 000000FF

Becomes:

Code:
40501E50 00080000
000000FF 00000000

I'm going to test this out on a clean save, to see if it works


[Edit]

Well.... didn't work as I intended it to.

[attachment=52644]


When I use the non condensed version of the code it works fine. This is weird though, it should definitely be working. :/
Actually that code can be reduced to this
20501E50 FFFFFFFF
20501E54 FFFFFFFF

It's been a while since I make any cheats and used that program so I'm not 100% sure how it was working

When the codes you want to make a condensed code for,the address increment is 1 or 2 bytes,you must write the complete value in the row below 4
Huh. That actually worked. Wonder why the tool gave me the 4XXXXXXX code instead.

I guess it's because it's not a 32-bit code but rather an 8-bit code or something.

[Edit]

Let's try this code now for Kingdom Hearts 2 (Max Stats Sora, Donald, Goofy, Mickey)

Code:
0033FEC5 00000078
0033FEC7 00000078
0033FEC9 00000078
0033FECA 00000078
0033FECB 00000078

0033FFB9 00000078
0033FFBB 00000078
0033FFBD 00000078
0033FFBE 00000078
0033FFBF 00000078

003400AD 00000078
003400AF 00000078
003400B1 00000078
003400B2 00000078
003400B3 00000078

003401A1 00000078
003401A3 00000078
003401A5 00000078
003401A6 00000078
003401A7 00000078

(Well technically it's just 120 in all stats, HP included, but I'm just using it as an example code atm.)

I think with this particular setup, you'd probably get a few lines still, because the offset values change with each character. But the increment for each Stat per character is still only 2 bytes.

I think... for the first character it would become:

Code:
2033FEC5 78787878
0033FEC5 00000078
Nope,you can't use that.
With the code above you are setting 78(hex value)to addresses such as
0033FEC6
0033FEC8
and the second line in your code is pointless because you already set 78 to 0033FEC5

Maybe tadatata will tell you how it works(when I don't use something for a long time,I start to forget how it works).
I can do some testing to see how it works but I can't right now.
Ahh alright. Thanks for helping so far at least.

And yeah you're right that above code didn't work. Sadly. Requires some more testing!

[Edit]

Ok, some more testing complete.

Code:
0033FEC5 000000C8
0033FEC7 000000C8

These 2 codes are for HP and MP.

Code:
0033FEC9 000000FF
0033FECA 000000FF
0033FECB 000000FF

These are for Stats (STR, MAG, DEF)

With the condensed code for stats I came up with: (ignore the FF instead of 78 from my previous post, I just went with FF for true max stats lol, and that way I can distinguish stats from HP&MP which is set to 200)
Code:
2033FEC9 00FFFFFF

This seemed to work fine in the game. My stats were boosted and nothing else seemed to have changed.

Haven't been able to get the HP/MP code to be condensed though.

So far the code went from 5 lines, to 3 lines:

Code:
0033FEC5 000000C8
0033FEC7 000000C8
2033FEC9 00FFFFFF



[Edit 2]

The original code (20 lines):

Code:
0033FEC5 000000C8
0033FEC7 000000C8

0033FFB9 000000C8
0033FFBB 000000C8

003400AD 000000C8
003400AF 000000C8

003401A1 000000C8
003401A3 000000C8

0033FEC9 000000FF
0033FECA 000000FF
0033FECB 000000FF

0033FFBD 000000FF
0033FFBE 000000FF
0033FFBF 000000FF

003400B1 000000FF
003400B2 000000FF
003400B3 000000FF

003401A5 000000FF
003401A6 000000FF
003401A7 000000FF


Condensed code, SO FAR (12 lines):
Code:
0033FEC5 000000C8
0033FEC7 000000C8

0033FFB9 000000C8
0033FFBB 000000C8

003400AD 000000C8
003400AF 000000C8

003401A1 000000C8
003401A3 000000C8

2033FEC9 00FFFFFF
2033FFBD 00FFFFFF
203400B1 00FFFFFF
203401A5 00FFFFFF

Now to figure out a method for the HP/MP codes.. If that's even remotely possible.

Did manage to condense a code of 45+ lines for the other codes to a mere 27. So that's some progress.


[Edit 3]

Here's another code that does work now. (Seems to work fine so far at least, tested out on 9 out of 13 characters).

Code:
0033FEC8 000000FF
0033FFBC 000000FF
003400B0 000000FF
003401A4 000000FF
00340298 000000FF
0034038C 000000FF
00340480 000000FF
00340574 000000FF
00340668 000000FF
0034075C 000000FF
00340850 000000FF
00340944 000000FF
00340A38 000000FF


The offset value has an increment of F4.
The code consists of 13 lines (0xD)

Going by the rule of
Code:
4AAAAAAA XXXXYYYY
DDDDDDDD 00000000

XXXX = 13 lines of code (D) (000D)
YYYY = Increment * 4 = 3D0 (003D)

First line would then be: 4033FEC8 000D003D

DDDDDDDD = Value, which I want maxed for AP, so that's 000000FF

Second line would then be 000000FF 00000000

Final code:
Code:
4033FEC8 000D003D
000000FF 00000000

^This seemed to work good. Haven't run into bad values yet in the game itself.

So that's a code of 13 lines condensed to just 2. Smile