Skip to content

Commit

Permalink
add xbox gamepad config page
Browse files Browse the repository at this point in the history
  • Loading branch information
duchuule committed Oct 6, 2015
1 parent c2b9ac2 commit ee61143
Show file tree
Hide file tree
Showing 12 changed files with 403 additions and 5 deletions.
144 changes: 143 additions & 1 deletion EmulatorSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,128 @@ namespace VBA10
}
}

property int XboxA
{
int get()
{
return GetValueOrDefault<int>(XboxAKey, XboxADefault);
}
void set(int value)
{
AddOrUpdateValue(XboxAKey, value);
}
}

property int XboxB
{
int get()
{
return GetValueOrDefault<int>(XboxBKey, XboxBDefault);
}
void set(int value)
{
AddOrUpdateValue(XboxBKey, value);
}
}

property int XboxX
{
int get()
{
return GetValueOrDefault<int>(XboxXKey, XboxXDefault);
}
void set(int value)
{
AddOrUpdateValue(XboxXKey, value);
}
}

property int XboxY
{
int get()
{
return GetValueOrDefault<int>(XboxYKey, XboxYDefault);
}
void set(int value)
{
AddOrUpdateValue(XboxYKey, value);
}
}


property int XboxL1
{
int get()
{
return GetValueOrDefault<int>(XboxL1Key, XboxL1Default);
}
void set(int value)
{
AddOrUpdateValue(XboxL1Key, value);
}
}


property int XboxL2
{
int get()
{
return GetValueOrDefault<int>(XboxL2Key, XboxL2Default);
}
void set(int value)
{
AddOrUpdateValue(XboxL2Key, value);
}
}

property int XboxL3
{
int get()
{
return GetValueOrDefault<int>(XboxL3Key, XboxL3Default);
}
void set(int value)
{
AddOrUpdateValue(XboxL3Key, value);
}
}

property int XboxR1
{
int get()
{
return GetValueOrDefault<int>(XboxR1Key, XboxR1Default);
}
void set(int value)
{
AddOrUpdateValue(XboxR1Key, value);
}
}

property int XboxR2
{
int get()
{
return GetValueOrDefault<int>(XboxR2Key, XboxR2Default);
}
void set(int value)
{
AddOrUpdateValue(XboxR2Key, value);
}
}

property int XboxR3
{
int get()
{
return GetValueOrDefault<int>(XboxR3Key, XboxR3Default);
}
void set(int value)
{
AddOrUpdateValue(XboxR3Key, value);
}
}

#pragma region Button positions

property double PadLeftP
Expand Down Expand Up @@ -674,6 +796,17 @@ namespace VBA10
Platform::String^ PixelShaderKey = "PixelShaderKey";
Platform::String^ CommandButtonPositionKey = "CommandButtonPositionKey";

Platform::String^ XboxAKey = "XboxAKey";
Platform::String^ XboxBKey = "XboxBKey";
Platform::String^ XboxXKey = "XboxXKey";
Platform::String^ XboxYKey = "XboxYKey";
Platform::String^ XboxL1Key = "XboxL1Key";
Platform::String^ XboxL2Key = "XboxL2Key";
Platform::String^ XboxR1Key = "XboxR1Key";
Platform::String^ XboxR2Key = "XboxR2Key";
Platform::String^ XboxL3Key = "XboxL3Key";
Platform::String^ XboxR3Key = "XboxR3Key";

#pragma region button positions
Platform::String^ PadLeftPKey = "PadLeftPKey";
Platform::String^ PadBottomPKey = "PadBottomPKey";
Expand Down Expand Up @@ -731,7 +864,16 @@ namespace VBA10
const int PixelFilterDefault = 0; //0: none
const int PixelShaderDefault = 1; //0: nearest neighbor, 1: bilinear
const int CommandButtonPositionDefault = 0; //auto

const int XboxADefault = 1; //A
const int XboxBDefault = 2; //B
const int XboxXDefault = 2; //B
const int XboxYDefault = 5; //A+B
const int XboxL1Default = 3; //L
const int XboxL2Default = 3; //L
const int XboxR1Default = 4; //R
const int XboxR2Default = 4; //R
const int XboxL3Default = 0; //none
const int XboxR3Default = 6; //turbo

