CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 TitleID) : m_TitleID(TitleID) { Common::ReadReplacements(replacements); strcpy(pathData_bin, FileName); memcpy(SD_IV, "\x21\x67\x12\xE6\xAA\x1F\x68\x9F\x95\xC5\xA2\x23\x24\xDC\x6A\x98", 0x10); if (!TitleID) // Import { AES_set_decrypt_key(SDKey, 128, &m_AES_KEY); do { b_valid = true; ReadHDR(); ReadBKHDR(); ImportWiiSaveFiles(); // TODO: check_sig() if (b_valid) { SuccessAlertT("Successfully imported save files"); b_tryAgain = false; } else { b_tryAgain = AskYesNoT("Import failed, try again?"); } } while(b_tryAgain); } else { AES_set_encrypt_key(SDKey, 128, &m_AES_KEY); if (getPaths(true)) { do { b_valid = true; WriteHDR(); WriteBKHDR(); ExportWiiSaveFiles(); do_sig(); if (b_valid) { SuccessAlertT("Successfully exported file to %s", pathData_bin); b_tryAgain = false; } else { b_tryAgain = AskYesNoT("Export failed, try again?"); } } while(b_tryAgain); } } }
CWiiSaveCrypted::CWiiSaveCrypted(const char* FileName, u64 TitleID) : m_TitleID(TitleID) { Common::ReadReplacements(replacements); encryptedSavePath = std::string(FileName); memcpy(SD_IV, "\x21\x67\x12\xE6\xAA\x1F\x68\x9F\x95\xC5\xA2\x23\x24\xDC\x6A\x98", 0x10); if (!TitleID) // Import { aes_setkey_dec(&m_AES_ctx, SDKey, 128); b_valid = true; ReadHDR(); ReadBKHDR(); ImportWiiSaveFiles(); // TODO: check_sig() if (b_valid) { SuccessAlertT("Successfully imported save files"); } else { PanicAlertT("Import failed"); } } else { aes_setkey_enc(&m_AES_ctx, SDKey, 128); if (getPaths(true)) { b_valid = true; WriteHDR(); WriteBKHDR(); ExportWiiSaveFiles(); do_sig(); if (b_valid) { SuccessAlertT("Successfully exported file to %s", encryptedSavePath.c_str()); } else { PanicAlertT("Export failed"); } } } }