MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / MapBinaryFileForRead

Function MapBinaryFileForRead

common/FileSystem.cpp:1269–1280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1267
1268#ifdef _WIN32
1269static std::span<const u8> MapBinaryFileForRead(HANDLE handle)
1270{
1271 LARGE_INTEGER size;
1272 if (!GetFileSizeEx(handle, &size) || size.QuadPart == 0)
1273 return {};
1274 HANDLE mapping = CreateFileMappingW(handle, nullptr, PAGE_READONLY, size.HighPart, size.LowPart, nullptr);
1275 if (!mapping)
1276 return {};
1277 void* ptr = MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, 0);
1278 CloseHandle(mapping);
1279 return {static_cast<const u8*>(ptr), static_cast<size_t>(size.QuadPart)};
1280}
1281#else
1282static std::span<const u8> MapBinaryFileForRead(int fd)
1283{

Callers 3

InitializeConfigMethod · 0.85
TryLoadFontFunction · 0.85
MapBinaryFileForReadMethod · 0.85

Calls 1

CloseHandleFunction · 0.85

Tested by

no test coverage detected