Hi,
from IWineD3DDeviceImpl_CreatePalette:
- memset(&palVersion, 0, sizeof(LOGPALETTE));
- object->hpal = CreatePalette(&palVersion);
- memcpy(&object->palVersion, &palVersion, sizeof(LOGPALETTE));
- /* FIXME Using the palVersion member from IWineD3DPaletteImpl for
CreatePalette + * directly causes a heap corruption. Why? In original ddraw this was a WORD, + * which failed too. Confused ...
*/
- object->palNumEntries = IWineD3DPaletteImpl_Size(Flags);
That can't really work. This only creates a palette with zero entries. You need to set palNumEntries before calling CreatePalette. Attached patch( applies on top of yours ) should fix it( i.e. do it the same way it is done in the current implementation). But the text colors in AoE are still lacking :/. Needs some more investigation ...
I'll look at this, the whole palette code is a bit messy. My suspicion is that IDirectDrawPaletteImpl_SetEntries / IWineD3DPaletteImpl_SetEntries doesn't update all surfaces that use a palette. I also have to take IWineD3DDevice::SetCurrentTexturePalette, IWineD3DDevice::GetCurrentTexturePalette as well as IWineD3DDevice::SetPaletteEntries and GetPaletteEntries in account.