Skip to content

Commit

Permalink
You WIL(L) use COM for the IPC
Browse files Browse the repository at this point in the history
OLE!
  • Loading branch information
KimihikoAkayasaki committed Apr 7, 2024
1 parent aa5ee02 commit 0b5687b
Show file tree
Hide file tree
Showing 418 changed files with 3,810 additions and 2,512 deletions.
21 changes: 5 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,13 @@ jobs:
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.1

- name: Restore and build (publish)
run: msbuild /restore /p:Platform=x64 /p:PlatformTarget=x64 /p:Configuration=Release /p:RuntimeIdentifier=win10-x64 /t:plugin_OpenVR:Publish /p:PublishProfile=plugin_OpenVR\Properties\PublishProfiles\FolderProfile.pubxml

- name: Build the OpenVR driver
run: msbuild /restore /p:Platform=x64 /p:PlatformTarget=x64 /p:Configuration=Release /p:RuntimeIdentifier=win10-x64 /t:driver_Amethyst

- name: Deploy the dotnet runtime
run: Copy-Item -Path "C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.5\*" -Destination plugin_OpenVR\bin\Release\net7.0\win10-x64\publish\Driver\Amethyst\bin\win64\ -PassThru

- name: Replace IJW and FXR with prepared prebuilts
shell: pwsh
run: |
$(New-Object System.Net.WebClient).DownloadFile("https://github.com/KimihikoAkayasaki/runtime/releases/download/v7.0.0-fakefxr/comhost.dll", "plugin_OpenVR\bin\Release\net7.0\win10-x64\publish\Driver\Amethyst\bin\win64\comhost.dll")
$(New-Object System.Net.WebClient).DownloadFile("https://github.com/KimihikoAkayasaki/runtime/releases/download/v7.0.0-fakefxr/coreclr.dll", "plugin_OpenVR\bin\Release\net7.0\win10-x64\publish\Driver\Amethyst\bin\win64\coreclr.dll")
$(New-Object System.Net.WebClient).DownloadFile("https://github.com/KimihikoAkayasaki/runtime/releases/download/v7.0.0-fakefxr/hostfxr.dll", "plugin_OpenVR\bin\Release\net7.0\win10-x64\publish\Driver\Amethyst\bin\win64\hostfxr.dll")
$(New-Object System.Net.WebClient).DownloadFile("https://github.com/KimihikoAkayasaki/runtime/releases/download/v7.0.0-fakefxr/hostpolicy.dll", "plugin_OpenVR\bin\Release\net7.0\win10-x64\publish\Driver\Amethyst\bin\win64\hostpolicy.dll")
$(New-Object System.Net.WebClient).DownloadFile("https://github.com/KimihikoAkayasaki/runtime/releases/download/v7.0.0-fakefxr/ijwhost.dll", "plugin_OpenVR\bin\Release\net7.0\win10-x64\publish\Driver\Amethyst\bin\win64\ijwhost.dll")
$(New-Object System.Net.WebClient).DownloadFile("https://github.com/KimihikoAkayasaki/runtime/releases/download/v7.0.0-fakefxr/nethost.dll", "plugin_OpenVR\bin\Release\net7.0\win10-x64\publish\Driver\Amethyst\bin\win64\nethost.dll")
nuget restore
msbuild /restore /p:Platform=x64 /p:PlatformTarget=x64 /p:Configuration=Release /p:RuntimeIdentifier=win10-x64 /t:driver_Amethyst
- name: Restore and build (publish)
run: msbuild /restore /p:Platform=x64 /p:PlatformTarget=x64 /p:Configuration=Release /p:RuntimeIdentifier=win10-x64 /t:plugin_OpenVR:Publish /p:PublishProfile=plugin_OpenVR\Properties\PublishProfiles\FolderProfile.pubxml

