Merge pull request #110 from PatrickvL/master

HLE verification
This commit is contained in:
Luke Usher 2017-01-16 17:23:46 +00:00 committed by GitHub
commit 05579ab92f
16 changed files with 222 additions and 63 deletions

View File

@ -357,6 +357,10 @@ extern "C" CXBXKRNL_API void CxbxKrnlInit
#endif #endif
} }
#ifdef _DEBUG_TRACE
VerifyHLEDataBase();
#endif
{ {
// Create a fake kernel header for XapiRestrictCodeSelectorLimit // Create a fake kernel header for XapiRestrictCodeSelectorLimit
// Thanks advancingdragon / DirtBox // Thanks advancingdragon / DirtBox

View File

@ -290,6 +290,7 @@ DWORD EEPROM_XboxLanguage = 0x01; // = English
DWORD EEPROM_XboxVideo = 0x10; // = Letterbox DWORD EEPROM_XboxVideo = 0x10; // = Letterbox
DWORD EEPROM_XboxAudio = 0; // = Stereo, no AC3, no DTS DWORD EEPROM_XboxAudio = 0; // = Stereo, no AC3, no DTS
DWORD EEPROM_ParentalControlGames = 0; // = XC_PC_ESRB_ALL DWORD EEPROM_ParentalControlGames = 0; // = XC_PC_ESRB_ALL
DWORD EEPROM_ParentalControlMovies = 0; // = XC_PC_ESRB_ALL
DWORD EEPROM_XboxMisc = 0; // No automatic power down DWORD EEPROM_XboxMisc = 0; // No automatic power down
DWORD EEPROM_XboxFactoryAvRegion = 0x01; // = NTSC_M DWORD EEPROM_XboxFactoryAvRegion = 0x01; // = NTSC_M
DWORD EEPROM_XboxFactoryGameRegion = 1; // = North America DWORD EEPROM_XboxFactoryGameRegion = 1; // = North America
@ -308,6 +309,7 @@ static const EEPROMInfo EEPROMInfos[] = {
{ xboxkrnl::XC_VIDEO, &EEPROM_XboxVideo, REG_DWORD, sizeof(DWORD) }, { xboxkrnl::XC_VIDEO, &EEPROM_XboxVideo, REG_DWORD, sizeof(DWORD) },
{ xboxkrnl::XC_AUDIO, &EEPROM_XboxAudio, REG_DWORD, sizeof(DWORD) }, { xboxkrnl::XC_AUDIO, &EEPROM_XboxAudio, REG_DWORD, sizeof(DWORD) },
{ xboxkrnl::XC_P_CONTROL_GAMES, &EEPROM_ParentalControlGames, REG_DWORD, sizeof(DWORD) }, // Zapper queries this. TODO : Should this be REG_NONE? { xboxkrnl::XC_P_CONTROL_GAMES, &EEPROM_ParentalControlGames, REG_DWORD, sizeof(DWORD) }, // Zapper queries this. TODO : Should this be REG_NONE?
{ xboxkrnl::XC_P_CONTROL_MOVIES, &EEPROM_ParentalControlMovies, REG_DWORD, sizeof(DWORD) }, // Xbox Dashboard queries this.
{ xboxkrnl::XC_MISC, &EEPROM_XboxMisc, REG_DWORD, sizeof(DWORD) }, { xboxkrnl::XC_MISC, &EEPROM_XboxMisc, REG_DWORD, sizeof(DWORD) },
{ xboxkrnl::XC_FACTORY_AV_REGION, &EEPROM_XboxFactoryAvRegion, REG_DWORD, sizeof(DWORD) }, { xboxkrnl::XC_FACTORY_AV_REGION, &EEPROM_XboxFactoryAvRegion, REG_DWORD, sizeof(DWORD) },
{ xboxkrnl::XC_FACTORY_GAME_REGION, &EEPROM_XboxFactoryGameRegion, REG_DWORD, sizeof(DWORD) }, { xboxkrnl::XC_FACTORY_GAME_REGION, &EEPROM_XboxFactoryGameRegion, REG_DWORD, sizeof(DWORD) },

View File

@ -1096,8 +1096,6 @@ OOVPATable D3D8_1_0_4034[] = {
OOVPA_TABLE_PATCH(IDirect3DDevice8_Clear_1_0_4034, XTL::EmuIDirect3DDevice8_Clear), OOVPA_TABLE_PATCH(IDirect3DDevice8_Clear_1_0_4034, XTL::EmuIDirect3DDevice8_Clear),
// IDirect3DResource8::Register // IDirect3DResource8::Register
OOVPA_TABLE_PATCH(IDirect3DResource8_Register_1_0_3925, XTL::EmuIDirect3DResource8_Register), OOVPA_TABLE_PATCH(IDirect3DResource8_Register_1_0_3925, XTL::EmuIDirect3DResource8_Register),
// IDirect3DDevice8::CreatePalette
OOVPA_TABLE_PATCH(IDirect3DDevice8_CreatePalette_1_0_3925, XTL::EmuIDirect3DDevice8_CreatePalette),
// ********************** BEG WARNING UNTESTED!!! ******************* // ********************** BEG WARNING UNTESTED!!! *******************
#if 0 #if 0
@ -1316,8 +1314,6 @@ OOVPATable D3D8_1_0_4034[] = {
OOVPA_TABLE_PATCH(Direct3D_SetPushBufferSize_1_0_4034, XTL::EmuIDirect3D8_SetPushBufferSize), OOVPA_TABLE_PATCH(Direct3D_SetPushBufferSize_1_0_4034, XTL::EmuIDirect3D8_SetPushBufferSize),
// Get2DSurfacDesc // Get2DSurfacDesc
OOVPA_TABLE_PATCH(Get2DSurfaceDesc_1_0_4034, XTL::EmuGet2DSurfaceDesc), OOVPA_TABLE_PATCH(Get2DSurfaceDesc_1_0_4034, XTL::EmuGet2DSurfaceDesc),
// IDirect3DTexture8::GetSurfaceLevel (* unchanged since 3925 *)
OOVPA_TABLE_PATCH(IDirect3DTexture8_GetSurfaceLevel_1_0_3925, XTL::EmuIDirect3DTexture8_GetSurfaceLevel),
// D3DDevice_SetRenderState_ZEnable // D3DDevice_SetRenderState_ZEnable
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_ZEnable_1_0_4034, XTL::EmuIDirect3DDevice8_SetRenderState_ZEnable), OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_ZEnable_1_0_4034, XTL::EmuIDirect3DDevice8_SetRenderState_ZEnable),
// D3DDevice_LightEnable // D3DDevice_LightEnable
@ -1328,8 +1324,6 @@ OOVPATable D3D8_1_0_4034[] = {
OOVPA_TABLE_PATCH(Direct3D_GetAdapterIdentifier_1_0_3925, XTL::EmuIDirect3D8_GetAdapterIdentifier), OOVPA_TABLE_PATCH(Direct3D_GetAdapterIdentifier_1_0_3925, XTL::EmuIDirect3D8_GetAdapterIdentifier),
// IDirect3DSurface8::GetDesc (* unchanged since 3925 *) // IDirect3DSurface8::GetDesc (* unchanged since 3925 *)
OOVPA_TABLE_PATCH(D3DSurface_GetDesc_1_0_3925, XTL::EmuIDirect3DSurface8_GetDesc), OOVPA_TABLE_PATCH(D3DSurface_GetDesc_1_0_3925, XTL::EmuIDirect3DSurface8_GetDesc),
// Get2DSurfacDesc
OOVPA_TABLE_PATCH(Get2DSurfaceDesc_1_0_4034, XTL::EmuGet2DSurfaceDesc),
// IDirect3DDevice8::SetLight // IDirect3DDevice8::SetLight
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetLight_1_0_4034, XTL::EmuIDirect3DDevice8_SetLight), OOVPA_TABLE_PATCH(IDirect3DDevice8_SetLight_1_0_4034, XTL::EmuIDirect3DDevice8_SetLight),
// IDirect3DVertexBuffer8::Lock // IDirect3DVertexBuffer8::Lock

View File

@ -2035,8 +2035,6 @@ OOVPATable D3D8_1_0_4134[] = {
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_FrontFace_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_FrontFace), OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_FrontFace_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_FrontFace),
// IDirect3DDevice8::SetRenderState_LogicOp // IDirect3DDevice8::SetRenderState_LogicOp
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_LogicOp_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_LogicOp), OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_LogicOp_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_LogicOp),
// IDirect3DDevice8::SetRenderState_StencilFail
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_StencilFail_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail),
// IDirect3DDevice8::SetRenderState_OcclusionCullEnable // IDirect3DDevice8::SetRenderState_OcclusionCullEnable
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable), OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable),
// IDirect3DDevice8::SetRenderState_StencilCullEnable // IDirect3DDevice8::SetRenderState_StencilCullEnable

