Added error message if included DirectX DLLs are missing

This commit is contained in:
Hyper 2025-03-04 22:47:10 +00:00
parent 4705ffddc2
commit f7e054bb46
3 changed files with 30 additions and 0 deletions

View file

@ -692,6 +692,12 @@ std::unordered_map<std::string_view, std::unordered_map<ELanguage, std::string>>
{ 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." }
}
},
{
"Common_On",
{

View file

@ -27,6 +27,15 @@
#include <timeapi.h>
#endif
#if _WIN32 && UNLEASHED_RECOMP_D3D12
static std::array<std::string_view, 3> g_D3D12RequiredModules =
{
"D3D12/D3D12Core.dll",
"dxcompiler.dll",
"dxil.dll"
};
#endif
const size_t XMAIOBegin = 0x7FEA0000;
const size_t XMAIOEnd = XMAIOBegin + 0x0000FFFF;
@ -180,6 +189,19 @@ int main(int argc, char *argv[])
Config::Load();
#if _WIN32 && 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);

View file

@ -8,6 +8,8 @@
#define GAME_INSTALL_DIRECTORY "."
#endif
extern std::filesystem::path g_executableRoot;
inline std::filesystem::path GetGamePath()
{
return GAME_INSTALL_DIRECTORY;