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

Method onToolsEditCheatsPatchesTriggered

pcsx2-qt/MainWindow.cpp:2166–2190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2164}
2165#endif
2166void MainWindow::onToolsEditCheatsPatchesTriggered(bool cheats)
2167{
2168 if (s_current_disc_serial.isEmpty() || s_current_running_crc == 0)
2169 return;
2170
2171 const std::string path = Patch::GetPnachFilename(s_current_disc_serial.toStdString(), s_current_running_crc, cheats);
2172 if (!FileSystem::FileExists(path.c_str()))
2173 {
2174 if (QMessageBox::question(this, tr("Confirm File Creation"),
2175 tr("The pnach file '%1' does not currently exist. Do you want to create it?")
2176 .arg(QtUtils::StringViewToQString(Path::GetFileName(path))),
2177 QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes)
2178 {
2179 return;
2180 }
2181
2182 if (!FileSystem::WriteStringToFile(path.c_str(), std::string_view()))
2183 {
2184 QMessageBox::critical(this, tr("Error"), tr("Failed to create '%1'.").arg(QString::fromStdString(path)));
2185 return;
2186 }
2187 }
2188
2189 QtUtils::OpenURL(this, QUrl::fromLocalFile(QString::fromStdString(path)));
2190}
2191
2192void MainWindow::onCreateMemoryCardOpenRequested()
2193{

Callers

nothing calls this directly

Calls 5

StringViewToQStringFunction · 0.85
OpenURLFunction · 0.85
argMethod · 0.80
isEmptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected