Update the Launcher by patch_bin

08/06/2013 16:40 thund22222#1
Hello,



At first I noticed lot is developing several different topics about rappelz either be released prisoners or repairs and tools may be programmed or solutions to some problems facing society e'pvp

But never a developed theme of the patch_bin official/patchserver

I open this thread for anyone who has some information about this program

In my personal experience I noticed that the program supports files with a certain formula and .tpf during the opening of the player to the Launcher checks and then activate the Start button
But I still can't make it downloads the updates that I want, you check a file I found this line

Update command SFrame.exe:
:RZ_ME:100:SFrame.exe:8052736:3827E729:8052736:382 7E729:/::

Update command files inside data
:RZ_ME:100:pidA4Mxj(66;ig_V:365680:037E0D1C:354973 :02D0B221:/053/::

For SFrame.exe
8052736 = file size

037E0D1C = I didn't know

RZ_ME: 100 = verification to the Launcher by Default

With regard to the data files:
PidA4Mxj (66; ig_V: 365680 = hash file

I do not know the file size might be 365680 or 354973

354973 = already said I didn't analyze this

053 = probably the distribution file in data

This now but she reached
08/06/2013 19:35 glandu2#2
The launcher first load the launcher page, then read the update server IP & port

Then send to the update server:
Code:
QUERY RZ_FR 400
where FR is the current used locale and 400 the current game version

then the update server answer that:
Code:
SERVER_LIST : patch.rappelz.gpotato.eu/fr/RZ_FR/Patch
which tell the launcher where to download files
then the update server send all updated files since the game version that the launcher sent (here it was 400)

Then it do the same as above but for localized files using the query (for example translation files: db_string.rdb)
Code:
QUERY RZ_FR_LOCAL 400
Note that the versions for the 2 queries are not related (so for the FR server, RZ_FR has a version of 900~ and RZ_FR_LOCAL 200~

This is text data with 1 line = 1 file, it's almost what you tell to the patch server:
Code:
sdXwe'vmvdeHga$:216:11935985:30CF20EB:6813532:37603A3D:/036/
Where:
  • sdXwe'vmvdeHga$ is the file name (hashed, it's db_string.rdb)
  • 216 is the file's version
  • 11935985 the unpacked file size
  • 30CF20EB the unpacked file's checksum (sum of all bytes)
  • 6813532 the packed size (it use zlib)
  • 37603A3D the packed file's checksum (sum of all bytes)
  • /036/ the folder where to find the file in the patch file server

So here, launcher.exe will download http://patch.rappelz.gpotato.eu/fr/RZ_FR/Patch/036/sdXwe'vmvdeHga$
(which exist if you go to that url ^^)


So for you:
Code:
:RZ_ME:100:sidA4Mxj(66;ig_V:365680:037E0D1C:354973:02D0B221:/053/::
  • RZ_ME : the locale, the patch server will answer to 'QUERY RZ_ME <version>' and 'QUERY RZ_ME_LOCAL <local_version>'
  • 100 : is the file version
  • sidA4Mxj(66;ig_V : the file name
  • 365680 : the unpacked file size
  • 037E0D1C : the unpacked file checksum
  • 354973 : the packed file size
  • 02D0B221 : the packed file checksum
  • /053/ : the folder where to find the file

I will release a tool compress / uncompress server's option files (eop) and your patch files (as it use the same algorithm, that is zlib)
I made this tool more than one year before so it may be outdated, is the new one works still ? (I know about the encrypted version for newer servers and that Pyrok or someone else patched the server binary to use old version that use compression only, mine is also only compatible to only the old version though I remember having found how the server handle the new format, but I will have to discover where I saved that information ...)

Anyway, I am pretty sure that the hex string is the checksum, it's the same along with the size for non packed file like sframe.exe

But hey, we have the PDB :) So all information needed is there waiting for someone to open that chest to find the answer to everything (that is a number -- 42 [Only registered and activated users can see links. Click Here To Register...])

------------------------
Some more information:
------------------------

After reading the PDB file, there are indeed checksum of unpacked and packed files.

Notice that there are 2 ':' at the end, you can write something, it's a description it seems (optional)

So we have:
Code:
:applicationName:version:fileName:unpackedSize:unpackedChecksum:packedSize:packedChecksum:directory:description:
To add a file server which will provide all downloadable files (the patch server will use that with SERVER_LIST)
Write a line like that in the tpf file:
:HTTP_SERVER:RZ_ME:[Only registered and activated users can see links. Click Here To Register...]

For official french server, it's probably (if not 100% sure^^) to be this:
Code:
:HTTP_SERVER:RZ_FR:patch.rappelz.gpotato.eu/fr/RZ_FR/Patch:
Then to download a file, the launcher will prefix all files to be downloaded by [Only registered and activated users can see links. Click Here To Register...] + the file's directory (036 for db_string.rdb) + the file name hashed to have:
Code:
http://patch.rappelz.gpotato.eu/fr/RZ_FR/Patch/036/sdXwe'vmvdeHga$
Note that "http://" is not included in the config file.

That should work (the HTTP_SERVER need to be in capitals)

All tpf files have to be in the "PathInfo" directory along with the PatchServer.exe
To have this:
Code:
+ server_directory
|
+--+ PatchServer.exe
|
+--+ PatchInfo
   |
   +--+ file1.tpf
   |
   +--+ file2.tpf
   ...
08/06/2013 20:17 thund22222#3
Very nice information thanks
But how to bring the unpacked file checksum?
08/06/2013 20:25 glandu2#4
Ah, that the only thing I don't know yet, along with what to write in the .opt file (probably the same thing as for the game and auth servers about which IP & port the patchserver should listen, maybe other options)
10/26/2013 16:47 glandu2#5
While doing some stuff, I also found that the checksum is really a checksum, that is a sum of all byte in file, then written in hexadecimal. I updated the first post

So to calculate the checksum of a file:

Code:
uint32_t sum = 0;
for(uint8_t b in fileData) {
  sum += b;
}
Where fileData is the content of the file (all bytes). At the end of the loop, sum contain the checksum (32 bits value) and should be written in hexa format with 0 to have 8 characters (if the value is 0x5E8 for example, you need to write 000005E8)
02/16/2015 21:11 Aurorauser#6
Quote:
Originally Posted by glandu2 View Post
While doing some stuff, I also found that the checksum is really a checksum, that is a sum of all byte in file, then written in hexadecimal. I updated the first post

So to calculate the checksum of a file:

Code:
uint32_t sum = 0;
for(uint8_t b in fileData) {
  sum += b;
}
Where fileData is the content of the file (all bytes). At the end of the loop, sum contain the checksum (32 bits value) and should be written in hexa format with 0 to have 8 characters (if the value is 0x5E8 for example, you need to write 000005E8)
C# code working!
Code:
openFileDialog1.ShowDialog();
            label3.Text = openFileDialog1.SafeFileName;
            textBox1.Text = openFileDialog1.FileName;
            byte[] bytes = File.ReadAllBytes(openFileDialog1.FileName);
            int checksum = 0;
            for (int i = 0; i < bytes.Length; i++)
            {
             checksum += bytes[i];
             
            }
            //to get hex value for tpf file...be careful checksum must have 8 values!!!
            //checksum.ToString("X").PadLeft(8, '0');
            string so = checksum.ToString("X").PadLeft(8, '0');
            label1.Text = so.ToString();
[Only registered and activated users can see links. Click Here To Register...]

Launcher system open download update %95 file invalid error ?
02/16/2015 22:08 glandu2#7
Quote:
Originally Posted by Aurorauser View Post
C# code working!
Code:
openFileDialog1.ShowDialog();
            label3.Text = openFileDialog1.SafeFileName;
            textBox1.Text = openFileDialog1.FileName;
            byte[] bytes = File.ReadAllBytes(openFileDialog1.FileName);
            int checksum = 0;
            for (int i = 0; i < bytes.Length; i++)
            {
             checksum += bytes[i];
             
            }
            //to get hex value for tpf file...be careful checksum must have 8 values!!!
            //checksum.ToString("X").PadLeft(8, '0');
            string so = checksum.ToString("X").PadLeft(8, '0');
            label1.Text = so.ToString();
[Only registered and activated users can see links. Click Here To Register...]

Launcher system open download update %95 file invalid error ?
You must use unsigned variables when computing the checksum else some bytes will be read as negative. "bytes[i]" must be an unsigned value (you can use a cast or change the type of "bytes")
02/16/2015 22:35 Aurorauser#8
null
08/31/2016 20:29 makr12#9
Thanks