- Probably fixed USB lag?

- Added left-hand mode for mouse movement
- Made Home LED on default
This commit is contained in:
David Khachaturov 2020-04-02 11:11:02 +01:00
parent e579f4a94e
commit 5e11617fa9
4 changed files with 23 additions and 15 deletions

View file

@ -11,7 +11,7 @@
but in that case also change the port in PadTest and cemuhook.ini accordingly. Default: 26760 -->
<add key="Port" value="26760" />
<!--Whether the Motion Server is enabled or not. Default: true -->
<add key="MotionServer" value="false" />
<add key="MotionServer" value="true" />
<!--Rumble motor period in millisec. Lower means more granular vibration, higher is more stable.-->
<!--The response of rumble does not only depend on this setting and it's always high. Default: 300 -->
<add key="RumblePeriod" value="300" />
@ -51,8 +51,9 @@
<!-- When enabled, can only calibrate one controller at a time. -->
<!-- Default: false -->
<add key="NonOriginalController" value="false" />
<!-- The program will keep the HOME button LED ring light on at all times-->
<add key="HomeLEDOn" value="false"/>
<!-- The program will keep the HOME button LED ring light on at all times. -->
<!-- Default: true -->
<add key="HomeLEDOn" value="true"/>
<!-- Determines whether or not to translate gyro movements into joystick ("joy") or mouse movement ("mouse"), or have no effect ("none") -->
<!-- When "joy", turn gyro movements into joystick movement (left/right depends on setting) [not yet implemented]-->
<!-- When "mouse", turn gyro movements into mouse movement. Press either stick-button to reset to middle of primary display -->
@ -60,6 +61,9 @@
<add key="GyroToJoyOrMouse" value="mouse"/>
<!-- Sensitivity of gyro-to-mouse movements -->
<!-- Default: 50 -->
<add key="GyroMouseSensitivity" value ="50"/>
<add key="GyroMouseSensitivity" value="50"/>
<!-- 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"/>
</appSettings>
</configuration>

View file

@ -344,7 +344,7 @@ namespace BetterJoyForCemu {
form.AppendTextBox("Using USB.\r\n");
a[0] = 0x80;
a[1] = 0x01;
a[1] = 0x1;
HIDapi.hid_write(handle, a, new UIntPtr(2));
HIDapi.hid_read(handle, a, new UIntPtr(64));
@ -354,16 +354,16 @@ namespace BetterJoyForCemu {
// USB Pairing
a = Enumerable.Repeat((byte)0, 64).ToArray();
a[0] = 0x80; a[1] = 0x02; // Handshake
a[0] = 0x80; a[1] = 0x2; // Handshake
HIDapi.hid_write(handle, a, new UIntPtr(2));
a[0] = 0x80; a[1] = 0x03; // 3Mbit baud rate
a[0] = 0x80; a[1] = 0x3; // 3Mbit baud rate
HIDapi.hid_write(handle, a, new UIntPtr(2));
a[0] = 0x80; a[1] = 0x02; // Handshake at new baud rate
a[0] = 0x80; a[1] = 0x2; // Handshake at new baud rate
HIDapi.hid_write(handle, a, new UIntPtr(2));
a[0] = 0x80; a[1] = 0x04; // Prevent HID timeout
a[0] = 0x80; a[1] = 0x4; // Prevent HID timeout
HIDapi.hid_write(handle, a, new UIntPtr(2));
dump_calibration_data();
@ -448,14 +448,14 @@ namespace BetterJoyForCemu {
if (state > state_.NO_JOYCONS) {
HIDapi.hid_set_nonblocking(handle, 0);
Subcommand(0x40, new byte[] { 0x0 }, 1);
Subcommand(0x40, new byte[] { 0x0 }, 1); // disable IMU sensor
//Subcommand(0x48, new byte[] { 0x0 }, 1); // Would turn off rumble?
if (isUSB) {
byte[] a = Enumerable.Repeat((byte)0, 64).ToArray();
a[0] = 0x80; a[1] = 0x05; // Allow device to talk to BT again
a[0] = 0x80; a[1] = 0x5; // Allow device to talk to BT again
HIDapi.hid_write(handle, a, new UIntPtr(2));
a[0] = 0x80; a[1] = 0x06; // Allow device to talk to BT again
a[0] = 0x80; a[1] = 0x6; // Allow device to talk to BT again
HIDapi.hid_write(handle, a, new UIntPtr(2));
}
}
@ -501,7 +501,7 @@ namespace BetterJoyForCemu {
if (extraGyroFeature == "joy") {
// TODO
} else if (extraGyroFeature == "mouse") {
} else if (extraGyroFeature == "mouse" && (isPro || (other == null) || (other != null && (Boolean.Parse(ConfigurationManager.AppSettings["GyroMouseLeftHanded"]) ? isLeft : !isLeft)))) {
Win32.POINT p;
Win32.GetCursorPos(out p);
@ -541,7 +541,8 @@ namespace BetterJoyForCemu {
// Send a no-op operation as heartbeat to keep connection alive.
// Do not send this too frequently, otherwise I/O would be too heavy and cause lag.
// Needed for both BLUETOOTH and USB to not time out. Never remove pls
SendRumble(rumble_obj.GetData());
//SendRumble(rumble_obj.GetData());
// TODO: Investigate if this really is safe to remove now?
watch.Restart();
}
int a = ReceiveRaw();

View file

@ -325,7 +325,7 @@
//
// AutoCalibrate
//
this.AutoCalibrate.Location = new System.Drawing.Point(111, 112);
this.AutoCalibrate.Location = new System.Drawing.Point(203, 112);
this.AutoCalibrate.Name = "AutoCalibrate";
this.AutoCalibrate.Size = new System.Drawing.Size(71, 20);
this.AutoCalibrate.TabIndex = 8;

View file

@ -35,6 +35,9 @@ namespace BetterJoyForCemu {
if (!nonOriginal)
AutoCalibrate.Hide();
// Feature not yet implemented - hide
btn_open3rdP.Hide();
con = new List<Button> { con1, con2, con3, con4 };
loc = new List<Button> { loc1, loc2, loc3, loc4 };