OK, after some further work I've now finalized the web download process. So far as you're concerned it works in the same way as ProQuake and Qrack downloading, but behind the scenes a few things have changed.
I'm not using libcurl anymore; it's native Windows code all the way. I suppose the argument for libcurl is that it's portable, but since I'm Direct3D I've already sold that particular farm.
This means that - as before - all you need is DirectQ.exe for this to work, no additional DLLs, no DLL version hell, just nice and clean and easy.
The native code depends on some Internet Explorer components. If you're one of those people who likes to remove Internet Explorer from your PC using unofficial hacks this WILL PROBABLY NOT work for you. I don't actually know to be honest; it's possible that the components required will remain behind as they live in Windows rather than in Program Files.
In any event, I dynamically load everything and have some robust failure cases written so the engine at least won't crash. You'll just need to download the missing models yourself.
Another difference is that it no longer creates the temp file in your Quake folder. Instead it uses the TEMP folder from your user profile, so if anything bad does happen partway through the download you can take some consolation that your Quake folder won't be polluted by orphaned left-behind bits.
I've added a download progress indicator to it, and removed the output from keepalive messages while downloading (the keepalive messages still happen, they just don't write to screen). The progress indicator just puts a percentage completed to the console at roughly 10% intervals. This should help reassure you that the download is actually happening, and enable you to cancel it if you want (by disconnecting) if it's taking too long.
Some of the more verbose messages have been tightened up. The original code printed the name of the file you were downloading I think 3 times (!!!) during the process. I reckon you only need to see it once - when the download starts - and then either a plain and simple success or failure message.
I've also fixed some genuinely weird looking bugs in it; free-ing a static buffer, for example. I've added some more meaningful error messages and cleaned up the original (quite messy) code too.
Another nice result.
Tuesday, March 23, 2010
Web Download is Finalized
Posted by
mhquake
at
7:15 PM
Subscribe to:
Post Comments (Atom)
8 comments:
What is the web download for exactly? For downloading and loading maps like Quake injector? Or Does it have something to do with Multiplayer?
Multiplayer.
Multiplayer only. If you're connected to a server but you don't have the map it's running, it gets downloaded for you.
Fun code to write.
Hmmm... Internet Explorer components, eh? Make sure to make the code rock solid! We don't want dirty hackers exploiting code, or the code of said components to inject malware or spyware...
I believe it just uses the native networking API behind the scenes so it should be OK.
I know you're probably at least 50% joking, but it does raise an interesting question - one that almost makes me regret using the words "Internet Explorer components"...
Should I switch it to the native network API? Just to avoid the potential FUD?
I'm one of those that removes IE.
I've currently got IE installed because I haven't actually bothered this install yet.
But if sometime down the road you update the code to not use IE that would be supersweet.
Also...awesome...awesome awesome.
"I know you're probably at least 50% joking, but it does raise an interesting question - one that almost makes me regret using the words 'Internet Explorer components'..."
I'm sorry I kind of scared you about that, but you know Microsoft and IE; you just can't be too careful. IE-6 was the worst browser for exploitation as it didn't really have good security. As time went on it got better, I guess, but as I said, you just can't be too careful...
Once again, sorry for the scare.
Well the real problem is ActiveX controls and VB scripts which had permission to run literally any arbirtary code on your PC. The underlying network transport is no worse than the underlying network transport for regular filesharing (or Quake multiplayer).
It's academic anyway as I now have fully native API code written to do the download, and it's even simpler!
Post a Comment