mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
parent
0b974e2dd7
commit
767c8d28ee
@ -22,6 +22,7 @@
|
||||
#include <Config/Settings/ForceD3D9On12.h>
|
||||
#include <Config/Settings/FpsLimiter.h>
|
||||
#include <Config/Settings/FullscreenMode.h>
|
||||
#include <Config/Settings/GdiStretchBltMode.h>
|
||||
#include <Config/Settings/LogLevel.h>
|
||||
#include <Config/Settings/PalettizedTextures.h>
|
||||
#include <Config/Settings/RemoveBorders.h>
|
||||
@ -78,6 +79,7 @@ namespace Config
|
||||
Settings::ForceD3D9On12 forceD3D9On12;
|
||||
Settings::FpsLimiter fpsLimiter;
|
||||
Settings::FullscreenMode fullscreenMode;
|
||||
Settings::GdiStretchBltMode gdiStretchBltMode;
|
||||
Settings::LogLevel logLevel;
|
||||
Settings::PalettizedTextures palettizedTextures;
|
||||
Settings::RemoveBorders removeBorders;
|
||||
|
25
DDrawCompat/Config/Settings/GdiStretchBltMode.h
Normal file
25
DDrawCompat/Config/Settings/GdiStretchBltMode.h
Normal file
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <Config/MappedSetting.h>
|
||||
|
||||
namespace Config
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
class GdiStretchBltMode : public MappedSetting<UINT>
|
||||
{
|
||||
public:
|
||||
static const UINT APP = 0;
|
||||
|
||||
GdiStretchBltMode() : MappedSetting("GdiStretchBltMode", "app", {
|
||||
{"app", APP},
|
||||
{"coloroncolor", COLORONCOLOR},
|
||||
{"halftone", HALFTONE}
|
||||
})
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
extern Settings::GdiStretchBltMode gdiStretchBltMode;
|
||||
}
|
@ -188,6 +188,7 @@
|
||||
<ClInclude Include="Config\Settings\ForceD3D9On12.h" />
|
||||
<ClInclude Include="Config\Settings\FpsLimiter.h" />
|
||||
<ClInclude Include="Config\Settings\FullscreenMode.h" />
|
||||
<ClInclude Include="Config\Settings\GdiStretchBltMode.h" />
|
||||
<ClInclude Include="Config\Settings\LogLevel.h" />
|
||||
<ClInclude Include="Config\Settings\PalettizedTextures.h" />
|
||||
<ClInclude Include="Config\Settings\RemoveBorders.h" />
|
||||
|
@ -720,6 +720,9 @@
|
||||
<ClInclude Include="Config\Settings\VertexFixup.h">
|
||||
<Filter>Header Files\Config\Settings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Config\Settings\GdiStretchBltMode.h">
|
||||
<Filter>Header Files\Config\Settings</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Gdi\Gdi.cpp">
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <Common/Hook.h>
|
||||
#include <Common/Log.h>
|
||||
#include <Config/Settings/GdiStretchBltMode.h>
|
||||
#include <Gdi/CompatDc.h>
|
||||
#include <Gdi/Dc.h>
|
||||
#include <Gdi/DcFunctions.h>
|
||||
@ -342,6 +343,24 @@ namespace
|
||||
Compat::hookFunction<origFunc>(moduleName, funcName, &compatGdiTextDcFunc<origFunc>);
|
||||
}
|
||||
|
||||
int WINAPI setStretchBltMode(HDC hdc, int mode)
|
||||
{
|
||||
LOG_FUNC("SetStretchBltMode", hdc, mode);
|
||||
if (COLORONCOLOR == mode && HALFTONE == Config::gdiStretchBltMode.get())
|
||||
{
|
||||
POINT org = {};
|
||||
GetBrushOrgEx(hdc, &org);
|
||||
auto result = CALL_ORIG_FUNC(SetStretchBltMode)(hdc, HALFTONE);
|
||||
SetBrushOrgEx(hdc, org.x, org.y, nullptr);
|
||||
return LOG_RESULT(result);
|
||||
}
|
||||
if (HALFTONE == mode && COLORONCOLOR == Config::gdiStretchBltMode.get())
|
||||
{
|
||||
mode = COLORONCOLOR;
|
||||
}
|
||||
return LOG_RESULT(CALL_ORIG_FUNC(SetStretchBltMode)(hdc, mode));
|
||||
}
|
||||
|
||||
HWND WINAPI windowFromDc(HDC dc)
|
||||
{
|
||||
return CALL_ORIG_FUNC(WindowFromDC)(Gdi::Dc::getOrigDc(dc));
|
||||
@ -394,6 +413,7 @@ namespace Gdi
|
||||
|
||||
// Device context functions
|
||||
HOOK_GDI_DC_FUNCTION(gdi32, DrawEscape);
|
||||
HOOK_FUNCTION(gdi32, SetStretchBltMode, setStretchBltMode);
|
||||
HOOK_FUNCTION(user32, WindowFromDC, windowFromDc);
|
||||
|
||||
// Filled shape functions
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <Config/Settings/DisplayFilter.h>
|
||||
#include <Config/Settings/FontAntialiasing.h>
|
||||
#include <Config/Settings/FpsLimiter.h>
|
||||
#include <Config/Settings/GdiStretchBltMode.h>
|
||||
#include <Config/Settings/RenderColorDepth.h>
|
||||
#include <Config/Settings/ResolutionScale.h>
|
||||
#include <Config/Settings/ResolutionScaleFilter.h>
|
||||
@ -28,6 +29,7 @@
|
||||
#include <Config/Settings/VertexFixup.h>
|
||||
#include <Config/Settings/VSync.h>
|
||||
#include <D3dDdi/Device.h>
|
||||
#include <Gdi/Gdi.h>
|
||||
#include <Gdi/GuiThread.h>
|
||||
#include <Input/Input.h>
|
||||
#include <Overlay/ConfigWindow.h>
|
||||
@ -57,6 +59,7 @@ namespace
|
||||
{ &Config::displayFilter },
|
||||
{ &Config::fontAntialiasing },
|
||||
{ &Config::fpsLimiter },
|
||||
{ &Config::gdiStretchBltMode, []() { Gdi::redraw(nullptr); } },
|
||||
{ &Config::renderColorDepth, &D3dDdi::Device::updateAllConfig },
|
||||
{ &Config::resolutionScale, &D3dDdi::Device::updateAllConfig },
|
||||
{ &Config::resolutionScaleFilter },
|
||||
|
Loading…
x
Reference in New Issue
Block a user