blood.06s Posted July 2 Posted July 2 Hi, I'm trying to repack the dataS.gar file from Farming Simulator 2013. I extracted it successfully using QuickBMS and the giants_software.bms script. However, when I try to reimport it (even without modifying any files), the .xml files become completely corrupted after packing. Even if I reimport the original, unmodified XML, it still gets damaged. I've tried multiple reimport methods and command variations, but nothing works. After repacking, the game either shows a black screen or displays "MISSING L10N_EN_XML" everywhere. This clearly indicates that the repacked .gar file is either corrupted or the localization system (language files) can't be read properly anymore. Is there any working method, tool, or script to rebuild the .gar file correctly so the game accepts it? Any advice or help would be appreciated. Thanks in advance!
Engineers shak-otay Posted July 3 Engineers Posted July 3 Did you find any hint that repacking is possible using that script, theoretically at least? Reimport works for simple scripts only, afaik. I couldn't find giants_software.bms, only this one. So before I share my assumptions could you please confirm it's the same script?
blood.06s Posted July 3 Author Posted July 3 Yes, I'm using the same script — it's called "giants_software.bms" and I used it with QuickBMS to extract the .gar files from Farming Simulator 2013. It works fine for extraction, but I’m not sure if it supports reimport. As far as I can tell, this script only supports extraction, not repacking. I’d like to repack the .gar files after modifying the contents, but I haven’t found any tool or method that can do this yet. Do you know if repacking is even possible for this format?
Engineers shak-otay Posted July 3 Engineers Posted July 3 (edited) Repacking would require to encrypt, I guess. (The only encryption I know what does encrypt/decrypt when applied twice is xoring.) Quickbms can reverse the compression types it knows (comtype lzma here). For the dataS.gar of the FS 2013 demo, that I have, the enc_mode is 1 (because of "about secrets" at offset 0x40 in the gar). So encryption aes_128_cbc KEY IVEC is used here. The key is logged in the quickbms window (didn't check that at time of unpacking). Surprisingly Quickbms knows/supports aes_128_cbc, but I have no idea whether the reimport is clever enough to get the key. You'll have to ask Aluigi about it (he was active on Zenhax which is down now). Or you could do some test, see example Encryption aes "0123456789abcdef" "" 1 # encrypt without ivec in quickbms.txt. (ivec could be another hurdle, but it has zeroes in the script) edit: (Above mentioned key is in the script.) Problems on reimport: Quote - signature of 20 bytes at offset 0x00000000 doesn't match the one expected by the script: this one: "<?xml version="1.0" " 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 <?xml version="1 2e 30 22 20 .0" expected: "Copyright (C) GIANTS" 43 6f 70 79 72 69 67 68 74 20 28 43 29 20 47 49 Copyright (C) GI 41 4e 54 53 ANTS btw, for FS2019 huben wrote: Quote I tested if the files where reimported correctly, which they were. but I don't know which bms script he used. Edited July 4 by shak-otay
blood.06s Posted July 4 Author Posted July 4 The most logical thing to do is to contact Aluigi. How can I get in touch with him?
Engineers shak-otay Posted July 4 Engineers Posted July 4 (edited) I'm not sure. There's an email address at the top here. Or emit an issue here. But for this you'll need to sign in to Github, I guess. On another thought: FS2013 has a modding feature. Is it possible to add a script for example by modding? Back to bms; (Seems I misunderstood the script ; gar doesn't use lzma AND aes but lzma OR aes. Right? (ENC_MODE == 2 not taken into account)) Since I don't understand why reimport doesn't work for the gar file (maybe it's a bug in the reimport feature?) we should try to reimport one file manually, say achievements.xml (a luc, compiled lua would add another level of complexity). Here's offset and unpacked size of the first two files in dataS.gar (of the demo): 00037000 2862 achievements.xml 00038000 1905 character\chickenAnimalHusbandry.xml So the task is to aes encode achievements.xml and compare to the original block data Next problem: the block from 0x37000 to 0x38000 has 4096 bytes. Seems unlikely to me that aes increases the size that much. As a hint: Quote Even if some people know how to extract the files, it would be a violation of the accepted EULA/T&C to publish such methods, in other words: illegal. You can do this for your own private usage, but have to find out yourself. Edited July 4 by shak-otay
Engineers shak-otay Posted July 14 Engineers Posted July 14 (edited) I've cut down the script so that it extracts one file only from the dataS.gar. (A simplified script is more likely to work on reverse than a big one, I think.) Startfunction SET_KEYS is empty for legal reasons. You'll need to get it from the original script. Using the faked script with dataS.gar from the FS2013 demo results in test.xml being unpacked which is the same as achievements.xml. # GIANTS Software GAR archives (script 0.3.3) # Farming Simulator 2013 # Demolition Company # Ski Region Simulator # various mods # script for QuickBMS http://quickbms.aluigi.org # faked to unpack first xml only quickbmsver "0.9.2" math ENC_MODE = 1 callfunction SET_KEYS 1 set IVEC binary "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" math XSIZE = 16 for i = 0 getarray KEY 0 i if KEY == "" print "Error: unknown key, contact me" cleanexit endif callfunction SET_DECRYPT 1 #log MEMORY_FILE 0x200 XSIZE #get DUMMY long MEMORY_FILE #get ZERO long MEMORY_FILE if i == 0 break endif next i if ENC_MODE == 1 print "use key %KEY%" else print "use key %KEY|x% %KEY2|x% %KEY3|x% %KEY4|x%" endif callfunction SET_DECRYPT 1 string NAME = test.xml for i = 0 < 1 log NAME 0x37000 2862 0 2864 next i startfunction SET_DECRYPT if ENC_MODE == 1 encryption aes_128_cbc KEY IVEC elif ENC_MODE == 2 print "ENC_Mode 2 disabled!" else encryption "" "" endif endfunction startfunction SET_KEYS math i = 0 # ... putarray 0 i "" endfunction So far, so good. In the next step I replaced 0x37000 by 0x0 and used the script on the binary data block cut from dataS.gar at 0x37000. test.xml was created. Fine. Edited July 14 by shak-otay
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now