I'm trying to play an old Windows 95-era space game in Wine, Space Empires III. (Specifically, the Steam release, although I must clarify that I am *not* running this under Proton, but under vanilla Wine.)
For the most part, it runs wonderfully. However, occasionally on loading a save game I'll get an error message box:
The game then quits.Application Error
----------------------
Exception ERangeError in module SE3.EXE at 00064F73.
Range check error.
[ OK ]
After investigation, I have found that this is not technically due to a bug in Wine, but because when the game tries to animate the ships, it uses the GetTickCount Win32 API function for timing. The result is assigned to a signed 32-bit integer (which overflows after ~24.9 days of uptime.) This integer is then checked to make sure it's greater than or equal to 0. If the result is less than 0 - which it will be if the system has been up for between ~24.9 and ~49.7 days or any multiple of this range - then this exception is thrown. This was the case when I got the error, and this behaviour is reproducible on a native Windows session, too.
I realise that this is (arguably) not due to a bug in Wine, but due to the game being badly programmed. However, it made me wonder whether Wine's implementation of GetTickCount should even be using the host system's uptime, or whether it should be using the uptime of the current session (ie. the lifetime of the loaded wineserver binary). Is there already an option for this? (I can't see anything in winecfg for it.) If not, is it worth including one? I can potentially see arguments for both.