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

Author Topic: Any idea what this SLZ algorithm is?  (Read 27396 times)

boodrl

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #20 on: October 28, 2011, 11:01:14 am »
Thanks for the information.  :)
Downloaded the new .slz decompressor and it didn't crash at all :thumbsup:

Anything specific you want to know about the files?

Boulotaur2024

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #21 on: November 02, 2011, 04:35:04 pm »
Ouch, looks like we ain't going nowhere with this game and its formidable encryption. I heard Tri-Ace also heavily used obfuscation on this which makes it even harder to uncompress... What is frustrating is that I KNOW oroboro eventually managed to decrypt, uncompress and manipulate the data of this game... but he obviously didn't share much of his acquired knowledge (well he shared the result of his efforts at least, thank you for this by the way)...

So, CUE, I think your SLZ uncompressor is now working properly, I downloaded the source code, applied the code fix you mention a few posts above and compiled everything. Now it seems to successfully uncompress all the .SLZ files...

But I still have no clue what to with these, now that they're uncompressed... They don't contain any actually "usable data" per se... I mean boodrl wants to retrieve the models, I want to extract the FMV (which I think are located in those .unk files)...

...Maybe, maybe those .SLZ files can be seen as a key to open other encrypted files that contain "valuable" data ?
I like the intellectual challenge anyway, even if I'm clearly not (yet) skilled enough in the hexedit/encryption domain !
« Last Edit: November 02, 2011, 04:40:48 pm by Boulotaur2024 »

boodrl

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #22 on: November 04, 2011, 01:11:57 pm »
Do you happen to know what engine these ps2 triace games used? I've tried searching for the name but come up with dead ends. Most of my searches talk about the aska engine for ps2 games and the preview of their newest engine or something...

Is Oroboro also  "fluffy kitty". The hacker from the torrents I've come across?
http://www.thepiratebay.ee/torrent/3960365/Valkyrie_Profile_2_Silmeria_USA_UNDUB

Is Oroboro active on this forum?
« Last Edit: November 04, 2011, 01:35:50 pm by boodrl »

yoshi314

  • Jr. Member
  • **
  • Posts: 8
  • still learning to code
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #23 on: November 10, 2011, 08:33:39 am »
does anybody have a clue on SLE format that is also used in the image ?

Quote
I heard Tri-Ace also heavily used obfuscation on this which makes it even harder to uncompress...
tell me about it. there are a lot of tricky multi-header files there, and you eventually end up confused. e.g. ZLS containing SLZ containing FIS (based on my guesswork). or when you go by 4 bytes you end up on data with no header.

i started writing a dumb scanner to figure out the TOC, that lists file types and then looks for another file, basing by offset or by checking header every 4 bytes. i got stuck at SEQ which seems to be raw file (probably video) with no typical header.

my guess is  that the key to figuring out the true file table is cracking the data segment at 0x200000 in the iso. every tri-ace game has some kind of encrypted TOC there and it looks structurarily similar between all tri-ace ps2 games.

at boot up each game reads that area of the disc, and based on its contents calculates the beginning of actual data, as it jumps right over to the first SLZ packed executables. i've been staring at initial loader executable in disassembler for a while, and i'm no R5900 ASM guru. i can already notice it has multiple procedures for handling SLZ and SLE, probably to confuse me ;)

also, from quick runs in pcsx2 it seems that game initially reads disk in standard sectors, and then switches to different sector size - it was some odd value. anybody else caught that?

btw, the fluffy kitty is most likely the one at http://asmodean.reverse.net ;)
« Last Edit: November 10, 2011, 09:04:46 am by yoshi314 »

CUE

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • Nasío pa'jakear
Re: Any idea what this SLZ algorithm is?
« Reply #24 on: November 10, 2011, 12:24:54 pm »
Do you want the TOC decoder? (well, the triAce-PS2 source code)

yoshi314

  • Jr. Member
  • **
  • Posts: 8
  • still learning to code
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #25 on: November 10, 2011, 12:56:33 pm »
by all means, yes.

it's going to take me forever reversing mips assembly :/

boodrl

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #26 on: November 10, 2011, 02:56:55 pm »
Yes please CUE! I'll be able to pass it on to my partner who will be able to use it.
« Last Edit: November 10, 2011, 03:12:13 pm by boodrl »

yoshi314

  • Jr. Member
  • **
  • Posts: 8
  • still learning to code
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #27 on: November 11, 2011, 03:45:47 am »
Quote
...Maybe, maybe those .SLZ files can be seen as a key to open other encrypted files that contain "valuable" data ?
I like the intellectual challenge anyway, even if I'm clearly not (yet) skilled enough in the hexedit/encryption domain !

the first bunch of slz files are extra PS2 system drivers (pad, memory card, interrupt handler, etc). not sure why aren't they taken straight from IOPRP, but maybe that's to make things harder for hackers.

