mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-31 06:59:45 +08:00
2b6bd5a532
* [audio] added sdl audio backend and in-tree atrac9 decoder * [input] replaced per-platform pad readers with sdl gamepad input * [video] added sdl window and host display plumbing * [gui] added host display options and per-game render settings * [bink] synced host movie playback to the guest audio clock * [cpu] hooked windows write faults into guest image tracking * [perf] added guest and render profiling, reserved host cpu lanes * [kernel] fixed stale pthread mutex handle alias * [host] wired the sdl session, save-data paths and project references * [audio] hoisted ajm trace stackalloc out of its loop * [video] Add guest image sync setting * [build] Strip native symbols * reuse
44 lines
1.6 KiB
C#
44 lines
1.6 KiB
C#
// Copyright (C) 2026 SharpEmu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
namespace SharpEmu.HLE.Host;
|
|
|
|
/// <summary>
|
|
/// Routes emulated input through the active cross-platform host window.
|
|
/// </summary>
|
|
internal sealed class WindowHostInput : IHostInput
|
|
{
|
|
public void EnsureStarted()
|
|
{
|
|
// SDL owns device discovery and pumps it on the window thread.
|
|
}
|
|
|
|
public int GetGamepadStates(Span<HostGamepadState> destination) =>
|
|
HostWindowInputSource.Current?.GetGamepadStates(destination) ?? 0;
|
|
|
|
public string? DescribeConnectedGamepad() =>
|
|
HostWindowInputSource.Current?.DescribeConnectedGamepad();
|
|
|
|
public void SetRumble(byte largeMotor, byte smallMotor) =>
|
|
HostWindowInputSource.Current?.SetRumble(largeMotor, smallMotor);
|
|
|
|
public void SetTriggerRumble(byte? leftTrigger, byte? rightTrigger) =>
|
|
HostWindowInputSource.Current?.SetTriggerRumble(leftTrigger, rightTrigger);
|
|
|
|
public void SetAdaptiveTriggerEffect(
|
|
HostAdaptiveTriggerEffect? leftTrigger,
|
|
HostAdaptiveTriggerEffect? rightTrigger) =>
|
|
HostWindowInputSource.Current?.SetAdaptiveTriggerEffect(leftTrigger, rightTrigger);
|
|
|
|
public void SetLightbar(byte red, byte green, byte blue) =>
|
|
HostWindowInputSource.Current?.SetLightbar(red, green, blue);
|
|
|
|
public void ResetLightbar() => HostWindowInputSource.Current?.ResetLightbar();
|
|
|
|
public bool IsHostWindowFocused() =>
|
|
HostWindowInputSource.Current?.HasKeyboardFocus ?? false;
|
|
|
|
public bool IsKeyDown(int virtualKey) =>
|
|
HostWindowInputSource.Current?.IsKeyDown(virtualKey) ?? false;
|
|
}
|