- Renamed BetterJoyForCemu to BetterJoy

- Fixed joy-to-joy bug (hopefully last)
 - Added drag toggle
This commit is contained in:
David Khachaturov 2020-04-08 08:47:36 +01:00
parent 77913a8562
commit 146a712c06
5 changed files with 28 additions and 8 deletions

View file

@ -1,9 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29418.71
# Visual Studio 15
VisualStudioVersion = 15.0.28307.852
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BetterJoyForCemu", "BetterJoyForCemu\BetterJoyForCemu.csproj", "{1BF709E9-C133-41DF-933A-C9FF3F664C7B}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BetterJoy", "BetterJoyForCemu\BetterJoy.csproj", "{1BF709E9-C133-41DF-933A-C9FF3F664C7B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View file

@ -65,5 +65,9 @@
<!-- When two joycons are connected, it would take the gyro movement of the right joycon for mouse movement. This swaps that -->
<!-- Default: false -->
<add key="GyroMouseLeftHanded" value="false"/>
<!-- Changes drag behaviour. -->
<!-- Will only apply to mouse buttons being mapped -->
<!-- Default: false -->
<add key="DragToggle" value="true"/>
</appSettings>
</configuration>

View file

@ -522,6 +522,8 @@ namespace BetterJoyForCemu {
return ret;
}
bool dragToggle = Boolean.Parse(ConfigurationManager.AppSettings["DragToggle"]);
Dictionary<int, bool> mouse_toggle_btn = new Dictionary<int, bool>();
private void Simulate(string s, bool click=true, bool up=false) {
if (s.StartsWith("key_")) {
WindowsInput.Events.KeyCode key = (WindowsInput.Events.KeyCode)Int32.Parse(s.Substring(4));
@ -539,10 +541,22 @@ namespace BetterJoyForCemu {
if (click) {
WindowsInput.Simulate.Events().Click(button).Invoke();
} else {
if (up) {
WindowsInput.Simulate.Events().Release(button).Invoke();
if (dragToggle) {
if (!up) {
bool release;
mouse_toggle_btn.TryGetValue((int)button, out release);
if (release)
WindowsInput.Simulate.Events().Release(button).Invoke();
else
WindowsInput.Simulate.Events().Hold(button).Invoke();
mouse_toggle_btn[(int)button] = !release;
}
} else {
WindowsInput.Simulate.Events().Hold(button).Invoke();
if (up) {
WindowsInput.Simulate.Events().Release(button).Invoke();
} else {
WindowsInput.Simulate.Events().Hold(button).Invoke();
}
}
}
}
@ -552,7 +566,7 @@ namespace BetterJoyForCemu {
private void SimulateContinous(int origin, string s) {
if (s.StartsWith("joy_")) {
int button = Int32.Parse(s.Substring(4));
buttons[button] = buttons[origin];
buttons[button] |= buttons[origin];
}
}
@ -720,6 +734,8 @@ namespace BetterJoyForCemu {
down_[i] = buttons[i];
}
}
buttons = new bool[20];
buttons[(int)Button.DPAD_DOWN] = (report_buf[3 + (isLeft ? 2 : 0)] & (isLeft ? 0x01 : 0x04)) != 0;
buttons[(int)Button.DPAD_RIGHT] = (report_buf[3 + (isLeft ? 2 : 0)] & (isLeft ? 0x04 : 0x08)) != 0;
buttons[(int)Button.DPAD_UP] = (report_buf[3 + (isLeft ? 2 : 0)] & (isLeft ? 0x02 : 0x02)) != 0;

View file

@ -367,7 +367,7 @@
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "MainForm";
this.Text = "BetterJoyForCemu";
this.Text = "BetterJoy";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.Load += new System.EventHandler(this.MainForm_Load);
this.Resize += new System.EventHandler(this.MainForm_Resize);