AIP (Artificial Intelligence Program)

Tools for osRose and osiRose will be placed in here, as well as Rose file formats.

Please PM rl2171 or lmame to get them added to the list.

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

Re: HIM

Postby Qix on Tue Sep 29, 2015 12:10 am

Are BSTR types simply the following?

  1. BYTE length
  2. CHAR[length]


Is there a guaranteed null byte at the end? That's what I'm seeing in the HIM files with the "quad" string:



Though I'm not sure if the null is part of the next data segment.

EDIT: MSDN states it's

  1. DWORD length;
  2. CHAR[length];
  3. SHORT null = 0;


but that's not what I'm seeing in these formats.

EDIT2: also, working on the HIM format, I'm seeing an extra SHORT before each FLOAT in the points list (first loop). As well, I'm also seeing an extra DWORD (or some 4 byte construct) in the header (before the point list).

This is from client v162. Going to hold off on HIM support right now because it's obviously not correct.

For completeness, here is the full HIM file I'm working with. It's from Junon 29_29, client v162.

http://pastebin.com/c8Lp1zKW

And just the first portion, since I know stuff on this forum gets outdated/broken pretty often:

  1. 0000000: 4100 0000 4200 0000 0400 0000 0000 7a43  A...B.........zC
  2. 0000010: 0000 c3ba c383 0000 c3ba c383 0000 c3ba  ................
  3. 0000020: c383 0000 c3ba c383 0000 c3ba c383 0000  ................
  4. 0000030: c3ba c383 0000 c3ba c383 0000 c3ba c383  ................
  5. 0000040: 0000 c3ba c383 0000 c3ba c383 0000 c3ba  ................
  6. 0000050: c383 0000 c3ba c383 0000 c3ba c383 0000  ................
  7. 0000060: c3ba c383 0000 c3ba c383 0000 c3ba c383  ................
  8. 0000070: 0000 c3ba c383 0000 c3ba c383 0000 c3ba  ................
  9. 0000080: c383 0000 c3ba c383 0000 c3ba c383 0000  ................
  10. 0000090: c3ba c383 0000 c3ba c383 0000 c3ba c383  ................
  11. 00000a0: 0000 c3ba c383 0000 c3ba c383 0000 c3ba  ................
  12. 00000b0: c383 0000 c3ba c383 0000 c3ba c383 0000  ................
  13. 00000c0: c3ba c383 0000 c3ba c383 0000 c3ba c383  ................
  14. 00000d0: 0000 c3ba c383 0000 c3ba c383 0000 c3ba  ................
  15. 00000e0: c383 0000 c3ba c383 0000 c3ba c383 0000  ................
  16. 00000f0: c3ba c383 0000 c3ba c383 0000 c3ba c383  ................
  17.  


[hr]

Now I'm on to IDX. Similar problem; the format isn't quite right.

Here is what I'm finding:

  1. c28b # magic (?)
  2. 0000 00c2 # base version
  3. a200 0000 # current version
  4.  
  5. 0600 0000 # num. VFS files
  6.  
  7. # DATA vfs
  8. 0900 # filename length
  9. "DATA.VFS"
  10. 00 # null
  11. 6a00 0000 # file offset
  12.  
  13. 00 # null byte (?)
  14.  
  15. # MAP vfs
  16. 0800 # filename length
  17. "MAP.VFS"
  18. 00 # null
  19. c394 c393 0400 # unknown
  20.  
  21. # GROUND vfs
  22. 0b00 # filename length
  23. "GROUND.VFS"
  24. 00 # null
  25. 2ac3 8415 00 # unknown
  26.  
  27. # 3DDATA vfs
  28. 0b00 # filename length
  29. "3DDATA.VFS"
  30. 00 # null
  31. 7c27 1900 # unknown
  32.  
  33. # BASIC vfs
  34. 0a00 # filename length
  35. "BASIC.VFS"
  36. 00 # null
  37. 731b 1e00 # unknown
  38.  
  39. # ROOT vfs
  40. 0900 # filename length
  41. "ROOT.VFS"
  42. 00 # null
  43. c2a3 0e1e 00 # unknown


And then the format seems to continue normally.

All of the unknowns seems to end in a null byte, but only the first VFS entry (DATA.VFS) actually adheres to the structure.

