mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 13:20:28 +00:00
Add bypass for buggy wintab32.dll
This commit is contained in:
parent
cca23cb4f7
commit
0b538d8779
@ -10,9 +10,11 @@
|
||||
|
||||
#include "she/win/pen.h"
|
||||
|
||||
#include "base/convert_to.h"
|
||||
#include "base/debug.h"
|
||||
#include "base/fs.h"
|
||||
#include "base/log.h"
|
||||
#include "base/sha1.h"
|
||||
#include "base/string.h"
|
||||
|
||||
#include <iostream>
|
||||
@ -136,6 +138,12 @@ bool PenAPI::loadWintab()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isBuggyDll()) {
|
||||
base::unload_dll(m_wintabLib);
|
||||
m_wintabLib = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
WTInfo = base::get_dll_proc<WTInfoW_Func>(m_wintabLib, "WTInfoW");
|
||||
WTOpen = base::get_dll_proc<WTOpenW_Func>(m_wintabLib, "WTOpenW");
|
||||
WTClose = base::get_dll_proc<WTClose_Func>(m_wintabLib, "WTClose");
|
||||
@ -149,4 +157,25 @@ bool PenAPI::loadWintab()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PenAPI::isBuggyDll()
|
||||
{
|
||||
ASSERT(m_wintabLib);
|
||||
|
||||
WCHAR wpath[MAX_PATH];
|
||||
memset(wpath, 0, sizeof(wpath));
|
||||
GetModuleFileNameW((HMODULE)m_wintabLib, wpath, sizeof(wpath) / sizeof(WCHAR));
|
||||
|
||||
// Ugly hack to bypass the buggy WALTOP International Corp .dll that
|
||||
// hangs Aseprite completely when we call its WTInfo function.
|
||||
std::string path = base::to_utf8(wpath);
|
||||
if (base::is_file(path)) {
|
||||
std::string checksum =
|
||||
base::convert_to<std::string>(base::Sha1::calculateFromFile(path));
|
||||
LOG("PEN: SHA1 <%s> of <%s>\n", checksum.c_str(), path.c_str());
|
||||
if (checksum == "a3ba0d9c0f5d8b9f4070981b243a80579f8be105")
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace she
|
||||
|
@ -1,5 +1,5 @@
|
||||
// SHE library
|
||||
// Copyright (C) 2016 David Capello
|
||||
// Copyright (C) 2016-2017 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -32,6 +32,7 @@ namespace she {
|
||||
|
||||
private:
|
||||
bool loadWintab();
|
||||
bool isBuggyDll();
|
||||
|
||||
base::dll m_wintabLib;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user