Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Allegro 4.4.1 + MinGW64 errors!

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Allegro 4.4.1 + MinGW64 errors!
Zepper
Member #8,715
June 2007
avatar

Now I know my confusion.

http://alleg.sourceforge.net/wip.html (it has 4.4.1 as downloads, outdated page, must be disabled).
http://alleg.sourceforge.net/download.html (up-to-date page).

Thomas Fjellstrom
Member #476
June 2000
avatar

I downloaded the .rar and extracted it over allegro 4.4.X and tried to run git diff but it is totally retarded. The diffs just aren't coming out right. It's trying to replace nearly the whole file in some cases, and there are a lot of files to be patched. Not sure what to do.

I think you can tell it to ignore whitespace changes (which should fix issues with line endings), or ignore line endings... Or do a batch dtou on it?

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Zepper
Member #8,715
June 2007
avatar

Here's a problem I'm unable to solve it.

File src/win/wwnd.c, line 480. Problem: comparison is always true: result >= WAIT_OBJECT_0

#SelectExpand
1 /* message loop */ 2 while (TRUE) { 3 result = MsgWaitForMultipleObjects(_win_input_events, _win_input_event_id, FALSE, INFINITE, QS_ALLINPUT); 4 if ((result >= WAIT_OBJECT_0) && (result <= WAIT_OBJECT_0 + _win_input_events)) { 5 /* one of the registered events is in signaled state */ 6 (*_win_input_event_handler[result - WAIT_OBJECT_0])(); 7 } 8 else if (result == WAIT_OBJECT_0 + _win_input_events) {

Thomas Fjellstrom
Member #476
June 2000
avatar

result is probably unsigned, and WAIT_OBJECT is 0. So its not really an error, but it is a pointless comparison.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

This is the code in git :

src/win/wwnd.c#SelectExpand
477 /* message loop */ 478 while (TRUE) { 479 result = MsgWaitForMultipleObjects(_win_input_events, _win_input_event_id, FALSE, INFINITE, QS_ALLINPUT); 480 if ((result >= WAIT_OBJECT_0) && (result < (int)(WAIT_OBJECT_0 + _win_input_events))) { 481 /* one of the registered events is in signaled state */ 482 (*_win_input_event_handler[result - WAIT_OBJECT_0])(); 483 } 484 else if (result == WAIT_OBJECT_0 + _win_input_events) { 485 /* messages are waiting in the queue */ 486 while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { 487 if (GetMessage(&msg, NULL, 0, 0)) { 488 DispatchMessage(&msg); 489 } 490 else { 491 goto End; 492 } 493 } 494 } 495 }

You changed && (result < (int)(WAIT_OBJECT_0 + win_input_events))) to <=, which is incorrect according to MSDN :

Return code/value Description

WAIT_OBJECT_0 to (WAIT_OBJECT_0 + nCount– 1)

If bWaitAll is TRUE, the return value indicates that the state of all specified objects is signaled. If bWaitAll is FALSE, the return value minus WAIT_OBJECT_0 indicates the pHandles array index of the object that satisfied the wait.

WAIT_OBJECT_0 + nCount

New input of the type specified in the dwWakeMask parameter is available in the thread's input queue. Functions such as PeekMessage, GetMessage, and WaitMessage mark messages in the queue as old messages. Therefore, after you call one of these functions, a subsequent call to MsgWaitForMultipleObjects will not return until new input of the specified type arrives.

This value is also returned upon the occurrence of a system event that requires the thread's action, such as foreground activation. Therefore, MsgWaitForMultipleObjects can return even though no appropriate input is available and even if dwWakeMask is set to 0. If this occurs, call GetMessage or PeekMessage to process the system event before trying the call to MsgWaitForMultipleObjects again.

Edit
The comparison may be pointless now, but if WAIT_OBJECT_0 ever changes it won't be, so it should remain the same.

Zepper
Member #8,715
June 2007
avatar

My program (using Allegro) crashes exactly there.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Zepper
Member #8,715
June 2007
avatar

EDIT2: even without warnings, my emu crashes after loading a game. I tested a few Allegro programs (like Allegro demo) and it worked.

#SelectExpand
1static void wnd_thread_proc(HANDLE setup_event) 2{ 3 int result; 4 MSG msg; 5 6 _win_thread_init(); 7 _TRACE(PREFIX_I "window thread starts\n"); 8 9 /* setup window */ 10 if (wnd_create_proc) 11 allegro_wnd = wnd_create_proc(directx_wnd_proc); 12 else 13 allegro_wnd = create_directx_window(); 14 15 if (!allegro_wnd) 16 goto End; 17 18 /* now the thread it running successfully, let's acknowledge */ 19 SetEvent(setup_event); 20 21 /* message loop */ 22 while (TRUE) { 23 result = MsgWaitForMultipleObjects(_win_input_events, _win_input_event_id, FALSE, INFINITE, QS_ALLINPUT); 24 if ((result >= (int)WAIT_OBJECT_0) && (result < (int)(WAIT_OBJECT_0 + _win_input_events))) { 25 /* one of the registered events is in signaled state */ 26 (*_win_input_event_handler[result - WAIT_OBJECT_0])(); 27 } 28 else if (result == (int)(WAIT_OBJECT_0 + _win_input_events)) { 29 /* messages are waiting in the queue */ 30 while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { 31 if (GetMessage(&msg, NULL, 0, 0)) { 32 DispatchMessage(&msg); 33 } 34 else { 35 goto End; 36 } 37 } 38 } 39 } 40 41 End: 42 _TRACE(PREFIX_I "window thread exits\n"); 43 _win_thread_exit(); 44}

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Zepper said:

EDIT2: even without warnings, my emu crashes after loading a game. I tested a few Allegro programs (like Allegro demo) and it worked.

Sorry, you're being a little vague here - you are running allegro programs through an emulator you wrote? And some programs work, but not others? With or without the patch to wwnd.c?

Zepper
Member #8,715
June 2007
avatar

shrugs My program is a NES videogame emulator for Windows. It uses Allegro.
The problem seems to be at wwnd.c as I already pointed out.
Allegro demo works, but my program doesn't.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Okay, like I said before, can you post a backtrace? And the values of local variables?

You can use 'bt' and 'info locals' within GDB to accomplish this.

gdb>backtrace
...
gdb>frame 0
gdb>info locals

Zepper
Member #8,715
June 2007
avatar

Not much info. The GUI loads normally. Once I select a file, it crashes and the mouse becomes very very slow.

#SelectExpand
1C:\rnes>gdb rocknes 2GNU gdb (GDB) 7.6.1 3Copyright (C) 2013 Free Software Foundation, Inc. 4License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 5This is free software: you are free to change and redistribute it. 6There is NO WARRANTY, to the extent permitted by law. Type "show copying" 7and "show warranty" for details. 8This GDB was configured as "x86_64-w64-mingw32". 9For bug reporting instructions, please see: 10<http://www.gnu.org/software/gdb/bugs/>... 11Reading symbols from C:\rnes\rocknes.exe...done. 12(gdb) r 13Starting program: C:\rnes/rocknes.exe 14[New Thread 3284.0x3e8] 15[New Thread 3284.0xda4] 16[New Thread 3284.0x988] 17[New Thread 3284.0xc60] 18[New Thread 3284.0x5ec] 19[New Thread 3284.0xc24] 20[New Thread 3284.0xd28] 21[New Thread 3284.0xdb0] 22[New Thread 3284.0xdb8] 23[New Thread 3284.0x7f4] 24[New Thread 3284.0xdb4] 25[New Thread 3284.0xfec] 26[New Thread 3284.0x9a0] 27[New Thread 3284.0xdf8] 28[New Thread 3284.0x520] 29[New Thread 3284.0xf1c] 30[New Thread 3284.0x46c] 31[New Thread 3284.0xcf0] 32[New Thread 3284.0xd90] 33warning: Critical error detected c0000374 34 35 36Program received signal SIGTRAP, Trace/breakpoint trap. 370x0000000077b940d0 in ntdll!RtlUnhandledExceptionFilter () 38 from C:\Windows\system32\ntdll.dll 39(gdb) back 40#0 0x0000000077b940d0 in ntdll!RtlUnhandledExceptionFilter () 41 from C:\Windows\system32\ntdll.dll 42#1 0x000000000022f160 in ?? () 43#2 0x000007fefe9c10c8 in msvcrt!free () from C:\Windows\system32\msvcrt.dll 44#3 0x0000000077b94120 in ntdll!RtlUnhandledExceptionFilter () 45 from C:\Windows\system32\ntdll.dll 46#4 0x00000000c0000374 in ?? () 47#5 0x0000000000000001 in ?? () 48#6 0x0000000000000001 in ?? () 49#7 0x000000000340ccd0 in ?? () 50#8 0x0000000000435d1c in gzclose_r () 51#9 0x0000000000000003 in ?? () 52#10 0x0000000000000000 in ?? () 53(gdb) frame 0 54#0 0x0000000077b940d0 in ntdll!RtlUnhandledExceptionFilter () 55 from C:\Windows\system32\ntdll.dll 56(gdb) info locals 57No symbol table info available. 58(gdb) q 59A debugging session is active. 60 61 Inferior 1 [process 3284] will be killed. 62 63Quit anyway? (y or n) y

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Did you use a debugging version of allegro? (-DCMAKE_BUILD_TYPE=Debug to cmake command), there is usually more info. You probably also need to select the correct thread to get a backtrace with main in it.

Just curious, but how do you know where it is crashing?

This should get you some better information :

gdb>info threads
gdb>thread # 

(select each thread # until you find the thread that contains the main function)

gdb>backtrace

gdb>frame # 

(select the frame # that corresponds to the frame that called MsgWaitForMultipleObjects, if that is where it crashed)

info locals

Thomas Fjellstrom
Member #476
June 2000
avatar

could also try "thread apply all bt full".

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

 1   2 


Go to: