Improve logging for OpenTK gamepads
This commit is contained in:
parent
b29516e864
commit
ee0848d7d0
|
@ -16,6 +16,8 @@ namespace BizHawk.Bizware.DirectX
|
||||||
|
|
||||||
private Config? _config;
|
private Config? _config;
|
||||||
|
|
||||||
|
public string Desc { get; } = "DirectInput+XInput";
|
||||||
|
|
||||||
public void DeInitAll()
|
public void DeInitAll()
|
||||||
{
|
{
|
||||||
KeyInput.Cleanup();
|
KeyInput.Cleanup();
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace BizHawk.Bizware.OpenTK3
|
||||||
static void DropAt(int knownAsIndex, IList<OTK_GamePad> devices)
|
static void DropAt(int knownAsIndex, IList<OTK_GamePad> devices)
|
||||||
{
|
{
|
||||||
var known = devices[knownAsIndex];
|
var known = devices[knownAsIndex];
|
||||||
Console.WriteLine($"Dropped gamepad #{knownAsIndex}, was port#{known._deviceIndex} ({known._name}) via OpenTK");
|
Console.WriteLine($"Dropped gamepad #{knownAsIndex}: was {known.VerboseName}");
|
||||||
devices.RemoveAt(knownAsIndex);
|
devices.RemoveAt(knownAsIndex);
|
||||||
}
|
}
|
||||||
if (!initialized) return;
|
if (!initialized) return;
|
||||||
|
@ -69,7 +69,7 @@ namespace BizHawk.Bizware.OpenTK3
|
||||||
{
|
{
|
||||||
var newConn = new OTK_GamePad(tryIndex, Devices.Count);
|
var newConn = new OTK_GamePad(tryIndex, Devices.Count);
|
||||||
Devices.Insert(tryIndex, newConn); // try and keep our indices in line with the OpenTK ones
|
Devices.Insert(tryIndex, newConn); // try and keep our indices in line with the OpenTK ones
|
||||||
Console.WriteLine($"Connected new gamepad #{tryIndex}, port#{newConn._deviceIndex} ({newConn._name}) via OpenTK");
|
Console.WriteLine($"Connected new gamepad as #{tryIndex}: {newConn.VerboseName}");
|
||||||
}
|
}
|
||||||
// else was and remains disconnected, move along
|
// else was and remains disconnected, move along
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,8 @@ namespace BizHawk.Bizware.OpenTK3
|
||||||
/// <summary>The object returned by <see cref="Joystick.GetCapabilities"/></summary>
|
/// <summary>The object returned by <see cref="Joystick.GetCapabilities"/></summary>
|
||||||
private readonly JoystickCapabilities? _joystickCapabilities;
|
private readonly JoystickCapabilities? _joystickCapabilities;
|
||||||
|
|
||||||
|
private readonly string VerboseName;
|
||||||
|
|
||||||
public readonly IReadOnlyCollection<string> HapticsChannels;
|
public readonly IReadOnlyCollection<string> HapticsChannels;
|
||||||
|
|
||||||
/// <summary>For use in keybind boxes</summary>
|
/// <summary>For use in keybind boxes</summary>
|
||||||
|
@ -156,12 +158,8 @@ namespace BizHawk.Bizware.OpenTK3
|
||||||
? new[] { "Left", "Right" } // two haptic motors
|
? new[] { "Left", "Right" } // two haptic motors
|
||||||
: new[] { "Mono" }; // one or zero haptic motors -- in the latter case, pretend it's mono anyway as that doesn't seem to cause problems
|
: new[] { "Mono" }; // one or zero haptic motors -- in the latter case, pretend it's mono anyway as that doesn't seem to cause problems
|
||||||
InputNamePrefix = $"{(MappedGamePad ? "X" : "J")}{_playerIndex} ";
|
InputNamePrefix = $"{(MappedGamePad ? "X" : "J")}{_playerIndex} ";
|
||||||
|
VerboseName = $"port #{_deviceIndex} {(MappedGamePad ? "mapped" : "unmapped")} {Guid} {_name}";
|
||||||
Update();
|
Update();
|
||||||
|
|
||||||
Console.WriteLine($"Initialising OpenTK GamePad: {Guid}");
|
|
||||||
Console.WriteLine($"OpenTK Mapping: {_name}");
|
|
||||||
|
|
||||||
InitializeMappings();
|
InitializeMappings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ namespace BizHawk.Bizware.OpenTK3
|
||||||
{
|
{
|
||||||
private IReadOnlyDictionary<string, int> _lastHapticsSnapshot = new Dictionary<string, int>();
|
private IReadOnlyDictionary<string, int> _lastHapticsSnapshot = new Dictionary<string, int>();
|
||||||
|
|
||||||
|
public string Desc { get; } = "OpenTK 3";
|
||||||
|
|
||||||
public void DeInitAll() {}
|
public void DeInitAll() {}
|
||||||
|
|
||||||
public void FirstInitAll(IntPtr mainFormHandle)
|
public void FirstInitAll(IntPtr mainFormHandle)
|
||||||
|
|
|
@ -8,6 +8,8 @@ namespace BizHawk.Client.Common
|
||||||
/// <remarks>this was easier than trying to make static classes instantiable...</remarks>
|
/// <remarks>this was easier than trying to make static classes instantiable...</remarks>
|
||||||
public interface IHostInputAdapter
|
public interface IHostInputAdapter
|
||||||
{
|
{
|
||||||
|
string Desc { get; }
|
||||||
|
|
||||||
void DeInitAll();
|
void DeInitAll();
|
||||||
|
|
||||||
void FirstInitAll(IntPtr mainFormHandle);
|
void FirstInitAll(IntPtr mainFormHandle);
|
||||||
|
|
|
@ -48,6 +48,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
EHostInputMethod.DirectInput => new DirectInputAdapter(),
|
EHostInputMethod.DirectInput => new DirectInputAdapter(),
|
||||||
_ => throw new Exception()
|
_ => throw new Exception()
|
||||||
};
|
};
|
||||||
|
Console.WriteLine($"Using {Adapter.Desc} for host input (keyboard + gamepads)");
|
||||||
Adapter.UpdateConfig(config);
|
Adapter.UpdateConfig(config);
|
||||||
Adapter.FirstInitAll(mainFormHandle);
|
Adapter.FirstInitAll(mainFormHandle);
|
||||||
_updateThread = new Thread(UpdateThreadProc)
|
_updateThread = new Thread(UpdateThreadProc)
|
||||||
|
|
Loading…
Reference in New Issue