mirror of
https://github.com/par274/sharpemu.git
synced 2026-07-30 22:49:53 +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:
@@ -8,19 +8,20 @@ using Xunit;
|
||||
namespace SharpEmu.Libs.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Save data lives under ~/SharpEmu/Saves/<titleId>/<dirName>/ with UI
|
||||
/// Save data lives under user/savedata/<titleId>/<dirName>/ with UI
|
||||
/// metadata in <slot>/sce_sys/param.json. These guard the pure path and
|
||||
/// metadata logic that the SaveData HLE exports build on.
|
||||
/// </summary>
|
||||
public sealed class SaveDataStorageTests
|
||||
{
|
||||
[Fact]
|
||||
public void RootHonorsOverrideAndFallsBackToUserProfile()
|
||||
public void RootHonorsOverrideAndFallsBackToPortableDirectory()
|
||||
{
|
||||
Assert.Equal(Path.GetFullPath("/tmp/custom-saves"), SaveDataStorage.Root("/tmp/custom-saves"));
|
||||
|
||||
var home = System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile);
|
||||
Assert.Equal(Path.Combine(home, "SharpEmu", "Saves"), SaveDataStorage.Root());
|
||||
Assert.Equal(
|
||||
Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "user", "savedata")),
|
||||
SaveDataStorage.Root());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -112,4 +113,36 @@ public sealed class SaveDataStorageTests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LegacyMigrationKeepsTheNewestSaveAndFlattensNumericUsers()
|
||||
{
|
||||
var testRoot = Path.Combine(Path.GetTempPath(), "sharpemu-savemigrate-" + Path.GetRandomFileName());
|
||||
var destination = Path.Combine(testRoot, "portable");
|
||||
var profile = Path.Combine(testRoot, "profile");
|
||||
try
|
||||
{
|
||||
var stale = Path.Combine(destination, "268435456", "PPSA02929", "SAVEDATA00", "save.dat");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(stale)!);
|
||||
File.WriteAllText(stale, "stale");
|
||||
File.SetLastWriteTimeUtc(stale, DateTime.UtcNow.AddMinutes(-2));
|
||||
|
||||
var current = Path.Combine(profile, "PPSA02929", "SAVEDATA00", "save.dat");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(current)!);
|
||||
File.WriteAllText(current, "current");
|
||||
|
||||
SaveDataStorage.MigrateLegacyLayout(destination, profile);
|
||||
|
||||
Assert.Equal(
|
||||
"current",
|
||||
File.ReadAllText(Path.Combine(destination, "PPSA02929", "SAVEDATA00", "save.dat")));
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (Directory.Exists(testRoot))
|
||||
{
|
||||
Directory.Delete(testRoot, recursive: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user