DiskCacheLoadResult.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. /// <summary>
  13. /// File can't be accessed.
  14. /// </summary>
  15. NoAccess,
  16. /// <summary>
  17. /// The constant buffer 1 data length is too low for the translation of the guest shader.
  18. /// </summary>
  19. InvalidCb1DataLength,
  20. /// <summary>
  21. /// The cache is missing the descriptor of a texture used by the shader.
  22. /// </summary>
  23. MissingTextureDescriptor,
  24. /// <summary>
  25. /// File is corrupted.
  26. /// </summary>
  27. FileCorruptedGeneric,
  28. /// <summary>
  29. /// File is corrupted, detected by magic value check.
  30. /// </summary>
  31. FileCorruptedInvalidMagic,
  32. /// <summary>
  33. /// File is corrupted, detected by length check.
  34. /// </summary>
  35. FileCorruptedInvalidLength,
  36. /// <summary>
  37. /// File might be valid, but is incompatible with the current emulator version.
  38. /// </summary>
  39. IncompatibleVersion
  40. }
  41. static class DiskCacheLoadResultExtensions
  42. {
  43. /// <summary>
  44. /// Gets an error message from a result code.
  45. /// </summary>
  46. /// <param name="result">Result code</param>
  47. /// <returns>Error message</returns>
  48. public static string GetMessage(this DiskCacheLoadResult result)
  49. {
  50. return result switch
  51. {
  52. DiskCacheLoadResult.Success => "No error.",
  53. DiskCacheLoadResult.NoAccess => "Could not access the cache file.",
  54. DiskCacheLoadResult.InvalidCb1DataLength => "Constant buffer 1 data length is too low.",
  55. DiskCacheLoadResult.MissingTextureDescriptor => "Texture descriptor missing from the cache file.",
  56. DiskCacheLoadResult.FileCorruptedGeneric => "The cache file is corrupted.",
  57. DiskCacheLoadResult.FileCorruptedInvalidMagic => "Magic check failed, the cache file is corrupted.",
  58. DiskCacheLoadResult.FileCorruptedInvalidLength => "Length check failed, the cache file is corrupted.",
  59. DiskCacheLoadResult.IncompatibleVersion => "The version of the disk cache is not compatible with this version of the emulator.",
  60. _ => "Unknown error."
  61. };
  62. }
  63. }
  64. }