Rev 50 | Rev 83 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 50 | Rev 59 | ||
---|---|---|---|
Line 18... | Line 18... | ||
18 | // WARNING: it does also build the smilies list ! |
18 | // WARNING: it does also build the smilies list ! |
19 | 19 | ||
20 | void *inifile; |
20 | void *inifile; |
21 | smiley_t *smiley; |
21 | smiley_t *smiley; |
22 | char *file_buffer; |
22 | char *file_buffer; |
- | 23 | wchar_t language_name[64]; |
|
23 | wchar_t smiley_pathname[MAX_PATH]; |
24 | wchar_t smiley_pathname[MAX_PATH]; |
24 | wchar_t *smiley_name; |
25 | wchar_t *smiley_name; |
- | 26 | int language_index; |
|
25 | int smiley_index; |
27 | int smiley_index; |
26 | int file_length; |
28 | int file_length; |
27 | FILE *fp; |
29 | FILE *fp; |
28 | 30 | ||
29 | // open the INI file |
31 | // open the INI file |
Line 46... | Line 48... | ||
46 | options.want_sepiafilter = (INIFile_ReadEntryAsBool (inifile, L"options", L"use sepia filter for past moves", true) > 0); |
48 | options.want_sepiafilter = (INIFile_ReadEntryAsBool (inifile, L"options", L"use sepia filter for past moves", true) > 0); |
47 | options.want_autorotateon1vs1 = (INIFile_ReadEntryAsBool (inifile, L"options", L"auto-rotate board",true) > 0); |
49 | options.want_autorotateon1vs1 = (INIFile_ReadEntryAsBool (inifile, L"options", L"auto-rotate board",true) > 0); |
48 | options.rotate_speed = INIFile_ReadEntryAsLong (inifile, L"options", L"rotation speed", 5); |
50 | options.rotate_speed = INIFile_ReadEntryAsLong (inifile, L"options", L"rotation speed", 5); |
49 | 51 | ||
50 | // [display] |
52 | // [display] |
- | 53 | READ_WIDESTRING (language_name, inifile, L"display", L"language", L"auto"); // first, try to read the language from the config file |
|
- | 54 | for (language_index = 0; language_index < language_count; language_index++) |
|
- | 55 | if (_wcsicmp (languages[language_index].name, language_name) == 0) |
|
- | 56 | { |
|
- | 57 | language_id = language_index; // identify the claimed language's ID among the list of known languages |
|
- | 58 | break; // stop searching as soon as we find it |
|
- | 59 | } |
|
- | 60 | if (language_index == language_count) |
|
- | 61 | { |
|
- | 62 | GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SENGLANGUAGE, language_name, WCHAR_SIZEOF (language_name)); // if unspecified, query the OS locale |
|
- | 63 | for (language_index = 0; language_index < language_count; language_index++) |
|
- | 64 | if (_wcsicmp (languages[language_index].name, language_name) == 0) |
|
- | 65 | { |
|
- | 66 | language_id = language_index; // identify the claimed language's ID among the list of known languages |
|
- | 67 | break; // stop searching as soon as we find it |
|
- | 68 | } |
|
- | 69 | } |
|
- | 70 | if (language_index == language_count) |
|
- | 71 | { |
|
- | 72 | for (language_index = 0; language_index < language_count; language_index++) |
|
- | 73 | if (_wcsicmp (languages[language_index].name, L"English") == 0) |
|
- | 74 | { |
|
- | 75 | language_id = language_index; // if still not found, fallback to the English language |
|
- | 76 | break; // stop searching as soon as we find it |
|
- | 77 | } |
|
- | 78 | } |
|
- | 79 | if (language_index == language_count) |
|
- | 80 | language_id = 0; // if still not found, fallback to the first language known |
|
51 | options.want_fullscreen = (INIFile_ReadEntryAsBool (inifile, L"display", L"fullscreen", false) > 0); |
81 | options.want_fullscreen = (INIFile_ReadEntryAsBool (inifile, L"display", L"fullscreen", false) > 0); |
52 | options.window_width = INIFile_ReadEntryAsLong (inifile, L"display", L"window width", 1024); |
82 | options.window_width = INIFile_ReadEntryAsLong (inifile, L"display", L"window width", 1024); |
53 | options.window_height = INIFile_ReadEntryAsLong (inifile, L"display", L"window height", 768); |
83 | options.window_height = INIFile_ReadEntryAsLong (inifile, L"display", L"window height", 768); |
54 | options.want_filtering = (INIFile_ReadEntryAsBool (inifile, L"display", L"enable texture filtering", true) > 0); |
84 | options.want_filtering = (INIFile_ReadEntryAsBool (inifile, L"display", L"enable texture filtering", true) > 0); |
55 | options.want_hiquality = (INIFile_ReadEntryAsBool (inifile, L"display", L"enable high quality filtering", true) > 0); |
85 | options.want_hiquality = (INIFile_ReadEntryAsBool (inifile, L"display", L"enable high quality filtering", true) > 0); |
Line 229... | Line 259... | ||
229 | INIFile_WriteEntryAsBool (inifile, L"options", L"use sepia filter for past moves", options.want_sepiafilter); |
259 | INIFile_WriteEntryAsBool (inifile, L"options", L"use sepia filter for past moves", options.want_sepiafilter); |
230 | INIFile_WriteEntryAsBool (inifile, L"options", L"auto-rotate board", options.want_autorotateon1vs1); |
260 | INIFile_WriteEntryAsBool (inifile, L"options", L"auto-rotate board", options.want_autorotateon1vs1); |
231 | INIFile_WriteEntryAsLong (inifile, L"options", L"rotation speed", options.rotate_speed); |
261 | INIFile_WriteEntryAsLong (inifile, L"options", L"rotation speed", options.rotate_speed); |
232 | 262 | ||
233 | // [display] |
263 | // [display] |
- | 264 | WRITE_WIDESTRING (L"display", L"language", languages[language_id].name); |
|
234 | INIFile_WriteEntryAsBool (inifile, L"display", L"fullscreen", options.want_fullscreen); |
265 | INIFile_WriteEntryAsBool (inifile, L"display", L"fullscreen", options.want_fullscreen); |
235 | INIFile_WriteEntryAsLong (inifile, L"display", L"window width", max (options.window_width, 640)); |
266 | INIFile_WriteEntryAsLong (inifile, L"display", L"window width", max (options.window_width, 640)); |
236 | INIFile_WriteEntryAsLong (inifile, L"display", L"window height", max (options.window_height, 480)); |
267 | INIFile_WriteEntryAsLong (inifile, L"display", L"window height", max (options.window_height, 480)); |
237 | INIFile_WriteEntryAsBool (inifile, L"display", L"enable texture filtering", options.want_filtering); |
268 | INIFile_WriteEntryAsBool (inifile, L"display", L"enable texture filtering", options.want_filtering); |
238 | INIFile_WriteEntryAsBool (inifile, L"display", L"enable high quality filtering", options.want_hiquality); |
269 | INIFile_WriteEntryAsBool (inifile, L"display", L"enable high quality filtering", options.want_hiquality); |