]> Chaos Git - corbenik/ctrulib.git/commitdiff
os: Added osStrError().
authorplutoo <plutoo@univor.se>
Thu, 21 Aug 2014 18:17:41 +0000 (20:17 +0200)
committerplutoo <plutoo@univor.se>
Thu, 21 Aug 2014 18:20:23 +0000 (20:20 +0200)
This will summarize an error-code given by the OS/sysmodules in few words.
Useful for debugging.

libctru/include/3ds/os.h
libctru/source/os.c

index e807f64a4ce2594d304801bf3d5565d77b4acd16..60a97b46e01fbfff769f863aa6fce15e51dcb73e 100644 (file)
@@ -2,5 +2,6 @@
 #define OS_H
 
 u32 osConvertVirtToPhys(u32 vaddr);
+const char* osStrError(u32 error);
 
 #endif
index 7d546a991ecb7cd6deadd8df7f6821971e2ede05..7d84af16b723cb83cf81e843ffce6014553cee87 100644 (file)
@@ -12,3 +12,32 @@ u32 osConvertVirtToPhys(u32 vaddr)
         return vaddr - 0x07000000; // VRAM
     return 0;
 }
+
+const char* osStrError(u32 error) {
+    switch((error>>26) & 0x3F) {
+    case 0:
+        return "Success.";
+    case 1:
+        return "Nothing happened.";
+    case 2:
+        return "Would block.";
+    case 3:
+        return "Not enough resources.";
+    case 4:
+        return "Not found.";
+    case 5:
+        return "Invalid state.";
+    case 6:
+        return "Unsupported.";
+    case 7:
+        return "Invalid argument.";
+    case 8:
+        return "Wrong argument.";
+    case 9:
+        return "Interrupted.";
+    case 10:
+        return "Internal error.";
+    default:
+        return "Unknown.";
+    }
+}