1
0
mirror of synced 2024-11-25 00:00:27 +01:00

feat: Added base64 exporter

Closes #900
This commit is contained in:
WerWolv 2023-01-25 10:51:00 +01:00
parent fee1b985c0
commit 4b112321d2
9 changed files with 28 additions and 7 deletions

View File

@ -133,7 +133,6 @@
"hex.builtin.menu.file.close": "Schliessen", "hex.builtin.menu.file.close": "Schliessen",
"hex.builtin.menu.file.create_file": "Neue Datei...", "hex.builtin.menu.file.create_file": "Neue Datei...",
"hex.builtin.menu.file.export": "Exportieren...", "hex.builtin.menu.file.export": "Exportieren...",
"hex.builtin.menu.file.export.base64.popup.export_error": "Datei hat kein gültiges Base64 Format!",
"hex.builtin.menu.file.export.ips": "IPS Patch", "hex.builtin.menu.file.export.ips": "IPS Patch",
"hex.builtin.menu.file.export.ips32": "IPS32 Patch", "hex.builtin.menu.file.export.ips32": "IPS32 Patch",
"hex.builtin.menu.file.export.popup.create": "Daten konnten nicht exportiert werden. Datei konnte nicht erstellt werden!", "hex.builtin.menu.file.export.popup.create": "Daten konnten nicht exportiert werden. Datei konnte nicht erstellt werden!",

View File

@ -136,6 +136,8 @@
"hex.builtin.menu.file.close": "Close", "hex.builtin.menu.file.close": "Close",
"hex.builtin.menu.file.create_file": "New File...", "hex.builtin.menu.file.create_file": "New File...",
"hex.builtin.menu.file.export": "Export...", "hex.builtin.menu.file.export": "Export...",
"hex.builtin.menu.file.export.base64": "Base64",
"hex.builtin.menu.file.export.base64.popup.export_error": "Failed to create new base64 file!",
"hex.builtin.menu.file.export.ips.popup.export_error": "Failed to create new IPS file!", "hex.builtin.menu.file.export.ips.popup.export_error": "Failed to create new IPS file!",
"hex.builtin.menu.file.export.ips.popup.invalid_patch_header_error": "Invalid IPS patch header!", "hex.builtin.menu.file.export.ips.popup.invalid_patch_header_error": "Invalid IPS patch header!",
"hex.builtin.menu.file.export.ips.popup.address_out_of_range_error": "A patch tried to patch an address that is out of range!", "hex.builtin.menu.file.export.ips.popup.address_out_of_range_error": "A patch tried to patch an address that is out of range!",

View File

@ -132,7 +132,6 @@
"hex.builtin.menu.file.close": "Chiudi", "hex.builtin.menu.file.close": "Chiudi",
"hex.builtin.menu.file.create_file": "***** MISSING TRANSLATION *****", "hex.builtin.menu.file.create_file": "***** MISSING TRANSLATION *****",
"hex.builtin.menu.file.export": "Esporta...", "hex.builtin.menu.file.export": "Esporta...",
"hex.builtin.menu.file.export.base64.popup.export_error": "***** MISSING TRANSLATION *****",
"hex.builtin.menu.file.export.ips": "IPS Patch", "hex.builtin.menu.file.export.ips": "IPS Patch",
"hex.builtin.menu.file.export.ips32": "IPS32 Patch", "hex.builtin.menu.file.export.ips32": "IPS32 Patch",
"hex.builtin.menu.file.export.popup.create": "***** MISSING TRANSLATION *****", "hex.builtin.menu.file.export.popup.create": "***** MISSING TRANSLATION *****",

View File

@ -132,7 +132,6 @@
"hex.builtin.menu.file.close": "ファイルを閉じる", "hex.builtin.menu.file.close": "ファイルを閉じる",
"hex.builtin.menu.file.create_file": "***** MISSING TRANSLATION *****", "hex.builtin.menu.file.create_file": "***** MISSING TRANSLATION *****",
"hex.builtin.menu.file.export": "エクスポート…", "hex.builtin.menu.file.export": "エクスポート…",
"hex.builtin.menu.file.export.base64.popup.export_error": "有効なBase64形式ではありません。",
"hex.builtin.menu.file.export.ips": "IPSパッチ", "hex.builtin.menu.file.export.ips": "IPSパッチ",
"hex.builtin.menu.file.export.ips32": "IPS32パッチ", "hex.builtin.menu.file.export.ips32": "IPS32パッチ",
"hex.builtin.menu.file.export.popup.create": "データをエクスポートできません。\nファイルの作成に失敗しました。", "hex.builtin.menu.file.export.popup.create": "データをエクスポートできません。\nファイルの作成に失敗しました。",

View File