View File

@ -748,8 +748,6 @@ OOVPATable D3D8_1_0_4432[] {
OOVPA_TABLE_PATCH(IDirect3DDevice8_GetCreationParameters_1_0_4034, XTL::EmuIDirect3DDevice8_GetCreationParameters), OOVPA_TABLE_PATCH(IDirect3DDevice8_GetCreationParameters_1_0_4034, XTL::EmuIDirect3DDevice8_GetCreationParameters),
// IDirect3DDevice8::GetVisibilityTestResult (* unchanged since 3925 *) // IDirect3DDevice8::GetVisibilityTestResult (* unchanged since 3925 *)
OOVPA_TABLE_PATCH(IDirect3DDevice8_GetVisibilityTestResult_1_0_3925, XTL::EmuIDirect3DDevice8_GetVisibilityTestResult), OOVPA_TABLE_PATCH(IDirect3DDevice8_GetVisibilityTestResult_1_0_3925, XTL::EmuIDirect3DDevice8_GetVisibilityTestResult),
// IDirect3DDevice8::SetTextureState_BumpEnv (* unchanged since 4361 *)
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetTextureState_BumpEnv_1_0_4361, XTL::EmuIDirect3DDevice8_SetTextureState_BumpEnv),
// IDirect3DDevice8::SetRenderState_EdgeAntiAlias (* unchanged since 4361 *) // IDirect3DDevice8::SetRenderState_EdgeAntiAlias (* unchanged since 4361 *)
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_EdgeAntiAlias_1_0_4361, XTL::EmuIDirect3DDevice8_SetRenderState_EdgeAntiAlias), OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_EdgeAntiAlias_1_0_4361, XTL::EmuIDirect3DDevice8_SetRenderState_EdgeAntiAlias),
// IDirect3DDevice8::SetRenderState_FillMode (* unchanged since 4361 *) // IDirect3DDevice8::SetRenderState_FillMode (* unchanged since 4361 *)

