Repository navigation
Expand file tree
/
Copy pathDisplayShadersPowerToy.csproj
More file actions
101 lines (85 loc) · 5.85 KB
/
Copy pathDisplayShadersPowerToy.csproj
File metadata and controls
101 lines (85 loc) · 5.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>DisplayShadersPowerToy</AssemblyName>
<Version>2.0.0</Version>
<Authors>Display Shaders PowerToy Contributors</Authors>
<Product>Display Shaders PowerToy</Product>
<Description>Real display shader support for OLED text rendering with DirectWrite hooks</Description>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
<!-- Exclude Tests folder from main compilation -->
<ItemGroup>
<Compile Remove="Tests\**" />
<EmbeddedResource Remove="Tests\**" />
<None Remove="Tests\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="2.0.1" />
</ItemGroup>
<!-- Native C++ Hook Project reference (if exists) -->
<ItemGroup>
<None Include="Native\DisplayShaderHook\**\*" />
</ItemGroup>
<ItemGroup>
<Folder Include="DllTest\" />
</ItemGroup>
<!-- Copy native DLL to output directory when built -->
<Target Name="CopyNativeDll" AfterTargets="Build">
<PropertyGroup>
<!-- Primary locations - Native subfolder -->
<NativeDllPath>$(ProjectDir)Native\DisplayShaderHook\bin\x64\$(Configuration)\DisplayShaderHook.dll</NativeDllPath>
<NativeDllPathRelease>$(ProjectDir)Native\DisplayShaderHook\bin\x64\Release\DisplayShaderHook.dll</NativeDllPathRelease>
<!-- Alternate locations - Solution root -->
<NativeDllPath2>$(SolutionDir)bin\x64\$(Configuration)\DisplayShaderHook.dll</NativeDllPath2>
<NativeDllPath3>$(SolutionDir)bin\x64\Release\DisplayShaderHook.dll</NativeDllPath3>
<!-- Additional fallback - parent directory -->
<NativeDllPath4>$(SolutionDir)..\bin\x64\$(Configuration)\DisplayShaderHook.dll</NativeDllPath4>
<NativeDllPath5>$(SolutionDir)..\bin\x64\Release\DisplayShaderHook.dll</NativeDllPath5>
</PropertyGroup>
<!-- Try primary location (Native subfolder, matching configuration) -->
<Copy SourceFiles="$(NativeDllPath)" DestinationFolder="$(OutputPath)" Condition="Exists('$(NativeDllPath)')" SkipUnchangedFiles="true">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
<Message Text="Copied DLL from: $(NativeDllPath)" Condition="Exists('$(NativeDllPath)')" Importance="high" />
<!-- Fallback to Release DLL in Native subfolder -->
<Copy SourceFiles="$(NativeDllPathRelease)" DestinationFolder="$(OutputPath)" Condition="!Exists('$(NativeDllPath)') And Exists('$(NativeDllPathRelease)')" SkipUnchangedFiles="true">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
<Message Text="Copied DLL from: $(NativeDllPathRelease) (fallback to Release)" Condition="!Exists('$(NativeDllPath)') And Exists('$(NativeDllPathRelease)')" Importance="high" />
<!-- Try solution root location -->
<Copy SourceFiles="$(NativeDllPath2)" DestinationFolder="$(OutputPath)" Condition="!Exists('$(NativeDllPath)') And !Exists('$(NativeDllPathRelease)') And Exists('$(NativeDllPath2)')" SkipUnchangedFiles="true">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
<Message Text="Copied DLL from: $(NativeDllPath2)" Condition="!Exists('$(NativeDllPath)') And !Exists('$(NativeDllPathRelease)') And Exists('$(NativeDllPath2)')" Importance="high" />
<!-- Try solution root Release location -->
<Copy SourceFiles="$(NativeDllPath3)" DestinationFolder="$(OutputPath)" Condition="!Exists('$(NativeDllPath)') And !Exists('$(NativeDllPathRelease)') And !Exists('$(NativeDllPath2)') And Exists('$(NativeDllPath3)')" SkipUnchangedFiles="true">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
<Message Text="Copied DLL from: $(NativeDllPath3)" Condition="!Exists('$(NativeDllPath)') And !Exists('$(NativeDllPathRelease)') And !Exists('$(NativeDllPath2)') And Exists('$(NativeDllPath3)')" Importance="high" />
<!-- Parent directory fallback -->
<Copy SourceFiles="$(NativeDllPath4)" DestinationFolder="$(OutputPath)" Condition="!Exists('$(NativeDllPath)') And !Exists('$(NativeDllPathRelease)') And !Exists('$(NativeDllPath2)') And !Exists('$(NativeDllPath3)') And Exists('$(NativeDllPath4)')" SkipUnchangedFiles="true">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
<!-- Final fallback -->
<Copy SourceFiles="$(NativeDllPath5)" DestinationFolder="$(OutputPath)" Condition="!Exists('$(NativeDllPath)') And !Exists('$(NativeDllPathRelease)') And !Exists('$(NativeDllPath2)') And !Exists('$(NativeDllPath3)') And !Exists('$(NativeDllPath4)') And Exists('$(NativeDllPath5)')" SkipUnchangedFiles="true">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
<!-- Log the final result -->
<Message Text="✓ Native DLL successfully copied to: $(OutputPath)DisplayShaderHook.dll" Condition="Exists('$(OutputPath)DisplayShaderHook.dll')" Importance="high" />
<Warning Text="⚠ Native DLL not found in any expected location. Searched:
 1. $(NativeDllPath)
 2. $(NativeDllPathRelease)
 3. $(NativeDllPath2)
 4. $(NativeDllPath3)

Shader injection will not be available. ClearType mode can still be used independently.

To build the DLL:
 1. Open Native\DisplayShaderHook\DisplayShaderHook.vcxproj in Visual Studio
 2. Build in Release configuration (x64)
 3. Rebuild this C# project" Condition="!Exists('$(OutputPath)DisplayShaderHook.dll')" />
</Target>
<!-- Copy SubpixelMasks folder to output -->
<Target Name="CopySubpixelMasks" AfterTargets="Build">
<ItemGroup>
<MaskFiles Include="SubpixelMasks\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(MaskFiles)" DestinationFolder="$(OutputPath)SubpixelMasks\%(RecursiveDir)" SkipUnchangedFiles="true" />
</Target>
</Project>