Skip to content

Commit

Permalink
button_on_360_guide_v7
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam777Z committed Jul 22, 2021
1 parent cd8218f commit 8ebf979
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 229 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added XboxOneLogoIcon.ico
Binary file not shown.
File renamed without changes.
2 changes: 2 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
g++ -o button_on_360_guide.exe -I . main.cpp INI.cpp --std=c++11 -O2 -Wl,-subsystem,windows
pause
2 changes: 1 addition & 1 deletion button2.ini → config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; Default is 27 (escape).
; If you set it to zero, set longpress_key correctly, and set hold_mode=2,
; tapping the guide button for less than longpress_duration will do nothing.
key = 120
key = 27

; If 1, "key" will be sent for as long as guide is pressed and longpress_*
; will be ignored- simple as that. If 2, "key" will be briefly tapped if guide is
Expand Down
26 changes: 15 additions & 11 deletions src/main.cpp → main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


#include <string>

#include <chrono>
Expand Down Expand Up @@ -79,6 +77,8 @@ HWND get_console_hwnd(void)
// Restore original window title.
SetConsoleTitle(oldWindowTitle);

SetConsoleTitle("Xbox Guide button map to key");

return(hwndFound);
}

Expand Down Expand Up @@ -198,8 +198,8 @@ struct GlobalData
XInputGetStateEx = (XInputGetStateEx_t)GetProcAddress(dll, (LPCSTR)100);

handy::io::INIFile ini;
if (!ini.loadFile("button2.ini"))
fatal_error("Couldn't load button2.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);
Expand Down Expand Up @@ -238,8 +238,17 @@ int main()
{
GlobalData& d = GlobalData::get();

printf("Button on 360 guide v6, by pinumbernumber.\nWill minimise now\n\n");
Sleep(500);
// HWND hWnd = CreateDialog( hInstance, MAKEINTRESOURCE(IDD_DLG_DIALOG), NULL, (DLGPROC)DlgProc );
// NOTIFYICONDATA stData;
// ZeroMemory(&stData, sizeof(stData));
// stData.cbSize = sizeof(stData);
// stData.hWnd = hWnd;
// stData.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
// //stData.uCallbackMessage = WM_TRAY;
// stData.hIcon = LoadIcon(NULL, IDI_APPLICATION);
// //LoadStringSafe(IDS_TIP, stData.szTip, _countof(stData.szTip));
// Shell_NotifyIcon(NIM_ADD, &stData);

ShowWindow(get_console_hwnd(), SW_MINIMIZE);

typedef std::chrono::high_resolution_clock hrc;
Expand All @@ -255,8 +264,6 @@ int main()
{
if (d.settings[i].key != 0)
{

printf ("Player %i guide down, will start holding key %lli\n", i+1, d.settings[i].key);
key_down(d.settings[i].key);
}
}
Expand All @@ -271,7 +278,6 @@ int main()
{
if (d.settings[i].hold_mode == 1)
{
printf ("Player %i guide up, will stop holding key %lli\n", i+1, d.settings[i].key);
key_up(d.settings[i].key);
}
else if (d.settings[i].hold_mode == 2)
Expand All @@ -281,7 +287,6 @@ int main()
{
if (d.settings[i].longpress_key != 0)
{
printf ("Player %i guide pressed for longer than %lli ms, will now tap key %lli\n", i+1, d.settings[i].longpress_duration, d.settings[i].longpress_key);
key_tap(d.settings[i].longpress_key, 0, 1);
}

Expand All @@ -290,7 +295,6 @@ int main()
{
if (d.settings[i].key != 0)
{
printf ("Player %i guide pressed for less than %lli ms, will now tap key %lli\n", i+1, d.settings[i].longpress_duration, d.settings[i].key);
key_tap(d.settings[i].key, 0, 1);
}

Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion src/build.bat

This file was deleted.

216 changes: 0 additions & 216 deletions src/button2.ini

This file was deleted.

0 comments on commit 8ebf979

Please sign in to comment.