This commit is contained in:
Aaron Robinson 2003-10-06 05:04:15 +00:00
parent db03fe9e1e
commit 7fbefb2607
5 changed files with 86 additions and 6 deletions

View File

@ -1,5 +1,9 @@
Cxbx Todo (* denotes high priority, + denotes medium priority)
* For Vertex buffer locks, if tesselation has occurred, the original
pointer should be returned, and a flag set to know that the next time
the vertex buffer is used it should be re-registered (retesselated)
* Stella has a memory leak in the game's list screen..
* SetPushBufferSize -> 0x184CC0 (Halo)..too small to detect?

View File

@ -199,6 +199,7 @@ inline D3DFORMAT EmuXB2PC_D3DFormat(X_D3DFORMAT Format)
case 0x3F: // Linear (X_D3DFMT_LIN_A8B8G8R8)
return D3DFMT_A8R8G8B8; // Note: Warning: R<->B Swapped!
case 0x1E: // Linear (X_D3DFMT_LIN_X8R8G8B8)
case 0x07: // Swizzled (X_D3DFMT_X8R8G8B8)
return D3DFMT_X8R8G8B8;

View File

@ -1423,6 +1423,16 @@ OOVPATable D3D8_1_0_4627[] =
"EmuIDirect3D8_CreateDevice"
#endif
},
// IDirect3D8::GetAdapterModeCount (* unchanged since 4361 *)
{
(OOVPA*)&IDirect3D8_GetAdapterModeCount_1_0_4361,
XTL::EmuIDirect3D8_GetAdapterModeCount,
#ifdef _DEBUG_TRACE
"EmuIDirect3D8_GetAdapterModeCount"
#endif
},
// IDirect3D8::GetAdapterDisplayMode
{
(OOVPA*)&IDirect3D8_GetAdapterDisplayMode_1_0_4627,
@ -1433,6 +1443,16 @@ OOVPATable D3D8_1_0_4627[] =
"EmuIDirect3D8_GetAdapterDisplayMode"
#endif
},
// IDirect3D8::EnumAdapterModes (* unchanged since 4361 *)
{
(OOVPA*)&IDirect3D8_EnumAdapterModes_1_0_4361,
XTL::EmuIDirect3D8_EnumAdapterModes,
#ifdef _DEBUG_TRACE
"EmuIDirect3D8_EnumAdapterModes"
#endif
},
// IDirect3D8::KickOffAndWaitForIdle
{
(OOVPA*)&IDirect3D8_KickOffAndWaitForIdle_1_0_4627,

View File

@ -610,6 +610,26 @@ OOVPATable DSound_1_0_4627[] =
"CDirectSound::CreateSoundBuffer (XREF)"
#endif
},
// IDirectSoundBuffer8::SetPlayRegion (* unchanged since 4361 *)
{
(OOVPA*)&IDirectSoundBuffer8_SetPlayRegion_1_0_4361,
XTL::EmuIDirectSoundBuffer8_SetPlayRegion,
#ifdef _DEBUG_TRACE
"EmuIDirectSoundBuffer8_SetPlayRegion"
#endif
},
// IDirectSoundBuffer8::SetLoopRegion (* unchanged since 4361 *)
{
(OOVPA*)&IDirectSoundBuffer8_SetLoopRegion_1_0_4361,
XTL::EmuIDirectSoundBuffer8_SetLoopRegion,
#ifdef _DEBUG_TRACE
"EmuIDirectSoundBuffer8_SetLoopRegion"
#endif
},
// CDirectSound_SetI3DL2Listener
{
(OOVPA*)&CDirectSound_SetI3DL2Listener_1_0_4627, 0,

View File

@ -486,7 +486,7 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
// EmuCleanup("Unknown MultiSampleType (0x%.08X)", pPresentationParameters->MultiSampleType);
}
g_EmuCDPD.pPresentationParameters->Flags |= D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
g_EmuCDPD.pPresentationParameters->Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
// retrieve resolution from configuration
if(g_EmuCDPD.pPresentationParameters->Windowed)
@ -706,6 +706,10 @@ static DWORD EmuCheckAllocationSize(PVOID pBase)
if(MemoryBasicInfo.State != MEM_COMMIT)
return 0;
// this is a hack in order to determine when pointers come from a large write-combined database
if(MemoryBasicInfo.RegionSize > 5*1024*1024)
return -1;
return MemoryBasicInfo.RegionSize - ((DWORD)pBase - (DWORD)MemoryBasicInfo.BaseAddress);
}
@ -883,10 +887,21 @@ UINT WINAPI XTL::EmuIDirect3D8_GetAdapterModeCount
}
#endif
// NOTE: WARNING: We should return only modes that should exist on a real
// Xbox. This could even be configurable, if desirable.
UINT ret = g_pD3D8->GetAdapterModeCount(g_XBVideo.GetDisplayAdapter());
D3DDISPLAYMODE Mode;
for(uint32 v=0;v<ret;v++)
{
HRESULT hRet = g_pD3D8->EnumAdapterModes(g_XBVideo.GetDisplayAdapter(), v, &Mode);
if(hRet != D3D_OK)
break;
if(Mode.Width != 640 || Mode.Height != 480)
ret--;
}
EmuSwapFS(); // XBox FS
return ret;
@ -965,9 +980,23 @@ HRESULT WINAPI XTL::EmuIDirect3D8_EnumAdapterModes
}
#endif
// NOTE: WARNING: We should probably only return valid xbox display modes,
// this should be coordinated with GetAdapterModeCount, etc.
HRESULT hRet = g_pD3D8->EnumAdapterModes(g_XBVideo.GetDisplayAdapter(), Mode, (D3DDISPLAYMODE*)pMode);
HRESULT hRet;
static int ModeAdder = 0;
if(Mode == 0)
ModeAdder = 0;
do
{
hRet = g_pD3D8->EnumAdapterModes(g_XBVideo.GetDisplayAdapter(), Mode+ModeAdder, (D3DDISPLAYMODE*)pMode);
if(hRet != D3D_OK || (pMode->Width == 640 && pMode->Height == 480))
break;
ModeAdder++;
}
while(true);
// make adjustments to parameters to make sense with windows direct3d
{
@ -2602,6 +2631,9 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register
{
DWORD dwSize = EmuCheckAllocationSize(pBase);
if(dwSize == -1)
EmuCleanup("Detected dangerous allocation techniques. This will be fixed soon!");
hRet = g_pD3DDevice8->CreateVertexBuffer
(
dwSize, 0, 0, D3DPOOL_MANAGED,
@ -2640,6 +2672,9 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register
{
DWORD dwSize = EmuCheckAllocationSize(pBase);
if(dwSize == -1)
EmuCleanup("Detected dangerous allocation techniques. This will be fixed soon!");
HRESULT hRet = g_pD3DDevice8->CreateIndexBuffer
(
dwSize, 0, D3DFMT_INDEX16, D3DPOOL_MANAGED,