Prevent loading crashy shpks.

This commit is contained in:
Ottermandias 2024-08-11 23:22:42 +02:00
parent 6b0b1629bd
commit 47268ab377

View file

@ -61,7 +61,7 @@ public class PathResolver : IDisposable, IService
ResourceCategory.GameScript => (null, ResolveData.Invalid),
// Use actual resolving.
ResourceCategory.Chara => Resolve(path, resourceType),
ResourceCategory.Shader => Resolve(path, resourceType),
ResourceCategory.Shader => ResolveShader(path, resourceType),
ResourceCategory.Vfx => Resolve(path, resourceType),
ResourceCategory.Sound => Resolve(path, resourceType),
// EXD Modding in general should probably be prohibited but is currently used for fan translations.
@ -83,6 +83,19 @@ public class PathResolver : IDisposable, IService
};
}
/// <remarks> Replacing the characterstockings.shpk or the characterocclusion.shpk files currently causes crashes, so we just entirely prevent that. </remarks>
private (FullPath?, ResolveData) ResolveShader(Utf8GamePath gamePath, ResourceType type)
{
if (type is not ResourceType.Shpk)
return Resolve(gamePath, type);
if (gamePath.Path.EndsWith("occlusion.shpk"u8)
|| gamePath.Path.EndsWith("stockings.shpk"u8))
return (null, ResolveData.Invalid);
return Resolve(gamePath, type);
}
public (FullPath?, ResolveData) Resolve(Utf8GamePath gamePath, ResourceType type)
{
using var performance = _performance.Measure(PerformanceType.CharacterResolver);