Write out the .ini file, keeping the original comments intact
| 325 | |
| 326 | // Write out the .ini file, keeping the original comments intact |
| 327 | void IPreferences::Commit() |
| 328 | { |
| 329 | FILE * fh( fopen(mFilename.c_str(), "w") ); |
| 330 | if (fh != NULL) |
| 331 | { |
| 332 | const SGlobalPreferences defaults; |
| 333 | |
| 334 | #define OUTPUT_BOOL( b, nm, def ) fprintf( fh, "%s=%s\n", #nm, b.nm ? "yes" : "no" ); |
| 335 | #define OUTPUT_FLOAT( b, nm, def ) fprintf( fh, "%s=%f\n", #nm, b.nm ); |
| 336 | #define OUTPUT_INT( b, nm, def ) fprintf( fh, "%s=%d\n", #nm, b.nm ); |
| 337 | #ifdef DAEDALUS_PSP |
| 338 | #define OUTPUT_LANGUAGE( b, nm, def ) fprintf( fh, "%s=%s\n", #nm, Translate_NameFromIndex( b.nm ) ); |
| 339 | #endif |
| 340 | OUTPUT_INT( gGlobalPreferences, DisplayFramerate, defaults ); |
| 341 | OUTPUT_BOOL( gGlobalPreferences, ForceLinearFilter, defaults ); |
| 342 | OUTPUT_BOOL( gGlobalPreferences, RumblePak, defaults ); |
| 343 | #ifdef DAEDALUS_DEBUG_DISPLAYLIST |
| 344 | OUTPUT_BOOL( gGlobalPreferences, HighlightInexactBlendModes, defaults ); |
| 345 | OUTPUT_BOOL( gGlobalPreferences, CustomBlendModes, defaults ); |
| 346 | #endif |
| 347 | OUTPUT_BOOL( gGlobalPreferences, BatteryWarning, defaults ); |
| 348 | OUTPUT_BOOL( gGlobalPreferences, LargeROMBuffer, defaults ); |
| 349 | OUTPUT_INT( gGlobalPreferences, GuiColor, defaults ) |
| 350 | OUTPUT_FLOAT( gGlobalPreferences, StickMinDeadzone, defaults ); |
| 351 | OUTPUT_FLOAT( gGlobalPreferences, StickMaxDeadzone, defaults ); |
| 352 | #ifdef DAEDALUS_PSP |
| 353 | OUTPUT_LANGUAGE( gGlobalPreferences, Language, defaults ); |
| 354 | #endif |
| 355 | OUTPUT_INT( gGlobalPreferences, ViewportType, defaults ); |
| 356 | OUTPUT_BOOL( gGlobalPreferences, TVEnable, defaults ); |
| 357 | OUTPUT_BOOL( gGlobalPreferences, TVLaced, defaults ); |
| 358 | OUTPUT_INT( gGlobalPreferences, TVType, defaults ); |
| 359 | fprintf( fh, "\n\n" ); //Spacer to go before Rom Settings |
| 360 | |
| 361 | for ( PreferencesMap::const_iterator it = mPreferences.begin(); it != mPreferences.end(); ++it ) |
| 362 | { |
| 363 | OutputSectionDetails( it->first, it->second, fh ); |
| 364 | } |
| 365 | |
| 366 | fclose( fh ); |
| 367 | mDirty = false; |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | // Retreive the preferences for the specified rom. Returns false if the rom is |
| 372 | // not in the database |