ctr_Repair/trunk/CardCup/HeapManager.cpp
N2614 6b864c9c80 CUP不要時にもNUPバージョンをチェックして必要なら強制的にCUPするように
NUPバージョンをromfsから読み出すように
アプリ名の変更

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@355 385bec56-5757-e545-9c3a-d8741f4650f1
2011-07-05 02:34:43 +00:00

60 lines
1.6 KiB
C++

/*---------------------------------------------------------------------------*
Project: Horizon
File: HeapManager.cpp
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$
*---------------------------------------------------------------------------*/
#include "HeapManager.h"
nn::fnd::ThreadSafeExpHeap s_AppHeap;
HeapManager::HeapManager(size_t byteSize, s32 alignment, bit8 groupId, nn::fnd::ExpHeapBase::AllocationMode mode, bool reuse)
{
m_Ptr = s_AppHeap.Allocate(byteSize, alignment, groupId, mode, reuse);
}
HeapManager::~HeapManager()
{
if(m_Ptr != NULL)
{
s_AppHeap.Free(m_Ptr);
}
}
void* HeapManager::GetAddr()
{
return m_Ptr;
}
void InitializeHeap()
{
s_AppHeap.Initialize(nn::os::GetDeviceMemoryAddress(), nn::os::GetDeviceMemorySize(), nn::os::ALLOCATE_OPTION_LINEAR);
}
size_t GetAllocatableSize(s32 alignment)
{
return s_AppHeap.GetAllocatableSize(alignment);
}
void* ForceAllocate(size_t byteSize, s32 alignment, bit8 groupId, nn::fnd::ExpHeapBase::AllocationMode mode, bool reuse)
{
return s_AppHeap.Allocate(byteSize, alignment, groupId, mode, reuse);
}
void ForceFree(void* ptr)
{
if(ptr != NULL)
{
s_AppHeap.Free(ptr);
}
}