mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-01-01 09:12:37 -06:00
* Implemented guest-to-host function pointers (WIP) Co-Authored-By: Skyth (Asilkan) <19259897+blueskythlikesclouds@users.noreply.github.com> * function: support more types for function pointers * api: ported BlueBlur headers and misc. research * Move over function-pointers changes from options-menu branch. --------- Co-authored-by: Skyth (Asilkan) <19259897+blueskythlikesclouds@users.noreply.github.com>
39 lines
751 B
C++
39 lines
751 B
C++
#pragma once
|
|
|
|
#include "mutex.h"
|
|
|
|
struct Heap
|
|
{
|
|
Mutex mutex;
|
|
O1HeapInstance* heap;
|
|
|
|
Mutex physicalMutex;
|
|
O1HeapInstance* physicalHeap;
|
|
|
|
void Init();
|
|
|
|
void* Alloc(size_t size);
|
|
void* AllocPhysical(size_t size, size_t alignment);
|
|
void Free(void* ptr);
|
|
|
|
size_t Size(void* ptr);
|
|
|
|
template<typename T, typename... Args>
|
|
T* Alloc(Args... args)
|
|
{
|
|
T* obj = (T*)Alloc(sizeof(T));
|
|
new (obj) T(std::forward<Args>(args)...);
|
|
return obj;
|
|
}
|
|
|
|
template<typename T, typename... Args>
|
|
T* AllocPhysical(Args... args)
|
|
{
|
|
T* obj = (T*)AllocPhysical(sizeof(T), alignof(T));
|
|
new (obj) T(std::forward<Args>(args)...);
|
|
return obj;
|
|
}
|
|
};
|
|
|
|
extern Heap g_userHeap;
|