Skip to content

Commit ee61143

Browse files
committed
add xbox gamepad config page
1 parent c2b9ac2 commit ee61143

12 files changed

+403
-5
lines changed

EmulatorSettings.h

Lines changed: 143 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,128 @@ namespace VBA10
229229
}
230230
}
231231

232+
property int XboxA
233+
{
234+
int get()
235+
{
236+
return GetValueOrDefault<int>(XboxAKey, XboxADefault);
237+
}
238+
void set(int value)
239+
{
240+
AddOrUpdateValue(XboxAKey, value);
241+
}
242+
}
243+
244+
property int XboxB
245+
{
246+
int get()
247+
{
248+
return GetValueOrDefault<int>(XboxBKey, XboxBDefault);
249+
}
250+
void set(int value)
251+
{
252+
AddOrUpdateValue(XboxBKey, value);
253+
}
254+
}
255+
256+
property int XboxX
257+
{
258+
int get()
259+
{
260+
return GetValueOrDefault<int>(XboxXKey, XboxXDefault);
261+
}
262+
void set(int value)
263+
{
264+
AddOrUpdateValue(XboxXKey, value);
265+
}
266+
}
267+
268+
property int XboxY
269+
{
270+
int get()
271+
{
272+
return GetValueOrDefault<int>(XboxYKey, XboxYDefault);
273+
}
274+
void set(int value)
275+
{
276+
AddOrUpdateValue(XboxYKey, value);
277+
}
278+
}
279+
280+
281+
property int XboxL1
282+
{
283+
int get()
284+
{
285+
return GetValueOrDefault<int>(XboxL1Key, XboxL1Default);
286+
}
287+
void set(int value)
288+
{
289+
AddOrUpdateValue(XboxL1Key, value);
290+
}
291+
}
292+
293+
294+
property int XboxL2
295+
{
296+
int get()
297+
{
298+
return GetValueOrDefault<int>(XboxL2Key, XboxL2Default);
299+
}
300+
void set(int value)
301+
{
302+
AddOrUpdateValue(XboxL2Key, value);
303+
}
304+
}
305+
306+
property int XboxL3
307+
{
308+
int get()
309+
{
310+
return GetValueOrDefault<int>(XboxL3Key, XboxL3Default);
311+
}
312+
void set(int value)
313+
{
314+
AddOrUpdateValue(XboxL3Key, value);
315+
}
316+
}
317+
318+
property int XboxR1
319+
{
320+
int get()
321+
{
322+
return GetValueOrDefault<int>(XboxR1Key, XboxR1Default);
323+
}
324+
void set(int value)
325+
{
326+
AddOrUpdateValue(XboxR1Key, value);
327+
}
328+
}
329+
330+
property int XboxR2
331+
{
332+
int get()
333+
{
334+
return GetValueOrDefault<int>(XboxR2Key, XboxR2Default);
335+
}
336+
void set(int value)
337+
{
338+
AddOrUpdateValue(XboxR2Key, value);
339+
}
340+
}
341+
342+
property int XboxR3
343+
{
344+
int get()
345+
{
346+
return GetValueOrDefault<int>(XboxR3Key, XboxR3Default);
347+
}
348+
void set(int value)
349+
{
350+
AddOrUpdateValue(XboxR3Key, value);
351+
}
352+
}
353+
232354
#pragma region Button positions
233355

234356
property double PadLeftP
@@ -674,6 +796,17 @@ namespace VBA10
674796
Platform::String^ PixelShaderKey = "PixelShaderKey";
675797
Platform::String^ CommandButtonPositionKey = "CommandButtonPositionKey";
676798

