![]() |
|
Allegro SVN & Retrieving Display Modes |
Erin Maus
Member #7,537
July 2006
![]() |
I "upgraded" to the latest SVN version today (from being between 4.9.7 release and 4.9.8 release, again, with SVN) and I ran into a strange problem. I compiled Allegro as a shared library. No problems during compiling, everything went fine. I then had to make a few modifications to my game-thing, as expected. After it finally compiled properly, I tried to run it...and it crashed. I ran it through a debugger, and it crashed when it called the function al_get_num_display_modes in a loop, the first time it was called. The example program is as follows:
Allegro initializes, but it crashes on al_get_num_display_modes(). The backtrace is as so: (gdb) bt #0 _al_deduce_color_format (eds=0x0) at C:/Users/veiva/Desktop/Allegro/4.9.8/src/display_settings.c:535 #1 0x6b6b2795 in win_get_num_display_modes () at C:/Users/veiva/Desktop/Allegro/4.9.8/src/win/wnewsys.c:271 #2 0x00401327 in _mangled_main () #3 0x6b6b249b in _WinMain (_main=0x4012f0, hInst=0x400000, hPrev=0x0, Cmd=0x4e22e0 "", nShow=10) at C:/Users/veiva/Desktop/Allegro/4.9.8/src/win/wnewsys.c:136 #4 0x004013b3 in WinMain@16 () #5 0x004014e0 in main () It crashes because _al_get_new_display_settings() returns zero, as this part of GDB shows: Breakpoint 1, win_get_num_display_modes () at C:/Users/veiva/Desktop/Allegro/4.9.8/src/win/wnewsys.c:271 271 int format = _al_deduce_color_format(_al_get_new_display_settings()); (gdb) s _al_get_new_display_settings () at C:/Users/veiva/Desktop/Allegro/4.9.8/src/tls.c:247 247 if ((tls = tls_get()) == NULL) (gdb) n 248 return 0; (gdb) Yet, if I go "p tls," it shows a valid pointer. If I go "p *tls," it shows this: (gdb) p *tls $1 = {new_display_refresh_rate = 0, new_display_flags = 0, new_display_settings = 0x0, current_display = <incomplete type>, target_bitmap = <incomplete type>, new_bitmap_format = 0, new_bitmap_flags = 0, blend_source = 2, blend_dest = 3, blend_alpha_source = 2, blend_alpha_dest = 3, blend_color = {r = 1, g = 1, b = 1, a = 1}, allegro_errno = 2} I compiled Allegro with these commands (or at least, I hope I did! But it's surely a shared library...): mkdir build cd build cmake .. -G "MinGW Makefiles" make make install I just want to get my game-thing up and running again! [edit]Oh, my GCC version is 3.4.5, if that's of any help! --- |
Elias
Member #358
May 2000
|
Thanks, can confirm this here. We need to fix it before 4.9.9. -- |
Erin Maus
Member #7,537
July 2006
![]() |
Elias said: Thanks, can confirm this here. We need to fix it before 4.9.9. Thank you! I was rereading the manual and all, thinking I missed something important that changed since somewhere between 4.9.7 and 4.9.8! --- |
Milan Mimica
Member #3,877
September 2003
![]() |
Can you try calling al_reset_display_options() after al_init()? That should work around it but I'm too lazy to try. Thanks.
-- |
Erin Maus
Member #7,537
July 2006
![]() |
Doing so stops it from crashing, but then al_get_num_display_modes returns -1, as shown by GDB: (gdb) p al_get_num_display_modes() $1 = -1
--- |
Milan Mimica
Member #3,877
September 2003
![]() |
You also have to call al_set_new_display_flags(ALLEGRO_FULLSCREEN) apparently.
-- |
|