ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Mon Dec 18, 2017 3:12 am

All times are UTC




Post new topic  Reply to topic  [ 108 posts ]  Go to page Previous 1 2 3 4 5 6 Next
Author Message
PostPosted: Fri Sep 23, 2016 11:13 pm 
User avatar

Joined: Tue Feb 02, 2016 2:35 am
Posts: 981
Well...
Code:
- open input file E:\MGS_USA\CD1\MGS\DEMO.DAT
- open script E:\MGS_USA\CD1\MGS\mgs_dat.bms
- set output folder E:\MGS_USA\CD1\MGS\DEMO
- the folder doesn't exist, do you want to create it (y/N)?:
  y

  offset   filesize   filename
--------------------------------------
  00000000 6572016    0000.dat
  00644800 1456112    0001.dat
  007a8000 2586608    0002.dat
  00a1f800 3399664    0003.dat
  00d5d800 2326512    0004.dat
  00f95800 1384432    0005.dat
  010e7800 3907568    0006.dat
  014a1800 673776     0007.dat
  01546000 1322992    0008.dat
  01689000 1058800    0009.dat
  0178b800 5144560    0010.dat
  01c73800 1699824    0011.dat
  01e12800 5152752    0012.dat
  022fc800 5486576    0013.dat
  02838000 3338224    0014.dat
  02b67000 3874800    0015.dat
  02f19000 4179952    0016.dat
  03315800 665584     0017.dat
  033b8000 1046512    0018.dat
  034b7800 1769456    0019.dat
  03667800 4986864    0020.dat
  03b29000 3987440    0021.dat
  03ef6800 3973104    0022.dat
  042c0800 9422832    0023.dat
  04bbd000 2080752    0024.dat
  04db9000 1189872    0025.dat
  04edb800 1683440    0026.dat
  05076800 7182320    0027.dat
  05750000 2795504    0028.dat
  059fa800 591856     0029.dat
  05a8b000 4315120    0030.dat
  05ea8800 483312     0031.dat
  05f1e800 778224     0032.dat
  05fdc800 931824     0033.dat
  060c0000 5431280    0034.dat
  065ee000 3487728    0035.dat
  06941800 3014640    0036.dat
  06c21800 3940336    0037.dat
  06fe3800 1310704    0038.dat
  07123800 741360     0039.dat
  071d8800 1495024    0040.dat
  07345800 983024     0041.dat
  07435800 1269744    0042.dat
  0756b800 2742256    0043.dat
  07809000 608240     0044.dat
  0789d800 475120     0045.dat
  07911800 2516976    0046.dat
  07b78000 2355184    0047.dat
  07db7000 6008816    0048.dat
  08372000 6008816    0049.dat
  0892d000 2691056    0050.dat
  08bbe000 6797296    0051.dat
  09239800 649200     0052.dat
  092d8000 1134576    0053.dat
  093ed000 1255408    0054.dat
  0951f800 2299888    0055.dat
  09751000 3203056    0056.dat
  09a5f000 7909360    0057.dat
  0a1ea000 7559152    0058.dat
  0a91f800 4583408    0059.dat
  0ad7e800 659440     0060.dat
  0ae1f800 514032     0061.dat
  0ae9d000 5699568    0062.dat
  0b40c800 5236720    0063.dat
  0b90b000 13840368   0064.dat
  0c63e000 94192      0065.dat
  0c655000 718832     0066.dat
  0c704800 5713904    0067.dat
  0cc77800 3213296    0068.dat
  0cf88000 1427440    0069.dat
  0d0e4800 1318896    0070.dat
  0d226800 2578416    0071.dat
  0d49c000 2582512    0072.dat
  0d712800 7786480    0073.dat
  0de7f800 1257456    0074.dat
  0dfb2800 1675248    0075.dat
  0e14b800 13529072   0076.dat
  0ee32800 4045199360 0077.dat

Error: impossible to write 0xf11cd800 bytes (total 0xf11cd800)
       Check your disk space

Last script line before the error or that produced the error:
  10  log NAME OFFSET SIZE
The last file increases the size for no reason. I think I'm a bit clueless at this point...
Or perhaps...

_________________
Expect my username to be everywhere, whether you're using the internet or not.


Top
   
PostPosted: Fri Sep 23, 2016 11:18 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 7251
Eh, you have to add the "if" statement to handle the event of a missing findloc :)


