News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: PS2 Berwick Saga compress/decompress and graphic question.  (Read 4644 times)

lckhoa

  • Jr. Member
  • **
  • Posts: 16
    • View Profile
PS2 Berwick Saga compress/decompress and graphic question.
« on: August 03, 2013, 06:38:21 am »
Hi Pro,

I would like to make an English, at least for Menu but thing's not easy as i thought.
After a week playing with Hex & SaveState i know that most of font are compress (except font for items, chars name).

Screenshot below is two windows of compress/decompress of 1 font.

One the compress windows, first 4 bytes is decompress size and next 4 bytes is compress size, next "F8" byte i don't know yet - maybe signature or something?

When compare two windows, we can see that compress data is not total hidden data of the decompress one. We can see some bytes like "14" "F802" "7C01"...

So:
 - Is there any pro out there that have more experience/smarter than me know which type of compression it is or point me a hint about it?
 - The decompress data looks like a BMP, TIM but it's not. I can see this font on GDD but not its true form. Is it a TIM2, TIM3 or what?



Thanks for reading.

Pokeytax

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Cavespeak
Re: PS2 Berwick Saga compress/decompress and graphic question.
« Reply #1 on: August 03, 2013, 02:29:57 pm »
Judging by the general structure (more readable early on, mix of literals), it looks like a LZW variant.  A lot of the time, the opening "F8" might be a bitfield indicating the state of the next 8 pieces (i.e. "11111000" meaning the next 5 chunks are literal bytes and the last three are compression codes), which explains the first five bytes being verbatim, but I don't know how to square that with the literal "14" appearing eight bytes later.

Ultimately this is easiest to solve by using a debugger and watching the game unpack the data.

tryphon

  • Hero Member
  • *****
  • Posts: 722
    • View Profile
Re: PS2 Berwick Saga compress/decompress and graphic question.
« Reply #2 on: August 03, 2013, 06:19:07 pm »
Ultimately this is easiest to solve by using a debugger and watching the game unpack the data.

I'd be REALLY interested to know how to do that with a PS2  :)

lckhoa

  • Jr. Member
  • **
  • Posts: 16
    • View Profile
Re: PS2 Berwick Saga compress/decompress and graphic question.
« Reply #3 on: August 03, 2013, 08:54:57 pm »
Ultimately this is easiest to solve by using a debugger and watching the game unpack the data.

Thanks for your information. Cheat Engine can set break on read/write and i can see memory change bye by byte but sadly that i know nothing about ASM.
If you don't mind than...

Thanks,

Klarth

  • Sr. Member
  • ****
  • Posts: 489
    • View Profile
Re: PS2 Berwick Saga compress/decompress and graphic question.
« Reply #4 on: August 03, 2013, 09:54:56 pm »
I'd be REALLY interested to know how to do that with a PS2  :)
The general technique is to locate where the compressed file is loaded into RAM, then set a read breakpoint on the compressed data (alternatively, set a write breakpoint on the decompressed data).  That will give you an idea of where the code is at.  Then you can either disassemble the surrounding code or do a code trace.  I'm not sure what the state of PS2 debuggers are and I never released my PCSX2 trace modification.

tryphon

  • Hero Member
  • *****
  • Posts: 722
    • View Profile
Re: PS2 Berwick Saga compress/decompress and graphic question.
« Reply #5 on: August 04, 2013, 02:59:31 am »
Please release it :)

The only PCSX2 version with a debugger I found is the one on this site, and tracer crashes on my PC as sson as I launch it.

So, for the moment, either I try to figure out the compression scheme looking at both compressed and uncompressed data (which worls only for simple compression) or I look into a disassembly all references to the memory areas, which is... tiring, to say the least :)

lckhoa

  • Jr. Member
  • **
  • Posts: 16
    • View Profile
Re: PS2 Berwick Saga compress/decompress and graphic question.
« Reply #6 on: August 04, 2013, 04:39:38 am »
Please release it :)

Have you try CheatEngine?

tryphon

  • Hero Member
  • *****
  • Posts: 722
    • View Profile
Re: PS2 Berwick Saga compress/decompress and graphic question.
« Reply #7 on: August 04, 2013, 07:46:19 am »
I must say I didn't know about that. Thanks :)

But it's not PS2 specific, is it ?

lckhoa

  • Jr. Member
  • **
  • Posts: 16
    • View Profile
Re: PS2 Berwick Saga compress/decompress and graphic question.
« Reply #8 on: August 04, 2013, 09:59:38 am »
I think no but try it and you will see :)
You can set break point on access/write, break and trace and more...
Like i said on my previous post, i can see the decompress routine but sadly that i don't understand ASM!