#pragma region button positions (in cm based on 6x10cm phone)
const double PadLeftPDefault = 0.1f; //from left
Expand Down
2 changes: 1 addition & 1 deletion HIDGamepadConfig.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
<Button Content="Close" Grid.Row="3"
Width="120"
HorizontalAlignment="Center"
Margin="0,0,0,4"
Margin="0,8,0,4"
x:Name="closeBtn"
Click="closeBtn_Click"/>
</Grid>
Expand Down
6 changes: 6 additions & 0 deletions HelpPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@
<LineBreak />
<Run Text="- Rahadian Rihadi for Indonesian translation."/>
<LineBreak />
<Run Text="- Luiz Alberto for Portuguese translation."/>
<LineBreak />
<Run Text="- Vladislav Beliy for Ukrainian translation."/>
<LineBreak />
<Run Text="- Vladimir Volkov for Russian translation."/>
<LineBreak />
<LineBreak />
<Run Text="The author is not responsible for any illegal use of this software. Further more, there is no warranty for this software and the author is not liable for any damages."/>
<LineBreak/>
Expand Down
1 change: 1 addition & 0 deletions Package.StoreAssociation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@
<AccountPackageIdentityNames>
<MainPackageIdentityName>16994Sparksoft.LoanBook</MainPackageIdentityName>
<MainPackageIdentityName>16994Sparksoft.Snes8x</MainPackageIdentityName>
<MainPackageIdentityName>16994Sparksoft.VBA10Pro</MainPackageIdentityName>
<MainPackageIdentityName>16994Sparksoft.VBA8</MainPackageIdentityName>
<MainPackageIdentityName>16994Sparksoft.VGBC8</MainPackageIdentityName>
</AccountPackageIdentityNames>
Expand Down
2 changes: 1 addition & 1 deletion Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
<Identity Name="16994Sparksoft.VBA10" Publisher="CN=9289A21E-3389-49E2-A9E0-46AA1289C3CB" Version="1.17.186.0" />
<Identity Name="16994Sparksoft.VBA10" Publisher="CN=9289A21E-3389-49E2-A9E0-46AA1289C3CB" Version="1.18.187.0" />
<mp:PhoneIdentity PhoneProductId="2b9558e5-6253-426c-8989-3284f508e743" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>VBA10</DisplayName>
Expand Down
2 changes: 1 addition & 1 deletion SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<Button x:Name="ConfigureXboxBtn" Content="**Configure"
x:Uid="ConfigureBtn"
HorizontalAlignment="Stretch"
Margin="0,0,0,12"
Margin="0,0,0,12" Click="ConfigureXboxBtn_Click"
/>

<StackPanel x:Name="panelHIDGamepad" >
Expand Down
14 changes: 13 additions & 1 deletion SettingsPage.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ SettingsPage::SettingsPage()
else
{
this->txtControllerStatus->Text = loader->GetString("XboxControllerConnectedText");
this->ConfigureXboxBtn->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
this->ConfigureXboxBtn->Visibility = Windows::UI::Xaml::Visibility::Visible;
}


Expand Down Expand Up @@ -269,6 +269,15 @@ void SettingsPage::OnCompleted(Platform::Object ^sender, Platform::Object ^args)
dialog->ShowAsync();
}

void SettingsPage::ConfigureXboxBtn_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->Frame->Navigate(
TypeName(XboxConfigPage::typeid),
nullptr,
ref new Windows::UI::Xaml::Media::Animation::DrillInNavigationTransitionInfo());
}


void SettingsPage::ConfigureBtn_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
if (this->HIDDeviceList->Size == 0)
Expand Down Expand Up @@ -825,3 +834,6 @@ void SettingsPage::hideHamburgerToggle_Toggled(Platform::Object^ sender, Windows






1 change: 1 addition & 0 deletions SettingsPage.xaml.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@ namespace VBA10
void cboPixelShader_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
void skipComboBox_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
void cboCommandButtonPosition_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
void ConfigureXboxBtn_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
};
}
9 changes: 9 additions & 0 deletions Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,15 @@
<data name="EmulatorFunction.Text" xml:space="preserve">
<value>Emulator function</value>
</data>
<data name="L3LeftStick.Text" xml:space="preserve">
<value>L3 (Left stick press)</value>
</data>
<data name="R3RightStick.Text" xml:space="preserve">
<value>R3 (Right stick press)</value>
</data>
<data name="TurboText" xml:space="preserve">
<value>Turbo</value>
</data>
<data name="XboxButton.Text" xml:space="preserve">
<value>Xbox button</value>
</data>
Expand Down
116 changes: 116 additions & 0 deletions XboxConfigPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<Page
x:Class="VBA10.XboxConfigPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:VBA10"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>


