ctr_Repair/branches/CardCup_Normal/HeapManager.h
N2614 1db4d710c7 3rdNUP本体で無限ループしてしまうバージョンのブランチ
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@704 385bec56-5757-e545-9c3a-d8741f4650f1
2012-05-01 00:27:25 +00:00

47 lines
1.6 KiB
C++

/*---------------------------------------------------------------------------*
Project: Horizon
File: HeapManager.h
Copyright 2009 Nintendo. All rights reserved.
These coded instructions, statements, and computer programs contain
proprietary information of Nintendo of America Inc. and/or Nintendo
Company Ltd., and are protected by Federal copyright law. They may
not be disclosed to third parties or copied or duplicated in any form,
in whole or in part, without the prior written consent of Nintendo.
$Rev$
*---------------------------------------------------------------------------*/
#ifndef HEAPMANAGER_H_
#define HEAPMANAGER_H_
#include <nn.h>
#include <nn/fnd.h>
class HeapManager
{
public:
explicit HeapManager(size_t byteSize, s32 alignment = nn::fnd::ExpHeapBase::DEFAULT_ALIGNMENT, bit8 groupId = 0,
nn::fnd::ExpHeapBase::AllocationMode mode = nn::fnd::ExpHeapBase::ALLOCATION_MODE_FIRST_FIT, bool reuse = false);
virtual ~HeapManager();
void* GetAddr();
private:
void* m_Ptr;
};
void InitializeHeap();
size_t GetAllocatableSize(s32 alignment = nn::fnd::ExpHeapBase::DEFAULT_ALIGNMENT);
// HeapManagerを使わず確保する場合のみ
void* ForceAllocate(size_t byteSize, s32 alignment = nn::fnd::ExpHeapBase::DEFAULT_ALIGNMENT, bit8 groupId = 0,
nn::fnd::ExpHeapBase::AllocationMode mode = nn::fnd::ExpHeapBase::ALLOCATION_MODE_FIRST_FIT, bool reuse = false);
// HeapManagerを使わず解放する場合のみ
void ForceFree(void* ptr);
#endif /* HEAPMANAGER_H_ */