RetroArch/360/xdk360_video_resources.h

94 lines
3.1 KiB
C
Raw Normal View History

2012-04-21 23:13:50 +02:00
/* RetroArch - A frontend for libretro.
2012-02-12 15:23:35 +01:00
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - Daniel De Matteis
*
2012-04-21 23:13:50 +02:00
* RetroArch is free software: you can redistribute it and/or modify it under the terms
2012-02-12 15:23:35 +01:00
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
2012-04-21 23:13:50 +02:00
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
2012-02-12 15:23:35 +01:00
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
2012-04-21 23:31:57 +02:00
* You should have received a copy of the GNU General Public License along with RetroArch.
2012-02-12 15:23:35 +01:00
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
2012-04-22 02:06:34 +02:00
#ifndef RARCH_360_RESOURCES_H
#define RARCH_360_RESOURCES_H
2012-02-12 15:23:35 +01:00
struct RESOURCE
{
2012-04-14 04:38:40 +02:00
unsigned long dwType;
unsigned long dwOffset;
unsigned long dwSize;
char * strName;
2012-02-12 15:23:35 +01:00
};
// Resource types
enum
{
2012-04-14 04:38:40 +02:00
RESOURCETYPE_USERDATA = ( ( 'U' << 24 ) | ( 'S' << 16 ) | ( 'E' << 8 ) | ( 'R' ) ),
RESOURCETYPE_TEXTURE = ( ( 'T' << 24 ) | ( 'X' << 16 ) | ( '2' << 8 ) | ( 'D' ) ),
RESOURCETYPE_CUBEMAP = ( ( 'T' << 24 ) | ( 'X' << 16 ) | ( 'C' << 8 ) | ( 'M' ) ),
RESOURCETYPE_VOLUMETEXTURE = ( ( 'T' << 24 ) | ( 'X' << 16 ) | ( '3' << 8 ) | ( 'D' ) ),
RESOURCETYPE_VERTEXBUFFER = ( ( 'V' << 24 ) | ( 'B' << 16 ) | ( 'U' << 8 ) | ( 'F' ) ),
RESOURCETYPE_INDEXBUFFER = ( ( 'I' << 24 ) | ( 'B' << 16 ) | ( 'U' << 8 ) | ( 'F' ) ),
RESOURCETYPE_EOF = 0xffffffff
2012-02-12 15:23:35 +01:00
};
//--------------------------------------------------------------------------------------
// Name: PackedResource
//--------------------------------------------------------------------------------------
class PackedResource
{
2012-05-29 15:25:39 +02:00
protected:
unsigned char * m_pSysMemData; // Alloc'ed memory for resource headers etc.
unsigned long m_dwSysMemDataSize;
unsigned char * m_pVidMemData; // Alloc'ed memory for resource data, etc.
unsigned long m_dwVidMemDataSize;
RESOURCE* m_pResourceTags; // Tags to associate names with the resources
unsigned long m_dwNumResourceTags; // Number of resource tags
public:
int m_bInitialized; // Resource is fully initialized
HRESULT Create( const char * strFilename );
void Destroy();
void * GetData( unsigned long dwOffset ) const
{
return &m_pSysMemData[dwOffset];
}
D3DResource* GetResource( unsigned long dwOffset ) const
{
return (( D3DResource* )GetData( dwOffset ) );
}
D3DTexture* GetTexture( unsigned long dwOffset ) const
{
return ( D3DTexture* )GetResource( dwOffset );
}
void * GetData( const char * strName ) const;
D3DResource* GetResource( const char * strName ) const
{
return ( ( D3DResource* )GetData( strName ) );
}
D3DTexture* GetTexture( const char * strName ) const
{
return ( D3DTexture* )GetResource( strName );
}
PackedResource();
~PackedResource();
2012-02-12 15:23:35 +01:00
};
2012-02-12 17:13:13 +01:00
#endif