Black Screen with Solaris 1.0.4, ddraw v0.5.1
rafael-57 opened this issue · comments
Hi,
the latest version doesn't work properly for this game.
I've tested version 0.2.1 and it works, the game doesn't lag anymore and it displays correctly.
Any idea on what could cause this issue?
Thank you
I don't fully understand the problem (not really an expert on floating point arithmetic myself), but I guess the game does something to mess up the FPU state (x87 stack overflow?), which causes the std::ceil function call in DDrawCompat from the display filter shader setup code to return -nan at some point. It's then cast to int, which becomes INT_MIN, then 1 is subtracted, so it rolls over to INT_MAX, and this is passed into the shader as a loop count. I assume this is what causes the subsequent TDR (Timeout Detection & Recovery), which resets the display driver.
Replacing std::ceil with ceilf seems to work around the problem. Please try this fix:
ddraw.zip (diff.txt)
Fixed in v0.5.2.
Sorry for getting back late, I only saw the message now so I couldn't test the workaround.
Thank you for fixing it!!!!!