READ THE RULES: Click here

Follow us on Facebook: https://www.facebook.com/xentax/ :)

Scripting Help (from Troubleshooting forum)

Coders and would-be coders alike, this is the place to talk about programming.
elcondor
VIP member
VIP member
Posts: 18
Joined: Tue Dec 14, 2004 11:28 am

Scripting Help (from Troubleshooting forum)

Post by elcondor » Fri Jan 07, 2005 8:52 pm

Well, as promised, here's the script I "Guest ;)" wrote for the You Don't Know Jack games (it reads all 'QFold' files only, the files on hard drives or the bigger archives are a different format, which I'll need help on)

I'll post it as a bms, so it can be loaded in MexScriptor and pulled apart or otherwise studied.

As a script, I think the politest term to use for it is 'functional' - in a bid to make things a little clearer i've used the odd DUMMYL to skip past longs rather than anything more elegant.

I assure you, this works 100% on every file of this format I've tried it on (The STR information isn't directly connected to the filenames).

Don't expect to be able to use the extracted files just yet, I think it's a standard Apple sound format (ima4 is present, suggesting something like .snd), but I can't find out the exact details needed to play it.
You do not have the required permissions to view the files attached to this post.

elcondor
VIP member
VIP member
Posts: 18
Joined: Tue Dec 14, 2004 11:28 am

Post by elcondor » Fri Jan 07, 2005 9:08 pm

I wonder if someone can help with this:

Basically, I found another SRF format (the one I've coded for already seems to be bulletproof now, but that's the 'quick access' style as opposed to the 'big archive' one).

The files are so big I can't really do much about sending a sample, so bear with my explanation for a second (all mathematical longs are big endian, like the other example).

The first long is an ID, 'srf1' (I think this was supposed to be different to the other one, to show the difference in layout, but no example I've seen has an alternate ID string).
The second long is big endian, and is the overall size of the file, while the third is the total size of the 'header' portion (the data starts immediately after it), However, this is where the fun really starts.

The fourth long is a recognisable text string, such as Mb01. My experiments with the actual executable suggest that the 'M' just acts as a marker, and the real filename is the three other bytes (e.g. b01) So far, so simple, but the next long after one of these M??? strings is a file counter, which leads to a loop of filenumber, file offset, file size, with the last ID being equal to the file counter. We then move back to an M??? string, and the whole process repeats.

How can I get all of these files out (assuming that name duplication is permitted by MEX3, having the three byte code as markers would be fine)? I've noticed that the obvious nested loops approach (setting up one loop looking for M??? strings until we run out of header, while using another internal loop to log the file info until all files between M??? strings are accounted for) seems to confuse the parser and crash the engine.

Since I can't copy out of the MexScriptor directly, I include a JPG of the scripting window
You do not have the required permissions to view the files attached to this post.

User avatar
Mr.Mouse
Site Admin
Posts: 4039
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 412 times
Been thanked: 558 times
Contact:

Post by Mr.Mouse » Fri Jan 07, 2005 11:12 pm

First, thanks for the script, I'm sure going to try it and then add it to the next release! (crediting you of course). ;)

As to that other format, you can actually copy the text right out of Mex3Scriptor. Just select it all (ctrl+a) and copy it (ctrl+c). Voila.

In the script you make the engine search for an 'M' which is not really the way to go. There may be a lot of bytes in a file, and chances are you will stumble upon an M that is just part of something else and not anything related to your header.

I also noticed that you load up a long variable in FILENAME (a variable I would expect to be a string) and Reversing it even and then logging it with the Log command. Do you know I never even tried that? I just assumed my code would not be able to handle that, but it does I noticed from the script you attach above!! LOL! Excellent! :D
However, I'm pretty sure you can't use a "Math FILENAME += FILEID ;" construction, as the engine has no way to tell whether you wish to append a character to a string, it will just tell you a variable type mismatch occured.

As for the crash, that is bound to happen if you take account the above. Besides that, IF the script finds an M that is not part of the marker, it might be that your FILECNTL gets a number that is completely inappropriate.

Hope that helps. :)

elcondor
VIP member
VIP member
Posts: 18
Joined: Tue Dec 14, 2004 11:28 am

Post by elcondor » Sat Jan 08, 2005 8:37 pm

However, I'm pretty sure you can't use a "Math FILENAME += FILEID ;" construction, as the engine has no way to tell whether you wish to append a character to a string, it will just tell you a variable type mismatch occured.
I took this out of the script, so that no appending occurs - and the crash still happens.

Basically, what I've got to try to figure out is how I can get two concurrent routines, the one which locates and logs the main name, and the one which actually does the extraction (My information on the format shows that the 'M' character does not occur in anything other than these main filenames when in the header portion, where it apparently stands for Media).

User avatar
Mr.Mouse
Site Admin
Posts: 4039
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 412 times
Been thanked: 558 times
Contact:

Post by Mr.Mouse » Sat Jan 08, 2005 10:51 pm

Ahh.. I wish I could take a look at that file! :)

Perhaps it is possible to attach just a small portion of the file (enough to expose the format) ?

