Fix filename lookups on LegacySkins going awry when extension is specified

Due to the logic present to handle `@2x` fallback, the extension was
potentially being added at the wrong point in the filename. This change
ensures that the lookup filenames are always correct.

Closes https://github.com/ppy/osu/issues/17690.
This commit is contained in:
Dean Herbert 2022-04-07 14:16:16 +09:00
parent b7f8716de9
commit 205edb65a2

View File

@ -443,7 +443,11 @@ namespace osu.Game.Skinning
string lookupName = name.Replace(@"@2x", string.Empty);
float ratio = 2;
var texture = Textures?.Get(@$"{lookupName}@2x", wrapModeS, wrapModeT);
string twoTimesFilename = Path.HasExtension(lookupName)
? @$"{Path.GetFileNameWithoutExtension(lookupName)}@2x{Path.GetExtension(lookupName)}"
: @$"{lookupName}@2x";
var texture = Textures?.Get(twoTimesFilename, wrapModeS, wrapModeT);
if (texture == null)
{