Top
   
PostPosted: Fri Sep 23, 2016 11:24 pm 
User avatar

Joined: Tue Feb 02, 2016 2:35 am
Posts: 981
like this:
Code:
   if SIZE & 0xf0000000
      math SIZE & 0x3fffffff
      log NAME OFFSET SIZE
   else
      log NAME OFFSET SIZE
   endif

Or this:
Code:
   if END_OFFSET == ""
      math END_OFFSET = FULLSIZE
   endif
I think the latter works.
In any case, I think the problem should be solved now. I still have other archives I have to write the scripts for but that's about it for now.

_________________
Expect my username to be everywhere, whether you're using the internet or not.


Top
   
PostPosted: Sat Sep 24, 2016 8:19 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 7251
Yeah, the latter is the right one.


Top
   
PostPosted: Sun Sep 25, 2016 7:31 pm 
User avatar

Joined: Tue Feb 02, 2016 2:35 am
Posts: 981
So what am I going to do if the size of the names vary by each file despite not being referenced in the index size itself?
Code:
open FDDE "whd"
open FDDE "wav" 1
open FDSE "streams.wav" 1
get WHD_SIZE long
get WHD_SIZE_TOTAL long

for CURR_OFF = 0 < WHD_SIZE_TOTAL
   get DUMMY long
   get DUMMY long
   get NAME string
   padding 4
   get UNKNOWN1 long
   get UNKNOWN2 long
   get UNKNOWN3 long
   get UNKNOWN4 long
   get UNKNOWN5 long
   get UNKNOWN6 long
   get UNKNOWN7 long
   get UNKNOWN8 long
   get UNKNOWN9 long
   savepos CURR_OFF
next


Attachments:
MAINMENU.rar [1.79 KiB]
Downloaded 56 times

_________________
Expect my username to be everywhere, whether you're using the internet or not.


Last edited by AnonBaiter on Mon Sep 26, 2016 1:08 am, edited 1 time in total.
Top
   
PostPosted: Sun Sep 25, 2016 11:55 pm 

Joined: Thu Aug 07, 2014 10:28 pm
Posts: 135
you just do a get name string
then pad to 4


Top
   
PostPosted: Mon Sep 26, 2016 12:13 am 
User avatar

Joined: Tue Feb 02, 2016 2:35 am
Posts: 981
Like this, right?
Code:
   get NAME string
   padding 4
Also, call me an idiot, but here's how it looked like after I did exactly what you said.


Attachments:
MAINMENU.TXT [68.69 KiB]
Downloaded 53 times

_________________
Expect my username to be everywhere, whether you're using the internet or not.
Top
   
PostPosted: Mon Sep 26, 2016 8:44 am 

Joined: Thu Aug 07, 2014 10:28 pm
Posts: 135
i did that works fine
http://pastebin.com/raw/Vbgiy9Fy

Code:
goto 0x10
for
get name string
Padding 4
getdstring junk 0x30
print "%name%"
next


Top
   
PostPosted: Mon Sep 26, 2016 8:45 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 7251
Add another couple of UNKNOWN longs


Top
   
PostPosted: Mon Sep 26, 2016 10:07 am 
User avatar

Joined: Tue Feb 02, 2016 2:35 am
Posts: 981
Okay, I'm almost there...
Code:
open FDDE "whd"
open FDDE "wav" 1
open FDSE "streams.wav" 1
get WHD_SIZE long
get WHD_SIZE_TOTAL long
get DUMMY long
get DUMMY long

for CURR_OFF = 0 < WHD_SIZE
   get NAME string
   padding 4
   callfunction COPYPASTE 1
   log NAME OFFSET SIZE 1
next

startfunction COPYPASTE
      get SIX long
      get OFFSET long
      get FORMAT long
      get FREQUENCY long
      get BITS long
      get SIZE long
      get DUMMY long
      get CHANNELS long
      get DUMMY long
      get DUMMY long
      get DUMMY long
      get DUMMY long
      savepos CURR_OFF
endfunction

if BITS = 0x00000004
   open FDDE "wav" 1
elif BITS = 0x0000010
   open FDSE "streams.wav" 1
else
   cleanexit
