mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-01-02 01:30:25 -06:00
- Implements "Unleash Cancel" to allow cancelling Unleash after activating it. - Implements out of control fixes to prevent the gauge from draining when the player cannot utilise it.
40 lines
771 B
C++
40 lines
771 B
C++
#pragma once
|
|
|
|
#include "mutex.h"
|
|
#include <o1heap.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;
|