- name: Pack published files
run: |
Expand Down
53 changes: 53 additions & 0 deletions Common/Common.vcxitems
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<ItemsProjectGuid>{8a1baf89-44d0-4bbf-a64d-35e6ebebed06}</ItemsProjectGuid>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectCapability Include="SourceItemsFromImports" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(MSBuildThisFileDirectory)appinfo.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)arch.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)config\activeinactivetaskbarappearance.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)config\ruledtaskbarappearance.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)simplefactory.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)undoc\explorer.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)undoc\winternl.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)util\color.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)config\config.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)config\optionaltaskbarappearance.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)config\rapidjsonhelper.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)config\taskbarappearance.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)config\windowfilter.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)constants.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)redefgetcurrenttime.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)undefgetcurrenttime.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)undoc\user32.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)undoc\uxtheme.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)undoc\winuser.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)util\concepts.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)util\hash.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)util\maybe_delete.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)util\null_terminated_string_view.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)util\numbers.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)util\strings.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)util\string_macros.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)util\thread_independent_mutex.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)util\type_traits.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)version.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)wilx.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)win32.hpp" />
<ClInclude Include="$(MSBuildThisFileDirectory)winrt.hpp" />
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)CppProject.props" />
</ItemGroup>
</Project>
227 changes: 227 additions & 0 deletions Common/CppProject.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
<?xml version="1.0" encoding="utf-8"?>

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<UseDebugLibraries>true</UseDebugLibraries>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Release'">
<UseDebugLibraries>false</UseDebugLibraries>
<LinkIncremental>false</LinkIncremental>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>

<PropertyGroup Label="Globals">
<CharacterSet>Unicode</CharacterSet>
<Keyword>Win32Proj</Keyword>
<DefaultLanguage>en-US</DefaultLanguage>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<SpectreMitigation>Spectre</SpectreMitigation>

<!-- Versions -->
<PlatformToolset Condition="'$(PlatformToolset)'==''">v143</PlatformToolset>
<VCProjectVersion>16.0</VCProjectVersion>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)'==''">17.0</MinimumVisualStudioVersion>
<WindowsTargetPlatformVersion>10.0.22621.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.18362.0</WindowsTargetPlatformMinVersion>

<!-- WinRT -->
<CppWinRTLibs>false</CppWinRTLibs>
<CppWinRTFastAbi>true</CppWinRTFastAbi>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>

<SignToolDigestAlgorithm Condition="'$(SignToolDigestAlgorithm)'==''">sha512</SignToolDigestAlgorithm>

<SignToolTimestampServer Condition="'$(CertificateTimestampServer)'!=''">/tr "$(CertificateTimestampServer)" /td $(SignToolDigestAlgorithm)</SignToolTimestampServer>
<SignToolTimestampServer Condition="'$(CertificateTimestampServer)'==''"></SignToolTimestampServer>

<SignToolSignatureMethod Condition="'$(CertificateThumbprint)'!=''">/sha1 $(CertificateThumbprint)</SignToolSignatureMethod>
<SignToolSignatureMethod Condition="'$(AcsMetadata)'!=''">/dlib "$(AzureCodeSigningDlibBinFolder)\$(SignToolArchitecture)\Azure.CodeSigning.Dlib.dll" /dmdf "$(AcsMetadata)"</SignToolSignatureMethod>

<VcpkgEnableManifest>true</VcpkgEnableManifest>
<VcpkgTriplet>$(Platform.ToLowerInvariant())-windows</VcpkgTriplet>
<VcpkgAdditionalInstallOptions>--overlay-ports="$(SolutionDir)\vcpkg\ports"</VcpkgAdditionalInstallOptions>

<BuildType Condition="'$(BuildType)'==''">Dev</BuildType>
<IntBuildType Condition="'$(BuildType)'=='Release'">0</IntBuildType>
<IntBuildType Condition="'$(BuildType)'=='Canary'">1</IntBuildType>
<IntBuildType Condition="'$(IntBuildType)'==''">2</IntBuildType>
</PropertyGroup>