799+
Platform::String^ XboxAKey = "XboxAKey";
800+
Platform::String^ XboxBKey = "XboxBKey";
801+
Platform::String^ XboxXKey = "XboxXKey";
802+
Platform::String^ XboxYKey = "XboxYKey";
803+
Platform::String^ XboxL1Key = "XboxL1Key";
804+
Platform::String^ XboxL2Key = "XboxL2Key";
805+
Platform::String^ XboxR1Key = "XboxR1Key";
806+
Platform::String^ XboxR2Key = "XboxR2Key";
807+
Platform::String^ XboxL3Key = "XboxL3Key";
808+
Platform::String^ XboxR3Key = "XboxR3Key";
809+
677810
#pragma region button positions
678811
Platform::String^ PadLeftPKey = "PadLeftPKey";
679812
Platform::String^ PadBottomPKey = "PadBottomPKey";
@@ -731,7 +864,16 @@ namespace VBA10
731864
const int PixelFilterDefault = 0; //0: none
732865
const int PixelShaderDefault = 1; //0: nearest neighbor, 1: bilinear
733866
const int CommandButtonPositionDefault = 0; //auto
734-
867+
const int XboxADefault = 1; //A
868+
const int XboxBDefault = 2; //B
869+
const int XboxXDefault = 2; //B
870+
const int XboxYDefault = 5; //A+B
871+
const int XboxL1Default = 3; //L
872+
const int XboxL2Default = 3; //L
873+
const int XboxR1Default = 4; //R
874+
const int XboxR2Default = 4; //R
875+
const int XboxL3Default = 0; //none
876+
const int XboxR3Default = 6; //turbo
735877

736878
#pragma region button positions (in cm based on 6x10cm phone)
737879
const double PadLeftPDefault = 0.1f; //from left

HIDGamepadConfig.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
<Button Content="Close" Grid.Row="3"
124124
Width="120"
125125
HorizontalAlignment="Center"
126-
Margin="0,0,0,4"
126+
Margin="0,8,0,4"
127127
x:Name="closeBtn"
128128
Click="closeBtn_Click"/>
129129
</Grid>

HelpPage.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@
9797
<LineBreak />
9898
<Run Text="- Rahadian Rihadi for Indonesian translation."/>
9999
<LineBreak />
100+
<Run Text="- Luiz Alberto for Portuguese translation."/>
101+
<LineBreak />
102+
<Run Text="- Vladislav Beliy for Ukrainian translation."/>
103+
<LineBreak />
104+
<Run Text="- Vladimir Volkov for Russian translation."/>
105+
<LineBreak />
100106
<LineBreak />
101107
<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."/>
102108
<LineBreak/>

Package.StoreAssociation.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@
364364
<AccountPackageIdentityNames>
365365
<MainPackageIdentityName>16994Sparksoft.LoanBook</MainPackageIdentityName>
366366
<MainPackageIdentityName>16994Sparksoft.Snes8x</MainPackageIdentityName>
367+
<MainPackageIdentityName>16994Sparksoft.VBA10Pro</MainPackageIdentityName>
367368
<MainPackageIdentityName>16994Sparksoft.VBA8</MainPackageIdentityName>
368369
<MainPackageIdentityName>16994Sparksoft.VGBC8</MainPackageIdentityName>
369370
</AccountPackageIdentityNames>

Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<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">
3-
<Identity Name="16994Sparksoft.VBA10" Publisher="CN=9289A21E-3389-49E2-A9E0-46AA1289C3CB" Version="1.17.186.0" />
3+
<Identity Name="16994Sparksoft.VBA10" Publisher="CN=9289A21E-3389-49E2-A9E0-46AA1289C3CB" Version="1.18.187.0" />
44
<mp:PhoneIdentity PhoneProductId="2b9558e5-6253-426c-8989-3284f508e743" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
55
<Properties>
66
<DisplayName>VBA10</DisplayName>

SettingsPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<Button x:Name="ConfigureXboxBtn" Content="**Configure"
8686
x:Uid="ConfigureBtn"
8787
HorizontalAlignment="Stretch"
88-
Margin="0,0,0,12"
88+
Margin="0,0,0,12" Click="ConfigureXboxBtn_Click"
8989
/>
9090

9191
<StackPanel x:Name="panelHIDGamepad" >

SettingsPage.xaml.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ SettingsPage::SettingsPage()
159159
else
160160
{
161161
this->txtControllerStatus->Text = loader->GetString("XboxControllerConnectedText");
162-
this->ConfigureXboxBtn->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
162+
this->ConfigureXboxBtn->Visibility = Windows::UI::Xaml::Visibility::Visible;
163163
}
164164

