Rev 2 | Rev 12 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 7 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | { |
24 | { |
25 | // this function starts a chess engine as a child process. This process's stdin and |
25 | // this function starts a chess engine as a child process. This process's stdin and |
26 | // stdout are redirected to the handles we give it, so that we may read/write to it. |
26 | // stdout are redirected to the handles we give it, so that we may read/write to it. |
27 | 27 | ||
28 | wchar_t widechar_buffer[256]; |
28 | wchar_t widechar_buffer[256]; |
- | 29 | SYSTEM_INFO sysinfo; |
|
29 | SECURITY_ATTRIBUTES saAttr; |
30 | SECURITY_ATTRIBUTES saAttr; |
30 | STARTUPINFO si; |
31 | STARTUPINFO si; |
31 | FILE *fp; |
32 | FILE *fp; |
32 | 33 | ||
33 | // reset stuff first |
34 | // reset stuff first |
Line 108... | Line 109... | ||
108 | PlayerEngine_Shutdown (player); // on error, shutdown the engine |
109 | PlayerEngine_Shutdown (player); // on error, shutdown the engine |
109 | return (false); |
110 | return (false); |
110 | } |
111 | } |
111 | 112 | ||
112 | Debug_Log (L"===Found initialization file, parsing...===\n"); |
113 | Debug_Log (L"===Found initialization file, parsing...===\n"); |
- | 114 | ||
- | 115 | // SMP HACK -- is our engine Crafty ? if so, set the max CPUs to use to core max - 1 |
|
- | 116 | // (the computer will look like hung if all CPU is taken) |
|
- | 117 | if (wcsistr (options.engine.name, L"Crafty") != NULL) |
|
- | 118 | { |
|
- | 119 | GetSystemInfo (&sysinfo); // get the number of cores and build the corresponding engine initialization order |
|
- | 120 | swprintf_s (widechar_buffer, WCHAR_SIZEOF (widechar_buffer), L"mt %d\n", max (sysinfo.dwNumberOfProcessors - 1, 1)); |
|
- | 121 | ||
- | 122 | // new command line found, append it to the send buffer |
|
- | 123 | Player_SendBuffer_Add (player, 1000, widechar_buffer); |
|
- | 124 | } |
|
113 | 125 | ||
114 | // read line per line |
126 | // read line per line |
115 | while (fgetws (widechar_buffer, WCHAR_SIZEOF (widechar_buffer), fp) != NULL) |
127 | while (fgetws (widechar_buffer, WCHAR_SIZEOF (widechar_buffer), fp) != NULL) |
116 | { |
128 | { |
117 | if ((widechar_buffer[0] == L'#') || (widechar_buffer[0] == L'\n')) |
129 | if ((widechar_buffer[0] == L'#') || (widechar_buffer[0] == L'\n')) |