| 2164 | } |
| 2165 | #endif |
| 2166 | void 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 | |
| 2192 | void MainWindow::onCreateMemoryCardOpenRequested() |
| 2193 | { |
nothing calls this directly
no test coverage detected