mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Pack and deploy d3dcompiler_47.dll.
This commit is contained in:
parent
6e90d6ae53
commit
1ce66e5198
6 changed files with 90 additions and 2 deletions
|
@ -96,6 +96,50 @@ BOOL CALLBACK _ActivateProcess(HWND hWnd, LPARAM lParam) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeleteMyModules() {
|
||||||
|
constexpr auto kMaxPathLong = 32767;
|
||||||
|
auto exePath = std::array<WCHAR, kMaxPathLong + 1>{ 0 };
|
||||||
|
const auto exeLength = GetModuleFileName(
|
||||||
|
nullptr,
|
||||||
|
exePath.data(),
|
||||||
|
kMaxPathLong + 1);
|
||||||
|
if (!exeLength || exeLength >= kMaxPathLong + 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto exe = std::wstring(exePath.data());
|
||||||
|
const auto last1 = exe.find_last_of('\\');
|
||||||
|
const auto last2 = exe.find_last_of('/');
|
||||||
|
const auto last = std::max(
|
||||||
|
(last1 == std::wstring::npos) ? -1 : int(last1),
|
||||||
|
(last2 == std::wstring::npos) ? -1 : int(last2));
|
||||||
|
if (last < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto modules = exe.substr(0, last + 1) + L"modules";
|
||||||
|
const auto deleteOne = [&](const wchar_t *name, const wchar_t *arch) {
|
||||||
|
const auto path = modules + L'\\' + arch + L'\\' + name;
|
||||||
|
DeleteFile(path.c_str());
|
||||||
|
};
|
||||||
|
const auto deleteBoth = [&](const wchar_t *name) {
|
||||||
|
deleteOne(name, L"x86");
|
||||||
|
deleteOne(name, L"x64");
|
||||||
|
};
|
||||||
|
const auto removeOne = [&](const std::wstring &name) {
|
||||||
|
const auto path = modules + L'\\' + name;
|
||||||
|
RemoveDirectory(path.c_str());
|
||||||
|
};
|
||||||
|
const auto removeBoth = [&](const std::wstring &name) {
|
||||||
|
removeOne(L"x86\\" + name);
|
||||||
|
removeOne(L"x64\\" + name);
|
||||||
|
};
|
||||||
|
deleteBoth(L"d3d\\d3dcompiler_47.dll");
|
||||||
|
|
||||||
|
removeBoth(L"d3d");
|
||||||
|
removeOne(L"x86");
|
||||||
|
removeOne(L"x64");
|
||||||
|
RemoveDirectory(modules.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void psActivateProcess(uint64 pid) {
|
void psActivateProcess(uint64 pid) {
|
||||||
|
@ -133,6 +177,7 @@ void psDoCleanup() {
|
||||||
psAutoStart(false, true);
|
psAutoStart(false, true);
|
||||||
psSendToMenu(false, true);
|
psSendToMenu(false, true);
|
||||||
AppUserModelId::cleanupShortcut();
|
AppUserModelId::cleanupShortcut();
|
||||||
|
DeleteMyModules();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,6 +276,7 @@ void StartOpenSSL() {
|
||||||
|
|
||||||
void start() {
|
void start() {
|
||||||
StartOpenSSL();
|
StartOpenSSL();
|
||||||
|
Dlls::CheckLoadedModules();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ThirdParty
|
} // namespace ThirdParty
|
||||||
|
|
|
@ -14,6 +14,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#define LOAD_SYMBOL(lib, name) ::base::Platform::LoadMethod(lib, #name, name)
|
#define LOAD_SYMBOL(lib, name) ::base::Platform::LoadMethod(lib, #name, name)
|
||||||
|
|
||||||
|
bool DirectXResolveCompiler();
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
namespace Dlls {
|
namespace Dlls {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -74,5 +76,30 @@ SafeIniter::SafeIniter() {
|
||||||
SafeIniter kSafeIniter;
|
SafeIniter kSafeIniter;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
void CheckLoadedModules() {
|
||||||
|
if (DirectXResolveCompiler()) {
|
||||||
|
auto LibD3DCompiler = HMODULE();
|
||||||
|
if (GetModuleHandleEx(0, L"d3dcompiler_47.dll", &LibD3DCompiler)) {
|
||||||
|
constexpr auto kMaxPathLong = 32767;
|
||||||
|
auto path = std::array<WCHAR, kMaxPathLong + 1>{ 0 };
|
||||||
|
const auto length = GetModuleFileName(
|
||||||
|
LibD3DCompiler,
|
||||||
|
path.data(),
|
||||||
|
kMaxPathLong);
|
||||||
|
if (length > 0 && length < kMaxPathLong) {
|
||||||
|
LOG(("Using DirectX compiler '%1'."
|
||||||
|
).arg(QString::fromWCharArray(path.data())));
|
||||||
|
} else {
|
||||||
|
LOG(("Error: Could not resolve DirectX compiler path."));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOG(("Error: Could not resolve DirectX compiler module."));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOG(("Error: Could not resolve DirectX compiler library."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Dlls
|
} // namespace Dlls
|
||||||
} // namespace Platform
|
} // namespace Platform
|
||||||
|
|
|
@ -22,6 +22,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
namespace Dlls {
|
namespace Dlls {
|
||||||
|
|
||||||
|
void CheckLoadedModules();
|
||||||
|
|
||||||
// UXTHEME.DLL
|
// UXTHEME.DLL
|
||||||
inline HRESULT(__stdcall *SetWindowTheme)(
|
inline HRESULT(__stdcall *SetWindowTheme)(
|
||||||
HWND hWnd,
|
HWND hWnd,
|
||||||
|
|
|
@ -206,7 +206,13 @@ if %BuildUWP% equ 0 (
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
call Packer.exe -version %VersionForPacker% -path %BinaryName%.exe -path Updater.exe -target %BuildTarget% %AlphaBetaParam%
|
if %Build64% neq 0 (
|
||||||
|
set "ModulesFolder=x64"
|
||||||
|
) else (
|
||||||
|
set "ModulesFolder=x86"
|
||||||
|
)
|
||||||
|
|
||||||
|
call Packer.exe -version %VersionForPacker% -path %BinaryName%.exe -path Updater.exe -path "modules\!ModulesFolder!\d3d\d3dcompiler_47.dll" -target %BuildTarget% %AlphaBetaParam%
|
||||||
if %errorlevel% neq 0 goto error
|
if %errorlevel% neq 0 goto error
|
||||||
|
|
||||||
if %AlphaVersion% neq 0 (
|
if %AlphaVersion% neq 0 (
|
||||||
|
|
|
@ -36,10 +36,14 @@ DisableProgramGroupPage=no
|
||||||
ArchitecturesAllowed=x64
|
ArchitecturesAllowed=x64
|
||||||
ArchitecturesInstallIn64BitMode=x64
|
ArchitecturesInstallIn64BitMode=x64
|
||||||
OutputBaseFilename=tsetup-x64.{#MyAppVersionFull}
|
OutputBaseFilename=tsetup-x64.{#MyAppVersionFull}
|
||||||
|
#define ArchModulesFolder "x64"
|
||||||
#else
|
#else
|
||||||
OutputBaseFilename=tsetup.{#MyAppVersionFull}
|
OutputBaseFilename=tsetup.{#MyAppVersionFull}
|
||||||
|
#define ArchModulesFolder "x86"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ModulesFolder "modules\{#ArchModulesFolder}"
|
||||||
|
|
||||||
[Languages]
|
[Languages]
|
||||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||||
Name: "it"; MessagesFile: "compiler:Languages\Italian.isl"
|
Name: "it"; MessagesFile: "compiler:Languages\Italian.isl"
|
||||||
|
@ -58,6 +62,7 @@ Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescrip
|
||||||
[Files]
|
[Files]
|
||||||
Source: "{#ReleasePath}\Telegram.exe"; DestDir: "{app}"; Flags: ignoreversion
|
Source: "{#ReleasePath}\Telegram.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
Source: "{#ReleasePath}\Updater.exe"; DestDir: "{app}"; Flags: ignoreversion
|
Source: "{#ReleasePath}\Updater.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||||
|
Source: "{#ReleasePath}\{#ModulesFolder}\d3d\d3dcompiler_47.dll; DestDir: "{app}\{#ModulesFolder}\d3d"; Flags: ignoreversion
|
||||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
|
@ -78,6 +83,7 @@ Type: filesandordirs; Name: "{app}\tupdates"
|
||||||
Type: filesandordirs; Name: "{app}\tdata"
|
Type: filesandordirs; Name: "{app}\tdata"
|
||||||
Type: filesandordirs; Name: "{app}\tcache"
|
Type: filesandordirs; Name: "{app}\tcache"
|
||||||
Type: filesandordirs; Name: "{app}\tdumps"
|
Type: filesandordirs; Name: "{app}\tdumps"
|
||||||
|
Type: filesandordirs; Name: "{app}\modules"
|
||||||
Type: dirifempty; Name: "{app}"
|
Type: dirifempty; Name: "{app}"
|
||||||
Type: files; Name: "{userappdata}\{#MyAppName}\data"
|
Type: files; Name: "{userappdata}\{#MyAppName}\data"
|
||||||
Type: files; Name: "{userappdata}\{#MyAppName}\data_config"
|
Type: files; Name: "{userappdata}\{#MyAppName}\data_config"
|
||||||
|
@ -87,6 +93,7 @@ Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\tupdates"
|
||||||
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\tdata"
|
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\tdata"
|
||||||
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\tcache"
|
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\tcache"
|
||||||
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\tdumps"
|
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\tdumps"
|
||||||
|
Type: filesandordirs; Name: "{userappdata}\{#MyAppName}\modules"
|
||||||
Type: dirifempty; Name: "{userappdata}\{#MyAppName}"
|
Type: dirifempty; Name: "{userappdata}\{#MyAppName}"
|
||||||
|
|
||||||
[Code]
|
[Code]
|
||||||
|
|
2
cmake
2
cmake
|
@ -1 +1 @@
|
||||||
Subproject commit 46a49caa21c16d3cc563798b8c26ba936cdd30e3
|
Subproject commit fe0d8a184134850bf1476096c09564290188d470
|
Loading…
Add table
Reference in a new issue