<StackPanel Background="{ThemeResource ListBoxBorderThemeBrush}"
VerticalAlignment="Stretch"
Orientation="Horizontal" >

<TextBlock Text="**Xbox Gamepad Config"
Style="{ThemeResource TitleTextBlockStyle}"
Margin="12,4,0,4"
x:Uid="XboxGamepadConfig"
x:Name="txtTitle"
/>
</StackPanel>

<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
Grid.Row="1"
>
<StackPanel MaxWidth="500"
HorizontalAlignment="Left">

<TextBlock Grid.Row="0" Text="invisible text to stretch the panel invisible text to stretch the panel invisible text to stretch the panel"
Height="0"
/>


<Grid Margin="12,0,12,0"
x:Name="gridMain"
>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>


<TextBlock Grid.Row="0" Grid.Column="0" Text="**Xbox button" x:Uid="XboxButton" Margin="0,12,0,4" Style="{ThemeResource BaseTextBlockStyle}" />
<TextBlock Grid.Row="0" Grid.Column="1" Text="**Emulator function" x:Uid="EmulatorFunction" Margin="0,12,0,4" Style="{ThemeResource BaseTextBlockStyle}" />

<TextBlock Grid.Row="1" Grid.Column="0" Text="A" VerticalAlignment="Center" Margin="0,12,0,4" />
<ComboBox Grid.Row="1" Grid.Column="1" x:Name="cboA" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
<TextBlock Grid.Row="2" Grid.Column="0" Text="B" VerticalAlignment="Center" Margin="0,12,0,4" />
<ComboBox Grid.Row="2" Grid.Column="1" x:Name="cboB" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
<TextBlock Grid.Row="3" Grid.Column="0" Text="X" VerticalAlignment="Center" Margin="0,12,0,4" />
<ComboBox Grid.Row="3" Grid.Column="1" x:Name="cboX" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
<TextBlock Grid.Row="4" Grid.Column="0" Text="Y" VerticalAlignment="Center" Margin="0,12,0,4" />
<ComboBox Grid.Row="4" Grid.Column="1" x:Name="cboY" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
<TextBlock Grid.Row="5" Grid.Column="0" Text="L1" VerticalAlignment="Center" Margin="0,12,0,4" />
<ComboBox Grid.Row="5" Grid.Column="1" x:Name="cboL1" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
<TextBlock Grid.Row="6" Grid.Column="0" Text="L2" VerticalAlignment="Center" Margin="0,12,0,4" />
<ComboBox Grid.Row="6" Grid.Column="1" x:Name="cboL2" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
<TextBlock Grid.Row="7" Grid.Column="0" Text="R1" VerticalAlignment="Center" Margin="0,12,0,4" />
<ComboBox Grid.Row="7" Grid.Column="1" x:Name="cboR1" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
<TextBlock Grid.Row="8" Grid.Column="0" Text="R2" VerticalAlignment="Center" Margin="0,12,0,4" />
<ComboBox Grid.Row="8" Grid.Column="1" x:Name="cboR2" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
<TextBlock Grid.Row="9" Grid.Column="0" Text="**L3 (Left stick press)" x:Uid="L3LeftStick" VerticalAlignment="Center" Margin="0,12,0,4" />
<ComboBox Grid.Row="9" Grid.Column="1" x:Name="cboL3" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
<TextBlock Grid.Row="10" Grid.Column="0" Text="**R3 (Right stick press)" x:Uid="R3RightStick" VerticalAlignment="Center" Margin="0,12,0,4" />
<ComboBox Grid.Row="10" Grid.Column="1" x:Name="cboR3" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
</Grid>



</StackPanel>
</ScrollViewer>

<StackPanel Orientation="Horizontal"
Margin="0,8,0,4"
Grid.Row="2"
HorizontalAlignment="Center">
<Button Content="**Cancel"
Width="120"
HorizontalAlignment="Center"
x:Name="CancelBtn"
Margin="0,0,8,0"
x:Uid="CancelBtn" Click="CancelBtn_Click"
/>

<Button Content="**OK"
Width="120"
HorizontalAlignment="Center"
x:Name="OkBtn"
x:Uid="OKBtn" Click="OkBtn_Click"
/>
</StackPanel>
</Grid>
</Page>
Loading

0 comments on commit ee61143

Please sign in to comment.