From bf64de2acff236c3a1ac0c39cdad469bbcfec929 Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 8 May 2024 23:24:42 +0200 Subject: [PATCH] Actually save the OTP to otp.bin instead of opt.bin --- src/utils/utils.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index b3cd039..199692c 100644 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -75,7 +75,7 @@ void Utils::DumpOTPAndSeeprom() { return; } std::string backupPathConsole = string_format(BACKUPS_DIRECTORY_FULL "/%s", serialId.c_str()); - std::string backupPathConsoleOtpPath = backupPathConsole + "/opt.bin"; + std::string backupPathConsoleOtpPath = backupPathConsole + "/otp.bin"; std::string backupPathConsoleSeepromPath = backupPathConsole + "/seeprom.bin"; if (!FSUtils::CreateSubfolder(backupPathConsole.c_str())) { @@ -83,7 +83,7 @@ void Utils::DumpOTPAndSeeprom() { } bool seepromExists = FSUtils::CheckFile(backupPathConsoleSeepromPath.c_str()); - bool optExists = FSUtils::CheckFile(backupPathConsoleOtpPath.c_str()); + bool otpExists = FSUtils::CheckFile(backupPathConsoleOtpPath.c_str()); if (!seepromExists) { uint8_t data[0x200] = {}; @@ -99,7 +99,7 @@ void Utils::DumpOTPAndSeeprom() { } else { DEBUG_FUNCTION_LINE_VERBOSE("SEEPROM backup already exists"); } - if (!optExists) { + if (!otpExists) { WiiUConsoleOTP otp = {}; if (Mocha_ReadOTP(&otp) != MOCHA_RESULT_SUCCESS) { DEBUG_FUNCTION_LINE_WARN("Failed to read otp"); @@ -113,4 +113,10 @@ void Utils::DumpOTPAndSeeprom() { } else { DEBUG_FUNCTION_LINE_VERBOSE("OTP backup already exists"); } + + // Remove wrong file with typo + std::string backupPathConsoleOTPPathTypo = backupPathConsole + "/opt.bin"; + if (FSUtils::CheckFile(backupPathConsoleOTPPathTypo.c_str())) { + remove(backupPathConsoleOTPPathTypo.c_str()); + } } \ No newline at end of file