kozarovv
Developer
Great idea with "compressing" multi versions game configs. Small tip for 0x12.I have been looking for a way for a standardisation of the config files meant for different versions having the same licence code, for example Wrath of Cortex, Silent Hill 2, Star Wars: Battlefront II, etc. To goal is to have a single config containing working patches for the both versions. If someone has noticed, the WRC 4 PAL config already did have a three 0x09 commands inside. Let's make it clear, the ps2_netemu has got a maximum amount of usage of the commands (most of them are already discovered and specified on the "PS2 Emulation" page in the wiki). For example, we are limited to the max 32 patches of the EE memory using either the 0x09 or 0x0A command (mixing them will make the emulator hang. As well as exceeding the patch count). Here is the link for the WRC 4 PAL config:
https://www.psx-place.com/threads/compatibility-list-ps2-on-ps3.1306/page-231#post-303815
First "09 00 00 00 10 00 00 00" command is a straight copy from the gxemu config. The 10 is a hexadecimal number, so we have got a 16 patches there. Since this game needs a rearrangement of the branch opcodes, otherwise it would not boot at all, Sony has included a patches for the both versions - original and a Platinum one. It is working well, because the patch commands are looking for the original value before the replacement, therefore there is no chance of applying the patches to the wrong version of the game. Thanks to it, we can include the patches for the every version in a single config! As long as there is a room for them, and truly speaking, the WRC 4 config already does utilize the maximum amount of them (Valkyrie Profile 2 being just a little behind with a 31 patches). Their executable files are packed, so we cannot apply additional patches using the 0x0B command unfortunately. A 0x42 written hook would be needed to do so.
Okay, we have got a second "09 00 00 00 08 00 00 00" command. The patches for the original (v1.01) version are there. And the last "09 00 00 00 08 00 00 00" command contains the patches for the Platinum (v2.00) version. It turns out you can use as many separate 0x0A/0x09 commands as you want as long you do not exceed the maximum 32 limit of them. Sony has used it in the official NET config of the game BlowOut (two separate 0x0A commands).
My recommendation is to left the Sony's patches in the first command copied straight and apply the custom patches in the second command. If the game has got a second version, use a separate command for the patches. The pattern is to have an order like that:
Official patches -> Custom patches -> Custom patches (for the second version) -> Custom patches (for the third version) -> etc.
Another games which need a double patch for the different versions are Silent Hill 2, Wrath of Cortex and Star Wars: Battlefront II. I won't be discussing them, as I have updated the configs on the "PS2 Emulation" page of the wiki. The pattern is similar (Silent Hill 2 example):
0x0E command for the original version -> 0x0E command for the Greatest Hits version -> 0x0F command for the original version -> 0x0F command for the Greatest Hits version.
The last but not least is the Crash Twinsanity NTSC config. We have got a 0x12 command there. It turns out you cannot have a two 0x12 commands in the config, when some subcommands are duplicated - the emulator would turn itself off after the LV2 reboot. But we can have a second 0x12 command with just a single type 3 subcommand, which looks for a memory offset containing a specific opcode. The config looks like this:
Code:3D 00 00 00 57 44 00 00 12 00 00 00 08 00 00 00 00 00 00 04 00 00 00 00 02 00 03 00 00 00 00 00 9B BF 2C B6 00 02 00 00 03 00 01 00 7C 15 2B 10 12 00 00 00 02 00 00 00 03 00 01 00 6C 19 2B 10 0A 00 00 00 03 00 00 00 30 1B 19 00 FB FF 40 54 00 00 00 00 34 1B 19 00 2F 18 71 00 00 00 00 00 38 1B 19 00 2F 10 23 02 00 00 00 00 0A 00 00 00 03 00 00 00 58 1C 19 00 FB FF 40 54 00 00 00 00 5C 1C 19 00 2F 18 71 00 00 00 00 00 60 1C 19 00 2F 10 23 02 00 00 00 00 00 00 00 00
We have got a "12 00 00 00 08 00 00 00" command copied straight from the gxemu config for the 1.00 version. Then we have got a "12 00 00 00 02 00 00 00" command which does contain only the 0x03 subcommand with the offset for the 2.00 version. So the pattern is similar here:
0x12 full command copied straight from the original config for the 1.00 version (I am not aware of any community made 0x12 patch) -> 0x12 command with just a offset for the 2.00 version -> First 0x0A freeze fix for the 1.00 version -> Second 0x0A freeze fix for the 2.00 version.
I think it is a pretty straightforward standard for few games affected by this issue.
Instead of
3D 00 00 00 57 44 00 00 12 00 00 00 08 00 00 00
00 00 00 04 00 00 00 00 02 00 03 00 00 00 00 00
9B BF 2C B6 00 02 00 00 03 00 01 00 7C 15 2B 10
12 00 00 00 02 00 00 00 03 00 01 00 6C 19 2B 10
You can do
3D 00 00 00 57 44 00 00 12 00 00 00 09 00 00 00
00 00 00 04 00 00 00 00 02 00 03 00 00 00 00 00
9B BF 2C B6 00 02 00 00 03 00 02 00 7C 15 2B 10
6C 19 2B 10
all that assuming that CRC, and CMSAR for 02 00 03 won't changed, which is really really rare to be changed even between regions.