Last active
August 29, 2015 14:10
-
-
Save Subv/64c55aacc2f9e57b25d9 to your computer and use it in GitHub Desktop.
3DS Error Codes extractor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
# Convert 3DS errors to readable format | |
# plutooo | |
import sys | |
descs = { | |
0: 'Success', | |
2: 'Invalid memory permissions (kernel)', | |
4: 'Invalid ticket version (AM)', | |
5: 'String too big? This error is returned when service name length is greater than 8. (srv)', | |
6: 'Access denied? This error is returned when you request a service that you don\'t have access to. (srv)', | |
7: 'String too small? This error is returned when service name contains an unexpected null byte. (srv)', | |
10: 'Not enough memory (os)', | |
26: 'Session closed by remote (os)', | |
37: 'Invalid NCCH? (AM)', | |
39: 'Invalid title version (AM)', | |
43: 'Database doesn\'t exist/failed to open (AM)', | |
44: 'Trying to uninstall system-app (AM)', | |
120: 'Title/object not found? (fs)', | |
141: 'Gamecard not inserted? (fs)', | |
230: 'Invalid open-flags / permissions? (fs)', | |
391: 'NCCH hash-check failed? (fs)', | |
392: 'RSA/AES-MAC verification failed? (fs)', | |
395: 'RomFS hash-check failed? (fs)', | |
630: 'Command not allowed / missing permissions? (fs)', | |
702: 'Invalid path? (fs)', | |
761: 'Incorrect read-size for ExeFS? (fs)', | |
1000: 'Invalid section', | |
1001: 'Too large', | |
1002: 'Not authorized', | |
1003: 'Already done', | |
1004: 'Invalid size', | |
1005: 'Invalid enum value', | |
1006: 'Invalid combination', | |
1007: 'No data', | |
1008: 'Busy', | |
1009: 'Misaligned address', | |
1010: 'Misaligned size', | |
1011: 'Out of memory', | |
1012: 'Not implemented', | |
1013: 'Invalid address', | |
1014: 'Invalid pointer', | |
1015: 'Invalid handle', | |
1016: 'Not initialized', | |
1017: 'Already initialized', | |
1018: 'Not found', | |
1019: 'Cancel requested', | |
1020: 'Already exists', | |
1021: 'Out of range', | |
1022: 'Timeout', | |
1023: 'Invalid result value' | |
} | |
mods = [ | |
'Common', 'Kernel', 'Util', 'File server', 'Loader server', 'TCB', 'OS', | |
'DBG', 'DMNT', 'PDN', 'GX', 'I2C', 'GPIO', 'DD', 'CODEC', 'SPI', 'PXI', 'FS', | |
'DI', 'HID', 'CAM', 'PI', 'PM', 'PM_LOW', 'FSI', 'SRV', 'NDM', 'NWM', 'SOC', | |
'LDR', 'ACC', 'RomFS', 'AM', 'HIO', 'Updater', 'MIC', 'FND', 'MP', 'MPWL', 'AC', | |
'HTTP', 'DSP', 'SND', 'DLP', 'HIO_LOW', 'CSND', 'SSL', 'AM_LOW', 'NEX', 'Friends', | |
'RDT', 'Applet', 'NIM', 'PTM', 'MIDI', 'MC', 'SWC', 'FatFS', 'NGC', 'CARD', 'CARDNOR', | |
'SDMC', 'BOSS', 'DBM', 'Config', 'PS', 'CEC', 'IR', 'UDS', 'PL', 'CUP', 'Gyroscope', | |
'MCU', 'NS', 'News', 'RO', 'GD', 'Card SPI', 'EC', 'RO', 'Web Browser', 'Test', | |
'ENC', 'PIA' | |
] | |
summs = [ | |
'Success', 'Nothing happened', 'Would block', 'Out of resource', | |
'Not found', 'Invalid state', 'Not supported', 'Invalid argument', | |
'Wrong argument', 'Canceled', 'Status changed', 'Internal' | |
] | |
if len(sys.argv) == 2: | |
err = sys.argv[1].strip() | |
if err.startswith("0x"): | |
err = err[2:] | |
rc = int(err, 16) | |
desc = rc & 0x3FF | |
mod = (rc >> 10) & 0xFF | |
summ = (rc >> 21) & 0x3F | |
level = (rc >> 27) & 0x1F | |
print('Module:') | |
if mod >= 0 and mod < len(mods): | |
print(' ' + mods[mod]) | |
else: | |
print(' ' + 'Unknown') | |
print('Description:') | |
if desc in descs: | |
print(' ' + descs[desc]) | |
else: | |
print(' ' + 'Unknown %d' % desc) | |
print('Summary:') | |
if summ == 63: | |
print(' ' + 'Invalid result value') | |
elif summ >= 0 and summ < len(summs): | |
print(' ' + summs[summ]) | |
else: | |
print(' ' + 'Unknown %d' % summ) | |
print('Level: ') | |
print(' %d' % level) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment