diff --git a/far/changelog b/far/changelog index a82953f407..3542362445 100644 --- a/far/changelog +++ b/far/changelog @@ -1,3 +1,7 @@ +w17 30.08.2017 12:21:12 +0300 - build 5015 + +1. Plerolad %FARHOME%\legacy\lua51.dll if x86 CPU doesn't support SSE2. + drkns 26.08.2017 11:20:44 +0100 - build 5014 1. В макрофункции date творилась дичь: diff --git a/far/main.cpp b/far/main.cpp index d484fefc82..442542577e 100644 --- a/far/main.cpp +++ b/far/main.cpp @@ -149,6 +149,34 @@ static int MainProcess( ppanel = Global->Opt->LocalProfilePath; } +#if defined(_WIN32) && !defined(_WIN64) && (defined(_MSC_VER) || defined(__GNUC__)) + // actual lua51.dll uses SSE2 instructions on x86. + // so we have to preload legacy lua51.dll if x86 CPU doesn't support SSE2 + { + bool have_sse2 = false; + int info[4] = { 0, 0, 0, 0 }; +#ifdef _MSC_VER +#include + __cpuidex(info, 0, 0); + if (info[0] >= 1) { + __cpuidex(info, 1, 0); +#else +#include + __cpuid_count(0, 0, info[0], info[1], info[2], info[3]); + if (info[0] >= 1) { + __cpuid_count(1, 0, info[0], info[1], info[2], info[3]); +#endif + have_sse2 = (info[3] & ((int)1 << 26)) != 0; + } + + if (!have_sse2) + { + auto legay_path = Global->g_strFarPath + L"\\legacy\\lua51.dll"; // %FARHOME%\legacy\lua51.dll + LoadLibraryW(legay_path.data()); + } + } +#endif + if (!ename.empty() || !vname.empty()) { Global->OnlyEditorViewerUsed = true; @@ -634,7 +662,7 @@ static int mainImpl(const range& Args) Iter = Next; } } - } + } break; case L'T': diff --git a/far/vbuild.m4 b/far/vbuild.m4 index 47fe7d6a51..d82edeb405 100644 --- a/far/vbuild.m4 +++ b/far/vbuild.m4 @@ -1 +1 @@ -m4_define(BUILD,5014)m4_dnl +m4_define(BUILD,5015)m4_dnl