From 7da7ef65f1e9532799e85539394513a2779ebe3a Mon Sep 17 00:00:00 2001 From: thedax Date: Sun, 27 Sep 2020 02:21:18 -0400 Subject: [PATCH] Revamp the error/result code module. (#830) * Prepare for error code rewrite -removed err.py -removed nxerr.py -edited kurisu.py to account for this * Add results cog It unifies `nxerr` and `err` together with a cleaner codebase. Its supporting code properly parses errors whenever possible and is mostly complete at this point. There are still some missing codes from all consoles, but I plan on adding more as time goes on. * Add types.py This file is the backbone of the result codes built on top of it. It provides the two basic types necessary for the result cog to function. * Add ctr.py This file contains all currently known 3DS error codes, and helper funcs to get information about them. * Add cafe.py This file contains all currently known Wii U error codes, and helper funcs to get information about them. * Add nx.py This file contains all currently known Switch error codes, and helper funcs to get information about them. * Rename files for less confusion nx.py to switch.py cafe.py to wiiu.py * Update cog code to account for renamed files * Add Wii U error code 115-5004. Closes issue #825. * Fix indentation of description embed field * Add comments to most of the files to help explain what they do. Also how to add new modules and error codes. * Adjust some comments in the cog. * Make a note that a number of 3DS result codes were left out. This wasn't completely intentional, but adding literally everything would have delayed this even longer than it's already taken (months of off and on work). I will add them in eventually. * Credit switchbrew, 3dbrew, and Atmosphere for much of the information. * Address pyflakes's complaints. They're actually valid for once. I missed a few things. * Add meme support Not bothering to obfuscate them anymore, because everyone knows about them already. * Add several more missing 3DS error codes. NIM-specifics are still NYI. * Adjust ban result codes to have a flag instead Keeps the descriptions much shorter. * Add more missing Wii U results * Add some missing nx support pages and errors * Implement err2hex, hex2err And also add a couple more errors... * Fixup the input for hex2err & err2hex * Prefer `is not None` when possible * Support showing both hex and human-readable results in the embed * Add basic support for Wii U hexadecimal error codes -Removed err2hex for 3ds & wiiu, it's not possible to do this * Revise QoL hex/err display logic * Shorten an extremely long line of code * Fix pyflakes issues * Two changes -Catch bad error or hex codes passed to err2hex and hex2err -Simplify the err_disp logic as much as possible * Remove debug prints * Fix small bug in wiiu.get Actually fix the bug * Add support for suppressing err2hex unsupported messages. It helps keep other code sane. Hopefully this is the LAST time I have to touch the error code display logic. I'm sick of this. Also change the embed colour to the warning colour when the result is a ban. * Add 3DS nim-specific error handling. It feels like a hack but it is what it is. * Add original notes from the nim-specific stuff in the old err cog Edited slightly since the first line had redundancy. * Don't need an f-string there * Fix indentation * Add a bit more info to one error code * Reorder 3ds modules based on number * Reorder Switch modules based on number * wiiu: Add missing parenthesis, remove old TODO * Fix various style issues (mainly spacing). Ignored error about := spacing, because pep8 doesn't know what it wants. Ignored line length limits, we don't follow that either. * Remove excess newlines at end of files Gedit has some kind of a bug in it, or it automatically adds newlines regardless of what you do? Unsure, don't care. * Remove unused and/or redundant things --- cogs/err.py | 522 ------------ cogs/nxerr.py | 826 ------------------ cogs/results/__init__.py | 138 +++ cogs/results/ctr.py | 472 +++++++++++ cogs/results/switch.py | 1744 ++++++++++++++++++++++++++++++++++++++ cogs/results/types.py | 55 ++ cogs/results/wiiu.py | 534 ++++++++++++ kurisu.py | 3 +- 8 files changed, 2944 insertions(+), 1350 deletions(-) delete mode 100644 cogs/err.py delete mode 100644 cogs/nxerr.py create mode 100644 cogs/results/__init__.py create mode 100644 cogs/results/ctr.py create mode 100644 cogs/results/switch.py create mode 100644 cogs/results/types.py create mode 100644 cogs/results/wiiu.py diff --git a/cogs/err.py b/cogs/err.py deleted file mode 100644 index 1f0737be3..000000000 --- a/cogs/err.py +++ /dev/null @@ -1,522 +0,0 @@ -import binascii -import discord -import re - -from discord import Color -from discord.ext import commands - - -class Err(commands.Cog): - """ - Parses CTR error codes. - """ - def __init__(self, bot): - self.bot = bot - - # CTR Error Codes - summaries = { - 0: 'Success', - 1: 'Nothing happened', - 2: 'Would block', - 3: 'Out of resource', - 4: 'Not found', - 5: 'Invalid state', - 6: 'Not supported', - 7: 'Invalid argument', - 8: 'Wrong argument', - 9: 'Canceled', - 10: 'Status changed', - 11: 'Internal', - 63: 'Invalid result value' - } - - levels = { - 0: "Success", - 1: "Info", - - 25: "Status", - 26: "Temporary", - 27: "Permanent", - 28: "Usage", - 29: "Reinitialize", - 30: "Reset", - 31: "Fatal" - } - - modules = { - 0: 'Common', - 1: 'Kernel', - 2: 'Util', - 3: 'File server', - 4: 'Loader server', - 5: 'TCB', - 6: 'OS', - 7: 'DBG', - 8: 'DMNT', - 9: 'PDN', - 10: 'GSP', - 11: 'I2C', - 12: 'GPIO', - 13: 'DD', - 14: 'CODEC', - 15: 'SPI', - 16: 'PXI', - 17: 'FS', - 18: 'DI', - 19: 'HID', - 20: 'CAM', - 21: 'PI', - 22: 'PM', - 23: 'PM_LOW', - 24: 'FSI', - 25: 'SRV', - 26: 'NDM', - 27: 'NWM', - 28: 'SOC', - 29: 'LDR', - 30: 'ACC', - 31: 'RomFS', - 32: 'AM', - 33: 'HIO', - 34: 'Updater', - 35: 'MIC', - 36: 'FND', - 37: 'MP', - 38: 'MPWL', - 39: 'AC', - 40: 'HTTP', - 41: 'DSP', - 42: 'SND', - 43: 'DLP', - 44: 'HIO_LOW', - 45: 'CSND', - 46: 'SSL', - 47: 'AM_LOW', - 48: 'NEX', - 49: 'Friends', - 50: 'RDT', - 51: 'Applet', - 52: 'NIM', - 53: 'PTM', - 54: 'MIDI', - 55: 'MC', - 56: 'SWC', - 57: 'FatFS', - 58: 'NGC', - 59: 'CARD', - 60: 'CARDNOR', - 61: 'SDMC', - 62: 'BOSS', - 63: 'DBM', - 64: 'Config', - 65: 'PS', - 66: 'CEC', - 67: 'IR', - 68: 'UDS', - 69: 'PL', - 70: 'CUP', - 71: 'Gyroscope', - 72: 'MCU', - 73: 'NS', - 74: 'News', - 75: 'RO', - 76: 'GD', - 77: 'Card SPI', - 78: 'EC', - 79: 'Web Browser', - 80: 'Test', - 81: 'ENC', - 82: 'PIA', - 83: 'ACT', - 84: 'VCTL', - 85: 'OLV', - 86: 'NEIA', - 87: 'NPNS', - 90: 'AVD', - 91: 'L2B', - 92: 'MVD', - 93: 'NFC', - 94: 'UART', - 95: 'SPM', - 96: 'QTM', - 97: 'NFP (amiibo)', - 254: 'Application', - 255: 'Invalid result value' - } - - descriptions = { - 0: 'Success', - 2: 'Invalid memory permissions (kernel)', - 4: 'Invalid ticket version (AM)', - 5: 'Invalid string length. This error is returned when service name length is greater than 8 or zero. (srv)', - 6: 'Access denied. This error is returned when you request a service that you don\'t have access to. (srv)', - 7: 'String size does not match string contents. This error is returned when service name contains an unexpected null byte. (srv)', - 8: 'Camera already in use/busy (qtm).', - 10: 'Not enough memory (os)', - 26: 'Session closed by remote (os)', - 32: 'Empty CIA? (AM)', - 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)', - 47: 'Invalid command header (OS)', - 101: 'Archive not mounted/mount-point not found (fs)', - 105: 'Request timed out (http)', - 106: 'Invalid signature/CIA? (AM)', - 120: 'Title/object not found? (fs)', - 141: 'Gamecard not inserted? (fs)', - 190: 'Object does already exist/failed to create object.', - 230: 'Invalid open-flags / permissions? (fs)', - 250: 'FAT operation denied (fs?)', - 271: 'Invalid configuration (mvd).', - 335: '(No permission? Seemed to appear when JKSM was being used without its XML.)', - 391: 'NCCH hash-check failed? (fs)', - 392: 'RSA/AES-MAC verification failed? (fs)', - 393: 'Invalid database? (AM)', - 395: 'RomFS/Savedata hash-check failed? (fs)', - 630: 'Command not allowed / missing permissions? (fs)', - 702: 'Invalid path? (fs)', - 740: '(Occurred when NDS card was inserted and attempting to use AM_GetTitleCount on MEDIATYPE_GAME_CARD.) (fs)', - 761: 'Incorrect read-size for ExeFS? (fs)', - 1000: 'Invalid selection', - 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' - } - - # Nintendo Error Codes - errcodes = { - # Nintendo 3DS - '001-0502': 'Some sort of network error related to friend presence. "Allow Friends to see your online status" might fix this.', - '001-0803': 'Could not communicate with authentication server.', - '002-0102': 'System is permanently banned by Nintendo. You cannot ask how to fix this issue here.', - '002-0107': 'System is temporarily(?) banned by Nintendo. You cannot ask how to fix this issue here.', - '002-0119': 'System update required (outdated friends-module)', - '002-0120': 'Title update required (outdated title version)', - '002-0121': 'Local friend code SEED has invalid signature.\n\nThis should not happen unless it is modified. The only use case for modifying this file is for system unbanning, so you cannot ask how to fix this issue here.', - '002-0123': 'System is generally banned by Nintendo. You cannot ask how to fix this issue here.', - '022-2502': 'Region settings between the console and Nintendo Network ID do not match. The console region must be fixed to use the NNID. If you want to use a different region, the NNID must be unlinked from the system or deleted.', - '022-2932': 'Unable to agree to the Nintendo Network Services Agreement. Usually found on region-changed devices.', - '003-1099': 'Access point could not be found with the given SSID.', - '003-2001': 'DNS error. If using a custom DNS server, make sure the settings are correct.', - '005-7000': 'Base error code for most other error codes. No error occured.', - '005-2008': 'This error is caused by installing a game or game update from an unofficial source, as it contains a bad ticket.\nThe only solution is to delete the unofficial game or update as well as its ticket\nin FBI, and install the game or update legitimately. If the title was uninstalled\nalready, remove the ticket in FBI.', - '005-4800': 'HTTP Status 500 (Internal Error), unknown cause(?). eShop servers might have issues.', - '005-5602': 'Unable to connect to the eShop. This error is most likely the result of an incorrect region setting.\nMake sure your region is correctly set in System Settings. If you encounter this error after region-changing your system, make sure you followed all the steps properly.', - '005-5958': 'Unknown eShop error. Usually seen on region-changed devices.', - '005-5964': 'Your Nintendo Network ID has been banned from accessing the eShop.\nIf you think this was unwarranted, you will have to contact Nintendo Support to have it reversed.', - '005-7550': 'Replace SD card(?). Occurs on Nintendo eShop.', - '006-0102': 'Unexpected error. Could probably happen trying to play an out-of-region title online?', - '006-0332': 'Disconnected from the game server.', - '006-0502': 'Could not connect to the server.\n\n• Check the [network status page](http://support.nintendo.com/networkstatus)\n• Move closer to your wireless router\n• Verify DNS settings. If "Auto-Obtain" doesn\'t work, try Google\'s Public DNS (8.8.8.8, 8.8.4.4) and try again.', - '006-0612': 'Failed to join the session.', - '007-0200': 'Could not access SD card.', - '007-2001': 'Usually the result after region-changing the system. New 3DS cannot fix this issue right now.', - '007-2100': 'The connection to the Nintendo eShop timed out.\nThis may be due to an ongoing server maintenance, check to make sure the servers are operating normally. You may also encounter this error if you have a weak internet connection.', - '007-2404': 'An error occurred while attempting to connect to the Nintendo eShop.\nMake sure you are running the latest firmware, since this error will appear if you are trying to access the eShop on older versions.', - '007-2670': 'Generic connection error.', - '007-2720': 'SSL error?', - '007-2916': 'HTTP error, server is probably down. Try again later?', - '007-2920': 'This error is caused by installing a game or game update from an unofficial source, as it contains a bad ticket.\nThe only solution is to delete the unofficial game or update as well as its ticket\nin FBI, and install the game or update legitimately. If the title was uninstalled\nalready, remove the ticket in FBI.', - '007-2913': 'HTTP error, server is probably down. Try again later?', - '007-2923': 'The Nintendo Servers are currently down for maintenance. Please try again later.', - '007-3102': 'Cannot find title on Nintendo eShop. Probably pulled.', - '007-6054': 'Occurs when ticket database is full (8192 tickets).', - '009-1000': 'System update required. (friends module?)', - '009-2916': 'NIM HTTP error, server is probably down. Try again later?', - '009-2913': 'NIM HTTP error, server is probably down. Try again later?', - '009-2920': 'This error is caused by installing a game or game update from an unofficial source, as it contains a bad ticket.\nThe only solution is to delete the unofficial game or update as well as its ticket\nin FBI, and install the game or update legitimately. If the title was uninstalled\nalready, remove the ticket in FBI.', - '009-4079': 'Could not access SD card. General purpose error.', - '009-4998': '"Local content is newer."\nThe actual cause of this error is unknown.', - '009-6106': '"AM error in NIM."\nProbably a bad ticket.', - '009-8401': 'Update data corrupted. Delete and re-install.', - '011-3021': 'Cannot find title on Nintendo eShop. Probably incorrect region, or never existed.', - '011-3136': 'Nintendo eShop is currently unavailable. Try again later.', - '011-6901': 'System is banned by Nintendo, this error code description is oddly Japanese, generic error code. You cannot ask how to fix this issue here.', - '012-1511': 'Certificate warning.', - '014-0016': 'Both systems have the same movable.sed key. Format the target and try system transfer again.', - '014-0062': 'Error during System Transfer. Move closer to the wireless router and keep trying.', - '022-2452': 'Occurs when trying to use Nintendo eShop with UNITINFO patches enabled.', - '022-2501': 'Attempting to use a Nintendo Network ID on one system when it is linked on another. This can be the result of using System Transfer, then restoring the source system\'s NAND and attempting to use services that require a Nintendo Network ID.\n\nIn a System Transfer, all Nintendo Network ID accounts associated with the system are transferred over, whether they are currently linked or not.', - '022-2511': 'System update required (what causes this? noticed while opening Miiverse, probably not friends module)', - '022-2613': 'Incorrect e-mail or password when trying to link an existing Nintendo Network ID. Make sure there are no typos, and the given e-mail is the correct one for the given ID.\nIf you forgot the password, reset it at ', - '022-2631': 'Nintendo Network ID deleted, or not usable on the current system. If you used System Transfer, the Nintendo Network ID will only work on the target system.', - '022-2633': 'Nintendo Network ID temporarily locked due to too many incorrect password attempts. Try again later.', - '022-2634': 'Nintendo Network ID is not correctly linked on the system. This can be a result of formatting the SysNAND using System Settings to unlink it from the EmuNAND.\nTo fix, boot GodMode9 and [follow these steps.](https://3ds.hacks.guide/godmode9-usage#removing-an-nnid-without-formatting-your-device)\nAfterwards, reboot and sign into your NNID again.', - '022-2812': 'System is permanently banned by Nintendo for illegally playing the Pokemon Sun & Moon ROM leak online before release. You cannot ask how to fix this issue here.', - '022-2815': 'System is banned by Nintendo from Miiverse access.', - '022-5515': 'Network timeout.', - '032-1820': 'Browser error that asks whether you want to go on to a potentially dangerous website. Can be bypassed by touching "yes".', - '090-0212': 'Game is permanently banned from Pokémon Global Link. This is most likely as a result of using altered or illegal save data.', - # Wii U - # these all mean different things technically and maybe i should list them - '102-2802': 'NNID is permanently banned by Nintendo. You cannot ask how to fix this issue here.', - '102-2805': 'System is banned from accessing Nintendo eShop. You cannot ask how to fix this issue here.', - '102-2812': 'System + linked NNID and access to online services are permanently banned by Nintendo. You cannot ask how to fix this issue here.', - '102-2813': 'System is banned by Nintendo. You cannot ask how to fix this issue here.', - '102-2814': 'System is permanently banned from online multiplayer in a/multiple game(s) (preferably Splatoon). You cannot ask how to fix this issue here.', - '102-2815': 'System is banned from accessing the Nintendo eShop. You cannot ask how to fix this issue here.', - '102-2816': 'System is banned for a/multiple game(s) (preferably Splatoon) for an unknown duration, by attempting to use modified static.pack/+ game files online. You cannot ask how to fix this issue here.', - '106-0306': 'NNID is temporarily banned from a/multiple games (preferably Splatoon) online multiplayer. You cannot ask how to fix this issue here.', - '106-0346': 'NNID is permanently banned from a/multiple games (preferably Splatoon) online multiplayer. You cannot ask how to fix this issue here.', - '112-1037': 'Incorrect permissions for the default index.html file which prevents the Internet Browser from reading it. This can be fixed by following [this guide](https://wiiu.hacks.guide/#/fix-errcode-112-1037).', - '115-1009': 'System is permanently banned from Miiverse.', - '121-0902': 'Permissions missing for the action you are trying to perfrom (Miiverse error).', - '126-9622': 'Error when attempting to add funds. Maybe try again after a while, or make sure there is no issue with the payment method.', - '150-1031': 'Disc could not be read. Either the disc is dirty, the lens is dirty, or the disc is unsupported (i.e. not a Wii or Wii U game).', - '150-2031': 'Disc could not be read. Either the disc is dirty, the lens is dirty, or the disc is unsupported (i.e. not a Wii or Wii U game).', - '160-0101': '"Generic error". Can happen when formatting a system with CBHC.', - '160-0102': 'Error in SLC/MLC or USB.', - '160-0103': '"The system memory is corrupted (MLC)."', - '160-0104': '"The system memory is corrupted (SLC)."', - '160-0105': 'USB storage corrupted?', - '199-9999': 'Usually occurs when trying to run an unsigned title without signature patches, or something unknown(?) is corrupted.', - } - - switch_errcodes = { - # Switch - '007-1037': ['Could not detect an SD card.', None], - '2001-0125': ['Executed svcCloseHandle on main-thread handle (No known support page)', None], - '2002-6063': ['Attempted to read eMMC CID from browser? (No known support page)', None], - '2005-0003': ['You are unable to download software.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/22393/kw/2005-0003'], - '2016-2101': ['Inserted Tencent-Nintendo (Chinese model) cartridge into regular Switch, which is region locked.', 'https://nintendoswitch.com.cn/support/'], - '2110-3400': ['This error code indicates the Internet connection you are attempting to use likely requires some type of authentication through a web browser (such as agreeing to terms of service or entering a username and password).', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/22569/kw/2110-3400'], - '2124-4007': ['System + Nintendo Account are permanently banned by Nintendo. You cannot ask how to fix this issue here.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/28046/kw/2124-4007'], - '2124-4025': ['Game Card is banned, this "COULD" happen to legal users if so contact Nintendo to allow them to whitelist the Game Card. Otherwise, You cannot ask how to fix this issue here.', None], - '2124-4027': ['System + Nintendo Account are banned from a game (preferably Splatoon 2) online multiplayer services for a set duration which can be found after checking your email on the account recieving the ban. You cannot ask how to fix this issue here.', None], - '2162-0002': ['General userland crash', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/22596/kw/2162-0002'], - '2164-0020': ['Error starting software.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/22539/kw/2164-0020'], - '2168-0000': ['Illegal opcode. (No known support page)', None], - '2168-0001': ['Resource/Handle not available.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/29104/kw/2168-0001'], - '2168-0002': ['Segmentation Fault.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/22518/kw/2168-0002'], - '2168-0003': ['Memory access must be 4 bytes aligned. (No known support page)', None], - '2181-4008': ['System is permanently banned by Nintendo. You cannot ask how to fix this issue here.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/42061/kw/2181-4008'], - '2811-5001': ['General connection error.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/22392/kw/2811-5001'], - '2124-4517': ['Console banned due a breach of the user agreements. You cannot ask how to fix this issue here.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/43652/kw/2124-4517'], - '2124-4621': ['Online features in foreign games are not available on Tencent-Nintendo Switch (Chinese model).', 'https://nintendoswitch.com.cn/support/'] - } - - def get_name(self, d, k, show_unknown=False): - if k in d: - return f'{d[k]} ({k})' - else: - if show_unknown: - return f'_Unknown {show_unknown}_ ({k})' # crappy method - else: - return f'{k}' - - async def aaaa(self, ctx, rc): - # i know this is shit that's the point - if rc == 3735928559: - await ctx.send(binascii.unhexlify(hex(3273891394255502812531345138727304541163813328167758675079724534358388)[2:]).decode('utf-8')) - elif rc == 3735927486: - await ctx.send(binascii.unhexlify(hex(271463605137058211622646033881424078611212374995688473904058753630453734836388633396349994515442859649191631764050721993573)[2:]).decode('utf-8')) - elif rc == 2343432205: - await ctx.send(binascii.unhexlify(hex(43563598107828907579305977861310806718428700278286708)[2:]).decode('utf-8')) - - async def convert_zerox(self, ctx, rc): - if not rc & 0x80000000: - await ctx.send('This is likely not a CTR error code.') - await self.aaaa(ctx, rc) - desc = rc & 0x3FF - mod = (rc >> 10) & 0xFF - summ = (rc >> 21) & 0x3F - level = (rc >> 27) & 0x1F - return desc, mod, summ, level, rc - - def nim_3ds_errors(self, err: str, embed): - """ - Parses 3ds nim error codes between the range of 005-2000 to 005-3023, 005-4200 to 005-4399, 005-4400 to 005-4999, 005-5000 to 005-6999 and 005-7000 to 005-9999. - - 005-2000 to 005-3023: - - NIM got a result of its own. Took description and added by 52000. - - 005-4200 to 005-4399: - - NIM got an HTTP result. Took description and added by 54200, cutting out at 54399 if it was beyond that. - - 005-4400 to 005-4999: - - Range of HTTP codes, however, can suffer collision. - - 005-5000 to 005-6999: - - SOAP Error Code range, when is not 0 on the SOAP responses. - - 005-7000 to 005-9999: - - Non specific expected results are formatted to an error code in nim by taking result module and shifting right by 5, and taking the result description and masked with 0x1F, then added both together along with 57000. - """ - - if len(err) != 8: - return False - - try: - err_hi = int(err[:3], 10) - err_lo = int(err[-4:], 10) - except ValueError: - return False - - if err_hi != 5: - return False - - if 2000 <= err_lo < 3024: - err_lo -= 2000 - - embed.add_field(name="Module", value=self.get_name(self.modules, 52), inline=False) - embed.add_field(name="Description", value=self.get_name(self.descriptions, err_lo), inline=False) - return True - - # this range is still a little mystified by another section in nim - # but this covers one section of it - elif 4200 <= err_lo < 4400: - embed_extra = None - if err_lo == 4399: - embed_extra = "Or NIM's HTTP result description maximum." - err_lo -= 4200 - - embed.add_field(name="Module", value=self.get_name(self.modules, 40), inline=False) - embed.add_field(name="Description", value=self.get_name(self.descriptions, err_lo), inline=False) - if embed_extra: - embed.add_field(name="Extra Note", value=embed_extra, inline=False) - return True - - elif 4400 <= err_lo < 5000: - err_lo -= 4400 - embed_extra = None - if err_lo < 100: - desc = f"{err_lo + 100}" - elif 100 <= err_lo < 500: - desc = f"{err_lo + 100} or {err_lo}" - embed_extra = "Likely due to a programming mistake in NIM, this error code range suffers collision.\n" - embed_extra += "Real HTTP code will vary with what operation it came from." - else: - desc = f"{err_lo}" - - embed.description = "HTTP error code" - embed.add_field(name="Code", value=desc, inline=False) - if embed_extra: - embed.add_field(name="Extra Note", value=embed_extra, inline=False) - return True - - elif 5000 <= err_lo < 7000: - err_lo -= 5000 - - desc = f"SOAP Message returned ErrorCode {err_lo} on a NIM operation." - if err_lo == 1999: - desc += "\nOr beyond 1999. It's maxed out at 005-6999." - embed.description = desc - return True - - elif err_lo >= 7000: - embed_extra = None - if err_lo == 9999: - embed_extra = "Also NIM's maximum compacted result to error code." - elif err_lo == 7000: - embed_extra = "Also NIM's minimum compacted result to error code." - err_lo -= 7000 - - module = err_lo >> 5 - short_desc = err_lo & 0x1F - - known_desc = [] - unknown_desc = [] - - for i in range(0+short_desc, 0x400+short_desc, 0x20): - if i not in self.descriptions: - unknown_desc += [str(i)] - continue - known_desc += [self.get_name(self.descriptions, i)] - - known_desc = "\n".join(known_desc) - unknown_desc = ", ".join(unknown_desc) - - embed.add_field(name="Module", value=self.get_name(self.modules, module), inline=False) - if known_desc: - embed.add_field(name="Possible known descriptions", value=known_desc, inline=False) - if unknown_desc: - embed.add_field(name="Possible unknown descriptions", value=unknown_desc, inline=False) - if embed_extra: - embed.add_field(name="Extra Note", value=embed_extra, inline=False) - return True - - return False - - @commands.command() - async def err(self, ctx, err: str): - """ - Parses Nintendo and CTR error codes, with a fancy embed. 0x prefix is not required. - - Example: - .err 0xD960D02B - .err 022-2634 - """ - if re.match('[0-1][0-9][0-9]\-[0-9][0-9][0-9][0-9]', err): - embed = discord.Embed(title=err + (": Nintendo 3DS" if err[0] == "0" else ": Wii U")) - embed.url = f"https://en-americas-support.nintendo.com/app/answers/list/kw/{err}" - if err in self.errcodes: - embed.description = self.errcodes[err] - embed.color = (Color(0xCE181E) if err[0] == "0" else Color(0x009AC7)) - elif self.nim_3ds_errors(err, embed): - embed.color = Color(0xCE181E) - else: - embed.description = "I don't know this one! Click the error code for details on Nintendo Support.\n\nIf you keep getting this issue and Nintendo Support does not help, or know how to fix it, you should report relevant details to [the Kurisu repository](https://github.com/nh-server/Kurisu/issues) so it can be added to the bot." - - # 0xE60012 - # Switch Error Codes (w/ website) - # Switch Error Codes (w/o website) - elif re.match('[0-9][0-9][0-9][0-9]\-[0-9][0-9][0-9][0-9]', err): - embed = discord.Embed(title=err + ": Nintendo Switch") - embed.url = "http://en-americas-support.nintendo.com/app/answers/landing/p/897" - embed.color = Color(0xE60012) - if re.match('2110\-1[0-9][0-9][0-9]', err): - embed.url = "http://en-americas-support.nintendo.com/app/answers/detail/a_id/22594" - embed.description = "General connection error." - elif re.match('2110\-29[0-9][0-9]', err): - embed.url = "http://en-americas-support.nintendo.com/app/answers/detail/a_id/22277/p/897" - embed.description = "General connection error." - elif re.match('2110\-2[0-8][0-9][0-9]', err): - embed.url = "http://en-americas-support.nintendo.com/app/answers/detail/a_id/22263/p/897" - embed.description = "General connection error." - else: - if err in self.switch_errcodes: - embed.url = self.switch_errcodes[err][1] - embed.description = self.switch_errcodes[err][0] - else: - embed.color = embed.Empty - embed.description = "I don't know this one! Click the error code for details on Nintendo Support.\n\nIf you keep getting this issue and Nintendo Support does not help, and know how to fix it, you should report relevant details to [the Kurisu repository](https://github.com/nh-server/Kurisu/issues) so it can be added to the bot." - else: - try: - err_num = int(err, 16) - except ValueError: - return await ctx.send("Invalid error code.") - - desc, mod, summ, level, rc = await self.convert_zerox(ctx, err_num) - - # garbage - embed = discord.Embed(title=f"0x{rc:X}") - embed.add_field(name="Module", value=self.get_name(self.modules, mod), inline=False) - embed.add_field(name="Description", value=self.get_name(self.descriptions, desc), inline=False) - embed.add_field(name="Summary", value=self.get_name(self.summaries, summ), inline=False) - embed.add_field(name="Level", value=self.get_name(self.levels, level), inline=False) - await ctx.send(embed=embed) - - -def setup(bot): - bot.add_cog(Err(bot)) diff --git a/cogs/nxerr.py b/cogs/nxerr.py deleted file mode 100644 index fe14cb122..000000000 --- a/cogs/nxerr.py +++ /dev/null @@ -1,826 +0,0 @@ -import discord -import re -from discord.ext import commands - - -class NXErr(commands.Cog): - """ - Parses NX (Nintendo Switch) error codes. - Uses http://switchbrew.org/index.php?title=Error_codes - """ - def __init__(self, bot): - self.bot = bot - - # Modules - modules = { - 1: "Kernel ", - 2: "FS ", - 3: "OS (Memory, Thread, Mutex, NVIDIA) ", - 4: "HTCS ", - 5: "NCM ", - 6: "DD ", - 7: "Debug Monitor ", - 8: "LR ", - 9: "Loader ", - 10: "CMIF (IPC command interface) ", - 11: "HIPC (IPC) ", - 15: "PM ", - 16: "NS ", - 17: "Sockets ", - 18: "HTC ", - 20: "NCM Content ", - 21: "SM ", - 22: "RO userland ", - 24: "SDMMC ", - 25: "OVLN ", - 26: "SPL ", - 100: "ETHC ", - 101: "I2C ", - 102: "GPIO ", - 103: "UART ", - 105: "Settings ", - 107: "WLAN ", - 108: "XCD ", - 110: "NIFM ", - 111: "Hwopus ", - 113: "Bluetooth ", - 114: "VI ", - 115: "NFP ", - 116: "Time ", - 117: "FGM ", - 118: "OE ", - 120: "PCIe ", - 121: "Friends ", - 122: "BCAT ", - 123: "SSL ", - 124: "Account ", - 125: "News ", - 126: "Mii ", - 127: "NFC ", - 128: "AM ", - 129: "Play Report ", - 130: "AHID ", - 132: "Home Menu (Qlaunch) ", - 133: "PCV ", - 134: "OMM ", - 135: "BPC ", - 136: "PSM ", - 137: "NIM ", - 138: "PSC ", - 139: "TC ", - 140: "USB ", - 141: "NSD ", - 142: "PCTL ", - 143: "BTM ", - 144: "EC (Shop) ", - 145: "ETicket ", - 146: "NGC (Bad Words) ", - 147: "Error Report ", - 148: "APM ", - 150: "Profiler ", - 151: "Error Upload ", - 153: "Audio ", - 154: "NPNS ", - 155: "NPNS HTTP Stream ", - 157: "ARP ", - 158: "SWKBD ", - 159: "Boot ", - 161: "NFC Mifare ", - 162: "Userland assert ", - 163: "Fatal ", - 164: "NIM Shop ", - 165: "SPSM ", - 167: "BGTC ", - 168: "Userland crash ", - 179: "OLSC ", - 180: "SREPO ", - 181: "Dauth ", - 202: "HID ", - 203: "LDN ", - 205: "Irsensor ", - 206: "Capture ", - 208: "Manu ", - 209: "ATK ", - 210: "Web ", - 211: " ", - 212: "GRC ", - 216: "Migration ", - 217: "Migration Idc Server ", - - # Libnx - - 345: "libnx ", - 346: "Homebrew ABI ", - 347: "Homebrew Loader ", - 348: "libnx Nvidia", - 349: "libnx Binder", - - # Support Errors - - 800: "General web-applet", - 809: "WifiWebAuthApplet", - 810: "Whitelisted-applet", - 811: "ShopN", - - # Custom Sysmodules - - 311: "SwitchPresence", - } - - known_errcodes = { - 0x0E01: "Session count exceeded ", - 0x1C01: "Invalid kernel capability descriptor ", - 0x4201: "Not Implemented ", - 0x7601: "Thread terminated/termination requested ", - 0x8C01: "No more debug events ", - 0xCA01: "Invalid size ", - 0xCC01: "Invalid address ", - 0xCE01: "Resource exhaustion ", - 0xD001: "Memory exhaustion ", - 0xD201: "Handle-table exhaustion ", - 0xD801: "Invalid memory permissions. ", - 0xDC01: "Invalid memory range ", - 0xE001: "Invalid thread priority. ", - 0xE201: "Invalid processor id. ", - 0xE401: "Invalid handle. ", - 0xE601: "Invalid pointer/Syscall copy from user failed. ", - 0xE801: "Invalid combination ", - 0xEA01: "Time out. Also when you give 0 handles to svcWaitSynchronizationN. ", - 0xEC01: "Canceled/interrupted [?] ", - 0xEE01: "Out of range ", - 0xF001: "Invalid enum ", - 0xF201: "No such entry ", - 0xF401: "Irq/DeviceAddressSpace/{...} already registered ", - 0xF601: "Port remote dead ", - 0xF801: "[Usermode] Unhandled interrupt/exception ", - 0xFA01: "Process already started/Wrong memory permission? ", - 0xFC01: "Reserved value ", - 0xFE01: "Invalid hardware breakpoint ", - 0x10001: "[Usermode] Fatal exception ", - 0x10201: "Last thread didn\'t belong to your process ", - 0x10601: "Port closed ", - 0x10801: "Resource limit exceeded ", - 0x20801: "Command buffer too small ", - 0x40a01: "No such process ", - 0x41001: "Process not being debugged ", - 0x202: "Path does not exist. ", - 0x402: "Path already exists. ", - 0xE02: "Savedata already mounted ", - 0x4602: "Not enough free space for BIS Calibration partition. ", - 0x4802: "Not enough free space for BIS Safe partition. ", - 0x4A02: "Not enough free space for BIS User partition. ", - 0x4C02: "Not enough free space for BIS System partition. ", - 0x4E02: "Not enough free space on SD card. ", - 0x7802: "The specified NCA-type doesn\'t exist for this title. ", - 0x7D202: "Process does not have RomFs ", - 0x7D402: "Title-id not found / savedata not found. ", - 0xFA202: "SD card not inserted ", - 0x13B002: "Gamecard not inserted ", - 0x13DA02: "Version check failed when mounting gamecard sysupdate partition? ", - 0x171402: "Invalid gamecard handle. ", - 0x177202: "Unimplemented behavior ", - 0x177602: "File/Directory already exists. ", - 0x190202: "Memory allocation failure related to FAT filesystem code ", - 0x190602: "Memory allocation failure related to FAT filesystem code ", - 0x190802: "Memory allocation failure related to FAT filesystem code ", - 0x190A02: "Memory allocation failure related to FAT filesystem code ", - 0x190C02: "Memory allocation failure related to FAT filesystem code ", - 0x191002: "Memory allocation failure related to FAT filesystem code ", - 0x195802: "Allocation failure related to SD cards ", - 0x196002: "Out of memory ", - 0x196202: "Out of memory ", - 0x1A3E02: "Out of memory ", - 0x1A4002: "Out of memory ", - 0x1A4A02: "Out of memory ", - 0x21BC02: "Invalid save data filesystem magic (valid magic is SAVE in ASCII) ", - 0x234202: "Error reading ACID section in NPDM ", - 0x234402: "Invalid NPDM ACID section size ", - 0x234602: "Last byte of the ACID modulus is zero ", - 0x234802: "Invalid ACID fixed key signature ", - 0x234A02: "Invalid NCA magic ", - 0x234C02: "Invalid NCA header fixed key signature ", - 0x234E02: "Invalid NCA header ACID signature ", - 0x235002: "Invalid NCA header section hash ", - 0x235202: "Invalid NCA Key index ", - 0x235602: "Invalid encryption type ", - 0x235802: "Redirection BKTR table size is negative ", - 0x235A02: "Encryption BKTR table size is negative ", - 0x235C02: "Redirection BKTR table end offset is past the Encryption BKTR table start offset ", - 0x235E02: "NCA-path used with the wrong titleID. ", - 0x236002: "NCA header value is out of range ", - 0x236202: "NCA FS header value is out of range ", - 0x236802: "PartitionFS hash block size is not a power of 2 ", - 0x236A02: "PartitionFS hash always_2 field is not 2 ", - 0x236C02: "PartitionFS hash table is too small for main data ", - 0x236E02: "Invalid PartitionFS block hash ", - 0x249802: "Invalid FAT file number. ", - 0x249C02: "Invalid FAT format for BIS User partition. ", - 0x249E02: "Invalid FAT format for BIS System partition. ", - 0x24A002: "Invalid FAT format for BIS Safe partition. ", - 0x24A202: "Invalid FAT format for BIS Calibration partition. ", - 0x250E02: "Corrupted NAX0 header. ", - 0x251002: "Invalid NAX0 magicnum. ", - 0x280202: "Invalid FAT size ", - 0x280402: "Invalid FAT BPB (BIOS Parameter Block) ", - 0x280602: "Invalid FAT parameter ", - 0x280802: "Invalid FAT sector ", - 0x280A02: "Invalid FAT sector ", - 0x280C02: "Invalid FAT sector ", - 0x280E02: "Invalid FAT sector ", - 0x296A02: "Mountpoint not found ", - 0x2EE202: "Invalid input ", - 0x2EE602: "Path too long ", - 0x2EE802: "Invalid character. ", - 0x2EEA02: "Invalid directory path. ", - 0x2EEC02: "Unable to retrieve directory from path ", - 0x2F5A02: "Offset outside storage ", - 0x313802: "Operation not supported ", - 0x320002: "Permission denied ", - 0x326602: "Missing titlekey(?) required to mount content ", - 0x326E02: "File not closed ", - 0x327002: "Directory not closed ", - 0x327402: "FS allocators already registered ", - 0x327602: "FS allocators already used ", - 0x339402: "File not found. ", - 0x339602: "Directory not found. ", - 0x803: "OS busy ", - 0xE03: "Invalid parameter ", - 0x1003: "Out of memory ", - 0x1203: "Out of resources ", - 0x3EA03: "Invalid handle ", - 0x3EE03: "Invalid memory mirror ", - 0x7FE03: "TLS slot is not allocated ", - 0xA05: "NcaID not found. Returned when attempting to mount titles which exist that aren\'t *8XX titles, the same way *8XX titles are mounted. ", - 0xE05: "TitleId not found ", - 0x1805: "Invalid StorageId ", - 0xDC05: "Gamecard not inserted ", - 0x17C05: "Gamecard not initialized ", - 0x1F405: "Sdcard not inserted ", - 0x20805: "Storage not mounted ", - 0x806: "Converted from error 0xD401 ", - 0x1006: "Converted from error 0xE401 ", - 0x408: "Program location entry not found ", - 0x608: "Invalid context for control location ", - 0x808: "Storage not found ", - 0xA08: "Access denied ", - 0xC08: "Offline manual HTML location entry not found ", - 0xE08: "Title is not registered ", - 0x1008: "Control location entry for host not found ", - 0x1208: "Legal info HTML location entry not found ", - 0x209: "Args too long. ", - 0x409: "Maximum processes loaded. ", - 0x609: "NPDM too big. ", - 0x19009: "Invalid access control sizes in NPDM. ", - 0x809: "Invalid NPDM. ", - 0xA09: "Invalid files. ", - 0xE09: "Already registered. ", - 0x1009: "Title not found. ", - 0x1209: "Title-id in ACI0 doesn\'t match range in ACID. ", - 0x6609: "Invalid memory state/permission ", - 0x6A09: "Invalid NRR ", - 0xA209: "Unaligned NRR address ", - 0xA409: "Bad NRR size ", - 0xAA09: "Bad NRR address ", - 0xAE09: "Bad initialization ", - 0xC809: "Unknown ACI0 descriptor ", - 0xCE09: "ACID/ACI0 don\'t match for descriptor KernelFlags ", - 0xD009: "ACID/ACI0 don\'t match for descriptor SyscallMask ", - 0xD409: "ACID/ACI0 don\'t match for descriptor MapIoOrNormalRange ", - 0xD609: "ACID/ACI0 don\'t match for descriptor MapNormalPage ", - 0xDE09: "ACID/ACI0 don\'t match for descriptor InterruptPair ", - 0xE209: "ACID/ACI0 don\'t match for descriptor ApplicationType ", - 0xE409: "ACID/ACI0 don\'t match for descriptor KernelReleaseVersion ", - 0xE609: "ACID/ACI0 don\'t match for descriptor HandleTableSize ", - 0xE809: "ACID/ACI0 don\'t match for descriptor DebugFlags ", - 0x1940A: "Invalid CMIF header size. ", - 0x1A60A: "Invalid CMIF input header. ", - 0x1A80A: "Invalid CMIF output header. ", - 0x1BA0A: "Invalid method dispatch ID. ", - 0x1D60A: "Invalid in object count. ", - 0x1D80A: "Invalid out object count. ", - 0x25A0A: "Out of domain entries. ", - 0x20B: "Unsupported operation ", - 0xCC0B: "Out of server session memory ", - 0x11A0B: "Went past maximum during marshalling. ", - 0x1900B: "Session doesn\'t support domains. ", - 0x25A0B: "Remote process is dead. ", - 0x3260B: "Unknown request type ", - 0x3D60B: "IPC Query 1 failed. ", - 0x20F: "Pid not found ", - 0x60F: "Process has no pending events ", - 0xA0F: "Application already running ", - 0x410: "Title-id not found ", - 0xF010: "Gamecard sysupdate not required ", - 0x1F610: "Unexpected StorageId ", - 0x215: "Out of processes ", - 0x415: "Not initialized. ", - 0x615: "Max sessions ", - 0x815: "Service already registered ", - 0xA15: "Out of services ", - 0xC15: "Invalid name (all zeroes) ", - 0xE15: "Service not registered ", - 0x1015: "Permission denied ", - 0x1215: "Service Access Control too big. ", - 0x416: "Address space is full ", - 0x616: "NRO already loaded ", - 0x816: "Invalid NRO header values ", - 0xC16: "Bad NRR magic ", - 0x1016: "Reached max NRR count ", - 0x1216: "Unable to verify NRO hash or NRR signature ", - 0x80216: "Address not page-aligned ", - 0x80416: "Incorrect NRO size ", - 0x80816: "NRO not loaded ", - 0x80A16: "NRR not loaded ", - 0x80C16: "Already initialized ", - 0x80E16: "Not initialized ", - 0x41A: "Argument is invalid ", - 0xC81A: "Incorrect buffer size ", - 0xCA1A: "Unknown TZ error ", - 0xD01A: "All AES engines busy ", - 0xD21A: "Invalid AES engine-id ", - 0x19669: "Setting value cannot be NULL ", - 0x1A069: "Null setting value size buffer ", - 0x1A269: "Null debug mode flag buffer ", - 0x1BA69: "Setting group name has zero length ", - 0x1BC69: "Empty settings item key ", - 0x1E269: "Setting group name is too long (64 character limit?) ", - 0x1E469: "Setting name is too long (64 character limit?) ", - 0x20A69: "Setting group name ends with \'.\' or contains invalid characters (allowed: [a-z0-9_\-.]) ", - 0x20C69: "Setting name ends with \'.\' or contains invalid characters (allowed: [a-z0-9_\-.]) ", - 0x4DA69: "Null language code buffer ", - 0x4EE69: "Null network settings buffer ", - 0x4F069: "Null network settings output count buffer ", - 0x50269: "Null backlight settings buffer ", - 0x51669: "Null Bluetooth device setting buffer ", - 0x51869: "Null Bluetooth device setting output count buffer ", - 0x51A69: "Null Bluetooth enable flag buffer ", - 0x51C69: "Null Bluetooth AFH enable flag buffer ", - 0x51E69: "Null Bluetooth boost enable flag buffer ", - 0x52069: "Null BLE pairing settings buffer ", - 0x52269: "Null BLE pairing settings entry count buffer ", - 0x52A69: "Null external steady clock source ID buffer ", - 0x52C69: "Null user system clock context buffer ", - 0x52E69: "Null network system clock context buffer ", - 0x53069: "Null user system clock automatic correction enabled flag buffer ", - 0x53269: "Null shutdown RTC value buffer ", - 0x53469: "Null external steady clock internal offset buffer ", - 0x53E69: "Null account settings buffer ", - 0x55269: "Null audio volume buffer ", - 0x55669: "Null ForceMuteOnHeadphoneRemoved buffer ", - 0x55869: "Null headphone volume warning count buffer ", - 0x55E69: "Invalid audio output mode ", - 0x56069: "Null headphone volume update flag buffer ", - 0x56669: "Null console information upload flag buffer ", - 0x57A69: "Null automatic application download flag buffer ", - 0x57C69: "Null notification settings buffer ", - 0x57E69: "Null account notification settings entry count buffer ", - 0x58069: "Null account notification settings buffer ", - 0x58E69: "Null vibration master volume buffer ", - 0x59069: "Null NX controller settings buffer ", - 0x59269: "Null NX controller settings entry count buffer ", - 0x59469: "Null USB full key enable flag buffer ", - 0x5A269: "Null TV settings buffer ", - 0x5A469: "Null EDID buffer ", - 0x5B669: "Null data deletion settings buffer ", - 0x5CA69: "Null initial system applet program ID buffer ", - 0x5CC69: "Null overlay disp program ID buffer ", - 0x5CE69: "Null IsInRepairProcess buffer ", - 0x5D069: "Null RequiresRunRepairTimeReviser buffer ", - 0x5DE69: "Null device timezone location name buffer ", - 0x5F269: "Null primary album storage buffer ", - 0x60669: "Null USB 3.0 enable flag buffer ", - 0x60869: "Null USB Type-C power source circuit version buffer ", - 0x61A69: "Null battery lot buffer ", - 0x62E69: "Null serial number buffer ", - 0x64269: "Null lock screen flag buffer ", - 0x64669: "Null color set ID buffer ", - 0x64869: "Null quest flag buffer ", - 0x64A69: "Null wireless certification file size buffer ", - 0x64C69: "Null wireless certification file buffer ", - 0x64E69: "Null initial launch settings buffer ", - 0x65069: "Null device nickname buffer ", - 0x65269: "Null battery percentage flag buffer ", - 0x65469: "Null applet launch flags buffer ", - 0x7E869: "Null wireless LAN enable flag buffer ", - 0x7FA69: "Null product model buffer ", - 0x80E69: "Null NFC enable flag buffer ", - 0x82269: "Null ECI device certificate buffer ", - 0x82469: "Null E-Ticket device certificate buffer ", - 0x83669: "Null sleep settings buffer ", - 0x84A69: "Null EULA version buffer ", - 0x84C69: "Null EULA version entry count buffer ", - 0x85E69: "Null LDN channel buffer ", - 0x87269: "Null SSL key buffer ", - 0x87469: "Null SSL certificate buffer ", - 0x88669: "Null telemetry flags buffer ", - 0x89A69: "Null Gamecard key buffer ", - 0x89C69: "Null Gamecard certificate buffer ", - 0x8AE69: "Null PTM battery lot buffer ", - 0x8B069: "Null PTM fuel gauge parameter buffer ", - 0x8C269: "Null ECI device key buffer ", - 0x8C469: "Null E-Ticket device key buffer ", - 0x8D669: "Null speaker parameter buffer ", - 0x8EA69: "Null firmware version buffer ", - 0x8EC69: "Null firmware version digest buffer ", - 0x8EE69: "Null rebootless system update version buffer ", - 0x8FE69: "Null Mii author ID buffer ", - 0x91269: "Null fatal flags buffer ", - 0x92669: "Null auto update enable flag buffer ", - 0x93A69: "Null external RTC reset flag buffer ", - 0x94E69: "Null push notification activity mode buffer ", - 0x96269: "Null service discovery control setting buffer ", - 0x97669: "Null error report share permission buffer ", - 0x98A69: "Null LCD vendor ID buffer ", - 0x99E69: "Null console SixAxis sensor acceleration bias buffer ", - 0x9A069: "Null console SixAxis sensor angular velocity bias buffer ", - 0x9A269: "Null console SixAxis sensor acceleration gain buffer ", - 0x9A469: "Null console SixAxis sensor angular velocity gain buffer ", - 0x9A669: "Null console SixAxis sensor angular velocity time bias buffer ", - 0x9A869: "Null console SixAxis sensor angular acceleration buffer ", - 0x9B269: "Null keyboard layout buffer ", - 0x9BA69: "Invalid keyboard layout ", - 0x9C669: "Null web inspector flag buffer ", - 0x9C869: "Null allowed SSL hosts buffer ", - 0x9CA69: "Null allowed SSL hosts entry count buffer ", - 0x9CC69: "Null host FS mount point buffer ", - 0x9EE69: "Null Amiibo key buffer ", - 0x9F069: "Null Amiibo ECQV certificate buffer ", - 0x9F269: "Null Amiibo ECDSA certificate buffer ", - 0x9F469: "Null Amiibo ECQV BLS key buffer ", - 0x9F669: "Null Amiibo ECQV BLS certificate buffer ", - 0x9F869: "Null Amiibo ECQV BLS root certificate buffer ", - 0x272: "Generic error ", - 0xCC74: "Time not set ", - 0x287C: "Argument is NULL ", - 0x2C7C: "Argument is invalid ", - 0x3C7C: "Bad input buffer size ", - 0x407C: "Invalid input buffer ", - 0x4680: "Error while launching applet. ", - 0x4A80: "Title-ID not found. Caused by code 0x410 when applet launch fails ", - 0x3E880: "Invalid IStorage size (negative?) ", - 0x3EC80: "IStorage has already been opened by another accessor ", - 0x3EE80: "IStorage Read/Write out-of-bounds ", - 0x3FE80: "IStorage opened as wrong type (data opened as transfermem, transfermem opened as data) ", - 0x4B080: "Failed to allocate memory for IStorage ", - 0x59080: "Thread stack pool exhausted (out of memory) ", - 0x7A880: "am.debug!dev_function setting needs to be set ", - 0xA83: "Unrecognized applet ID ", - 0x3CF089: "Unknown/invalid libcurl error. ", - 0x68A: "Not initialized. ", - 0x668C: "USB data-transfer in progress ", - 0xD48C: "Invalid descriptor ", - 0x1928C: "USB device not bound / interface already enabled ", - 0x299: "Invalid audio device ", - 0x499: "Operation couldn\'t complete successfully ", - 0x699: "Invalid sample rate ", - 0x899: "Buffer size too small ", - 0x1099: "Too many buffers are still unreleased ", - 0x1499: "Invalid channel count ", - 0x40299: "Invalid/Unsupported operation ", - 0xC0099: "Invalid handle ", - 0xC0899: "Audio output was already started ", - 0x3C9D: "Address is NULL ", - 0x3E9D: "PID is NULL ", - 0x549D: "Already bound ", - 0xCC9D: "Invalid PID ", - 0xAA3: "System is booting up repair process without VOL+ held down. ", - 0xCA3: "System is booting up repair process that requires RepairTimeReviser but does not have special cartridge inserted. ", - 0xF0CD: "IR image data not available/ready. ", - 0x35B: "Failed to init SM. ", - 0x55B: "Failed to init FS. ", - 0x75B: "Failed to to open NRO file. May also happen when SD card isn\'t inserted / SD mounting failed earlier. ", - 0x95B: "Failed to read NRO header. ", - 0xB5B: "Invalid NRO magic. ", - 0xD5B: "Invalid NRO segments. ", - 0xF5B: "Failed to read NRO. ", - 0x135B: "Failed to allocate heap. ", - 0x255B: "Failed to map code-binary memory. ", - 0x275B: "Failed to map code memory (.text). ", - 0x295B: "Failed to map code memory (.rodata). ", - 0x2B5B: "Failed to map code memory (.data+.bss). ", - 0x315B: "Failed to unmap code memory (.text). ", - 0x335B: "Failed to unmap code memory (.rodata). ", - 0x355B: "Failed to unmap code memory (.data+.bss). ", - - # FS Codes - - 0xD401: "Error: Passed buffer is not usable for fs library. ", - 0x177A02: "Error: Specified value is out of range. ", - 0x2F5C02: "Error: Invalid size was specified.", - 0x2F5E02: "Error: Null pointer argument was specified. ", - 0x2EE002: "Error: Precondition violation. ", - 0x307202: "Error: OpenMode_AllowAppend is required for implicit extension of file size by WriteFile(). ", - 0x346402: "Error: Enough journal space is not left. ", - 0x346A02: "Error: The open count of files and directories reached the limitation. ", - - # Fatal - - 0x4A2: "Can be triggered by running svcBreak. The svcBreak params have no affect on the value of the thrown error-code.", - 0xA8: "Userland ARM undefined instruction exception", - 0x2A8: "Userland ARM prefetch-abort due to PC set to non-executable region", - 0x4A8: "Userland ARM data abort. Also caused by abnormal process termination via svcExitProcess. Note: directly jumping to nnMain()-retaddr from non-main-thread has the same result.", - 0x6A8: "Userland PC address not aligned to 4 bytes ", - 0x10A8: "Can occur when attempting to call an svc outside the whitelist ", - - # Libnx Errors from libnx/result.h - - # - Normal - - 0x359: "LibnxError_BadReloc", - 0x559: "LibnxError_OutOfMemory", - 0x759: "LibnxError_AlreadyMapped", - 0x959: "LibnxError_BadGetInfo_Stack", - 0xB59: "LibnxError_BadGetInfo_Heap", - 0xD59: "LibnxError_BadQueryMemory", - 0xF59: "LibnxError_AlreadyInitialized", - 0x1159: "LibnxError_NotInitialized", - 0x1359: "LibnxError_NotFound", - 0x1559: "LibnxError_IoError", - 0x1759: "LibnxError_BadInput", - 0x1959: "LibnxError_BadReent", - 0x1B59: "LibnxError_BufferProducerError", - 0x1D59: "LibnxError_HandleTooEarly", - 0x1F59: "LibnxError_HeapAllocFailed", - 0x2159: "LibnxError_TooManyOverrides", - 0x2359: "LibnxError_ParcelError", - 0x2559: "LibnxError_BadGfxInit", - 0x2759: "LibnxError_BadGfxEventWait", - 0x2959: "LibnxError_BadGfxQueueBuffer", - 0x2B59: "LibnxError_BadGfxDequeueBuffer", - 0x2D59: "LibnxError_AppletCmdidNotFound", - 0x2F59: "LibnxError_BadAppletReceiveMessage", - 0x3159: "LibnxError_BadAppletNotifyRunning", - 0x3359: "LibnxError_BadAppletGetCurrentFocusState", - 0x3559: "LibnxError_BadAppletGetOperationMode", - 0x3759: "LibnxError_BadAppletGetPerformanceMode", - 0x3959: "LibnxError_BadUsbCommsRead", - 0x3B59: "LibnxError_BadUsbCommsWrite", - 0x3D59: "LibnxError_InitFail_SM", - 0x3F59: "LibnxError_InitFail_AM", - 0x4159: "LibnxError_InitFail_HID", - 0x4359: "LibnxError_InitFail_FS", - 0x4559: "LibnxError_BadGetInfo_Rng", - 0x4759: "LibnxError_JitUnavailable", - 0x4959: "LibnxError_WeirdKernel", - 0x4B59: "LibnxError_IncompatSysVer", - 0x4D59: "LibnxError_InitFail_Time", - 0x4F59: "LibnxError_TooManyDevOpTabs", - 0x5159: "LibnxError_DomainMessageUnknownType", - 0x5359: "LibnxError_DomainMessageTooManyObjectIds", - 0x5559: "LibnxError_AppletFailedToInitialize", - 0x5759: "LibnxError_ApmFailedToInitialize", - 0x5959: "LibnxError_NvinfoFailedToInitialize", - 0x5B59: "LibnxError_NvbufFailedToInitialize", - 0x5D59: "LibnxError_LibAppletBadExit", - - # - Libnx Binder - - 0x35D: "LibnxBinderError_Unknown", - 0x55D: "LibnxBinderError_NoMemory", - 0x75D: "LibnxBinderError_InvalidOperation", - 0x95D: "LibnxBinderError_BadValue", - 0xB5D: "LibnxBinderError_BadType", - 0xD5D: "LibnxBinderError_NameNotFound", - 0xF5D: "LibnxBinderError_PermissionDenied", - 0x115D: "LibnxBinderError_NoInit", - 0x135D: "LibnxBinderError_AlreadyExists", - 0x155D: "LibnxBinderError_DeadObject", - 0x175D: "LibnxBinderError_FailedTransaction", - 0x195D: "LibnxBinderError_BadIndex", - 0x1B5D: "LibnxBinderError_NotEnoughData", - 0x1D5D: "LibnxBinderError_WouldBlock", - 0x1F5D: "LibnxBinderError_TimedOut", - 0x215D: "LibnxBinderError_UnknownTransaction", - 0x235D: "LibnxBinderError_FdsNotAllowed", - - # - LibNX Nvidia - - 0x35C: "LibnxNvidiaError_Unknown", - 0x55C: "LibnxNvidiaError_NotImplemented", - 0x75C: "LibnxNvidiaError_NotSupported", - 0x95C: "LibnxNvidiaError_NotInitialized", - 0xB5C: "LibnxNvidiaError_BadParameter", - 0xD5C: "LibnxNvidiaError_Timeout", - 0xF5C: "LibnxNvidiaError_InsufficientMemory", - 0x115C: "LibnxNvidiaError_ReadOnlyAttribute", - 0x135C: "LibnxNvidiaError_InvalidState", - 0x155C: "LibnxNvidiaError_InvalidAddress", - 0x175C: "LibnxNvidiaError_InvalidSize", - 0x195C: "LibnxNvidiaError_BadValue", - 0x1B5C: "LibnxNvidiaError_AlreadyAllocated", - 0x1D5C: "LibnxNvidiaError_Busy", - 0x1F5C: "LibnxNvidiaError_ResourceError", - 0x215C: "LibnxNvidiaError_CountMismatch", - 0x235C: "LibnxNvidiaError_SharedMemoryTooSmall", - 0x255C: "LibnxNvidiaError_FileOperationFailed", - 0x275C: "LibnxNvidiaError_IoctlFailed", - - # Non-SwitchBrew Error Codes - Should probably add them to SwitchBrew if you read this - - 0x7E12B: 'Eshop connection failed', - 0x39D689: 'CDN Ban', - 0x3E8E7C: 'Error in account login/creation', - 0x3E8EA0: 'Failed connection test', - 0x1F4E7C: '(normal) console ban', - 0x27EE7C: '(potential) complete account ban', # This error is still super new, needs more informations - 0x36B72B: "Access token expired", - 0x1F486E: "Internet connection lost because the console entered sleep mode.", - # 0x3E8E89: 'Failed to access Firmware Updates - Often because of DNS!', - # ^ Also used by libcurl - - # Atmosphere - - 0xCAFEF: "Atmosphere: Version Mismatch", - - # SwitchPresence - - 0x337: "Error_InitSocket", - 0x537: "Error_Listen", - 0x737: "Error_Accepting", - 0x937: "Error_ListAppFailed", - 0xb37: "Error_InvalidMagic", - 0xd37: "Error_CmdIdNotConfirm", - 0xf37: "Error_CmdIdNotSendBuff", - 0x1137: "Error_RecData", - 0x1337: "Error_SendData", - 0x1537: "Error_InitNS", - 0x1737: "Error_InitACC", - 0x1937: "Error_GetControlData", - 0x1b37: "Error_InvalidControlSize", - 0x1d37: "Error_GetAciveUser", - 0x1f37: "Error_GetProfile", - 0x2137: "Error_ProfileGet", - 0x2337: "Error_InitPMDMNT", - 0x2537: "Error_GetAppPid", - 0x2737: "Error_GetProcessTid", - 0x2937: "Error_InitPMINFO", - 0x2b37: "Error_GetPidList", - 0x2d37: "Error_GetDebugProc", - 0x2f37: "Error_CloseHandle", - - 0xDEADBEEF: "Congrats, you found some hexspeak \n \n https://www.youtube.com/watch?v=DLzxrzFCyOs" - } - - known_errcode_ranges = { - # NIM - 137: [ - [8001, 8096, 'libcurl error 1-96. Some of the libcurl errors in the error-table map to the above unknown-libcurl-error however.'], - ], - - # FS - 2: [ - [2000, 2499, "Error: Failed to access SD card."], - [2500, 2999, "Error: Failed to access game card. "], - [3500, 3999, "Error: Failed to access MMC. "], - [4001, 4299, "Error: ROM is corrupted. "], - [4301, 4499, "Error: Save data is corrupted."], - [4501, 4599, "Error: NCA is corrupted."], - [4601, 4639, "Error: Integrity verification failed."], - [4641, 4659, "Error: Partition FS is corrupted."], - [4661, 4679, "Error: Built-in-storage is corrupted."], - [4681, 4699, "Error: FAT FS is corrupted."], - [4701, 4719, "Error: HOST FS is corrupted."], - [5000, 5999, "Error: Unexpected failure occurred."], - [6002, 6029, "Error: Invalid path was specified."], - [6001, 6199, "Error: Invalid argument was specified."], - [6202, 6299, "Error: Invalid operation for the open mode."], - [6300, 6399, "Error: Unsupported operation."], - [6400, 6499, "Error: Permission denied."], - ], - - # NIFM Support Page Links - 110: [ - [2900, 2999, "https://en-americas-support.nintendo.com/app/answers/detail/a_id/22277/p/897"], - [2000, 2899, "https://en-americas-support.nintendo.com/app/answers/detail/a_id/22263/p/897"], - ] - } - - # Game Erros - Strings because Nintendo decided that it would be useless to put them into normal ints ;^) - # Attention: These need to be formatted -> : ": " - Also Nintendo support codes - nin_err = { - # Splatoon 2 - "2-AAB6A-3400": "Splatoon 2: A kick from online due to exefs/romfs edits.", - - # Youtube - "2-ARVHA-0000": "Youtube: Unknown Error", - - # Nintendo Support Page - "2005-0003": "This error code may indicate an issue related to the microSD card being used. (https://en-americas-support.nintendo.com/app/answers/detail/a_id/22393/kw/2005-0003)", - "2110-1100": "This error code typically indicates that the Nintendo Switch console was unable to detect a network which matches any of the saved networks within the Internet settings. (https://en-americas-support.nintendo.com/app/answers/detail/a_id/22780/kw/2110-1100)", - "2618-0516": "This error code generally indicates that your network is not optimal for peer to peer connections, likely due to your network's NAT type. (https://en-americas-support.nintendo.com/app/answers/detail/a_id/25855/kw/2618-0516)", - "2110-2003": "Error codes in this range generally indicate an error occurred when the Nintendo Switch console attempted to initially connect to a wireless router (usually prior to obtaining an IP address). (https://en-americas-support.nintendo.com/app/answers/detail/a_id/27023/kw/2110-2003)", - "2813-6838": "You are unable to redeem a Nintendo eShop Card (https://en-americas-support.nintendo.com/app/answers/detail/a_id/22630/kw/2813-6838)", - "2813-6561": "In most cases, this error indicates the Nintendo eShop card or download code was entered incorrectly, or was intended for a different region's Nintendo eShop. (https://en-americas-support.nintendo.com/app/answers/detail/a_id/25870/kw/2813-6561)", - "2618-0513": "This error code generally indicates that your network is not optimal for peer to peer connections, this may be due to the ISP, Internet connection speeds, or due to your network's NAT type. (https://en-americas-support.nintendo.com/app/answers/detail/a_id/25980/kw/2618-0513)", - "2618-0201": "This error may be the result your connection timing out due to a slow Internet service or a poor wireless environment. (https://en-americas-support.nintendo.com/app/answers/detail/a_id/25866/kw/2618-0201)", - "2002-0001": "An error code is received when powering up the Nintendo Switch console, or when coming out of sleep mode. (https://en-americas-support.nintendo.com/app/answers/detail/a_id/27167/kw/2002-0001)", - "2124-4517": "Console banned due to a breach of the user agreements. You cannot ask how to fix this issue here. (https://en-americas-support.nintendo.com/app/answers/detail/a_id/43652/kw/2124-4517)", - "2181-4017": "Console banned due to a breach of the user agreements. You cannot ask how to fix this issue here. (https://en-americas-support.nintendo.com/app/answers/detail/a_id/43653/kw/2181-4017)", - "2147-4508": "Console permanently banned due to a breach of the user agreements. You cannot ask how to fix this issue here. (https://en-americas-support.nintendo.com/app/answers/detail/a_id/28046/kw/2147-4508)", - "2147-4007": "Console permanently banned due to a breach of the user agreements. You cannot ask how to fix this issue here. (https://en-americas-support.nintendo.com/app/answers/detail/a_id/28046/kw/2147-4007)", - "2181-4008": "Console permanently banned due to a breach of the user agreements. You cannot ask how to fix this issue here. (https://en-americas-support.nintendo.com/app/answers/detail/a_id/42061/kw/2181-4008)", - "2124-4007": "Console permanently banned due to a breach of the user agreements. You cannot ask how to fix this issue here. (https://en-americas-support.nintendo.com/app/answers/detail/a_id/28046/kw/2124-4007)", - "2124-4508": "Console permanently banned due to a breach of the user agreements. You cannot ask how to fix this issue here. (https://en-americas-support.nintendo.com/app/answers/detail/a_id/28046/kw/2124-4508)", #I have no clue why there are so many of these - "2813-1470": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/26362/kw/2813-1470", - "2811-5001": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/22392/kw/2811-5001", - "2110-3127": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/22567/kw/2110-3127", - "9001-0026": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/27311/kw/9001-0026", - "2124-8006": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/25858/kw/2124-8006", - "2124-8007": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/25858/kw/2124-8007", - "2137-8006": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/22493/kw/2137-8006", - "2155-8007": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/42264/kw/2155-8007", - "2811-1006": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/25859/kw/2811-1006", - "2813-0055": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/27056/kw/2813-0055", - "2137-8056": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/28910/kw/2137-8056", - "2618-0502": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/25865/kw/2618-0502", - "2618-0501": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/25865/kw/2618-0501", - "2162-0002": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/22596/kw/2162-0002", - "2137-8035": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/22298/kw/2137-8035", - "2618-0006": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/25856/kw/2618-0006", - "2016-0641": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/27004/kw/2016-0641", - "2016-0247": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/22720/kw/2016-0247", - "2124-8028": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/22443/kw/2124-8028", - "2811-1028": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/22503/kw/2811-1028", - "2306-0303": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/42878/kw/2306-0303", - "2123-0301": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/28291/kw/2123-0301", - "2168-0002": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/22518/kw/2168-0002", - "2160-8007": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/28530/kw/2160-8007", - "2160-8006": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/28530/kw/2160-8006", - "2101-0001": "https://en-americas-support.nintendo.com/app/answers/detail/a_id/22624/kw/2101-0001", - # If somebody wants to continue this: https://en-americas-support.nintendo.com/app/answers/list/st/5/kw/error%20code/p/897/page/5 - } - - def get_name(self, d, k): - if k in d: - return f'{d[k]} ({k})' - else: - return f'{k}' - - @commands.command() - async def serr(self, ctx, err: str): - """ - Parses Nintendo Switch error codes according to http://switchbrew.org/index.php?title=Error_codes. - - Example: - .serr 1A80A - .serr 0xDC05 - .serr 2005-0110 - """ - # Normal Errors that follow the standard guidelines - if re.match(r'[0-9][0-9][0-9][0-9]\-[0-9][0-9][0-9][0-9]', err): - module = int(err[0:4]) - 2000 - desc = int(err[5:9]) - errcode = (desc << 9) + module - elif err in self.nin_err: - await ctx.send(embed=discord.Embed(title="Game / Support Page Error Code", description=f"**Description:** {self.nin_err[err]}")) - return - else: - if err.startswith("0x"): - err = err[2:] - try: - errcode = int(err, 16) - except ValueError: - await ctx.send("Invalid Switch error code!") - return - module = errcode & 0x1FF - desc = (errcode >> 9) & 0x3FFF - str_errcode = f'{module + 2000:04}-{desc:04}' - explanation = '' - if errcode in self.known_errcodes: - explanation += self.known_errcodes[errcode] + '\n\n' - elif module in self.known_errcode_ranges: - for errcode_range in self.known_errcode_ranges[module]: - if errcode_range[0] <= desc <= errcode_range[1]: - explanation += errcode_range[2] + '\n\n' - # Game / Support Errors because they are either special or I'm just lazy - elif err in self.nin_err: - await ctx.send(embed=discord.Embed(title="Game / Support Page Error Code", description=f"**Description:** {self.nin_err[err]}")) - return - # Return back to normal guidelines - else: - explanation = "It seems like your error code is unknown. You should report relevant details to [the Kurisu repository](https://github.com/nh-server/Kurisu/issues) so it can be added to the bot. \n \n" - explanation += 'Module: ' + self.get_name(self.modules, module) - explanation += f'\nDescription: {desc}' - embed = discord.Embed(title=f'0x{errcode:X} / {str_errcode}', description=explanation) - await ctx.send(embed=embed) - - @commands.command() - async def err2hex(self, ctx, err: str): - if not re.match(r'[0-9][0-9][0-9][0-9]\-[0-9][0-9][0-9][0-9]', err): - await ctx.send('Does not follow XXXX-XXXX format') - else: - module = int(err[0:4]) - 2000 - desc = int(err[5:9]) - errcode = (desc << 9) + module - await ctx.send(f'0x{errcode:X}') - - @commands.command() - async def hex2err(self, ctx, err: str): - if err.startswith("0x"): - err = err[2:] - err = int(err, 16) - module = err & 0x1FF - desc = (err >> 9) & 0x3FFF - errcode = f'{module + 2000:04}-{desc:04}' - await ctx.send(errcode) - - -def setup(bot): - bot.add_cog(NXErr(bot)) diff --git a/cogs/results/__init__.py b/cogs/results/__init__.py new file mode 100644 index 000000000..808f62078 --- /dev/null +++ b/cogs/results/__init__.py @@ -0,0 +1,138 @@ +import discord +from discord.ext import commands + +from . import switch, wiiu, ctr, types + + +class Results(commands.Cog): + """ + Parses game console result codes. + """ + def fetch(self, error): + if ctr.is_valid(error): + return ctr.get(error) + if wiiu.is_valid(error): + return wiiu.get(error) + if switch.is_valid(error): + return switch.get(error) + + # Console name, module name, result, color + return None, None, None, types.WARNING_COLOR + + def err2hex(self, error, suppress_error=False): + # If it's already hex, just return it. + if self.is_hex(error): + return error + + # Only Switch is supported. The other two can only give nonsense results. + if switch.is_valid(error): + return switch.err2hex(error, suppress_error) + + if not suppress_error: + return 'Invalid or unsupported error code format. \ +Only Nintendo Switch XXXX-YYYY formatted error codes are supported.' + + def hex2err(self, error): + # Don't bother processing anything if it's not hex. + if self.is_hex(error): + if ctr.is_valid(error): + return ctr.hex2err(error) + if wiiu.is_valid(error): + return wiiu.hex2err(error) + if switch.is_valid(error): + return switch.hex2err(error) + return 'This isn\'t a hexadecimal value!' + + def fixup_input(self, user_input): + # Truncate input to 16 chars so as not to create a huge embed or do + # eventual regex on a huge string. If we add support for consoles that + # that have longer error codes, adjust accordingly. + user_input = user_input[:16] + + # Fix up hex input if 0x was omitted. It's fine if it doesn't convert. + try: + user_input = hex(int(user_input, 16)) + except ValueError: + pass + + return user_input + + def is_hex(self, user_input): + try: + user_input = hex(int(user_input, 16)) + except ValueError: + return False + return True + + def check_meme(self, err: str) -> str: + memes = { + '0xdeadbeef': 'you sure you want to eat that?', + '0xdeadbabe': 'i think you have bigger problems if that\'s the case', + '0x8badf00d': 'told you not to eat it' + } + return memes.get(err.casefold()) + + @commands.command(aliases=['nxerr', 'serr', 'err', 'res']) + async def result(self, ctx, err: str): + """ + Displays information on game console result codes, with a fancy embed. + 0x prefix is not required for hex input. + + Examples: + .err 0xD960D02B + .err D960D02B + .err 022-2634 + .err 102-2804 + .err 2168-0002 + .err 2-ARVHA-0000 + """ + err = self.fixup_input(err) + if (meme := self.check_meme(err)) is not None: + return await ctx.send(meme) + + system_name, module_name, error, color = self.fetch(err) + + if error: + if self.is_hex(err): + err_str = self.hex2err(err) + else: + err_str = self.err2hex(err, True) + + err_disp = f'{err}{"/" + err_str if err_str else ""}' + embed = discord.Embed(title=f"{err_disp} ({system_name})") + embed.add_field(name="Module", value=module_name, inline=False) + + if error.summary is not None: + embed.add_field(name="Summary", value=error.summary, inline=False) + if error.level is not None: + embed.add_field(name="Level", value=error.level, inline=False) + + embed.add_field(name="Description", value=error.description, inline=False) + + if error.support_url: + embed.add_field(name="Further information", value=error.support_url, inline=False) + + if error.is_ban: + embed.add_field( + name="Console, account and game bans", + value="Nintendo Homebrew does not provide support \ +for unbanning. Please do not ask for further assistance with this.") + embed.color = color if not error.is_ban else types.WARNING_COLOR + await ctx.send(embed=embed) + else: + await ctx.send(f'{ctx.author.mention}, the code you entered is \ +invalid or is for a system I don\'t have support for.') + + @commands.command(name='err2hex') + async def cmderr2hex(self, ctx, error: str): + error = self.fixup_input(error) + return await ctx.send(self.err2hex(error)) + + @commands.command(name='hex2err') + async def cmdhex2err(self, ctx, error: str): + error = self.fixup_input(error) + return await ctx.send(self.hex2err(error)) + + +def setup(bot): + bot.add_cog(Results(bot)) diff --git a/cogs/results/ctr.py b/cogs/results/ctr.py new file mode 100644 index 000000000..d0d7d858c --- /dev/null +++ b/cogs/results/ctr.py @@ -0,0 +1,472 @@ +import re + +from .types import Module, ResultCode, UNKNOWN_MODULE, UNKNOWN_ERROR, NO_RESULTS_FOUND + +""" +This file contains all currently known 2DS/3DS result and error codes. +There may be inaccuracies here; we'll do our best to correct them +when we find out more about them. It is also worth noting that apparently Nintendo +loved to use random modules for some of these error codes, due to the reporting +modules not making much sense (e.g., kernel reporting an internet authentication + server error...). + +A result code is a 32-bit integer returned when calling various commands in the +3DS's operating system, Horizon. Its breaks down like so: + + Bits | Description +------------------- +00-09 | Description +10-17 | Module +21-26 | Summary +27-31 | Level + +Description: A value indicating exactly what happened. +Module: A value indicating who raised the error or returned the result. +Summary: A value indicating a shorter description of what happened. +Level: A value indicating the severity of the issue (fatal, temporary, etc.). + +The 3DS makes it simple by providing all of these values directly. Other +consoles, such as the Wii U and Switch do not provide summaries or levels, so +those fields in the ResultCode class are re-used for other similar purposes. + +To add a module so the code understands it, simply add a new module number +to the 'modules' dictionary, with a Module variable as the value. If the module +has no known error codes, simply add a dummy Module instead (see the dict for +more info). See the various module variables for a more in-depth example + on how to make one. + +Once you've added a module, or you want to add a new result code to an existing +module, add a new description value (for 3DS it's the 4 digit number after the dash) +as the key, and a ResultCode variable with a text description of the error or result. +You can also add a second string to the ResultCode to designate a support URL if +one exists. Not all results or errors have support webpages. + +Simple example of adding a module with a sample result code: +test = Module('test', { + 5: ResultCode('test', 'https://example.com') +}) + +modules = { + 9999: test +} + +Sources used to compile these results and information: +https://www.3dbrew.org/wiki/Error_codes +Kurisu's previous err.py module + +TODO: Add a number of result codes that were in the previous result code Kurisu +used. They were left out for the sake of getting this initial code done faster. +""" + +common = Module('common', { + 0: ResultCode('Success'), + 1000: ResultCode('Invalid selection'), + 1001: ResultCode('Too large'), + 1002: ResultCode('Not authorized'), + 1003: ResultCode('Already done'), + 1004: ResultCode('Invalid size'), + 1005: ResultCode('Invalid enum value'), + 1006: ResultCode('Invalid combination'), + 1007: ResultCode('No data'), + 1008: ResultCode('Busy'), + 1009: ResultCode('Misaligned address'), + 1010: ResultCode('Misaligned size'), + 1011: ResultCode('Out of memory'), + 1012: ResultCode('Not implemented'), + 1013: ResultCode('Invalid address'), + 1014: ResultCode('Invalid pointer'), + 1015: ResultCode('Invalid handle'), + 1016: ResultCode('Not initialized'), + 1017: ResultCode('Already initialized'), + 1018: ResultCode('Not found'), + 1019: ResultCode('Cancel requested'), + 1020: ResultCode('Already exists'), + 1021: ResultCode('Out of range'), + 1022: ResultCode('Timeout'), + 1023: ResultCode('Invalid result value') +}) + +kernel = Module('kernel', { + 2: ResultCode('Invalid memory permissions.') +}) + +util = Module('util', { + 102: ResultCode('This console is permanently banned by Nintendo.', is_ban=True), + 107: ResultCode('This console is temporarily (?) banned by Nintendo.', is_ban=True), + 119: ResultCode('System update is required. This is typically shown when the friends module is outdated.'), + 120: ResultCode('Game or title update is required. This is typically shown when the title you\'re trying to launch is outdated.'), + 121: ResultCode('Local friend code SEED has invalid signature. This should only happen if it has been modified.', is_ban=True), + 123: ResultCode('This console is permanently banned by Nintendo.', is_ban=True) +}) + +fssrv = Module('file server', { + 1099: ResultCode('Access point with given SSID not found.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/4249/kw/003-1099'), + 2001: ResultCode('DNS error. If you\'re using a custom DNS server, make sure the settings are correct.') +}) + +os = Module('os', { + 10: ResultCode('Not enough memory.'), + 26: ResultCode('Session closed by remote.'), + 47: ResultCode('Invalid command header.') +}) + +pdn = Module('pdn', { + 1000: ResultCode('System update required (friends module?).'), + 2913: ResultCode('NIM HTTP error, so the server is probably down. Try again later.'), + 2916: ResultCode('NIM HTTP error, so the server is probably down. Try again later.'), + 2920: ResultCode('Title has an invalid ticket. Delete the title and/or its ticket in FBI and install it again from a legitimate source like the Nintendo eShop, or from your game cartridges if using cart dumps.'), + 4079: ResultCode('Unable to access SD card.'), + 4998: ResultCode('Local content is newer. Unknown what causes this.'), + 6106: ResultCode('AM error in NIM. Bad ticket is likely.'), + 8401: ResultCode('The update data is corrupted. Delete it and reinstall.') +}) + +i2c = Module('i2c', { + 3021: ResultCode('Cannot find title on Nintendo eShop (incorrect region, or never existed?).'), + 3136: ResultCode('Nintendo eShop is currently unavailable. Try again later.'), + 6901: ResultCode('This console is permanently banned by Nintendo (displayed in Japanese for some reason).', is_ban=True) +}) + +gpio = Module('gpio', { + 1511: ResultCode('Certificate warning.') +}) + +codec = Module('codec', { + 16: ResultCode('Both consoles have the same movable.sed key. Format the target console and system transfer again.'), + 62: ResultCode('An error occurred during system transfer. Move closer to the wireless router and try again.') +}) + +fs = Module('fs', { + 101: ResultCode('Archive not mounted or mount-point not found.'), + 120: ResultCode('Title or object not found.'), + 141: ResultCode('Gamecard not inserted.'), + 230: ResultCode('Invalid open flags or permissions.'), + 391: ResultCode('NCCH hash check failed.'), + 302: ResultCode('RSA or AES-MAC verification failed.'), + 395: ResultCode('RomFS or Savedata hash check failed.'), + 630: ResultCode('Command not allowed, or missing permissions.'), + 702: ResultCode('Invalid path.'), + 761: ResultCode('Incorrect ExeFS read size.'), + (100, 179): ResultCode('[Media] not found.'), + (180, 199): ResultCode('Exists already.'), + (200, 219): ResultCode('Not enough space.'), + (220, 229): ResultCode('Invalidated archive.'), + (230, 339): ResultCode('Unacceptable or write protected.'), + (360, 389): ResultCode('Bad format.'), + (390, 399): ResultCode('Verification failure.'), + (600, 629): ResultCode('Out of resources.'), + (630, 660): ResultCode('Access denied.'), + (700, 729): ResultCode('Invalid argument.'), + (730, 749): ResultCode('Not initialized.'), + (750, 759): ResultCode('Already initialized.'), + (760, 779): ResultCode('Not supported.') +}) + +pm = Module('pm', { + 2452: ResultCode('Tried to access the eShop with UNITINFO patch enabled. Turn it off in Luma\'s options.'), + 2501: ResultCode('NNID is already linked to another system. This can be the result of using System Transfer (where all NNIDs associated with the system are moved, whether they are currently linked or not), restoring the source console\'s NAND, and then attempting to use applications which require an NNID.'), + 2511: ResultCode('System update required (displayed by Miiverse?).'), + 2613: ResultCode('Incorrect email or password when attempting to link an existing NNID. Can also happen if the NNID is already linked to another system, or if you attempt to download an application from the eShop without a linked NNID on the console.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/4314/kw/022-2613'), + 2631: ResultCode('The NNID you are attempting to use has been deleted, or is unusable due to a System Transfer. A transferred NNID will only work on the target system.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/4285/kw/022-2631'), + 2633: ResultCode('NNID is temporarily locked due to too many incorrect password attempts. Try again later.'), + 2634: ResultCode('NNID is not correctly linked on this console.', '[To fix it, follow these steps. Afterwards, reboot and sign into your NNID again.](https://3ds.hacks.guide/godmode9-usage#removing-an-nnid-without-formatting-your-device)'), + 2812: ResultCode('This console is permanently banned by Nintendo for playing Pokémon Sun & Moon online before the release date illegally.', is_ban=True), + 2815: ResultCode('This console is banned from accessing Miiverse by Nintendo.'), + 5515: ResultCode('Network timeout.'), +}) + +srv = Module('srv', { + 5: ResultCode('Invalid string length (service name length is zero or longer than 8 chars).'), + 6: ResultCode('Access to service denied (requested a service the application does not have access to).'), + 7: ResultCode('String size does not match contents (service name contains unexpected null byte).') +}) + +am = Module('am', { + 4: ResultCode('Invalid ticket version.'), + 32: ResultCode('Empty CIA.'), + 37: ResultCode('Invalid NCCH.'), + 39: ResultCode('Invalid title version.'), + 43: ResultCode('Database doesn\'t exist, or it failed to open.'), + 44: ResultCode('Trying to uninstall system-app.'), + 106: ResultCode('Invalid signature/CIA.'), + 393: ResultCode('Invalid database.'), + 1820: ResultCode('Displayed when the browser asks if you want to go to to a potentially dangerous website. Press \'yes\' to continue if you feel it is safe.') +}) + +http = Module('http', { + 105: ResultCode('Request timed out.') +}) + +nim = Module('nim', { + # Temporary value to remove the "no known error codes for this module" + # message. We *do* know about some of NIM's weird error codes, but they + # do not all fit nicely here. + 65535: ResultCode('Placeholder value hack. This should never be displayed.') +}) + +avd = Module('avd', { + 212: ResultCode('Game is permanently banned from Pokémon Global Link for using altered or illegal save data.', is_ban=True) +}) + +mvd = Module('mvd', { + 271: ResultCode('Invalid configuration.') +}) + +qtm = Module('qtm', { + 8: ResultCode('Camera is already in use or busy.') +}) + +# This is largely a dummy module, but FBI errors often get passed through the bot +# which return incorrect error strings. Since there's not really a feasible way to figure out the +# application which is throwing the error, this is the best compromise without giving the user +# false information. +application = Module('application-specific error', { + (0, 9999): ResultCode('The application raised an error. Please consult the application\'s source code or ask the author for assistance with it.') +}) + +# We have some modules partially documented, those that aren't have dummy Modules. +modules = { + 0: common, + 1: kernel, + 2: util, + 3: fssrv, + 4: Module('loader server'), + # Module 5 is deliberately left out due to needing specific hack logic... + 6: os, + 7: Module('dbg'), + 8: Module('dmnt'), + 9: pdn, + 10: Module('gsp'), + 11: i2c, + 12: gpio, + 13: Module('dd'), + 14: codec, + 15: Module('spi'), + 16: Module('pxi'), + 17: fs, + 18: Module('di'), + 19: Module('hid'), + 20: Module('cam'), + 21: Module('pi'), + 22: pm, + 23: Module('pm_low'), + 24: Module('fsi'), + 25: srv, + 26: Module('ndm'), + 27: Module('nwm'), + 28: Module('soc'), + 29: Module('ldr'), + 30: Module('acc'), + 31: Module('romfs'), + 32: am, + 33: Module('hio'), + 34: Module('updater'), + 35: Module('mic'), + 36: Module('fnd'), + 37: Module('mp'), + 38: Module('mpwl'), + 39: Module('ac'), + 40: http, + 41: Module('dsp'), + 42: Module('snd'), + 43: Module('dlp'), + 44: Module('hio_low'), + 45: Module('csnd'), + 46: Module('ssl'), + 47: Module('am_low'), + 48: Module('nex'), + 49: Module('friends'), + 50: Module('rdt'), + 51: Module('applet'), + 52: nim, + 53: Module('ptm'), + 54: Module('midi'), + 55: Module('mc'), + 56: Module('swc'), + 57: Module('fatfs'), + 58: Module('ngc'), + 59: Module('card'), + 60: Module('cardnor'), + 61: Module('sdmc'), + 62: Module('boss'), + 63: Module('dbm'), + 64: Module('config'), + 65: Module('ps'), + 66: Module('cec'), + 67: Module('ir'), + 68: Module('uds'), + 69: Module('pl'), + 70: Module('cup'), + 71: Module('gyroscope'), + 72: Module('mcu'), + 73: Module('ns'), + 74: Module('news'), + 75: Module('ro'), + 76: Module('gd'), + 77: Module('card spi'), + 78: Module('ec'), + 79: Module('web browser'), + 80: Module('test'), + 81: Module('enc'), + 82: Module('pia'), + 83: Module('act'), + 84: Module('vctl'), + 85: Module('olv'), + 86: Module('neia'), + 87: Module('npns'), + 90: avd, + 91: Module('l2b'), + 92: mvd, + 93: Module('nfc'), + 94: Module('uart'), + 95: Module('spm'), + 96: qtm, + 97: Module('nfp'), + 254: application, +} + +levels = { + 0: 'Success', + 1: 'Info', + 25: 'Status', + 26: 'Temporary', + 27: 'Permanent', + 28: 'Usage', + 29: 'Reinitialize', + 30: 'Reset', + 31: 'Fatal' +} + +summaries = { + 0: 'Success', + 1: 'Nothing happened', + 2: 'Would block', + 3: 'Out of resource', + 4: 'Not found', + 5: 'Invalid state', + 6: 'Not supported', + 7: 'Invalid argument', + 8: 'Wrong argument', + 9: 'Canceled', + 10: 'Status changed', + 11: 'Internal', + 63: 'Invalid result value' +} + +# regex for 3DS result code format "0XX-YYYY" +RE = re.compile(r'0\d{2}-\d{4}') + +CONSOLE_NAME = 'Nintendo 2DS/3DS' + +# Suggested color to use if displaying information through a Discord bot's embed +COLOR = 0xCE181E + + +def is_valid(error): + err_int = None + if error.startswith('0x'): + err_int = int(error, 16) + if err_int: + module = (err_int >> 10) & 0xFF + return (err_int & 0x80000000) and (module < 100 or module != 254) + return RE.match(error) + + +def hex2err(error): + if error.startswith('0x'): + error = error[2:] + error = int(error, 16) + module = (error >> 10) & 0xFF + desc = error & 0x3FF + code = f'{module:03}-{desc:04}' + return code + + +def nim_handler(module, level, summary, description): + """ + Parses 3ds nim error codes in the following ranges: + 005-2000 to 005-3023: + - NIM got a result of its own. Took description and added by 52000. + 005-4200 to 005-4399: + - NIM got an HTTP result. Took description and added by 54200, cutting out at 54399 if it was beyond that. + 005-4400 to 005-4999: + - Range of HTTP codes, however, can suffer collision. + 005-5000 to 005-6999: + - SOAP Error Code range, when is not 0 on the SOAP responses. + 005-7000 to 005-9999: + - Non specific expected results are formatted to an error code in nim by taking result module and shifting right by 5, and taking the result description and masked with 0x1F, then added both together along with 57000. + """ + nim = modules[52] + if 2000 <= description < 3024: + description -= 2000 + module = 52 # nim + return construct_result(module, level, summary, description) + elif 4200 <= description < 4400: + description -= 4200 + module = 40 # http + return construct_result(module, level, summary, description) + elif 4400 <= description < 5000: + description -= 4400 + if description < 100: + ret = ResultCode(f'{description + 100}') + elif 100 <= description < 500: + ret = ResultCode(f'{description + 100} or {description} due to a programming mistake in NIM.') + ret.summary = 'HTTP error code' + else: + ret = ResultCode(f'{description}') + return CONSOLE_NAME, modules[40].name, ret, COLOR + elif 5000 <= description < 7000: + description -= 5000 + ret = ResultCode(f'SOAP message returned result code {description} on a NIM operation.') + ret.level = level + ret.summary = summary + return CONSOLE_NAME, nim.name, ret, COLOR + # >= 7000 range is compacted + elif description >= 7000: + description -= 7000 + module = description >> 5 + return construct_result(module, level, summary, description) + return CONSOLE_NAME, nim.name, UNKNOWN_ERROR, COLOR + + +def construct_result(mod, level, summary, desc): + if mod in modules: + in_common_range = desc in common.data + if not modules[mod].data: + if not in_common_range: + return CONSOLE_NAME, modules[mod].name, NO_RESULTS_FOUND, COLOR + else: + ret = ResultCode() # Make a blank result that gets filled in below + else: + ret = modules[mod].get_error(desc) + + if in_common_range: + ret.description = common.data[desc].description + ret.level = levels[level] if level in levels else None + ret.summary = summaries[summary] if summary in summaries else None + return CONSOLE_NAME, modules[mod].name, ret, COLOR + return CONSOLE_NAME, None, UNKNOWN_MODULE, COLOR + + +def get(error): + level = None + summary = None + # TODO: can level and summary be derived from a + # human-readable string? Probably not... + if error.startswith("0x"): + error.strip() + err = int(error[2:], 16) + desc = err & 0x3FF + mod = (err >> 10) & 0xFF + summary = (err >> 21) & 0x3F + level = (err >> 27) & 0x1F + else: + mod = int(error[0:3]) + desc = int(error[4:]) + + # NIM-specific hack, hopefully more like these won't creep up in the + # future. + if mod == 5: + return nim_handler(mod, level, summary, desc) + + return construct_result(mod, level, summary, desc) diff --git a/cogs/results/switch.py b/cogs/results/switch.py new file mode 100644 index 000000000..8f62a07de --- /dev/null +++ b/cogs/results/switch.py @@ -0,0 +1,1744 @@ +import re + +from .types import Module, ResultCode, UNKNOWN_MODULE, NO_RESULTS_FOUND + +""" +This file contains all currently known Switch result and error codes. +There may be inaccuracies here; we'll do our best to correct them +when we find out more about them. + +A result code is a 32-bit integer returned when calling various commands in the +Switch's operating system, Horizon. Its breaks down like so: + + Bits | Description +------------------- +00-08 | Module +09-21 | Description + +Module: A value indicating who raised the error or returned the result. +Description: A value indicating exactly what happened. + +Unlike the 3DS, the Nintendo Switch does not provide a 'summary' or 'level' +field in result codes, so some artistic license was taken here to repurpose those +fields in our ResultCode class to add additional information from sources +such as Atmosphere's libvapours and the Switchbrew wiki. + +To add a module so the code understands it, simply add a new module number +to the 'modules' dictionary, with a Module variable as the value. If the module +has no known error codes, simply add a dummy Module instead (see the dict for +more info). See the various module variables for a more in-depth example + on how to make one. + +Once you've added a module, or you want to add a new result code to an existing +module, add a new description value (for Switch it's the final set of 4 digits after any dashes) +as the key, and a ResultCode variable with a text description of the error or result. +You can also add a second string to the ResultCode to designate a support URL if +one exists. Not all results or errors have support webpages. + +Simple example of adding a module with a sample result code: +test = Module('test', { + 5: ResultCode('test', 'https://example.com') +}) + +modules = { + 9999: test +} + +Sources used to compile these results and information: +https://switchbrew.org/wiki/Error_codes +https://github.com/Atmosphere-NX/Atmosphere/tree/master/libraries/libvapours/include/vapours/results +""" + +kernel = Module('kernel', { + 7: ResultCode('Out of sessions.'), + 14: ResultCode('Invalid argument.'), + 33: ResultCode('Not implemented.'), + 54: ResultCode('Stop processing exception.'), + 57: ResultCode('No synchronization object.'), + 59: ResultCode('Termination requested.'), + 70: ResultCode('No event.'), + 101: ResultCode('Invalid size.'), + 102: ResultCode('Invalid address.'), + 103: ResultCode('Out of resources.'), + 104: ResultCode('Out of memory.'), + 105: ResultCode('Out of handles.'), + 106: ResultCode('Invalid current memory state or permissions.'), + 108: ResultCode('Invalid new memory permissions.'), + 110: ResultCode('Invalid memory region.'), + 112: ResultCode('Invalid thread priority.'), + 113: ResultCode('Invalid processor core ID.'), + 114: ResultCode('Invalid handle.'), + 115: ResultCode('Invalid pointer.'), + 116: ResultCode('Invalid combination.'), + 117: ResultCode('Timed out.'), + 118: ResultCode('Cancelled.'), + 119: ResultCode('Out of range.'), + 120: ResultCode('Invalid enum value.'), + 121: ResultCode('Not found.'), + 122: ResultCode('Busy or already registered.'), + 123: ResultCode('Session closed.'), + 124: ResultCode('Not handled.'), + 125: ResultCode('Invalid state.'), + 126: ResultCode('Reserved used.'), + 127: ResultCode('Not supported.'), + 128: ResultCode('Debug.'), + 129: ResultCode('Thread not owned.'), + 131: ResultCode('Port closed.'), + 132: ResultCode('Limit reached.'), + 133: ResultCode('Invalid memory pool.'), + 258: ResultCode('Receive list broken.'), + 259: ResultCode('Out of address space.'), + 260: ResultCode('Message too large.'), + 517: ResultCode('Invalid process ID.'), + 518: ResultCode('Invalid thread ID.'), + 519: ResultCode('Invalid thread ID (svcGetDebugThreadParam).'), + 520: ResultCode('Process terminated.') +}) + +fs = Module('fs', { + 1: ResultCode('Path not found.'), + 2: ResultCode('Path already exists.'), + 7: ResultCode('Target locked (already in use).'), + 8: ResultCode('Directory not empty.'), + 35: ResultCode('Not enough free space on CAL0 partition.'), + 36: ResultCode('Not enough free space on SAFE partition.'), + 37: ResultCode('Not enough free space on USER partition.'), + 38: ResultCode('Not enough free space on SYSTEM partition.'), + 39: ResultCode('Not enough free space on SD card.'), + 50: ResultCode('NCA is older than version 3, or NCA SDK version is < 0.11.0.0.'), + 60: ResultCode('Mount name already exists.'), + 1001: ResultCode('Process does not have RomFS.'), + 1002: ResultCode('Target not found.'), + 2001: ResultCode('SD card not present.'), + 2520: ResultCode('Game Card is not inserted.'), + 2522: ResultCode('Attempted to process an AsicHandler command in initial mode.'), + 2540: ResultCode('Attempted to read from the secure Game Card partition in normal mode.'), + 2541: ResultCode('Attempted to read from the normal Game Card partition in secure mode.'), + 2542: ResultCode('Attempted a read that spanned both the normal and secure Game Card partitions.'), + 2544: ResultCode('Game Card initial data hash doesn\'t match the initial data hash in the card header.'), + 2545: ResultCode('Game Card initial data reserved area is not all zeroes.'), + 2546: ResultCode('Game Card certificate kek index doesn\'t match card header kek index.'), + 2551: ResultCode('Unable to read card header on Game Card initialization.'), + 2565: ResultCode('Encountered SDMMC error in write operation.'), + 2600: ResultCode('Attempted to switch Lotus state machine to secure mode from a mode other than normal mode.'), + 2601: ResultCode('Attempted to switch Lotus state machine to normal mode from a mode other than initial mode.'), + 2602: ResultCode('Attempted to switch Lotus state machine to write mode from a mode other than normal mode.'), + 2634: ResultCode('Error processing Lotus command SetUserAsicFirmware.'), + 2637: ResultCode('Error processing Lotus command GetAsicCert.'), + 2640: ResultCode('Error processing Lotus command SetEmmcEmbeddedSocCertificate.'), + 2645: ResultCode('Error processing Lotus command GetAsicEncryptedMessage.'), + 2646: ResultCode('Error processing Lotus command SetLibraryEncryptedMessage.'), + 2651: ResultCode('Error processing Lotus command GetAsicAuthenticationData.'), + 2652: ResultCode('Error processing Lotus command SetAsicAuthenticationDataHash.'), + 2653: ResultCode('Error processing Lotus command SetLibraryAuthenticationData.'), + 2654: ResultCode('Error processing Lotus command GetLibraryAuthenticationDataHash.'), + 2657: ResultCode('Error processing Lotus command ExchangeRandomValuesInSecureMode.'), + 2668: ResultCode('Error calling nn::gc::detail::GcCrypto::GenerateRandomBytes.'), + 2671: ResultCode('Error processing Lotus command ReadAsicRegister.'), + 2672: ResultCode('Error processing Lotus command GetGameCardIdSet.'), + 2674: ResultCode('Error processing Lotus command GetCardHeader.'), + 2676: ResultCode('Error processing Lotus command GetCardKeyArea.'), + 2677: ResultCode('Error processing Lotus command ChangeDebugMode.'), + 2678: ResultCode('Error processing Lotus command GetRmaInformation.'), + 2692: ResultCode('Tried sending Lotus card command Refresh when not in secure mode.'), + 2693: ResultCode('Tried sending Lotus card command when not in correct mode.'), + 2731: ResultCode('Error processing Lotus card command ReadId1.'), + 2732: ResultCode('Error processing Lotus card command ReadId2.'), + 2733: ResultCode('Error processing Lotus card command ReadId3.'), + 2735: ResultCode('Error processing Lotus card command ReadPage.'), + 2737: ResultCode('Error processing Lotus card command WritePage.'), + 2738: ResultCode('Error processing Lotus card command Refresh.'), + 2742: ResultCode('Error processing Lotus card command ReadCrc.'), + 2743: ResultCode('Error processing Lotus card command Erase or UnlockForceErase.'), + 2744: ResultCode('Error processing Lotus card command ReadDevParam.'), + 2745: ResultCode('Error processing Lotus card command WriteDevParam.'), + 2904: ResultCode('Id2Normal did not match the value in the buffer returned by ChangeDebugMode.'), + 2905: ResultCode('Id1Normal did not match Id1Writer when switching gamecard to write mode.'), + 2906: ResultCode('Id2Normal did not match Id2Writer when switching gamecard to write mode.'), + 2954: ResultCode('Invalid Game Card handle.'), + 2960: ResultCode('Invalid gamecard handle when opening normal gamecard partition.'), + 2961: ResultCode('Invalid gamecard handle when opening secure gamecard partition.'), + 3001: ResultCode('Not implemented.'), + 3002: ResultCode('Unsupported version.'), + 3003: ResultCode('File or directory already exists.'), + 3005: ResultCode('Out of range.'), + 3100: ResultCode('System partition not ready.'), + 3201: ResultCode('Memory allocation failure related to FAT filesystem code.'), + 3203: ResultCode('Memory allocation failure related to FAT filesystem code.'), + 3204: ResultCode('Memory allocation failure related to FAT filesystem code.'), + 3206: ResultCode('Memory allocation failure related to FAT filesystem code.'), + 3208: ResultCode('Memory allocation failure related to FAT filesystem code.'), + 3211: ResultCode('Allocation failure in FileSystemAccessorA.'), + 3212: ResultCode('Allocation failure in FileSystemAccessorB.'), + 3213: ResultCode('Allocation failure in ApplicationA.'), + 3215: ResultCode('Allocation failure in BisA.'), + 3216: ResultCode('Allocation failure in BisB.'), + 3217: ResultCode('Allocation failure in BisC.'), + 3218: ResultCode('Allocation failure in CodeA.'), + 3219: ResultCode('Allocation failure in ContentA.'), + 3220: ResultCode('Allocation failure in ContentStorageA.'), + 3221: ResultCode('Allocation failure in ContentStorageB.'), + 3222: ResultCode('Allocation failure in DataA.'), + 3223: ResultCode('Allocation failure in DataB.'), + 3224: ResultCode('Allocation failure in DeviceSaveDataA.'), + 3225: ResultCode('Allocation failure in GameCardA'), + 3226: ResultCode('Allocation failure in GameCardB'), + 3227: ResultCode('Allocation failure in GameCardC'), + 3228: ResultCode('Allocation failure in GameCardD'), + 3232: ResultCode('Allocation failure in ImageDirectoryA.'), + 3244: ResultCode('Allocation failure in SDCardA.'), + 3245: ResultCode('Allocation failure in SDCardB.'), + 3246: ResultCode('Allocation failure in SystemSaveDataA.'), + 3247: ResultCode('Allocation failure in RomFsFileSystemA.'), + 3248: ResultCode('Allocation failure in RomFsFileSystemB.'), + 3249: ResultCode('Allocation failure in RomFsFileSystemC.'), + 3256: ResultCode('Allocation failure in FilesystemProxyCoreImplD.'), + 3257: ResultCode('Allocation failure in FilesystemProxyCoreImplE.'), + 3280: ResultCode('Allocation failure in PartitionFileSystemCreatorA.'), + 3281: ResultCode('Allocation failure in RomFileSystemCreatorA.'), + 3288: ResultCode('Allocation failure in StorageOnNcaCreatorA.'), + 3289: ResultCode('Allocation failure in StorageOnNcaCreatorB.'), + 3294: ResultCode('Allocation failure in SystemBuddyHeapA.'), + 3295: ResultCode('Allocation failure in SystemBufferManagerA.'), + 3296: ResultCode('Allocation failure in BlockCacheBufferedStorageA.'), + 3297: ResultCode('Allocation failure in BlockCacheBufferedStorageB.'), + 3304: ResultCode('Allocation failure in IntegrityVerificationStorageA.'), + 3305: ResultCode('Allocation failure in IntegrityVerificationStorageB.'), + 3321: ResultCode('Allocation failure in DirectorySaveDataFileSystem.'), + 3341: ResultCode('Allocation failure in NcaFileSystemDriverI.'), + 3347: ResultCode('Allocation failure in PartitionFileSystemA.'), + 3348: ResultCode('Allocation failure in PartitionFileSystemB.'), + 3349: ResultCode('Allocation failure in PartitionFileSystemC.'), + 3350: ResultCode('Allocation failure in PartitionFileSystemMetaA.'), + 3351: ResultCode('Allocation failure in PartitionFileSystemMetaB.'), + 3355: ResultCode('Allocation failure in SubDirectoryFileSystem.'), + 3359: ResultCode('Out of memory.'), + 3360: ResultCode('Out of memory.'), + 3363: ResultCode('Allocation failure in NcaReaderA.'), + 3365: ResultCode('Allocation failure in RegisterA.'), + 3366: ResultCode('Allocation failure in RegisterB.'), + 3367: ResultCode('Allocation failure in PathNormalizer.'), + 3375: ResultCode('Allocation failure in DbmRomKeyValueStorage.'), + 3377: ResultCode('Allocation failure in RomFsFileSystemE.'), + 3386: ResultCode('Allocation failure in ReadOnlyFileSystemA.'), + 3399: ResultCode('Allocation failure in AesCtrCounterExtendedStorageA.'), + 3400: ResultCode('Allocation failure in AesCtrCounterExtendedStorageB.'), + 3407: ResultCode('Allocation failure in FileSystemInterfaceAdapter.'), + 3411: ResultCode('Allocation failure in BufferedStorageA.'), + 3412: ResultCode('Allocation failure in IntegrityRomFsStorageA.'), + 3420: ResultCode('Allocation failure in New.'), + 3422: ResultCode('Allocation failure in MakeUnique.'), + 3423: ResultCode('Allocation failure in AllocateShared.'), + 3424: ResultCode('Allocation failure in PooledBufferNotEnoughSize.'), + 4000: ResultCode('The data is corrupted.'), + 4002: ResultCode('Unsupported ROM version.'), + 4012: ResultCode('Invalid AesCtrCounterExtendedEntryOffset.'), + 4013: ResultCode('Invalid AesCtrCounterExtendedTableSize.'), + 4014: ResultCode('Invalid AesCtrCounterExtendedGeneration.'), + 4015: ResultCode('Invalid AesCtrCounterExtendedOffset.'), + 4022: ResultCode('Invalid IndirectEntryOffset.'), + 4023: ResultCode('Invalid IndirectEntryStorageIndex.'), + 4024: ResultCode('Invalid IndirectStorageSize.'), + 4025: ResultCode('Invalid IndirectVirtualOffset.'), + 4026: ResultCode('Invalid IndirectPhysicalOffset.'), + 4027: ResultCode('Invalid IndirectStorageIndex.'), + 4032: ResultCode('Invalid BucketTreeSignature.'), + 4033: ResultCode('Invalid BucketTreeEntryCount.'), + 4034: ResultCode('Invalid BucketTreeNodeEntryCount.'), + 4035: ResultCode('Invalid BucketTreeNodeOffset.'), + 4036: ResultCode('Invalid BucketTreeEntryOffset.'), + 4037: ResultCode('Invalid BucketTreeEntrySetOffset.'), + 4038: ResultCode('Invalid BucketTreeNodeIndex.'), + 4039: ResultCode('Invalid BucketTreeVirtualOffset.'), + 4052: ResultCode('ROM NCA filesystem type is invalid.'), + 4053: ResultCode('ROM ACID file size is invalid.'), + 4054: ResultCode('ROM ACID size is invalid.'), + 4055: ResultCode('ROM ACID is invalid.'), + 4056: ResultCode('ROM ACID verification failed.'), + 4057: ResultCode('ROM NCA signature is invalid.'), + 4058: ResultCode('ROM NCA header signature 1 verification failed.'), + 4059: ResultCode('ROM NCA header signature 2 verification failed.'), + 4060: ResultCode('ROM NCA FS header hash verification failed.'), + 4061: ResultCode('ROM NCA key index is invalid.'), + 4062: ResultCode('ROM NCA FS header hash type is invalid.'), + 4063: ResultCode('ROM NCA FS header encryption type is invalid.'), + 4070: ResultCode('ROM data is corrupted.'), + 4072: ResultCode('Invalid ROM hierarchical SHA256 block size.'), + 4073: ResultCode('Invalid ROM hierarchical SHA256 layer count.'), + 4074: ResultCode('ROM hierarchical SHA256 BaseStorage is too large.'), + 4075: ResultCode('ROM hierarchical SHA256 hash verification failed.'), + 4142: ResultCode('Incorrect ROM integrity verification magic.'), + 4143: ResultCode('Invalid ROM0 hash.'), + 4144: ResultCode('ROM non-real data verification failed.'), + 4145: ResultCode('Invalid ROM hierarchical integrity verification layer count.'), + 4151: ResultCode('Cleared ROM real data verification failed.'), + 4152: ResultCode('Uncleared ROM real data verification failed.'), + 4153: ResultCode('Invalid ROM0 hash.'), + 4182: ResultCode('Invalid ROM SHA256 partition hash target.'), + 4183: ResultCode('ROM SHA256 partition hash verification failed.'), + 4184: ResultCode('ROM partition signature verification failed.'), + 4185: ResultCode('ROM SHA256 partition signature verification failed.'), + 4186: ResultCode('Invalid ROM partition entry offset.'), + 4187: ResultCode('Invalid ROM SHA256 partition metadata size.'), + 4202: ResultCode('ROM GPT header verification failed.'), + 4242: ResultCode('ROM host entry corrupted.'), + 4243: ResultCode('ROM host file data corrupted.'), + 4244: ResultCode('ROM host file corrupted.'), + 4245: ResultCode('Invalid ROM host handle.'), + 4262: ResultCode('Invalid ROM allocation table block.'), + 4263: ResultCode('Invalid ROM key value list element index.'), + 4318: ResultCode('Invalid save data filesystem magic (valid magic is SAVE in ASCII).'), + 4508: ResultCode('NcaBaseStorage is out of Range A.'), + 4509: ResultCode('NcaBaseStorage is out of Range B.'), + 4512: ResultCode('Invalid NCA filesystem type.'), + 4513: ResultCode('Invalid ACID file size.'), + 4514: ResultCode('Invalid ACID size.'), + 4515: ResultCode('Invalid ACID.'), + 4516: ResultCode('ACID verification failed.'), + 4517: ResultCode('Invalid NCA signature.'), + 4518: ResultCode('NCA header signature 1 verification failed.'), + 4519: ResultCode('NCA header signature 2 verification failed.'), + 4520: ResultCode('NCA FS header hash verification failed.'), + 4521: ResultCode('Invalid NCA key index.'), + 4522: ResultCode('Invalid NCA FS header hash type.'), + 4523: ResultCode('Invalid NCA FS header encryption type.'), + 4524: ResultCode('Redirection BKTR table size is negative.'), + 4525: ResultCode('Encryption BKTR table size is negative.'), + 4526: ResultCode('Redirection BKTR table end offset is past the Encryption BKTR table start offset.'), + 4527: ResultCode('NCA path used with the wrong program ID.'), + 4528: ResultCode('NCA header value is out of range.'), + 4529: ResultCode('NCA FS header value is out of range.'), + 4530: ResultCode('NCA is corrupted.'), + 4532: ResultCode('Invalid hierarchical SHA256 block size.'), + 4533: ResultCode('Invalid hierarchical SHA256 layer count.'), + 4534: ResultCode('Hierarchical SHA256 base storage is too large.'), + 4535: ResultCode('Hierarchical SHA256 hash verification failed.'), + 4543: ResultCode('Invalid NCA header 1 signature key generation.'), + 4602: ResultCode('Incorrect integrity verification magic.'), + 4603: ResultCode('Invalid zero hash.'), + 4604: ResultCode('Non-real data verification failed.'), + 4605: ResultCode('Invalid hierarchical integrity verification layer count.'), + 4612: ResultCode('Cleared real data verification failed.'), + 4613: ResultCode('Uncleared real data verification failed.'), + 4642: ResultCode('Invalid SHA256 partition hash target.'), + 4643: ResultCode('SHA256 partition hash verification failed.'), + 4644: ResultCode('Partition signature verification failed.'), + 4645: ResultCode('SHA256 partition signature verification failed.'), + 4646: ResultCode('Invalid partition entry offset.'), + 4647: ResultCode('Invalid SHA256 partition metadata size.'), + 4662: ResultCode('GPT header verification failed.'), + 4684: ResultCode('Invalid FAT file number.'), + 4686: ResultCode('Invalid FAT format for BIS USER partition.'), + 4687: ResultCode('Invalid FAT format for BIS SYSTEM partition.'), + 4688: ResultCode('Invalid FAT format for BIS SAFE partition.'), + 4689: ResultCode('Invalid FAT format for BIS PRODINFOF partition.'), + 4702: ResultCode('Host entry is corrupted.'), + 4703: ResultCode('Host file data is corrupted.'), + 4704: ResultCode('Host file is corrupted.'), + 4705: ResultCode('Invalid host handle.'), + 4722: ResultCode('Invalid allocation table block.'), + 4723: ResultCode('Invalid key value list element index.'), + 4743: ResultCode('Corrupted NAX0 header.'), + 4744: ResultCode('Invalid NAX0 magic number.'), + 4781: ResultCode('Game Card logo data is corrupted.'), + 5121: ResultCode('Invalid FAT size.'), + 5122: ResultCode('Invalid FAT BPB (BIOS Parameter Block).'), + 5123: ResultCode('Invalid FAT parameter.'), + 5124: ResultCode('Invalid FAT sector.'), + 5125: ResultCode('Invalid FAT sector.'), + 5126: ResultCode('Invalid FAT sector.'), + 5127: ResultCode('Invalid FAT sector.'), + 5301: ResultCode('Mount point not found.'), + 5315: ResultCode('Unexpected InAesCtrStorageA.'), + 5317: ResultCode('Unexpected InAesXtsStorageA.'), + 5319: ResultCode('Unexpected InFindFileSystemA.'), + 6000: ResultCode('Precondition violation.'), + 6001: ResultCode('Invalid argument.'), + 6003: ResultCode('Path is too long.'), + 6004: ResultCode('Invalid character.'), + 6005: ResultCode('Invalid path format.'), + 6006: ResultCode('Directory is unobtainable.'), + 6007: ResultCode('Not normalized.'), + 6031: ResultCode('The directory is not deletable.'), + 6032: ResultCode('The directory is not renameable.'), + 6033: ResultCode('The path is incompatible.'), + 6034: ResultCode('Rename to other filesystem.'), # 'Attempted to rename to other filesystem.'? + 6061: ResultCode('Invalid offset.'), + 6062: ResultCode('Invalid size.'), + 6063: ResultCode('Argument is nullptr.'), + 6064: ResultCode('Invalid alignment.'), + 6065: ResultCode('Invalid mount name.'), + 6066: ResultCode('Extension size is too large.'), + 6067: ResultCode('Extension size is invalid.'), + 6072: ResultCode('Invalid open mode.'), + 6081: ResultCode('Invalid savedata state.'), + 6082: ResultCode('Invalid savedata space ID.'), + 6201: ResultCode('File extension without open mode AllowAppend.'), + 6202: ResultCode('Reads are not permitted.'), + 6203: ResultCode('Writes are not permitted.'), + 6300: ResultCode('Operation not supported.'), + 6301: ResultCode('A specified filesystem has no MultiCommitTarget when doing a multi-filesystem commit.'), + 6302: ResultCode('Attempted to resize a nn::fs::SubStorage or BufferedStorage that is marked as non-resizable.'), + 6303: ResultCode('Attempted to resize a nn::fs::SubStorage or BufferedStorage when the SubStorage ends before the base storage.'), + 6304: ResultCode('Attempted to call nn::fs::MemoryStorage::SetSize.'), + 6305: ResultCode('Invalid Operation ID in nn::fs::MemoryStorage::OperateRange.'), + 6306: ResultCode('Invalid Operation ID in nn::fs::FileStorage::OperateRange.'), + 6307: ResultCode('Invalid Operation ID in nn::fs::FileHandleStorage::OperateRange.'), + 6308: ResultCode('Invalid Operation ID in nn::fssystem::SwitchStorage::OperateRange.'), + 6309: ResultCode('Invalid Operation ID in nn::fs::detail::StorageServiceObjectAdapter::OperateRange.'), + 6310: ResultCode('Attempted to call nn::fssystem::AesCtrCounterExtendedStorage::Write.'), + 6311: ResultCode('Attempted to call nn::fssystem::AesCtrCounterExtendedStorage::SetSize.'), + 6312: ResultCode('Invalid Operation ID in nn::fssystem::AesCtrCounterExtendedStorage::OperateRange.'), + 6313: ResultCode('Attempted to call nn::fssystem::AesCtrStorageExternal::Write.'), + 6314: ResultCode('Attempted to call nn::fssystem::AesCtrStorageExternal::SetSize.'), + 6315: ResultCode('Attempted to call nn::fssystem::AesCtrStorage::SetSize.'), + 6316: ResultCode('Attempted to call nn::fssystem::save::HierarchicalIntegrityVerificationStorage::SetSize.'), + 6317: ResultCode('Attempted to call nn::fssystem::save::HierarchicalIntegrityVerificationStorage::OperateRange.'), + 6318: ResultCode('Attempted to call nn::fssystem::save::IntegrityVerificationStorage::SetSize.'), + 6319: ResultCode('Attempted to invalidate the cache of a RomFs IVFC storage in nn::fssystem::save::IntegrityVerificationStorage::OperateRange.'), + 6320: ResultCode('Invalid Operation ID in nn::fssystem::save::IntegrityVerificationStorage::OperateRange.'), + 6321: ResultCode('Attempted to call nn::fssystem::save::BlockCacheBufferedStorage::SetSize.'), + 6322: ResultCode('Attempted to invalidate the cache of something other than a savedata IVFC storage in nn::fssystem::save::BlockCacheBufferedStorage::OperateRange.'), + 6323: ResultCode('Invalid Operation ID in nn::fssystem::save::BlockCacheBufferedStorage::OperateRange.'), + 6324: ResultCode('Attempted to call nn::fssystem::IndirectStorage::Write.'), + 6325: ResultCode('Attempted to call nn::fssystem::IndirectStorage::SetSize.'), + 6326: ResultCode('Invalid Operation ID in nn::fssystem::IndirectStorage::OperateRange.'), + 6327: ResultCode('Attempted to call nn::fssystem::SparseStorage::ZeroStorage::Write.'), + 6328: ResultCode('Attempted to call nn::fssystem::SparseStorage::ZeroStorage::SetSize.'), + 6329: ResultCode('Attempted to call nn::fssystem::HierarchicalSha256Storage::SetSize.'), + 6330: ResultCode('Attempted to call nn::fssystem::ReadOnlyBlockCacheStorage::Write.'), + 6331: ResultCode('Attempted to call nn::fssystem::ReadOnlyBlockCacheStorage::SetSize.'), + 6332: ResultCode('Attempted to call nn::fssystem::IntegrityRomFsStorage::SetSize.'), + 6333: ResultCode('Attempted to call nn::fssystem::save::DuplexStorage::SetSize.'), + 6334: ResultCode('Invalid Operation ID in nn::fssystem::save::DuplexStorage::OperateRange.'), + 6335: ResultCode('Attempted to call nn::fssystem::save::HierarchicalDuplexStorage::SetSize.'), + 6336: ResultCode('Attempted to call nn::fssystem::save::RemapStorage::GetSize.'), + 6337: ResultCode('Attempted to call nn::fssystem::save::RemapStorage::SetSize.'), + 6338: ResultCode('Invalid Operation ID in nn::fssystem::save::RemapStorage::OperateRange.'), + 6339: ResultCode('Attempted to call nn::fssystem::save::IntegritySaveDataStorage::SetSize.'), + 6340: ResultCode('Invalid Operation ID in nn::fssystem::save::IntegritySaveDataStorage::OperateRange.'), + 6341: ResultCode('Attempted to call nn::fssystem::save::JournalIntegritySaveDataStorage::SetSize.'), + 6342: ResultCode('Invalid Operation ID in nn::fssystem::save::JournalIntegritySaveDataStorage::OperateRange.'), + 6343: ResultCode('Attempted to call nn::fssystem::save::JournalStorage::GetSize.'), + 6344: ResultCode('Attempted to call nn::fssystem::save::JournalStorage::SetSize.'), + 6345: ResultCode('Invalid Operation ID in nn::fssystem::save::JournalStorage::OperateRange.'), + 6346: ResultCode('Attempted to call nn::fssystem::save::UnionStorage::SetSize.'), + 6347: ResultCode('Attempted to call nn::fssystem::dbm::AllocationTableStorage::SetSize.'), + 6348: ResultCode('Attempted to call nn::fssrv::fscreator::WriteOnlyGameCardStorage::Read.'), + 6349: ResultCode('Attempted to call nn::fssrv::fscreator::WriteOnlyGameCardStorage::SetSize.'), + 6350: ResultCode('Attempted to call nn::fssrv::fscreator::ReadOnlyGameCardStorage::Write.'), + 6351: ResultCode('Attempted to call nn::fssrv::fscreator::ReadOnlyGameCardStorage::SetSize.'), + 6352: ResultCode('Invalid Operation ID in nn::fssrv::fscreator::ReadOnlyGameCardStorage::OperateRange.'), + 6353: ResultCode('Attempted to call SdStorage::SetSize.'), + 6354: ResultCode('Invalid Operation ID in SdStorage::OperateRange.'), + 6355: ResultCode('Invalid Operation ID in nn::fat::FatFile::DoOperateRange.'), + 6356: ResultCode('Invalid Operation ID in nn::fssystem::StorageFile::DoOperateRange.'), + 6357: ResultCode('Attempted to call nn::fssystem::ConcatenationFile::SetSize.'), + 6358: ResultCode('Attempted to call nn::fssystem::ConcatenationFile::OperateRange.'), + 6359: ResultCode('Invalid Query ID in nn::fssystem::ConcatenationFileSystem::DoQueryEntry.'), + 6360: ResultCode('Invalid Operation ID in nn::fssystem::ConcatenationFile::DoOperateRange.'), + 6361: ResultCode('Attempted to call nn::fssystem::ZeroBitmapFile::SetSize.'), + 6362: ResultCode('Invalid Operation ID in nn::fs::detail::FileServiceObjectAdapter::DoOperateRange.'), + 6363: ResultCode('Invalid Operation ID in nn::fssystem::AesXtsFile::DoOperateRange.'), + 6364: ResultCode('Attempted to modify a nn::fs::RomFsFileSystem.'), + 6365: ResultCode('Attempted to call nn::fs::RomFsFileSystem::DoCommitProvisionally.'), + 6366: ResultCode('Attempted to query the space in a nn::fs::RomFsFileSystem.'), + 6367: ResultCode('Attempted to modify a nn::fssystem::RomFsFile.'), + 6368: ResultCode('Invalid Operation ID in nn::fssystem::RomFsFile::DoOperateRange.'), + 6369: ResultCode('Attempted to modify a nn::fs::ReadOnlyFileSystemTemplate.'), + 6370: ResultCode('Attempted to call nn::fs::ReadOnlyFileSystemTemplate::DoCommitProvisionally.'), + 6371: ResultCode('Attempted to query the space in a nn::fs::ReadOnlyFileSystemTemplate.'), + 6372: ResultCode('Attempted to modify a nn::fs::ReadOnlyFileSystemFile.'), + 6373: ResultCode('Invalid Operation ID in nn::fs::ReadOnlyFileSystemFile::DoOperateRange.'), + 6374: ResultCode('UAttempted to modify a nn::fssystem::PartitionFileSystemCore.'), + 6375: ResultCode('Attempted to call nn::fssystem::PartitionFileSystemCore::DoCommitProvisionally.'), + 6376: ResultCode('Attempted to call nn::fssystem::PartitionFileSystemCore::PartitionFile::DoSetSize.'), + 6377: ResultCode('Invalid Operation ID in nn::fssystem::PartitionFileSystemCore::PartitionFile::DoOperateRange.'), + 6378: ResultCode('Invalid Operation ID in nn::fssystem::TmFileSystemFile::DoOperateRange.'), + 6379: ResultCode('Attempted to call unsupported functions in nn::fssrv::fscreator::SaveDataInternalStorageFileSystem, nn::fssrv::detail::SaveDataInternalStorageAccessor::PaddingFile or nn::fssystem::save::detail::SaveDataExtraDataInternalStorageFile.'), + 6382: ResultCode('Attempted to call nn::fssystem::ApplicationTemporaryFileSystem::DoCommitProvisionally.'), + 6383: ResultCode('Attempted to call nn::fssystem::SaveDataFileSystem::DoCommitProvisionally.'), + 6384: ResultCode('Attempted to call nn::fssystem::DirectorySaveDataFileSystem::DoCommitProvisionally.'), + 6385: ResultCode('Attempted to call nn::fssystem::ZeroBitmapHashStorageFile::Write.'), + 6386: ResultCode('Attempted to call nn::fssystem::ZeroBitmapHashStorageFile::SetSize.'), + 6400: ResultCode('Permission denied.'), + 6451: ResultCode('Missing titlekey (required to mount content).'), + 6454: ResultCode('Needs flush.'), + 6455: ResultCode('File not closed.'), + 6456: ResultCode('Directory not closed.'), + 6457: ResultCode('Write-mode file not closed.'), + 6458: ResultCode('Allocator already registered.'), + 6459: ResultCode('Default allocator used.'), + 6461: ResultCode('Allocator alignment violation.'), + 6465: ResultCode('User does not exist.'), + 6602: ResultCode('File not found.'), + 6603: ResultCode('Directory not found.'), + 6705: ResultCode('Buffer allocation failed.'), + 6706: ResultCode('Mapping table full.'), + 6709: ResultCode('Open count limit reached.'), + 6710: ResultCode('Multicommit limit reached.'), + 6811: ResultCode('Map is full.'), + 6902: ResultCode('Not initialized.'), + 6905: ResultCode('Not mounted.'), + 7902: ResultCode('DBM key was not found.'), + 7903: ResultCode('DBM file was not found.'), + 7904: ResultCode('DBM directory was not found.'), + 7906: ResultCode('DBM already exists.'), + 7907: ResultCode('DBM key is full.'), + 7908: ResultCode('DBM directory entry is full.'), + 7909: ResultCode('DBM file entry is full.'), + 7910: ResultCode('RomFs directory has no more child directories/files when iterating.'), + 7911: ResultCode('DBM FindKey finished.'), + 7912: ResultCode('DBM iteration finshed.'), + 7914: ResultCode('Invalid DBM operation.'), + 7915: ResultCode('Invalid DBM path format.'), + 7916: ResultCode('DBM directory name is too long.'), + 7917: ResultCode('DBM filename is too long.') +}, { + (30, 33): 'Not enough free space.', + (34, 38): 'Not enough BIS free space.', + (39, 45): 'Not enough free space.', + (2000, 2499): 'Failed to access SD card.', + (2500, 2999): 'Failed to access Game Card.', + (3200, 3499): 'Allocation failed.', + (3500, 3999): 'Failed to access eMMC.', + # (4001, 4200): 'ROM is corrupted.', + (4001, 4010): 'ROM is corrupted.', + (4011, 4019): 'AES-CTR CounterExtendedStorage is corrupted.', + (4021, 4029): 'Indirect storage is corrupted.', + (4031, 4039): 'Bucket tree is corrupted.', + (4041, 4050): 'ROM NCA is corrupted.', + (4051, 4069): 'ROM NCA filesystem is corrupted.', + (4071, 4079): 'ROM NCA hierarchical SHA256 storage is corrupted.', + (4141, 4150): 'ROM integrity verification storage is corrupted.', + (4151, 4159): 'ROM real data verification failed.', + (4160, 4079): 'ROM integrity verification storage is corrupted.', + (4181, 4199): 'ROM partition filesystem is corrupted.', + (4201, 4219): 'ROM built-in storage is corrupted.', + (4241, 4259): 'ROM host filesystem is corrupted.', + (4261, 4279): 'ROM database is corrupted.', + (4280, 4299): 'ROM is corrupted.', + (4301, 4499): 'Savedata is corrupted.', + (4501, 4510): 'NCA is corrupted.', + (4511, 4529): 'NCA filesystem is corrupted.', + (4531, 4539): 'NCA hierarchical SHA256 storage is corrupted.', + (4540, 4599): 'NCA is corrupted.', + (4601, 4610): 'Integrity verification storage is corrupted.', + (4611, 4619): 'Real data verification failed.', + (4620, 4639): 'Integrity verification storage is corrupted.', + (4641, 4659): 'Partition filesystem is corrupted.', + (4661, 4679): 'Built-in storage is corrupted.', + (4681, 4699): 'FAT filesystem is corrupted.', + (4701, 4719): 'Host filesystem is corrupted.', + (4721, 4739): 'Database is corrupted.', + (4741, 4759): 'AEX-XTS filesystem is corrupted.', + (4761, 4769): 'Savedata transfer data is corrupted.', + (4771, 4779): 'Signed system partition data is corrupted.', + (4800, 4999): 'The data is corrupted.', + (5000, 5999): 'Unexpected.', + (6002, 6029): 'Invalid path.', + (6030, 6059): 'Invalid path for operation.', + (6080, 6099): 'Invalid enum value.', + (6100, 6199): 'Invalid argument.', + (6200, 6299): 'Invalid operation for open mode.', + (6300, 6399): 'Unsupported operation.', + (6400, 6449): 'Permission denied.', + (6600, 6699): 'Not found.', + (6700, 6799): 'Out of resources.', + (6800, 6899): 'Mapping failed.', + (6900, 6999): 'Bad state.', + (7901, 7904): 'DBM not found.', + (7910, 7912): 'DBM find finished.', +}) + +os = Module('os', { + 4: ResultCode('Busy.'), + 8: ResultCode('Out of memory.'), + 9: ResultCode('Out of resources.'), + 12: ResultCode('Out of virtual address space.'), + 13: ResultCode('Resource limit reached.'), + 384: ResultCode('File operation failed.'), + 500: ResultCode('Out of handles.'), + 501: ResultCode('Invalid handle.'), + 502: ResultCode('Invalid CurrentMemory state.'), + 503: ResultCode('Invalid TransferMemory state.'), + 504: ResultCode('Invalid TransferMemory size.'), + 505: ResultCode('Out of TransferMemory.'), + 506: ResultCode('Out of address space.') +}) + +ncm = Module('ncm', { + 1: ResultCode('Invalid ContentStorageBase.'), + 2: ResultCode('Placeholder already exists.'), + 3: ResultCode('Placeholder not found (issue related to the SD card in use).', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/22393/kw/2005-0003'), + 4: ResultCode('Content already exists.'), + 5: ResultCode('Content not found.'), + 7: ResultCode('Content meta not found.'), + 8: ResultCode('Allocation failed.'), + 12: ResultCode('Unknown storage.'), + 100: ResultCode('Invalid ContentStorage.'), + 110: ResultCode('Invalid ContentMetaDatabase.'), + 130: ResultCode('Invalid package format.'), + 140: ResultCode('Invalid content hash.'), + 160: ResultCode('Invalid install task state.'), + 170: ResultCode('Invalid placeholder file.'), + 180: ResultCode('Buffer is insufficient.'), + 190: ResultCode('Cannot write to read-only ContentStorage.'), + 200: ResultCode('Not enough install space.'), + 210: ResultCode('System update was not found in package.'), + 220: ResultCode('Content info not found.'), + 237: ResultCode('Delta not found.'), + 240: ResultCode('Invalid content metakey.'), + 251: ResultCode('GameCardContentStorage is not active.'), + 252: ResultCode('BuiltInSystemContentStorage is not active.'), + 253: ResultCode('BuiltInUserContentStorage is not active.'), + 254: ResultCode('SdCardContentStorage is not active.'), + 258: ResultCode('UnknownContentStorage is not active.'), + 261: ResultCode('GameCardContentMetaDatabase is not active.'), + 262: ResultCode('BuiltInSystemMetaDatabase is not active.'), + 263: ResultCode('BuiltInUserMetaDatabase is not active.'), + 264: ResultCode('SdCardContentMetaDatabase is not active.'), + 268: ResultCode('UnknownContentMetaDatabase is not active.'), + 291: ResultCode('Create placeholder was cancelled.'), + 292: ResultCode('Write placeholder was cancelled.'), + 280: ResultCode('Ignorable install ticket failure.'), + 310: ResultCode('ContentStorageBase not found.'), + 330: ResultCode('List partially not committed.'), + 360: ResultCode('Unexpected ContentMeta prepared.'), + 380: ResultCode('Invalid firmware variation.'), + 8182: ResultCode('Invalid offset.') +}, { + (250, 258): 'Content storage is not active.', + (260, 268): 'Content meta database is not active.', + (290, 299): 'Install task was cancelled.', + (8181, 8191): 'Invalid argument.' +}) + +lr = Module('lr', { + 2: ResultCode('Program not found.'), + 3: ResultCode('Data not found.'), + 4: ResultCode('Unknown storage ID.'), + 5: ResultCode('Access denied.'), + 6: ResultCode('HTML document not found.'), + 7: ResultCode('Add-on Content not found.'), + 8: ResultCode('Control not found.'), + 9: ResultCode('Legal information not found.'), + 10: ResultCode('Debug program not found.'), + 90: ResultCode('Too many registered paths.') +}) + +loader = Module('loader', { + 1: ResultCode('Argument too long.'), + 2: ResultCode('Too many arguments.'), + 3: ResultCode('Meta is too large.'), + 4: ResultCode('Invalid meta.'), + 5: ResultCode('Invalid NSO.'), + 6: ResultCode('Invalid path.'), + 7: ResultCode('Too many processes.'), + 8: ResultCode('Not pinned.'), + 9: ResultCode('Invalid program ID.'), + 10: ResultCode('Invalid version.'), + 11: ResultCode('Invalid ACID signature.'), + 12: ResultCode('Invalid NCA signature.'), + 51: ResultCode('Insufficient address space.'), + 52: ResultCode('Invalid NRO.'), + 53: ResultCode('Invalid NRR.'), + 54: ResultCode('Invalid signature.'), + 55: ResultCode('Insufficient NRO registrations.'), + 56: ResultCode('Insufficient NRR registrations.'), + 57: ResultCode('NRO already loaded.'), + 81: ResultCode('Unaligned NRR address.'), + 82: ResultCode('Invalid NRR size.'), + 84: ResultCode('NRR not loaded.'), + 85: ResultCode('Not registered (bad NRR address).'), + 86: ResultCode('Invalid session.'), + 87: ResultCode('Invalid process (bad initialization).'), + 100: ResultCode('Unknown capability (unknown ACI0 descriptor).'), + 103: ResultCode('CapabilityKernelFlags is invalid.'), + 104: ResultCode('CapabilitySyscallMask is invalid.'), + 106: ResultCode('CapabilityMapRange is invalid.'), + 107: ResultCode('CapabilityMapPage is invalid.'), + 111: ResultCode('CapabilityInterruptPair is invalid.'), + 113: ResultCode('CapabilityApplicationType is invalid.'), + 114: ResultCode('CapabilityKernelVersion is invalid.'), + 115: ResultCode('CapabilityHandleTable is invalid.'), + 116: ResultCode('CapabilityDebugFlags is invalid.'), + 200: ResultCode('Internal error.') +}) + +sf = Module('sf', { + 1: ResultCode('Not supported.'), + 3: ResultCode('Precondition violation.'), + 202: ResultCode('Invalid header size.'), + 211: ResultCode('Invalid in header.'), + 212: ResultCode('Invalid out header.'), + 221: ResultCode('Unknown command ID.'), + 232: ResultCode('Invalid out raw size.'), + 235: ResultCode('Invalid number of in objects.'), + 236: ResultCode('Invalid number of out objects.'), + 239: ResultCode('Invalid in object.'), + 261: ResultCode('Target not found.'), + 301: ResultCode('Out of domain entries.'), + 800: ResultCode('Request invalidated.'), + 802: ResultCode('Request invalidated by user.'), + 812: ResultCode('Request deferred by user.'), +}, { + (800, 809): 'Request invalidated.', + (810, 819): 'Request deferred.', + (820, 899): 'Request context changed.' +}) + +hipc = Module('hipc', { + 1: ResultCode('Unsupported operation.'), + 102: ResultCode('Out of session memory.'), + (131, 139): ResultCode('Out of sessions.'), + 141: ResultCode('Pointer buffer is too small.'), + 200: ResultCode('Out of domains (session doesn\'t support domains).'), + 301: ResultCode('Session closed.'), + 402: ResultCode('Invalid request size.'), + 403: ResultCode('Unknown command type.'), + 420: ResultCode('Invalid CMIF request.'), + 491: ResultCode('Target is not a domain.'), + 492: ResultCode('Domain object was not found.') +}, { + (100, 299): 'Out of resources.' +}) + +dmnt = Module('dmnt', { + 1: ResultCode('Unknown error.'), + 2: ResultCode('Debugging is disabled.'), + + # atmosphere extension errors + 6500: ResultCode('Not attached.'), + 6501: ResultCode('Buffer is null.'), + 6502: ResultCode('Buffer is invalid.'), + 6503: ResultCode('ID is unknown.'), + 6504: ResultCode('Out of resources.'), + 6505: ResultCode('Cheat is invalid.'), + 6506: ResultCode('Cheat cannot be disabled.'), + 6600: ResultCode('Width is invalid.'), + 6601: ResultCode('Address already exists.'), + 6602: ResultCode('Address not found.'), + 6603: ResultCode('Address is out of resources.'), + 6700: ResultCode('Virtual machine condition depth is invalid.') +}, { + (6500, 6599): 'Cheat engine error.', + (6600, 6699): 'Frozen address error.' +}) + +pm = Module('pm', { + 1: ResultCode('Process not found.'), + 2: ResultCode('Already started.'), + 3: ResultCode('Not terminated.'), + 4: ResultCode('Debug hook in use.'), + 5: ResultCode('Application running.'), + 6: ResultCode('Invalid size.') +}) + +ns = Module('ns', { + 90: ResultCode('Canceled.'), + 110: ResultCode('Out of max running tasks.'), + 120: ResultCode('System update is not required.'), + 251: ResultCode('Unexpected storage ID.'), + 270: ResultCode('Card update not set up.'), + 280: ResultCode('Card update not prepared.'), + 290: ResultCode('Card update already set up.'), + 340: ResultCode('IsAnyInternetRequestAccepted with the output from GetClientId returned false.'), + 460: ResultCode('PrepareCardUpdate already requested.'), + 801: ResultCode('SystemDeliveryInfo system_delivery_protocol_version is less than the system setting.'), + 802: ResultCode('SystemDeliveryInfo system_delivery_protocol_version is greater than the system setting.'), + 892: ResultCode('Unknown state: reference count is zero.'), + 931: ResultCode('Invalid SystemDeliveryInfo HMAC/invalid Meta ID.'), + 2101: ResultCode('Inserted region-locked Tencent-Nintendo (Chinese) game cartridge into a non-Chinese console.', 'https://nintendoswitch.com.cn/support/') +}) + +kvdb = Module('kvdb', { + 1: ResultCode('Out of key resources.'), + 2: ResultCode('Key not found.'), + 4: ResultCode('Allocation failed.'), + 5: ResultCode('Invalid key value.'), + 6: ResultCode('Buffer insufficient.'), + 8: ResultCode('Invalid filesystem state.'), + 9: ResultCode('Not created.') +}) + +sm = Module('sm', { + 1: ResultCode('Out of processes.'), + 2: ResultCode('Invalid client (not initialized).'), + 3: ResultCode('Out of sessions.'), + 4: ResultCode('Already registered.'), + 5: ResultCode('Out of services.'), + 6: ResultCode('Invalid service name.'), + 7: ResultCode('Not registered.'), + 8: ResultCode('Not allowed (permission denied).'), + 9: ResultCode('Access control is too large.'), + + 1000: ResultCode('Should forward to session.'), + 1100: ResultCode('Process is not associated.') +}, { + (1000, 2000): 'Atmosphere man-in-the-middle (MITM) extension result.' +}) + +ro = Module('ro', { + 2: ResultCode('Out of address space.'), + 3: ResultCode('NRO already loaded.'), + 4: ResultCode('Invalid NRO.'), + 6: ResultCode('Invalid NRR.'), + 7: ResultCode('Too many NROs.'), + 8: ResultCode('Too many NRRs.'), + 9: ResultCode('Not authorized (bad NRO hash or NRR signature).'), + 10: ResultCode('Invalid NRR type.'), + 1023: ResultCode('Internal error.'), + 1025: ResultCode('Invalid address.'), + 1026: ResultCode('Invalid size.'), + 1028: ResultCode('NRO not loaded.'), + 1029: ResultCode('NRO not registered.'), + 1030: ResultCode('Invalid session (already initialized).'), + 1031: ResultCode('Invalid process (not initialized).') +}) + +spl = Module('spl', { + 1: ResultCode('Secure monitor: function is not implemented.'), + 2: ResultCode('Secure monitor: invalid argument.'), + 3: ResultCode('Secure monitor is busy.'), + 4: ResultCode('Secure monitor: function is not an async operation.'), + 5: ResultCode('Secure monitor: invalid async operation.'), + 6: ResultCode('Secure monitor: not permitted.'), + 7: ResultCode('Secure monitor: not initialized.'), + 100: ResultCode('Invalid size.'), + 101: ResultCode('Unknown secure monitor error.'), + 102: ResultCode('Decryption failed.'), + 104: ResultCode('Out of keyslots.'), + 105: ResultCode('Invalid keyslot.'), + 106: ResultCode('Boot reason was aleady set.'), + 107: ResultCode('Boot reason was not set.'), + 108: ResultCode('Invalid argument.') +}, { + (0, 99): 'Secure monitor error.' +}) + +i2c = Module('i2c', { + 1: ResultCode('No ACK.'), + 2: ResultCode('Bus is busy.'), + 3: ResultCode('Command list is full.'), + 4: ResultCode('Timed out.'), + 5: ResultCode('Unknown device.') +}) + +settings = Module('settings', { + 11: ResultCode('Settings item not found.'), + 101: ResultCode('Settings item key allocation failed.'), + 102: ResultCode('Settings item value allocation failed.'), + 201: ResultCode('Settings name is null.'), + 202: ResultCode('Settings item key is null.'), + 203: ResultCode('Settings item value is null.'), + 204: ResultCode('Settings item key buffer is null.'), + 205: ResultCode('Settings item value buffer is null.'), + 221: ResultCode('Settings name is empty.'), + 222: ResultCode('Settings item key is empty.'), + 241: ResultCode('Settings group name is too long.'), + 242: ResultCode('Settings item key is too long.'), + 261: ResultCode('Settings group name has invalid format.'), + 262: ResultCode('Settings item key has invalid format.'), + 263: ResultCode('Settings item value has invalid format.'), + 621: ResultCode('Language code.'), + 625: ResultCode('Language out of range.'), + 631: ResultCode('Network.'), + 651: ResultCode('Bluetooth device.'), + 652: ResultCode('Bluetooth device setting output count.'), + 653: ResultCode('Bluetooth enable flag.'), + 654: ResultCode('Bluetooth AFH enable flag.'), + 655: ResultCode('Bluetooth boost enable flag.'), + 656: ResultCode('BLE pairing.'), + 657: ResultCode('BLE pairing settings entry count.'), + 661: ResultCode('External steady clock source ID.'), + 662: ResultCode('User system clock context.'), + 663: ResultCode('Network system clock context.'), + 664: ResultCode('User system clock automatic correction enabled flag.'), + 665: ResultCode('Shutdown RTC value.'), + 666: ResultCode('External steady clock internal offset.'), + 671: ResultCode('Account settings.'), + 681: ResultCode('Audio volume.'), + 683: ResultCode('ForceMuteOnHeadphoneRemoved.'), + 684: ResultCode('Headphone volume warning.'), + 687: ResultCode('Invalid audio output mode.'), + 688: ResultCode('Headphone volume update flag.'), + 691: ResultCode('Console information upload flag.'), + 701: ResultCode('Automatic application download flag.'), + 702: ResultCode('Notification settings.'), + 703: ResultCode('Account notification settings entry count.'), + 704: ResultCode('Account notification settings.'), + 711: ResultCode('Vibration master volume.'), + 712: ResultCode('NX controller settings.'), + 713: ResultCode('NX controller settings entry count.'), + 714: ResultCode('USB full key enable flag.'), + 721: ResultCode('TV settings.'), + 722: ResultCode('EDID.'), + 731: ResultCode('Data deletion settings.'), + 741: ResultCode('Initial system applet program ID.'), + 742: ResultCode('Overlay disp program ID.'), + 743: ResultCode('IsInRepairProcess.'), + 744: ResultCode('RequresRunRepairTimeReviser.'), + 751: ResultCode('Device timezone location name.'), + 761: ResultCode('Primary album storage.'), + 771: ResultCode('USB 3.0 enable flag.'), + 772: ResultCode('USB Type-C power source circuit version.'), + 781: ResultCode('Battery lot.'), + 791: ResultCode('Serial number.'), + 801: ResultCode('Lock screen flag.'), + 803: ResultCode('Color set ID.'), + 804: ResultCode('Quest flag.'), + 805: ResultCode('Wireless certification file size.'), + 806: ResultCode('Wireless certification file.'), + 807: ResultCode('Initial launch settings.'), + 808: ResultCode('Device nickname.'), + 809: ResultCode('Battery percentage flag.'), + 810: ResultCode('Applet launch flags.'), + 1012: ResultCode('Wireless LAN enable flag.'), + 1021: ResultCode('Product model.'), + 1031: ResultCode('NFC enable flag.'), + 1041: ResultCode('ECI device certificate.'), + 1042: ResultCode('E-Ticket device certificate.'), + 1051: ResultCode('Sleep settings.'), + 1061: ResultCode('EULA version.'), + 1062: ResultCode('EULA version entry count.'), + 1071: ResultCode('LDN channel.'), + 1081: ResultCode('SSL key.'), + 1082: ResultCode('SSL certificate.'), + 1091: ResultCode('Telemetry flags.'), + 1101: ResultCode('Gamecard key.'), + 1102: ResultCode('Gamecard certificate.'), + 1111: ResultCode('PTM battery lot.'), + 1112: ResultCode('PTM fuel gauge parameter.'), + 1121: ResultCode('ECI device key.'), + 1122: ResultCode('E-Ticket device key.'), + 1131: ResultCode('Speaker parameter.'), + 1141: ResultCode('Firmware version.'), + 1142: ResultCode('Firmware version digest.'), + 1143: ResultCode('Rebootless system update version.'), + 1151: ResultCode('Mii author ID.'), + 1161: ResultCode('Fatal flags.'), + 1171: ResultCode('Auto update enable flag.'), + 1181: ResultCode('External RTC reset flag.'), + 1191: ResultCode('Push notification activity mode.'), + 1201: ResultCode('Service discovery control setting.'), + 1211: ResultCode('Error report share permission.'), + 1221: ResultCode('LCD vendor ID.'), + 1231: ResultCode('SixAxis sensor acceleration bias.'), + 1232: ResultCode('SixAxis sensor angular velocity bias.'), + 1233: ResultCode('SixAxis sensor acceleration gain.'), + 1234: ResultCode('SixAxis sensor angular velocity gain.'), + 1235: ResultCode('SixAxis sensor angular velocity time bias.'), + 1236: ResultCode('SixAxis sensor angular acceleration.'), + 1241: ResultCode('Keyboard layout.'), + 1245: ResultCode('Invalid keyboard layout.'), + 1251: ResultCode('Web inspector flag.'), + 1252: ResultCode('Allowed SSL hosts.'), + 1253: ResultCode('Allowed SSL hosts entry count.'), + 1254: ResultCode('FS mount point.'), + 1271: ResultCode('Amiibo key.'), + 1272: ResultCode('Amiibo ECQV certificate.'), + 1273: ResultCode('Amiibo ECDSA certificate.'), + 1274: ResultCode('Amiibo ECQV BLS key.'), + 1275: ResultCode('Amiibo ECQV BLS certificate.'), + 1276: ResultCode('Amiibo ECQV BLS root certificate.') +}, { + (100, 149): 'Internal error.', + (200, 399): 'Invalid argument.', + (621, 1276): 'Setting buffer is null.', +}) + +nifm = Module('nifm', { + 3400: ResultCode('The internet connection you are using requires authentication or a user agreement.' 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/22569/kw/2110-3400'), +}) + +vi = Module('vi', { + 1: ResultCode('Operation failed.'), + 6: ResultCode('Not supported.'), + 7: ResultCode('Not found.') +}) + +nfp = Module('nfp', { + 64: ResultCode('Device not found.'), + 96: ResultCode('Needs restart.'), + 128: ResultCode('Area needs to be created.'), + 152: ResultCode('Access ID mismatch.'), + 168: ResultCode('Area already created.') +}) + +time = Module('time', { + 0: ResultCode('Not initialized.'), + 1: ResultCode('Permission denied.'), + 102: ResultCode('Time not set (clock source ID mismatch).'), + 200: ResultCode('Not comparable.'), + 201: ResultCode('Signed over/under-flow.'), + 801: ResultCode('Memory allocation failure.'), + 901: ResultCode('Invalid pointer.'), + 902: ResultCode('Value out of range.'), + 903: ResultCode('TimeZoneRule conversion failed.'), + 989: ResultCode('TimeZone location name not found.'), + 990: ResultCode('Unimplemented.') +}, { + (900, 919): 'Invalid argument.' +}) + +friends = Module('friends', { + 6: ResultCode('IsAnyInternetRequestAccepted with the output from GetClientId returned false.'), +}) + +bcat = Module('bcat', { + 1: ResultCode('Invalid argument.'), + 2: ResultCode('Object not found.'), + 3: ResultCode('Object locked (in use).'), + 4: ResultCode('Target already mounted.'), + 5: ResultCode('Target not mounted.'), + 6: ResultCode('Object already opened.'), + 7: ResultCode('Object not opened.'), + 8: ResultCode('IsAnyInternetRequestAccepted with the output from GetClientId returned false.'), + 80: ResultCode('Passphrase not found.'), + 81: ResultCode('Data verification failed.'), + 90: ResultCode('Invalid API call.'), + 98: ResultCode('Invalid operation.') +}) + +ssl = Module('ssl', { + 11: ResultCode('Returned during various NSS SEC, NSPR and NSS SSL errors.', 'https://switchbrew.org/wiki/Error_codes'), + 13: ResultCode('Unrecognized error.'), + 102: ResultCode('Out of memory or table full (NSS SEC error -8173 or NSPR errors -6000, -5974, -5971).'), + 116: ResultCode('NSPR error -5999 (PR_BAD_DESCRIPTOR_ERROR).'), + 204: ResultCode('NSPR error -5998 (PR_WOULD_BLOCK_ERROR).'), + 205: ResultCode('NSPR error -5990 (PR_IO_TIMEOUT_ERROR).'), + 206: ResultCode('NSPR error -5935 (PR_OPERATION_ABORTED_ERROR)..'), + 208: ResultCode('NSPR error -5978 (PR_NOT_CONNECTED_ERROR).'), + 209: ResultCode('NSPR error -5961 (PR_CONNECT_RESET_ERROR).'), + 210: ResultCode('NSPR error -5928 (PR_CONNECT_ABORTED_ERROR).'), + 211: ResultCode('NSPR error -5929 (PR_SOCKET_SHUTDOWN_ERROR).'), + 212: ResultCode('NSPR error -5930 (PR_NETWORK_DOWN_ERROR).'), + 215: ResultCode('ClientPki/InternalPki was already previously imported/registered.'), + 218: ResultCode('Maximum number of ServerPki objects were already imported.'), + 301: ResultCode('NSS SSL error -12276 (SSL_ERROR_BAD_CERT_DOMAIN).'), + 302: ResultCode('NSS SSL error -12285 (SSL_ERROR_NO_CERTIFICATE).'), + 303: ResultCode('NSS SEC errors: -8181 (SEC_ERROR_EXPIRED_CERTIFICATE), -8162 (SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE).'), + 304: ResultCode('NSS SEC error -8180 (SEC_ERROR_REVOKED_CERTIFICATE).'), + 305: ResultCode('NSS SEC error -8183 (SEC_ERROR_BAD_DER).'), + 306: ResultCode('NSS SEC errors: -8102 (SEC_ERROR_INADEQUATE_KEY_USAGE), -8101 (SEC_ERROR_INADEQUATE_CERT_TYPE).'), + 307: ResultCode('NSS SEC errors: -8185 (SEC_ERROR_INVALID_AVA), -8182 (SEC_ERROR_BAD_SIGNATURE), -8158 (SEC_ERROR_EXTENSION_VALUE_INVALID), -8156 (SEC_ERROR_CA_CERT_INVALID), -8151 (SEC_ERROR_UNKNOWN_CRITICAL_EXTENSION), -8080 (SEC_ERROR_CERT_NOT_IN_NAME_SPACE).'), + 308: ResultCode('NSS SEC errors: -8179 (SEC_ERROR_UNKNOWN_ISSUER), -8172 (SEC_ERROR_UNTRUSTED_ISSUER), -8014 (SEC_ERROR_APPLICATION_CALLBACK_ERROR).'), + 309: ResultCode('NSS SEC error -8171 (SEC_ERROR_UNTRUSTED_CERT).'), + 310: ResultCode('NSS SSL errors: -12233 (SSL_ERROR_RX_UNKNOWN_RECORD_TYPE), -12232 (SSL_ERROR_RX_UNKNOWN_HANDSHAKE), -12231 (SSL_ERROR_RX_UNKNOWN_ALERT). This is also returned by ImportClientPki when import fails.'), + 311: ResultCode('NSS SSL errors: One of various malformed request errors. See Switchbrew for the complete list.'), + 312: ResultCode('NSS SEC errors: One of various unexpected request errors. See Switchbrew for the complete list.'), + 313: ResultCode(' NSS SSL errors: -12237 (SSL_ERROR_RX_UNEXPECTED_CHANGE_CIPHER), -12236 (SSL_ERROR_RX_UNEXPECTED_ALERT), -12235 (SSL_ERROR_RX_UNEXPECTED_HANDSHAKE), -12234 (SSL_ERROR_RX_UNEXPECTED_APPLICATION_DATA).'), + 314: ResultCode('NSS SSL error -12263 (SSL_ERROR_RX_RECORD_TOO_LONG).'), + 315: ResultCode('NSS SSL error -12165 (SSL_ERROR_RX_UNEXPECTED_HELLO_VERIFY_REQUEST).'), + 316: ResultCode('NSS SSL error -12163 (SSL_ERROR_RX_UNEXPECTED_CERT_STATUS).'), + 317: ResultCode('NSS SSL error -12160 (SSL_ERROR_INCORRECT_SIGNATURE_ALGORITHM).'), + 318: ResultCode('NSS SSL errors: -12173 (SSL_ERROR_WEAK_SERVER_EPHEMERAL_DH_KEY), -12156 (SSL_ERROR_WEAK_SERVER_CERT_KEY).'), + 319: ResultCode('NSS SSL error -12273 (SSL_ERROR_BAD_MAC_READ).'), + 321: ResultCode('NSS SSL errors: -12215 (SSL_ERROR_MD5_DIGEST_FAILURE), -12214 (SSL_ERROR_SHA_DIGEST_FAILURE), -12161 (SSL_ERROR_DIGEST_FAILURE).'), + 322: ResultCode('NSS SSL error -12213 (SSL_ERROR_MAC_COMPUTATION_FAILURE).'), + 324: ResultCode('NSS SEC error -8157 (SEC_ERROR_EXTENSION_NOT_FOUND).'), + 325: ResultCode('NSS SEC error -8049 (SEC_ERROR_UNRECOGNIZED_OID).'), + 326: ResultCode('NSS SEC error -8032 (SEC_ERROR_POLICY_VALIDATION_FAILED).'), + 330: ResultCode('NSS SSL error -12177 (SSL_ERROR_DECOMPRESSION_FAILURE).'), + 1501: ResultCode('NSS SSL error -12230 (SSL_ERROR_CLOSE_NOTIFY_ALERT).'), + 1502: ResultCode('NSS SSL error -12229 (SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT).'), + 1503: ResultCode('NSS SSL error -12272 (SSL_ERROR_BAD_MAC_ALERT).'), + 1504: ResultCode('NSS SSL error -12197 (SSL_ERROR_DECRYPTION_FAILED_ALERT).'), + 1505: ResultCode('NSS SSL error -12196 (SSL_ERROR_RECORD_OVERFLOW_ALERT).'), + 1506: ResultCode('NSS SSL error -12228 (SSL_ERROR_DECOMPRESSION_FAILURE_ALERT).'), + 1507: ResultCode('NSS SSL error -12227 (SSL_ERROR_HANDSHAKE_FAILURE_ALERT).'), + 1509: ResultCode('NSS SSL error -12271 (SSL_ERROR_BAD_CERT_ALERT).'), + 1510: ResultCode('NSS SSL error -12225 (SSL_ERROR_UNSUPPORTED_CERT_ALERT).'), + 1511: ResultCode('NSS SSL error -12270 (SSL_ERROR_REVOKED_CERT_ALERT).'), + 1512: ResultCode('NSS SSL error -12269 (SSL_ERROR_EXPIRED_CERT_ALERT).'), + 1513: ResultCode('NSS SSL error -12224 (SSL_ERROR_CERTIFICATE_UNKNOWN_ALERT).'), + 1514: ResultCode('NSS SSL error -12226 (SSL_ERROR_ILLEGAL_PARAMETER_ALERT).'), + 1515: ResultCode('NSS SSL error -12195 (SSL_ERROR_UNKNOWN_CA_ALERT).'), + 1516: ResultCode('NSS SSL error -12194 (SSL_ERROR_ACCESS_DENIED_ALERT).'), + 1517: ResultCode('NSS SSL error -12193 (SSL_ERROR_DECODE_ERROR_ALERT).'), + 1518: ResultCode('NSS SSL error -12192 (SSL_ERROR_DECRYPT_ERROR_ALERT).'), + 1519: ResultCode('NSS SSL error -12191 (SSL_ERROR_EXPORT_RESTRICTION_ALERT).'), + 1520: ResultCode('NSS SSL error -12190 (SSL_ERROR_PROTOCOL_VERSION_ALERT).'), + 1521: ResultCode('NSS SSL error -12189 (SSL_ERROR_INSUFFICIENT_SECURITY_ALERT).'), + 1522: ResultCode('NSS SSL error -12188 (SSL_ERROR_INTERNAL_ERROR_ALERT).'), + 1523: ResultCode('NSS SSL error -12157 (SSL_ERROR_INAPPROPRIATE_FALLBACK_ALERT).'), + 1524: ResultCode('NSS SSL error -12187 (SSL_ERROR_USER_CANCELED_ALERT).'), + 1525: ResultCode('NSS SSL error -12186 (SSL_ERROR_NO_RENEGOTIATION_ALERT).'), + 1526: ResultCode('NSS SSL error -12184 (SSL_ERROR_UNSUPPORTED_EXTENSION_ALERT).'), + 1527: ResultCode('NSS SSL error -12183 (SSL_ERROR_CERTIFICATE_UNOBTAINABLE_ALERT).'), + 1528: ResultCode('NSS SSL error -12182 (SSL_ERROR_UNRECOGNIZED_NAME_ALERT).'), + 1529: ResultCode('NSS SSL error -12181 (SSL_ERROR_BAD_CERT_STATUS_RESPONSE_ALERT).'), + 1530: ResultCode('NSS SSL error -12180 (SSL_ERROR_BAD_CERT_HASH_VALUE_ALERT).'), + 5001: ResultCode('NSS SSL error -12155 (SSL_ERROR_RX_SHORT_DTLS_READ).'), + 5007: ResultCode('Out-of-bounds error during error conversion.') +}) + +account = Module('account', { + 59: ResultCode('IsAnyInternetRequestAccepted with the output from GetClientId returned false.'), + 3000: ResultCode('System update is required.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/27166/'), + 4007: ResultCode('Console is permanently banned.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/28046/', is_ban=True), + 4025: ResultCode('Game Card is banned. If you have a legitimate cartridge and this happened to you, contact Nintendo.', is_ban=True), + 4027: ResultCode('Console (and Nintendo Account) are temporarily banned from a game.', is_ban=True), + 4508: ResultCode('Console is permanently banned.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/28046/', is_ban=True), + 4517: ResultCode('Console is permanently banned.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/43652/', is_ban=True), + 4609: ResultCode('The online service is no longer available.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/46482/'), + 4621: ResultCode('Tencent-Nintendo (Chinese) consoles cannot use online features in foreign games.' 'https://nintendoswitch.com.cn/support/'), + 5111: ResultCode('Complete account ban.', is_ban=True) +}) + +mii = Module('mii', { + 1: ResultCode('Invalid argument.'), + 4: ResultCode('Entry not found.'), + 67: ResultCode('Invalid database signature value (should be "NFDB").'), + 69: ResultCode('Invalid database entry count.'), + 204: ResultCode('Development/debug-only behavior.') +}) + +am = Module('am', { + 2: ResultCode('IStorage not available.'), + 3: ResultCode('No messages.'), + 35: ResultCode('Error while launching applet.'), + 37: ResultCode('Program ID not found. This usually happens when applet launch fails.'), + 500: ResultCode('Invalid input.'), + 502: ResultCode('IStorage is already opened.'), + 503: ResultCode('IStorage read/write out of bounds.'), + 506: ResultCode('Invalid parameters.'), + 511: ResultCode('IStorage opened as wrong type (e.g. data opened as TransferMemory, or TransferMemory opened as data.'), + 518: ResultCode('Null object.'), + 600: ResultCode('Failed to allocate memory for IStorage.'), + 712: ResultCode('Thread stack pool exhausted.'), + 974: ResultCode('DebugMode not enabled.'), + 980: ResultCode('am.debug!dev_function setting needs to be set (DebugMode not enabled).'), + 998: ResultCode('Not implemented.'), +}) + +prepo = Module('prepo', { + 102: ResultCode('Transmission not agreed.'), + 105: ResultCode('Network unavailable.'), + 1005: ResultCode('Couldn\'t resolve proxy.'), + 1006: ResultCode('Couldn\'t resolve host.'), + 1007: ResultCode('Couldn\'t connect.'), + 1023: ResultCode('Write error.'), + 1026: ResultCode('Read error.'), + 1027: ResultCode('Out of memory.'), + 1028: ResultCode('Operation timed out.'), + 1035: ResultCode('SSL connection error.'), + 1051: ResultCode('Peer failed verification.'), + 1052: ResultCode('Got nothing.'), + 1055: ResultCode('Send error.'), + 1056: ResultCode('Recv error.'), + 1058: ResultCode('SSL cert problem.'), + 1059: ResultCode('SSL cipher.'), + 1060: ResultCode('SSL CA cert.'), + 2400: ResultCode('Status 400.'), + 2401: ResultCode('Status 401.'), + 2403: ResultCode('Status 403.'), + 2500: ResultCode('Status 500.'), + 2503: ResultCode('Status 503.'), + 2504: ResultCode('Status 504.'), +}, { + (1005, 1060): 'HTTP error.', + (2400, 2504): 'Server error.' +}) + +pcv = Module('pcv', { + 2: ResultCode('Invalid DVFS table ID.'), + 3: ResultCode('DVFS table ID for debug only.'), + 4: ResultCode('Invalid parameter.') +}) + +nim = Module('nim', { + 10: ResultCode('Already initialized.'), + 30: ResultCode('Task not found.'), + 40: ResultCode('Memory allocation failed (due to bad input?).'), + 70: ResultCode('HTTP connection canceled.'), + 330: ResultCode('ContentMetaType does not match SystemUpdate.'), + 5001: ResultCode('A socket error occurred (ENETDOWN, ECONNRESET, EHOSTDOWN, EHOSTUNREACH, or EPIPE). Also occurs when the received size doesn\'t match the expected size (recvfrom() ret with meta_size data receiving).'), + 5010: ResultCode('Socket was shutdown due to the async operation being cancelled.'), + 5020: ResultCode('Too many internal input entries with nim command 42, or an unrecognized socket error occurred.'), + 5100: ResultCode('Connection time-out.'), + 5410: ResultCode('Invalid ID.'), + 5420: ResultCode('Invalid magicnum. Can also be caused by the connection being closed by the peer, since non-negative return values from recv() are ignored in this case.'), + 5430: ResultCode('Invalid data_size.'), + 5440: ResultCode('The input ContentMetaKey doesn\'t match the ContentMetaKey in state.'), + 5450: ResultCode('Invalid meta_size.'), + 7001: ResultCode('Invalid HTTP response code (>=600).'), + 7002: ResultCode('Invalid HTTP client response code (4xx).'), + 7003: ResultCode('Invalid HTTP server response code (5xx).'), + 7004: ResultCode('Invalid HTTP redirect response code (3xx).'), + (7300, 7308): ResultCode('HTTP response code 300-308.'), + (7400, 7417): ResultCode('HTTP response code 400-417.'), + (7500, 7509): ResultCode('HTTP response code 500-509.'), + 7800: ResultCode('Unknown/invalid libcurl error.'), + (8001, 8096): ResultCode('libcurl error 1-96. Some errors map to the 7800 result code range instead, however.') +}) + +psc = Module('psc', { + 2: ResultCode('Already initialized.'), + 3: ResultCode('Not initialized.') +}) + +usb = Module('usb', { + 51: ResultCode('USB data transfer in progress.'), + 106: ResultCode('Invalid descriptor.'), + 201: ResultCode('USB device not bound or interface already enabled.') +}) + +pctl = Module('pctl', { + 223: ResultCode('IsAnyInternetRequestAccepted with the output from GetClientId returned false.') +}) + +applet = Module('applet', { + 1: ResultCode('Exited abnormally.'), + 3: ResultCode('Cancelled.'), + 4: ResultCode('Rejected.'), + 5: ResultCode('Exited unexpectedly.') +}) + +erpt = Module('erpt', { + 1: ResultCode('Not initialized.'), + 2: ResultCode('Already initialized.'), + 3: ResultCode('Out of array space.'), + 4: ResultCode('Out of field space.'), + 5: ResultCode('Out of memory.'), + 7: ResultCode('Invalid argument.'), + 8: ResultCode('Not found.'), + 9: ResultCode('Field category mismatch.'), + 10: ResultCode('Field type mismatch.'), + 11: ResultCode('Already exists.'), + 12: ResultCode('Journal is corrupted.'), + 13: ResultCode('Category not found.'), + 14: ResultCode('Required context is missing.'), + 15: ResultCode('Required field is missing.'), + 16: ResultCode('Formatter error.'), + 17: ResultCode('Invalid power state.'), + 18: ResultCode('Array field is too large.'), + 19: ResultCode('Already owned.') +}) + +audio = Module('audio', { + 1: ResultCode('Invalid audio device.'), + 2: ResultCode('Operation failed.'), + 3: ResultCode('Invalid sample rate.'), + 4: ResultCode('Buffer size too small.'), + 8: ResultCode('Too many buffers are still unreleased.'), + 10: ResultCode('Invalid channel count.'), + 513: ResultCode('Invalid/unsupported operation.'), + 1536: ResultCode('Invalid handle.'), + 1540: ResultCode('Audio output was already started.') +}) + +arp = Module('arp', { + 30: ResultCode('Address is NULL.'), + 31: ResultCode('PID is NULL.'), + 42: ResultCode('Already bound'), + 102: ResultCode('Invalid PID.') +}) + +updater = Module('updater', { + 2: ResultCode('Boot image package not found.'), + 3: ResultCode('Invalid boot image package.'), + 4: ResultCode('Work buffer is too small.'), + 5: ResultCode('Work buffer is not aligned.'), + 6: ResultCode('Needs repair boot images.') +}) + +userland_assert = Module('userland (assert)', { + 0: ResultCode('Undefined instruction.'), + 1: ResultCode('Application aborted (usually svcBreak).'), + 2: ResultCode('System module aborted.'), + 3: ResultCode('Unaligned userland PC.'), + 8: ResultCode('Attempted to call an SVC outside of the whitelist.') +}) + +fatal = Module('fatal', { + 1: ResultCode('Allocation failed.'), + 2: ResultCode('Graphics buffer is null.'), + 3: ResultCode('Already thrown.'), + 4: ResultCode('Too many events.'), + 5: ResultCode('In repair without volume held.'), + 6: ResultCode('In repair without time reviser cartridge.') +}) + +ec = Module('ec', { + 20: ResultCode('Unable to start the software.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/22539/kw/2164-0020'), + 56: ResultCode('IsAnyInternetRequestAccepted with the output from GetClientId returned false.') +}) + +creport = Module('userland assert/crash', { + 0: ResultCode('Undefined instruction.'), + 1: ResultCode('Instruction abort.'), + 2: ResultCode('Data abort.'), + 3: ResultCode('Alignment fault.'), + 4: ResultCode('Debugger attached.'), + 5: ResultCode('Breakpoint.'), + 6: ResultCode('User break.'), + 7: ResultCode('Debugger break.'), + 8: ResultCode('Undefined system call.'), + 9: ResultCode('Memory system error.'), + 99: ResultCode('Report is incomplete.') +}) + +jit = Module('jit', { + 2: ResultCode('Bad version.'), + 101: ResultCode('Input NRO/NRR is too large for the storage buffer.'), + 600: ResultCode('Function pointer is not initialized (Control/GenerateCode).'), + 601: ResultCode('DllPlugin not initialized, or plugin NRO already loaded.'), + 602: ResultCode('An error occurred when calling the function pointer with the Control command.'), +}) + +dauth = Module('dauth', { + 4008: ResultCode('Console is permanently banned by Nintendo.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/42061/kw/2181-4008', is_ban=True) +}) + +dbg = Module('dbg', { + 1: ResultCode('Cannot debug.'), + 2: ResultCode('Already attached.'), + 3: ResultCode('Cancelled.') +}) + +calibration = Module('calibration', { + 101: ResultCode('Calibration data CRC error.'), +}) + +capsrv = Module('capsrv (capture)', { + 3: ResultCode('Album work memory error.'), + 7: ResultCode('Album is already opened.'), + 8: ResultCode('Album is out of range.'), + 11: ResultCode('The application ID is invalid.'), + 12: ResultCode('The timestamp is invalid.'), + 13: ResultCode('The storage is invalid.'), + 14: ResultCode('The filecontents is invalid.'), + 21: ResultCode('Album is not mounted.'), + 22: ResultCode('Album is full.'), + 23: ResultCode('File not found.'), + 24: ResultCode('The file data is invalid.'), + 25: ResultCode('The file count limit has been reached.'), + 26: ResultCode('The file has no thumbnail.'), + 30: ResultCode('The read buffer is too small.'), + 96: ResultCode('The destination is corrupted.'), + 820: ResultCode('Control resource limit reached.'), + 822: ResultCode('Control is not opened.'), + 1023: ResultCode('Not supported.'), + 1210: ResultCode('Internal JPEG encoder error.'), + 1212: ResultCode('Internal JPEG work memory shortage.'), + 1301: ResultCode('The file data was empty.'), + 1302: ResultCode('EXIF extraction failed.'), + 1303: ResultCode('EXIF data analysis failed.'), + 1304: ResultCode('Datetime extraction failed.'), + 1305: ResultCode('Invalid datetime length.'), + 1306: ResultCode('Inconsistent datatime.'), + 1307: ResultCode('Make note extraction failed.'), + 1308: ResultCode('Inconsistent application ID.'), + 1309: ResultCode('Inconsistent signature.'), + 1310: ResultCode('Unsupported orientation.'), + 1311: ResultCode('Invalid data dimension.'), + 1312: ResultCode('Inconsistent orientation.'), + 1401: ResultCode('File count limit has been reached.'), + 1501: ResultCode('EXIF extraction failed.'), + 1502: ResultCode('Maker note extraction failed'), + 1701: ResultCode('Album session limit reached.'), + 1901: ResultCode('File count limit reached.'), + 1902: ResultCode('Error when creating file.'), + 1903: ResultCode('File creation retry limit reached.'), + 1904: ResultCode('Error opening file.'), + 1905: ResultCode('Error retrieving the file size.'), + 1906: ResultCode('Error setting the file size.'), + 1907: ResultCode('Error when reading the file.'), + 1908: ResultCode('Error when writing the file.') +}, { + (10, 19): 'Album: invalid file ID.', + (90, 99): 'Album: filesystem error.', + (800, 899): 'Control error.', + # (1024, 2047): 'Internal error.', + (1200, 1299): 'Internal JPEG encoder error.', + (1300, 1399): 'Internal file data verification error.', + (1400, 1499): 'Internal album limitation error.', + (1500, 1599): 'Internal signature error.', + (1700, 1799): 'Internal album session error.', + (1900, 1999): 'Internal album temporary file error.' + +}) + +pgl = Module('pgl', { + 2: ResultCode('Not available.'), + 3: ResultCode('Application not running.'), + 4: ResultCode('Buffer is not enough.'), + 5: ResultCode('Application content record was not found.'), + 6: ResultCode('Content meta was not found.') +}) + +web_applet = Module('web applet', { + 1006: ResultCode('This error code indicates an issue with the DNS used or that the connection timed out.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/25859/p/897'), + 1028: ResultCode('This error code generally indicates that your connection to the Nintendo eShop has timed out.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/22503/p/897'), + 2750: ResultCode('MP4 parsing failed.'), + 5001: ResultCode('This error code indicates an error occurred when connecting to the service, likely the result of the network environment.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/22392/p/897'), +}) + +youtube_app = Module('youtube', { + 0: ResultCode('This error typically occurs when your system clock isn\'t set correctly. If the problem persists, try reinstalling YouTube from the Nintendo eShop.') +}) + +arms_game = Module('ARMS', { + 1021: ResultCode('This error code indicates the connection has likely timed out during a download.', 'https://en-americas-support.nintendo.com/app/answers/detail/a_id/26250/~/error-code%3A-2-aabqa-1021') +}) + +splatoon_game = Module('Splatoon 2', { + 3400: ResultCode('You have been kicked from the online service due to using exefs/romfs edits.') +}) + +# known homebrew modules go below here +libnx = Module('libnx', { + 1: ResultCode('Bad relocation.'), + 2: ResultCode('Out of memory.'), + 3: ResultCode('Already mapped.'), + 4: ResultCode('Bad getinfo: stack.'), + 5: ResultCode('Bad getinfo: heap.'), + 6: ResultCode('Bad QueryMemory.'), + 7: ResultCode('Aleady initialized.'), + 8: ResultCode('Not initialized.'), + 9: ResultCode('Not found.'), + 10: ResultCode('I/O error.'), + 11: ResultCode('Bad input.'), + 12: ResultCode('Bad re-entry.'), + 13: ResultCode('Buffer producer error.'), + 14: ResultCode('Handle too early.'), + 15: ResultCode('Heap alloc too early.'), + 16: ResultCode('Heap alloc failed.'), + 17: ResultCode('Too many overrides.'), + 18: ResultCode('Parcel error.'), + 19: ResultCode('Bad graphics init.'), + 20: ResultCode('Bad graphics queue buffer.'), + 21: ResultCode('Bad graphics dequeue buffer.'), + 22: ResultCode('Applet command ID not found.'), + 23: ResultCode('Bad applet receive message.'), + 24: ResultCode('Bad applet notify running.'), + 25: ResultCode('Bad applet get current focus state.'), + 26: ResultCode('Bad applet get operation mode.'), + 27: ResultCode('Bad applet get performance mode.'), + 28: ResultCode('Bad USB comms read.'), + 29: ResultCode('Bad USB comms write.'), + 30: ResultCode('Failed to initialize sm.'), + 31: ResultCode('Failed to initialize am.'), + 32: ResultCode('Failed to initialize hid.'), + 33: ResultCode('Failed to initialize fs.'), + 34: ResultCode('Bad getinfo: rng'), + 35: ResultCode('JIT unavailable.'), + 36: ResultCode('Weird kernel.'), + 37: ResultCode('Incompatible system firmware version.'), + 38: ResultCode('Failed to initialize time.'), + 39: ResultCode('Too many dev op tabs.'), + 40: ResultCode('Domain message was of an unknown type.'), + 41: ResultCode('Domain message had too many object IDs.'), + 42: ResultCode('Failed to initialize applet.'), + 43: ResultCode('Failed to initialize apm.'), + 44: ResultCode('Failed to initialize nvinfo.'), + 45: ResultCode('Failed to initialize nvbuf.'), + 46: ResultCode('Libapplet bad exit.'), + 47: ResultCode('Invalid CMIF out header.'), + 48: ResultCode('Should not happen.') +}) + +hb_abi = Module('homebrew ABI', { + 0: ResultCode('End of list.'), + 1: ResultCode('Main thread handle.'), + 2: ResultCode('Next load path.'), + 3: ResultCode('Override heap.'), + 4: ResultCode('Override service.'), + 5: ResultCode('Argv.'), + 6: ResultCode('Syscall available hint.'), + 7: ResultCode('Applet type.'), + 8: ResultCode('Applet workaround.'), + 9: ResultCode('Reserved9.'), + 10: ResultCode('Process handle.'), + 11: ResultCode('Last load result.'), + 12: ResultCode('Alloc pages.'), + 13: ResultCode('Lock region.'), + 14: ResultCode('Random seed.'), + 15: ResultCode('User ID storage.'), + 16: ResultCode('HOS version.') +}) + +hbl = Module('homebrew loader', { + 1: ResultCode('Failed to initialize sm.'), + 2: ResultCode('Failed to initialize fs.'), + 3: ResultCode('Next NRO to run was not found. This is usually caused by `hbmenu.nro` not being found on the root of the SD card.'), + 4: ResultCode('Failed to read NRO.'), + 5: ResultCode('NRO header magic is invalid.'), + 6: ResultCode('NRO size does not match size indicated by header.'), + 7: ResultCode('Failed to read the rest of the NRO.'), + 8: ResultCode('Reached an unreachable location in hbloader main(). What are you doing here? This area is off-limits.'), + 9: ResultCode('Unable to set heap size, or heap address was NULL.'), + 10: ResultCode('Failed to create service thread.'), + 12: ResultCode('Unable to create svc session.'), + 13: ResultCode('Failed to start service thread.'), + 15: ResultCode('An error occurred while executing svcReplyAndReceive.'), + 17: ResultCode('Too many (> 1) copy handles from hipcParseRequest.'), + 18: ResultCode('Failed to map process code memory.'), + 19: ResultCode('Failed to set process .text memory permissions.'), + 20: ResultCode('Failed to set process .rodata memory permissions.'), + 21: ResultCode('Failed to set process .data & .bss memory permissions.'), + 24: ResultCode('Failed to unmap process .text.'), + 25: ResultCode('Failed to unmap process .rodata.'), + 26: ResultCode('Failed to unmap process .data and .bss.'), + 39: ResultCode('Attempted to call exit(), which should never happen.'), + 404: ResultCode('Failed to mount SD card.') +}) + +lnx_nvidia = Module('libnx (NVIDIA)', { + 1: ResultCode('Not implemented.'), + 2: ResultCode('Not supported.'), + 3: ResultCode('Not initialized.'), + 4: ResultCode('Bad parameter.'), + 5: ResultCode('Timed out.'), + 6: ResultCode('Insufficient memory.'), + 7: ResultCode('Read-only attribute.'), + 8: ResultCode('Invalid state.'), + 9: ResultCode('Invalid address.'), + 10: ResultCode('Invalid size.'), + 11: ResultCode('Bad value.'), + 13: ResultCode('Already allocated.'), + 14: ResultCode('Busy.'), + 15: ResultCode('Resource error.'), + 16: ResultCode('Count mismatch.'), + 4096: ResultCode('Shared memory too small.'), + # 0x30003: ResultCode('File operation failed.') # This actually belongs to OS. +}) + +lnx_binder = Module('libnx (binder)', { + 1: ResultCode('Permission denied.'), + 2: ResultCode('Name not found.'), + 11: ResultCode('Would block.'), + 12: ResultCode('No memory.'), + 17: ResultCode('Already exists.'), + 19: ResultCode('No init.'), + 22: ResultCode('Bad value.'), + 32: ResultCode('Dead object.'), + 38: ResultCode('Invalid operation.'), + 61: ResultCode('Not enough data.'), + 74: ResultCode('Unknown transaction.'), + 75: ResultCode('Bad index.'), + 110: ResultCode('Timed out.') + # TODO: How do I express INT32_MIN in pythonic terms? + # -(INT32_MIN + 7): ResultCode('Fds not allowed.'), + # -(INT32_MIN + 2): ResultCode('Failed transaction.'), + # -(INT32_MIN + 1): ResultCode('Bad type.'), +}) + +emuiibo = Module('emuiibo', { + 1: ResultCode('No active virtual Amiibo.'), + 2: ResultCode('Invalid virtual Amiibo.'), + 3: ResultCode('Iterator end reached.'), + 4: ResultCode('Unable to read Mii.') +}) + +exosphere = Module('exosphere', { + 1: ResultCode('Not present.'), + 2: ResultCode('Version mismatch.') +}) + +# We have some modules partially documented, those that aren't have dummy Modules. +modules = { + 1: kernel, + 2: fs, + 3: os, + 4: Module('htcs'), + 5: ncm, + 6: Module('dd'), + 7: dmnt, + 8: lr, + 9: loader, + 10: sf, + 11: hipc, + 13: dmnt, + 15: pm, + 16: ns, + 17: Module('bsdsockets'), + 18: Module('htc'), + 19: Module('tsc'), + 20: kvdb, + 21: sm, + 22: ro, + 23: Module('gc'), + 24: Module('sdmmc'), + 25: Module('ovln'), + 26: spl, + 27: Module('socket'), + 29: Module('htclow'), + 30: Module('bus'), + 31: Module('hfcsfs'), + 32: Module('async'), + 100: Module('ethc'), + 101: i2c, + 102: Module('gpio'), + 103: Module('uart'), + 105: settings, + 107: Module('wlan'), + 108: Module('xcd'), + 110: nifm, + 111: Module('hwopus'), + 113: Module('bluetooth'), + 114: vi, + 115: nfp, + 116: time, + 117: Module('fgm'), + 118: Module('oe'), + 120: Module('pcie'), + 121: friends, + 122: bcat, + 123: ssl, + 124: account, + 125: Module('news'), + 126: mii, + 127: Module('nfc'), + 128: am, + 129: prepo, + 130: Module('ahid'), + 132: Module('qlaunch'), + 133: pcv, + 134: Module('omm'), + 135: Module('bpc'), + 136: Module('psm'), + 137: nim, + 138: psc, + 139: Module('tc'), + 140: usb, + 141: Module('nsd'), + 142: pctl, + 143: Module('btm'), + 144: applet, + 145: Module('es'), + 146: Module('ngc'), + 147: erpt, + 148: Module('apm'), + 149: Module('cec'), + 150: Module('profiler'), + 151: Module('eupld'), + 153: audio, + 154: Module('npns'), + 155: Module('npns xmpp stream'), + 157: arp, + 158: updater, + 159: Module('swkbd'), + 161: Module('mifare'), + 162: userland_assert, + 163: fatal, + 164: ec, + 165: Module('spsm'), + 167: Module('bgtc'), + 168: creport, + 175: jit, + 178: Module('pdm'), + 179: Module('olsc'), + 180: Module('srepo'), + 181: dauth, + 183: dbg, + 187: Module('sasbus'), + 189: Module('pwm'), + 191: Module('rtc'), + 192: Module('regulator'), + 193: Module('led'), + 197: Module('clkrst'), + 198: calibration, + 202: Module('hid'), + 203: Module('ldn'), + 205: Module('irsensor'), + 206: capsrv, + 208: Module('manu'), + 210: Module('web'), + 211: Module('lcs'), + 212: Module('grc'), + 214: Module('album'), + 216: Module('migration'), + 218: Module('hidbus'), + 223: Module('websocket'), + 228: pgl, + 229: Module('notification'), + 230: Module('ins'), + 231: Module('lp2p'), + + 800: web_applet, + 809: web_applet, + 810: web_applet, + 811: web_applet, + 'arvha': youtube_app, + 'aabqa': arms_game, + 'aab6a': splatoon_game, + + # Add non-nintendo modules below here. + 345: libnx, + 346: hb_abi, + 347: hbl, + 348: lnx_nvidia, + 349: lnx_binder, + 352: emuiibo, + 416: Module('SwitchPresence-Rewritten'), + 444: exosphere, + 789: Module('SwitchPresence-Old-Random'), +} + +# regex for result code format "XXXX-YYYY" +RE = re.compile(r'2\d{3}-\d{4}') + +# regex for result code format "2-BBBBB-CCCC" +# The first digit always appears to be "2" for games/applications. +RE_APP = re.compile(r'2-[a-zA-Z0-9]{5}-\d{4}') + +CONSOLE_NAME = 'Nintendo Switch' + +# Suggested color to use if displaying information through a Discord bot's embed +COLOR = 0xE60012 + + +def is_valid(error): + err_int = None + if error.startswith('0x'): + err_int = int(error, 16) + if err_int: + return not err_int & 0x80000000 + return RE.match(error) or RE_APP.match(error) + + +def err2hex(error, suppress_error=False): + if RE.match(error): + module = int(error[:4]) - 2000 + desc = int(error[5:9]) + code = (desc << 9) + module + return hex(code) + if RE_APP.match(error) and not suppress_error: + return '2-BBBBB-CCCC format error codes are not supported.' + return '' + + +def hex2err(error): + if error.startswith('0x'): + error = error[2:] + error = int(error, 16) + module = error & 0x1FF + desc = (error >> 9) & 0x3FFF + code = f'{module + 2000:04}-{desc:04}' + return code + + +def get(error): + if RE_APP.match(error): + subs = error.split('-') + mod = subs[1].casefold() + code = int(subs[2], 10) + elif not error.startswith('0x'): + mod = int(error[:4], 10) - 2000 + code = int(error[5:9], 10) + else: + err_int = int(error, 16) + mod = err_int & 0x1FF + code = (err_int >> 9 & 0x3FFF) + + if mod in modules: + if not modules[mod].data: + return CONSOLE_NAME, modules[mod].name, NO_RESULTS_FOUND, COLOR + ret = modules[mod].get_error(code) + ret.summary = modules[mod].get_level(code) + return CONSOLE_NAME, modules[mod].name, modules[mod].get_error(code), COLOR + + return CONSOLE_NAME, None, UNKNOWN_MODULE, COLOR diff --git a/cogs/results/types.py b/cogs/results/types.py new file mode 100644 index 000000000..b37e1f2d2 --- /dev/null +++ b/cogs/results/types.py @@ -0,0 +1,55 @@ +class Module: + """ + Describes a Module. A Module contains a dictionary of ResultCodes, + and possibly a second dictionary with extra information. + A module itself is basically who raised the error or returned the result. + """ + def __init__(self, name, data={}, levels={}): + self.name = name + self.data = data + self.levels = levels + + def get_error(self, error: int): + for key, value in self.data.items(): + if key == error: + return value + elif isinstance(key, tuple) and key[0] <= error <= key[1]: + return value + + return UNKNOWN_ERROR + + # If your modules require specific extra info for error ranges, add it here + def get_level(self, level: int): + for key, value in self.levels.items(): + if isinstance(key, tuple) and key[0] <= level <= key[1]: + return value + return None + + +class ResultCode: + """ + Describes a result code. A ResultCode has several fields which are used + to provide information about the error or result, including a support + webpage, if available. + """ + def __init__(self, description='', support_url='', is_ban=False): + self.description = description + self.support_url = support_url + self.summary = None + self.level = None + self.is_ban = is_ban + + +# Helper constants +UNKNOWN_MODULE = ResultCode('Invalid or unknown module. Are you sure you \ +typed the error code in correctly?') + +UNKNOWN_ERROR = ResultCode('Your error appears to be unknown. You should report\ + relevant details to \ +[the Kurisu repository](https://github.com/nh-server/Kurisu/issues).') + +NO_RESULTS_FOUND = ResultCode('I know about this module, but I don\'t have any \ +information on error codes for it. You should report relevant details to \ +[the Kurisu repository](https://github.com/nh-server/Kurisu/issues).') + +WARNING_COLOR = 0xFFFF00 diff --git a/cogs/results/wiiu.py b/cogs/results/wiiu.py new file mode 100644 index 000000000..d2a9d393a --- /dev/null +++ b/cogs/results/wiiu.py @@ -0,0 +1,534 @@ +import re + +from .types import Module, ResultCode, UNKNOWN_MODULE, NO_RESULTS_FOUND + +""" +This file contains all currently known Wii U result and error codes. +There may be inaccuracies here; we'll do our best to correct them +when we find out more about them. + +A result code is a 32-bit integer returned when calling various commands in the +Wii U's operating system, Cafe OS. Its breaks down like so: + + Bits | Description +------------------- +00-03 | Level +04-12 | Module +13-31 | Description + +Level: A value indicating the severity of the issue (fatal, temporary, etc.). +Module: A value indicating who raised the error or returned the result. +Description: A value indicating exactly what happened. + +Unlike the 3DS, the Wii U does not provide a 'summary' +field in result codes, so some artistic license was taken here to repurpose those +fields in our ResultCode class to add additional information from sources +such as the NintendoClients wiki. + +Currently our Wii U result code parsing does not understand hexadecimal +values. It is planned in the future to add support for these. + +To add a module so the code understands it, simply add a new module number +to the 'modules' dictionary, with a Module variable as the value. If the module +has no known error codes, simply add a dummy Module instead (see the dict for +more info). See the various module variables for a more in-depth example + on how to make one. + +Once you've added a module, or you want to add a new result code to an existing +module, add a new description value (for Switch it's the final set of 4 digits after any dashes) +as the key, and a ResultCode variable with a text description of the error or result. +You can also add a second string to the ResultCode to designate a support URL if +one exists. Not all results or errors have support webpages. + +Simple example of adding a module with a sample result code: +test = Module('test', { + 5: ResultCode('test', 'https://example.com') +}) + +modules = { + 9999: test +} + +Sources used to compile this list of results: +https://github.com/Kinnay/NintendoClients/wiki/Wii-U-Error-Codes +https://github.com/devkitPro/wut/blob/master/include/nn/result.h#L67 +""" + +fp = Module('fp (friends)', { + 0: ResultCode('Success.'), + 1: ResultCode('Session closed.'), + 10: ResultCode('Programming error.'), + 11: ResultCode('Not initialized.'), + 12: ResultCode('Already initialized.'), + 13: ResultCode('Invalid argument.'), + 14: ResultCode('Busy.'), + 15: ResultCode('Network clock is invalid.'), + 16: ResultCode('Not permitted.'), + 100: ResultCode('Undefined error.'), + 101: ResultCode('Reserved error 01.'), + 102: ResultCode('Unknown error.'), + 103: ResultCode('Not implemented.'), + 104: ResultCode('Invalid pointer.'), + 105: ResultCode('Operation aborted.'), + 106: ResultCode('Exception occurred.'), + 107: ResultCode('Access denied.'), + 108: ResultCode('Invalid handle.'), + 109: ResultCode('Invalid index.'), + 110: ResultCode('Out of memory.'), + 111: ResultCode('Invalid argument.'), + 112: ResultCode('Timeout.'), + 113: ResultCode('Initialization failure.'), + 114: ResultCode('Call initiation failure.'), + 115: ResultCode('Registration error.'), + 116: ResultCode('Buffer overflow.'), + 117: ResultCode('Invalid lock state.'), + 200: ResultCode('Undefined.'), + 201: ResultCode('Invalid signature.'), + 202: ResultCode('Incorrect version.'), + 300: ResultCode('Undefined.'), + 301: ResultCode('Connection failure.'), + 302: ResultCode('Not authenticated.'), + 303: ResultCode('Invalid username.'), + 304: ResultCode('Invalid password.'), + 305: ResultCode('Username already exists.'), + 306: ResultCode('Account is disabled.'), + 307: ResultCode('Account is expired.'), + 308: ResultCode('Concurrent login denied.'), + 309: ResultCode('Encryption failure.'), + 310: ResultCode('Invalid PID.'), + 311: ResultCode('Max connections reached.'), + 312: ResultCode('Invalid GID.'), + 313: ResultCode('Invalid thread ID.'), + 314: ResultCode('Invalid operation in live environment.'), + 315: ResultCode('Duplicate entry.'), + 316: ResultCode('Control script failure.'), + 317: ResultCode('Class not found.'), + 318: ResultCode('Reserved 18.'), + 319: ResultCode('Reserved 19.'), + 320: ResultCode('DDL mismatch.'), + 321: ResultCode('Reserved 21.'), + 322: ResultCode('Reserved 22.'), + 400: ResultCode('Undefined error.'), + 401: ResultCode('Exception occurred.'), + 402: ResultCode('Type error.'), + 403: ResultCode('Index error.'), + 404: ResultCode('Invalid reference.'), + 405: ResultCode('Call failure.'), + 406: ResultCode('Memory error.'), + 407: ResultCode('Operation error.'), + 408: ResultCode('Conversion error.'), + 409: ResultCode('Validation error.'), + 500: ResultCode('Undefined error.'), + 501: ResultCode('Unknown error.'), + 502: ResultCode('Connection failure.'), + 503: ResultCode('Invalid URL.'), + 504: ResultCode('Invalid key.'), + 505: ResultCode('Invalid URL type.'), + 506: ResultCode('Duplicate endpoint.'), + 507: ResultCode('I/O error.'), + 508: ResultCode('Timeout.'), + 509: ResultCode('Connection reset.'), + 510: ResultCode('Incorrect remote authentication.'), + 511: ResultCode('Server request error.'), + 512: ResultCode('Decompression failure.'), + 513: ResultCode('Congested end-point.'), + 514: ResultCode('Reserved 14.'), + 515: ResultCode('Reserved 15.'), + 516: ResultCode('Reserved 16.'), + 517: ResultCode('Reserved 17.'), + 518: ResultCode('Socket send warning.'), + 519: ResultCode('Unsupported NAT.'), + 520: ResultCode('DNS error.'), + 521: ResultCode('Proxy error.'), + 522: ResultCode('Data remaining.'), + 523: ResultCode('No buffer.'), + 524: ResultCode('Not found.'), + 600: ResultCode('Undefined error.'), + 700: ResultCode('Undefined error.'), + 701: ResultCode('Reserved 1.'), + 702: ResultCode('Not initialized.'), + 703: ResultCode('Already initialized.'), + 704: ResultCode('Not connected.'), + 705: ResultCode('Connected.'), + 706: ResultCode('Initialization failure.'), + 707: ResultCode('Out of memory.'), + 708: ResultCode('RMC failed.'), + 709: ResultCode('Invalid argument.'), + 710: ResultCode('Reserved 10.'), + 711: ResultCode('Invalid principal ID.'), + 712: ResultCode('Reserved 12.'), + 713: ResultCode('Reserved 13.'), + 714: ResultCode('Reserved 14.'), + 715: ResultCode('Reserved 15.'), + 716: ResultCode('Reserved 16.'), + 717: ResultCode('Reserved 17.'), + 718: ResultCode('Reserved 18.'), + 719: ResultCode('Reserved 19.'), + 720: ResultCode('File I/O error.'), + 721: ResultCode('P2P internet prohibited.'), + 722: ResultCode('Unknown error.'), + 723: ResultCode('Invalid state.'), + 724: ResultCode('Reservd 24.'), + 725: ResultCode('Adding a friend is prohibited.'), + 726: ResultCode('Reserved 26.'), + 727: ResultCode('Invalid account.'), + 728: ResultCode('Blacklisted by me.'), + 729: ResultCode('Reserved 29.'), + 730: ResultCode('Friend already added.'), + 731: ResultCode('Friend list limit exceeded.'), + 732: ResultCode('Requests limit exceeded.'), + 733: ResultCode('Invalid message ID.'), + 734: ResultCode('Message is not mine.'), + 735: ResultCode('Message is not for me.'), + 736: ResultCode('Friend request blocked.'), + 737: ResultCode('Not in my friend list.'), + 738: ResultCode('Friend listed by me.'), + 739: ResultCode('Not in my blackist.'), + 740: ResultCode('Incompatible account.'), + 741: ResultCode('Block setting change not allowed.'), + 742: ResultCode('Size limit exceeded.'), + 743: ResultCode('Operation not allowed.'), + 744: ResultCode('Not a network account.'), + 745: ResultCode('Notification not found.'), + 746: ResultCode('Preference not initialized.'), + 747: ResultCode('Friend request not allowed.'), + 800: ResultCode('Undefined error.'), + 801: ResultCode('Account library error.'), + 802: ResultCode('Token parse error.'), + 803: ResultCode('Reserved 3.'), + 804: ResultCode('Reserved 4.'), + 805: ResultCode('Reserved 5.'), + 806: ResultCode('Token expired.'), + 807: ResultCode('Validation failed.'), + 808: ResultCode('Invalid parameters.'), + 809: ResultCode('Principal ID unmatched.'), + 810: ResultCode('Reserved 10.'), + 811: ResultCode('Under maintenance.'), + 812: ResultCode('Unsupported version.'), + 813: ResultCode('Unknown error.') +}, { + (100, 199): 'Core', + (200, 299): 'DDL', + (300, 399): 'Rendezvous', + (400, 499): 'Python Core', + (500, 599): 'Transport', + (600, 699): 'DO Core', + (700, 799): 'FPD', + (800, 899): 'Authentication', + (1100, 1199): 'Ranking', + (1200, 1299): 'Data Store', + (1500, 1599): 'Service Item', + (1800, 1899): 'Matchmaking Referee', + (1900, 1999): 'Subscriber', + (2000, 2099): 'Ranking2', +}) + +act = Module('act (accounts)', { + 0: ResultCode('Success.'), + 1: ResultCode('Mail address not confirmed.'), + 500: ResultCode('Library error.'), + 501: ResultCode('Not initialized.'), + 502: ResultCode('Already initialized.'), + 511: ResultCode('Busy.'), + 591: ResultCode('Not implemented.'), + 592: ResultCode('Deprecated.'), + 593: ResultCode('Development only.'), + 600: ResultCode('Invalid argument.'), + 601: ResultCode('Invalid pointer.'), + 602: ResultCode('Out of range.'), + 603: ResultCode('Invalid size.'), + 604: ResultCode('Invalid format.'), + 605: ResultCode('Invalid handle.'), + 606: ResultCode('Invalid value.'), + 700: ResultCode('Internal error.'), + 701: ResultCode('End of stream.'), + 710: ResultCode('File error.'), + 711: ResultCode('File not found.'), + 712: ResultCode('File version mismatch.'), + 713: ResultCode('File I/O error.'), + 714: ResultCode('File type mismatch.'), + 730: ResultCode('Out of resources.'), + 731: ResultCode('Buffer is insufficient.'), + 740: ResultCode('Out of memory.'), + 741: ResultCode('Out of global heap.'), + 742: ResultCode('Out of cross-process heap.'), + 744: ResultCode('Out of MXML heap.'), + 800: ResultCode('Generic error.'), + 801: ResultCode('Open error.'), + 802: ResultCode('Read sys-config error.'), + 810: ResultCode('Generic error.'), + 811: ResultCode('Open error.'), + 812: ResultCode('Get info error.'), + 820: ResultCode('Generic error.'), + 821: ResultCode('Initialization failure.'), + 822: ResultCode('Get country code failure.'), + 823: ResultCode('Get language code failure.'), + 850: ResultCode('Generic error.'), + 900: ResultCode('Generic error.'), + 901: ResultCode('Open error.'), + 1000: ResultCode('Management error.'), + 1001: ResultCode('Not found.'), + 1002: ResultCode('Slots full.'), + 1011: ResultCode('Not loaded.'), + 1012: ResultCode('Already loaded.'), + 1013: ResultCode('Locked.'), + 1021: ResultCode('Not a network account.'), + 1022: ResultCode('Not a local account.'), + 1023: ResultCode('Not committed.'), + 1101: ResultCode('Network clock is invalid.'), + 2000: ResultCode('Authentication error.'), + # TODO: 2001-2644 (there aren't really that many errors) + 2643: ResultCode('Authentication is required.'), + 2651: ResultCode('Confirmation code is expired.'), + 2661: ResultCode('Mail address is not validated.'), + 2662: ResultCode('Excessive mail send requests.'), + 2670: ResultCode('Generic error.'), + 2671: ResultCode('General failure.'), + 2672: ResultCode('Declined.'), + 2673: ResultCode('Blacklisted.'), + 2674: ResultCode('Invalid credit card number.'), + 2675: ResultCode('Invalid credit card date.'), + 2676: ResultCode('Invalid credit card PIN.'), + 2677: ResultCode('Invalid postal code.'), + 2678: ResultCode('Invalid location.'), + 2679: ResultCode('Card is expired.'), + 2680: ResultCode('Credit card number is wrong.'), + 2681: ResultCode('PIN is wrong.'), + 2800: ResultCode('Banned.', is_ban=True), + 2801: ResultCode('Account is banned.', is_ban=True), + 2802: ResultCode('Account is banned from all services.', is_ban=True), + 2803: ResultCode('Account is banned from a particular game.', is_ban=True), + 2804: ResultCode('Account is banned from Nintendo\'s online service.', is_ban=True), + 2805: ResultCode('Account is banned from independent services.', is_ban=True), + 2811: ResultCode('Console is banned.', is_ban=True), + 2812: ResultCode('Console is banned from all services.', is_ban=True), + 2813: ResultCode('Console is banned from a particular game.', is_ban=True), + 2814: ResultCode('Console is banned from Nintendo\'s online service.', is_ban=True), + 2815: ResultCode('Console is banned from independent services.', is_ban=True), + 2816: ResultCode('Console is banned for an unknown duration, due to using modified/hacked files in online games like Splatoon.', is_ban=True), + 2821: ResultCode('Account is temporarily banned.', is_ban=True), + 2822: ResultCode('Account is temporarily banned from all services.', is_ban=True), + 2823: ResultCode('Account is temporarily banned from a particular game.', is_ban=True), + 2824: ResultCode('Account is temporarily banned from Nintendo\'s online service.', is_ban=True), + 2825: ResultCode('Acccount is temporarily banned from independent services.', is_ban=True), + 2831: ResultCode('Console is temporarily banned.', is_ban=True), + 2832: ResultCode('Console is temporarily banned from all services.', is_ban=True), + 2833: ResultCode('Console is temporarily banned from a particular game.', is_ban=True), + 2834: ResultCode('Console is temporarily banned from Nintendo\'s online service.', is_ban=True), + 2835: ResultCode('Console is temporarily banned from independent services.', is_ban=True), + 2880: ResultCode('Service is not provided.'), + 2881: ResultCode('Service is currently under maintenance.'), + 2882: ResultCode('Service is closed.'), + 2883: ResultCode('Nintendo Network is closed.'), + 2884: ResultCode('Service is not provided in this country.'), + 2900: ResultCode('Restriction error.'), + 2901: ResultCode('Restricted by age.'), + 2910: ResultCode('Restricted by parental controls.'), + 2911: ResultCode('In-game internet communication/chat is restricted.'), + 2931: ResultCode('Internal server error.'), + 2932: ResultCode('Unknown server error.'), + 2998: ResultCode('Unauthenticated after salvage.'), + 2999: ResultCode('Unknown authentication failure.'), + +}, { + (0, 499): 'Internal', + (500, 599): 'Status changed', + (600, 699): 'Invalid argument', + (700, 709): 'Internal error', + (710, 729): 'File error', + (730, 799): 'Out of resources', + (800, 809): 'UC', + (810, 819): 'MCP', + (820, 849): 'ISO', + (850, 899): 'MXML', + (900, 999): 'IOS', + (1000, 1099): 'Account', + (2100, 2199): 'HTTP', + (2500, 2599): 'Account', + (2670, 2699): 'Credit Card', + (2800, 2835): 'Banned', + (2880, 2899): 'Not available', # not provided/under maintenance/no longer in service +}) + +nex = Module('nex (game servers)', { + 102: ResultCode('The reason for the error is unknown.'), + 103: ResultCode('The operation is currently not implemented.'), + 104: ResultCode('The operation specifies or accesses an invalid pointer.'), + 105: ResultCode('The operation was aborted.'), + 106: ResultCode('The operation raised an exception.'), + 107: ResultCode('An attempt was made to access data in an incorrect manner. This may be due to inadequate permission or the data, file, etc. not existing.'), + 108: ResultCode('The operation specifies or accesses an invalid DOHandle.'), + 109: ResultCode('The operation specifies or accesses an invalid index.'), + 110: ResultCode('The system could not allocate or access enough memory or disk space to perform the specified operation.'), + 111: ResultCode('Invalid argument were passed with the operation. The argument(s) may be out of range or invalid.'), + 112: ResultCode('The operation did not complete within the specified timeout for that operation.'), + 113: ResultCode('Initialization of the component failed.'), + 114: ResultCode('The call failed to initialize.'), + 115: ResultCode('An error occurred during registration.'), + 116: ResultCode('The buffer is too large to be sent.'), + 117: ResultCode('Invalid lock state.'), + 118: ResultCode('Invalid sequence.'), + 301: ResultCode('Connection was unable to be established, either with the Rendez-Vous back end or a Peer.'), + 302: ResultCode('The Principal could not be authenticated by the Authentication Service.'), + 303: ResultCode('The Principal tried to log in with an invalid user name, i.e. the user name does not exist in the database.'), + 304: ResultCode('The Principal either tried to log in with an invalid password for the provided user name or tried to join a Gathering with an invalid password.'), + 305: ResultCode('The provided user name already exists in the database. All usernames must be unique.'), + 306: ResultCode('The Principal\'s account still exists in the database but the account has been disabled.', is_ban=True), + 307: ResultCode('The Principal\'s account still exists in the database but the account has expired.'), + 308: ResultCode('The Principal does not have the Capabilities to perform concurrent log ins, i.e. at any given time only one log-in may be maintained.'), + 309: ResultCode('Data encryption failed.'), + 310: ResultCode('The operation specifies or accesses an invalid PrincipalID.'), + 311: ResultCode('Maximum connnection number is reached.'), + 312: ResultCode('Invalid GID.'), + 313: ResultCode('Invalid Control script ID.'), + 314: ResultCode('Invalid operation in live/production environment.'), + 315: ResultCode('Duplicate entry.'), + 346: ResultCode('NNID is permanently banned.', is_ban=True), + 501: ResultCode('The reason for the error is unknown.'), + 502: ResultCode('Network connection was unable to be established.'), + 503: ResultCode('The URL contained in the StationURL is invalid. The syntax may be incorrect.'), + 504: ResultCode('The key used to authenticate a given station is invalid. The secure transport layer uses secret-key based cryptography to ensure the integrity and confidentiality of data sent across the network.'), + 505: ResultCode('The specified transport type is invalid.'), + 506: ResultCode('The Station is already connected via another EndPoint.'), + 507: ResultCode('The data could not be sent across the network. This could be due to an invalid message, packet, or buffer.'), + 508: ResultCode('The operation did not complete within the specified timeout for that operation.'), + 509: ResultCode('The network connection was reset.'), + 510: ResultCode('The destination Station did not authenticate itself properly.'), + 511: ResultCode('3rd-party server or device answered with an error code according to protocol used e.g. HTTP error code.'), +}, { + (100, 199): 'Core', + (200, 299): 'DDL', + (300, 399): 'Rendezvous', + (400, 499): 'Python Core', + (500, 599): 'Transport', + (600, 699): 'DO Core', + (700, 799): 'FPD', + (800, 899): 'Authentication', + (1100, 1199): 'Ranking', + (1200, 1299): 'Data Store', + (1500, 1599): 'Service Item', + (1800, 1899): 'Matchmaking Referee', + (1900, 1999): 'Subscriber', + (2000, 2099): 'Ranking2', +}) + +eshop_api = Module('eshop(api)', { + 3190: ResultCode('Wishlist is full.') +}) + +eshop_web = Module('eshop (web)', { + 9000: ResultCode('Close application (Connection timeout issue?).'), + 9001: ResultCode('Retriable.'), + 9002: ResultCode('Online services are undergoing maintenance.'), + 9003: ResultCode('The online services are discontinued and thus are no longer available.'), + 9100: ResultCode('Invalid template.') +}) + +unknown2 = Module('unknown (browser?)', { + 1037: ResultCode('Incorrect permissions for the default index.html file which prevents the Internet Browser from reading it.', '[To fix it, follow these steps.](https://wiiu.hacks.guide/#/fix-errcode-112-1037)'), +}) + +olv = Module('olv (miiverse)', { + 1009: ResultCode('Console is permanently banned from Miiverse.', is_ban=True), + 5004: ResultCode('The Miiverse service has been discontinued.') +}) + +eshop_unk = Module('eShop (unknown)', { + 9622: ResultCode('Error when attempting to add funds. Check that the payment method is correct or try again later.') +}) + +fs = Module('fs', { + 1031: ResultCode('The disc could not be read or is unsupported (i.e. not a Wii or Wii U game). Try cleaning the disc or lens if it is a supported title.'), + 2031: ResultCode('The disc could not be read or is unsupported (i.e. not a Wii or Wii U game). Try cleaning the disc or lens if it is a supported title.') +}) + +syserr = Module('system error', { + 101: ResultCode('Generic error. Can happen when formatting a console that has CBHC installed.'), + 102: ResultCode('Error in SLC/MLC or USB.'), + 103: ResultCode('The MLC system memory is corrupted.'), + 104: ResultCode('The SLC system memory is corrupted.'), + 105: ResultCode('The USB storage is corrupted.'), +}) + +unknown = Module('unknown/misc.', { + 9999: ResultCode('Usually indicates an invalid signature, ticket, or corrupted data. Typically happens when running an unsigned program without CFW/signature patches.') +}) + +# We have some modules partially documented, those that aren't have dummy Modules. +modules = { + 101: fp, + 102: act, + 103: Module('ac (internet connection)'), + 104: Module('boss(spotpass)'), + 105: Module('nim (title installation'), + 106: nex, + 107: eshop_api, + 111: eshop_web, + 112: unknown2, + 115: olv, + 118: Module('pia (peer-to-peer)'), + 124: Module('ec (e-commerce)'), + 126: eshop_unk, + 150: fs, + 151: Module('kpad (wiimote)'), + 155: Module('save'), + 160: syserr, + 165: Module('vpad (gamepad)'), + 166: Module('aoc (dlc)'), + 187: Module('nfp (amiibo)'), + 199: unknown +} + +levels = { + 0: 'Success.', + -1: 'Fatal.', + -2: 'Usage.', + -3: 'Status.', + -7: 'End.' +} + +# regex for Wii U result code format "1XX-YYYY" +RE = re.compile(r'1\d{2}-\d{4}') + +CONSOLE_NAME = 'Nintendo Wii U' + +# Suggested color to use if displaying information through a Discord bot's embed +COLOR = 0x009AC7 + + +def is_valid(error): + err_int = None + if error.startswith('0x'): + err_int = int(error, 16) + if err_int: + module = (err_int & 0x1FF0) >> 4 + return (err_int & 0x80000000) and module >= 100 + return RE.match(error) + + +def hex2err(error): + error = int(error) + module = (error & 0x1FF0) >> 4 + desc = (error & 0xFFFFE000) >> 13 + code = f'{module:03}-{desc:04}' + return code + + +def get(error): + level = None + if error.startswith('0x'): + error = int(error) + level = (error & 0xF) | 0xFFFFFFF8 + mod = (error & 0x1FF0) >> 4 + desc = (error & 0xFFFFE000) >> 13 + else: + mod = int(error[0:3]) + desc = int(error[4:]) + if mod in modules: + if not modules[mod].data: + return CONSOLE_NAME, modules[mod].name, NO_RESULTS_FOUND, COLOR + ret = modules[mod].get_error(desc) + ret.level = modules[mod].get_level(desc) if not level else levels[level] + return CONSOLE_NAME, modules[mod].name, ret, COLOR + + return CONSOLE_NAME, None, UNKNOWN_MODULE, COLOR diff --git a/kurisu.py b/kurisu.py index bcde10352..3a9b1e37a 100644 --- a/kurisu.py +++ b/kurisu.py @@ -33,7 +33,6 @@ cogs = [ 'cogs.assistance', 'cogs.blah', - 'cogs.err', 'cogs.events', 'cogs.extras', 'cogs.filters', @@ -50,7 +49,7 @@ 'cogs.mod_warn', 'cogs.mod_watch', 'cogs.mod', - 'cogs.nxerr', + 'cogs.results', 'cogs.rules', 'cogs.ssnc', 'cogs.xkcdparse',