Update Premake5 (100% no hacks)
This commit is contained in:
@ -19,15 +19,9 @@ namespace Utils
|
||||
return Library(handle);
|
||||
}
|
||||
|
||||
Library::Library(const std::string& buffer, bool _freeOnDestroy) : _module(nullptr), freeOnDestroy(_freeOnDestroy)
|
||||
Library::Library(const std::string& name, bool _freeOnDestroy) : _module(nullptr), freeOnDestroy(_freeOnDestroy)
|
||||
{
|
||||
this->_module = LoadLibraryExA(buffer.data(), nullptr, 0);
|
||||
}
|
||||
|
||||
Library::Library(const std::string& buffer)
|
||||
{
|
||||
this->_module = GetModuleHandleA(buffer.data());
|
||||
this->freeOnDestroy = true;
|
||||
this->_module = LoadLibraryExA(name.data(), nullptr, 0);
|
||||
}
|
||||
|
||||
Library::Library(const HMODULE handle)
|
||||
@ -49,7 +43,7 @@ namespace Utils
|
||||
return this->_module != nullptr;
|
||||
}
|
||||
|
||||
HMODULE Library::getModule()
|
||||
HMODULE Library::getModule() const
|
||||
{
|
||||
return this->_module;
|
||||
}
|
||||
|
@ -81,10 +81,12 @@ namespace Utils
|
||||
this->pool.push_back(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
template <typename T> inline T* allocate()
|
||||
{
|
||||
return this->allocateArray<T>(1);
|
||||
}
|
||||
|
||||
template <typename T> inline T* allocateArray(size_t count = 1)
|
||||
{
|
||||
return static_cast<T*>(this->allocate(count * sizeof(T)));
|
||||
|
@ -107,9 +107,9 @@ namespace Utils
|
||||
void SetEnvironment()
|
||||
{
|
||||
wchar_t exeName[512];
|
||||
GetModuleFileNameW(GetModuleHandle(nullptr), exeName, sizeof(exeName) / 2);
|
||||
GetModuleFileNameW(GetModuleHandle(nullptr), exeName, sizeof(exeName) / sizeof(wchar_t));
|
||||
|
||||
wchar_t* exeBaseName = wcsrchr(exeName, L'\\');
|
||||
auto* exeBaseName = wcsrchr(exeName, L'\\');
|
||||
exeBaseName[0] = L'\0';
|
||||
|
||||
SetCurrentDirectoryW(exeName);
|
||||
|
Reference in New Issue
Block a user