[
  {
    "path": ".gitignore",
    "content": "## Ignore Visual Studio temporary files, build results, and\r\n## files generated by popular Visual Studio add-ons.\r\n##\r\n## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore\r\n\r\n# User-specific folders\r\nCertificates/\r\nZip/\r\n\r\n# Autogenerated files\r\nReleaseVersioning/Version.props\r\nReleaseVersioning/VersionStrings.h\r\nReleaseVersioning/VersionStrings.cs\r\nHID Wiimote Control Center/Properties/VersionStrings.cs\r\n\r\n# User-specific files\r\n*.suo\r\n*.user\r\n*.userosscache\r\n*.sln.docstates\r\n\r\n# User-specific files (MonoDevelop/Xamarin Studio)\r\n*.userprefs\r\n\r\n# Build results\r\n[Dd]ebug/\r\n[Dd]ebugPublic/\r\n[Rr]elease/\r\n[Rr]eleases/\r\nx64/\r\nx86/\r\nbld/\r\n[Bb]in/\r\n[Oo]bj/\r\n[Ll]og/\r\n\r\n# Visual Studio 2015 cache/options directory\r\n.vs/\r\n# Uncomment if you have tasks that create the project's static files in wwwroot\r\n#wwwroot/\r\n\r\n# MSTest test Results\r\n[Tt]est[Rr]esult*/\r\n[Bb]uild[Ll]og.*\r\n\r\n# NUNIT\r\n*.VisualState.xml\r\nTestResult.xml\r\n\r\n# Build Results of an ATL Project\r\n[Dd]ebugPS/\r\n[Rr]eleasePS/\r\ndlldata.c\r\n\r\n# Benchmark Results\r\nBenchmarkDotNet.Artifacts/\r\n\r\n# .NET Core\r\nproject.lock.json\r\nproject.fragment.lock.json\r\nartifacts/\r\n**/Properties/launchSettings.json\r\n\r\n*_i.c\r\n*_p.c\r\n*_i.h\r\n*.ilk\r\n*.meta\r\n*.obj\r\n*.pch\r\n*.pdb\r\n*.pgc\r\n*.pgd\r\n*.rsp\r\n*.sbr\r\n*.tlb\r\n*.tli\r\n*.tlh\r\n*.tmp\r\n*.tmp_proj\r\n*.log\r\n*.vspscc\r\n*.vssscc\r\n.builds\r\n*.pidb\r\n*.svclog\r\n*.scc\r\n*.snk\r\n\r\n# Chutzpah Test files\r\n_Chutzpah*\r\n\r\n# Visual C++ cache files\r\nipch/\r\n*.aps\r\n*.ncb\r\n*.opendb\r\n*.opensdf\r\n*.sdf\r\n*.cachefile\r\n*.VC.db\r\n*.VC.VC.opendb\r\n\r\n# Visual Studio profiler\r\n*.psess\r\n*.vsp\r\n*.vspx\r\n*.sap\r\n\r\n# TFS 2012 Local Workspace\r\n$tf/\r\n\r\n# Guidance Automation Toolkit\r\n*.gpState\r\n\r\n# ReSharper is a .NET coding add-in\r\n_ReSharper*/\r\n*.[Rr]e[Ss]harper\r\n*.DotSettings.user\r\n\r\n# JustCode is a .NET coding add-in\r\n.JustCode\r\n\r\n# TeamCity is a build add-in\r\n_TeamCity*\r\n\r\n# DotCover is a Code Coverage Tool\r\n*.dotCover\r\n\r\n# Visual Studio code coverage results\r\n*.coverage\r\n*.coveragexml\r\n\r\n# NCrunch\r\n_NCrunch_*\r\n.*crunch*.local.xml\r\nnCrunchTemp_*\r\n\r\n# MightyMoose\r\n*.mm.*\r\nAutoTest.Net/\r\n\r\n# Web workbench (sass)\r\n.sass-cache/\r\n\r\n# Installshield output folder\r\n[Ee]xpress/\r\n\r\n# DocProject is a documentation generator add-in\r\nDocProject/buildhelp/\r\nDocProject/Help/*.HxT\r\nDocProject/Help/*.HxC\r\nDocProject/Help/*.hhc\r\nDocProject/Help/*.hhk\r\nDocProject/Help/*.hhp\r\nDocProject/Help/Html2\r\nDocProject/Help/html\r\n\r\n# Click-Once directory\r\npublish/\r\n\r\n# Publish Web Output\r\n*.[Pp]ublish.xml\r\n*.azurePubxml\r\n# TODO: Comment the next line if you want to checkin your web deploy settings\r\n# but database connection strings (with potential passwords) will be unencrypted\r\n*.pubxml\r\n*.publishproj\r\n\r\n# Microsoft Azure Web App publish settings. Comment the next line if you want to\r\n# checkin your Azure Web App publish settings, but sensitive information contained\r\n# in these scripts will be unencrypted\r\nPublishScripts/\r\n\r\n# NuGet Packages\r\n*.nupkg\r\n# The packages folder can be ignored because of Package Restore\r\n**/packages/*\r\n# except build/, which is used as an MSBuild target.\r\n!**/packages/build/\r\n# Uncomment if necessary however generally it will be regenerated when needed\r\n#!**/packages/repositories.config\r\n# NuGet v3's project.json files produces more ignorable files\r\n*.nuget.props\r\n*.nuget.targets\r\n\r\n# Microsoft Azure Build Output\r\ncsx/\r\n*.build.csdef\r\n\r\n# Microsoft Azure Emulator\r\necf/\r\nrcf/\r\n\r\n# Windows Store app package directories and files\r\nAppPackages/\r\nBundleArtifacts/\r\nPackage.StoreAssociation.xml\r\n_pkginfo.txt\r\n*.appx\r\n\r\n# Visual Studio cache files\r\n# files ending in .cache can be ignored\r\n*.[Cc]ache\r\n# but keep track of directories ending in .cache\r\n!*.[Cc]ache/\r\n\r\n# Others\r\nClientBin/\r\n~$*\r\n*~\r\n*.dbmdl\r\n*.dbproj.schemaview\r\n*.jfm\r\n*.pfx\r\n*.publishsettings\r\norleans.codegen.cs\r\n\r\n# Since there are multiple workflows, uncomment next line to ignore bower_components\r\n# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)\r\n#bower_components/\r\n\r\n# RIA/Silverlight projects\r\nGenerated_Code/\r\n\r\n# Backup & report files from converting an old project file\r\n# to a newer Visual Studio version. Backup files are not needed,\r\n# because we have git ;-)\r\n_UpgradeReport_Files/\r\nBackup*/\r\nUpgradeLog*.XML\r\nUpgradeLog*.htm\r\n\r\n# SQL Server files\r\n*.mdf\r\n*.ldf\r\n*.ndf\r\n\r\n# Business Intelligence projects\r\n*.rdl.data\r\n*.bim.layout\r\n*.bim_*.settings\r\n\r\n# Microsoft Fakes\r\nFakesAssemblies/\r\n\r\n# GhostDoc plugin setting file\r\n*.GhostDoc.xml\r\n\r\n# Node.js Tools for Visual Studio\r\n.ntvs_analysis.dat\r\nnode_modules/\r\n\r\n# Typescript v1 declaration files\r\ntypings/\r\n\r\n# Visual Studio 6 build log\r\n*.plg\r\n\r\n# Visual Studio 6 workspace options file\r\n*.opt\r\n\r\n# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)\r\n*.vbw\r\n\r\n# Visual Studio LightSwitch build output\r\n**/*.HTMLClient/GeneratedArtifacts\r\n**/*.DesktopClient/GeneratedArtifacts\r\n**/*.DesktopClient/ModelManifest.xml\r\n**/*.Server/GeneratedArtifacts\r\n**/*.Server/ModelManifest.xml\r\n_Pvt_Extensions\r\n\r\n# Paket dependency manager\r\n.paket/paket.exe\r\npaket-files/\r\n\r\n# FAKE - F# Make\r\n.fake/\r\n\r\n# JetBrains Rider\r\n.idea/\r\n*.sln.iml\r\n\r\n# CodeRush\r\n.cr/\r\n\r\n# Python Tools for Visual Studio (PTVS)\r\n__pycache__/\r\n*.pyc\r\n\r\n# Cake - Uncomment if you are using it\r\n# tools/**\r\n# !tools/packages.config\r\n\r\n# Tabs Studio\r\n*.tss\r\n\r\n# Telerik's JustMock configuration file\r\n*.jmconfig\r\n\r\n# BizTalk build output\r\n*.btp.cs\r\n*.btm.cs\r\n*.odx.cs\r\n*.xsd.cs\r\n"
  },
  {
    "path": "BuildAndZip/BuildAndZip.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Windows 10 Universal Release|Win32\">\r\n      <Configuration>Windows 10 Universal Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Universal Release|x64\">\r\n      <Configuration>Windows 10 Universal Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Release|Win32\">\r\n      <Configuration>Windows 10 Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Release|x64\">\r\n      <Configuration>Windows 10 Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{0C56BAEE-4F6C-4590-9E48-EFBF80099FEB}</ProjectGuid>\r\n    <RootNamespace>BuildAndZip</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <ConfigurationType>Utility</ConfigurationType>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\" Label=\"Configuration\">\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <ConfigurationType>Utility</ConfigurationType>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <ConfigurationType>Utility</ConfigurationType>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\" Label=\"Configuration\">\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <ConfigurationType>Utility</ConfigurationType>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\">\r\n    <Import Project=\"..\\ReleaseVersioning\\Version.props\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\">\r\n    <ZipTool>$(SolutionDir)BuildTools\\7za\\7za.exe</ZipTool>\r\n    <ZipDir>$(SolutionDir)Zip</ZipDir>\r\n    <ZipName>$(SolutionName.replace(' ','-'))-$(ControlCenterVersion)_$(PlatformArchitecture)Bit.zip</ZipName>\r\n    <ZipPath>$(ZipDir)\\$(ZipName)</ZipPath>\r\n    <PackageDir>$(SolutionDir)$(PlatformShortName)\\$(Configuration.replace(\" \",\"\"))\\HID Wiimote Package</PackageDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">\r\n    <OutDir>$(PlatformShortName)\\$(Configuration)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(Configuration)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\">\r\n    <OutDir>$(PlatformShortName)\\$(Configuration)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(Configuration)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n    <OutDir>$(PlatformShortName)\\$(Configuration)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(Configuration)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\">\r\n    <OutDir>$(PlatformShortName)\\$(Configuration)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(Configuration)\\</IntDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">\r\n    <PostBuildEvent>\r\n      <Command>if not exist \"$(ZipDir)\" mkdir \"$(ZipDir)\"\r\n\"$(ZipTool)\" d \"$(ZipPath)\"\r\n\"$(ZipTool)\" a \"$(ZipPath)\" \"$(PackageDir)\\*\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\">\r\n    <PostBuildEvent>\r\n      <Command>if not exist \"$(ZipDir)\" mkdir \"$(ZipDir)\"\r\n\"$(ZipTool)\" d \"$(ZipPath)\"\r\n\"$(ZipTool)\" a \"$(ZipPath)\" \"$(PackageDir)\\*\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n    <PostBuildEvent>\r\n      <Command>if not exist \"$(ZipDir)\" mkdir \"$(ZipDir)\"\r\n\"$(ZipTool)\" d \"$(ZipPath)\"\r\n\"$(ZipTool)\" a \"$(ZipPath)\" \"$(PackageDir)\\*\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\">\r\n    <PostBuildEvent>\r\n      <Command>if not exist \"$(ZipDir)\" mkdir \"$(ZipDir)\"\r\n\"$(ZipTool)\" d \"$(ZipPath)\"\r\n\"$(ZipTool)\" a \"$(ZipPath)\" \"$(PackageDir)\\*\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "BuildAndZip/BuildAndZip.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" />"
  },
  {
    "path": "BuildTools/7za/license.txt",
    "content": "      7-Zip Command line version\n      ~~~~~~~~~~~~~~~~~~~~~~~~~~\n      License for use and distribution\n      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n      7-Zip Copyright (C) 1999-2010 Igor Pavlov.\n\n      7za.exe is distributed under the GNU LGPL license\n\n      Notes: \n        You can use 7-Zip on any computer, including a computer in a commercial \n        organization. You don't need to register or pay for 7-Zip.\n\n\n      GNU LGPL information\n      --------------------\n\n        This library is free software; you can redistribute it and/or\n        modify it under the terms of the GNU Lesser General Public\n        License as published by the Free Software Foundation; either\n        version 2.1 of the License, or (at your option) any later version.\n\n        This library is distributed in the hope that it will be useful,\n        but WITHOUT ANY WARRANTY; without even the implied warranty of\n        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n        Lesser General Public License for more details.\n\n        You can receive a copy of the GNU Lesser General Public License from \n        http://www.gnu.org/\n"
  },
  {
    "path": "BuildTools/7za/readme.txt",
    "content": "7-Zip Command line version 9.20\n-------------------------------\n\n7-Zip is a file archiver with high compression ratio.\n7za.exe is a standalone command line version of 7-Zip.\n\n7-Zip Copyright (C) 1999-2010 Igor Pavlov.\n\nFeatures of 7za.exe: \n  - High compression ratio in new 7z format\n  - Supported formats:\n      - Packing / unpacking: 7z, xz, ZIP, GZIP, BZIP2 and TAR \n      - Unpacking only: Z, lzma\n  - Highest compression ratio for ZIP and GZIP formats.\n  - Fast compression and decompression\n  - Strong AES-256 encryption in 7z and ZIP formats.\n\n7za.exe is a free software distributed under the GNU LGPL.\nRead license.txt for more information.\n\nSource code of 7za.exe and 7-Zip can be found at\nhttp://www.7-zip.org/\n\n7za.exe can work in Windows 95/98/ME/NT/2000/2003/2008/XP/Vista/7.\n\nThere is also port of 7za.exe for POSIX systems like Unix (Linux, Solaris, OpenBSD, \nFreeBSD, Cygwin, AIX, ...), MacOS X and BeOS:\n\nhttp://p7zip.sourceforge.net/\n\n\n  This distributive packet contains the following files:\n\n  7za.exe       - 7-Zip standalone command line version.\n  readme.txt    - This file.\n  license.txt   - License information.\n  7-zip.chm     - User's Manual in HTML Help format.\n\n\n---\nEnd of document\n"
  },
  {
    "path": "HID Miniport/HID Miniport.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Windows 10 Universal Debug|Win32\">\r\n      <Configuration>Windows 10 Universal Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Universal Debug|x64\">\r\n      <Configuration>Windows 10 Universal Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Universal Release|Win32\">\r\n      <Configuration>Windows 10 Universal Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Universal Release|x64\">\r\n      <Configuration>Windows 10 Universal Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Debug|Win32\">\r\n      <Configuration>Windows 10 Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Release|Win32\">\r\n      <Configuration>Windows 10 Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Debug|x64\">\r\n      <Configuration>Windows 10 Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Release|x64\">\r\n      <Configuration>Windows 10 Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}</ProjectGuid>\r\n    <TemplateGuid>{dd38f7fc-d7bd-488b-9242-7d8754cde80d}</TemplateGuid>\r\n    <Configuration>Win8 Debug</Configuration>\r\n    <Platform Condition=\"'$(Platform)' == ''\">Win32</Platform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <RootNamespace>HID_Miniport</RootNamespace>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"PropertySheets\">\r\n    <ConfigurationType>Driver</ConfigurationType>\r\n    <DriverType>WDM</DriverType>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|Win32'\">\r\n    <TargetVersion>Windows10</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>\r\n    </TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n    <DriverTargetPlatform>Universal</DriverTargetPlatform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n    <TargetVersion>Windows10</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>\r\n    </TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n    <DriverTargetPlatform>Universal</DriverTargetPlatform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|x64'\">\r\n    <TargetVersion>Windows10</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>\r\n    </TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n    <DriverTargetPlatform>Universal</DriverTargetPlatform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">\r\n    <TargetVersion>Windows10</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>\r\n    </TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n    <DriverTargetPlatform>Universal</DriverTargetPlatform>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup>\r\n    <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|x64'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n    <DriverSign>\r\n      <FileDigestAlgorithm>SHA256</FileDigestAlgorithm>\r\n    </DriverSign>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|x64'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n    <DriverSign>\r\n      <FileDigestAlgorithm>SHA256</FileDigestAlgorithm>\r\n    </DriverSign>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|Win32'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n    <DriverSign>\r\n      <FileDigestAlgorithm>SHA256</FileDigestAlgorithm>\r\n    </DriverSign>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|Win32'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n    <DriverSign>\r\n      <FileDigestAlgorithm>SHA256</FileDigestAlgorithm>\r\n    </DriverSign>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <FilesToPackage Include=\"$(TargetPath)\" />\r\n    <FilesToPackage Include=\"@(Inf->'%(CopyOutput)')\" Condition=\"'@(Inf)'!=''\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"Hidminiport.c\" />\r\n    <ClCompile Include=\"Trace.c\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"Hidminiport.h\" />\r\n    <ClInclude Include=\"resource.h\" />\r\n    <ClInclude Include=\"Trace.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"HID Miniport.rc\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "HID Miniport/HID Miniport.vcxproj.backup",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Win8 Debug|Win32\">\r\n      <Configuration>Win8 Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win8 Release|Win32\">\r\n      <Configuration>Win8 Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win7 Debug|Win32\">\r\n      <Configuration>Win7 Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win7 Release|Win32\">\r\n      <Configuration>Win7 Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Vista Debug|Win32\">\r\n      <Configuration>Vista Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Vista Release|Win32\">\r\n      <Configuration>Vista Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win8 Debug|x64\">\r\n      <Configuration>Win8 Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win8 Release|x64\">\r\n      <Configuration>Win8 Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win7 Debug|x64\">\r\n      <Configuration>Win7 Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win7 Release|x64\">\r\n      <Configuration>Win7 Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Vista Debug|x64\">\r\n      <Configuration>Vista Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Vista Release|x64\">\r\n      <Configuration>Vista Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}</ProjectGuid>\r\n    <TemplateGuid>{dd38f7fc-d7bd-488b-9242-7d8754cde80d}</TemplateGuid>\r\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r\n    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>\r\n    <Configuration>Win8 Debug</Configuration>\r\n    <Platform Condition=\"'$(Platform)' == ''\">Win32</Platform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <RootNamespace>HID_Miniport</RootNamespace>\r\n    <VCTargetsPath Condition=\"'$(VCTargetsPath11)' != '' and '$(VisualStudioVersion)' == '11.0'\">$(VCTargetsPath11)</VCTargetsPath>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"PropertySheets\">\r\n    <PlatformToolset>WindowsKernelModeDriver8.0</PlatformToolset>\r\n    <ConfigurationType>Driver</ConfigurationType>\r\n    <DriverType>WDM</DriverType>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows8</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows8</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows7</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows7</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Vista</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Vista</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows8</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows8</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows7</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows7</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Vista</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Vista</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup>\r\n    <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|x64'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|x64'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|x64'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|x64'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|x64'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|x64'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|Win32'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|Win32'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|Win32'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|Win32'\">\r\n    <Link>\r\n      <AdditionalDependencies>$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <FilesToPackage Include=\"$(TargetPath)\" />\r\n    <FilesToPackage Include=\"@(Inf->'%(CopyOutput)')\" Condition=\"'@(Inf)'!=''\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"Hidminiport.c\" />\r\n    <ClCompile Include=\"Trace.c\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"Hidminiport.h\" />\r\n    <ClInclude Include=\"Trace.h\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "HID Miniport/HID Miniport.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Source Files\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\">\r\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r\n      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Driver Files\">\r\n      <UniqueIdentifier>{8E41214B-6785-4CFE-B992-037D68949A14}</UniqueIdentifier>\r\n      <Extensions>inf;inv;inx;mof;mc;</Extensions>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"Hidminiport.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Trace.c\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"Hidminiport.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Trace.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"resource.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"HID Miniport.rc\">\r\n      <Filter>Resource Files</Filter>\r\n    </ResourceCompile>\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "HID Miniport/Hidminiport.c",
    "content": "/*\r\n\r\nCopyright (C) 2014 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\thidminiport.c\r\n\r\nAbstract:\r\n\tActual miniport driver for HIDClass. Passes through all IRPs. Additonally sends down a custiom IOCTL, with the actual FDO and HidNotifyPrcense address.\r\n\r\n*/\r\n\r\n#include \"hidminiport.h\"\r\n\r\nNTSTATUS\r\nDriverEntry (\r\n    _In_ PDRIVER_OBJECT  DriverObject,\r\n    _In_ PUNICODE_STRING RegistryPath\r\n    )\r\n{\r\n    NTSTATUS Status;\r\n\tHID_MINIDRIVER_REGISTRATION HIDMinidriverRegistration;\r\n    ULONG i;\r\n\r\n\t//Trace(\"Driver Entry\");\r\n\r\n\t//Set Function Pointers for IRPs\r\n    for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) {\r\n        DriverObject->MajorFunction[i] = PassThrough;\r\n    }\r\n\r\n\t//Special for PnP\r\n\tDriverObject->MajorFunction[IRP_MJ_PNP] = PnPPassThrough;\r\n\r\n    DriverObject->DriverExtension->AddDevice = AddDevice;\r\n    DriverObject->DriverUnload = Unload;\r\n\r\n\t//Register as HID Minidriver\r\n    RtlZeroMemory(&HIDMinidriverRegistration, sizeof(HIDMinidriverRegistration));\r\n\r\n    HIDMinidriverRegistration.Revision            = HID_REVISION;\r\n    HIDMinidriverRegistration.DriverObject        = DriverObject;\r\n    HIDMinidriverRegistration.RegistryPath        = RegistryPath;\r\n    HIDMinidriverRegistration.DeviceExtensionSize = 0;\r\n    HIDMinidriverRegistration.DevicesArePolled = FALSE;\r\n\r\n    Status = HidRegisterMinidriver(&HIDMinidriverRegistration);\r\n    if (!NT_SUCCESS(Status) ){\r\n        return Status;\r\n    }\r\n\r\n    return Status;\r\n}\r\n\r\n\r\nNTSTATUS\r\nAddDevice(\r\n    _In_ PDRIVER_OBJECT DriverObject,\r\n    _In_ PDEVICE_OBJECT FunctionalDeviceObject\r\n    )\r\n{\r\n    UNREFERENCED_PARAMETER(DriverObject);\r\n\t\r\n\t//Trace(\"Add Device\");\r\n\r\n    FunctionalDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;\r\n\r\n    return STATUS_SUCCESS;\r\n}\r\n\r\nNTSTATUS\r\nPassThrough(\r\n    _In_    PDEVICE_OBJECT  DeviceObject,\r\n    _Inout_ PIRP            Irp\r\n    )\r\n{\r\n\t//Trace(\"Pass Through\");\r\n\r\n    IoCopyCurrentIrpStackLocationToNext(Irp);\r\n    return IoCallDriver(GET_NEXT_DEVICE_OBJECT(DeviceObject), Irp);\r\n}\r\n\r\n/*\r\nNTSTATUS SendAddressesCompeted(\r\n  _In_      PDEVICE_OBJECT DeviceObject,\r\n  _In_      PIRP Irp,\r\n  _In_opt_  PVOID Context\r\n)\r\n{\r\n\tUNREFERENCED_PARAMETER(DeviceObject);\r\n\r\n\tTrace(\"Send Addresses Completed\");\r\n\r\n\tif(Context != NULL)\r\n\t{\r\n\t\tExFreePoolWithTag(Context, IOCTL_POOL_TAG);\r\n\t}\r\n\r\n\tIoFreeIrp(Irp);\r\n\r\n\treturn STATUS_SUCCESS;\r\n}\r\n*/\r\n\r\nNTSTATUS\r\nSendAddresses(\r\n    _In_    PDEVICE_OBJECT  DeviceObject\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPIRP NewIrp;\r\n\tIO_STATUS_BLOCK StatusBlock;\r\n\tHID_MINIPORT_ADDRESSES AddressesBuffer;\r\n\r\n\tUNREFERENCED_PARAMETER(DeviceObject);\r\n\r\n\tTrace(\"Sending Addresses!\");\r\n\r\n\t/*AddressesBuffer = (PHID_MINIPORT_ADDRESSES)ExAllocatePoolWithTag(NonPagedPool, sizeof(HID_MINIPORT_ADDRESSES), IOCTL_POOL_TAG);\r\n\tif(AddressesBuffer == NULL)\r\n\t{\r\n\t\tTrace(\"Couldn't allocate Addresses Buffer\");\r\n\t\treturn STATUS_SUCCESS;\r\n\t}\r\n\t\r\n\tRtlSecureZeroMemory(AddressesBuffer, sizeof(HID_MINIPORT_ADDRESSES));\r\n\t*/\r\n\tAddressesBuffer.FDO = DeviceObject;\r\n\tAddressesBuffer.HidNotifyPresence = HidNotifyPresence;\r\n\r\n\tNewIrp = IoBuildDeviceIoControlRequest(IOCTL_WIIMOTE_ADDRESSES, GET_NEXT_DEVICE_OBJECT(DeviceObject), &AddressesBuffer, sizeof(HID_MINIPORT_ADDRESSES), NULL, 0, TRUE, NULL, &StatusBlock);\r\n\tif(NewIrp == NULL)\r\n\t{\r\n\t\tTrace(\"Couldn't Build IRP\");\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t//IoSetCompletionRoutine(NewIrp, SendAddressesCompeted, AddressesBuffer, TRUE, TRUE, TRUE);\r\n\r\n\tStatus = IoCallDriver(GET_NEXT_DEVICE_OBJECT(DeviceObject), NewIrp);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tif(Status == STATUS_PENDING)\r\n\t\t{\r\n\t\t\tTrace(\"SendAddress IoCallDriver is Pending!\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tTrace(\"SendAddress IoCallDriver: 0x%x\", Status);\r\n\t\t}\r\n\r\n\t\treturn Status;\r\n\t}\r\n\t\r\n\t\r\n\tTrace(\"Sending Addresses returned!\");\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nPnPPassThrough(\r\n    _In_    PDEVICE_OBJECT  DeviceObject,\r\n    _Inout_ PIRP            Irp\r\n    )\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPIO_STACK_LOCATION StackLocation = IoGetCurrentIrpStackLocation(Irp);\r\n\tUCHAR MinorFunction = StackLocation->MinorFunction;\r\n\t//Trace(\"MinorFunction: %x\", MinorFunction);\r\n\r\n    IoCopyCurrentIrpStackLocationToNext(Irp);\r\n    Status = IoCallDriver(GET_NEXT_DEVICE_OBJECT(DeviceObject), Irp);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\t\r\n\tif(MinorFunction == IRP_MN_START_DEVICE)\r\n\t{\r\n\t\tTrace(\"Device Start\");\r\n\r\n\t\tStatus = SendAddresses(DeviceObject);\r\n\t\tif(!NT_SUCCESS(Status))\r\n\t\t{\r\n\t\t\treturn Status;\r\n\t\t}\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\n\r\n\r\nVOID\r\nUnload(\r\n    _In_ PDRIVER_OBJECT DriverObject\r\n    )\r\n{\r\n    UNREFERENCED_PARAMETER(DriverObject);\r\n\r\n    return;\r\n}\r\n\r\n"
  },
  {
    "path": "HID Miniport/Hidminiport.h",
    "content": "/*\r\n\r\nCopyright (C) 2014 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\thidminiport.c\r\n\r\nAbstract:\r\n\tHeader file for hidminiport.c\r\n\r\n*/\r\n\r\n#ifndef _HIDMINIPORT_H_\r\n#define _HIDMINIPORT_H_\r\n\r\n#include <wdm.h>\r\n#include <hidport.h>\r\n\r\n#include \"Trace.h\"\r\n\r\nDRIVER_INITIALIZE DriverEntry;\r\nDRIVER_ADD_DEVICE AddDevice;\r\n_Dispatch_type_(IRP_MJ_OTHER)\r\nDRIVER_DISPATCH PassThrough;\r\n//IO_COMPLETION_ROUTINE SendAddressesCompeted;\r\n_Dispatch_type_(IRP_MJ_POWER)\r\nDRIVER_DISPATCH PowerPassThrough;\r\n_Dispatch_type_(IRP_MJ_PNP)\r\nDRIVER_DISPATCH PnPPassThrough;\r\nDRIVER_UNLOAD Unload;\r\n\r\n\r\n#define GET_NEXT_DEVICE_OBJECT(DO) (((PHID_DEVICE_EXTENSION)(DO)->DeviceExtension)->NextDeviceObject)\r\n\r\n#define IOCTL_WIIMOTE_ADDRESSES CTL_CODE(FILE_DEVICE_KEYBOARD, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)\r\n#define IOCTL_POOL_TAG '_WOI' \r\n\r\ntypedef NTSTATUS (*PNOTIFY_PRESENCE)(PDEVICE_OBJECT, BOOLEAN);\r\n\r\ntypedef struct _HID_MINIPORT_ADDRESSES \r\n{\r\n\tPDEVICE_OBJECT FDO;\r\n\tPNOTIFY_PRESENCE HidNotifyPresence;\r\n\r\n} HID_MINIPORT_ADDRESSES, * PHID_MINIPORT_ADDRESSES;\r\n\r\n#endif"
  },
  {
    "path": "HID Miniport/Trace.c",
    "content": "/*\r\n\r\nCopyright (C) 2013 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tTrace.c\r\n\r\nAbstract:\r\n\tContains the code for Tracing.\r\n\r\n*/\r\n\r\n#include \"Trace.h\"\r\n\r\n\r\nVOID\r\nTrace(\r\n    _In_ PCCHAR  DebugMessage,\r\n    ...\r\n    )\r\n{\r\n#ifndef DBG\r\n    UNREFERENCED_PARAMETER(DebugMessage);\r\n#else\r\n\tNTSTATUS Status;\r\n\tva_list ParameterList;\r\n\tCHAR DebugMessageBuffer[512];\r\n\r\n\tva_start(ParameterList, DebugMessage);\r\n\r\n\tif(DebugMessage != NULL)\r\n\t{\r\n\t\tStatus = RtlStringCbVPrintfA(DebugMessageBuffer, sizeof(DebugMessageBuffer), DebugMessage, ParameterList);\r\n\r\n\t\tif(NT_SUCCESS(Status))\r\n\t\t{\r\n\t\t\tDbgPrint(\"Trace Miniport: %s\\n\", DebugMessageBuffer);\r\n\t\t}\r\n\t}\r\n\r\n\tva_end(ParameterList);\r\n\r\n#endif\r\n}\r\n"
  },
  {
    "path": "HID Miniport/Trace.h",
    "content": "/*\r\n\r\nCopyright (C) 2013 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tTrace.h\r\n\r\nAbstract:\r\n\tHeader file for Trace.c\r\n\tContains declarations and configuration for Tracing.\r\n\r\n*/\r\n#ifndef _TRACE_H_\r\n#define _TRACE_H_\r\n\r\n#include <ntddk.h>\r\n\r\n#define NTSTRSAFE_LIB\r\n#include <ntstrsafe.h>\r\n\r\nVOID\r\nTrace(\r\n    _In_ PCCHAR  DebugMessage,\r\n    ...\r\n    );\r\n\r\n#endif"
  },
  {
    "path": "HID Miniport/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by HID Miniport.rc\n\n// Next default values for new objects\n// \n#ifdef APSTUDIO_INVOKED\n#ifndef APSTUDIO_READONLY_SYMBOLS\n#define _APS_NEXT_RESOURCE_VALUE        101\n#define _APS_NEXT_COMMAND_VALUE         40001\n#define _APS_NEXT_CONTROL_VALUE         1001\n#define _APS_NEXT_SYMED_VALUE           101\n#endif\n#endif\n"
  },
  {
    "path": "HID Wiimote/Bluetooth.c",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tBluetooth.c\r\n\r\nAbstract:\r\n\tContains all Bluetooth relevant functions.\r\n\tLike establishing the connection, reading and writing,\r\n\tclosing the connection to the device and Bluetooth error handling.\r\n*/\r\n#include \"Bluetooth.h\"\r\n\r\n#include \"Device.h\"\r\n\r\nEVT_WDF_REQUEST_COMPLETION_ROUTINE ControlChannelCompletion;\r\nEVT_WDF_REQUEST_COMPLETION_ROUTINE InterruptChannelCompletion;\r\nVOID L2CAPCallback(_In_  PVOID Context, _In_  INDICATION_CODE Indication, _In_  PINDICATION_PARAMETERS Parameters);\r\n\r\nEVT_WDF_REQUEST_COMPLETION_ROUTINE TransferToDeviceCompletion;\r\nEVT_WDF_REQUEST_COMPLETION_ROUTINE ReadFromDeviceCompletion;\r\n\r\nNTSTATUS \r\nGetVendorAndProductID(\r\n\t_In_ WDFIOTARGET IoTarget, \r\n\t_Out_ USHORT * VendorID, \r\n\t_Out_ USHORT * ProductID\r\n\t)\r\n{\t\r\n    NTSTATUS Status = STATUS_SUCCESS;\r\n\tWDF_MEMORY_DESCRIPTOR EnumInfoMemDescriptor;\r\n\tBTH_ENUMERATOR_INFO EnumInfo;\r\n\r\n\tRtlZeroMemory(&EnumInfo, sizeof(EnumInfo));\r\n\tWDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&EnumInfoMemDescriptor, &EnumInfo, sizeof(EnumInfo));\r\n\r\n\tStatus = WdfIoTargetSendInternalIoctlSynchronously(\r\n\t\tIoTarget, \r\n\t\tNULL, \r\n\t\tIOCTL_INTERNAL_BTHENUM_GET_ENUMINFO, \r\n\t\tNULL, \r\n\t\t&EnumInfoMemDescriptor, \r\n\t\tNULL, \r\n\t\tNULL);\r\n\t \r\n    if (!NT_SUCCESS(Status)) \r\n\t{\r\n\t\treturn Status;\r\n    }\r\n\r\n\t(*ProductID) = EnumInfo.Pid;\r\n\t(*VendorID) = EnumInfo.Vid;\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS \r\nBluetoothPrepare(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n    NTSTATUS Status = STATUS_SUCCESS;\r\n\tPBLUETOOTH_DEVICE_CONTEXT BluetoothContext = &(DeviceContext->BluetoothContext);\r\n\tWDF_MEMORY_DESCRIPTOR  DeviceInfoMemDescriptor;\r\n\tBTH_DEVICE_INFO\tDeviceInfo;\r\n\r\n\tBluetoothContext->ControlChannelHandle = NULL;\r\n\tBluetoothContext->InterruptChannelHandle = NULL;\r\n\r\n\t// Get Interfaces\r\n\tStatus = WdfFdoQueryForInterface(\r\n\t\tDeviceContext->Device, \r\n\t\t&GUID_BTHDDI_PROFILE_DRIVER_INTERFACE, \r\n\t\t(PINTERFACE)(&(BluetoothContext->ProfileDriverInterface)), \r\n\t\tsizeof(BluetoothContext->ProfileDriverInterface), \r\n\t\tBTHDDI_PROFILE_DRIVER_INTERFACE_VERSION_FOR_QI, \r\n\t\tNULL); \r\n\t\r\n\tif (!NT_SUCCESS(Status))\r\n    {\r\n        return Status;\r\n    }\r\n\r\n\t// Get BluetoothAdress\r\n\tRtlZeroMemory(&DeviceInfo, sizeof(DeviceInfo));\r\n\tWDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&DeviceInfoMemDescriptor, &DeviceInfo, sizeof(DeviceInfo));\r\n\r\n\tStatus = WdfIoTargetSendInternalIoctlSynchronously(\r\n\t\tDeviceContext->IoTarget, \r\n\t\tNULL, \r\n\t\tIOCTL_INTERNAL_BTHENUM_GET_DEVINFO, \r\n\t\tNULL, \r\n\t\t&DeviceInfoMemDescriptor, \r\n\t\tNULL, \r\n\t\tNULL);\r\n\t \r\n    if (!NT_SUCCESS(Status)) \r\n\t{\r\n\t\treturn Status;\r\n    }\r\n\r\n\tBluetoothContext->DeviceAddress = DeviceInfo.address;\r\n\r\n\tStatus = RtlStringCchPrintfW(BluetoothContext->DeviceAddressStringBuffer, BLUETOOTH_ADDRESS_STRING_SIZE, L\"%012I64x\", DeviceInfo.address);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tStatus = RtlUnicodeStringInit(&BluetoothContext->DeviceAddressString, BluetoothContext->DeviceAddressStringBuffer);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tsize_t NameLength;\r\n\tStatus = RtlStringCbLengthA(DeviceInfo.name, BTH_MAX_NAME_SIZE, &NameLength);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tStatus = RtlUTF8ToUnicodeN(BluetoothContext->DeviceNameStringBuffer, BTH_MAX_NAME_SIZE * sizeof(WCHAR), NULL, DeviceInfo.name, (ULONG)NameLength);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tStatus = RtlUnicodeStringInit(&BluetoothContext->DeviceNameString, BluetoothContext->DeviceNameStringBuffer);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nCreateRequest(\r\n\t_In_ WDFDEVICE Device,\r\n\t_In_ WDFIOTARGET IoTarget,\r\n\t_Outptr_ WDFREQUEST * Request\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n    WDF_OBJECT_ATTRIBUTES Attributes;\r\n\r\n    WDF_OBJECT_ATTRIBUTES_INIT(&Attributes);\r\n    Attributes.ParentObject = Device;\r\n\r\n\tStatus = WdfRequestCreate(&Attributes, IoTarget, Request);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nCreateBuffer(\r\n\t_In_ WDFREQUEST Request,\r\n\t_In_ SIZE_T BufferSize,\r\n\t_Outptr_ WDFMEMORY * Memory,\r\n\t_Outptr_opt_result_buffer_(BufferSize) PVOID * Buffer\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n    WDF_OBJECT_ATTRIBUTES Attributes;\r\n\r\n\tWDF_OBJECT_ATTRIBUTES_INIT(&Attributes);\r\n\tAttributes.ParentObject = Request;\r\n\t\r\n\tStatus = WdfMemoryCreate(&Attributes, NonPagedPool, BUFFER_POOL_TAG, BufferSize, Memory, Buffer);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nBluetoothCreateRequestAndBuffer(\r\n\t_In_ WDFDEVICE Device,\r\n\t_In_ WDFIOTARGET IoTarget,\r\n\t_In_ SIZE_T BufferSize,\r\n\t_Outptr_ WDFREQUEST * Request,\r\n\t_Outptr_ WDFMEMORY * Memory,\r\n\t_Outptr_opt_result_buffer_(BufferSize) PVOID * Buffer\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\r\n\tStatus = CreateRequest(Device, IoTarget, Request);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tStatus = CreateBuffer((*Request), BufferSize, Memory, Buffer);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfObjectDelete(*Request);\r\n\t\t(*Request) = NULL;\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n\r\n}\r\n\r\nNTSTATUS\r\nPrepareRequest(\r\n\t_In_ WDFIOTARGET IoTarget,\r\n\t_In_ PBRB BRB,\r\n\t_In_ WDFREQUEST Request\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n    WDF_OBJECT_ATTRIBUTES MemoryAttributes;\r\n    WDFMEMORY Memory = NULL;\r\n\r\n    WDF_OBJECT_ATTRIBUTES_INIT(&MemoryAttributes);\r\n    MemoryAttributes.ParentObject = Request;\r\n\r\n\tStatus = WdfMemoryCreatePreallocated(\r\n        &MemoryAttributes,\r\n        BRB,\r\n\t\tsizeof(*BRB),\r\n        &Memory\r\n        );\r\n\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\t\t\r\n\tStatus = WdfIoTargetFormatRequestForInternalIoctlOthers(\r\n        IoTarget,\r\n        Request,\r\n        IOCTL_INTERNAL_BTH_SUBMIT_BRB,\r\n        Memory, //OtherArg1\r\n        NULL, //OtherArg1Offset\r\n        NULL, //OtherArg2\r\n        NULL, //OtherArg2Offset\r\n        NULL, //OtherArg4\r\n        NULL  //OtherArg4Offset\r\n        );\r\n\t\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nSendBRB(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext,\r\n\t_In_opt_ WDFREQUEST OptRequest,\r\n\t_In_ PBRB BRB,\r\n\t_In_ PFN_WDF_REQUEST_COMPLETION_ROUTINE\tCompletionRoutine\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tWDFREQUEST Request;\r\n\r\n\tif(OptRequest == NULL)\r\n\t{\r\n\t\tStatus = CreateRequest(DeviceContext->Device, DeviceContext->IoTarget, &Request);\r\n\t\tif(!NT_SUCCESS(Status))\r\n\t\t{\r\n\t\t\treturn Status;\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\tRequest = OptRequest;\r\n\t}\r\n\r\n\tStatus = PrepareRequest(DeviceContext->IoTarget, BRB, Request);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfObjectDelete(Request);\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tWdfRequestSetCompletionRoutine(\r\n\t\tRequest,\r\n\t\tCompletionRoutine,\r\n\t\tBRB\r\n\t\t);\r\n\r\n\tif(!WdfRequestSend(\r\n\t\tRequest,\r\n\t\tDeviceContext->IoTarget,\r\n\t\tWDF_NO_SEND_OPTIONS\r\n\t\t))\r\n\t{\r\n        Status = WdfRequestGetStatus(Request);\r\n\t\tWdfObjectDelete(Request);\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nSendBRBSynchronous(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext,\r\n\t_In_opt_ WDFREQUEST OptRequest,\r\n\t_In_ PBRB BRB\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tWDF_REQUEST_SEND_OPTIONS SendOptions;\r\n\tWDFREQUEST Request;\r\n\r\n\tif(OptRequest == NULL)\r\n\t{\r\n\t\tStatus = CreateRequest(DeviceContext->Device, DeviceContext->IoTarget, &Request);\r\n\t\tif(!NT_SUCCESS(Status))\r\n\t\t{\r\n\t\t\treturn Status;\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\tRequest = OptRequest;\r\n\t}\r\n\r\n\tStatus = PrepareRequest(DeviceContext->IoTarget, BRB, Request);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfObjectDelete(Request);\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tStatus = WdfRequestAllocateTimer(Request);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfObjectDelete(Request);\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tWDF_REQUEST_SEND_OPTIONS_INIT(&SendOptions, WDF_REQUEST_SEND_OPTION_SYNCHRONOUS | WDF_REQUEST_SEND_OPTION_TIMEOUT);\r\n\tWDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT(&SendOptions, SYNCHRONOUS_CALL_TIMEOUT);\r\n\r\n\tWdfRequestSend(\r\n\t\tRequest,\r\n\t\tDeviceContext->IoTarget,\r\n\t\t&SendOptions\r\n\t\t);\r\n\t\r\n\tStatus = WdfRequestGetStatus(Request);\r\n\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfObjectDelete(Request);\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nVOID\r\nCleanUpCompletedRequest(\r\n\t_In_ WDFREQUEST Request,\r\n\t_In_  WDFIOTARGET IoTarget,\r\n\t_In_  WDFCONTEXT Context\r\n\t)\r\n{\r\n\tPDEVICE_CONTEXT DeviceContext;\r\n\tPBLUETOOTH_DEVICE_CONTEXT BluetoothContext;\r\n\tPBRB UsedBRB;\r\n\r\n\tDeviceContext = GetDeviceContext(WdfIoTargetGetDevice(IoTarget));\r\n\tBluetoothContext = &(DeviceContext->BluetoothContext);\r\n\tUsedBRB = (PBRB)Context;\r\n\r\n\tWdfObjectDelete(Request);\r\n\tBluetoothContext->ProfileDriverInterface.BthFreeBrb(UsedBRB);\r\n}\r\n\r\n\r\nVOID \r\nL2CAPCallback(\r\n\t_In_  PVOID Context, \r\n\t_In_  INDICATION_CODE Indication, \r\n\t_In_  PINDICATION_PARAMETERS Parameters\r\n\t)\r\n{\r\n\t//WDF_DEVICE_STATE NewDeviceState;\r\n\tPDEVICE_CONTEXT DeviceContext = (PDEVICE_CONTEXT)Context;\r\n\r\n\t//UNREFERENCED_PARAMETER(Context);\r\n\tUNREFERENCED_PARAMETER(Parameters);\r\n\t\r\n\tTrace(\"L2CAP Channel Callback\");\r\n\tTrace(\"Indication: %u\", Indication);\r\n\t\r\n\r\n\tif(Indication == IndicationRemoteDisconnect)\r\n\t{\r\n\t\t//Wiimote has disconnected.\r\n\t\t//Code has to be added to signal the PnP-Manager that the device is gone.\r\n\t\t\r\n\t\tTrace(\"Disconnect\");\r\n\t\tTrace(\"Parameter: %u; %u\", Parameters->Parameters.Disconnect.Reason, Parameters->Parameters.Disconnect.CloseNow);\r\n\t\r\n\t\tWiimoteReset(DeviceContext);\r\n\t\tSignalDeviceIsGone(DeviceContext);\r\n\r\n\t\t//WDF_DEVICE_STATE_INIT (&NewDeviceState);\r\n\r\n\t\t//HidNotifyPresence(WdfDeviceWdmGetDeviceObject(DeviceContext->Device), FALSE);\r\n\t\t\r\n\t\t//WdfDeviceGetDeviceState(DeviceContext->Device, &NewDeviceState);\r\n\t\t//NewDeviceState.Removed = WdfTrue;\r\n\t\t//WdfDeviceSetDeviceState(DeviceContext->Device, &NewDeviceState);\r\n\t\t//WdfPdoMarkMissing(DeviceContext->Device);\r\n\t}\r\n}\r\n\r\nNTSTATUS \r\nOpenChannel(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext,\r\n\t_In_opt_ PBRB PreAllocatedBRB,\r\n\t_In_ BYTE PSM,\r\n\t_In_opt_ PFNBTHPORT_INDICATION_CALLBACK ChannelCallback,\r\n\t_In_ PFN_WDF_REQUEST_COMPLETION_ROUTINE ChannelCompletion\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPBLUETOOTH_DEVICE_CONTEXT BluetoothContext = &(DeviceContext->BluetoothContext);\r\n\tPBRB_L2CA_OPEN_CHANNEL BRBOpenChannel;\r\n\r\n\t//Create or reuse BRB\r\n\tif(PreAllocatedBRB == NULL)\r\n\t{\r\n\t\tBRBOpenChannel = (PBRB_L2CA_OPEN_CHANNEL)BluetoothContext->ProfileDriverInterface.BthAllocateBrb(BRB_L2CA_OPEN_CHANNEL, BLUETOOTH_POOL_TAG);\r\n\t\tif (BRBOpenChannel == NULL)\r\n\t\t{\r\n\t\t\treturn STATUS_INSUFFICIENT_RESOURCES;\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\tBluetoothContext->ProfileDriverInterface.BthReuseBrb(PreAllocatedBRB, BRB_L2CA_OPEN_CHANNEL);\r\n\t\tBRBOpenChannel = (PBRB_L2CA_OPEN_CHANNEL)PreAllocatedBRB;\r\n\t}\r\n\t\r\n\t//Fill BRB\r\n\tBRBOpenChannel->BtAddress = BluetoothContext->DeviceAddress;\r\n\tBRBOpenChannel->Psm = PSM; //0x13\r\n\tBRBOpenChannel->ChannelFlags = 0;\r\n\tBRBOpenChannel->ConfigOut.Flags = 0;\r\n    BRBOpenChannel->ConfigOut.Mtu.Max = L2CAP_DEFAULT_MTU;\r\n    BRBOpenChannel->ConfigOut.Mtu.Min = L2CAP_MIN_MTU;\r\n    BRBOpenChannel->ConfigOut.Mtu.Preferred = L2CAP_DEFAULT_MTU;\r\n\tBRBOpenChannel->ConfigOut.FlushTO.Max = L2CAP_DEFAULT_FLUSHTO;\r\n\tBRBOpenChannel->ConfigOut.FlushTO.Min = L2CAP_MIN_FLUSHTO;\r\n\tBRBOpenChannel->ConfigOut.FlushTO.Preferred = L2CAP_DEFAULT_FLUSHTO;\r\n\tBRBOpenChannel->ConfigOut.ExtraOptions = 0;\r\n\tBRBOpenChannel->ConfigOut.NumExtraOptions = 0;\r\n\tBRBOpenChannel->ConfigOut.LinkTO = 0;\r\n\r\n    BRBOpenChannel->IncomingQueueDepth = 50;\r\n    BRBOpenChannel->ReferenceObject = (PVOID) WdfDeviceWdmGetDeviceObject(DeviceContext->Device);\r\n   \r\n\tif(ChannelCallback != NULL)\r\n\t{\r\n\t\tBRBOpenChannel->CallbackFlags = CALLBACK_DISCONNECT;                                                   \r\n\t\tBRBOpenChannel->Callback = ChannelCallback; //L2CAPCallback;\r\n\t\tBRBOpenChannel->CallbackContext = (PVOID)DeviceContext;\r\n\t}\r\n\r\n\t//SendBRB\r\n\tStatus = SendBRB(DeviceContext, NULL, (PBRB)BRBOpenChannel, ChannelCompletion);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tBluetoothContext->ProfileDriverInterface.BthFreeBrb((PBRB)BRBOpenChannel);\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nVOID \r\nControlChannelCompletion(\r\n\t_In_  WDFREQUEST Request,\r\n\t_In_  WDFIOTARGET IoTarget,\r\n\t_In_  PWDF_REQUEST_COMPLETION_PARAMS Params,\r\n\t_In_  WDFCONTEXT Context\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPDEVICE_CONTEXT DeviceContext;\r\n\tPBLUETOOTH_DEVICE_CONTEXT BluetoothContext;\r\n\tPBRB_L2CA_OPEN_CHANNEL UsedBRBOpenChannel;\r\n\r\n\tDeviceContext = GetDeviceContext(WdfIoTargetGetDevice(IoTarget));\r\n\tBluetoothContext = &(DeviceContext->BluetoothContext);\r\n\tUsedBRBOpenChannel = (PBRB_L2CA_OPEN_CHANNEL)Context;\r\n\r\n\tStatus = Params->IoStatus.Status;\r\n\t\r\n\tTraceStatus(\"Control Channel Result\", Status);\r\n\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tCleanUpCompletedRequest(Request, IoTarget, Context);\r\n\t\tif(Status == STATUS_IO_TIMEOUT)\r\n\t\t{\r\n\t\t\tSignalDeviceIsGone(DeviceContext);\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tWdfDeviceSetFailed(DeviceContext->Device, WdfDeviceFailedNoRestart);\r\n\t\t}\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\tBluetoothContext->ControlChannelHandle = UsedBRBOpenChannel->ChannelHandle;\r\n\tCleanUpCompletedRequest(Request, IoTarget, Context);\r\n\t\r\n\t// Open Interrupt Channel\r\n\tOpenChannel(DeviceContext, NULL, 0x13, L2CAPCallback, InterruptChannelCompletion);\r\n}\r\n\r\nVOID \r\nInterruptChannelCompletion(\r\n\t_In_  WDFREQUEST Request,\r\n\t_In_  WDFIOTARGET IoTarget,\r\n\t_In_  PWDF_REQUEST_COMPLETION_PARAMS Params,\r\n\t_In_  WDFCONTEXT Context\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPDEVICE_CONTEXT DeviceContext;\r\n\tPBLUETOOTH_DEVICE_CONTEXT BluetoothContext;\r\n\tPBRB_L2CA_OPEN_CHANNEL UsedBRBOpenChannel;\r\n\r\n\tDeviceContext = GetDeviceContext(WdfIoTargetGetDevice(IoTarget));\r\n\tBluetoothContext = &(DeviceContext->BluetoothContext);\r\n\tUsedBRBOpenChannel = (PBRB_L2CA_OPEN_CHANNEL)Context;\r\n\r\n\tStatus = Params->IoStatus.Status;\r\n\t\r\n\tTraceStatus(\"Interrupt Channel Result\", Status);\r\n\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tCleanUpCompletedRequest(Request, IoTarget, Context);\r\n\t\tif(Status == STATUS_IO_TIMEOUT)\r\n\t\t{\r\n\t\t\tSignalDeviceIsGone(DeviceContext);\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tWdfDeviceSetFailed(DeviceContext->Device, WdfDeviceFailedNoRestart);\r\n\t\t}\r\n\r\n\t\treturn;\r\n\t}\r\n\r\n\tBluetoothContext->InterruptChannelHandle = UsedBRBOpenChannel->ChannelHandle;\r\n\tCleanUpCompletedRequest(Request, IoTarget, Context);\r\n\t\r\n\t// Start Wiimote functionality\r\n\tWiimoteStart(DeviceContext);\r\n}\r\n\r\nNTSTATUS\r\nBluetoothOpenChannels(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\treturn OpenChannel(DeviceContext, NULL, 0x11, NULL, ControlChannelCompletion);\r\n}\r\n\r\nNTSTATUS \r\nCloseChannel(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext,\r\n\t_In_ L2CAP_CHANNEL_HANDLE ChannelHandle\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPBLUETOOTH_DEVICE_CONTEXT BluetoothContext = &(DeviceContext->BluetoothContext);\r\n\tPBRB_L2CA_CLOSE_CHANNEL BRBCloseChannel;\r\n\r\n\tif(ChannelHandle == NULL)\r\n\t{\t\r\n\t\tTrace(\"Close Channel: Handle is NULL\");\r\n\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tBRBCloseChannel = (PBRB_L2CA_CLOSE_CHANNEL)BluetoothContext->ProfileDriverInterface.BthAllocateBrb(BRB_L2CA_CLOSE_CHANNEL, BLUETOOTH_POOL_TAG);\r\n\tif (BRBCloseChannel == NULL)\r\n\t{\r\n\t\treturn STATUS_INSUFFICIENT_RESOURCES;\r\n\t}\r\n\r\n\tBRBCloseChannel->BtAddress = BluetoothContext->DeviceAddress;\r\n\tBRBCloseChannel->ChannelHandle = ChannelHandle;\r\n\r\n\tStatus = SendBRBSynchronous(DeviceContext, NULL, (PBRB)BRBCloseChannel);\r\n\tBluetoothContext->ProfileDriverInterface.BthFreeBrb((PBRB)BRBCloseChannel);\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nBluetoothCloseChannels(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\t\r\n\tPBLUETOOTH_DEVICE_CONTEXT BluetoothContext = &(DeviceContext->BluetoothContext);\r\n\r\n\tCloseChannel(DeviceContext, BluetoothContext->InterruptChannelHandle);\r\n\tBluetoothContext->InterruptChannelHandle = NULL;\r\n\r\n\tCloseChannel(DeviceContext, BluetoothContext->ControlChannelHandle);\r\n\tBluetoothContext->ControlChannelHandle = NULL;\r\n\r\n\treturn STATUS_SUCCESS;\r\n}\r\n\r\nNTSTATUS \r\nBluetoothTransferToDevice(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext, \r\n\t_In_ WDFREQUEST Request, \r\n\t_In_ WDFMEMORY Memory,\r\n\t_In_ BOOLEAN Synchronous\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPBLUETOOTH_DEVICE_CONTEXT BluetoothContext = &(DeviceContext->BluetoothContext);\r\n\tPBRB_L2CA_ACL_TRANSFER BRBTransfer;\r\n\tsize_t BufferSize;\r\n\t\r\n\tif(BluetoothContext->InterruptChannelHandle == NULL)\r\n\t{\r\n\t\treturn STATUS_INVALID_HANDLE;\r\n\t}\r\n\r\n\t// Now get an BRB and fill it\r\n\tBRBTransfer = (PBRB_L2CA_ACL_TRANSFER)BluetoothContext->ProfileDriverInterface.BthAllocateBrb(BRB_L2CA_ACL_TRANSFER, BLUETOOTH_POOL_TAG);\r\n\tif (BRBTransfer == NULL)\r\n\t{\r\n\t\treturn STATUS_INSUFFICIENT_RESOURCES;\r\n\t}\r\n\r\n\tBRBTransfer->BtAddress = BluetoothContext->DeviceAddress;\r\n\tBRBTransfer->ChannelHandle = BluetoothContext->InterruptChannelHandle;\r\n\tBRBTransfer->TransferFlags = ACL_TRANSFER_DIRECTION_OUT;\r\n\tBRBTransfer->BufferMDL = NULL;\r\n\tBRBTransfer->Buffer = WdfMemoryGetBuffer(Memory, &BufferSize);\r\n\tBRBTransfer->BufferSize = (ULONG)BufferSize;\r\n\r\n\t//Send\r\n\tif(Synchronous)\r\n\t{\r\n\t\tStatus = SendBRBSynchronous(DeviceContext, Request, (PBRB)BRBTransfer);\r\n\t\tBluetoothContext->ProfileDriverInterface.BthFreeBrb((PBRB)BRBTransfer);\r\n\t\tif(!NT_SUCCESS(Status))\r\n\t\t{\r\n\t\t\treturn Status;\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\tStatus = SendBRB(DeviceContext, Request, (PBRB)BRBTransfer, TransferToDeviceCompletion);\t\r\n\t\tif(!NT_SUCCESS(Status))\r\n\t\t{\r\n\t\t\tBluetoothContext->ProfileDriverInterface.BthFreeBrb((PBRB)BRBTransfer);\r\n\t\t\treturn Status;\r\n\t\t}\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nVOID \r\nTransferToDeviceCompletion(\r\n\t_In_  WDFREQUEST Request,\r\n\t_In_  WDFIOTARGET IoTarget,\r\n\t_In_  PWDF_REQUEST_COMPLETION_PARAMS Params,\r\n\t_In_  WDFCONTEXT Context\r\n\t)\r\n{\r\n\tUNREFERENCED_PARAMETER(Params);\r\n\r\n\tCleanUpCompletedRequest(Request, IoTarget, Context);\r\n}\r\n\r\nNTSTATUS\r\nReadFromDevice(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext,\r\n\t_In_ WDFREQUEST Request,\r\n\t_In_ PBRB_L2CA_ACL_TRANSFER BRB,\r\n\t_In_reads_(ReadBufferSize) PVOID ReadBuffer,\r\n\t_In_ SIZE_T ReadBufferSize\r\n)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPBLUETOOTH_DEVICE_CONTEXT BluetoothContext = &(DeviceContext->BluetoothContext);\r\n\r\n\tif(BluetoothContext->InterruptChannelHandle == NULL)\r\n\t{\r\n\t\treturn STATUS_INVALID_HANDLE;\r\n\t}\r\n\r\n\tBRB->BtAddress = BluetoothContext->DeviceAddress;\r\n\tBRB->ChannelHandle = BluetoothContext->InterruptChannelHandle;\r\n\tBRB->TransferFlags = ACL_TRANSFER_DIRECTION_IN | ACL_SHORT_TRANSFER_OK;\r\n\tBRB->BufferMDL = NULL;\r\n\tBRB->Buffer = ReadBuffer;\r\n\tBRB->BufferSize = (ULONG)ReadBufferSize;\r\n\r\n\tStatus = SendBRB(DeviceContext, Request, (PBRB)BRB, ReadFromDeviceCompletion);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tTraceStatus(\"SendBRB Failed\", Status);\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nVOID\r\nReadFromDeviceCompletion(\r\n\t_In_  WDFREQUEST Request,\r\n\t_In_  WDFIOTARGET IoTarget,\r\n\t_In_  PWDF_REQUEST_COMPLETION_PARAMS Params,\r\n\t_In_  WDFCONTEXT Context\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPDEVICE_CONTEXT DeviceContext;\r\n\tPBLUETOOTH_DEVICE_CONTEXT BluetoothContext;\r\n\tPVOID ReadBuffer;\r\n\tsize_t ReadBufferSize;\r\n\tPBRB_L2CA_ACL_TRANSFER BRB;\r\n\tWDF_REQUEST_REUSE_PARAMS  RequestReuseParams;\r\n\r\n\tDeviceContext = GetDeviceContext(WdfIoTargetGetDevice(IoTarget));\r\n\tBluetoothContext = &(DeviceContext->BluetoothContext);\r\n\tBRB = (PBRB_L2CA_ACL_TRANSFER)Context;\r\n\r\n\tStatus = Params->IoStatus.Status;\r\n\r\n\t//TraceStatus(\"ReadFromDeviceCompletion Result\", Status);\r\n\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfObjectDelete(Request);\r\n\t\treturn;\r\n\t}\r\n\r\n\tReadBuffer = BRB->Buffer;\r\n\tReadBufferSize = BRB->BufferSize;\r\n\r\n\t//Trace(\"RawBuffer: %08x\", (*(UINT64 * )ReadBuffer));\r\n\t//Trace(\"BufferSize: %d - RemainingBufferSize: %d\", BRB->BufferSize, BRB->RemainingBufferSize);\r\n\r\n\t//Call Wiimote Read Callback\r\n\tStatus = WiimoteProcessReport(DeviceContext, ReadBuffer, (ReadBufferSize - BRB->RemainingBufferSize));\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfObjectDelete(Request);\r\n\t\treturn;\r\n\t}\r\n\r\n\t//Reset all Object for reuse\r\n\tBluetoothContext->ProfileDriverInterface.BthReuseBrb((PBRB)BRB, BRB_L2CA_ACL_TRANSFER);\r\n\r\n\tWDF_REQUEST_REUSE_PARAMS_INIT(&RequestReuseParams, WDF_REQUEST_REUSE_NO_FLAGS, STATUS_SUCCESS);\r\n\tStatus = WdfRequestReuse(Request, &RequestReuseParams);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfObjectDelete(Request);\r\n\t\treturn;\r\n\t}\r\n\r\n\tRtlSecureZeroMemory(ReadBuffer, ReadBufferSize);\r\n\r\n\t//Send out new Read\r\n\tStatus = ReadFromDevice(DeviceContext, Request, BRB, ReadBuffer, BluetoothContext->ReadBufferSize);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn;\r\n\t}\r\n}\r\n\r\nNTSTATUS\r\nBluetoothStartContiniousReader(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tCONST size_t ReadBufferSize = 50;\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tWDFREQUEST Request;\r\n\tWDFMEMORY Memory;\r\n\tPBRB BRB;\r\n\tPBLUETOOTH_DEVICE_CONTEXT BluetoothContext = &(DeviceContext->BluetoothContext);\r\n\tPVOID ReadBuffer = NULL;\r\n\r\n\t\r\n\tTrace(\"StartContiniousReader\");\r\n\r\n\t//Create Report And Buffer\r\n\tStatus = BluetoothCreateRequestAndBuffer(DeviceContext->Device, DeviceContext->IoTarget, ReadBufferSize, &Request, &Memory, &ReadBuffer);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tTraceStatus(\"CreateRequestAndBuffer Failed\", Status);\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t// Safe the Buffer Size\r\n\tBluetoothContext->ReadBufferSize = ReadBufferSize;\r\n\r\n\t// Create BRB\r\n\tBRB = BluetoothContext->ProfileDriverInterface.BthAllocateBrb(BRB_L2CA_ACL_TRANSFER, BLUETOOTH_POOL_TAG);\r\n\tif (BRB == NULL)\r\n\t{\r\n\t\tWdfObjectDelete(Request);\r\n\t\treturn STATUS_INSUFFICIENT_RESOURCES;\r\n\t}\r\n\r\n\t//Start the Reader\r\n\tStatus = ReadFromDevice(DeviceContext, Request, (PBRB_L2CA_ACL_TRANSFER)BRB, ReadBuffer, ReadBufferSize);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\treturn Status;\r\n\r\n}\r\n"
  },
  {
    "path": "HID Wiimote/Bluetooth.h",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tBluetooth.h\r\n\r\nAbstract:\r\n\tHeader file for Bluetooth.c\r\n*/\r\n\r\n#pragma once\r\n\r\n#include \"HIDWiimote.h\"\r\n\r\n#include <bthdef.h>\r\n#include <bthguid.h>\r\n#include <bthioctl.h>\r\n#include <sdpnode.h>\r\n#include <bthddi.h>\r\n#include <bthsdpddi.h>\r\n#include <bthsdpdef.h>\r\n\r\n#define BLUETOOTH_POOL_TAG '_htB'\r\n#define BUFFER_POOL_TAG '_fuB'\r\n#define SYNCHRONOUS_CALL_TIMEOUT (-1000000000) // 1 Second\r\n\r\n#define BLUETOOTH_ADDRESS_STRING_SIZE 17\r\n\r\ntypedef struct _BLUETOOTH_DEVICE_CONTEXT \r\n{\r\n    BTH_PROFILE_DRIVER_INTERFACE ProfileDriverInterface;\r\n\r\n    BTH_ADDR DeviceAddress;\r\n\tUNICODE_STRING DeviceAddressString;\r\n\tWCHAR DeviceAddressStringBuffer[BLUETOOTH_ADDRESS_STRING_SIZE];\r\n\tUNICODE_STRING DeviceNameString;\r\n\tWCHAR DeviceNameStringBuffer[BTH_MAX_NAME_SIZE];\r\n\r\n\tL2CAP_CHANNEL_HANDLE ControlChannelHandle;\r\n\tL2CAP_CHANNEL_HANDLE InterruptChannelHandle;\r\n\r\n\tsize_t ReadBufferSize;\r\n\r\n} BLUETOOTH_DEVICE_CONTEXT, * PBLUETOOTH_DEVICE_CONTEXT;\r\n\r\ntypedef struct _BRB_L2CA_OPEN_CHANNEL * PBRB_L2CA_OPEN_CHANNEL;\r\ntypedef struct _BRB_L2CA_CLOSE_CHANNEL * PBRB_L2CA_CLOSE_CHANNEL;\r\ntypedef struct _BRB_L2CA_ACL_TRANSFER * PBRB_L2CA_ACL_TRANSFER;\r\n\r\nNTSTATUS GetVendorAndProductID(_In_ WDFIOTARGET IoTarget, _Out_ USHORT * VendorID, _Out_ USHORT * ProductID);\r\n\r\nNTSTATUS BluetoothPrepare(_In_ PDEVICE_CONTEXT DeviceContext);\r\nNTSTATUS BluetoothOpenChannels(_In_ PDEVICE_CONTEXT DeviceContext);\r\nNTSTATUS BluetoothCloseChannels(_In_ PDEVICE_CONTEXT DeviceContext);\r\n\r\nNTSTATUS BluetoothCreateRequestAndBuffer(_In_ WDFDEVICE Device, _In_ WDFIOTARGET IoTarget, _In_ SIZE_T BufferSize, _Outptr_ WDFREQUEST * Request, _Outptr_ WDFMEMORY * Memory, _Outptr_opt_result_buffer_(BufferSize) PVOID * Buffer);\r\nNTSTATUS BluetoothTransferToDevice(_In_ PDEVICE_CONTEXT DeviceContext, _In_ WDFREQUEST Request, _In_ WDFMEMORY Memory, _In_ BOOLEAN Synchronous);\r\n\r\nNTSTATUS BluetoothStartContiniousReader(_In_ PDEVICE_CONTEXT DeviceContext);\r\n"
  },
  {
    "path": "HID Wiimote/Device.c",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tDevice.c\r\n\r\nAbstract:\r\n\tContains all system callbacks regarding a devices pnp and power states.\r\n*/\r\n#include \"Device.h\"\r\n\r\nNTSTATUS\r\nDeviceAdd(\r\n\t_In_    WDFDRIVER\t\tDriver,\r\n\t_Inout_ PWDFDEVICE_INIT\tDeviceInit\r\n    )\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tWDF_OBJECT_ATTRIBUTES Attributes;\r\n\tWDF_PNPPOWER_EVENT_CALLBACKS PnpPowerCallbacks;\r\n\tWDFDEVICE Device;\r\n\tPDEVICE_CONTEXT DevContext;\r\n\r\n\tUNREFERENCED_PARAMETER(Driver);\r\n\r\n\tTrace(\"Device Added\");\r\n\r\n\t// Driver is filter\r\n\tWdfFdoInitSetFilter(DeviceInit);\r\n\r\n\t// Configure PnP Functions\r\n\tWDF_PNPPOWER_EVENT_CALLBACKS_INIT(&PnpPowerCallbacks);\r\n\r\n\tPnpPowerCallbacks.EvtDevicePrepareHardware = PrepareHardware;\r\n\tPnpPowerCallbacks.EvtDeviceReleaseHardware = ReleaseHardware;\r\n\r\n\tPnpPowerCallbacks.EvtDeviceD0Entry = DeviceD0Entry;\r\n\tPnpPowerCallbacks.EvtDeviceD0Exit = DeviceD0Exit;\r\n\r\n\tWdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &PnpPowerCallbacks);\r\n\r\n\t// Configure Device Context\r\n\tWDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&Attributes, DEVICE_CONTEXT); \r\n\r\n\t//Create Device Object\r\n\tStatus = WdfDeviceCreate(&DeviceInit, &Attributes, &Device);\r\n\t\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t//Initialize DeviceContext\r\n\tDevContext = GetDeviceContext(Device);\r\n\tDevContext->Device = Device;\r\n\r\n\t// Create IO Queue\r\n\tStatus = HIDCreateQueues(Device, DevContext);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tTrace(\"Device Added Error On CreateQueues Result: 0x%x\", Status);\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t// Create Settings Device Interface\r\n\tStatus = DeviceInterfaceCreate(DevContext);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\tTraceStatus(\"Error Creating Device Interface\", Status);\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tTraceStatus(\"Device Added Result\", Status);\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nPrepareHardware(\r\n\t_In_  WDFDEVICE Device,\r\n\t_In_  WDFCMRESLIST ResourcesRaw,\r\n\t_In_  WDFCMRESLIST ResourcesTranslated\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPDEVICE_CONTEXT DeviceContext;\r\n\r\n\tUNREFERENCED_PARAMETER(ResourcesRaw);\r\n\tUNREFERENCED_PARAMETER(ResourcesTranslated);\r\n\t\r\n\tTrace(\"PrepareHardware\");\r\n\t\r\n\tDeviceContext = GetDeviceContext(Device);\r\n\tDeviceContext->IoTarget = WdfDeviceGetIoTarget(Device);\r\n\r\n\t//Initialize Bluetooth\r\n\tStatus = BluetoothPrepare(DeviceContext);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\t\r\n\t//Initialize HID\r\n\tStatus = HIDPrepare(DeviceContext);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\t\r\n\t//Initialize Wiimote\r\n\tStatus = WiimotePrepare(DeviceContext);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\t\r\n\tTraceStatus(\"PrepareHardware Result\", Status);\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS \r\nDeviceD0Entry(\r\n\t_In_  WDFDEVICE Device,\r\n\t_In_  WDF_POWER_DEVICE_STATE PreviousState\r\n)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPDEVICE_CONTEXT DeviceContext;\r\n\r\n\tUNREFERENCED_PARAMETER(PreviousState);\r\n\t\r\n\tTrace(\"Device D0 Entry\");\r\n\r\n\tDeviceContext = GetDeviceContext(Device);\r\n\r\n\tRtlSecureZeroMemory(&(DeviceContext->HIDMiniportAddresses), sizeof(HID_MINIPORT_ADDRESSES));\r\n\r\n\tStatus = BluetoothOpenChannels(DeviceContext);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tTraceStatus(\"Device D0 Entry Result\", Status);\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS \r\nDeviceD0Exit(\r\n\t_In_  WDFDEVICE Device,\r\n\t_In_  WDF_POWER_DEVICE_STATE TargetState\r\n)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPDEVICE_CONTEXT DeviceContext;\r\n\r\n\tUNREFERENCED_PARAMETER(TargetState);\r\n\r\n\tTrace(\"Exit D0; Target: %x\", TargetState);\r\n\t\r\n\tDeviceContext = GetDeviceContext(Device);\r\n\r\n\t//Suspend Wiimote\r\n\tStatus = WiimoteStop(DeviceContext);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\tTraceStatus(\"Error Stopping Wiimote\", Status);\r\n\t}\r\n\r\n\t//Close BluetoothConnection\r\n\tStatus = BluetoothCloseChannels(DeviceContext);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\tTraceStatus(\"Error Closing Bluetooth Connections\", Status);\r\n\t}\r\n\r\n\tTraceStatus(\"Exit D0 Result\", Status);\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nReleaseHardware(\r\n\t_In_  WDFDEVICE Device,\r\n\t_In_  WDFCMRESLIST ResourcesTranslated\r\n)\r\n{ \r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPDEVICE_CONTEXT DeviceContext;\r\n\t\r\n\tUNREFERENCED_PARAMETER(ResourcesTranslated);\r\n\r\n\tTrace(\"Releasee Hardware\");\r\n\r\n\tDeviceContext = GetDeviceContext(Device);\r\n\r\n\tStatus = DeviceInterfaceRelease(DeviceContext->SettingsInterfaceContext);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\tTraceStatus(\"Error Releaseing Device Interface\", Status);\r\n\t}\r\n\r\n\tStatus = HIDRelease(DeviceContext);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\tTraceStatus(\"Error Releaseing HID\", Status);\r\n\t}\r\n\t\r\n\tTraceStatus(\"Releasee Hardware Result\", Status);\r\n\r\n\treturn Status;\r\n}\r\n\r\n\r\nVOID \r\nSetHIDMiniportAddresses(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext,\r\n\t_In_ PHID_MINIPORT_ADDRESSES Addresses\r\n\t)\r\n{\r\n\tDeviceContext->HIDMiniportAddresses.FDO = Addresses->FDO;\r\n\tDeviceContext->HIDMiniportAddresses.HidNotifyPresence = Addresses->HidNotifyPresence;\r\n}\r\n\r\nNTSTATUS\r\nSignalDeviceIsGone(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\r\n\tif((DeviceContext->HIDMiniportAddresses.FDO != NULL) && (DeviceContext->HIDMiniportAddresses.HidNotifyPresence != NULL))\r\n\t{\r\n\t\tStatus = (DeviceContext->HIDMiniportAddresses.HidNotifyPresence)((DeviceContext->HIDMiniportAddresses.FDO), FALSE);\r\n\t\tTraceStatus(\"Signaling Device is Gone\", Status);\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n"
  },
  {
    "path": "HID Wiimote/Device.h",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tDevice.h\r\n\r\nAbstract:\r\n\tHeader file for Device.c\r\n\r\n*/\r\n#pragma once\r\n\r\n#include \"HIDWiimote.h\"\r\n\r\n#include \"DeviceInterface.h\"\r\n#include \"Wiimote.h\"\r\n#include \"Bluetooth.h\"\r\n#include \"HID.h\"\r\n\r\ntypedef struct _DEVICE_CONTEXT \r\n{\r\n\tWDFDEVICE Device;\r\n\tWDFIOTARGET IoTarget;\r\n\r\n\tPDEVICE_INTERFACE_CONTEXT SettingsInterfaceContext;\r\n\tBLUETOOTH_DEVICE_CONTEXT BluetoothContext;\r\n\tHID_DEVICE_CONTEXT HIDContext;\r\n\tWIIMOTE_DEVICE_CONTEXT WiimoteContext;\r\n\r\n\tHID_MINIPORT_ADDRESSES HIDMiniportAddresses;\r\n\r\n} DEVICE_CONTEXT, * PDEVICE_CONTEXT;\r\n\r\nWDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DEVICE_CONTEXT, GetDeviceContext)\r\n\r\n\t\r\nEVT_WDF_DRIVER_DEVICE_ADD DeviceAdd;\r\n\r\nEVT_WDF_DEVICE_PREPARE_HARDWARE PrepareHardware;\r\nEVT_WDF_DEVICE_D0_ENTRY DeviceD0Entry;\r\n\r\nEVT_WDF_DEVICE_D0_EXIT DeviceD0Exit;\r\nEVT_WDF_DEVICE_RELEASE_HARDWARE ReleaseHardware;\r\n\r\nVOID SetHIDMiniportAddresses(_In_ PDEVICE_CONTEXT DeviceContext, _In_ PHID_MINIPORT_ADDRESSES Addresses);\r\nNTSTATUS SignalDeviceIsGone(_In_ PDEVICE_CONTEXT DeviceContext);\r\n"
  },
  {
    "path": "HID Wiimote/DeviceInterface.c",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tDeviceInterface.c\n\nAbstract:\n\tContains code for the RawPDO used as Device Interface.\n\tHandles all incomming IOCTLs.\n\n*/\n#include \"DeviceInterface.h\"\n\n#include \"Device.h\"\n#include \"DeviceInterfacePublic.h\"\n\ntypedef VOID DRIVER_MODE_SETTING_SETTER(_In_ PDEVICE_CONTEXT DeviceContext, _In_ WIIMOTE_DRIVER_MODE Value);\ntypedef VOID BOOLEAN_SETTING_SETTER(_In_ PDEVICE_CONTEXT DeviceContext, _In_ BOOLEAN Value);\n\n\n// {7D180E63-2CAC-4112-B3D4-C42275CA497E}\nDEFINE_GUID(GUID_DEVCLASS_HIDWIIMOTE,\n\t0x7d180e63, 0x2cac, 0x4112, 0xb3, 0xd4, 0xc4, 0x22, 0x75, 0xca, 0x49, 0x7e);\n\nWDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DEVICE_INTERFACE_CONTEXT, GetDeviceInterfaceContext);\n\nNTSTATUS CreateSettingsInterfaceQueues(_In_ PDEVICE_INTERFACE_CONTEXT DeviceInterfaceContext);\nEVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL DeviceInterfaceDeviceControlCallback;\nEVT_READ_IO_CONTROL_BUFFER_FILL_BUFFER DeviceInterfaceFillReadBufferCallback;\n\nVOID ProcessGetState(_In_ WDFREQUEST Request, _In_ PDEVICE_INTERFACE_CONTEXT DeviceInterfaceContext);\nVOID ForwardReadStatusRequest(_In_ WDFREQUEST Request, _In_ PDEVICE_INTERFACE_CONTEXT DeviceInterfaceContext);\nVOID ProcessSetDriverModeSetting(_In_ WDFREQUEST Request, _In_ PDEVICE_INTERFACE_CONTEXT DeviceInterfaceContext, _In_ DRIVER_MODE_SETTING_SETTER DriverModeSettingSetter);\nVOID ProcessSetBooleanSetting(_In_ WDFREQUEST Request, _In_ PDEVICE_INTERFACE_CONTEXT DeviceInterfaceContext, _In_ BOOLEAN_SETTING_SETTER BooleanSettingSetter);\n\nVOID FillStateIoControlData(_In_ PWIIMOTE_STATE_IOCTL_DATA StateData, _In_ PWIIMOTE_DEVICE_CONTEXT WiimoteContext);\nVOID FillStatusIoControlData(_In_ PWIIMOTE_STATUS_IOCTL_DATA StatusData, _In_ PWIIMOTE_DEVICE_CONTEXT WiimoteContext);\n\nNTSTATUS DeviceInterfaceCreate(_In_ PDEVICE_CONTEXT ParentDeviceContext)\n{\n\tNTSTATUS Status = STATUS_SUCCESS;\n\tPWDFDEVICE_INIT DeviceInit;\n\tWDF_OBJECT_ATTRIBUTES Attributes;\n\tWDFDEVICE InterfaceDevice;\n\tPDEVICE_INTERFACE_CONTEXT DeviceInterfaceContext;\n\tWDF_DEVICE_PNP_CAPABILITIES PnpCapabilities;\n\tWDF_DEVICE_STATE DeviceState;\n\n\tDECLARE_CONST_UNICODE_STRING(DeviceID, L\"{398128C0-7830-4B53-BA84-1E02F05EFFB0}\\\\HIDWiimoteInterface\");\n\tDECLARE_CONST_UNICODE_STRING(InstanceID, L\"0\");\n\tDECLARE_CONST_UNICODE_STRING(DeviceText, L\"HID Wiimote Settings Interface\");\n\tDECLARE_CONST_UNICODE_STRING(DeviceLocation, L\"Somewhere in Kernel Space\");\n\n\t// Allocate and setup DeviceInit\n\tDeviceInit = WdfPdoInitAllocate(ParentDeviceContext->Device);\n\tif (DeviceInit == NULL)\n\t{\n\t\treturn STATUS_INSUFFICIENT_RESOURCES;\n\t}\n\n\t// Assing custom Device Class\n\tStatus = WdfPdoInitAssignRawDevice(DeviceInit, &GUID_DEVCLASS_HIDWIIMOTE);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tWdfDeviceInitFree(DeviceInit);\n\t\treturn Status;\n\t}\n\n\t// Device ID\n\tStatus = WdfPdoInitAssignDeviceID(DeviceInit, &DeviceID);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tWdfDeviceInitFree(DeviceInit);\n\t\treturn Status;\n\t}\n\n\t// Instance ID (unique to its parent)\n\tStatus = WdfPdoInitAssignInstanceID(DeviceInit, &InstanceID);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tWdfDeviceInitFree(DeviceInit);\n\t\treturn Status;\n\t}\n\n\t// Default Device Name and Location shown in Device Manager\n\tStatus = WdfPdoInitAddDeviceText(DeviceInit, &DeviceText, &DeviceLocation, 0x409);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tWdfDeviceInitFree(DeviceInit);\n\t\treturn Status;\n\t}\n\n\tWdfPdoInitSetDefaultLocale(DeviceInit, 0x409);\n\n\t// Set our Device Interface Context\n\tWDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&Attributes, DEVICE_INTERFACE_CONTEXT);\n\n\t// Create the raw PDO\n\tStatus = WdfDeviceCreate(&DeviceInit, &Attributes, &InterfaceDevice);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTraceStatus(\"Error creating raw PDO for Settings Interface\", Status);\n\t\tWdfDeviceInitFree(DeviceInit);\n\t\treturn Status;\n\t}\n\n\t// Initialize Raw Context\n\tDeviceInterfaceContext = GetDeviceInterfaceContext(InterfaceDevice);\n\tDeviceInterfaceContext->InterfaceDevice = InterfaceDevice;\n\tDeviceInterfaceContext->Parent = ParentDeviceContext;\n\n\t// Plug'n'Play Settings\n\tWDF_DEVICE_PNP_CAPABILITIES_INIT(&PnpCapabilities);\n\n\tPnpCapabilities.Removable = WdfTrue;\n\tPnpCapabilities.SurpriseRemovalOK = WdfTrue;\n\tPnpCapabilities.NoDisplayInUI = WdfTrue;\n\n\tWdfDeviceSetPnpCapabilities(InterfaceDevice, &PnpCapabilities);\n\n\t//Hide it in Device Manager\n\tWDF_DEVICE_STATE_INIT(&DeviceState);\n\tDeviceState.DontDisplayInUI = WdfTrue;\n\tWdfDeviceSetDeviceState(InterfaceDevice, &DeviceState);\n\n\t// Create Device Interface\n\tStatus = WdfDeviceCreateDeviceInterface(InterfaceDevice, &GUID_DEVINTERFACE_HIDWIIMOTE, NULL);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTraceStatus(\"Error creating raw PDO for Settings Interface\", Status);\n\t\tWdfObjectDelete(InterfaceDevice);\n\t\treturn Status;\n\t}\n\n\t// Make Static Child\n\tStatus = WdfFdoAddStaticChild(ParentDeviceContext->Device, InterfaceDevice);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tWdfObjectDelete(InterfaceDevice);\n\t\treturn Status;\n\t}\n\n\t// Everything is fine, so save the Interface Context in our parent/main context\n\tParentDeviceContext->SettingsInterfaceContext = DeviceInterfaceContext;\n\n\t// Create Queues\n\tStatus = CreateSettingsInterfaceQueues(DeviceInterfaceContext);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTraceStatus(\"Error Creating Settings Interface Queues\", Status);\n\t\treturn Status;\n\t}\n\n\treturn STATUS_SUCCESS;\n}\n\nNTSTATUS CreateSettingsInterfaceQueues(_In_ PDEVICE_INTERFACE_CONTEXT DeviceInterfaceContext)\n{\n\tNTSTATUS Status = STATUS_SUCCESS;\n\tWDF_IO_QUEUE_CONFIG DefaultQueueConfig;\n\t\n\t// Default IO Queue\n\tWDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&DefaultQueueConfig, WdfIoQueueDispatchSequential);\n\n\tDefaultQueueConfig.EvtIoDeviceControl = DeviceInterfaceDeviceControlCallback;\n\n\tStatus = WdfIoQueueCreate(DeviceInterfaceContext->InterfaceDevice, &DefaultQueueConfig, WDF_NO_OBJECT_ATTRIBUTES, &DeviceInterfaceContext->DefaultIOQueue);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTraceStatus(\"Failed to create Default IO Queue for Settings Interface Device\", Status);\n\t\treturn Status;\n\t}\n\n\t// Read Buffer Queue\n\tStatus = ReadIoControlBufferCreate(\n\t\t&DeviceInterfaceContext->ReadBuffer, \n\t\tDeviceInterfaceContext->InterfaceDevice, \n\t\tDeviceInterfaceContext->Parent, \n\t\tDeviceInterfaceFillReadBufferCallback,\n\t\tsizeof(WIIMOTE_STATUS_IOCTL_DATA));\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTraceStatus(\"Creating Device Interface Read Buffer failed\", Status);\n\t\treturn Status;\n\t}\n\n\treturn STATUS_SUCCESS;\n}\n\nNTSTATUS \nDeviceInterfaceRelease(\n\t_In_ PDEVICE_INTERFACE_CONTEXT DeviceInterfaceContext\n\t)\n{\n\tNTSTATUS Status = STATUS_SUCCESS;\n\n\tReadIoControlBufferFlush(&DeviceInterfaceContext->ReadBuffer);\n\n\treturn Status;\n}\n\nVOID DeviceInterfaceWiimoteStateUpdated(_In_ PDEVICE_CONTEXT DeviceContext)\n{\n\tReadIoControlBufferDispatchRequest(&DeviceContext->SettingsInterfaceContext->ReadBuffer);\n}\n\nVOID\nDeviceInterfaceDeviceControlCallback(\n\tIN WDFQUEUE      Queue,\n\tIN WDFREQUEST    Request,\n\tIN size_t        OutputBufferLength,\n\tIN size_t        InputBufferLength,\n\tIN ULONG         IoControlCode\n\t)\n{\n\tUNREFERENCED_PARAMETER(OutputBufferLength);\n\tUNREFERENCED_PARAMETER(InputBufferLength);\n\n\tPDEVICE_INTERFACE_CONTEXT DeviceInterfaceContext = GetDeviceInterfaceContext(WdfIoQueueGetDevice(Queue));\n\n\tswitch (IoControlCode)\n\t{\n\tcase IOCTL_WIIMOTE_GET_STATE:\n\t\tProcessGetState(Request, DeviceInterfaceContext);\n\t\tbreak;\n\tcase IOCTL_WIIMOTE_READ_STATUS:\n\t\tForwardReadStatusRequest(Request, DeviceInterfaceContext);\n\t\tbreak;\n\tcase IOCTL_WIIMOTE_SET_MODE:\n\t\tProcessSetDriverModeSetting(Request, DeviceInterfaceContext, WiimoteSettingsSetDriverMode);\n\t\tbreak;\n\tcase IOCTL_WIIMOTE_SET_ENABLE_WIIMOTE_XAXIS_ACCELEROMETER:\n\t\tProcessSetBooleanSetting(Request, DeviceInterfaceContext, WiimoteSettingsSetEnableWiimoteXAxisAccelerometer);\n\t\tbreak;\n\tcase IOCTL_WIIMOTE_SET_ENABLE_WIIMOTE_YAXIS_ACCELEROMETER:\n\t\tProcessSetBooleanSetting(Request, DeviceInterfaceContext, WiimoteSettingsSetEnableWiimoteYAxisAccelerometer);\n\t\tbreak;\n\tcase IOCTL_WIIMOTE_SET_SWITCH_MOUSEBUTTONS:\n\t\tProcessSetBooleanSetting(Request, DeviceInterfaceContext, WiimoteSettingsSetSwapMouseButtons);\n\t\tbreak;\n\tcase IOCTL_WIIMOTE_SET_SWITCH_TRIGGERANDSHOULDER:\n\t\tProcessSetBooleanSetting(Request, DeviceInterfaceContext, WiimoteSettingsSetSwapTriggerAndShoulder);\n\t\tbreak;\n\tcase IOCTL_WIIMOTE_SET_SPLIT_TRIGGERAXIS:\n\t\tProcessSetBooleanSetting(Request, DeviceInterfaceContext, WiimoteSettingsSetSplitTriggerAxis);\n\t\tbreak;\n\tcase IOCTL_WIIMOTE_SET_MAP_TRIGGER_AS_AXIS:\n\t\tProcessSetBooleanSetting(Request, DeviceInterfaceContext, WiimoteSettingsSetMapTriggerAsAxis);\n\t\tbreak;\n\tcase IOCTL_WIIMOTE_SET_MAP_TRIGGER_AS_BUTTONS:\n\t\tProcessSetBooleanSetting(Request, DeviceInterfaceContext, WiimoteSettingsSetMapTriggerAsButtons);\n\t\tbreak;\n\tdefault:\n\t\tTrace(\"Devcice Interface recieved unknown IOCTL: %#010x\", IoControlCode);\n\t\tWdfRequestComplete(Request, STATUS_NOT_IMPLEMENTED);\n\t}\n}\n\nVOID \nProcessGetState(\n\t_In_ WDFREQUEST Request,\n\t_In_ PDEVICE_INTERFACE_CONTEXT DeviceInterfaceContext\n\t)\n{\n\tNTSTATUS Status = STATUS_SUCCESS;\n\tPWIIMOTE_STATE_IOCTL_DATA StateData = NULL;\n\tPWIIMOTE_DEVICE_CONTEXT WiimoteContext = &(DeviceInterfaceContext->Parent->WiimoteContext);\n\n\tTrace(\"Processing IOCTL_WIIMOTE_GET_STATE\");\n\n\tStatus = WdfRequestRetrieveOutputBuffer(Request, sizeof(WIIMOTE_STATE_IOCTL_DATA), &StateData, NULL);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTraceStatus(\"Error retrieving State Buffer\", Status);\n\t\tWdfRequestComplete(Request, Status);\n\t\treturn;\n\t}\n\n\tFillStateIoControlData(StateData, WiimoteContext);\n\n\tWdfRequestCompleteWithInformation(Request, STATUS_SUCCESS, sizeof(WIIMOTE_STATE_IOCTL_DATA));\n}\n\nVOID \nForwardReadStatusRequest(\n\t_In_ WDFREQUEST Request, \n\t_In_ PDEVICE_INTERFACE_CONTEXT DeviceInterfaceContext\n\t)\n{\n\tReadIoControlBufferForwardRequest(&DeviceInterfaceContext->ReadBuffer, Request);\n}\n\nVOID\nDeviceInterfaceFillReadBufferCallback(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_Inout_updates_all_(BufferSize) PVOID Buffer,\n\t_In_ size_t BufferSize, \n\t_Out_ PSIZE_T BytesWritten)\n{\n\tUNREFERENCED_PARAMETER(BufferSize);\n\n\tFillStatusIoControlData((PWIIMOTE_STATUS_IOCTL_DATA)Buffer, &DeviceContext->WiimoteContext);\n\n\t(*BytesWritten) = sizeof(WIIMOTE_STATUS_IOCTL_DATA);\n}\n\nVOID\nFillStateIoControlData(\n\t_In_ PWIIMOTE_STATE_IOCTL_DATA StateData,\n\t_In_ PWIIMOTE_DEVICE_CONTEXT WiimoteContext\n\t)\n{\n\tRtlZeroMemory(StateData, sizeof(WIIMOTE_STATE_IOCTL_DATA));\n\n\tStateData->Settings = WiimoteContext->Settings;\n\n\tFillStatusIoControlData(&(StateData->Status), WiimoteContext);\n}\n\nVOID\nFillStatusIoControlData(\n\t_In_ PWIIMOTE_STATUS_IOCTL_DATA StatusData,\n\t_In_ PWIIMOTE_DEVICE_CONTEXT WiimoteContext\n\t)\n{\n\tRtlZeroMemory(StatusData, sizeof(WIIMOTE_STATUS_IOCTL_DATA));\n\n\tStatusData->Extension = WiimoteContext->Extension;\n\tStatusData->BatteryLevel = WiimoteContext->BatteryLevel;\n\tStatusData->LEDs = WiimoteContext->LEDState;\n}\nVOID ProcessSetDriverModeSetting(\n\t_In_ WDFREQUEST Request, \n\t_In_ PDEVICE_INTERFACE_CONTEXT DeviceInterfaceContext, \n\t_In_ DRIVER_MODE_SETTING_SETTER DriverModeSettingSetter\n\t)\n{\n\tNTSTATUS Status;\n\tPWIIMOTE_DRIVER_MODE RequestedMode;\n\n\tStatus = WdfRequestRetrieveInputBuffer(Request, sizeof(WIIMOTE_DRIVER_MODE), &RequestedMode, NULL);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTraceStatus(\"Error retrieving Driver Mode Io Control Mode Input Buffer\", Status);\n\t\tWdfRequestComplete(Request, Status);\n\t\treturn;\n\t}\n\n\tDriverModeSettingSetter(DeviceInterfaceContext->Parent, *RequestedMode);\n\n\tWdfRequestCompleteWithInformation(Request, STATUS_SUCCESS, sizeof(WIIMOTE_DRIVER_MODE));\n}\n\nVOID ProcessSetBooleanSetting(\n\t_In_ WDFREQUEST Request, \n\t_In_ PDEVICE_INTERFACE_CONTEXT DeviceInterfaceContext, \n\t_In_ BOOLEAN_SETTING_SETTER BooleanSettingSetter\n\t)\n{\n\tNTSTATUS Status;\n\tPBOOLEAN RequestedValue;\n\n\tStatus = WdfRequestRetrieveInputBuffer(Request, sizeof(BOOLEAN), &RequestedValue, NULL);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTraceStatus(\"Error retrieving Driver Mode Io Control Mode Input Buffer\", Status);\n\t\tWdfRequestComplete(Request, Status);\n\t\treturn;\n\t}\n\n\tBooleanSettingSetter(DeviceInterfaceContext->Parent, *RequestedValue);\n\n\tWdfRequestCompleteWithInformation(Request, STATUS_SUCCESS, sizeof(BOOLEAN));\n}\n"
  },
  {
    "path": "HID Wiimote/DeviceInterface.h",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tDeviceInterface.h\n\nAbstract:\n\tHeader file for DeviceInterface.c\n\n*/\n#pragma once\n\n#include \"HIDWiimote.h\"\n\n#include \"ReadIoControlBuffer.h\"\n\ntypedef struct _DEVICE_INTERFACE_CONTEXT\n{\n\tWDFDEVICE InterfaceDevice;\n\tPDEVICE_CONTEXT Parent;\n\n\tWDFQUEUE DefaultIOQueue;\n\tREAD_IO_CONTROL_BUFFER ReadBuffer;\n\n} DEVICE_INTERFACE_CONTEXT, * PDEVICE_INTERFACE_CONTEXT;\n\nNTSTATUS DeviceInterfaceCreate(_In_ PDEVICE_CONTEXT ParentDeviceContext);\nNTSTATUS DeviceInterfaceRelease(_In_ PDEVICE_INTERFACE_CONTEXT DeviceInterfaceContext);\n\nVOID DeviceInterfaceWiimoteStateUpdated(_In_ PDEVICE_CONTEXT DeviceContext);\n"
  },
  {
    "path": "HID Wiimote/DeviceInterfacePublic.h",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tDeviceInterfacePublic.h\n\nAbstract:\n\tShared types and values for the Device Interface, provided by the driver and used by the user mode dll.\n\n*/\n#pragma once\n\n#include <initguid.h>\n\n// {8259315A-7B87-4D02-83A3-20CBCDAD7647}\nDEFINE_GUID(GUID_DEVINTERFACE_HIDWIIMOTE,\n\t0x8259315a, 0x7b87, 0x4d02, 0x83, 0xa3, 0x20, 0xcb, 0xcd, 0xad, 0x76, 0x47);\n\n// IOCTLs\n// 0x00-0x7FF (0-2047) reserved, 0x800-0xFFF (2048-4095) for custom use\n#define FUNCTION_CODE(base, id) (0x800 | base | id)\n\n#define HID_WIIMOTE_CTL_CODE(base, id)\t\t\tCTL_CODE(FILE_DEVICE_KEYBOARD, FUNCTION_CODE(base, id), METHOD_NEITHER, FILE_ANY_ACCESS)\n#define HID_WIIMOTE_BUFFERED_CTL_CODE(base, id)\tCTL_CODE(FILE_DEVICE_KEYBOARD, FUNCTION_CODE(base, id), METHOD_BUFFERED, FILE_ANY_ACCESS)\n\n// Device\n#define DEVICE_IOCTL_BASE\t0x000\n\n#define IOCTL_WIIMOTE_GET_STATE\t\t\t\tHID_WIIMOTE_BUFFERED_CTL_CODE(DEVICE_IOCTL_BASE, 0x01)\n#define IOCTL_WIIMOTE_READ_STATUS\t\t\tHID_WIIMOTE_BUFFERED_CTL_CODE(DEVICE_IOCTL_BASE, 0x02)\n\n// Settings\n#define SETTINGS_IOCTL_BASE 0x100\n\n#define IOCTL_WIIMOTE_SET_MODE\t\t\t\t\t\t\t\t\tHID_WIIMOTE_BUFFERED_CTL_CODE(SETTINGS_IOCTL_BASE, 0x01)\n#define IOCTL_WIIMOTE_SET_ENABLE_WIIMOTE_XAXIS_ACCELEROMETER\tHID_WIIMOTE_BUFFERED_CTL_CODE(SETTINGS_IOCTL_BASE, 0x02)\n#define IOCTL_WIIMOTE_SET_ENABLE_WIIMOTE_YAXIS_ACCELEROMETER\tHID_WIIMOTE_BUFFERED_CTL_CODE(SETTINGS_IOCTL_BASE, 0x03)\n#define IOCTL_WIIMOTE_SET_SWITCH_MOUSEBUTTONS\t\t\t\t\tHID_WIIMOTE_BUFFERED_CTL_CODE(SETTINGS_IOCTL_BASE, 0x04)\n#define IOCTL_WIIMOTE_SET_SWITCH_TRIGGERANDSHOULDER\t\t\t\tHID_WIIMOTE_BUFFERED_CTL_CODE(SETTINGS_IOCTL_BASE, 0x10)\n#define IOCTL_WIIMOTE_SET_SPLIT_TRIGGERAXIS\t\t\t\t\t\tHID_WIIMOTE_BUFFERED_CTL_CODE(SETTINGS_IOCTL_BASE, 0x11)\n#define IOCTL_WIIMOTE_SET_MAP_TRIGGER_AS_AXIS\t\t\t\t\tHID_WIIMOTE_BUFFERED_CTL_CODE(SETTINGS_IOCTL_BASE, 0x12)\n#define IOCTL_WIIMOTE_SET_MAP_TRIGGER_AS_BUTTONS\t\t\t\tHID_WIIMOTE_BUFFERED_CTL_CODE(SETTINGS_IOCTL_BASE, 0x13)\n\n// LEDs\n#define WIIMOTE_LEDS_ONE (0x10)\n#define WIIMOTE_LEDS_TWO (0x20)\n#define WIIMOTE_LEDS_THREE (0x40)\n#define WIIMOTE_LEDS_FOUR (0x80)\n#define WIIMOTE_LEDS_ALL (WIIMOTE_LEDS_FOUR | WIIMOTE_LEDS_THREE | WIIMOTE_LEDS_TWO | WIIMOTE_LEDS_ONE)\n\n// Enumerations\ntypedef enum _WIIMOTE_EXTENSION { None, Nunchuck, BalanceBoard, ClassicController, ClassicControllerPro, WiiUProController, Guitar } WIIMOTE_EXTENSION, *PWIIMOTE_EXTENSION;\ntypedef enum _WIIMOTE_DRIVER_MODE { Gamepad, PassThrough, IRMouse, DPadMouse, GamepadAndIRMouse } WIIMOTE_DRIVER_MODE, *PWIIMOTE_DRIVER_MODE;\n\n// IOCTL data structs\ntypedef struct _WIIMOTE_SETTINGS\n{\n\tWIIMOTE_DRIVER_MODE Mode;\n\n\tBOOLEAN EnableWiimoteXAxisAccelerometer;\n\tBOOLEAN EnableWiimoteYAxisAcceleromenter;\n\tBOOLEAN SwapMouseButtons;\n\tBOOLEAN SwapTriggerAndShoulder;\n\tBOOLEAN SplitTriggerAxis;\n\tBOOLEAN MapTriggerAsAxis;\n\tBOOLEAN MapTriggerAsButtons;\n\n} WIIMOTE_SETTINGS, *PWIIMOTE_SETTINGS;\n\ntypedef struct _WIIMOTE_STATUS_IOCTL_DATA\n{\n\tUCHAR LEDs;\n\tUCHAR BatteryLevel;\n\tWIIMOTE_EXTENSION Extension;\n\n} WIIMOTE_STATUS_IOCTL_DATA, *PWIIMOTE_STATUS_IOCTL_DATA;\n\ntypedef struct _WIIMOTE_STATE_IOCTL_DATA\n{\n\tWIIMOTE_SETTINGS Settings;\n\tWIIMOTE_STATUS_IOCTL_DATA Status;\n\n} WIIMOTE_STATE_IOCTL_DATA, *PWIIMOTE_STATE_IOCTL_DATA;"
  },
  {
    "path": "HID Wiimote/Driver.c",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tDriver.c\r\n\r\nAbstract:\r\n\tContains the entry code for the Kernel Mode driver.\r\n\r\n*/\r\n#include \"Driver.h\"\r\n\r\nNTSTATUS\r\nDriverEntry (\r\n    _In_ PDRIVER_OBJECT  DriverObject,\r\n    _In_ PUNICODE_STRING RegistryPath\r\n    )\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tWDF_DRIVER_CONFIG Config;\r\n\r\n\t// Initialize Config\r\n\tWDF_DRIVER_CONFIG_INIT(&Config, DeviceAdd);\r\n\r\n\t// Create Driver Object\r\n\tStatus = WdfDriverCreate(DriverObject, RegistryPath, WDF_NO_OBJECT_ATTRIBUTES, &Config, WDF_NO_HANDLE);\r\n\r\n\treturn Status;\r\n}\r\n"
  },
  {
    "path": "HID Wiimote/Driver.h",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tDriver.h\r\n\r\nAbstract:\r\n\tHeader file for Driver.c\r\n\r\n*/\r\n#pragma once\r\n\r\n#include \"HIDWiimote.h\"\r\n\r\n#include \"Device.h\"\r\n\r\nDRIVER_INITIALIZE DriverEntry;\r\n"
  },
  {
    "path": "HID Wiimote/HID Wiimote.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Windows 10 Universal Debug|Win32\">\r\n      <Configuration>Windows 10 Universal Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Universal Debug|x64\">\r\n      <Configuration>Windows 10 Universal Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Universal Release|Win32\">\r\n      <Configuration>Windows 10 Universal Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Universal Release|x64\">\r\n      <Configuration>Windows 10 Universal Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Debug|Win32\">\r\n      <Configuration>Windows 10 Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Release|Win32\">\r\n      <Configuration>Windows 10 Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Debug|x64\">\r\n      <Configuration>Windows 10 Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Release|x64\">\r\n      <Configuration>Windows 10 Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{785D88E1-E758-4966-80FA-AEF74681FEF1}</ProjectGuid>\r\n    <TemplateGuid>{1bc93793-694f-48fe-9372-81e2b05556fd}</TemplateGuid>\r\n    <Configuration>Win8 Debug</Configuration>\r\n    <Platform Condition=\"'$(Platform)' == ''\">Win32</Platform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <RootNamespace>HID_Wiimote</RootNamespace>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"PropertySheets\">\r\n    <ConfigurationType>Driver</ConfigurationType>\r\n    <DriverType>KMDF</DriverType>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|Win32'\">\r\n    <TargetVersion>Windows10</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>\r\n    </TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n    <DriverTargetPlatform>Universal</DriverTargetPlatform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n    <TargetVersion>Windows10</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>\r\n    </TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n    <DriverTargetPlatform>Universal</DriverTargetPlatform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|x64'\">\r\n    <TargetVersion>Windows10</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>\r\n    </TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n    <DriverTargetPlatform>Universal</DriverTargetPlatform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">\r\n    <TargetVersion>Windows10</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>\r\n    </TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <SupportsPackaging>false</SupportsPackaging>\r\n    <DriverTargetPlatform>Universal</DriverTargetPlatform>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">\r\n    <Import Project=\"..\\ReleaseVersioning\\Version.props\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n    <Import Project=\"..\\ReleaseVersioning\\Version.props\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\">\r\n    <Import Project=\"..\\ReleaseVersioning\\Version.props\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\">\r\n    <Import Project=\"..\\ReleaseVersioning\\Version.props\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup>\r\n    <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|Win32'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|Win32'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|x64'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|x64'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Inf>\r\n      <TimeStamp Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\">$(DeviceDriverVersion)</TimeStamp>\r\n    </Inf>\r\n    <Inf>\r\n      <TimeStamp Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\">$(DeviceDriverVersion)</TimeStamp>\r\n    </Inf>\r\n    <Inf>\r\n      <TimeStamp Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">$(DeviceDriverVersion)</TimeStamp>\r\n    </Inf>\r\n    <Inf>\r\n      <TimeStamp Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">$(DeviceDriverVersion)</TimeStamp>\r\n    </Inf>\r\n    <DriverSign>\r\n      <FileDigestAlgorithm Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|Win32'\">SHA256</FileDigestAlgorithm>\r\n    </DriverSign>\r\n    <DriverSign>\r\n      <FileDigestAlgorithm Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">SHA256</FileDigestAlgorithm>\r\n    </DriverSign>\r\n    <DriverSign>\r\n      <FileDigestAlgorithm Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|x64'\">SHA256</FileDigestAlgorithm>\r\n    </DriverSign>\r\n    <DriverSign>\r\n      <FileDigestAlgorithm Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">SHA256</FileDigestAlgorithm>\r\n    </DriverSign>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <Inf Include=\"HIDWiimote.inf\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <FilesToPackage Include=\"$(TargetPath)\" />\r\n    <FilesToPackage Include=\"@(Inf->'%(CopyOutput)')\" Condition=\"'@(Inf)'!=''\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"Bluetooth.c\" />\r\n    <ClCompile Include=\"Device.c\" />\r\n    <ClCompile Include=\"DeviceInterface.c\" />\r\n    <ClCompile Include=\"Driver.c\" />\r\n    <ClCompile Include=\"HID.c\" />\r\n    <ClCompile Include=\"HIDDescriptors.c\" />\r\n    <ClCompile Include=\"ReadIoControlBuffer.c\" />\r\n    <ClCompile Include=\"Trace.c\" />\r\n    <ClCompile Include=\"Wiimote.c\" />\r\n    <ClCompile Include=\"WiimoteSettings.c\" />\r\n    <ClCompile Include=\"WiimoteState.c\" />\r\n    <ClCompile Include=\"WiimoteToHIDParser.c\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"Bluetooth.h\" />\r\n    <ClInclude Include=\"Device.h\" />\r\n    <ClInclude Include=\"DeviceInterface.h\" />\r\n    <ClInclude Include=\"DeviceInterfacePublic.h\" />\r\n    <ClInclude Include=\"Driver.h\" />\r\n    <ClInclude Include=\"HID.h\" />\r\n    <ClInclude Include=\"HIDDescriptors.h\" />\r\n    <ClInclude Include=\"HIDWiimote.h\" />\r\n    <ClInclude Include=\"ReadIoControlBuffer.h\" />\r\n    <ClInclude Include=\"resource.h\" />\r\n    <ClInclude Include=\"Trace.h\" />\r\n    <ClInclude Include=\"Wiimote.h\" />\r\n    <ClInclude Include=\"WiimoteSettings.h\" />\r\n    <ClInclude Include=\"WiimoteState.h\" />\r\n    <ClInclude Include=\"WiimoteToHIDParser.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"HID Wiimote.rc\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "HID Wiimote/HID Wiimote.vcxproj.backup",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Win8 Debug|Win32\">\r\n      <Configuration>Win8 Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win8 Release|Win32\">\r\n      <Configuration>Win8 Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win7 Debug|Win32\">\r\n      <Configuration>Win7 Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win7 Release|Win32\">\r\n      <Configuration>Win7 Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Vista Debug|Win32\">\r\n      <Configuration>Vista Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Vista Release|Win32\">\r\n      <Configuration>Vista Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win8 Debug|x64\">\r\n      <Configuration>Win8 Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win8 Release|x64\">\r\n      <Configuration>Win8 Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win7 Debug|x64\">\r\n      <Configuration>Win7 Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win7 Release|x64\">\r\n      <Configuration>Win7 Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Vista Debug|x64\">\r\n      <Configuration>Vista Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Vista Release|x64\">\r\n      <Configuration>Vista Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{785D88E1-E758-4966-80FA-AEF74681FEF1}</ProjectGuid>\r\n    <TemplateGuid>{1bc93793-694f-48fe-9372-81e2b05556fd}</TemplateGuid>\r\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r\n    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>\r\n    <Configuration>Win8 Debug</Configuration>\r\n    <Platform Condition=\"'$(Platform)' == ''\">Win32</Platform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <RootNamespace>HID_Wiimote</RootNamespace>\r\n    <VCTargetsPath Condition=\"'$(VCTargetsPath11)' != '' and '$(VisualStudioVersion)' == '11.0'\">$(VCTargetsPath11)</VCTargetsPath>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"PropertySheets\">\r\n    <PlatformToolset>WindowsKernelModeDriver8.0</PlatformToolset>\r\n    <ConfigurationType>Driver</ConfigurationType>\r\n    <DriverType>KMDF</DriverType>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows8</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows8</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows7</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows7</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Vista</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Vista</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows8</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows8</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows7</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows7</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Vista</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Vista</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup>\r\n    <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup>\r\n    <ClCompile>\r\n      <WppEnabled>true</WppEnabled>\r\n      <WppScanConfigurationData Condition=\"'%(ClCompile. ScanConfigurationData)'  == ''\">trace.h</WppScanConfigurationData>\r\n      <WppKernelMode>true</WppKernelMode>\r\n    </ClCompile>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|Win32'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|Win32'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|Win32'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|Win32'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|x64'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|x64'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|x64'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|x64'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|x64'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n    </Link>\r\n    <Link>\r\n      <AdditionalDependencies Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|x64'\">%(AdditionalDependencies);$(DDK_LIB_PATH)\\hidclass.lib;$(DDK_LIB_PATH)\\ntstrsafe.lib</AdditionalDependencies>\r\n      <ShowProgress Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|x64'\">NotSet</ShowProgress>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <Inf Include=\"HIDWiimote.inf\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <FilesToPackage Include=\"$(TargetPath)\" />\r\n    <FilesToPackage Include=\"@(Inf->'%(CopyOutput)')\" Condition=\"'@(Inf)'!=''\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"Bluetooth.c\" />\r\n    <ClCompile Include=\"Device.c\" />\r\n    <ClCompile Include=\"Driver.c\" />\r\n    <ClCompile Include=\"HID.c\" />\r\n    <ClCompile Include=\"HIDDescriptors.c\" />\r\n    <ClCompile Include=\"Trace.c\" />\r\n    <ClCompile Include=\"Wiimote.c\" />\r\n    <ClCompile Include=\"WiimoteToHIDParser.c\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"Bluetooth.h\" />\r\n    <ClInclude Include=\"Device.h\" />\r\n    <ClInclude Include=\"Driver.h\" />\r\n    <ClInclude Include=\"HID.h\" />\r\n    <ClInclude Include=\"HIDDescriptors.h\" />\r\n    <ClInclude Include=\"HIDWiimote.h\" />\r\n    <ClInclude Include=\"Trace.h\" />\r\n    <ClInclude Include=\"Wiimote.h\" />\r\n    <ClInclude Include=\"WiimoteToHIDParser.h\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "HID Wiimote/HID Wiimote.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Driver Files\">\r\n      <UniqueIdentifier>{8E41214B-6785-4CFE-B992-037D68949A14}</UniqueIdentifier>\r\n      <Extensions>inf;inv;inx;mof;mc;</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Device\">\r\n      <UniqueIdentifier>{5159a567-d541-480d-953f-e3c93dffcaa2}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Bluetooth\">\r\n      <UniqueIdentifier>{c20eef7d-9f93-4c18-9f99-bfb2145ed4a5}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Wiimote\">\r\n      <UniqueIdentifier>{ec536e52-2b68-45dd-a902-0321278a5e69}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"HID\">\r\n      <UniqueIdentifier>{90c8726a-976d-46bc-ac3c-1b98dbd789d8}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Driver\">\r\n      <UniqueIdentifier>{5a23eaec-7eab-4ec8-a970-9d4d31de22de}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Utilities\">\r\n      <UniqueIdentifier>{a11a5e1a-29a3-478a-a65f-6a59c0e0acf7}</UniqueIdentifier>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Inf Include=\"HIDWiimote.inf\">\r\n      <Filter>Driver Files</Filter>\r\n    </Inf>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"Device.c\">\r\n      <Filter>Device</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Bluetooth.c\">\r\n      <Filter>Bluetooth</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Wiimote.c\">\r\n      <Filter>Wiimote</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"HID.c\">\r\n      <Filter>HID</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"HIDDescriptors.c\">\r\n      <Filter>HID</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"WiimoteToHIDParser.c\">\r\n      <Filter>HID</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Driver.c\">\r\n      <Filter>Driver</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Trace.c\">\r\n      <Filter>Utilities</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"DeviceInterface.c\">\r\n      <Filter>Device</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"ReadIoControlBuffer.c\">\r\n      <Filter>Utilities</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"WiimoteSettings.c\">\r\n      <Filter>Wiimote</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"WiimoteState.c\">\r\n      <Filter>Wiimote</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"Device.h\">\r\n      <Filter>Device</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Bluetooth.h\">\r\n      <Filter>Bluetooth</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Wiimote.h\">\r\n      <Filter>Wiimote</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"HIDDescriptors.h\">\r\n      <Filter>HID</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"HID.h\">\r\n      <Filter>HID</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"WiimoteToHIDParser.h\">\r\n      <Filter>HID</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Driver.h\">\r\n      <Filter>Driver</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"HIDWiimote.h\">\r\n      <Filter>Driver</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Trace.h\">\r\n      <Filter>Utilities</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"resource.h\">\r\n      <Filter>Utilities</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"DeviceInterface.h\">\r\n      <Filter>Device</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"ReadIoControlBuffer.h\">\r\n      <Filter>Utilities</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"WiimoteSettings.h\">\r\n      <Filter>Wiimote</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"WiimoteState.h\">\r\n      <Filter>Wiimote</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"DeviceInterfacePublic.h\">\r\n      <Filter>Device</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"HID Wiimote.rc\">\r\n      <Filter>Resource Files</Filter>\r\n    </ResourceCompile>\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "HID Wiimote/HID.c",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tHID.c\r\n\r\nAbstract:\r\n\tContains IOQueues and HID specific functions.\r\n\tHandles all HID Requests and translates the Wiimote State into HID reports.\r\n*/\r\n#include \"HID.h\"\r\n\r\n#include \"Device.h\"\r\n#include \"Bluetooth.h\"\r\n#include \"HIDDescriptors.h\"\r\n#include \"WiimoteToHIDParser.h\"\r\n\r\nEVT_WDF_IO_QUEUE_IO_INTERNAL_DEVICE_CONTROL HIDInternalDeviceControlCallback;\r\nEVT_READ_IO_CONTROL_BUFFER_FILL_BUFFER HIDFillReadBufferCallback;\r\n\r\nVOID ProcessGetDeviceDescriptor(_In_ WDFREQUEST Request);\r\nVOID ProcessGetReportDescriptor(_In_ WDFREQUEST Request);\r\nVOID ProcessGetDeviceAttributes(_In_ WDFREQUEST Request,_In_ PHID_DEVICE_CONTEXT HIDContext);\r\nVOID ProcessGetString(_In_ WDFREQUEST Request, _In_ PDEVICE_CONTEXT DeviceContext);\r\nVOID ForwardReadReportRequest(_In_ WDFREQUEST Request, _In_ PDEVICE_CONTEXT DeviceContext);\r\nVOID ProcessAddresses(_In_ WDFREQUEST Request, _In_ PDEVICE_CONTEXT DeviceContext);\r\n\r\nNTSTATUS HIDPrepare(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\r\n\tStatus = GetVendorAndProductID(DeviceContext->IoTarget, &(DeviceContext->HIDContext.VendorID), &(DeviceContext->HIDContext.ProductID));\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS \r\nHIDCreateQueues(\r\n\t_In_ WDFDEVICE Device, \r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tNTSTATUS Status;\r\n\tWDF_IO_QUEUE_CONFIG QueueConfig;\r\n\tPHID_DEVICE_CONTEXT HIDContext = &DeviceContext->HIDContext;\r\n\r\n\t// Create Default Queue\r\n\tWDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&QueueConfig, WdfIoQueueDispatchParallel);\r\n\tQueueConfig.EvtIoInternalDeviceControl = HIDInternalDeviceControlCallback;\r\n\r\n\tStatus = WdfIoQueueCreate(Device, &QueueConfig, WDF_NO_OBJECT_ATTRIBUTES, &(HIDContext->DefaultIOQueue));\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tTraceStatus(\"Creating DefaultIOQueue failed\", Status);\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t// Create Read Buffer Queue\r\n\tStatus = ReadIoControlBufferCreate(&HIDContext->ReadBuffer, DeviceContext->Device, DeviceContext, HIDFillReadBufferCallback, sizeof(HID_GAMEPAD_REPORT));\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\tTraceStatus(\"Creating HID Read Buffer failed\", Status);\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nPHID_DEVICE_CONTEXT\r\nGetHIDContext(\r\n\t_In_ WDFQUEUE Queue\r\n\t)\r\n{\r\n\treturn &(GetDeviceContext(WdfIoQueueGetDevice(Queue))->HIDContext);\r\n}\r\n\r\nVOID\r\nHIDInternalDeviceControlCallback(\r\n\t_In_ WDFQUEUE Queue,\r\n    _In_ WDFREQUEST Request,\r\n    _In_ size_t OutputBufferLength,\r\n    _In_ size_t InputBufferLength,\r\n    _In_ ULONG IoControlCode\r\n\t)\r\n{\r\n\tUNREFERENCED_PARAMETER(Queue);\r\n\tUNREFERENCED_PARAMETER(OutputBufferLength);\r\n\tUNREFERENCED_PARAMETER(InputBufferLength);\r\n\r\n\tswitch(IoControlCode)\r\n\t{\r\n\tcase IOCTL_HID_GET_DEVICE_DESCRIPTOR:\r\n\t\tProcessGetDeviceDescriptor(Request);\r\n\t\tbreak;\r\n\tcase IOCTL_HID_GET_DEVICE_ATTRIBUTES:\r\n\t\tProcessGetDeviceAttributes(Request, GetHIDContext(Queue));\r\n\t\tbreak;\r\n\tcase IOCTL_HID_GET_REPORT_DESCRIPTOR:\r\n\t\tProcessGetReportDescriptor(Request);\r\n\t\tbreak;\r\n\tcase IOCTL_HID_GET_STRING:\r\n\t\tProcessGetString(Request, GetDeviceContext(WdfIoQueueGetDevice(Queue)));\r\n\t\tbreak;\r\n\tcase IOCTL_HID_READ_REPORT:\r\n\t\tForwardReadReportRequest(Request, GetDeviceContext(WdfIoQueueGetDevice(Queue)));\r\n\t\tbreak;\r\n\tcase IOCTL_WIIMOTE_ADDRESSES:\r\n\t\tProcessAddresses(Request, GetDeviceContext(WdfIoQueueGetDevice(Queue)));\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tTrace(\"Unknown IOCTL: %x\", IoControlCode);\r\n\t\tWdfRequestComplete(Request, STATUS_NOT_SUPPORTED);\r\n\t}\r\n}\r\n\r\nVOID\r\nProcessGetDeviceDescriptor(\r\n\t_In_ WDFREQUEST Request\r\n\t)\r\n{\r\n\tNTSTATUS Status;\r\n    WDFMEMORY Memory;\r\n\t\r\n\t// Get Memory\r\n\tStatus = WdfRequestRetrieveOutputMemory(Request, &Memory);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfRequestComplete(Request, Status);\r\n\t\treturn;\r\n\t}\r\n\r\n\t// Copy \r\n\tStatus = WdfMemoryCopyFromBuffer(Memory, 0, (PVOID)&HIDDescriptor, HIDDescriptor.bLength);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfRequestComplete(Request, Status);\r\n\t\treturn;\r\n\t}\r\n\r\n\t// Complete Request\r\n\tWdfRequestCompleteWithInformation(Request, Status, HIDDescriptor.bLength);\r\n}\r\n\r\nVOID\r\nProcessGetDeviceAttributes(\r\n\t_In_ WDFREQUEST Request,\r\n\t_In_ PHID_DEVICE_CONTEXT HIDContext\r\n\t)\r\n{\r\n\tNTSTATUS Status;\r\n    PHID_DEVICE_ATTRIBUTES DeviceAttributes = NULL;\r\n\tsize_t DeviceAttributesSize = sizeof(HID_DEVICE_ATTRIBUTES);\r\n\r\n\t// Get Buffer\r\n\tStatus = WdfRequestRetrieveOutputBuffer(Request, DeviceAttributesSize, (PVOID *)&DeviceAttributes, NULL);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfRequestComplete(Request, Status);\r\n\t\treturn;\r\n\t}\r\n\r\n\t// Fill out\r\n\tDeviceAttributes->Size = (ULONG)DeviceAttributesSize;\r\n\tDeviceAttributes->VendorID = HIDContext->VendorID;\r\n\tDeviceAttributes->ProductID = HIDContext->ProductID;\r\n\tDeviceAttributes->VersionNumber = 0x0000;\r\n\t\r\n\t// Complete Request\r\n\tWdfRequestCompleteWithInformation(Request, Status, DeviceAttributesSize);\r\n}\r\n\r\nVOID\r\nProcessGetReportDescriptor(\r\n\t_In_ WDFREQUEST Request\r\n\t)\r\n{\r\n\tNTSTATUS Status;\r\n    WDFMEMORY Memory;\r\n\tsize_t ReportDescriptorSize = HIDReportDescriptorSize;\r\n\r\n\t// Get Memory\r\n\tStatus = WdfRequestRetrieveOutputMemory(Request, &Memory);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfRequestComplete(Request, Status);\r\n\t\treturn;\r\n\t}\r\n\r\n\t// Copy \r\n\tStatus = WdfMemoryCopyFromBuffer(Memory, 0, (PVOID)&HIDReportDescriptor, ReportDescriptorSize);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfRequestComplete(Request, Status);\r\n\t\treturn;\r\n\t}\r\n\r\n\t// Complete Request\r\n\tWdfRequestCompleteWithInformation(Request, Status, ReportDescriptorSize);\r\n}\r\n\r\nVOID ProcessGetString(\r\n\t_In_ WDFREQUEST Request,\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n)\r\n{\r\n\tNTSTATUS Status;\r\n\tWDF_REQUEST_PARAMETERS Parameters;\r\n\tWDFMEMORY Memory;\r\n\tPUNICODE_STRING String = NULL;\r\n\r\n\tWDF_REQUEST_PARAMETERS_INIT(&Parameters);\r\n\tWdfRequestGetParameters(Request, &Parameters);\r\n\r\n\tStatus = WdfRequestRetrieveOutputMemory(Request, &Memory);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfRequestComplete(Request, Status);\r\n\t\treturn;\r\n\t}\r\n\r\n\tswitch (((UINT_PTR)Parameters.Parameters.DeviceIoControl.Type3InputBuffer) & 0xFF)\r\n\t{\r\n\tcase HID_STRING_ID_IPRODUCT:\r\n\t\tString = &DeviceContext->BluetoothContext.DeviceNameString;\r\n\t\tbreak;\r\n\tcase HID_STRING_ID_IMANUFACTURER:\r\n\t\tWdfRequestComplete(Request, STATUS_NOT_SUPPORTED);\r\n\t\treturn;\r\n\tcase HID_STRING_ID_ISERIALNUMBER:\r\n\t\tString = &DeviceContext->BluetoothContext.DeviceAddressString;\r\n\t\tbreak;\r\n\t}\r\n\r\n\tStatus = WdfMemoryCopyFromBuffer(Memory, 0, (PVOID)String->Buffer, String->MaximumLength);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\tWdfRequestComplete(Request, Status);\r\n\t\treturn;\r\n\t}\r\n\r\n\t// Complete Request\r\n\tWdfRequestCompleteWithInformation(Request, Status, String->MaximumLength);\r\n}\r\n\r\nVOID \r\nForwardReadReportRequest(\r\n\t_In_ WDFREQUEST Request,\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tReadIoControlBufferForwardRequest(&DeviceContext->HIDContext.ReadBuffer, Request);\r\n}\r\n\r\n\r\nNTSTATUS \r\nHIDRelease(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPHID_DEVICE_CONTEXT HIDContext = &(DeviceContext->HIDContext);\r\n\r\n\tReadIoControlBufferFlush(&HIDContext->ReadBuffer);\r\n\r\n\treturn Status;\r\n}\r\n\r\nVOID \r\nHIDFillReadBufferCallback(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext, \r\n\t_Inout_updates_all_(BufferSize) PVOID Buffer,\r\n\t_In_ size_t BufferSize, \r\n\t_Out_ PSIZE_T BytesWritten)\r\n{\r\n\tPWIIMOTE_DEVICE_CONTEXT WiimoteContext = &(DeviceContext->WiimoteContext);\r\n\t(*BytesWritten) = 0;\r\n\r\n\tswitch (WiimoteContext->Settings.Mode)\r\n\t{\r\n\tcase Gamepad:\r\n\t\tParseWiimoteStateAsGamepad(WiimoteContext, Buffer, BufferSize, BytesWritten);\r\n\t\tbreak;\r\n\tcase PassThrough:\r\n\t\tbreak;\r\n\tcase IRMouse:\r\n\t\tParseWiimoteStateAsIRMouse(&(WiimoteContext->State), Buffer, BufferSize, BytesWritten);\r\n\t\tbreak;\r\n\tcase DPadMouse:\r\n\t\tParseWiimoteStateAsDPadMouse(&(WiimoteContext->State), Buffer, BufferSize, BytesWritten);\r\n\t\tbreak;\r\n\tcase GamepadAndIRMouse:\r\n\t\tif (!DeviceContext->HIDContext.GamepadAndIRMouseReportToggleFlag)\r\n\t\t{\r\n\t\t\tParseWiimoteStateAsIRMouse(&(WiimoteContext->State), Buffer, BufferSize, BytesWritten);\r\n\t\t\tDeviceContext->HIDContext.GamepadAndIRMouseReportToggleFlag = !DeviceContext->HIDContext.GamepadAndIRMouseReportToggleFlag;\r\n\r\n\t\t\tReadIoControlBufferDispatchRequest(&(DeviceContext->HIDContext.ReadBuffer));\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tParseWiimoteStateAsGamepad(WiimoteContext, Buffer, BufferSize, BytesWritten);\r\n\t\t\tDeviceContext->HIDContext.GamepadAndIRMouseReportToggleFlag = !DeviceContext->HIDContext.GamepadAndIRMouseReportToggleFlag;\r\n\t\t}\r\n\t\tbreak;\r\n\t}\r\n}\r\n\r\nVOID \r\nHIDWiimoteStateUpdated(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tReadIoControlBufferDispatchRequest(&(DeviceContext->HIDContext.ReadBuffer));\r\n}\r\n\r\nVOID\r\nProcessAddresses(\r\n\t_In_ WDFREQUEST Request,\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPHID_MINIPORT_ADDRESSES Addresses = NULL;\r\n\r\n\tTrace(\"Adresses recieved\");\r\n\r\n\tStatus = WdfRequestRetrieveInputBuffer(Request, sizeof(HID_MINIPORT_ADDRESSES), (PVOID *)&Addresses, NULL);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tTraceStatus(\"Couldn't retrieve Input Buffer\", Status);\r\n\t\tWdfRequestComplete(Request, STATUS_SUCCESS);\r\n\t\treturn;\r\n\t}\r\n\r\n\tSetHIDMiniportAddresses(DeviceContext, Addresses);\r\n\r\n\tWdfRequestComplete(Request, STATUS_SUCCESS);\r\n}\r\n"
  },
  {
    "path": "HID Wiimote/HID.h",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tHID.h\r\n\r\nAbstract:\r\n\tHeader file for HID.c\r\n*/\r\n#pragma once\r\n\r\n#include \"HIDWiimote.h\"\r\n\r\n#include <hidport.h>\r\n\r\n#include \"ReadIoControlBuffer.h\"\r\n\r\ntypedef struct _HID_DEVICE_CONTEXT \r\n{\r\n\tWDFQUEUE DefaultIOQueue;\r\n\tREAD_IO_CONTROL_BUFFER ReadBuffer;\r\n\r\n\tUSHORT VendorID;\r\n\tUSHORT ProductID;\r\n\r\n\tBOOLEAN GamepadAndIRMouseReportToggleFlag;\r\n\r\n} HID_DEVICE_CONTEXT, * PHID_DEVICE_CONTEXT;\r\n\r\ntypedef UCHAR HID_REPORT_DESCRIPTOR, *PHID_REPORT_DESCRIPTOR;\r\n\r\nNTSTATUS HIDPrepare(_In_ PDEVICE_CONTEXT DeviceContext);\r\nNTSTATUS HIDCreateQueues(_In_ WDFDEVICE Device, _In_ PDEVICE_CONTEXT DeviceContext);\r\n\r\nNTSTATUS HIDRelease(_In_ PDEVICE_CONTEXT DeviceContext);\r\n\r\nVOID HIDWiimoteStateUpdated(_In_ PDEVICE_CONTEXT DeviceContext);\r\n\r\n#define IOCTL_WIIMOTE_ADDRESSES CTL_CODE(FILE_DEVICE_KEYBOARD, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)\r\n"
  },
  {
    "path": "HID Wiimote/HIDDescriptors.c",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tHIDDescriptor.c\r\n\r\nAbstract:\r\n\tContains the definition of several HID Descriptors\r\n*/\r\n#include \"HIDDescriptors.h\"\r\n\r\nCONST HID_REPORT_DESCRIPTOR HIDReportDescriptor[] = {\r\n\t0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)\r\n\t0x09, 0x05,                    // USAGE (Game Pad)\r\n\t0xa1, 0x01,                    // COLLECTION (Application)\r\n/*\r\n\t\t\t\t   |-----------------------------|\r\n\t\t\t\t   |\t\t   Gamepad\t\t\t |\r\n\t\t\t\t   |-----------------------------|\r\n\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t  Report ID\t\t\t\t\t\t\t    |\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t\tX-Axis\t\t\t\t\t\t\t\t|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t\tY-Axis\t\t\t\t\t\t\t\t|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\tButton 1-8\t\t\t\t\t\t\t\t|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t  Button 9-13\t\t\t\t   |xxxxxxx Padding xxxxxxxx|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t\tZ-Axis\t\t\t\t\t\t\t\t|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t\tRX-Axis\t\t\t\t\t\t\t\t|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t\tRY-Axis\t\t\t\t\t\t\t\t|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t\tRZ-Axis\t\t\t\t\t\t\t\t|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t  Hat Switch\t\t\t\t\t\t    |\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n\r\n*/\r\n\t0x85, GAMEPAD_REPORT_ID,\t   //   REPORT_ID (GAMEPAD_REPORT_ID)  \r\n\t0x05, 0x01,                    //   USAGE_PAGE (Generic Desktop)\r\n\t0x09, 0x30,                    //   USAGE (X)\r\n\t0x09, 0x31,                    //   USAGE (Y)\r\n\t0x15, 0x00,                    //   LOGICAL_MINIMUM (0)\r\n\t0x26, 0xFF, 0x00,\t\t\t   //   LOGICAL_MAXIMUM (255)\r\n\t0x75, 0x08,                    //   REPORT_SIZE (8)\r\n\t0x95, 0x02,                    //   REPORT_COUNT (2)\r\n\t0x81, 0x02,                    //   INPUT (Data,Var,Abs)\r\n\t0x05, 0x09,                    //   USAGE_PAGE (Button)\r\n\t0x19, 0x01,                    //   USAGE_MINIMUM (Button 1)\r\n\t0x29, 0x0D,                    //   USAGE_MAXIMUM (Button 13)\r\n\t0x15, 0x00,                    //   LOGICAL_MINIMUM (0)\r\n\t0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)\r\n\t0x95, 0x0D,                    //   REPORT_COUNT (13)\r\n\t0x75, 0x01,                    //   REPORT_SIZE (1)\r\n\t0x81, 0x02,                    //   INPUT (Data,Var,Abs)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x75, 0x03,                    //   REPORT_SIZE (3)\r\n\t0x81, 0x03,                    //   INPUT (Cnst,Var,Abs)\r\n\t0x05, 0x01,                    //   USAGE_PAGE (Generic Desktop)\r\n\t0x09, 0x32,                    //   USAGE (Z)\r\n\t0x09, 0x33,                    //   USAGE (RX)\r\n\t0x09, 0x34,                    //   USAGE (RY)\r\n\t0x09, 0x35,                    //   USAGE (RZ)\r\n\t0x15, 0x00,\t\t\t\t\t   //   LOGICAL_MINIMUM (0)\r\n\t0x26, 0xFF, 0x00,\t\t\t   //   LOGICAL_MAXIMUM (255)\r\n\t0x75, 0x08,                    //   REPORT_SIZE (8)\r\n\t0x95, 0x04,                    //   REPORT_COUNT (4)\r\n\t0x81, 0x02,                    //   INPUT (Data,Var,Abs)\r\n\t0x05, 0x01,                    //   USAGE_PAGE (Generic Desktop)\r\n\t0x09, 0x39,                    //   USAGE (Hat Swtich)\r\n\t0x15, 0x01,                    //   LOGICAL_MINIMUM (1)\r\n\t0x25, 0x08,                    //   LOGICAL_MAXIMUM (8)\r\n\t0x35, 0x00,                    //   PHYSICAL_MINIMUM (0)\r\n\t0x46, 0x3b, 0x01,              //   PHYSICAL_MAXIMUM (315)\r\n\t0x55, 0x00,                    //   UNIT_EXPONENT (0)\r\n\t0x65, 0x14,                    //   UNIT (English Rotation: Angular Position)\r\n\t0x75, 0x08,                    //   REPORT_SIZE (8)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x81, 0x4a,                    //   INPUT (Data,Var,Abs,Wrap,Null)\r\n/*\r\n\t\t\t\t   |-----------------------------|\r\n\t\t\t\t   |\t\t   Wiimote\t\t\t |\r\n\t\t\t\t   |-----------------------------|\r\n*/\t\r\n\t0xc0                           // END_COLLECTION\r\n/*\r\n\t0x06, 0x00, 0xff,              //   USAGE_PAGE (Vendor Defined)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x91, 0x00,                    //   OUTPUT (Data,Ary,Abs)\r\n\t0x85, 0x11,                    //   REPORT_ID (11)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x91, 0x00,                    //   OUTPUT (Data,Ary,Abs)\r\n\t0x85, 0x12,                    //   REPORT_ID (12)\r\n\t0x95, 0x02,                    //   REPORT_COUNT (2)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x91, 0x00,                    //   OUTPUT (Data,Ary,Abs)\r\n\t0x85, 0x13,                    //   REPORT_ID (13)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x91, 0x00,                    //   OUTPUT (Data,Ary,Abs)\r\n\t0x85, 0x14,                    //   REPORT_ID (14)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x91, 0x00,                    //   OUTPUT (Data,Ary,Abs)\r\n\t0x85, 0x15,                    //   REPORT_ID (15)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x91, 0x00,                    //   OUTPUT (Data,Ary,Abs)\r\n\t0x85, 0x16,                    //   REPORT_ID (16)\r\n\t0x95, 0x15,                    //   REPORT_COUNT (21)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x91, 0x00,                    //   OUTPUT (Data,Ary,Abs)\r\n\t0x85, 0x17,                    //   REPORT_ID (17)\r\n\t0x95, 0x06,                    //   REPORT_COUNT (6)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x91, 0x00,                    //   OUTPUT (Data,Ary,Abs)\r\n\t0x85, 0x18,                    //   REPORT_ID (18)\r\n\t0x95, 0x15,                    //   REPORT_COUNT (21)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x91, 0x00,                    //   OUTPUT (Data,Ary,Abs)\r\n\t0x85, 0x19,                    //   REPORT_ID (19)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x91, 0x00,                    //   OUTPUT (Data,Ary,Abs)\r\n\t0x85, 0x1a,                    //   REPORT_ID (1A)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x91, 0x00,                    //   OUTPUT (Data,Ary,Abs)\r\n\t0x85, 0x20,                    //   REPORT_ID (20)\r\n\t0x95, 0x06,                    //   REPORT_COUNT (6)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x81, 0x00,                    //   INPUT (Data,Ary,Abs)\r\n\t0x85, 0x21,                    //   REPORT_ID (21)\r\n\t0x95, 0x15,                    //   REPORT_COUNT (21)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x81, 0x00,                    //   INPUT (Data,Ary,Abs)\r\n\t0x85, 0x22,                    //   REPORT_ID (22)\r\n\t0x95, 0x04,                    //   REPORT_COUNT (4)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x81, 0x00,                    //   INPUT (Data,Ary,Abs)\r\n\t0x85, 0x30,                    //   REPORT_ID (30)\r\n\t0x95, 0x02,                    //   REPORT_COUNT (2)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x81, 0x00,                    //   INPUT (Data,Ary,Abs)\r\n\t0x85, 0x31,                    //   REPORT_ID (31)\r\n\t0x95, 0x05,                    //   REPORT_COUNT (5)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x81, 0x00,                    //   INPUT (Data,Ary,Abs)\r\n\t0x85, 0x32,                    //   REPORT_ID (32)\r\n\t0x95, 0x0a,                    //   REPORT_COUNT (10)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x81, 0x00,                    //   INPUT (Data,Ary,Abs)\r\n\t0x85, 0x33,                    //   REPORT_ID (33)\r\n\t0x95, 0x11,                    //   REPORT_COUNT (17)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x81, 0x00,                    //   INPUT (Data,Ary,Abs)\r\n\t0x85, 0x34,                    //   REPORT_ID (34)\r\n\t0x95, 0x15,                    //   REPORT_COUNT (21)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x81, 0x00,                    //   INPUT (Data,Ary,Abs)\r\n\t0x85, 0x35,                    //   REPORT_ID (35)\r\n\t0x95, 0x15,                    //   REPORT_COUNT (21)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x81, 0x00,                    //   INPUT (Data,Ary,Abs)\r\n\t0x85, 0x36,                    //   REPORT_ID (36)\r\n\t0x95, 0x15,                    //   REPORT_COUNT (21)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x81, 0x00,                    //   INPUT (Data,Ary,Abs)\r\n\t0x85, 0x37,                    //   REPORT_ID (37)\r\n\t0x95, 0x15,                    //   REPORT_COUNT (21)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x81, 0x00,                    //   INPUT (Data,Ary,Abs)\r\n\t0x85, 0x3d,                    //   REPORT_ID (3D)\r\n\t0x95, 0x15,                    //   REPORT_COUNT (21)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x81, 0x00,                    //   INPUT (Data,Ary,Abs)\r\n\t0x85, 0x3e,                    //   REPORT_ID (3E)\r\n\t0x95, 0x15,                    //   REPORT_COUNT (21)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x81, 0x00,                    //   INPUT (Data,Ary,Abs)\r\n\t0x85, 0x3f,                    //   REPORT_ID (3F)\r\n\t0x95, 0x15,                    //   REPORT_COUNT (21)\r\n\t0x09, 0x01,                    //   USAGE (Vendor Ussage 1)\r\n\t0x81, 0x00,                    //   INPUT (Data,Ary,Abs)\r\n\t0xc0,                          // END_COLLECTION\r\n/*\r\n\t\t\t\t   |-----------------------------|\r\n\t\t\t\t   |\t\t  IR-Mouse\t\t\t |\r\n\t\t\t\t   |-----------------------------|\r\n\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t  Report ID\t\t\t\t\t\t\t    |\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\tButton 1-3\t\t  |xxxxxxxxxxxxxxxx Padding\txxxxxxxxxxxxxxxx|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t\tX-Axis\t\t\t\t\t\t\t\t|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t\tX-Axis\t\t\t\t\t\t\t\t|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t\tY-Axis\t\t\t\t\t\t\t\t|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t\tY-Axis\t\t\t\t\t\t\t\t|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n*/\r\n/*\r\n\t0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)\r\n\t0x09, 0x02,                    // USAGE (Mouse)\r\n\t0xa1, 0x01,                    // COLLECTION (Application)\r\n\t0x09, 0x01,                    //   USAGE (Pointer)\r\n\t0x85, IRMOUSE_REPORT_ID,\t   //   REPORT_ID (IRMOUSE_REPORT_ID)  \r\n\t0x05, 0x09,                    //   USAGE_PAGE (Button)\r\n\t0x19, 0x01,                    //   USAGE_MINIMUM (Button 1)\r\n\t0x29, 0x03,                    //   USAGE_MAXIMUM (Button 3)\r\n\t0x15, 0x00,                    //   LOGICAL_MINIMUM (0)\r\n\t0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)\r\n\t0x95, 0x03,                    //   REPORT_COUNT (3)\r\n\t0x75, 0x01,                    //   REPORT_SIZE (1)\r\n\t0x81, 0x02,                    //   INPUT (Data,Var,Abs)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x75, 0x05,                    //   REPORT_SIZE (5)\r\n\t0x81, 0x03,                    //   INPUT (Cnst,Var,Abs)\r\n\t0x05, 0x01,                    //   USAGE_PAGE (Generic Desktop)\r\n\t0x09, 0x30,                    //   USAGE (X)\r\n\t0x15, 0x00,                    //   LOGICAL_MINIMUM (0)\r\n\t0x26, 0xFF, 0x03,              //   LOGICAL_MAXIMUM (1023)\r\n\t0x75, 0x0B,                    //   REPORT_SIZE (11)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x81, 0x02,                    //   INPUT (Data,Var,Abs)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x75, 0x05,                    //   REPORT_SIZE (5)\r\n\t0x81, 0x03,                    //   INPUT (Cnst,Var,Abs)\r\n\t0x09, 0x31,                    //   USAGE (Y)\r\n\t0x15, 0x00,                    //   LOGICAL_MINIMUM (0)\r\n\t0x26, 0xFF, 0x03,              //   LOGICAL_MAXIMUM (1023)\r\n\t0x75, 0x0B,                    //   REPORT_SIZE (11)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x81, 0x02,                    //   INPUT (Data,Var,Abs)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x75, 0x05,                    //   REPORT_SIZE (5)\r\n\t0x81, 0x03,                    //   INPUT (Cnst,Var,Abs)\r\n\t0xc0,                          // END_COLLECTION\r\n/*\r\n\t\t\t\t   |-----------------------------|\r\n\t\t\t\t   |\t\t DPad-Mouse\t\t\t |\r\n\t\t\t\t   |-----------------------------|\r\n\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t  Report ID\t\t\t\t\t\t\t    |\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\tButton 1-3\t\t  |xxxxxxxxxxxxxxxx Padding\txxxxxxxxxxxxxxxx|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t\tX-Axis\t\t\t\t\t\t\t\t|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|\t\t\t\t\t\t\t\tY-Axis\t\t\t\t\t\t\t\t|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n|xxxxxxxxxxxxxxxxxxxxxxxxxxxxx Padding\txxxxxxxxxxxxxxxxxxxxxxxxxxxx|\r\n|--------|-------|--------|-------|--------|-------|--------|-------|\r\n*/\t\r\n/*\r\n\t0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)\r\n\t0x09, 0x02,                    // USAGE (Mouse)\r\n\t0xa1, 0x01,                    // COLLECTION (Application)\r\n\t0x09, 0x01,                    //   USAGE (Pointer)\r\n\t0x85, DPADMOUSE_REPORT_ID,\t   //   REPORT_ID (DPADMOUSE_REPORT_ID)  \r\n\t0x05, 0x09,                    //   USAGE_PAGE (Button)\r\n\t0x19, 0x01,                    //   USAGE_MINIMUM (Button 1)\r\n\t0x29, 0x03,                    //   USAGE_MAXIMUM (Button 3)\r\n\t0x15, 0x00,                    //   LOGICAL_MINIMUM (0)\r\n\t0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)\r\n\t0x95, 0x03,                    //   REPORT_COUNT (3)\r\n\t0x75, 0x01,                    //   REPORT_SIZE (1)\r\n\t0x81, 0x02,                    //   INPUT (Data,Var,Abs)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x75, 0x05,                    //   REPORT_SIZE (5)\r\n\t0x81, 0x03,                    //   INPUT (Cnst,Var,Abs)\r\n\t0x05, 0x01,                    //   USAGE_PAGE (Generic Desktop)\r\n\t0x09, 0x30,                    //   USAGE (X)\r\n\t0x09, 0x31,                    //   USAGE (Y)\r\n\t0x15, 0x81,                    //   LOGICAL_MINIMUM (-127)\r\n\t0x25, 0x7f,                    //   LOGICAL_MAXIMUM (127)\r\n\t0x75, 0x08,                    //   REPORT_SIZE (8)\r\n\t0x95, 0x02,                    //   REPORT_COUNT (2)\r\n\t0x81, 0x06,                    //   INPUT (Data,Var,Rel)\r\n\t0x95, 0x01,                    //   REPORT_COUNT (1)\r\n\t0x75, 0x08,                    //   REPORT_SIZE (8)\r\n\t0x81, 0x03,                    //   INPUT (Cnst,Var,Abs)\r\n\t0xc0                           // END_COLLECTION\r\n*/\r\n};\r\n\r\n\r\nCONST HID_DESCRIPTOR HIDDescriptor = {\r\n\t0x09,   // length of HID descriptor\r\n    0x21,   // descriptor type == HID  0x21\r\n    0x0111, // hid spec release\r\n    0x00,   // country code == Not Specified\r\n    0x01,   // number of HID class descriptors\r\n    { \r\n\t\t0x22, // descriptor type \r\n\t\tsizeof(HIDReportDescriptor) // total length of report descriptor\r\n\t}  \r\n};\r\n\r\nCONST size_t HIDReportDescriptorSize = sizeof(HIDReportDescriptor);\r\n"
  },
  {
    "path": "HID Wiimote/HIDDescriptors.h",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tHIDDescriptor.h\r\n\r\nAbstract:\r\n\tCommon Header file.\r\n\tContains common includes and declarations.\r\n\r\n*/\r\n#pragma once\r\n\r\n#include \"HID.h\"\r\n\r\n#define GAMEPAD_REPORT_ID 0x01\r\n#define IRMOUSE_REPORT_ID 0x02\r\n#define DPADMOUSE_REPORT_ID 0x03\r\n\r\nextern CONST HID_REPORT_DESCRIPTOR HIDReportDescriptor[];\r\nextern CONST HID_DESCRIPTOR HIDDescriptor;\r\nextern CONST size_t HIDReportDescriptorSize;\r\n\r\n#pragma pack(push, 1)\r\ntypedef struct _HID_GAMEPAD_REPORT {\r\n\tUCHAR ReportID;\r\n\tUCHAR XAxis;\r\n\tUCHAR YAxis;\r\n\tUCHAR Buttons[2];\r\n\tUCHAR ZAxis;\r\n\tUCHAR RXAxis;\r\n\tUCHAR RYAxis;\r\n\tUCHAR RZAxis;\r\n\tUCHAR Hatswitch;\r\n} HID_GAMEPAD_REPORT, * PHID_GAMEPAD_REPORT;\r\n\r\nVOID\r\nFORCEINLINE\r\nHID_GAMEPAD_REPORT_INIT(\r\n\t_Out_ PHID_GAMEPAD_REPORT Report)\r\n{\r\n\tRtlZeroMemory(Report, sizeof(HID_GAMEPAD_REPORT));\r\n\tReport->ReportID = GAMEPAD_REPORT_ID;\r\n\tReport->XAxis = 0x7F;\r\n\tReport->YAxis = 0x7F;\r\n\tReport->ZAxis = 0x7F;\r\n\tReport->RXAxis = 0x7F;\r\n\tReport->RYAxis = 0x7F;\r\n\tReport->RZAxis = 0x7F;\r\n}\r\n\r\ntypedef struct _HID_IRMOUSE_REPORT\r\n{\r\n\tUCHAR ReportID;\r\n\tUCHAR Buttons;\r\n\tUSHORT X;\r\n\tUSHORT Y;\r\n} HID_IRMOUSE_REPORT, * PHID_IRMOUSE_REPORT;\r\n\r\nVOID\r\nFORCEINLINE\r\nHID_IRMOUSE_REPORT_INIT(\r\n\t_Out_ PHID_IRMOUSE_REPORT Report)\r\n{\r\n\tRtlZeroMemory(Report, sizeof(HID_IRMOUSE_REPORT));\r\n\tReport->ReportID = IRMOUSE_REPORT_ID;\r\n}\r\n\r\ntypedef struct _HID_DPADMOUSE_REPORT\r\n{\r\n\tUCHAR ReportID;\r\n\tUCHAR Buttons;\r\n\tUCHAR X;\r\n\tUCHAR Y;\r\n} HID_DPADMOUSE_REPORT, *PHID_DPADMOUSE_REPORT;\r\n\r\nVOID\r\nFORCEINLINE\r\nHID_DPADMOUSE_REPORT_INIT(\r\n\t_Out_ PHID_DPADMOUSE_REPORT Report)\r\n{\r\n\tRtlZeroMemory(Report, sizeof(HID_DPADMOUSE_REPORT));\r\n\tReport->ReportID = DPADMOUSE_REPORT_ID;\r\n}\r\n\r\n#pragma pack(pop)"
  },
  {
    "path": "HID Wiimote/HIDWiimote.h",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tHIDWiimote.h\r\n\r\nAbstract:\r\n\tCommon Header file.\r\n\tContains common includes and declarations.\r\n\r\n*/\r\n#pragma once\r\n\r\n#include <initguid.h>\r\n#include <ntddk.h>\r\n#include <wdf.h>\r\n\r\n#include \"Trace.h\"\r\n\r\n//#define MOUSE_DPAD\r\n//#define MOUSE_IR\r\n\r\n//Forward Declarations\r\ntypedef struct _DEVICE_CONTEXT DEVICE_CONTEXT, * PDEVICE_CONTEXT;\r\ntypedef struct _DEVICE_INTERFACE_CONTEXT DEVICE_INTERFACE_CONTEXT, *PDEVICE_INTERFACE_CONTEXT;\r\ntypedef struct _WIIMOTE_DEVICE_CONTEXT WIIMOTE_DEVICE_CONTEXT, * PWIIMOTE_DEVICE_CONTEXT;\r\ntypedef struct _BLUETOOTH_DEVICE_CONTEXT BLUETOOTH_DEVICE_CONTEXT, * PBLUETOOTH_DEVICE_CONTEXT;\r\ntypedef struct _HID_DEVICE_CONTEXT HID_DEVICE_CONTEXT, * PHID_DEVICE_CONTEXT;\r\n\r\n// Used by HID Layer and Device Part\r\ntypedef NTSTATUS (*PNOTIFY_PRESENCE)(PDEVICE_OBJECT, BOOLEAN);\r\n\r\ntypedef struct _HID_MINIPORT_ADDRESSES \r\n{\r\n\tPDEVICE_OBJECT FDO;\r\n\tPNOTIFY_PRESENCE HidNotifyPresence;\r\n\r\n} HID_MINIPORT_ADDRESSES, * PHID_MINIPORT_ADDRESSES;\r\n"
  },
  {
    "path": "HID Wiimote/ReadIoControlBuffer.c",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tReadIoControlBuffer.c\n\nAbstract:\n\tA manual dispatch Queue to buffer read requests\n*/\n#include \"ReadIoControlBuffer.h\"\n\n\nVOID\nReadIoControlBufferCompleteRequest(\n\t_In_ PREAD_IO_CONTROL_BUFFER ReadIoControlBuffer,\n\t_In_ WDFREQUEST Request\n\t);\n\nNTSTATUS\nReadIoControlBufferCreate(\n\t_Inout_ PREAD_IO_CONTROL_BUFFER ReadIoControlBuffer,\n\t_In_ WDFDEVICE ParentDevice,\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ PFN_READ_IO_CONTROL_BUFFER_FILL_BUFFER Callback,\n\t_In_ size_t MinOutputBufferSize\n\t)\n{\n\tNTSTATUS Status = STATUS_SUCCESS;\n\tWDF_IO_QUEUE_CONFIG QueueConfig;\n\n\t// Set up the Object\n\tReadIoControlBuffer->DeviceContext = DeviceContext;\n\tReadIoControlBuffer->Callback = Callback;\n\tReadIoControlBuffer->InstantCompletion = FALSE;\n\tReadIoControlBuffer->MinOutputBufferSize = MinOutputBufferSize;\n\n\t// Create the WDF Queue\n\tWDF_IO_QUEUE_CONFIG_INIT(&QueueConfig, WdfIoQueueDispatchManual);\n\tQueueConfig.PowerManaged = WdfFalse;\n\n\tStatus = WdfIoQueueCreate(ParentDevice, &QueueConfig, WDF_NO_OBJECT_ATTRIBUTES, &(ReadIoControlBuffer->BufferQueue));\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTraceStatus(\"Failed to create Read IO Control Buffer Queue\", Status);\n\t\treturn Status;\n\t}\n\n\treturn Status;\n}\n\nVOID\nReadIoControlBufferFlush(\n\t_In_ PREAD_IO_CONTROL_BUFFER ReadIoControlBuffer\n\t)\n{\n\tNTSTATUS Status = STATUS_SUCCESS;\n\tWDFREQUEST TmpRequest;\n\n\tif (ReadIoControlBuffer->BufferQueue == NULL)\n\t{\n\t\treturn;\n\t}\n\n\twhile (NT_SUCCESS(Status = (WdfIoQueueRetrieveNextRequest(ReadIoControlBuffer->BufferQueue, &TmpRequest))))\n\t{\n\t\tWdfRequestComplete(TmpRequest, STATUS_DEVICE_REMOVED);\n\t}\n\n\tif (Status != STATUS_NO_MORE_ENTRIES)\n\t{\n\t\tTraceStatus(\"Something went wring while flushing a Read IO Control Buffer\", Status);\n\t}\n}\n\nVOID\nReadIoControlBufferForwardRequest(\n\t_In_ PREAD_IO_CONTROL_BUFFER ReadIoControlBuffer,\n\t_In_ WDFREQUEST Request\n\t)\n{\n\tNTSTATUS Status = STATUS_SUCCESS;\n\n\tif (ReadIoControlBuffer->InstantCompletion)\n\t{\n\t\tReadIoControlBufferCompleteRequest(ReadIoControlBuffer, Request);\n\t}\n\telse\n\t{\n\t\tStatus = WdfRequestForwardToIoQueue(Request, ReadIoControlBuffer->BufferQueue);\n\t\tif (!NT_SUCCESS(Status))\n\t\t{\n\t\t\tWdfRequestComplete(Request, Status);\n\t\t\treturn;\n\t\t}\n\t}\n}\n\nVOID\nReadIoControlBufferCompleteRequest(\n\t_In_ PREAD_IO_CONTROL_BUFFER ReadIoControlBuffer,\n\t_In_ WDFREQUEST Request\n\t)\n{\n\tNTSTATUS Status = STATUS_SUCCESS;\n\tPVOID OutputBuffer;\n\tsize_t OutputBufferSize;\n\tSIZE_T BytesWritten = 0;\n\n\tReadIoControlBuffer->InstantCompletion = FALSE;\n\n\tStatus = WdfRequestRetrieveOutputBuffer(Request, ReadIoControlBuffer->MinOutputBufferSize, &OutputBuffer, &OutputBufferSize);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTraceStatus(\"Error retrieving Output Buffer from Read IO Control\", Status);\n\t\tWdfRequestComplete(Request, Status);\n\t\treturn;\n\t}\n\n\tReadIoControlBuffer->Callback(ReadIoControlBuffer->DeviceContext, OutputBuffer, OutputBufferSize, &BytesWritten);\n\n\tWdfRequestCompleteWithInformation(Request, Status, BytesWritten);\n}\n\nVOID\nReadIoControlBufferDispatchRequest(\n\t_In_ PREAD_IO_CONTROL_BUFFER ReadIoControlBuffer\n\t)\n{\n\tNTSTATUS Status = STATUS_SUCCESS;\n\tWDFREQUEST Request;\n\n\tStatus = WdfIoQueueRetrieveNextRequest(ReadIoControlBuffer->BufferQueue, &Request);\n\tif (NT_SUCCESS(Status))\n\t{\n\t\tReadIoControlBufferCompleteRequest(ReadIoControlBuffer, Request);\n\t}\n\telse if (Status == STATUS_NO_MORE_ENTRIES)\n\t{\n\t\tReadIoControlBuffer->InstantCompletion = TRUE;\n\t}\n}"
  },
  {
    "path": "HID Wiimote/ReadIoControlBuffer.h",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tReadIoControlBuffer.h\n\nAbstract:\n\tHeader file for ReadIoControlBuffer.c\n\n*/\n#pragma once\n\n#include \"HIDWiimote.h\"\n\ntypedef VOID EVT_READ_IO_CONTROL_BUFFER_FILL_BUFFER(_In_ PDEVICE_CONTEXT DeviceContext, _Inout_updates_all_(BufferSize) PVOID Buffer, _In_ size_t BufferSize, _Out_ PSIZE_T BytesWritten);\ntypedef EVT_READ_IO_CONTROL_BUFFER_FILL_BUFFER *PFN_READ_IO_CONTROL_BUFFER_FILL_BUFFER;\n\ntypedef struct _READ_IO_CONTROL_BUFFER\n{\n\tWDFQUEUE BufferQueue;\n\tPDEVICE_CONTEXT DeviceContext;\n\tPFN_READ_IO_CONTROL_BUFFER_FILL_BUFFER Callback;\n\n\tsize_t MinOutputBufferSize;\n\tBOOLEAN InstantCompletion;\n\n} READ_IO_CONTROL_BUFFER, * PREAD_IO_CONTROL_BUFFER;\n\nNTSTATUS\nReadIoControlBufferCreate(\n\t_Inout_ PREAD_IO_CONTROL_BUFFER ReadIoControlBuffer,\n\t_In_ WDFDEVICE ParentDevice,\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ PFN_READ_IO_CONTROL_BUFFER_FILL_BUFFER Callback,\n\t_In_ size_t MinOutputBufferSize\n\t);\n\nVOID\nReadIoControlBufferFlush(\n\t_In_ PREAD_IO_CONTROL_BUFFER ReadIoControlBuffer\n\t);\n\nVOID\nReadIoControlBufferForwardRequest(\n\t_In_ PREAD_IO_CONTROL_BUFFER ReadIoControlBuffer,\n\t_In_ WDFREQUEST Request);\n\nVOID\nReadIoControlBufferDispatchRequest(\n\t_In_ PREAD_IO_CONTROL_BUFFER ReadIoControlBuffer\n\t);"
  },
  {
    "path": "HID Wiimote/Trace.c",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tTrace.c\r\n\r\nAbstract:\r\n\tContains the code for Tracing.\r\n\r\n*/\r\n#include \"Trace.h\"\r\n\r\nVOID\r\nTrace(\r\n    _In_ PCCHAR  DebugMessage,\r\n    ...\r\n    )\r\n{\r\n#ifndef DBG\r\n    UNREFERENCED_PARAMETER(DebugMessage);\r\n#else\r\n\tNTSTATUS Status;\r\n\tva_list ParameterList;\r\n\tCHAR DebugMessageBuffer[512];\r\n\r\n\tva_start(ParameterList, DebugMessage);\r\n\r\n\tif(DebugMessage != NULL)\r\n\t{\r\n\t\tStatus = RtlStringCbVPrintfA(DebugMessageBuffer, sizeof(DebugMessageBuffer), DebugMessage, ParameterList);\r\n\r\n\t\tif(NT_SUCCESS(Status))\r\n\t\t{\r\n\t\t\tDbgPrint(\"Trace Wiimote: %s\\n\", DebugMessageBuffer);\r\n\t\t}\r\n\t}\r\n\r\n\tva_end(ParameterList);\r\n\r\n#endif\r\n}\r\n\r\nVOID\r\nTraceStatus(\r\n\t_In_ PCCHAR  DebugMessage,\r\n\t_In_ NTSTATUS Status\r\n\t)\r\n{\r\n#ifndef DBG\r\n\tUNREFERENCED_PARAMETER(DebugMessage);\r\n\tUNREFERENCED_PARAMETER(Status);\r\n#else\r\n\tTrace(\"%s: \" NTSTATUS_FORMAT_IDENTIFIER, DebugMessage, Status);\r\n#endif\r\n}\r\n\r\nVOID \r\nPrintBytes(\r\n\t_In_reads_(Size) PCUCHAR Data,\r\n\t_In_ SIZE_T Size \r\n\t)\r\n{\r\n#ifndef DBG\r\n\tUNREFERENCED_PARAMETER(Data);\r\n\tUNREFERENCED_PARAMETER(Size);\r\n#else\r\n\tNTSTATUS Result = STATUS_SUCCESS;\r\n\tPCHAR Message;\r\n\tPCHAR WritePointer;\r\n\tPCUCHAR ReadPointer;\r\n\tconst size_t BytesPerElement = 5;\r\n\tsize_t StringBufferSize = (Size * BytesPerElement) + 1;\r\n\r\n\tMessage = (PCHAR)ExAllocatePoolWithTag(NonPagedPool, StringBufferSize, PRINTBYTE_POOL_TAG);\r\n\tif (Message == NULL)\r\n\t{\r\n\t\tTrace(\"Error printing Bytes: Out of Memory\");\r\n\t\treturn;\r\n\t}\r\n\r\n\tWritePointer = Message;\r\n\tReadPointer = Data;\r\n\r\n\tfor (SIZE_T i = 0; (i < Size) && (NT_SUCCESS(Result)); ++i)\r\n\t{\r\n\t\tResult = RtlStringCbPrintfA(WritePointer, StringBufferSize, \"%#04x \", *ReadPointer);\r\n\r\n\t\tWritePointer += BytesPerElement;\r\n\t\tStringBufferSize -= BytesPerElement;\r\n\t\tReadPointer++;\r\n\t}\r\n\r\n\t(*WritePointer) = 0;\r\n\tTrace(\"Byte Print: %s\", Message);\r\n\tExFreePool(Message);\r\n\r\n#endif\r\n}\r\n"
  },
  {
    "path": "HID Wiimote/Trace.h",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tTrace.h\r\n\r\nAbstract:\r\n\tHeader file for Trace.c\r\n\tContains declarations and configuration for Tracing.\r\n\r\n*/\r\n#pragma once\r\n\r\n#include <ntddk.h>\r\n\r\n#define NTSTRSAFE_LIB\r\n#include <ntstrsafe.h>\r\n\r\n#define PRINTBYTE_POOL_TAG '_BrP'\r\n#define NTSTATUS_FORMAT_IDENTIFIER \"%#010x\"\r\n\r\nVOID\r\nTrace(\r\n    _In_ PCCHAR  DebugMessage,\r\n    ...\r\n    );\r\n\r\nVOID\r\nTraceStatus(\r\n\t_In_ PCCHAR  DebugMessage,\r\n\t_In_ NTSTATUS Status\r\n\t);\r\n\r\nVOID\r\nPrintBytes(\r\n\t_In_reads_(Size) PCUCHAR Data,\r\n\t_In_ SIZE_T Size\r\n\t);\r\n"
  },
  {
    "path": "HID Wiimote/Wiimote.c",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tWiimote.c\r\n\r\nAbstract:\r\n\tManages the Wiimote states and is the layer between HID and Bluetooth.\r\n*/\r\n#include \"Wiimote.h\"\r\n\r\n#include \"Device.h\"\r\n#include \"Bluetooth.h\"\r\n#include \"WiimoteSettings.h\"\r\n\r\nEVT_WDF_TIMER BatteryLevelLEDUpdateTimerExpired;\r\n\r\nNTSTATUS \r\nWiimotePrepare(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tWDF_TIMER_CONFIG TimerConfig;\r\n\tWDF_OBJECT_ATTRIBUTES TimerAttributes;\r\n\r\n\t// Reset Device\r\n\tWiimoteReset(DeviceContext);\r\n\r\n\t// Load Settings from Registry\r\n\tWiimoteSettingsLoad(DeviceContext);\r\n\r\n\t// Create Timer to request StatusInformation\r\n\tWDF_TIMER_CONFIG_INIT_PERIODIC(&TimerConfig, BatteryLevelLEDUpdateTimerExpired, WIIMOTE_STATUSINFORMATION_INTERVAL);\r\n\tWDF_OBJECT_ATTRIBUTES_INIT(&TimerAttributes);\r\n\tTimerAttributes.ParentObject = DeviceContext->Device;\r\n\t\r\n\tStatus = WdfTimerCreate(&TimerConfig, &TimerAttributes, &(DeviceContext->WiimoteContext.BatteryLevelLEDUpdateTimer));\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nSetLEDs(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext,\r\n\t_In_ BYTE LEDFlag\r\n\t)\r\n{\r\n\tCONST size_t BufferSize = 3;\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tWDFREQUEST Request;\r\n\tWDFMEMORY Memory;\r\n\tBYTE * Data;\r\n\r\n\t// Save new LED State\r\n\tDeviceContext->WiimoteContext.LEDState = LEDFlag;\r\n\r\n\t// Get Resources\r\n\tStatus = BluetoothCreateRequestAndBuffer(DeviceContext->Device, DeviceContext->IoTarget, BufferSize, &Request, &Memory, (PVOID *)&Data); \r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t// Fill Buffer\t\r\n\tData[0] = 0xA2;\t//HID Output Report\r\n\tData[1] = 0x11;\t//Player LED\r\n\tData[2] = LEDFlag;\r\n\r\n\tStatus = BluetoothTransferToDevice(DeviceContext, Request, Memory, FALSE);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nSetReportMode(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext,\r\n\t_In_ BYTE ReportMode\r\n\t)\r\n{\r\n\tCONST size_t BufferSize = 4;\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tWDFREQUEST Request;\r\n\tWDFMEMORY Memory;\r\n\tBYTE * Data;\r\n\r\n\t// Get Resources\r\n\tStatus = BluetoothCreateRequestAndBuffer(DeviceContext->Device, DeviceContext->IoTarget, BufferSize, &Request, &Memory, (PVOID *)&Data); \r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t// Fill Buffer\t\r\n\tData[0] = 0xA2;\t//HID Output Report\r\n\tData[1] = 0x12;\t//Set ReportMode\r\n\tData[2] = 0x00;\t//Only On Change\r\n\tData[3] = ReportMode; //Mode\r\n\r\n\tStatus = BluetoothTransferToDevice(DeviceContext, Request, Memory, FALSE);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tDeviceContext->WiimoteContext.CurrentReportMode = ReportMode;\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nRequestStatusInformation(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tCONST size_t BufferSize = 3;\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tWDFREQUEST Request;\r\n\tWDFMEMORY Memory;\r\n\tBYTE * Data;\r\n\r\n\t// Get Resources\r\n\tStatus = BluetoothCreateRequestAndBuffer(DeviceContext->Device, DeviceContext->IoTarget, BufferSize, &Request, &Memory, (PVOID *)&Data); \r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t// Fill Buffer\t\r\n\tData[0] = 0xA2;\t//HID Output Report\r\n\tData[1] = 0x15;\t//Status Information Request\r\n\tData[2] = 0x00;\t//Rumble Off\r\n\r\n\tStatus = BluetoothTransferToDevice(DeviceContext, Request, Memory, FALSE);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nReadFromRegister(\r\n_In_ PDEVICE_CONTEXT DeviceContext,\r\n_In_ INT32 Address,\r\n_In_ BYTE Size\r\n)\r\n{\r\n\tCONST size_t BufferSize = 8;\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tWDFREQUEST Request;\r\n\tWDFMEMORY Memory;\r\n\tBYTE * Data;\r\n\r\n\t// Get Resources\r\n\tStatus = BluetoothCreateRequestAndBuffer(DeviceContext->Device, DeviceContext->IoTarget, BufferSize, &Request, &Memory, (PVOID *)&Data);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t// Fill Buffer\t\r\n\tData[0] = 0xA2;\t//HID Output Report\r\n\tData[1] = 0x17;\t//Status Information Request\r\n\tData[2] = 0x04;\t//Rumble Off but write to Registers\r\n\r\n\t//Offset\r\n\tData[3] = 0xFF & (Address >> 16);\r\n\tData[4] = 0xFF & (Address >> 8);\r\n\tData[5] = 0xFF & (Address);\r\n\r\n\tData[6] = 0x00; //Size\r\n\tData[7] = Size; //Size\r\n\r\n\tStatus = BluetoothTransferToDevice(DeviceContext, Request, Memory, FALSE);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nWriteToRegister(\r\n_In_ PDEVICE_CONTEXT DeviceContext,\r\n_In_ INT32 Address,\r\n_In_reads_(DataSize) PCUCHAR Data,\r\n_In_ BYTE DataSize\r\n)\r\n{\r\n\tCONST size_t BufferSize = 23;\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tWDFREQUEST Request;\r\n\tWDFMEMORY Memory;\r\n\tBYTE * Report;\r\n\r\n\t// Get Resources\r\n\tStatus = BluetoothCreateRequestAndBuffer(DeviceContext->Device, DeviceContext->IoTarget, BufferSize, &Request, &Memory, (PVOID *)&Report);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t// Fill Buffer\t\r\n\tReport[0] = 0xA2;\t//HID Output Report\r\n\tReport[1] = 0x16;\t//Status Information Request\r\n\tReport[2] = 0x04;\t//Rumble Off but write to Registers\r\n\t\r\n\t//Offset\r\n\tReport[3] = 0xFF & (Address >> 16);\r\n\tReport[4] = 0xFF & (Address >> 8);\r\n\tReport[5] = 0xFF & (Address);\r\n\r\n\tReport[6] = DataSize; //Size\r\n\r\n\tRtlSecureZeroMemory(Report + 7, 16);\r\n\tRtlCopyBytes(Report + 7, Data, DataSize);\r\n\r\n\tStatus = BluetoothTransferToDevice(DeviceContext, Request, Memory, FALSE);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nWriteSingeByteToRegister(\r\n_In_ PDEVICE_CONTEXT DeviceContext,\r\n_In_ INT32 Address,\r\n_In_ BYTE Data\r\n)\r\n{\r\n\treturn WriteToRegister(DeviceContext, Address, &Data, 1);\r\n}\r\n\r\nNTSTATUS\r\nSendSingleByteReport(\r\n_In_ PDEVICE_CONTEXT DeviceContext,\r\n_In_ BYTE ReportID,\r\n_In_ BYTE Byte\r\n)\r\n{\r\n\tCONST size_t BufferSize = 3;\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tWDFREQUEST Request;\r\n\tWDFMEMORY Memory;\r\n\tBYTE * Data;\r\n\r\n\t// Get Resources\r\n\tStatus = BluetoothCreateRequestAndBuffer(DeviceContext->Device, DeviceContext->IoTarget, BufferSize, &Request, &Memory, (PVOID *)&Data);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t// Fill Buffer\t\r\n\tData[0] = 0xA2;\t//HID Output Report\r\n\tData[1] = ReportID;\t// Enable IR \r\n\tData[2] = Byte; // Get acknowledgement \r\n\r\n\r\n\tStatus = BluetoothTransferToDevice(DeviceContext, Request, Memory, FALSE);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS \r\nWiimoteStart(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\r\n\t//Set LEDs\r\n\tStatus = SetLEDs(DeviceContext, WIIMOTE_LEDS_ALL);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n#ifdef MOUSE_IR\r\n\t//Enable IR\r\n\tStatus = SendSingleByteReport(DeviceContext, 0x13, 0x06);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tTraceStatus(\"EnableIR Failed\", Status);\r\n\t\treturn Status;\r\n\t}\r\n#else\r\n\t//Set Report Mode\r\n\tStatus = SetReportMode(DeviceContext, 0x31);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tTraceStatus(\"SetReportMode Failed\", Status);\r\n\t\treturn Status;\r\n\t}\r\n#endif\r\n\r\n\t//Start Continious Reader\r\n\tStatus = BluetoothStartContiniousReader(DeviceContext);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\tTraceStatus(\"StartContiniousReader Failed\", Status);\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t//Start Timer\r\n\tWdfTimerStart(DeviceContext->WiimoteContext.BatteryLevelLEDUpdateTimer, WDF_REL_TIMEOUT_IN_SEC(1));\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nEnableIR(\r\n_In_ PDEVICE_CONTEXT DeviceContext\r\n)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\r\n\tconst BYTE SensivityBlock1[] = { 0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0xaa, 0x00, 0x64 };\r\n\tconst BYTE SensivityBlock2[] = { 0x63, 0x03 };\r\n\r\n\t//Write 0x08 to register 0xb00030\r\n\tStatus = WriteSingeByteToRegister(DeviceContext, 0xb00030, 0x08);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t//Write Sensitivity Block 1 to registers at 0xb00000\r\n\tStatus = WriteToRegister(DeviceContext, 0xb00000, SensivityBlock1, sizeof(SensivityBlock1));\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t//Write Sensitivity Block 2 to registers at 0xb0001a\r\n\tStatus = WriteToRegister(DeviceContext, 0xb0001a, SensivityBlock2, sizeof(SensivityBlock2));\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t//Write Mode Number to register 0xb00033\r\n\t//0x01 Basic Mode 10 Byte\r\n\tStatus = WriteSingeByteToRegister(DeviceContext, 0xb00030, 0x01);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\t//Write 0x08 to register 0xb00030 (again)\r\n\tStatus = WriteSingeByteToRegister(DeviceContext, 0xb00030, 0x08);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t//Set Report Mode\r\n\tStatus = SetReportMode(DeviceContext, 0x36);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nSuspendWiimote(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tCONST size_t BufferSize = 1;\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tWDFREQUEST Request;\r\n\tWDFMEMORY Memory;\r\n\tBYTE * Data;\r\n\r\n\t// Get Resources\r\n\tStatus = BluetoothCreateRequestAndBuffer(DeviceContext->Device, DeviceContext->IoTarget, BufferSize, &Request, &Memory, (PVOID *)&Data); \r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t// Fill Buffer\t\r\n\tData[0] = 0x13;\t//HID Control with Suspend: 0x10 = HID_Control - 0x03 = SUSPEND\r\n\r\n\tStatus = BluetoothTransferToDevice(DeviceContext, Request, Memory, TRUE);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tWdfObjectDelete(Request);\r\n\treturn Status;\r\n\r\n}\r\n\r\nNTSTATUS\r\nWiimoteStop(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\r\n\t//Stop Timer\r\n\tWdfTimerStop(DeviceContext->WiimoteContext.BatteryLevelLEDUpdateTimer, TRUE);\r\n\r\n\t//Shut down Wiimote\r\n\tStatus = SuspendWiimote(DeviceContext);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\r\n\treturn Status;\r\n}\r\n\r\nVOID \r\nWiimoteReset(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tDeviceContext->WiimoteContext.Extension = None;\r\n\tWiimoteStateResetToNullState(DeviceContext);\r\n}\r\n\r\nNTSTATUS\r\nUpdateBatteryLEDs(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tPWIIMOTE_DEVICE_CONTEXT WiimoteContext = &(DeviceContext->WiimoteContext);\r\n\r\n\tif (WiimoteContext->Extension == BalanceBoard)\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tStatus = SetLEDs(DeviceContext, ((0xF0 << (3 - (DeviceContext->WiimoteContext.BatteryLevel / 64))) & 0xF0));\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tif (DeviceContext->WiimoteContext.LEDState == WIIMOTE_LEDS_FOUR)\r\n\t{\r\n\t\tWdfTimerStop(WiimoteContext->BatteryLevelLEDUpdateTimer, FALSE);\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nInitializeExtension(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\r\n\tStatus = WriteSingeByteToRegister(DeviceContext, 0xA400F0, 0x55);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tStatus = WriteSingeByteToRegister(DeviceContext, 0xA400FB, 0x00);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tStatus = ReadFromRegister(DeviceContext, 0xA400FA, 0x06);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nProcessWiimoteBatteryLevel(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext,\r\n\t_In_ BYTE BatteryLevel\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\r\n\tTrace(\"BatteryLevel: 0x%x\", BatteryLevel);\r\n\r\n\tDeviceContext->WiimoteContext.BatteryLevel = BatteryLevel;\r\n\r\n\tStatus = UpdateBatteryLEDs(DeviceContext); \r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn STATUS_SUCCESS;\r\n}\r\n\r\nNTSTATUS\r\nProcessStatusInformation(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext,\r\n\t_In_reads_bytes_(ReadBufferSize) BYTE * ReadBuffer,\r\n\t_In_ size_t ReadBufferSize\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\r\n\tUNREFERENCED_PARAMETER(ReadBufferSize);\r\n\t\r\n\tTrace(\"ProcessStatusInformation\");\r\n\r\n#ifndef MOUSE_IR\r\n\tBOOLEAN Extension = (ReadBuffer[3] & 0x02);\r\n\tTrace(\"Extension Flag: %d\", (ReadBuffer[3] & 0x02)); \r\n\r\n\tif (Extension)\r\n\t{\r\n\t\tif (DeviceContext->WiimoteContext.Extension == None)\r\n\t\t{\r\n\t\t\tStatus = InitializeExtension(DeviceContext);\r\n\t\t\tif (!NT_SUCCESS(Status))\r\n\t\t\t{\r\n\t\t\t\treturn Status;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\tDeviceContext->WiimoteContext.Extension = None;\r\n\t\tDeviceContext->WiimoteContext.CurrentReportMode = 0x31;\r\n\t}\r\n#endif\r\n\r\n\t//Process the Battery Level to set the LEDS; Wii U Pro Controller reports its Battery Level in its Input Report\r\n\tswitch (DeviceContext->WiimoteContext.Extension)\r\n\t{\r\n\tcase WiiUProController:\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tStatus = ProcessWiimoteBatteryLevel(DeviceContext, ReadBuffer[6]);\r\n\t\tif (!NT_SUCCESS(Status))\r\n\t\t{\r\n\t\t\treturn Status;\r\n\t\t}\r\n\t}\r\n\r\n\t//Set Report Mode, if extension changed\r\n\tStatus = SetReportMode(DeviceContext, DeviceContext->WiimoteContext.CurrentReportMode);\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\t\r\n\t// Notify Device Interface about Status Update\r\n\tDeviceInterfaceWiimoteStateUpdated(DeviceContext);\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nProcessExtensionRegister(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext,\r\n\t_In_reads_bytes_(ReadBufferSize) BYTE * ReadBuffer,\r\n\t_In_ size_t ReadBufferSize,\r\n\t_In_ BYTE ErrorFlag,\r\n\t_In_ USHORT ReadAddress)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\r\n\tUNREFERENCED_PARAMETER(ReadBufferSize);\r\n\tUNREFERENCED_PARAMETER(ErrorFlag);\r\n\tUNREFERENCED_PARAMETER(ReadAddress);\r\n\r\n\tUSHORT ExtensionType = ReadBuffer[4] << 8 | ReadBuffer[5];\r\n\tUSHORT SubType = ReadBuffer[0] << 8 | ReadBuffer[1];\r\n\r\n\tTrace(\"Extension Type: %#010x\", ExtensionType);\r\n\tTrace(\"Sub Type: %#010x\", SubType);\r\n\r\n\tswitch (ExtensionType)\r\n\t{\r\n\tcase 0x0000: // Nunchuck\r\n\t\tTrace(\"Nunchuck Extension\");\r\n\t\tDeviceContext->WiimoteContext.Extension = Nunchuck;\r\n\t\tDeviceContext->WiimoteContext.CurrentReportMode = 0x35;\r\n\t\tbreak;\r\n\tcase 0x0402: // Balance Board\r\n\t\tTrace(\"Balance Board\");\r\n\t\tDeviceContext->WiimoteContext.Extension = BalanceBoard;\r\n\t\tDeviceContext->WiimoteContext.CurrentReportMode = 0x32;\r\n\t\tSetLEDs(DeviceContext, WIIMOTE_LEDS_ALL);\r\n\t\t// Get Calibration Data\r\n\t\tReadFromRegister(DeviceContext, 0xA40024, 24);\r\n\t\tbreak;\r\n\tcase 0x0101:\r\n\t\tswitch (SubType)\r\n\t\t{\r\n\t\tdefault:\r\n\t\tcase 0x0000: // Classic Controler\r\n\t\t\tTrace(\"Classic Controller Extension\");\r\n\t\t\tDeviceContext->WiimoteContext.Extension = ClassicController;\r\n\t\t\tDeviceContext->WiimoteContext.CurrentReportMode = 0x32;\r\n\t\t\tbreak;\r\n\t\tcase 0x0100: // Classic Controler Pro\r\n\t\t\tTrace(\"Classic Controller Pro Extension\");\r\n\t\t\tDeviceContext->WiimoteContext.Extension = ClassicControllerPro;\r\n\t\t\tDeviceContext->WiimoteContext.CurrentReportMode = 0x32;\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tbreak;\r\n\tcase 0x0120: // Wii U Pro Controller\r\n\t\tTrace(\"Wii U Pro Controller\");\r\n\t\tDeviceContext->WiimoteContext.Extension = WiiUProController;\r\n\t\tDeviceContext->WiimoteContext.CurrentReportMode = 0x34;\r\n\t\tbreak;\r\n\tcase 0x0103:\r\n\t\t// 0x0000: Guitar Hero Guitar\r\n\t\t// 0x0100: Guitar Hero Drum Kit\r\n\t\t// 0x0300: DJ Hero Turntables\r\n\t\tTrace(\"Guitar Hero Guitar\");\r\n\t\tDeviceContext->WiimoteContext.Extension = Guitar;\r\n\t\tDeviceContext->WiimoteContext.CurrentReportMode = 0x32;\r\n\t\tbreak;\r\n\tcase 0xFFFF: // Error\r\n\t\tTrace(\"Error\");\r\n\t\tDeviceContext->WiimoteContext.Extension = None;\r\n\t\tDeviceContext->WiimoteContext.CurrentReportMode = 0x31;\r\n\t\tStatus = InitializeExtension(DeviceContext);\r\n\t\tif (!NT_SUCCESS(Status))\r\n\t\t{\r\n\t\t\treturn Status;\r\n\t\t}\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tTrace(\"Unsupported Extension!\");\r\n\t\treturn Status;\r\n\t}\r\n\r\n\tStatus = SetReportMode(DeviceContext, DeviceContext->WiimoteContext.CurrentReportMode);\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\t// Signal Device Interface to report the new Extension Type\r\n\tDeviceInterfaceWiimoteStateUpdated(DeviceContext);\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nProcessBalanceBoardCalibrationRegister(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext,\r\n\t_In_reads_bytes_(ReadBufferSize) PUCHAR ReadBuffer,\r\n\t_In_ size_t ReadBufferSize,\r\n\t_In_ BYTE ErrorFlag,\r\n\t_In_ USHORT ReadAddress)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\r\n\tUNREFERENCED_PARAMETER(ErrorFlag);\r\n\r\n\tPUSHORT Data = (PUSHORT)ReadBuffer;\r\n\tsize_t CalibrationIndexStart = (ReadAddress == 0x0024) ? 0 : 2;\r\n\tsize_t CalibrationIndexEnd = CalibrationIndexStart + (ReadBufferSize / 8);\r\n\r\n\tfor (size_t CalibrationDataIndex = CalibrationIndexStart; CalibrationDataIndex < CalibrationIndexEnd; ++CalibrationDataIndex)\r\n\t{\r\n\t\tfor (size_t SensorIndex = 0; SensorIndex < 4; ++SensorIndex)\r\n\t\t{\r\n\t\t\tDeviceContext->WiimoteContext.State.BalanceBoardState.Calibration[SensorIndex][CalibrationDataIndex] = RtlUshortByteSwap(Data[4 * (CalibrationDataIndex - CalibrationIndexStart) + SensorIndex]);\r\n\t\t}\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nProcessRegisterReadReport(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext,\r\n\t_In_reads_bytes_(ReadBufferSize) BYTE * ReadBuffer,\r\n\t_In_ size_t ReadBufferSize\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\r\n\tUNREFERENCED_PARAMETER(ReadBufferSize);\r\n\r\n\tTrace(\"ProcessRegisterReadReport\");\r\n\r\n\tWiimoteStateUpdate(DeviceContext, ReadBuffer, ReadBufferSize);\r\n\r\n\tBYTE Error = 0x0F & (ReadBuffer[3]);\r\n\tTrace(\"Error Flag: %#04x\", Error);\r\n\r\n\tBYTE Size = ((0xF0 & (ReadBuffer[3])) >> 4) + 1;\r\n\tTrace(\"Size: %#04x\", Size);\r\n\tUSHORT Address = RtlUshortByteSwap(*((USHORT *)(ReadBuffer + 4)));\r\n\tTrace(\"Address: %#06x\", Address);\r\n\r\n\tswitch(Address)\r\n\t{\r\n\tcase 0x00FA: // Extension Type\r\n\t\tStatus = ProcessExtensionRegister(DeviceContext, ReadBuffer + 6, Size, Error, Address);\r\n\t\tbreak;\r\n\tcase 0x0024: // BalanceBoard Calibration\r\n\tcase 0x0034:\r\n\t\tStatus = ProcessBalanceBoardCalibrationRegister(DeviceContext, ReadBuffer + 6, Size, Error, Address);\r\n\t\tbreak;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nProcessAcknowledgementReport(\r\n_In_ PDEVICE_CONTEXT DeviceContext,\r\n_In_reads_bytes_(ReadBufferSize) BYTE * ReadBuffer,\r\n_In_ size_t ReadBufferSize\r\n)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\r\n\tUNREFERENCED_PARAMETER(ReadBufferSize);\r\n\r\n\tTrace(\"ProcessAcknowledgementReport\");\r\n\r\n\tWiimoteStateUpdate(DeviceContext, ReadBuffer, ReadBufferSize);\r\n\r\n\tBYTE Report = ReadBuffer[3];\r\n\tBYTE Result = ReadBuffer[4];\r\n\r\n\tTrace(\"Report: %#04x\", Report);\r\n\tTrace(\"Error Flag: %#04x\", Result);\r\n\r\n\tif (Result == 0x03)\r\n\t{\r\n\t\treturn STATUS_SUCCESS;\r\n\t}\r\n\r\n\tswitch (Report)\r\n\t{\r\n\tcase 0x13:\r\n\t\tStatus = SendSingleByteReport(DeviceContext, 0x1A, 0x06);\r\n\t\tbreak;\r\n\tcase 0x1A:\r\n\t\tStatus = EnableIR(DeviceContext);\r\n\t\tbreak;\r\n\t}\r\n\r\n\tif (!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nNTSTATUS\r\nWiimoteProcessReport(\r\n\t_In_ PDEVICE_CONTEXT DeviceContext,\r\n\t_In_reads_bytes_(ReadBufferSize) PVOID ReadBuffer,\r\n\t_In_ SIZE_T ReadBufferSize\r\n\t)\r\n{\r\n\tNTSTATUS Status = STATUS_SUCCESS;\r\n\tBYTE ReportID = 0x00;\r\n\t\r\n\tif(ReadBufferSize >= 2)\r\n\t{\r\n\t\tReportID = ((BYTE *)ReadBuffer)[1];\r\n\t}\r\n\r\n\t//PrintBytes(ReadBuffer, ReadBufferSize);\r\n\r\n\tswitch(ReportID)\r\n\t{\r\n\t// Status Information\r\n\tcase 0x20:\t\r\n\t\tStatus = ProcessStatusInformation(DeviceContext,(((BYTE *)ReadBuffer) + 1), (ReadBufferSize - 1));\r\n\t\tbreak;\r\n\r\n\tcase 0x21:\r\n\t\tStatus = ProcessRegisterReadReport(DeviceContext, (((BYTE *)ReadBuffer) + 1), (ReadBufferSize - 1));\r\n\t\tbreak;\r\n\r\n\tcase 0x22:\r\n\t\tStatus = ProcessAcknowledgementReport(DeviceContext, (((BYTE *)ReadBuffer) + 1), (ReadBufferSize - 1));\r\n\t\tbreak;\r\n\r\n\tcase 0x30:\r\n\tcase 0x31:\r\n\tcase 0x32:\r\n\tcase 0x34:\r\n\tcase 0x35:\r\n\tcase 0x36:\r\n\tcase 0x3D:\r\n\t\tStatus = WiimoteStateUpdate(DeviceContext,(((PUCHAR)ReadBuffer) + 1), (ReadBufferSize - 1));\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tTrace(\"Unkown Report Recieved\");\r\n\t\tbreak;\r\n\t}\r\n\r\n\tif(!NT_SUCCESS(Status))\r\n\t{\r\n\t\treturn Status;\r\n\t}\r\n\r\n\treturn Status;\r\n}\r\n\r\nVOID\r\nBatteryLevelLEDUpdateTimerExpired(\r\n    WDFTIMER  Timer\r\n    )\r\n{\r\n\tNTSTATUS Status;\r\n\tPDEVICE_CONTEXT DeviceContext = GetDeviceContext(WdfTimerGetParentObject(Timer));\r\n\r\n\tTrace(\"BatteryLevelLEDUpdate Timer!\");\r\n\r\n\tif (DeviceContext->WiimoteContext.Extension == WiiUProController)\r\n\t{\r\n\t\tStatus = UpdateBatteryLEDs(DeviceContext);\r\n\t\tif (!NT_SUCCESS(Status))\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\tStatus = RequestStatusInformation(DeviceContext);\r\n\t\tTraceStatus(\"Request Status Information Result\", Status);\r\n\t\tif (!NT_SUCCESS(Status))\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "HID Wiimote/Wiimote.h",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tWiimote.h\r\n\r\nAbstract:\r\n\tHeader file for Wiimote.c\r\n*/\r\n#pragma once\r\n\r\n#include \"HIDWiimote.h\"\r\n\r\n#include \"DeviceInterfacePublic.h\"\r\n#include \"WiimoteState.h\"\r\n#include \"WiimoteSettings.h\"\r\n\r\n#define WIIMOTE_STATUSINFORMATION_INTERVAL (60000) // 60 Second\r\n\r\ntypedef struct _WIIMOTE_DEVICE_CONTEXT\r\n{\r\n\tBYTE CurrentReportMode;\r\n\tBYTE BatteryLevel;\r\n\tBYTE LEDState;\r\n\r\n\tWIIMOTE_SETTINGS Settings;\r\n\tWIIMOTE_EXTENSION Extension;\r\n\tWIIMOTE_STATE State;\r\n\r\n\tWDFTIMER BatteryLevelLEDUpdateTimer;\r\n\r\n} WIIMOTE_DEVICE_CONTEXT, * PWIIMOTE_DEVICE_CONTEXT;\r\n\r\nNTSTATUS WiimotePrepare(_In_ PDEVICE_CONTEXT DeviceContext);\r\nNTSTATUS WiimoteStart(_In_ PDEVICE_CONTEXT DeviceContext);\r\nNTSTATUS WiimoteStop(_In_ PDEVICE_CONTEXT DeviceContext);\r\n\r\nVOID WiimoteReset(_In_ PDEVICE_CONTEXT DeviceContext);\r\n\r\nNTSTATUS WiimoteProcessReport(_In_ PDEVICE_CONTEXT DeviceContext, _In_reads_bytes_(ReadBufferSize) PVOID ReadBuffer, _In_ SIZE_T ReadBufferSize);\r\n"
  },
  {
    "path": "HID Wiimote/WiimoteSettings.c",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tWiimoteSettings.c\n\nAbstract:\n\tLoads and saves the Wiimote Settings from and to the Registry. \n\n*/\n#include \"WiimoteToHIDParser.h\"\n\n#include \"Device.h\"\n\nDECLARE_CONST_UNICODE_STRING(DriverModeValueName, L\"DriverMode\");\nDECLARE_CONST_UNICODE_STRING(EnableWiimoteXAxisAccelerometerValueName, L\"EnableWiimoteXAxisAccelerometer\");\nDECLARE_CONST_UNICODE_STRING(EnableWiimoteYAxisAccelerometerValueName, L\"EnableWiimoteYAxisAccelerometer\");\nDECLARE_CONST_UNICODE_STRING(SwapMouseButtonsValueName, L\"SwapMouseButtons\");\nDECLARE_CONST_UNICODE_STRING(SwapTriggerAndShoulderValueName, L\"SwapTriggerAndShoulder\");\nDECLARE_CONST_UNICODE_STRING(SplitTriggerAxisValueName, L\"SplitTriggerAxis\");\nDECLARE_CONST_UNICODE_STRING(MapTriggerAsAxisValueName, L\"MapTriggerAsAxis\");\nDECLARE_CONST_UNICODE_STRING(MapTriggerAsButtonsValueName, L\"MapTriggerAsButtons\");\n\nNTSTATUS\nOpenRegistryKey(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ ACCESS_MASK Access,\n\t_Out_ WDFKEY * DeviceKey,\n\t_Out_opt_ BOOLEAN * NewlyCreated\n\t);\n\nVOID\nLoadWiimoteDriverModeValue(\n\t_In_ WDFKEY Key,\n\t_In_ PCUNICODE_STRING ValueName,\n\t_In_ WIIMOTE_DRIVER_MODE DefaultValue,\n\t_Out_ PWIIMOTE_DRIVER_MODE Value\n);\n\nVOID\nLoadBooleanValue(\n\t_In_ WDFKEY Key,\n\t_In_ PCUNICODE_STRING ValueName,\n\t_In_ BOOLEAN DefaultValue,\n\t_Out_ PBOOLEAN Value\n);\n\nVOID\nSaveULONGValue(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ PCUNICODE_STRING ValueName,\n\t_In_ ULONG Value\n\t);\n\nVOID\nWiimoteSettingsLoad(\n\t_In_ PDEVICE_CONTEXT DeviceContext\n\t)\n{\n\tNTSTATUS Status;\n\tWDFKEY Key;\n\n\tStatus = OpenRegistryKey(DeviceContext, KEY_READ, &Key, NULL);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTrace(\"Failed to open Reg Key to load settings.\");\n\t\treturn;\n\t}\n\n\t// Load each Setting\n\tDeviceContext->WiimoteContext.Settings.Mode = Gamepad;\n\t//LoadWiimoteDriverModeValue(Key, &DriverModeValueName, Gamepad, &DeviceContext->WiimoteContext.Settings.Mode);\n\tLoadBooleanValue(Key, &EnableWiimoteXAxisAccelerometerValueName, TRUE, &DeviceContext->WiimoteContext.Settings.EnableWiimoteXAxisAccelerometer);\n\tLoadBooleanValue(Key, &EnableWiimoteYAxisAccelerometerValueName, TRUE, &DeviceContext->WiimoteContext.Settings.EnableWiimoteYAxisAcceleromenter);\n\tLoadBooleanValue(Key, &SwapMouseButtonsValueName, FALSE, &DeviceContext->WiimoteContext.Settings.SwapMouseButtons);\n\tLoadBooleanValue(Key, &SwapTriggerAndShoulderValueName, FALSE, &DeviceContext->WiimoteContext.Settings.SwapTriggerAndShoulder);\n\tLoadBooleanValue(Key, &SplitTriggerAxisValueName, TRUE, &DeviceContext->WiimoteContext.Settings.SplitTriggerAxis);\n\tLoadBooleanValue(Key, &MapTriggerAsAxisValueName, TRUE, &DeviceContext->WiimoteContext.Settings.MapTriggerAsAxis);\n\tLoadBooleanValue(Key, &MapTriggerAsButtonsValueName, TRUE, &DeviceContext->WiimoteContext.Settings.MapTriggerAsButtons);\n\n\t// Close Key\n\tWdfRegistryClose(Key);\n}\n\nVOID\nWiimoteSettingsSetDriverMode(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ WIIMOTE_DRIVER_MODE DriverMode\n\t)\n{\n\t//DeviceContext->WiimoteContext.Settings.Mode = DriverMode;\n\n\tSaveULONGValue(DeviceContext, &DriverModeValueName, (ULONG)DriverMode);\n\n\t// Check for IR Activation/Deactivation\n\n}\n\nVOID\nWiimoteSettingsSetEnableWiimoteXAxisAccelerometer(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ BOOLEAN Enabled\n\t)\n{\n\tDeviceContext->WiimoteContext.Settings.EnableWiimoteXAxisAccelerometer = Enabled;\n\tHIDWiimoteStateUpdated(DeviceContext);\n\n\tSaveULONGValue(DeviceContext, &EnableWiimoteXAxisAccelerometerValueName, (ULONG)Enabled);\n}\n\nVOID\nWiimoteSettingsSetEnableWiimoteYAxisAccelerometer(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ BOOLEAN Enabled\n\t)\n{\n\tDeviceContext->WiimoteContext.Settings.EnableWiimoteYAxisAcceleromenter = Enabled;\n\tHIDWiimoteStateUpdated(DeviceContext);\n\n\tSaveULONGValue(DeviceContext, &EnableWiimoteYAxisAccelerometerValueName, (ULONG)Enabled);\n}\n\nVOID\nWiimoteSettingsSetSwapMouseButtons(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ BOOLEAN Enabled\n\t)\n{\n\tDeviceContext->WiimoteContext.Settings.SwapMouseButtons = Enabled;\n\tHIDWiimoteStateUpdated(DeviceContext);\n\n\tSaveULONGValue(DeviceContext, &SwapMouseButtonsValueName, (ULONG)Enabled);\n}\n\nVOID\nWiimoteSettingsSetSwapTriggerAndShoulder(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ BOOLEAN Enabled\n\t)\n{\n\tDeviceContext->WiimoteContext.Settings.SwapTriggerAndShoulder = Enabled;\n\tHIDWiimoteStateUpdated(DeviceContext);\n\n\tSaveULONGValue(DeviceContext, &SwapTriggerAndShoulderValueName, (ULONG)Enabled);\n}\n\nVOID\nWiimoteSettingsSetSplitTriggerAxis(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ BOOLEAN Enabled\n\t)\n{\n\tDeviceContext->WiimoteContext.Settings.SplitTriggerAxis = Enabled;\n\tHIDWiimoteStateUpdated(DeviceContext);\n\n\tSaveULONGValue(DeviceContext, &SplitTriggerAxisValueName, (ULONG)Enabled);\n}\n\nVOID\nWiimoteSettingsSetMapTriggerAsAxis(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ BOOLEAN Enabled\n)\n{\n\tDeviceContext->WiimoteContext.Settings.MapTriggerAsAxis = Enabled;\n\tHIDWiimoteStateUpdated(DeviceContext);\n\n\tSaveULONGValue(DeviceContext, &MapTriggerAsAxisValueName, (ULONG)Enabled);\n}\n\nVOID\nWiimoteSettingsSetMapTriggerAsButtons(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ BOOLEAN Enabled\n)\n{\n\tDeviceContext->WiimoteContext.Settings.MapTriggerAsButtons = Enabled;\n\tHIDWiimoteStateUpdated(DeviceContext);\n\n\tSaveULONGValue(DeviceContext, &MapTriggerAsButtonsValueName, (ULONG)Enabled);\n}\n\n/*\n Currently the hardware/device key as well as the driver software key is not persistent accross disconnecting Wiimotes.\n Therefore we need to use the driver/service parameters key, that seems to be persistent, even when the driver is uninstalled.\n An \"DeviceSettings\" subkey is used so the parameters key remains clear.\n For each device the Bluetooth address is used as unique identifier and device key.\n*/\nNTSTATUS\nOpenRegistryKey(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ ACCESS_MASK Access,\n\t_Out_ WDFKEY * DeviceKey,\n\t_Out_opt_ BOOLEAN * NewlyCreated\n\t)\n{\n\tNTSTATUS Status;\n\tWDFKEY ServiceKey;\n\tWDFKEY DeviceSettingsSubkey;\n\tULONG CreateDisposition;\n\n\tDECLARE_CONST_UNICODE_STRING(DeviceSettingsSubkeyName, L\"DeviceSettings\");\n\n\t// Open the driver/service parameters key \"../Services/HIDWiimote/Parameters\"\n\tStatus = WdfDriverOpenParametersRegistryKey(WdfGetDriver(), Access, WDF_NO_OBJECT_ATTRIBUTES, &ServiceKey);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTraceStatus(\"Error opening Service Key\", Status);\n\t\treturn Status;\n\t}\n\n\t// Open/create a subkey for all devices \"../Services/HIDWiimote/Parameters/DeviceSettings\"\n\tStatus = WdfRegistryCreateKey(ServiceKey, &DeviceSettingsSubkeyName, Access, REG_OPTION_NON_VOLATILE, &CreateDisposition, WDF_NO_OBJECT_ATTRIBUTES, &DeviceSettingsSubkey);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTraceStatus(\"Error opening Device Settings Subkey\", Status);\n\t\tWdfRegistryClose(ServiceKey);\n\t\treturn Status;\n\t}\n\n\t// Open/create the device \"../Services/HIDWiimote/Parameters/DeviceSettings/XXXXXXXXXXX\"\n\tStatus = WdfRegistryCreateKey(DeviceSettingsSubkey, &DeviceContext->BluetoothContext.DeviceAddressString, Access, REG_OPTION_NON_VOLATILE, &CreateDisposition, WDF_NO_OBJECT_ATTRIBUTES, DeviceKey);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTraceStatus(\"Error opening Device Subkey\", Status);\n\t\tWdfRegistryClose(ServiceKey);\n\t\tWdfRegistryClose(DeviceSettingsSubkey);\n\t\treturn Status;\n\t}\n\n\tif (NewlyCreated != NULL)\n\t{\n\t\t(*NewlyCreated) = (CreateDisposition == REG_CREATED_NEW_KEY) ? TRUE : FALSE;\n\t}\n\n\tWdfRegistryClose(ServiceKey);\n\tWdfRegistryClose(DeviceSettingsSubkey);\n\n\treturn STATUS_SUCCESS;\n}\n\nVOID\nLoadWiimoteDriverModeValue(\n\t_In_ WDFKEY Key,\n\t_In_ PCUNICODE_STRING ValueName,\n\t_In_ WIIMOTE_DRIVER_MODE DefaultValue,\n\t_Out_ PWIIMOTE_DRIVER_MODE Value\n)\n{\n\tNTSTATUS Status;\n\tULONG ValueBuffer;\n\n\tStatus = WdfRegistryQueryULong(Key, ValueName, &ValueBuffer);\n\t(*Value) = NT_SUCCESS(Status) ? (WIIMOTE_DRIVER_MODE)ValueBuffer : DefaultValue;\n}\n\nVOID\nLoadBooleanValue(\n\t_In_ WDFKEY Key,\n\t_In_ PCUNICODE_STRING ValueName,\n\t_In_ BOOLEAN DefaultValue,\n\t_Out_ PBOOLEAN Value\n)\n{\n\tNTSTATUS Status;\n\tULONG ValueBuffer;\n\n\tStatus = WdfRegistryQueryULong(Key, ValueName, &ValueBuffer);\n\t(*Value) = NT_SUCCESS(Status) ? (BOOLEAN)ValueBuffer : DefaultValue;\n}\n\nVOID\nSaveULONGValue(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ PCUNICODE_STRING ValueName,\n\t_In_ ULONG Value\n)\n{\n\tNTSTATUS Status;\n\tWDFKEY Key;\n\n\tStatus = OpenRegistryKey(DeviceContext, KEY_WRITE, &Key, NULL);\n\tif (!NT_SUCCESS(Status)) \n\t{\n\t\tTraceStatus(\"Error opening Subkey for writing\", Status);\n\t\treturn;\n\t}\n\n\tStatus = WdfRegistryAssignULong(Key, ValueName, Value);\n\tif (!NT_SUCCESS(Status))\n\t{\n\t\tTraceStatus(\"Error writing Value\", Status);\n\t\tWdfRegistryClose(Key);\n\t\treturn;\n\t}\n\n\tWdfRegistryClose(Key);\n}"
  },
  {
    "path": "HID Wiimote/WiimoteSettings.h",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tWiimoteSettings.h\n\nAbstract:\n\tHeader file for WiimoteSettings.c\n*/\n#pragma once\n\n#include \"HIDWiimote.h\"\n\n#include \"DeviceInterfacePublic.h\"\n\nVOID\nWiimoteSettingsLoad(\n\t_In_ PDEVICE_CONTEXT DeviceContext\n\t);\n\nVOID\nWiimoteSettingsSetDriverMode(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ WIIMOTE_DRIVER_MODE DriverMode\n\t);\n\nVOID\nWiimoteSettingsSetEnableWiimoteXAxisAccelerometer(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ BOOLEAN Enabled\n\t);\n\nVOID\nWiimoteSettingsSetEnableWiimoteYAxisAccelerometer(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ BOOLEAN Enabled\n\t);\n\nVOID\nWiimoteSettingsSetSwapMouseButtons(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ BOOLEAN Enabled\n\t);\n\nVOID\nWiimoteSettingsSetSwapTriggerAndShoulder(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ BOOLEAN Enabled\n\t);\n\nVOID\nWiimoteSettingsSetSplitTriggerAxis(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ BOOLEAN Enabled\n\t);\n\nVOID\nWiimoteSettingsSetMapTriggerAsAxis(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ BOOLEAN Enabled\n);\n\nVOID\nWiimoteSettingsSetMapTriggerAsButtons(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_ BOOLEAN Enabled\n);\n"
  },
  {
    "path": "HID Wiimote/WiimoteState.c",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tWiimoteState.c\n\nAbstract:\n\tParses Wiimote Reports into State Buffers\n*/\n#include \"WiimoteState.h\"\n\n#include \"Device.h\"\n\nNTSTATUS UpdateCoreButtons(_Inout_ PWIIMOTE_WII_REMOTE_STATE WiiRemoteState, _In_reads_bytes_(2) PUCHAR ButtonData, _In_ size_t ButtonDataSize);\nNTSTATUS UpdateAccelerometer(_Inout_ PWIIMOTE_WII_REMOTE_STATE WiiRemoteState, _In_reads_bytes_(3) PUCHAR AccelerometerData, _In_ size_t AccelerometerDataSize);\nNTSTATUS UpdateExtension(_Inout_ PWIIMOTE_DEVICE_CONTEXT WiimoteContext, _In_reads_bytes_(DataSize) PUCHAR Data, _In_ size_t DataSize);\nNTSTATUS UpdateNunchuck(_Inout_ PWIIMOTE_NUNCHUCK_STATE NunchuckState, _In_reads_bytes_(6) PUCHAR NunchuckData, _In_ size_t NunchuckDataSize);\nNTSTATUS UpdateBalanceBoard(_Inout_ PWIIMOTE_BALANCE_BOARD_STATE BalanceBoardState, _In_reads_bytes_(8) PUCHAR BalanceBoardData, _In_ size_t BalanceBoardDataSize);\nNTSTATUS UpdateClassicController(_Inout_ PWIIMOTE_CLASSIC_CONTROLLER_STATE ClassicControllerState, _In_reads_bytes_(6) PUCHAR ClassicControllerData, _In_ size_t ClassicControllerDataSize);\nNTSTATUS UpdateClassicControllerPro(_Inout_ PWIIMOTE_CLASSIC_CONTROLLER_STATE ClassicControllerState, _In_reads_bytes_(6) PUCHAR ClassicControllerProData, _In_ size_t ClassicControllerProDataSize);\nNTSTATUS UpdateWiiUProController(_Inout_ PWIIMOTE_DEVICE_CONTEXT WiimoteContext, _Inout_ PWIIMOTE_CLASSIC_CONTROLLER_STATE ClassicControllerState, _In_reads_bytes_(11) PUCHAR WiiUProControllerData, _In_ size_t WiiUProControllerDataSize);\nNTSTATUS UpdateGuitar(_Inout_ PWIIMOTE_GUITAR_STATE GuitarState, _In_reads_bytes_(6) PUCHAR GuitarData, _In_ size_t GuitarDataSize);\nNTSTATUS UpdateIRCamera(_In_ PWIIMOTE_IR_STATE IRState, _In_reads_bytes_(10) PUCHAR IRData, _In_ size_t IRDataSize, _Out_ PBOOLEAN IRDataIsValid);\n\nVOID UpdateClassicControllerButtons(_Inout_ PWIIMOTE_CLASSIC_CONTROLLER_STATE ClassicControllerState, _In_reads_bytes_(2) PUCHAR ButtonData);\nVOID UpdateClassicControllerAxes(_Inout_ PWIIMOTE_CLASSIC_CONTROLLER_STATE ClassicControllerState, _In_reads_bytes_(2) PUCHAR ButtoInputDatanData);\nBOOLEAN UpdateIRCameraPoint(_In_ PWIIMOTE_IR_POINT IRPointData1, _In_ PWIIMOTE_IR_POINT IRPointData2, _In_reads_bytes_(5) PUCHAR IRData);\n\nVOID WiimoteStateResetToNullState(\n\t_In_ PDEVICE_CONTEXT DeviceContext\n\t)\n{\n\tPWIIMOTE_STATE WiimoteState = &DeviceContext->WiimoteContext.State;\n\n\t// Reset all to zero => No buttons pressed\n\tRtlSecureZeroMemory(WiimoteState, sizeof(WIIMOTE_STATE));\n\n\t// Reset Accelerometers to null state\n\tWiimoteState->WiiRemoteState.Accelerometer.X = 0x80;\n\tWiimoteState->WiiRemoteState.Accelerometer.Y = 0x80;\n\tWiimoteState->WiiRemoteState.Accelerometer.Z = 0x80;\n\n\t// Reset IR data to \"invalid data\"\n\tfor (size_t i = 0; i < WIIMOTE_IR_POINTS_BUFFER_SIZE; ++i)\n\t\tfor (size_t j = 0; j < WIIMOTE_IR_POINTS; j++)\n\t\t{\n\t\t\tDeviceContext->WiimoteContext.State.IRState.Points[i][j].X = 0x3FF;\n\t\t\tDeviceContext->WiimoteContext.State.IRState.Points[i][j].Y = 0x3FF;\n\t\t}\n\n\tHIDWiimoteStateUpdated(DeviceContext);\n}\n\n\nNTSTATUS WiimoteStateUpdate(\n\t_In_ PDEVICE_CONTEXT DeviceContext,\n\t_In_reads_bytes_(DataSize) PUCHAR Data,\n\t_In_ _In_range_(1, SIZE_MAX) size_t DataSize\n\t)\n{\n\tNTSTATUS Status = STATUS_SUCCESS;\n\tBOOLEAN ForwardUpdateToHID = TRUE;\n\tPWIIMOTE_DEVICE_CONTEXT WiimoteContext = &(DeviceContext->WiimoteContext);\n\tPWIIMOTE_WII_REMOTE_STATE WiiRemoteState = &(WiimoteContext->State.WiiRemoteState);\n\tBYTE ReportID = Data[0];\n\n\t//Every Report but 0x3D has Core Buttons\n\tif (ReportID != 0x3D)\n\t{\n\t\tStatus = UpdateCoreButtons(WiiRemoteState, Data + 1, DataSize - 1);\n\t\tif (!NT_SUCCESS(Status))\n\t\t{\n\t\t\treturn Status;\n\t\t}\n\t}\n\n\t// Process additional payload\n\tswitch (ReportID)\n\t{\n\tcase 0x31: // Accelerometer\n\t\tStatus = UpdateAccelerometer(WiiRemoteState, Data + 3, DataSize - 3);\n\t\tif (!NT_SUCCESS(Status))\n\t\t{\n\t\t\treturn Status;\n\t\t}\n\t\tbreak;\n\tcase 0x32: // 8 Byte Extension\n\tcase 0x34: // 19 Byte Extension\n\t\tStatus = UpdateExtension(WiimoteContext, Data + 3, DataSize - 3);\n\t\tif (!NT_SUCCESS(Status))\n\t\t{\n\t\t\treturn Status;\n\t\t}\n\t\tbreak;\n\tcase 0x35: // Accelerometer & 16 Byte Extension\n\t\tStatus = UpdateAccelerometer(WiiRemoteState, Data + 3, DataSize - 3);\n\t\tif (!NT_SUCCESS(Status))\n\t\t{\n\t\t\treturn Status;\n\t\t}\n\t\tStatus = UpdateExtension(WiimoteContext, Data + 6, DataSize - 6);\n\t\tif (!NT_SUCCESS(Status))\n\t\t{\n\t\t\treturn Status;\n\t\t}\n\t\tbreak;\n\tcase 0x36: // 10 Byte IR & 9 Byte Extension\n\t\tStatus = UpdateIRCamera(&(WiimoteContext->State.IRState), Data + 3, DataSize - 3, &ForwardUpdateToHID);\n\t\tif (!NT_SUCCESS(Status))\n\t\t{\n\t\t\treturn Status;\n\t\t}\n\t\tbreak;\n\t}\n\n\tif (ForwardUpdateToHID)\n\t{\n\t\tHIDWiimoteStateUpdated(DeviceContext);\n\t}\n\n\treturn Status;\n}\n\nNTSTATUS\nUpdateCoreButtons(\n\t_Inout_ PWIIMOTE_WII_REMOTE_STATE WiiRemoteState,\n\t_In_reads_bytes_(2) PUCHAR ButtonData,\n\t_In_ size_t ButtonDataSize\n\t)\n{\n\tif (ButtonDataSize < 2)\n\t{\n\t\tTrace(\"Data Buffer too small to read Core Buttons\");\n\t\treturn STATUS_INVALID_BUFFER_SIZE;\n\t}\n\n\tWiiRemoteState->CoreButtons.A = (ButtonData[1] & 0x08);\n\tWiiRemoteState->CoreButtons.B = (ButtonData[1] & 0x04);\n\tWiiRemoteState->CoreButtons.One = (ButtonData[1] & 0x02);\n\tWiiRemoteState->CoreButtons.Two = (ButtonData[1] & 0x01);\n\tWiiRemoteState->CoreButtons.Minus = (ButtonData[1] & 0x10);\n\tWiiRemoteState->CoreButtons.Plus = (ButtonData[0] & 0x10);\n\tWiiRemoteState->CoreButtons.Home = (ButtonData[1] & 0x80);\n\n\tWiiRemoteState->CoreButtons.DPad.Left = (ButtonData[0] & 0x01);\n\tWiiRemoteState->CoreButtons.DPad.Right = (ButtonData[0] & 0x02);\n\tWiiRemoteState->CoreButtons.DPad.Down = (ButtonData[0] & 0x04);\n\tWiiRemoteState->CoreButtons.DPad.Up = (ButtonData[0] & 0x08);\n\n\treturn STATUS_SUCCESS;\n}\n\nNTSTATUS\nUpdateAccelerometer(\n\t_Inout_ PWIIMOTE_WII_REMOTE_STATE WiiRemoteState,\n\t_In_reads_bytes_(3) PUCHAR AccelerometerData,\n\t_In_ size_t AccelerometerDataSize\n\t)\n{\n\tif (AccelerometerDataSize < 3)\n\t{\n\t\tTrace(\"Data Buffer too small to Update Accelerometer Data\");\n\t\treturn STATUS_INVALID_BUFFER_SIZE;\n\t}\n\n\t/*\n\t  Accelerometer data is originally 10 Bits wide. 8 MSBs are carried in the Accelermoter bytes.\n\t  The 2 LSBs are packed into the Core Button bytes. (Only for X are actually 2 bits packed; for Y and Z only the second LSB is provided)\n\t  For further processing only the 8 MSB are used.\n\t*/\n\tWiiRemoteState->Accelerometer.X = AccelerometerData[0];\n\tWiiRemoteState->Accelerometer.Y = AccelerometerData[1];\n\tWiiRemoteState->Accelerometer.Z = AccelerometerData[2];\n\n\treturn STATUS_SUCCESS;\n}\n\nNTSTATUS UpdateExtension(\n\t_Inout_ PWIIMOTE_DEVICE_CONTEXT WiimoteContext,\n\t_In_reads_bytes_(DataSize) PUCHAR Data,\n\t_In_ size_t DataSize\n\t)\n{\n\tswitch (WiimoteContext->Extension)\n\t{\n\tcase Nunchuck:\n\t\treturn UpdateNunchuck(&(WiimoteContext->State.NunchuckState), Data, DataSize);\n\tcase BalanceBoard:\n\t\treturn UpdateBalanceBoard(&(WiimoteContext->State.BalanceBoardState), Data, DataSize);\n\tcase ClassicController:\n\t\treturn UpdateClassicController(&(WiimoteContext->State.ClassicControllerState), Data, DataSize);\n\tcase ClassicControllerPro:\n\t\treturn UpdateClassicControllerPro(&(WiimoteContext->State.ClassicControllerState), Data, DataSize);\n\tcase WiiUProController:\n\t\treturn UpdateWiiUProController(WiimoteContext, &(WiimoteContext->State.ClassicControllerState), Data, DataSize);\n\tcase Guitar:\n\t\treturn UpdateGuitar(&(WiimoteContext->State.GuitarState), Data, DataSize);\n\tdefault:\n\t\treturn STATUS_SUCCESS;\n\t}\n}\n\nNTSTATUS\nUpdateNunchuck(\n\t_Inout_ PWIIMOTE_NUNCHUCK_STATE NunchuckState,\n\t_In_reads_bytes_(6) PUCHAR NunchuckData,\n\t_In_ size_t NunchuckDataSize\n\t)\n{\n\tif (NunchuckDataSize < 6)\n\t{\n\t\tTrace(\"Data Buffer too small to read Nunchuck Data\");\n\t\treturn STATUS_INVALID_BUFFER_SIZE;\n\t}\n\n\tBYTE ButtonData = ~NunchuckData[5];\n\n\t//Buttons\n\tNunchuckState->Buttons.Z = ButtonData & 0x01;\n\tNunchuckState->Buttons.C = ButtonData & 0x02;\n\n\t//Analog Stick\n\tNunchuckState->AnalogStick.X = NunchuckData[0];\n\tNunchuckState->AnalogStick.Y = NunchuckData[1];\n\n\t//Accelerometer\n\tNunchuckState->Accelerometer.X = NunchuckData[2];\n\tNunchuckState->Accelerometer.Y = NunchuckData[3];\n\tNunchuckState->Accelerometer.Z = NunchuckData[4];\n\n\treturn STATUS_SUCCESS;\n}\n\nNTSTATUS\nUpdateBalanceBoard(\n\t_Inout_ PWIIMOTE_BALANCE_BOARD_STATE BalanceBoardState,\n\t_In_reads_bytes_(8) PUCHAR BalanceBoardData,\n\t_In_ size_t BalanceBoardDataSize\n\t)\n{\n\tif (BalanceBoardDataSize < 8)\n\t{\n\t\tTrace(\"Data Buffer too small to read Balance Board Data\");\n\t\treturn STATUS_INVALID_BUFFER_SIZE;\n\t}\n\n\t// Sensor Data is Big-Endian, Windows is always Little-Endian\n\tBalanceBoardState->Sensor[WIIMOTE_BALANCE_BOARD_TOP_RIGHT] = RtlUshortByteSwap(*((PUSHORT)(BalanceBoardData + 0)));\n\tBalanceBoardState->Sensor[WIIMOTE_BALANCE_BOARD_BOTTOM_RIGHT] = RtlUshortByteSwap(*((PUSHORT)(BalanceBoardData + 2)));\n\tBalanceBoardState->Sensor[WIIMOTE_BALANCE_BOARD_TOP_LEFT] = RtlUshortByteSwap(*((PUSHORT)(BalanceBoardData + 4)));\n\tBalanceBoardState->Sensor[WIIMOTE_BALANCE_BOARD_BOTTOM_LEFT] = RtlUshortByteSwap(*((PUSHORT)(BalanceBoardData + 6)));\n\n\treturn STATUS_SUCCESS;\n}\n\nNTSTATUS\nUpdateClassicController(\n\t_Inout_ PWIIMOTE_CLASSIC_CONTROLLER_STATE ClassicControllerState,\n\t_In_reads_bytes_(6) PUCHAR ClassicControllerData,\n\t_In_ size_t ClassicControllerDataSize\n)\n{\n\tif (ClassicControllerDataSize < 6)\n\t{\n\t\tTrace(\"Data Buffer too small to read Classic Controller Data\");\n\t\treturn STATUS_INVALID_BUFFER_SIZE;\n\t}\n\n\t// Buttons\n\tUpdateClassicControllerButtons(ClassicControllerState, ClassicControllerData + 4);\n\n\t// Axes\n\tUpdateClassicControllerAxes(ClassicControllerState, ClassicControllerData);\n\n\t// Trigger\n\tClassicControllerState->LeftTrigger = 0xFF & ((0x60 & ClassicControllerData[2]) >> 2);\n\tClassicControllerState->LeftTrigger |= 0xFF & ((0xE0 & ClassicControllerData[3]) >> 5);\n\tClassicControllerState->RightTrigger = 0xFF & (0x1F & ClassicControllerData[3]);\n\n\treturn STATUS_SUCCESS;\n}\n\nNTSTATUS\nUpdateClassicControllerPro(\n\t_Inout_ PWIIMOTE_CLASSIC_CONTROLLER_STATE ClassicControllerState,\n\t_In_reads_bytes_(6) PUCHAR ClassicControllerProData,\n\t_In_ size_t ClassicControllerProDataSize\n\t)\n{\n\tif (ClassicControllerProDataSize < 6)\n\t{\n\t\tTrace(\"Data Buffer too small to read Classic Controller Pro Data\");\n\t\treturn STATUS_INVALID_BUFFER_SIZE;\n\t}\n\n\t//Buttons\n\tUpdateClassicControllerButtons(ClassicControllerState, ClassicControllerProData + 4);\n\n\t// Axes\n\tUpdateClassicControllerAxes(ClassicControllerState, ClassicControllerProData);\n\n\t//Trigger \n\tClassicControllerState->LeftTrigger = 0xFF;\n\tClassicControllerState->RightTrigger = 0xFF;\n\n\treturn STATUS_SUCCESS;\n}\n\nNTSTATUS\nUpdateWiiUProController(\n\t_Inout_ PWIIMOTE_DEVICE_CONTEXT WiimoteContext,\n\t_Inout_ PWIIMOTE_CLASSIC_CONTROLLER_STATE ClassicControllerState,\n\t_In_reads_bytes_(11) PUCHAR WiiUProControllerData,\n\t_In_ size_t WiiUProControllerDataSize\n\t)\n{\n\tif (WiiUProControllerDataSize < 11)\n\t{\n\t\tTrace(\"Data Buffer too small to read Wii U Pro Controller Data\");\n\t\treturn STATUS_INVALID_BUFFER_SIZE;\n\t}\n\n\tBYTE BatteryLevel = 0;\n\tBYTE ButtonData = ~WiiUProControllerData[10];\n\n\t//Buttons\n\tUpdateClassicControllerButtons(ClassicControllerState, WiiUProControllerData + 8);\n\n\tClassicControllerState->Buttons.LH = (ButtonData & 0x02);\n\tClassicControllerState->Buttons.RH = (ButtonData & 0x01);\n\n\t//AnalogSticks\n\tClassicControllerState->LeftAnalogStick.X = 0xFF & ((WiiUProControllerData[0] >> 4) | (WiiUProControllerData[1] << 4));\n\tClassicControllerState->LeftAnalogStick.Y = 0xFF & ((WiiUProControllerData[4] >> 4) | (WiiUProControllerData[5] << 4));\n\n\tClassicControllerState->RightAnalogStick.X = 0xFF & ((WiiUProControllerData[2] >> 4) | (WiiUProControllerData[3] << 4));\n\tClassicControllerState->RightAnalogStick.Y = 0xFF & ((WiiUProControllerData[6] >> 4) | (WiiUProControllerData[7] << 4));\n\n\t//Unsupported Input\n\tClassicControllerState->LeftTrigger = 0xFF;\n\tClassicControllerState->RightTrigger = 0xFF;\n\n\t//Battery Level\n\tswitch (WiiUProControllerData[10] & 0xF0)\n\t{\n\tcase 0xC0:\n\t\tBatteryLevel = 0xFF;\n\t\tbreak;\n\tcase 0xB0:\n\t\tBatteryLevel = 0xBF;\n\t\tbreak;\n\tcase 0xA0:\n\t\tBatteryLevel = 0x7F;\n\t\tbreak;\n\tcase 0x90:\n\t\tBatteryLevel = 0x3F;\n\t\tbreak;\n\tcase 0x80:\n\tdefault:\n\t\tBatteryLevel = 0x10;\n\t}\n\n\tWiimoteContext->BatteryLevel = BatteryLevel;\n\n\treturn STATUS_SUCCESS;\n}\n\nVOID\nUpdateClassicControllerButtons(\n\t_Inout_ PWIIMOTE_CLASSIC_CONTROLLER_STATE ClassicControllerState,\n\t_In_reads_bytes_(2) PUCHAR ButtonData\n)\n{\n\tBYTE InvertedButtonData[2] = { 0 };\n\tInvertedButtonData[0] = ~ButtonData[0];\n\tInvertedButtonData[1] = ~ButtonData[1];\n\n\tClassicControllerState->Buttons.A = InvertedButtonData[1] & 0x10;\n\tClassicControllerState->Buttons.B = InvertedButtonData[1] & 0x40;\n\tClassicControllerState->Buttons.Y = InvertedButtonData[1] & 0x20;\n\tClassicControllerState->Buttons.X = InvertedButtonData[1] & 0x08;\n\tClassicControllerState->Buttons.Home = InvertedButtonData[0] & 0x08;\n\tClassicControllerState->Buttons.Plus = InvertedButtonData[0] & 0x04;\n\tClassicControllerState->Buttons.Minus = InvertedButtonData[0] & 0x10;\n\n\tClassicControllerState->Buttons.DPad.Up = InvertedButtonData[1] & 0x01;\n\tClassicControllerState->Buttons.DPad.Right = InvertedButtonData[0] & 0x80;\n\tClassicControllerState->Buttons.DPad.Down = InvertedButtonData[0] & 0x40;\n\tClassicControllerState->Buttons.DPad.Left = InvertedButtonData[1] & 0x02;\n\n\tClassicControllerState->Buttons.L = InvertedButtonData[0] & 0x20;\n\tClassicControllerState->Buttons.ZL = InvertedButtonData[1] & 0x80;\n\tClassicControllerState->Buttons.R = InvertedButtonData[0] & 0x02;\n\tClassicControllerState->Buttons.ZR = InvertedButtonData[1] & 0x04;\n\n\tClassicControllerState->Buttons.LH = FALSE;\n\tClassicControllerState->Buttons.RH = FALSE;\n}\n\nVOID \nUpdateClassicControllerAxes(\n\t_Inout_ PWIIMOTE_CLASSIC_CONTROLLER_STATE ClassicControllerState,\n\t_In_reads_bytes_(3) PUCHAR InputData\n)\n{\n\t//Analog Sticks\n\tClassicControllerState->LeftAnalogStick.X = 0xFF & ((0x3F & InputData[0]) << 2);\n\tClassicControllerState->LeftAnalogStick.Y = 0xFF & ((0x3F & InputData[1]) << 2);\n\n\tClassicControllerState->RightAnalogStick.X = 0xFF & ((0xC0 & InputData[0]));\n\tClassicControllerState->RightAnalogStick.X |= 0xFF & ((0xC0 & InputData[1]) >> 2);\n\tClassicControllerState->RightAnalogStick.X |= 0xFF & ((0x80 & InputData[2]) >> 4);\n\tClassicControllerState->RightAnalogStick.Y = 0xFF & ((0x1F & InputData[2]) << 3);\n}\n\nNTSTATUS\nUpdateGuitar(\n\t_Inout_ PWIIMOTE_GUITAR_STATE GuitarState,\n\t_In_reads_bytes_(6) PUCHAR GuitarData,\n\t_In_ size_t GuitarDataSize\n\t)\n{\n\tif (GuitarDataSize < 6)\n\t{\n\t\tTrace(\"Data Buffer too small to read Guitar Data\");\n\t\treturn STATUS_INVALID_BUFFER_SIZE;\n\t}\n\n\tBYTE ButtonData[2] = { 0 };\n\tButtonData[0] = ~GuitarData[4];\n\tButtonData[1] = ~GuitarData[5];\n\n\t// Buttons\n\tGuitarState->Buttons.Green = ButtonData[1] & 0x10;\n\tGuitarState->Buttons.Red = ButtonData[1] & 0x40;\n\tGuitarState->Buttons.Yellow = ButtonData[1] & 0x08;\n\tGuitarState->Buttons.Blue = ButtonData[1] & 0x20;\n\tGuitarState->Buttons.Orange = ButtonData[1] & 0x80;\n\tGuitarState->Buttons.Plus = ButtonData[0] & 0x04;\n\tGuitarState->Buttons.Minus = ButtonData[0] & 0x10;\n\tGuitarState->Buttons.Up = ButtonData[1] & 0x01;\n\tGuitarState->Buttons.Down = ButtonData[0] & 0x40;\n\n\t// Analog Sticks\n\tGuitarState->AnalogStick.X = 0xFF & ((0x3F & GuitarData[0]) << 2);\n\tGuitarState->AnalogStick.Y = 0xFF & ((0x3F & GuitarData[1]) << 2);\n\n\t// Analog Bars\n\tGuitarState->TouchBar = 0xFF & ((0x1F & GuitarData[2]) << 3);\n\tGuitarState->WhammyBar = 0xFF & ((0x1F & GuitarData[3]) << 3);\n\n\treturn STATUS_SUCCESS;\n}\n\nNTSTATUS\nUpdateIRCamera(\n\t_In_ PWIIMOTE_IR_STATE IRState,\n\t_In_reads_bytes_(10) PUCHAR IRData,\n\t_In_ size_t IRDataSize,\n\t_Out_ PBOOLEAN IRDataIsValid\n\t)\n{\n\tif (IRDataSize < 10)\n\t{\n\t\tTrace(\"Data Buffer too small to read IR Data\");\n\t\treturn STATUS_INVALID_BUFFER_SIZE;\n\t}\n\n\tBYTE BufferIndex = IRState->PointsBufferPointer++;\n\n\tIRState->PointsBufferPointer %= WIIMOTE_IR_POINTS_BUFFER_SIZE;\n\t(*IRDataIsValid) = FALSE;\n\n\t(*IRDataIsValid) |= UpdateIRCameraPoint(&(IRState->Points[BufferIndex][0]), &(IRState->Points[BufferIndex][1]), IRData);\n\t(*IRDataIsValid) |= UpdateIRCameraPoint(&(IRState->Points[BufferIndex][2]), &(IRState->Points[BufferIndex][3]), IRData + 5);\n\n\treturn STATUS_SUCCESS;\n}\n\nBOOLEAN\nUpdateIRCameraPoint(\n\t_In_ PWIIMOTE_IR_POINT IRPointData1,\n\t_In_ PWIIMOTE_IR_POINT IRPointData2,\n\t_In_reads_bytes_(5) PUCHAR IRData\n\t)\n{\n\tUSHORT X1 = IRData[0];\n\tUSHORT Y1 = IRData[1];\n\tUSHORT X2 = IRData[3];\n\tUSHORT Y2 = IRData[4];\n\n\tX1 |= (0x30 & IRData[2]) << 4;\n\tY1 |= (0xC0 & IRData[2]) << 2;\n\tX2 |= (0x03 & IRData[2]) << 8;\n\tY2 |= (0x0C & IRData[2]) << 6;\n\n\tIRPointData1->X = X1;\n\tIRPointData1->Y = Y1;\n\tIRPointData2->X = X2;\n\tIRPointData2->Y = Y2;\n\n\t// Max for Y is 767, so 0x3FF Value means no Data\n\treturn ((Y1 != 0x3FF) || (Y2 != 0x3FF));\n}\n"
  },
  {
    "path": "HID Wiimote/WiimoteState.h",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tWiimoteState.h\n\nAbstract:\n\tHeader file for WiimoteState.c\n*/\n#pragma once\n\n#include \"HIDWiimote.h\"\n\n// --- Wii Remote --- //\ntypedef struct _WIIMOTE_WII_REMOTE_STATE\n{\n\tstruct\n\t{\n\t\tBOOLEAN A;\n\t\tBOOLEAN B;\n\t\tBOOLEAN One;\n\t\tBOOLEAN Two;\n\t\tBOOLEAN Plus;\n\t\tBOOLEAN Minus;\n\t\tBOOLEAN Home;\n\n\t\tstruct\n\t\t{\n\t\t\tBOOLEAN Up;\n\t\t\tBOOLEAN Down;\n\t\t\tBOOLEAN Left;\n\t\t\tBOOLEAN Right;\n\t\t} DPad;\n\t} CoreButtons;\n\n\tstruct\n\t{\n\t\tBYTE X;\n\t\tBYTE Y;\n\t\tBYTE Z;\n\t} Accelerometer;\n\n} WIIMOTE_WII_REMOTE_STATE, *PWIIMOTE_WII_REMOTE_STATE;\n\n// --- IR --- //\n#define WIIMOTE_IR_POINTS 4\n#define WIIMOTE_IR_POINTS_BUFFER_SIZE 5\n#define WIIMOTE_IR_POINT_X_MAX 1023\n#define WIIMOTE_IR_POINT_Y_MAX 767\n\ntypedef struct _WIIMOTE_IR_POINT\n{\n\tUSHORT X;\n\tUSHORT Y;\n\n} WIIMOTE_IR_POINT, *PWIIMOTE_IR_POINT;\n\n\ntypedef struct _WIIMOTE_IR_STATE\n{\n\tWIIMOTE_IR_POINT Points[WIIMOTE_IR_POINTS_BUFFER_SIZE][WIIMOTE_IR_POINTS];\n\tBYTE PointsBufferPointer;\n\n} WIIMOTE_IR_STATE, *PWIIMOTE_IR_STATE;\n\n// --- Nunchuck --- //\ntypedef struct _WIIMOTE_NUNCHUCK_STATE\n{\n\tstruct\n\t{\n\t\tBOOLEAN C;\n\t\tBOOLEAN Z;\n\t} Buttons;\n\n\tstruct\n\t{\n\t\tBYTE X;\n\t\tBYTE Y;\n\t} AnalogStick;\n\n\tstruct\n\t{\n\t\tBYTE X;\n\t\tBYTE Y;\n\t\tBYTE Z;\n\t} Accelerometer;\n\n} WIIMOTE_NUNCHUCK_STATE, *PWIIMOTE_NUNCHUCK_STATE;\n\n// --- Balance Board --- //\n#define WIIMOTE_BALANCE_BOARD_TOP_RIGHT\t\t0\n#define WIIMOTE_BALANCE_BOARD_BOTTOM_RIGHT\t1\n#define WIIMOTE_BALANCE_BOARD_TOP_LEFT\t\t2\n#define WIIMOTE_BALANCE_BOARD_BOTTOM_LEFT\t3\n#define WIIMOTE_BALANCE_BOARD_SENSOR_POINTS\t4\n\n#define WIIMOTE_BALANCE_BOARD_CALIBRATION_RECORDS 3\n\ntypedef struct _WIIMOTE_BALANCE_BOARD_STATE\n{\n\tUSHORT Sensor[4];\n\tUSHORT Calibration[WIIMOTE_BALANCE_BOARD_SENSOR_POINTS][WIIMOTE_BALANCE_BOARD_CALIBRATION_RECORDS];\n\n} WIIMOTE_BALANCE_BOARD_STATE, *PWIIMOTE_BALANCE_BOARD_STATE;\n\n// --- Classic Controller (Pro) / Wii U Pro Controller --- //\ntypedef struct _WIIMOTE_CLASSIC_CONTROLLER_STATE\n{\n\tstruct\n\t{\n\t\tBOOLEAN L;\n\t\tBOOLEAN R;\n\t\tBOOLEAN ZL;\n\t\tBOOLEAN ZR;\n\t\tBOOLEAN LH;\n\t\tBOOLEAN RH;\n\t\tBOOLEAN A;\n\t\tBOOLEAN B;\n\t\tBOOLEAN Y;\n\t\tBOOLEAN X;\n\t\tBOOLEAN Plus;\n\t\tBOOLEAN Minus;\n\t\tBOOLEAN Home;\n\n\t\tstruct\n\t\t{\n\t\t\tBOOLEAN Up;\n\t\t\tBOOLEAN Down;\n\t\t\tBOOLEAN Left;\n\t\t\tBOOLEAN Right;\n\t\t} DPad;\n\n\t} Buttons;\n\n\tBYTE LeftTrigger;\n\tBYTE RightTrigger;\n\n\tstruct\n\t{\n\t\tBYTE X;\n\t\tBYTE Y;\n\t} LeftAnalogStick;\n\n\tstruct\n\t{\n\t\tBYTE X;\n\t\tBYTE Y;\n\t} RightAnalogStick;\n\n} WIIMOTE_CLASSIC_CONTROLLER_STATE, *PWIIMOTE_CLASSIC_CONTROLLER_STATE;\n\n// --- Guitar --- //\ntypedef struct _WIIMOTE_GUITAR_STATE\n{\n\tstruct\n\t{\n\t\tBOOLEAN Green;\n\t\tBOOLEAN Red;\n\t\tBOOLEAN Yellow;\n\t\tBOOLEAN Blue;\n\t\tBOOLEAN Orange;\n\t\tBOOLEAN Plus;\n\t\tBOOLEAN Minus;\n\t\tBOOLEAN Up;\n\t\tBOOLEAN Down;\n\t} Buttons;\n\n\tBYTE TouchBar;\n\tBYTE WhammyBar;\n\n\tstruct\n\t{\n\t\tBYTE X;\n\t\tBYTE Y;\n\t} AnalogStick;\n\n} WIIMOTE_GUITAR_STATE, *PWIIMOTE_GUITAR_STATE;\n\n// --- Wiimote State --- //\n#pragma warning(push)\n#pragma warning(disable:4201) //nameless struct/union\ntypedef struct _WIIMOTE_STATE\n{\n\tWIIMOTE_WII_REMOTE_STATE WiiRemoteState;\n\tWIIMOTE_IR_STATE IRState;\n\n\tunion\n\t{\n\t\tWIIMOTE_NUNCHUCK_STATE NunchuckState;\n\t\tWIIMOTE_BALANCE_BOARD_STATE BalanceBoardState;\n\t\tWIIMOTE_CLASSIC_CONTROLLER_STATE ClassicControllerState;\n\t\tWIIMOTE_GUITAR_STATE GuitarState;\n\n\t};\n\n} WIIMOTE_STATE, *PWIIMOTE_STATE;\n#pragma warning(pop)\n\nVOID WiimoteStateResetToNullState(_In_ PDEVICE_CONTEXT DeviceContext);\nNTSTATUS WiimoteStateUpdate(_In_ PDEVICE_CONTEXT DeviceContext, _In_reads_bytes_(DataSize) PUCHAR Data, _In_ size_t DataSize);\n"
  },
  {
    "path": "HID Wiimote/WiimoteToHIDParser.c",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tWiimoteToHIDParser.c\r\n\r\nAbstract:\r\n\tParses the current Wiimote State to a HID Read Report\r\n\r\n*/\r\n#include \"WiimoteToHIDParser.h\"\r\n\r\n#include \"Wiimote.h\"\r\n\r\nVOID\r\nParseBooleanAxis(\r\n\t_In_ BOOLEAN MinimumValue,\r\n\t_In_ BOOLEAN MaximumValue,\r\n\t_Inout_ PUCHAR AxisValue,\r\n\t_In_ BOOLEAN Signed\r\n)\r\n{\r\n\tBYTE MinValue = (Signed ? 0x81 : 0x00);\r\n\tBYTE MaxValue = (Signed ? 0x7F : 0xFF);\r\n\tBYTE NullValue = (Signed ? 0x00 : 0x7F);\r\n\r\n\t(*AxisValue) = MinimumValue ? MinValue : MaximumValue ? MaxValue : NullValue;\r\n}\r\n\r\n\r\nVOID\r\nParseBooleanNonByteAxis(\r\n\t_In_ BOOLEAN MinimumValue,\r\n\t_In_ BOOLEAN MaximumValue,\r\n\t_Inout_ PUCHAR AxisValue,\r\n\t_In_ UCHAR LeastSignificantBitPosition,\r\n\t_In_ BYTE Bits,\r\n\t_In_ BOOLEAN Signed\r\n)\r\n{\r\n\tUCHAR Value;\r\n\tParseBooleanAxis(MinimumValue, MaximumValue, &Value, Signed);\r\n\r\n\t(*AxisValue) |= (Value >> (8 - Bits)) << LeastSignificantBitPosition;\r\n}\r\n\r\nVOID\r\nParseButton(\r\n\t_In_ BOOLEAN ButtonValue,\r\n\t_Inout_ PUCHAR ButtonBitField,\r\n\t_In_ UCHAR LeastSignificantBitPosition\r\n)\r\n{\r\n\tif (ButtonValue)\r\n\t{\r\n\t\t(*ButtonBitField) |= (0x01 << LeastSignificantBitPosition);\r\n\t}\r\n}\r\n\r\nVOID\r\nParseAnalogAxis(\r\n\t_In_ BYTE RawValue,\r\n\t_Out_ PUCHAR AxisValue,\r\n\t_In_ BOOLEAN Signed,\r\n\t_In_ BOOLEAN Invert\r\n)\r\n{\r\n\tif (Invert)\r\n\t{\r\n\t\tRawValue = ~RawValue;\r\n\t}\r\n\r\n\tif (Signed)\r\n\t{\r\n\t\tRawValue ^= 0x80;\r\n\t}\r\n\t\t\r\n\t(*AxisValue) = RawValue;\r\n}\r\n\r\nVOID\r\nParseAccelerometer(\r\n\t_In_ BYTE RawValue,\r\n\t_Out_ PUCHAR AxisValue,\r\n\t_In_ BOOLEAN Invert\r\n)\r\n{\r\n\t// Gravity is always present. 10 Bit Accelerometer data would have value of 96 (9,8 m/s).\r\n\t// As only the 8 MSBs are used the value is 24. To caputure that constant pull a value range from 0 to 63 is used (32 = nullstate).\r\n\t// For a range of 63 6 bits are used.\r\n\r\n\t// Normally 0x80 (128) is the middle of the 8 bit range, so cap the accelerometer data to a range of 32 around 128.\r\n\tRawValue = max(RawValue, 0x80 - 0x20);\r\n\tRawValue = min(RawValue, 0x80 + 0x1F);\r\n\r\n\tRawValue -= (0x80 - 0x20);\r\n\r\n\tif (Invert)\r\n\t{\r\n\t\tRawValue = RawValue ^ 0x3F;\r\n\t}\r\n\r\n\t(*AxisValue) = RawValue << 2;\r\n}\r\n\r\nBYTE\r\nGetTriggerValue(\r\n\t_In_ BYTE Trigger,\r\n\t_In_ BOOLEAN Button\r\n)\r\n{\r\n\tif (Trigger == 0xFF)\r\n\t{\r\n\t\treturn (Button ? 0x7C : 0x00);\r\n\t}\r\n\telse\r\n\t{\r\n\t\treturn (Trigger << 2);\r\n\t}\r\n}\r\n\r\nVOID\r\nParseTrigger(\r\n\t_In_ BYTE TriggerLValue,\r\n\t_In_ BYTE TriggerRValue,\r\n\t_In_ BOOLEAN ButtonRValue,\r\n\t_In_ BOOLEAN ButtonLValue,\r\n\t_In_ BOOLEAN ButtonZRValue,\r\n\t_In_ BOOLEAN ButtonZLValue,\r\n\t_In_ BOOLEAN SplitAxis,\r\n\t_In_ BOOLEAN SwapButtons,\r\n\t_Out_ BYTE ReportZByte[1],\r\n\t_Out_ BYTE ReportRZByte[1]\r\n)\r\n{\r\n\tTriggerLValue = GetTriggerValue(TriggerLValue, (SwapButtons) ? ButtonZLValue : ButtonLValue);\r\n\tTriggerRValue = GetTriggerValue(TriggerRValue, (SwapButtons) ? ButtonZRValue : ButtonRValue);\r\n\r\n\tif (SplitAxis)\r\n\t{\r\n\t\t*ReportZByte = TriggerLValue << 1;\r\n\t\t*ReportRZByte = TriggerRValue << 1;\r\n\t}\r\n\telse\r\n\t{\r\n\t\t*ReportZByte = 0x80 - TriggerLValue + TriggerRValue;\r\n\t}\r\n}\r\n\r\nVOID\r\nParseDPad(\r\n\t_In_ BOOLEAN Up,\r\n\t_In_ BOOLEAN Right,\r\n\t_In_ BOOLEAN Down,\r\n\t_In_ BOOLEAN Left,\r\n\t_Out_ PUCHAR HatswitchBitField\r\n)\r\n{\r\n\t/*\r\n\t\tUp\t\t\t1\t\t0000 0001\t\t\t0000 0000\r\n\t\tUp-Right\t2\t\t0000 0010\t\t\t0000 0001\r\n\t\tRight\t\t3\t\t0000 0011\t\t\t0000 0010\r\n\t\tDown-Right\t4\t\t0000 0100\t\t\t0000 0011\r\n\t\tDown\t\t5\t\t0000 0101\t\t\t0000 0100\r\n\t\tDown-Left\t6\t\t0000 0110\t\t\t0000 0101\r\n\t\tLeft\t\t7\t\t0000 0111\t\t\t0000 0110\r\n\t\tUp-Left\t\t8\t\t0000 1000\t\t\t0000 0111\r\n\t*/\r\n\r\n\t// Thanks to Waterlimon for this solution\r\n\t// See http://www.gamedev.net/topic/667868-direction-booleans-into-single-integer/ for more solutions.\r\n\t//\r\n\t// Branchless polynomial version (just for fun):\r\n\t// int64_t x = 3 * (up - down) + left - right;\r\n\t// return x * (x * (x * (x * (x * (x * (x * (x * (-31) - 28) + 938) + 840) - 8519) - 6972) + 24412) + 12880) / 3360;\r\n\t//\r\n\tconst BYTE ValueLookUpTable[3][3] = {\r\n\t\t\t{ 8, 1, 2 },\r\n\t\t\t{ 7, 0, 3 },\r\n\t\t\t{ 6, 5, 4 },\r\n\t};\r\n\r\n\t//BOOLEAN is a UCHAR in C\r\n\t//so make sure its numerical value is 1, some may have other values due to bit operations.\r\n\tUp = Up ? 1 : 0;\r\n\tDown = Down ? 1 : 0;\r\n\tLeft = Left ? 1 : 0;\r\n\tRight = Right ? 1 : 0;\r\n\r\n\t(*HatswitchBitField) = ValueLookUpTable[Down + 1 - Up][Right + 1 - Left];\r\n}\r\n\r\nUCHAR\r\nJoinSensorValue(\r\n\t_In_ USHORT ValueOne,\r\n\t_In_ USHORT ValueTwo\r\n)\r\n{\r\n\tUSHORT Value = (ValueOne + ValueTwo);\r\n\treturn (UCHAR)(Value / 4);\r\n}\r\n\r\nBYTE\r\nParseBalanceBoardSensors(\r\n\t_In_ UCHAR PositiveValueOne,\r\n\t_In_ UCHAR PositiveValueTwo,\r\n\t_In_ UCHAR NegativeValueOne,\r\n\t_In_ UCHAR NegativeValueTwo\r\n)\r\n{\r\n\tUCHAR PositiveValue = JoinSensorValue(PositiveValueOne, PositiveValueTwo);\r\n\tUCHAR NegativeValue = JoinSensorValue(NegativeValueOne, NegativeValueTwo);\r\n\r\n\tBYTE Value = PositiveValue + 0x7F - NegativeValue;\r\n\r\n\treturn Value;\r\n}\r\n\r\nUCHAR\r\nGetCalibratedBoardValue(\r\n\t_In_ USHORT Value,\r\n\t_In_reads_(3) PUSHORT CalibrationData)\r\n{\r\n\t/*\r\n\tCalibration - return range 0 - 255\r\n\t-----------\r\n\t0\t\t0\r\n\t\t...\r\n\t1\t\t128\r\n\t\t...\r\n\t2\t\t255\r\n\r\n\t*/\r\n\r\n\tif (Value <= CalibrationData[0])\r\n\t{\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tif (Value >= CalibrationData[2])\r\n\t{\r\n\t\treturn 255;\r\n\t}\r\n\r\n\tsize_t CalibrationHigherBound = (Value > CalibrationData[1]) ? 2 : 1;\r\n\r\n\tconst UCHAR SegmentRange = 128;\r\n\tUSHORT RawRange = CalibrationData[CalibrationHigherBound] - CalibrationData[CalibrationHigherBound - 1];\r\n\tDWORD32 RawValue = (Value - CalibrationData[CalibrationHigherBound - 1]);\r\n\r\n\tRawValue *= SegmentRange;\r\n\tUCHAR ActualValue = (UCHAR)(RawValue / RawRange);\r\n\tActualValue += (UCHAR)(CalibrationHigherBound - 1) * SegmentRange;\r\n\r\n\treturn ActualValue;\r\n}\r\n\r\nBOOLEAN AccumulateIRPoint(\r\n\t_In_ PWIIMOTE_IR_POINT Point,\r\n\t_Inout_ PUINT16 X,\r\n\t_Inout_ PUINT16 Y\r\n)\r\n{\r\n\t// X ranges from 0-1023; Y from 0-767; so if Y == 0x3FF (1023) the point data is empty\r\n\tif (Point->Y != 0x3FF)\r\n\t{\r\n\t\t(*X) += Point->X;\r\n\t\t(*Y) += Point->Y;\r\n\t\treturn TRUE;\r\n\t}\r\n\r\n\treturn FALSE;\r\n}\r\n\r\nBOOLEAN ParseIRPoints(\r\n\t_In_ WIIMOTE_IR_POINT Points[WIIMOTE_IR_POINTS],\r\n\t_Out_ PUINT32 X,\r\n\t_Out_ PUINT32 Y\r\n)\r\n{\r\n\tBYTE ValidPointCount = 0;\r\n\tUINT16 GroupX = 0;\r\n\tUINT16 GroupY = 0;\r\n\r\n\tfor (BYTE i = 0; i < WIIMOTE_IR_POINTS; i++)\r\n\t{\r\n\t\tif (AccumulateIRPoint(&Points[i], &GroupX, &GroupY))\r\n\t\t{\r\n\t\t\tValidPointCount++;\r\n\t\t}\r\n\t}\r\n\r\n\tif (ValidPointCount > 0)\r\n\t{\r\n\t\t(*X) += GroupX / ValidPointCount;\r\n\t\t(*Y) += GroupY / ValidPointCount;\r\n\r\n\t\treturn TRUE;\r\n\t}\r\n\r\n\treturn FALSE;\r\n}\r\n\r\nVOID ParseIRCamera(\r\n\t_In_ WIIMOTE_IR_POINT Points[WIIMOTE_IR_POINTS_BUFFER_SIZE][WIIMOTE_IR_POINTS],\r\n\t_Out_ PUSHORT XAxis,\r\n\t_Out_ PUSHORT YAxis,\r\n\t_In_ BYTE XPadding,\r\n\t_In_ BYTE YPadding\r\n)\r\n{\r\n\tBYTE ValidBufferCount = 0;\r\n\tUINT32 X = 0;\r\n\tUINT32 Y = 0;\r\n\r\n\tfor (BYTE i = 0; i < WIIMOTE_IR_POINTS_BUFFER_SIZE; i++)\r\n\t{\r\n\t\tif (ParseIRPoints(Points[i], &X, &Y))\r\n\t\t{\r\n\t\t\tValidBufferCount++;\r\n\t\t}\r\n\t}\r\n\r\n\tif (ValidBufferCount == 0)\r\n\t{\r\n\t\treturn;\r\n\t}\r\n\r\n\tX /= ValidBufferCount;\r\n\tY /= ValidBufferCount;\r\n\r\n\t//Invert X\r\n\tX = WIIMOTE_IR_POINT_X_MAX - X;\r\n\r\n\tX = (X >= (UINT32)(WIIMOTE_IR_POINT_X_MAX - XPadding)) ? WIIMOTE_IR_POINT_X_MAX - XPadding : X;\r\n\tX = (X <= XPadding) ? 0 : X - XPadding;\r\n\r\n\tY = (Y >= (UINT32)(WIIMOTE_IR_POINT_Y_MAX - YPadding)) ? WIIMOTE_IR_POINT_Y_MAX - YPadding : Y;\r\n\tY = (Y <= YPadding) ? 0 : Y - YPadding;\r\n\r\n\t// Value = OldValue * NewMax / OldMax\r\n\t// Bug or Feature in at least Windows 8.1 HID Class, LOGCIAL_MAXIMUM musst be power of 2 - 1\r\n\tX *= 1023;\r\n\tX /= WIIMOTE_IR_POINT_X_MAX - 2 * XPadding;\r\n\r\n\tY *= 1023;\r\n\tY /= WIIMOTE_IR_POINT_Y_MAX - 2 * YPadding;\r\n\r\n\t(*XAxis) = RtlUshortByteSwap(X);\r\n\t(*YAxis) = RtlUshortByteSwap(Y);\r\n}\r\n\r\nVOID\r\nParseWiimoteStateAsStandaloneWiiremote(\r\n\t_In_ PWIIMOTE_STATE WiimoteState,\r\n\t_In_ PWIIMOTE_SETTINGS WiimoteSettings,\r\n\t_Out_ PHID_GAMEPAD_REPORT GamepadReport\r\n)\r\n{\r\n\t//Axis\r\n\tParseBooleanAxis(WiimoteState->WiiRemoteState.CoreButtons.DPad.Up, WiimoteState->WiiRemoteState.CoreButtons.DPad.Down, &GamepadReport->XAxis, FALSE);\r\n\tParseBooleanAxis(WiimoteState->WiiRemoteState.CoreButtons.DPad.Right, WiimoteState->WiiRemoteState.CoreButtons.DPad.Left, &GamepadReport->YAxis, FALSE);\r\n\r\n\t//Buttons\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.One, &GamepadReport->Buttons[0], 0);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Two, &GamepadReport->Buttons[0], 1);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.A, &GamepadReport->Buttons[0], 2);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.B, &GamepadReport->Buttons[0], 3);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Plus, &GamepadReport->Buttons[0], 4);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Minus, &GamepadReport->Buttons[0], 5);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Home, &GamepadReport->Buttons[0], 6);\r\n\r\n\t//Accelerometer\r\n\tif(WiimoteSettings->EnableWiimoteXAxisAccelerometer)\r\n\t\tParseAccelerometer(WiimoteState->WiiRemoteState.Accelerometer.Y, &GamepadReport->RXAxis, TRUE);\r\n\tif (WiimoteSettings->EnableWiimoteYAxisAcceleromenter)\r\n\t\tParseAccelerometer(WiimoteState->WiiRemoteState.Accelerometer.X, &GamepadReport->RYAxis, TRUE);\r\n\t//ParseAccelerometer(WiimoteState->Accelerometer.Z, RequestBuffer + 3, 4);\r\n\t\r\n}\r\n\r\nVOID\r\nParseWiimoteStateAsNunchuckExtension(\r\n\t_In_ PWIIMOTE_STATE WiimoteState,\r\n\t_In_ PWIIMOTE_SETTINGS WiimoteSettings,\r\n\t_Out_ PHID_GAMEPAD_REPORT GamepadReport\r\n)\r\n{\r\n\t//AnalogStick as Axis\r\n\tParseAnalogAxis(WiimoteState->NunchuckState.AnalogStick.X, &GamepadReport->XAxis, FALSE, FALSE);\r\n\tParseAnalogAxis(WiimoteState->NunchuckState.AnalogStick.Y, &GamepadReport->YAxis, FALSE, TRUE);\r\n\r\n\t//Buttons\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.A, &GamepadReport->Buttons[0], 0);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.B, &GamepadReport->Buttons[0], 1);\r\n\tParseButton(WiimoteState->NunchuckState.Buttons.C, &GamepadReport->Buttons[0], 2);\r\n\tParseButton(WiimoteState->NunchuckState.Buttons.Z, &GamepadReport->Buttons[0], 3);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.One, &GamepadReport->Buttons[0], 4);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Two, &GamepadReport->Buttons[0], 5);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Plus, &GamepadReport->Buttons[0], 6);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Minus, &GamepadReport->Buttons[0], 7);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Home, &GamepadReport->Buttons[1], 0);\r\n\r\n\t//Accelerometer\r\n\tif (WiimoteSettings->EnableWiimoteXAxisAccelerometer)\r\n\t\tParseAccelerometer(WiimoteState->WiiRemoteState.Accelerometer.X, &GamepadReport->RXAxis, TRUE);\r\n\tif (WiimoteSettings->EnableWiimoteYAxisAcceleromenter)\r\n\t\tParseAccelerometer(WiimoteState->WiiRemoteState.Accelerometer.Y, &GamepadReport->RYAxis, TRUE);\r\n\r\n\t//DPad\r\n\tParseDPad(\r\n\t\tWiimoteState->WiiRemoteState.CoreButtons.DPad.Up,\r\n\t\tWiimoteState->WiiRemoteState.CoreButtons.DPad.Right,\r\n\t\tWiimoteState->WiiRemoteState.CoreButtons.DPad.Down,\r\n\t\tWiimoteState->WiiRemoteState.CoreButtons.DPad.Left,\r\n\t\t&GamepadReport->Hatswitch);\r\n}\r\n\r\nVOID\r\nParseWiimoteStateAsBalanceBoard(\r\n\t_In_ PWIIMOTE_STATE WiimoteState,\r\n\t_Out_ PHID_GAMEPAD_REPORT GamepadReport\r\n)\r\n{\r\n\tUCHAR TopRight = GetCalibratedBoardValue(WiimoteState->BalanceBoardState.Sensor[WIIMOTE_BALANCE_BOARD_TOP_RIGHT], WiimoteState->BalanceBoardState.Calibration[WIIMOTE_BALANCE_BOARD_TOP_RIGHT]);\r\n\tUCHAR BottomRight = GetCalibratedBoardValue(WiimoteState->BalanceBoardState.Sensor[WIIMOTE_BALANCE_BOARD_BOTTOM_RIGHT], WiimoteState->BalanceBoardState.Calibration[WIIMOTE_BALANCE_BOARD_BOTTOM_RIGHT]);\r\n\tUCHAR TopLeft = GetCalibratedBoardValue(WiimoteState->BalanceBoardState.Sensor[WIIMOTE_BALANCE_BOARD_TOP_LEFT], WiimoteState->BalanceBoardState.Calibration[WIIMOTE_BALANCE_BOARD_TOP_LEFT]);\r\n\tUCHAR BottomLeft = GetCalibratedBoardValue(WiimoteState->BalanceBoardState.Sensor[WIIMOTE_BALANCE_BOARD_BOTTOM_LEFT], WiimoteState->BalanceBoardState.Calibration[WIIMOTE_BALANCE_BOARD_BOTTOM_LEFT]);\r\n\r\n\tGamepadReport->XAxis = ParseBalanceBoardSensors(BottomRight, TopRight, TopLeft, BottomLeft);\r\n\tGamepadReport->YAxis = ParseBalanceBoardSensors(BottomLeft, BottomRight, TopLeft, TopRight);\r\n\r\n\t// Balance Board has only a single button, that is reported as \"A\"\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.A, &GamepadReport->Buttons[0], 0);\r\n}\r\n\r\nVOID\r\nParseWiimoteStateAsClassicControllerExtension(\r\n\t_In_ PWIIMOTE_STATE WiimoteState,\r\n\t_In_ PWIIMOTE_SETTINGS WiimoteSettings,\r\n\t_Out_ PHID_GAMEPAD_REPORT GamepadReport\r\n)\r\n{\r\n\t//LeftAnalogStick as Axis\r\n\tParseAnalogAxis(WiimoteState->ClassicControllerState.LeftAnalogStick.X, &GamepadReport->XAxis, FALSE, FALSE);\r\n\tParseAnalogAxis(WiimoteState->ClassicControllerState.LeftAnalogStick.Y, &GamepadReport->YAxis, FALSE, TRUE);\r\n\r\n\t//Buttons\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.A || WiimoteState->ClassicControllerState.Buttons.A, &GamepadReport->Buttons[0], 0);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.B || WiimoteState->ClassicControllerState.Buttons.B, &GamepadReport->Buttons[0], 1);\r\n\tParseButton(WiimoteState->ClassicControllerState.Buttons.Y, &GamepadReport->Buttons[0], 2);\r\n\tParseButton(WiimoteState->ClassicControllerState.Buttons.X, &GamepadReport->Buttons[0], 3);\r\n\tif (WiimoteSettings->SwapTriggerAndShoulder || WiimoteSettings->MapTriggerAsButtons)\r\n\t{\r\n\t\tParseButton(WiimoteState->ClassicControllerState.Buttons.L, &GamepadReport->Buttons[0], 4);\r\n\t\tParseButton(WiimoteState->ClassicControllerState.Buttons.R, &GamepadReport->Buttons[0], 5);\r\n\t}\r\n\tif (!WiimoteSettings->SwapTriggerAndShoulder || WiimoteSettings->MapTriggerAsButtons)\r\n\t{\r\n\t\tParseButton(WiimoteState->ClassicControllerState.Buttons.ZL, &GamepadReport->Buttons[0], 6);\r\n\t\tParseButton(WiimoteState->ClassicControllerState.Buttons.ZR, &GamepadReport->Buttons[0], 7);\r\n\t}\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Plus || WiimoteState->ClassicControllerState.Buttons.Plus, &GamepadReport->Buttons[1], 0);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Minus || WiimoteState->ClassicControllerState.Buttons.Minus, &GamepadReport->Buttons[1], 1);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Home || WiimoteState->ClassicControllerState.Buttons.Home, &GamepadReport->Buttons[1], 2);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.One || WiimoteState->ClassicControllerState.Buttons.LH, &GamepadReport->Buttons[1], 3);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Two || WiimoteState->ClassicControllerState.Buttons.RH, &GamepadReport->Buttons[1], 4);\r\n\r\n\t//Right Analog Stick as Second Axis\r\n\tParseAnalogAxis(WiimoteState->ClassicControllerState.RightAnalogStick.X, &GamepadReport->RXAxis, FALSE, FALSE);\r\n\tParseAnalogAxis(WiimoteState->ClassicControllerState.RightAnalogStick.Y, &GamepadReport->RYAxis, FALSE, TRUE);\r\n\r\n\tif (WiimoteSettings->MapTriggerAsAxis)\r\n\t{\r\n\t\tParseTrigger(\r\n\t\t\tWiimoteState->ClassicControllerState.LeftTrigger,\r\n\t\t\tWiimoteState->ClassicControllerState.RightTrigger,\r\n\t\t\tWiimoteState->ClassicControllerState.Buttons.R,\r\n\t\t\tWiimoteState->ClassicControllerState.Buttons.L,\r\n\t\t\tWiimoteState->ClassicControllerState.Buttons.ZR,\r\n\t\t\tWiimoteState->ClassicControllerState.Buttons.ZL,\r\n\t\t\tWiimoteSettings->SplitTriggerAxis,\r\n\t\t\tWiimoteSettings->SwapTriggerAndShoulder,\r\n\t\t\t&GamepadReport->ZAxis, \r\n\t\t\t&GamepadReport->RZAxis\r\n\t\t\t);\r\n\r\n\t}\r\n\t\r\n\r\n\t//DPad\r\n\tParseDPad(\r\n\t\tWiimoteState->WiiRemoteState.CoreButtons.DPad.Up || WiimoteState->ClassicControllerState.Buttons.DPad.Up,\r\n\t\tWiimoteState->WiiRemoteState.CoreButtons.DPad.Right || WiimoteState->ClassicControllerState.Buttons.DPad.Right,\r\n\t\tWiimoteState->WiiRemoteState.CoreButtons.DPad.Down || WiimoteState->ClassicControllerState.Buttons.DPad.Down,\r\n\t\tWiimoteState->WiiRemoteState.CoreButtons.DPad.Left || WiimoteState->ClassicControllerState.Buttons.DPad.Left,\r\n\t\t&GamepadReport->Hatswitch);\r\n}\r\n\r\nVOID\r\nParseWiimoteStateAsGuitarExtension(\r\n\t_In_ PWIIMOTE_STATE WiimoteState,\r\n\t_Out_ PHID_GAMEPAD_REPORT GamepadReport\r\n)\r\n{\r\n\t// LeftAnalogStick as Axis\r\n\tParseAnalogAxis(WiimoteState->GuitarState.AnalogStick.X, &GamepadReport->XAxis, FALSE, FALSE);\r\n\tParseAnalogAxis(WiimoteState->GuitarState.AnalogStick.Y, &GamepadReport->YAxis, FALSE, TRUE);\r\n\r\n\t// Buttons\r\n\tParseButton(WiimoteState->GuitarState.Buttons.Green, &GamepadReport->Buttons[0], 0);\r\n\tParseButton(WiimoteState->GuitarState.Buttons.Red, &GamepadReport->Buttons[0], 1);\r\n\tParseButton(WiimoteState->GuitarState.Buttons.Yellow, &GamepadReport->Buttons[0], 2);\r\n\tParseButton(WiimoteState->GuitarState.Buttons.Blue, &GamepadReport->Buttons[0], 3);\r\n\tParseButton(WiimoteState->GuitarState.Buttons.Orange, &GamepadReport->Buttons[0], 4);\r\n\tParseButton(WiimoteState->GuitarState.Buttons.Up, &GamepadReport->Buttons[0], 5);\r\n\tParseButton(WiimoteState->GuitarState.Buttons.Down, &GamepadReport->Buttons[0], 6);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Plus || WiimoteState->GuitarState.Buttons.Plus, &GamepadReport->Buttons[1], 0);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Minus || WiimoteState->GuitarState.Buttons.Minus, &GamepadReport->Buttons[1], 1);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.One, &GamepadReport->Buttons[1], 2);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Two, &GamepadReport->Buttons[1], 3);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.A, &GamepadReport->Buttons[1], 4);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.B, &GamepadReport->Buttons[1], 5);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Home, &GamepadReport->Buttons[1], 6);\r\n\r\n\t// Analog Bars\r\n\tParseAnalogAxis(WiimoteState->GuitarState.WhammyBar, &GamepadReport->ZAxis, FALSE, FALSE);\r\n\tParseAnalogAxis(WiimoteState->GuitarState.TouchBar, &GamepadReport->RZAxis, FALSE, TRUE);\r\n\r\n\t// DPad\r\n\tParseDPad(\r\n\t\tWiimoteState->WiiRemoteState.CoreButtons.DPad.Up,\r\n\t\tWiimoteState->WiiRemoteState.CoreButtons.DPad.Right,\r\n\t\tWiimoteState->WiiRemoteState.CoreButtons.DPad.Down,\r\n\t\tWiimoteState->WiiRemoteState.CoreButtons.DPad.Left,\r\n\t\t&GamepadReport->Hatswitch);\r\n}\r\n\r\n\r\nVOID\r\nParseWiimoteStateAsGamepad(\r\n\t_In_ PWIIMOTE_DEVICE_CONTEXT WiimoteContext,\r\n\t_Inout_updates_all_(BufferSize) PVOID Buffer,\r\n\t_In_ size_t BufferSize,\r\n\t_Out_ PSIZE_T BytesWritten\r\n)\r\n{\r\n\tPHID_GAMEPAD_REPORT GamepadReport = (PHID_GAMEPAD_REPORT)Buffer;\r\n\tPWIIMOTE_STATE WiimoteState = &(WiimoteContext->State);\r\n\tPWIIMOTE_SETTINGS WiimoteSettings = &(WiimoteContext->Settings);\r\n\tif (BufferSize < sizeof(HID_GAMEPAD_REPORT))\r\n\t{\r\n\t\tTrace(\"Gamepad Report Buffer seems to be too small: %d - %d\", BufferSize, sizeof(HID_GAMEPAD_REPORT));\r\n\t}\r\n\t//ASSERT(BufferSize < sizeof(HID_GAMEPAD_REPORT));\r\n\tHID_GAMEPAD_REPORT_INIT(GamepadReport);\r\n\r\n\tswitch (WiimoteContext->Extension)\r\n\t{\r\n\tcase None:\r\n\t\tParseWiimoteStateAsStandaloneWiiremote(WiimoteState, WiimoteSettings, GamepadReport);\r\n\t\tbreak;\r\n\tcase Nunchuck:\r\n\t\tParseWiimoteStateAsNunchuckExtension(WiimoteState, WiimoteSettings, GamepadReport);\r\n\t\tbreak;\r\n\tcase BalanceBoard:\r\n\t\tParseWiimoteStateAsBalanceBoard(WiimoteState, GamepadReport);\r\n\t\tbreak;\r\n\tcase ClassicController:\r\n\tcase ClassicControllerPro:\r\n\tcase WiiUProController:\r\n\t\tParseWiimoteStateAsClassicControllerExtension(WiimoteState, WiimoteSettings, GamepadReport);\r\n\t\tbreak;\r\n\tcase Guitar:\r\n\t\tParseWiimoteStateAsGuitarExtension(WiimoteState, GamepadReport);\r\n\tdefault:\r\n\t\tbreak;\r\n\t}\r\n\r\n\t(*BytesWritten) = sizeof(HID_GAMEPAD_REPORT);\r\n}\r\n\r\nVOID ParseWiimoteStateAsDPadMouse(\r\n\t_In_ PWIIMOTE_STATE WiimoteState,\r\n\t_Inout_updates_all_(BufferSize) PVOID Buffer,\r\n\t_In_ size_t BufferSize,\r\n\t_Out_ PSIZE_T BytesWritten\r\n)\r\n{\r\n\tPHID_DPADMOUSE_REPORT DPadMouseReport = (PHID_DPADMOUSE_REPORT)Buffer;\r\n\tif (BufferSize < sizeof(HID_DPADMOUSE_REPORT))\r\n\t{\r\n\t\tTrace(\"DPadMouse Report Buffer seems to be too small: %d - %d\", BufferSize, sizeof(HID_DPADMOUSE_REPORT));\r\n\t}\r\n\t//ASSERT(BufferSize < sizeof(HID_DPADMOUSE_REPORT));\r\n\tHID_DPADMOUSE_REPORT_INIT(DPadMouseReport);\r\n\r\n\t//Buttons\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.One, &DPadMouseReport->Buttons, 0);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Two, &DPadMouseReport->Buttons, 1);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.B, &DPadMouseReport->Buttons, 2);\r\n\r\n\t//Axis\r\n\tParseBooleanNonByteAxis(WiimoteState->WiiRemoteState.CoreButtons.DPad.Up, WiimoteState->WiiRemoteState.CoreButtons.DPad.Down, &DPadMouseReport->X, 6, 2, TRUE);\r\n\tParseBooleanNonByteAxis(WiimoteState->WiiRemoteState.CoreButtons.DPad.Right, WiimoteState->WiiRemoteState.CoreButtons.DPad.Left, &DPadMouseReport->Y, 6, 2, TRUE);\r\n\r\n\t(*BytesWritten) = sizeof(HID_DPADMOUSE_REPORT);\r\n}\r\n\r\nVOID ParseWiimoteStateAsIRMouse(\r\n\t_In_ PWIIMOTE_STATE WiimoteState,\r\n\t_Inout_updates_all_(BufferSize) PVOID Buffer,\r\n\t_In_ size_t BufferSize,\r\n\t_Out_ PSIZE_T BytesWritten\r\n)\r\n{\r\n\tPHID_IRMOUSE_REPORT IRMouseReport = (PHID_IRMOUSE_REPORT)Buffer;\r\n\tif (BufferSize < sizeof(HID_IRMOUSE_REPORT))\r\n\t{\r\n\t\tTrace(\"IRMouse Report Buffer seems to be too small: %d - %d\", BufferSize, sizeof(HID_IRMOUSE_REPORT));\r\n\t}\r\n\t//ASSERT(BufferSize < sizeof(HID_IRMOUSE_REPORT));\r\n\tHID_IRMOUSE_REPORT_INIT(IRMouseReport);\r\n\r\n\t//Buttons\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.A, &IRMouseReport->Buttons, 0);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.B, &IRMouseReport->Buttons, 1);\r\n\tParseButton(WiimoteState->WiiRemoteState.CoreButtons.Home, &IRMouseReport->Buttons, 2);\r\n\r\n\t//Axis\r\n\tParseIRCamera(WiimoteState->IRState.Points, &IRMouseReport->X, &IRMouseReport->Y, 128, 121);\r\n\r\n\t(*BytesWritten) = sizeof(HID_IRMOUSE_REPORT);\r\n}\r\n"
  },
  {
    "path": "HID Wiimote/WiimoteToHIDParser.h",
    "content": "/*\r\n\r\nCopyright (C) 2017 Julian Lhr\r\nAll rights reserved.\r\n\r\nFilename:\r\n\tWiimoteToHIDParser.h\r\n\r\nAbstract:\r\n\tHeader file for WiimoteToHIDParser.c\r\n*/\r\n#pragma once\r\n\r\n#include \"HIDWiimote.h\"\r\n#include \"HIDDescriptors.h\"\r\n#include \"WiimoteState.h\"\r\n\r\nVOID ParseWiimoteStateAsGamepad(_In_ PWIIMOTE_DEVICE_CONTEXT WiimoteContext, _Inout_updates_all_(BufferSize) PVOID Buffer, _In_ size_t BufferSize, _Out_ PSIZE_T BytesWritten);\r\nVOID ParseWiimoteStateAsDPadMouse(_In_ PWIIMOTE_STATE WiimoteState, _Inout_updates_all_(BufferSize) PVOID Buffer, _In_ size_t BufferSize, _Out_ PSIZE_T BytesWritten);\r\nVOID ParseWiimoteStateAsIRMouse(_In_ PWIIMOTE_STATE WiimoteState, _Inout_updates_all_(BufferSize) PVOID Buffer, _In_ size_t BufferSize, _Out_ PSIZE_T BytesWritten);\r\n"
  },
  {
    "path": "HID Wiimote/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by HID Wiimote.rc\n\n// Next default values for new objects\n// \n#ifdef APSTUDIO_INVOKED\n#ifndef APSTUDIO_READONLY_SYMBOLS\n#define _APS_NEXT_RESOURCE_VALUE        101\n#define _APS_NEXT_COMMAND_VALUE         40001\n#define _APS_NEXT_CONTROL_VALUE         1001\n#define _APS_NEXT_SYMED_VALUE           101\n#endif\n#endif\n"
  },
  {
    "path": "HID Wiimote Control Center/App.config",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<configuration>\r\n\t<startup>\r\n    <supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.7.1\"/> \r\n\t</startup>\r\n</configuration>\r\n"
  },
  {
    "path": "HID Wiimote Control Center/App.xaml",
    "content": "﻿<Application x:Class=\"HIDWiimote.ControlCenter.App\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             xmlns:local=\"clr-namespace:HIDWiimote.ControlCenter\" \n             Startup=\"OnStartup\">\n    <Application.Resources>\n         \n    </Application.Resources>\n</Application>\n"
  },
  {
    "path": "HID Wiimote Control Center/App.xaml.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tApp.cs\n\nAbstract:\n\tApp class\n\n*/\nusing System;\nusing System.Windows;\n\nnamespace HIDWiimote.ControlCenter\n{\n    /// <summary>\n    /// Interaction logic for App.xaml\n    /// </summary>\n    public partial class App : Application\n    {\n        SingleInstanceProtector SingleInstanceProtector;\n\n        public App()\n        {\n            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;\n        }\n\n        private void OnStartup(object sender, StartupEventArgs e)\n        {\n            SingleInstanceProtector = new SingleInstanceProtector();\n\n            if (!SingleInstanceProtector.IsFirstInstance())\n            {\n                SingleInstanceProtector.ShowOtherAppInstance();\n                Shutdown();\n                return;\n            }\n\n            DeviceDriverUninstallerRegistry.DeviceDriverState DPState = DeviceDriverUninstallerRegistry.GetDeviceDriverState(VersionStrings.DeviceDriverVersion, out string InstalledDeviceDriverVersionString);\n\n            switch (DPState)\n            {\n                case DeviceDriverUninstallerRegistry.DeviceDriverState.NoneInstalled:\n                    // Installer Window\n                    StartupUri = new Uri(\"Main Windows\\\\InstallerWindow.xaml\", UriKind.Relative);\n                    break;\n                case DeviceDriverUninstallerRegistry.DeviceDriverState.OlderInstalled:\n                    // Update Windows\n                    StartupUri = new Uri(\"Main Windows\\\\UpdaterWindow.xaml\", UriKind.Relative);\n                    break;\n                case DeviceDriverUninstallerRegistry.DeviceDriverState.CurrentInstalled:\n                    // Control Center\n                    StartupUri = new Uri(\"Main Windows\\\\ControlCenterWindow.xaml\", UriKind.Relative);\n                    break;\n                case DeviceDriverUninstallerRegistry.DeviceDriverState.NewerInstalled:\n                    // Show Notice & shutdown\n                    MessageBox.Show(string.Format(HIDWiimote.ControlCenter.Properties.App.NewerInstalledDialog_MainMessage, VersionStrings.DeviceDriverVersion, InstalledDeviceDriverVersionString), \"HID Wiimote Control Center\", MessageBoxButton.OK, MessageBoxImage.Exclamation);\n                    Shutdown();\n                    return;\n            }\n        }\n\n        public static void ChangeMainWindow(Window NewWindow, Window CallingWindow)\n        {\n            Current.MainWindow = NewWindow;\n            NewWindow.Show();\n            CallingWindow.Close();\n        }\n\n        private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)\n        {\n            Exception Exception = e.ExceptionObject as Exception;\n\n            while (Exception != null)\n            {\n                MessageBox.Show(\"An unhandled exception of type '\" + Exception.GetType() + \"' occured in '\" + Exception.Source + \"'.\\n\\nAdditional information: \" + Exception.Message + \"\\n\\nStack trace: \\n\" + Exception.StackTrace, Exception.GetType().ToString(), MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.None, MessageBoxOptions.DefaultDesktopOnly);\n\n                Exception = Exception.InnerException;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Control Center/DummyDeviceInterface.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tDummyDeviceInterface.cs\n\nAbstract:\n\tDummy Implementation of the Device Interface for simpler UI debugging\n\n*/\nusing System;\nusing HIDWiimote.UserModeLib;\nusing System.Threading;\n\nnamespace HIDWiimote.ControlCenter.Control_Center\n{\n    class DummyDeviceInterface : UserModeLib.IWiimoteDeviceInterface\n    {\n        private int DummySleep = 500;\n\n        public event EventHandler DeviceRemoved\n        {\n            add { }\n            remove { }\n        }\n\n        public event EventHandler<Status> StatusUpdate\n        {\n            add { }\n            remove { }\n        }\n\n\n        public void Disconnect()\n        {\n        }\n\n        public State Initialize()\n        {\n            return new State();\n        }\n\n        public bool SetDriverMode(DriverMode NewMode)\n        {\n            Thread.Sleep(DummySleep);\n            return true;\n        }\n\n        public bool SetEnableWiimoteXAxisAccelerometer(bool Enabled)\n        {\n            Thread.Sleep(DummySleep);\n            return true;\n        }\n\n        public bool SetEnableWiimoteYAxisAccelerometer(bool Enabled)\n        {\n            Thread.Sleep(DummySleep);\n            return true;\n        }\n        \n        public bool SetSwapMouseButtons(bool Enabled)\n        {\n            Thread.Sleep(DummySleep);\n            return true;\n        }\n\n        public bool SetSwapTriggerAndShoulder(bool Enabled)\n        {\n            Thread.Sleep(DummySleep);\n            return true;\n        }\n\n        public bool SetSplitTrigger(bool Enabled)\n        {\n            Thread.Sleep(DummySleep);\n            return true;\n        }\n\n        public bool SetMapTriggerAsAxis(bool Enabled)\n        {\n            Thread.Sleep(DummySleep);\n            return true;\n        }\n\n        public bool SetMapTriggerAsButtons(bool Enabled)\n        {\n            Thread.Sleep(DummySleep);\n            return true;\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Control Center/WiimoteDevice.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tWiimoteDevice.cs\n\nAbstract:\n\tInstance of a single Wii Remote Device used for data binding on UI\n\n*/\nusing System;\nusing System.ComponentModel;\nusing System.Threading.Tasks;\n\nnamespace HIDWiimote.ControlCenter.Control_Center\n{\n    public class WiimoteDevice : INotifyPropertyChanged\n    {\n        public class Option<Type> : INotifyPropertyChanged\n        {\n            private Type _Value;\n            private bool _UIEnabled = true;\n            private Func<Type, bool> InterfaceDelegate;\n\n            public event PropertyChangedEventHandler PropertyChanged;\n\n            public Option(Func<Type, bool> InterfaceDelegate)\n            {\n                this.InterfaceDelegate = InterfaceDelegate;\n            }\n\n            public Type Value\n            {\n                get { return _Value; }\n                set { ChangeValue(value); }\n            }\n\n            public bool UIEnabled\n            {\n                get { return _UIEnabled; }\n                protected set { _UIEnabled = value; OnPropertyChanged(\"UIEnabled\"); }\n            }\n\n            public void SetValue(Type Value)\n            {\n                _Value = Value;\n                OnPropertyChanged(\"Value\");\n            }\n\n            protected void ChangeValue(Type RequestedValue)\n            {\n                UIEnabled = false;\n\n                Task.Factory.StartNew(() => {\n                    if ((InterfaceDelegate == null) || (InterfaceDelegate(RequestedValue)))\n                    {\n                        SetValue(RequestedValue);\n                    }\n\n                    UIEnabled = true;\n                });\n            }\n\n            protected void OnPropertyChanged(string PropertyName)\n            {\n                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(PropertyName));\n            }\n        }\n\n        private UserModeLib.IWiimoteDeviceInterface DeviceInterface;\n        private bool _Initilized = false;\n\n        private UserModeLib.Extension _Extension = UserModeLib.Extension.None;\n        private byte _BatteryLevel = 0;\n        private bool[] _LEDState = { false, false, false, false };\n\n        public Option<UserModeLib.DriverMode> Mode { get; set; }\n        public Option<bool> EnableWiimoteXAxisAccelerometer { get; set; }\n        public Option<bool> EnableWiimoteYAxisAccelerometer { get; set; }\n        public Option<bool> SwapMouseButtons { get; set; }\n        public Option<bool> SwapTriggerAndShoulder { get; set; }\n        public Option<bool> SplitTriggerAxis { get; set; }\n        public Option<bool> MapTriggerAsAxis { get; set; }\n        public Option<bool> MapTriggerAsButtons { get; set; }\n\n        public event PropertyChangedEventHandler PropertyChanged;\n        public event EventHandler Disconneted;\n        \n        public WiimoteDevice(UserModeLib.IWiimoteDeviceInterface DeviceInterface)\n        {\n            this.DeviceInterface = DeviceInterface;\n\n            DeviceInterface.StatusUpdate += OnStatusUpdate;\n            DeviceInterface.DeviceRemoved += OnDeviceRemoved;\n\n            Mode = new Option<UserModeLib.DriverMode>(DeviceInterface.SetDriverMode);\n\n            EnableWiimoteXAxisAccelerometer = new Option<bool>(DeviceInterface.SetEnableWiimoteXAxisAccelerometer);\n            EnableWiimoteYAxisAccelerometer = new Option<bool>(DeviceInterface.SetEnableWiimoteYAxisAccelerometer);\n            SwapMouseButtons = new Option<bool>(DeviceInterface.SetSwapMouseButtons);\n            SwapTriggerAndShoulder = new Option<bool>(DeviceInterface.SetSwapTriggerAndShoulder);\n            SplitTriggerAxis = new Option<bool>(DeviceInterface.SetSplitTrigger);\n            MapTriggerAsAxis = new Option<bool>(DeviceInterface.SetMapTriggerAsAxis);\n            MapTriggerAsButtons = new Option<bool>(DeviceInterface.SetMapTriggerAsButtons);\n\n            EnableWiimoteXAxisAccelerometer.PropertyChanged += OnEnableAccelerometerAxisChanged;\n            EnableWiimoteYAxisAccelerometer.PropertyChanged += OnEnableAccelerometerAxisChanged;\n        }\n\n        public UserModeLib.Extension Extension\n        {\n            get { return _Extension; }\n            set\n            {\n                _Extension = value;\n                OnPropertyChanged(\"Extension\");\n            }\n        }\n\n        public byte BatteryLevel\n        {\n            get { return (byte)(0x00FF - _BatteryLevel); }\n            set\n            {\n                _BatteryLevel = value;\n                OnPropertyChanged(\"BatteryLevel\");\n            }\n        }\n\n        public bool[] LEDState\n        {\n            get { return _LEDState; }\n            set\n            {\n                _LEDState = value;\n                OnPropertyChanged(\"LEDState\");\n            }\n        }\n\n        public bool EnableAccelerometers\n        {\n            get { return EnableWiimoteXAxisAccelerometer.Value || EnableWiimoteYAxisAccelerometer.Value; }\n            set\n            {\n                EnableWiimoteXAxisAccelerometer.Value = value;\n                EnableWiimoteYAxisAccelerometer.Value = value;\n                OnPropertyChanged(\"EnableAccelerometers\");\n            }\n        }\n\n        private void OnEnableAccelerometerAxisChanged(object sender, PropertyChangedEventArgs e)\n        {\n            if (e.PropertyName == \"Value\")\n            {\n                OnPropertyChanged(\"EnableAccelerometers\");\n            }\n        }\n\n        public bool Initilized\n        {\n            get { return _Initilized; }\n            set\n            {\n                _Initilized = value;\n                OnPropertyChanged(\"Initilized\");\n            }\n        }\n\n        protected void OnPropertyChanged(string PropertyName)\n        {\n            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(PropertyName));\n        }\n\n        public void Disconnect()\n        {\n            DeviceInterface.Disconnect();\n        }\n\n        public void Initilize()\n        {\n            Task.Factory.StartNew(InitilizeAction);\n        }\n\n        protected void InitilizeAction()\n        {\n            UserModeLib.State InitinalState = DeviceInterface.Initialize();\n\n            if(InitinalState == null)\n            {\n                DeviceInterface.Disconnect();\n                return;\n            }\n\n            ApplyState(InitinalState);\n            Initilized = true;\n        }\n\n        private void OnDeviceRemoved(object sender, System.EventArgs e)\n        {\n            DeviceInterface.StatusUpdate -= OnStatusUpdate;\n            DeviceInterface.DeviceRemoved -= OnDeviceRemoved;\n\n            Disconneted?.Invoke(this, null);\n        }\n\n        private void OnStatusUpdate(object sender, UserModeLib.Status StatusUpdate)\n        {\n            ApplyStatus(StatusUpdate);\n        }\n\n        protected void ApplyState(UserModeLib.State State)\n        {\n            Mode.SetValue(State.Mode);\n\n            EnableWiimoteXAxisAccelerometer.SetValue(State.EnableWiimoteXAxisAccelerometer);\n            EnableWiimoteYAxisAccelerometer.SetValue(State.EnableWiimoteYAxisAccelerometer);\n            SwapMouseButtons.SetValue(State.SwapMouseButtons);\n            SwapTriggerAndShoulder.SetValue(State.SwapTriggerAndShoulder);\n            SplitTriggerAxis.SetValue(State.SplitTrigger);\n            MapTriggerAsAxis.SetValue(State.MapTriggerAsAxis);\n            MapTriggerAsButtons.SetValue(State.MapTriggerAsButtons);\n\n            ApplyStatus(State.Status);\n        }\n\n        protected void ApplyStatus(UserModeLib.Status Status)\n        {\n            Extension = Status.Extension;\n            BatteryLevel = Status.BatteryLevel;\n            LEDState = Status.LEDState;\n        } \n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/HID Wiimote Control Center.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"15.0\">\r\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\r\n  <PropertyGroup>\r\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\r\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\r\n    <ProjectGuid>{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}</ProjectGuid>\r\n    <OutputType>WinExe</OutputType>\r\n    <AppDesignerFolder>Properties</AppDesignerFolder>\r\n    <RootNamespace>HIDWiimote.ControlCenter</RootNamespace>\r\n    <AssemblyName>HID Wiimote Control Center</AssemblyName>\r\n    <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>\r\n    <FileAlignment>512</FileAlignment>\r\n    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>\r\n    <WarningLevel>4</WarningLevel>\r\n    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>\r\n    <IsWebBootstrapper>false</IsWebBootstrapper>\r\n    <PublishUrl>publish\\</PublishUrl>\r\n    <Install>true</Install>\r\n    <InstallFrom>Disk</InstallFrom>\r\n    <UpdateEnabled>false</UpdateEnabled>\r\n    <UpdateMode>Foreground</UpdateMode>\r\n    <UpdateInterval>7</UpdateInterval>\r\n    <UpdateIntervalUnits>Days</UpdateIntervalUnits>\r\n    <UpdatePeriodically>false</UpdatePeriodically>\r\n    <UpdateRequired>false</UpdateRequired>\r\n    <MapFileExtensions>true</MapFileExtensions>\r\n    <ApplicationRevision>0</ApplicationRevision>\r\n    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>\r\n    <UseApplicationTrust>false</UseApplicationTrust>\r\n    <BootstrapperEnabled>true</BootstrapperEnabled>\r\n    <FileUpgradeFlags>\r\n    </FileUpgradeFlags>\r\n    <UpgradeBackupLocation>\r\n    </UpgradeBackupLocation>\r\n    <OldToolsVersion>2.0</OldToolsVersion>\r\n    <TargetFrameworkProfile />\r\n  </PropertyGroup>\r\n  <PropertyGroup>\r\n    <TargetZone>LocalIntranet</TargetZone>\r\n  </PropertyGroup>\r\n  <PropertyGroup>\r\n    <GenerateManifests>false</GenerateManifests>\r\n  </PropertyGroup>\r\n  <PropertyGroup>\r\n    <ApplicationManifest>Properties\\app.manifest</ApplicationManifest>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|x86'\">\r\n    <DebugSymbols>true</DebugSymbols>\r\n    <OutputPath>bin\\x86\\Debug\\</OutputPath>\r\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\r\n    <DebugType>full</DebugType>\r\n    <PlatformTarget>x86</PlatformTarget>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|x86'\">\r\n    <OutputPath>bin\\x86\\Release\\</OutputPath>\r\n    <DefineConstants>TRACE</DefineConstants>\r\n    <Optimize>true</Optimize>\r\n    <DebugType>pdbonly</DebugType>\r\n    <PlatformTarget>x86</PlatformTarget>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|x64'\">\r\n    <DebugSymbols>true</DebugSymbols>\r\n    <OutputPath>bin\\x64\\Debug\\</OutputPath>\r\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\r\n    <DebugType>full</DebugType>\r\n    <PlatformTarget>x64</PlatformTarget>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|x64'\">\r\n    <OutputPath>bin\\x64\\Release\\</OutputPath>\r\n    <DefineConstants>TRACE</DefineConstants>\r\n    <Optimize>true</Optimize>\r\n    <DebugType>pdbonly</DebugType>\r\n    <PlatformTarget>x64</PlatformTarget>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\r\n  </PropertyGroup>\r\n  <ItemGroup>\r\n    <Reference Include=\"System\" />\r\n    <Reference Include=\"System.Data\" />\r\n    <Reference Include=\"System.Drawing\" />\r\n    <Reference Include=\"System.Windows.Forms\" />\r\n    <Reference Include=\"System.Xml\" />\r\n    <Reference Include=\"Microsoft.CSharp\" />\r\n    <Reference Include=\"System.Core\" />\r\n    <Reference Include=\"System.Xml.Linq\" />\r\n    <Reference Include=\"System.Data.DataSetExtensions\" />\r\n    <Reference Include=\"System.Net.Http\" />\r\n    <Reference Include=\"System.Xaml\">\r\n      <RequiredTargetFramework>4.0</RequiredTargetFramework>\r\n    </Reference>\r\n    <Reference Include=\"WindowsBase\" />\r\n    <Reference Include=\"PresentationCore\" />\r\n    <Reference Include=\"PresentationFramework\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ApplicationDefinition Include=\"App.xaml\">\r\n      <Generator>MSBuild:Compile</Generator>\r\n      <SubType>Designer</SubType>\r\n    </ApplicationDefinition>\r\n    <Compile Include=\"Control Center\\DummyDeviceInterface.cs\" />\r\n    <Compile Include=\"Control Center\\WiimoteDevice.cs\" />\r\n    <Compile Include=\"Properties\\ControlCenter.Designer.cs\">\r\n      <AutoGen>True</AutoGen>\r\n      <DesignTime>True</DesignTime>\r\n      <DependentUpon>ControlCenter.resx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Main Windows\\ControlCenterWindow.xaml.cs\">\r\n      <DependentUpon>ControlCenterWindow.xaml</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Properties\\Installer.Designer.cs\">\r\n      <AutoGen>True</AutoGen>\r\n      <DesignTime>True</DesignTime>\r\n      <DependentUpon>Installer.resx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Secondary Windows\\About.xaml.cs\">\r\n      <DependentUpon>About.xaml</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Setup\\DeviceDriver.cs\" />\r\n    <Compile Include=\"Setup\\SetupAction\\Certificate.cs\" />\r\n    <Compile Include=\"Setup\\SetupAction\\DeviceDriver.cs\" />\r\n    <Compile Include=\"Setup\\DeviceDriverUninstallerRegistry.cs\" />\r\n    <Compile Include=\"Main Windows\\InstallerWindow.xaml.cs\">\r\n      <DependentUpon>InstallerWindow.xaml</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Setup\\InstallStepAction\\CopyFile.cs\" />\r\n    <Compile Include=\"Setup\\InstallStepAction\\CreateRegistryUninstallKey.cs\" />\r\n    <Compile Include=\"Setup\\InstallStepAction\\IInstallAction.cs\" />\r\n    <Compile Include=\"Setup\\InstallStepAction\\RunDPInstall.cs\" />\r\n    <Compile Include=\"Setup\\InstallStepAction\\TextResourceToFile.cs\" />\r\n    <Compile Include=\"Setup\\SetupAction\\ISetupAction.cs\" />\r\n    <Compile Include=\"Setup\\SetupAction\\TestMode.cs\" />\r\n    <Compile Include=\"UserControls\\LEDDisplay.xaml.cs\">\r\n      <DependentUpon>LEDDisplay.xaml</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"UserControls\\TaskList.xaml.cs\">\r\n      <DependentUpon>TaskList.xaml</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Utility\\SingleInstanceProtector.cs\" />\r\n    <Compile Include=\"Properties\\VersionStrings.cs\" />\r\n    <Compile Include=\"Main Windows\\UpdaterWindow.xaml.cs\">\r\n      <DependentUpon>UpdaterWindow.xaml</DependentUpon>\r\n    </Compile>\r\n    <Page Include=\"Main Windows\\ControlCenterWindow.xaml\">\r\n      <SubType>Designer</SubType>\r\n      <Generator>MSBuild:Compile</Generator>\r\n    </Page>\r\n    <Page Include=\"Main Windows\\InstallerWindow.xaml\">\r\n      <SubType>Designer</SubType>\r\n      <Generator>MSBuild:Compile</Generator>\r\n    </Page>\r\n    <Compile Include=\"App.xaml.cs\">\r\n      <DependentUpon>App.xaml</DependentUpon>\r\n      <SubType>Code</SubType>\r\n    </Compile>\r\n    <Page Include=\"Main Windows\\UpdaterWindow.xaml\">\r\n      <SubType>Designer</SubType>\r\n      <Generator>MSBuild:Compile</Generator>\r\n    </Page>\r\n    <Page Include=\"Secondary Windows\\About.xaml\">\r\n      <SubType>Designer</SubType>\r\n      <Generator>MSBuild:Compile</Generator>\r\n    </Page>\r\n    <Page Include=\"UserControls\\LEDDisplay.xaml\">\r\n      <SubType>Designer</SubType>\r\n      <Generator>MSBuild:Compile</Generator>\r\n    </Page>\r\n    <Page Include=\"UserControls\\TaskList.xaml\">\r\n      <SubType>Designer</SubType>\r\n      <Generator>MSBuild:Compile</Generator>\r\n    </Page>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Compile Include=\"Properties\\AssemblyInfo.cs\">\r\n      <SubType>Code</SubType>\r\n    </Compile>\r\n    <Compile Include=\"Properties\\App.Designer.cs\">\r\n      <AutoGen>True</AutoGen>\r\n      <DesignTime>True</DesignTime>\r\n      <DependentUpon>App.resx</DependentUpon>\r\n    </Compile>\r\n    <Compile Include=\"Properties\\Settings.Designer.cs\">\r\n      <AutoGen>True</AutoGen>\r\n      <DependentUpon>Settings.settings</DependentUpon>\r\n      <DesignTimeSharedInput>True</DesignTimeSharedInput>\r\n    </Compile>\r\n    <EmbeddedResource Include=\"Properties\\ControlCenter.resx\">\r\n      <Generator>PublicResXFileCodeGenerator</Generator>\r\n      <LastGenOutput>ControlCenter.Designer.cs</LastGenOutput>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Properties\\Installer.resx\">\r\n      <Generator>PublicResXFileCodeGenerator</Generator>\r\n      <LastGenOutput>Installer.Designer.cs</LastGenOutput>\r\n    </EmbeddedResource>\r\n    <EmbeddedResource Include=\"Properties\\App.resx\">\r\n      <Generator>ResXFileCodeGenerator</Generator>\r\n      <LastGenOutput>App.Designer.cs</LastGenOutput>\r\n      <SubType>Designer</SubType>\r\n    </EmbeddedResource>\r\n    <None Include=\"Properties\\app.manifest\" />\r\n    <None Include=\"Properties\\Settings.settings\">\r\n      <Generator>SettingsSingleFileGenerator</Generator>\r\n      <LastGenOutput>Settings.Designer.cs</LastGenOutput>\r\n    </None>\r\n    <AppDesigner Include=\"Properties\\\" />\r\n    <EmbeddedResource Include=\"Resources\\JulianLoehrCA.cer\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"App.config\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <BootstrapperPackage Include=\".NETFramework,Version=v4.5.2\">\r\n      <Visible>False</Visible>\r\n      <ProductName>Microsoft .NET Framework 4.5.2 %28x86 and x64%29</ProductName>\r\n      <Install>true</Install>\r\n    </BootstrapperPackage>\r\n    <BootstrapperPackage Include=\"Microsoft.Net.Framework.3.5.SP1\">\r\n      <Visible>False</Visible>\r\n      <ProductName>.NET Framework 3.5 SP1</ProductName>\r\n      <Install>false</Install>\r\n    </BootstrapperPackage>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"Resources\\UninstallerContent.txt\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ProjectReference Include=\"..\\HID Wiimote User Mode\\HID Wiimote User Mode.vcxproj\">\r\n      <Project>{591eee1a-3007-4d38-910a-af3d065105f9}</Project>\r\n      <Name>HID Wiimote User Mode</Name>\r\n    </ProjectReference>\r\n  </ItemGroup>\r\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\r\n  <PropertyGroup Label=\"UserMacros\">\r\n    <SignTool>C:\\Program Files (x86)\\Windows Kits\\10\\bin\\x86\\signtool.exe</SignTool>\r\n  </PropertyGroup>\r\n  <PropertyGroup>\r\n    <PreBuildEvent>copy /y \"$(SolutionDir)ReleaseVersioning\\VersionStrings.cs\" \"$(SolutionDir)HID Wiimote Control Center\\Properties\\VersionStrings.cs\"</PreBuildEvent>\r\n  </PropertyGroup>\r\n  <PropertyGroup>\r\n    <PostBuildEvent Condition=\"Exists('$(SignTool)')\">\"$(SignTool)\" sign /a \"$(TargetName)$(TargetExt)\"</PostBuildEvent>\r\n  </PropertyGroup>\r\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\r\n</Project>"
  },
  {
    "path": "HID Wiimote Control Center/Main Windows/ControlCenterWindow.xaml",
    "content": "﻿<Window x:Class=\"HIDWiimote.ControlCenter.Main_Windows.ControlCenterWindow\"\n        xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n        xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n        xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n        xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n        xmlns:local=\"clr-namespace:HIDWiimote.ControlCenter.Main_Windows\"\n        xmlns:user=\"clr-namespace:HIDWiimote.ControlCenter.UserControls\"\n        xmlns:res=\"clr-namespace:HIDWiimote.ControlCenter.Properties\"\n        mc:Ignorable=\"d\"\n        Title=\"HID Wiimote Control Center\" Height=\"600\" Width=\"800\" ResizeMode=\"NoResize\" WindowStartupLocation=\"CenterScreen\" Initialized=\"OnInitialized\" Closing=\"OnClosing\">\n    <Window.Resources>\n        <local:ExtensionToStringConverter x:Key=\"ExtensionToStringConverter\" \n                                          WiimoteString=\"{x:Static res:ControlCenter.ExtensionString_Wiimote}\"\n                                          NunchuckString=\"{x:Static res:ControlCenter.ExtensionString_Nunchuck}\"\n                                          ClassicControllerString=\"{x:Static res:ControlCenter.ExtensionString_ClassicController}\"\n                                          ClassicControllerProString=\"{x:Static res:ControlCenter.ExtensionString_ClassicControllerPro}\"\n                                          WiiUProControllerString=\"{x:Static res:ControlCenter.ExtensionString_WiiUProController}\"\n                                          BalanceBoardString=\"{x:Static res:ControlCenter.ExtensionString_BalanceBoard}\"\n                                          GuitarHeroString=\"{x:Static res:ControlCenter.ExtensionString_GuitarHero}\"/>\n        <local:ModeToStringConverter x:Key=\"ModeToStringConverter\"\n                                     GamepadString=\"{x:Static res:ControlCenter.ModeString_Gamepad}\"\n                                     PassThroughString=\"{x:Static res:ControlCenter.ModeString_PassThrough}\"\n                                     GamepadAndIRMouseString=\"{x:Static res:ControlCenter.ModeString_GamepadAndIRMouse}\"\n                                     IRMouseString=\"{x:Static res:ControlCenter.ModeString_IRMouse}\"\n                                     DPadMouseString=\"{x:Static res:ControlCenter.ModeString_DPadMouse}\" />\n    </Window.Resources>\n    <DockPanel>\n        <Menu DockPanel.Dock=\"Top\">\n            <MenuItem Header=\"_Tools\">\n                <MenuItem Header=\"_Installer\" Click=\"OnInstallerClick\"/>\n            </MenuItem>\n            <MenuItem Header=\"_Help\">\n                <MenuItem Header=\"_About\" Click=\"OnAboutClick\" />\n            </MenuItem>\n        </Menu>\n        <Grid Margin=\"10\">\n            <Grid.ColumnDefinitions>\n                <ColumnDefinition/>\n                <ColumnDefinition Width=\"3.5*\"/>\n            </Grid.ColumnDefinitions>\n            <Border BorderThickness=\"1,1,0,1\" BorderBrush=\"{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}\" Margin=\"0,0,-1,0\" >\n                <ListBox x:Name=\"ConnectedDevicesListBox\" HorizontalContentAlignment=\"Stretch\" ScrollViewer.HorizontalScrollBarVisibility=\"Disabled\" ScrollViewer.VerticalScrollBarVisibility=\"Auto\" ScrollViewer.CanContentScroll=\"True\" UseLayoutRounding=\"False\" BorderThickness=\"0\" >\n                    <ListBox.Style>\n                        <Style\n                            TargetType=\"ListBox\"\n                            BasedOn=\"{StaticResource {x:Type ListBox}}\">\n                            <Style.Triggers>\n                                <!-- Use ListBox.HasItems instead of Binding -->\n                                <Trigger Property=\"HasItems\" Value=\"False\">\n                                    <Setter Property=\"Template\">\n                                        <Setter.Value>\n                                            <ControlTemplate>\n                                                <TextBlock Text=\"No Wii Remotes connected\" HorizontalAlignment=\"Center\" VerticalAlignment=\"Top\" Margin=\"0,10,0,0\" Opacity=\"0.8\" FontWeight=\"Bold\" />\n                                            </ControlTemplate>\n                                        </Setter.Value>\n                                    </Setter>\n                                </Trigger>\n                            </Style.Triggers>\n                        </Style>\n                    </ListBox.Style>\n                    <ListBox.ItemContainerStyle>\n                    <Style TargetType=\"ListBoxItem\" >\n                        <Setter Property=\"Background\" Value=\"#FFDDDDDD\" />\n                        <Setter Property=\"Margin\" Value=\"0, 0, 0, 2\" />\n                        <Setter Property=\"BorderThickness\" Value=\"1, 1, 0, 1\" />\n                    </Style>\n                </ListBox.ItemContainerStyle>\n                    <ListBox.ItemTemplate>\n                        <DataTemplate>\n                            <StackPanel>\n                                <Label FontWeight=\"Bold\" Content=\"{Binding Extension, Converter={StaticResource ExtensionToStringConverter}, Mode=OneWay}\" />\n                                <Label FontStyle=\"Italic\" Padding=\"5, 0, 5, 5\" DataContext=\"{Binding Mode}\" Content=\"{Binding Value, Converter={StaticResource ModeToStringConverter}, Mode=OneWay}\" Visibility=\"Hidden\" />\n                                <user:LEDDisplay />\n                            </StackPanel>\n                        </DataTemplate>\n                    </ListBox.ItemTemplate>\n                </ListBox>\n            </Border>\n            <Border Grid.Column=\"1\" BorderThickness=\"1\" BorderBrush=\"Black\" DataContext=\"{Binding SelectedItem, ElementName=ConnectedDevicesListBox}\" >\n                <Border.Style>\n                    <Style TargetType=\"Border\">\n                        <Style.Triggers>\n                            <DataTrigger Binding=\"{Binding Path=DataContext, RelativeSource={RelativeSource Self}}\" Value=\"{x:Null}\">\n                                <Setter Property=\"IsEnabled\" Value=\"false\"/>\n                            </DataTrigger>\n                            <DataTrigger Binding=\"{Binding Path=DataContext.Initilized, RelativeSource={RelativeSource Self}}\" Value=\"false\">\n                                <Setter Property=\"IsEnabled\" Value=\"false\"/>\n                            </DataTrigger>\n                        </Style.Triggers>\n                    </Style>\n                </Border.Style>\n                <Grid>\n                    <Grid.RowDefinitions>\n                        <RowDefinition Height=\"2*\" />\n                        <RowDefinition Height=\"5*\" />\n                        <RowDefinition Height=\"5*\"  />\n                    </Grid.RowDefinitions>\n                    <Grid Grid.Row=\"0\">\n                        <Label Content=\"{Binding Extension, Converter={StaticResource ExtensionToStringConverter}, Mode=OneWay}\" FontWeight=\"Bold\" FontSize=\"29.333\" />\n                        <Grid>\n                            <Grid.ColumnDefinitions>\n                                <ColumnDefinition />\n                                <ColumnDefinition />\n                            </Grid.ColumnDefinitions>\n                            <StackPanel Grid.Column=\"0\" Orientation=\"Horizontal\">\n                                <Label Content=\"Mode: \" VerticalContentAlignment=\"Bottom\" IsEnabled=\"False\" Visibility=\"Hidden\" />\n                                <ComboBox Width=\"150\" VerticalAlignment=\"Bottom\" DisplayMemberPath=\"Value\" SelectedValuePath=\"Key\" DataContext=\"{Binding Mode}\" SelectedValue=\"{Binding Value, Mode=TwoWay}\" ItemsSource=\"{Binding WiimoteDeviceModeTypeDescriptions, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:ControlCenterWindow}}}\" IsEnabled=\"{Binding UIEnabled}\" Visibility=\"Hidden\" />\n                            </StackPanel>\n                            <StackPanel Grid.Column=\"1\" HorizontalAlignment=\"Right\" Margin=\"10\" VerticalAlignment=\"Center\" Orientation=\"Horizontal\" >\n                                <Rectangle Width=\"16\" Height=\"24\" Margin=\"2\" HorizontalAlignment=\"Center\" VerticalAlignment=\"Center\">\n                                    <Rectangle.Fill>\n                                        <DrawingBrush>\n                                            <DrawingBrush.Drawing>\n                                                <DrawingGroup>\n                                                    <DrawingGroup.Children>\n                                                        <GeometryDrawing Brush=\"#00FFFFFF\" Geometry=\"F1M16,24L0,24 0,0 0,24z\" />\n                                                        <GeometryDrawing Brush=\"#FFF6F6F6\" Geometry=\"F1M1,4L1,23 15,23 15,4 12,3 12,1 4,1 4,3z\" />\n                                                        <GeometryDrawing Brush=\"#FF414141\" Geometry=\"F1M3,5L3,22 13,22 13,5 11,4 11,2 5,2 5,4z\" />\n                                                    </DrawingGroup.Children>\n                                                </DrawingGroup>\n                                            </DrawingBrush.Drawing>\n                                        </DrawingBrush>\n                                    </Rectangle.Fill>\n                                </Rectangle>\n                                <StackPanel>\n                                    <ProgressBar Width=\"100\" Height=\"20\" Maximum=\"255\" Value=\"{Binding BatteryLevel}\" Background=\"{DynamicResource FullBar}\" Foreground=\"{DynamicResource EmptyBar}\" >\n                                        <ProgressBar.Resources>\n                                            <SolidColorBrush x:Key=\"EmptyBar\" Color=\"#FFE6E6E6\"/>\n                                            <SolidColorBrush x:Key=\"FullBar\" Color=\"#FF06B025\"/>\n                                        </ProgressBar.Resources>\n                                    </ProgressBar>\n                                    <user:LEDDisplay />\n                                </StackPanel>\n                            </StackPanel>\n                        </Grid>\n                    </Grid>\n                    <StackPanel Grid.Row=\"1\">\n                        <Separator Margin=\"5\" />\n                        <Label Content=\"Wiimote:\" FontStyle=\"Italic\" Margin=\"10,0,0,0\" FontSize=\"16\" />\n                        <CheckBox Content=\"Accelerometer\" Margin=\"10,10,0,0\" IsChecked=\"{Binding EnableAccelerometers}\" HorizontalAlignment=\"Left\" />\n                        <CheckBox Content=\"X-Axis\" Margin=\"20,5,0,0\" DataContext=\"{Binding EnableWiimoteXAxisAccelerometer}\" IsChecked=\"{Binding Value}\" IsEnabled=\"{Binding UIEnabled}\" HorizontalAlignment=\"Left\" />\n                        <CheckBox Content=\"Y-Axis\" Margin=\"20,5,0,0\" DataContext=\"{Binding EnableWiimoteYAxisAccelerometer}\"   IsChecked=\"{Binding Value}\" IsEnabled=\"{Binding UIEnabled}\" HorizontalAlignment=\"Left\" />\n                        <CheckBox Content=\"Swap Mouse Buttons\" Margin=\"10,10,0,0\" DataContext=\"{Binding SwapMouseButtons}\" IsChecked=\"{Binding Value}\" IsEnabled=\"{Binding UIEnabled}\" HorizontalAlignment=\"Left\" Visibility=\"Hidden\" />\n                    </StackPanel>\n                    <StackPanel Grid.Row=\"2\">\n                        <Separator Margin=\"5\" />\n                        <Label Content=\"Classic Controller Extension/Wii U Pro Controller:\" FontStyle=\"Italic\" Margin=\"10,0,0,0\" FontSize=\"16\" />\n                        <CheckBox Content=\"Swap Trigger and Bumper\" Margin=\"10,10,0,0\" DataContext=\"{Binding SwapTriggerAndShoulder}\" IsChecked=\"{Binding Value}\" IsEnabled=\"{Binding UIEnabled}\" HorizontalAlignment=\"Left\" />\n                        <CheckBox Content=\"Split Trigger Axis\" Margin=\"10,10,0,0\" DataContext=\"{Binding SplitTriggerAxis}\" IsChecked=\"{Binding Value}\" IsEnabled=\"{Binding UIEnabled}\" HorizontalAlignment=\"Left\" />\n                        <TextBlock Text=\"Trigger Mapping\" Margin=\"10,10,0,0\"/>\n                        <CheckBox Content=\"Trigger As Axis\" Margin=\"20,5,0,0\" DataContext=\"{Binding MapTriggerAsAxis}\" IsChecked=\"{Binding Value}\" IsEnabled=\"{Binding UIEnabled}\" HorizontalAlignment=\"Left\" />\n                        <CheckBox Content=\"Trigger As Buttons\" Margin=\"20,5,0,0\" DataContext=\"{Binding MapTriggerAsButtons}\" IsChecked=\"{Binding Value}\" IsEnabled=\"{Binding UIEnabled}\" HorizontalAlignment=\"Left\" />\n                    </StackPanel>\n                </Grid>\n            </Border>\n        </Grid>\n    </DockPanel>\n</Window>\n"
  },
  {
    "path": "HID Wiimote Control Center/Main Windows/ControlCenterWindow.xaml.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tControlCenterWindow.xaml.cs\n\nAbstract:\n\tMain Window for the Application\n\n*/\nusing HIDWiimote.ControlCenter.Control_Center;\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Windows;\nusing System.Windows.Data;\n\nnamespace HIDWiimote.ControlCenter.Main_Windows\n{\n    /// <summary>\n    /// Interaction logic for ControlCenterWindow.xaml\n    /// </summary>\n    public partial class ControlCenterWindow : Window\n    {\n        List<WiimoteDevice> ConnectedWiimoteDevices = new List<WiimoteDevice>();\n        HIDWiimote.UserModeLib.WiimoteDeviceInterfaceDiscoverer DeviceInterfaceDiscoverer;\n\n        public ControlCenterWindow()\n        {\n            InitializeComponent();            \n        }\n        \n        private void OnInitialized(object sender, System.EventArgs e)\n        {\n            ConnectedDevicesListBox.ItemsSource = ConnectedWiimoteDevices;\n\n            DeviceInterfaceDiscoverer = new UserModeLib.WiimoteDeviceInterfaceDiscoverer();\n            DeviceInterfaceDiscoverer.NewWiimoteDeviceInterfaceFound += OnNewWiimoteDeviceInterfaceFound;\n            DeviceInterfaceDiscoverer.Start();\n\n#if DEBUG\n            OnNewWiimoteDeviceInterfaceFound(this, new DummyDeviceInterface());\n#endif\n        }\n\n        private void OnNewWiimoteDeviceInterfaceFound(object sender, UserModeLib.IWiimoteDeviceInterface NewInterface)\n        {\n            Application.Current.Dispatcher.Invoke(() => {\n                WiimoteDevice NewWiimoteDevice = new WiimoteDevice(NewInterface);\n\n                NewWiimoteDevice.Disconneted += OnWiimoteDeviceDisconneted;\n                ConnectedWiimoteDevices.Add(NewWiimoteDevice);\n                ConnectedDevicesListBox.Items.Refresh();\n\n                if(ConnectedDevicesListBox.SelectedItem == null)\n                {\n                    ConnectedDevicesListBox.SelectedItem = NewWiimoteDevice;\n                }\n\n                NewWiimoteDevice.Initilize();\n            });\n        }\n\n        private void OnWiimoteDeviceDisconneted(object sender, EventArgs e)\n        {\n            Application.Current.Dispatcher.Invoke(() =>\n            {\n                WiimoteDevice DisconnectedWiimoteDevice = sender as WiimoteDevice;\n\n                ConnectedWiimoteDevices.Remove(DisconnectedWiimoteDevice);\n                ConnectedDevicesListBox.Items.Refresh();\n\n                if ((ConnectedDevicesListBox.SelectedItem == null) && ConnectedDevicesListBox.HasItems)\n                {\n                    ConnectedDevicesListBox.SelectedItem = ConnectedDevicesListBox.Items[0];\n                }\n            });\n        }\n\n        private void OnInstallerClick(object sender, RoutedEventArgs e)\n        {\n            App.ChangeMainWindow(new InstallerWindow(), this);\n        }\n\n        private void OnAboutClick(object sender, RoutedEventArgs e)\n        {\n            Secondary_Windows.About AboutDialog = new Secondary_Windows.About();\n            AboutDialog.Owner = this;\n\n            AboutDialog.ShowDialog();\n        }\n\n        private static Dictionary<UserModeLib.DriverMode, string> WiimoteDeviceModeTypeDescriptionsDictionary = new Dictionary<UserModeLib.DriverMode, string>()\n        {\n            { UserModeLib.DriverMode.Gamepad, HIDWiimote.ControlCenter.Properties.ControlCenter.ModeString_Gamepad },\n            { UserModeLib.DriverMode.PassThrough, HIDWiimote.ControlCenter.Properties.ControlCenter.ModeString_PassThrough },\n            { UserModeLib.DriverMode.GamepadAndIRMouse, HIDWiimote.ControlCenter.Properties.ControlCenter.ModeString_GamepadAndIRMouse },\n            { UserModeLib.DriverMode.IRMouse, HIDWiimote.ControlCenter.Properties.ControlCenter.ModeString_IRMouse },\n            { UserModeLib.DriverMode.DPadMouse, HIDWiimote.ControlCenter.Properties.ControlCenter.ModeString_DPadMouse }\n        };\n\n        public Dictionary<UserModeLib.DriverMode, string> WiimoteDeviceModeTypeDescriptions\n        {\n            get\n            {\n                return WiimoteDeviceModeTypeDescriptionsDictionary;\n            }\n        }\n\n        private void OnClosing(object sender, System.ComponentModel.CancelEventArgs e)\n        {\n            if(DeviceInterfaceDiscoverer != null)\n            {\n                DeviceInterfaceDiscoverer.Stop();\n            }\n            \n            foreach(WiimoteDevice WiimoteDevice in ConnectedWiimoteDevices)\n            {\n                WiimoteDevice.Disconneted -= OnWiimoteDeviceDisconneted;\n                WiimoteDevice.Disconnect();\n            }\n\n            ConnectedWiimoteDevices.Clear();\n            ConnectedDevicesListBox.Items.Refresh();\n        }\n    }\n\n    public class ExtensionToStringConverter : IValueConverter\n    {\n        public string WiimoteString { get; set; }\n        public string NunchuckString { get; set; }\n        public string ClassicControllerString { get; set; }\n        public string ClassicControllerProString { get; set; }\n        public string WiiUProControllerString { get; set; }\n        public string BalanceBoardString { get; set; }\n        public string GuitarHeroString { get; set; }\n\n        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\n        {\n            UserModeLib.Extension Extension = (UserModeLib.Extension)value;\n\n            switch (Extension)\n            {\n                case UserModeLib.Extension.None:\n                    return WiimoteString;\n                case UserModeLib.Extension.Nunchuck:\n                    return NunchuckString;\n                case UserModeLib.Extension.BalanceBoard:\n                    return BalanceBoardString;\n                case UserModeLib.Extension.ClassicController:\n                    return ClassicControllerString;\n                case UserModeLib.Extension.ClassicControllerPro:\n                    return ClassicControllerProString;\n                case UserModeLib.Extension.WiiUProController:\n                    return WiiUProControllerString;\n                case UserModeLib.Extension.Guitar:\n                    return GuitarHeroString;\n                default:\n                    return \"Error\";\n            }\n        }\n\n        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)\n        {\n            throw new NotImplementedException();\n        }\n    }\n\n    public class ModeToStringConverter : IValueConverter\n    {\n        public string GamepadString { get; set; }\n        public string GamepadAndIRMouseString { get; set; }\n        public string IRMouseString { get; set; }\n        public string DPadMouseString { get; set; }\n        public string PassThroughString { get; set; }\n\n\n        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\n        {\n            UserModeLib.DriverMode Mode = (UserModeLib.DriverMode)value;\n\n            switch (Mode)\n            {\n                case UserModeLib.DriverMode.Gamepad:\n                    return GamepadString;\n                case UserModeLib.DriverMode.PassThrough:\n                    return PassThroughString;\n                case UserModeLib.DriverMode.GamepadAndIRMouse:\n                    return GamepadAndIRMouseString;\n                case UserModeLib.DriverMode.IRMouse:\n                    return IRMouseString;\n                case UserModeLib.DriverMode.DPadMouse:\n                    return DPadMouseString;\n                default:\n                    return \"Error\";\n            }\n        }\n\n        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)\n        {\n            throw new NotImplementedException();\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Main Windows/InstallerWindow.xaml",
    "content": "﻿<Window x:Class=\"HIDWiimote.ControlCenter.Main_Windows.InstallerWindow\"\n        xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n        xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n        xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n        xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n        xmlns:local=\"clr-namespace:HIDWiimote.ControlCenter.Main_Windows\"\n        mc:Ignorable=\"d\"\n        Title=\"HID Wiimote Installer\" ResizeMode=\"NoResize\" Width=\"750\" SizeToContent=\"Height\" Initialized=\"OnInitialized\" WindowStartupLocation=\"CenterScreen\" >\n    <Window.Resources>\n        <SolidColorBrush x:Key=\"BackgroundGood\" Color=\"#40008000\" />\n        <SolidColorBrush x:Key=\"BackgroundRed\" Color=\"#40FF0000\" />\n\n        <local:BooleanToColorConverter x:Key=\"IsGoodColorConverter\"\n                                       TrueColor=\"{StaticResource BackgroundGood}\"\n                                       FalseColor=\"{StaticResource BackgroundRed}\"/>\n    </Window.Resources>\n    <Grid>\n        <ItemsControl x:Name=\"ActionPanel\" Margin=\"0\">\n            <ItemsControl.ItemsPanel>\n                <ItemsPanelTemplate>\n                    <StackPanel Margin=\"0,5,0,40\" />\n                </ItemsPanelTemplate>\n            </ItemsControl.ItemsPanel>\n            <ItemsControl.ItemTemplate>\n                <DataTemplate>\n                    <Border BorderBrush=\"Black\" BorderThickness=\"1\" Margin=\"10, 5, 10, 5\" Padding=\"10\" Background=\"{Binding IsGood, Converter={StaticResource IsGoodColorConverter}}\" IsEnabled=\"{Binding TaskHasReturned}\"  >\n                        <StackPanel>\n                            <StackPanel Orientation=\"Horizontal\" Margin=\"0, 0, 0, 5\" >\n                                <Label Content=\"{Binding Title}\" FontSize=\"21.333\" FontWeight=\"Bold\" />\n                                <Label Content=\"{Binding RequiredOptional}\" FontSize=\"21.333\" FontStyle=\"Italic\" Foreground=\"#FF666666\" VerticalAlignment=\"Bottom\" />\n                            </StackPanel>\n                            <TextBlock TextWrapping=\"Wrap\" FontSize=\"16\" Text=\"{Binding Description}\" />\n                            <TextBlock TextWrapping=\"Wrap\" FontStyle=\"Italic\" Foreground=\"#FF202020\" Margin=\"0,5\" Text=\"{Binding SmallDescription}\" />\n                            <TextBlock TextWrapping=\"Wrap\" FontStyle=\"Italic\" Foreground=\"Red\" Text=\"{Binding RedNote}\" />\n                            <Button Content=\"{Binding ButtonText}\" Width=\"75\" HorizontalAlignment=\"Right\" Margin=\"0,0,10,10\" Click=\"InstallerActionButtonClick\" />\n                        </StackPanel>\n                    </Border>\n                </DataTemplate>\n            </ItemsControl.ItemTemplate>\n        </ItemsControl>\n        <Button x:Name=\"CloseButton\" Content=\"Close\" HorizontalAlignment=\"Right\" Margin=\"0,0,10,10\" VerticalAlignment=\"Bottom\" Width=\"75\" Click=\"CloseButtonClick\"/>\n    </Grid>\n</Window>\n"
  },
  {
    "path": "HID Wiimote Control Center/Main Windows/InstallerWindow.xaml.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tInstallerWindow.xaml.cs\n\nAbstract:\n\tInstaller Window\n\n*/\nusing HIDWiimote.ControlCenter.Setup.SetupAction;\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Globalization;\nusing System.Threading.Tasks;\nusing System.Windows;\nusing System.Windows.Data;\nusing System.Windows.Media;\n\nnamespace HIDWiimote.ControlCenter.Main_Windows\n{\n    /// <summary>\n    /// Interaction logic for InstallerWindow.xaml\n    /// </summary>\n    public partial class InstallerWindow : Window\n    {\n        List<InstallerAction> ActionList = new List<InstallerAction>();\n\n        public InstallerWindow()\n        {\n            ActionList.Add(new InstallerAction(\n                HIDWiimote.ControlCenter.Properties.Installer.TestMode_Title,\n                false,\n                HIDWiimote.ControlCenter.Properties.Installer.TestMode_Description,\n                HIDWiimote.ControlCenter.Properties.Installer.TestMode_SmallDescription,\n                HIDWiimote.ControlCenter.Properties.Installer.TestMode_RedNote,\n                HIDWiimote.ControlCenter.Properties.Installer.ButtonDisable,\n                HIDWiimote.ControlCenter.Properties.Installer.ButtonEnable,\n                new TestMode()\n                ));\n\n            ActionList.Add(new InstallerAction(\n                HIDWiimote.ControlCenter.Properties.Installer.Certificate_Title,\n                false,\n                HIDWiimote.ControlCenter.Properties.Installer.Certificate_Description,\n                HIDWiimote.ControlCenter.Properties.Installer.Certificate_SmallDescription,\n                string.Empty,\n                HIDWiimote.ControlCenter.Properties.Installer.ButtonUninstall,\n                HIDWiimote.ControlCenter.Properties.Installer.ButtonInstall,\n                new Certificate()\n                ));\n\n            ActionList.Add(new InstallerAction(\n                HIDWiimote.ControlCenter.Properties.Installer.DeviceDriver_Title,\n                true,\n                HIDWiimote.ControlCenter.Properties.Installer.DeviceDriver_Description,\n                HIDWiimote.ControlCenter.Properties.Installer.DeviceDriver_SmallDescription,\n                string.Empty,\n                HIDWiimote.ControlCenter.Properties.Installer.ButtonUninstall,\n                HIDWiimote.ControlCenter.Properties.Installer.ButtonInstall,\n                new Setup.SetupAction.DeviceDriver()\n                ));\n\n            InitializeComponent();\n        }\n\n        private void OnInitialized(object sender, EventArgs e)\n        {\n            ActionPanel.ItemsSource = ActionList;\n        }\n\n        private void InstallerActionButtonClick(object sender, RoutedEventArgs e)\n        {\n            FrameworkElement Button = sender as FrameworkElement;\n\n            if (Button != null)\n            {\n                InstallerAction Action = Button.DataContext as InstallerAction;\n                if (Action != null)\n                {\n                    Action.ButtonClicked();\n                }\n            }\n\n        }\n\n        private void CloseButtonClick(object sender, RoutedEventArgs e)\n        {\n            if (AllRequirementsFulfilled())\n            {\n                App.ChangeMainWindow(new ControlCenterWindow(), this);\n            }\n            else\n            {\n                Close();\n            }\n\n        }\n\n        private bool AllRequirementsFulfilled()\n        {\n            foreach (InstallerAction Action in ActionList)\n            {\n                if (Action.Required)\n                {\n                    if (!Action.IsGood)\n                    {\n                        return false;\n                    }\n                }\n            }\n\n            return true;\n        }\n    }\n\n    public class InstallerAction : INotifyPropertyChanged\n    {\n        public event PropertyChangedEventHandler PropertyChanged;\n\n\n        private string _Title;\n        private bool _Required;\n        private string _Description;\n        private string _SmallDescription;\n        private string _RedNote;\n        private bool _ShowRedNote;\n\n        private bool _IsGood;\n        private bool _TaskHasReturned;\n        private string GoodButtonText;\n        private string BadButtonText;\n\n        private ISetupAction InstallerTask;\n\n        public InstallerAction(string Title, bool Required, string Description, string SmallDescription, string RedNote, string GoodButtonText, string BadButtonText, ISetupAction InstallerTask)\n        {\n            this.Title = Title;\n            this._Required = Required;\n            this.Description = Description;\n            this.SmallDescription = SmallDescription;\n            this._RedNote = RedNote;\n            this.GoodButtonText = GoodButtonText;\n            this.BadButtonText = BadButtonText;\n\n            this.InstallerTask = InstallerTask;\n\n            this.ShowRedNote = false;\n            this.IsGood = false;\n            this.TaskHasReturned = true;\n\n            StartTask(CheckIsGood);\n        }\n\n        public string Title\n        {\n            get { return _Title; }\n            set\n            {\n                _Title = value;\n                OnPropertyChanged(\"Title\");\n            }\n        }\n\n        public bool Required\n        {\n            get\n            {\n                return _Required;\n            }\n        }\n\n        public string RequiredOptional\n        {\n            get\n            {\n                if (Required)\n                {\n                    return \"- \" + HIDWiimote.ControlCenter.Properties.Installer.ActionRequired;\n                }\n                else\n                {\n                    return \"- \" + HIDWiimote.ControlCenter.Properties.Installer.ActionOptional;\n                }\n            }\n        }\n\n        public string Description\n        {\n            get { return _Description; }\n            set\n            {\n                _Description = value;\n                OnPropertyChanged(\"Description\");\n            }\n        }\n\n        public string SmallDescription\n        {\n            get { return _SmallDescription; }\n            set\n            {\n                _SmallDescription = value;\n                OnPropertyChanged(\"SmallDescription\");\n            }\n        }\n\n        public string RedNote\n        {\n            get\n            {\n                if (ShowRedNote)\n                {\n                    return _RedNote;\n                }\n                else\n                {\n                    return string.Empty;\n                }\n            }\n        }\n\n        public bool ShowRedNote\n        {\n            get { return _ShowRedNote; }\n            set\n            {\n                _ShowRedNote = value;\n                OnPropertyChanged(\"ShowRedNote\");\n                OnPropertyChanged(\"RedNote\");\n            }\n        }\n\n        public string ButtonText\n        {\n            get\n            {\n                if (IsGood)\n                {\n                    return GoodButtonText;\n                }\n                else\n                {\n                    return BadButtonText;\n                }\n            }\n        }\n\n        public bool IsGood\n        {\n            get { return _IsGood; }\n            set\n            {\n                _IsGood = value;\n                OnPropertyChanged(\"IsGood\");\n                OnPropertyChanged(\"ButtonText\");\n            }\n        }\n\n        public bool TaskHasReturned\n        {\n            get { return _TaskHasReturned; }\n            set\n            {\n                _TaskHasReturned = value;\n                OnPropertyChanged(\"TaskHasReturned\");\n            }\n        }\n\n        protected void OnPropertyChanged(string PropertyName)\n        {\n            PropertyChangedEventHandler Handler = PropertyChanged;\n            if (Handler != null)\n            {\n                Handler(this, new PropertyChangedEventArgs(PropertyName));\n            }\n        }\n\n        private void StartTask(Action TaskAction)\n        {\n            if (!TaskHasReturned)\n            {\n                return;\n            }\n\n            TaskHasReturned = false;\n            Task NewTask = new Task(TaskAction);\n            NewTask.ContinueWith(TaskCompletion);\n            NewTask.Start(TaskScheduler.Default);\n        }\n\n        private void TaskCompletion(Task CompletedTask)\n        {\n            TaskHasReturned = true;\n        }\n\n        private void CheckIsGood()\n        {\n            IsGood = InstallerTask.IsSetUp();\n        }\n\n        private void ButtonAction()\n        {\n            try\n            {\n                if (IsGood)\n                {\n                    InstallerTask.TryRevert();\n                }\n                else\n                {\n                    InstallerTask.TrySetUp();\n                }\n\n            }\n            catch (Exception e)\n            {\n                MessageBox.Show(HIDWiimote.ControlCenter.Properties.Installer.InstallerAction_ExceptionDialogMessage + Title + \"\\n\\n\" + e.Message, HIDWiimote.ControlCenter.Properties.Installer.InstallerAction_ExceptionDialogTitle, MessageBoxButton.OK, MessageBoxImage.Error);\n                return;\n            }\n\n            IsGood = !IsGood;\n            ShowRedNote = !ShowRedNote;\n        }\n\n        public void ButtonClicked()\n        {\n            StartTask(ButtonAction);\n        }\n    }\n\n    public class BooleanToColorConverter : IValueConverter\n    {\n        public SolidColorBrush TrueColor { get; set; }\n        public SolidColorBrush FalseColor { get; set; }\n\n        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\n        {\n            bool Value = (bool)value;\n\n            return Value ? TrueColor : FalseColor;\n        }\n\n        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)\n        {\n            throw new NotImplementedException();\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Main Windows/UpdaterWindow.xaml",
    "content": "﻿<Window x:Class=\"HIDWiimote.ControlCenter.Main_Windows.UpdaterWindow\"\n        xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n        xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n        xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n        xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n        xmlns:local=\"clr-namespace:HIDWiimote.ControlCenter.Main_Windows\"\n        xmlns:user=\"clr-namespace:HIDWiimote.ControlCenter.UserControls\"\n        xmlns:Emit=\"clr-namespace:System.Reflection.Emit;assembly=mscorlib\"\n        mc:Ignorable=\"d\"\n        Title=\"HID Wiimote Updater\" Height=\"297\" Width=\"450\" Initialized=\"OnInitialized\" Loaded=\"OnLoaded\" ResizeMode=\"NoResize\" WindowStartupLocation=\"CenterScreen\">\n    <Grid>\n        <user:TaskList x:Name=\"TaskListBox\" Margin=\"10,10,10,40\" />\n        <Button x:Name=\"CloseButton\" Content=\"Close\" HorizontalAlignment=\"Right\" Margin=\"0,0,10,10\" VerticalAlignment=\"Bottom\" Width=\"75\" IsEnabled=\"False\" Grid.Column=\"1\" Click=\"CloseButtonClick\"/>\n    </Grid>\n</Window>\n"
  },
  {
    "path": "HID Wiimote Control Center/Main Windows/UpdaterWindow.xaml.cs",
    "content": "/*\n\nCopyright (C) 2018 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tInstallerWindow.xaml.cs\n\nAbstract:\n\tWindow for the updating process\n\n*/\nusing HIDWiimote.ControlCenter.Setup;\nusing HIDWiimote.ControlCenter.UserControls;\r\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Globalization;\nusing System.Threading.Tasks;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\n\nnamespace HIDWiimote.ControlCenter.Main_Windows\n{\n    /// <summary>\n    /// Interaction logic for UpdaterWindow.xaml\n    /// </summary>\n    public partial class UpdaterWindow : Window\n    {\n        List<TaskList.Item> UpdateTasks = new List<TaskList.Item>();\n        bool UpdateSuccesfull = false;\n        string ErrorMessage;\n\n        public UpdaterWindow()\n        {\n            if (!AskForUpdate())\n            {\n                this.Close();\n                return;\n            }\n\n            UpdateTasks.Add(new TaskList.Item(HIDWiimote.ControlCenter.Properties.App.Updater_RemoveDeviceDriverPMessage, RemoveOldDeviceDriver));\n            UpdateTasks.Add(new TaskList.Item(HIDWiimote.ControlCenter.Properties.App.Updater_InstallDeviceDriverMessage, InstallNewDeviceDriver));\n\n            InitializeComponent();\n        }\n\n        private bool AskForUpdate()\n        {\n            string InstalledVersion = DeviceDriverUninstallerRegistry.GetInstalledVersionString(); \n            MessageBoxResult Result = MessageBox.Show(string.Format(HIDWiimote.ControlCenter.Properties.App.UpdaterDialog_MainMessage, VersionStrings.DeviceDriverVersion, InstalledVersion), \"HID Wiimote Updater\", MessageBoxButton.YesNo, MessageBoxImage.Question);\n\n            return (Result == MessageBoxResult.Yes);\n        }\n\n        private void OnInitialized(object sender, EventArgs e)\n        {\n            TaskListBox.DataContext = UpdateTasks;\n        }\n\n        private void OnLoaded(object sender, RoutedEventArgs e)\n        {\n            if (UpdateTasks.Count > 0)\n            {\n                // Do some delay, so the user can graps the steps\n                Task.Delay(TimeSpan.FromSeconds(0.25)).ContinueWith(DelayTask => { StartTaskQueue(); }, TaskScheduler.FromCurrentSynchronizationContext());\n            }\n        }\n\n        private void StartTaskQueue()\n        {\n            UpdateTasks[0].StartTask(UpdaterTaskComplete);\n        }\n\n        private void UpdaterTaskComplete(Task<bool> CompletedTask, Object State)\n        {\n            TaskList.Item CompletedUpdaterTask = State as TaskList.Item;\n\n            if ((CompletedTask.Status == TaskStatus.Faulted) || (CompletedTask.Result == false))\n            {\n                // Error\n                CompletedUpdaterTask.Status = TaskList.Item.TaskStatus.Error;\n                CloseButton.IsEnabled = true;\n                if (ErrorMessage.Length != 0)\n                {\n                    MessageBox.Show(ErrorMessage, HIDWiimote.ControlCenter.Properties.App.Update_RemoveDeviceDriverErrorDialog_Title + CompletedUpdaterTask.DisplayMessage, MessageBoxButton.OK, MessageBoxImage.Error);\n                }\n                return;\n            }\n\n\n            CompletedUpdaterTask.Status = TaskList.Item.TaskStatus.Finished;\n            int TaskIndex = UpdateTasks.IndexOf(CompletedUpdaterTask);\n\n            if (TaskIndex == (UpdateTasks.Count - 1))\n            {\n                // Last one finished\n                UpdateSuccesfull = true;\n                CloseButton.IsEnabled = true;\n                return;\n            }\n\n            TaskList.Item NextTask = UpdateTasks[TaskIndex + 1];\n            NextTask.StartTask(UpdaterTaskComplete);\n        }\n\n        private bool RemoveOldDeviceDriver()\n        {\n            try\n            {\n                DeviceDriver.Uninstall();\n            }\n            catch (Exception e)\n            {\n                ErrorMessage = HIDWiimote.ControlCenter.Properties.App.Updater_RemoveDeviceDriverException + \"\\n\\n\" + e.Message;\n                return false;\n            }\n\n            bool UninstallCheck = (DeviceDriverUninstallerRegistry.GetUninstallString().Length == 0);\n            if (!UninstallCheck)\n            {\n                ErrorMessage = HIDWiimote.ControlCenter.Properties.App.Updater_RemoveDeviceDriverCheckFailed;\n                return false;\n            }\n\n            return true;\n        }\n\n        private bool InstallNewDeviceDriver()\n        {\n            try\n            {\n                DeviceDriver.Install();\n            }\n            catch (Exception e)\n            {\n                ErrorMessage = HIDWiimote.ControlCenter.Properties.App.Updater_InstallDeviceDriverException + \"\\n\\n\" + e.Message;\n                return false;\n            }\n\n            bool InstallCheck = (DeviceDriverUninstallerRegistry.GetUninstallString().Length != 0);\n            if (!InstallCheck)\n            {\n                ErrorMessage = HIDWiimote.ControlCenter.Properties.App.Updater_InstallDeviceDriverCheckFailed;\n                return false;\n            }\n\n            return true;\n        }\n\n        private void CloseButtonClick(object sender, RoutedEventArgs e)\n        {\n            if (UpdateSuccesfull)\n            {\n                App.ChangeMainWindow(new ControlCenterWindow(), this);\n            }\n            else\n            {\n                this.Close();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Properties/App.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:4.0.30319.42000\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace HIDWiimote.ControlCenter.Properties {\r\n    using System;\r\n    \r\n    \r\n    /// <summary>\r\n    ///   A strongly-typed resource class, for looking up localized strings, etc.\r\n    /// </summary>\r\n    // This class was auto-generated by the StronglyTypedResourceBuilder\r\n    // class via a tool like ResGen or Visual Studio.\r\n    // To add or remove a member, edit your .ResX file then rerun ResGen\r\n    // with the /str option, or rebuild your VS project.\r\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Resources.Tools.StronglyTypedResourceBuilder\", \"17.0.0.0\")]\r\n    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\r\n    internal class App {\r\n        \r\n        private static global::System.Resources.ResourceManager resourceMan;\r\n        \r\n        private static global::System.Globalization.CultureInfo resourceCulture;\r\n        \r\n        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\r\n        internal App() {\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Returns the cached ResourceManager instance used by this class.\r\n        /// </summary>\r\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        internal static global::System.Resources.ResourceManager ResourceManager {\r\n            get {\r\n                if (object.ReferenceEquals(resourceMan, null)) {\r\n                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(\"HIDWiimote.ControlCenter.Properties.App\", typeof(App).Assembly);\r\n                    resourceMan = temp;\r\n                }\r\n                return resourceMan;\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Overrides the current thread's CurrentUICulture property for all\r\n        ///   resource lookups using this strongly typed resource class.\r\n        /// </summary>\r\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        internal static global::System.Globalization.CultureInfo Culture {\r\n            get {\r\n                return resourceCulture;\r\n            }\r\n            set {\r\n                resourceCulture = value;\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to There is a newer Device Driver already installed.\n        ///Please use the Control Center that came with it.\n        ///\n        ///Compatible Device Driver: {0}\n        ///Installed Device Driver: {1}.\r\n        /// </summary>\r\n        internal static string NewerInstalledDialog_MainMessage {\r\n            get {\r\n                return ResourceManager.GetString(\"NewerInstalledDialog_MainMessage\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Error while: .\r\n        /// </summary>\r\n        internal static string Update_RemoveDeviceDriverErrorDialog_Title {\r\n            get {\r\n                return ResourceManager.GetString(\"Update_RemoveDeviceDriverErrorDialog_Title\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to The new Device Driver was not successfully installed. Please try again..\r\n        /// </summary>\r\n        internal static string Updater_InstallDeviceDriverCheckFailed {\r\n            get {\r\n                return ResourceManager.GetString(\"Updater_InstallDeviceDriverCheckFailed\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to An error occured while trying to install the new Device Driver..\r\n        /// </summary>\r\n        internal static string Updater_InstallDeviceDriverException {\r\n            get {\r\n                return ResourceManager.GetString(\"Updater_InstallDeviceDriverException\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Install new Device Driver.\r\n        /// </summary>\r\n        internal static string Updater_InstallDeviceDriverMessage {\r\n            get {\r\n                return ResourceManager.GetString(\"Updater_InstallDeviceDriverMessage\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to The old Device Driver was not successfully removed. Please try again or remove it via &quot;Programs and Features&quot;..\r\n        /// </summary>\r\n        internal static string Updater_RemoveDeviceDriverCheckFailed {\r\n            get {\r\n                return ResourceManager.GetString(\"Updater_RemoveDeviceDriverCheckFailed\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to An error occured while trying to uninstall the old Device Driver..\r\n        /// </summary>\r\n        internal static string Updater_RemoveDeviceDriverException {\r\n            get {\r\n                return ResourceManager.GetString(\"Updater_RemoveDeviceDriverException\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Remove old Device Driver.\r\n        /// </summary>\r\n        internal static string Updater_RemoveDeviceDriverPMessage {\r\n            get {\r\n                return ResourceManager.GetString(\"Updater_RemoveDeviceDriverPMessage\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to This Control Center comes with an driver update.\n        ///Would you like to update the HID Wiimote Device Driver?\n        ///\n        ///Note: This Control Center is only compatible with the updated driver.\n        ///\n        ///New Device Driver: {0}\n        ///Installed Device Driver: {1}.\r\n        /// </summary>\r\n        internal static string UpdaterDialog_MainMessage {\r\n            get {\r\n                return ResourceManager.GetString(\"UpdaterDialog_MainMessage\", resourceCulture);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "HID Wiimote Control Center/Properties/App.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The primary goals of this format is to allow a simple XML format \n    that is mostly human readable. The generation and parsing of the \n    various data types are done through the TypeConverter classes \n    associated with the data types.\n    \n    Example:\n    \n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n                \n    There are any number of \"resheader\" rows that contain simple \n    name/value pairs.\n    \n    Each data row contains a name, and value. The row also contains a \n    type or mimetype. Type corresponds to a .NET class that support \n    text/value conversion through the TypeConverter architecture. \n    Classes that don't support this are serialized and stored with the \n    mimetype set.\n    \n    The mimetype is used for serialized objects, and tells the \n    ResXResourceReader how to depersist the object. This is currently not \n    extensible. For a given mimetype the value must be set accordingly:\n    \n    Note - application/x-microsoft.net.object.binary.base64 is the format \n    that the ResXResourceWriter will generate, however the reader can \n    read any of the formats listed below.\n    \n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n    \n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array \n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <data name=\"NewerInstalledDialog_MainMessage\" xml:space=\"preserve\">\n    <value>There is a newer Device Driver already installed.\nPlease use the Control Center that came with it.\n\nCompatible Device Driver: {0}\nInstalled Device Driver: {1}</value>\n  </data>\n  <data name=\"UpdaterDialog_MainMessage\" xml:space=\"preserve\">\n    <value>This Control Center comes with an driver update.\nWould you like to update the HID Wiimote Device Driver?\n\nNote: This Control Center is only compatible with the updated driver.\n\nNew Device Driver: {0}\nInstalled Device Driver: {1}</value>\n  </data>\n  <data name=\"Updater_InstallDeviceDriverMessage\" xml:space=\"preserve\">\n    <value>Install new Device Driver</value>\n  </data>\n  <data name=\"Updater_RemoveDeviceDriverCheckFailed\" xml:space=\"preserve\">\n    <value>The old Device Driver was not successfully removed. Please try again or remove it via \"Programs and Features\".</value>\n  </data>\n  <data name=\"Updater_RemoveDeviceDriverException\" xml:space=\"preserve\">\n    <value>An error occured while trying to uninstall the old Device Driver.</value>\n  </data>\n  <data name=\"Updater_RemoveDeviceDriverPMessage\" xml:space=\"preserve\">\n    <value>Remove old Device Driver</value>\n  </data>\n  <data name=\"Update_RemoveDeviceDriverErrorDialog_Title\" xml:space=\"preserve\">\n    <value>Error while: </value>\n  </data>\n  <data name=\"Updater_InstallDeviceDriverCheckFailed\" xml:space=\"preserve\">\n    <value>The new Device Driver was not successfully installed. Please try again.</value>\n  </data>\n  <data name=\"Updater_InstallDeviceDriverException\" xml:space=\"preserve\">\n    <value>An error occured while trying to install the new Device Driver.</value>\n  </data>\n</root>"
  },
  {
    "path": "HID Wiimote Control Center/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\nusing System.Resources;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Windows;\n\n// General Information about an assembly is controlled through the following \n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(\"HID Wiimote Control Center\")]\n[assembly: AssemblyDescription(\"Control Center Application for the HID Wiimote Driver\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"Julian Löhr\")]\n[assembly: AssemblyProduct(\"HID Wiimote\")]\n[assembly: AssemblyCopyright(\"Copyright ©  2016\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible \n// to COM components.  If you need to access a type in this assembly from \n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n//In order to begin building localizable applications, set \n//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file\n//inside a <PropertyGroup>.  For example, if you are using US english\n//in your source files, set the <UICulture> to en-US.  Then uncomment\n//the NeutralResourceLanguage attribute below.  Update the \"en-US\" in\n//the line below to match the UICulture setting in the project file.\n\n//[assembly: NeutralResourcesLanguage(\"en-US\", UltimateResourceFallbackLocation.Satellite)]\n\n\n[assembly: ThemeInfo(\n    ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located\n                                     //(used if a resource is not found in the page, \n                                     // or application resource dictionaries)\n    ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located\n                                              //(used if a resource is not found in the page, \n                                              // app, or any theme specific resource dictionaries)\n)]\n\n\n// Version information for an assembly consists of the following four values:\n//\n//      Major Version\n//      Minor Version \n//      Build Number\n//      Revision\n//\n// You can specify all the values or you can default the Build and Revision Numbers \n// by using the '*' as shown below:\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(HIDWiimote.VersionStrings.ControlCenterVersion)]\n[assembly: AssemblyFileVersion(HIDWiimote.VersionStrings.ControlCenterVersion)]\n\n[assembly: AssemblyKeyFileAttribute(\"../HID Wiimote.snk\")]\n"
  },
  {
    "path": "HID Wiimote Control Center/Properties/ControlCenter.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:4.0.30319.42000\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace HIDWiimote.ControlCenter.Properties {\r\n    using System;\r\n    \r\n    \r\n    /// <summary>\r\n    ///   A strongly-typed resource class, for looking up localized strings, etc.\r\n    /// </summary>\r\n    // This class was auto-generated by the StronglyTypedResourceBuilder\r\n    // class via a tool like ResGen or Visual Studio.\r\n    // To add or remove a member, edit your .ResX file then rerun ResGen\r\n    // with the /str option, or rebuild your VS project.\r\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Resources.Tools.StronglyTypedResourceBuilder\", \"17.0.0.0\")]\r\n    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\r\n    public class ControlCenter {\r\n        \r\n        private static global::System.Resources.ResourceManager resourceMan;\r\n        \r\n        private static global::System.Globalization.CultureInfo resourceCulture;\r\n        \r\n        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\r\n        internal ControlCenter() {\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Returns the cached ResourceManager instance used by this class.\r\n        /// </summary>\r\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        public static global::System.Resources.ResourceManager ResourceManager {\r\n            get {\r\n                if (object.ReferenceEquals(resourceMan, null)) {\r\n                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(\"HIDWiimote.ControlCenter.Properties.ControlCenter\", typeof(ControlCenter).Assembly);\r\n                    resourceMan = temp;\r\n                }\r\n                return resourceMan;\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Overrides the current thread's CurrentUICulture property for all\r\n        ///   resource lookups using this strongly typed resource class.\r\n        /// </summary>\r\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        public static global::System.Globalization.CultureInfo Culture {\r\n            get {\r\n                return resourceCulture;\r\n            }\r\n            set {\r\n                resourceCulture = value;\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Balance Board.\r\n        /// </summary>\r\n        public static string ExtensionString_BalanceBoard {\r\n            get {\r\n                return ResourceManager.GetString(\"ExtensionString_BalanceBoard\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Classic Controller.\r\n        /// </summary>\r\n        public static string ExtensionString_ClassicController {\r\n            get {\r\n                return ResourceManager.GetString(\"ExtensionString_ClassicController\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Classic Controller Pro.\r\n        /// </summary>\r\n        public static string ExtensionString_ClassicControllerPro {\r\n            get {\r\n                return ResourceManager.GetString(\"ExtensionString_ClassicControllerPro\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Guitar Hero.\r\n        /// </summary>\r\n        public static string ExtensionString_GuitarHero {\r\n            get {\r\n                return ResourceManager.GetString(\"ExtensionString_GuitarHero\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Wiimote + Nunchuck.\r\n        /// </summary>\r\n        public static string ExtensionString_Nunchuck {\r\n            get {\r\n                return ResourceManager.GetString(\"ExtensionString_Nunchuck\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Wiimote.\r\n        /// </summary>\r\n        public static string ExtensionString_Wiimote {\r\n            get {\r\n                return ResourceManager.GetString(\"ExtensionString_Wiimote\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Wii U Pro Controller.\r\n        /// </summary>\r\n        public static string ExtensionString_WiiUProController {\r\n            get {\r\n                return ResourceManager.GetString(\"ExtensionString_WiiUProController\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to DPad-Mouse.\r\n        /// </summary>\r\n        public static string ModeString_DPadMouse {\r\n            get {\r\n                return ResourceManager.GetString(\"ModeString_DPadMouse\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Gamepad.\r\n        /// </summary>\r\n        public static string ModeString_Gamepad {\r\n            get {\r\n                return ResourceManager.GetString(\"ModeString_Gamepad\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Gamepad + IR-Mouse.\r\n        /// </summary>\r\n        public static string ModeString_GamepadAndIRMouse {\r\n            get {\r\n                return ResourceManager.GetString(\"ModeString_GamepadAndIRMouse\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to IR-Mouse.\r\n        /// </summary>\r\n        public static string ModeString_IRMouse {\r\n            get {\r\n                return ResourceManager.GetString(\"ModeString_IRMouse\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Pass Through.\r\n        /// </summary>\r\n        public static string ModeString_PassThrough {\r\n            get {\r\n                return ResourceManager.GetString(\"ModeString_PassThrough\", resourceCulture);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "HID Wiimote Control Center/Properties/ControlCenter.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The primary goals of this format is to allow a simple XML format \n    that is mostly human readable. The generation and parsing of the \n    various data types are done through the TypeConverter classes \n    associated with the data types.\n    \n    Example:\n    \n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n                \n    There are any number of \"resheader\" rows that contain simple \n    name/value pairs.\n    \n    Each data row contains a name, and value. The row also contains a \n    type or mimetype. Type corresponds to a .NET class that support \n    text/value conversion through the TypeConverter architecture. \n    Classes that don't support this are serialized and stored with the \n    mimetype set.\n    \n    The mimetype is used for serialized objects, and tells the \n    ResXResourceReader how to depersist the object. This is currently not \n    extensible. For a given mimetype the value must be set accordingly:\n    \n    Note - application/x-microsoft.net.object.binary.base64 is the format \n    that the ResXResourceWriter will generate, however the reader can \n    read any of the formats listed below.\n    \n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n    \n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array \n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <data name=\"ExtensionString_BalanceBoard\" xml:space=\"preserve\">\n    <value>Balance Board</value>\n  </data>\n  <data name=\"ExtensionString_ClassicController\" xml:space=\"preserve\">\n    <value>Classic Controller</value>\n  </data>\n  <data name=\"ExtensionString_ClassicControllerPro\" xml:space=\"preserve\">\n    <value>Classic Controller Pro</value>\n  </data>\n  <data name=\"ExtensionString_GuitarHero\" xml:space=\"preserve\">\n    <value>Guitar Hero</value>\n  </data>\n  <data name=\"ExtensionString_Nunchuck\" xml:space=\"preserve\">\n    <value>Wiimote + Nunchuck</value>\n  </data>\n  <data name=\"ExtensionString_Wiimote\" xml:space=\"preserve\">\n    <value>Wiimote</value>\n  </data>\n  <data name=\"ExtensionString_WiiUProController\" xml:space=\"preserve\">\n    <value>Wii U Pro Controller</value>\n  </data>\n  <data name=\"ModeString_DPadMouse\" xml:space=\"preserve\">\n    <value>DPad-Mouse</value>\n  </data>\n  <data name=\"ModeString_Gamepad\" xml:space=\"preserve\">\n    <value>Gamepad</value>\n  </data>\n  <data name=\"ModeString_GamepadAndIRMouse\" xml:space=\"preserve\">\n    <value>Gamepad + IR-Mouse</value>\n  </data>\n  <data name=\"ModeString_IRMouse\" xml:space=\"preserve\">\n    <value>IR-Mouse</value>\n  </data>\n  <data name=\"ModeString_PassThrough\" xml:space=\"preserve\">\n    <value>Pass Through</value>\n  </data>\n</root>"
  },
  {
    "path": "HID Wiimote Control Center/Properties/Installer.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:4.0.30319.42000\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace HIDWiimote.ControlCenter.Properties {\r\n    using System;\r\n    \r\n    \r\n    /// <summary>\r\n    ///   A strongly-typed resource class, for looking up localized strings, etc.\r\n    /// </summary>\r\n    // This class was auto-generated by the StronglyTypedResourceBuilder\r\n    // class via a tool like ResGen or Visual Studio.\r\n    // To add or remove a member, edit your .ResX file then rerun ResGen\r\n    // with the /str option, or rebuild your VS project.\r\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Resources.Tools.StronglyTypedResourceBuilder\", \"17.0.0.0\")]\r\n    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r\n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\r\n    public class Installer {\r\n        \r\n        private static global::System.Resources.ResourceManager resourceMan;\r\n        \r\n        private static global::System.Globalization.CultureInfo resourceCulture;\r\n        \r\n        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\r\n        internal Installer() {\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Returns the cached ResourceManager instance used by this class.\r\n        /// </summary>\r\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        public static global::System.Resources.ResourceManager ResourceManager {\r\n            get {\r\n                if (object.ReferenceEquals(resourceMan, null)) {\r\n                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(\"HIDWiimote.ControlCenter.Properties.Installer\", typeof(Installer).Assembly);\r\n                    resourceMan = temp;\r\n                }\r\n                return resourceMan;\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Overrides the current thread's CurrentUICulture property for all\r\n        ///   resource lookups using this strongly typed resource class.\r\n        /// </summary>\r\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\r\n        public static global::System.Globalization.CultureInfo Culture {\r\n            get {\r\n                return resourceCulture;\r\n            }\r\n            set {\r\n                resourceCulture = value;\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to optional.\r\n        /// </summary>\r\n        public static string ActionOptional {\r\n            get {\r\n                return ResourceManager.GetString(\"ActionOptional\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to required.\r\n        /// </summary>\r\n        public static string ActionRequired {\r\n            get {\r\n                return ResourceManager.GetString(\"ActionRequired\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Disable.\r\n        /// </summary>\r\n        public static string ButtonDisable {\r\n            get {\r\n                return ResourceManager.GetString(\"ButtonDisable\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Enable.\r\n        /// </summary>\r\n        public static string ButtonEnable {\r\n            get {\r\n                return ResourceManager.GetString(\"ButtonEnable\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Install.\r\n        /// </summary>\r\n        public static string ButtonInstall {\r\n            get {\r\n                return ResourceManager.GetString(\"ButtonInstall\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Uninstall.\r\n        /// </summary>\r\n        public static string ButtonUninstall {\r\n            get {\r\n                return ResourceManager.GetString(\"ButtonUninstall\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Installs driver certificate..\r\n        /// </summary>\r\n        public static string Certificate_Description {\r\n            get {\r\n                return ResourceManager.GetString(\"Certificate_Description\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to May boost driver ranking, if it is not selected as default..\r\n        /// </summary>\r\n        public static string Certificate_SmallDescription {\r\n            get {\r\n                return ResourceManager.GetString(\"Certificate_SmallDescription\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Certificate.\r\n        /// </summary>\r\n        public static string Certificate_Title {\r\n            get {\r\n                return ResourceManager.GetString(\"Certificate_Title\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to PnP Device Driver for the Wii Remote..\r\n        /// </summary>\r\n        public static string DeviceDriver_Description {\r\n            get {\r\n                return ResourceManager.GetString(\"DeviceDriver_Description\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to An entry in &quot;Programs and Features&quot; is added for uninstall..\r\n        /// </summary>\r\n        public static string DeviceDriver_SmallDescription {\r\n            get {\r\n                return ResourceManager.GetString(\"DeviceDriver_SmallDescription\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Device Driver.\r\n        /// </summary>\r\n        public static string DeviceDriver_Title {\r\n            get {\r\n                return ResourceManager.GetString(\"DeviceDriver_Title\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to An error occurred while trying to run the following action: .\r\n        /// </summary>\r\n        public static string InstallerAction_ExceptionDialogMessage {\r\n            get {\r\n                return ResourceManager.GetString(\"InstallerAction_ExceptionDialogMessage\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to An error occured!.\r\n        /// </summary>\r\n        public static string InstallerAction_ExceptionDialogTitle {\r\n            get {\r\n                return ResourceManager.GetString(\"InstallerAction_ExceptionDialogTitle\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized resource of type System.Byte[].\r\n        /// </summary>\r\n        public static byte[] JulianLoehrCA {\r\n            get {\r\n                object obj = ResourceManager.GetObject(\"JulianLoehrCA\", resourceCulture);\r\n                return ((byte[])(obj));\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Enables permanent Test mode..\r\n        /// </summary>\r\n        public static string TestMode_Description {\r\n            get {\r\n                return ResourceManager.GetString(\"TestMode_Description\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Note: Requires reboot to take action..\r\n        /// </summary>\r\n        public static string TestMode_RedNote {\r\n            get {\r\n                return ResourceManager.GetString(\"TestMode_RedNote\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Test Mode or turned off Driver Signature Verification is required to run the Driver. If Test Mode is off, you need to manually turn off Driver Signature Verification on each start up..\r\n        /// </summary>\r\n        public static string TestMode_SmallDescription {\r\n            get {\r\n                return ResourceManager.GetString(\"TestMode_SmallDescription\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to Test Mode.\r\n        /// </summary>\r\n        public static string TestMode_Title {\r\n            get {\r\n                return ResourceManager.GetString(\"TestMode_Title\", resourceCulture);\r\n            }\r\n        }\r\n        \r\n        /// <summary>\r\n        ///   Looks up a localized string similar to cd &quot;{{InstallDir}}&quot;\n        ///START /WAIT dpinst.exe /q /u &quot;{{InfFileName}}&quot;\n        ///IF ERRORLEVEL 1 (\n        ///\tECHO dpinst.exe failed: %ERRORLEVEL%\n        ///) ELSE (\n        ///\tREG DELETE &quot;HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\HID Wiimote&quot; /f\n        ///\tdel dpinst.exe\n        ///\tdel &quot;{{InfFileName}}&quot;\n        ///\tdel &quot;%~f0&quot;\n        ///).\r\n        /// </summary>\r\n        public static string UninstallerContent {\r\n            get {\r\n                return ResourceManager.GetString(\"UninstallerContent\", resourceCulture);\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "HID Wiimote Control Center/Properties/Installer.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The primary goals of this format is to allow a simple XML format \n    that is mostly human readable. The generation and parsing of the \n    various data types are done through the TypeConverter classes \n    associated with the data types.\n    \n    Example:\n    \n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n                \n    There are any number of \"resheader\" rows that contain simple \n    name/value pairs.\n    \n    Each data row contains a name, and value. The row also contains a \n    type or mimetype. Type corresponds to a .NET class that support \n    text/value conversion through the TypeConverter architecture. \n    Classes that don't support this are serialized and stored with the \n    mimetype set.\n    \n    The mimetype is used for serialized objects, and tells the \n    ResXResourceReader how to depersist the object. This is currently not \n    extensible. For a given mimetype the value must be set accordingly:\n    \n    Note - application/x-microsoft.net.object.binary.base64 is the format \n    that the ResXResourceWriter will generate, however the reader can \n    read any of the formats listed below.\n    \n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n    \n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array \n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <data name=\"ActionOptional\" xml:space=\"preserve\">\n    <value>optional</value>\n  </data>\n  <data name=\"ActionRequired\" xml:space=\"preserve\">\n    <value>required</value>\n  </data>\n  <data name=\"ButtonDisable\" xml:space=\"preserve\">\n    <value>Disable</value>\n  </data>\n  <data name=\"ButtonEnable\" xml:space=\"preserve\">\n    <value>Enable</value>\n  </data>\n  <data name=\"ButtonInstall\" xml:space=\"preserve\">\n    <value>Install</value>\n  </data>\n  <data name=\"ButtonUninstall\" xml:space=\"preserve\">\n    <value>Uninstall</value>\n  </data>\n  <data name=\"Certificate_Description\" xml:space=\"preserve\">\n    <value>Installs driver certificate.</value>\n  </data>\n  <data name=\"Certificate_SmallDescription\" xml:space=\"preserve\">\n    <value>May boost driver ranking, if it is not selected as default.</value>\n  </data>\n  <data name=\"Certificate_Title\" xml:space=\"preserve\">\n    <value>Certificate</value>\n  </data>\n  <data name=\"DeviceDriver_Description\" xml:space=\"preserve\">\n    <value>PnP Device Driver for the Wii Remote.</value>\n  </data>\n  <data name=\"DeviceDriver_SmallDescription\" xml:space=\"preserve\">\n    <value>An entry in \"Programs and Features\" is added for uninstall.</value>\n  </data>\n  <data name=\"DeviceDriver_Title\" xml:space=\"preserve\">\n    <value>Device Driver</value>\n  </data>\n  <data name=\"InstallerAction_ExceptionDialogMessage\" xml:space=\"preserve\">\n    <value>An error occurred while trying to run the following action: </value>\n  </data>\n  <data name=\"InstallerAction_ExceptionDialogTitle\" xml:space=\"preserve\">\n    <value>An error occured!</value>\n  </data>\n  <assembly alias=\"System.Windows.Forms\" name=\"System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" />\n  <data name=\"JulianLoehrCA\" type=\"System.Resources.ResXFileRef, System.Windows.Forms\">\n    <value>..\\Resources\\JulianLoehrCA.cer;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </data>\n  <data name=\"TestMode_Description\" xml:space=\"preserve\">\n    <value>Enables permanent Test mode.</value>\n  </data>\n  <data name=\"TestMode_RedNote\" xml:space=\"preserve\">\n    <value>Note: Requires reboot to take action.</value>\n  </data>\n  <data name=\"TestMode_SmallDescription\" xml:space=\"preserve\">\n    <value>Test Mode or turned off Driver Signature Verification is required to run the Driver. If Test Mode is off, you need to manually turn off Driver Signature Verification on each start up.</value>\n  </data>\n  <data name=\"TestMode_Title\" xml:space=\"preserve\">\n    <value>Test Mode</value>\n  </data>\n  <data name=\"UninstallerContent\" type=\"System.Resources.ResXFileRef, System.Windows.Forms\">\n    <value>..\\Resources\\UninstallerContent.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>\n  </data>\n</root>"
  },
  {
    "path": "HID Wiimote Control Center/Properties/Settings.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\r\n// <auto-generated>\r\n//     This code was generated by a tool.\r\n//     Runtime Version:4.0.30319.42000\r\n//\r\n//     Changes to this file may cause incorrect behavior and will be lost if\r\n//     the code is regenerated.\r\n// </auto-generated>\r\n//------------------------------------------------------------------------------\r\n\r\nnamespace HIDWiimote.ControlCenter.Properties {\r\n    \r\n    \r\n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\r\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator\", \"17.4.0.0\")]\r\n    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {\r\n        \r\n        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));\r\n        \r\n        public static Settings Default {\r\n            get {\r\n                return defaultInstance;\r\n            }\r\n        }\r\n    }\r\n}\r\n"
  },
  {
    "path": "HID Wiimote Control Center/Properties/Settings.settings",
    "content": "﻿<?xml version='1.0' encoding='utf-8'?>\n<SettingsFile xmlns=\"uri:settings\" CurrentProfile=\"(Default)\">\n  <Profiles>\n    <Profile Name=\"(Default)\" />\n  </Profiles>\n  <Settings />\n</SettingsFile>"
  },
  {
    "path": "HID Wiimote Control Center/Properties/app.manifest",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<assembly manifestVersion=\"1.0\" xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n  <assemblyIdentity version=\"1.0.0.0\" name=\"MyApplication.app\" />\n  <trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">\n    <security>\n      <requestedPrivileges xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n        <!-- UAC Manifest Options\n             If you want to change the Windows User Account Control level replace the \n             requestedExecutionLevel node with one of the following.\n\n        <requestedExecutionLevel  level=\"asInvoker\" uiAccess=\"false\" />\n        <requestedExecutionLevel  level=\"requireAdministrator\" uiAccess=\"false\" />\n        <requestedExecutionLevel  level=\"highestAvailable\" uiAccess=\"false\" />\n\n            Specifying requestedExecutionLevel element will disable file and registry virtualization. \n            Remove this element if your application requires this virtualization for backwards\n            compatibility.\n        -->\n        <requestedExecutionLevel level=\"requireAdministrator\" uiAccess=\"false\" />\n      </requestedPrivileges>\n      <applicationRequestMinimum>\n        <defaultAssemblyRequest permissionSetReference=\"Custom\" />\n        <PermissionSet class=\"System.Security.PermissionSet\" version=\"1\" ID=\"Custom\" SameSite=\"site\" />\n      </applicationRequestMinimum>\n    </security>\n  </trustInfo>\n  <compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\">\n    <application>\n      <!-- A list of the Windows versions that this application has been tested on and is\n           is designed to work with. Uncomment the appropriate elements and Windows will \n           automatically selected the most compatible environment. -->\n      <!-- Windows Vista -->\n      <!--<supportedOS Id=\"{e2011457-1546-43c5-a5fe-008deee3d3f0}\" />-->\n      <!-- Windows 7 -->\n      <!--<supportedOS Id=\"{35138b9a-5d96-4fbd-8e2d-a2440225f93a}\" />-->\n      <!-- Windows 8 -->\n      <!--<supportedOS Id=\"{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}\" />-->\n      <!-- Windows 8.1 -->\n      <!--<supportedOS Id=\"{1f676c76-80e1-4239-95bb-83d0f6d0da78}\" />-->\n      <!-- Windows 10 -->\n      <!--<supportedOS Id=\"{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}\" />-->\n    </application>\n  </compatibility>\n  <!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher\n       DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need \n       to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should \n       also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->\n  <!--\n  <application xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n    <windowsSettings>\n      <dpiAware xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">true</dpiAware>\n    </windowsSettings>\n  </application>\n  -->\n  <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->\n  <!--\n  <dependency>\n    <dependentAssembly>\n      <assemblyIdentity\n          type=\"win32\"\n          name=\"Microsoft.Windows.Common-Controls\"\n          version=\"6.0.0.0\"\n          processorArchitecture=\"*\"\n          publicKeyToken=\"6595b64144ccf1df\"\n          language=\"*\"\n        />\n    </dependentAssembly>\n  </dependency>\n  -->\n</assembly>"
  },
  {
    "path": "HID Wiimote Control Center/Resources/UninstallerContent.txt",
    "content": "cd \"{{InstallDir}}\"\nSTART /WAIT dpinst.exe /q /u \"{{InfFileName}}\"\nIF ERRORLEVEL 1 (\n\tECHO dpinst.exe failed: %ERRORLEVEL%\n) ELSE (\n\tREG DELETE \"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\HID Wiimote\" /f\n\tdel dpinst.exe\n\tdel \"{{InfFileName}}\"\n\tdel \"%~f0\"\n)"
  },
  {
    "path": "HID Wiimote Control Center/Secondary Windows/About.xaml",
    "content": "﻿<Window x:Class=\"HIDWiimote.ControlCenter.Secondary_Windows.About\"\n        xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n        xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n        xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n        xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n        xmlns:local=\"clr-namespace:HIDWiimote.ControlCenter.Secondary_Windows\"\n        mc:Ignorable=\"d\"\n        Initialized=\"OnInitialized\"\n        Title=\"About\" Width=\"450\" ResizeMode=\"NoResize\" WindowStartupLocation=\"CenterOwner\" ShowInTaskbar=\"False\" SizeToContent=\"Height\">\n    <Grid Margin=\"10\">\n        <Grid.RowDefinitions>\n            <RowDefinition />\n            <RowDefinition/>\n            <RowDefinition/>\n        </Grid.RowDefinitions>\n        <StackPanel Margin=\"0,0,0,20\">\n            <StackPanel.Resources>\n                <Style x:Key=\"Header\" TargetType=\"Label\">\n                    <Setter Property=\"FontSize\" Value=\"16\" />\n                    <Setter Property=\"FontWeight\" Value=\"Bold\" />\n                </Style>\n            </StackPanel.Resources>\n            <Label Style=\"{StaticResource Header}\" x:Name=\"DeviceDriverHeader\" Content=\"HID Wiimote \" />\n            <Label Style=\"{StaticResource Header}\" x:Name=\"ControlCenterHeader\" Content=\"HID Wiimote Control Center \" />\n        </StackPanel>\n        <StackPanel Grid.Row=\"1\">\n            <TextBlock  TextWrapping=\"Wrap\" Margin=\"0,0,0,10\" >\n                <Hyperlink NavigateUri=\"https://www.julianloehr.de/educational-work/hid-wiimote/\" ToolTip=\"https://www.julianloehr.de/educational-work/hid-wiimote/\" RequestNavigate=\"HyperlinkRequestNavigate\" ><Run Text=\"Project Page\"/></Hyperlink><LineBreak/>\n                <Hyperlink NavigateUri=\"https://github.com/jloehr/HID-Wiimote\" ToolTip=\"https://github.com/jloehr/HID-Wiimote\" RequestNavigate=\"HyperlinkRequestNavigate\"><Run Text=\"Source Code\"/></Hyperlink>\n            </TextBlock>\n            <TextBlock   TextWrapping=\"Wrap\" Margin=\"0,0,0,10\" >\n                <Run Text=\"© 2017 \" /><Hyperlink NavigateUri=\"https://www.julianloehr.de/\" ToolTip=\"https://www.julianloehr.de/\" RequestNavigate=\"HyperlinkRequestNavigate\"><Run Text=\"Julian Löhr\" /></Hyperlink>\n            </TextBlock>\n        </StackPanel>\n        <StackPanel Grid.Row=\"2\">\n            <TextBlock TextWrapping=\"Wrap\">\n                This program and accompanied driver is free of charge. If you were charged please claim a refund and report the site. However Donations are welcome to support this project.\n            </TextBlock>\n            <Button Content=\"Close\" Width=\"75\" HorizontalAlignment=\"Right\" VerticalAlignment=\"Bottom\" Click=\"OnCloseClick\" />\n        </StackPanel>\n    </Grid>\n</Window>\n"
  },
  {
    "path": "HID Wiimote Control Center/Secondary Windows/About.xaml.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tAbout.xaml.cs\n\nAbstract:\n\tWindow with some additional info\n\n*/\nusing System.Diagnostics;\nusing System.Windows;\n\nnamespace HIDWiimote.ControlCenter.Secondary_Windows\n{\n    /// <summary>\n    /// Interaction logic for About.xaml\n    /// </summary>\n    public partial class About : Window\n    {\n        public About()\n        {\n            InitializeComponent();\n        }\n        private void OnInitialized(object sender, System.EventArgs e)\n        {\n            DeviceDriverHeader.Content += VersionStrings.DeviceDriverVersion;\n            ControlCenterHeader.Content += VersionStrings.ControlCenterVersion;\n        }\n\n        private void HyperlinkRequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)\n        {\n            Process.Start(e.Uri.ToString());\n        }\n\n        private void OnCloseClick(object sender, RoutedEventArgs e)\n        {\n            this.Close();\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Setup/DeviceDriver.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tDeviceDriver.cs\n\nAbstract:\n\tLet's one install and uninstall the device driver and query its install state \n\n*/\nusing HIDWiimote.ControlCenter.Setup.InstallStepAction;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\n\nnamespace HIDWiimote.ControlCenter.Setup\n{\n    static class DeviceDriver\n    {\n        const string InstallDir = @\"%ProgramFiles%\\DIFX\\HID Wiimote\";\n        const string UninstallFileName = \"Uninstall.bat\";\n        const string DPInstFileName = \"dpinst.exe\";\n        const string InfFileName = \"HIDWiimote.inf\";\n        const string UninstallerInfFileToken = \"{{InfFileName}}\";\n        const string InstallDirToken = \"{{InstallDir}}\";\n\n        public static bool IsInstalled()\n        {\n            DeviceDriverUninstallerRegistry.DeviceDriverState DPState = DeviceDriverUninstallerRegistry.GetDeviceDriverState(VersionStrings.DeviceDriverVersion);\n\n            return (DPState != DeviceDriverUninstallerRegistry.DeviceDriverState.NoneInstalled);\n        }\n\n        public static void Install()\n        {\n            if (IsInstalled())\n            {\n                return;\n            }\n\n            string ActualInstallDir = Environment.ExpandEnvironmentVariables(InstallDir);\n            string DPInstInstallPath = System.IO.Path.Combine(ActualInstallDir, DPInstFileName);\n            string InfInstallPath = System.IO.Path.Combine(ActualInstallDir, InfFileName);\n            string UninstallerPath = System.IO.Path.Combine(ActualInstallDir, UninstallFileName);\n\n            string UninstallerContent = HIDWiimote.ControlCenter.Properties.Installer.UninstallerContent;\n            UninstallerContent = UninstallerContent.Replace(UninstallerInfFileToken, InfFileName);\n            UninstallerContent = UninstallerContent.Replace(InstallDirToken, ActualInstallDir);\n\n            // Make sure Directory exists\n            System.IO.Directory.CreateDirectory(ActualInstallDir);\n\n            List<IInstallStepAction> InstallSteps = new List<IInstallStepAction> {\n                new CopyFile(DPInstFileName, ActualInstallDir),\n                new CopyFile(InfFileName, ActualInstallDir),\n                new TextResourceToFile(UninstallerPath, UninstallerContent),\n                new RunDPInstall(DPInstFileName, InfFileName),\n                new CreateRegistryUninstallKey(UninstallerPath, DPInstInstallPath)\n            };\n\n            for (int i = 0; i < InstallSteps.Count; i++)\n            {\n                if (!InstallSteps[i].Do())\n                {\n                    for (int j = i; j >= 0; j--)\n                    {\n                        InstallSteps[j].Undo();\n                    }\n\n                    throw new Exception(InstallSteps[i].GetExceptionMessage());\n                }\n            }\n        }\n\n        public static void Uninstall()\n        {\n            string UninstallerString = DeviceDriverUninstallerRegistry.GetUninstallString();\n            Process Uninstall = Process.Start(\"cmd.exe\", \"/C \\\"\" + UninstallerString + \"\\\"\");\n            Uninstall.WaitForExit();\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Setup/DeviceDriverUninstallerRegistry.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tDeviceDriverUninstallerRegistry.cs\n\nAbstract:\n\tLet's one create and retrieve the uninstaller registry entry and quiery its state \n\n*/\nusing Microsoft.Win32;\n\nnamespace HIDWiimote.ControlCenter\n{\n    static class DeviceDriverUninstallerRegistry\n    {\n        private static string UninstallKey = \"Software\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Uninstall\\\\HID Wiimote\\\\\";\n\n        private struct Version\n        {\n            public ushort Major;\n            public ushort Minor;\n            public ushort Build;\n            public ushort Revision;\n\n            public Version(string VersionString)\n            {\n                string[] StringParts = VersionString.Split('.');\n\n                Major = ParseStringPart(StringParts, 0);\n                Minor = ParseStringPart(StringParts, 1);\n                Build = ParseStringPart(StringParts, 2);\n                Revision = ParseStringPart(StringParts, 3);\n            }\n\n            public bool IsNewer(Version Other)\n            {\n                if (this.Major != Other.Major)\n                {\n                    return this.Major > Other.Major;\n                }\n\n                if (this.Minor != Other.Minor)\n                {\n                    return this.Minor > Other.Minor;\n                }\n\n                if (this.Build != Other.Build)\n                {\n                    return this.Build > Other.Build;\n                }\n\n                if (this.Revision != Other.Revision)\n                {\n                    return this.Revision > Other.Revision;\n                }\n\n                return false;\n            }\n\n            private static ushort ParseStringPart(string[] StringParts, int index)\n            {\n                if (StringParts.Length <= index)\n                {\n                    return 0;\n                }\n\n                ushort.TryParse(StringParts[index], out ushort Result);\n\n                return Result;\n            }\n        }\n\n        public enum DeviceDriverState { NoneInstalled, OlderInstalled, CurrentInstalled, NewerInstalled };\n\n        public static DeviceDriverState GetDeviceDriverState(string AppVersionString)\n        {\n            return GetDeviceDriverState(AppVersionString, out string InstalledVersionString);\n        }\n\n        public static DeviceDriverState GetDeviceDriverState(string AppVersionString, out string InstalledVersionString)\n        {\n            InstalledVersionString = \"\";\n#if !DEBUG\n            RegistryKey UninstallerKey = GetHIDWiimoteUninstallKey();\n\n            if (UninstallerKey == null)\n            {\n                return DeviceDriverState.NoneInstalled;\n            }\n\n            InstalledVersionString = UninstallerKey.GetValue(\"DisplayVersion\") as string;\n\n            if (AppVersionString == InstalledVersionString)\n            {\n                return DeviceDriverState.CurrentInstalled;\n            }\n\n            Version AppVersion = new Version(AppVersionString);\n            Version InstalledVersion = new Version(InstalledVersionString);\n\n            if (AppVersion.IsNewer(InstalledVersion))\n            {\n                return DeviceDriverState.OlderInstalled;\n            }\n\n            return DeviceDriverState.NewerInstalled;\n#else\n            return DeviceDriverState.CurrentInstalled;\n#endif\n        }\n\n        public static string GetInstalledVersionString()\n        {\n            RegistryKey UninstallerKey = GetHIDWiimoteUninstallKey();\n            return UninstallerKey.GetValue(\"DisplayVersion\") as string;\n        }\n\n        public static string GetUninstallString()\n        {\n            RegistryKey UninstallerKey = GetHIDWiimoteUninstallKey();\n\n            if (UninstallerKey == null)\n            {\n                return string.Empty;\n            }\n\n            return UninstallerKey.GetValue(\"UninstallString\") as string;\n        }\n\n        public static bool CreateHIDWiimoteUninstallKey(string UninstallCommnad, string DPInstPath)\n        {\n            RegistryKey UninstallerKey = Registry.LocalMachine.CreateSubKey(UninstallKey);\n            if (UninstallerKey == null)\n            {\n                return false;\n            }\n\n            UninstallerKey.SetValue(\"DisplayName\", \"HID Wiimote \" + VersionStrings.DeviceDriverVersion, RegistryValueKind.String);\n            UninstallerKey.SetValue(\"DisplayIcon\", DPInstPath + \",0\", RegistryValueKind.String);\n            UninstallerKey.SetValue(\"DisplayVersion\", VersionStrings.DeviceDriverVersion, RegistryValueKind.String);\n            UninstallerKey.SetValue(\"Publisher\", \"Julian Löhr\", RegistryValueKind.String);\n            UninstallerKey.SetValue(\"UninstallString\", string.Format(\"\\\"{0}\\\"\", UninstallCommnad), RegistryValueKind.String);\n            UninstallerKey.SetValue(\"HelpLink\", \"https://www.julianloehr.de/educational-work/hid-wiimote/\", RegistryValueKind.String);\n\n            return true;\n        }\n\n        private static RegistryKey GetHIDWiimoteUninstallKey()\n        {\n            return Registry.LocalMachine.OpenSubKey(UninstallKey, false);\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Setup/InstallStepAction/CopyFile.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tCopyFile.cs\n\nAbstract:\n\tInstall Task to copy some files\n\n*/\nnamespace HIDWiimote.ControlCenter.Setup.InstallStepAction\n{\n    class CopyFile : IInstallStepAction\n    {\n        string FileName;\n        string InstallDir;\n        string InstallFilePath;\n\n        public CopyFile(string FileName, string InstallDir)\n        {\n            this.FileName = FileName;\n            this.InstallDir = InstallDir;\n\n            this.InstallFilePath = System.IO.Path.Combine(InstallDir, FileName);\n        }\n\n        public bool Do()\n        {\n            if (System.IO.File.Exists(InstallFilePath))\n            {\n                return false;\n            }\n\n            System.IO.File.Copy(FileName, InstallFilePath);\n            return true;\n        }\n\n        public void Undo()\n        {\n            System.IO.File.Delete(InstallFilePath);\n        }\n\n        public string GetExceptionMessage()\n        {\n            return \"An error occured while copying files!\";\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Setup/InstallStepAction/CreateRegistryUninstallKey.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tCreateRegistryUninstallKey.cs\n\nAbstract:\n\tInstall Task to create the Uninstaller Registry Key\n\n*/\nnamespace HIDWiimote.ControlCenter.Setup.InstallStepAction\n{\n    class CreateRegistryUninstallKey : IInstallStepAction\n    {\n        string UninstallString;\n        string DPInstPath;\n\n        public CreateRegistryUninstallKey(string UninstallString, string DPInstPath)\n        {\n            this.UninstallString = UninstallString;\n            this.DPInstPath = DPInstPath;\n        }\n\n        public bool Do()\n        {\n            return DeviceDriverUninstallerRegistry.CreateHIDWiimoteUninstallKey(UninstallString, DPInstPath);\n        }\n\n        public void Undo()\n        {\n        }\n\n        public string GetExceptionMessage()\n        {\n            return \"An error occured while creating the \\\"Programs and Features\\\" entry!\";\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Setup/InstallStepAction/IInstallAction.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tIInstallStepAction.cs\n\nAbstract:\n\tInterface for Installer tasks\n\n*/\nnamespace HIDWiimote.ControlCenter.Setup.InstallStepAction\n{\n    interface IInstallStepAction\n    {\n        bool Do();\n        void Undo();\n        string GetExceptionMessage();\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Setup/InstallStepAction/RunDPInstall.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tRunDPInstall.cs\n\nAbstract:\n\tInstall Task to run dpinst.exe\n\n*/\nusing System.Diagnostics;\n\nnamespace HIDWiimote.ControlCenter.Setup.InstallStepAction\n{\n    class RunDPInstall : IInstallStepAction\n    {\n        string DPInstPath;\n        string InfFilePath;\n\n        public RunDPInstall(string DPInstPath, string InfFilePath)\n        {\n            this.DPInstPath = DPInstPath;\n            this.InfFilePath = InfFilePath;\n        }\n\n        public bool Do()\n        {\n            Process DPInst = Process.Start(DPInstPath);\n            DPInst.WaitForExit();\n\n            return (((uint)DPInst.ExitCode & 0x80000000) == 0);\n        }\n\n        public void Undo()\n        {\n            Process DPInst = Process.Start(DPInstPath, \"/q /u \" + InfFilePath);\n            DPInst.WaitForExit();\n        }\n\n        public string GetExceptionMessage()\n        {\n            return \"An error occured while running DPInst.exe!\";\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Setup/InstallStepAction/TextResourceToFile.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tTextResourceToFile.cs\n\nAbstract:\n\tInstall Task to write some string to a file\n\n*/\nnamespace HIDWiimote.ControlCenter.Setup.InstallStepAction\n{\n    class TextResourceToFile : IInstallStepAction\n    {\n        string OutputPath;\n        string FileContent;\n\n        public TextResourceToFile(string OutputPath, string FileContent)\n        {\n            this.OutputPath = OutputPath;\n            this.FileContent = FileContent;\n        }\n\n        public bool Do()\n        {\n            if (System.IO.File.Exists(OutputPath))\n            {\n                return false;\n            }\n\n            using (System.IO.StreamWriter UninstallerStreamWriter = new System.IO.StreamWriter(OutputPath))\n            {\n                UninstallerStreamWriter.Write(FileContent);\n            }\n\n            return true;\n        }\n\n        public void Undo()\n        {\n            System.IO.File.Delete(OutputPath);\n        }\n\n        public string GetExceptionMessage()\n        {\n            return \"An error occured while creating the uninstaller!\";\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Setup/SetupAction/Certificate.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tCertificate.cs\n\nAbstract:\n\tSetup Action to install and uninstall a certificate\n\n*/\nusing System.Security.Cryptography.X509Certificates;\n\nnamespace HIDWiimote.ControlCenter.Setup.SetupAction\n{\n    class Certificate : ISetupAction\n    {\n        X509Store Store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);\n        X509Certificate2 CertificateInstance = new X509Certificate2(HIDWiimote.ControlCenter.Properties.Installer.JulianLoehrCA);\n\n        public bool IsSetUp()\n        {\n            bool Result;\n\n            try\n            {\n                Store.Open(OpenFlags.ReadOnly);\n                Result = Store.Certificates.Contains(CertificateInstance);\n            }\n            catch\n            {\n                Result = false;\n            }\n            finally\n            {\n                Store.Close();\n            }\n\n            return Result;\n        }\n\n\n        public void TrySetUp()\n        {\n            try\n            {\n                Store.Open(OpenFlags.ReadWrite);\n                if (!Store.Certificates.Contains(CertificateInstance))\n                {\n                    Store.Add(CertificateInstance);\n                }\n            }\n            finally\n            {\n                Store.Close();\n            }\n        }\n\n        public void TryRevert()\n        {\n            try\n            {\n                Store.Open(OpenFlags.ReadWrite);\n                if (Store.Certificates.Contains(CertificateInstance))\n                {\n                    Store.Remove(CertificateInstance);\n                }\n            }\n            finally\n            {\n                Store.Close();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Setup/SetupAction/DeviceDriver.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tDeviceDriver.cs\n\nAbstract:\n\tSetup Action to install and uninstall the device driver\n\n*/\nnamespace HIDWiimote.ControlCenter.Setup.SetupAction\n{\n\n    class DeviceDriver : ISetupAction\n    {\n        public bool IsSetUp()\n        {\n            return Setup.DeviceDriver.IsInstalled();\n        }\n\n        public void TrySetUp()\n        {\n            Setup.DeviceDriver.Install();\n        }\n\n        public void TryRevert()\n        {\n            Setup.DeviceDriver.Uninstall();\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Setup/SetupAction/ISetupAction.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tISetupAction.cs\n\nAbstract:\n\tSetup Action Interface\n\n*/\nnamespace HIDWiimote.ControlCenter.Setup.SetupAction\n{\n    public interface ISetupAction\n    {\n        bool IsSetUp();\n        void TrySetUp();\n        void TryRevert();\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/Setup/SetupAction/TestMode.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tTestMode.cs\n\nAbstract:\n\tSetup Action to enable and disable Windows Test Mode\n\n*/\nusing System;\nusing System.Diagnostics;\n\nnamespace HIDWiimote.ControlCenter.Setup.SetupAction\n{\n    class TestMode : ISetupAction\n    {\n        private const string BCDEdit = \"bcdedit.exe\";\n        private const string Id = \"{current}\";\n        private const string TestSigningEntryName = \"testsigning\";\n        private const string TestSigningSetCommand = \"-set TESTSIGNING \";\n        private const string TestSigningSetCommandOn = TestSigningSetCommand + \"ON\";\n        private const string TestSigningSetCommandOff = TestSigningSetCommand + \"OFF\";\n\n        public bool IsSetUp()\n        {\n            string Result = RunBCDEdit(\"/enum \" + Id);\n\n            string[] Lines = Result.Split('\\n');\n            string TestsigningValue = Array.Find<string>(Lines, (string Line) => { return Line.StartsWith(TestSigningEntryName); });\n\n            return ((TestsigningValue != null) && TestsigningValue.Contains(\"Yes\"));\n        }\n\n        public void TrySetUp()\n        {\n            RunBCDEdit(TestSigningSetCommandOn);\n        }\n\n        public void TryRevert()\n        {\n            RunBCDEdit(TestSigningSetCommandOff);\n        }\n\n        private string RunBCDEdit(string Argument)\n        {\n            ProcessStartInfo StartInfo = new ProcessStartInfo(BCDEdit, Argument);\n            StartInfo.RedirectStandardOutput = true;\n            StartInfo.UseShellExecute = false;\n            StartInfo.CreateNoWindow = true;\n            StartInfo.WindowStyle = ProcessWindowStyle.Hidden;\n\n            Process New = Process.Start(StartInfo);\n            New.WaitForExit();\n\n            return New.StandardOutput.ReadToEnd();\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/UserControls/LEDDisplay.xaml",
    "content": "﻿<UserControl x:Class=\"HIDWiimote.ControlCenter.UserControls.LEDDisplay\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \n             xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\" \n             xmlns:local=\"clr-namespace:HIDWiimote.ControlCenter.UserControls\"\n             mc:Ignorable=\"d\" \n             d:DesignHeight=\"300\" d:DesignWidth=\"300\">\n    <UserControl.Resources>\n        <local:LEDStateToColorConverter x:Key=\"LEDStateToColorConverter\"\n                                        EnabledColor=\"#FF3070F0\"\n                                         />\n    </UserControl.Resources>\n    <StackPanel Orientation=\"Horizontal\" HorizontalAlignment=\"Center\">\n        <Rectangle Width=\"6\" Height=\"6\" Margin=\"6\" Stroke=\"Black\" Fill=\"{Binding LEDState, Converter={StaticResource LEDStateToColorConverter}, ConverterParameter=0, Mode=OneWay}\" />\n        <Rectangle Width=\"6\" Height=\"6\" Margin=\"6\" Stroke=\"Black\" Fill=\"{Binding LEDState, Converter={StaticResource LEDStateToColorConverter}, ConverterParameter=1, Mode=OneWay}\" />\n        <Rectangle Width=\"6\" Height=\"6\" Margin=\"6\" Stroke=\"Black\" Fill=\"{Binding LEDState, Converter={StaticResource LEDStateToColorConverter}, ConverterParameter=2, Mode=OneWay}\" />\n        <Rectangle Width=\"6\" Height=\"6\" Margin=\"6\" Stroke=\"Black\" Fill=\"{Binding LEDState, Converter={StaticResource LEDStateToColorConverter}, ConverterParameter=3, Mode=OneWay}\" />\n    </StackPanel>\n</UserControl>\n"
  },
  {
    "path": "HID Wiimote Control Center/UserControls/LEDDisplay.xaml.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tLEDDisplay.cs\n\nAbstract:\n\tUser Control for displaying the Wii Remote LEDs\n\n*/\nusing System;\nusing System.Globalization;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Media;\n\nnamespace HIDWiimote.ControlCenter.UserControls\n{\n    /// <summary>\n    /// Interaction logic for LEDDisplay.xaml\n    /// </summary>\n    public partial class LEDDisplay : UserControl\n    {\n        public LEDDisplay()\n        {\n            InitializeComponent();\n        }\n    }\n\n    public class LEDStateToColorConverter : IValueConverter\n    {\n        public SolidColorBrush EnabledColor { get; set; }\n        public SolidColorBrush DisabledColor { get; set; }\n\n        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\n        {\n            bool[] LEDState = (bool[])value;\n            uint LEDIndex = uint.MaxValue;\n\n            if (!uint.TryParse((string)parameter, out LEDIndex))\n            {\n                return DisabledColor;\n            }\n\n            if (LEDIndex >= LEDState.Length)\n            {\n                return DisabledColor;\n            }\n\n            return (LEDState[LEDIndex]) ? EnabledColor : DisabledColor;\n        }       \n\n        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)\n        {\n            throw new NotImplementedException();\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Control Center/UserControls/TaskList.xaml",
    "content": "﻿<UserControl x:Name=\"userControl\" x:Class=\"HIDWiimote.ControlCenter.UserControls.TaskList\"\r\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\r\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\r\n             xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \r\n             xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\" \r\n             xmlns:local=\"clr-namespace:HIDWiimote.ControlCenter.UserControls\"\r\n             mc:Ignorable=\"d\" \r\n             d:DesignHeight=\"450\" d:DesignWidth=\"800\">\r\n    <UserControl.Resources>\r\n        <!-- Bullet Point -->\r\n        <ControlTemplate x:Key=\"BulletPoint\" x:Name=\"BulletPoint\" TargetType=\"{x:Type ContentControl}\">\r\n            <BulletDecorator>\r\n                <BulletDecorator.Bullet>\r\n                    <Grid Width=\"16\">\r\n                        <Rectangle  Width=\"6\" Height=\"6\" >\r\n                            <Rectangle.Fill>\r\n                                <DrawingBrush>\r\n                                    <DrawingBrush.Drawing>\r\n                                        <DrawingGroup>\r\n                                            <DrawingGroup.Children>\r\n                                                <GeometryDrawing Brush=\"#00FFFFFF\" Geometry=\"F1M6,6L0,6 0,0 6,0z\" />\r\n                                                <GeometryDrawing Brush=\"#FFF6F6F6\" Geometry=\"F1M6,3C6,4.656 4.657,6 3,6 1.343,6 0,4.656 0,3 0,1.343 1.343,0 3,0 4.657,0 6,1.343 6,3\" />\r\n                                                <GeometryDrawing Brush=\"#FF424242\" Geometry=\"F1M5,3C5,4.104 4.104,5 3,5 1.896,5 1,4.104 1,3 1,1.896 1.896,1 3,1 4.104,1 5,1.896 5,3\" />\r\n                                            </DrawingGroup.Children>\r\n                                        </DrawingGroup>\r\n                                    </DrawingBrush.Drawing>\r\n                                </DrawingBrush>\r\n                            </Rectangle.Fill>\r\n                        </Rectangle>\r\n                    </Grid>\r\n                </BulletDecorator.Bullet>\r\n                <ContentPresenter />\r\n            </BulletDecorator>\r\n        </ControlTemplate>\r\n\r\n        <!-- Arrow -->\r\n        <ControlTemplate x:Key=\"Arrow\" TargetType=\"{x:Type ContentControl}\">\r\n            <BulletDecorator>\r\n                <BulletDecorator.Bullet>\r\n                    <Rectangle Width=\"16\" Height=\"16\">\r\n                        <Rectangle.Fill>\r\n                            <DrawingBrush>\r\n                                <DrawingBrush.Drawing>\r\n                                    <DrawingGroup>\r\n                                        <DrawingGroup.Children>\r\n                                            <GeometryDrawing Brush=\"#00FFFFFF\" Geometry=\"F1M16,16L0,16 0,0 16,0z\" />\r\n                                            <GeometryDrawing Brush=\"#FFF6F6F6\" Geometry=\"F1M11,4L1,4 1,4.748 4.252,8 1,11.252 1,12 11,12 16,8.249 16,7.751z\" />\r\n                                            <GeometryDrawing Brush=\"#FF414141\" Geometry=\"F1M10.666,5L2.666,5 5.666,8 2.666,11 10.666,11 14.666,8z\" />\r\n                                        </DrawingGroup.Children>\r\n                                    </DrawingGroup>\r\n                                </DrawingBrush.Drawing>\r\n                            </DrawingBrush>\r\n                        </Rectangle.Fill>\r\n                    </Rectangle>\r\n                </BulletDecorator.Bullet>\r\n                <ContentPresenter />\r\n            </BulletDecorator>\r\n        </ControlTemplate>\r\n\r\n        <!--Checkmark -->\r\n        <ControlTemplate x:Key=\"Checkmark\" TargetType=\"{x:Type ContentControl}\">\r\n            <BulletDecorator>\r\n                <BulletDecorator.Bullet>\r\n                    <Rectangle Width=\"16\" Height=\"16\">\r\n                        <Rectangle.Fill>\r\n                            <DrawingBrush>\r\n                                <DrawingBrush.Drawing>\r\n                                    <DrawingGroup>\r\n                                        <DrawingGroup.Children>\r\n                                            <GeometryDrawing Brush=\"#00FFFFFF\" Geometry=\"F1M16,16L0,16 0,0 16,0z\" />\r\n                                            <GeometryDrawing Brush=\"#FFF6F6F6\" Geometry=\"F1M5.3818,13L2.3818,7 6.6178,7 6.9998,7.764 9.3818,3 13.6178,3 8.6178,13z\" />\r\n                                            <GeometryDrawing Brush=\"#FF388A34\" Geometry=\"F1M12,3.9995L8,11.9995 6,11.9995 4,7.9995 6,7.9995 7,9.9995 10,3.9995z\" />\r\n                                        </DrawingGroup.Children>\r\n                                    </DrawingGroup>\r\n                                </DrawingBrush.Drawing>\r\n                            </DrawingBrush>\r\n                        </Rectangle.Fill>\r\n                    </Rectangle>\r\n                </BulletDecorator.Bullet>\r\n                <ContentPresenter />\r\n            </BulletDecorator>\r\n        </ControlTemplate>\r\n\r\n        <!-- Error -->\r\n        <ControlTemplate x:Key=\"Error\" TargetType=\"{x:Type ContentControl}\">\r\n            <BulletDecorator>\r\n                <BulletDecorator.Bullet>\r\n                    <Rectangle Width=\"16\" Height=\"16\">\r\n                        <Rectangle.Fill>\r\n                            <DrawingBrush>\r\n                                <DrawingBrush.Drawing>\r\n                                    <DrawingGroup>\r\n                                        <DrawingGroup.Children>\r\n                                            <GeometryDrawing Brush=\"#00FFFFFF\" Geometry=\"F1M16,16L0,16 0,0 16,0z\" />\r\n                                            <GeometryDrawing Brush=\"#FFF6F6F6\" Geometry=\"F1M16,8C16,12.418 12.418,16 8,16 3.582,16 0,12.418 0,8 0,3.582 3.582,0 8,0 12.418,0 16,3.582 16,8\" />\r\n                                            <GeometryDrawing Brush=\"#FFE41400\" Geometry=\"F1M12.4141,11L11.0001,12.414 8.0001,9.414 5.0001,12.414 3.5861,11 6.5861,8 3.5861,5 5.0001,3.586 8.0001,6.586 11.0001,3.586 12.4141,5 9.4141,8z M8.0001,1C4.1341,1 1.0001,4.135 1.0001,8 1.0001,11.865 4.1341,15 8.0001,15 11.8651,15 15.0001,11.865 15.0001,8 15.0001,4.135 11.8651,1 8.0001,1\" />\r\n                                            <GeometryDrawing Brush=\"#FFFFFFFF\" Geometry=\"F1M9.4141,8L12.4141,11 11.0001,12.414 8.0001,9.414 5.0001,12.414 3.5861,11 6.5861,8 3.5861,5 5.0001,3.586 8.0001,6.586 11.0001,3.586 12.4141,5z\" />\r\n                                        </DrawingGroup.Children>\r\n                                    </DrawingGroup>\r\n                                </DrawingBrush.Drawing>\r\n                            </DrawingBrush>\r\n                        </Rectangle.Fill>\r\n                    </Rectangle>\r\n                </BulletDecorator.Bullet>\r\n                <ContentPresenter />\r\n            </BulletDecorator>\r\n        </ControlTemplate>\r\n\r\n        <!-- Value Converters -->\r\n        <local:StatusToBulletPointValueConverter x:Key=\"StatusToBulletPointValueConverter\" \r\n                                                 BulletPoint=\"{StaticResource BulletPoint}\"\r\n                                                 Arrow=\"{StaticResource Arrow}\"\r\n                                                 Checkmark=\"{StaticResource Checkmark}\"\r\n                                                 Error=\"{StaticResource Error}\" />\r\n    </UserControl.Resources>\r\n    <ListBox ItemsSource=\"{Binding DataContext, ElementName=userControl}\">\r\n        <ListBox.ItemTemplate>\r\n            <DataTemplate>\r\n                <ContentControl Template=\"{Binding Status, Converter={StaticResource StatusToBulletPointValueConverter}}\" >\r\n                    <Label Content=\"{Binding DisplayMessage}\" FontSize=\"16\" />\r\n                </ContentControl>\r\n            </DataTemplate>\r\n        </ListBox.ItemTemplate>\r\n        <!--ContentControl Template=\"{StaticResource Checkmark}\" >\r\n            <Label Content=\"Remove old Driver Package\" FontSize=\"16\" />\r\n        </>\r\n        <ContentControl Template=\"{StaticResource Error}\" >\r\n            <Label Content=\"Extracting Data\" FontSize=\"16\" />\r\n        </ContentControl>\r\n        <ContentControl Template=\"{StaticResource Arrow}\" >\r\n            <Label Content=\"Install new Driver Package\" FontSize=\"16\" />\r\n        </ContentControl>\r\n        <ContentControl Template=\"{StaticResource BulletPoint}\" >\r\n            <Label Content=\"Install other Stuff\" FontSize=\"16\" />\r\n        </ContentControl-->\r\n    </ListBox>\r\n</UserControl>\r\n"
  },
  {
    "path": "HID Wiimote Control Center/UserControls/TaskList.xaml.cs",
    "content": "﻿/*\n\nCopyright (C) 2018 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tTaskList.xaml.cs\n\nAbstract:\n\tUser Control for displaying a list of tasks that are processed\n\n*/\r\nusing System;\r\nusing System.ComponentModel;\r\nusing System.Globalization;\r\nusing System.Threading.Tasks;\r\nusing System.Windows.Controls;\r\nusing System.Windows.Data;\r\n\r\nnamespace HIDWiimote.ControlCenter.UserControls\r\n{\r\n    /// <summary>\r\n    /// Interaction logic for TaskList.xaml\r\n    /// </summary>\r\n    public partial class TaskList : UserControl\r\n    {\r\n        public TaskList()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        public class Item : INotifyPropertyChanged\n        {\n            public enum TaskStatus { Waiting, Running, Finished, Error };\n\n            public event PropertyChangedEventHandler PropertyChanged;\n\n            private string _DisplayMessage;\n            private TaskStatus _Status;\n\n            private Task<bool> QueuedTask;\n\n            public Item(string DisplayMessage, Func<bool> QueuedTask)\n            {\n                this.DisplayMessage = DisplayMessage;\n                this.Status = TaskStatus.Waiting;\n                this.QueuedTask = new Task<bool>(QueuedTask);\n            }\n\n            public Item(string DisplayMessage, TaskStatus Status)\n            {\n                this.DisplayMessage = DisplayMessage;\n                this.Status = Status;\n            }\n\n            public string DisplayMessage\n            {\n                get { return _DisplayMessage; }\n                set\n                {\n                    _DisplayMessage = value;\n                    OnPropertyChanged(\"DisplayMessage\");\n                }\n            }\n\n            public TaskStatus Status\n            {\n                get { return _Status; }\n                set\n                {\n                    _Status = value;\n                    OnPropertyChanged(\"Status\");\n                }\n            }\n\n            public void StartTask(Action<Task<bool>, Object> CompleteCallback)\n            {\n                Status = TaskStatus.Running;\n                QueuedTask.ContinueWith(CompleteCallback, this, TaskScheduler.FromCurrentSynchronizationContext());\n                // Do some delay, so the user can graps the steps\n                System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(0.5)).ContinueWith(DelayTask => { QueuedTask.Start(TaskScheduler.Default); });\n            }\n\n            protected void OnPropertyChanged(string PropertyName)\n            {\n                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(PropertyName));\n            }\n        }\r\n    }\r\n\r\n    public class StatusToBulletPointValueConverter : IValueConverter\n    {\n        public ControlTemplate BulletPoint { get; set; }\n        public ControlTemplate Arrow { get; set; }\n        public ControlTemplate Checkmark { get; set; }\n        public ControlTemplate Error { get; set; }\n\n        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\n        {\n            TaskList.Item.TaskStatus Status = (TaskList.Item.TaskStatus)value;\n\n            switch (Status)\n            {\n                case TaskList.Item.TaskStatus.Waiting:\n                    return BulletPoint;\n                case TaskList.Item.TaskStatus.Running:\n                    return Arrow;\n                case TaskList.Item.TaskStatus.Finished:\n                    return Checkmark;\n                case TaskList.Item.TaskStatus.Error:\n                    return Error;\n                default:\n                    return BulletPoint;\n            }\n        }\n\n        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)\n        {\n            throw new NotImplementedException();\n        }\n    }\r\n}\r\n"
  },
  {
    "path": "HID Wiimote Control Center/Utility/SingleInstanceProtector.cs",
    "content": "﻿/*\n\nCopyright (C) 2017 Julian Löhr\nAll rights reserved.\n\nFilename:\n\tSingleInstanceProtector.cs\n\nAbstract:\n    Single program instance protector\n\n*/\nusing System;\nusing System.Diagnostics;\nusing System.Reflection;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace HIDWiimote.ControlCenter\n{\n    class SingleInstanceProtector\n    {\n\n        [DllImport(\"user32.dll\")]\n        private static extern bool SetForegroundWindow(IntPtr hWnd);\n        [DllImport(\"user32.dll\")]\n        private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);\n        [DllImport(\"user32.dll\")]\n        private static extern bool IsIconic(IntPtr hWnd);\n\n        private const int SW_RESTORE = 9;\n\n        private const string MutexGUID = \"{29E5C640-0885-47E3-A4B2-8F4A2D96F9AD}\";\n        private Mutex InstanceMutex;\n        private bool MutexCreated;\n\n        public SingleInstanceProtector()\n        {\n            InstanceMutex = new Mutex(true, MutexGUID, out MutexCreated);\n            if (MutexCreated)\n            {\n                App.Current.Exit += OnAppExit;\n            }\n        }\n\n        public bool IsFirstInstance()\n        {\n            return (MutexCreated == true);\n        }\n\n        private void OnAppExit(object sender, System.Windows.ExitEventArgs e)\n        {\n            InstanceMutex.ReleaseMutex();\n        }\n\n        public void ShowOtherAppInstance()\n        {\n            string AssemblyName = Assembly.GetExecutingAssembly().GetName().Name;\n            int ThisProcessId = Process.GetCurrentProcess().Id;\n\n            foreach (Process Other in Process.GetProcessesByName(AssemblyName))\n            {\n                if (Other.Id == ThisProcessId)\n                {\n                    continue;\n                }\n\n                if (IsIconic(Other.MainWindowHandle))\n                {\n                    ShowWindowAsync(Other.MainWindowHandle, SW_RESTORE);\n                }\n\n                SetForegroundWindow(Other.MainWindowHandle);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "HID Wiimote Package/DPInst.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<dpinst>\n  <legacyMode />\n  <suppressAddRemovePrograms />\n  <enableNotListedLanguages />\n  <language code=\"0x401\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x804\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x404\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x405\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x406\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x407\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x408\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x409\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0xC0A\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x40B\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x40C\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x40D\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x40E\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x410\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x411\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x412\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x414\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x413\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x415\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x416\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x816\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x419\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x41D\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n  <language code=\"0x41F\">\n    <eula type=\"txt\" path=\"EULA.txt\" />\n  </language>\n</dpinst>"
  },
  {
    "path": "HID Wiimote Package/EULA.txt",
    "content": "TLDR: You don't need to pay for it. Don't use this software to harm or kill anybody. Use on your own risk. Don't sue me later, when it breaks or causes any damage.\n\nHID Wiimote is free for use in any environment, including but not necessarily limited to: personal, academic, commercial, government, business, non-profit, and for-profit. \"Free\" in the preceding sentence means that there is no cost or charge associated with the installation and use of HID Wiimote.\n\nYou may reproduce and distribute an unlimited number of copies of this software; provided that each copy shall be a true and complete copy, including all copyright and trademark notices, and shall be accompanied by a copy of this EULA.\n\nCopies of the software may be distributed as a standalone product or included with your own product as long as the software is not sold or included in a product or package that intends to receive benefits through the inclusion of this software.\n\nLIMITED WARRANTY\n\nNO WARRANTIES.\nThe Author of this Software expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation is provided “as is” without warranty of any kind, either express or implied, including, without limitation, the implied warranties or merchantability, fitness for a particular purpose, or noninfringement. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you.\n\nNO LIABILITY FOR DAMAGES.\nIn no event shall the author of this Software be liable for any special, consequential, incidental or indirect damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use this product, even if the Author of this Software is aware of the possibility of such damages and known defects.\n"
  },
  {
    "path": "HID Wiimote Package/HID Wiimote Package.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Windows 10 Universal Debug|Win32\">\r\n      <Configuration>Windows 10 Universal Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Universal Debug|x64\">\r\n      <Configuration>Windows 10 Universal Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Universal Release|Win32\">\r\n      <Configuration>Windows 10 Universal Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Universal Release|x64\">\r\n      <Configuration>Windows 10 Universal Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Debug|Win32\">\r\n      <Configuration>Windows 10 Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Release|Win32\">\r\n      <Configuration>Windows 10 Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Debug|x64\">\r\n      <Configuration>Windows 10 Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Windows 10 Release|x64\">\r\n      <Configuration>Windows 10 Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}</ProjectGuid>\r\n    <TemplateGuid>{4605da2c-74a5-4865-98e1-152ef136825f}</TemplateGuid>\r\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r\n    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>\r\n    <Configuration>Win8 Debug</Configuration>\r\n    <Platform Condition=\"'$(Platform)' == ''\">Win32</Platform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <RootNamespace>HID_Wiimote_Package</RootNamespace>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"PropertySheets\">\r\n    <ConfigurationType>Utility</ConfigurationType>\r\n    <DriverType>Package</DriverType>\r\n    <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|Win32'\">\r\n    <TargetVersion>Windows10</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <DriverTargetPlatform>\r\n    </DriverTargetPlatform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>\r\n    </TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <DriverTargetPlatform>Universal</DriverTargetPlatform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n    <TargetVersion>Windows10</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>\r\n    </TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <DriverTargetPlatform>Universal</DriverTargetPlatform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|x64'\">\r\n    <TargetVersion>Windows10</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <DriverTargetPlatform>\r\n    </DriverTargetPlatform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>\r\n    </TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <DriverTargetPlatform>Universal</DriverTargetPlatform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Configuration\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">\r\n    <TargetVersion>Windows10</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>\r\n    </TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>\r\n    <DriverTargetPlatform>Universal</DriverTargetPlatform>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup>\r\n    <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>\r\n    <EnableDeployment>False</EnableDeployment>\r\n    <RemoveDriver>True</RemoveDriver>\r\n    <HardwareIdString />\r\n    <CommandLine />\r\n    <DeployFiles />\r\n    <EnableVerifier>False</EnableVerifier>\r\n    <AllDrivers>False</AllDrivers>\r\n    <VerifyProjectOutput>True</VerifyProjectOutput>\r\n    <VerifyDrivers />\r\n    <VerifyFlags>133563</VerifyFlags>\r\n    <PackageDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\HID Wiimote Package</PackageDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n    <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n    <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n    <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n    <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|x64'\">\r\n    <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|x64'\">\r\n    <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">\r\n    <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\">\r\n    <Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|Win32'\">\r\n    <DriverSign>\r\n      <FileDigestAlgorithm>SHA256</FileDigestAlgorithm>\r\n    </DriverSign>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n    <DriverSign>\r\n      <FileDigestAlgorithm>SHA256</FileDigestAlgorithm>\r\n    </DriverSign>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|x64'\">\r\n    <DriverSign>\r\n      <FileDigestAlgorithm>SHA256</FileDigestAlgorithm>\r\n    </DriverSign>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">\r\n    <DriverSign>\r\n      <FileDigestAlgorithm>SHA256</FileDigestAlgorithm>\r\n    </DriverSign>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <FilesToPackage Include=\"DIFx\\$(PlatformShortName)\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"DIFx\\$(PlatformShortName)\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\">\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"DIFx\\$(PlatformShortName)\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"DIFx\\$(PlatformShortName)\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\">\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"..\\$(Platform)\\$(ConfigurationName)\\HIDMiniport.pdb\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|x64'\">\r\n      <PackageRelativeDirectory>Debug</PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"..\\$(Platform)\\$(ConfigurationName)\\HIDMiniport.pdb\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|x64'\">\r\n      <PackageRelativeDirectory>Debug</PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"..\\$(Platform)\\$(ConfigurationName)\\HIDWiimote.pdb\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|x64'\">\r\n      <PackageRelativeDirectory>Debug</PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"..\\$(Platform)\\$(ConfigurationName)\\HIDWiimote.pdb\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|x64'\">\r\n      <PackageRelativeDirectory>Debug</PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"..\\HID Wiimote\\$(Platform)\\$(ConfigurationName)\\vc140.pdb\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Debug|x64'\">\r\n      <PackageRelativeDirectory>Debug</PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"..\\HID Wiimote\\$(Platform)\\$(ConfigurationName)\\vc140.pdb\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Debug|x64'\">\r\n      <PackageRelativeDirectory>Debug</PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"@(Inf->'%(CopyOutput)')\" Condition=\"'@(Inf)'!=''\" />\r\n    <FilesToPackage Include=\"DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"EULA.txt\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"EULA.txt\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"EULA.txt\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"EULA.txt\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"Readme.txt\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"Readme.txt\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"Readme.txt\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"Readme.txt\" Condition=\"'$(Configuration)|$(Platform)'=='Windows 10 Universal Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"..\\HID Wiimote Control Center\\bin\\$(PlatformShortName)\\Debug\\HID Wiimote Control Center.exe\" Condition=\"'$(Configuration)'=='Windows 10 Debug'\" />\r\n    <FilesToPackage Include=\"..\\HID Wiimote Control Center\\bin\\$(PlatformShortName)\\Release\\HID Wiimote Control Center.exe\" Condition=\"'$(Configuration)'=='Windows 10 Release'\" />\r\n    <FilesToPackage Include=\"..\\HID Wiimote User Mode\\$(PlatformShortName)\\Debug\\HID Wiimote User Mode.dll\" Condition=\"'$(Configuration)'=='Windows 10 Debug'\" />\r\n    <FilesToPackage Include=\"..\\HID Wiimote User Mode\\$(PlatformShortName)\\Release\\HID Wiimote User Mode.dll\" Condition=\"'$(Configuration)'=='Windows 10 Release'\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ProjectReference Include=\"..\\HID Miniport\\HID Miniport.vcxproj\">\r\n      <Project>{3baff0eb-1b25-4e8e-8189-267b6686d7bc}</Project>\r\n    </ProjectReference>\r\n    <ProjectReference Include=\"..\\HID Wiimote\\HID Wiimote.vcxproj\">\r\n      <Project>{785d88e1-e758-4966-80fa-aef74681fef1}</Project>\r\n    </ProjectReference>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Xml Include=\"DPInst.xml\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Text Include=\"EULA.txt\" />\r\n    <Text Include=\"Readme.txt\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "HID Wiimote Package/HID Wiimote Package.vcxproj.backup",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Win8 Debug|Win32\">\r\n      <Configuration>Win8 Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win8 Release|Win32\">\r\n      <Configuration>Win8 Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win7 Debug|Win32\">\r\n      <Configuration>Win7 Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win7 Release|Win32\">\r\n      <Configuration>Win7 Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Vista Debug|Win32\">\r\n      <Configuration>Vista Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Vista Release|Win32\">\r\n      <Configuration>Vista Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win8 Debug|x64\">\r\n      <Configuration>Win8 Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win8 Release|x64\">\r\n      <Configuration>Win8 Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win7 Debug|x64\">\r\n      <Configuration>Win7 Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Win7 Release|x64\">\r\n      <Configuration>Win7 Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Vista Debug|x64\">\r\n      <Configuration>Vista Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Vista Release|x64\">\r\n      <Configuration>Vista Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}</ProjectGuid>\r\n    <TemplateGuid>{4605da2c-74a5-4865-98e1-152ef136825f}</TemplateGuid>\r\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r\n    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>\r\n    <Configuration>Win8 Debug</Configuration>\r\n    <Platform Condition=\"'$(Platform)' == ''\">Win32</Platform>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <RootNamespace>HID_Wiimote_Package</RootNamespace>\r\n    <VCTargetsPath Condition=\"'$(VCTargetsPath11)' != '' and '$(VisualStudioVersion)' == '11.0'\">$(VCTargetsPath11)</VCTargetsPath>\r\n  </PropertyGroup>\r\n  <PropertyGroup Label=\"PropertySheets\">\r\n    <PlatformToolset>WindowsKernelModeDriver8.0</PlatformToolset>\r\n    <ConfigurationType>Utility</ConfigurationType>\r\n    <DriverType>Package</DriverType>\r\n    <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows8</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows8</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows7</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows7</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Vista</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|Win32'\" Label=\"Configuration\">\r\n    <TargetVersion>Vista</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows8</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows8</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows7</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Windows7</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Vista</TargetVersion>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|x64'\" Label=\"Configuration\">\r\n    <TargetVersion>Vista</TargetVersion>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup>\r\n    <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>\r\n    <EnableDeployment>False</EnableDeployment>\r\n    <RemoveDriver>True</RemoveDriver>\r\n    <HardwareIdString />\r\n    <CommandLine />\r\n    <DeployFiles />\r\n    <EnableVerifier>False</EnableVerifier>\r\n    <AllDrivers>False</AllDrivers>\r\n    <VerifyProjectOutput>True</VerifyProjectOutput>\r\n    <VerifyDrivers />\r\n    <VerifyFlags>133563</VerifyFlags>\r\n    <PackageDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\HID Wiimote Package</PackageDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|Win32'\">\r\n    <OutDir>$(SolutionDir)$(PlatformShortName)\\$(ConfigurationName)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(ConfigurationName)\\</IntDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|Win32'\">\r\n    <Inf2Cat>\r\n      <UseLocalTime>true</UseLocalTime>\r\n    </Inf2Cat>\r\n    <PreLinkEvent>\r\n      <Command>\r\n      </Command>\r\n    </PreLinkEvent>\r\n    <PostBuildEvent>\r\n      <Command>d:\\Tools\\7za920\\7za.exe d \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"\r\nd:\\Tools\\7za920\\7za.exe a \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(PackageDir)\\*\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'\">\r\n    <Inf2Cat>\r\n      <UseLocalTime>true</UseLocalTime>\r\n    </Inf2Cat>\r\n    <PreLinkEvent>\r\n      <Command>\r\n      </Command>\r\n    </PreLinkEvent>\r\n    <PostBuildEvent>\r\n      <Command>d:\\Tools\\7za920\\7za.exe d \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"\r\nd:\\Tools\\7za920\\7za.exe a \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(PackageDir)\\*\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|Win32'\">\r\n    <Inf2Cat>\r\n      <UseLocalTime>true</UseLocalTime>\r\n    </Inf2Cat>\r\n    <PreLinkEvent>\r\n      <Command>\r\n      </Command>\r\n    </PreLinkEvent>\r\n    <PostBuildEvent>\r\n      <Command>d:\\Tools\\7za920\\7za.exe d \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"\r\nd:\\Tools\\7za920\\7za.exe a \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(PackageDir)\\*\"\r\nmove /y \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(SolutionDir)Zip\\$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'\">\r\n    <Inf2Cat>\r\n      <UseLocalTime>true</UseLocalTime>\r\n    </Inf2Cat>\r\n    <PreLinkEvent>\r\n      <Command>\r\n      </Command>\r\n    </PreLinkEvent>\r\n    <PostBuildEvent>\r\n      <Command>d:\\Tools\\7za920\\7za.exe d \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"\r\nd:\\Tools\\7za920\\7za.exe a \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(PackageDir)\\*\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|Win32'\">\r\n    <Inf2Cat>\r\n      <UseLocalTime>true</UseLocalTime>\r\n    </Inf2Cat>\r\n    <PreLinkEvent>\r\n      <Command>\r\n      </Command>\r\n    </PreLinkEvent>\r\n    <PostBuildEvent>\r\n      <Command>d:\\Tools\\7za920\\7za.exe d \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"\r\nd:\\Tools\\7za920\\7za.exe a \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(PackageDir)\\*\"\r\nmove /y \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(SolutionDir)Zip\\$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|Win32'\">\r\n    <Inf2Cat>\r\n      <UseLocalTime>true</UseLocalTime>\r\n    </Inf2Cat>\r\n    <PreLinkEvent>\r\n      <Command>\r\n      </Command>\r\n    </PreLinkEvent>\r\n    <PostBuildEvent>\r\n      <Command>d:\\Tools\\7za920\\7za.exe d \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"\r\nd:\\Tools\\7za920\\7za.exe a \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(PackageDir)\\*\"\r\nmove /y \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(SolutionDir)Zip\\$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|x64'\">\r\n    <Inf2Cat>\r\n      <UseLocalTime>true</UseLocalTime>\r\n    </Inf2Cat>\r\n    <PreLinkEvent>\r\n      <Command>\r\n      </Command>\r\n    </PreLinkEvent>\r\n    <PostBuildEvent>\r\n      <Command>d:\\Tools\\7za920\\7za.exe d \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"\r\nd:\\Tools\\7za920\\7za.exe a \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(PackageDir)\\*\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|x64'\">\r\n    <Inf2Cat>\r\n      <UseLocalTime>true</UseLocalTime>\r\n    </Inf2Cat>\r\n    <PreLinkEvent>\r\n      <Command>\r\n      </Command>\r\n    </PreLinkEvent>\r\n    <PostBuildEvent>\r\n      <Command>d:\\Tools\\7za920\\7za.exe d \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"\r\nd:\\Tools\\7za920\\7za.exe a \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(PackageDir)\\*\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|x64'\">\r\n    <Inf2Cat>\r\n      <UseLocalTime>true</UseLocalTime>\r\n    </Inf2Cat>\r\n    <PreLinkEvent>\r\n      <Command>\r\n      </Command>\r\n    </PreLinkEvent>\r\n    <PostBuildEvent>\r\n      <Command>d:\\Tools\\7za920\\7za.exe d \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"\r\nd:\\Tools\\7za920\\7za.exe a \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(PackageDir)\\*\"\r\nmove /y \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(SolutionDir)Zip\\$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|x64'\">\r\n    <Inf2Cat>\r\n      <UseLocalTime>true</UseLocalTime>\r\n    </Inf2Cat>\r\n    <PreLinkEvent>\r\n      <Command>\r\n      </Command>\r\n    </PreLinkEvent>\r\n    <PostBuildEvent>\r\n      <Command>d:\\Tools\\7za920\\7za.exe d \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"\r\nd:\\Tools\\7za920\\7za.exe a \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(PackageDir)\\*\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|x64'\">\r\n    <Inf2Cat>\r\n      <UseLocalTime>true</UseLocalTime>\r\n    </Inf2Cat>\r\n    <PreLinkEvent>\r\n      <Command>\r\n      </Command>\r\n    </PreLinkEvent>\r\n    <PostBuildEvent>\r\n      <Command>d:\\Tools\\7za920\\7za.exe d \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"\r\nd:\\Tools\\7za920\\7za.exe a \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(PackageDir)\\*\"\r\nmove /y \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(SolutionDir)Zip\\$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|x64'\">\r\n    <Inf2Cat>\r\n      <UseLocalTime>true</UseLocalTime>\r\n    </Inf2Cat>\r\n    <PreLinkEvent>\r\n      <Command>\r\n      </Command>\r\n    </PreLinkEvent>\r\n    <PostBuildEvent>\r\n      <Command>d:\\Tools\\7za920\\7za.exe d \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"\r\nd:\\Tools\\7za920\\7za.exe a \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(PackageDir)\\*\"\r\nmove /y \"$(TargetDir)$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\" \"$(SolutionDir)Zip\\$(SolutionName.replace(' ','-'))-$(TargetVersion.replace('dows', ''))-$(PlatformArchitecture)Bit.zip\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <FilesToPackage Include=\"@(Inf->'%(CopyOutput)')\" Condition=\"'@(Inf)'!=''\" />\r\n    <FilesToPackage Include=\"C:\\Program Files (x86)\\Windows Kits\\8.0\\Redist\\DIFx\\dpinst\\MultiLin\\x64\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Program Files (x86)\\Windows Kits\\8.0\\Redist\\DIFx\\dpinst\\MultiLin\\x64\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Program Files (x86)\\Windows Kits\\8.0\\Redist\\DIFx\\dpinst\\MultiLin\\x64\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Program Files (x86)\\Windows Kits\\8.0\\Redist\\DIFx\\dpinst\\MultiLin\\x64\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Program Files (x86)\\Windows Kits\\8.0\\Redist\\DIFx\\dpinst\\MultiLin\\x64\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Program Files (x86)\\Windows Kits\\8.0\\Redist\\DIFx\\dpinst\\MultiLin\\x64\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Program Files (x86)\\Windows Kits\\8.0\\Redist\\DIFx\\dpinst\\MultiLin\\x86\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Program Files (x86)\\Windows Kits\\8.0\\Redist\\DIFx\\dpinst\\MultiLin\\x86\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Program Files (x86)\\Windows Kits\\8.0\\Redist\\DIFx\\dpinst\\MultiLin\\x86\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Program Files (x86)\\Windows Kits\\8.0\\Redist\\DIFx\\dpinst\\MultiLin\\x86\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Program Files (x86)\\Windows Kits\\8.0\\Redist\\DIFx\\dpinst\\MultiLin\\x86\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Program Files (x86)\\Windows Kits\\8.0\\Redist\\DIFx\\dpinst\\MultiLin\\x86\\dpinst.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\OneDrive\\Projekte\\HID Wiimote\\DPInst\\DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\OneDrive\\Projekte\\HID Wiimote\\HID Wiimote\\x64\\Win8Debug\\vc110.pdb\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|x64'\">\r\n      <PackageRelativeDirectory>Debug</PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\OneDrive\\Projekte\\HID Wiimote\\TinyInstaller\\bin\\Release\\TinyInstaller.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\OneDrive\\Projekte\\HID Wiimote\\x64\\Win8Debug\\HIDMiniport.pdb\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|x64'\">\r\n      <PackageRelativeDirectory>Debug</PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\OneDrive\\Projekte\\HID Wiimote\\x64\\Win8Debug\\HIDWiimote.pdb\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|x64'\">\r\n      <PackageRelativeDirectory>Debug</PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\DPInst\\DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\DPInst\\DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\DPInst\\DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\DPInst\\DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\DPInst\\DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\DPInst\\DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\DPInst\\DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\DPInst\\DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\DPInst\\DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\DPInst\\DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\DPInst\\DPInst.xml\" Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\TinyInstaller\\bin\\Release\\TinyInstaller.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\TinyInstaller\\bin\\Release\\TinyInstaller.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\TinyInstaller\\bin\\Release\\TinyInstaller.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\TinyInstaller\\bin\\Release\\TinyInstaller.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\TinyInstaller\\bin\\Release\\TinyInstaller.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|x64'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\TinyInstaller\\bin\\Release\\TinyInstaller.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\TinyInstaller\\bin\\Release\\TinyInstaller.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win8 Debug|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\TinyInstaller\\bin\\Release\\TinyInstaller.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win7 Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\TinyInstaller\\bin\\Release\\TinyInstaller.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Win7 Debug|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\TinyInstaller\\bin\\Release\\TinyInstaller.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Vista Release|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n    <FilesToPackage Include=\"C:\\Users\\Julian\\SkyDrive\\Projekte\\HID Wiimote\\TinyInstaller\\bin\\Release\\TinyInstaller.exe\" Condition=\"'$(Configuration)|$(Platform)'=='Vista Debug|Win32'\">\r\n      <PackageRelativeDirectory>\r\n      </PackageRelativeDirectory>\r\n    </FilesToPackage>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ProjectReference Include=\"..\\HID Miniport\\HID Miniport.vcxproj\">\r\n      <Project>{3baff0eb-1b25-4e8e-8189-267b6686d7bc}</Project>\r\n    </ProjectReference>\r\n    <ProjectReference Include=\"..\\HID Wiimote\\HID Wiimote.vcxproj\">\r\n      <Project>{785d88e1-e758-4966-80fa-aef74681fef1}</Project>\r\n    </ProjectReference>\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "HID Wiimote Package/HID Wiimote Package.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Driver Files\">\r\n      <UniqueIdentifier>{8E41214B-6785-4CFE-B992-037D68949A14}</UniqueIdentifier>\r\n      <Extensions>inf;inv;inx;mof;mc;</Extensions>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Xml Include=\"DPInst.xml\">\r\n      <Filter>Driver Files</Filter>\r\n    </Xml>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Text Include=\"EULA.txt\">\r\n      <Filter>Driver Files</Filter>\r\n    </Text>\r\n    <Text Include=\"Readme.txt\">\r\n      <Filter>Driver Files</Filter>\r\n    </Text>\r\n  </ItemGroup>\r\n</Project>"
  },
  {
    "path": "HID Wiimote Package/Readme.txt",
    "content": "HID Wiimote 0.4.0.0\n\nHID Wiimote is a Windows Device Driver for the Nintendo Wii Remote.\n\nProject Homepage: https://www.julianloehr.de/educational-work/hid-wiimote/\nSupported Windows Versions: 10 and higher\n\nThis software is provided free of charge. If you have paid for this, please claim a refund and report this site to: info@julianloehr.de\n\nIf you like this project and really want to pay for it, see my homepage (https://www.julianloehr.de) for donations.\n\n-- Changelog --\n\n-- 0.4.0.0 --\n\n-- Final release\n-- Upgrade to Visual Studio 2022, Windows SDK 11 and Windows WDK 11\n-- Removed support for Windows 7, 8, 8.1, because Windows WDK 11 only allows for Windows 10 and higher\n-- Fix Apps and Features uninstall button not working\n-- Fix zip step if path contains spaces\n\n-- 0.3.0.3 --\n\n-- Upgrade to Visual Studio 2017 and current Fall Creators Update SDK and WDK (10.0.16299)\n-- Add an unhandled exception handler to the Control Center\n-- Fix #38: Change unit from Radians to Degree\n-- Fix #40: Change guitar whammy bar and touchbar mapping from RX and RY to Z and RZ\n-- Fix #41: Home button mapped to wrong output when using Nunchuck\n\n-- 0.3.0.2 --\n\n-- Change checking Extension subtype\n-- Add Product and Serial string support\n-- Add minor delay to update process for UX \n-- Change wording from \"Switch\" to \"Swap\"\n\n-- 0.3.0.1 --\n\n- Fix #24 & Fix #31: Fix Guitar Hero Buttons, Whammy and Touch bar\n- Fix not detecting certain GH Accessories\n- Change default settings for new unknown devices to have accelerometer and trigger axis enabled\n\n-- 0.3.0.0 --\n\n- Implement #2: Basic Tool for device specific settings, including an installer replacing TinyInstaller\n- Fix phony button presses when connecting extension\n\n-- 0.2.7.4 --\n\n- Fix Balance Board not beeing detected correctly and reporting any input\n\n-- 0.2.7.3 --\n\n- Fix #15: Yellow Guitar Hero Button not working\n\n-- 0.2.7.2 --\n\n- Change Balance Board Axes\n\n-- 0.2.7.1 --\n\n- Fix Balance Board Axes\n\n-- 0.2.7.0 --\n\n- Fix RawInput not reading the primary axes correctly\n- Add experimental untested Balance Board support\n- Add experimental untested Guitar Hero Guitar support\n\n-- 0.2.6.2 --\n\n- Fix non English languages for the Driver Package Installer\n\n-- 0.2.6.1 --\n\n- Revert back to Multilingual Driver Package Installer\n\n-- 0.2.6 --\n\n- Fix #11: Improved Extension Controller detection\n- Package now includes EULA and Readme file\n- Replaced Multilingual Driver Package Installer with only-English one\n- Introduced proper versioning, starting with 0.2.6\n- Build with WDK 10.0.10586.15, to hopefully fix connectivity issues with Windows 10 Version 1511 (November Update)\n"
  },
  {
    "path": "HID Wiimote User Mode/AssemblyInfo.cpp",
    "content": "#include \"stdafx.h\"\n#include \"..\\ReleaseVersioning\\VersionStrings.h\"\n\nusing namespace System;\nusing namespace System::Reflection;\nusing namespace System::Runtime::CompilerServices;\nusing namespace System::Runtime::InteropServices;\nusing namespace System::Security::Permissions;\n\n//\n// General Information about an assembly is controlled through the following\n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n//\n[assembly:AssemblyTitleAttribute(L\"HID Wiimote User Mode\")];\n[assembly:AssemblyDescriptionAttribute(L\"User Mode Library for the HID Wiimote Driver\")];\n[assembly:AssemblyConfigurationAttribute(L\"\")];\n[assembly:AssemblyCompanyAttribute(L\"Julian Lhr\")];\n[assembly:AssemblyProductAttribute(L\"HID Wiimote User Mode\")];\n[assembly:AssemblyCopyrightAttribute(L\"Copyright (c)  2016\")];\n[assembly:AssemblyTrademarkAttribute(L\"\")];\n[assembly:AssemblyCultureAttribute(L\"\")];\n\n//\n// Version information for an assembly consists of the following four values:\n//\n//      Major Version\n//      Minor Version\n//      Build Number\n//      Revision\n//\n// You can specify all the value or you can default the Revision and Build Numbers\n// by using the '*' as shown below:\n\n[assembly:AssemblyVersionAttribute(CONTROL_CENTER_VERSION_STRING)];\n\n[assembly:AssemblyKeyFileAttribute(\"../HID Wiimote.snk\")];\n\n[assembly:ComVisible(false)];\n\n[assembly:CLSCompliantAttribute(true)];"
  },
  {
    "path": "HID Wiimote User Mode/HID Wiimote User Mode.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|x64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|x64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{591EEE1A-3007-4D38-910A-AF3D065105F9}</ProjectGuid>\r\n    <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>\r\n    <Keyword>ManagedCProj</Keyword>\r\n    <RootNamespace>HIDWiimoteUserMode</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CLRSupport>true</CLRSupport>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CLRSupport>true</CLRSupport>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CLRSupport>true</CLRSupport>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n    <CLRSupport>true</CLRSupport>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <IntDir>$(PlatformShortName)\\$(Configuration)\\obj\\</IntDir>\r\n    <OutDir>$(PlatformShortName)\\$(Configuration)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <IntDir>$(PlatformShortName)\\$(Configuration)\\obj\\</IntDir>\r\n    <OutDir>$(PlatformShortName)\\$(Configuration)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <IntDir>$(PlatformShortName)\\$(Configuration)\\obj\\</IntDir>\r\n    <OutDir>$(PlatformShortName)\\$(Configuration)\\</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <IntDir>$(PlatformShortName)\\$(Configuration)\\obj\\</IntDir>\r\n    <OutDir>$(PlatformShortName)\\$(Configuration)\\</OutDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <PrecompiledHeader>Use</PrecompiledHeader>\r\n    </ClCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <Optimization>Disabled</Optimization>\r\n      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <PrecompiledHeader>Use</PrecompiledHeader>\r\n    </ClCompile>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <PrecompiledHeader>Use</PrecompiledHeader>\r\n    </ClCompile>\r\n    <PostBuildEvent>\r\n      <Command>signtool sign /fd SHA256 /a \"$(OutDir)$(TargetName)$(TargetExt)\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <ClCompile>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <PrecompiledHeader>Use</PrecompiledHeader>\r\n    </ClCompile>\r\n    <PostBuildEvent>\r\n      <Command>signtool sign /fd SHA256 /a \"$(OutDir)$(TargetName)$(TargetExt)\"</Command>\r\n    </PostBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <Reference Include=\"System\" />\r\n    <Reference Include=\"System.Data\" />\r\n    <Reference Include=\"System.Xml\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"IWiimoteDeviceInterface.h\" />\r\n    <ClInclude Include=\"Log.h\" />\r\n    <ClInclude Include=\"resource.h\" />\r\n    <ClInclude Include=\"State.h\" />\r\n    <ClInclude Include=\"Status.h\" />\r\n    <ClInclude Include=\"Stdafx.h\" />\r\n    <ClInclude Include=\"WiimoteDeviceInterface.h\" />\r\n    <ClInclude Include=\"WiimoteDeviceInterfaceDiscoverer.h\" />\r\n    <ClInclude Include=\"WiimoteDeviceInterfaceEnumerator.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"AssemblyInfo.cpp\" />\r\n    <ClCompile Include=\"Log.cpp\" />\r\n    <ClCompile Include=\"State.cpp\" />\r\n    <ClCompile Include=\"Status.cpp\" />\r\n    <ClCompile Include=\"Stdafx.cpp\">\r\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">Create</PrecompiledHeader>\r\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">Create</PrecompiledHeader>\r\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">Create</PrecompiledHeader>\r\n      <PrecompiledHeader Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">Create</PrecompiledHeader>\r\n    </ClCompile>\r\n    <ClCompile Include=\"WiimoteDeviceInterface.cpp\" />\r\n    <ClCompile Include=\"WiimoteDeviceInterfaceDiscoverer.cpp\" />\r\n    <ClCompile Include=\"WiimoteDeviceInterfaceEnumerator.cpp\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ResourceCompile Include=\"HID Wiimote User Mode.rc\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "HID Wiimote User Mode/HID Wiimote User Mode.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <Filter Include=\"Source Files\">\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\n    </Filter>\n    <Filter Include=\"Header Files\">\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>\n    </Filter>\n    <Filter Include=\"Resource Files\">\n      <UniqueIdentifier>{a6a11ab9-aec9-41c5-b10e-a88615b2f318}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"Stdafx.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"resource.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"WiimoteDeviceInterfaceDiscoverer.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"WiimoteDeviceInterface.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Status.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"WiimoteDeviceInterfaceEnumerator.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"Log.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"State.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n    <ClInclude Include=\"IWiimoteDeviceInterface.h\">\n      <Filter>Header Files</Filter>\n    </ClInclude>\n  </ItemGroup>\n  <ItemGroup>\n    <ClCompile Include=\"AssemblyInfo.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"Stdafx.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"WiimoteDeviceInterfaceDiscoverer.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"WiimoteDeviceInterface.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"Status.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"WiimoteDeviceInterfaceEnumerator.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"Log.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n    <ClCompile Include=\"State.cpp\">\n      <Filter>Source Files</Filter>\n    </ClCompile>\n  </ItemGroup>\n  <ItemGroup>\n    <ResourceCompile Include=\"HID Wiimote User Mode.rc\">\n      <Filter>Resource Files</Filter>\n    </ResourceCompile>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "HID Wiimote User Mode/IWiimoteDeviceInterface.h",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\n\tAll rights reserved.\n\nFilename:\n\tIWiimoteDeviceInterface.h\n\nAbstract:\n\tPublic managed interface that represents a HID Wiimote Device Interface\n\n*/\n#pragma once\n\n#include \"Status.h\"\n#include \"State.h\"\n\nnamespace HIDWiimote\n{\n\tnamespace UserModeLib\n\t{\n\t\tpublic interface class IWiimoteDeviceInterface\n\t\t{\n\t\t\tevent System::EventHandler^ DeviceRemoved;\n\t\t\tevent System::EventHandler<Status^>^ StatusUpdate;\n\n\t\t\tState^ Initialize();\n\t\t\tvoid Disconnect();\n\n\t\t\tSystem::Boolean SetDriverMode(DriverMode NewMode);\n\t\t\tSystem::Boolean SetEnableWiimoteXAxisAccelerometer(System::Boolean Enabled);\n\t\t\tSystem::Boolean SetEnableWiimoteYAxisAccelerometer(System::Boolean Enabled);\n\t\t\tSystem::Boolean SetSwapMouseButtons(System::Boolean Enabled);\n\t\t\tSystem::Boolean SetSwapTriggerAndShoulder(System::Boolean Enabled);\n\t\t\tSystem::Boolean SetSplitTrigger(System::Boolean Enabled);\n\t\t\tSystem::Boolean SetMapTriggerAsAxis(System::Boolean Enabled);\n\t\t\tSystem::Boolean SetMapTriggerAsButtons(System::Boolean Enabled);\n\t\t};\n\t}\n}"
  },
  {
    "path": "HID Wiimote User Mode/Log.cpp",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tLog.cpp\n\nAbstract:\n\tImplementation of Logging\n\n*/\n#include \"stdafx.h\"\n#include \"Log.h\"\n\n\nnamespace HIDWiimote\n{\n\tnamespace UserModeLib\n\t{\n\t\tvoid Log::Write(System::String^ Text)\n\t\t{\n#if _DEBUG\n\t\t\tSystem::Diagnostics::Debug::WriteLine(Text);\n#endif\n\t\t\tLog::NewLine(nullptr, Text);\n\t\t}\n\n\t\tvoid Log::Write(System::String^ Format, ... array<System::Object^>^ Args)\n\t\t{\n\t\t\tSystem::String^ FormatedString = System::String::Format(Format, Args);\n\n\t\t\tWrite(FormatedString);\n\t\t}\n\t}\n}"
  },
  {
    "path": "HID Wiimote User Mode/Log.h",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tLog.h\n\nAbstract:\n\tStatic methods for Logging\n\n*/\n#pragma once\n\nnamespace HIDWiimote\n{\n\tnamespace UserModeLib\n\t{\n\t\tpublic ref class Log abstract sealed\n\t\t{\n\t\tpublic:\n\t\t\tstatic event System::EventHandler<System::String^>^ NewLine;\n\n\t\t\tstatic void Write(System::String^ Text);\n\t\t\tstatic void Write(System::String^ Format, ... array<System::Object^>^ Args);\n\t\t};\n\t}\n}\n"
  },
  {
    "path": "HID Wiimote User Mode/State.cpp",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tState.cpp\n\nAbstract:\n\tImplementation of the Status Class\n\n*/\n#include \"stdafx.h\"\n#include \"State.h\"\n\n#include \"Log.h\"\n\n#include \"../HID Wiimote/DeviceInterfacePublic.h\"\n\nnamespace HIDWiimote\n{\n\tnamespace UserModeLib\n\t{\n\t\tState::State()\n\t\t{\n\t\t\tStatus = gcnew UserModeLib::Status();\t\n\t\t\tMode = DriverMode::PassThrough;\n\t\t}\n\n\t\tState::State(const WIIMOTE_STATE_IOCTL_DATA & StateData)\n\t\t{\n\t\t\tStatus = gcnew UserModeLib::Status(StateData.Status);\n\n\t\t\tMode = (UserModeLib::DriverMode)StateData.Settings.Mode;\n\n\t\t\tEnableWiimoteXAxisAccelerometer = (StateData.Settings.EnableWiimoteXAxisAccelerometer != FALSE);\n\t\t\tEnableWiimoteYAxisAccelerometer = (StateData.Settings.EnableWiimoteYAxisAcceleromenter != FALSE);\n\t\t\tSwapMouseButtons = (StateData.Settings.SwapMouseButtons != FALSE);\n\t\t\tSwapTriggerAndShoulder = (StateData.Settings.SwapTriggerAndShoulder != FALSE);\n\t\t\tSplitTrigger = (StateData.Settings.SplitTriggerAxis != FALSE);\n\t\t\tMapTriggerAsAxis = (StateData.Settings.MapTriggerAsAxis != FALSE);\n\t\t\tMapTriggerAsButtons = (StateData.Settings.MapTriggerAsButtons != FALSE);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "HID Wiimote User Mode/State.h",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tState.h\n\nAbstract:\n\tPublic managed class that represents the current state of a Wiimote Device including its settings.\n\n*/\n#pragma once\n\n#include \"Status.h\"\n\n#include \"../HID Wiimote/DeviceInterfacePublic.h\"\n\nnamespace HIDWiimote\n{\n\tnamespace UserModeLib\n\t{\n\t\tpublic enum class DriverMode { Gamepad, PassThrough,  IRMouse, DPadMouse, GamepadAndIRMouse };\n\n\t\tpublic ref class State\n\t\t{\n\t\tpublic:\n\t\t\tState();\n\t\t\tState(const WIIMOTE_STATE_IOCTL_DATA & StateData);\n\n\t\t\tproperty DriverMode Mode;\n\t\t\tproperty Status^ Status;\n\t\t\tproperty System::Boolean EnableWiimoteXAxisAccelerometer;\n\t\t\tproperty System::Boolean EnableWiimoteYAxisAccelerometer;\n\t\t\tproperty System::Boolean SwapMouseButtons;\n\t\t\tproperty System::Boolean SwapTriggerAndShoulder;\n\t\t\tproperty System::Boolean SplitTrigger;\n\t\t\tproperty System::Boolean MapTriggerAsAxis;\n\t\t\tproperty System::Boolean MapTriggerAsButtons;\n\t\t};\n\t}\n}\n\n"
  },
  {
    "path": "HID Wiimote User Mode/Status.cpp",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tStatus.cpp\n\nAbstract:\n\tImplementation of the Status Class\n\n*/\n#include \"stdafx.h\"\n#include \"Status.h\"\n\n#include \"Log.h\"\n\n#include \"../HID Wiimote/DeviceInterfacePublic.h\"\n\nnamespace HIDWiimote\n{\n\tnamespace UserModeLib\n\t{\n\t\tStatus::Status()\n\t\t{\n\t\t\tSetLEDState(0x00);\n\t\t}\n\n\t\tStatus::Status(const WIIMOTE_STATUS_IOCTL_DATA & StatusData)\n\t\t{\n\t\t\tBatteryLevel = StatusData.BatteryLevel;\n\t\t\tExtension = (UserModeLib::Extension)StatusData.Extension;\n\n\t\t\tSetLEDState(StatusData.LEDs);\n\t\t}\n\n\t\tvoid Status::SetLEDState(UCHAR LEDs)\n\t\t{\n\t\t\tLEDState = gcnew array<System::Boolean>(4);\n\n\t\t\tLEDState[0] = (LEDs & WIIMOTE_LEDS_ONE);\n\t\t\tLEDState[1] = (LEDs & WIIMOTE_LEDS_TWO);\n\t\t\tLEDState[2] = (LEDs & WIIMOTE_LEDS_THREE);\n\t\t\tLEDState[3] = (LEDs & WIIMOTE_LEDS_FOUR);\n\t\t}\n\t}\n}"
  },
  {
    "path": "HID Wiimote User Mode/Status.h",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tStatus.h\n\nAbstract:\n\tPublic managed class that contains information about an status update of a Wiimote Device\n\n*/\n#pragma once\n\n#include \"../HID Wiimote/DeviceInterfacePublic.h\"\n\nnamespace HIDWiimote\n{\n\tnamespace UserModeLib\n\t{\n\t\tpublic enum class Extension { None, Nunchuck, BalanceBoard, ClassicController, ClassicControllerPro, WiiUProController, Guitar };\n\n\t\tpublic ref class Status\n\t\t{\n\t\tpublic:\n\t\t\tStatus();\n\t\t\tStatus(const WIIMOTE_STATUS_IOCTL_DATA & StatusData);\n\n\t\t\tproperty array<System::Boolean>^ LEDState;\n\t\t\tproperty System::Byte BatteryLevel;\n\t\t\tproperty Extension Extension;\n\n\t\tprivate:\n\t\t\tvoid SetLEDState(UCHAR LEDs);\n\t\t};\n\t}\n}\n\n"
  },
  {
    "path": "HID Wiimote User Mode/Stdafx.cpp",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tStdafx.cpp\n\nAbstract:\n\tstdafx.cpp : source file that includes just the standard includes\n\tHID Wiimote User Mode.pch will be the pre-compiled header\n\tstdafx.obj will contain the pre-compiled type information\n\n*/\n#include \"stdafx.h\"\n"
  },
  {
    "path": "HID Wiimote User Mode/Stdafx.h",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tStdafx.h\n\nAbstract:\n\tstdafx.h : include file for standard system include files,\n\tor project specific include files that are used frequently,\n\tbut are changed infrequently\n\n*/\n#pragma once\n\n#include <string>\n\n#include <vector>\n\n#include <Windows.h>\n#include <SetupAPI.h>\n"
  },
  {
    "path": "HID Wiimote User Mode/WiimoteDeviceInterface.cpp",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tWiimoteDeviceInterface.cpp\n\nAbstract:\n\tImplementation of the WiimoteDeviceInterface Class\n\n*/\n#include \"stdafx.h\"\n#include \"WiimoteDeviceInterface.h\"\n\n#include \"Log.h\"\n\n#include \"../HID Wiimote/DeviceInterfacePublic.h\"\n\nnamespace HIDWiimote\n{\n\tnamespace UserModeLib\n\t{\n\t\tWiimoteDeviceInterface::WiimoteDeviceInterface(System::String ^ DeviceInterfacePath)\n\t\t\t: DeviceInterfaceHandle(INVALID_HANDLE_VALUE),\n\t\t\tReaderThread(nullptr),\n\t\t\tStopThread(false)\n\t\t{\n\t\t\tthis->DeviceInterfacePath = DeviceInterfacePath;\n\t\t}\n\n\t\tState^ WiimoteDeviceInterface::Initialize()\n\t\t{\n\t\t\tif (DeviceIsGood())\n\t\t\t{\n\t\t\t\tLog::Write(\"Device Interface already initialized: \" + DeviceInterfacePath);\n\t\t\t}\n\n\t\t\t// Open Device Interface Path\n\t\t\tif (!OpenDevice())\n\t\t\t{\n\t\t\t\tLog::Write(\"Error Opening Device: \" + DeviceInterfacePath);\n\t\t\t\treturn nullptr;\n\t\t\t}\n\n\t\t\t// Query Initinal State\n\t\t\tState^ InitinalState = GetState();\n\n\t\t\tif (InitinalState == nullptr)\n\t\t\t{\n\t\t\t\tLog::Write(\"Error getting initinal state \" + DeviceInterfacePath);\n\t\t\t\treturn nullptr;\n\t\t\t}\n\n\t\t\tStartContinousReader();\n\n\t\t\treturn InitinalState;\n\t\t}\n\n\t\tvoid WiimoteDeviceInterface::Disconnect()\n\t\t{\n\t\t\tStopContinousReader();\n\n\t\t\tCloseDevice();\n\n\t\t\tDeviceRemoved(this, nullptr);\n\t\t}\n\n\t\tSystem::Boolean WiimoteDeviceInterface::SetDriverMode(DriverMode NewMode)\n\t\t{\n\t\t\tWIIMOTE_DRIVER_MODE Mode = (WIIMOTE_DRIVER_MODE)NewMode;\n\n\t\t\treturn SendBufferdIOCTL(IOCTL_WIIMOTE_SET_MODE, &Mode, sizeof(Mode), nullptr, 0);\n\t\t}\n\n\t\tSystem::Boolean WiimoteDeviceInterface::SetEnableWiimoteXAxisAccelerometer(System::Boolean Enabled)\n\t\t{\n\t\t\treturn SendBooleanSetting(IOCTL_WIIMOTE_SET_ENABLE_WIIMOTE_XAXIS_ACCELEROMETER, Enabled);\n\t\t}\n\n\t\tSystem::Boolean WiimoteDeviceInterface::SetEnableWiimoteYAxisAccelerometer(System::Boolean Enabled)\n\t\t{\n\t\t\treturn SendBooleanSetting(IOCTL_WIIMOTE_SET_ENABLE_WIIMOTE_YAXIS_ACCELEROMETER, Enabled);\n\t\t}\n\n\t\tSystem::Boolean WiimoteDeviceInterface::SetSwapMouseButtons(System::Boolean Enabled)\n\t\t{\n\t\t\treturn SendBooleanSetting(IOCTL_WIIMOTE_SET_SWITCH_MOUSEBUTTONS, Enabled);\n\t\t}\n\n\t\tSystem::Boolean WiimoteDeviceInterface::SetSwapTriggerAndShoulder(System::Boolean Enabled)\n\t\t{\n\t\t\treturn SendBooleanSetting(IOCTL_WIIMOTE_SET_SWITCH_TRIGGERANDSHOULDER, Enabled);\n\t\t}\n\n\t\tSystem::Boolean WiimoteDeviceInterface::SetSplitTrigger(System::Boolean Enabled)\n\t\t{\n\t\t\treturn SendBooleanSetting(IOCTL_WIIMOTE_SET_SPLIT_TRIGGERAXIS, Enabled);\n\t\t}\n\n\t\tSystem::Boolean WiimoteDeviceInterface::SetMapTriggerAsAxis(System::Boolean Enabled)\n\t\t{\n\t\t\treturn SendBooleanSetting(IOCTL_WIIMOTE_SET_MAP_TRIGGER_AS_AXIS, Enabled);\n\t\t}\n\n\t\tSystem::Boolean WiimoteDeviceInterface::SetMapTriggerAsButtons(System::Boolean Enabled)\n\t\t{\n\t\t\treturn SendBooleanSetting(IOCTL_WIIMOTE_SET_MAP_TRIGGER_AS_BUTTONS, Enabled);\n\t\t}\n\n\t\tbool WiimoteDeviceInterface::OpenDevice()\n\t\t{\n\t\t\tSystem::IntPtr PointerToNativeString = System::Runtime::InteropServices::Marshal::StringToHGlobalUni(DeviceInterfacePath);\n\n\t\t\tHANDLE OpenDevice = CreateFile(static_cast<LPCWSTR>(PointerToNativeString.ToPointer()), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);\n\t\t\tSystem::Runtime::InteropServices::Marshal::FreeHGlobal(PointerToNativeString);\n\n\t\t\tif (OpenDevice == INVALID_HANDLE_VALUE)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tDeviceInterfaceHandle = OpenDevice;\n\t\t\treturn true;\n\t\t}\n\n\t\tbool WiimoteDeviceInterface::DeviceIsGood()\n\t\t{\n\t\t\treturn (DeviceInterfaceHandle != INVALID_HANDLE_VALUE);\n\t\t}\n\n\t\tvoid WiimoteDeviceInterface::CloseDevice()\n\t\t{\n\t\t\tCloseHandle(DeviceInterfaceHandle);\n\t\t\tDeviceInterfaceHandle = INVALID_HANDLE_VALUE;\n\t\t}\n\n\t\tvoid WiimoteDeviceInterface::StartContinousReader()\n\t\t{\n\t\t\tif (ReaderThread != nullptr)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tSystem::Threading::ThreadStart^ ThreadEntry = gcnew System::Threading::ThreadStart(this, &WiimoteDeviceInterface::ContinousReaderThreadBody);\n\t\t\tReaderThread = gcnew System::Threading::Thread(ThreadEntry);\n\t\t\tReaderThread->Name = \"Continous Reader Thread\";\n\t\t\tStopThread = false;\n\n\t\t\tReadIo = new OVERLAPPED();\n\t\t\tReadIo->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);\n\n\t\t\tReaderThread->Start();\n\t\t}\n\n\t\tvoid WiimoteDeviceInterface::StopContinousReader()\n\t\t{\n\t\t\tStopThread = true;\n\n\t\t\tif ((ReaderThread != nullptr) && (System::Threading::Thread::CurrentThread != ReaderThread) && (ReaderThread->IsAlive))\n\t\t\t{\n\t\t\t\tdo {\n\t\t\t\t\tSetEvent(ReadIo->hEvent);\n\t\t\t\t} while (!ReaderThread->Join(100));\n\t\t\t}\n\t\t}\n\n\t\tvoid WiimoteDeviceInterface::ContinousReaderThreadBody()\n\t\t{\n\t\t\tWIIMOTE_STATUS_IOCTL_DATA StatusBuffer = {};\n\t\t\tDWORD ByteWritten = 0;\n\n\t\t\twhile (!StopThread)\n\t\t\t{\n\t\t\t\tResetEvent(ReadIo->hEvent);\n\n\t\t\t\tif (!SendBufferdIOCTL(IOCTL_WIIMOTE_READ_STATUS, nullptr, 0, &StatusBuffer, sizeof(StatusBuffer), ReadIo))\n\t\t\t\t{\n\t\t\t\t\tLog::Write(\"Error sending Read Status Request\");\n\t\t\t\t\tDisconnect();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (ReadIo->Internal == STATUS_PENDING)\n\t\t\t\t{\n\t\t\t\t\t// Stop Continous Reader was called;\n\t\t\t\t\tCancelIo(DeviceInterfaceHandle);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tStatusUpdate(this, gcnew Status(StatusBuffer));\n\t\t\t}\n\n\t\t\tFreeThreadResources();\n\t\t\tReaderThread = nullptr;\n\t\t}\n\n\t\tvoid WiimoteDeviceInterface::FreeThreadResources()\n\t\t{\n\t\t\tif (ReadIo != nullptr)\n\t\t\t{\n\t\t\t\tif (ReadIo->hEvent != INVALID_HANDLE_VALUE)\n\t\t\t\t{\n\t\t\t\t\tCloseHandle(ReadIo->hEvent);\n\t\t\t\t\tReadIo->hEvent = INVALID_HANDLE_VALUE;\n\t\t\t\t}\n\n\t\t\t\tdelete ReadIo;\n\t\t\t\tReadIo = nullptr;\n\t\t\t}\n\n\t\t}\n\n\t\tState^ WiimoteDeviceInterface::GetState()\n\t\t{\n\t\t\tif (!DeviceIsGood())\n\t\t\t{\n\t\t\t\treturn nullptr;\n\t\t\t}\n\n\t\t\tWIIMOTE_STATE_IOCTL_DATA StateData;\n\n\t\t\tif (!SendBufferdIOCTL(IOCTL_WIIMOTE_GET_STATE, nullptr, 0, &StateData, sizeof(StateData)))\n\t\t\t{\n\t\t\t\tLog::Write(\"Error getting State\");\n\t\t\t\treturn nullptr;\n\t\t\t}\n\n\t\t\treturn gcnew State(StateData);\n\t\t}\n\n\t\tbool WiimoteDeviceInterface::SendBooleanSetting(DWORD IoControlCode, bool Value)\n\t\t{\n\t\t\tBOOL Converted = Value;\n\n\t\t\treturn SendBufferdIOCTL(IoControlCode, &Converted, sizeof(Converted), nullptr, 0);\n\t\t}\n\n\t\tbool WiimoteDeviceInterface::SendBufferdIOCTL(DWORD IoControlCode, LPVOID InputBuffer, DWORD InputBufferSize, LPVOID OutputBuffer, DWORD OutputBufferSize)\n\t\t{\n\t\t\tif (!DeviceIsGood())\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tOVERLAPPED Overlapped = { 0 };\n\t\t\tOverlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);\n\n\t\t\tbool Result = SendBufferdIOCTL(IoControlCode, InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize, &Overlapped);\n\n\t\t\tCloseHandle(Overlapped.hEvent);\n\n\t\t\treturn Result;\n\t\t}\n\n\t\tbool WiimoteDeviceInterface::SendBufferdIOCTL(DWORD IoControlCode, LPVOID InputBuffer, DWORD InputBufferSize, LPVOID OutputBuffer, DWORD OutputBufferSize, LPOVERLAPPED Overlapped)\n\t\t{\n\t\t\tif (!DeviceIsGood())\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tBOOL Result = DeviceIoControl(DeviceInterfaceHandle, IoControlCode, InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize, nullptr, Overlapped);\n\t\t\tif (!Result)\n\t\t\t{\n\t\t\t\tDWORD Error = GetLastError();\n\t\t\t\tif (Error != ERROR_IO_PENDING)\n\t\t\t\t{\n\t\t\t\t\tLog::Write(\"Error calling DeviceIoControl: \" + Error);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tDWORD NumberOfBytesTransferred;\n\t\t\t\t\tif (!GetOverlappedResult(DeviceInterfaceHandle, Overlapped, &NumberOfBytesTransferred, TRUE))\n\t\t\t\t\t{\n\t\t\t\t\t\tLog::Write(\"Error calling GetOverlappedResult: \" + GetLastError());\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t}\n}"
  },
  {
    "path": "HID Wiimote User Mode/WiimoteDeviceInterface.h",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tWiimoteDeviceInterface.h\n\nAbstract:\n\tInternal managed class that represents a HID Wiimote Device Interface\n\n*/\n#pragma once\n\n#include \"IWiimoteDeviceInterface.h\"\n\nnamespace HIDWiimote\n{\n\tnamespace UserModeLib\n\t{\n\t\tprivate ref class WiimoteDeviceInterface : IWiimoteDeviceInterface\n\t\t{\n\t\tpublic:\n\t\t\tWiimoteDeviceInterface(System::String^ DeviceInterfacePath);\n\n\t\t\tproperty System::String^ DeviceInterfacePath;\n\n\t\t\tvirtual event System::EventHandler^ DeviceRemoved;\n\t\t\tvirtual event System::EventHandler<Status^>^ StatusUpdate;\n\n\t\t\tvirtual State^ Initialize();\n\t\t\tvirtual void Disconnect();\n\n\t\t\tvirtual System::Boolean SetDriverMode(DriverMode NewMode);\n\t\t\tvirtual System::Boolean SetEnableWiimoteXAxisAccelerometer(System::Boolean Enabled);\n\t\t\tvirtual System::Boolean SetEnableWiimoteYAxisAccelerometer(System::Boolean Enabled);\n\t\t\tvirtual System::Boolean SetSwapMouseButtons(System::Boolean Enabled);\n\t\t\tvirtual System::Boolean SetSwapTriggerAndShoulder(System::Boolean Enabled);\n\t\t\tvirtual System::Boolean SetSplitTrigger(System::Boolean Enabled);\n\t\t\tvirtual System::Boolean SetMapTriggerAsAxis(System::Boolean Enabled);\n\t\t\tvirtual System::Boolean SetMapTriggerAsButtons(System::Boolean Enabled);\n\n\t\tprivate:\n\t\t\tHANDLE DeviceInterfaceHandle;\n\t\t\tLPOVERLAPPED ReadIo;\n\n\t\t\tSystem::Threading::Thread^ ReaderThread;\n\t\t\tvolatile bool StopThread;\n\n\t\t\tbool OpenDevice();\n\t\t\tbool DeviceIsGood();\n\t\t\tvoid CloseDevice();\n\n\t\t\tvoid StartContinousReader();\n\t\t\tvoid StopContinousReader();\n\t\t\tvoid ContinousReaderThreadBody();\n\n\t\t\tvoid FreeThreadResources();\n\n\t\t\tState^ GetState();\n\n\t\t\tbool SendBooleanSetting(DWORD IoControlCode, bool Value);\n\t\t\tbool SendBufferdIOCTL(DWORD IoControlCode, LPVOID InputBuffer, DWORD InputBufferSize, LPVOID OutputBuffer, DWORD OutputBufferSize);\n\t\t\tbool SendBufferdIOCTL(DWORD IoControlCode, LPVOID InputBuffer, DWORD InputBufferSize, LPVOID OutputBuffer, DWORD OutputBufferSize, LPOVERLAPPED Overlapped);\n\n\t\t};\n\t}\n}\n\n"
  },
  {
    "path": "HID Wiimote User Mode/WiimoteDeviceInterfaceDiscoverer.cpp",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tWiimoteDeviceInterfaceDiscoverer.cpp\n\nAbstract:\n\tImplementation of the WiimoteDeviceInterfaceDiscoverer Class\n\n*/\n#include \"stdafx.h\"\n#include \"WiimoteDeviceInterfaceDiscoverer.h\"\n\n#include \"WiimoteDeviceInterfaceEnumerator.h\"\n\nnamespace HIDWiimote\n{\n\tnamespace UserModeLib\n\t{\n\t\tWiimoteDeviceInterfaceDiscoverer::WiimoteDeviceInterfaceDiscoverer()\n\t\t\t: NativeEnumerator(new WiimoteDeviceInterfaceEnumerator()),\n\t\t\tSearchingThread(nullptr),\n\t\t\tStopThread(false),\n\t\t\tActiveInterfacesPaths(gcnew System::Collections::Generic::List<System::String^>)\n\t\t{\n\t\t}\n\n\t\tWiimoteDeviceInterfaceDiscoverer::~WiimoteDeviceInterfaceDiscoverer()\n\t\t{\n\t\t\tStop();\n\n\t\t\tif (NativeEnumerator != nullptr)\n\t\t\t{\n\t\t\t\tdelete NativeEnumerator;\n\t\t\t\tNativeEnumerator = nullptr;\n\t\t\t}\n\t\t}\n\n\t\tvoid WiimoteDeviceInterfaceDiscoverer::Start()\n\t\t{\n\t\t\tif (SearchingThread != nullptr)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tSystem::Threading::ThreadStart^ ThreadEntry = gcnew System::Threading::ThreadStart(this, &WiimoteDeviceInterfaceDiscoverer::SearchingThreadBody);\n\t\t\tSearchingThread = gcnew System::Threading::Thread(ThreadEntry);\n\t\t\tSearchingThread->Name = \"Searching Thread\";\n\t\t\tStopThread = false;\n\n\t\t\tSearchingThread->Start();\n\t\t}\n\n\t\tvoid WiimoteDeviceInterfaceDiscoverer::Stop()\n\t\t{\n\t\t\tif (SearchingThread == nullptr)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tStopThread = true;\n\t\t\tSearchingThread->Join();\n\n\t\t\tSearchingThread = nullptr;\n\t\t}\n\n\t\tvoid WiimoteDeviceInterfaceDiscoverer::SearchingThreadBody()\n\t\t{\n\t\t\twhile (!StopThread)\n\t\t\t{\n\t\t\t\t// Refresh Enumeration\n\t\t\t\tNativeEnumerator->Enumerate();\n\t\t\t\tWiimoteDeviceInterfaceEnumerator::DevicePathVector EnumeratedInterfaces = NativeEnumerator->GetEnumeratedDevices();\n\n\t\t\t\t// Enter Critical Section \n\t\t\t\tSystem::Threading::Monitor::Enter(ActiveInterfacesPaths);\n\n\t\t\t\tfor (auto & DeviceInterfacePath : EnumeratedInterfaces)\n\t\t\t\t{\n\t\t\t\t\t// Check if it already has been enumerated and discovered\n\t\t\t\t\tSystem::String^ ManagedDevicePath = gcnew System::String(DeviceInterfacePath.c_str());\n\t\t\t\t\tif (ActiveInterfacesPaths->Contains(ManagedDevicePath))\n\t\t\t\t\t{\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// If not create DeviceInterfaceWrapper, register onto its removed event and fire our event\n\t\t\t\t\tWiimoteDeviceInterface^ NewDeviceInterface = gcnew WiimoteDeviceInterface(ManagedDevicePath);\n\t\t\t\t\tNewDeviceInterface->DeviceRemoved += gcnew System::EventHandler(this, &HIDWiimote::UserModeLib::WiimoteDeviceInterfaceDiscoverer::OnWiimoteDeviceInterfaceRemoved);\n\n\t\t\t\t\tActiveInterfacesPaths->Add(ManagedDevicePath);\n\n\t\t\t\t\tNewWiimoteDeviceInterfaceFound(this, NewDeviceInterface);\n\t\t\t\t}\n\n\t\t\t\t// Leave Critical Section and sleep for some time before we do the next enumeration\n\t\t\t\tSystem::Threading::Monitor::Exit(ActiveInterfacesPaths);\n\t\t\t\tSystem::Threading::Thread::Sleep(1000);\n\t\t\t}\n\t\t}\n\n\t\tvoid WiimoteDeviceInterfaceDiscoverer::OnWiimoteDeviceInterfaceRemoved(System::Object ^ sender, System::EventArgs ^ e)\n\t\t{\n\t\t\tWiimoteDeviceInterface^ RemovedInterferace = (WiimoteDeviceInterface^)sender;\n\n\t\t\t// Enter Critical Section \n\t\t\tSystem::Threading::Monitor::Enter(ActiveInterfacesPaths);\n\n\t\t\tActiveInterfacesPaths->Remove(RemovedInterferace->DeviceInterfacePath);\n\n\t\t\t// Leave Critical Section \n\t\t\tSystem::Threading::Monitor::Exit(ActiveInterfacesPaths);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "HID Wiimote User Mode/WiimoteDeviceInterfaceDiscoverer.h",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tWiimoteDeviceInterfaceDiscoverer.h\n\nAbstract:\n\tPublic managed class to find HID Wiimote Device Interfaces.\n\n*/\n#pragma once\n\n#include \"IWiimoteDeviceInterface.h\"\n#include \"WiimoteDeviceInterface.h\"\n#include \"WiimoteDeviceInterfaceEnumerator.h\"\n\nnamespace HIDWiimote\n{\n\tnamespace UserModeLib\n\t{\n\t\tpublic ref class WiimoteDeviceInterfaceDiscoverer\n\t\t{\n\t\tpublic:\n\t\t\tWiimoteDeviceInterfaceDiscoverer();\n\t\t\t~WiimoteDeviceInterfaceDiscoverer();\n\n\t\t\tvoid Start();\n\t\t\tvoid Stop();\n\n\t\t\tevent System::EventHandler<IWiimoteDeviceInterface^>^ NewWiimoteDeviceInterfaceFound;\n\n\t\tprivate:\n\t\t\tPWiimoteDeviceInterfaceEnumerator NativeEnumerator;\n\n\t\t\tSystem::Collections::Generic::List<System::String^>^ ActiveInterfacesPaths;\n\t\t\tSystem::Threading::Thread^ SearchingThread;\n\t\t\tvolatile bool StopThread;\n\n\t\t\tvoid SearchingThreadBody();\n\t\t\tvoid OnWiimoteDeviceInterfaceRemoved(System::Object ^sender, System::EventArgs ^e);\n\t\t};\n\t}\n}\n\n"
  },
  {
    "path": "HID Wiimote User Mode/WiimoteDeviceInterfaceEnumerator.cpp",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tWiimoteDeviceInterfaceEnumerator.cpp\n\nAbstract:\n\tImplementation of the WiimoteDeviceInterfaceEnumerator Class\n\n*/\n#include \"stdafx.h\"\n#include \"WiimoteDeviceInterfaceEnumerator.h\"\n\n#pragma comment(lib, \"setupapi.lib\")\n\n#include \"../HID Wiimote/DeviceInterfacePublic.h\"\n\n#include \"Log.h\"\n\nnamespace HIDWiimote\n{\n\tnamespace UserModeLib\n\t{\n\t\tbool WiimoteDeviceInterfaceEnumerator::Enumerate()\n\t\t{\n\t\t\tHDEVINFO DeviceInfoSet; \n\n\t\t\tEnumeratedDevices.clear();\n\n\t\t\tDeviceInfoSet = SetupDiGetClassDevs(&GUID_DEVINTERFACE_HIDWIIMOTE, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);\n\t\t\tif (!DeviceInfoSet)\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tDWORD DeviceIndex = 0;\n\t\t\twhile (EnumerateDeviceInterface(DeviceInfoSet, DeviceIndex))\n\t\t\t{\n\t\t\t\tDeviceIndex++;\n\t\t\t}\n\n\t\t\tif (!SetupDiDestroyDeviceInfoList(DeviceInfoSet))\n\t\t\t{\n\t\t\t\tLog::Write(\"Error destroying Device Info Set\");\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tbool WiimoteDeviceInterfaceEnumerator::EnumerateDeviceInterface(HDEVINFO DeviceInfoSet, DWORD DeviceIndex)\n\t\t{\n\t\t\tSP_DEVICE_INTERFACE_DATA DeviceInterfaceData = {};\n\t\t\tDeviceInterfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);\n\n\t\t\tif (!SetupDiEnumDeviceInterfaces(DeviceInfoSet, NULL, &GUID_DEVINTERFACE_HIDWIIMOTE, DeviceIndex, &DeviceInterfaceData))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tBOOL Result;\n\t\t\tDWORD RequiredSize;\n\n\t\t\tSP_DEVINFO_DATA DeviceInfoData = {};\n\t\t\tDeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);\n\n\t\t\tSetupDiGetDeviceInterfaceDetail(DeviceInfoSet, &DeviceInterfaceData, NULL, 0, &RequiredSize, NULL);\n\t\t\tif (GetLastError() != ERROR_INSUFFICIENT_BUFFER)\n\t\t\t{\n\t\t\t\tLog::Write(\"Error getting DeviceInterfaceDetailData size\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t\n\t\t\tPSP_DEVICE_INTERFACE_DETAIL_DATA DeviceInterfaceDetailData = (PSP_DEVICE_INTERFACE_DETAIL_DATA)malloc(RequiredSize);\n\t\t\tDeviceInterfaceDetailData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);\n\n\t\t\tResult = SetupDiGetDeviceInterfaceDetail(DeviceInfoSet, &DeviceInterfaceData, DeviceInterfaceDetailData, RequiredSize, NULL, &DeviceInfoData);\n\t\t\tif (!Result)\n\t\t\t{\n\t\t\t\tLog::Write(\"Error getting Device Interface Details\");\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tEnumeratedDevices.push_back(DeviceInterfaceDetailData->DevicePath);\n\n\t\t\treturn true;\n\t\t}\n\t}\n}"
  },
  {
    "path": "HID Wiimote User Mode/WiimoteDeviceInterfaceEnumerator.h",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tWiimoteDeviceInterfaceEnumerator.h\n\nAbstract:\n\tNative class that enumerates and returns all HID Wiimote Device Interfaces.\n\n*/\n#pragma once\n\nnamespace HIDWiimote\n{\n\tnamespace UserModeLib\n\t{\n\t\tclass WiimoteDeviceInterfaceEnumerator;\n\t\ttypedef WiimoteDeviceInterfaceEnumerator * PWiimoteDeviceInterfaceEnumerator;\n\n\t\tclass WiimoteDeviceInterfaceEnumerator\n\t\t{\n\t\tpublic:\n\t\t\ttypedef std::vector<std::wstring> DevicePathVector;\n\n\t\t\tbool Enumerate();\n\n\t\t\tconst DevicePathVector & GetEnumeratedDevices()\n\t\t\t{\n\t\t\t\treturn EnumeratedDevices;\n\t\t\t}\n\n\t\tprivate:\n\t\t\tbool EnumerateDeviceInterface(HDEVINFO DeviceInfoSet, DWORD DeviceIndex);\n\n\t\t\tDevicePathVector EnumeratedDevices;\n\t\t};\n\t}\n}\n\n"
  },
  {
    "path": "HID Wiimote User Mode/resource.h",
    "content": "//{{NO_DEPENDENCIES}}\n// Microsoft Visual C++ generated include file.\n// Used by HID Wiimote User Mode.rc\n\n// Next default values for new objects\n// \n#ifdef APSTUDIO_INVOKED\n#ifndef APSTUDIO_READONLY_SYMBOLS\n#define _APS_NEXT_RESOURCE_VALUE        101\n#define _APS_NEXT_COMMAND_VALUE         40001\n#define _APS_NEXT_CONTROL_VALUE         1001\n#define _APS_NEXT_SYMED_VALUE           101\n#endif\n#endif\n"
  },
  {
    "path": "HID Wiimote.sln",
    "content": "Microsoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio 15\r\nVisualStudioVersion = 15.0.27130.2036\r\nMinimumVisualStudioVersion = 10.0.40219.1\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"HID Wiimote\", \"HID Wiimote\\HID Wiimote.vcxproj\", \"{785D88E1-E758-4966-80FA-AEF74681FEF1}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00} = {411F3C13-DA46-42DA-9368-F5ADC5072E00}\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"HID Wiimote Package\", \"HID Wiimote Package\\HID Wiimote Package.vcxproj\", \"{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\t\t{591EEE1A-3007-4D38-910A-AF3D065105F9} = {591EEE1A-3007-4D38-910A-AF3D065105F9}\r\n\t\t{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616} = {D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1} = {785D88E1-E758-4966-80FA-AEF74681FEF1}\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"HID Miniport\", \"HID Miniport\\HID Miniport.vcxproj\", \"{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}\"\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"BuildAndZip\", \"BuildAndZip\\BuildAndZip.vcxproj\", \"{0C56BAEE-4F6C-4590-9E48-EFBF80099FEB}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\t\t{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616} = {D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E} = {E1721BA4-CF41-483D-A72A-1452A0FF2F1E}\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"HID Wiimote Control Center\", \"HID Wiimote Control Center\\HID Wiimote Control Center.csproj\", \"{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00} = {411F3C13-DA46-42DA-9368-F5ADC5072E00}\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Build Utilities\", \"Build Utilities\", \"{DB263901-FCD3-46C6-9E48-460707381DAB}\"\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"ReleaseVersioning\", \"ReleaseVersioning\\ReleaseVersioning.vcxproj\", \"{411F3C13-DA46-42DA-9368-F5ADC5072E00}\"\r\nEndProject\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"HID Wiimote User Mode\", \"HID Wiimote User Mode\\HID Wiimote User Mode.vcxproj\", \"{591EEE1A-3007-4D38-910A-AF3D065105F9}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|Win32 = Debug|Win32\r\n\t\tDebug|x64 = Debug|x64\r\n\t\tRelease|Win32 = Release|Win32\r\n\t\tRelease|x64 = Release|x64\r\n\t\tUniversal Debug|Win32 = Universal Debug|Win32\r\n\t\tUniversal Debug|x64 = Universal Debug|x64\r\n\t\tUniversal Release|Win32 = Universal Release|Win32\r\n\t\tUniversal Release|x64 = Universal Release|x64\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Debug|Win32.ActiveCfg = Windows 10 Debug|Win32\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Debug|Win32.Build.0 = Windows 10 Debug|Win32\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Debug|x64.ActiveCfg = Windows 10 Debug|x64\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Debug|x64.Build.0 = Windows 10 Debug|x64\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Release|Win32.ActiveCfg = Windows 10 Release|Win32\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Release|Win32.Build.0 = Windows 10 Release|Win32\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Release|x64.ActiveCfg = Windows 10 Release|x64\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Release|x64.Build.0 = Windows 10 Release|x64\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Universal Debug|Win32.ActiveCfg = Windows 10 Universal Debug|Win32\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Universal Debug|Win32.Build.0 = Windows 10 Universal Debug|Win32\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Universal Debug|x64.ActiveCfg = Windows 10 Universal Debug|x64\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Universal Debug|x64.Build.0 = Windows 10 Universal Debug|x64\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Universal Release|Win32.ActiveCfg = Windows 10 Universal Release|Win32\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Universal Release|Win32.Build.0 = Windows 10 Universal Release|Win32\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Universal Release|x64.ActiveCfg = Windows 10 Universal Release|x64\r\n\t\t{785D88E1-E758-4966-80FA-AEF74681FEF1}.Universal Release|x64.Build.0 = Windows 10 Universal Release|x64\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Debug|Win32.ActiveCfg = Windows 10 Debug|Win32\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Debug|Win32.Build.0 = Windows 10 Debug|Win32\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Debug|x64.ActiveCfg = Windows 10 Debug|x64\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Debug|x64.Build.0 = Windows 10 Debug|x64\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Release|Win32.ActiveCfg = Windows 10 Release|Win32\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Release|Win32.Build.0 = Windows 10 Release|Win32\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Release|x64.ActiveCfg = Windows 10 Release|x64\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Release|x64.Build.0 = Windows 10 Release|x64\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Universal Debug|Win32.ActiveCfg = Windows 10 Universal Debug|Win32\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Universal Debug|Win32.Build.0 = Windows 10 Universal Debug|Win32\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Universal Debug|x64.ActiveCfg = Windows 10 Universal Debug|x64\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Universal Debug|x64.Build.0 = Windows 10 Universal Debug|x64\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Universal Release|Win32.ActiveCfg = Windows 10 Universal Release|Win32\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Universal Release|Win32.Build.0 = Windows 10 Universal Release|Win32\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Universal Release|x64.ActiveCfg = Windows 10 Universal Release|x64\r\n\t\t{E1721BA4-CF41-483D-A72A-1452A0FF2F1E}.Universal Release|x64.Build.0 = Windows 10 Universal Release|x64\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Debug|Win32.ActiveCfg = Windows 10 Debug|Win32\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Debug|Win32.Build.0 = Windows 10 Debug|Win32\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Debug|x64.ActiveCfg = Windows 10 Debug|x64\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Debug|x64.Build.0 = Windows 10 Debug|x64\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Release|Win32.ActiveCfg = Windows 10 Release|Win32\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Release|Win32.Build.0 = Windows 10 Release|Win32\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Release|x64.ActiveCfg = Windows 10 Release|x64\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Release|x64.Build.0 = Windows 10 Release|x64\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Universal Debug|Win32.ActiveCfg = Windows 10 Universal Debug|Win32\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Universal Debug|Win32.Build.0 = Windows 10 Universal Debug|Win32\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Universal Debug|x64.ActiveCfg = Windows 10 Universal Debug|x64\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Universal Debug|x64.Build.0 = Windows 10 Universal Debug|x64\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Universal Release|Win32.ActiveCfg = Windows 10 Universal Release|Win32\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Universal Release|Win32.Build.0 = Windows 10 Universal Release|Win32\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Universal Release|x64.ActiveCfg = Windows 10 Universal Release|x64\r\n\t\t{3BAFF0EB-1B25-4E8E-8189-267B6686D7BC}.Universal Release|x64.Build.0 = Windows 10 Universal Release|x64\r\n\t\t{0C56BAEE-4F6C-4590-9E48-EFBF80099FEB}.Debug|Win32.ActiveCfg = Windows 10 Release|Win32\r\n\t\t{0C56BAEE-4F6C-4590-9E48-EFBF80099FEB}.Debug|x64.ActiveCfg = Windows 10 Release|x64\r\n\t\t{0C56BAEE-4F6C-4590-9E48-EFBF80099FEB}.Release|Win32.ActiveCfg = Windows 10 Release|Win32\r\n\t\t{0C56BAEE-4F6C-4590-9E48-EFBF80099FEB}.Release|x64.ActiveCfg = Windows 10 Release|x64\r\n\t\t{0C56BAEE-4F6C-4590-9E48-EFBF80099FEB}.Universal Debug|Win32.ActiveCfg = Windows 10 Universal Release|Win32\r\n\t\t{0C56BAEE-4F6C-4590-9E48-EFBF80099FEB}.Universal Debug|x64.ActiveCfg = Windows 10 Universal Release|x64\r\n\t\t{0C56BAEE-4F6C-4590-9E48-EFBF80099FEB}.Universal Release|Win32.ActiveCfg = Windows 10 Universal Release|Win32\r\n\t\t{0C56BAEE-4F6C-4590-9E48-EFBF80099FEB}.Universal Release|x64.ActiveCfg = Windows 10 Universal Release|x64\r\n\t\t{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}.Debug|Win32.ActiveCfg = Debug|x86\r\n\t\t{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}.Debug|Win32.Build.0 = Debug|x86\r\n\t\t{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}.Debug|x64.ActiveCfg = Debug|x64\r\n\t\t{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}.Debug|x64.Build.0 = Debug|x64\r\n\t\t{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}.Release|Win32.ActiveCfg = Release|x86\r\n\t\t{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}.Release|Win32.Build.0 = Release|x86\r\n\t\t{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}.Release|x64.ActiveCfg = Release|x64\r\n\t\t{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}.Release|x64.Build.0 = Release|x64\r\n\t\t{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}.Universal Debug|Win32.ActiveCfg = Debug|x86\r\n\t\t{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}.Universal Debug|x64.ActiveCfg = Debug|x64\r\n\t\t{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}.Universal Release|Win32.ActiveCfg = Release|x86\r\n\t\t{D91AA07C-75AF-47B7-B3EE-CBEFD7AA5616}.Universal Release|x64.ActiveCfg = Release|x64\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Debug|Win32.ActiveCfg = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Debug|Win32.Build.0 = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Debug|x64.ActiveCfg = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Debug|x64.Build.0 = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Release|Win32.ActiveCfg = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Release|Win32.Build.0 = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Release|x64.ActiveCfg = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Release|x64.Build.0 = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Universal Debug|Win32.ActiveCfg = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Universal Debug|Win32.Build.0 = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Universal Debug|x64.ActiveCfg = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Universal Debug|x64.Build.0 = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Universal Release|Win32.ActiveCfg = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Universal Release|Win32.Build.0 = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Universal Release|x64.ActiveCfg = Release|Win32\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00}.Universal Release|x64.Build.0 = Release|Win32\r\n\t\t{591EEE1A-3007-4D38-910A-AF3D065105F9}.Debug|Win32.ActiveCfg = Debug|Win32\r\n\t\t{591EEE1A-3007-4D38-910A-AF3D065105F9}.Debug|Win32.Build.0 = Debug|Win32\r\n\t\t{591EEE1A-3007-4D38-910A-AF3D065105F9}.Debug|x64.ActiveCfg = Debug|x64\r\n\t\t{591EEE1A-3007-4D38-910A-AF3D065105F9}.Debug|x64.Build.0 = Debug|x64\r\n\t\t{591EEE1A-3007-4D38-910A-AF3D065105F9}.Release|Win32.ActiveCfg = Release|Win32\r\n\t\t{591EEE1A-3007-4D38-910A-AF3D065105F9}.Release|Win32.Build.0 = Release|Win32\r\n\t\t{591EEE1A-3007-4D38-910A-AF3D065105F9}.Release|x64.ActiveCfg = Release|x64\r\n\t\t{591EEE1A-3007-4D38-910A-AF3D065105F9}.Release|x64.Build.0 = Release|x64\r\n\t\t{591EEE1A-3007-4D38-910A-AF3D065105F9}.Universal Debug|Win32.ActiveCfg = Debug|Win32\r\n\t\t{591EEE1A-3007-4D38-910A-AF3D065105F9}.Universal Debug|x64.ActiveCfg = Debug|x64\r\n\t\t{591EEE1A-3007-4D38-910A-AF3D065105F9}.Universal Release|Win32.ActiveCfg = Release|Win32\r\n\t\t{591EEE1A-3007-4D38-910A-AF3D065105F9}.Universal Release|x64.ActiveCfg = Release|x64\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\n\tGlobalSection(NestedProjects) = preSolution\r\n\t\t{0C56BAEE-4F6C-4590-9E48-EFBF80099FEB} = {DB263901-FCD3-46C6-9E48-460707381DAB}\r\n\t\t{411F3C13-DA46-42DA-9368-F5ADC5072E00} = {DB263901-FCD3-46C6-9E48-460707381DAB}\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "LICENSE.md",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>."
  },
  {
    "path": "README.md",
    "content": "# HID Wiimote - A Windows Device Driver for the Nintendo Wii Remote\n\n⚠ This project and repository has been archived, as it hasn't been under any active development for a very long time ⚠\n\n## Builds\n\nYou can get test signed and zipped Driver Packages from the project site:\nhttp://julianloehr.de/educational-work/hid-wiimote/\n\n## Build yourself\n\nTo build the driver yourself you need the following software.\nAll paths in the project are either relative or are using Visual Studio Macros.\n\nThe One-Click Build is open `Build` > `Batch Build...`, check only all `BuildAndZip` Configurations and hit `Build` or `Rebuild`. This will build all drivers, User Mode app and library, pack everything into a Driver Package and Zip it. The final Zips are then found in the `Zip` folder.\n\n### Requirements\n\n* Visual Studio 2022\n* Windows SDK for Windows 11\n* Windows Driver Kit (WDK 11)\n\nAll can be downloaded on this page: https://developer.microsoft.com/en-us/windows/hardware/windows-driver-kit\n\n## Projects Overview\n\n### Build And Zip\n\nHelper project to zip the Driver Packages after building. Has only Release Configurations, so should be only used on Release builds. Has a dependency on `HID Wiimote Package` so the package itself is build/rebuild as well.\n\n### Release Versioning\n\nUtility project that generates different files containing the current version string. Version is parsed from package readme.\n\n### HID Miniport\n\nMy own implementation of the MsHidKmdf driver, so I can pass some function addresses to the HID Wiimote driver. It basically just passes everything down to the HID Wiimote filter driver, additionally a custom IOCTL to request function addresses.\n\n### HID Wiimote\n\nMain driver - does all the important Wiimote stuff.\n\n### HID Wiimote Control Center\n\nUser Mode Application to set specific device settings. Also includes an installer and updater.\n\n### HID Wiimote User Mode\n\nUser Mode Managed Library to interact with Wiimote Devices.\n\n### HID Wiimote Package\n\nDriver Package/Utility project, to pack everything into one package and sign it. No code, just settings.\n\n## Contribution\n\nFeel free to create issues, report bugs or give feedback/features wishes.\n"
  },
  {
    "path": "ReleaseVersioning/ReleaseVersioning.vcxproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"Version.js\" />\r\n    <None Include=\"Version.props\" />\r\n    <None Include=\"Version.wsf\" />\r\n    <None Include=\"VersionStrings.cs\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"VersionStrings.h\" />\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <ProjectGuid>{411F3C13-DA46-42DA-9368-F5ADC5072E00}</ProjectGuid>\r\n    <RootNamespace>ReleaseVersioning</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>Utility</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v143</PlatformToolset>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <OutDir>$(PlatformShortName)\\$(Configuration)\\</OutDir>\r\n    <IntDir>$(PlatformShortName)\\$(Configuration)\\</IntDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <PreBuildEvent>\r\n      <Command>cscript.exe Version.wsf //Job:GenerateVersionStringFiles \"$(SolutionDir)HID Wiimote Package\\Readme.txt\"</Command>\r\n    </PreBuildEvent>\r\n  </ItemDefinitionGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n  </ImportGroup>\r\n</Project>"
  },
  {
    "path": "ReleaseVersioning/ReleaseVersioning.vcxproj.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <ItemGroup>\n    <None Include=\"Version.js\" />\n    <None Include=\"Version.wsf\" />\n    <None Include=\"Version.props\">\n      <Filter>Output</Filter>\n    </None>\n    <None Include=\"VersionStrings.cs\">\n      <Filter>Output</Filter>\n    </None>\n  </ItemGroup>\n  <ItemGroup>\n    <Filter Include=\"Output\">\n      <UniqueIdentifier>{fd41ccd1-1a75-4bdf-81b9-1e1bd69feb41}</UniqueIdentifier>\n    </Filter>\n  </ItemGroup>\n  <ItemGroup>\n    <ClInclude Include=\"VersionStrings.h\">\n      <Filter>Output</Filter>\n    </ClInclude>\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "ReleaseVersioning/Version.js",
    "content": "/*\n\nCopyright (C) 2017 Julian Lhr\nAll rights reserved.\n\nFilename:\n\tVersion.js\n\nAbstract:\n\tSmall script to generate various files containing the current version string.\n\n*/\n\nvar FSO = new ActiveXObject(\"Scripting.FileSystemObject\");\n\nvar ForReading = 1;\n\nfunction ParseVersionStringPart(VersionString, Index)\n{\n    var Number = parseInt(VersionString[Index]);\n    if(isNaN(Number))\n    {\n        return 0;\n    }\n\n    return Number;\n}\n\nfunction ParseVersionString(VersionString)\n{\n    var VersionParts = VersionString.split(\".\");\n    var Version = {\n        String: VersionString,\n        Major: ParseVersionStringPart(VersionParts, 0),\n        Minor: ParseVersionStringPart(VersionParts, 1),\n        Build: ParseVersionStringPart(VersionParts, 2),\n        Revision: ParseVersionStringPart(VersionParts, 3)\n    }\n\n    return Version;\n}\n\nfunction GetVersionsFromReadme(ReadmePath)\n{\n    // First Line of Readme is either\n    // HID Wiimote u.v.w.x\n    // or\n    // HID Wiimote u.v.w.x (Device Driver a.b.c.d)\n\n    var ReadmeFile = FSO.OpenTextFile(ReadmePath, ForReading);\n    if (ReadmeFile == null)\n    {\n        WScript.Echo(\"Can't find Readme File: \" + ReadmePath);\n        WScript.Exit(1);\n    }\n\n    var FirstLine = ReadmeFile.ReadLine();\n    if (FirstLine.length == 0)\n    {\n        WScript.Echo(\"First line of Readme is empty: \" + ReadmePath);\n        WScript.Exit(1);\n    }\n\n    var FirstLineParts = FirstLine.split(\" \");\n    var VersionString = FirstLineParts[2];\n    if (VersionString.length == 0) {\n        WScript.Echo(\"Version string of Readme is empty: \" + ReadmePath);\n        WScript.Exit(1);\n    }\n\n    var Versions = {\n        ControlCenter: ParseVersionString(VersionString)\n    }\n    \n    if (FirstLineParts.length > 3)\n    {\n        VersionString = FirstLineParts[FirstLineParts.length - 1].slice(0, -1);\n        Versions.DeviceDriver = ParseVersionString(VersionString);\n    }\n    else\n    {\n        Versions.DeviceDriver = Versions.ControlCenter;\n    }\n    \n\n    return Versions;\n}\n\nfunction UpdateFile(FilePath, NewContent)\n{\n    var OutputFile = null;\n\n    if (FSO.FileExists(FilePath))\n    {\n        OutputFile = FSO.OpenTextFile(FilePath);\n    }\n\n    if ((OutputFile == null) || (OutputFile.ReadAll() != NewContent)) {\n        OutputFile = FSO.CreateTextFile(FilePath, true);\n        OutputFile.Write(NewContent);\n    }\n}\n\nfunction GenerateVersionPropsSheet(Versions, OutputPath)\n{\n    var FileContent = \"\";\n    FileContent += '<?xml version=\"1.0\" encoding=\"utf-8\"?>' + \"\\n\";\n    FileContent += '<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">' + \"\\n\";\n    FileContent += '  <PropertyGroup Label=\"UserMacros\">' + \"\\n\";\n    FileContent += '    <ControlCenterVersion>' + Versions.ControlCenter.String + '</ControlCenterVersion>' + \"\\n\";\n    FileContent += '    <DeviceDriverVersion>' + Versions.DeviceDriver.String + '</DeviceDriverVersion>' + \"\\n\";\n    FileContent += '  </PropertyGroup>' + \"\\n\";\n    FileContent += '</Project>' + \"\\n\";\n\n    UpdateFile(OutputPath, FileContent);\n}\n\nfunction GenerateVersionStringClass(Versions, OutputPath)\n{\n    var FileContent = \"// Auto generated file\\n\";\n    FileContent += \"// Changes will be overwritten\\n\";\n    FileContent += \"namespace HIDWiimote\\n\";\n    FileContent += \"{\\n\";\n    FileContent += \"    internal static class VersionStrings\\n\";\n    FileContent += \"    {\\n\";\n    FileContent += \"        public const string ControlCenterVersion = \\\"\" + Versions.ControlCenter.String + \"\\\";\\n\";\n    FileContent += \"        public const string DeviceDriverVersion = \\\"\" + Versions.DeviceDriver.String + \"\\\";\\n\";\n    FileContent += \"    }\\n\";\n    FileContent += \"}\\n\";\n\n    UpdateFile(OutputPath, FileContent);\n}\n\nfunction GenerateVersionStringHeaderFile(Versions, OutputPath)\n{\n    var FileContent = \"// Auto generated file\\n\";\n    FileContent += \"// Changes will be overwritten\\n\";\n    FileContent += \"#pragma once\\n\";\n    FileContent += \"\\n\";\n    FileContent += \"#define CONTROL_CENTER_VERSION \" + Versions.ControlCenter.Major + \",\" + Versions.ControlCenter.Minor + \",\" + Versions.ControlCenter.Build + \",\" + Versions.ControlCenter.Revision + \"\\n\";\n    FileContent += \"#define CONTROL_CENTER_VERSION_STRING \\\"\" + Versions.ControlCenter.String + \"\\\"\\n\";\n    FileContent += \"#define DEVICE_DRIVER_VERSION \" + Versions.DeviceDriver.Major + \",\" + Versions.DeviceDriver.Minor + \",\" + Versions.DeviceDriver.Build + \",\" + Versions.DeviceDriver.Revision + \"\\n\";\n    FileContent += \"#define DEVICE_DRIVER_VERSION_STRING \\\"\" + Versions.DeviceDriver.String + \"\\\"\\n\";\n    FileContent += \"\\n\";\n\n    UpdateFile(OutputPath, FileContent);\n}"
  },
  {
    "path": "ReleaseVersioning/Version.wsf",
    "content": "<package>\n    <job id=\"GenerateVersionStringFiles\" >\n        <script language=\"JScript\" src=\"Version.js\" />\n        <script language=\"JScript\">\n            // Arg 0: Readme file path\n            WScript.Echo(\"Generating Version String Files...\");\n\n            var Versions = GetVersionsFromReadme(WScript.arguments(0));\n\n            GenerateVersionPropsSheet(Versions, \"Version.props\");\n            GenerateVersionStringClass(Versions, \"VersionStrings.cs\");\n            GenerateVersionStringHeaderFile(Versions, \"VersionStrings.h\");\n        </script>\n    </job>\n</package>"
  }
]