cheats: Fix previous cheats not being cleaned up when a game has no cheats file (#1640)

This commit is contained in:
Francesco Saltori 2026-01-20 14:38:44 +01:00 committed by GitHub
parent 0805711cba
commit c7e0364342
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -91,10 +91,6 @@ void CheatEngine::LoadCheatFile(u64 title_id) {
FileUtil::CreateDir(cheat_dir);
}
if (!FileUtil::Exists(filepath)) {
return;
}
auto gateway_cheats = GatewayCheat::LoadFile(filepath);
{
std::unique_lock lock{cheats_list_mutex};

View File

@ -487,6 +487,10 @@ std::string GatewayCheat::ToString() const {
std::vector<std::shared_ptr<CheatBase>> GatewayCheat::LoadFile(const std::string& filepath) {
std::vector<std::shared_ptr<CheatBase>> cheats;
if (!FileUtil::Exists(filepath)) {
return cheats;
}
boost::iostreams::stream<boost::iostreams::file_descriptor_source> file;
FileUtil::OpenFStream<std::ios_base::in>(file, filepath);
if (!file.is_open()) {