View File

@ -1013,6 +1013,10 @@ OOVPA_END;
// ****************************************************************** // ******************************************************************
OOVPA_NO_XREF(IDirect3DDevice8_Begin_1_0_4627, 14) OOVPA_NO_XREF(IDirect3DDevice8_Begin_1_0_4627, 14)
// IDirect3DDevice8_Begin+0x19 : shl edx, 6
{ 0x19, 0xD1 }, // (Offset,Value)-Pair #7
{ 0x1A, 0xE8 }, // (Offset,Value)-Pair #8
// IDirect3DDevice8_Begin+0x25 : mov dword ptr [eax], 0x417FC // IDirect3DDevice8_Begin+0x25 : mov dword ptr [eax], 0x417FC
{ 0x25, 0xC7 }, // (Offset,Value)-Pair #1 { 0x25, 0xC7 }, // (Offset,Value)-Pair #1
{ 0x26, 0x00 }, // (Offset,Value)-Pair #2 { 0x26, 0x00 }, // (Offset,Value)-Pair #2
@ -1021,10 +1025,6 @@ OOVPA_NO_XREF(IDirect3DDevice8_Begin_1_0_4627, 14)
{ 0x29, 0x04 }, // (Offset,Value)-Pair #5 { 0x29, 0x04 }, // (Offset,Value)-Pair #5
{ 0x2A, 0x00 }, // (Offset,Value)-Pair #6 { 0x2A, 0x00 }, // (Offset,Value)-Pair #6
// IDirect3DDevice8_Begin+0x19 : shl edx, 6
{ 0x19, 0xD1 }, // (Offset,Value)-Pair #7
{ 0x1A, 0xE8 }, // (Offset,Value)-Pair #8
// IDirect3DDevice8_Begin+0x33 : or dword ptr [esi+8], 0x800 // IDirect3DDevice8_Begin+0x33 : or dword ptr [esi+8], 0x800
{ 0x33, 0x81 }, // (Offset,Value)-Pair #9 { 0x33, 0x81 }, // (Offset,Value)-Pair #9
{ 0x34, 0x4E }, // (Offset,Value)-Pair #10 { 0x34, 0x4E }, // (Offset,Value)-Pair #10
@ -3479,8 +3479,6 @@ OOVPATable D3D8_1_0_4627[] = {
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_RopZRead_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_RopZRead), OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_RopZRead_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_RopZRead),
// IDirect3DDevice8::SetRenderState_DoNotCullUncompressed (* unchanged since 4134 *) // IDirect3DDevice8::SetRenderState_DoNotCullUncompressed (* unchanged since 4134 *)
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_DoNotCullUncompressed_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed), OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_DoNotCullUncompressed_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed),
// IDirect3DDevice8::DeletePixelShader (* unchanged since 4134 *)
OOVPA_TABLE_PATCH(IDirect3DDevice8_DeletePixelShader_1_0_4134, XTL::EmuIDirect3DDevice8_DeletePixelShader),
// D3DDevice_PersistDisplay // D3DDevice_PersistDisplay
OOVPA_TABLE_PATCH(D3DDevice_PersistDisplay_1_0_4627, XTL::EmuIDirect3DDevice8_PersistDisplay), OOVPA_TABLE_PATCH(D3DDevice_PersistDisplay_1_0_4627, XTL::EmuIDirect3DDevice8_PersistDisplay),
// D3DDevice_PersistDisplay // D3DDevice_PersistDisplay