Here is the first portion of data from data.idx, client 162:

  1. 0000000: c28b 0000 00c2 a200 0000 0600 0000 0900  ................
  2. 0000010: 4441 5441 2e56 4653 006a 0000 0008 004d  DATA.VFS.j.....M
  3. 0000020: 4150 2e56 4653 00c3 94c3 9304 000b 0047  AP.VFS.........G
  4. 0000030: 524f 554e 442e 5646 5300 2ac3 8415 000b  ROUND.VFS.*.....
  5. 0000040: 0033 4444 4154 412e 5646 5300 7c27 1900  .3DDATA.VFS.|'..
  6. 0000050: 0a00 4241 5349 432e 5646 5300 731b 1e00  ..BASIC.VFS.s...
  7. 0000060: 0900 524f 4f54 2e56 4653 00c2 a30e 1e00  ..ROOT.VFS......
  8. 0000070: 4f13 0000 0300 0000 0000 0000 1d00 3344  O.............3D
  9. 0000080: 4441 5441 5c41 495c 4141 4a55 2d41 5155  DATA\AI\AAJU-AQU
  10. 0000090: 4147 5541 5244 2e41 4950 0000 0000 00c3  AGUARD.AIP......


Can anyone shed some light as to what those unknowns are?
o-o
User avatar
Qix
Smoulie
Smoulie
 
Posts: 34
Joined: Sat May 18, 2013 10:33 pm
Location: Behind you...

Re: IDX

Postby PurpleYouko on Tue Sep 29, 2015 3:07 pm

I don't remember coming across any problems while building a loader in excel (VBA code).
I just made it as a quickie tool to extract all STBs from a VFS. It was actually faster to code it myself than to figure out how to make one of the existing editors extract all files of a specific type.
Later i added IFO extraction to help with finding map triggers and stuff.

This utility has worked with every VFS / IDX that I've tried it on (I even managed to modify a version of this to read the AFS from Arua at one time)

not sure if this code will help much but this is how we load the IDX file in VBA (Visual Basic for Applications) using excel.
A lot of it is code to write values into cells in the spreadsheet and I like to put in bits of useless code such as "a = a" just so i can create a breakpoint which helps to debug the code. You can hover over any variable in VB to see what value it holds when the code execution has stopped at a break point.
VBA (and VB6) has no seek function. we use something like "Get #1, ReadPos, StdVersion" where #1 is the open file reference, Readpos is the position to read from and StdVersion is the variable that we read the value into.
It is therefore necessary to move the "ReadPos" pointer forward after each time we read a value from the file.
  1.  
  2. Private Sub Readidx_Click()
  3.   Dim ReadPos As Long
  4.   Dim StdVersion As Long
  5.   Dim CurVersion As Long
  6.   Dim VFSCount As Long
  7.   Dim NameLen As Integer
  8.   Dim VFSName(10) As String
  9.   Dim ThisByte As Byte
  10.   Dim VFSOffset(10) As Long
  11.   Dim FileCount(10) As Long
  12.   Dim DeletedCount(10) As Long
  13.   Dim StartOffset(10) As Long
  14.   Dim FileName As String
  15.   Dim FileOffset As Long
  16.   Dim FileSize As Long
  17.   Dim BlockSize As Long
  18.   Dim Deleted As Byte
  19.   Dim Compressed As Byte
  20.   Dim EncryptionType As Byte
  21.   Dim Version As Long
  22.   Dim Checksum As Long
  23.   Dim OutRow As Long
  24.  
  25.   Cells.Clear
  26.   OutRow = 2
  27.   filepath = Sheets("config").Cells(8, 2).Value + "data.idx"
  28.   Open filepath For Binary As 1
  29.   ReadPos = 1
  30.   Get #1, ReadPos, StdVersion
  31.   ReadPos = ReadPos + 4
  32.   Get #1, ReadPos, CurVersion
  33.   ReadPos = ReadPos + 4
  34.   Get #1, ReadPos, VFSCount
  35.   ReadPos = ReadPos + 4
  36.   For t = 1 To VFSCount
  37.     Get #1, ReadPos, NameLen
  38.     ReadPos = ReadPos + 2
  39.     For i = 1 To NameLen
  40.       Get #1, ReadPos, ThisByte
  41.       VFSName(t) = VFSName(t) + Chr(CLng(ThisByte))
  42.       ReadPos = ReadPos + 1
  43.     Next
  44.     Get #1, ReadPos, VFSOffset(t)
  45.     ReadPos = ReadPos + 4
  46.     a = a
  47.   Next
  48.   a = a
  49.   'now we read through the VFS files
  50.   For t = 1 To VFSCount
  51.     ReadPos = VFSOffset(t) + 1
  52.     Cells(OutRow, 1).Value = VFSName(t)
  53.     Get #1, ReadPos, FileCount(t)
  54.     'Cells(OutRow + 1, 1).Value = FileCount(t)
  55.     ReadPos = ReadPos + 4
  56.     Get #1, ReadPos, DeletedCount(t)
  57.     'Cells(OutRow, 3).Value = DeletedCount(t)
  58.     ReadPos = ReadPos + 4
  59.     Get #1, ReadPos, StartOffset(t)
  60.     'Cells(OutRow, 4).Value = StartOffset(t)
  61.     ReadPos = ReadPos + 4
  62.     'OutRow = OutRow + 2
  63.     a = a
  64.     If VFSName(t) = "ROOT.VFS" Then
  65.       a = a
  66.     End If
  67.     For j = 1 To FileCount(t)
  68.       Get #1, ReadPos, NameLen
  69.       ReadPos = ReadPos + 2
  70.       FileName = ""
  71.       For i = 1 To NameLen - 1
  72.         Get #1, ReadPos, ThisByte
  73.         FileName = FileName + Chr(CLng(ThisByte))
  74.         ReadPos = ReadPos + 1
  75.       Next
  76.       ReadPos = ReadPos + 1
  77.       Cells(OutRow, 1).Value = VFSName(t)
  78.       Cells(OutRow, 2).Value = FileName
  79.       Get #1, ReadPos, FileOffset
  80.       Cells(OutRow, 3).Value = FileOffset
  81.       ReadPos = ReadPos + 4
  82.       Get #1, ReadPos, FileSize
  83.       Cells(OutRow, 4).Value = FileSize
  84.       ReadPos = ReadPos + 4
  85.       Get #1, ReadPos, BlockSize
  86.       Cells(OutRow, 5).Value = BlockSize
  87.       ReadPos = ReadPos + 4
  88.       Get #1, ReadPos, Deleted
  89.       Cells(OutRow, 6).Value = CStr(Deleted)
  90.       ReadPos = ReadPos + 1
  91.       Get #1, ReadPos, Compressed
  92.       Cells(OutRow, 7).Value = CStr(Compressed)
  93.       ReadPos = ReadPos + 1
  94.       Get #1, ReadPos, EncryptionType
  95.       Cells(OutRow, 8).Value = CStr(EncryptionType)
  96.       ReadPos = ReadPos + 1
  97.       Get #1, ReadPos, Version
  98.       Cells(OutRow, 9).Value = Version
  99.       ReadPos = ReadPos + 4
  100.       Get #1, ReadPos, Checksum
  101.       Cells(OutRow, 10).Value = Checksum
  102.       ReadPos = ReadPos + 4
  103.       OutRow = OutRow + 1
  104.       a = a
  105.     Next
  106.     a = a
  107.   Next
  108.  
  109.   a = a
  110.   Close #1
  111. End Sub
  112.  


