Skip to content

Commit

Permalink
[linux] add D3DXLoadSurfaceFromSurface implementation from WINE
Browse files Browse the repository at this point in the history
  • Loading branch information
q4a committed Mar 15, 2022
1 parent 3683228 commit 499e7c8
Show file tree
Hide file tree
Showing 5 changed files with 1,014 additions and 3 deletions.
20 changes: 20 additions & 0 deletions src/libs/common/include/storm_d3dx9.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once
#ifndef _WIN32

#include <d3d9.h>
#include <algorithm>

#define D3DX_DEFAULT ((UINT)-1)

// Textures Methods

HRESULT D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
const PALETTEENTRY *dst_palette, const RECT *dst_rect, const void *src_memory,
D3DFORMAT src_format, UINT src_pitch, const PALETTEENTRY *src_palette, const RECT *src_rect,
DWORD filter, D3DCOLOR color_key);

HRESULT D3DXLoadSurfaceFromSurface(IDirect3DSurface9 *dst_surface,
const PALETTEENTRY *dst_palette, const RECT *dst_rect, IDirect3DSurface9 *src_surface,
const PALETTEENTRY *src_palette, const RECT *src_rect, DWORD filter, D3DCOLOR color_key);

#endif
1 change: 1 addition & 0 deletions src/libs/common/include/storm_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ inline const char *convert_path_sep(const char *cPath)

#include <limits.h>

#include "storm_d3dx9.h"
#include "linux/winuser.h"
#include "safe_str_lib.h"
#undef EXTERN // fix for token.h:72:5: error: expected identifier EXTERN,
Expand Down
4 changes: 2 additions & 2 deletions src/libs/renderer/src/s_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3328,7 +3328,7 @@ void DX9RENDER::MakeScreenShot()
return;
}

#ifdef _WIN32 // FIX_LINUX D3DXLoadSurfaceFromSurface
#ifndef false //#ifdef _WIN32 // FIX_LINUX D3DXLoadSurfaceFromSurface
if (CHECKD3DERR(D3DXLoadSurfaceFromSurface(surface, NULL, NULL, renderTarget, NULL, NULL, D3DX_DEFAULT, 0)))
#else
if (FAILED(d3d9->UpdateSurface(renderTarget, nullptr, surface, nullptr)))
Expand Down Expand Up @@ -3845,7 +3845,7 @@ HRESULT DX9RENDER::GetSurfaceLevel(IDirect3DTexture9 *ppTexture, UINT Level, IDi
HRESULT DX9RENDER::UpdateSurface(IDirect3DSurface9 *pSourceSurface, CONST RECT *pSourceRectsArray, UINT cRects,
IDirect3DSurface9 *pDestinationSurface, CONST POINT *pDestPointsArray)
{
#ifdef _WIN32 // FIX_LINUX D3DXLoadSurfaceFromSurface
#ifndef false //#ifdef _WIN32 // FIX_LINUX D3DXLoadSurfaceFromSurface
return CHECKD3DERR(D3DXLoadSurfaceFromSurface(pDestinationSurface, nullptr, nullptr, pSourceSurface, nullptr,
nullptr, D3DX_DEFAULT, 0));
#else
Expand Down
Loading

0 comments on commit 499e7c8

Please sign in to comment.