func_getTYPE.bms
Ok, this post is extremely long overdue. When extracting files there's often no extension given, so I normally would test for the extensions that exist in the archive and just adjust a function at the end of the script. Lately I've run into too many GRAFs with no names or extensions and I think it's time to get some automation going here.

I'll slowly update the below script with different heuristics as I encounter more and more file types. I know that there are file scanners for all kinds of types but I need this to determine the type inside MEMORY_FILE to adjust the extension on-the-fly.
So you can go from
to
Code: Select all
include "func_getTYPE.bms"
...
log MEMORY_FILE OFFSET SIZE
callfunction getTYPE 1
string NAME += EXT
log NAME 0 SIZE MEMORY_FILE
...
There's also the ZNAME variable which holds the filename in some file types (e.g. *.vag). Obviously, add
Code: Select all
...
if ZNAME != ""
string NAME += "_"
string NAME += ZNAME
endif
string NAME += EXT
...
for this (or just "set NAME ZNAME" if you want to leave out theID/CRC/TOC name).
Of course there are thousands of file types and many of them cannot be identified clearly, e.g. txt/inf/log/lua etc.
If you encounter any file type that isn't included in this script, just PM me and I'll see what I can do.
You do not have the required permissions to view the files attached to this post.