RetroArch/360/xdk360_video_resources.h

98 lines
3.3 KiB
C++

/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* 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.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef RARCH_360_RESOURCES_H
#define RARCH_360_RESOURCES_H
#ifdef _XBOX360
#include "../gfx/fonts/xdk360_fonts.h"
#endif
struct RESOURCE
{
unsigned long dwType;
unsigned long dwOffset;
unsigned long dwSize;
char * strName;
};
// Resource types
enum
{
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
};
extern video_console_t video_console;
extern xdk360_video_font_t m_Font;
class PackedResource
{
protected:
unsigned char * m_pSysMemData; // Alloc'ed memory for resource headers etc.
unsigned char * m_pVidMemData; // Alloc'ed memory for resource data, etc.
unsigned long m_dwSysMemDataSize;
unsigned long m_dwVidMemDataSize;
unsigned long m_dwNumResourceTags; // Number of resource tags
RESOURCE* m_pResourceTags; // Tags to associate names with the resources
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();
};
extern void xdk360_convert_texture_to_as16_srgb( D3DTexture *pTexture );
extern void xdk360_video_font_draw_text(xdk360_video_font_t * font,
float fOriginX, float fOriginY, const wchar_t * strText, float fMaxPixelWidth );
#endif