//////////////////////////////////////////////////////////////////////////////
//
// Asura_Chunk_ResourceFile_PS2_Dll.cpp
//
// Copyright (c) 2003 Rebellion. All rights reserved.
//
// Description:
//
//     Dll chunk parsing code
//
//////////////////////////////////////////////////////////////////////////////

// I N C L U D E S ///////////////////////////////////////////////////////////

#include "Core/Asura.h"

#ifdef ASURA_PS2_SUPPORT_DLLS

#include "ChunkSystem/Asura_Chunk_ResourceFile_PS2_Dll.h"

// independent includes
#include "Debugging/Asura_Assert.h"
#include "FileAccess/Asura_FileAccess.h"

// ps2 includes
#include "Core/Asura_PS2_OS.h"

bool Asura_Chunk_ResourceFile_PS2_Dll::Process( Asura_Handle hFile, const char* szOriginalFilename )
{
	u_long128* puBuffer = Asura_PS2_OS::AllocateDllMem( this->FileSize );
	Asura_Assert(puBuffer, "no buffer");
	if (!puBuffer)
	{
		return false;
	}
	
	bool bOK = Asura_FileAccess::ReadData( hFile, puBuffer, this->FileSize );
	if (bOK)
	{
		Asura_PS2_OS::InitDll(szOriginalFilename, puBuffer);
	}
	return bOK;
}

#endif // #ifdef ASURA_PS2_SUPPORT_DLLS
