DiskCacheLoadResult.cs
1 namespace Ryujinx.Graphics.Gpu.Shader.DiskCache 2 { 3 /// <summary> 4 /// Result of a shader cache load operation. 5 /// </summary> 6 enum DiskCacheLoadResult 7 { 8 /// <summary> 9 /// No error. 10 /// </summary> 11 Success, 12 13 /// <summary> 14 /// File can't be accessed. 15 /// </summary> 16 NoAccess, 17 18 /// <summary> 19 /// The constant buffer 1 data length is too low for the translation of the guest shader. 20 /// </summary> 21 InvalidCb1DataLength, 22 23 /// <summary> 24 /// The cache is missing the length of a texture array used by the shader. 25 /// </summary> 26 MissingTextureArrayLength, 27 28 /// <summary> 29 /// The cache is missing the descriptor of a texture used by the shader. 30 /// </summary> 31 MissingTextureDescriptor, 32 33 /// <summary> 34 /// File is corrupted. 35 /// </summary> 36 FileCorruptedGeneric, 37 38 /// <summary> 39 /// File is corrupted, detected by magic value check. 40 /// </summary> 41 FileCorruptedInvalidMagic, 42 43 /// <summary> 44 /// File is corrupted, detected by length check. 45 /// </summary> 46 FileCorruptedInvalidLength, 47 48 /// <summary> 49 /// File might be valid, but is incompatible with the current emulator version. 50 /// </summary> 51 IncompatibleVersion, 52 } 53 54 static class DiskCacheLoadResultExtensions 55 { 56 /// <summary> 57 /// Gets an error message from a result code. 58 /// </summary> 59 /// <param name="result">Result code</param> 60 /// <returns>Error message</returns> 61 public static string GetMessage(this DiskCacheLoadResult result) 62 { 63 return result switch 64 { 65 DiskCacheLoadResult.Success => "No error.", 66 DiskCacheLoadResult.NoAccess => "Could not access the cache file.", 67 DiskCacheLoadResult.InvalidCb1DataLength => "Constant buffer 1 data length is too low.", 68 DiskCacheLoadResult.MissingTextureArrayLength => "Texture array length missing from the cache file.", 69 DiskCacheLoadResult.MissingTextureDescriptor => "Texture descriptor missing from the cache file.", 70 DiskCacheLoadResult.FileCorruptedGeneric => "The cache file is corrupted.", 71 DiskCacheLoadResult.FileCorruptedInvalidMagic => "Magic check failed, the cache file is corrupted.", 72 DiskCacheLoadResult.FileCorruptedInvalidLength => "Length check failed, the cache file is corrupted.", 73 DiskCacheLoadResult.IncompatibleVersion => "The version of the disk cache is not compatible with this version of the emulator.", 74 _ => "Unknown error.", 75 }; 76 } 77 } 78 }