[Bug 27674] Majesty 2: fog of war broken

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Jul 3 17:15:48 CDT 2011


http://bugs.winehq.org/show_bug.cgi?id=27674

--- Comment #2 from Piotr Pawlow <pp at siedziba.pl> 2011-07-03 17:15:48 CDT ---
Poking the code for several hours leads to the following results:

I can leave the code creating the cursor in device.c intact, I can leave the
code blitting the cursor in swapchain.c intact, and the game still works
properly, provided that I delete / comment out the following line in
device.c/5200, wined3d_device_set_cursor_properties():

glDeleteTextures(1, &device->cursorTexture);

Of course it makes Wine leak cursor textures.

So, is it deleting wrong texture because cursorTexture is uninitialized or
invalid at some point? It seems not, I put tracing before glDeleteTextures and
after glGenTextures. It starts by generating texture number 5, then deleting 5,
and it keeps generating / deleting, always number 5.

Does the glDeleteTextures call have some unexpected side effect? It doesn't
seem so. I can leave glDeleteTextures untoched but duplicate the line in
device.c/5275:

glGenTextures(1, &device->cursorTexture);

Of course we leak textures, but glDeleteTextures() gets called and it doesn't
break the game.

Even more surprising is that I can do this instead - add in device.c/5202:

else glGenTextures(1, &device->cursorTexture);

Leave the rest of the code untouched, just one line so that if the
device->cursorTexture is uninitialized we create one extra (which will leak).
It causes the game to use texture number *6* for the cursor instead of 5, and
somehow makes it work!

And one more funny thing: saving cursorTexture to a temporary variable, and
deleting it AFTER glGenTextures, makes the terrain all explored by default.

All of this doesn't make sense to me, and I have no idea what's going on.

I'm testing on Gefore 9600 GT with NVidia proprietary driver version 270.41.06.

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list