DXGL r868 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r867‎ | r868 | r869 >
Date:21:51, 15 September 2018
Author:admin
Status:new
Tags:
Comment:
Fix CreateThread on Windows 9x systems.
Modified paths:
  • /ddraw/glRenderWindow.cpp (modified) (history)
  • /ddraw/glRenderer.cpp (modified) (history)
  • /dxglcfg/dxglcfg.cpp (modified) (history)
  • /dxglcfg/timer.cpp (modified) (history)

Diff [purge]

Index: ddraw/glRenderWindow.cpp
@@ -52,6 +52,7 @@
5353
5454 glRenderWindow::glRenderWindow(int width, int height, bool fullscreen, HWND parent, glDirectDraw7 *glDD7, bool devwnd)
5555 {
 56+ DWORD threadid;
5657 ddInterface = glDD7;
5758 this->width = width;
5859 this->height = height;
@@ -59,7 +60,7 @@
6061 this->device = devwnd;
6162 hParentWnd = parent;
6263 ReadyEvent = CreateEvent(NULL,false,false,NULL);
63 - hThread = CreateThread(NULL,0,ThreadEntry,this,0,NULL);
 64+ hThread = CreateThread(NULL,0,ThreadEntry,this,0,&threadid);
6465 WaitForObjectAndMessages(ReadyEvent);
6566 CloseHandle(ReadyEvent);
6667 ReadyEvent = NULL;
@@ -149,6 +150,9 @@
150151 {
151152 HWND hParent;
152153 HCURSOR cursor;
 154+ #ifdef _TRACE
 155+ DWORD threadid;
 156+ #endif
153157 switch(msg)
154158 {
155159 case WM_CREATE:
@@ -187,7 +191,7 @@
188192 case WM_HOTKEY:
189193 #ifdef _TRACE
190194 trace_end = TRUE;
191 - CreateThread(NULL,0,BeepThread,NULL,0,NULL);
 195+ CreateThread(NULL,0,BeepThread,NULL,0,&threadid);
192196 UnregisterHotKey(hWnd,1);
193197 hotkeyregistered = false;
194198 #else
Index: ddraw/glRenderer.cpp
@@ -1687,6 +1687,7 @@
16881688 This->busy = CreateEvent(NULL,FALSE,FALSE,NULL);
16891689 This->start = CreateEvent(NULL,FALSE,FALSE,NULL);
16901690 HWND hTempWnd;
 1691+ DWORD threadid;
16911692 if(fullscreen)
16921693 {
16931694 switch (dxglcfg.fullmode)
@@ -1878,7 +1879,7 @@
18791880 This->inputs[6] = glDD7;
18801881 This->inputs[7] = This;
18811882 This->inputs[8] = (void*)devwnd;
1882 - This->hThread = CreateThread(NULL, 0, glRenderer_ThreadEntry, This->inputs, 0, NULL);
 1883+ This->hThread = CreateThread(NULL, 0, glRenderer_ThreadEntry, This->inputs, 0, &threadid);
18831884 WaitForSingleObject(This->busy,INFINITE);
18841885 }
18851886
Index: dxglcfg/dxglcfg.cpp
@@ -3136,12 +3136,13 @@
31373137 HWND hProgressWnd;
31383138 WNDCLASSEX wndclass;
31393139 HWND hTempWnd;
 3140+ DWORD threadid;
31403141 switch (Msg)
31413142 {
31423143 case WM_INITDIALOG:
31433144 hProgressWnd = NULL;
3144 - CreateThread(NULL, 0, ProgressThread, &hProgressWnd, 0, NULL);
3145 - while (hProgressWnd == NULL) Sleep(10);
 3145+ CreateThread(NULL, 0, ProgressThread, &hProgressWnd, 0, &threadid);
 3146+ while (hProgressWnd == NULL) Sleep(100);
31463147 hDialog = hWnd;
31473148 ZeroMemory(&wndclass, sizeof(WNDCLASSEX));
31483149 wndclass.cbSize = sizeof(WNDCLASSEX);
Index: dxglcfg/timer.cpp
@@ -54,6 +54,7 @@
5555
5656 void StartTimer(HWND hWnd, UINT message, double framerate)
5757 {
 58+ DWORD threadid;
5859 TimerhWnd = hWnd;
5960 wndMessage = message;
6061 delay = (1.0/framerate)*1000.0;
@@ -60,7 +61,7 @@
6162 stoptimer = false;
6263 if(!hThread)
6364 {
64 - hThread = CreateThread(NULL,0,TimerThread,NULL,0,NULL);
 65+ hThread = CreateThread(NULL,0,TimerThread,NULL,0,&threadid);
6566 CloseHandle(hThread);
6667 }
6768 }