eriksoe / Schockabsorber

A program to play games etc. created with Adobe Director (abandoned)
26 stars 3 forks source link

progress??? #1

Open Brian151 opened 8 years ago

Brian151 commented 8 years ago

Have you made any new progress on this, or even plan to continue work on it?

Also, I find your documentation pretty confusing to make sense of, and there's no explanation how to even use your code for anything.

tomysshadow commented 7 years ago

This would appear to me to be an abandoned project (see the last commit date) albeit a valiant attempt - I was able to use it to correct the mapping table on a DXR I extracted from a Shockwave Projector EXE file, still seems way too early to actually play such files. An application like this would ideally need to be written in C++ because the Xtras are DLL files, and you need to be able to load and use them, even if they're third party...

Brian151 commented 7 years ago

I feared as much...

Honestly, I was hoping to adapt this to make a decompiler. I've been painstakingly re-engineering the internal format , but hit major delays. And sadly, I can't make heads or toes of this docu. My efforts: https://github.com/Brian151/Various-Projects/tree/master/Shockwave

Between both the documentation on This repository, and http://fileformats.archiveteam.org/wiki/Lingo_bytecode, I sort of can disassemble the scripts. However, on multiple occassions, the exact format of chunks has confused me. Even the 'documented' bytecode chunks are giving me problems, and I have results that seem not to match what the documentation says I should encounter. But, I also was trying manual disassembly, too...so... Even so, I was very cautious offsets matched exactly...

Would you be interested in a collaboration? I've hit more or less a dead end because my understanding of some formats, specifically binary/compressed isn't the greatest. How well do you understand this library's "envelope" classes? As I said, I don't understand anything about it as of yet. Also, I'm not able to work exclusively on this project, but if I had someone else helping, and actually solving stuff, it'd certainly inspire me more to work on it. So, what do you say?

Also, what do you hope to achieve by reversing shockwave? I want to decompile older games before Shockwave is dead, or an update kills them, so their data/assets can be recovered/archived, maybe the games, themselves can be ported.

tomysshadow commented 7 years ago

I don't understand a whole lot about the format. I do know you can use offzip and Jauder Naub on DCR files and what you end up with looks pretty similar to a DXR file that's been split apart. I think they're similar but DCR uses zlib compression on some resources. I understand the mapping table. I had a Shockwave Projector containing a DXR file and the mapping table was based on locations in the EXE file so when I tore it out they were all wrong, so I used this code to quickly loop through them and correct them all. I also get how the beginning of the sections work in that they're names followed by lengths, typical binary stuff.

The LctX, Lscr and Lnam sections have me completely confused. I get that Lnam is a bunch of strings with the names of properties, which only seem to be there in case there's an error, but I don't get how they correlate with their actual values. I was also able to use Ollydbg on DIRAPI.DLL and see which Lingo functions were being called - some Xtras include documentation in their X32 files (starting with "new object me") that tend to reflect the actual order of the functions within them. X32 files, I've discovered, are actually just DLL files with a different extension, and W32 files are containers for these.

I've been using this because I was trying (and succeeded) to get a number of old 3D Groove SX engine games to work which all use Shockwave, as well as a number of other Shockwave games. As I said though, I like Python but it isn't a good language for this purpose.

I should also add that you can always use a Stub Projector to play Shockwave files outside of the browser.

Brian151 commented 7 years ago

I at first didn't understand even the basic constructs of the format. The XFIR header always confused me, because it's so unlike adobe's other formats. Then I encountered that other site, it's a RIFF derivative. Based off of this, it's 100% possible to dissect the components of any given uncompressed, unprotected movie/cast (cst and dir) out. But... there's understanding the internal formats to deal with. This is quite the pain, look at all MY notes mentioning "this seems inconsistent" , "this doesn't make any sense" , etc...

I partially disassembled a LctX , but parts didn't seem to match what the documentation says I should find. I also partly disassembled a Lscr, but again, parts didn't match documentation from what I could tell... Lnam is just a string array, there's nothing special to it. Say you compile function foo(){var bar = 1} the Lnam contains a string array with "foo","bar". But, the Lnam is utterly useless to us if we can't associate the scripts with the names. It's no secret the .x32 files are just dlls. What is secret is their internal workings. Indeed, any player needs to be able to use them, or substitute them. Something using native code is the smartest way, yes.

It's really not a great language for any more advanced purpose, but there's entire games and editors written with it, so what do I know? I got tired of the whitespace senstitivity, and encountered numerous errors. Haven't touched it in probably 4 years, but that doesn't mean I can't somewhat read Python code. The code in this library is just foreign to me.... that's the problem. Want to talk about inadequate, I'd be porting to...probably JavaScript!

A what?

So, what of my offer/request? Between the two of us, maybe we could figure stuff out? (or more than is already) I've currently got issues fully re-constructing cast members, and I'm focusing on bitmap members at present. I know their raw pixels are probably in the BitD sections, but I can't figure out how to turn that into readable data... I also want to get something for converting .swa audio to 'REAL' mp3 files, or even .wav... I can play them, but not always properly, and editing has thus far not worked. extracting the extra data that director embeds would be useful, also.

tomysshadow commented 7 years ago

Sounds like it'd be interesting. I'm currently in college and also have a job so I wouldn't be able to work on this all the time either, but maybe I could help. I will say I haven't dug too deep into the format.

If you extract DCRs with offzip the last file always contains a message about "Macromedia ziplib compression," which I guess must be close enough to zlib (or the same) for offzip to use?

QuickTime can play .swa and convert them to .mov and Goldwave can open them (revealing they are just PCM streams) as well as save them out to a number of formats, I'm guessing it shouldn't be so hard to deal with but I'm pretty sure most sounds aren't stored as SWA. I've never actually used Director myself but I've seen DCRs that make reference to AIFF files but these are nowhere to be found. Interestingly I noticed the game WRC Championship Rally stores its sounds in seperate CCT files which Goldwave can also open but they are all split up into parts and there's no cue points. Maybe the snd sections contain cue points if the sounds are split up and need to loop somewhere?

Really, I'd just like to have a utility that can take apart a DXR file so I can edit one section of it in a hex editor and inject it back in. This would make it easy to defeat leech protection where a game requires it be played on a website that no longer exists. You can usually use XAMPP to circumvent that but it's not the nicest solution.

Brian151 commented 7 years ago

I'll create a new repo just for this, and with any luck, invite you to it

it's probably almost exactly the same, given this library uses zlib.

i read they're basically mp3, but with certain internal data used just by shockwave. firefox can also play them in html5 audio tags, i'm aware quicktime can play them. was unaware it can convert them. i'd prefer a format not controlled by adobe or apple, however. (especially since quicktime is basically dead) A lot of shockwave games use one or more external casts, sometimes the reasons for it is questionable. right, snd... iirc, those really didnt give me anything useful... XMED contain swa's and even swf. the SWA itself contains the cue point, iirc...

a good decompiler can automate this process. ultimately, i want something that can dissassemble the bytecode and extract assets. the same can also be done in reverse. However, many decompilers do not properly support editing, even with swf. Every such attempt I made failed... anyways, a decompiler would be the way to go for re-building the files. but first we need a decompiler. and to do that, we need the format released/cracked...