Author | Message | Time |
---|---|---|
Grok | Skywing authorized me to post this on NNTP, so I'm copying here for anyone interested. This was in reply to someone wanting to know how to make starcraft not use 100% CPU. Updated version: This is From [vL]Skywing himself: ----------------------------- "The Starcraft GUI thread doesn't use any wait functions in it's message loop, which means it uses as much CPU time as the OS will give it. My fix was adding a call to a wait function in the message loop, so the thread would only use processor time when it needed to." [code] // This is my C version of the problematic message handling function in Storm.dll for // SDlgDialog windows. BOOL __fastcall SDlgDialogProcessMessage(HWND hSDlg) { MSG msg; if(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) { __asm { call Storm_Ordinal_00cb // I just used __asm call so that I wouldn't call Storm_Ordinal_00dc // have to use typedefs and function pointers. } return FALSE; } if(msg.message == WM_QUIT) { PostQuitMessage(msg.wParam); return TRUE; } // ESI = hWnd if(hSDlg && IsDialogMessageA(hSDlg, &msg)) // No real accelerators are used! Instead, return TRUE; // IsDialogMessageA is used with child control captions (i.e. &V) // ESP+04 = msg TranslateMessage(&msg); DispatchMessage(&msg); return TRUE; } while(!GetProp(hDlg, "SDlg_EndDialog")) SDlgDialogProcessMessage(hDlg); [/code] | February 21, 2003, 4:35 PM |
pileofcrap(cantlogin)@sch | what exactly are we looking at here? | March 4, 2003, 6:58 PM |
St0rm.iD | Nice, so do we just add this to the DefWndProc hook? | March 4, 2003, 8:36 PM |
Yoni | ??? No, the code above is Skywing's translation of the bad code by Blizzard. You shouldn't use it. | March 5, 2003, 10:18 AM |
St0rm.iD | Thought so. | March 5, 2003, 4:22 PM |