Skip to content

Commit

Permalink
Added Nunchuk Support
Browse files Browse the repository at this point in the history
  • Loading branch information
KeyPuncher committed Jun 26, 2017
1 parent 7aee9f1 commit d0ee18c
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Shared/Windows/WinBtStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public WinBtStream(string path)
UseToshiba = ForceToshibaMode;// || !BluetoothEnableDiscovery(IntPtr.Zero, true);

// Default Windows 8/10 to ReadWrite (non exclusive)
if (Environment.OSVersion.Version.Major > 6)
if (Environment.OSVersion.Version.Major > 6
|| (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 2)) // temp
{
SharingMode = FileShare.ReadWrite;
UseWriteFile = true;
Expand Down
33 changes: 30 additions & 3 deletions WiinUPro/Controls/WiiControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,37 @@
</Canvas>
</Viewbox>
<!-- Nunchuck -->
<Viewbox x:Name="viewNunchuk" Width="545" Visibility="Collapsed">
<Canvas Width="1179" Height="1500" Background="Transparent">
<Viewbox x:Name="viewNunchuk" Width="200" Visibility="Collapsed">
<Canvas Width="277" Height="1104" Background="Transparent">
<Grid Margin="0,0,0,0">
<Image Source="/WiinUPro;component/Images/Controllers/Nunchuk/Nun_temp.jpg" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0" Width="1179" Height="1500"/>
<Image Source="/WiinUPro;component/Images/Controllers/Nunchuk/nunchuk-base.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,240,0,0" Width="270"/>
<Image Source="/WiinUPro;component/Images/Controllers/Nunchuk/nunchuck-back.png" HorizontalAlignment="Left" VerticalAlignment="Top" Width="270"/>
<Image x:Name="nBtnC" Source="/WiinUPro;component/Images/Controllers/Nunchuk/nunC.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="95,25,0,0" Width="86" Opacity="0" MouseLeftButtonDown="Btn_MouseLeftButtonDown" MouseRightButtonUp="Btn_MouseRightButtonUp" Tag="nC" />
<Image x:Name="nBtnZ" Source="/WiinUPro;component/Images/Controllers/Nunchuk/nunZ.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="69,100,0,0" Width="136" Opacity="0" MouseLeftButtonDown="Btn_MouseLeftButtonDown" MouseRightButtonUp="Btn_MouseRightButtonUp" Tag="nZ" />
<Image x:Name="nJoy" Source="/WiinUPro;component/Images/Controllers/Nunchuk/nunJoy.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="70,360,0,0" Width="121" Opacity="1" MouseLeftButtonUp="OpenContextMenu" >
<Image.ContextMenu>
<ContextMenu>
<MenuItem Header="Up" Tag="nUP" Click="OpenInput"/>
<MenuItem Header="Left" Tag="nLEFT" Click="OpenInput"/>
<MenuItem Header="Right" Tag="nRIGHT" Click="OpenInput"/>
<MenuItem Header="Down" Tag="nDOWN" Click="OpenInput"/>
<Separator/>
<MenuItem Header="Quick Assign">
<MenuItem Header="Mouse">
<MenuItem Header="50% Speed" Tag="n" Click="QuickAssignMouse_Click" />
<MenuItem Header="100% Speed" Tag="n" Click="QuickAssignMouse_Click" />
<MenuItem Header="150% Speed" Tag="n" Click="QuickAssignMouse_Click" />
<MenuItem Header="200% Speed" Tag="n" Click="QuickAssignMouse_Click" />
<MenuItem Header="250% Speed" Tag="n" Click="QuickAssignMouse_Click" />
<MenuItem Header="300% Speed" Tag="n" Click="QuickAssignMouse_Click" />
</MenuItem>
<MenuItem Header="WASD" Tag="nL" Click="QuickAssign_Click"/>
<MenuItem Header="Arrows" Tag="n" Click="QuickAssign_Click"/>
</MenuItem>
<MenuItem Header="Calibrate" Tag="nJoy" Click="CalibrateJoystick_Click"/>
</ContextMenu>
</Image.ContextMenu>
</Image>
</Grid>
</Canvas>
</Viewbox>
Expand Down
5 changes: 4 additions & 1 deletion WiinUPro/Controls/WiiControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public void UpdateVisual(INintrollerState state)
var nun = (Nunchuk)state;
UpdateWiimoteVisual(nun.wiimote);

nBtnC.Opacity = nun.C ? 1 : 0;
nBtnZ.Opacity = nun.Z ? 1 : 0;
nJoy.Margin = new Thickness(70 + 30 * nun.joystick.X, 360 - 30 * nun.joystick.Y, 0, 0);

if (_openJoyWindow != null && _calibrationTarget == "nJoy")
{
_openJoyWindow.Update(nun.joystick);
Expand All @@ -69,7 +73,6 @@ public void UpdateVisual(INintrollerState state)
var cc = (ClassicController)state;
UpdateWiimoteVisual(cc.wiimote);

// TODO: Make L & R Triggers work
ccBtnA.Opacity = cc.A ? 1 : 0;
ccBtnB.Opacity = cc.B ? 1 : 0;
ccBtnX.Opacity = cc.X ? 1 : 0;
Expand Down
Binary file removed WiinUPro/Images/Controllers/Nunchuk/Nun_temp.jpg
Binary file not shown.
Binary file added WiinUPro/Images/Controllers/Nunchuk/nunC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WiinUPro/Images/Controllers/Nunchuk/nunJoy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added WiinUPro/Images/Controllers/Nunchuk/nunZ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion WiinUPro/WiinUPro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
<PropertyGroup>
<ApplicationIcon>app.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
Expand Down Expand Up @@ -437,7 +440,6 @@
<Resource Include="Images\Controllers\Wiimote\wmRight.png" />
<Resource Include="Images\Controllers\Wiimote\wmTwo.png" />
<Resource Include="Images\Controllers\Wiimote\wmUp.png" />
<Resource Include="Images\Controllers\Nunchuk\Nun_temp.jpg" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Controllers\ClassicPro\ccpRight.png" />
Expand Down Expand Up @@ -515,6 +517,13 @@
<ItemGroup>
<Resource Include="Images\Icons\joystick_icon.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Controllers\Nunchuk\nunC.png" />
<Resource Include="Images\Controllers\Nunchuk\nunchuck-back.png" />
<Resource Include="Images\Controllers\Nunchuk\nunchuk-base.png" />
<Resource Include="Images\Controllers\Nunchuk\nunJoy.png" />
<Resource Include="Images\Controllers\Nunchuk\nunZ.png" />
</ItemGroup>
<Import Project="..\Shared\Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
2 changes: 1 addition & 1 deletion WiinUPro/app.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="0.9.0.0" name="WiinUPro.exe"/>
<assemblyIdentity version="0.8.1.550" name="WiinUPro.exe"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
Expand Down

0 comments on commit d0ee18c

Please sign in to comment.