elcondor
VIP member
VIP member
Posts: 18
Joined: Tue Dec 14, 2004 11:28 am

Post by elcondor » Sun Jan 09, 2005 9:06 pm

I'll have to try to get hold of some webspace, because I can't find a file small enough to fit here.

Bear with me, I'll have something ready by the end of this week.

User avatar
Captain
Site Admin
Posts: 252
Joined: Wed Jan 15, 2003 6:25 pm
Location: Home
Has thanked: 2 times
Been thanked: 61 times
Contact:

Post by Captain » Sun Jan 09, 2005 9:41 pm

elcondor wrote:I'll have to try to get hold of some webspace, because I can't find a file small enough to fit here.

Bear with me, I'll have something ready by the end of this week.
How big is this file? I can open up a public ftp for you if you want...

elcondor
VIP member
VIP member
Posts: 18
Joined: Tue Dec 14, 2004 11:28 am

Post by elcondor » Tue Jan 11, 2005 3:03 pm

It's OK, I have a lot of filespace, just wanted to get off dialup first ;)

http://www.mametesters.org/elcondor/JACKSND1.SRF is one example, as is
http://www.mametesters.org/elcondor/SHORTVAR.SRF and

http://www.mametesters.org/elcondor/COMRCIAL.SRF

Shortvar is the smallest, but the others have more info.

PS. If anyone knows of a utility that can play MAC System 7 audio files or SFIL filetypes, but on a Windows platform, I'd like to know about it, because that's the audio format used.

elcondor
VIP member
VIP member
Posts: 18
Joined: Tue Dec 14, 2004 11:28 am

Post by elcondor » Tue Jan 11, 2005 3:38 pm

Repeat after me: SRF stands for Script/Resource File - the fork is included already.

If that's right, then the scripting is going to be easier than I thought for the original format, but the new format will still need looking at.

User avatar
Mr.Mouse
Site Admin
Posts: 4039
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 412 times
Been thanked: 558 times
Contact:

Post by Mr.Mouse » Tue Jan 11, 2005 3:41 pm

Okay thanks, I will download them and take a good look at them!

Intimidated
VIP member
VIP member
Posts: 4
Joined: Wed Dec 21, 2005 7:24 am
Been thanked: 1 time

Post by Intimidated » Wed Dec 21, 2005 7:37 am

Hi guys.

I'm sorry to pull up such an old topic, but i've been trying to deal with the SRF files in the UK version of "You don't know jack" pretty much solidly for the last 7 days now.

Unfortunately MultiEx couldn't deal with the SRF's properly, so I wrote a script in visual basic. I don't know the scripting language that MultiEx uses, so if anybody fancies having a shot at converting my vb code into a script for multiex, go ahead ;) - This script can handle any srf.

Anyway, my main issue is the format of the audio files.

They appear to be SFIL/SND (Macintosh System 7 sound archive) with IMA4 ADPCM compression.

The closest i've come so far to decoding the audio is to stick a RIFF/WAV header on it with an MS IMA ADPCM compression tag, but the sound is VERY distorted.

Do we have any Mac users who might be able to either a) try and play / convert an extracted SFIL or b) might know how to do so in windows?

Many Thanks

Tom.

Link to the SND sample: http://www.bolt7.com/Mb04.1.snd
Link to the same sample with a WAV header: http://www.bolt7.com/Mb04.1.wav
You do not have the required permissions to view the files attached to this post.

User avatar
Mr.Mouse
Site Admin
Posts: 4039
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 412 times
Been thanked: 558 times
Contact:

Post by Mr.Mouse » Wed Dec 21, 2005 7:42 am

Hi Tom. Thanks for the donation, once again.

I will go through your code. :)

elcondor
VIP member
VIP member
Posts: 18
Joined: Tue Dec 14, 2004 11:28 am

Post by elcondor » Wed Dec 21, 2005 8:56 pm

Can I just point out here that the problem you may be having with the YDKJUK SRF files (Not the sound stuff) may be due to me not submitting the revised script correctly?


There's a script on the XeNTaX wiki for You Don't Know Jack that is supposed to open any SRF file, including YDKJUK ones, but I didn't send it in time for the latest MultiEx release.

How would I go about submitting the new version?

User avatar
Mr.Mouse
Site Admin
Posts: 4039
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 412 times
Been thanked: 558 times
Contact:

Post by Mr.Mouse » Wed Dec 21, 2005 9:19 pm

Well, you can actually just sign up at the WIKI and add your new script there, or add it to the page. If you think the script there is not correct, then please do update it with your better one! 8) The WIKI is open to everyone!

User avatar
Dinoguy1000
Site Admin
Posts: 721
Joined: Mon Sep 13, 2004 1:55 am
Has thanked: 106 times
Been thanked: 130 times

Post by Dinoguy1000 » Fri Dec 23, 2005 7:42 pm

...Except spambots. :wink:
Welcome to Xentax!

Rules | Requests | Wiki

If you run across a post that breaks the rules, please report the post - a mod or admin will handle it from there.

Post Reply