Looking around in a few programs it seems an XPR ripper/re-packer is badly need. XPR being a XBox Binary Resource File optimized for the XBox to read the contents right into memory. This is where much of the texture/vertex/other data is stored for many a game.
Anyone up to the challenge?
The function to read the XPR should look something like this:
//-----------------------------------------------------------------------------
// Name: LoadPackedResource()
// Desc: Loads all the texture resources from the given XPR.
//-----------------------------------------------------------------------------
HRESULT LoadPackedResource()
{
// Open the file to read the XPR headers
FILE* file = fopen( "D:\\media\\Resource.xpr", "rb" );
if( NULL == file )
return E_FAIL;
// Read in and verify the XPR magic header
XPR_HEADER xprh;
if(fread( &xprh, sizeof(XPR_HEADER), 1, file) != 1)
{
fclose(file);
return E_FAIL;
}
if( xprh.dwMagic != XPR_MAGIC_VALUE )
{
OutputDebugStringA( "ERROR: Invalid Xbox Packed Resource (.xpr) file" );
fclose( file );
return E_INVALIDARG;
}
// Compute memory requirements
DWORD dwSysMemDataSize = xprh.dwHeaderSize - sizeof(XPR_HEADER);
DWORD dwVidMemDataSize = xprh.dwTotalSize - xprh.dwHeaderSize;
// Allocate memory
g_pResourceSysMemData = new BYTE[dwSysMemDataSize];
g_pResourceVidMemData = (BYTE*)D3D_AllocContiguousMemory( dwVidMemDataSize, D3DTEXTURE_ALIGNMENT );
// Read in the data from the file
if(fread( g_pResourceSysMemData, dwSysMemDataSize, 1, file ) != 1 ||
fread( g_pResourceVidMemData, dwVidMemDataSize, 1, file ) != 1 )
{
delete [] g_pResourceSysMemData;
D3D_FreeContiguousMemory(g_pResourceVidMemData);
fclose(file);
return E_FAIL;
}
// Done with the file
fclose( file );
// Loop over resources, then call a function to save it to HDD
BYTE* pData = g_pResourceSysMemData;
for( DWORD i = 0; i < resource_NUM_RESOURCES; i++ )
{
// Get the resource
LPDIRECT3DRESOURCE8 pResource = (LPDIRECT3DRESOURCE8)pData;
// Save in appropriate format to HDD
pResource->SaveToHD( g_pResourceVidMemData );
// Advance the pointer
switch( pResource->GetType() )
{
case D3DRTYPE_TEXTURE: pData += sizeof(D3DTexture); break;
case D3DRTYPE_VOLUMETEXTURE: pData += sizeof(D3DVolumeTexture); break;
case D3DRTYPE_CUBETEXTURE: pData += sizeof(D3DCubeTexture); break;
case D3DRTYPE_VERTEXBUFFER: pData += sizeof(D3DVertexBuffer); break;
case D3DRTYPE_INDEXBUFFER: pData += sizeof(D3DIndexBuffer); break;
case D3DRTYPE_PALETTE: pData += sizeof(D3DPalette); break;
default: return E_FAIL;
}
}
return S_OK;
}
You'd need to add some code to convert textures to .bmp's (with volume and cube writing multiple .bmp's), the vertices and indices can be text (I think).
Do a search on XPR in the DK docs for the specs that the bundler uses to create the files in the first place. PM me if you interesting working on this.