endif
One thing to note is that on the GC version, the .whd file has that coeff part, which interferes with the files it`s trying to process.


Attachments:
MainMenu_GC.rar [2.53 KiB]
Downloaded 53 times
MainMenu_XBOX.rar [1.78 KiB]
Downloaded 45 times

_________________
Expect my username to be everywhere, whether you're using the internet or not.


Last edited by AnonBaiter on Mon Sep 26, 2016 2:42 pm, edited 4 times in total.
Top
   
PostPosted: Mon Sep 26, 2016 11:28 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 7251
A suggestion: you can avoid long copy&paste parts of code by putting them in a function to call at their place.
For example:
Code:
...
callfunction COPYPASTE 1
...

startfunction COPYPASTE
      get UNKNOWN1 long
      get UNKNOWN2 long
      get UNKNOWN3 long
      get UNKNOWN4 long
      get UNKNOWN5 long
      get UNKNOWN6 long
      get UNKNOWN7 long
      get UNKNOWN8 long
      get UNKNOWN9 long
      get UNKNOWN10 long
      get UNKNOWN11 long
      get UNKNOWN12 long
      savepos CURR_OFF
endfunction
I use this trick often to make the multi-versions scripts more readable.


Top
   
PostPosted: Mon Sep 26, 2016 2:19 pm 
User avatar

Joined: Tue Feb 02, 2016 2:35 am
Posts: 981
Well, the script isn`t quite there with how compartible it is with other versions though... especially the GC version.
See the edited post for details.

On an unrelated note, I want the script to alternate between the two archives based on this argument right here:
Code:
if BITS & 0x10
   open FDDE "wav" 1
elif BITS & 0x4
   open FDSE "streams.wav" 1
else
   cleanexit
endif
Is there any way to do this?


Attachments:
MainMenu_XBOX.TXT [39.09 KiB]
Downloaded 48 times
MainMenu_GC.TXT [49.71 KiB]
Downloaded 50 times

_________________
Expect my username to be everywhere, whether you're using the internet or not.
Top
   
PostPosted: Fri Oct 14, 2016 8:07 pm 
User avatar

Joined: Tue Feb 02, 2016 2:35 am
Posts: 981
So, how can I find an AES key for these 2 dumped/unencrypted XEX2 files so that I can use it on an encrypted archive?
common.rar

I tried findaes, but nothing happened.

Another question I like to ask is how can I "decrypt" this header(which you can see it as an attachment for later use) of an archive file(STAGE.DAT)?

And yes, these questions came from two different games(Grand Theft Auto IV, Metal Gear Solid 2).


Attachments:
stage_header.rar [40.12 KiB]
Downloaded 47 times

_________________
Expect my username to be everywhere, whether you're using the internet or not.
Top
   
PostPosted: Sat Oct 15, 2016 8:12 pm 
User avatar

