mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-02 05:43:40 +01:00
Use the substitution provider for textures in the ULD Wrapper. (#1553)
This commit is contained in:
parent
30c2872400
commit
6637bd8207
1 changed files with 13 additions and 6 deletions
|
|
@ -1,10 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Utility;
|
||||
using ImGuiScene;
|
||||
using Lumina.Data.Files;
|
||||
using Lumina.Data.Parsing.Uld;
|
||||
|
||||
|
|
@ -155,20 +155,27 @@ public class UldWrapper : IDisposable
|
|||
|
||||
// Try to load HD textures first.
|
||||
var hrPath = texturePath.Replace(".tex", "_hr1.tex");
|
||||
var substitution = Service<TextureManager>.Get();
|
||||
hrPath = substitution.GetSubstitutedPath(hrPath);
|
||||
var hd = true;
|
||||
var file = this.data.GetFile<TexFile>(hrPath);
|
||||
if (file == null)
|
||||
var tex = Path.IsPathRooted(hrPath)
|
||||
? this.data.GameData.GetFileFromDisk<TexFile>(hrPath)
|
||||
: this.data.GetFile<TexFile>(hrPath);
|
||||
if (tex == null)
|
||||
{
|
||||
hd = false;
|
||||
file = this.data.GetFile<TexFile>(texturePath);
|
||||
texturePath = substitution.GetSubstitutedPath(texturePath);
|
||||
tex = Path.IsPathRooted(texturePath)
|
||||
? this.data.GameData.GetFileFromDisk<TexFile>(texturePath)
|
||||
: this.data.GetFile<TexFile>(texturePath);
|
||||
|
||||
// Neither texture could be loaded.
|
||||
if (file == null)
|
||||
if (tex == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return (id, file.Header.Width, file.Header.Height, hd, file.GetRgbaImageData());
|
||||
return (id, tex.Header.Width, tex.Header.Height, hd, tex.GetRgbaImageData());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue