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

Method loadGameSettings

pcsx2-qt/Debugger/DebuggerSettingsManager.cpp:51–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51void DebuggerSettingsManager::loadGameSettings(BreakpointModel* bpModel)
52{
53 const std::string path = VMManager::GetDebuggerSettingsFilePathForCurrentGame();
54 if (path.empty())
55 return;
56
57 const QJsonValue breakpointsValue = loadGameSettingsJSON().value("Breakpoints");
58 const QString valueToLoad = breakpointsValue.toString();
59 if (breakpointsValue.isUndefined() || !breakpointsValue.isArray())
60 {
61 Console.WriteLnFmt("Debugger Settings Manager: Failed to read Breakpoints array from settings file: '{}'", path);
62 return;
63 }
64
65 // Breakpoint descriptions were added at debugger settings file version 0.01. If loading
66 // saved breakpoints from a previous version (only 0.00 existed prior), the breakpoints will be
67 // missing a description. This code will add in an empty description so that the previous
68 // version, 0.00, is compatible with 0.01.
69 bool isMissingDescription = false;
70 const QJsonValue savedVersionValue = loadGameSettingsJSON().value("Version");
71 if (!savedVersionValue.isUndefined())
72 {
73 isMissingDescription = savedVersionValue.toString().toStdString() == "0.00";
74 }
75
76 const QJsonArray breakpointsArray = breakpointsValue.toArray();
77 for (u32 row = 0; row < breakpointsArray.size(); row++)
78 {
79 const QJsonValue rowValue = breakpointsArray.at(row);
80 if (rowValue.isUndefined() || !rowValue.isObject())
81 {
82 Console.WriteLn("Debugger Settings Manager: Failed to load invalid Breakpoint object.");
83 continue;
84 }
85 QJsonObject rowObject = rowValue.toObject();
86
87 // Add empty description for saved breakpoints from debugger settings versions prior to 0.01
88 if (isMissingDescription)
89 {
90 rowObject.insert(QString("DESCRIPTION"), QJsonValue(""));
91 }
92
93 QStringList fields;
94 u32 col = 0;
95 for (auto iter = rowObject.begin(); iter != rowObject.end(); iter++, col++)
96 {
97 QString headerColKey = bpModel->headerData(col, Qt::Horizontal, Qt::UserRole).toString();
98 fields << rowObject.value(headerColKey).toString();
99 }
100 bpModel->loadBreakpointFromFieldList(fields);
101 }
102}
103
104void DebuggerSettingsManager::loadGameSettings(SavedAddressesModel* savedAddressesModel)
105{

Callers

nothing calls this directly

Calls 13

atMethod · 0.80
emptyMethod · 0.45
valueMethod · 0.45
toStringMethod · 0.45
WriteLnFmtMethod · 0.45
sizeMethod · 0.45
WriteLnMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected