Client updating (sevenhearts style)

This forum is for main questions (format files, STB / STL and so on).

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Forum rules
Client Editing is a delicate subject. osRose and osiRose will not support or use any Client Editing tool or results as a standard. So you are free to experiment, test, and develop there on Client Editing, but at your own risk :)

Client updating (sevenhearts style)

Postby RoseFan on Sat Nov 17, 2007 4:32 pm

This is the way updating (I think) works the original way.
The sevenhearts is the only Irose/krrose server which still uses this methode, I never used EVO so i don't know if the official servers still work like this.

In your client directory theres an lua file called RoseOnline.lua, if you open it with notepad you see:
ScriptURL = "http://updates.sevenhearts.net/~sevenhearts.bin"

~sevenhearts.bin is a compiled lua file which you can decompile to get the original file back

If you open the ~sevenhearts file after decompiling it in notepad you see

  1. g_szURL="http://arua.sevenhearts.net/";
  2. g_szVFS="data.idx";
  3. ExePath="~patch";
  4.  
  5. function lua_DN_EXT_DEL(szFileName)
  6.     if (0==cf_r_DN2FILE(g_szURL, szFileName)) then
  7.         do return 0 end;
  8.        
  9.     end
  10.    
  11.     if (0==cf_l_EXTRACT(szFileName)) then
  12.         do return 0 end;
  13.        
  14.     end
  15.    
  16.     cf_l_DELETE(szFileName);
  17.     return 1;
  18.    
  19.  
  20. end
  21.  
  22.  
  23. function lua_DN_EXT_DEL2(szDownPath, szFileName)
  24.     szDownURL=g_szURL.."/"..szDownPath;
  25.     if (0==cf_r_DN2FILE(szDownURL, szFileName)) then
  26.         do return 0 end;
  27.        
  28.     end
  29.    
  30.     if (0==cf_l_EXTRACT(szFileName)) then
  31.         do return 0 end;
  32.        
  33.     end
  34.    
  35.     cf_l_DELETE(szFileName);
  36.     return 1;
  37.    
  38.  
  39. end
  40.  
  41. g_VFSFiles={};
  42. g_VFSFiles[1]={"3DDATA.VFS.1"};
  43. g_VFSFiles[2]={"BASIC.VFS.1"};
  44. g_VFSFiles[3]={"DATA.VFS.1"};
  45. g_VFSFiles[4]={"GROUND.VFS.1"};
  46. g_VFSFiles[5]={"MAP.VFS.1"};
  47. g_VFSFiles[6]={"TRose.exe.1"};
  48. g_VFSFiles[7]={"TGameCtrl_r.dll.1"};
  49. g_VFSFiles[8]={"data.idx.1"};
  50. g_VFSFiles[9]={"RoseOnline.lua.1"};
  51. for c=1, getn(g_VFSFiles) do
  52.     strFileName=g_VFSFiles[c][1];
  53.     iVfsCRCCheck=cf_GETFILECRC(strFileName);
  54.     if (iVfsCRCCheck~=0) then
  55.         cf_l_DELETE(strFileName);
  56.     end
  57.    
  58. end
  59.  
  60. g_PatchInfo={};
  61. g_PatchInfo[1]={"TRose.exe",
  62.     -1805721449,
  63.     "TRose.zip",
  64.     ""};
  65. g_PatchInfo[2]={"TGameCtrl_r.dll",
  66.     1487682055,
  67.     "TGameCtrl_r.zip",
  68.     ""};
  69. g_PatchInfo[3]={"Par2Patch.exe",
  70.     106161604,
  71.     "Par2Patch.zip",
  72.     ""};
  73. for i=1, getn(g_PatchInfo) do
  74.     strFile=g_PatchInfo[c][1];
  75.     nCrc=g_PatchInfo[c][2];
  76.     strZipName=g_PatchInfo[c][3];
  77.     strDelDir=g_PatchInfo[c][4];
  78.     iExeCRC=cf_GETFILECRC(strFile);
  79.     if (iExeCRC~=nCrc) then
  80.         cf_l_DELETE(strFile);
  81.         lua_DN_EXT_DEL2(ExePath, strZipName);
  82.         cf_l_DELETE(strZipName);
  83.         LoadFlag=1;
  84.         if (strDelDir~="") then
  85.             cf_l_DELETE(strDelDir);
  86.         end
  87.        
  88.     end
  89.    
  90. end
  91.  
  92. g_LuaFiles={};
  93. g_LuaFiles[1]={"RoseOnline.lua",
  94.     -1873047095,
  95.     "SHOLua.zip",
  96.     ""};
  97. for x=1, getn(g_LuaFiles) do
  98.     strFile=g_LuaFiles[c][1];
  99.     nCrc=g_LuaFiles[c][2];
  100.     strZipName=g_LuaFiles[c][3];
  101.     strDelDir=g_LuaFiles[c][4];
  102.     iExeCRC=cf_GETFILECRC(strFile);
  103.     if (iExeCRC~=nCrc) then
  104.         cf_l_DELETE(strFile);
  105.         lua_DN_EXT_DEL2(ExePath, strZipName);
  106.         cf_l_DELETE(strZipName);
  107.         LoadFlag=1;
  108.         cf_l_EXIT("RoseOnline.exe", strDelDir);
  109.         if (strDelDir~="") then
  110.             cf_l_DELETE(strDelDir);
  111.         end
  112.        
  113.     end
  114.    
  115. end
  116.  
  117. g_BaseVers={};
  118. g_BaseVers[1]={762,
  119.     "SHO762.zip"};
  120. g_BaseVers[2]={763,
  121.     "SHO763.zip"};
  122. g_BaseVers[3]={764,
  123.     "SHO764.zip"};
  124. g_BaseVers[4]={765,
  125.     "SHO765.zip"};
  126. g_BaseVers[5]={766,
  127.     "SHO766.zip"};
  128. g_BaseVers[6]={767,
  129.     "SHO767.zip"};
  130. g_BaseVers[7]={768,
  131.     "SHO768.zip"};
  132. g_BaseVers[8]={772,
  133.     "SHO772.zip"};
  134. g_BaseVers[9]={773,
  135.     "SHO773.zip"};
  136. g_BaseVers[10]={774,
  137.     "SHO774.zip"};
  138. g_BaseVers[11]={775,
  139.     "SHO775.zip"};
  140. g_BaseVers[12]={777,
  141.     "SHO777.zip"};
  142. g_BaseVers[13]={778,
  143.     "SHO778.zip"};
  144. g_BaseVers[14]={779,
  145.     "SHO779.zip"};
  146. g_Par2Patch={};
  147. g_Par2Patch[1]={752,
  148.     "SHO752.PAR2",
  149.     " r -q -q SHO752.PAR2"};
  150. g_Par2Patch[2]={760,
  151.     "SHO760.PAR2",
  152.     " r -q -q SHO760.PAR2"};
  153. g_Par2Patch[3]={761,
  154.     "SHO761.PAR2",
  155.     " r -q -q SHO761.PAR2"};
  156. iVer=cf_l_VFS_CURVER(g_szVFS);
  157. iBaseCNT=getn(g_Par2Patch);
  158. if (iBaseCNT>0) then
  159.     for j=1, iBaseCNT do
  160.         iBaseVer=g_Par2Patch[c][1];
  161.         if (iVer<iBaseVer) then
  162.             PatchFile=g_Par2Patch[c][2];
  163.             PatchTarget=g_Par2Patch[c][3];
  164.             iFileTest=cf_GETFILECRC(PatchFile);
  165.             if (iFileTest==0) then
  166.                 cf_l_MESSAGEBOX("Patch v0."..iBaseVer.." will start downloading. The launcher may appear frozen, simply leave it running and the patch will complete. Manual patches can also be found on our website http://www.sevenhearts.net. "Warning", 1);
  167.                 if (0==cf_r_DN2FILE(g_szURL, PatchFile)) then
  168.                     cf_l_PRINT("ERROR: in Base Version Patch");
  169.                     do return end;
  170.                    
  171.                 end
  172.                
  173.             end
  174.            
  175.             if (iFileTest~=0) then
  176.                 cf_l_MESSAGEBOX("Patchfile v0."..iBaseVer.." found. The installation may take several minutes to complete. Don't close the patching window while it's running!", "Warning", 1);
  177.             end
  178.            
  179.             iVer=iBaseVer;
  180.             cf_l_EXIT("Par2Patch.exe", PatchTarget);
  181.         end
  182.        
  183.     end
  184.    
  185. end
  186.  
  187. bBasePatch=false;
  188. iBaseCNT=getn(g_BaseVers);
  189. if (iBaseCNT>0) then
  190.     for j=1, iBaseCNT do
  191.         iBaseVer=g_BaseVers[c][1];
  192.         cf_l_VFS_PUSH_PATCH(g_szURL, g_BaseVers[c][2], g_szVFS);
  193.         if (iVer<iBaseVer) then
  194.             cf_l_MESSAGEBOX("Patch v0."..iBaseVer.." will start downloading. The launcher may appear frozen, simply leave it running and the patch will complete. Manual patches can also be found on our website http://www.sevenhearts.net. "Warning", 1);
  195.             bBasePatch=true;
  196.             PatchList=g_BaseVers[c][2];
  197.             if (0==cf_l_VFS_PATCH(g_szURL, PatchList, g_szVFS)) then
  198.                 cf_l_PRINT("ERROR: in Base Version Patch");
  199.                 do return end;
  200.                
  201.             end
  202.            
  203.             iVer=iBaseVer;
  204.         end
  205.        
  206.     end
  207.    
  208.     if (bBasePatch==true) then
  209.         cf_l_VFS_CLEARBLANK(g_szVFS);
  210.     end
  211.    
  212. end
  213.  
  214. cf_l_STARTFILE("TriggerDetect.exe", "@TRIGGER_SOFT@ _server arua.sevenhearts.net");
  215.  
  216.  

the first line points at the update site where the clients downloads the files for updating
than there's some functions and after that a file list which is crc checked
if the crc is wrong it is deleted and downloaded again
than the lua file roseonline.lua is crc checked and downloaded again if it fails

after that there's a list of zip files which contain par2 files, these files update the VFS as a whole and not the seperate files in the vfs, the par2patch.exe is used for that.

than there's zip files wich contain parts of filenames, like SHO762.zip contains the file 762
if you open the 762 file in a hex editor you can see that the first 4 bytes is the patch number
FA02 0000 = 0 762
the 6th byte is 05 which means 5 files to update
followed by a number 01FA0200 (this is part of the filename as you see in the updatewindow i think)
and a number FF FFFA 02 which is an opcode of the type of update(i think)
than two bytes containing the path length of the destination file 1E00 = 30, the path and filename 3Ddata\Item\LIST_FIELDITEM.ZSC, path length of the destination VFS 0A00, name of the VFS container 3DDATA.VFS
after that is the next file
Image

and the final line is the command which is run when you click the play button(I think)
cf_l_STARTFILE("TriggerDetect.exe", "@TRIGGER_SOFT@ _server arua.sevenhearts.net");

edit: the CRC number is a CRC-32 and its a Signed Long
g_PatchInfo[1]={"TRose.exe",
-1805721449, //CRC number
"TRose.zip",
""};

and how the client knows at which rev number it is

if anyone is interested I can explain how to decompile and compile the lua file
Last edited by RoseFan on Sat Nov 17, 2007 11:17 pm, edited 2 times in total.
RoseFan
Little soul
Little soul
 
Posts: 7
Joined: Sat Nov 17, 2007 11:52 am

Re: Client updating (sevenhearts style)

Postby Cellcote on Sat Nov 17, 2007 4:45 pm

Wow, nice guide. I'll definatly try this out.

EDIT: I can't find any Roseonline.lua in my Rose directory. Anyone?
Image
Cellcote
Rackie
Rackie
 
Posts: 188
Joined: Thu Aug 09, 2007 11:07 am

Re: Client updating (sevenhearts style)

Postby RoseFan on Sat Nov 17, 2007 8:40 pm

Cellcote wrote:Wow, nice guide. I'll definatly try this out.

EDIT: I can't find any Roseonline.lua in my Rose directory. Anyone?

the Seven hearts client has one
RoseFan
Little soul
Little soul
 
Posts: 7
Joined: Sat Nov 17, 2007 11:52 am

Re: Client updating (sevenhearts style)

Postby Maxxon on Sun Nov 18, 2007 9:45 am

yes. tell me pls how to decompile lua :)
Image
an anymous comment on a program called reloader:
what if a fatal error happens, will it restart it?
User avatar
Maxxon
Hawker's pet
Hawker's pet
 
Posts: 1305
Joined: Sat Nov 10, 2007 12:42 pm

Re: Client updating (sevenhearts style)

Postby Cellcote on Sun Nov 18, 2007 11:57 am

Can I copy Roseonline.lua from 7H to the original kr client?
Image
Cellcote
Rackie
Rackie
 
Posts: 188
Joined: Thu Aug 09, 2007 11:07 am

Re: Client updating (sevenhearts style)

Postby RoseFan on Sun Nov 18, 2007 11:23 pm

Cellcote wrote:Can I copy Roseonline.lua from 7H to the original kr client?

the best way to find out is by opening your ROSEonline.exe in a hex editor and use the search function to look for .lua
than you know if it uses the same name for the lua file or a difrend name
RoseFan
Little soul
Little soul
 
Posts: 7
Joined: Sat Nov 17, 2007 11:52 am

Re: Client updating (sevenhearts style)

Postby RoseFan on Sun Nov 18, 2007 11:43 pm

Maxxon wrote:yes. tell me pls how to decompile lua :)

