mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
parent
53b0265138
commit
c54c45a773
@ -1274,8 +1274,7 @@ namespace D3dDdi
|
|||||||
m_device.flushPrimitives();
|
m_device.flushPrimitives();
|
||||||
if (srcResource->m_lockResource)
|
if (srcResource->m_lockResource)
|
||||||
{
|
{
|
||||||
if (srcResource->m_lockData[data.SrcSubResourceIndex].isSysMemUpToDate &&
|
if (srcResource->m_lockData[data.SrcSubResourceIndex].isSysMemUpToDate)
|
||||||
!srcResource->m_origData.Flags.RenderTarget)
|
|
||||||
{
|
{
|
||||||
srcResource->m_lockData[data.SrcSubResourceIndex].isVidMemUpToDate = false;
|
srcResource->m_lockData[data.SrcSubResourceIndex].isVidMemUpToDate = false;
|
||||||
srcResource->m_lockData[data.SrcSubResourceIndex].isMsaaResolvedUpToDate = false;
|
srcResource->m_lockData[data.SrcSubResourceIndex].isMsaaResolvedUpToDate = false;
|
||||||
@ -1488,11 +1487,9 @@ namespace D3dDdi
|
|||||||
void Resource::setAsPrimary()
|
void Resource::setAsPrimary()
|
||||||
{
|
{
|
||||||
D3dDdi::ScopedCriticalSection lock;
|
D3dDdi::ScopedCriticalSection lock;
|
||||||
if (!m_isPrimary)
|
m_isPrimary = true;
|
||||||
{
|
m_origData.Flags.RenderTarget = DDraw::PrimarySurface::getOrigCaps() & DDSCAPS_3DDEVICE ? 1 : 0;
|
||||||
m_isPrimary = true;
|
updateConfig();
|
||||||
updateConfig();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Resource::setFormatOverride(D3DDDIFORMAT format)
|
void Resource::setFormatOverride(D3DDDIFORMAT format)
|
||||||
|
@ -59,6 +59,7 @@ namespace
|
|||||||
constexpr void setCompatVtable(Vtable& vtable)
|
constexpr void setCompatVtable(Vtable& vtable)
|
||||||
{
|
{
|
||||||
typedef GetSurfaceType<Vtable>::Type TSurface;
|
typedef GetSurfaceType<Vtable>::Type TSurface;
|
||||||
|
SET_COMPAT_METHOD(AddAttachedSurface);
|
||||||
SET_COMPAT_METHOD(Blt);
|
SET_COMPAT_METHOD(Blt);
|
||||||
SET_COMPAT_METHOD(BltFast);
|
SET_COMPAT_METHOD(BltFast);
|
||||||
SET_COMPAT_METHOD(Flip);
|
SET_COMPAT_METHOD(Flip);
|
||||||
|
@ -84,6 +84,11 @@ namespace DDraw
|
|||||||
desc.ddsCaps.dwCaps |= DDSCAPS_OFFSCREENPLAIN;
|
desc.ddsCaps.dwCaps |= DDSCAPS_OFFSCREENPLAIN;
|
||||||
desc.ddpfPixelFormat = DirectDraw::getRgbPixelFormat(g_monitorInfo.bpp);
|
desc.ddpfPixelFormat = DirectDraw::getRgbPixelFormat(g_monitorInfo.bpp);
|
||||||
|
|
||||||
|
if (!(desc.dwFlags & DDSD_BACKBUFFERCOUNT))
|
||||||
|
{
|
||||||
|
desc.ddsCaps.dwCaps |= DDSCAPS_3DDEVICE;
|
||||||
|
}
|
||||||
|
|
||||||
result = Surface::create(dd, desc, surface, std::move(privateData));
|
result = Surface::create(dd, desc, surface, std::move(privateData));
|
||||||
if (FAILED(result))
|
if (FAILED(result))
|
||||||
{
|
{
|
||||||
@ -277,6 +282,16 @@ namespace DDraw
|
|||||||
Surface::restore();
|
Surface::restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrimarySurface::setAsRenderTarget()
|
||||||
|
{
|
||||||
|
g_origCaps |= DDSCAPS_3DDEVICE;
|
||||||
|
auto resource = D3dDdi::Device::findResource(DDraw::DirectDrawSurface::getDriverResourceHandle(*g_primarySurface));
|
||||||
|
if (resource)
|
||||||
|
{
|
||||||
|
resource->setAsPrimary();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PrimarySurface::updateFrontResource()
|
void PrimarySurface::updateFrontResource()
|
||||||
{
|
{
|
||||||
g_frontResource = DirectDrawSurface::getDriverResourceHandle(*g_primarySurface);
|
g_frontResource = DirectDrawSurface::getDriverResourceHandle(*g_primarySurface);
|
||||||
|
@ -28,6 +28,7 @@ namespace DDraw
|
|||||||
static HANDLE getGdiResource();
|
static HANDLE getGdiResource();
|
||||||
static DWORD getOrigCaps();
|
static DWORD getOrigCaps();
|
||||||
static void onLost();
|
static void onLost();
|
||||||
|
static void setAsRenderTarget();
|
||||||
static void updatePalette();
|
static void updatePalette();
|
||||||
|
|
||||||
template <typename TSurface>
|
template <typename TSurface>
|
||||||
|
@ -84,6 +84,22 @@ namespace DDraw
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename TSurface>
|
||||||
|
HRESULT PrimarySurfaceImpl<TSurface>::AddAttachedSurface(TSurface* This, TSurface* lpDDSAttachedSurface)
|
||||||
|
{
|
||||||
|
HRESULT result = getOrigVtable(This).AddAttachedSurface(This, lpDDSAttachedSurface);
|
||||||
|
if (SUCCEEDED(result) && !(PrimarySurface::getOrigCaps() & DDSCAPS_3DDEVICE))
|
||||||
|
{
|
||||||
|
TDdsCaps caps = {};
|
||||||
|
getOrigVtable(This).GetCaps(lpDDSAttachedSurface, &caps);
|
||||||
|
if (caps.dwCaps & DDSCAPS_3DDEVICE)
|
||||||
|
{
|
||||||
|
PrimarySurface::setAsRenderTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename TSurface>
|
template <typename TSurface>
|
||||||
HRESULT PrimarySurfaceImpl<TSurface>::Blt(
|
HRESULT PrimarySurfaceImpl<TSurface>::Blt(
|
||||||
TSurface* This, LPRECT lpDestRect, TSurface* lpDDSrcSurface, LPRECT lpSrcRect,
|
TSurface* This, LPRECT lpDestRect, TSurface* lpDDSrcSurface, LPRECT lpSrcRect,
|
||||||
|
@ -15,6 +15,7 @@ namespace DDraw
|
|||||||
public:
|
public:
|
||||||
PrimarySurfaceImpl(Surface* data);
|
PrimarySurfaceImpl(Surface* data);
|
||||||
|
|
||||||
|
virtual HRESULT AddAttachedSurface(TSurface* This, TSurface* lpDDSAttachedSurface) override;
|
||||||
virtual HRESULT Blt(TSurface* This, LPRECT lpDestRect, TSurface* lpDDSrcSurface, LPRECT lpSrcRect,
|
virtual HRESULT Blt(TSurface* This, LPRECT lpDestRect, TSurface* lpDDSrcSurface, LPRECT lpSrcRect,
|
||||||
DWORD dwFlags, LPDDBLTFX lpDDBltFx) override;
|
DWORD dwFlags, LPDDBLTFX lpDDBltFx) override;
|
||||||
virtual HRESULT BltFast(TSurface* This, DWORD dwX, DWORD dwY,
|
virtual HRESULT BltFast(TSurface* This, DWORD dwX, DWORD dwY,
|
||||||
|
@ -122,6 +122,12 @@ namespace DDraw
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename TSurface>
|
||||||
|
HRESULT SurfaceImpl<TSurface>::AddAttachedSurface(TSurface* This, TSurface* lpDDSAttachedSurface)
|
||||||
|
{
|
||||||
|
return getOrigVtable(This).AddAttachedSurface(This, lpDDSAttachedSurface);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename TSurface>
|
template <typename TSurface>
|
||||||
HRESULT SurfaceImpl<TSurface>::Blt(
|
HRESULT SurfaceImpl<TSurface>::Blt(
|
||||||
TSurface* This, LPRECT lpDestRect, TSurface* lpDDSrcSurface, LPRECT lpSrcRect,
|
TSurface* This, LPRECT lpDestRect, TSurface* lpDDSrcSurface, LPRECT lpSrcRect,
|
||||||
|
@ -24,6 +24,7 @@ namespace DDraw
|
|||||||
SurfaceImpl(Surface* data);
|
SurfaceImpl(Surface* data);
|
||||||
virtual ~SurfaceImpl();
|
virtual ~SurfaceImpl();
|
||||||
|
|
||||||
|
virtual HRESULT AddAttachedSurface(TSurface* This, TSurface* lpDDSAttachedSurface);
|
||||||
virtual HRESULT Blt(TSurface* This, LPRECT lpDestRect, TSurface* lpDDSrcSurface, LPRECT lpSrcRect,
|
virtual HRESULT Blt(TSurface* This, LPRECT lpDestRect, TSurface* lpDDSrcSurface, LPRECT lpSrcRect,
|
||||||
DWORD dwFlags, LPDDBLTFX lpDDBltFx);
|
DWORD dwFlags, LPDDBLTFX lpDDBltFx);
|
||||||
virtual HRESULT BltFast(TSurface* This, DWORD dwX, DWORD dwY,
|
virtual HRESULT BltFast(TSurface* This, DWORD dwX, DWORD dwY,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user