the SLE file that follows is probably the main game executable. the initial ELF you can see on the root of the disc is actually pretty much the same in every tri-ace ps2 game (differs by a few text strings between games) and most likely is focused on handling SLE and SLZ datatypes.

fun fact - that loader searches for a bin file on ps2 hdd on startup with game data (vp2.bin, sotet.bin, radiata.bin) to load files from. it should be, in theory, actually possible to run the game off ps2 hdd, if you can override the ps2 system hdd drivers (not that hard nowadays) and figure out how is the file supposed to look like.

Quote
But I still have no clue what to with these, now that they're uncompressed... They don't contain any actually "usable data" per se... I mean boodrl wants to retrieve the models, I want to extract the FMV (which I think are located in those .unk files)...
i think somebody mentioned somewhere that FIS datatypes could be shape data. i beliefe unk files are FMV's, although they don't look like mpeg to me (probably somehow encrypted).

i think you need to look at pk1 files, which are in fairly simple PACK format. it was used in valkyrie profile on psp - data file was one PACK file, with multiple components packed with SLZ.

CUE

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • Nasío pa'jakear
Re: Any idea what this SLZ algorithm is?
« Reply #28 on: November 11, 2011, 04:19:14 am »
I need put some comments in the tool  to upload the code tomorrow. Today is time to upload all my Nintendo DS/GBA compressors ;)


~~~ ADDED 2011-11-13 ~~~

All this stuff are free, without license, blah, blah, blah, use at your own risk, blah, blah, blah, and I'm the author ;D

The file: http://www.bwass.org/bucket/triAce-PS2.c

What do you need to know:

The encoded data has 3 32-bit tables:
- LBA table (offset position, in sectors)
- size table (number of sectors)
- a table not used (unknown)

Supported games (PS2):
- Star Ocean 3
- Radiata Stories
- Valkyrie Profile 2

If you want investigate the PSX games (Star Ocean 2, Valkyrie Profile):
The encoded data has 2 tables:
- a 32-bit table
- a 8-bit table

You must join the 4+1 bytes:
- 3 bytes are the file offset (MM:SS:FF format)
- 2 bytes are the length (number of sectors)

I don't remember now the PSX offsets.

This is a tiny tool used to test the decode method (PSX and PS2), with the keys used in each game:
Code: [Select]
#include <stdio.h>

#define PS1 1
#define PS2 2

void Codes(int ps, unsigned int seed, char *game) {
  unsigned int key = seed;

  printf("%s\n", game);
  do {
    printf(":%08X", key); key ^= (key << 1);
    printf(":%08X", key); key ^= ~seed;
    if (ps == PS2) {
      printf(":%08X", key); key ^= (key << 2) ^ seed;
    }
    printf("\n");
  } while (key != seed);
  printf("\n");
}

int main(void) {
  Codes(PS1, 0x13578642, "Star Ocean 2");
  Codes(PS1, 0x64283921, "Valkyrie Profile");
  Codes(PS2, 0x13578642, "Radiata Stories");
  Codes(PS2, 0x13578642, "Star Ocean 3");
  Codes(PS2, 0x49287491, "Valkyrie Profile 2");

  return(0);
}
« Last Edit: November 13, 2011, 03:36:27 am by CUE »

yoshi314

  • Jr. Member
  • **
  • Posts: 8
  • still learning to code
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #29 on: November 13, 2011, 05:19:44 am »
that multi-table approach is awfully similar to what was implemented in ff12, although ff12 had also multi part files.

btw linux build fixes for the tool, if anyone needs them :

Code: [Select]
--- a/triAce-PS2.c
+++ b/triAce-PS2.c
@@ -10,6 +10,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <sys/stat.h>
+
+
 // types
 typedef unsigned char      U08;
 typedef unsigned short int U16;
