mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-24 15:41:49 +01:00
Merge branch 'jay' into vigem-udpserver
This commit is contained in:
commit
d74abc801f
@ -779,28 +779,28 @@ namespace DS4Windows
|
|||||||
|
|
||||||
if (absX <= 0.4)
|
if (absX <= 0.4)
|
||||||
{
|
{
|
||||||
outputX = 0.45 * absX;
|
outputX = 0.46 * absX;
|
||||||
}
|
}
|
||||||
else if (absX <= 0.75)
|
else if (absX <= 0.75)
|
||||||
{
|
{
|
||||||
outputX = absX - 0.22;
|
outputX = absX - 0.216;
|
||||||
}
|
}
|
||||||
else if (absX > 0.75)
|
else if (absX > 0.75)
|
||||||
{
|
{
|
||||||
outputX = (absX * 1.88) - 0.88;
|
outputX = (absX * 1.8634) - 0.8634;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (absY <= 0.4)
|
if (absY <= 0.4)
|
||||||
{
|
{
|
||||||
outputY = 0.45 * absY;
|
outputY = 0.46 * absY;
|
||||||
}
|
}
|
||||||
else if (absY <= 0.75)
|
else if (absY <= 0.75)
|
||||||
{
|
{
|
||||||
outputY = absY - 0.22;
|
outputY = absY - 0.216;
|
||||||
}
|
}
|
||||||
else if (absY > 0.75)
|
else if (absY > 0.75)
|
||||||
{
|
{
|
||||||
outputY = (absY * 1.88) - 0.88;
|
outputY = (absY * 1.8634) - 0.8634;
|
||||||
}
|
}
|
||||||
|
|
||||||
dState.LX = (byte)(outputX * signX * 127.5 + 127.5);
|
dState.LX = (byte)(outputX * signX * 127.5 + 127.5);
|
||||||
@ -839,28 +839,28 @@ namespace DS4Windows
|
|||||||
|
|
||||||
if (absX <= 0.4)
|
if (absX <= 0.4)
|
||||||
{
|
{
|
||||||
outputX = 0.45 * absX;
|
outputX = 0.46 * absX;
|
||||||
}
|
}
|
||||||
else if (absX <= 0.75)
|
else if (absX <= 0.75)
|
||||||
{
|
{
|
||||||
outputX = absX - 0.22;
|
outputX = absX - 0.216;
|
||||||
}
|
}
|
||||||
else if (absX > 0.75)
|
else if (absX > 0.75)
|
||||||
{
|
{
|
||||||
outputX = (absX * 1.88) - 0.88;
|
outputX = (absX * 1.8634) - 0.8634;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (absY <= 0.4)
|
if (absY <= 0.4)
|
||||||
{
|
{
|
||||||
outputY = 0.45 * absY;
|
outputY = 0.46 * absY;
|
||||||
}
|
}
|
||||||
else if (absY <= 0.75)
|
else if (absY <= 0.75)
|
||||||
{
|
{
|
||||||
outputY = absY - 0.22;
|
outputY = absY - 0.216;
|
||||||
}
|
}
|
||||||
else if (absY > 0.75)
|
else if (absY > 0.75)
|
||||||
{
|
{
|
||||||
outputY = (absY * 1.88) - 0.88;
|
outputY = (absY * 1.8634) - 0.8634;
|
||||||
}
|
}
|
||||||
|
|
||||||
dState.RX = (byte)(outputX * signX * 127.5 + 127.5);
|
dState.RX = (byte)(outputX * signX * 127.5 + 127.5);
|
||||||
|
@ -1462,6 +1462,7 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
|
|||||||
opt.TopLevel = false;
|
opt.TopLevel = false;
|
||||||
opt.Dock = DockStyle.Fill;
|
opt.Dock = DockStyle.Fill;
|
||||||
opt.FormBorderStyle = FormBorderStyle.None;
|
opt.FormBorderStyle = FormBorderStyle.None;
|
||||||
|
|
||||||
tabProfiles.Controls.Add(opt);
|
tabProfiles.Controls.Add(opt);
|
||||||
optPop = true;
|
optPop = true;
|
||||||
//opt.Dock = DockStyle.Fill;
|
//opt.Dock = DockStyle.Fill;
|
||||||
@ -1479,9 +1480,12 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
|
|||||||
}
|
}
|
||||||
|
|
||||||
opt.Reload(devID, profile);
|
opt.Reload(devID, profile);
|
||||||
|
|
||||||
opt.inputtimer.Start();
|
opt.inputtimer.Start();
|
||||||
opt.Visible = true;
|
opt.Visible = true;
|
||||||
|
|
||||||
tabMain.SelectedIndex = 1;
|
tabMain.SelectedIndex = 1;
|
||||||
|
opt.SetFlowAutoScroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OptionsClosed()
|
public void OptionsClosed()
|
||||||
@ -1510,7 +1514,6 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question
|
|||||||
opt.sixaxisTimer.Stop();
|
opt.sixaxisTimer.Stop();
|
||||||
opt.Dock = DockStyle.None;
|
opt.Dock = DockStyle.None;
|
||||||
tabProfiles.Controls.Remove(opt);
|
tabProfiles.Controls.Remove(opt);
|
||||||
opt.Dispose();
|
|
||||||
optPop = false;
|
optPop = false;
|
||||||
|
|
||||||
lBProfiles.Visible = true;
|
lBProfiles.Visible = true;
|
||||||
|
1
DS4Windows/DS4Forms/Options.Designer.cs
generated
1
DS4Windows/DS4Forms/Options.Designer.cs
generated
@ -4117,7 +4117,6 @@
|
|||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "Options";
|
this.Name = "Options";
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Options_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Options_FormClosing);
|
||||||
this.Resize += new System.EventHandler(this.Options_Resize);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nUDRainbow)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.nUDRainbow)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.tBBlueBar)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.tBBlueBar)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.tBGreenBar)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.tBGreenBar)).EndInit();
|
||||||
|
@ -142,6 +142,12 @@ namespace DS4Windows
|
|||||||
populateHoverLabelDict();
|
populateHoverLabelDict();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetFlowAutoScroll()
|
||||||
|
{
|
||||||
|
fLPSettings.AutoScroll = false;
|
||||||
|
fLPSettings.AutoScroll = true;
|
||||||
|
}
|
||||||
|
|
||||||
private void populateHoverIndexDict()
|
private void populateHoverIndexDict()
|
||||||
{
|
{
|
||||||
hoverIndexDict.Clear();
|
hoverIndexDict.Clear();
|
||||||
@ -2987,12 +2993,6 @@ namespace DS4Windows
|
|||||||
e.Graphics.DrawImage(btnLightBgImg, new Rectangle(0, -1, Convert.ToInt32(btnLightbar.Width), Convert.ToInt32(btnLightbar.Height - 2)));
|
e.Graphics.DrawImage(btnLightBgImg, new Rectangle(0, -1, Convert.ToInt32(btnLightbar.Width), Convert.ToInt32(btnLightbar.Height - 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Options_Resize(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
fLPSettings.AutoScroll = false;
|
|
||||||
fLPSettings.AutoScroll = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void lBControls_SelectedIndexChanged(object sender, EventArgs e)
|
private void lBControls_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
int controlSelectedIndex = lBControls.SelectedIndex;
|
int controlSelectedIndex = lBControls.SelectedIndex;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,19 +2,16 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Diagnostics;
|
using Process = System.Diagnostics.Process;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Runtime;
|
||||||
using Microsoft.Win32.TaskScheduler;
|
using Microsoft.Win32.TaskScheduler;
|
||||||
|
|
||||||
namespace DS4Windows
|
namespace DS4Windows
|
||||||
{
|
{
|
||||||
static class Program
|
static class Program
|
||||||
{
|
{
|
||||||
[DllImport("user32.dll")]
|
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
|
||||||
static extern bool SetForegroundWindow(IntPtr hWnd);
|
|
||||||
|
|
||||||
// Add "global\" in front of the EventName, then only one instance is allowed on the
|
// Add "global\" in front of the EventName, then only one instance is allowed on the
|
||||||
// whole system, including other users. But the application can not be brought
|
// whole system, including other users. But the application can not be brought
|
||||||
// into view, of course.
|
// into view, of course.
|
||||||
@ -24,6 +21,7 @@ namespace DS4Windows
|
|||||||
public static ControlService rootHub;
|
public static ControlService rootHub;
|
||||||
private static Thread testThread;
|
private static Thread testThread;
|
||||||
private static Thread controlThread;
|
private static Thread controlThread;
|
||||||
|
private static DS4Form ds4form;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
@ -71,27 +69,26 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.Runtime.GCSettings.LatencyMode = System.Runtime.GCLatencyMode.LowLatency;
|
GCSettings.LatencyMode = GCLatencyMode.LowLatency;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Process.GetCurrentProcess().PriorityClass =
|
Process.GetCurrentProcess().PriorityClass =
|
||||||
ProcessPriorityClass.High;
|
System.Diagnostics.ProcessPriorityClass.High;
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Ignore problems raising the priority.
|
|
||||||
}
|
}
|
||||||
|
catch { } // Ignore problems raising the priority.
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// another instance is already running if OpenExsting succeeds.
|
// another instance is already running if OpenExsting succeeds.
|
||||||
threadComEvent = EventWaitHandle.OpenExisting(SingleAppComEventName);
|
threadComEvent = EventWaitHandle.OpenExisting(SingleAppComEventName,
|
||||||
|
System.Security.AccessControl.EventWaitHandleRights.Synchronize |
|
||||||
|
System.Security.AccessControl.EventWaitHandleRights.Modify);
|
||||||
threadComEvent.Set(); // signal the other instance.
|
threadComEvent.Set(); // signal the other instance.
|
||||||
threadComEvent.Close();
|
threadComEvent.Close();
|
||||||
return; // return immediatly.
|
return; // return immediatly.
|
||||||
}
|
}
|
||||||
catch { /* don't care about errors */ }
|
catch { /* don't care about errors */ }
|
||||||
|
|
||||||
// Create the Event handle
|
// Create the Event handle
|
||||||
threadComEvent = new EventWaitHandle(false, EventResetMode.ManualReset, SingleAppComEventName);
|
threadComEvent = new EventWaitHandle(false, EventResetMode.ManualReset, SingleAppComEventName);
|
||||||
@ -107,7 +104,8 @@ namespace DS4Windows
|
|||||||
rootHub.CreateHidGuardKey();
|
rootHub.CreateHidGuardKey();
|
||||||
//rootHub = new ControlService();
|
//rootHub = new ControlService();
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.Run(new DS4Form(args));
|
ds4form = new DS4Form(args);
|
||||||
|
Application.Run(ds4form);
|
||||||
rootHub.removeHidGuardKey();
|
rootHub.removeHidGuardKey();
|
||||||
//mutex.ReleaseMutex();
|
//mutex.ReleaseMutex();
|
||||||
//}
|
//}
|
||||||
@ -131,29 +129,26 @@ namespace DS4Windows
|
|||||||
|
|
||||||
private static void CreateTempWorkerThread()
|
private static void CreateTempWorkerThread()
|
||||||
{
|
{
|
||||||
testThread = new Thread(singleAppComThread_DoWork);
|
testThread = new Thread(SingleAppComThread_DoWork);
|
||||||
testThread.Priority = ThreadPriority.Lowest;
|
testThread.Priority = ThreadPriority.Lowest;
|
||||||
testThread.IsBackground = true;
|
testThread.IsBackground = true;
|
||||||
testThread.Start();
|
testThread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void singleAppComThread_DoWork()
|
private static void SingleAppComThread_DoWork()
|
||||||
{
|
{
|
||||||
WaitHandle[] waitHandles = new WaitHandle[] { threadComEvent };
|
|
||||||
|
|
||||||
while (!exitComThread)
|
while (!exitComThread)
|
||||||
{
|
{
|
||||||
// check every second for a signal.
|
// check for a signal.
|
||||||
if (WaitHandle.WaitAny(waitHandles) == 0)
|
if (threadComEvent.WaitOne())
|
||||||
{
|
{
|
||||||
threadComEvent.Reset();
|
threadComEvent.Reset();
|
||||||
// The user tried to start another instance. We can't allow that,
|
// The user tried to start another instance. We can't allow that,
|
||||||
// so bring the other instance back into view and enable that one.
|
// so bring the other instance back into view and enable that one.
|
||||||
// That form is created in another thread, so we need some thread sync magic.
|
// That form is created in another thread, so we need some thread sync magic.
|
||||||
if (!exitComThread && Application.OpenForms.Count > 0)
|
if (!exitComThread)
|
||||||
{
|
{
|
||||||
Form mainForm = Application.OpenForms[0];
|
ds4form?.Invoke(new SetFormVisableDelegate(ThreadFormVisable), ds4form);
|
||||||
mainForm?.Invoke(new SetFormVisableDelegate(ThreadFormVisable), mainForm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,24 +162,13 @@ namespace DS4Windows
|
|||||||
private delegate void SetFormVisableDelegate(Form frm);
|
private delegate void SetFormVisableDelegate(Form frm);
|
||||||
static private void ThreadFormVisable(Form frm)
|
static private void ThreadFormVisable(Form frm)
|
||||||
{
|
{
|
||||||
if (frm != null)
|
if (frm is DS4Form)
|
||||||
{
|
{
|
||||||
if (frm is DS4Form)
|
// display the form and bring to foreground.
|
||||||
{
|
frm.WindowState = FormWindowState.Normal;
|
||||||
// display the form and bring to foreground.
|
frm.Focus();
|
||||||
frm.WindowState = FormWindowState.Normal;
|
frm.Activate();
|
||||||
frm.Focus();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WinProgs wp = (WinProgs)frm;
|
|
||||||
wp.form.mAllowVisible = true;
|
|
||||||
wp.ShowMainWindow();
|
|
||||||
SetForegroundWindow(wp.form.Handle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetForegroundWindow(frm.Handle);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -33,7 +33,7 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.5.0")]
|
[assembly: AssemblyVersion("1.5.1")]
|
||||||
[assembly: AssemblyFileVersion("1.5.0")]
|
[assembly: AssemblyFileVersion("1.5.1")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
|
@ -7,5 +7,6 @@
|
|||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<probing privatePath="Lang"/>
|
<probing privatePath="Lang"/>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
|
<gcServer enabled="true" />
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -8,12 +8,12 @@ You can find the latest and older versions [here](https://github.com/Ryochan7/DS
|
|||||||
|
|
||||||
UdpServer builds for using Gyro motion controls in Cemu.
|
UdpServer builds for using Gyro motion controls in Cemu.
|
||||||
|
|
||||||
http://ryochan7.xyz/ds4windows/test/DS4Windows_1.4.123_UdpServer_x64.zip
|
http://ryochan7.xyz/ds4windows/test/DS4Windows_1.5.0_UdpServer_x64.zip
|
||||||
http://ryochan7.xyz/ds4windows/test/DS4Windows_1.4.123_ViGEm_UdpServer_x64.zip
|
http://ryochan7.xyz/ds4windows/test/DS4Windows_1.5.0_ViGEm_UdpServer_x64.zip
|
||||||
|
|
||||||
ViGEm build.
|
ViGEm build.
|
||||||
|
|
||||||
http://ryochan7.xyz/ds4windows/test/DS4Windows_1.4.123_ViGEm_x64.zip
|
http://ryochan7.xyz/ds4windows/test/DS4Windows_1.5.0_ViGEm_x64.zip
|
||||||
|
|
||||||
This project is a fork of the work of Jays2Kings. You can find the old project
|
This project is a fork of the work of Jays2Kings. You can find the old project
|
||||||
website at [ds4windows.com](http://ds4windows.com).
|
website at [ds4windows.com](http://ds4windows.com).
|
||||||
|
Loading…
Reference in New Issue
Block a user