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; } }
void Emulator_Implementation_ButtonMappingSettings(int map_button_option_enum) { switch(map_button_option_enum) { case MAP_BUTTONS_OPTION_SETTER: currentconfig.SetInt("PS3ButtonMappings::DPad_Up",Settings.DPad_Up); currentconfig.SetInt("PS3ButtonMappings::DPad_Down",Settings.DPad_Down); currentconfig.SetInt("PS3ButtonMappings::DPad_Left",Settings.DPad_Left); currentconfig.SetInt("PS3ButtonMappings::DPad_Right",Settings.DPad_Right); currentconfig.SetInt("PS3ButtonMappings::ButtonCircle",Settings.ButtonCircle); currentconfig.SetInt("PS3ButtonMappings::ButtonCross",Settings.ButtonCross); currentconfig.SetInt("PS3ButtonMappings::ButtonTriangle",Settings.ButtonTriangle); currentconfig.SetInt("PS3ButtonMappings::ButtonSquare",Settings.ButtonSquare); currentconfig.SetInt("PS3ButtonMappings::ButtonSelect",Settings.ButtonSelect); currentconfig.SetInt("PS3ButtonMappings::ButtonStart",Settings.ButtonStart); currentconfig.SetInt("PS3ButtonMappings::ButtonL1",Settings.ButtonL1); currentconfig.SetInt("PS3ButtonMappings::ButtonR1",Settings.ButtonR1); currentconfig.SetInt("PS3ButtonMappings::ButtonL2",Settings.ButtonL2); currentconfig.SetInt("PS3ButtonMappings::ButtonR2",Settings.ButtonR2); currentconfig.SetInt("PS3ButtonMappings::ButtonL2_ButtonL3",Settings.ButtonL2_ButtonL3); currentconfig.SetInt("PS3ButtonMappings::ButtonL2_ButtonR3",Settings.ButtonL2_ButtonR3); currentconfig.SetInt("PS3ButtonMappings::ButtonR3",Settings.ButtonR3); currentconfig.SetInt("PS3ButtonMappings::ButtonL3",Settings.ButtonL3); currentconfig.SetInt("PS3ButtonMappings::ButtonL2_ButtonR2",Settings.ButtonL2_ButtonR2); currentconfig.SetInt("PS3ButtonMappings::ButtonL2_AnalogR_Right",Settings.ButtonL2_AnalogR_Right); currentconfig.SetInt("PS3ButtonMappings::ButtonL2_AnalogR_Left",Settings.ButtonL2_AnalogR_Left); currentconfig.SetInt("PS3ButtonMappings::ButtonL2_AnalogR_Up",Settings.ButtonL2_AnalogR_Up); currentconfig.SetInt("PS3ButtonMappings::ButtonL2_AnalogR_Down",Settings.ButtonL2_AnalogR_Down); currentconfig.SetInt("PS3ButtonMappings::ButtonR2_AnalogR_Right",Settings.ButtonR2_AnalogR_Right); currentconfig.SetInt("PS3ButtonMappings::ButtonR2_AnalogR_Left",Settings.ButtonR2_AnalogR_Left); currentconfig.SetInt("PS3ButtonMappings::ButtonR2_AnalogR_Up",Settings.ButtonR2_AnalogR_Up); currentconfig.SetInt("PS3ButtonMappings::ButtonR2_AnalogR_Down",Settings.ButtonR2_AnalogR_Down); currentconfig.SetInt("PS3ButtonMappings::ButtonR2_ButtonR3",Settings.ButtonR2_ButtonR3); currentconfig.SetInt("PS3ButtonMappings::ButtonR3_ButtonL3",Settings.ButtonR3_ButtonL3); currentconfig.SetInt("PS3ButtonMappings::AnalogR_Up",Settings.AnalogR_Up); currentconfig.SetInt("PS3ButtonMappings::AnalogR_Down",Settings.AnalogR_Down); currentconfig.SetInt("PS3ButtonMappings::AnalogR_Left",Settings.AnalogR_Left); currentconfig.SetInt("PS3ButtonMappings::AnalogR_Right",Settings.AnalogR_Right); currentconfig.SetBool("PS3ButtonMappings::AnalogR_Up_Type",Settings.AnalogR_Up_Type); currentconfig.SetBool("PS3ButtonMappings::AnalogR_Down_Type",Settings.AnalogR_Down_Type); currentconfig.SetBool("PS3ButtonMappings::AnalogR_Left_Type",Settings.AnalogR_Left_Type); currentconfig.SetBool("PS3ButtonMappings::AnalogR_Right_Type",Settings.AnalogR_Right_Type); break; case MAP_BUTTONS_OPTION_GETTER: Settings.DPad_Up = currentconfig.GetInt("PS3ButtonMappings::DPad_Up",BTN_UP); Settings.DPad_Down = currentconfig.GetInt("PS3ButtonMappings::DPad_Down",BTN_DOWN); Settings.DPad_Left = currentconfig.GetInt("PS3ButtonMappings::DPad_Left",BTN_LEFT); Settings.DPad_Right = currentconfig.GetInt("PS3ButtonMappings::DPad_Right",BTN_RIGHT); Settings.ButtonCircle = currentconfig.GetInt("PS3ButtonMappings::ButtonCircle",BTN_A); Settings.ButtonCross = currentconfig.GetInt("PS3ButtonMappings::ButtonCross",BTN_B); Settings.ButtonTriangle = currentconfig.GetInt("PS3ButtonMappings::ButtonTriangle",BTN_NONE); Settings.ButtonSquare = currentconfig.GetInt("PS3ButtonMappings::ButtonSquare",BTN_NONE); Settings.ButtonSelect = currentconfig.GetInt("PS3ButtonMappings::ButtonSelect",BTN_SELECT); Settings.ButtonStart = currentconfig.GetInt("PS3ButtonMappings::ButtonStart",BTN_START); Settings.ButtonL1 = currentconfig.GetInt("PS3ButtonMappings::ButtonL1",BTN_NONE); Settings.ButtonR1 = currentconfig.GetInt("PS3ButtonMappings::ButtonR1",BTN_NONE); Settings.ButtonL2 = currentconfig.GetInt("PS3ButtonMappings::ButtonL2",BTN_NONE); Settings.ButtonR2 = currentconfig.GetInt("PS3ButtonMappings::ButtonR2",BTN_NONE); Settings.ButtonL2_ButtonL3 = currentconfig.GetInt("PS3ButtonMappings::ButtonL2_ButtonL3",BTN_NONE); Settings.ButtonL2_ButtonR3 = currentconfig.GetInt("PS3ButtonMappings::ButtonL2_ButtonR3",BTN_QUICKLOAD); Settings.ButtonR3 = currentconfig.GetInt("PS3ButtonMappings::ButtonR3",BTN_NONE); Settings.ButtonL3 = currentconfig.GetInt("PS3ButtonMappings::ButtonL3",BTN_NONE); Settings.ButtonL2_ButtonR2 = currentconfig.GetInt("PS3ButtonMappings::ButtonL2_ButtonR2",BTN_NONE); Settings.ButtonL2_AnalogR_Right = currentconfig.GetInt("PS3ButtonMappings::ButtonL2_AnalogR_Right",BTN_INCREMENTCHEAT); Settings.ButtonL2_AnalogR_Left = currentconfig.GetInt("PS3ButtonMappings::ButtonL2_AnalogR_Left",BTN_DECREMENTCHEAT); Settings.ButtonL2_AnalogR_Up = currentconfig.GetInt("PS3ButtonMappings::ButtonL2_AnalogR_Up",BTN_NONE); Settings.ButtonL2_AnalogR_Down = currentconfig.GetInt("PS3ButtonMappings::ButtonL2_AnalogR_Down",BTN_NONE); Settings.ButtonR2_AnalogR_Right = currentconfig.GetInt("PS3ButtonMappings::ButtonR2_AnalogR_Right",BTN_NONE); Settings.ButtonR2_AnalogR_Left = currentconfig.GetInt("PS3ButtonMappings::ButtonR2_AnalogR_Left",BTN_NONE); Settings.ButtonR2_AnalogR_Up = currentconfig.GetInt("PS3ButtonMappings::ButtonR2_AnalogR_Up",BTN_NONE); Settings.ButtonR2_AnalogR_Down = currentconfig.GetInt("PS3ButtonMappings::ButtonR2_AnalogR_Down",BTN_NONE); Settings.ButtonR2_ButtonR3 = currentconfig.GetInt("PS3ButtonMappings::ButtonR2_ButtonR3",BTN_QUICKSAVE); Settings.ButtonR3_ButtonL3 = currentconfig.GetInt("PS3ButtonMappings::ButtonR3_ButtonL3",BTN_EXITTOMENU); Settings.AnalogR_Up = currentconfig.GetInt("PS3ButtonMappings::AnalogR_Up",BTN_CHEATENABLE); Settings.AnalogR_Down = currentconfig.GetInt("PS3ButtonMappings::AnalogR_Down",BTN_NONE); Settings.AnalogR_Left = currentconfig.GetInt("PS3ButtonMappings::AnalogR_Left",BTN_DECREMENTSAVE); Settings.AnalogR_Right = currentconfig.GetInt("PS3ButtonMappings::AnalogR_Right",BTN_INCREMENTSAVE); Settings.AnalogR_Up_Type = currentconfig.GetBool("PS3ButtonMappings::AnalogR_Up_Type",false); Settings.AnalogR_Down_Type = currentconfig.GetBool("PS3ButtonMappings::AnalogR_Down_Type",false); Settings.AnalogR_Left_Type = currentconfig.GetBool("PS3ButtonMappings::AnalogR_Left_Type",false); Settings.AnalogR_Right_Type = currentconfig.GetBool("PS3ButtonMappings::AnalogR_Right_Type",false); break; case MAP_BUTTONS_OPTION_DEFAULT: Settings.DPad_Up = BTN_UP; Settings.DPad_Down = BTN_DOWN; Settings.DPad_Left = BTN_LEFT; Settings.DPad_Right = BTN_RIGHT; Settings.ButtonCircle = BTN_A; Settings.ButtonCross = BTN_B; Settings.ButtonTriangle = BTN_NONE; Settings.ButtonSquare = BTN_NONE; Settings.ButtonSelect = BTN_SELECT; Settings.ButtonStart = BTN_START; Settings.ButtonL1 = BTN_NONE; Settings.ButtonR1 = BTN_NONE; Settings.ButtonL2 = BTN_NONE; Settings.ButtonR2 = BTN_NONE; Settings.ButtonL2_ButtonL3 = BTN_NONE; Settings.ButtonL2_ButtonR3 = BTN_QUICKLOAD; Settings.ButtonR3 = BTN_NONE; Settings.ButtonL3 = BTN_NONE; Settings.ButtonL2_ButtonR2 = BTN_NONE; Settings.ButtonL2_AnalogR_Right = BTN_INCREMENTCHEAT; Settings.ButtonL2_AnalogR_Left = BTN_DECREMENTCHEAT; Settings.ButtonL2_AnalogR_Up = BTN_NONE; Settings.ButtonL2_AnalogR_Down = BTN_NONE; Settings.ButtonR2_AnalogR_Right = BTN_NONE; Settings.ButtonR2_AnalogR_Left = BTN_NONE; Settings.ButtonR2_AnalogR_Up = BTN_NONE; Settings.ButtonR2_AnalogR_Down = BTN_NONE; Settings.ButtonR2_ButtonR3 = BTN_QUICKSAVE; Settings.ButtonR3_ButtonL3 = BTN_EXITTOMENU; Settings.AnalogR_Up = BTN_CHEATENABLE; Settings.AnalogR_Down = BTN_NONE; Settings.AnalogR_Left = BTN_DECREMENTSAVE; Settings.AnalogR_Right = BTN_INCREMENTSAVE; Settings.AnalogR_Up_Type = false; Settings.AnalogR_Down_Type = false; Settings.AnalogR_Left_Type = false; Settings.AnalogR_Right_Type = false; break; case MAP_BUTTONS_OPTION_NEW: Input_MapButton(&Settings.DPad_Up,false,BTN_UP); Input_MapButton(&Settings.DPad_Down,false,BTN_DOWN); Input_MapButton(&Settings.DPad_Left,false,BTN_LEFT); Input_MapButton(&Settings.DPad_Right,false,BTN_RIGHT); Input_MapButton(&Settings.ButtonCircle,false,BTN_A); Input_MapButton(&Settings.ButtonCross,false,BTN_B); Input_MapButton(&Settings.ButtonTriangle,false,BTN_NONE); Input_MapButton(&Settings.ButtonSquare,false,BTN_NONE); Input_MapButton(&Settings.ButtonSelect,false,BTN_SELECT); Input_MapButton(&Settings.ButtonStart,false,BTN_START); Input_MapButton(&Settings.ButtonL1,false,BTN_NONE); Input_MapButton(&Settings.ButtonL2,false,BTN_NONE); Input_MapButton(&Settings.ButtonR2,false,BTN_NONE); Input_MapButton(&Settings.ButtonL3,false,BTN_NONE); Input_MapButton(&Settings.ButtonR3,false,BTN_NONE); Input_MapButton(&Settings.ButtonR1,false,BTN_NONE); Input_MapButton(&Settings.ButtonL2_ButtonL3,false,BTN_NONE); Input_MapButton(&Settings.ButtonL2_ButtonR2,false,BTN_NONE); Input_MapButton(&Settings.ButtonL2_ButtonR3,false,BTN_NONE); Input_MapButton(&Settings.ButtonR2_ButtonR3,false,BTN_NONE); Input_MapButton(&Settings.AnalogR_Up,false,BTN_NONE); Input_MapButton(&Settings.AnalogR_Down,false,BTN_NONE); Input_MapButton(&Settings.AnalogR_Left,false,BTN_NONE); Input_MapButton(&Settings.AnalogR_Right,false,BTN_NONE); Input_MapButton(&Settings.ButtonL2_AnalogR_Right,false,BTN_INCREMENTCHEAT); Input_MapButton(&Settings.ButtonL2_AnalogR_Left,false,BTN_DECREMENTCHEAT); Input_MapButton(&Settings.ButtonL2_AnalogR_Up,false,BTN_CHEATENABLE); Input_MapButton(&Settings.ButtonL2_AnalogR_Down,false,BTN_NONE); Input_MapButton(&Settings.ButtonR2_AnalogR_Right,false,BTN_INCREMENTSAVE); Input_MapButton(&Settings.ButtonR2_AnalogR_Left,false,BTN_DECREMENTSAVE); Input_MapButton(&Settings.ButtonR2_AnalogR_Up,false,BTN_QUICKLOAD); Input_MapButton(&Settings.ButtonR2_AnalogR_Down,false,BTN_QUICKSAVE); Input_MapButton(&Settings.ButtonR3_ButtonL3,false,BTN_EXITTOMENU); Settings.AnalogR_Up_Type = 0; Settings.AnalogR_Down_Type = 0; Settings.AnalogR_Left_Type = 0; Settings.AnalogR_Right_Type = 0; break; } }