http://rapidshare.com/files/70670209/ro ... ompile.rar
to decompile a compiled lua file download the roseluacompiledecompile.rar extract the files in it to a directory of your liking, drag the compiled lua file over the CFLuaDC.exe and your file is decompiled
the decompiled file has _DC in its name
I included luac4.exe to compile your eddited lua file
RoseFan
Little soul
Little soul
 
Posts: 7
Joined: Sat Nov 17, 2007 11:52 am

Re: Client updating (sevenhearts style)

Postby kiu on Mon Dec 24, 2007 8:10 pm

Hello , i decompiled and compile that Lua file , match on my server , But , i have some problems , well ... the launcher find the *.bin file , and load it ,BUT don't find the patches even if i Put them in same folder as the *.bin file , And when i launch the Game that don't work ! do u know what folders i should Put the Patch files and the Trose.rar and others ?
kiu
Pomic
Pomic
 
Posts: 130
Joined: Sat Aug 11, 2007 3:25 am

Re: Client updating (sevenhearts style)

Postby RoseFan on Thu Dec 27, 2007 2:56 am

kiu wrote:Hello , i decompiled and compile that Lua file , match on my server , But , i have some problems , well ... the launcher find the *.bin file , and load it ,BUT don't find the patches even if i Put them in same folder as the *.bin file , And when i launch the Game that don't work ! do u know what folders i should Put the Patch files and the Trose.rar and others ?

