[r1286] Aborts on title screen

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Chris
Posts: 2969
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

[r1286] Aborts on title screen

Post by Chris »

When trying to start a game of Doom1 on Linux, ZDoom consistantly asserts. Output:

Code: Select all

zdoom: /home/kitty/zdoom/src/sdl/i_system.cpp:168: void I_FreezeTimePolled(bool): Assertion `TicFrozen != 0' failed.

Program received signal SIGABRT, Aborted.
0xb7fce410 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7fce410 in __kernel_vsyscall ()
#1  0xb732e181 in raise () from /lib/libc.so.6
#2  0xb732f948 in abort () from /lib/libc.so.6
#3  0xb73277d5 in __assert_fail () from /lib/libc.so.6
#4  0x0812dbe2 in I_FreezeTimePolled (frozen=false) at /home/kitty/zdoom/src/sdl/i_system.cpp:168
#5  0x0815b820 in D_Display () at /home/kitty/zdoom/src/d_main.cpp:753
#6  0x0815bdc6 in D_DoomLoop () at /home/kitty/zdoom/src/d_main.cpp:852
#7  0x0815d296 in D_DoomMain () at /home/kitty/zdoom/src/d_main.cpp:2670
#8  0x0812c633 in main (argc=1, argv=0xbf8afaa4) at /home/kitty/zdoom/src/sdl/i_main.cpp:272
If I run zdoom with +map e1m1, it works.

I wonder if it's due to the game getting "frozen" before it tries to call I_GetTimePolled.. I_FreezeTimePolled(true) will set TicFrozen to I_GetTimePolled(false), and if that's the first time it's called (or if it's the first time SDL_GetTics returns non-0), it will return 0. BaseTime gets set to tm if BaseTime is 0 (which would happen on the first call, and possibly even the second if the first had SDL_GetTics return 0, setting BaseTime to 0), and tm-BaseTime will always be 0 even after scaling. It then tries to unfreeze, sees TicFrozen == 0, and dies.
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: [r1286] Aborts on title screen

Post by randi »

How about now? The problem here looks like it's because SDL_GetTicks() returns the time since initializing SDL, but timeGetTime() returns the time since booting the system. So this will never be 0 on Windows, but can be 0 with SDL if game startup is too fast.
Blzut3
 
 
Posts: 3202
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: [r1286] Aborts on title screen

Post by Blzut3 »

Works for me now.
User avatar
Chris
Posts: 2969
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: [r1286] Aborts on title screen

Post by Chris »

Still asserts for me. Even made sure to do a full rebuild.
Here's some traced output (tm is traced in I_GetTimePolled, frozen/unfrozen in I_FreezeTimePolled before the asserts):

Code: Select all

Resolution: 800 x 600
tm = 1469
tm = 1469
frozen
tm = 1470
tm = 1472
tm = 1514
tm = 1556
tm = 1603
tm = 1646
tm = 1689
tm = 1732
tm = 1777
tm = 1821
tm = 1867
tm = 1913
tm = 1959
tm = 2005
tm = 2052
tm = 2100
tm = 2148
tm = 2196
tm = 2244
tm = 2292
tm = 2346
tm = 2393
tm = 2439
tm = 2485
tm = 2531
tm = 2578
tm = 2623
tm = 2668
tm = 2714
tm = 2758
tm = 2801
tm = 2844
tm = 2887
tm = 2929
tm = 2971
tm = 3014
tm = 3056
tm = 3099
tm = 3141
tm = 3184
tm = 3227
tm = 3269
tm = 3312
unfrozen
zdoom: /home/kitty/zdoom/src/sdl/i_system.cpp:171: void I_FreezeTimePolled(bool): Assertion `TicFrozen != 0' failed.
So, it seems the +1 can go (the first call is well above 0). Perhaps a call to I_WaitForTic(I_GetTime(false)) before freezing would suffice?

EDIT
Alternatively, how about a flag to mark if the game is currently frozen or not, instead of assuming TicFrozen == 0 is unfrozen and TicFrozen != 0 is frozen?
Blzut3
 
 
Posts: 3202
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: [r1286] Aborts on title screen

Post by Blzut3 »

Chris wrote:So, it seems the +1 can go (the first call is well above 0).
I wouldn't remove it since as I said it works for me. (The only differences in my code is the strife inventory bar fix and I added 1280x1024 to the resolutions table.)
User avatar
Chris
Posts: 2969
Joined: Thu Jul 17, 2003 12:07 am
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: [r1286] Aborts on title screen

Post by Chris »

Blzut3 wrote:
Chris wrote:So, it seems the +1 can go (the first call is well above 0).
I wouldn't remove it since as I said it works for me.
Removing the +1 won't hurt anything, though. In fact, it probably doesn't even need to set an initial BaseTime value if it's 0 (since SDL_GetTicks counts from SDL initialization, I don't see this being a problem). The problem is apparently that the call to I_FreezeTime(true) happens so soon after the initial I_GetTime call that it gets frozen on tic 0. The code, however, assumes it's not frozen if TicFrozen == 0, thus it asserts when it tries to unfreeze thinking it hasn't been frozen yet (even though it has been).

The attached patch is an "easy" fix. Though I still think it may be a better idea to use a global flag to indicate frozen time instead of assuming tic 0 is never frozen.
Attachments
sdltime.diff.gz
(248 Bytes) Downloaded 37 times
Post Reply

Return to “Closed Bugs [GZDoom]”