XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Mon Oct 23, 2017 5:20 am

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Help to decompress game file
PostPosted: Mon Mar 13, 2017 7:56 am 
Offline
ultra-n00b

Joined: Sun Sep 11, 2016 7:38 am
Posts: 5
Has thanked: 5 times
Have thanks: 0 time

the game is: 舞力全开:活力派 (download: adl.netease.com/d/g/justdance/c/gw_pcclient). In the pastes of installed game there is a paste called Setting, in older versions of the game this paste contained files .json that can be easily readed.

But in the current version, the paste Setting contains .z files that cannot be extracted or readed. I want to read the text in the setting files but it is kind compressed. So I decided to use dotPeek to decompile the Assembly-CSharp.dll (an dll from the game) and I discover that it uses sevenzip lzma comprfession, So I got some interesting codes that can be useful to decode these files.

Here is the Setting old and current files https://www.dropbox.com/sh/d64b1pjx3sp8 ... uHNxa?dl=0

and here it is the codes I decompiled https://www.dropbox.com/sh/frejsrezln9y ... -Hiaa?dl=0

If someone can help me I will be thankful

You can make the ads go away by registering



Last edited by andrevictor18 on Wed Mar 15, 2017 11:49 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Help to decompress game file with sevenzip lzma compress
PostPosted: Mon Mar 13, 2017 8:40 pm 
Offline
advanced
User avatar

Joined: Sat Sep 13, 2014 2:05 pm
Posts: 41
Has thanked: 7 times
Have thanks: 16 times
It's indeed 7Zip algorithm you IL-generated code posted:
http://www.7-zip.org/sdk.html
Download LZMA SDK for C# and you will get 1:1 code as is inside assembly-CSharp.dll
Neither of the official SDK tools for decompression works as this is not an archive. I'll try to test algorithms on raw data now.

EDIT: grr, I can't decode it, maybe there's something additional?
EDIT2: Yeah, the SettingsManager uses JDCStreamReader.messageParse()... (not LZMA)
Code:
public string messageParse(byte[] message, int startIndex, int messageLength, out int totalLen, out bool readSuccess)
{
   totalLen = 0;
   readSuccess = false;
   int num = messageLength - startIndex;
   if (num < 5)
   {
      return string.Empty;
   }
   int num2 = BasicFunc.stringConvertToNumber(Encoding.UTF8.GetString(message, startIndex, 5), 36);
   int num3 = (num2 & 29360128) >> 22;
   int num4 = num2 & 4194303;
   totalLen = num4 + 5;
   if (num4 <= num - 5)
   {
      byte[] buffer = BufferPool<byte>.GetBuffer((long)num4);
      Array.Copy(message, startIndex + 5, buffer, 0, num4);
      string result = Singleton<JDCZlibWrapper>.GetInstance().doDeCompress(buffer, num4);
      BufferPool<byte>.Release(buffer, true);
      readSuccess = true;
      return result;
   }
   return string.Empty;
}


JDCZlib:
Code:
[DllImport("JDCZlibForUnity")]
private static extern IntPtr JDCZlibDeCompress([MarshalAs(UnmanagedType.LPArray)] byte[] source, int length);

Ah, not the first time I see this... They are coding the file via streamer and/or password/key that is stored in unmanaged binary (Mobius: Final Fantasy uses external assembly to get AES key for example)
Let's see if there's something special about this Zlib stream

UPDATE:
Basically, the first 5 characters in .z file are used to get final size of decompressed file. File content is after these five characters.

Done!
I'm coding a tool for you


Last edited by MaKiPL on Mon Mar 13, 2017 10:37 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Help to decompress game file with sevenzip lzma compress
PostPosted: Mon Mar 13, 2017 10:24 pm 
Offline
advanced
User avatar

Joined: Sat Sep 13, 2014 2:05 pm
Posts: 41
Has thanked: 7 times
Have thanks: 16 times
Decompressor:
https://github.com/MaKiPL/JAP_JustDance ... r/Form1.cs

Binary:
https://github.com/MaKiPL/JAP_JustDance ... r/releases

.NET Framework 4.0 or 4.5 you will need it


Last edited by MaKiPL on Thu Mar 16, 2017 12:45 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Help to decompress game file with sevenzip lzma compress
PostPosted: Tue Mar 14, 2017 11:32 pm 
Offline
ultra-n00b

Joined: Sun Sep 11, 2016 7:38 am
Posts: 5
Has thanked: 5 times
Have thanks: 0 time
Thank you very much for your effort! But can you send a example of a decompressed file? No, better can you show me some tutorial How to use the decompressor?


Top
 Profile  
 
 Post subject: Re: Help to decompress game file with sevenzip lzma compress
PostPosted: Wed Mar 15, 2017 6:29 am 
Offline
ultra-veteran
ultra-veteran

Joined: Mon Oct 27, 2008 12:11 am
Posts: 369
Location: Slovakia
Has thanked: 35 times
Have thanks: 98 times
Just download the binary and run it. MaKi made really simple but useful graphical interface there.


Top
 Profile  
 
 Post subject: Re: Help to decompress game file with sevenzip lzma compress
PostPosted: Thu Mar 16, 2017 12:08 am 
Offline
advanced
User avatar

Joined: Sat Sep 13, 2014 2:05 pm
Posts: 41
Has thanked: 7 times
Have thanks: 16 times
andrevictor18 wrote:
Thank you very much for your effort! But can you send a example of a decompressed file? No, better can you show me some tutorial How to use the decompressor?


andrevictor18 wrote:
do I need visual studio?


No, you don't need it. :)
Just get on this link: https://github.com/MaKiPL/JAP_JustDance ... tag/1.0.0b
download 'debug.7z' from there, unpack the archive and run "JAP_JustDance_JDCZlib_Decompressor.exe". You should see a window like on this image:

Image

If you are getting error about ".NET Framework" then please download Microsoft .NET Framework 4.5 (you can get it from official Microsoft site: https://www.microsoft.com/pl-pl/downloa ... x?id=30653)

Right in software you have labels for "input file" and "output file". In input file please click on "Browse..." button on it's right and file browser will appear allowing you to choose a .z file (e.g. currency.z) that is compressed. Next step is choosing the output file, do the same, use "Browse..." button (the second one) and type the filename of the decompressed file (e.g. currency.Unpacked). If you did the both, then the last step is clicking on "DECOMPRESS" button. If everything worked well a "DONE!" message box should appear.

:wv:


Top
 Profile  
 
 Post subject: Re: Help to decompress game file
PostPosted: Thu Mar 16, 2017 12:17 am 
Offline
ultra-n00b

Joined: Sun Sep 11, 2016 7:38 am
Posts: 5
Has thanked: 5 times
Have thanks: 0 time
THank you very much! You are amazing


Top
 Profile  
 
 Post subject: Re: Help to decompress game file
PostPosted: Sun Apr 16, 2017 1:14 pm 
Offline
advanced
User avatar

Joined: Sat Sep 13, 2014 2:05 pm
Posts: 41
Has thanked: 7 times
Have thanks: 16 times
I'm so sorry I couldn't done it faster. Here:
https://github.com/MaKiPL/JAP_JustDance ... es/tag/1.1

The compression support :)



Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group