|
GuyPerfect Catgirl Level: 68 Posts: 697/1096 EXP: 2665648 For next: 63152 Since: 07-23-07 Since last post: 1.7 years Last activity: 219 days |
|
| It's a compatibility hack I've been working on. Not a ROM, exactly, but it still falls under the category of "video games being hacked," so I'm tossing it in here.
Over the years, Lemmings Revolution has been degrading. It started in Windows XP with some funky colors going on in spots, but on Windows 7 it really devolves into an experience that's only marginally enjoyable. The problems were caused, unsurprisingly, by the game being programmed incorrectly in a few key areas relating to DirectX. It doesn't fully conform to the spec, and some of the results are arguably catastrophic from the publisher's point of view. The moral of the story is that even though your code might work on a given system or architecture, it doesn't mean it's correct. As developers, we all need to make sure any code we write that uses external libraries fully conforms to the expectations of those libraries. The patch, though still in development, can be found here: http://www.lemmingsforums.com/index.php?topic=615.msg13684#msg13684 __________ The Problems #1 - When initializing DirectSound, the game will enumerate a list of devices and presumably pick the first one returned. This worked on Windos 98 and XP, but on Windows 7, the first device is the sound card driver and not the system mixer output. The result is that on Windows 7, Lemmings Revolution has no sound. #2 - While processing textures with alpha masks, the game will use BitBlt() to copy color data, then call IDirectDrawSurface::Lock() and write only the alpha bytes into video memory. This worked fine on Windows 98, though XP had some color errors, and Windows 7 just makes everything black. The culprit? Lock() expects every byte to be written to in the specified range. Lemmings Revolution was crossing its fingers and hoping the RGB channels would be preserved, which nowadays they aren't. #3 - On the main menu, but only when you first launch the game, the cursor and all the text are just black rectangles if you're on Windows 7. After playing a level, this corrects itself. This is due to the Direct3D object not being configured to work with alpha blending on textures--something that apparently works out of the box on Windows 98 and XP. It's something that should explicitly be done in all cases, but since it didn't cause problems in development, it was probably overlooked. The Solutions #1 - Unless a program intends to prompt the user to select their audio output device, it should use whatever device is selected as the default by the system. You can do this with DirectSound by passing a driver ID of NULL. This is a simple patch of the instruction in the EXE by changing the value loaded into a register to 0 before the DirectX function is called. #2 - The textures need to be processed and initialized correctly, and the existing function in the game isn't equipped to handle that scenario. What I wound up doing was crafting a DLL with a new texture loader in it, then swapping it out to impersonate DDRAW.dll (of which only 2 functions are imported by the EXE). When calling one of the DirectDraw functions with special arguments, my DLL will return the address of the texture loader function. So a simple patch to the texture loader in the EXE was made to redirect the program into my DLL instead. #3 - The handful of function calls needed to configure the texture stage for blending with textures are run once by the DLL the first time the texture loader is called. __________ Let's take a quick tour of the history of Lemmings Revolution falling apart over the years as Windows saw its various updates! Click any thumbnail for the full image. For each triplet of images, the systems represented are in this order: Windows XP, Windows 7, and either system with the patch applied. Title Screen / Main Menu Level Select In-Game Level Results This last one's kinda hard to see, but the text on XP is barely visible. It's dark red. |










