MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / UpdateGameSettingsLayer

Method UpdateGameSettingsLayer

pcsx2/VMManager.cpp:969–1034  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

967}
968
969bool VMManager::UpdateGameSettingsLayer()
970{
971 std::unique_ptr<INISettingsInterface> new_interface;
972 if (s_disc_crc != 0)
973 {
974 std::string filename(GetGameSettingsPath(GetSerialForGameSettings(), s_disc_crc));
975 if (!FileSystem::FileExists(filename.c_str()))
976 {
977 // try the legacy format (crc.ini)
978 filename = GetGameSettingsPath({}, s_disc_crc);
979 }
980
981 if (FileSystem::FileExists(filename.c_str()))
982 {
983 Console.WriteLn("Loading game settings from '%s'...", filename.c_str());
984 new_interface = std::make_unique<INISettingsInterface>(std::move(filename));
985 if (!new_interface->Load())
986 {
987 Console.Error("Failed to parse game settings ini '%s'", new_interface->GetFileName().c_str());
988 new_interface.reset();
989 }
990 }
991 else
992 {
993 DevCon.WriteLn("No game settings found (tried '%s')", filename.c_str());
994 }
995 }
996
997 std::string input_profile_name;
998 if (new_interface)
999 new_interface->GetStringValue("EmuCore", "InputProfileName", &input_profile_name);
1000
1001 if (!s_game_settings_interface && !new_interface && s_input_profile_name == input_profile_name)
1002 return false;
1003
1004 auto lock = Host::GetSettingsLock();
1005 Host::Internal::SetGameSettingsLayer(new_interface.get(), lock);
1006 s_game_settings_interface = std::move(new_interface);
1007
1008 std::unique_ptr<INISettingsInterface> input_interface;
1009 if (!input_profile_name.empty())
1010 {
1011 const std::string filename(GetInputProfilePath(input_profile_name));
1012 if (FileSystem::FileExists(filename.c_str()))
1013 {
1014 Console.WriteLn("Loading input profile from '%s'...", filename.c_str());
1015 input_interface = std::make_unique<INISettingsInterface>(std::move(filename));
1016 if (!input_interface->Load())
1017 {
1018 Console.Error("Failed to parse input profile ini '%s'", input_interface->GetFileName().c_str());
1019 input_interface.reset();
1020 input_profile_name = {};
1021 }
1022 }
1023 else
1024 {
1025 DevCon.WriteLn("No game settings found (tried '%s')", filename.c_str());
1026 input_profile_name = {};

Callers

nothing calls this directly

Calls 9

GetFileNameMethod · 0.80
c_strMethod · 0.45
WriteLnMethod · 0.45
LoadMethod · 0.45
ErrorMethod · 0.45
resetMethod · 0.45
GetStringValueMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected