Skip to content

Commit

Permalink
[CKPE]
Browse files Browse the repository at this point in the history
- Supported only 8.1 or newer;
- Install hook for mipmaps (DX11);
SSE:
- Fixed transparent water for CK 1.6.1130 or newer;
- Fixed fog;
FO4:
- Fixed bad picture in render with sky enabled;
  • Loading branch information
Perchik71 committed Dec 20, 2024
1 parent 65ad93f commit b80b319
Show file tree
Hide file tree
Showing 22 changed files with 183 additions and 35 deletions.
9 changes: 9 additions & 0 deletions Creation Kit Platform Extended Core/Core/D3D11Proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,15 @@ namespace CreationKitPlatformExtended

HRESULT STDMETHODCALLTYPE D3D11DeviceProxy::CreateSamplerState(const D3D11_SAMPLER_DESC *pSamplerDesc, ID3D11SamplerState **ppSamplerState)
{
if (pSamplerDesc)
{
auto SamplerDesc = const_cast<D3D11_SAMPLER_DESC*>(pSamplerDesc);

SamplerDesc->MipLODBias = 0.0f; // mipmap level bias value
SamplerDesc->MinLOD = 0.0f; // alternative minimum mipmap level
SamplerDesc->MaxLOD = D3D11_FLOAT32_MAX; // alternative maximum mipmap level
}

return m_Device->CreateSamplerState(pSamplerDesc, ppSamplerState);
}

Expand Down
5 changes: 2 additions & 3 deletions Creation Kit Platform Extended Core/Core/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,14 +615,13 @@ namespace CreationKitPlatformExtended
DWORD dwMajor, dwMinor, dwBuild;
if (!GetVerOs(&dwMajor, &dwMinor, &dwBuild))
{
if (dwMajor < 6)
// Need 8.1
if ((dwMajor < 6) || (dwMajor == 6) && (dwMinor < 3))
{
_ERROR("Unsupported OS version");

return RC_UNSUPPORT_VERSION_OS;
}
else if ((dwMajor == 6) && (dwMinor < 3)) // Need 8.1
_WARNING("Your OS is not fully supported");
}

// Доступные имена для Creation Kit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "Patches/FO4/CrashConditionItemGetCrime.h"
#include "Patches/FO4/DontMatchForms.h"
#include "Patches/FO4/ResponseIgnoreMaxF4.h"
#include "Patches/FO4/FixBadPictureInRender.h"

#include "Patches/Windows/FO4/MainWindowF4.h"
#include "Patches/Windows/FO4/ObjectWindowF4.h"
Expand Down Expand Up @@ -119,7 +120,8 @@ namespace CreationKitPlatformExtended
new Patches::CrashConditionItemGetCrimePatch(),
new Patches::DontMatchFormsPatch(),
new Patches::ResponseIgnoreMaxPatch(),

new Patches::FixBadPictureInRenderPatch(),

