From 4a57ccc3e8d4cdacdd5a7cb17a153b9a5bf56010 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 14 Oct 2024 12:44:23 +1000 Subject: [PATCH] Cheats: Strip leading * when importing old files --- src/core/cheats.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/cheats.cpp b/src/core/cheats.cpp index 36606eaaf..b350c1d24 100644 --- a/src/core/cheats.cpp +++ b/src/core/cheats.cpp @@ -1461,7 +1461,7 @@ bool Cheats::ImportPCSXFile(CodeInfoList* dst, const std::string_view file_conte if (linev.front() == '[') { - if (linev.size() < 3 || linev.back() != ']') + if (linev.size() < 3 || linev.back() != ']' || (linev[1] == '*' && linev.size() < 4)) { if (!reader.LogError(error, stop_on_error, "Malformed code at line {}: {}", reader.GetCurrentLineNumber(), line)) @@ -1477,7 +1477,7 @@ bool Cheats::ImportPCSXFile(CodeInfoList* dst, const std::string_view file_conte return false; current_code = CodeInfo(); - current_code.name = linev.substr(1, linev.length() - 2); + current_code.name = (linev[1] == '*') ? linev.substr(2, linev.length() - 3) : linev.substr(1, linev.length() - 2); current_code.file_offset_start = static_cast(reader.GetCurrentLineOffset()); current_code.file_offset_end = current_code.file_offset_start; current_code.file_offset_body_start = current_code.file_offset_start;