View File

@ -1478,8 +1478,6 @@ OOVPATable D3D8_1_0_5849[] = {
OOVPA_TABLE_PATCH(D3DDevice_SetRenderState_StencilFail_1_0_5849, XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail), OOVPA_TABLE_PATCH(D3DDevice_SetRenderState_StencilFail_1_0_5849, XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail),
// D3DDevice_SetRenderState_VertexBlend // D3DDevice_SetRenderState_VertexBlend
OOVPA_TABLE_PATCH(D3DDevice_SetRenderState_VertexBlend_1_0_5849, XTL::EmuIDirect3DDevice8_SetRenderState_VertexBlend), OOVPA_TABLE_PATCH(D3DDevice_SetRenderState_VertexBlend_1_0_5849, XTL::EmuIDirect3DDevice8_SetRenderState_VertexBlend),
// D3DDevice_SetRenderState_VertexBlend
OOVPA_TABLE_PATCH(D3DDevice_SetRenderState_VertexBlend_1_0_5849, XTL::EmuIDirect3DDevice8_SetRenderState_VertexBlend),
// IDirect3DDevice8::Reset (* unchanged since 4134 *) // IDirect3DDevice8::Reset (* unchanged since 4134 *)
OOVPA_TABLE_PATCH(IDirect3DDevice8_Reset_1_0_4134, XTL::EmuIDirect3DDevice8_Reset), OOVPA_TABLE_PATCH(IDirect3DDevice8_Reset_1_0_4134, XTL::EmuIDirect3DDevice8_Reset),
// IDirect3DDevice::Release // IDirect3DDevice::Release
@ -1580,14 +1578,8 @@ OOVPATable D3D8_1_0_5849[] = {
OOVPA_TABLE_PATCH(D3DDevice_DeleteStateBlock_1_0_5849, XTL::EmuIDirect3DDevice8_DeleteStateBlock), OOVPA_TABLE_PATCH(D3DDevice_DeleteStateBlock_1_0_5849, XTL::EmuIDirect3DDevice8_DeleteStateBlock),
// IDirect3DDevice8::SetRenderState_StencilCullEnable (* unchanged since 4134 *) // IDirect3DDevice8::SetRenderState_StencilCullEnable (* unchanged since 4134 *)
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_StencilCullEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_StencilCullEnable), OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_StencilCullEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_StencilCullEnable),
// IDirect3DDevice8::SetRenderState_OcclusionCullEnable (* unchanged since 4134 *)
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_OcclusionCullEnable_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_OcclusionCullEnable),
// IDirect3DDevice8::SetRenderState_RopZCmpAlwaysRead // IDirect3DDevice8::SetRenderState_RopZCmpAlwaysRead
OOVPA_TABLE_PATCH(D3DDevice_SetRenderState_RopZCmpAlwaysRead_1_0_5849, XTL::EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead), OOVPA_TABLE_PATCH(D3DDevice_SetRenderState_RopZCmpAlwaysRead_1_0_5849, XTL::EmuIDirect3DDevice8_SetRenderState_RopZCmpAlwaysRead),
// IDirect3DDevice8::SetRenderState_RopZRead (* unchanged since 4134 *)
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_RopZRead_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_RopZRead),
// IDirect3DDevice8::SetRenderState_DoNotCullUncompressed (* unchanged since 4134 *)
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetRenderState_DoNotCullUncompressed_1_0_4134, XTL::EmuIDirect3DDevice8_SetRenderState_DoNotCullUncompressed),
// D3DDevice_GetTexture2 // D3DDevice_GetTexture2
OOVPA_TABLE_PATCH(D3DDevice_GetTexture2_1_0_5849, XTL::EmuIDirect3DDevice8_GetTexture2), OOVPA_TABLE_PATCH(D3DDevice_GetTexture2_1_0_5849, XTL::EmuIDirect3DDevice8_GetTexture2),
// IDirect3DDevice8::SetRenderTargetFast (* unchanged since 5344 *) // IDirect3DDevice8::SetRenderTargetFast (* unchanged since 5344 *)

