// Save the choosen values in the corresponding parameter file. static void saveSoundOption(void *) { // Force current edit to loose focus (if one has it) and update associated variable. GfuiUnSelectCurrent(); char buf[1024]; sprintf(buf, "%s%s", GfLocalDir(), SND_PARAM_FILE); void *paramHandle = GfParmReadFile(buf, GFPARM_RMODE_REREAD | GFPARM_RMODE_CREAT); GfParmSetStr(paramHandle, SND_SCT_SOUND, SND_ATT_SOUND_STATE, soundOptionList[curOption]); GfParmSetNum(paramHandle, SND_SCT_SOUND, SND_ATT_SOUND_VOLUME, "%", VolumeValue); GfParmSetStr(paramHandle, SND_SCT_MUSIC, SND_ATT_MUSIC_STATE, musicStateList[curMusicState]); GfParmSetNum(paramHandle, SND_SCT_MUSIC, SND_ATT_MUSIC_VOLUME, "%", MusicVolumeValue); GfParmWriteFile(NULL, paramHandle, "sound"); GfParmReleaseHandle(paramHandle); // Shutdown the user interface. LegacyMenu::self().shutdown(); // Restart the game. GfuiApp().restart(); // Return to previous screen. GfuiScreenActivate(prevHandle); }
/* Save players info (from PlayersInfo array) to the human drivers and preferences XML files, as well as graphics settings for players if they changed */ static void onSavePlayerList(void * /* dummy */) { int index; if (!PlayerHdle || !PrefHdle) { return; } // Force current edit to loose focus (if one has it) and update associated variable. GfuiUnSelectCurrent(); for (index = 1; index <= (int)PlayersInfo.size(); index++) { PutPlayerSettings(index); } GfParmWriteFile(NULL, PlayerHdle, HumanDriverModuleName); GfParmWriteFile(NULL, PrefHdle, "preferences"); if (GraphHdle) // Write graphic params file if needed. GfParmWriteFile(NULL, GraphHdle, "Graph"); // Temporary, as long as this menu has not been ported to using the tgfdata layer // in order to access drivers data (rather that directly read/writing the XML files). // Reload the drivers from disk. GfDrivers::self()->reload(); onQuitPlayerConfig(0 /* dummy */); }