mirror of
https://github.com/par274/sharpemu.git
synced 2026-08-04 00:49:45 +08:00
Sdl backend (#670)
* [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
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// Copyright (C) 2026 SharpEmu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
namespace SharpEmu.HLE.Host;
|
||||
|
||||
/// <summary>Input snapshots produced by the active host window.</summary>
|
||||
public interface IHostWindowInputSource
|
||||
{
|
||||
bool HasKeyboardFocus { get; }
|
||||
|
||||
bool IsKeyDown(int virtualKey);
|
||||
|
||||
int GetGamepadStates(Span<HostGamepadState> destination);
|
||||
|
||||
string? DescribeConnectedGamepad();
|
||||
|
||||
void SetRumble(byte largeMotor, byte smallMotor);
|
||||
|
||||
void SetTriggerRumble(byte? leftTrigger, byte? rightTrigger);
|
||||
|
||||
void SetAdaptiveTriggerEffect(
|
||||
HostAdaptiveTriggerEffect? leftTrigger,
|
||||
HostAdaptiveTriggerEffect? rightTrigger);
|
||||
|
||||
void SetLightbar(byte red, byte green, byte blue);
|
||||
|
||||
void ResetLightbar();
|
||||
}
|
||||
|
||||
/// <summary>Process-wide bridge between the window layer and host input.</summary>
|
||||
public static class HostWindowInputSource
|
||||
{
|
||||
private static IHostWindowInputSource? _current;
|
||||
|
||||
public static IHostWindowInputSource? Current => Volatile.Read(ref _current);
|
||||
|
||||
public static void Set(IHostWindowInputSource source) =>
|
||||
Volatile.Write(ref _current, source);
|
||||
|
||||
public static void Clear(IHostWindowInputSource source) =>
|
||||
Interlocked.CompareExchange(ref _current, null, source);
|
||||
}
|
||||
Reference in New Issue
Block a user