Hacking Lemmings Revolution

Started by GuyPerfect, April 13, 2012, 12:54:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

The Lemmings Encyclopedia

http://www.lemmingsforums.com/index.php?topic=615.msg13705#msg13705">Quote from: GuyPerfect on 2012-04-27 19:47:25
Attached to this post is Full Color v1.0 (Beta 4). This is a release candidate.

The updated Readme is as follows:

Code: [Select]
Lemmings Full Color Revolution!             Windows Vista/7 Compatibility Patch
Written and maintained by Lemmings Forums        http://www.lemmingsforums.com/
  Version 1.0 (Beta 4) - April 27, 2012


About this program:

As you've probably noticed, Lemmings Revolution has been falling apart over the
years as Windows went through its many updates. It started out innocently
enough on Windows XP: a few of the icons had wonky colors, but it was otherwise
okay. But then, when windows Vista and 7 came about, those icky colors just
turned full-on black. And the main menu became a virtually unusable cluster of
black rectangles. Oh, and the sound stopped working! It's a real mess.

Well, this handy little gadget fixes all of those problems. While the technical
details are beyond the scope of this readme file, the tl;dr version is that the
game program does not conform 100% to the DirectX specification. It was just
fine back on Windows 98 where it worked anyway, but as time marches on, we see
that the game was released with what we have since learned to be show-stopping
bugs!


Things that this gizmo will fix:
 * Restores audio on Windows Vista and 7. It was completely AWOL before.
 * Provides a new texture loading routine. This corrects the messed-up colors.
 * Tweaks the main menu graphics. Solid black rectangles are hard to read.


Things you can fix yourself:
 * Level 9-6, The High Dive, has practically never worked for users who
   selected the "Typical" installation option. This can be corrected by copying
   "lemmings.box" from the CD and into the Lemmings Revolution installation
   directory. For real. The installer doesn't copy it right for some reason.


How to use this bad boy:

 * This patch is only designed to work with the original Lemmings Revolution
   EXE files (the game has seen various releases), so if you have one with any
   modifications, don't expect it to work. When in doubt, just re-install it
   from the CD. Don't worry: you won't lose your save data.

 * Locate the Lemmings Revolution installation directory on your computer. By
   default, this is "C:\Program Files (x86)\Take 2\Lemmings Revolution\" for
   the North America releases. Believe in yourself. I'm sure you can find it.

 * Make sure "Lemmings Revolution.exe" is not read-only. You can check this by
   right-clicking the file, selecting Properties, then making sure the box next
   to "Attributes" is un-checked.

 * Copy the Full Color EXE file into the Lemmings Revolution installation
   directory and run it. If UAC is enabled, you will have to run it as
   administrator. To do so, right-click the Full Color file and select
   "Run as administrator"

 * The program will do its darnedest to fix up the Lemmings Revolution EXE so
   that it works correctly again. Be sure to read the contents of the window
   that appears for information on what it was able to accomplish. If there was
   a problem, it will let you know what went wrong.


Additional information:

As noted above, there's a few different versions of Lemmings Revolution out
there. In fact, no one's really sure just how many there are. It's not feasible
to track them all down to make a comprehensive list, so this patch is instead
designed to be flexible and figure out exactly what needs to be done by
analyzing the Lemmings Revolution EXE file that it's intended to patch.

Some of the code updates were too large or otherwise too complex to be fitted
into the original EXE file, so they were moved into a DLL file instead. The
Full Color program will produce one such DLL file when it patches Lemmings
Revolution, adding it to the installation directory. The file's name is
"patch.dll" and it is required for the game to run, so don't delete it.

In addition to patching the Lemmings Revolution EXE file, that DLL file itself
is configured to work specifically with the version of Lemmings Revolution
being patched. If you copy a patch DLL from a different installation of
Lemmings Revolution, it will not work. In order to ensure correct
functionality, always run the Full Color program on an un-modified Lemmings
Revolution EXE.