165165

@@ -269,6 +269,15 @@ void SettingsPage::OnCompleted(Platform::Object ^sender, Platform::Object ^args)
269269
dialog->ShowAsync();
270270
}
271271

272+
void SettingsPage::ConfigureXboxBtn_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
273+
{
274+
this->Frame->Navigate(
275+
TypeName(XboxConfigPage::typeid),
276+
nullptr,
277+
ref new Windows::UI::Xaml::Media::Animation::DrillInNavigationTransitionInfo());
278+
}
279+
280+
272281
void SettingsPage::ConfigureBtn_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
273282
{
274283
if (this->HIDDeviceList->Size == 0)
@@ -825,3 +834,6 @@ void SettingsPage::hideHamburgerToggle_Toggled(Platform::Object^ sender, Windows
825834

826835

827836

837+
838+
839+

SettingsPage.xaml.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,6 @@ namespace VBA10
8686
void cboPixelShader_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
8787
void skipComboBox_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
8888
void cboCommandButtonPosition_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e);
89+
void ConfigureXboxBtn_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
8990
};
9091
}

Strings/en-US/Resources.resw

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,15 @@
672672
<data name="EmulatorFunction.Text" xml:space="preserve">
673673
<value>Emulator function</value>
674674
</data>
675+
<data name="L3LeftStick.Text" xml:space="preserve">
676+
<value>L3 (Left stick press)</value>
677+
</data>
678+
<data name="R3RightStick.Text" xml:space="preserve">
679+
<value>R3 (Right stick press)</value>
680+
</data>
681+
<data name="TurboText" xml:space="preserve">
682+
<value>Turbo</value>
683+
</data>
675684
<data name="XboxButton.Text" xml:space="preserve">
676685
<value>Xbox button</value>
677686
</data>

