error.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #include <stdint.h>
  2. #include "util/error.h"
  3. const char *get_error_type(ErrorCodes error)
  4. {
  5. switch (error / 1000)
  6. {
  7. case 0: return "None";
  8. case 1: return "Init";
  9. case 2: return "Mount";
  10. case 3: return "Dir";
  11. case 4: return "File";
  12. case 5: return "Install";
  13. default: return "Unknown";
  14. }
  15. }
  16. const char *error_get_description(ErrorCodes error)
  17. {
  18. switch (error)
  19. {
  20. case ErrorCode_None:
  21. return "None";
  22. case ErrorCode_Init_Gc:
  23. return "Failed to init Gamecard";
  24. case ErrorCode_Init_Fs:
  25. return "Failed to init FS";
  26. case ErrorCode_Init_Ncm:
  27. return "Failed to init NCM";
  28. case ErrorCode_Init_Spl:
  29. return "Failed to init SPL";
  30. case ErrorCode_Init_Ns:
  31. return "Failed to init NS";
  32. case ErrorCode_Init_Crypto:
  33. return "Failed to init Crypto";
  34. case ErrorCode_Init_Menu:
  35. return "Failed to init Menu";
  36. case ErrorCode_Mount_Handle:
  37. return "Failed to get gamecard handle";
  38. case ErrorCode_Mount_Secure:
  39. return "Failed to mount secure partition";
  40. case ErrorCode_Mount_Update:
  41. return "Failed to mount update partition";
  42. case ErrorCode_Mount_NoMeta:
  43. return "No CNMT found";
  44. case ErrorCode_Alloc:
  45. return "Failed to allocate memory";
  46. case ErrorCode_OpenDir:
  47. return "Failed to open directory";
  48. case ErrorCode_ReadDir:
  49. return "Failed to read directory";
  50. case ErrorCode_ChangeDir:
  51. return "Failed to change directory";
  52. case ErrorCode_DeleteDir:
  53. return "Failed to delete directory";
  54. case ErrorCode_OpenFile:
  55. return "Failed to open file";
  56. case ErrorCode_ReadFile:
  57. return "Failed to read file";
  58. case ErrorCode_WriteFile:
  59. return "Failed to write file";
  60. case ErrorCode_DeleteFile:
  61. return "Failed to delete file";
  62. case ErrorCode_DecryptNcaHeader:
  63. return "Failed to decrypt nca header";
  64. case ErrorCode_DecryptNcaSection:
  65. return "Failed to decrypt nca section";
  66. case ErrorCode_DecryptNcaKeak:
  67. return "Failed to decrypt nca keak";
  68. case ErrorCode_DecryptTitleKey:
  69. return "Failed to decrypt titlekey";
  70. case ErrorCode_EncryptNcaHeader:
  71. return "Failed to encrypt nca header";
  72. case ErrorCode_EncryptNcaSection:
  73. return "Failed to encrypt nca section";
  74. case ErrorCode_EncryptNcaKeak:
  75. return "Failed to encrypt nca section";
  76. case ErrorCode_EncryptTitleKey:
  77. return "Failed to encrypt titlekey";
  78. case ErrorCode_NcmDb:
  79. return "Failed to commit ncmDB";
  80. case ErrorCode_AppRecord:
  81. return "Failed to push application record";
  82. case ErrorCode_NoSpace:
  83. return "Not enough storage space";
  84. case ErrorCode_KeyGen:
  85. return "KeyGen too low to decrypt.";
  86. case ErrorCode_NoKeyFile:
  87. return "No prod.keys / keys.txt found";
  88. case ErrorCode_Unknown:
  89. return "Unkown Error";
  90. default:
  91. return "Unkown Error";
  92. }
  93. }