mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-17 22:15:59 +01:00
Compare commits
1 Commits
feat/sbt-c
...
feat/audio
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
170bb58487 |
@@ -1,197 +0,0 @@
|
||||
using StarterNG.Infrastructure.Adapters;
|
||||
using StarterNG.Infrastructure.Sceneries;
|
||||
using StarterNG.Tests.Fakes;
|
||||
|
||||
namespace StarterNG.Tests;
|
||||
|
||||
public class BinaryTerrainFilesTests
|
||||
{
|
||||
private const string Record = "user/sbt-cleanup.txt";
|
||||
|
||||
private static BinaryTerrainFiles Build(InMemoryFileSystem files, string root = "game") =>
|
||||
new(files, new GamePaths(root), TestLog.Over(files), Record);
|
||||
|
||||
private static string Scenery(string name) => $"game/scenery/{name}";
|
||||
|
||||
[Fact]
|
||||
public void An_sbt_whose_terrain_files_are_all_there_goes()
|
||||
{
|
||||
var files = new InMemoryFileSystem()
|
||||
.WithLegacyFile(Scenery("kato.scn"), "include kato/kato_ter.scm end\nFirstInit\n")
|
||||
.WithFile(Scenery("kato/kato_ter.scm"), "node")
|
||||
.WithFile(Scenery("kato.sbt"), "EU07SBT2");
|
||||
|
||||
var cleanup = Build(files).CleanUpOnce(1)!;
|
||||
|
||||
Assert.Equal("kato.sbt", Assert.Single(cleanup.Deleted));
|
||||
Assert.False(files.FileExists(Scenery("kato.sbt")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void An_sbt_standing_in_for_missing_terrain_files_stays()
|
||||
{
|
||||
var files = new InMemoryFileSystem(caseSensitive: true)
|
||||
.WithLegacyFile(Scenery("Lk2_Sandbox.scn"), "include nmt/nmt100_mazowieckie_ter.scm end\nFirstInit\n")
|
||||
.WithFile(Scenery("lk2_sandbox.sbt"), "EU07SBT2");
|
||||
|
||||
var cleanup = Build(files).CleanUpOnce(1)!;
|
||||
|
||||
Assert.Empty(cleanup.Deleted);
|
||||
Assert.Equal(("lk2_sandbox.sbt", "nmt/nmt100_mazowieckie_ter.scm"), Assert.Single(cleanup.Kept));
|
||||
Assert.True(files.FileExists(Scenery("lk2_sandbox.sbt")));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(true)]
|
||||
[InlineData(false)]
|
||||
public void Terrain_included_through_another_file_is_looked_for_too(bool present)
|
||||
{
|
||||
var files = new InMemoryFileSystem()
|
||||
.WithLegacyFile(Scenery("td.scn"), "include td/base.inc end\nFirstInit\n")
|
||||
.WithLegacyFile(Scenery("td/base.inc"), "include td/td_ter.scm 1 2 end\n")
|
||||
.WithFile(Scenery("td.sbt"), "EU07SBT2");
|
||||
if (present)
|
||||
files.WithFile(Scenery("td/td_ter.scm"), "node");
|
||||
|
||||
var cleanup = Build(files).CleanUpOnce(1)!;
|
||||
|
||||
Assert.Equal(present, cleanup.Deleted.Count == 1);
|
||||
Assert.Equal(present, !files.FileExists(Scenery("td.sbt")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_missing_include_other_than_terrain_does_not_keep_the_sbt()
|
||||
{
|
||||
var files = new InMemoryFileSystem()
|
||||
.WithLegacyFile(Scenery("tomaszewo.scn"), "include tomaszewo/modele.scm end\nFirstInit\n")
|
||||
.WithLegacyFile(Scenery("tomaszewo/modele.scm"),
|
||||
"include;przejazdy_kombud\\1t12m_0rog_2zar_1x_1dzw.inc;p_czernica15;0;0;0;end\n")
|
||||
.WithFile(Scenery("tomaszewo.sbt"), "EU07SBT2");
|
||||
|
||||
Assert.Single(Build(files).CleanUpOnce(1)!.Deleted);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void An_include_commented_out_needs_no_file()
|
||||
{
|
||||
var files = new InMemoryFileSystem()
|
||||
.WithLegacyFile(Scenery("td.scn"), "// include gone_ter.scm end\n/* include gone.inc end */\nFirstInit\n")
|
||||
.WithFile(Scenery("td.sbt"), "EU07SBT2");
|
||||
|
||||
Assert.Single(Build(files).CleanUpOnce(1)!.Deleted);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_scenery_bringing_terrain_by_a_terrain_directive_keeps_its_sbt()
|
||||
{
|
||||
var files = new InMemoryFileSystem()
|
||||
.WithLegacyFile(Scenery("td.scn"), "terrain td.sbt endterrain\nFirstInit\n")
|
||||
.WithFile(Scenery("td.sbt"), "EU07SBT2");
|
||||
|
||||
Assert.Equal("td.sbt", Assert.Single(Build(files).CleanUpOnce(1)!.Kept).File);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("td/teren.txtf")]
|
||||
[InlineData("td/Teren.btf")]
|
||||
public void An_sbt_in_the_way_of_terrain_files_that_are_there_goes(string onDisk)
|
||||
{
|
||||
var files = new InMemoryFileSystem(caseSensitive: true)
|
||||
.WithLegacyFile(Scenery("td.scn"), "terrain td/teren.txtf endterrain\nFirstInit\n")
|
||||
.WithFile(Scenery(onDisk), "x")
|
||||
.WithFile(Scenery("td.sbt"), "EU07SBT2");
|
||||
|
||||
Assert.Single(Build(files).CleanUpOnce(1)!.Deleted);
|
||||
Assert.False(files.FileExists(Scenery("td.sbt")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void An_sbt_standing_in_for_a_missing_terrain_file_stays()
|
||||
{
|
||||
var files = new InMemoryFileSystem()
|
||||
.WithLegacyFile(Scenery("td.scn"), "terrain td/a.txtf td/b.txtf endterrain\nFirstInit\n")
|
||||
.WithFile(Scenery("td/a.txtf"), "x")
|
||||
.WithFile(Scenery("td.sbt"), "EU07SBT2");
|
||||
|
||||
Assert.Equal(("td.sbt", "td/b.txtf"), Assert.Single(Build(files).CleanUpOnce(1)!.Kept));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void An_sbt_named_beside_terrain_files_keeps_the_scenery_s_own()
|
||||
{
|
||||
var files = new InMemoryFileSystem()
|
||||
.WithLegacyFile(Scenery("td.scn"), "terrain td/a.txtf wspolny.sbt endterrain\nFirstInit\n")
|
||||
.WithFile(Scenery("td/a.txtf"), "x")
|
||||
.WithFile(Scenery("wspolny.sbt"), "EU07SBT2")
|
||||
.WithFile(Scenery("td.sbt"), "EU07SBT2");
|
||||
|
||||
var cleanup = Build(files).CleanUpOnce(1)!;
|
||||
|
||||
Assert.Empty(cleanup.Deleted);
|
||||
Assert.Contains(("td.sbt", "terrain wspolny.sbt"), cleanup.Kept);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void An_sbt_of_no_scenery_stays()
|
||||
{
|
||||
var files = new InMemoryFileSystem()
|
||||
.WithFile(Scenery("old.sbt"), "EU07SBT2");
|
||||
|
||||
Assert.Equal(("old.sbt", "old.scn"), Assert.Single(Build(files).CleanUpOnce(1)!.Kept));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Each_generation_clears_an_installation_once()
|
||||
{
|
||||
var files = new InMemoryFileSystem()
|
||||
.WithLegacyFile(Scenery("td.scn"), "FirstInit\n")
|
||||
.WithFile(Scenery("td.sbt"), "EU07SBT2");
|
||||
var sbt = Build(files);
|
||||
|
||||
Assert.NotNull(sbt.CleanUpOnce(1));
|
||||
files.WithFile(Scenery("td.sbt"), "EU07SBT2");
|
||||
|
||||
Assert.Null(sbt.CleanUpOnce(1));
|
||||
Assert.True(files.FileExists(Scenery("td.sbt")));
|
||||
|
||||
Assert.Single(sbt.CleanUpOnce(2)!.Deleted);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Generation_zero_clears_nothing()
|
||||
{
|
||||
var files = new InMemoryFileSystem()
|
||||
.WithLegacyFile(Scenery("td.scn"), "FirstInit\n")
|
||||
.WithFile(Scenery("td.sbt"), "EU07SBT2");
|
||||
|
||||
Assert.Null(Build(files).CleanUpOnce(0));
|
||||
Assert.True(files.FileExists(Scenery("td.sbt")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Another_installation_has_a_cleanup_of_its_own()
|
||||
{
|
||||
var files = new InMemoryFileSystem()
|
||||
.WithLegacyFile(Scenery("td.scn"), "FirstInit\n")
|
||||
.WithLegacyFile("other/scenery/td.scn", "FirstInit\n")
|
||||
.WithFile("other/scenery/td.sbt", "EU07SBT2");
|
||||
|
||||
Assert.NotNull(Build(files).CleanUpOnce(1));
|
||||
|
||||
Assert.Single(Build(files, "other").CleanUpOnce(1)!.Deleted);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void One_scenery_s_sbt_is_found_whatever_its_case_and_deleted()
|
||||
{
|
||||
var files = new InMemoryFileSystem(caseSensitive: true)
|
||||
.WithLegacyFile(Scenery("Kato.scn"), "FirstInit\n")
|
||||
.WithFile(Scenery("kato.sbt"), "EU07SBT2");
|
||||
var sbt = Build(files);
|
||||
|
||||
Assert.Equal(Path.Combine("game", "scenery", "kato.sbt"), sbt.Of(Scenery("Kato.scn")));
|
||||
Assert.Null(sbt.MissingOriginal(Scenery("Kato.scn")));
|
||||
Assert.True(sbt.Delete(Scenery("Kato.scn")));
|
||||
Assert.Null(sbt.Of(Scenery("Kato.scn")));
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
using StarterNG.Classes;
|
||||
using StarterNG.Tests.Fakes;
|
||||
|
||||
namespace StarterNG.Tests;
|
||||
|
||||
// The old starter's magazyn.ini taken in at a start, over the fake disk.
|
||||
public class OldStarterWarehouseTests
|
||||
{
|
||||
private const string PresetsPath = "/home/user/.config/MaSzyna/starter/userpresets.json";
|
||||
|
||||
// As the old starter writes it: CRLF, code page 1250, the scenery's path for a name.
|
||||
private const string Magazyn =
|
||||
"[TRAINSET0=baltyk/baltyk_km/mpj15120]\r\n" +
|
||||
"00=node -1 0 EN57AKM-1682RA dynamic pkp\\en57akm_2013_v1 EN57AKM-1682ra akm_2013_ra_male_okna 0 headdriver 255 0 enddynamic\r\n" +
|
||||
"01=node -1 0 EN57AKM-1682S dynamic pkp\\en57akm_2013_v1 EN57AKM-1682s akm_2013_s 0 nobody 255 0 enddynamic\r\n" +
|
||||
"02=node -1 0 EN57AKM-1682RB dynamic pkp\\en57akm_2013_v1 EN57AKM-1682rb akm_2013_rb_male_okna 0 nobody 0 0 enddynamic\r\n";
|
||||
|
||||
private static (PresetFile Presets, InMemoryFileSystem Files) Rig()
|
||||
{
|
||||
var files = new InMemoryFileSystem();
|
||||
return (new PresetFile(files, TestLog.Over(files), PresetsPath), files);
|
||||
}
|
||||
|
||||
private static List<TrainsetPreset> Consist(string name, string vehicle) =>
|
||||
OldStarterWarehouse.Read($"[TRAINSET0={name}]\r\n00=node -1 0 {vehicle} dynamic pkp\\x {vehicle} x 0 headdriver 3 0 enddynamic\r\n");
|
||||
|
||||
[Fact]
|
||||
public void A_consist_of_the_old_starter_reads_as_a_trainset_with_its_vehicles()
|
||||
{
|
||||
var consist = Assert.Single(OldStarterWarehouse.Read(Magazyn));
|
||||
|
||||
Assert.Equal("baltyk/baltyk_km/mpj15120", consist.Name);
|
||||
Assert.StartsWith("trainset baltyk/baltyk_km/mpj15120 none 0 0\n", consist.Entry);
|
||||
Assert.EndsWith("endtrainset\n", consist.Entry);
|
||||
var vehicles = ConsistText.VehiclesFrom(consist.Entry);
|
||||
Assert.NotNull(vehicles);
|
||||
Assert.Equal(new[] { "EN57AKM-1682RA", "EN57AKM-1682S", "EN57AKM-1682RB" }, vehicles!.Select(v => v.Name));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_consist_new_in_the_old_starter_joins_the_warehouse()
|
||||
{
|
||||
var (presets, _) = Rig();
|
||||
presets.Save("mine", "trainset mine");
|
||||
|
||||
int added = presets.TakeFromOldStarter(OldStarterWarehouse.Read(Magazyn));
|
||||
|
||||
Assert.Equal(1, added);
|
||||
Assert.Equal(new[] { "baltyk/baltyk_km/mpj15120", "mine" }, presets.Presets().Select(p => p.Name));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_consist_removed_here_does_not_come_back_at_the_next_start()
|
||||
{
|
||||
var (presets, _) = Rig();
|
||||
var found = OldStarterWarehouse.Read(Magazyn);
|
||||
presets.TakeFromOldStarter(found);
|
||||
presets.Delete("baltyk/baltyk_km/mpj15120");
|
||||
|
||||
int added = presets.TakeFromOldStarter(found);
|
||||
|
||||
Assert.Equal(0, added);
|
||||
Assert.Empty(presets.Presets());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Nothing_new_leaves_the_file_unwritten()
|
||||
{
|
||||
var (presets, files) = Rig();
|
||||
var found = OldStarterWarehouse.Read(Magazyn);
|
||||
presets.TakeFromOldStarter(found);
|
||||
string before = files.ReadAllText(PresetsPath);
|
||||
files.WithFile(PresetsPath, before + " ");
|
||||
|
||||
presets.TakeFromOldStarter(found);
|
||||
|
||||
Assert.Equal(before + " ", files.ReadAllText(PresetsPath));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_consist_imported_by_hand_before_is_not_taken_twice()
|
||||
{
|
||||
var (presets, _) = Rig();
|
||||
var found = OldStarterWarehouse.Read(Magazyn);
|
||||
presets.Save(found[0].Name, found[0].Entry);
|
||||
|
||||
int added = presets.TakeFromOldStarter(found);
|
||||
|
||||
Assert.Equal(0, added);
|
||||
Assert.Single(presets.Presets());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_consist_of_the_same_name_made_here_stays_and_the_old_one_comes_in_beside_it()
|
||||
{
|
||||
var (presets, _) = Rig();
|
||||
presets.Save("osobowy", "trainset osobowy none 0 0\nendtrainset\n");
|
||||
|
||||
presets.TakeFromOldStarter(Consist("osobowy", "SM42"));
|
||||
|
||||
var all = presets.Presets();
|
||||
Assert.Equal(new[] { "osobowy", "osobowy" + PresetFile.OldStarterSuffix }, all.Select(p => p.Name));
|
||||
Assert.Equal("trainset osobowy none 0 0\nendtrainset\n", all[0].Entry);
|
||||
Assert.Contains("SM42", all[1].Entry);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_consist_changed_in_the_old_starter_and_untouched_here_is_replaced()
|
||||
{
|
||||
var (presets, _) = Rig();
|
||||
presets.TakeFromOldStarter(Consist("osobowy", "SM42"));
|
||||
|
||||
presets.TakeFromOldStarter(Consist("osobowy", "SU45"));
|
||||
|
||||
var only = Assert.Single(presets.Presets());
|
||||
Assert.Equal("osobowy", only.Name);
|
||||
Assert.Contains("SU45", only.Entry);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_warehouse_file_that_cannot_be_read_is_left_as_it_is()
|
||||
{
|
||||
var (presets, files) = Rig();
|
||||
files.WithFile(PresetsPath, "{ cut");
|
||||
|
||||
int added = presets.TakeFromOldStarter(OldStarterWarehouse.Read(Magazyn));
|
||||
|
||||
Assert.Equal(0, added);
|
||||
Assert.Equal("{ cut", files.ReadAllText(PresetsPath));
|
||||
Assert.False(files.FileExists(PresetsPath + ".unreadable"));
|
||||
}
|
||||
}
|
||||
@@ -53,26 +53,6 @@ public class SceneryFileWatchTests
|
||||
Assert.Equal("Katowice Główne", change.Fresh!.Name);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(true)]
|
||||
[InlineData(false)]
|
||||
public void An_sbt_made_or_removed_makes_the_scenery_read_anew(bool there)
|
||||
{
|
||||
string sbt = TestInstallation.At("scenery", "kato.sbt");
|
||||
var files = Folder();
|
||||
if (there)
|
||||
files.WithFile(sbt, "EU07SBT2");
|
||||
var (installation, watch, _) = Rig(files);
|
||||
|
||||
if (there)
|
||||
files.DeleteFile(sbt);
|
||||
else
|
||||
files.WithFile(sbt, "EU07SBT2");
|
||||
|
||||
var change = Assert.Single(watch.Look(installation.Library.Sceneries));
|
||||
Assert.Equal(!there, change.Fresh!.HasCompanionTimetable);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void An_include_that_changed_or_came_makes_the_scenery_read_anew()
|
||||
{
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
using StarterNG.Application;
|
||||
using StarterNG.Tests.Fakes;
|
||||
|
||||
namespace StarterNG.Tests;
|
||||
|
||||
/// <summary>The settings page on a start with no eu07.ini of the player's own yet.</summary>
|
||||
[Collection(AvaloniaControls.Name)]
|
||||
public class SettingsFirstStartTests
|
||||
{
|
||||
[Fact]
|
||||
public void A_first_start_has_nothing_to_save_before_the_simulator_starts()
|
||||
{
|
||||
var files = new InMemoryFileSystem();
|
||||
files.WriteAllText(TestInstallation.At("eu07.ini"), "width 1920\nheight 1080\nendconfig\n");
|
||||
var installation = new TestInstallation(files);
|
||||
installation.Environment.AsWindows();
|
||||
var services = AppServices.Initialize(installation.Paths, installation.Files, installation.Clock,
|
||||
installation.Environment);
|
||||
services.SettingsStore.Load();
|
||||
services.SettingsStore.StartAtHighWithoutOwnSettings();
|
||||
|
||||
HeadlessDrawing.Ensure();
|
||||
// The page reads the graphics cards away from the window and comes back to it, as in the application.
|
||||
var context = SynchronizationContext.Current;
|
||||
SynchronizationContext.SetSynchronizationContext(new Avalonia.Threading.AvaloniaSynchronizationContext());
|
||||
Avalonia.Controls.Window? window = null;
|
||||
try
|
||||
{
|
||||
var page = new StarterNG.Views.Settings();
|
||||
window = Controls.Show(page, 1600, 1000, themed: true);
|
||||
Assert.False(page.HasUnsavedChanges);
|
||||
}
|
||||
finally
|
||||
{
|
||||
window?.Close();
|
||||
SynchronizationContext.SetSynchronizationContext(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1520,4 +1520,75 @@ public class SettingsStoreTests
|
||||
|
||||
Assert.Null(LineFor(installation, "blackbox"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void The_sound_device_options_left_alone_add_nothing_to_the_file()
|
||||
{
|
||||
var installation = WithHome(new InMemoryFileSystem().WithFile(UserIni, "width 1920\n"));
|
||||
installation.SettingsStore.Load();
|
||||
|
||||
installation.SettingsStore.Save();
|
||||
|
||||
string saved = SavedLines(installation);
|
||||
foreach (var key in new[] { "sound.openal.renderer", "sound.outputmode", "sound.hrtf", "sound.hrtf.profile",
|
||||
"sound.resampler", "sound.limiter", "sound.frequency", "sound.maxsources",
|
||||
"sound.doppler", "sound.efx.lowpass", "sound.efx.airabsorption" })
|
||||
Assert.Null(LineFor(installation, key));
|
||||
Assert.Contains("width 1920\n", saved);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void The_sound_device_options_survive_a_round_trip_with_names_in_quotes()
|
||||
{
|
||||
var installation = WithHome();
|
||||
installation.SettingsStore.Load();
|
||||
var s = installation.SettingsStore.Settings;
|
||||
s.AudioDevice = "OpenAL Soft on Speakers (Realtek(R) Audio)";
|
||||
s.AudioOutputMode = "headphones";
|
||||
s.AudioHrtf = "on";
|
||||
s.AudioHrtfProfile = "Built-In HRTF";
|
||||
s.AudioResampler = "Cubic";
|
||||
s.AudioLimiter = "off";
|
||||
s.AudioFrequency = 48000;
|
||||
s.AudioDoppler = 0.5;
|
||||
s.AudioLowpass = true;
|
||||
s.AudioAirAbsorption = 1.0;
|
||||
|
||||
installation.SettingsStore.Save();
|
||||
|
||||
Assert.Equal("sound.openal.renderer \"OpenAL Soft on Speakers (Realtek(R) Audio)\"",
|
||||
LineFor(installation, "sound.openal.renderer"));
|
||||
Assert.Equal("sound.resampler Cubic", LineFor(installation, "sound.resampler"));
|
||||
Assert.Empty(BareSimulatorKeys(installation));
|
||||
|
||||
var again = WithHome(new InMemoryFileSystem().WithFile(UserIni, installation.Files.ReadAllText(UserIni)));
|
||||
again.SettingsStore.Load();
|
||||
var read = again.SettingsStore.Settings;
|
||||
Assert.Equal(s.AudioDevice, read.AudioDevice);
|
||||
Assert.Equal("headphones", read.AudioOutputMode);
|
||||
Assert.Equal("on", read.AudioHrtf);
|
||||
Assert.Equal("Built-In HRTF", read.AudioHrtfProfile);
|
||||
Assert.Equal("Cubic", read.AudioResampler);
|
||||
Assert.Equal("off", read.AudioLimiter);
|
||||
Assert.Equal(48000, read.AudioFrequency);
|
||||
Assert.Equal(0.5, read.AudioDoppler, 6);
|
||||
Assert.True(read.AudioLowpass);
|
||||
Assert.Equal(1.0, read.AudioAirAbsorption, 6);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_sound_name_set_back_to_the_librarys_choice_takes_its_line_out()
|
||||
{
|
||||
var installation = WithHome(new InMemoryFileSystem()
|
||||
.WithFile(UserIni, "sound.openal.renderer \"Old Device\"\nsound.resampler Cubic\n"));
|
||||
installation.SettingsStore.Load();
|
||||
Assert.Equal("Old Device", installation.SettingsStore.Settings.AudioDevice);
|
||||
|
||||
installation.SettingsStore.Settings.AudioDevice = "";
|
||||
installation.SettingsStore.Settings.AudioResampler = "";
|
||||
installation.SettingsStore.Save();
|
||||
|
||||
Assert.Null(LineFor(installation, "sound.openal.renderer"));
|
||||
Assert.Null(LineFor(installation, "sound.resampler"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,11 +160,6 @@ public partial class App : Avalonia.Application
|
||||
});
|
||||
});
|
||||
|
||||
// Ahead of the sceneries, so the list knows which still have their .sbt.
|
||||
try { AppServices.Current.BinaryTerrain.CleanUpOnce(); }
|
||||
catch (Exception ex) { Diagnostics.Log("sbt cleanup", ex); }
|
||||
// Before any window lists the warehouse; it catches what it meets itself.
|
||||
PresetStore.TakeFromOldStarter();
|
||||
AppServices.Current.Library.Load(progress);
|
||||
}).ContinueWith(load =>
|
||||
{
|
||||
|
||||
@@ -43,7 +43,6 @@ public sealed class AppServices
|
||||
paths.FromRoot("starter"),
|
||||
paths.FromRoot("lang")));
|
||||
Sceneries = new SceneryRepository(files, paths, log, new SceneryParser(clock, random));
|
||||
BinaryTerrain = new BinaryTerrainFiles(files, paths, log, settingsPaths.SbtCleanupPath());
|
||||
SceneryImages = new SceneryImageLocator(files);
|
||||
MiniTextures = new MiniTextureIndex(files, paths);
|
||||
|
||||
@@ -112,8 +111,6 @@ public sealed class AppServices
|
||||
|
||||
public SceneryFileWatch SceneryFiles { get; }
|
||||
|
||||
public BinaryTerrainFiles BinaryTerrain { get; }
|
||||
|
||||
public SceneryImageLocator SceneryImages { get; }
|
||||
|
||||
public IMiniTextureIndex MiniTextures { get; }
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
@@ -30,9 +28,6 @@ public sealed class TrainsetPreset
|
||||
public sealed class PresetCollection
|
||||
{
|
||||
public List<TrainsetPreset> Presets { get; set; } = new();
|
||||
|
||||
/// <summary>The old starter's consists taken in at a start, by <see cref="PresetFile.Fingerprint"/>.</summary>
|
||||
public List<string> OldStarterSeen { get; set; } = new();
|
||||
}
|
||||
|
||||
public static class PresetStore
|
||||
@@ -86,9 +81,33 @@ public static class PresetStore
|
||||
int added = 0;
|
||||
try
|
||||
{
|
||||
foreach (var consist in OldStarterWarehouse.Read(LegacyText.Decode(File.ReadAllBytes(path))))
|
||||
string text = File.ReadAllText(path, LegacyText.CodePage1250);
|
||||
var section = Regex.Matches(text,
|
||||
@"\[TRAINSET\d+\s*=\s*([^\]]*)\](.*?)(?=\[TRAINSET|\z)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Singleline);
|
||||
|
||||
foreach (Match m in section)
|
||||
{
|
||||
Save(consist.Name, consist.Entry);
|
||||
string name = m.Groups[1].Value.Trim();
|
||||
if (name.Length == 0) name = $"import_{added + 1}";
|
||||
|
||||
var nodes = new List<string>();
|
||||
foreach (Match line in Regex.Matches(m.Groups[2].Value, @"(?m)^\s*\d+\s*=\s*(.+)$"))
|
||||
{
|
||||
string body = line.Groups[1].Value.Trim();
|
||||
if (!body.Contains("enddynamic", StringComparison.OrdinalIgnoreCase))
|
||||
body += " enddynamic";
|
||||
nodes.Add(body);
|
||||
}
|
||||
if (nodes.Count == 0) continue;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("trainset ").Append(Sanitize(name)).Append(" none 0 0\n");
|
||||
foreach (string n in nodes)
|
||||
sb.Append(n).Append('\n');
|
||||
sb.Append("endtrainset\n");
|
||||
|
||||
Save(name, sb.ToString());
|
||||
added++;
|
||||
}
|
||||
}
|
||||
@@ -99,26 +118,6 @@ public static class PresetStore
|
||||
return added;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// At the start: what the old starter put in its warehouse since the last start
|
||||
/// joins this one, as that starter showed its magazyn.ini each time it was opened.
|
||||
/// </summary>
|
||||
public static void TakeFromOldStarter()
|
||||
{
|
||||
string? path = FindMagazynPath();
|
||||
if (path is null)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
Disk.TakeFromOldStarter(OldStarterWarehouse.Read(LegacyText.Decode(File.ReadAllBytes(path))));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Infrastructure.Diagnostics.Log($"Import {path}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static string? FindMagazynPath()
|
||||
{
|
||||
string cwd = Directory.GetCurrentDirectory();
|
||||
@@ -140,46 +139,6 @@ public static class PresetStore
|
||||
var m = Regex.Match(p.Entry ?? "", @"^\s*trainset\s+\S+\s+(\S+)", RegexOptions.Multiline | RegexOptions.IgnoreCase);
|
||||
return m.Success ? m.Groups[1].Value : "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The old starter's magazyn.ini: a [TRAINSETn=name] line for each consist, then
|
||||
/// its vehicles as numbered "node … enddynamic" lines.
|
||||
/// </summary>
|
||||
public static class OldStarterWarehouse
|
||||
{
|
||||
public static List<TrainsetPreset> Read(string text)
|
||||
{
|
||||
var consists = new List<TrainsetPreset>();
|
||||
var sections = Regex.Matches(text,
|
||||
@"\[TRAINSET\d+\s*=\s*([^\]]*)\](.*?)(?=\[TRAINSET|\z)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Singleline);
|
||||
|
||||
foreach (Match m in sections)
|
||||
{
|
||||
string name = m.Groups[1].Value.Trim();
|
||||
if (name.Length == 0) name = $"import_{consists.Count + 1}";
|
||||
|
||||
var nodes = new List<string>();
|
||||
foreach (Match line in Regex.Matches(m.Groups[2].Value, @"(?m)^\s*\d+\s*=\s*(.+)$"))
|
||||
{
|
||||
string body = line.Groups[1].Value.Trim();
|
||||
if (!body.Contains("enddynamic", StringComparison.OrdinalIgnoreCase))
|
||||
body += " enddynamic";
|
||||
nodes.Add(body);
|
||||
}
|
||||
if (nodes.Count == 0) continue;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("trainset ").Append(Sanitize(name)).Append(" none 0 0\n");
|
||||
foreach (string n in nodes)
|
||||
sb.Append(n).Append('\n');
|
||||
sb.Append("endtrainset\n");
|
||||
|
||||
consists.Add(new TrainsetPreset { Name = name, Entry = sb.ToString() });
|
||||
}
|
||||
return consists;
|
||||
}
|
||||
|
||||
private static string Sanitize(string name) =>
|
||||
string.IsNullOrWhiteSpace(name) ? "preset" : name.Replace(' ', '_');
|
||||
@@ -234,55 +193,6 @@ public sealed class PresetFile
|
||||
Persist(col, read);
|
||||
}
|
||||
|
||||
/// <summary>Where a consist of the old starter goes when one of its name with other vehicles is here.</summary>
|
||||
public const string OldStarterSuffix = " (magazyn.ini)";
|
||||
|
||||
/// <summary>
|
||||
/// Takes in the old starter's consists not taken at an earlier start, so one
|
||||
/// removed here stays removed while the old starter keeps it as it was. One
|
||||
/// whose name is here with other vehicles comes in beside it, unless what is
|
||||
/// here is that consist as an earlier start brought it, untouched since.
|
||||
/// </summary>
|
||||
/// <returns>How many came in.</returns>
|
||||
public int TakeFromOldStarter(IReadOnlyList<TrainsetPreset> found)
|
||||
{
|
||||
// A file that cannot be read is not replaced by an import nobody asked for.
|
||||
if (found.Count == 0 || !TryRead(out var col))
|
||||
return 0;
|
||||
|
||||
var seenBefore = new HashSet<string>(col.OldStarterSeen, StringComparer.Ordinal);
|
||||
var seen = new HashSet<string>(seenBefore, StringComparer.Ordinal);
|
||||
int added = 0;
|
||||
foreach (var consist in found)
|
||||
{
|
||||
if (!seen.Add(Fingerprint(consist)))
|
||||
continue;
|
||||
|
||||
var here = col.Presets.Find(p => string.Equals(p.Name, consist.Name, StringComparison.OrdinalIgnoreCase));
|
||||
if (here is not null && here.Entry == consist.Entry)
|
||||
continue;
|
||||
|
||||
string name = here is null || seenBefore.Contains(Fingerprint(here))
|
||||
? consist.Name
|
||||
: consist.Name + OldStarterSuffix;
|
||||
col.Presets.RemoveAll(p => string.Equals(p.Name, name, StringComparison.OrdinalIgnoreCase));
|
||||
col.Presets.Add(new TrainsetPreset { Name = name, Entry = consist.Entry });
|
||||
added++;
|
||||
}
|
||||
|
||||
if (seen.Count == seenBefore.Count)
|
||||
return 0;
|
||||
|
||||
col.OldStarterSeen = seen.Order(StringComparer.Ordinal).ToList();
|
||||
col.Presets.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase));
|
||||
Persist(col, read: true);
|
||||
return added;
|
||||
}
|
||||
|
||||
/// <summary>A consist by its name and vehicles, short enough to keep each one ever taken in.</summary>
|
||||
public static string Fingerprint(TrainsetPreset preset) =>
|
||||
Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(preset.Name + "\n" + preset.Entry)));
|
||||
|
||||
/// <summary>The file's presets; false, with none, when there is a file but they cannot be had from it.</summary>
|
||||
private bool TryRead(out PresetCollection col)
|
||||
{
|
||||
|
||||
@@ -161,6 +161,29 @@ public sealed class SimulatorSettings
|
||||
public int VehiclesVolume = 100;
|
||||
public int PositionalVolume = 100;
|
||||
public int AmbientVolume = 100;
|
||||
|
||||
// OpenAL Soft options of the simulator; the defaults leave the choice to the library, as the
|
||||
// simulator did before it had these keys.
|
||||
/// <summary>sound.openal.renderer: the output device, empty for the system's default.</summary>
|
||||
public string AudioDevice = "";
|
||||
/// <summary>sound.outputmode: auto, mono, stereo, stereo-basic, uhj, headphones, quad, 5.1, 6.1, 7.1.</summary>
|
||||
public string AudioOutputMode = "auto";
|
||||
/// <summary>sound.hrtf: auto, on, off.</summary>
|
||||
public string AudioHrtf = "auto";
|
||||
/// <summary>sound.hrtf.profile: the HRTF data set, empty for the library's choice.</summary>
|
||||
public string AudioHrtfProfile = "";
|
||||
/// <summary>sound.resampler: empty for the library's default.</summary>
|
||||
public string AudioResampler = "";
|
||||
/// <summary>sound.limiter: auto, on, off.</summary>
|
||||
public string AudioLimiter = "auto";
|
||||
/// <summary>sound.frequency: the mixing rate in Hz, 0 for the device's.</summary>
|
||||
public int AudioFrequency;
|
||||
/// <summary>sound.doppler: the strength of the Doppler effect.</summary>
|
||||
public double AudioDoppler = 0.25;
|
||||
/// <summary>sound.efx.lowpass: soundproofing also muffles the high frequencies.</summary>
|
||||
public bool AudioLowpass;
|
||||
/// <summary>sound.efx.airabsorption: 0-10, the high frequencies fade with distance.</summary>
|
||||
public double AudioAirAbsorption;
|
||||
public bool SkipPipeline;
|
||||
public int PythonScreenUpdateRate = 200;
|
||||
public bool DebugLogVisible;
|
||||
|
||||
159
StarterNG/Infrastructure/OpenAlProbe.cs
Normal file
159
StarterNG/Infrastructure/OpenAlProbe.cs
Normal file
@@ -0,0 +1,159 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StarterNG.Infrastructure;
|
||||
|
||||
/// <summary>What the simulator's OpenAL library offers for its sound settings.</summary>
|
||||
public sealed record AudioChoices(IReadOnlyList<string> Devices, IReadOnlyList<string> HrtfProfiles, IReadOnlyList<string> Resamplers)
|
||||
{
|
||||
public static AudioChoices None { get; } = new(Array.Empty<string>(), Array.Empty<string>(), Array.Empty<string>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asks the OpenAL library beside the simulator, the one it plays through, for the output devices,
|
||||
/// the HRTF data sets and the resamplers. The data sets and the resamplers are known only with a
|
||||
/// device open, so the default one is opened for a moment. An older library (OpenAL Soft before
|
||||
/// 1.19 lists no resamplers), or none at all, gives what it can and empty lists for the rest.
|
||||
/// </summary>
|
||||
public static unsafe class OpenAlProbe
|
||||
{
|
||||
private const int AlcDeviceSpecifier = 0x1005;
|
||||
private const int AlcAllDevicesSpecifier = 0x1013;
|
||||
private const int AlcNumHrtfSpecifiers = 0x1994;
|
||||
private const int AlcHrtfSpecifier = 0x1995;
|
||||
private const int AlNumResamplers = 0x1210;
|
||||
private const int AlResamplerName = 0x1213;
|
||||
|
||||
/// <summary>The file of the library in the simulator's folder.</summary>
|
||||
public static string LibraryFile => OperatingSystem.IsWindows() ? "OpenAL32.dll" : "libopenal.so.1";
|
||||
|
||||
public static AudioChoices Read(string gameFolder)
|
||||
{
|
||||
// The library stays loaded: OpenAL Soft keeps threads of its own, unloading it under them is not safe.
|
||||
if (!NativeLibrary.TryLoad(Path.Combine(gameFolder, LibraryFile), out IntPtr library))
|
||||
return AudioChoices.None;
|
||||
try
|
||||
{
|
||||
return new Api(library).Read();
|
||||
}
|
||||
catch (EntryPointNotFoundException)
|
||||
{
|
||||
return AudioChoices.None;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The entry points of one library; the extension ones are null where it lacks them.</summary>
|
||||
private sealed class Api
|
||||
{
|
||||
private readonly delegate* unmanaged[Cdecl]<IntPtr, byte*, byte> _alcIsExtensionPresent;
|
||||
private readonly delegate* unmanaged[Cdecl]<IntPtr, int, byte*> _alcGetString;
|
||||
private readonly delegate* unmanaged[Cdecl]<byte*, IntPtr> _alcOpenDevice;
|
||||
private readonly delegate* unmanaged[Cdecl]<IntPtr, byte> _alcCloseDevice;
|
||||
private readonly delegate* unmanaged[Cdecl]<IntPtr, int*, IntPtr> _alcCreateContext;
|
||||
private readonly delegate* unmanaged[Cdecl]<IntPtr, byte> _alcMakeContextCurrent;
|
||||
private readonly delegate* unmanaged[Cdecl]<IntPtr, void> _alcDestroyContext;
|
||||
private readonly delegate* unmanaged[Cdecl]<IntPtr, int, int, int*, void> _alcGetIntegerv;
|
||||
private readonly delegate* unmanaged[Cdecl]<int, int> _alGetInteger;
|
||||
private readonly delegate* unmanaged[Cdecl]<IntPtr, int, int, byte*> _alcGetStringiSOFT;
|
||||
private readonly delegate* unmanaged[Cdecl]<int, int, byte*> _alGetStringiSOFT;
|
||||
|
||||
public Api(IntPtr library)
|
||||
{
|
||||
_alcIsExtensionPresent = (delegate* unmanaged[Cdecl]<IntPtr, byte*, byte>)NativeLibrary.GetExport(library, "alcIsExtensionPresent");
|
||||
_alcGetString = (delegate* unmanaged[Cdecl]<IntPtr, int, byte*>)NativeLibrary.GetExport(library, "alcGetString");
|
||||
_alcOpenDevice = (delegate* unmanaged[Cdecl]<byte*, IntPtr>)NativeLibrary.GetExport(library, "alcOpenDevice");
|
||||
_alcCloseDevice = (delegate* unmanaged[Cdecl]<IntPtr, byte>)NativeLibrary.GetExport(library, "alcCloseDevice");
|
||||
_alcCreateContext = (delegate* unmanaged[Cdecl]<IntPtr, int*, IntPtr>)NativeLibrary.GetExport(library, "alcCreateContext");
|
||||
_alcMakeContextCurrent = (delegate* unmanaged[Cdecl]<IntPtr, byte>)NativeLibrary.GetExport(library, "alcMakeContextCurrent");
|
||||
_alcDestroyContext = (delegate* unmanaged[Cdecl]<IntPtr, void>)NativeLibrary.GetExport(library, "alcDestroyContext");
|
||||
_alcGetIntegerv = (delegate* unmanaged[Cdecl]<IntPtr, int, int, int*, void>)NativeLibrary.GetExport(library, "alcGetIntegerv");
|
||||
_alGetInteger = (delegate* unmanaged[Cdecl]<int, int>)NativeLibrary.GetExport(library, "alGetInteger");
|
||||
// OpenAL Soft exports its extension functions too; a library without them leaves these null.
|
||||
NativeLibrary.TryGetExport(library, "alcGetStringiSOFT", out IntPtr getStringi);
|
||||
_alcGetStringiSOFT = (delegate* unmanaged[Cdecl]<IntPtr, int, int, byte*>)getStringi;
|
||||
NativeLibrary.TryGetExport(library, "alGetStringiSOFT", out IntPtr alGetStringi);
|
||||
_alGetStringiSOFT = (delegate* unmanaged[Cdecl]<int, int, byte*>)alGetStringi;
|
||||
}
|
||||
|
||||
public AudioChoices Read()
|
||||
{
|
||||
int deviceList = HasExtension("ALC_ENUMERATE_ALL_EXT\0"u8) ? AlcAllDevicesSpecifier : AlcDeviceSpecifier;
|
||||
List<string> devices = NameList(_alcGetString(IntPtr.Zero, deviceList));
|
||||
|
||||
IntPtr device = _alcOpenDevice(null);
|
||||
if (device == IntPtr.Zero)
|
||||
return new AudioChoices(devices, Array.Empty<string>(), Array.Empty<string>());
|
||||
try
|
||||
{
|
||||
return new AudioChoices(devices, HrtfProfiles(device), Resamplers(device));
|
||||
}
|
||||
finally
|
||||
{
|
||||
_alcCloseDevice(device);
|
||||
}
|
||||
}
|
||||
|
||||
private bool HasExtension(ReadOnlySpan<byte> name)
|
||||
{
|
||||
fixed (byte* text = name)
|
||||
return _alcIsExtensionPresent(IntPtr.Zero, text) != 0;
|
||||
}
|
||||
|
||||
private List<string> HrtfProfiles(IntPtr device)
|
||||
{
|
||||
var names = new List<string>();
|
||||
if (_alcGetStringiSOFT == null)
|
||||
return names;
|
||||
int count = 0;
|
||||
_alcGetIntegerv(device, AlcNumHrtfSpecifiers, 1, &count);
|
||||
for (int index = 0; index < count; index++)
|
||||
names.Add(Utf8(_alcGetStringiSOFT(device, AlcHrtfSpecifier, index)));
|
||||
return names;
|
||||
}
|
||||
|
||||
private List<string> Resamplers(IntPtr device)
|
||||
{
|
||||
var names = new List<string>();
|
||||
if (_alGetStringiSOFT == null)
|
||||
return names;
|
||||
IntPtr context = _alcCreateContext(device, null);
|
||||
if (context == IntPtr.Zero)
|
||||
return names;
|
||||
try
|
||||
{
|
||||
_alcMakeContextCurrent(context);
|
||||
int count = _alGetInteger(AlNumResamplers);
|
||||
for (int index = 0; index < count; index++)
|
||||
names.Add(Utf8(_alGetStringiSOFT(AlResamplerName, index)));
|
||||
}
|
||||
finally
|
||||
{
|
||||
_alcMakeContextCurrent(IntPtr.Zero);
|
||||
_alcDestroyContext(context);
|
||||
}
|
||||
return names;
|
||||
}
|
||||
}
|
||||
|
||||
private static string Utf8(byte* text) => text == null ? "" : Marshal.PtrToStringUTF8((IntPtr)text) ?? "";
|
||||
|
||||
/// <summary>A list of null-terminated names ending with an empty one, as OpenAL gives the devices.</summary>
|
||||
private static List<string> NameList(byte* list)
|
||||
{
|
||||
var names = new List<string>();
|
||||
if (list == null)
|
||||
return names;
|
||||
while (*list != 0)
|
||||
{
|
||||
int length = 0;
|
||||
while (list[length] != 0)
|
||||
length++;
|
||||
names.Add(Encoding.UTF8.GetString(list, length));
|
||||
list += length + 1;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
}
|
||||
@@ -1,289 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using StarterNG.Application.Abstractions;
|
||||
using StarterNG.Domain;
|
||||
using StarterNG.Domain.Sceneries;
|
||||
using StarterNG.Infrastructure.Adapters;
|
||||
|
||||
namespace StarterNG.Infrastructure.Sceneries;
|
||||
|
||||
/// <summary>
|
||||
/// The sceneries' binary terrain files (.sbt): the simulator writes one beside a
|
||||
/// scenery on its first load and from then on takes the terrain from it, passing
|
||||
/// the scenery's terrain includes (<c>*_ter.scm</c>) over. It never asks whether
|
||||
/// the text changed since, so a file made by an older simulator, or before the
|
||||
/// scenery was updated, keeps showing what was there then.
|
||||
/// <para>
|
||||
/// A file goes only when the scenery's text still holds what it was made of: some
|
||||
/// sceneries come with the .sbt in place of their terrain includes, and without it
|
||||
/// they would have no terrain at all.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public sealed class BinaryTerrainFiles
|
||||
{
|
||||
/// <summary>
|
||||
/// Raised by a release that wants the .sbt files made anew: each installation is
|
||||
/// cleared once for each value, on the first start of a starter carrying it.
|
||||
/// Zero clears nothing.
|
||||
/// </summary>
|
||||
public const int CleanupGeneration = 1;
|
||||
|
||||
private const string Extension = ".sbt";
|
||||
|
||||
// The simulator splits its text into words at spaces, tabs, line ends and semicolons.
|
||||
private static readonly Regex Word = new(@"[^\s;]+", RegexOptions.CultureInvariant);
|
||||
|
||||
private readonly IFileSystem _files;
|
||||
private readonly IGamePaths _paths;
|
||||
private readonly IDiagnosticsLog _log;
|
||||
private readonly string _recordPath;
|
||||
|
||||
/// <param name="recordPath">Where the cleanups done are noted, for each installation.</param>
|
||||
public BinaryTerrainFiles(IFileSystem files, IGamePaths paths, IDiagnosticsLog log, string recordPath)
|
||||
{
|
||||
_files = files;
|
||||
_paths = paths;
|
||||
_log = log;
|
||||
_recordPath = recordPath;
|
||||
}
|
||||
|
||||
/// <summary>The scenery's own .sbt as it is on disk, whatever the case of its letters; null when it has none.</summary>
|
||||
public string? Of(string sceneryPath)
|
||||
{
|
||||
string? file = new CaseInsensitivePaths(_files)
|
||||
.Resolve(_paths.Scenery, Path.GetFileNameWithoutExtension(sceneryPath) + Extension);
|
||||
return file is null ? null : Path.Combine(_paths.Scenery, file);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What the simulator would miss to make the scenery's .sbt again - the first
|
||||
/// terrain file its text names and the installation lacks, or the terrain directive
|
||||
/// that brings terrain from elsewhere; null when the text holds it all.
|
||||
/// </summary>
|
||||
public string? MissingOriginal(string sceneryPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
var names = new CaseInsensitivePaths(_files, keepListings: true);
|
||||
string? own = names.Resolve(_paths.Scenery, Path.GetFileName(sceneryPath));
|
||||
if (own is null)
|
||||
return Path.GetFileName(sceneryPath);
|
||||
|
||||
var seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
var pending = new Stack<string>();
|
||||
pending.Push(own);
|
||||
while (pending.Count > 0)
|
||||
{
|
||||
string file = pending.Pop();
|
||||
if (!seen.Add(file))
|
||||
continue;
|
||||
|
||||
if (Scan(file, names, pending) is { } missing)
|
||||
return missing;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Log($"sbt/{Path.GetFileName(sceneryPath)}", ex);
|
||||
return Path.GetFileName(sceneryPath);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads one file of the scenery for its includes: the terrain ones have to be
|
||||
/// there, the others are read in turn. Terrain files are not opened - they are the
|
||||
/// largest of all and include nothing.
|
||||
/// </summary>
|
||||
private string? Scan(string file, CaseInsensitivePaths names, Stack<string> pending)
|
||||
{
|
||||
string text = LegacyText.Decode(_files.ReadAllBytes(Path.Combine(_paths.Scenery, file)));
|
||||
string code = SceneryCode.Mask(text, out _);
|
||||
|
||||
bool includeNext = false;
|
||||
bool terrainDirective = false;
|
||||
for (var word = Word.Match(code); word.Success; word = word.NextMatch())
|
||||
{
|
||||
string token = word.Value;
|
||||
if (terrainDirective)
|
||||
{
|
||||
if (token.Equals("endterrain", StringComparison.OrdinalIgnoreCase))
|
||||
terrainDirective = false;
|
||||
else if (TerrainFileMissing(token, names) is { } missing)
|
||||
return missing;
|
||||
}
|
||||
else if (includeNext)
|
||||
{
|
||||
includeNext = false;
|
||||
bool terrain = SimulatorNames.Lower(token).Contains("_ter.scm");
|
||||
string? found = names.Resolve(_paths.Scenery, token);
|
||||
if (found is null && terrain)
|
||||
return token;
|
||||
// Any other file the simulator reads from the text, .sbt or not: missing,
|
||||
// it is missing either way, and the .sbt made again lacks nothing.
|
||||
if (found is not null && !terrain)
|
||||
pending.Push(found);
|
||||
}
|
||||
else if (token.Equals("include", StringComparison.OrdinalIgnoreCase))
|
||||
includeNext = true;
|
||||
else if (token.Equals("terrain", StringComparison.OrdinalIgnoreCase))
|
||||
terrainDirective = true;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// One file named by a terrain directive. An .sbt named there holds the geometry
|
||||
/// of the whole scenery and nothing makes it again, so the scenery's own goes
|
||||
/// only without one. A terrain file (.txtf) has its geometry in itself or in its
|
||||
/// binary copy (.btf) beside it: with either one there, the scenery's .sbt only
|
||||
/// keeps that terrain from being used, and the simulator asks for it to go.
|
||||
/// </summary>
|
||||
private string? TerrainFileMissing(string token, CaseInsensitivePaths names)
|
||||
{
|
||||
string extension = Path.GetExtension(token);
|
||||
if (extension.Equals(Extension, StringComparison.OrdinalIgnoreCase))
|
||||
return "terrain " + token;
|
||||
|
||||
if (!extension.Equals(".txtf", StringComparison.OrdinalIgnoreCase)
|
||||
&& !extension.Equals(".btf", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
string stem = token[..^extension.Length];
|
||||
return names.Resolve(_paths.Scenery, stem + ".txtf") is null
|
||||
&& names.Resolve(_paths.Scenery, stem + ".btf") is null
|
||||
? stem + ".txtf"
|
||||
: null;
|
||||
}
|
||||
|
||||
/// <summary>Removes the scenery's .sbt; false when it has none or it could not go.</summary>
|
||||
public bool Delete(string sceneryPath)
|
||||
{
|
||||
if (Of(sceneryPath) is not { } file)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
_files.DeleteFile(file);
|
||||
_log.Log($"{file} removed, the simulator makes it again on the next load of the scenery");
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Log($"sbt/{Path.GetFileName(file)}", ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the .sbt files the simulator can make again, once for each
|
||||
/// <paramref name="generation"/> on this installation; null when it was done
|
||||
/// already. A file that could not go leaves the cleanup to the next start.
|
||||
/// </summary>
|
||||
public BinaryTerrainCleanup? CleanUpOnce(int generation = CleanupGeneration)
|
||||
{
|
||||
if (generation <= 0 || !_files.DirectoryExists(_paths.Scenery))
|
||||
return null;
|
||||
|
||||
var record = ReadRecord();
|
||||
string installation = Installation();
|
||||
if (record.TryGetValue(installation, out int done) && done >= generation)
|
||||
return null;
|
||||
|
||||
var deleted = new List<string>();
|
||||
var kept = new List<(string File, string Reason)>();
|
||||
var failed = new List<string>();
|
||||
var names = new CaseInsensitivePaths(_files);
|
||||
|
||||
foreach (string sbt in _files.GetFiles(_paths.Scenery)
|
||||
.Where(f => Path.GetExtension(f).Equals(Extension, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
string name = Path.GetFileName(sbt);
|
||||
string? scenery = names.Resolve(_paths.Scenery, Path.GetFileNameWithoutExtension(sbt) + ".scn");
|
||||
string? missing = scenery is null ? Path.GetFileNameWithoutExtension(sbt) + ".scn" : MissingOriginal(scenery);
|
||||
if (missing is not null)
|
||||
{
|
||||
kept.Add((name, missing));
|
||||
_log.Log($"{name} kept: the scenery cannot be made without it, {missing} is missing");
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_files.DeleteFile(sbt);
|
||||
deleted.Add(name);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
failed.Add(name);
|
||||
_log.Log($"sbt/{name}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (deleted.Count > 0)
|
||||
_log.Log($"Binary terrain files removed, the simulator makes them again: {string.Join(", ", deleted)}");
|
||||
|
||||
if (failed.Count == 0)
|
||||
{
|
||||
record[installation] = generation;
|
||||
WriteRecord(record);
|
||||
}
|
||||
|
||||
return new BinaryTerrainCleanup(deleted, kept, failed);
|
||||
}
|
||||
|
||||
private string Installation() =>
|
||||
Path.TrimEndingDirectorySeparator(Path.GetFullPath(_paths.Root));
|
||||
|
||||
private Dictionary<string, int> ReadRecord()
|
||||
{
|
||||
var record = new Dictionary<string, int>(
|
||||
_files.IgnoresCase ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal);
|
||||
try
|
||||
{
|
||||
if (!_files.FileExists(_recordPath))
|
||||
return record;
|
||||
|
||||
foreach (string line in _files.ReadAllLines(_recordPath))
|
||||
{
|
||||
int tab = line.IndexOf('\t');
|
||||
if (tab > 0 && int.TryParse(line[..tab], out int generation))
|
||||
record[line[(tab + 1)..]] = generation;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Log("sbt cleanup record", ex);
|
||||
}
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
private void WriteRecord(Dictionary<string, int> record)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Path.GetDirectoryName(_recordPath) is { Length: > 0 } folder)
|
||||
_files.CreateDirectory(folder);
|
||||
_files.WriteAllTextAtomic(_recordPath,
|
||||
string.Concat(record.Select(entry => $"{entry.Value}\t{entry.Key}\n")));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Log("sbt cleanup record", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <param name="Deleted">The files removed.</param>
|
||||
/// <param name="Kept">The files left, as nothing could make them again, each with what is missing.</param>
|
||||
/// <param name="Failed">The files that could not be removed.</param>
|
||||
public sealed record BinaryTerrainCleanup(
|
||||
IReadOnlyList<string> Deleted,
|
||||
IReadOnlyList<(string File, string Reason)> Kept,
|
||||
IReadOnlyList<string> Failed);
|
||||
@@ -79,12 +79,7 @@ public sealed class SceneryRepository : ISceneryRepository
|
||||
|
||||
// With its own .sbt the scenery's terrain comes from it, and the simulator
|
||||
// passes its terrain includes over without opening them.
|
||||
// Watched with the text: made by the simulator on a load, or removed, it changes the scenery too.
|
||||
string sbtName = Path.GetFileNameWithoutExtension(path) + ".sbt";
|
||||
string? sbt = ResolveInclude(sbtName);
|
||||
bool binaryTerrain = sbt is not null;
|
||||
string sbtPath = Path.Combine(_paths.Scenery, sbt ?? sbtName);
|
||||
sources[sbtPath] = FileStamp.Of(_files, sbtPath);
|
||||
bool binaryTerrain = Opens(Path.GetFileNameWithoutExtension(path) + ".sbt");
|
||||
bool OpensInclude(string name) =>
|
||||
Opens(name) || (binaryTerrain && SimulatorNames.Lower(name).Contains("_ter.scm"));
|
||||
|
||||
|
||||
@@ -53,9 +53,6 @@ public sealed class SettingsPaths
|
||||
/// <summary>The sceneries starred in the list.</summary>
|
||||
public string FavoritesPath() => Path.Combine(UserConfigDirectory(), "favorites.txt");
|
||||
|
||||
/// <summary>Which cleanup of the .sbt files each installation had.</summary>
|
||||
public string SbtCleanupPath() => Path.Combine(UserConfigDirectory(), "sbt-cleanup.txt");
|
||||
|
||||
public string UserConfigDirectory() =>
|
||||
Path.GetDirectoryName(UserConfigPath()) ?? _environment.BaseDirectory;
|
||||
}
|
||||
|
||||
@@ -194,6 +194,7 @@ public sealed class SettingsSerializer
|
||||
s.VehiclesVolume = Clamp((int)Math.Round(c.GetDouble("sound.volume.vehicle", 1.0) * 100), 0, 100);
|
||||
s.PositionalVolume = Clamp((int)Math.Round(c.GetDouble("sound.volume.positional", 1.0) * 100), 0, 100);
|
||||
s.AmbientVolume = Clamp((int)Math.Round(c.GetDouble("sound.volume.ambient", 1.0) * 100), 0, 100);
|
||||
ReadAudioDevice(c, s);
|
||||
s.SkipPipeline = c.GetBool("gfx.skippipeline", false);
|
||||
s.PythonScreenUpdateRate = c.Has("python.updatetime")
|
||||
? Clamp(c.GetInt("python.updatetime", 200), 0, 10000)
|
||||
@@ -412,6 +413,7 @@ public sealed class SettingsSerializer
|
||||
c.SetDouble("sound.volume.vehicle", s.VehiclesVolume / 100.0);
|
||||
c.SetDouble("sound.volume.positional", s.PositionalVolume / 100.0);
|
||||
c.SetDouble("sound.volume.ambient", s.AmbientVolume / 100.0);
|
||||
WriteAudioDevice(c, s);
|
||||
c.SetBool("gfx.skippipeline", s.SkipPipeline);
|
||||
c.SetInt("python.updatetime", s.PythonScreenUpdateRate);
|
||||
|
||||
@@ -457,6 +459,65 @@ public sealed class SettingsSerializer
|
||||
return Clamp((int)Math.Round(value > 4 ? value : value * 100), 25, 200);
|
||||
}
|
||||
|
||||
// The OpenAL Soft options. The names (devices, HRTF data sets, resamplers) can hold spaces, so
|
||||
// the simulator takes them in quotes.
|
||||
private static void ReadAudioDevice(ConfigFile c, SimulatorSettings s)
|
||||
{
|
||||
s.AudioDevice = Unquoted(c.GetString("sound.openal.renderer", ""));
|
||||
s.AudioOutputMode = FirstTokenOr(c, "sound.outputmode", "auto");
|
||||
s.AudioHrtf = FirstTokenOr(c, "sound.hrtf", "auto");
|
||||
s.AudioHrtfProfile = Unquoted(c.GetString("sound.hrtf.profile", ""));
|
||||
s.AudioResampler = Unquoted(c.GetString("sound.resampler", ""));
|
||||
s.AudioLimiter = FirstTokenOr(c, "sound.limiter", "auto");
|
||||
s.AudioFrequency = Clamp(c.GetInt("sound.frequency", 0), 0, 192000);
|
||||
s.AudioDoppler = Math.Clamp(c.GetDouble("sound.doppler", 0.25), 0.0, 10.0);
|
||||
s.AudioLowpass = c.GetBool("sound.efx.lowpass", false);
|
||||
s.AudioAirAbsorption = Math.Clamp(c.GetDouble("sound.efx.airabsorption", 0.0), 0.0, 10.0);
|
||||
}
|
||||
|
||||
// A key the file lacks is written only when the value differs from the simulator's default, so
|
||||
// saving with these left alone adds nothing an older simulator would not know.
|
||||
private static void WriteAudioDevice(ConfigFile c, SimulatorSettings s)
|
||||
{
|
||||
SetName(c, "sound.openal.renderer", s.AudioDevice);
|
||||
SetUnlessDefault(c, "sound.outputmode", s.AudioOutputMode, "auto");
|
||||
SetUnlessDefault(c, "sound.hrtf", s.AudioHrtf, "auto");
|
||||
SetName(c, "sound.hrtf.profile", s.AudioHrtfProfile);
|
||||
SetName(c, "sound.resampler", s.AudioResampler);
|
||||
SetUnlessDefault(c, "sound.limiter", s.AudioLimiter, "auto");
|
||||
if (c.Has("sound.frequency") || s.AudioFrequency != 0) c.SetInt("sound.frequency", s.AudioFrequency);
|
||||
if (c.Has("sound.doppler") || Math.Abs(s.AudioDoppler - 0.25) > 1e-9) c.SetDouble("sound.doppler", s.AudioDoppler);
|
||||
if (c.Has("sound.efx.lowpass") || s.AudioLowpass) c.SetBool("sound.efx.lowpass", s.AudioLowpass);
|
||||
if (c.Has("sound.efx.airabsorption") || s.AudioAirAbsorption != 0.0) c.SetDouble("sound.efx.airabsorption", s.AudioAirAbsorption);
|
||||
}
|
||||
|
||||
private static void SetUnlessDefault(ConfigFile c, string key, string value, string fallback)
|
||||
{
|
||||
if (c.Has(key) || value != fallback)
|
||||
c.Set(key, value);
|
||||
}
|
||||
|
||||
// An empty name is the library's choice: the line goes, rather than staying with a name in it.
|
||||
private static void SetName(ConfigFile c, string key, string name)
|
||||
{
|
||||
if (name.Length > 0)
|
||||
c.Set(key, name.Contains(' ') ? $"\"{name}\"" : name);
|
||||
else if (c.Has(key))
|
||||
c.Remove(key);
|
||||
}
|
||||
|
||||
private static string Unquoted(string value)
|
||||
{
|
||||
value = value.Trim();
|
||||
return value.Length >= 2 && value[0] == '"' && value[^1] == '"' ? value[1..^1] : value;
|
||||
}
|
||||
|
||||
private static string FirstTokenOr(ConfigFile c, string key, string fallback)
|
||||
{
|
||||
string token = FirstToken(c, key);
|
||||
return token.Length > 0 ? token : fallback;
|
||||
}
|
||||
|
||||
private static string FirstToken(ConfigFile c, string key)
|
||||
{
|
||||
var tokens = c.GetTokens(key);
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
<IsAotCompatible>true</IsAotCompatible>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<!-- function pointers into the OpenAL library of the simulator (Infrastructure/OpenAlProbe.cs) -->
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<ApplicationIcon>Assets\starter.ico</ApplicationIcon>
|
||||
|
||||
@@ -45,8 +45,6 @@
|
||||
Header="{Binding [ReloadSceneries], Source={x:Static starterNg:App.Loc}}" />
|
||||
<MenuItem Click="OpenSceneryDir_OnClick"
|
||||
Header="{Binding [OpenSceneryFolder], Source={x:Static starterNg:App.Loc}}" />
|
||||
<MenuItem Name="deleteSbtMenuItem" Click="DeleteSbt_OnClick"
|
||||
Header="{Binding [DeleteSbt], Source={x:Static starterNg:App.Loc}}" />
|
||||
</ContextMenu>
|
||||
</TreeView.ContextMenu>
|
||||
</TreeView>
|
||||
|
||||
@@ -165,39 +165,6 @@ public partial class Scenarios : UserControl
|
||||
favoriteMenuItem.Header = App.Loc[scenery is not null && AppServices.Current.Favorites.Contains(scenery)
|
||||
? "FavoriteRemove"
|
||||
: "FavoriteAdd"];
|
||||
deleteSbtMenuItem.IsEnabled = scenery is not null
|
||||
&& !AppServices.Current.State.SimulatorRunning
|
||||
&& AppServices.Current.BinaryTerrain.Of(scenery.Path) is not null;
|
||||
}
|
||||
|
||||
// Only a file the simulator can make again from the scenery's text goes: one
|
||||
// standing in for terrain files the installation lacks takes the terrain with it.
|
||||
private async void DeleteSbt_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (SelectedScenery is not { } scenery || TopLevel.GetTopLevel(this) is not Window owner)
|
||||
return;
|
||||
|
||||
var sbt = AppServices.Current.BinaryTerrain;
|
||||
if (sbt.Of(scenery.Path) is not { } file)
|
||||
return;
|
||||
|
||||
string name = Path.GetFileName(file);
|
||||
string title = App.Loc["DeleteSbt"];
|
||||
if (await Task.Run(() => sbt.MissingOriginal(scenery.Path)) is { } missing)
|
||||
{
|
||||
await MessageBox.Show(owner, string.Format(App.Loc["DeleteSbtNoOriginal"], name, missing), title,
|
||||
MessageBoxButtons.Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
long megabytes = AppServices.Current.Files.GetFileSize(file) / (1024 * 1024);
|
||||
if (!await MessageBox.Show(owner, string.Format(App.Loc["DeleteSbtConfirm"], name, megabytes), title,
|
||||
MessageBoxButtons.YesNo))
|
||||
return;
|
||||
|
||||
// Gone, the scenery follows by the watch on its files, as it would after any other change.
|
||||
if (!await Task.Run(() => sbt.Delete(scenery.Path)))
|
||||
await MessageBox.Show(owner, string.Format(App.Loc["DeleteSbtFailed"], name), title, MessageBoxButtons.Ok);
|
||||
}
|
||||
|
||||
private void ToggleFavorite_OnClick(object? sender, RoutedEventArgs e)
|
||||
|
||||
87
StarterNG/Views/Settings.Sound.cs
Normal file
87
StarterNG/Views/Settings.Sound.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using StarterNG.Application;
|
||||
using StarterNG.Domain.Settings;
|
||||
using StarterNG.Infrastructure;
|
||||
using StarterNG.Infrastructure.Adapters;
|
||||
|
||||
namespace StarterNG.Views;
|
||||
|
||||
// The OpenAL Soft options of the sound category. The lists of devices, HRTF data sets and
|
||||
// resamplers come from the simulator's own OpenAL library, read in the background; until then,
|
||||
// and where the library cannot say, a list holds the library's choice and the value of the file.
|
||||
public partial class Settings
|
||||
{
|
||||
// eu07.ini is written in code page 1250: a name it cannot hold (a device named in Cyrillic, say)
|
||||
// would reach the simulator as question marks, so such a name is not offered.
|
||||
private static readonly Encoding StrictCodePage1250 =
|
||||
Encoding.GetEncoding(LegacyText.CodePage1250.CodePage, EncoderFallback.ExceptionFallback, DecoderFallback.ExceptionFallback);
|
||||
|
||||
private async void ReadAudioChoices()
|
||||
{
|
||||
string root = AppServices.Current.Paths.Root;
|
||||
AudioChoices choices = await Task.Run(() => OpenAlProbe.Read(root));
|
||||
// Adding items leaves the selection alone, so this marks nothing as changed.
|
||||
AddNames(AudioDeviceCb, choices.Devices, FitsTheFile);
|
||||
// The simulator finds a device named in code page 1250 too, but an HRTF data set or a
|
||||
// resampler only by the library's own spelling, so of those only plain ASCII is offered.
|
||||
AddNames(AudioHrtfProfileCb, choices.HrtfProfiles, PlainAscii);
|
||||
AddNames(AudioResamplerCb, choices.Resamplers, PlainAscii);
|
||||
}
|
||||
|
||||
private static void AddNames(ComboBox cb, IReadOnlyList<string> names, Func<string, bool> offered)
|
||||
{
|
||||
foreach (string name in names)
|
||||
if (name.Length > 0 && offered(name) && IndexOfTag(cb, name) < 0)
|
||||
cb.Items.Add(new ComboBoxItem { Tag = name, Content = name });
|
||||
}
|
||||
|
||||
private static bool PlainAscii(string name) => Ascii.IsValid(name);
|
||||
|
||||
private static bool FitsTheFile(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
StrictCodePage1250.GetByteCount(name);
|
||||
return true;
|
||||
}
|
||||
catch (EncoderFallbackException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowSound(SimulatorSettings s)
|
||||
{
|
||||
SelectOrAddTag(AudioDeviceCb, s.AudioDevice, s.AudioDevice);
|
||||
SelectOrAddTag(AudioOutputModeCb, s.AudioOutputMode, s.AudioOutputMode);
|
||||
SelectOrAddTag(AudioHrtfCb, s.AudioHrtf, s.AudioHrtf);
|
||||
SelectOrAddTag(AudioHrtfProfileCb, s.AudioHrtfProfile, s.AudioHrtfProfile);
|
||||
SelectOrAddTag(AudioResamplerCb, s.AudioResampler, s.AudioResampler);
|
||||
SelectOrAddTag(AudioLimiterCb, s.AudioLimiter, s.AudioLimiter);
|
||||
string frequency = s.AudioFrequency.ToString(Invariant);
|
||||
SelectOrAddTag(AudioFrequencyCb, frequency, frequency + " Hz");
|
||||
AudioDopplerSlider.Value = s.AudioDoppler;
|
||||
AudioLowpassCb.IsChecked = s.AudioLowpass;
|
||||
AudioAirAbsorptionSlider.Value = s.AudioAirAbsorption;
|
||||
}
|
||||
|
||||
private void CaptureSound(SimulatorSettings s)
|
||||
{
|
||||
s.AudioDevice = SelectedTag(AudioDeviceCb) ?? "";
|
||||
s.AudioOutputMode = SelectedTag(AudioOutputModeCb) ?? "auto";
|
||||
s.AudioHrtf = SelectedTag(AudioHrtfCb) ?? "auto";
|
||||
s.AudioHrtfProfile = SelectedTag(AudioHrtfProfileCb) ?? "";
|
||||
s.AudioResampler = SelectedTag(AudioResamplerCb) ?? "";
|
||||
s.AudioLimiter = SelectedTag(AudioLimiterCb) ?? "auto";
|
||||
s.AudioFrequency = TagInt(AudioFrequencyCb, 0);
|
||||
// A value the slider can't show (past its end, between its ticks) is kept by the
|
||||
// shown-unlike bookkeeping of the page until the slider is moved.
|
||||
s.AudioDoppler = AudioDopplerSlider.Value;
|
||||
s.AudioLowpass = IsChecked(AudioLowpassCb);
|
||||
s.AudioAirAbsorption = AudioAirAbsorptionSlider.Value;
|
||||
}
|
||||
}
|
||||
@@ -537,6 +537,86 @@
|
||||
</ctl:SettingRow>
|
||||
</StackPanel>
|
||||
</ctl:SettingsSection>
|
||||
<ctl:SettingsSection Header="{Binding [SoundDevice], Source={x:Static starterNg:App.Loc}}">
|
||||
<StackPanel IsEnabled="{Binding #EnableSoundsCb.IsChecked}">
|
||||
<ctl:SettingRow ConfigKey="sound.openal.renderer" Label="{Binding [SoundOutputDevice], Source={x:Static starterNg:App.Loc}}"
|
||||
Description="{Binding [SoundOutputDeviceDesc], Source={x:Static starterNg:App.Loc}}">
|
||||
<ComboBox x:Name="AudioDeviceCb" HorizontalAlignment="Stretch">
|
||||
<ComboBoxItem Tag="" Content="{Binding [SoundSystemDefault], Source={x:Static starterNg:App.Loc}}" />
|
||||
</ComboBox>
|
||||
</ctl:SettingRow>
|
||||
<ctl:SettingRow ConfigKey="sound.outputmode" Label="{Binding [SoundOutputMode], Source={x:Static starterNg:App.Loc}}"
|
||||
Description="{Binding [SoundOutputModeDesc], Source={x:Static starterNg:App.Loc}}">
|
||||
<ComboBox x:Name="AudioOutputModeCb" Classes="Localized" SelectedIndex="0">
|
||||
<ComboBoxItem Tag="auto" Content="{Binding [SoundAutomatic], Source={x:Static starterNg:App.Loc}}" />
|
||||
<ComboBoxItem Tag="mono" Content="Mono" />
|
||||
<ComboBoxItem Tag="stereo" Content="Stereo" />
|
||||
<ComboBoxItem Tag="stereo-basic" Content="{Binding [SoundStereoBasic], Source={x:Static starterNg:App.Loc}}" />
|
||||
<ComboBoxItem Tag="uhj" Content="{Binding [SoundStereoUhj], Source={x:Static starterNg:App.Loc}}" />
|
||||
<ComboBoxItem Tag="headphones" Content="{Binding [SoundHeadphones], Source={x:Static starterNg:App.Loc}}" />
|
||||
<ComboBoxItem Tag="quad" Content="Quad" />
|
||||
<ComboBoxItem Tag="5.1" Content="5.1" />
|
||||
<ComboBoxItem Tag="6.1" Content="6.1" />
|
||||
<ComboBoxItem Tag="7.1" Content="7.1" />
|
||||
</ComboBox>
|
||||
</ctl:SettingRow>
|
||||
<ctl:SettingRow ConfigKey="sound.hrtf" Label="HRTF"
|
||||
Description="{Binding [SoundHrtfDesc], Source={x:Static starterNg:App.Loc}}">
|
||||
<ComboBox x:Name="AudioHrtfCb" Classes="Localized" SelectedIndex="0">
|
||||
<ComboBoxItem Tag="auto" Content="{Binding [SoundAutomatic], Source={x:Static starterNg:App.Loc}}" />
|
||||
<ComboBoxItem Tag="on" Content="{Binding [SoundOn], Source={x:Static starterNg:App.Loc}}" />
|
||||
<ComboBoxItem Tag="off" Content="{Binding [SoundOff], Source={x:Static starterNg:App.Loc}}" />
|
||||
</ComboBox>
|
||||
</ctl:SettingRow>
|
||||
<ctl:SettingRow ConfigKey="sound.hrtf.profile" Label="{Binding [SoundHrtfProfile], Source={x:Static starterNg:App.Loc}}"
|
||||
Description="{Binding [SoundHrtfProfileDesc], Source={x:Static starterNg:App.Loc}}">
|
||||
<ComboBox x:Name="AudioHrtfProfileCb" HorizontalAlignment="Stretch">
|
||||
<ComboBoxItem Tag="" Content="{Binding [SoundLibraryChoice], Source={x:Static starterNg:App.Loc}}" />
|
||||
</ComboBox>
|
||||
</ctl:SettingRow>
|
||||
<ctl:SettingRow ConfigKey="sound.resampler" Label="{Binding [SoundResampler], Source={x:Static starterNg:App.Loc}}"
|
||||
Description="{Binding [SoundResamplerDesc], Source={x:Static starterNg:App.Loc}}">
|
||||
<ComboBox x:Name="AudioResamplerCb" HorizontalAlignment="Stretch">
|
||||
<ComboBoxItem Tag="" Content="{Binding [SoundLibraryDefault], Source={x:Static starterNg:App.Loc}}" />
|
||||
</ComboBox>
|
||||
</ctl:SettingRow>
|
||||
<ctl:SettingRow ConfigKey="sound.limiter" Label="{Binding [SoundLimiter], Source={x:Static starterNg:App.Loc}}"
|
||||
Description="{Binding [SoundLimiterDesc], Source={x:Static starterNg:App.Loc}}">
|
||||
<ComboBox x:Name="AudioLimiterCb" Classes="Localized" SelectedIndex="0">
|
||||
<ComboBoxItem Tag="auto" Content="{Binding [SoundAutomatic], Source={x:Static starterNg:App.Loc}}" />
|
||||
<ComboBoxItem Tag="on" Content="{Binding [SoundOn], Source={x:Static starterNg:App.Loc}}" />
|
||||
<ComboBoxItem Tag="off" Content="{Binding [SoundOff], Source={x:Static starterNg:App.Loc}}" />
|
||||
</ComboBox>
|
||||
</ctl:SettingRow>
|
||||
<ctl:SettingRow ConfigKey="sound.frequency" Label="{Binding [SoundFrequency], Source={x:Static starterNg:App.Loc}}"
|
||||
Description="{Binding [SoundFrequencyDesc], Source={x:Static starterNg:App.Loc}}">
|
||||
<ComboBox x:Name="AudioFrequencyCb" Classes="Localized" SelectedIndex="0">
|
||||
<ComboBoxItem Tag="0" Content="{Binding [SoundDeviceRate], Source={x:Static starterNg:App.Loc}}" />
|
||||
<ComboBoxItem Tag="22050" Content="22050 Hz" />
|
||||
<ComboBoxItem Tag="32000" Content="32000 Hz" />
|
||||
<ComboBoxItem Tag="44100" Content="44100 Hz" />
|
||||
<ComboBoxItem Tag="48000" Content="48000 Hz" />
|
||||
<ComboBoxItem Tag="96000" Content="96000 Hz" />
|
||||
</ComboBox>
|
||||
</ctl:SettingRow>
|
||||
<ctl:SettingRow ConfigKey="sound.doppler" Label="{Binding [SoundDoppler], Source={x:Static starterNg:App.Loc}}"
|
||||
Description="{Binding [SoundDopplerDesc], Source={x:Static starterNg:App.Loc}}"
|
||||
ValueText="{Binding #AudioDopplerSlider.Value, StringFormat='{}{0:0.00}'}">
|
||||
<ctl:ReadableSlider x:Name="AudioDopplerSlider" Minimum="0" Maximum="1" TickFrequency="0.05"
|
||||
IsSnapToTickEnabled="True" Value="0.25" />
|
||||
</ctl:SettingRow>
|
||||
<ctl:SettingRow ConfigKey="sound.efx.lowpass" Label="{Binding [SoundLowpass], Source={x:Static starterNg:App.Loc}}"
|
||||
Description="{Binding [SoundLowpassDesc], Source={x:Static starterNg:App.Loc}}">
|
||||
<CheckBox x:Name="AudioLowpassCb" />
|
||||
</ctl:SettingRow>
|
||||
<ctl:SettingRow ConfigKey="sound.efx.airabsorption" Label="{Binding [SoundAirAbsorption], Source={x:Static starterNg:App.Loc}}"
|
||||
Description="{Binding [SoundAirAbsorptionDesc], Source={x:Static starterNg:App.Loc}}"
|
||||
ValueText="{Binding #AudioAirAbsorptionSlider.Value, StringFormat='{}{0:0.0}'}">
|
||||
<ctl:ReadableSlider x:Name="AudioAirAbsorptionSlider" Minimum="0" Maximum="10" TickFrequency="0.5"
|
||||
IsSnapToTickEnabled="True" Value="0" />
|
||||
</ctl:SettingRow>
|
||||
</StackPanel>
|
||||
</ctl:SettingsSection>
|
||||
</StackPanel>
|
||||
|
||||
<!-- ============================ PHYSICS ============================ -->
|
||||
|
||||
@@ -100,6 +100,7 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
BuildPresetButtons();
|
||||
BuildMonitorRates();
|
||||
ReadGraphicsCards();
|
||||
ReadAudioChoices();
|
||||
App.Loc.LanguageChanged += UpdateCardText;
|
||||
App.Loc.LanguageChanged += _keyRows.UpdateTexts;
|
||||
|
||||
@@ -436,6 +437,7 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
LogMissingVehicleFilesCb.IsChecked = s.LogMissingVehicleFiles;
|
||||
|
||||
ShowGraphics(s);
|
||||
ShowSound(s);
|
||||
GpuCb.SelectedIndex = s.Gpu == GpuPreference.System ? 1 : 0;
|
||||
SelectResolution(s.Width, s.Height);
|
||||
bufferScale.Value = s.BufferScalePercent;
|
||||
@@ -869,6 +871,7 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
s.LogMissingVehicleFiles = IsChecked(LogMissingVehicleFilesCb);
|
||||
|
||||
CaptureGraphics(s);
|
||||
CaptureSound(s);
|
||||
s.Gpu = SelectedGpu();
|
||||
ReadResolution(s);
|
||||
s.BufferScalePercent = (int)bufferScale.Value;
|
||||
@@ -966,11 +969,11 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
OnControlChanged();
|
||||
};
|
||||
UartEnabledCb.IsCheckedChanged += (_, _) => ValidateUart();
|
||||
OnTextEdited(UartTuneBox, () =>
|
||||
UartTuneBox.TextChanged += (_, _) =>
|
||||
{
|
||||
ValidateUart();
|
||||
OnControlChanged();
|
||||
});
|
||||
};
|
||||
App.Loc.LanguageChanged += UpdateUartTexts;
|
||||
UpdateUartTexts();
|
||||
}
|
||||
@@ -1511,7 +1514,7 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
nud.ValueChanged += (_, _) => OnControlChanged();
|
||||
break;
|
||||
case TextBox box when ReferenceEquals(box, VulkanDeviceTb):
|
||||
OnTextEdited(box, OnControlChanged);
|
||||
box.TextChanged += (_, _) => OnControlChanged();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1521,18 +1524,6 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
toggle.IsCheckedChanged += (_, _) => OnControlChanged();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The text as it changes, not TextChanged: that one comes later, from the
|
||||
/// dispatcher, so the text the page itself put there while loading came back
|
||||
/// as an edit once the window was shown - the first start asked to save.
|
||||
/// </summary>
|
||||
private static void OnTextEdited(TextBox box, Action edited) =>
|
||||
box.PropertyChanged += (_, e) =>
|
||||
{
|
||||
if (e.Property == TextBox.TextProperty)
|
||||
edited();
|
||||
};
|
||||
|
||||
private void OnControlChanged()
|
||||
{
|
||||
MarkDirty();
|
||||
@@ -1545,7 +1536,8 @@ public partial class Settings : UserControl, ISettingsCapture
|
||||
if (_loading || _dirty)
|
||||
return;
|
||||
|
||||
_dirty = true; UpdateSaveState();
|
||||
_dirty = true;
|
||||
UpdateSaveState();
|
||||
}
|
||||
|
||||
/// <summary>Edits on the page, or of the keys, not saved yet: what "Niezapisane zmiany" tells.</summary>
|
||||
|
||||
@@ -69,10 +69,6 @@
|
||||
<String key="FavoriteAdd">Přidat do oblíbených</String>
|
||||
<String key="FavoriteRemove">Odebrat z oblíbených</String>
|
||||
<String key="OpenSceneryFolder">Otevřít složku</String>
|
||||
<String key="DeleteSbt">Smazat SBT</String>
|
||||
<String key="DeleteSbtConfirm">Smazat {0} ({1} MB)? Simulátor jej znovu sestaví ze souborů scenérie při jejím dalším načtení, které potrvá déle.</String>
|
||||
<String key="DeleteSbtNoOriginal">Soubor {0} zůstává: není z čeho jej znovu sestavit, chybí {1}. Bez něj by scenérie přišla o terén.</String>
|
||||
<String key="DeleteSbtFailed">Soubor {0} nelze smazat. Možná jej používá simulátor, nebo je složka jen pro čtení.</String>
|
||||
<String key="OptionalIncludes">Volitelné prvky</String>
|
||||
<String key="OpenTextureFolder">Otevřít složku s texturami</String>
|
||||
<String key="CopyTextureName">Kopírovat název</String>
|
||||
@@ -522,6 +518,26 @@
|
||||
<String key="VehiclesVolume">Hlasitost vozidel</String>
|
||||
<String key="PositionedSoundsVolume">Hlasitost prostorových zvuků</String>
|
||||
<String key="AmbientVolume">Hlasitost okolí</String>
|
||||
<String key="SoundDevice">Zvukové zařízení a efekty</String>
|
||||
<String key="SoundOutputDevice">Výstupní zařízení</String>
|
||||
<String key="SoundSystemDefault">Výchozí systémové</String>
|
||||
<String key="SoundOutputMode">Rozložení reproduktorů</String>
|
||||
<String key="SoundAutomatic">Automaticky</String>
|
||||
<String key="SoundStereoBasic">Stereo (jednoduché panorama)</String>
|
||||
<String key="SoundStereoUhj">Stereo (UHJ, širší)</String>
|
||||
<String key="SoundHeadphones">Sluchátka (HRTF)</String>
|
||||
<String key="SoundOn">Zapnuto</String>
|
||||
<String key="SoundOff">Vypnuto</String>
|
||||
<String key="SoundHrtfProfile">Sada dat HRTF</String>
|
||||
<String key="SoundLibraryChoice">Volba knihovny</String>
|
||||
<String key="SoundResampler">Převzorkování</String>
|
||||
<String key="SoundLibraryDefault">Výchozí knihovny</String>
|
||||
<String key="SoundLimiter">Omezovač výstupu</String>
|
||||
<String key="SoundFrequency">Vzorkovací frekvence mixu</String>
|
||||
<String key="SoundDeviceRate">Frekvence zařízení</String>
|
||||
<String key="SoundDoppler">Dopplerův jev</String>
|
||||
<String key="SoundLowpass">Tlumené zvuky mimo kabinu</String>
|
||||
<String key="SoundAirAbsorption">Pohlcování vzduchem</String>
|
||||
|
||||
<String key="Advanced">Pokročilé</String>
|
||||
<String key="CompressTextures">Komprimovat textury TGA</String>
|
||||
|
||||
@@ -69,10 +69,6 @@
|
||||
<String key="FavoriteAdd">Add to favourites</String>
|
||||
<String key="FavoriteRemove">Remove from favourites</String>
|
||||
<String key="OpenSceneryFolder">Open folder</String>
|
||||
<String key="DeleteSbt">Delete SBT</String>
|
||||
<String key="DeleteSbtConfirm">Delete {0} ({1} MB)? The simulator makes it again from the scenery files on its next load, which takes longer.</String>
|
||||
<String key="DeleteSbtNoOriginal">{0} stays: nothing is there to make it again, {1} is missing. Without it the scenery would lose its terrain.</String>
|
||||
<String key="DeleteSbtFailed">Could not delete {0}. The simulator may be using it, or the folder is read-only.</String>
|
||||
<String key="OptionalIncludes">Optional elements</String>
|
||||
<String key="OpenTextureFolder">Open texture folder</String>
|
||||
<String key="CopyTextureName">Copy name</String>
|
||||
@@ -548,6 +544,36 @@
|
||||
<String key="VehiclesVolume">Vehicles volume</String>
|
||||
<String key="PositionedSoundsVolume">Positional sounds volume</String>
|
||||
<String key="AmbientVolume">Ambient volume</String>
|
||||
<String key="SoundDevice">Sound device and effects</String>
|
||||
<String key="SoundOutputDevice">Output device</String>
|
||||
<String key="SoundOutputDeviceDesc">The device the simulator plays through. The system default follows the device chosen in the system, also when it changes during the game.</String>
|
||||
<String key="SoundSystemDefault">System default</String>
|
||||
<String key="SoundOutputMode">Speaker layout</String>
|
||||
<String key="SoundOutputModeDesc">How the sound is mixed: for headphones, stereo speakers or a surround set. Automatic takes what the device reports.</String>
|
||||
<String key="SoundAutomatic">Automatic</String>
|
||||
<String key="SoundStereoBasic">Stereo (simple panning)</String>
|
||||
<String key="SoundStereoUhj">Stereo (UHJ, wider)</String>
|
||||
<String key="SoundHeadphones">Headphones (HRTF)</String>
|
||||
<String key="SoundHrtfDesc">Head-related sound for headphones: sources behind, above and below can be told apart. Automatic turns it on where the device is headphones.</String>
|
||||
<String key="SoundOn">On</String>
|
||||
<String key="SoundOff">Off</String>
|
||||
<String key="SoundHrtfProfile">HRTF data set</String>
|
||||
<String key="SoundHrtfProfileDesc">Which head model HRTF uses, of those the library has. A different one may suit your ears better.</String>
|
||||
<String key="SoundLibraryChoice">Library's choice</String>
|
||||
<String key="SoundResampler">Resampler</String>
|
||||
<String key="SoundResamplerDesc">How sounds are converted to the device's rate and pitched. The better ones sound cleaner and cost a little more processor time.</String>
|
||||
<String key="SoundLibraryDefault">Library default</String>
|
||||
<String key="SoundLimiter">Output limiter</String>
|
||||
<String key="SoundLimiterDesc">Keeps loud moments from clipping by turning the whole mix down for a moment.</String>
|
||||
<String key="SoundFrequency">Mixing rate</String>
|
||||
<String key="SoundFrequencyDesc">The sample rate the sound is mixed at. The device's own rate avoids converting it once more.</String>
|
||||
<String key="SoundDeviceRate">Device rate</String>
|
||||
<String key="SoundDoppler">Doppler effect</String>
|
||||
<String key="SoundDopplerDesc">How much the pitch of a passing vehicle changes. 0 turns the effect off, 1 is the physical one.</String>
|
||||
<String key="SoundLowpass">Muffled sounds outside the cab</String>
|
||||
<String key="SoundLowpassDesc">Sounds heard through the cab walls lose their high tones as well as their loudness.</String>
|
||||
<String key="SoundAirAbsorption">Air absorption</String>
|
||||
<String key="SoundAirAbsorptionDesc">Distant sounds lose their high tones, as in the open air. 0 turns it off, 1 is the natural amount.</String>
|
||||
|
||||
<String key="Advanced">Advanced</String>
|
||||
<String key="CompressTextures">Compress TGA textures</String>
|
||||
|
||||
@@ -69,10 +69,6 @@
|
||||
<String key="FavoriteAdd">Hozzáadás a kedvencekhez</String>
|
||||
<String key="FavoriteRemove">Eltávolítás a kedvencek közül</String>
|
||||
<String key="OpenSceneryFolder">Mappa megnyitása</String>
|
||||
<String key="DeleteSbt">SBT törlése</String>
|
||||
<String key="DeleteSbtConfirm">Törlöd: {0} ({1} MB)? A szimulátor a színtér fájljaiból a következő betöltéskor újra elkészíti, ami tovább tart.</String>
|
||||
<String key="DeleteSbtNoOriginal">{0} megmarad: nincs miből újra elkészíteni, hiányzik: {1}. Nélküle a színtér elveszítené a terepet.</String>
|
||||
<String key="DeleteSbtFailed">Nem sikerült törölni: {0}. Lehet, hogy a szimulátor használja, vagy a mappa csak olvasható.</String>
|
||||
<String key="OptionalIncludes">Opcionális elemek</String>
|
||||
<String key="OpenTextureFolder">Textúramappa megnyitása</String>
|
||||
<String key="CopyTextureName">Név másolása</String>
|
||||
@@ -522,6 +518,26 @@
|
||||
<String key="VehiclesVolume">Járművek hangereje</String>
|
||||
<String key="PositionedSoundsVolume">Térbeli hangok hangereje</String>
|
||||
<String key="AmbientVolume">Környezeti hangok hangereje</String>
|
||||
<String key="SoundDevice">Hangeszköz és effektek</String>
|
||||
<String key="SoundOutputDevice">Kimeneti eszköz</String>
|
||||
<String key="SoundSystemDefault">Rendszer alapértelmezése</String>
|
||||
<String key="SoundOutputMode">Hangszóró-elrendezés</String>
|
||||
<String key="SoundAutomatic">Automatikus</String>
|
||||
<String key="SoundStereoBasic">Sztereó (egyszerű panoráma)</String>
|
||||
<String key="SoundStereoUhj">Sztereó (UHJ, szélesebb)</String>
|
||||
<String key="SoundHeadphones">Fejhallgató (HRTF)</String>
|
||||
<String key="SoundOn">Be</String>
|
||||
<String key="SoundOff">Ki</String>
|
||||
<String key="SoundHrtfProfile">HRTF-adatkészlet</String>
|
||||
<String key="SoundLibraryChoice">A könyvtár választása</String>
|
||||
<String key="SoundResampler">Újramintavételezés</String>
|
||||
<String key="SoundLibraryDefault">A könyvtár alapértelmezése</String>
|
||||
<String key="SoundLimiter">Kimeneti limiter</String>
|
||||
<String key="SoundFrequency">Keverési mintavételi frekvencia</String>
|
||||
<String key="SoundDeviceRate">Az eszköz frekvenciája</String>
|
||||
<String key="SoundDoppler">Doppler-hatás</String>
|
||||
<String key="SoundLowpass">Tompított hangok a fülkén kívülről</String>
|
||||
<String key="SoundAirAbsorption">Levegő általi elnyelés</String>
|
||||
|
||||
<String key="Advanced">Speciális</String>
|
||||
<String key="CompressTextures">TGA textúrák tömörítése</String>
|
||||
|
||||
@@ -69,10 +69,6 @@
|
||||
<String key="FavoriteAdd">Dodaj do ulubionych</String>
|
||||
<String key="FavoriteRemove">Usuń z ulubionych</String>
|
||||
<String key="OpenSceneryFolder">Otwórz folder</String>
|
||||
<String key="DeleteSbt">Usuń SBT</String>
|
||||
<String key="DeleteSbtConfirm">Usunąć {0} ({1} MB)? Symulator zbuduje go od nowa z plików scenerii przy jej następnym wczytaniu, które potrwa dłużej.</String>
|
||||
<String key="DeleteSbtNoOriginal">Plik {0} zostaje: sceneria nie ma z czego go odbudować, brakuje {1}. Bez niego straciłaby teren.</String>
|
||||
<String key="DeleteSbtFailed">Nie udało się usunąć {0}. Może używa go symulator albo folder jest tylko do odczytu.</String>
|
||||
<String key="OptionalIncludes">Elementy opcjonalne</String>
|
||||
<String key="OpenTextureFolder">Otwórz folder tekstury</String>
|
||||
<String key="CopyTextureName">Kopiuj nazwę</String>
|
||||
@@ -548,6 +544,36 @@
|
||||
<String key="VehiclesVolume">Głośność pojazdów</String>
|
||||
<String key="PositionedSoundsVolume">Głośność dźwięków pozycjonowanych</String>
|
||||
<String key="AmbientVolume">Głośność otoczenia</String>
|
||||
<String key="SoundDevice">Urządzenie i efekty dźwięku</String>
|
||||
<String key="SoundOutputDevice">Urządzenie wyjściowe</String>
|
||||
<String key="SoundOutputDeviceDesc">Urządzenie, przez które gra symulator. Domyślne systemowe idzie za urządzeniem wybranym w systemie, także gdy zmieni się ono w trakcie gry.</String>
|
||||
<String key="SoundSystemDefault">Domyślne systemowe</String>
|
||||
<String key="SoundOutputMode">Układ głośników</String>
|
||||
<String key="SoundOutputModeDesc">Jak dźwięk jest miksowany: na słuchawki, głośniki stereo albo zestaw dookólny. Automatycznie bierze to, co zgłasza urządzenie.</String>
|
||||
<String key="SoundAutomatic">Automatycznie</String>
|
||||
<String key="SoundStereoBasic">Stereo (proste panoramowanie)</String>
|
||||
<String key="SoundStereoUhj">Stereo (UHJ, szersze)</String>
|
||||
<String key="SoundHeadphones">Słuchawki (HRTF)</String>
|
||||
<String key="SoundHrtfDesc">Dźwięk przestrzenny na słuchawki: źródła z tyłu, z góry i z dołu dają się odróżnić. Automatycznie włącza go, gdy urządzeniem są słuchawki.</String>
|
||||
<String key="SoundOn">Włączone</String>
|
||||
<String key="SoundOff">Wyłączone</String>
|
||||
<String key="SoundHrtfProfile">Zestaw danych HRTF</String>
|
||||
<String key="SoundHrtfProfileDesc">Którego modelu głowy używa HRTF, spośród tych, które ma biblioteka. Inny może lepiej pasować do twoich uszu.</String>
|
||||
<String key="SoundLibraryChoice">Wybór biblioteki</String>
|
||||
<String key="SoundResampler">Przepróbkowanie</String>
|
||||
<String key="SoundResamplerDesc">Jak dźwięki są przeliczane na częstotliwość urządzenia i zmieniają wysokość. Lepsze brzmią czyściej i kosztują trochę więcej czasu procesora.</String>
|
||||
<String key="SoundLibraryDefault">Domyślne biblioteki</String>
|
||||
<String key="SoundLimiter">Ogranicznik wyjścia</String>
|
||||
<String key="SoundLimiterDesc">Chroni głośne chwile przed przesterowaniem, na moment ściszając cały miks.</String>
|
||||
<String key="SoundFrequency">Częstotliwość miksowania</String>
|
||||
<String key="SoundFrequencyDesc">Częstotliwość próbkowania, z jaką dźwięk jest miksowany. Własna częstotliwość urządzenia oszczędza jeszcze jednego przeliczenia.</String>
|
||||
<String key="SoundDeviceRate">Częstotliwość urządzenia</String>
|
||||
<String key="SoundDoppler">Efekt Dopplera</String>
|
||||
<String key="SoundDopplerDesc">Jak bardzo zmienia się wysokość dźwięku przejeżdżającego pojazdu. 0 wyłącza efekt, 1 to wartość fizyczna.</String>
|
||||
<String key="SoundLowpass">Stłumione dźwięki spoza kabiny</String>
|
||||
<String key="SoundLowpassDesc">Dźwięki słyszane przez ściany kabiny tracą wysokie tony, a nie tylko głośność.</String>
|
||||
<String key="SoundAirAbsorption">Pochłanianie przez powietrze</String>
|
||||
<String key="SoundAirAbsorptionDesc">Odległe dźwięki tracą wysokie tony, jak na otwartej przestrzeni. 0 wyłącza, 1 to naturalna wartość.</String>
|
||||
|
||||
<String key="Advanced">Zaawansowane</String>
|
||||
<String key="CompressTextures">Kompresuj tekstury TGA</String>
|
||||
|
||||
@@ -69,10 +69,6 @@
|
||||
<String key="FavoriteAdd">Добавить в избранное</String>
|
||||
<String key="FavoriteRemove">Удалить из избранного</String>
|
||||
<String key="OpenSceneryFolder">Открыть папку</String>
|
||||
<String key="DeleteSbt">Удалить SBT</String>
|
||||
<String key="DeleteSbtConfirm">Удалить {0} ({1} МБ)? Симулятор заново соберёт его из файлов сценария при следующей загрузке, которая займёт больше времени.</String>
|
||||
<String key="DeleteSbtNoOriginal">Файл {0} остаётся: его не из чего собрать заново, нет {1}. Без него сценарий лишится рельефа.</String>
|
||||
<String key="DeleteSbtFailed">Не удалось удалить {0}. Возможно, его использует симулятор или папка только для чтения.</String>
|
||||
<String key="OptionalIncludes">Дополнительные элементы</String>
|
||||
<String key="OpenTextureFolder">Открыть папку с текстурами</String>
|
||||
<String key="CopyTextureName">Копировать название</String>
|
||||
@@ -522,6 +518,26 @@
|
||||
<String key="VehiclesVolume">Громкость подвижного состава</String>
|
||||
<String key="PositionedSoundsVolume">Громкость позиционных звуков</String>
|
||||
<String key="AmbientVolume">Громкость окружения</String>
|
||||
<String key="SoundDevice">Звуковое устройство и эффекты</String>
|
||||
<String key="SoundOutputDevice">Устройство вывода</String>
|
||||
<String key="SoundSystemDefault">Системное по умолчанию</String>
|
||||
<String key="SoundOutputMode">Конфигурация динамиков</String>
|
||||
<String key="SoundAutomatic">Автоматически</String>
|
||||
<String key="SoundStereoBasic">Стерео (простое панорамирование)</String>
|
||||
<String key="SoundStereoUhj">Стерео (UHJ, шире)</String>
|
||||
<String key="SoundHeadphones">Наушники (HRTF)</String>
|
||||
<String key="SoundOn">Вкл.</String>
|
||||
<String key="SoundOff">Выкл.</String>
|
||||
<String key="SoundHrtfProfile">Набор данных HRTF</String>
|
||||
<String key="SoundLibraryChoice">Выбор библиотеки</String>
|
||||
<String key="SoundResampler">Передискретизация</String>
|
||||
<String key="SoundLibraryDefault">По умолчанию библиотеки</String>
|
||||
<String key="SoundLimiter">Ограничитель выхода</String>
|
||||
<String key="SoundFrequency">Частота микширования</String>
|
||||
<String key="SoundDeviceRate">Частота устройства</String>
|
||||
<String key="SoundDoppler">Эффект Доплера</String>
|
||||
<String key="SoundLowpass">Приглушённые звуки вне кабины</String>
|
||||
<String key="SoundAirAbsorption">Поглощение воздухом</String>
|
||||
|
||||
<String key="Advanced">Дополнительно</String>
|
||||
<String key="CompressTextures">Сжимать текстуры TGA</String>
|
||||
|
||||
Reference in New Issue
Block a user