new Patches::MainWindow(),
new Patches::ObjectWindow(),
new Patches::CellViewWindow(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@
<ClCompile Include="Patches\FO4\EnableGoInSelGame.cpp" />
<ClCompile Include="Patches\FO4\ESLTip.cpp" />
<ClCompile Include="Patches\FO4\FakeMoveLight.cpp" />
<ClCompile Include="Patches\FO4\FixBadPictureInRender.cpp" />
<ClCompile Include="Patches\FO4\FixBNet.cpp" />
<ClCompile Include="Patches\FO4\FixCrashMapMarkerCmd.cpp" />
<ClCompile Include="Patches\FO4\FixCrashNoRootMat.cpp" />
Expand Down Expand Up @@ -627,6 +628,7 @@
<ClInclude Include="Patches\FO4\EnableGoInSelGame.h" />
<ClInclude Include="Patches\FO4\ESLTip.h" />
<ClInclude Include="Patches\FO4\FakeMoveLight.h" />
<ClInclude Include="Patches\FO4\FixBadPictureInRender.h" />
<ClInclude Include="Patches\FO4\FixBNet.h" />
<ClInclude Include="Patches\FO4\FixCrashMapMarkerCmd.h" />
<ClInclude Include="Patches\FO4\FixCrashNoRootMat.h" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,9 @@
<ClCompile Include="Patches\SF\BSResourceLooseFilesPatchSF.cpp">
<Filter>Patches\SF</Filter>
</ClCompile>
<ClCompile Include="Patches\FO4\FixBadPictureInRender.cpp">
<Filter>Patches\FO4</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="Version">
Expand Down Expand Up @@ -2194,6 +2197,9 @@
<ClInclude Include="Patches\SF\BSResourceLooseFilesPatchSF.h">
<Filter>Patches\SF</Filter>
</ClInclude>
<ClInclude Include="Patches\FO4\FixBadPictureInRender.h">
<Filter>Patches\FO4</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Version\resource_version.rc">
Expand Down
12 changes: 9 additions & 3 deletions Creation Kit Platform Extended Core/Patches/D3D11Patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace CreationKitPlatformExtended

bool D3D11Patch::HasOption() const
{
return true;
return false;
}

bool D3D11Patch::HasCanRuntimeDisabled() const
Expand All @@ -32,7 +32,7 @@ namespace CreationKitPlatformExtended

const char* D3D11Patch::GetOptionName() const
{
return "CreationKit:bD3D11Patch";
return nullptr;
}

const char* D3D11Patch::GetName() const
Expand All @@ -57,7 +57,8 @@ namespace CreationKitPlatformExtended
{
auto SystemVersion = _engine->GetSystemVersion();
// Win 8.1 and newer
return ((SystemVersion.MajorVersion > 6) || ((SystemVersion.MajorVersion == 6) && (SystemVersion.MinorVersion == 3)));
return ((SystemVersion.MajorVersion > 6) ||
((SystemVersion.MajorVersion == 6) && (SystemVersion.MinorVersion == 3)));
}

return false;
Expand Down Expand Up @@ -143,6 +144,11 @@ namespace CreationKitPlatformExtended
D3D_FEATURE_LEVEL* pFeatureLevel,
ID3D11DeviceContext** ppImmediateContext)
{
auto SwapChainDesc = const_cast<DXGI_SWAP_CHAIN_DESC*>(pSwapChainDesc);
SwapChainDesc->BufferDesc.RefreshRate.Numerator = 60;
SwapChainDesc->BufferDesc.RefreshRate.Denominator =
(UINT)_READ_OPTION_BOOL("CreationKit", "bRenderWindowVSync", true);

//
// From MSDN:
//
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Copyright © 2023-2024 aka perchik71. All rights reserved.
// Contacts: <email:[email protected]>
// License: https://www.gnu.org/licenses/gpl-3.0.html

#include "Core/Engine.h"
#include "FixBadPictureInRender.h"

namespace CreationKitPlatformExtended
{
namespace Patches
{
namespace Fallout4
{
FixBadPictureInRenderPatch::FixBadPictureInRenderPatch() : Module(GlobalEnginePtr)
{}

bool FixBadPictureInRenderPatch::HasOption() const
{
return false;
}

bool FixBadPictureInRenderPatch::HasCanRuntimeDisabled() const
{
return false;
}

const char* FixBadPictureInRenderPatch::GetOptionName() const
{
return nullptr;
}

const char* FixBadPictureInRenderPatch::GetName() const
{
return "Fix Bad Picture In Render";
}

bool FixBadPictureInRenderPatch::HasDependencies() const
{
return false;
}

Array<String> FixBadPictureInRenderPatch::GetDependencies() const
{
return {};
}

bool FixBadPictureInRenderPatch::QueryFromPlatform(EDITOR_EXECUTABLE_TYPE eEditorCurrentVersion,
const char* lpcstrPlatformRuntimeVersion) const
{
return (eEditorCurrentVersion != EDITOR_EXECUTABLE_TYPE::EDITOR_FALLOUT_C4_1_10_943_1) &&
(eEditorCurrentVersion <= EDITOR_EXECUTABLE_TYPE::EDITOR_FALLOUT_C4_LAST);
}

bool FixBadPictureInRenderPatch::Activate(const Relocator* lpRelocator,
const RelocationDatabaseItem* lpRelocationDatabaseItem)
{
auto verPatch = lpRelocationDatabaseItem->Version();
if ((verPatch == 1) || (verPatch == 2))
{
// Remove stuff init FXAA or TAA
lpRelocator->PatchNop(_RELDATA_RAV(0), verPatch == 1 ? 0x55 : 0x50);

return true;
}

return false;
}

bool FixBadPictureInRenderPatch::Shutdown(const Relocator* lpRelocator,
const RelocationDatabaseItem* lpRelocationDatabaseItem)
{
return false;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright © 2023-2024 aka perchik71. All rights reserved.
// Contacts: <email:[email protected]>
// License: https://www.gnu.org/licenses/gpl-3.0.html

#pragma once

#include "Core/Module.h"
#include "Core/Relocator.h"
#include "Core/RelocationDatabase.h"

namespace CreationKitPlatformExtended
{
namespace Patches
{
namespace Fallout4
{
using namespace CreationKitPlatformExtended::Core;

class FixBadPictureInRenderPatch : public Module
{
public:
FixBadPictureInRenderPatch();

virtual bool HasOption() const;
virtual bool HasCanRuntimeDisabled() const;
virtual const char* GetOptionName() const;
virtual const char* GetName() const;
virtual bool HasDependencies() const;
virtual Array<String> GetDependencies() const;
protected:
virtual bool QueryFromPlatform(EDITOR_EXECUTABLE_TYPE eEditorCurrentVersion,
const char* lpcstrPlatformRuntimeVersion) const;
virtual bool Activate(const Relocator* lpRelocator, const RelocationDatabaseItem* lpRelocationDatabaseItem);
virtual bool Shutdown(const Relocator* lpRelocator, const RelocationDatabaseItem* lpRelocationDatabaseItem);
private:
FixBadPictureInRenderPatch(const FixBadPictureInRenderPatch&) = default;
FixBadPictureInRenderPatch& operator=(const FixBadPictureInRenderPatch&) = default;
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace CreationKitPlatformExtended

bool RenderWindow60FPSPatch::HasOption() const
{
return true;
return false;
}

bool RenderWindow60FPSPatch::HasCanRuntimeDisabled() const
Expand All @@ -24,7 +24,7 @@ namespace CreationKitPlatformExtended

const char* RenderWindow60FPSPatch::GetOptionName() const
{
return "CreationKit:bRenderWindow60FPS";
return nullptr;
}

const char* RenderWindow60FPSPatch::GetName() const
Expand Down Expand Up @@ -53,14 +53,15 @@ namespace CreationKitPlatformExtended
const RelocationDatabaseItem* lpRelocationDatabaseItem)
{
auto verPatch = lpRelocationDatabaseItem->Version();
if ((verPatch == 1) || (verPatch == 2))
if (verPatch == 2)
{
//
// Force render window to draw at 60fps (SetTimer(10ms))
// DESC: BufferDesc.RefreshRate.Numerator = 60
//
lpRelocator->Patch(_RELDATA_RAV(0), { USER_TIMER_MINIMUM });

if (verPatch == 2)
if (!_READ_OPTION_BOOL("CreationKit", "bRenderWindowVSync", true))
// no VSync
lpRelocator->Patch(_RELDATA_RAV(1), { 0x33, 0xD2, 0x90 });

Expand Down
Binary file modified Creation Kit Platform Extended Core/Version/build_version.txt
Binary file not shown.
Binary file modified Creation Kit Platform Extended Core/Version/resource_version2.h
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions Database/FO4/1_10_162_0/FixBadPictureInRender.relb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fix Bad Picture In Render
1
extended
2AC6179 0 <nope>
Binary file not shown.
4 changes: 4 additions & 0 deletions Database/FO4/1_10_982_3/FixBadPictureInRender.relb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fix Bad Picture In Render
2
extended
2B55235 0 <nope>
36 changes: 18 additions & 18 deletions Database/SSE/1_5_73/Re-enableFogRendering.relb
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
Re-enable fog rendering
1
02E21DEF
02E21E43
02E21EEE
02E220B0
02E220B5
02E22124
02E1EA90
02E1E930
02D93405
013C9F92
013CA23F
013CA4C4
013CA6CD
02D9DAC0
04EE6FA8
059F51C8
059F51D8
02E21CF0
2E21DEF
2E21E43
2E21EEE
2E220B0
2E220B5
2E22124
2E1EA90
2E1E930
2D93405
13C9F92
13CA23F
13CA4C4
13CA6CD
2D9DAC0
4EE6FA8
59F51C8
59F51D8
2E21CF0
Binary file not shown.
2 changes: 1 addition & 1 deletion Database/SSE/1_6_1130/Re-enableFogRendering.relb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Re-enable fog rendering
2CF1700
2C65115
136CA32
136CB35
136CCDF
136CF64
136D182
2C6FC60
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion Database/SSE/1_6_1378_1/Re-enablefogrendering.relb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extended
2D2E160 0 <nope>
2CA1B55 128 74??488D0D????????E8????????4863F083FE0774??83FE0C7D??83FEFF75??4C8D05????????BA9B000000488D0D????????E8????????488B0D????????4C
139CFF2 0 <nope>
139D0F5 0 <nope>
139D2D2 0 <nope>
139D557 0 <nope>
139D775 0 <nope>
2CAC6A0 128 48895C24084889742410574883EC20418BF8488BDA488BF14885C974??488BD1488D0D????????E8????????0FBAE70A73??41B101488D0D????????4533C033
Expand Down
3 changes: 1 addition & 2 deletions Stuffs/FO4/CreationKitPlatformExtended.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ bVersionControlMergeWorkaround=false ; [Experimental] Workaround for version con
bBSPointerHandleExtremly=false ; [Experimental] Increase the maximum number of refs to 67.108.864 (for NG2 8.388.608). Use it at your own risk.

bINICache=true ; Abandoning outdated "profile" functions, using the cache, for fast reading and saving options.
bD3D11Patch=true ; Makes it possible to initialize both 11.0 and 11.2 version DirectX. So and fixed Nvidia NSight checks. Need Win8.1 and newer.
bGenerateCrashdumps=true ; Generate a dump in the game folder when the CK crashes.
bUnicode=false ; Translates UTF8 to ANSI when opening the plugin and back when saving.
bRenderWindow60FPS=true ; Force render window to always draw at 60 frames per second instead of 16.
bRenderWindowVSync=true ; Enabling vertical synchronization.
bDisableAssertions=false ; Remove assertion message popups (not recommended).
bSkipTopicInfoValidation=true ; Speed up initial plugin load by skipping topic info validation, it doesn't matter if forms validation is disabled (recommended - fix crashes).
bAllowSaveESM=true ; Allow saving master files directly & setting them as the active file in the Data File dialog. This will destroy version control information.
Expand Down
3 changes: 1 addition & 2 deletions Stuffs/SSE/CreationKitPlatformExtended.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ bEnableStateParentWorkaround=false ; [Experimental] Workaround for "Select Enab
bIgnoreGroundHeightTest=false ; [Experimental] Removes the error message when during navmesh generation in a Worldspace with "No Landscape" flag. Do NOT use this for anything else.

bINICache=true ; Abandoning outdated "profile" functions, using the cache, for fast reading and saving options.
bD3D11Patch=true ; Makes it possible to initialize both 11.0 and 11.2 version DirectX. So and fixed Nvidia NSight checks. Need Win8.1 and newer.
bGenerateCrashdumps=true ; Generate a dump in the game folder when the CK crashes.
bUnicode=false ; Translates UTF8 to ANSI when opening the plugin and back when saving.
bRenderWindow60FPS=true ; Force render window to always draw at 60 frames per second instead of 16.
bRenderWindowVSync=true ; Enabling vertical synchronization.
bDisableAssertions=false ; Remove assertion message popups (not recommended).
bSkipTopicInfoValidation=true ; Speed up initial plugin load by skipping topic info validation, it doesn't matter if forms validation is disabled (recommended - fix crashes).
bAllowSaveESM=true ; Allow saving master files directly & setting them as the active file in the Data File dialog. This will destroy version control information.
Expand Down

0 comments on commit b80b319

Please sign in to comment.