From 415ffc5e3b599dcd1bc8bc27363a8728e70e705a Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sat, 20 Jan 2024 20:45:25 +0300 Subject: [PATCH 1/2] this is missing the n too --- installer/windows/Language Files/TurkishExtra.nsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/windows/Language Files/TurkishExtra.nsh b/installer/windows/Language Files/TurkishExtra.nsh index dce067c4..ec43e7fd 100644 --- a/installer/windows/Language Files/TurkishExtra.nsh +++ b/installer/windows/Language Files/TurkishExtra.nsh @@ -12,7 +12,7 @@ ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Bu sihirbaz size $(^NameDA) prog ; installer ${LangFileString} GEODE_TEXT_GD_MISSING "$\r$\n$\r$\nBu dizin yolunda Geometry Dash yüklü değildir!" -${LangFileString} GEODE_TEXT_MH_ALREADY_INSTALLED "Bu dizin yolunda çoktan Mega Hack v6/v7 yüklüdür!$\r$\nGeode MHv6/v7 ile çalışmamaktadır (MHv8 Geode ile uyumlu olacaktır).$\r$\Lütfen devam etmek için programı kaldırın." +${LangFileString} GEODE_TEXT_MH_ALREADY_INSTALLED "Bu dizin yolunda çoktan Mega Hack v6/v7 yüklüdür!$\r$\nGeode MHv6/v7 ile çalışmamaktadır (MHv8 Geode ile uyumlu olacaktır).$\r$\nLütfen devam etmek için programı kaldırın." ${LangFileString} GEODE_TEXT_MOD_LOADER_ALREADY_INSTALLED "Bu dizin yolunda çoktan başka bir mod yükleyicisi bulunmaktadır!$\r$\nGeode başka bir mod yükleyicisi ile birlikte çalışmamaktadır.$\r$\nLütfen devam etmek için programı kaldırın. (the dll trademark)" ; uninstaller From b22ed7de213422e107c50965794a99dcc9422c78 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Sat, 20 Jan 2024 21:58:25 +0300 Subject: [PATCH 2/2] fun zip optimizations --- loader/src/utils/file.cpp | 90 +++++++++++++++++++++++++++++---------- 1 file changed, 68 insertions(+), 22 deletions(-) diff --git a/loader/src/utils/file.cpp b/loader/src/utils/file.cpp index 09565ded..ecb87c62 100644 --- a/loader/src/utils/file.cpp +++ b/loader/src/utils/file.cpp @@ -283,6 +283,73 @@ public: return Ok(std::move(ret)); } + Result<> extractAt(Path const& dir, Path const& name) { + auto entry = m_entries.at(name); + + GEODE_UNWRAP( + mzTry(mz_zip_entry_read_open(m_handle, 0, nullptr)) + .expect("Unable to open entry (code {error})") + ); + + // if the file is empty, its data is empty (duh) + if (!entry.uncompressedSize) { + return Ok(); + } + + ByteVector res; + res.resize(entry.uncompressedSize); + auto read = mz_zip_entry_read(m_handle, res.data(), entry.uncompressedSize); + if (read < 0) { + mz_zip_entry_close(m_handle); + return Err("Unable to read entry (code " + std::to_string(read) + ")"); + } + + mz_zip_entry_close(m_handle); + + GEODE_UNWRAP(file::writeBinary(dir / name, res)); + + return Ok(); + } + + Result<> extractAllTo(Path const& dir) { + GEODE_UNWRAP( + mzTry(mz_zip_goto_first_entry(m_handle)) + .expect("Unable to navigate to first entry (code {error})") + ); + + // while not at MZ_END_OF_LIST + while (mz_zip_goto_next_entry(m_handle) == MZ_OK) { + mz_zip_file* info = nullptr; + if (mz_zip_entry_get_info(m_handle, &info) != MZ_OK) { + return Err("Unable to get entry info"); + } + + Path filePath; + filePath.assign(info->filename, info->filename + info->filename_size); + + // make sure zip files like root/../../file.txt don't get extracted to + // avoid zip attacks +#ifdef GEODE_IS_WINDOWS + if (!std::filesystem::relative((dir / filePath).wstring(), dir.wstring()).empty()) { +#else + if (!ghc::filesystem::relative(dir / filePath, dir).empty()) { +#endif + if (m_entries.at(filePath).isDirectory) { + GEODE_UNWRAP(file::createDirectoryAll(dir / filePath)); + } else { + GEODE_UNWRAP(this->extractAt(dir, filePath)); + } + } else { + log::error( + "Zip entry '{}' is not contained within zip bounds", + dir / filePath + ); + } + }; + + return Ok(); + } + Result extract(Path const& name) { if (!m_entries.count(name)) { return Err("Entry not found"); @@ -458,28 +525,7 @@ Result<> Unzip::extractTo(Path const& name, Path const& path) { } Result<> Unzip::extractAllTo(Path const& dir) { - GEODE_UNWRAP(file::createDirectoryAll(dir)); - for (auto& [entry, info] : m_impl->getEntries()) { - // make sure zip files like root/../../file.txt don't get extracted to - // avoid zip attacks -#ifdef GEODE_IS_WINDOWS - if (!std::filesystem::relative((dir / entry).wstring(), dir.wstring()).empty()) { -#else - if (!ghc::filesystem::relative(dir / entry, dir).empty()) { -#endif - if (info.isDirectory) { - GEODE_UNWRAP(file::createDirectoryAll(dir / entry)); - } else { - GEODE_UNWRAP(this->extractTo(entry, dir / entry)); - } - } else { - log::error( - "Zip entry '{}' is not contained within zip bounds", - dir / entry - ); - } - } - return Ok(); + return m_impl->extractAllTo(dir); } Result<> Unzip::intoDir(