<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<Link>
<!-- Debug information -->
<GenerateDebugInformation>true</GenerateDebugInformation>

<!-- Optimization -->
<OptimizeReferences>false</OptimizeReferences>
</Link>
</ItemDefinitionGroup>

<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<!-- Warnings and errors -->
<TreatWarningAsError>true</TreatWarningAsError>

<!-- Optimization -->
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<OmitFramePointers>true</OmitFramePointers>
<Optimization>MaxSpeed</Optimization>

<!-- Trim the prefix from embedded file paths -->
<AdditionalOptions>/d1trimfile:"$(SolutionDir)\" %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<!-- Warnings and errors -->
<TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors>

<!-- Debug information -->
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<SetChecksum>true</SetChecksum>

<!-- Optimization -->
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<OptimizeReferences>true</OptimizeReferences>

<!-- Disable PDB paths and strip timestamps from output -->
<AdditionalOptions>/pdbaltpath:%_PDB% /Brepro %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>

<ItemDefinitionGroup Condition="'$(Platform)'=='x64'">
<ClCompile>
<!-- SSE2 is always available on x64 -->
<PreprocessorDefinitions>RAPIDJSON_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<IntelJCCErratum>true</IntelJCCErratum>
<GuardEHContMetadata>true</GuardEHContMetadata>
</ClCompile>
<Link>
<CETCompat Condition="'$(Configuration)'=='Release'">true</CETCompat>
</Link>
</ItemDefinitionGroup>

<ItemDefinitionGroup Condition="'$(Platform)'=='ARM64'">
<ClCompile>
<!-- Windows requires NEON on any ARM64 processor, see https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions -->
<PreprocessorDefinitions>RAPIDJSON_NEON;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>

<ItemDefinitionGroup Condition="'$(SkipSigning)'!='True' And ('$(CertificateThumbprint)'!='' Or '$(AcsMetadata)'!='')">
<ClCompile>
<PreprocessorDefinitions>SIGNED_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalOptions>/ALLOWBIND:NO %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(AcsMetadata)'!=''">/INTEGRITYCHECK %(AdditionalOptions)</AdditionalOptions>
</Link>
<CustomBuildStep>
<Command>"$(WindowsSDKBuildToolsBinVersionedArchFolder)\signtool.exe" sign /ph $(SignToolTimestampServer) /fd $(SignToolDigestAlgorithm) $(SignToolSignatureMethod) "$(TargetPath)" > "$(OutDir)sign\$(ProjectName)-sign.out"</Command>
<Message>Signing $(TargetPath)</Message>
<Inputs>$(TargetPath)</Inputs>
<Outputs>$(OutDir)sign\$(ProjectName)-sign.out</Outputs>
</CustomBuildStep>
</ItemDefinitionGroup>

<ItemDefinitionGroup Label="Globals">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<SDLCheck>true</SDLCheck>
<AdditionalOptions>/ZH:SHA_256 /utf-8 /Zc:__cplusplus /Zc:externConstexpr %(AdditionalOptions)</AdditionalOptions>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ControlFlowGuard>Guard</ControlFlowGuard>

<!-- We don't use modules yet and they conflict with PCHes -->
<BuildStlModules>false</BuildStlModules>

<!-- PCH -->
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>

<!-- Language version and conformance -->
<LanguageStandard>stdcpplatest</LanguageStandard>
<ConformanceMode>true</ConformanceMode>
<UseStandardPreprocessor>true</UseStandardPreprocessor>

<!-- Warnings and errors -->
<WarningLevel>Level4</WarningLevel>
<DiagnosticsFormat>Caret</DiagnosticsFormat>
<UseFullPaths>true</UseFullPaths>

<!-- RapidJSON -->
<PreprocessorDefinitions>RAPIDJSON_HAS_STDSTRING=1;RAPIDJSON_ERROR_CHARTYPE=wchar_t;RAPIDJSON_ERROR_STRING=UTIL_WIDEN;%(PreprocessorDefinitions)</PreprocessorDefinitions>