View File

@ -1033,10 +1033,6 @@ OOVPATable D3D8LTCG_1_0_5849[] = {
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetTextureState_ColorKeyColor_1_0_5849_LTCG, XTL::EmuIDirect3DDevice8_SetTextureState_ColorKeyColor), OOVPA_TABLE_PATCH(IDirect3DDevice8_SetTextureState_ColorKeyColor_1_0_5849_LTCG, XTL::EmuIDirect3DDevice8_SetTextureState_ColorKeyColor),
// IDirect3DDevice8::Clear // IDirect3DDevice8::Clear
OOVPA_TABLE_PATCH(IDirect3DDevice8_Clear_1_0_5849_LTCG, XTL::EmuIDirect3DDevice8_Clear), OOVPA_TABLE_PATCH(IDirect3DDevice8_Clear_1_0_5849_LTCG, XTL::EmuIDirect3DDevice8_Clear),
// IDirect3DVertexBuffer8::Lock2
OOVPA_TABLE_PATCH(IDirect3DVertexBuffer8_Lock2_1_0_5849_LTCG, XTL::EmuIDirect3DVertexBuffer8_Lock2),
// IDirect3DDevice8::SetVertexShader
OOVPA_TABLE_PATCH(IDirect3DDevice8_SetVertexShader_1_0_5849_LTCG, XTL::EmuIDirect3DDevice8_SetVertexShader),
}; };
uint32 D3D8LTCG_1_0_5849_SIZE = sizeof(D3D8LTCG_1_0_5849); uint32 D3D8LTCG_1_0_5849_SIZE = sizeof(D3D8LTCG_1_0_5849);

View File

