-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.steam.props
More file actions
121 lines (102 loc) · 6.16 KB
/
.steam.props
File metadata and controls
121 lines (102 loc) · 6.16 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets="RemoveMonoModBackports">
<!-- Steam Path Setup -->
<PropertyGroup>
<!-- On Windows: attempt to get the Steam install location from the registry -->
<_SteamRegPath>HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Valve\Steam</_SteamRegPath>
<SteamInstallPathFromRegistry Condition="'$(OS)' == 'Windows_NT'">$([MSBuild]::GetRegistryValueFromView('$(_SteamRegPath)', 'InstallPath', null, RegistryView.Registry32))</SteamInstallPathFromRegistry>
<!-- Use the registry value if available -->
<SteamDir Condition="'$(OS)' == 'Windows_NT' and '$(SteamInstallPathFromRegistry)' != ''">
$([MSBuild]::NormalizePath('$(SteamInstallPathFromRegistry)', 'steamapps'))
</SteamDir>
<!-- Default for Windows if registry lookup fails -->
<SteamDir Condition="'$(OS)' == 'Windows_NT' and '$(SteamInstallPathFromRegistry)' == ''">
$([MSBuild]::NormalizePath('C:', 'Program Files (x86)', 'Steam', 'steamapps'))
</SteamDir>
<!-- Default for non-Windows -->
<SteamDir Condition="'$(OS)' != 'Windows_NT'">$(HOME)/.steam/steam/steamapps</SteamDir>
<!-- Haste's App ID -->
<HasteAppId>1796470</HasteAppId>
<HarmonyWorkshopId>3408901301</HarmonyWorkshopId>
<SettingsLibWorkshopId>3462196533</SettingsLibWorkshopId>
<EnableHarmony Condition="'$(EnableHarmony)'==''">false</EnableHarmony>
<EnableSettingsLib Condition="'$(EnableSettingsLib)'==''">false</EnableSettingsLib>
</PropertyGroup>
<!-- Compute the path to the libraryfolders.vdf file -->
<PropertyGroup>
<CleanSteamDir>$([System.Text.RegularExpressions.Regex]::Replace('$(SteamDir)', '^\s+|\s+$', ''))</CleanSteamDir>
<LibraryFoldersFile>$([MSBuild]::NormalizePath('$(CleanSteamDir)', 'libraryfolders.vdf'))</LibraryFoldersFile>
</PropertyGroup>
<!-- Settings that don't depend on file contents -->
<PropertyGroup>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<GenerateDependencyFile>false</GenerateDependencyFile>
</PropertyGroup>
<!-- Target to extract and set the Steam library paths -->
<Target Name="ProcessSteamLibraryPaths" BeforeTargets="ResolveAssemblyReferences">
<!-- Read the libraryfolders.vdf file -->
<ReadLinesFromFile File="$(LibraryFoldersFile)" Condition="Exists('$(LibraryFoldersFile)')">
<Output TaskParameter="Lines" PropertyName="LibraryFileContent" />
</ReadLinesFromFile>
<!-- Extract the Steam library path that contains Haste -->
<PropertyGroup>
<!-- Look for the section with the HasteAppId and extract the path -->
<LibraryPathMatch>$([System.Text.RegularExpressions.Regex]::Match('$(LibraryFileContent)', '.*"path"\s+"([^"]+)".*"$(HasteAppId)"\s+').Groups[1].Value)</LibraryPathMatch>
<!-- If we found a match, use it; otherwise try to extract any path -->
<SteamLibraryPath Condition="'$(LibraryPathMatch)' != ''">$(LibraryPathMatch)</SteamLibraryPath>
<SteamLibraryPath Condition="'$(LibraryPathMatch)' == ''">$([System.Text.RegularExpressions.Regex]::Match('$(LibraryFileContent)', '.*"path"\s+"([^"]+)"').Groups[1].Value)</SteamLibraryPath>
<!-- Set HasteDir and Managed DLLs path -->
<HasteDir>$([MSBuild]::NormalizePath('$(SteamLibraryPath)', 'steamapps', 'common', 'Haste'))</HasteDir>
<HasteManagedDir>$([MSBuild]::NormalizePath('$(HasteDir)', 'Haste_Data', 'Managed'))</HasteManagedDir>
<WorkshopDir>$([MSBuild]::NormalizePath('$(SteamLibraryPath)', 'steamapps', 'workshop', 'content', '$(HasteAppId)'))</WorkshopDir>
<HarmonyWorkshopDir>$([MSBuild]::NormalizePath('$(WorkshopDir)', '$(HarmonyWorkshopId)', '0Harmony.dll'))</HarmonyWorkshopDir>
<SettingsLibWorkshopDir>$([MSBuild]::NormalizePath('$(WorkshopDir)', '$(SettingsLibWorkshopId)', 'SettingsLib.dll'))</SettingsLibWorkshopDir>
</PropertyGroup>
<Message Importance="high" Text="Extracted SteamLibraryPath: [$(SteamLibraryPath)]" />
<Message Importance="high" Text="HasteDir: [$(HasteDir)]" />
<Message Importance="high" Text="HasteManagedDir: [$(HasteManagedDir)]" />
<Message Importance="high" Text="EnableHarmony: [$(EnableHarmony)]" />
<Message Importance="high" Text="EnableSettingsLib: [$(EnableSettingsLib)]" />
<Message
Importance="high"
Text="Harmony: [$(HarmonyWorkshopDir)]"
Condition="'$(EnableHarmony)'=='true'" />
<Message
Importance="high"
Text="SettingsLib: [$(SettingsLibWorkshopDir)]"
Condition="'$(EnableSettingsLib)'=='true'" />
<!-- Add references for Haste Managed DLLs -->
<ItemGroup Condition="Exists('$(HasteManagedDir)')">
<Reference Include="$(HasteManagedDir)/*.dll" Private="false" />
</ItemGroup>
<!-- Make every class and property from the game public -->
<ItemGroup>
<PackageReference Include="Krafs.Publicizer" Version="2.3.0" PrivateAssets="all" />
<Publicize Include="Assembly-CSharp" />
<!--
... Add other DLLs you'd like to publicize here ...
Check out Krafs.Publicizer's documentation for more information: https://github.com/krafs/Publicizer#usage
-->
</ItemGroup>
<!-- Conditionally add references for the HarmonyX workshop item -->
<ItemGroup
Condition="'$(EnableHarmony)'=='true' and Exists('$(HarmonyWorkshopDir)')">
<Reference Include="$(HarmonyWorkshopDir)" Private="false" />
</ItemGroup>
<!-- Conditionally add references for the SettingsLib workshop item -->
<ItemGroup
Condition="'$(EnableSettingsLib)'=='true' and Exists('$(SettingsLibWorkshopDir)')">
<Reference Include="$(SettingsLibWorkshopDir)" Private="false" />
</ItemGroup>
</Target>
<!--
MonoMod.Backports.dll is required for MonoMod to work, but adding it as a reference causes issues,
as it contains a lot of types already included in Unity's standard library mscorlib.dll.
Exclude it from the globbed HasteManagedDir references using this snippet.
-->
<Target Name="RemoveMonoModBackports">
<ItemGroup>
<Reference Remove="@(Reference)" Condition="$([System.String]::new('%(Reference.Filename)').Contains('Backports'))"/>
</ItemGroup>
</Target>
</Project>