Skip to content

Commit

Permalink
Fixed Flip Discard emulation discarding the wrong surface in fullscre…
Browse files Browse the repository at this point in the history
…en mode
  • Loading branch information
Kaldaien committed Apr 8, 2022
1 parent 7a2be77 commit 651eefc
Show file tree
Hide file tree
Showing 16 changed files with 913 additions and 220 deletions.
20 changes: 12 additions & 8 deletions SpecialK.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
<VCToolsVersion>14.32.31114</VCToolsVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
Expand All @@ -50,6 +51,7 @@
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
<VCToolsVersion>14.32.31114</VCToolsVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
Expand Down Expand Up @@ -153,7 +155,7 @@
<LinkIncremental>false</LinkIncremental>
<MultiProcFXC>true</MultiProcFXC>
<CopyLocalDebugSymbols>false</CopyLocalDebugSymbols>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableMicrosoftCodeAnalysis>true</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release - AVX2|Win32'">
<OutDir>$(USERPROFILE)\Documents\My Mods\SpecialK\</OutDir>
Expand All @@ -167,7 +169,7 @@
<LinkIncremental>false</LinkIncremental>
<MultiProcFXC>true</MultiProcFXC>
<CopyLocalDebugSymbols>false</CopyLocalDebugSymbols>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableMicrosoftCodeAnalysis>true</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>SpecialK64</TargetName>
Expand All @@ -181,7 +183,7 @@
<MultiProcFXC>true</MultiProcFXC>
<IntDir>$(SolutionDir)build\$(Configuration)\x64\</IntDir>
<CopyLocalDebugSymbols>false</CopyLocalDebugSymbols>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableMicrosoftCodeAnalysis>true</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release - AVX2|x64'">
<TargetName>SpecialK64-AVX2</TargetName>
Expand All @@ -195,7 +197,7 @@
<MultiProcFXC>true</MultiProcFXC>
<IntDir>$(SolutionDir)build\$(Configuration)\x64\</IntDir>
<CopyLocalDebugSymbols>false</CopyLocalDebugSymbols>
<EnableMicrosoftCodeAnalysis>false</EnableMicrosoftCodeAnalysis>
<EnableMicrosoftCodeAnalysis>true</EnableMicrosoftCodeAnalysis>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down Expand Up @@ -245,6 +247,7 @@
<OmitFramePointers>true</OmitFramePointers>
<ErrorReporting>Send</ErrorReporting>
<DisableAnalyzeExternal>true</DisableAnalyzeExternal>
<SupportJustMyCode>false</SupportJustMyCode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down Expand Up @@ -355,6 +358,7 @@ if exist "$(TargetDir)$(TargetName).exp" ( del "$(TargetDir)$(TargetName).exp" )
<ErrorReporting>Send</ErrorReporting>
<DisableAnalyzeExternal>true</DisableAnalyzeExternal>
<GuardEHContMetadata>false</GuardEHContMetadata>
<SupportJustMyCode>false</SupportJustMyCode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down Expand Up @@ -460,7 +464,7 @@ if exist "$(TargetDir)$(TargetName).exp" ( del "$(TargetDir)$(TargetName).exp" )
<CompileAsWinRT>false</CompileAsWinRT>
<UseUnicodeForAssemblerListing>true</UseUnicodeForAssemblerListing>
<SupportJustMyCode>false</SupportJustMyCode>
<OmitFramePointers>false</OmitFramePointers>
<OmitFramePointers>true</OmitFramePointers>
<SupportJustMyCode>false</SupportJustMyCode>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<GuardEHContMetadata>false</GuardEHContMetadata>
Expand Down Expand Up @@ -585,7 +589,7 @@ if exist "$(TargetDir)$(TargetName).exp" ( del "$(TargetDir)$(TargetName).exp" )
<CompileAsWinRT>false</CompileAsWinRT>
<UseUnicodeForAssemblerListing>true</UseUnicodeForAssemblerListing>
<SupportJustMyCode>false</SupportJustMyCode>
<OmitFramePointers>false</OmitFramePointers>
<OmitFramePointers>true</OmitFramePointers>
<SupportJustMyCode>false</SupportJustMyCode>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<GuardEHContMetadata>false</GuardEHContMetadata>
Expand Down Expand Up @@ -711,7 +715,7 @@ if exist "$(TargetDir)$(TargetName).exp" ( del "$(TargetDir)$(TargetName).exp" )
<GuardEHContMetadata>false</GuardEHContMetadata>
<BrowseInformation>false</BrowseInformation>
<FloatingPointModel>Fast</FloatingPointModel>
<OmitFramePointers>false</OmitFramePointers>
<OmitFramePointers>true</OmitFramePointers>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<SDLCheck>false</SDLCheck>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
Expand Down Expand Up @@ -842,7 +846,7 @@ if exist "$(TargetDir)$(TargetName).exp" ( del "$(TargetDir)$(TargetName).exp" )
<GuardEHContMetadata>false</GuardEHContMetadata>
<BrowseInformation>false</BrowseInformation>
<FloatingPointModel>Fast</FloatingPointModel>
<OmitFramePointers>false</OmitFramePointers>
<OmitFramePointers>true</OmitFramePointers>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<SDLCheck>false</SDLCheck>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
Expand Down
1 change: 1 addition & 0 deletions include/SpecialK/injection/blacklist.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ static constexpr UNICODE_STRING __blacklist [] = {

SK_MakeUnicode (L"redprelauncher.exe"), // CD PROJEKT RED's pre-launcher included in the root of Cyberpunk 2077
SK_MakeUnicode (L"redlauncher.exe"), // CD PROJEKT RED's launcher located below %APPDATA%
SK_MakeUnicode (L"chronocross_launcher.exe"),
#endif

SK_MakeUnicode (L"postcrashdump.exe"),
Expand Down
17 changes: 17 additions & 0 deletions include/SpecialK/input/xinput.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ typedef struct _XINPUT_BATTERY_INFORMATION {
BYTE BatteryLevel;
} XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION;

typedef struct _XINPUT_KEYSTROKE {
WORD VirtualKey;
WCHAR Unicode;
WORD Flags;
BYTE UserIndex;
BYTE HidCode;
} XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE;


using XInputGetState_pfn = DWORD (WINAPI *)(
Expand Down Expand Up @@ -166,6 +173,16 @@ using XInputPowerOff_pfn = DWORD (WINAPI *)(
_In_ DWORD dwUserIndex
);

#define XINPUT_KEYSTROKE_KEYDOWN 0x0001
#define XINPUT_KEYSTROKE_KEYUP 0x0002
#define XINPUT_KEYSTROKE_REPEAT 0x0004

using XInputGetKeystroke_pfn = DWORD (WINAPI *)(
DWORD dwUserIndex,
DWORD dwReserved,
PXINPUT_KEYSTROKE pKeystroke
);


DWORD
WINAPI
Expand Down
18 changes: 18 additions & 0 deletions include/SpecialK/render/dxgi/dxgi_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -473,4 +473,22 @@ HRESULT SK_DXGI_OutputDebugString (const std::string& str, DXGI_INFO_QUEUE_MESSA
HRESULT SK_DXGI_ReportLiveObjects (IUnknown* pDev = nullptr);


static constexpr
BOOL
SK_DXGI_IsFlipModelSwapEffect (DXGI_SWAP_EFFECT swapEffect) noexcept
{
return
( swapEffect == DXGI_SWAP_EFFECT_FLIP_DISCARD ||
swapEffect == DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL );
}

static
BOOL
SK_DXGI_IsFlipModelSwapChain (const DXGI_SWAP_CHAIN_DESC& desc) noexcept
{
return
SK_DXGI_IsFlipModelSwapEffect (desc.SwapEffect);
};


#endif /* __SK__DXGI_BACKEND_H__ */
6 changes: 6 additions & 0 deletions include/SpecialK/storefront/achievements.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,19 @@ class SK_AchievementManager

void update (ISteamUserStats* stats)
{
if (stats == nullptr)
return;

stats->GetAchievementAndUnlockTime ( name_.c_str (),
&unlocked_,
(uint32_t *)&time_ );
}

void update_global (ISteamUserStats* stats)
{
if (stats == nullptr)
return;

// Reset to 0.0 on read failure
if (! stats->GetAchievementAchievedPercent (
name_.c_str (),
Expand Down

0 comments on commit 651eefc

Please sign in to comment.