diff --git a/MouseToVJoy/Debug/MouseToVJoy.log b/MouseToVJoy/Debug/MouseToVJoy.log deleted file mode 100644 index c8fbf4f..0000000 --- a/MouseToVJoy/Debug/MouseToVJoy.log +++ /dev/null @@ -1,25 +0,0 @@ - MouseToVJoy.cpp -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(244): warning C4477: „printf”: ciąg formatu „%S” wymaga argumentu typu „wchar_t *”, ale argument 1 ze zmienną liczbą argumentów ma typ „PVOID” -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(254): warning C4474: „printf”: przekazano za dużo argumentów dla ciągu formatowania - c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(254): note: symbole zastępcze i ich parametry oczekują 0 argumentów ze zmienną liczbą argumentów, ale podano następującą liczbę zmiennych argumentów: 1 -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(315): warning C4244: "+=": konwersja z "DOUBLE" do "INT", możliwa utrata danych -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(318): warning C4244: "-=": konwersja z "DOUBLE" do "INT", możliwa utrata danych -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(321): warning C4244: "+=": konwersja z "DOUBLE" do "INT", możliwa utrata danych -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(324): warning C4244: "-=": konwersja z "DOUBLE" do "INT", możliwa utrata danych -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(327): warning C4244: "+=": konwersja z "DOUBLE" do "INT", możliwa utrata danych -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(330): warning C4244: "-=": konwersja z "DOUBLE" do "INT", możliwa utrata danych -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(341): warning C4805: "==": niebezpieczne połączenie typu "BOOL" oraz typu "bool" w operacji -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(422): warning C4244: "+=": konwersja z "DOUBLE" do "INT", możliwa utrata danych -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(424): warning C4244: "+=": konwersja z "DOUBLE" do "INT", możliwa utrata danych -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(428): warning C4244: "+=": konwersja z "DOUBLE" do "INT", możliwa utrata danych -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(432): warning C4244: "+=": konwersja z "DOUBLE" do "INT", możliwa utrata danych -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(459): warning C4996: 'freopen': This function or variable may be unsafe. Consider using freopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. - c:\program files (x86)\windows kits\10\include\10.0.15063.0\ucrt\stdio.h(242): note: zobacz deklarację „freopen” -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(460): warning C4996: 'freopen': This function or variable may be unsafe. Consider using freopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. - c:\program files (x86)\windows kits\10\include\10.0.15063.0\ucrt\stdio.h(242): note: zobacz deklarację „freopen” -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(228): warning C4715: "cInputDevices::CheckKeyPress”: niewszystkie ścieżki kodu zwracają wartość -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(257): warning C4715: "vJoyInput::TestDriver”: niewszystkie ścieżki kodu zwracają wartość -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(282): warning C4715: "vJoyInput::TestVirtualDevices”: niewszystkie ścieżki kodu zwracają wartość -c:\users\theone\documents\visual studio 2017\projects\vjoyclient\mousetovjoy\mousetovjoy.cpp(294): warning C4715: "vJoyInput::AccuireDevice”: niewszystkie ścieżki kodu zwracają wartość - MouseToVJoy.vcxproj -> C:\Users\Theone\Documents\Visual Studio 2017\Projects\vJoyClient\Debug\MouseToVJoy.exe - MouseToVJoy.vcxproj -> C:\Users\Theone\Documents\Visual Studio 2017\Projects\vJoyClient\Debug\MouseToVJoy.pdb (Partial PDB) diff --git a/MouseToVJoy/Debug/MouseToVJoy.obj b/MouseToVJoy/Debug/MouseToVJoy.obj deleted file mode 100644 index 57f1467..0000000 Binary files a/MouseToVJoy/Debug/MouseToVJoy.obj and /dev/null differ diff --git a/MouseToVJoy/Debug/MouseToVJoy.tlog/CL.command.1.tlog b/MouseToVJoy/Debug/MouseToVJoy.tlog/CL.command.1.tlog deleted file mode 100644 index 330b713..0000000 Binary files a/MouseToVJoy/Debug/MouseToVJoy.tlog/CL.command.1.tlog and /dev/null differ diff --git a/MouseToVJoy/Debug/MouseToVJoy.tlog/CL.read.1.tlog b/MouseToVJoy/Debug/MouseToVJoy.tlog/CL.read.1.tlog deleted file mode 100644 index d97ffd3..0000000 Binary files a/MouseToVJoy/Debug/MouseToVJoy.tlog/CL.read.1.tlog and /dev/null differ diff --git a/MouseToVJoy/Debug/MouseToVJoy.tlog/CL.write.1.tlog b/MouseToVJoy/Debug/MouseToVJoy.tlog/CL.write.1.tlog deleted file mode 100644 index 9413350..0000000 Binary files a/MouseToVJoy/Debug/MouseToVJoy.tlog/CL.write.1.tlog and /dev/null differ diff --git a/MouseToVJoy/Debug/MouseToVJoy.tlog/MouseToVJoy.lastbuildstate b/MouseToVJoy/Debug/MouseToVJoy.tlog/MouseToVJoy.lastbuildstate deleted file mode 100644 index dd39983..0000000 --- a/MouseToVJoy/Debug/MouseToVJoy.tlog/MouseToVJoy.lastbuildstate +++ /dev/null @@ -1,2 +0,0 @@ -#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.15063.0 -Debug|Win32|C:\Users\Theone\Documents\Visual Studio 2017\Projects\vJoyClient\| diff --git a/MouseToVJoy/Debug/MouseToVJoy.tlog/link.command.1.tlog b/MouseToVJoy/Debug/MouseToVJoy.tlog/link.command.1.tlog deleted file mode 100644 index 336afd3..0000000 Binary files a/MouseToVJoy/Debug/MouseToVJoy.tlog/link.command.1.tlog and /dev/null differ diff --git a/MouseToVJoy/Debug/MouseToVJoy.tlog/link.read.1.tlog b/MouseToVJoy/Debug/MouseToVJoy.tlog/link.read.1.tlog deleted file mode 100644 index d2430e7..0000000 Binary files a/MouseToVJoy/Debug/MouseToVJoy.tlog/link.read.1.tlog and /dev/null differ diff --git a/MouseToVJoy/Debug/MouseToVJoy.tlog/link.write.1.tlog b/MouseToVJoy/Debug/MouseToVJoy.tlog/link.write.1.tlog deleted file mode 100644 index 0ac65b1..0000000 Binary files a/MouseToVJoy/Debug/MouseToVJoy.tlog/link.write.1.tlog and /dev/null differ diff --git a/MouseToVJoy/Debug/vc141.idb b/MouseToVJoy/Debug/vc141.idb deleted file mode 100644 index 1da9a17..0000000 Binary files a/MouseToVJoy/Debug/vc141.idb and /dev/null differ diff --git a/MouseToVJoy/Debug/vc141.pdb b/MouseToVJoy/Debug/vc141.pdb deleted file mode 100644 index b0ffc17..0000000 Binary files a/MouseToVJoy/Debug/vc141.pdb and /dev/null differ diff --git a/MouseToVJoy/MouseToVJoy.cpp b/MouseToVJoy/MouseToVJoy.cpp index 51cc9b3..5d221bc 100644 --- a/MouseToVJoy/MouseToVJoy.cpp +++ b/MouseToVJoy/MouseToVJoy.cpp @@ -16,7 +16,7 @@ #include #include #define DEV_ID 1 -DOUBLE VerApp = 1.0; +DOUBLE VerApp = 1.1; const char g_szClassName[] = "myWindowClass"; HWND hwnd; @@ -33,15 +33,12 @@ INT X = 0; INT Y = 0; INT Z = 0; INT RX = 0; - -LONG Btns = 0; PVOID pPositionMessage; UINT IoCode = LOAD_POSITIONS; UINT IoSize = sizeof(JOYSTICK_POSITION); // HID_DEVICE_ATTRIBUTES attrib; -BYTE id = 1; UINT iInterface = 1; -DOUBLE Sensitivity, AttackTimeThrottle, ReleaseTimeThrottle, AttackTimeBreak, ReleaseTimeBreak, AttackTimeClutch, ReleaseTimeClutch; +DOUBLE Sensitivity, AttackTimeThrottle, ReleaseTimeThrottle, AttackTimeBreak, ReleaseTimeBreak, AttackTimeClutch, ReleaseTimeClutch, ThrottleKey, BreakKey, ClutchKey, MouseLockKey, UseMouse; //Vjoy // Step 4: the Window Procedure @@ -121,9 +118,6 @@ void cInputDevices::GetData(LPARAM lParam) // So instead of manually typing every possible // case value, we can just start by looping through // an expected range of keys the keycode might be. - if (keyCode == 0x11) { - pbToKey = &m_baAlphabet[26]; - } for (int iii = 0; iii < 25; ++iii) { @@ -143,46 +137,8 @@ void cInputDevices::GetData(LPARAM lParam) break; } } - - - // However, if the whole for loop above did not find any matches - // to the keycode, then we can expect our boolean pointer to be the same - // value we initalized it to. Which would be NULL. - - if (pbToKey != NULL) - { - // if we entered this block of code, then the boolean pointer - // is not NULL and has been assigned. The main idea is to - // call the CheckKeyPress function to update the boolean pointed to - // by the pbToKey, as well as pass in that boolean value itself. - *pbToKey = CheckKeyPress(*pbToKey, keyUp); - // Be sure to return ASAP! - return; - } - - // If the boolean pointer was null, then before giving up - // we can check if the keycode falls in the arrow key range! - - for (int iii = 0; iii < 4; ++iii) - { - // Notice we add 0x25 to iii, - // just like we added 0x41 to iii in the last for loop. - - if (keyCode == iii + 0x25) - { - // Yay found it! - pbToKey = &m_baArrows[iii]; - break; - } - } - // Because the keycode may not match any in the ranges we - // so far, we check to see if the boolean - // pointer has been assigned anything other than NULL. If - // it is NULL then we do not want to call CheckKeyPress. - // The reason for that is, it would error because our pointer - // is invalid and CheckKeyPress would be fail. if (pbToKey != NULL) { @@ -294,9 +250,7 @@ int vJoyInput::AccuireDevice() { } void vJoyInput::FeedDevice() { - id = (BYTE)iInterface; - iReport.bDevice = id; - iReport.bDevice = 1; + iReport.bDevice = iInterface; iReport.wAxisX = X; iReport.wAxisY = Y; iReport.wAxisZ = Z; @@ -307,30 +261,45 @@ void vJoyInput::FeedDevice() { getchar(); AcquireVJD(iInterface); } - } void vJoyInput::AccelerationLogic() { - if (rInput.IsLeftMouseButtonDown() && Y < 32767) { - Y += AttackTimeThrottle; - } - if (!rInput.IsLeftMouseButtonDown() && Y > 1){ - Y -= ReleaseTimeThrottle; - } - if (rInput.IsRightMouseButtonDown() && Z < 32767) { - Z += AttackTimeBreak; + if (UseMouse == 1) { + if (rInput.IsLeftMouseButtonDown() && Y < 32767) { + Y += AttackTimeThrottle; + } + if (!rInput.IsLeftMouseButtonDown() && Y > 1) { + Y -= ReleaseTimeThrottle; + } + if (rInput.IsRightMouseButtonDown() && Z < 32767) { + Z += AttackTimeBreak; + } + if (!rInput.IsRightMouseButtonDown() && Z > 1) { + Z -= ReleaseTimeBreak; + } } - if (!rInput.IsRightMouseButtonDown() && Z > 1) { - Z -= ReleaseTimeBreak; + else { + if (rInput.IsAlphabeticKeyDown(ThrottleKey - 0x41) && Y < 32767) { + Y += AttackTimeThrottle; + } + if (!rInput.IsAlphabeticKeyDown(ThrottleKey - 0x41) && Y > 1) { + Y -= ReleaseTimeThrottle; + } + if (rInput.IsAlphabeticKeyDown(BreakKey - 0x41) && Z < 32767) { + Z += AttackTimeBreak; + } + if (!rInput.IsAlphabeticKeyDown(BreakKey - 0x41) && Z > 1) { + Z -= ReleaseTimeBreak; + } } - if (rInput.IsAlphabeticKeyDown(VKey_C - 0x41) && RX < 32767) { + if (rInput.IsAlphabeticKeyDown(ClutchKey - 0x41) && RX < 32767) { RX += AttackTimeClutch; } - if (!rInput.IsAlphabeticKeyDown(VKey_C - 0x41) && RX > 1) { + if (!rInput.IsAlphabeticKeyDown(ClutchKey - 0x41) && RX > 1) { RX -= ReleaseTimeClutch; } - if (rInput.IsAlphabeticKeyDown(VKey_O - 0x41)) { - SleepEx(250,!(rInput.IsAlphabeticKeyDown(VKey_O - 0x41))); + if (rInput.IsAlphabeticKeyDown(MouseLockKey - 0x41)) { + SleepEx(250,!(rInput.IsAlphabeticKeyDown(MouseLockKey - 0x41))); if (CursorLocked == false) { CursorLocked = true; } @@ -380,9 +349,25 @@ void ReadConfigFile() { else if (tmp == "ReleaseTimeClutch") { ReleaseTimeClutch = value; } + else if (tmp == "ThrottleKey") { + ThrottleKey = value; + } + else if (tmp == "BreakKey") { + BreakKey = value; + } + else if (tmp == "ClutchKey") { + ClutchKey = value; + } + else if (tmp == "MouseLockKey") { + MouseLockKey = value; + } + else if (tmp == "UseMouse") { + UseMouse = value; + } + } std::cout << "==================================\n"; - std::cout << "Sensitivity = " << Sensitivity << "\n" << "Throttle Attack Time = " << AttackTimeThrottle << "\n" << "Throttle Release Time = " << ReleaseTimeThrottle << "\n" << "Break Attack Time = " << AttackTimeBreak << "\n" << "Break Release Time = " << ReleaseTimeBreak << "\n" << "Clutch Attack Time = " << AttackTimeClutch << "\n" << "Clutch Release Time = " << ReleaseTimeClutch << "\n"; + std::cout << "Sensitivity = " << Sensitivity << "\n" << "Throttle Attack Time = " << AttackTimeThrottle << "\n" << "Throttle Release Time = " << ReleaseTimeThrottle << "\n" << "Break Attack Time = " << AttackTimeBreak << "\n" << "Break Release Time = " << ReleaseTimeBreak << "\n" << "Clutch Attack Time = " << AttackTimeClutch << "\n" << "Clutch Release Time = " << ReleaseTimeClutch << "\n" << "Throttle key = " << ThrottleKey << "\n" << "Break key = " << BreakKey << "\n" << "Clutch key = " << ClutchKey << "\n" << "Mouse Lock key = " << MouseLockKey << "\n" << "Use Mouse = " << UseMouse << "\n"; std::cout << "==================================\n"; file_.close(); } diff --git a/MouseToVJoy/config.txt b/MouseToVJoy/config.txt index 308aea5..32f6e54 100644 --- a/MouseToVJoy/config.txt +++ b/MouseToVJoy/config.txt @@ -5,4 +5,11 @@ AttackTimeBreak = 400 ReleaseTimeBreak = 400 AttackTimeClutch = 400 ReleaseTimeClutch = 400 +ThrottleKey = 87 +BreakKey = 83 +ClutchKey = 67 +MouseLockKey = 79 +UseMouse = 1 + +Use keycodes from 65 to 90 (65 for A, 90 for Z) diff --git a/MouseToVJoy/input.h b/MouseToVJoy/input.h index 2387301..7f0fee1 100644 --- a/MouseToVJoy/input.h +++ b/MouseToVJoy/input.h @@ -41,7 +41,6 @@ enum VKey_X, VKey_Y, VKey_Z, - VKey_CONTROL }; enum @@ -51,7 +50,6 @@ enum VKey_RightArrow, VKey_DownArrow }; - class cInputDevices { public: diff --git a/MouseToVJoy/vJoyInput.h b/MouseToVJoy/vJoyInput.h index 6a0bcd2..232d9cc 100644 --- a/MouseToVJoy/vJoyInput.h +++ b/MouseToVJoy/vJoyInput.h @@ -10,5 +10,6 @@ class vJoyInput { int AccuireDevice(); void FeedDevice(); void AccelerationLogic(); + void GetKeyAssigned(); }; #endif \ No newline at end of file