Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
Adam777Z committed Jul 22, 2021

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent c40f88c commit f23c07b
Showing 4 changed files with 17 additions and 8 deletions.
11 changes: 6 additions & 5 deletions XboxGuideButtonMapToKey.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@@ -22,27 +22,28 @@
<ProjectGuid>{1A08601A-0971-4A8F-AE2B-CF6184D01CDD}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<ProjectName>XboxGuideButtonMapToKey</ProjectName>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
8 changes: 8 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -143,9 +143,13 @@ struct GlobalData
XInputGetStateEx(i, &states[i]);

if ((is_guide_down(states[i])) && (!wasGuideDownPrev[i]))
{
guidePressed.call(i);
}
else if ((!is_guide_down(states[i])) && (wasGuideDownPrev[i]))
{
guideReleased.call(i);
}

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

if (!dll)
{
fatal_error("Error loading XInput DLL.");
}

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

handy::io::INIFile ini;
if (!ini.loadFile("config.ini"))
{
fatal_error("Couldn't load config.ini");
}

settings[0].key = ini.getInteger("player1", "key", 27);
settings[0].hold_mode = ini.getInteger("player1", "hold_mode", 1);
Binary file modified resource.rc
Binary file not shown.
6 changes: 3 additions & 3 deletions x64/Release/config.ini
Original file line number Diff line number Diff line change
@@ -9,12 +9,12 @@ key = 27
; will be ignored- simple as that. If 2, "key" will be briefly tapped if guide is
; held for less than longpress_duration, and longpress_key will be briefly tapped
; if the guide is held for longer than that.
; Note that even after the guide button has been held for loner than longpress_duration,
; Note that even after the guide button has been held for longer than longpress_duration,
; you still need to release it before anything will be sent.
hold_mode = 1

; See above. Default is 112 (F1).
longpress_key = 112
; See above. Default is 27 (escape).
longpress_key = 27

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

0 comments on commit f23c07b

Please sign in to comment.