mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-21 06:35:00 -04:00
prepare launcher for UGC
This commit is contained in:
parent
86d0919905
commit
4ed39ec344
11 changed files with 342 additions and 121 deletions
|
@ -10,6 +10,7 @@ extern "C" {
|
|||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdexcept>
|
||||
#include <filesystem>
|
||||
|
||||
// Funkce pro mapování souboru do paměti
|
||||
const void* map_file_to_memory_cpp(const char *name, size_t *sz) {
|
||||
|
@ -17,8 +18,10 @@ const void* map_file_to_memory_cpp(const char *name, size_t *sz) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
HANDLE h = CreateFileA(name, GENERIC_READ, FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
|
||||
if (h == INVALID_HANDLE_VALUE) throw std::runtime_error(std::string("Failed to open file for mapping: ").append(name));
|
||||
std::filesystem::path p(reinterpret_cast<const char8_t *>(name));
|
||||
|
||||
HANDLE h = CreateFileW(p.c_str(), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
|
||||
if (h == INVALID_HANDLE_VALUE) throw std::runtime_error(std::string("Failed to open file for mapping: ")+p.string());
|
||||
|
||||
LARGE_INTEGER fsize;
|
||||
if (!GetFileSizeEx(h, &fsize)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue