mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-31 15:09:42 +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:
@@ -30,6 +30,45 @@ public sealed class GuiSettingsTests
|
||||
Assert.Empty(settings.GameFolders);
|
||||
Assert.Empty(settings.ExcludedGames);
|
||||
Assert.Empty(settings.EnvironmentToggles);
|
||||
Assert.Equal("Windowed", settings.WindowMode);
|
||||
Assert.Equal("1920x1080", settings.Resolution);
|
||||
Assert.Equal("Fit", settings.ScalingMode);
|
||||
Assert.Equal("Auto", settings.HdrMode);
|
||||
Assert.True(settings.VSync);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NormalizeFromJson_InvalidVideoValues_FallBackAndClamp()
|
||||
{
|
||||
const string json = """
|
||||
{
|
||||
"WindowMode": "not-a-mode",
|
||||
"Resolution": "not-a-resolution",
|
||||
"ScalingMode": "nearest-ish",
|
||||
"HdrMode": "maybe",
|
||||
"DisplayIndex": -4,
|
||||
"RefreshRate": 5000
|
||||
}
|
||||
""";
|
||||
|
||||
var settings = GuiSettings.NormalizeFromJson(json);
|
||||
|
||||
Assert.Equal("Windowed", settings.WindowMode);
|
||||
Assert.Equal("1920x1080", settings.Resolution);
|
||||
Assert.Equal("Fit", settings.ScalingMode);
|
||||
Assert.Equal("Auto", settings.HdrMode);
|
||||
Assert.Equal(0, settings.DisplayIndex);
|
||||
Assert.Equal(1000, settings.RefreshRate);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NormalizeFromJson_CustomResolution_IsPreserved()
|
||||
{
|
||||
const string json = """{ "Resolution": "3440x1440" }""";
|
||||
|
||||
var settings = GuiSettings.NormalizeFromJson(json);
|
||||
|
||||
Assert.Equal("3440x1440", settings.Resolution);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -97,4 +136,44 @@ public sealed class GuiSettingsTests
|
||||
Assert.Empty(settings.ExcludedGames);
|
||||
Assert.Empty(settings.EnvironmentToggles);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EffectiveLaunchSettings_PerGameVideoValuesOverrideOnlySelectedFields()
|
||||
{
|
||||
var global = new GuiSettings
|
||||
{
|
||||
WindowMode = "Windowed",
|
||||
Resolution = "1920x1080",
|
||||
DisplayIndex = 1,
|
||||
RefreshRate = 60,
|
||||
ScalingMode = "Fit",
|
||||
HdrMode = "Auto",
|
||||
VSync = true,
|
||||
};
|
||||
var perGame = new PerGameSettings
|
||||
{
|
||||
Resolution = "2560x1440",
|
||||
DisplayIndex = 2,
|
||||
HdrMode = "On",
|
||||
VSync = false,
|
||||
};
|
||||
|
||||
var effective = EffectiveLaunchSettings.Resolve(global, perGame);
|
||||
|
||||
Assert.Equal("Windowed", effective.WindowMode);
|
||||
Assert.Equal("2560x1440", effective.Resolution);
|
||||
Assert.Equal(2, effective.DisplayIndex);
|
||||
Assert.Equal(60, effective.RefreshRate);
|
||||
Assert.Equal("Fit", effective.ScalingMode);
|
||||
Assert.Equal("On", effective.HdrMode);
|
||||
Assert.False(effective.VSync);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PerGameSettings_VideoOverridesParticipateInEmptyCheck()
|
||||
{
|
||||
Assert.True(new PerGameSettings().IsEmpty);
|
||||
Assert.False(new PerGameSettings { ScalingMode = "Integer" }.IsEmpty);
|
||||
Assert.False(new PerGameSettings { HdrMode = "Off" }.IsEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user