@@ -131,7 +134,7 @@ int main (int argc, char **argv) {
 
   // parameter to save the decoded data
   if (argc == 4) {
-    cue = !strcmpi(argv[3], "-cue") ? 1 : 0;
+    cue = !strcasecmp(argv[3], "-cue") ? 1 : 0;
     if (cue) argc--;
   } else {
     cue = 0;
@@ -191,7 +194,7 @@ int main (int argc, char **argv) {
   }
 
   // make folder
-  if (mkdir(argv[2]) > 0) STOP("Error creando la carpeta");
+  if (mkdir(argv[2], S_IRWXU | S_IRWXG ) > 0) STOP("Error creando la carpeta");
 
   // extract each file
   for (i = 0; i < max; i++) {
@@ -287,7 +290,7 @@ int main (int argc, char **argv) {
       printf("%s\n", fn);
 
       // save the file
-      if ((fp1 = fopen(fn, "wb")) == NULL) STOP("Error creando el fichero");
+      if ((fp1 = fopen(fn, "w+")) == NULL) STOP("Error creando el fichero");
       if (fwrite(buffer, 1, len, fp1) != len) STOP("Error grabando el fichero");
       if (fclose(fp1) == EOF) STOP("Error cerrando el fichero");

Boulotaur2024

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #30 on: November 13, 2011, 05:30:18 pm »
i beliefe unk files are FMV's, although they don't look like mpeg to me (probably somehow encrypted).

I guess so... I mean just by looking at their filesize... they have to contain videos...  .pk1 files, however, seem too small to be "interesting", even though they seem not compressed/encrypted.

I tried opening a Pcsx2 savestate taken during FMV playback to see if there was any hint as to which file contains video data being played by the emulator but again everything is so cryptic to me. I noticed however that there were a lot of references to "SLZ" in the savestate file "eeMemory.bin", which led me to believe that those SLZ files are a sort of a key to open other encrypted files (forgive my english I'm tired).

CUE, thank you very much for the source code, this will be really helpful for a lot of people all over the web I'm sure :)

luo7388458

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #31 on: February 04, 2012, 04:24:21 am »
I got a SLZ2 encoding code(with little bugs but i fixed them) on the web . According to this,i got the decoding tool(it is a right one),but the problem came!!!!
First,I decoding the raw file "a.slz2"(extracted from "vp2.iso") to a new file "a.slz2.bin",the new file turns to be a right-decoded file,thus,it is its self now,!
Second,I encoding(using the above encoding method) the file "a.slz2.bin" to a new file "a.slz2.bin.slz2";
Last,I find that the file "a.slz2.bin.slz2" has several bytes' difference from the raw file "a.slz2" !!! But they can be decoding to the same file.....what is going on?
Please help me!If you need the raw file ,I will mail it to you.Thanks!
image:
Email:luo7388458@gmail.com
« Last Edit: February 04, 2012, 07:31:00 am by luo7388458 »

Auryn

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #32 on: February 04, 2012, 05:46:49 am »
Are you trying to say that if you decompress and recompress a file without making a change, you get 2 different files??
By the way, your link doesn't work.

luo7388458

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #33 on: February 04, 2012, 06:44:22 am »
Are you trying to say that if you decompress and recompress a file without making a change, you get 2 different files??
By the way, your link doesn't work.
Yes!
I think the slz2 compression(I got it from the net) has some little bug. So what I need is the right slz2 compression code,can you help me?

CUE

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • Nasío pa'jakear
Re: Any idea what this SLZ algorithm is?
« Reply #34 on: February 04, 2012, 01:00:58 pm »
Is normal, you can use different offsets.

An example:

To encode "00-00-00", with previous data = "00-00-00-01-00-00-00-02-$" (the current position is '$'), you can use:
- get 3 bytes from $-8
- get 3 bytes from $-4

The 2-bytes chunk that indicate the compression of these data are different.

luo7388458

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #35 on: February 05, 2012, 12:02:10 am »
Is normal, you can use different offsets.

An example:

To encode "00-00-00", with previous data = "00-00-00-01-00-00-00-02-$" (the current position is '$'), you can use:
- get 3 bytes from $-8
- get 3 bytes from $-4

The 2-bytes chunk that indicate the compression of these data are different.
OK,Thank you very much!
I will not care this any more.

February 05, 2012, 12:22:30 am - (Auto Merged - Double Posts are not allowed before 7 days.)
-----"pk1" package format:
offset,size:data
000000,4:preserved bytes(00)
000004,4:number of the file record entries (name it with "n")
000008,4:the first file's offset(name it with "oft")
00000C,4:preserved bytes(00)
000010,16:first file entry(see about "pk1 file entry" below)
000020,16:second file entry
......
0000n0,16:the nth file entry
000oft:the start of file data
......

-----"pk1 file entry" format(16 bytes):
00-03,4:the type of the file?(I'm not sure)
04-07,4:may be one kind of parameter
08-0b,4:size of the file
0c-0f,4:offset of the file in the package file
« Last Edit: February 05, 2012, 12:22:30 am by luo7388458 »

CUE

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • Nasío pa'jakear
Re: Any idea what this SLZ algorithm is?
« Reply #36 on: February 05, 2012, 03:19:19 am »
Are you unpacking the PSX or PS2 games?

luo7388458

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #37 on: February 05, 2012, 07:22:38 am »
ps2 vp2

February 06, 2012, 12:23:12 am - (Auto Merged - Double Posts are not allowed before 7 days.)
CUE ,thank you for your source code!You are a great man!
« Last Edit: February 06, 2012, 05:15:59 am by luo7388458 »

bornd

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Any idea what this SLZ algorithm is?
« Reply #38 on: May 04, 2016, 07:21:09 pm »
Old bump, this thread seems to have important information for reference, rather then starting from scratch.

I am looking at StarOcean 5 for the ps3, after unpacking the cri cpk file, some of the game uses the SLZ encoded files (tri-Ace game), and none of the decompressers I found are working, so thought I would post some files to see if anyone has any ideas.

http://www104.zippyshare.com/v/afkVQXU9/file.html