mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
(Xbox 360) Buildfixes
This commit is contained in:
parent
89641d0009
commit
1f6b9e1c18
@ -82,26 +82,28 @@ class PackedResource
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/* Loads the resources out of the specified bundle */
|
/* Loads the resources out of the specified bundle */
|
||||||
#if defined(_XBOX1)
|
HRESULT Create(const char *strFilename, DWORD dwNumResourceTags,
|
||||||
HRESULT Create( const char *strFilename, DWORD dwNumResourceTags = 0L,
|
void *pResourceTags);
|
||||||
XBRESOURCE* pResourceTags = NULL );
|
|
||||||
#elif defined(_XBOX360)
|
|
||||||
HRESULT Create( const char * strFilename );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
|
||||||
BOOL m_bInitialized; /* Resource is fully initialized */
|
BOOL m_bInitialized; /* Resource is fully initialized */
|
||||||
|
|
||||||
#ifdef _XBOX360
|
|
||||||
/* Retrieves the resource tags */
|
/* Retrieves the resource tags */
|
||||||
void GetResourceTags( DWORD* pdwNumResourceTags, XBRESOURCE** ppResourceTags );
|
void GetResourceTags( DWORD* pdwNumResourceTags, XBRESOURCE** ppResourceTags );
|
||||||
#endif
|
/* Functions to retrieve resources by their name */
|
||||||
|
void *GetData( const char* strName );
|
||||||
|
void *GetTexture(const char* strName);
|
||||||
|
|
||||||
/* Helper function to make sure a resource is registered */
|
/* Constructor/destructor */
|
||||||
LPDIRECT3DRESOURCE RegisterResource( LPDIRECT3DRESOURCE pResource ) const
|
PackedResource();
|
||||||
{
|
~PackedResource();
|
||||||
|
};
|
||||||
|
|
||||||
|
void *PackedResource::GetTexture(const char* strName)
|
||||||
|
{
|
||||||
#ifdef _XBOX1
|
#ifdef _XBOX1
|
||||||
|
LPDIRECT3DRESOURCE8 pResource = (LPDIRECT3DRESOURCE8)GetData(strName);
|
||||||
/* Register the resource, if it has not yet been registered. We mark
|
/* Register the resource, if it has not yet been registered. We mark
|
||||||
* a resource as registered by upping it's reference count. */
|
* a resource as registered by upping it's reference count. */
|
||||||
if( pResource && ( pResource->Common & D3DCOMMON_REFCOUNT_MASK ) == 1 )
|
if( pResource && ( pResource->Common & D3DCOMMON_REFCOUNT_MASK ) == 1 )
|
||||||
@ -115,20 +117,12 @@ class PackedResource
|
|||||||
|
|
||||||
pResource->AddRef();
|
pResource->AddRef();
|
||||||
}
|
}
|
||||||
|
return (LPDIRECT3DTEXTURE8)pResource;
|
||||||
|
#elif defined(_XBOX360)
|
||||||
|
LPDIRECT3DRESOURCE9 pResource = (LPDIRECT3DRESOURCE9)GetData(strName);
|
||||||
|
return (LPDIRECT3DTEXTURE9)pResource;
|
||||||
#endif
|
#endif
|
||||||
return pResource;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Functions to retrieve resources by their name */
|
|
||||||
void *GetData( const char* strName ) const;
|
|
||||||
|
|
||||||
LPDIRECT3DTEXTURE GetTexture( const char* strName ) const
|
|
||||||
{ return (LPDIRECT3DTEXTURE)RegisterResource((LPDIRECT3DRESOURCE)GetData(strName)); }
|
|
||||||
|
|
||||||
/* Constructor/destructor */
|
|
||||||
PackedResource();
|
|
||||||
~PackedResource();
|
|
||||||
};
|
|
||||||
|
|
||||||
PackedResource::PackedResource()
|
PackedResource::PackedResource()
|
||||||
{
|
{
|
||||||
@ -141,13 +135,12 @@ PackedResource::PackedResource()
|
|||||||
m_bInitialized = false;
|
m_bInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PackedResource::~PackedResource()
|
PackedResource::~PackedResource()
|
||||||
{
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void *PackedResource::GetData(const char *strName) const
|
void *PackedResource::GetData(const char *strName)
|
||||||
{
|
{
|
||||||
if (!m_pResourceTags || !strName)
|
if (!m_pResourceTags || !strName)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -211,18 +204,18 @@ static HRESULT FindMediaFile(char *strPath, const char *strFilename, size_t strP
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_XBOX1)
|
|
||||||
HRESULT PackedResource::Create(const char *strFilename,
|
HRESULT PackedResource::Create(const char *strFilename,
|
||||||
DWORD dwNumResourceTags, XBRESOURCE* pResourceTags)
|
DWORD dwNumResourceTags, void* pResourceTags)
|
||||||
#elif defined(_XBOX360)
|
|
||||||
HRESULT PackedResource::Create(const char *strFilename)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
DWORD dwNumBytesRead;
|
DWORD dwNumBytesRead;
|
||||||
XPR_HEADER xprh;
|
XPR_HEADER xprh;
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
|
#ifdef _XBOX360
|
||||||
|
(void)dwNumResourceTags;
|
||||||
|
(void)pResourceTags;
|
||||||
|
#endif
|
||||||
#ifdef _XBOX1
|
#ifdef _XBOX1
|
||||||
char strResourcePath[512];
|
char strResourcePath[512];
|
||||||
bool bHasResourceOffsetsTable = false;
|
bool bHasResourceOffsetsTable = false;
|
||||||
@ -336,7 +329,7 @@ HRESULT PackedResource::Create(const char *strFilename)
|
|||||||
/* Use user-supplied number of resources and the resource tags */
|
/* Use user-supplied number of resources and the resource tags */
|
||||||
if(dwNumResourceTags != 0 || pResourceTags != NULL)
|
if(dwNumResourceTags != 0 || pResourceTags != NULL)
|
||||||
{
|
{
|
||||||
m_pResourceTags = pResourceTags;
|
m_pResourceTags = (XBRESOURCE*)pResourceTags;
|
||||||
m_dwNumResourceTags = dwNumResourceTags;
|
m_dwNumResourceTags = dwNumResourceTags;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -346,17 +339,17 @@ HRESULT PackedResource::Create(const char *strFilename)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _XBOX360
|
|
||||||
void PackedResource::GetResourceTags(DWORD* pdwNumResourceTags,
|
void PackedResource::GetResourceTags(DWORD* pdwNumResourceTags,
|
||||||
XBRESOURCE** ppResourceTags)
|
XBRESOURCE** ppResourceTags)
|
||||||
{
|
{
|
||||||
|
#ifdef _XBOX360
|
||||||
if (pdwNumResourceTags)
|
if (pdwNumResourceTags)
|
||||||
(*pdwNumResourceTags) = m_dwNumResourceTags;
|
(*pdwNumResourceTags) = m_dwNumResourceTags;
|
||||||
|
|
||||||
if (ppResourceTags)
|
if (ppResourceTags)
|
||||||
(*ppResourceTags) = m_pResourceTags;
|
(*ppResourceTags) = m_pResourceTags;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void PackedResource::Destroy()
|
void PackedResource::Destroy()
|
||||||
{
|
{
|
||||||
@ -403,7 +396,7 @@ typedef struct
|
|||||||
float m_fFontBottomPadding; /* Padding below the strike zone. */
|
float m_fFontBottomPadding; /* Padding below the strike zone. */
|
||||||
float m_fFontYAdvance; /* Number of pixels to move the cursor for a line feed. */
|
float m_fFontYAdvance; /* Number of pixels to move the cursor for a line feed. */
|
||||||
wchar_t * m_TranslatorTable; /* ASCII to glyph lookup table. */
|
wchar_t * m_TranslatorTable; /* ASCII to glyph lookup table. */
|
||||||
D3DTexture* m_pFontTexture;
|
void *m_pFontTexture;
|
||||||
const GLYPH_ATTR* m_Glyphs; /* Array of glyphs. */
|
const GLYPH_ATTR* m_Glyphs; /* Array of glyphs. */
|
||||||
} xdk360_video_font_t;
|
} xdk360_video_font_t;
|
||||||
|
|
||||||
@ -490,7 +483,7 @@ static void *xdk360_init_font(void *video_data,
|
|||||||
{
|
{
|
||||||
uint32_t dwFileVersion;
|
uint32_t dwFileVersion;
|
||||||
const void *pFontData = NULL;
|
const void *pFontData = NULL;
|
||||||
D3DTexture *pFontTexture = NULL;
|
void *pFontTexture = NULL;
|
||||||
const uint8_t * pData = NULL;
|
const uint8_t * pData = NULL;
|
||||||
xdk360_video_font_t *font = (xdk360_video_font_t*)calloc(1, sizeof(*font));
|
xdk360_video_font_t *font = (xdk360_video_font_t*)calloc(1, sizeof(*font));
|
||||||
|
|
||||||
@ -508,7 +501,7 @@ static void *xdk360_init_font(void *video_data,
|
|||||||
font->m_TranslatorTable = NULL;
|
font->m_TranslatorTable = NULL;
|
||||||
|
|
||||||
/* Create the font. */
|
/* Create the font. */
|
||||||
if (FAILED( m_xprResource.Create(font_path)))
|
if (FAILED( m_xprResource.Create(font_path, 0, NULL)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
pFontTexture = m_xprResource.GetTexture( "FontTexture" );
|
pFontTexture = m_xprResource.GetTexture( "FontTexture" );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user