bool Emulator_Implementation_SaveSettings() { currentconfig.SetInt("PS3General::ControlScheme",Settings.ControlScheme); currentconfig.SetBool("FCEU::GameGenie",Settings.FCEUGameGenie); currentconfig.SetBool("PS3General::KeepAspect",Settings.PS3KeepAspect); currentconfig.SetBool("PS3General::Smooth", Settings.PS3Smooth); currentconfig.SetBool("PS3General::OverscanEnabled", Settings.PS3OverscanEnabled); currentconfig.SetInt("PS3General::OverscanAmount",Settings.PS3OverscanAmount); currentconfig.SetInt("PS3General::Throttled",Settings.Throttled); currentconfig.SetBool("PS3General::PS3PALTemporalMode60Hz",Settings.PS3PALTemporalMode60Hz); currentconfig.SetInt("FCEU::Controlstyle",Settings.FCEUControlstyle); currentconfig.SetBool("FCEU::DisableSpriteLimitation",Settings.FCEUDisableSpriteLimitation); currentconfig.SetString("PS3General::PS3CurrentShader",Graphics->GetFragmentShaderPath()); currentconfig.SetUInt("PS3General::PS3CurrentResolution",Graphics->GetCurrentResolution()); currentconfig.SetString("PS3Paths::PathSaveStates",Settings.PS3PathSaveStates); currentconfig.SetString("PS3Paths::PathCheats",Settings.PS3PathCheats); currentconfig.SetString("PS3Paths::PathROMDirectory",Settings.PS3PathROMDirectory); currentconfig.SetString("PS3Paths::PathSRAM",Settings.PS3PathSRAM); currentconfig.SetString("PS3Paths::PathBaseDirectory",Settings.PS3PathBaseDirectory); currentconfig.SetString("PS3Paths::PathScreenshots",Settings.PS3PathScreenshots); currentconfig.SetString("RSound::RSoundServerIPAddress",Settings.RSoundServerIPAddress); currentconfig.SetBool("RSound::RSoundEnabled",Settings.RSoundEnabled); Emulator_Implementation_SaveCustomControls(false); return currentconfig.SaveTo(SYS_CONFIG_FILE); }
void Set(ConfigFile& conf) { switch(type) { case CIT_BOOL: if(size == 1) conf.SetBool(name, 0!=(*(uint8 *)addr), "TRUE","FALSE", comment); if(size == 2) conf.SetBool(name, 0!=(*(uint16*)addr), "TRUE","FALSE", comment); if(size == 4) conf.SetBool(name, 0!=(*(uint32*)addr), "TRUE","FALSE", comment); if(size == 8) conf.SetBool(name, 0!=(*(uint64*)addr), "TRUE","FALSE", comment); break; case CIT_BOOLONOFF: if(size == 1) conf.SetBool(name, 0!=(*(uint8 *)addr), "ON","OFF", comment); if(size == 2) conf.SetBool(name, 0!=(*(uint16*)addr), "ON","OFF", comment); if(size == 4) conf.SetBool(name, 0!=(*(uint32*)addr), "ON","OFF", comment); if(size == 8) conf.SetBool(name, 0!=(*(uint64*)addr), "ON","OFF", comment); break; case CIT_INT: if(size == 1) conf.SetInt(name, (int32)(*(uint8 *)addr), comment); if(size == 2) conf.SetInt(name, (int32)(*(uint16*)addr), comment); if(size == 4) conf.SetInt(name, (int32)(*(uint32*)addr), comment); if(size == 8) conf.SetInt(name, (int32)(*(uint64*)addr), comment); break; case CIT_UINT: if(size == 1) conf.SetUInt(name, (uint32)(*(uint8 *)addr), 10, comment); if(size == 2) conf.SetUInt(name, (uint32)(*(uint16*)addr), 10, comment); if(size == 4) conf.SetUInt(name, (uint32)(*(uint32*)addr), 10, comment); if(size == 8) conf.SetUInt(name, (uint32)(*(uint64*)addr), 10, comment); break; case CIT_STRING: if((TCHAR*)addr) conf.SetString(name, std::string(_tToChar((TCHAR*)addr)), comment); break; case CIT_INVBOOL: if(size == 1) conf.SetBool(name, 0==(*(uint8 *)addr), "TRUE","FALSE", comment); if(size == 2) conf.SetBool(name, 0==(*(uint16*)addr), "TRUE","FALSE", comment); if(size == 4) conf.SetBool(name, 0==(*(uint32*)addr), "TRUE","FALSE", comment); if(size == 8) conf.SetBool(name, 0==(*(uint64*)addr), "TRUE","FALSE", comment); break; case CIT_INVBOOLONOFF: if(size == 1) conf.SetBool(name, 0==(*(uint8 *)addr), "ON","OFF", comment); if(size == 2) conf.SetBool(name, 0==(*(uint16*)addr), "ON","OFF", comment); if(size == 4) conf.SetBool(name, 0==(*(uint32*)addr), "ON","OFF", comment); if(size == 8) conf.SetBool(name, 0==(*(uint64*)addr), "ON","OFF", comment); break; case CIT_VKEY: { uint16 keyNum = 0; if(size == 1) keyNum = (uint8)(*(uint8 *)addr); if(size == 2) keyNum = (uint16)(*(uint16*)addr); if(size == 4) keyNum = (uint16)(*(uint32*)addr); if(size == 8) keyNum = (uint16)(*(uint64*)addr); if(keyNum < 256) conf.SetString(name, keyToString[keyNum], comment); else if(keyNum & 0x8000) { char temp [128]; extern void TranslateKey(WORD keyz,char *out); TranslateKey(keyNum,temp); conf.SetString(name, temp, comment); } else conf.SetUInt(name, keyNum, 16, comment); } break; case CIT_VKEYMOD: { uint16 modNum = 0; if(size == 1) modNum = (uint8)(*(uint8 *)addr); if(size == 2) modNum = (uint16)(*(uint16*)addr); if(size == 4) modNum = (uint16)(*(uint32*)addr); if(size == 8) modNum = (uint16)(*(uint64*)addr); std::string modStr; if(modNum & CUSTKEY_CTRL_MASK) modStr += "Ctrl "; if(modNum & CUSTKEY_ALT_MASK) modStr += "Alt "; if(modNum & CUSTKEY_SHIFT_MASK) modStr += "Shift "; if(!(modNum & (CUSTKEY_CTRL_MASK|CUSTKEY_ALT_MASK|CUSTKEY_SHIFT_MASK))) modStr = "none"; else modStr.erase(modStr.length()-1); conf.SetString(name, modStr, comment); } break; } }