the first line in your compiled lua file points at the location where the update files are in the example file it is
g_szURL="http://arua.sevenhearts.net/";

and if you put the update files in the same place as your compiled lua file it should be the same as in your RoseOnline.lua file

I should also point out that it dosn't work with the ROSEonline.exe ruffrose uses and probably it's the same with the aurua client
RoseFan
Little soul
Little soul
 
Posts: 7
Joined: Sat Nov 17, 2007 11:52 am

Re: Client updating (sevenhearts style)

Postby kiu on Thu Dec 27, 2007 1:57 pm

RoseFan wrote:
kiu wrote:Hello , i decompiled and compile that Lua file , match on my server , But , i have some problems , well ... the launcher find the *.bin file , and load it ,BUT don't find the patches even if i Put them in same folder as the *.bin file , And when i launch the Game that don't work ! do u know what folders i should Put the Patch files and the Trose.rar and others ?

the first line in your compiled lua file points at the location where the update files are in the example file it is
g_szURL="http://arua.sevenhearts.net/";

and if you put the update files in the same place as your compiled lua file it should be the same as in your RoseOnline.lua file

I should also point out that it dosn't work with the ROSEonline.exe ruffrose uses and probably it's the same with the aurua client

well , i found that the launcher chek the ( Trose.zip , T_game.zip , and par2patch.zip ) in http://myip/~patch .. and after this he looks for patches in the http://myip like (SHO780.zip)
the problem i have now is .. that the launcher don't chek Trose , par2patch , even if they in Folder ~patch , and thats why the launcher don't load second time ,and Bug .. ( when clic on launch the Game nothing Happend ) ..
kiu
Pomic
Pomic
 
Posts: 130
Joined: Sat Aug 11, 2007 3:25 am

Next

Return to Client Editing Question Zone

Who is online

Users browsing this forum: No registered users and 9 guests