Skip to content

Commit f23c07b

Browse files
committed
Update
1 parent c40f88c commit f23c07b

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

XboxGuideButtonMapToKey.vcxproj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
44
<ProjectConfiguration Include="Debug|Win32">
55
<Configuration>Debug</Configuration>
@@ -22,27 +22,28 @@
2222
<ProjectGuid>{1A08601A-0971-4A8F-AE2B-CF6184D01CDD}</ProjectGuid>
2323
<Keyword>Win32Proj</Keyword>
2424
<ProjectName>XboxGuideButtonMapToKey</ProjectName>
25+
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
2526
</PropertyGroup>
2627
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2728
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
2829
<ConfigurationType>Application</ConfigurationType>
2930
<UseDebugLibraries>true</UseDebugLibraries>
30-
<PlatformToolset>v140</PlatformToolset>
31+
<PlatformToolset>v141</PlatformToolset>
3132
</PropertyGroup>
3233
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
3334
<ConfigurationType>Application</ConfigurationType>
3435
<UseDebugLibraries>false</UseDebugLibraries>
35-
<PlatformToolset>v140</PlatformToolset>
36+
<PlatformToolset>v141</PlatformToolset>
3637
</PropertyGroup>
3738
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
3839
<ConfigurationType>Application</ConfigurationType>
3940
<UseDebugLibraries>true</UseDebugLibraries>
40-
<PlatformToolset>v140</PlatformToolset>
41+
<PlatformToolset>v141</PlatformToolset>
4142
</PropertyGroup>
4243
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
4344
<ConfigurationType>Application</ConfigurationType>
4445
<UseDebugLibraries>false</UseDebugLibraries>
45-
<PlatformToolset>v140</PlatformToolset>
46+
<PlatformToolset>v141</PlatformToolset>
4647
</PropertyGroup>
4748
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
4849
<ImportGroup Label="ExtensionSettings">

main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,13 @@ struct GlobalData
143143
XInputGetStateEx(i, &states[i]);
144144

145145
if ((is_guide_down(states[i])) && (!wasGuideDownPrev[i]))
146+
{
146147
guidePressed.call(i);
148+
}
147149
else if ((!is_guide_down(states[i])) && (wasGuideDownPrev[i]))
150+
{
148151
guideReleased.call(i);
152+
}
149153

150154
wasGuideDownPrev[i] = is_guide_down(states[i]);
151155
}
@@ -171,13 +175,17 @@ struct GlobalData
171175
dll = LoadLibrary(dll_path);
172176

173177
if (!dll)
178+
{
174179
fatal_error("Error loading XInput DLL.");
180+
}
175181

176182
XInputGetStateEx = (XInputGetStateEx_t)GetProcAddress(dll, (LPCSTR)100);
177183

178184
handy::io::INIFile ini;
179185
if (!ini.loadFile("config.ini"))
186+
{
180187
fatal_error("Couldn't load config.ini");
188+
}
181189

182190
settings[0].key = ini.getInteger("player1", "key", 27);
183191
settings[0].hold_mode = ini.getInteger("player1", "hold_mode", 1);

resource.rc

14 Bytes
Binary file not shown.

x64/Release/config.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ key = 27
99
; will be ignored- simple as that. If 2, "key" will be briefly tapped if guide is
1010
; held for less than longpress_duration, and longpress_key will be briefly tapped
1111
; if the guide is held for longer than that.
12-
; Note that even after the guide button has been held for loner than longpress_duration,
12+
; Note that even after the guide button has been held for longer than longpress_duration,
1313
; you still need to release it before anything will be sent.
1414
hold_mode = 1
1515

16-
; See above. Default is 112 (F1).
17-
longpress_key = 112
16+
; See above. Default is 27 (escape).
17+
longpress_key = 27
1818

1919
; See above. In milliseconds (1000 = 1 second)
2020
longpress_duration = 1000

0 commit comments

Comments
 (0)