@ -132,7 +132,6 @@
"hex.builtin.menu.file.close": "닫기", "hex.builtin.menu.file.close": "닫기",
"hex.builtin.menu.file.create_file": "새 파일...", "hex.builtin.menu.file.create_file": "새 파일...",
"hex.builtin.menu.file.export": "내보내기...", "hex.builtin.menu.file.export": "내보내기...",
"hex.builtin.menu.file.export.base64.popup.export_error": "파일이 올바른 Base64 형식이 아닙니다!",
"hex.builtin.menu.file.export.ips": "IPS 패치", "hex.builtin.menu.file.export.ips": "IPS 패치",
"hex.builtin.menu.file.export.ips32": "IPS32 패치", "hex.builtin.menu.file.export.ips32": "IPS32 패치",
"hex.builtin.menu.file.export.popup.create": "데이터를 내보낼 수 없습니다. 파일을 만드는 데 실패했습니다!", "hex.builtin.menu.file.export.popup.create": "데이터를 내보낼 수 없습니다. 파일을 만드는 데 실패했습니다!",

View File

@ -132,7 +132,6 @@
"hex.builtin.menu.file.close": "Fechar", "hex.builtin.menu.file.close": "Fechar",
"hex.builtin.menu.file.create_file": "***** MISSING TRANSLATION *****", "hex.builtin.menu.file.create_file": "***** MISSING TRANSLATION *****",
"hex.builtin.menu.file.export": "Exportar...", "hex.builtin.menu.file.export": "Exportar...",
"hex.builtin.menu.file.export.base64.popup.export_error": "Esse arquivo não é baseado em um formato Base64 valido!",
"hex.builtin.menu.file.export.ips": "IPS Patch", "hex.builtin.menu.file.export.ips": "IPS Patch",
"hex.builtin.menu.file.export.ips32": "IPS32 Patch", "hex.builtin.menu.file.export.ips32": "IPS32 Patch",
"hex.builtin.menu.file.export.popup.create": "Não é possível exportar os dados. Falha ao criar arquivo!", "hex.builtin.menu.file.export.popup.create": "Não é possível exportar os dados. Falha ao criar arquivo!",

View File

@ -132,7 +132,6 @@
"hex.builtin.menu.file.close": "关闭", "hex.builtin.menu.file.close": "关闭",
"hex.builtin.menu.file.create_file": "新建文件...", "hex.builtin.menu.file.create_file": "新建文件...",
"hex.builtin.menu.file.export": "导出...", "hex.builtin.menu.file.export": "导出...",
"hex.builtin.menu.file.export.base64.popup.export_error": "文件不是有效的 Base64 格式!",
"hex.builtin.menu.file.export.ips": "IPS 补丁", "hex.builtin.menu.file.export.ips": "IPS 补丁",
"hex.builtin.menu.file.export.ips32": "IPS32 补丁", "hex.builtin.menu.file.export.ips32": "IPS32 补丁",
"hex.builtin.menu.file.export.popup.create": "无法导出文件。文件创建失败!", "hex.builtin.menu.file.export.popup.create": "无法导出文件。文件创建失败!",

View File

@ -132,7 +132,6 @@
"hex.builtin.menu.file.close": "關閉", "hex.builtin.menu.file.close": "關閉",
"hex.builtin.menu.file.create_file": "新檔案...", "hex.builtin.menu.file.create_file": "新檔案...",
"hex.builtin.menu.file.export": "匯出...", "hex.builtin.menu.file.export": "匯出...",
"hex.builtin.menu.file.export.base64.popup.export_error": "檔案並非有效的 Base64 格式!",
"hex.builtin.menu.file.export.ips": "IPS 修補檔案", "hex.builtin.menu.file.export.ips": "IPS 修補檔案",
"hex.builtin.menu.file.export.ips32": "IPS32 修補檔案", "hex.builtin.menu.file.export.ips32": "IPS32 修補檔案",
"hex.builtin.menu.file.export.popup.create": "無法匯出資料。無法建立檔案!", "hex.builtin.menu.file.export.popup.create": "無法匯出資料。無法建立檔案!",

View File

@ -210,6 +210,32 @@ namespace hex::plugin::builtin {
/* Export */ /* Export */
if (ImGui::BeginMenu("hex.builtin.menu.file.export"_lang, providerValid && provider->isWritable())) { if (ImGui::BeginMenu("hex.builtin.menu.file.export"_lang, providerValid && provider->isWritable())) {
if (ImGui::MenuItem("hex.builtin.menu.file.export.base64"_lang)) {
fs::openFileBrowser(fs::DialogMode::Save, {}, [](const auto &path) {
TaskManager::createTask("hex.builtin.common.processing", TaskManager::NoProgress, [path](auto &) {
fs::File outputFile(path, fs::File::Mode::Create);
if (!outputFile.isValid()) {
TaskManager::doLater([] {
View::showErrorPopup("hex.builtin.menu.file.export.base64.popup.export_error"_lang);
});
return;
}
auto provider = ImHexApi::Provider::get();
std::vector<u8> bytes(3000);
for (u64 address = 0; address < provider->getActualSize(); address += 3000) {
bytes.resize(std::min<u64>(3000, provider->getActualSize() - address));
provider->read(provider->getBaseAddress() + address, bytes.data(), bytes.size());
outputFile.write(crypt::encode64(bytes));
}
});
});
}
ImGui::Separator();
if (ImGui::MenuItem("hex.builtin.menu.file.export.ips"_lang, nullptr, false)) { if (ImGui::MenuItem("hex.builtin.menu.file.export.ips"_lang, nullptr, false)) {
Patches patches = provider->getPatches(); Patches patches = provider->getPatches();