XboxConfigPage.xaml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<Page
2+
x:Class="VBA10.XboxConfigPage"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:VBA10"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
mc:Ignorable="d">
9+
10+
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
11+
<Grid.RowDefinitions>
12+
<RowDefinition Height="Auto" />
13+
<RowDefinition Height="*" />
14+
<RowDefinition Height="Auto" />
15+
</Grid.RowDefinitions>
16+
17+
18+
<StackPanel Background="{ThemeResource ListBoxBorderThemeBrush}"
19+
VerticalAlignment="Stretch"
20+
Orientation="Horizontal" >
21+
22+
<TextBlock Text="**Xbox Gamepad Config"
23+
Style="{ThemeResource TitleTextBlockStyle}"
24+
Margin="12,4,0,4"
25+
x:Uid="XboxGamepadConfig"
26+
x:Name="txtTitle"
27+
/>
28+
</StackPanel>
29+
30+
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
31+
VerticalScrollBarVisibility="Auto"
32+
Grid.Row="1"
33+
>
34+
<StackPanel MaxWidth="500"
35+
HorizontalAlignment="Left">
36+
37+
<TextBlock Grid.Row="0" Text="invisible text to stretch the panel invisible text to stretch the panel invisible text to stretch the panel"
38+
Height="0"
39+
/>
40+
41+
42+
<Grid Margin="12,0,12,0"
43+
x:Name="gridMain"
44+
>
45+
<Grid.RowDefinitions>
46+
<RowDefinition Height="Auto" />
47+
<RowDefinition Height="Auto" />
48+
<RowDefinition Height="Auto" />
49+
<RowDefinition Height="Auto" />
50+
<RowDefinition Height="Auto" />
51+
<RowDefinition Height="Auto" />
52+
<RowDefinition Height="Auto" />
53+
<RowDefinition Height="Auto" />
54+
<RowDefinition Height="Auto" />
55+
<RowDefinition Height="Auto" />
56+
<RowDefinition Height="Auto" />
57+
<RowDefinition Height="Auto" />
58+
<RowDefinition Height="Auto" />
59+
</Grid.RowDefinitions>
60+
<Grid.ColumnDefinitions>
61+
<ColumnDefinition Width="1*" />
62+
<ColumnDefinition Width="1*" />
63+
</Grid.ColumnDefinitions>
64+
65+
66+
<TextBlock Grid.Row="0" Grid.Column="0" Text="**Xbox button" x:Uid="XboxButton" Margin="0,12,0,4" Style="{ThemeResource BaseTextBlockStyle}" />
67+
<TextBlock Grid.Row="0" Grid.Column="1" Text="**Emulator function" x:Uid="EmulatorFunction" Margin="0,12,0,4" Style="{ThemeResource BaseTextBlockStyle}" />
68+
69+
<TextBlock Grid.Row="1" Grid.Column="0" Text="A" VerticalAlignment="Center" Margin="0,12,0,4" />
70+
<ComboBox Grid.Row="1" Grid.Column="1" x:Name="cboA" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
71+
<TextBlock Grid.Row="2" Grid.Column="0" Text="B" VerticalAlignment="Center" Margin="0,12,0,4" />
72+
<ComboBox Grid.Row="2" Grid.Column="1" x:Name="cboB" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
73+
<TextBlock Grid.Row="3" Grid.Column="0" Text="X" VerticalAlignment="Center" Margin="0,12,0,4" />
74+
<ComboBox Grid.Row="3" Grid.Column="1" x:Name="cboX" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
75+
<TextBlock Grid.Row="4" Grid.Column="0" Text="Y" VerticalAlignment="Center" Margin="0,12,0,4" />
76+
<ComboBox Grid.Row="4" Grid.Column="1" x:Name="cboY" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
77+
<TextBlock Grid.Row="5" Grid.Column="0" Text="L1" VerticalAlignment="Center" Margin="0,12,0,4" />
78+
<ComboBox Grid.Row="5" Grid.Column="1" x:Name="cboL1" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
79+
<TextBlock Grid.Row="6" Grid.Column="0" Text="L2" VerticalAlignment="Center" Margin="0,12,0,4" />
80+
<ComboBox Grid.Row="6" Grid.Column="1" x:Name="cboL2" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
81+
<TextBlock Grid.Row="7" Grid.Column="0" Text="R1" VerticalAlignment="Center" Margin="0,12,0,4" />
82+
<ComboBox Grid.Row="7" Grid.Column="1" x:Name="cboR1" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
83+
<TextBlock Grid.Row="8" Grid.Column="0" Text="R2" VerticalAlignment="Center" Margin="0,12,0,4" />
84+
<ComboBox Grid.Row="8" Grid.Column="1" x:Name="cboR2" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
85+
<TextBlock Grid.Row="9" Grid.Column="0" Text="**L3 (Left stick press)" x:Uid="L3LeftStick" VerticalAlignment="Center" Margin="0,12,0,4" />
86+
<ComboBox Grid.Row="9" Grid.Column="1" x:Name="cboL3" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
87+
<TextBlock Grid.Row="10" Grid.Column="0" Text="**R3 (Right stick press)" x:Uid="R3RightStick" VerticalAlignment="Center" Margin="0,12,0,4" />
88+
<ComboBox Grid.Row="10" Grid.Column="1" x:Name="cboR3" HorizontalAlignment="Stretch" Margin="0,12,0,4" />
89+
</Grid>
90+
91+
92+
93+
</StackPanel>
94+
</ScrollViewer>
95+
96+
<StackPanel Orientation="Horizontal"
97+
Margin="0,8,0,4"
98+
Grid.Row="2"
99+
HorizontalAlignment="Center">
100+
<Button Content="**Cancel"
101+
Width="120"
102+
HorizontalAlignment="Center"
103+
x:Name="CancelBtn"
104+
Margin="0,0,8,0"
105+
x:Uid="CancelBtn" Click="CancelBtn_Click"
106+
/>
107+
108+
<Button Content="**OK"
109+
Width="120"
110+
HorizontalAlignment="Center"
111+
x:Name="OkBtn"
112+
x:Uid="OKBtn" Click="OkBtn_Click"
113+
/>
114+
</StackPanel>
115+
</Grid>
116+
</Page>

0 commit comments

Comments
 (0)