Rev 3 | Rev 14 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3 | Rev 11 | ||
|---|---|---|---|
| Line 22... | Line 22... | ||
| 22 | int smiley_index; |
22 | int smiley_index; |
| 23 | int file_length; |
23 | int file_length; |
| 24 | FILE *fp; |
24 | FILE *fp; |
| 25 | 25 | ||
| 26 | // open the INI file |
26 | // open the INI file |
| 27 | swprintf_s (filename, WCHAR_SIZEOF (filename), L"%s |
27 | swprintf_s (filename, WCHAR_SIZEOF (filename), L"%s/config.ini", app_path); |
| 28 | inifile = INIFile_LoadINIFile (filename); |
28 | inifile = INIFile_LoadINIFile (filename); |
| 29 | 29 | ||
| 30 | // read the INI file (if it doesn't exist, default values will be fed) |
30 | // read the INI file (if it doesn't exist, default values will be fed) |
| 31 | 31 | ||
| 32 | // [gameplay] |
32 | // [gameplay] |
| Line 124... | Line 124... | ||
| 124 | 124 | ||
| 125 | // else we found no match, we have to read the file ourselves |
125 | // else we found no match, we have to read the file ourselves |
| 126 | else |
126 | else |
| 127 | { |
127 | { |
| 128 | // build the smiley picture's file pathname and read that smiley's data as a hex string |
128 | // build the smiley picture's file pathname and read that smiley's data as a hex string |
| 129 | swprintf_s (smiley_pathname, WCHAR_SIZEOF (smiley_pathname), L"data/smilies/%s", smiley->filename); |
129 | swprintf_s (smiley_pathname, WCHAR_SIZEOF (smiley_pathname), L"%s/data/smilies/%s", app_path, smiley->filename); |
| 130 | _wfopen_s (&fp, smiley_pathname, L"rb"); |
130 | _wfopen_s (&fp, smiley_pathname, L"rb"); |
| 131 | if (fp == NULL) |
131 | if (fp == NULL) |
| 132 | continue; // if this smiley picture file can't be opened, ignore this smiley |
132 | continue; // if this smiley picture file can't be opened, ignore this smiley |
| 133 | 133 | ||
| 134 | // get the file length |
134 | // get the file length |
| Line 256... | Line 256... | ||
| 256 | } |
256 | } |
| 257 | SAFE_free ((void **) &smilies); |
257 | SAFE_free ((void **) &smilies); |
| 258 | smiley_count = 0; |
258 | smiley_count = 0; |
| 259 | 259 | ||
| 260 | // now save the INI file |
260 | // now save the INI file |
| 261 | swprintf_s (filename, WCHAR_SIZEOF (filename), L"%s |
261 | swprintf_s (filename, WCHAR_SIZEOF (filename), L"%s/config.ini", app_path); |
| 262 | INIFile_SaveINIFile (filename, inifile); |
262 | INIFile_SaveINIFile (filename, inifile); |
| 263 | 263 | ||
| 264 | return; // finished |
264 | return; // finished |
| 265 | } |
265 | } |