Joined: Tue Feb 02, 2016 2:35 am
Posts: 981
OK, I think it's time for the third question:
So I have this .sdt file I extracted using my very own scripts, and I got this header:
Code:
00000000  10 00 00 00 10 00 00 00 00 00 00 00 02 00 00 00  ................
00000010  10 00 00 00 10 00 00 00 00 00 00 00 01 00 00 00  ................
00000020  10 00 00 00 10 00 00 00 00 00 00 00 04 00 00 00  ................
00000030  02 00 00 00 A0 05 00 00 00 00 00 00 00 00 00 00  .... ...........
Do note though that in that file, the header doesn't reference the number of entries - it only lists them.
So how can I make sure these entries are detected based on the "\x10\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00" string rather than with "set ENTRIES long [number]"(or maybe some other idea I didn't think of)? Also, the last four lines detects the sizes each format has before forming into a full file each...
Code:
math HDREMASTER_FORMAT = 0
math XORED = 0

get SDT_SIZE asize
#findloc DUMMY binary "\x10\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00"
set ENTRIES long 3

for i = 0 < ENTRIES
   getdstring DUMMY 12
   get FORMAT long
next i
get INITIAL_FORMAT long
get BLOCKSIZE long
get ALT_SIZE1 long
get ALT_SIZE2 long
putvarchr MEMORY_FILE SDT_SIZE 0
log MEMORY_FILE 0 0
putvarchr MEMORY_FILE2 SDT_SIZE 0
log MEMORY_FILE2 0 0
Here is the .sdt file in question.

_________________
Expect my username to be everywhere, whether you're using the internet or not.


Top
   
PostPosted: Sun Oct 16, 2016 8:51 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 7251
Code:
do
    get DUMMY1 long
    get DUMMY2 long
    getdstring DUMMY 8
while DUMMY1 == 0x10 && DUMMY2 == 0x10
goto -16 0 SEEK_CUR


Top
   
PostPosted: Sun Oct 16, 2016 10:59 am 
User avatar

Joined: Tue Feb 02, 2016 2:35 am
Posts: 981
OK, I think I got that now...

_________________
Expect my username to be everywhere, whether you're using the internet or not.


Top
   
PostPosted: Sun Oct 16, 2016 3:16 pm 
User avatar

Joined: Tue Feb 02, 2016 2:35 am
Posts: 981
Wait a minute, what about my two other questions?

_________________
Expect my username to be everywhere, whether you're using the internet or not.


Top
   
PostPosted: Tue Oct 18, 2016 5:52 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 7251
Open a new topic in the Game Archive section for them.


Top
   
PostPosted: Tue Oct 18, 2016 5:59 am 
User avatar

Joined: Tue Feb 02, 2016 2:35 am
Posts: 981
^ Will do.

_________________
Expect my username to be everywhere, whether you're using the internet or not.


Top
   
PostPosted: Tue Nov 22, 2016 1:17 am 
User avatar

Joined: Tue Feb 02, 2016 2:35 am
Posts: 981
So I wrote this script:
Code:
get BF_SIZE asize
get EXT extension         # in case the format uses the splitted extensions(.bf0, .bf1, .bf2 and so on), might be of some use later
idstring "BIG\x00"
get DUMMY1 long
get FILES long
get ENTRIES long
get DUMMY4 longlong
get DUMMY5 longlong
get INFO_SIZE long
get DUMMY6 long
get DUMMY7 long
get FILES2 long
get ENTRIES2 long
get INFO_OFF long
get DUMMY8 long
get DUMMY9 long
get DUMMY10 long
xmath NAMES_OFF "INFO_OFF + INFO_SIZE * 8"
xmath FOLDERS_OFF "NAMES_OFF + INFO_SIZE * 0x54"
putarray 0 i INFO_OFF
putarray 1 i NAMES_OFF
putarray 2 i FOLDERS_OFF
math OFFSET = -1
math DIRECTORY = -1
math SUB_DIRECTORIES = -1
set FOLDER string ""
set NAME string ""

callfunction EXTRACT 1

startfunction EXTRACT
   goto FOLDERS_OFF
   for ENTRY = 0 < ENTRIES
      get FIRSTFILE long
      get SUB_DIRECTORIES long
      get NEXTDIR long
      get PREVDIR long
      get PARENT long
      getdstring FOLDER 0x40
      savepos FOLDERS_OFF
   next ENTRY
   
   goto INFO_OFF
   get OFFSET long
   get DUMMY long
   savepos INFO_OFF
   
   for i = 1 <= FILES
      if i == FILES
         get NEXT_OFFSET asize
      else
         goto INFO_OFF
         get NEXT_OFFSET long
         get DUMMY long
         savepos INFO_OFF
      endif
   
      goto NAMES_OFF
      get SIZE long
      get PREVFILE long
      get NEXTFILE long
      get ENTRYDIR long
      get DUMMY long
      getdstring NAME 0x40
      savepos NAMES_OFF
      
      math NEXT_OFFSET + 4
      log NAME OFFSET SIZE
      math OFFSET = NEXT_OFFSET
   next i
endfunction
The SUB_DIRECTORIES variable on the ENTRIES argument determines the number of sub-directories. In the case of the first ENTRY("ROOT"), the first sub-directory number is 0x2b0e. After the first one comes a number of references that form a directory tree. Onto the next lines of this script comes the FILES argument. Rather than cover all of the files based on a variable, I want the script to cover the number of files based on a number of SUB_DIRECTORIES an ENTRY has. In short, I want to handle it like this:
Code:
ROOT\EngineDatas\04 Technical Bank\World&co\univers\univ_exec_get_world_key.ofc
Any tips on handling an nested directory tree?


Attachments:
sally_clean.rar [885.94 KiB]
Downloaded 43 times

_________________
Expect my username to be everywhere, whether you're using the internet or not.


Last edited by AnonBaiter on Tue Nov 22, 2016 3:31 pm, edited 1 time in total.
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 108 posts ]  Go to page Previous 1 2 3 4 5 6 Next

All times are UTC


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:
Powered by phpBB® Forum Software © phpBB Limited