Rev 175 | Rev 185 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 175 | Rev 179 | ||
---|---|---|---|
Line 32... | Line 32... | ||
32 | char *endptr; |
32 | char *endptr; |
33 | wchar_t app_pathname[MAX_PATH]; |
33 | wchar_t app_pathname[MAX_PATH]; |
34 | wchar_t font_pathname[MAX_PATH]; |
34 | wchar_t font_pathname[MAX_PATH]; |
35 | wchar_t temp_string[MAX_PATH]; |
35 | wchar_t temp_string[MAX_PATH]; |
36 | DWORD ascii_buffersize; |
36 | DWORD ascii_buffersize; |
- | 37 | WSADATA wsa_data; |
|
37 | 38 | ||
38 | // does an InstallerPath registry key exist? if so, it means we've just been installed |
39 | // does an InstallerPath registry key exist? if so, it means we've just been installed |
39 | ascii_buffersize = sizeof (temp_string); |
40 | ascii_buffersize = sizeof (temp_string); |
40 | if ((RegOpenKeyEx (HKEY_CURRENT_USER, L"SOFTWARE\\Chess Giants", 0, KEY_READ | KEY_SET_VALUE, &hRegistryKey) == 0) |
41 | if ((RegOpenKeyEx (HKEY_CURRENT_USER, L"SOFTWARE\\Chess Giants", 0, KEY_READ | KEY_SET_VALUE, &hRegistryKey) == 0) |
41 | && (RegQueryValueEx (hRegistryKey, L"InstallerPath", 0, NULL, (BYTE *) temp_string, &ascii_buffersize) == 0)) |
42 | && (RegQueryValueEx (hRegistryKey, L"InstallerPath", 0, NULL, (BYTE *) temp_string, &ascii_buffersize) == 0)) |
Line 115... | Line 116... | ||
115 | LocalizedTexts_Init (); |
116 | LocalizedTexts_Init (); |
116 | if (language_count < 1) |
117 | if (language_count < 1) |
117 | { |
118 | { |
118 | MessageBox (NULL, L"Chess Giants was unable to load its data files.\nThe game cannot start.\n\nPlease reinstall this program to fix the problem.", L"Chess Giants", MB_ICONERROR | MB_OK); |
119 | MessageBox (NULL, L"Chess Giants was unable to load its data files.\nThe game cannot start.\n\nPlease reinstall this program to fix the problem.", L"Chess Giants", MB_ICONERROR | MB_OK); |
119 | return (-1); // bomb out on error |
120 | return (-1); // bomb out on error |
- | 121 | } |
|
- | 122 | ||
- | 123 | // initialize WinSock. God knows why it's necessary. |
|
- | 124 | if (WSAStartup (MAKEWORD (2, 2), &wsa_data) != 0) |
|
- | 125 | { |
|
- | 126 | MessageBox (NULL, LOCALIZE (L"Error_NetworkInitializationFailed"), LOCALIZE (L"ImportantMessage"), MB_ICONERROR | MB_OK); |
|
- | 127 | return (-1); // bomb out if network couldn't be initialized |
|
120 | } |
128 | } |
121 | 129 | ||
122 | // read configuration data |
130 | // read configuration data |
123 | Config_Load (); |
131 | Config_Load (); |
124 | 132 | ||
Line 486... | Line 494... | ||
486 | // save configuration data |
494 | // save configuration data |
487 | Config_Save (); |
495 | Config_Save (); |
488 | 496 | ||
489 | // unload localized texts |
497 | // unload localized texts |
490 | LocalizedTexts_Shutdown (); |
498 | LocalizedTexts_Shutdown (); |
- | 499 | ||
- | 500 | // shutdown WinSock |
|
- | 501 | WSACleanup (); |
|
491 | 502 | ||
492 | ExitProcess (0); // it looks like this is needed to terminate reluctant Chess Giants instances... |
503 | ExitProcess (0); // it looks like this is needed to terminate reluctant Chess Giants instances... |
493 | return (0); // and return to Windows. |
504 | return (0); // and return to Windows. |
494 | } |
505 | } |
495 | 506 |