Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 13:18

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Decompressing Downloaded Patch Files

Discussion on Decompressing Downloaded Patch Files within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2008
Posts: 962
Received Thanks: 650
Decompressing Downloaded Patch Files

Hello,

I'm trying to handle the files received from the downloadserver to the launcher. I have read Drew's guide here : and I understood most of the patching logic, but the implementation is not easy to understand because it's in C++.

I'm trying to implement the concept on a launcher using VSRO 1.88 downloadserver in C#. I reached the point where I could receive the data from the downloadserver and save it into a file. This is how it looks like:



Method used :
Code:
System.IO.File.WriteAllText("textfile.txt", Utility.HexDump(packet.GetBytes()));
Does anyone have a clue about decompressing the data? I tried Zlib and 7z decompressors, but they don't work.

The code I used for decompression :
Code:
ZLibCompressor.DeCompress(packet_bytes);
Library used :


Cheers
magicanoo is offline  
Old 09/15/2015, 19:02   #2
 
elite*gold: 0
Join Date: Jan 2009
Posts: 314
Received Thanks: 686
There is a and then there is ...

Edit: Forget lzma. You where right, vSRO uses zlib. I will look into it.
Edit2: Solution found. I'm using the ZlibDll from
You need to read the first 4 bytes. It stores the uncompressed size. The rest of the file is compressed data.

Code:
    class Program
    {
        [DllImport("ZlibDll.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int Decompress(byte[] compressed_buffer, int compressed_size, byte[] decompressed_buffer, ref int decompressed_size);

        [DllImport("ZlibDll.dll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int Compress(byte[] decompressed_buffer, int decompressed_size, byte[] compressed_buffer, ref int compressed_size);

        enum ZLIB_RESULT
        {
            Z_OK = 0,
            Z_STREAM_END = 1,
            Z_NEED_DICT = 2,
            Z_ERRORNO = -1,
            Z_STREAM_ERROR = -2,
            Z_DATA_ERROR = -3,
            Z_MEM_ERROR = -4,
            Z_BUF_ERROR = -5,
            Z_VERSION_ERROR = -6
        }

        static void Main(string[] args)
        {
            using (var fileStream = new FileStream("testFile.txt.zlib", FileMode.Open, FileAccess.Read))
            {
                using (BinaryReader reader = new BinaryReader(fileStream))
                {
                    int compressed_size = (int)reader.BaseStream.Length - 4;
                    int decompressed_size = reader.ReadInt32();

                    byte[] compressed_buffer = reader.ReadBytes(compressed_size);
                    byte[] decompressed_buffer = new byte[decompressed_size];

                    ZLIB_RESULT result = (ZLIB_RESULT)Program.Decompress(compressed_buffer, compressed_size, decompressed_buffer, ref decompressed_size);
                    if (result == ZLIB_RESULT.Z_OK)
                    {
                        string content = Encoding.Default.GetString(decompressed_buffer);
                        Console.WriteLine("Sucess.\n" + content);
                    }
                    else
                    {
                        Console.WriteLine("Error: {0}", result.ToString());
                    }
                }
            }
            Console.ReadLine();
        }
    }
DaxterSoul is offline  
Thanks
6 Users
Reply


Similar Threads Similar Threads
What to do with these 3 files I downloaded from Gc Pumaloco?
12/04/2009 - Grand Chase - 1 Replies
Could you tell me what to do with these 3 files? Putt them all together? And how do I run the game then? Thanks in advance. :)
How to connect to server2 acme? i downloaded the patch.
12/19/2008 - EO PServer Hosting - 2 Replies
i dl the patch and i dont see anything. can someone tell me? im on at yahoomessenger. [email protected] pls give me a buzz there..
Where to copy downloaded files?
08/08/2008 - General Gaming Discussion - 1 Replies
Hello guys, actually i´m completely new to this and i want to know where i have to copy edited files after i downloaded them from zerowaitingtime or whatever so i can use them in game. So please if you have time to, answer me and tell me how to do that, thank you.
Decompressing Gunz files
01/02/2006 - GunZ - 5 Replies
Can anyone decompress, or extract the files from the .MRS files ? If i can get to the files inside man.mrs i could probably make an aimbot :cool: But extractor will not work. It will extract only .txt files from man.mrs, but if you open man.mrs in WinRar you see animation files/clothes/body parts. I think the .txt files you see in extractor are being combined to make the animation and other files... if anyone has other ideas, or knows how to do it send me a PM or post here. Thanks alot



All times are GMT +1. The time now is 13:18.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.