🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

C&C Red Alert on Vista

posted in DruinkJournal
Published April 09, 2009
Advertisement
After my success with Tiberian Sun, I decided to try Red Alert too - I figured that it'll either just work, or I'll just need to add some more functions to forward to my wsock32.dll file.

No.

The problem is that Red Alert uses twipx32.dll, which is some IPX networking DLL. That wouldn't be a problem if it wasn't that the DLL links to some Windows 95, undocumented kernel32 exports for converting between segmented and linear addresses that don't exist in the NT kernel (SMapLS_IP_EBP_8, and similarly named functions).
So, I had to make my own version of this DLL. Thankfully there's only 11 exports, and only 10 of them are used, and I managed to find this online reference which some wonderful person has written which describes the parameters. Writing the DLL after that was pretty straightforward.
It would have taken me about 3 hours less than it did if I'd remembered to turn off blocking sockets first though (I thought the game was crashing because of my app, I didn't consider that recvfrom was blocking), and if I'd remembered to use htons() for the port number everywhere instead of missing a couple of places (I was using Wireshark, but had a packet filter to only capture packets on my port number, so I didn't see the packets being sent on the wrong port [cry]).

I also added registry support for specifying the log file path, and setting the log level (None=0, only errors=1, standard logging=2, verbose logging=3) which I'll port over to the Tiberian Sun patch at some point.

Another thing on my todo list for these patch DLLs is the ability to target a particular IP instead of broadcast. That would in theory let you play an Internet game of Red Alert or Tiberian Sun with the game thinking it was running on a LAN, so no need for the sodding Westwood Online or other third party shit that I always seem to have to install, and it'd allow my friends and I to play on Vista. That should be a quick change, but requires testing time (Only one of my friends has Red Alert and Tiberian Sun).


I'm off work tomorrow (Friday), and I'm staying at my girlfriends tonight. She has work tomorrow, so I'll try to get up when she does, and then put in a proper days work on this stuff. My ideal todo list for tomorrow is therefore:
  • Fix up the Red Alert patch (There's some hacks and crap in it, which is why I'm not linking it here)
  • Port registry stuff to Tiberian Sun patch
  • Investigate "targeted broadcast" packets - Possibly with some sort of NAT punch through?
  • Finish writing the article for D3D Tutorial #5

    All sounds perfectly achievable to me. If I manage to get up on time that is...
  • Previous Entry Untitled
    0 likes 1 comments

    Comments

    Nyerguds
    Just a small note... if you make a patch for Red Alert, be sure to take the 3.03 version. This is the latest official version, though it was never released beyond beta stage. Despite this, the patch is available (leaked by beta testers) because it has the first version of TS' internal internet interface (so, no more Westwood Chat mess), and doesn't seem to have any bugs. It's generally seen as the most complete version, since this patch unifies the versions after the second official expansion, The Aftermath (RA v2.00)

    This version no longer uses the thipx32.dll. Just like TS and RA2, it has its IPX junk built into the exe.

    http://www.commandandpatch.com/index.php?name=Downloads&file=details&id=23

    On a related note, a guy called Scorpio9a has already made similar patches ( http://www.understorm.net ), but his TS/RA2 patch appears to cause problems with the online multiplayer mode of the games.

    However, I've hacked the wsock32.dll patch he made (it has some sort of check on the which program is allowed to use it) to make it work on RA 3.03, and that worked fine.

    I hope you find this information useful.
    August 05, 2009 09:21 AM
    You must log in to join the conversation.
    Don't have a GameDev.net account? Sign up!
    Advertisement
    Advertisement