Here is the actual excel file if you care to take a look. You will need to activate the Developer tab in the ribbons options in order to see the code. Also make sure that macros are enabled.
https://mega.nz/#!fJEmgSpA!EF9gTH9uAUejqRt7aHPLM8Z7BGt7saY0WAiIdxWt7h8
Had to put it on Mega since this forum won't allow either .xlsm or .zip files to be uploaded. I really need to fix that at some point :?

ABE
I too have found a number of these file formats that don't quite jive with what I see in the actual files. I have modified a few of them from the original formats in the previous posts where i found obvious differences. I'm most familiar with formats like AIP and QSD where i found a lot of stuff not quite right in both the format file and in the osrose servers
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

MRP (Effect Animation Morpher)

Postby wolfwing on Wed Feb 19, 2020 6:56 pm

  1. :ENUM[DWORD] blend_types
  2.     ZERO            = 1
  3.     ONE             = 2
  4.     SRCCOLOR        = 3
  5.     INVSRCCOLOR     = 4
  6.     SRCALPHA        = 5
  7.     INVSRCALPHA     = 6
  8.     DESTALPHA       = 7
  9.     INVDESTALPHA    = 8
  10.     DESTCOLOR       = 9
  11.     INVDESTCOLOR    = 10
  12.     SRCALPHASAT     = 11 // ???
  13.     BOTHSRCALPHA    = 12
  14.     BOTHINVSRCALPHA = 13
  15.     BLENDFACTOR     = 14
  16.     INVBLENDFACTOR  = 15
  17. :ENDENUM
  18.  
  19. :ENUM[DWORD] blend_ops
  20.     ADD         = 1
  21.     SUBTRACT    = 2
  22.     REVSUBTRACT = 3
  23.     MIN         = 4
  24.     MAX         = 5
  25. :ENDENUM
  26.  
  27. DWORD version
  28.  
  29. LSTR zms_path
  30. LSTR zmo_path
  31. LSTR texture_path
  32.  
  33. DWORD alpha_enabled
  34. DWORD two_sided
  35. DWORD alpha_test_enabled
  36. DWORD z_test_enabled
  37. DWORD z_write_enabled
  38.  
  39. E[blend_types] BlendSource
  40. E[blend_types] BlendDestination
  41. E[blend_ops] BlendOperation
wolfwing
Clown
Clown
 
Posts: 502
Joined: Tue Mar 03, 2009 9:50 am

Previous

Return to Tools and File Format

Who is online

Users browsing this forum: No registered users and 5 guests

cron