@ -1763,6 +1763,11 @@ OOVPA_XREF(CDirectSoundStream_SetVelocityC_1_0_3936, 12,
XREF_DSSTREAMSETVELOCITY1C, XREF_DSSTREAMSETVELOCITY1C,
XRefZero) XRefZero)
// CDirectSoundStream_SetVelocityC+0x09 : movsd; movsd; movsd
{ 0x09, 0xA5 }, // (Offset,Value)-Pair #8
{ 0x0A, 0xA5 }, // (Offset,Value)-Pair #9
{ 0x0B, 0xA5 }, // (Offset,Value)-Pair #10
// CDirectSoundStream_SetVelocityC+0x0C : or byte ptr [ecx+0x80], 0x40 // CDirectSoundStream_SetVelocityC+0x0C : or byte ptr [ecx+0x80], 0x40
{ 0x0C, 0x83 }, // (Offset,Value)-Pair #1 { 0x0C, 0x83 }, // (Offset,Value)-Pair #1
{ 0x0D, 0x89 }, // (Offset,Value)-Pair #2 { 0x0D, 0x89 }, // (Offset,Value)-Pair #2
@ -1772,11 +1777,6 @@ OOVPA_XREF(CDirectSoundStream_SetVelocityC_1_0_3936, 12,
{ 0x11, 0x00 }, // (Offset,Value)-Pair #6 { 0x11, 0x00 }, // (Offset,Value)-Pair #6
{ 0x12, 0x40 }, // (Offset,Value)-Pair #7 { 0x12, 0x40 }, // (Offset,Value)-Pair #7
// CDirectSoundStream_SetVelocityC+0x09 : movsd; movsd; movsd
{ 0x09, 0xA5 }, // (Offset,Value)-Pair #8
{ 0x0A, 0xA5 }, // (Offset,Value)-Pair #9
{ 0x0B, 0xA5 }, // (Offset,Value)-Pair #10
// CDirectSoundStream_SetVelocityC+0x25 : retn 0x08 // CDirectSoundStream_SetVelocityC+0x25 : retn 0x08
{ 0x25, 0xC2 }, // (Offset,Value)-Pair #11 { 0x25, 0xC2 }, // (Offset,Value)-Pair #11
{ 0x26, 0x08 }, // (Offset,Value)-Pair #12 { 0x26, 0x08 }, // (Offset,Value)-Pair #12

View File

@ -937,8 +937,6 @@ OOVPATable DSound_1_0_5233[] = {
OOVPA_TABLE_XREF(CDirectSoundStream_FlushEx_1_0_5233), OOVPA_TABLE_XREF(CDirectSoundStream_FlushEx_1_0_5233),
// IDirectSoundBuffer8::StopEx // IDirectSoundBuffer8::StopEx
OOVPA_TABLE_PATCH(IDirectSoundBuffer8_StopEx_1_0_5233, XTL::EmuIDirectSoundBuffer8_StopEx), OOVPA_TABLE_PATCH(IDirectSoundBuffer8_StopEx_1_0_5233, XTL::EmuIDirectSoundBuffer8_StopEx),
// IDirectSound8::Release (* unchanged since 3936 *)
OOVPA_TABLE_PATCH(IDirectSound8_Release_1_0_3936, XTL::EmuIDirectSound8_Release),
// DirectSound::CDirectSound::EnableHeadphones (XRef) // DirectSound::CDirectSound::EnableHeadphones (XRef)
OOVPA_TABLE_XREF(CDirectSound_EnableHeadphones_1_0_5233), OOVPA_TABLE_XREF(CDirectSound_EnableHeadphones_1_0_5233),
// IDirectSound8::EnableHeadphones // IDirectSound8::EnableHeadphones

View File

@ -50,17 +50,7 @@ OOVPA_END;
// ****************************************************************** // ******************************************************************
// * XNetGetEthernetLinkStatus // * XNetGetEthernetLinkStatus
// ****************************************************************** // ******************************************************************
OOVPA_NO_XREF(XNetGetEthernetLinkStatus_1_0_5344, 8) #define XNetGetEthernetLinkStatus_1_0_5344 XNetGetEthernetLinkStatus_1_0_4627
{ 0x08, 0x33 },
{ 0x10, 0x8A },
{ 0x19, 0x00 },
{ 0x22, 0x56 },
{ 0x2B, 0xFF },
{ 0x34, 0xF0 },
{ 0x3D, 0x24 },
{ 0x46, 0x5B },
OOVPA_END;
// ****************************************************************** // ******************************************************************
// * CXo::XOnlineLogon // * CXo::XOnlineLogon

View File

@ -82,17 +82,7 @@ OOVPA_END;
// ****************************************************************** // ******************************************************************
// * XNetGetEthernetLinkStatus // * XNetGetEthernetLinkStatus
// ****************************************************************** // ******************************************************************
OOVPA_NO_XREF(XNetGetEthernetLinkStatus_1_0_5849, 8) #define XNetGetEthernetLinkStatus_1_0_5849 XNetGetEthernetLinkStatus_1_0_4627
{ 0x08, 0x33 },
{ 0x10, 0x8A },
{ 0x19, 0x00 },
{ 0x22, 0x56 },
{ 0x2B, 0xFF },
{ 0x34, 0xF0 },
{ 0x3D, 0x24 },
{ 0x46, 0x5B },
OOVPA_END;
// ****************************************************************** // ******************************************************************
// * XOnline_1_0_5849 // * XOnline_1_0_5849

View File

@ -1017,8 +1017,6 @@ OOVPATable XAPI_1_0_3911[] = {
OOVPA_TABLE_PATCH(SetThreadPriorityBoost_1_0_3911, XTL::EmuSetThreadPriorityBoost), OOVPA_TABLE_PATCH(SetThreadPriorityBoost_1_0_3911, XTL::EmuSetThreadPriorityBoost),
// GetThreadPriority // GetThreadPriority
OOVPA_TABLE_PATCH(GetThreadPriority_1_0_3911, XTL::EmuGetThreadPriority), OOVPA_TABLE_PATCH(GetThreadPriority_1_0_3911, XTL::EmuGetThreadPriority),
// XGetDevices
OOVPA_TABLE_PATCH(XGetDevices_1_0_3911, XTL::EmuXGetDevices),
// CreateFiber // CreateFiber
OOVPA_TABLE_PATCH(CreateFiber_1_0_3911, XTL::EmuCreateFiber), OOVPA_TABLE_PATCH(CreateFiber_1_0_3911, XTL::EmuCreateFiber),
// DeleteFiber // DeleteFiber
@ -1027,8 +1025,6 @@ OOVPATable XAPI_1_0_3911[] = {
OOVPA_TABLE_PATCH(SwitchToFiber_1_0_3911, XTL::EmuSwitchToFiber), OOVPA_TABLE_PATCH(SwitchToFiber_1_0_3911, XTL::EmuSwitchToFiber),
// ConvertThreadToFiber // ConvertThreadToFiber
OOVPA_TABLE_PATCH(ConvertThreadToFiber_1_0_3911, XTL::EmuConvertThreadToFiber), OOVPA_TABLE_PATCH(ConvertThreadToFiber_1_0_3911, XTL::EmuConvertThreadToFiber),
// XInputGetCapabilities
OOVPA_TABLE_PATCH(XInputGetCapabilities_1_0_3911, XTL::EmuXInputGetCapabilities),
// SignalObjectAndWait // SignalObjectAndWait
OOVPA_TABLE_PATCH(SignalObjectAndWait_1_0_3911, XTL::EmuSignalObjectAndWait), OOVPA_TABLE_PATCH(SignalObjectAndWait_1_0_3911, XTL::EmuSignalObjectAndWait),
// QueueUserAPC // QueueUserAPC

View File

@ -282,8 +282,6 @@ OOVPATable XAPI_1_0_5558[] = {
OOVPA_TABLE_PATCH(GetThreadPriority_1_0_4627, XTL::EmuGetThreadPriority), OOVPA_TABLE_PATCH(GetThreadPriority_1_0_4627, XTL::EmuGetThreadPriority),
// GetTimeZoneInformation (* unchanged since 3911 *) // GetTimeZoneInformation (* unchanged since 3911 *)
OOVPA_TABLE_PATCH(GetTimeZoneInformation_1_0_3911, XTL::EmuGetTimeZoneInformation), OOVPA_TABLE_PATCH(GetTimeZoneInformation_1_0_3911, XTL::EmuGetTimeZoneInformation),
// SetThreadPriority (* unchanged since 3911 *)
OOVPA_TABLE_PATCH(SetThreadPriority_1_0_3911, XTL::EmuSetThreadPriority),
// XMountMUA // XMountMUA
OOVPA_TABLE_PATCH(XMountMUA_1_0_5558, XTL::EmuXMountMUA), OOVPA_TABLE_PATCH(XMountMUA_1_0_5558, XTL::EmuXMountMUA),
// CreateFiber // CreateFiber

View File

@ -759,3 +759,204 @@ static void EmuXRefFailure()
CxbxKrnlCleanup("XRef-only function body reached. Fatal Error."); CxbxKrnlCleanup("XRef-only function body reached. Fatal Error.");
} }
#ifdef _DEBUG_TRACE
struct HLEVerifyContext {
const HLEData *main_data;
OOVPA *oovpa, *against;
const HLEData *against_data;
uint32 main_index, against_index;
};
std::string HLEErrorString(const HLEData *data, uint32 index)
{
std::string result =
"OOVPATable " + (std::string)(data->Library) + "_1_0_" + std::to_string(data->BuildVersion)
+ "[" + std::to_string(index) + "] "
+ (std::string)(data->OovpaTable[index].szFuncName);
return result;
}
void HLEError(HLEVerifyContext *context, char *format, ...)
{
std::string output = "HLE Error ";
if (context->main_data != nullptr)
output += "in " + HLEErrorString(context->main_data, context->main_index);
if (context->against != nullptr && context->against_data != nullptr)
output += ", comparing against " + HLEErrorString(context->against_data, context->against_index);
// format specific error message
char buffer[200];
va_list args;
va_start(args, format);
vsprintf(buffer, format, args);
va_end(args);
output += " : " + (std::string)buffer + (std::string)"\n";
printf(output.c_str());
}
void VerifyHLEDataBaseAgainst(HLEVerifyContext *context); // forward
void VerifyHLEOOVPA(HLEVerifyContext *context, OOVPA *oovpa)
{
if (context->against == nullptr) {
// TODO : verify XRefSaveIndex and XRef's (how?)
// verify offsets are in increasing order
uint32 prev_offset;
uint08 dummy_value;
GetOovpaEntry(oovpa, oovpa->XRefCount, prev_offset, dummy_value);
for (int p = oovpa->XRefCount + 1; p < oovpa->Count; p++) {
uint32 curr_offset;
GetOovpaEntry(oovpa, p, curr_offset, dummy_value);
if (!(curr_offset > prev_offset)) {
HLEError(context, "%s[%d] : Offset (0x%x) must be larger then previous offset (0x%x)",
(oovpa->Type = Large) ? "Lovp" : "Sovp", p, curr_offset, prev_offset);
}
}
// find duplicate OOVPA's across all other data-table-oovpa's
context->oovpa = oovpa;
context->against = oovpa;
VerifyHLEDataBaseAgainst(context);
context->against = nullptr; // reset scanning state
return;
}
// prevent checking an oovpa against itself
if (context->against == oovpa)
return;
// compare {Offset, Value}-pairs between two OOVPA's
OOVPA *left = context->against, *right = oovpa;
int l = 0, r = 0;
uint32 left_offset, right_offset;
uint08 left_value, right_value;
GetOovpaEntry(left, l, left_offset, left_value);
GetOovpaEntry(right, r, right_offset, right_value);
int unique_offset_left = 0;
int unique_offset_right = 0;
int equal_offset_value = 0;
int equal_offset_different_value = 0;
while (true) {
bool left_next = true;
bool right_next = true;
if (left_offset < right_offset) {
unique_offset_left++;
right_next = false;
}
else if (left_offset > right_offset) {
unique_offset_right++;
left_next = false;
}
else if (left_value == right_value) {
equal_offset_value++;
}
else {
equal_offset_different_value++;
}
// increment r before use (in left_next)
if (right_next)
r++;
if (left_next) {
l++;
if (l >= left->Count) {
unique_offset_right += right->Count - r;
break;
}
GetOovpaEntry(left, l, left_offset, left_value);
}
if (right_next) {
if (r >= right->Count) {
unique_offset_left += left->Count - l;
break;
}
GetOovpaEntry(right, r, right_offset, right_value);
}
}
// no mismatching values on identical offsets?
if (equal_offset_different_value == 0)
// enough matching OV-pairs?
if (equal_offset_value > 4)
{
// no unique OV-pairs on either side?
if (unique_offset_left + unique_offset_right == 0)
HLEError(context, "OOVPA's are identical",
unique_offset_left,
unique_offset_right);
else
// not too many new OV-pairs on the left side?
if (unique_offset_left < 6)
// not too many new OV-parirs on the right side?
if (unique_offset_right < 6)
HLEError(context, "OOVPA's are expanded (left +%d, right +%d)",
unique_offset_left,
unique_offset_right);
}
}
void VerifyHLEDataEntry(HLEVerifyContext *context, const OOVPATable *table, uint32 index, uint32 count)
{
if (context->against == nullptr) {
context->main_index = index;
// does this entry specify a redirection (patch)?
void * entry_redirect = table[index].lpRedirect;
if (entry_redirect != nullptr) {
// check no patch occurs twice in this table
for (uint32 t = index + 1; t < count; t++) {
if (entry_redirect == table[t].lpRedirect) {
if (table[index].Oovpa == table[t].Oovpa) {
HLEError(context, "Patch registered again (with same OOVPA) at index %d",
t);
} else {
HLEError(context, "Patch also used for another OOVPA at index %d",
t);
}
}
}
}
}
else
context->against_index = index;
// verify the OOVPA of this entry
VerifyHLEOOVPA(context, table[index].Oovpa);
}
void VerifyHLEData(HLEVerifyContext *context, const HLEData *data)
{
if (context->against == nullptr) {
context->main_data = data;
} else {
context->against_data = data;
}
// verify each entry in this HLEData
uint32 count = data->OovpaTableSize / sizeof(OOVPATable);
for (uint32 e = 0; e < count; e++)
VerifyHLEDataEntry(context, data->OovpaTable, e, count);
}
void VerifyHLEDataBaseAgainst(HLEVerifyContext *context)
{
// verify all HLEData's
for (uint32 d = 0; d < HLEDataBaseCount; d++)
VerifyHLEData(context, &HLEDataBase[d]);
}
void VerifyHLEDataBase()
{
HLEVerifyContext context = { 0 };
VerifyHLEDataBaseAgainst(&context);
}
#endif // _DEBUG_TRACE

View File

@ -40,4 +40,8 @@ extern bool bLLE_JIT; // Set this to true for experimental JIT
void EmuHLEIntercept(Xbe::LibraryVersion *LibraryVersion, Xbe::Header *XbeHeader); void EmuHLEIntercept(Xbe::LibraryVersion *LibraryVersion, Xbe::Header *XbeHeader);
#ifdef _DEBUG_TRACE
void VerifyHLEDataBase();
#endif #endif
#endif // HLEINTERCEPT_H