Woo! An update already! Also, an idea.
The PatcherAs ccexplore pointed out, there's who-knows-how-many versions of Lemmings Revolution out there. I think instead of forcing everyone to just use one particular EXE of our own design, we can distribute a patching program that will edit whatever EXE file the user happens to have, patching it to work with the texture edit. This way, that "Unknown String" error is virtually impossible to occur, and we get the added benefit of not actually distributing a copyrighted file.
If we can round up as many copies of Lemmings Revolution and its patches as we can, we can construct a list of them so the patcher knows what to change in order to get the textures working again. And whatever else we decide our DLL should do.
The UpdateIn yesterday's hack, I was passing
all textures through my own function, even the ones that worked before. As it turns out (and an examination of the assembly confirms), the problem
only occurred when the texture was having an alpha channel injected after the fact. All of the paletted textures that had transparency done with a color key were just fine. Nonetheless, all of them went through my function.
The thing is, I'm not sure how those color keys were determined, so when my function came across paletted textures, they weren't transparent at all (see earlier screen shot). My solution to that was to run a checksum on all of them, then put those in a list along with the color value of the pixels that were supposed to be transparent. That worked, more or less, but it wasn't 100% accurate. The bomb icon had a couple of holes in it, the main cursor had some black dots appear, etc. It wasn't great, but it was better than it was because all the
other textures looked correct now.
So it occurred to me, "You know, the game knows what to do with the paletted textures, and handles them correctly. If I just let it do its thing in the event an alpha mask is not present, it should make
all of the textures load 100% correctly." And that's exactly what I did. I removed the checksum/color value code from the DLL and told it to return to the function in Lemmings Revolution if no alpha mask was provided. Otherwise, it will keep doing what it was doing yesterday and construct an RGBA pixel buffer for a write-once operation to texture memory.
Man does it look good now. Textures are now processed with 100% accuracy to the way the game was designed to look. This is incredibly satisfying. (-:
Not that it matters to anyone here, but the new patch to the texture function looks like this:
00472DC8 | 51 | PUSH ECX |
00472DC9 | 6A 00 | PUSH 0 |
00472DCB | 6A 01 | PUSH 1 |
00472DCD | E8 EE400300 | CALL 004A6EC0 |
00472DD2 | FFD0 | CALL NEAR EAX |
00472DD4 | 83F8 04 | CMP EAX, 4 |
00472DD7 | 0F84 5B0B0000 | JE 00473938 |
00472DDD | 90 | NOP |
00472DDE | 90 | NOP |
00472DDF | 90 | NOP |
00472DE0 | 90 | NOP |