Skip to content

Commit edd03cd

Browse files
committed
When .s file requires missing .dds file, the equivalent .ace is picked if existing.
Bug fix for https://bugs.launchpad.net/or/+bug/1830498 .
1 parent 27c6fc9 commit edd03cd

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Source/RunActivity/Viewer3D/Materials.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,21 @@ public Texture2D Get(string path, Texture2D defaultTexture, bool required = fals
6565
try
6666
{
6767
Texture2D texture;
68-
if (Path.GetExtension(path) == ".dds" && File.Exists(path))
68+
if (Path.GetExtension(path) == ".dds")
6969
{
70-
DDSLib.DDSFromFile(path, GraphicsDevice, true, out texture);
70+
if (File.Exists(path))
71+
{
72+
DDSLib.DDSFromFile(path, GraphicsDevice, true, out texture);
73+
}
74+
else
75+
{
76+
var aceTexture = Path.ChangeExtension(path, ".ace");
77+
if (File.Exists(aceTexture))
78+
{
79+
texture = Orts.Formats.Msts.AceFile.Texture2DFromFile(GraphicsDevice, aceTexture);
80+
}
81+
else texture = defaultTexture;
82+
}
7183
}
7284
else if (Path.GetExtension(path) == ".ace")
7385
{

0 commit comments

Comments
 (0)