<!-- member_thunk -->
<PreprocessorDefinitions>MEMBER_THUNK_DEFAULT_HEAP_SAFETY=3;%(PreprocessorDefinitions)</PreprocessorDefinitions>

<!-- spdlog -->
<PreprocessorDefinitions>SPDLOG_DISABLE_DEFAULT_LOGGER;SPDLOG_NO_NAME;SPDLOG_NO_THREAD_ID;SPDLOG_NO_TLS;SPDLOG_USE_STD_FORMAT;SPDLOG_WCHAR_TO_UTF8_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>

<!-- wil -->
<PreprocessorDefinitions>RESULT_SUPPRESS_STATIC_INITIALIZERS;WIL_LOCK_EXCEPTION_MODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>

<!-- Windows -->
<PreprocessorDefinitions>_HIDE_GLOBAL_ASYNC_STATUS;STRICT_TYPED_ITEMIDS;NOMINMAX;_WINDOWS;WIN32_LEAN_AND_MEAN;WINRT_WINDOWS_ABI;%(PreprocessorDefinitions)</PreprocessorDefinitions>

<PreprocessorDefinitions>BUILD_TYPE=$(IntBuildType);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ResourceCompile>
<NullTerminateStrings>true</NullTerminateStrings>
<PreprocessorDefinitions>BUILD_TYPE=$(IntBuildType);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>

<ImportGroup Label="Shared">
<Import Project="Common.vcxitems" Label="Shared" />
</ImportGroup>

<Target Name="MakeWinMDReferencesNonPrivate" BeforeTargets="ResolveAssemblyReferences">
<ItemGroup>
<_TemporaryReferences Include="@(Reference)" Condition="'%(Extension)' == '.winmd' And '%(Reference.Private)' == ''" />
<Reference Remove="@(_TemporaryReferences)" />
<Reference Include="@(_TemporaryReferences)">
<Private>false</Private>
</Reference>
</ItemGroup>
</Target>

<Target Name="RemoveWebView2" BeforeTargets="ResolveAssemblyReferences">
<ItemGroup>
<_WebView2Reference Include="@(Reference)" Condition="'%(Filename)' == 'Microsoft.Web.WebView2.Core'" />
<Reference Remove="@(_WebView2Reference)" />
<Reference Include="@(_WebView2Reference)" RemoveMetadata="Implementation" />

<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)"
Condition="'%(Filename)' == 'Microsoft.Web.WebView2.Core'" />
</ItemGroup>
</Target>
</Project>
18 changes: 18 additions & 0 deletions Common/appinfo.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once
#include "util/string_macros.hpp"

#if defined(BUILD_TYPE) && BUILD_TYPE == 0
#define UTF8_APP_NAME "TranslucentTB"
#elif defined(BUILD_TYPE) && BUILD_TYPE == 1
#define UTF8_APP_NAME "TranslucentTB (Canary)"
#else
#define UTF8_APP_NAME "TranslucentTB (Dev)"
#endif

#define APP_NAME UTIL_WIDEN(UTF8_APP_NAME)

#define APP_COPYRIGHT_YEAR_NUM 2024
#define APP_COPYRIGHT_YEAR UTIL_STRINGIFY(APP_COPYRIGHT_YEAR_NUM)

#define APP_VERSION_FIXED 1,0,0,1
#define APP_VERSION UTIL_WIDEN("1.0.0.1")
15 changes: 15 additions & 0 deletions Common/arch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

// Those are defines required by various Windows headers to build.

#if defined(_M_AMD64)
# ifndef _AMD64_
# define _AMD64_
# endif
#elif defined(_M_ARM64)
# ifndef _ARM64_
# define _ARM64_
# endif
#else
# error "Target architecture not recognized"
#endif
Loading

0 comments on commit 0b5687b

Please sign in to comment.