GetTickCount (Win32 API): Can Wine return uptime of session instead of uptime of host system?

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
Sophira
Newbie
Newbie
Posts: 4
Joined: Mon Oct 14, 2019 6:55 am

GetTickCount (Win32 API): Can Wine return uptime of session instead of uptime of host system?

Post by Sophira »

Hi there,

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:
Application Error
----------------------

Exception ERangeError in module SE3.EXE at 00064F73.
Range check error.

[ OK ]
The game then quits.

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.
Sophira
Newbie
Newbie
Posts: 4
Joined: Mon Oct 14, 2019 6:55 am

Re: GetTickCount (Win32 API): Can Wine return uptime of session instead of uptime of host system?

Post by Sophira »

I wanted to edit my post, but don't see an option to, so I should clarify: When I said "the game is badly programmed", I didn't mean it as harshly as it probably sounds, sorry. It's actually pretty good; it's just that it was written in an era when not many people actually had their computers on for that long.

I apologise for the badly-chosen phrase.
Sophira
Newbie
Newbie
Posts: 4
Joined: Mon Oct 14, 2019 6:55 am

Re: GetTickCount (Win32 API): Can Wine return uptime of session instead of uptime of host system?

Post by Sophira »

Does anyone know if there's a more appropriate venue to ask for this feature request? Is the bug tracker an appropriate place?
Locked