Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Celsius - FFX-2 Save game editor
#21
CRC Calculation

Celsius has been using the CRC Bypass method, it has been a tad annoying that I could not find a CRC algorithm which would correctly calculate the values used by FFX-2. So I broke out CE and traced through the assembler code which the game uses.

After converting the trace to C code, it turns out that a standard CRC-16 CCITT algorithm is used, with one small exception. The last entry in the hash table is zero (not calculated). It looks like this may be a bug in the games CRC generation code, since a disproportionally large number of the CRCs I've seen while developing/testing Celsius have been 0xFFFF, the distribution of calculated hashes seems to be somewhat skewed.

I decided to try this algorithm on FFX, and it looks like FFX-2 inherited the code from it. CRCs are calculated consistantly between the two.

FFXII by contrast uses a bog standard CRC-32 algorithm.

The following is for FFX-2 UK PAL SLES_518.15

Algorithm
First 64 bytes are not used for hash calculation.
Start = 0x40
End = 0x16270 (File Length from PSU File)

Existing CRC is Zeroed out.
Byte [0x16268] = 0
Byte [0x16269] = 0

Calculate Hash Table with
Polynomial = 0x1021

Zero out last entry
Table[255] = 0

Calculate Hash with
Initial Value = 0
Seed = 0xFFFF

Code:
Start = 0x40
End = 0x16270

Hash = Initial
Hash ^= Seed

while(Start < End)
{
    Hash = Table[(Hash >> 8) ^ Data[Start++]] ^ (Hash << 8)
}

Hash ^= Seed

return Hash

I've attached a quick & dirty C# app (with source) for calculating CRC Hash values for FFX, FFX-2 and FFXII PSU Files.
You may have to adjust the offsets for non UK PAL versions of these games.

The next release of Celsius will include CRC support.


Attached Files
.7z   CrcTest.7z (Size: 35,06 KB / Downloads: 315)
Reply

Sponsored links

#22
That was very informative. FFXED has always replaced the CRC with zeroes, but I never knew why it actually works until now.
Reply
#23
thanks but i have a problem, when click open the memory card for pcsx2 emulator whit savegame of FFx-2, i see "Fail to open memory card"

My game is spanish version SLES 51819, is incompatible whit this editor?
Thanks
Reply
#24
(08-13-2011, 04:14 PM)usdelka Wrote: thanks but i have a problem, when click open the memory card for pcsx2 emulator whit savegame of FFx-2, i see "Fail to open memory card"

My game is spanish version SLES 51819, is incompatible whit this editor?
Thanks

I don't have your version, so can't say for sure that it is compatible. You can try the following -

1. If PCSX2 is running you must Eject the Memory Card in the PCSX2 GUI first.
2. Make sure you are running the latest version of Celsius (at least - 1.3.0.4237)
3. Configure Celsius for your version of the game.
- Press 'F2' to open the Properties box, select Celsius from the drop-down list at the top of Properties.
- Scroll down to PsuIO make sure Moroda is selected.
- For PsuTarget make sure User is selected.
- Change PsuUserPrefix to be BESLES-518. Hit <Return> to save the change.
4. Click <Open>, and select a .ps2 file. You should then see a list of your save games. The Size column must be 0x16270.
5. Select the save you want to edit and click <OK>.
6. Verify that the values displayed are the same as you see in game.

[Image: attachment.php?aid=29478]

Please post whether you are successful or not, or if you need any more help.



Attached Files Thumbnail(s)
   
Reply
#25
New Release 1.3.1.4257 - see first post.
Reply
#26
Thanks scarlet, now work whit my version spanish. The key is the configuration

Scroll down to PsuIO make sure Moroda is selected.
- For PsuTarget make sure User is selected.
- Change PsuUserPrefix to be BESLES-518. Hit <Return> to save the change.

Smile

ah, the new release not work in 32 bits?
Reply
#27
The new release is 'Any CPU' - so will work on 32 bit (x86) and 64 bit (amd64 and ia64) with the same executable. OS Version is detected at runtime by the .Net Framework.
Reply
#28
I'm playing the NTSC version with PCSX2. I have .NET Framework 4 Client Profile and VCR 2010 x64 installed. However, be it whether I have ejected the memory card or not, I will still get the error 'Failed to open for reading' when I try to open the file using the latest version of Celsius. I hope the save game editor can support this version some day.
Reply
#29
The editor does not use .Net Framework 4, it uses .Net Framework 2 (2.0.50727). There was no feature in 4 that I required for the editor, and I wanted to keep requirements to a minimum.

As of 1.3.1.4257 the editor no longer requires the VC runtime, Clasco.dll (the VC portion) was mostly included as a demonstrator of how to use P/Invoke and write a C/C++ dll to be consumed by a .Net Application. There are plenty of other P/Invokes in the code.

The 'Failed to open for reading' error is displayed if a Save within the card can not be found that matches the Target filter. The default Target is set for the PAL UK version of the game, this can be overriden in the Properties box, Celsius section. (see response to usdelka a few posts up).

If you do not know what your game version is you can find out by opening the card with Mymc.exe, the 'Directory' column in Mymc displays the full Target name, you would use the first 12-18 characters of this as your Target filter in Celsius (if in doubt you can just use 'B' as your Target, this should show everything that is on the card).

If you see your Save with size 0x16270 it can be edited with Celsius, there is at least 1 other save size of 0xD428 which cannot be edited (I don't have this version of the game - so can't find out what the Offsets are for it).

Let me know how you get on. Celsius development is complete feature wise, so if you have the 0xD428 save size (BASLUS-20672) it may be possible to work on ascertaining the offsets.
Reply
#30
(08-21-2011, 05:07 PM)Scarlet.Crush Wrote: The editor does not use .Net Framework 4, it uses .Net Framework 2 (2.0.50727). There was no feature in 4 that I required for the editor, and I wanted to keep requirements to a minimum.

As of 1.3.1.4257 the editor no longer requires the VC runtime, Clasco.dll (the VC portion) was mostly included as a demonstrator of how to use P/Invoke and write a C/C++ dll to be consumed by a .Net Application. There are plenty of other P/Invokes in the code.

The 'Failed to open for reading' error is displayed if a Save within the card can not be found that matches the Target filter. The default Target is set for the PAL UK version of the game, this can be overriden in the Properties box, Celsius section. (see response to usdelka a few posts up).

If you do not know what your game version is you can find out by opening the card with Mymc.exe, the 'Directory' column in Mymc displays the full Target name, you would use the first 12-18 characters of this as your Target filter in Celsius (if in doubt you can just use 'B' as your Target, this should show everything that is on the card).

If you see your Save with size 0x16270 it can be edited with Celsius, there is at least 1 other save size of 0xD428 which cannot be edited (I don't have this version of the game - so can't find out what the Offsets are for it).

Let me know how you get on. Celsius development is complete feature wise, so if you have the 0xD428 save size (BASLUS-20672) it may be possible to work on ascertaining the offsets.
I'm now able to open the save file. My game version is BISLPS-25250 and the file size indicated by Celsius's Select a Slot interface is 0xBB30. I'm using Windows 7 64bit and have verified that I have .Net 2 installed.

However, I find that existing levels, inventory and abilitietc for each character are not being shown at all. For example, each character is shown as having attained only Lv 1 when my charactes are all over 20 now. Each of my character has many abilities already mastered but they show only two basic ones being mastered - eg: Yuna's gunner is shown as having only attack and Trigger Happy mastered when I have already mastered a lot more than that.

Did I miss doing something?

Reply




Users browsing this thread: 1 Guest(s)