2012-04-21 21:13:50 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2012-02-12 14:23:35 +00:00
|
|
|
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
|
|
|
* Copyright (C) 2011-2012 - Daniel De Matteis
|
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
2012-02-12 14:23:35 +00: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 21:13:50 +00:00
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
2012-02-12 14:23:35 +00: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 21:31:57 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
2012-02-12 14:23:35 +00:00
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2012-04-22 00:06:34 +00:00
|
|
|
#ifndef RARCH_360_RESOURCES_H
|
|
|
|
#define RARCH_360_RESOURCES_H
|
2012-02-12 14:23:35 +00:00
|
|
|
|
2012-07-07 12:39:19 +00:00
|
|
|
#ifdef _XBOX360
|
|
|
|
#include "../gfx/fonts/xdk360_fonts.h"
|
|
|
|
#endif
|
|
|
|
|
2012-02-12 14:23:35 +00:00
|
|
|
struct RESOURCE
|
|
|
|
{
|
2012-04-14 02:38:40 +00:00
|
|
|
unsigned long dwType;
|
|
|
|
unsigned long dwOffset;
|
|
|
|
unsigned long dwSize;
|
|
|
|
char * strName;
|
2012-02-12 14:23:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Resource types
|
|
|
|
enum
|
|
|
|
{
|
2012-04-14 02:38:40 +00: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 14:23:35 +00:00
|
|
|
};
|
|
|
|
|
2012-07-07 12:39:19 +00:00
|
|
|
extern video_console_t video_console;
|
|
|
|
extern xdk360_video_font_t m_Font;
|
|
|
|
|
2012-02-12 14:23:35 +00:00
|
|
|
class PackedResource
|
|
|
|
{
|
2012-05-29 13:25:39 +00:00
|
|
|
protected:
|
|
|
|
unsigned char * m_pSysMemData; // Alloc'ed memory for resource headers etc.
|
|
|
|
unsigned char * m_pVidMemData; // Alloc'ed memory for resource data, etc.
|
2012-07-07 12:06:21 +00:00
|
|
|
unsigned long m_dwSysMemDataSize;
|
2012-05-29 13:25:39 +00:00
|
|
|
unsigned long m_dwVidMemDataSize;
|
|
|
|
unsigned long m_dwNumResourceTags; // Number of resource tags
|
2012-07-07 12:06:21 +00:00
|
|
|
RESOURCE* m_pResourceTags; // Tags to associate names with the resources
|
2012-05-29 13:25:39 +00:00
|
|
|
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 14:23:35 +00:00
|
|
|
};
|
|
|
|
|
2012-07-07 12:39:19 +00:00
|
|
|
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 );
|
|
|
|
|
2012-02-12 16:13:13 +00:00
|
|
|
#endif
|