Common/MemArenaWin: Move the advanced Windows memory function address initialization into its own struct and function so it can be reused.

This commit is contained in:
Admiral H. Curtiss
2023-11-28 21:15:27 +01:00
parent 78d22d8003
commit eb235d6ee3
2 changed files with 61 additions and 49 deletions

View File

@ -14,6 +14,15 @@ namespace Common
{
#ifdef _WIN32
struct WindowsMemoryRegion;
struct WindowsMemoryFunctions
{
Common::DynamicLibrary m_kernel32_handle;
Common::DynamicLibrary m_api_ms_win_core_memory_l1_1_6_handle;
void* m_address_UnmapViewOfFileEx = nullptr;
void* m_address_VirtualAlloc2 = nullptr;
void* m_address_MapViewOfFile3 = nullptr;
};
#endif
// This class lets you create a block of anonymous RAM, and then arbitrarily map views into it.
@ -110,11 +119,7 @@ private:
std::vector<WindowsMemoryRegion> m_regions;
void* m_reserved_region = nullptr;
void* m_memory_handle = nullptr;
Common::DynamicLibrary m_kernel32_handle;
Common::DynamicLibrary m_api_ms_win_core_memory_l1_1_6_handle;
void* m_address_UnmapViewOfFileEx = nullptr;
void* m_address_VirtualAlloc2 = nullptr;
void* m_address_MapViewOfFile3 = nullptr;
WindowsMemoryFunctions m_memory_functions;
#else
int m_shm_fd = 0;
void* m_reserved_region = nullptr;