From c64ef1fe15f4890b0c9aca99bf821722ab300a39 Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Fri, 7 Mar 2025 01:47:15 +0000 Subject: [PATCH] Added error message if included DirectX DLLs are missing (#998) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added error message if included DirectX DLLs are missing * locale: added System_Win32_MissingDLLs localisation Co-Authored-By: LJSTAR <31629427+LJSTARbird@users.noreply.github.com> Co-Authored-By: Kitzuku <25226941+Kitzuku@users.noreply.github.com> Co-Authored-By: NextinHKRY <38560522+NextinMono@users.noreply.github.com> Co-Authored-By: brianuuu <38166666+brianuuu@users.noreply.github.com> Co-Authored-By: Darío <538504+DarioSamo@users.noreply.github.com> * Fix ifdefs --------- Co-authored-by: LJSTAR <31629427+LJSTARbird@users.noreply.github.com> Co-authored-by: Kitzuku <25226941+Kitzuku@users.noreply.github.com> Co-authored-by: NextinHKRY <38560522+NextinMono@users.noreply.github.com> Co-authored-by: brianuuu <38166666+brianuuu@users.noreply.github.com> Co-authored-by: Darío <538504+DarioSamo@users.noreply.github.com> --- UnleashedRecomp/locale/locale.cpp | 11 +++++++++++ UnleashedRecomp/main.cpp | 22 ++++++++++++++++++++++ UnleashedRecomp/user/paths.h | 2 ++ 3 files changed, 35 insertions(+) diff --git a/UnleashedRecomp/locale/locale.cpp b/UnleashedRecomp/locale/locale.cpp index eafb24b9..138dc417 100644 --- a/UnleashedRecomp/locale/locale.cpp +++ b/UnleashedRecomp/locale/locale.cpp @@ -692,6 +692,17 @@ std::unordered_map> { ELanguage::Italian, "Impossibile creare un backend D3D12 (Windows) o Vulkan.\n\nAssicurati che:\n\n- Il tuo sistema soddisfi i requisiti minimi.\n- I driver della scheda grafica siano aggiornati.\n- Il tuo sistema operativo sia aggiornato." } } }, + { + "System_Win32_MissingDLLs", + { + { ELanguage::English, "The module \"%s\" could not be found.\n\nPlease make sure that:\n\n- You extracted this copy of Unleashed Recompiled fully and not just the *.exe file.\n- You are not running Unleashed Recompiled from a *.zip file." }, + { ELanguage::Japanese, "モジュール\"%s\"が見つかりませんでした\n\n次の点を確認してください:\n\n※Unleashed Recompiledの*.exeファイルだけを抽出していなく、 コピーを完全に抽出してること\n※Unleashed Recompiledを*.zipファイルから実行していないこと" }, + { ELanguage::German, "Das Modul \"%s\" konnte nicht gefunden werden.\n\nBitte stelle sicher, dass:\n\n- Diese Kopie von Unleashed Recompiled vollständig entpackt wurde und nicht nur die *.exe-Datei.\n- Unleashed Recompiled nicht direkt aus einer *.zip-Datei ausgeführt wird." }, + { ELanguage::French, "Le module \"%s\" n'a pas pu être trouvé.\n\nVeuillez vous assurer que :\n\n- Vous avez extrait Unleashed Recompiled dans son entièreté et pas seulement le fichier *.exe.\n- Vous n'exécutez pas Unleashed Recompiled à partir d'un fichier *.zip." }, + { ELanguage::Spanish, "No se pudo encontrar el módulo \"%s\".\n\nAsegúrese de que:\n\n- Ha extraido esta copia de Unleashed Recompiled por completo y no solo el archivo *.exe.\n- No está ejecutando Unleashed Recompiled desde un archivo *.zip." }, + { ELanguage::Italian, "Impossibile trovare il modulo \"%s\".\n\nAssicurati che:\n\n- Hai estratto questa copia di Unleashed Recompiled correttamente e non solo il file *.exe.\n- Non stai eseguendo Unleashed Recompiled da un file *.zip." } + } + }, { "Common_On", { diff --git a/UnleashedRecomp/main.cpp b/UnleashedRecomp/main.cpp index 9158abf3..a55c0181 100644 --- a/UnleashedRecomp/main.cpp +++ b/UnleashedRecomp/main.cpp @@ -28,6 +28,15 @@ #include #endif +#if defined(_WIN32) && defined(UNLEASHED_RECOMP_D3D12) +static std::array g_D3D12RequiredModules = +{ + "D3D12/D3D12Core.dll", + "dxcompiler.dll", + "dxil.dll" +}; +#endif + const size_t XMAIOBegin = 0x7FEA0000; const size_t XMAIOEnd = XMAIOBegin + 0x0000FFFF; @@ -204,6 +213,19 @@ int main(int argc, char *argv[]) Config::Load(); +#if defined(_WIN32) && defined(UNLEASHED_RECOMP_D3D12) + for (auto& dll : g_D3D12RequiredModules) + { + if (!std::filesystem::exists(g_executableRoot / dll)) + { + char text[512]; + snprintf(text, sizeof(text), Localise("System_Win32_MissingDLLs").c_str(), dll.data()); + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, GameWindow::GetTitle(), text, GameWindow::s_pWindow); + std::_Exit(1); + } + } +#endif + // Check the time since the last time an update was checked. Store the new time if the difference is more than six hours. constexpr double TimeBetweenUpdateChecksInSeconds = 6 * 60 * 60; time_t timeNow = std::time(nullptr); diff --git a/UnleashedRecomp/user/paths.h b/UnleashedRecomp/user/paths.h index d914213b..c0835204 100644 --- a/UnleashedRecomp/user/paths.h +++ b/UnleashedRecomp/user/paths.h @@ -8,6 +8,8 @@ #define GAME_INSTALL_DIRECTORY "." #endif +extern std::filesystem::path g_executableRoot; + inline std::filesystem::path GetGamePath() { return GAME_INSTALL_DIRECTORY;