Change log:

 * April 27, 2012 - Original release
   - Introducing audio fix
   - Introducing texture fix
   - Introducing main menu fix


Credits:
 * Lemmings Revolution is ©2000 Psygnosis/Talonsoft and Take-Two Interactive
 * Lemmings Forums staff (http://www.lemmingsforums.com/)
   - ccexplore, for technical research, ideas and testing support
   - Guy Perfect, for reverse engineering and patch development
   - thick molasses, for bug investigation and testing support


Any light on when the final release is ready?

Also, is it advisable to run the patch when running the game on Windows 98, XP and/or Wine?

mobius

as far as I know, it's been tested on XP and 7. I'm not sure about Wine.
On Wine the game wasn't too bad but had some problems. It don't think it was not playable though.

If you have a Windows 98, you don't need it; the game works correctly on that version. I don't know what it would do if you tested it out...
everything by me: https://www.lemmingsforums.net/index.php?topic=5982.msg96035#msg96035

"Not knowing how near the truth is, we seek it far away."
-Hakuin Ekaku

"I have seen a heap of trouble in my life, and most of it has never come to pass" - Mark Twain


GuyPerfect

It's ready to go if we have a site to put it on. With a username like "The Lemmings Encyclopedia", I'm suddenly hopeful. (-:

The fix corrects some code in the game that didn't conform to the DirectX specification. It should run fine on any version of Windows as well as Wine.

EDIT:
If you're aiming to put this up online, let me know and I'll make a formal v1.0 release with the host included in the credits.

The Lemmings Encyclopedia

http://www.lemmingsforums.com/index.php?topic=615.msg14558#msg14558">Quote from: GuyPerfect on 2012-08-21 19:25:18
It's ready to go if we have a site to put it on. With a username like "The Lemmings Encyclopedia", I'm suddenly hopeful. (-:

The fix corrects some code in the game that didn't conform to the DirectX specification. It should run fine on any version of Windows as well as Wine.

EDIT:
If you're aiming to put this up online, let me know and I'll make a formal v1.0 release with the host included in the credits.

You can e-mail it to me, I'll add a new section under Downloads named 'patches' and link to the file on page http://tle.vaarties.nl/revolution/" class="bbc_link" target="_blank">http://tle.vaarties.nl/revolution/

GuyPerfect

No need for an e-mail. I've attached the .zip file to this post, so if you're logged in you can download it. It's all ready to go, tested, and TLE is in the credits file.


The Lemmings Encyclopedia

Has someone been able to play this game properly on Wine? On my version, 1.5.11 on Ubuntu 12.04, the mouse cursor behaves as if it's drunk. Can some confirm this behaviour? Here's a movie of what Í'm describing, in the movie I'm trying to start a new game and select a level (which I'm unable to do this time): http://vergaarbak.vaarties.nl/drunk-cursor.ogv" class="bbc_link" target="_blank">http://vergaarbak.vaarties.nl/drunk-cursor.ogv

@GuyPerfect: I know of this official patch: http://download.cnet.com/Lemmings-Revolution-patch/3000-2121_4-10236700.html" class="bbc_link" target="_blank">http://download.cnet.com/Lemmings-Revolution-patch/3000-2121_4-10236700.html . Do you know what that patch does and if it's still needed after applying your Full color patch?

Note: attached is my version of Lemmings Revolution.exe (CD label = 'Lemmings Rev'). The CD cover says (c) 2004. DCG 902350 | Dice Multimedia

mobius

http://www.lemmingsforums.com/index.php?topic=615.msg14576#msg14576">Quote from: The Lemmings Encyclopedia on 2012-08-25 04:19:56
@GuyPerfect: I know of this official patch: http://download.cnet.com/Lemmings-Revolution-patch/3000-2121_4-10236700.html" class="bbc_link" target="_blank">http://download.cnet.com/Lemmings-Revolution-patch/3000-2121_4-10236700.html . Do you know what that patch does and if it's still needed after applying your Full color patch?

Note: attached is my version of Lemmings Revolution.exe (CD label = 'Lemmings Rev'). The CD cover says (c) 2004. DCG 902350 | Dice Multimedia

that patch was to fix an issue in which the fall height which made a few levels impossible. it's glitchy though, I have the patch and still once and a while it doesn't work correctly. If you bought revolution after some date (some time in 2000) it comes with the patch already.
Supposedly; If you bought the game before that you would need the patch. You can see what goes wrong in a video posted in this thread below; at a certain height there is a chance that either lemmings will survive or die.

you can find some more info about that mysterious patch in this thread:
http://www.lemmingsforums.com/index.php?topic=585.15" class="bbc_link" target="_blank">http://www.lemmingsforums.com/index.php?topic=585.15

(sorry I keep answering Guy's questions for him http://www.lemmingsforums.com/Smileys/lemmings/winktounge.gif" alt=";P" title="Wink-Tongue" class="smiley" />)
everything by me: https://www.lemmingsforums.net/index.php?topic=5982.msg96035#msg96035

"Not knowing how near the truth is, we seek it far away."
-Hakuin Ekaku

"I have seen a heap of trouble in my life, and most of it has never come to pass" - Mark Twain


The Lemmings Encyclopedia

http://www.lemmingsforums.com/index.php?topic=615.msg14576#msg14576">Quote from: The Lemmings Encyclopedia on 2012-08-25 04:19:56
@GuyPerfect: I know of this official patch: http://download.cnet.com/Lemmings-Revolution-patch/3000-2121_4-10236700.html" class="bbc_link" target="_blank">http://download.cnet.com/Lemmings-Revolution-patch/3000-2121_4-10236700.html . Do you know what that patch does and if it's still needed after applying your Full color patch?

Note: attached is my version of Lemmings Revolution.exe (CD label = 'Lemmings Rev'). The CD cover says (c) 2004. DCG 902350 | Dice Multimedia

that patch was to fix an issue in which the fall height which made a few levels impossible. it's glitchy though, I have the patch and still once and a while it doesn't work correctly. If you bought revolution after some date (some time in 2000) it comes with the patch already.
Supposedly; If you bought the game before that you would need the patch. You can see what goes wrong in a video posted in this thread below; at a certain height there is a chance that either lemmings will survive or die.

you can find some more info about that mysterious patch in this thread:
http://www.lemmingsforums.com/index.php?topic=585.15" class="bbc_link" target="_blank">http://www.lemmingsforums.com/index.php?topic=585.15

(sorry I keep answering Guy's questions for him http://www.lemmingsforums.com/Smileys/lemmings/winktounge.gif" alt=";P" title="Wink-Tongue" class="smiley" />)

Thanks for that answer, I don't know if mine is patched already. Will find out when I can play the game with wine and reach the specific levels.

For the drunk mouse, I made a bug report: http://bugs.winehq.org/show_bug.cgi?id=31545" class="bbc_link" target="_blank">http://bugs.winehq.org/show_bug.cgi?id=31545

GuyPerfect

The official patches address some game program bugs and should be applied before the Full Color compatibility fix.

I've had mouse issues on Wine as well. It's definitely something to bring to their attention.

jclampy

Ok, while reading about font problems in another game I noticed a solution had been found.

I have only tested this with ATI so have no idea what Nvidia users can do sorry.  http://www.lemmingsforums.com/Smileys/lemmings/winktounge.gif" alt=";P" title="Wink-Tongue" class="smiley" />

Anyhow, if your in game font looks like a dog's breakfast then try this;
ATI users have an option called "Alternate Pixel Centers", if you activate that then font issues
in Lemmings Revolution are solved.

I personally use ATI Tray Tools which I know has this option and it is also easy to setup a profile
just for Lemmings Revolution, incase it causes problems for other games. (or not?)

Just writing up some instructions which I'll post here:
http://www.lemmingsforums.com/index.php?topic=646.msg14732#msg14732" class="bbc_link" target="_blank">http://www.lemmingsforums.com/index.php?topic=646.msg14732#msg14732

Unfortunately no idea whether Nvidia has an option like this or how a Nvidia user would use it.

LemSteven

I got a new computer last month with Windows 7, and I have many of the same graphical bugs mentioned earlier in the thread.  However when I tried to run the patch, I got an error that read:

ERROR: Unrecognized EXE File
This Lemmings Revolution EXE file contains unknown data and cannot be patched. Try re-installing the game from the CD.


Apparently the patch is not recognizing my version of the EXE file.  My Lemmings Revolution.exe file is 921,600 bytes, with a modified date of July 14, 2000, 7:49:40 AM; however when I install it on the hard drive, the modified date there is July 10, 2000, 2:23:56 PM (the file size is the same).  I've tried running the patch on both files without success.  I don't have problems with the splat height and High Dive glitches, and the music works fine.

Any assistance on this issue would be appreciated.  http://www.lemmingsforums.com/Smileys/lemmings/smiley.gif" alt=":)" title="Smiley" class="smiley" />

GuyPerfect

http://www.lemmingsforums.com/index.php?topic=615.msg14788#msg14788">Quote from: LemSteven on 2012-09-09 16:30:39
Any assistance on this issue would be appreciated.  http://www.lemmingsforums.com/Smileys/lemmings/smiley.gif" alt=":)" title="Smiley" class="smiley" />

You first. (-:

You realize that all I can do from here is guess, right? How about a copy of that mysterious EXE file?

LemSteven

Thanks for looking into it!  Here's the .exe file.

GuyPerfect

Found the issue. In every version of the EXE we've encountered so far, the call to DirectSoundCreate() looks like this:

Code: [Select]
8B 00             MOV  EAX, DWORD PTR [EAX]
50                PUSH EAX
E8 xx xx xx xx    CALL xxxxxxxx ;DirectSoundCreate(), exact address varies

In that EXE file you just posted, however, it looks like this:

Code: [Select]
8B 04 02          MOV  EAX, DWORD PTR [EDX+EAX]
50                PUSH EAX
E8 xx xx xx xx    CALL xxxxxxxx ;DirectSoundCreate()

The patcher looks for the following byte pattern to locate the call to DirectSoundCreate(): 8B 00 50 E8 ** ** ** **. However, the code in your EXE doesn't start with 8B 00, but with 8B 04 02. At some point, Take 2 either changed the code that starts up DirectSound, or built it with a different compiler, and that's why the patcher is failing.
__________

I have modified the patcher program and have attached a v1.1 release candidate to this post. Note that this is not a formal release, so don't point people to it just yet.

What it does differently is that if it can't find the first DirectSoundCreate() call, it will search for the second one. If it finds either, it writes the following instruction to the "MOV EAX" instruction:

Code: [Select]
31 C0    XOR EAX, EAX
This forces EAX to be equal to zero, effectively passing NULL as the device ID to DirectSoundCreate(), which in turn informs the subsystem to use the default audio device. This is how the game should have been doing it all along. |-:

In the event the patcher located the second form, which has an additional byte, it will overwrite that byte with this:

Code: [Select]
90       NOP
NOP literally has no function, so it allows the number of bytes to remain the same while honoring our reprogramming of it.

So hey, LemSteven, check the attachment and see if it works for you. Everyone else, check the attachment and make sure it works for you as well. I want to make sure I didn't break anything while implementing this fix. (-:
__________

As for the EXE, I did notice one change in particular: the language-selection option on the main menu is missing:

http://i7.photobucket.com/albums/y255/bgng/DifferentyMenu_zpsb648c39f.png" alt="" class="bbc_img" />

This was either an early US-only release, or a late US-only release. I can't decide which is more likely. (-: