mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
[HRP] Added missing movie scaling implementation for GPUBlt=2
Reverted the previous commit.
This commit is contained in:
+7
-2
@@ -167,8 +167,13 @@ void Setting::init(const char* exeFileName, std::string &cmdline) {
|
||||
|
||||
if (!Setting::ExternalEnabled() && !hiResMode) return; // vanilla game mode
|
||||
|
||||
SCR_WIDTH = sf::IniReader::GetInt("Main", "SCR_WIDTH", 640, f2ResIni);
|
||||
SCR_HEIGHT = sf::IniReader::GetInt("Main", "SCR_HEIGHT", 480, f2ResIni);
|
||||
SCR_WIDTH = sf::IniReader::GetInt("Main", "SCR_WIDTH", 0, f2ResIni);
|
||||
SCR_HEIGHT = sf::IniReader::GetInt("Main", "SCR_HEIGHT", 0, f2ResIni);
|
||||
|
||||
if (SCR_WIDTH == 0 || SCR_HEIGHT == 0) {
|
||||
SCR_WIDTH = sf::IniReader::GetConfigInt("Graphics", "GraphicsWidth", 640);
|
||||
SCR_HEIGHT = sf::IniReader::GetConfigInt("Graphics", "GraphicsHeight", 480);
|
||||
}
|
||||
|
||||
if (SCR_WIDTH < 640) SCR_WIDTH = 640;
|
||||
if (SCR_HEIGHT < 480) SCR_HEIGHT = 480;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "SubModules\WindowRender.h"
|
||||
|
||||
#include "..\HRP\Init.h"
|
||||
#include "..\HRP\Image.h"
|
||||
#include "..\HRP\MoviesScreen.h"
|
||||
|
||||
#include "..\HLSL\A8PixelShader.h"
|
||||
@@ -115,6 +116,8 @@ static D3DXHANDLE gpuBltHighlightSize;
|
||||
static D3DXHANDLE gpuBltHighlightCorner;
|
||||
static D3DXHANDLE gpuBltShowHighlight;
|
||||
|
||||
static BYTE* mveScaleSurface = nullptr;
|
||||
|
||||
static float rcpres[2];
|
||||
|
||||
#define _VERTEXFORMAT D3DFVF_XYZRHW|D3DFVF_TEX1
|
||||
@@ -197,7 +200,7 @@ static void ResetDevice(bool create) {
|
||||
// Use: 0 - only CPU, 1 - force GPU, 2 - Auto Mode (GPU or switch to CPU)
|
||||
if (Graphics::GPUBlt == 2 && ShaderVersion < 20) Graphics::GPUBlt = 0;
|
||||
|
||||
bool A8IsSupported = (d3d9Device->CreateTexture(ResWidth, ResHeight, 1, 0, D3DFMT_A8, D3DPOOL_SYSTEMMEM, &mainTex, 0) == D3D_OK);
|
||||
bool A8IsSupported = Graphics::GPUBlt && (d3d9Device->CreateTexture(ResWidth, ResHeight, 1, 0, D3DFMT_A8, D3DPOOL_SYSTEMMEM, &mainTex, 0) == D3D_OK);
|
||||
|
||||
if (Graphics::GPUBlt) {
|
||||
const BYTE* shader = (A8IsSupported) ? gpuEffectA8 : gpuEffectL8;
|
||||
@@ -627,7 +630,7 @@ public:
|
||||
|
||||
IsPlayMovie = true;
|
||||
|
||||
BYTE* lockTarget = ((FakeDirectDrawSurface*)b)->lockTarget;
|
||||
BYTE* mveSurface = ((FakeDirectDrawSurface*)b)->lockTarget;
|
||||
|
||||
D3DLOCKED_RECT dRect;
|
||||
mainTex->LockRect(0, &dRect, dst, D3DLOCK_NO_DIRTY_UPDATE);
|
||||
@@ -637,16 +640,26 @@ public:
|
||||
|
||||
if (Graphics::GPUBlt) {
|
||||
if (d != 0) {
|
||||
fo::func::cscale(lockTarget, width, mveDesc.dwHeight, width, (BYTE*)dRect.pBits, dst->right - dst->left, dst->bottom - dst->top, dRect.Pitch);
|
||||
HRP::Image::Scale(mveSurface, width, mveDesc.dwHeight, (BYTE*)dRect.pBits, dst->right - dst->left, dst->bottom - dst->top, dRect.Pitch);
|
||||
} else {
|
||||
fo::func::buf_to_buf(lockTarget, width, mveDesc.dwHeight, width, (BYTE*)dRect.pBits, dRect.Pitch);
|
||||
fo::func::buf_to_buf(mveSurface, width, mveDesc.dwHeight, width, (BYTE*)dRect.pBits, dRect.Pitch);
|
||||
}
|
||||
} else {
|
||||
int height = mveDesc.dwHeight;
|
||||
|
||||
if (d != 0) { // scale
|
||||
if (!mveScaleSurface) mveScaleSurface = new BYTE[ResWidth * ResHeight];
|
||||
width = dst->right - dst->left;
|
||||
height = dst->bottom - dst->top;
|
||||
|
||||
HRP::Image::Scale(mveSurface, mveDesc.lPitch, mveDesc.dwHeight, mveScaleSurface, width, height, ResWidth);
|
||||
mveSurface = mveScaleSurface;
|
||||
}
|
||||
|
||||
int pitch = dRect.Pitch / 4;
|
||||
DWORD* pBits = (DWORD*)dRect.pBits;
|
||||
BYTE* target = lockTarget;
|
||||
BYTE* target = mveSurface;
|
||||
|
||||
int height = mveDesc.dwHeight;
|
||||
while (height--) {
|
||||
int x = width;
|
||||
while (x--) pBits[x] = palette[target[x]].xRGB;
|
||||
@@ -1236,6 +1249,7 @@ void Graphics::exit() {
|
||||
} else {
|
||||
DirectDraw::exit();
|
||||
}
|
||||
if (mveScaleSurface) delete[] mveScaleSurface;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -642,20 +642,12 @@
|
||||
<VariableName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">gpuEffectA8</VariableName>
|
||||
<VariableName Condition="'$(Configuration)|$(Platform)'=='ReleaseXP|Win32'">gpuEffectA8</VariableName>
|
||||
<VariableName Condition="'$(Configuration)|$(Platform)'=='DevXP|Win32'">gpuEffectA8</VariableName>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseXP|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DevXP|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</FxCompile>
|
||||
<FxCompile Include="HLSL\L8PixelShader.hlsl">
|
||||
<VariableName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">gpuEffectL8</VariableName>
|
||||
<VariableName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">gpuEffectL8</VariableName>
|
||||
<VariableName Condition="'$(Configuration)|$(Platform)'=='ReleaseXP|Win32'">gpuEffectL8</VariableName>
|
||||
<VariableName Condition="'$(Configuration)|$(Platform)'=='DevXP|Win32'">gpuEffectL8</VariableName>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseXP|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DevXP|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
||||
Reference in New Issue
Block a user