Disabled patches on D3DDevice_GetVertexShaderDeclaration and D3DDevice_GetVertexShaderFunction (all they do is read data from their input arguments, which we don't alter anymore, so these two getters can just as well be left unpatched)
This commit is contained in:
parent
6a8534a22e
commit
7d53eaae73
|
@ -7864,98 +7864,6 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_LoadVertexShaderProgram)
|
|||
CxbxImpl_LoadVertexShaderProgram(pFunction, Address);
|
||||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * patch: D3DDevice_GetVertexShaderDeclaration
|
||||
// ******************************************************************
|
||||
HRESULT WINAPI XTL::EMUPATCH(D3DDevice_GetVertexShaderDeclaration)
|
||||
(
|
||||
DWORD Handle,
|
||||
PVOID pData,
|
||||
DWORD *pSizeOfData
|
||||
)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_ARG(Handle)
|
||||
LOG_FUNC_ARG(pData)
|
||||
LOG_FUNC_ARG(pSizeOfData)
|
||||
LOG_FUNC_END;
|
||||
|
||||
// Handle is always address of an Xbox VertexShader struct, or-ed with 1 (X_D3DFVF_RESERVED0)
|
||||
// If the pData buffer pointer is given, pSizeOfData is the address of it's size (in bytes)
|
||||
// If pData is null, pSizeOfData is still given (to receive the required data size)
|
||||
|
||||
|
||||
// The VertexShader is converted back into the contained program and it's size.
|
||||
// In any case, *pSizeOfData will be set to the program size.
|
||||
// If the pData is null, no further action it taken.
|
||||
// If the pData buffer pointer is given, but the given *pSizeOfData is smaller than the program size, an error is returned.
|
||||
// Otherwise, the program is unbatched and copied into the pData buffer.
|
||||
|
||||
HRESULT hRet = D3DERR_INVALIDCALL;
|
||||
|
||||
if (pSizeOfData) {
|
||||
CxbxVertexShader *pCxbxVertexShader = GetCxbxVertexShader(Handle);
|
||||
if (pCxbxVertexShader) {
|
||||
DWORD sizeOfData = pCxbxVertexShader->Declaration.XboxDeclarationCount * sizeof(DWORD);
|
||||
if (*pSizeOfData < sizeOfData || !pData) {
|
||||
*pSizeOfData = sizeOfData;
|
||||
hRet = !pData ? D3D_OK : D3DERR_MOREDATA;
|
||||
}
|
||||
else {
|
||||
memcpy(pData, pCxbxVertexShader->Declaration.pXboxDeclarationCopy, pCxbxVertexShader->Declaration.XboxDeclarationCount * sizeof(DWORD));
|
||||
hRet = D3D_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hRet;
|
||||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * patch: D3DDevice_GetVertexShaderFunction
|
||||
// ******************************************************************
|
||||
HRESULT WINAPI XTL::EMUPATCH(D3DDevice_GetVertexShaderFunction)
|
||||
(
|
||||
DWORD Handle,
|
||||
PVOID *pData,
|
||||
DWORD *pSizeOfData
|
||||
)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_ARG(Handle)
|
||||
LOG_FUNC_ARG(pData)
|
||||
LOG_FUNC_ARG(pSizeOfData)
|
||||
LOG_FUNC_END;
|
||||
|
||||
// Handle is always address of an Xbox VertexShader struct, or-ed with 1 (X_D3DFVF_RESERVED0)
|
||||
// If the pData buffer pointer is given, pSizeOfData is the address of it's size (in bytes)
|
||||
// If pData is null, pSizeOfData is still given (to receive the required data size)
|
||||
|
||||
// The VertexShader is parsed and converted back into the underlying declaration and it's size.
|
||||
// In any case, *pSizeOfData will be set to the declaration size.
|
||||
// If the pData is null, no further action it taken.
|
||||
// If the pData buffer pointer is given, but the given *pSizeOfData is smaller than the declaration size, an error is returned.
|
||||
// Otherwise, the declaration is copied into the pData buffer.
|
||||
|
||||
HRESULT hRet = D3DERR_INVALIDCALL;
|
||||
|
||||
if(pSizeOfData) {
|
||||
CxbxVertexShader *pCxbxVertexShader = GetCxbxVertexShader(Handle);
|
||||
if (pCxbxVertexShader) {
|
||||
if (*pSizeOfData < pCxbxVertexShader->XboxFunctionSize || !pData) {
|
||||
*pSizeOfData = pCxbxVertexShader->XboxFunctionSize;
|
||||
hRet = !pData ? D3D_OK : D3DERR_MOREDATA;
|
||||
}
|
||||
else {
|
||||
memcpy(pData, pCxbxVertexShader->pXboxFunctionCopy, pCxbxVertexShader->XboxFunctionSize);
|
||||
hRet = D3D_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hRet;
|
||||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * patch: D3DDevice_SetDepthClipPlanes
|
||||
// ******************************************************************
|
||||
|
|
|
@ -4043,3 +4043,95 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_GetViewportOffsetAndScale)
|
|||
pScale->z = vScale[2];
|
||||
pScale->w = vScale[3];
|
||||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * patch: D3DDevice_GetVertexShaderDeclaration
|
||||
// ******************************************************************
|
||||
HRESULT WINAPI XTL::EMUPATCH(D3DDevice_GetVertexShaderDeclaration)
|
||||
(
|
||||
DWORD Handle,
|
||||
PVOID pData,
|
||||
DWORD *pSizeOfData
|
||||
)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_ARG(Handle)
|
||||
LOG_FUNC_ARG(pData)
|
||||
LOG_FUNC_ARG(pSizeOfData)
|
||||
LOG_FUNC_END;
|
||||
|
||||
// Handle is always address of an Xbox VertexShader struct, or-ed with 1 (X_D3DFVF_RESERVED0)
|
||||
// If the pData buffer pointer is given, pSizeOfData is the address of it's size (in bytes)
|
||||
// If pData is null, pSizeOfData is still given (to receive the required data size)
|
||||
|
||||
|
||||
// The VertexShader is converted back into the contained program and it's size.
|
||||
// In any case, *pSizeOfData will be set to the program size.
|
||||
// If the pData is null, no further action it taken.
|
||||
// If the pData buffer pointer is given, but the given *pSizeOfData is smaller than the program size, an error is returned.
|
||||
// Otherwise, the program is unbatched and copied into the pData buffer.
|
||||
|
||||
HRESULT hRet = D3DERR_INVALIDCALL;
|
||||
|
||||
if (pSizeOfData) {
|
||||
CxbxVertexShader *pCxbxVertexShader = GetCxbxVertexShader(Handle);
|
||||
if (pCxbxVertexShader) {
|
||||
DWORD sizeOfData = pCxbxVertexShader->Declaration.XboxDeclarationCount * sizeof(DWORD);
|
||||
if (*pSizeOfData < sizeOfData || !pData) {
|
||||
*pSizeOfData = sizeOfData;
|
||||
hRet = !pData ? D3D_OK : D3DERR_MOREDATA;
|
||||
}
|
||||
else {
|
||||
memcpy(pData, pCxbxVertexShader->Declaration.pXboxDeclarationCopy, pCxbxVertexShader->Declaration.XboxDeclarationCount * sizeof(DWORD));
|
||||
hRet = D3D_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hRet;
|
||||
}
|
||||
|
||||
// ******************************************************************
|
||||
// * patch: D3DDevice_GetVertexShaderFunction
|
||||
// ******************************************************************
|
||||
HRESULT WINAPI XTL::EMUPATCH(D3DDevice_GetVertexShaderFunction)
|
||||
(
|
||||
DWORD Handle,
|
||||
PVOID *pData,
|
||||
DWORD *pSizeOfData
|
||||
)
|
||||
{
|
||||
LOG_FUNC_BEGIN
|
||||
LOG_FUNC_ARG(Handle)
|
||||
LOG_FUNC_ARG(pData)
|
||||
LOG_FUNC_ARG(pSizeOfData)
|
||||
LOG_FUNC_END;
|
||||
|
||||
// Handle is always address of an Xbox VertexShader struct, or-ed with 1 (X_D3DFVF_RESERVED0)
|
||||
// If the pData buffer pointer is given, pSizeOfData is the address of it's size (in bytes)
|
||||
// If pData is null, pSizeOfData is still given (to receive the required data size)
|
||||
|
||||
// The VertexShader is parsed and converted back into the underlying declaration and it's size.
|
||||
// In any case, *pSizeOfData will be set to the declaration size.
|
||||
// If the pData is null, no further action it taken.
|
||||
// If the pData buffer pointer is given, but the given *pSizeOfData is smaller than the declaration size, an error is returned.
|
||||
// Otherwise, the declaration is copied into the pData buffer.
|
||||
|
||||
HRESULT hRet = D3DERR_INVALIDCALL;
|
||||
|
||||
if(pSizeOfData) {
|
||||
CxbxVertexShader *pCxbxVertexShader = GetCxbxVertexShader(Handle);
|
||||
if (pCxbxVertexShader) {
|
||||
if (*pSizeOfData < pCxbxVertexShader->XboxFunctionSize || !pData) {
|
||||
*pSizeOfData = pCxbxVertexShader->XboxFunctionSize;
|
||||
hRet = !pData ? D3D_OK : D3DERR_MOREDATA;
|
||||
}
|
||||
else {
|
||||
memcpy(pData, pCxbxVertexShader->pXboxFunctionCopy, pCxbxVertexShader->XboxFunctionSize);
|
||||
hRet = D3D_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hRet;
|
||||
}
|
||||
|
|
|
@ -92,8 +92,8 @@ std::map<const std::string, const xbox_patch_t> g_PatchTable = {
|
|||
PATCH_ENTRY("D3DDevice_GetTransform", XTL::EMUPATCH(D3DDevice_GetTransform), PATCH_HLE_D3D),
|
||||
PATCH_ENTRY("D3DDevice_GetVertexShader", XTL::EMUPATCH(D3DDevice_GetVertexShader), PATCH_HLE_D3D),
|
||||
PATCH_ENTRY("D3DDevice_GetVertexShaderConstant", XTL::EMUPATCH(D3DDevice_GetVertexShaderConstant), PATCH_HLE_D3D),
|
||||
PATCH_ENTRY("D3DDevice_GetVertexShaderDeclaration", XTL::EMUPATCH(D3DDevice_GetVertexShaderDeclaration), PATCH_HLE_D3D),
|
||||
PATCH_ENTRY("D3DDevice_GetVertexShaderFunction", XTL::EMUPATCH(D3DDevice_GetVertexShaderFunction), PATCH_HLE_D3D),
|
||||
//PATCH_ENTRY("D3DDevice_GetVertexShaderDeclaration", XTL::EMUPATCH(D3DDevice_GetVertexShaderDeclaration), PATCH_HLE_D3D),
|
||||
//PATCH_ENTRY("D3DDevice_GetVertexShaderFunction", XTL::EMUPATCH(D3DDevice_GetVertexShaderFunction), PATCH_HLE_D3D),
|
||||
PATCH_ENTRY("D3DDevice_GetVertexShaderInput", XTL::EMUPATCH(D3DDevice_GetVertexShaderInput), PATCH_HLE_D3D),
|
||||
//PATCH_ENTRY("D3DDevice_GetVertexShaderSize", XTL::EMUPATCH(D3DDevice_GetVertexShaderSize), PATCH_HLE_D3D),
|
||||
//PATCH_ENTRY("D3DDevice_GetVertexShaderType", XTL::EMUPATCH(D3DDevice_GetVertexShaderType), PATCH_HLE_D3D),
|
||||
|
|
Loading…
Reference in New Issue