diff --git a/src/win32/Direct3D.cpp b/src/win32/Direct3D.cpp index 10ee3d36..db4cae23 100644 --- a/src/win32/Direct3D.cpp +++ b/src/win32/Direct3D.cpp @@ -21,7 +21,7 @@ #ifndef NO_D3D // The number of pixel-filter threads to be created -#define NTHREADS ( theApp.maxCpuCores ) +#define NTHREADS ( nThreads ) #pragma comment( lib, "d3d9" ) #pragma comment( lib, "d3dx9" ) @@ -114,6 +114,7 @@ private: bool rectangleFillsScreen; PFTHREAD_DATA *pfthread_data; HANDLE *hThreads; + int nThreads; struct VERTEX { FLOAT x, y, z, rhw; // screen coordinates @@ -174,6 +175,8 @@ Direct3DDisplay::Direct3DDisplay() rectangleFillsScreen = false; pfthread_data = NULL; hThreads = NULL; + nThreads = theApp.maxCpuCores; + if( nThreads > 16 ) nThreads = 16; } diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index 674a7f59..0c584bcb 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -2597,6 +2597,9 @@ int VBA::detectCpuCores() int processor_count = ( CPUInfo[1] & 0x00FF0000 ) >> 16; + // some CPUs probably do not support this instruction properly + if( processor_count < 1 ) processor_count = 1; + return processor_count; }