2022-11-25 10:56:17 +01:00
|
|
|
using CommonHelpers;
|
2022-11-24 22:37:24 +01:00
|
|
|
|
2022-11-25 10:56:17 +01:00
|
|
|
namespace SteamController
|
2022-11-24 22:37:24 +01:00
|
|
|
{
|
2022-11-25 10:56:17 +01:00
|
|
|
public partial class Context
|
2022-11-24 22:37:24 +01:00
|
|
|
{
|
2023-05-21 18:47:38 +02:00
|
|
|
private List<string> debugLastItems = new List<string>();
|
|
|
|
|
private Profiles.Profile? debugLastProfile = null;
|
2022-11-24 22:37:24 +01:00
|
|
|
|
2022-11-25 10:56:17 +01:00
|
|
|
public void Debug()
|
2022-11-24 22:37:24 +01:00
|
|
|
{
|
|
|
|
|
var items = new List<string>();
|
|
|
|
|
|
2022-11-28 23:43:46 +01:00
|
|
|
var profile = CurrentProfile;
|
|
|
|
|
if (profile?.IsDesktop ?? false)
|
2022-11-24 22:37:24 +01:00
|
|
|
items.Add("[DESKTOP]");
|
|
|
|
|
else
|
|
|
|
|
items.Add("[CONTROLLER]");
|
|
|
|
|
|
2023-05-21 18:47:38 +02:00
|
|
|
if (profile != debugLastProfile)
|
|
|
|
|
{
|
|
|
|
|
Log.TraceLine("ProfileChanged: {0} to {1}", debugLastProfile?.Name ?? "null", profile?.Name ?? "null");
|
|
|
|
|
debugLastProfile = profile;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-25 10:56:17 +01:00
|
|
|
if (Steam.LizardButtons)
|
2022-11-24 22:37:24 +01:00
|
|
|
items.Add("[LB]");
|
2022-11-25 10:56:17 +01:00
|
|
|
if (Steam.LizardMouse)
|
2022-11-24 22:37:24 +01:00
|
|
|
items.Add("[LM]");
|
2022-12-10 17:00:09 +01:00
|
|
|
|
|
|
|
|
items.Add(X360.Connected ? "[X360]" : X360.Valid ? "[no-X360]" : "[inv-X360]");
|
2023-02-10 11:05:23 +01:00
|
|
|
items.Add(DS4.Connected ? "[DS4]" : DS4.Valid ? "[no-DS4]" : "[inv-DS4]");
|
2022-12-10 17:00:09 +01:00
|
|
|
items.Add(KeyboardMouseValid ? "[KM]" : "[inv-KM]");
|
2022-11-24 22:37:24 +01:00
|
|
|
|
2022-11-25 10:56:17 +01:00
|
|
|
foreach (var button in Steam.AllButtons)
|
2022-11-24 22:37:24 +01:00
|
|
|
{
|
|
|
|
|
if (button is null || !button.LastValue)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
String text = button.Name;
|
|
|
|
|
if (button.Consumed is not null)
|
|
|
|
|
text += String.Format("[{0}]", button.Consumed);
|
|
|
|
|
if (button.Value)
|
|
|
|
|
text += "[P]";
|
|
|
|
|
|
|
|
|
|
items.Add(text);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-25 10:56:17 +01:00
|
|
|
foreach (var key in Keyboard.DownKeys)
|
2022-11-24 22:37:24 +01:00
|
|
|
{
|
|
|
|
|
items.Add(String.Format("Key{0}", key));
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-25 10:56:17 +01:00
|
|
|
foreach (var mouse in Mouse.DownButtons)
|
2022-11-24 22:37:24 +01:00
|
|
|
{
|
|
|
|
|
items.Add(String.Format("Mouse{0}", mouse));
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-25 10:56:17 +01:00
|
|
|
if (!items.SequenceEqual(debugLastItems))
|
2022-11-24 22:37:24 +01:00
|
|
|
{
|
2023-05-21 18:47:38 +02:00
|
|
|
Log.TraceDebug("DEBUG: {0}", String.Join(" ", items));
|
2022-11-25 10:56:17 +01:00
|
|
|
debugLastItems = items;
|
2022-11-24 22:37:24 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|