https://switchbrew.org/w/api.php?action=feedcontributions&user=Behemoth&feedformat=atom
Nintendo Switch Brew - User contributions [en]
2024-03-29T07:48:00Z
User contributions
MediaWiki 1.35.8
https://switchbrew.org/w/index.php?title=Homebrew_Applications&diff=12560
Homebrew Applications
2023-10-23T21:16:57Z
<p>Behemoth: remove old & broken application by myself (ComicNX)</p>
<hr />
<div>== Installing ==<br />
Applications are installed by copying the necessary files directly to the <code>switch/</code> folder in the root of the SD card, or in a subdirectory of <code>switch/</code>, in which case said subfolder must be named identically to its executable. Normally the former should be used. The latter should be used if the application uses anything from FS current-working-directory (directory where the NRO is located). Applications come with the following:<br />
* <code>[appname].nro</code>: The executable.<br />
<br />
The Homebrew Menu will scan the SD card for all <code>.nro</code> files, but will only display an icon for those who have one according to the format described above. You can also freely navigate the filesystem to select an application.<br />
<br />
Icon/metadata for each application is loaded from data embedded in the NRO (custom assets section), if available.<br />
<br />
== Notes ==<br />
<br />
Distribution and promotion of tools to create or work with commercial game dumps is illegal under DMCA and EUCD provisions. Such tools risk legal repercussions and should not be linked or promoted here.<br />
<br />
== List ==<br />
<br />
=== Launchers ===<br />
<br />
{| class="wikitable" border="1"<br />
! width="20%" | Name<br />
! width="50%" | Description<br />
! width="10%" | Author<br />
! width="10%" | Download<br />
! width="5%" | Open-Source<br />
! width="15%" | Last Updated<br />
|-<br />
| [[Homebrew Menu]]<br />
| Run homebrew on your Switch!<br />
| [[User:Yellows8|Yellows8]], plutooo<br />
| [https://github.com/switchbrew/nx-hbmenu/releases Here]<br />
| [https://github.com/switchbrew/nx-hbmenu Yes]<br />
| 2022-07-14<br />
|}<br />
<br />
=== Applications ===<br />
{| class="wikitable" border="1"<br />
! width="20%" | Name<br />
! width="50%" | Description<br />
! width="10%" | Author<br />
! width="10%" | Download<br />
! width="5%" | Open-Source<br />
! width="15%" | Last Updated<br />
|-<br />
| switch_sysmodule<br />
| RPC over USB, etc. Originally a sysmodule, however this can also be used as a regular application.<br />
| [[User:Yellows8|Yellows8]]<br />
| [https://github.com/yellows8/switch_sysmodule/ Here]<br />
| Yes<br />
| 2019-10-17<br />
|-<br />
| pPlay<br />
| A video player for the Nintendo Switch<br />
| Cpasjuste<br />
| [https://github.com/Cpasjuste/pplay/releases Here]<br />
| [https://github.com/Cpasjuste/pplay/ Yes]<br />
| 2021-03-12<br />
|-<br />
| Switch Lan Play<br />
| Allows you to play Lan supported games online<br />
| spacemeowx2<br />
| [https://github.com/spacemeowx2/switch-lan-play/releases Here]<br />
| [https://github.com/spacemeowx2/switch-lan-play/ Yes]<br />
| 2020-06-21<br />
|-<br />
| Ldn_mitm<br />
| Allows you to play Wireless supported games online (Requires Switch Lan Play)<br />
| spacemeowx2<br />
| [https://github.com/spacemeowx2/ldn_mitm/releases Here]<br />
| [https://github.com/spacemeowx2/ldn_mitm/ Yes]<br />
| 2022-04-16<br />
|-<br />
| PyNX<br />
| Allows you to run homebrew applications written in Python on the Switch. <br />
| AileenLumina<br />
| [https://github.com/nx-python/Pynx/releases Here]<br />
| [https://github.com/nx-python/Pynx/ Yes]<br />
| 2018-08-09<br />
|-<br />
| Switch Brainfuck<br />
| A brainfuck interpreter for the Nintendo Switch.<br />
| TheKgg<br />
| [https://github.com/TheKgg/switch-brainfuck/releases Here]<br />
| [https://github.com/TheKgg/switch-brainfuck Yes]<br />
| 2018-04-21<br />
|-<br />
| ScreenTester-NX<br />
| Detect and repair dead/stuck pixels<br />
| Marice<br />
| [https://github.com/Marice/ScreenTester-NX/releases Here]<br />
| [https://github.com/Marice/ScreenTester-NX/ Yes]<br />
| 2018-05-19<br />
|-<br />
| NX-Shell<br />
| Multipurpose File Manager<br />
| Joel16<br />
| [https://github.com/joel16/NX-Shell/releases Here]<br />
| [https://github.com/joel16/NX-Shell/ Yes]<br />
| 2022-08-07<br />
|-<br />
| Gag Order<br />
| Removes the "SuperNag" update notification<br />
| Adubbz<br />
| [https://github.com/Adubbz/Gag-Order/releases Here]<br />
| [https://github.com/Adubbz/Gag-Order Yes]<br />
| 2018-05-30<br />
|-<br />
| In-Home-Switching<br />
| Stream games from PC to the Nintendo Switch<br />
| jakibaki, D-VAmpire<br />
| [https://github.com/jakibaki/In-Home-Switching/releases Here]<br />
| [https://github.com/jakibaki/In-Home-Switching Yes]<br />
| 2018-12-31<br />
|-<br />
| vgedit<br />
| Text editor with touch/controller/usb support<br />
| vgmoose<br />
| [https://github.com/vgmoose/vgedit/releases Here]<br />
| [https://github.com/vgmoose/vgedit Yes]<br />
| 2020-06-14<br />
|-<br />
| OJDS-NX<br />
| Stream controller inputs to your PC to be displayed on Open Joystick Display<br />
| [[User:NicholeMattera|NicholeMattera]]<br />
| [https://git.nicholemattera.com/NicholeMattera/OJDS-NX/releases/latest Here]<br />
| [https://git.nicholemattera.com/NicholeMattera/OJDS-NX Yes]<br />
| 2021-01-30<br />
|-<br />
| SkyNX<br />
| A fork of In-Home-Switching, stream games from PC to the Nintendo Switch<br />
| DevL0rd<br />
| [https://github.com/DevL0rd/SkyNX/release Here]<br />
| [https://github.com/DevL0rd/SkyNX Yes]<br />
| 2022-03-15<br />
|}<br />
<br />
=== Game Engines ===<br />
{| class="wikitable" border="1"<br />
! width="20%" | Name <br />
! width="50%" | Description <br />
! width="10%" | Author<br />
! width="10%" | Download<br />
! width="5%" | Open-Source <br />
! width="15%" | Last Updated <br />
|-<br />
| Duke Nukem 3D<br />
| EDuke32 is an awesome, free homebrew game engine and source port of the classic PC first person shooter Duke Nukem 3D<br />
| Cpasjuste<br />
| [https://github.com/Cpasjuste/eduke32/releases Here]<br />
| [https://github.com/Cpasjuste/eduke32 Yes]<br />
| 2021-07-13<br />
|-<br />
| LÖVE-NX<br />
| Direct port of [https://love2d.org LÖVE] for the Nintendo Switch<br />
| p-sam<br />
| [https://github.com/retronx-team/love-nx/releases Here]<br />
| [https://github.com/retronx-team/love-nx Yes]<br />
| 2022-04-04<br />
|-<br />
| LÖVE Potion<br />
| [https://love2d.org LÖVE] for Nintendo Switch<br />
| TurtleP<br />
| [https://github.com/lovebrew/LovePotion/releases Here]<br />
| [https://github.com/lovebrew/LovePotion Yes]<br />
| 2023-10-16<br />
|-<br />
| [https://blog.easyrpg.org/2018/03/easyrpg-player-now-available-as-nintendo-switch-homebrew/ EasyRPG Player]<br />
| RPG Maker 2000/2003 game interpreter<br />
| Rinnegatamante & EasyRPG team<br />
| [https://easyrpg.org/player/downloads/ Here]<br />
| [https://github.com/EasyRPG/Player Yes]<br />
| 2021-10-29<br />
|-<br />
| MegaZeux<br />
| A game creation system originally released in 1994 with text mode-like graphics and a [https://www.digitalmzx.com large library of games].<br />
| Lachesis<br />
| [https://github.com/AliceLR/megazeux/releases Here]<br />
| [https://github.com/AliceLR/megazeux/ Yes]<br />
| 2020-11-22<br />
|-<br />
| Solarus Engine<br />
| Zelda-like Action-RPG game engine<br />
| capsterx<br />
| [https://github.com/capsterx/solarus/releases Here]<br />
| [https://github.com/capsterx/solarus Yes]<br />
| 2021-02-21<br />
|-<br />
| [https://raylib.com/ raylib-nx]<br />
| A simple and easy-to-use library to enjoy videogames programming.<br />
| [[User:LucaSkyer|LucaSkyer]]<br />
| [https://github.com/lucaskyer/raylib-nx/releases Here]<br />
| [https://github.com/lucaskyer/raylib-nx Yes]<br />
| 2022-03-10<br />
|-<br />
|}<br />
<br />
=== Games ===<br />
{| class="wikitable" border="1"<br />
! width="20%" | Name<br />
! width="50%" | Description<br />
! width="10%" | Author<br />
! width="10%" | Download<br />
! width="5%" | Open-Source<br />
! width="15%" | Last Updated<br />
|-<br />
| 2048<br />
| 2048 port for Switch homebrew<br />
| Bernardo Giordano<br />
| [https://github.com/BernardoGiordano/2048/releases Here]<br />
| [https://github.com/BernardoGiordano/2048 Yes]<br />
| 2018-07-17<br />
|-<br />
| Cannonball-NX<br />
| An Enhanced OutRun Engine<br />
| lantus/MVG<br />
| [https://github.com/lantus/cannonball-nx/releases Here]<br />
| [https://github.com/lantus/cannonball-nx Yes]<br />
| 2018-05-22<br />
|-<br />
| Chocolate Doom<br />
| Chocolate Doom port for Switch<br />
| WinterMute<br />
| [https://github.com/WinterMute/chocolate-doom/releases/latest Here]<br />
| [https://github.com/WinterMute/chocolate-doom Yes]<br />
| 2018-07-15<br />
|-<br />
| Chocolate Doom NX<br />
| Chocolate Doom port for Switch<br />
| [[User:NicholeMattera|NicholeMattera]]<br />
| [https://git.nicholemattera.com/NicholeMattera/Chocolate-Doom-NX/releases/latest Here]<br />
| [https://git.nicholemattera.com/NicholeMattera/Chocolate-Doom-NX Yes]<br />
| 2021-01-30<br />
|-<br />
| Hamsters NX<br />
| A breeding of Hamsters game in text mode.<br />
| Cid2mizard<br />
| [https://github.com/Cid2mizard/Hamsters_NX/releases Here]<br />
| [https://github.com/Cid2mizard/Hamsters_NX Yes]<br />
| 2022-06-05<br />
|-<br />
| HEXGEM<br />
| A match 3 (or more) board game<br />
| [[User:carstene1ns|carstene1ns]]<br />
| [https://github.com/carstene1ns/hexgem/tree/switch-port Here]<br />
| Yes<br />
| 2018-07-25<br />
|-<br />
| Hot Pocolate<br />
| Alternative music visualizer<br />
| illteteka<br />
| [https://illteteka.itch.io/hot-pocolate Here]<br />
| [https://github.com/illteteka/hot-pocolate Yes]<br />
| 2018-08-15<br />
|-<br />
| [https://www.winterworks.de/project/hurrican/ Hurrican]<br />
| Port of POKE53280 Classic Turrican reimagination<br />
| rsn8887<br />
| [https://github.com/rsn8887/Hurrican/releases Here]<br />
| [https://github.com/rsn8887/Hurrican Yes]<br />
| 2021-05-22<br />
|-<br />
| InvadersNX<br />
| Space Invaders type game<br />
| MaesterRowen<br />
| [https://github.com/MaesterRowen/InvadersNX/releases/latest Here]<br />
| [https://github.com/MaesterRowen/InvadersNX Yes]<br />
| 2018-07-09<br />
|-<br />
| Ken's Labyrinth<br />
| Classic MS-DOS shooter with enhanced features such as HD textures and 60fps support<br />
| Nightfox<br />
| [https://github.com/sacredbanana/lab3d-sdl/releases/latest Here]<br />
| [https://github.com/sacredbanana/lab3d-sdl Yes]<br />
| 2019-10-05<br />
|-<br />
| Mario NES<br />
| Super Mario Bros port to Switch<br />
| 24ratcma<br />
| [https://github.com/sverigeunit/MarioNES-for-Switch/releases Here]<br />
| [https://github.com/sverigeunit/MarioNES-for-Switch Yes]<br />
| 2022-07-14<br />
|-<br />
| MCOsu<br />
| [https://osu.ppy.sh/home Osu!] Port for Switch<br />
| McKay42<br />
| [https://github.com/McKay42/McOsu-NX/releases Here]<br />
| [https://github.com/McKay42/McOsu-NX Yes]<br />
| 2022-01-23<br />
|-<br />
| Meritous<br />
| Top View Dungeon Game<br />
| nop90<br />
| [https://github.com/Nop90-Switch/Meritous-Switch/releases Here]<br />
| [https://github.com/Nop90-Switch/Meritous-Switch Yes]<br />
| 2018-03-17<br />
|-<br />
| Noodles!<br />
| A clone of the iOS puzzle game Noodles!<br />
| [[User:MrJPGames|MrJPGames]]<br />
| [https://github.com/MrJPGames/Noodles-/releases Here]<br />
| [https://github.com/MrJPGames/Noodles- Yes]<br />
| 2019-07-24<br />
|-<br />
| NXEngine<br />
| Reimplementation of Cave Story / Doukutsu Monogatari, a Japanese freeware PC side-scrolling platformer game from 2004.<br />
| isage<br />
| [https://github.com/nxengine/nxengine-evo/releases/latest/ Here]<br />
| [https://github.com/nxengine/nxengine-evo Yes]<br />
| 2022-08-04<br />
|-<br />
| NXQuake<br />
| TyrQuake is a source port of id Software's Quake<br />
| fgsfds<br />
| [https://github.com/fgsfdsfgs/nxquake/releases Here]<br />
| [https://github.com/fgsfdsfgs/nxquake Yes]<br />
| 2018-09-15<br />
|-<br />
| NXQuake2<br />
| Yamagi Quake II is a source port of id Software's Quake II<br />
| fgsfds<br />
| [https://github.com/fgsfdsfgs/nxquake2/releases Here]<br />
| [https://github.com/fgsfdsfgs/nxquake2 Yes]<br />
| 2018-09-04<br />
|-<br />
| NX-VVVVVV<br />
| VVVVVV port for Switch<br />
| [[User:NicholeMattera|NicholeMattera]]<br />
| [https://git.nicholemattera.com/NicholeMattera/NX-VVVVVV/releases/latest Here]<br />
| [https://git.nicholemattera.com/NicholeMattera/NX-VVVVVV Yes]<br />
| 2021-01-30<br />
|-<br />
| OpenBOR<br />
| OpenBOR is the ultimate 2D gaming engine with over 10+ years of active development behind it. With OpenBOR you can build anything from simple button mashers to elaborate projects rivaling the most lavish professional offerings. Download one of the dozens of ready to play game modules available here, or grab the development kit and start up one of your own!<br />
| cpasjuste<br />
| [https://github.com/Cpasjuste/openbor/releases Here]<br />
| [https://github.com/Cpasjuste/openbor Yes]<br />
| 2018-03-18<br />
|-<br />
| OpenTyrian<br />
| OpenTyrian is a port of the DOS shoot-em-up Tyrian, which is an arcade-style vertical scrolling shooter.<br />
| felixrg<br />
| [https://github.com/felixrg/opentyrian/releases Here]<br />
| [https://github.com/felixrg/opentyrian Yes]<br />
| 2018-05-19<br />
|-<br />
| Pickr<br />
| Pickr webgame port for Switch homebrew<br />
| Bernardo Giordano<br />
| [https://github.com/BernardoGiordano/Pickr/releases Here]<br />
| [https://github.com/BernardoGiordano/Pickr Yes]<br />
| 2018-04-16<br />
|-<br />
| Pixel-Painter<br />
| A simple drawing homebrew<br />
| 8BitWonder<br />
| [https://github.com/16BitWonder/Pixel-Painter-Switch/releases Here]<br />
| [https://github.com/16BitWonder/Pixel-Painter-Switch Yes]<br />
| 2020-08-19<br />
|-<br />
| Postal-NX<br />
| An isometric top-down shooter video game from 1997<br />
| lantus/MVG<br />
| [https://github.com/lantus/postal-nx/releases Here]<br />
| [https://github.com/lantus/postal-nx Yes]<br />
| 2018-05-25<br />
|-<br />
| powder-nx<br />
| Physics sandbox game, which simulates air pressure and velocity, heat, gravity and a countless number of interactions between different substances.<br />
| VelocityRa<br />
| [https://github.com/VelocityRa/powder-nx/releases Here]<br />
| [https://github.com/VelocityRa/powder-nx Yes]<br />
| 2019-09-15<br />
|-<br />
| REminiscence<br />
| REminiscence is a re-implementation of the engine used in the game Flashback made by Delphine Software and released in 1992.<br />
| Cpasjuste<br />
| [https://github.com/Cpasjuste/REminiscence/releases Here]<br />
| [https://github.com/Cpasjuste/REminiscence Yes]<br />
| 2018-03-28<br />
|-<br />
| SDLLopan<br />
| A classic remake of Linux Lopan (a Mahjong solitaire clone) by Dave Ashley.<br />
| nop90<br />
| [https://github.com/Nop90-Switch/SDLLopan-SWITCH/releases Here]<br />
| [https://github.com/Nop90-Switch/SDLLopan-SWITCH Yes]<br />
| 2018-03-02<br />
|-<br />
| SDLPoP<br />
| An open-source port of Prince of Persia, based on the disassembly of the DOS version.<br />
| usineur<br />
| [https://github.com/usineur/SDLPoP/releases Here]<br />
| [https://github.com/usineur/SDLPoP Yes]<br />
| 2018-05-14<br />
|-<br />
| Space Game NX<br />
| Space game is a graphical shooter game on the Switch ported from Wii U! <br />
| vgmoose<br />
| [https://github.com/vgmoose/spacenx/releases Here]<br />
| [https://github.com/vgmoose/spacenx/ Yes]<br />
| 2018-02-19<br />
|-<br />
| Snake<br />
| A minimalistic Snake clone for Switch made with LovePotion.<br />
| Shrike<br />
| [https://github.com/Ryuzaki-MrL/tetriswitch/releases Here]<br />
| [https://github.com/Ryuzaki-MrL/tetriswitch Yes]<br />
| 2018-03-10<br />
|-<br />
|Stepmania 5.x<br />
|A port of the Stepmania 5.x PC game to the switch<br />
|retronx-team<br />
|[https://github.com/retronx-team/stepmania-nx/releases Here]<br />
|[https://github.com/retronx-team/stepmania-nx Yes]<br />
|<br />
|-<br />
| SuperTuxKart<br />
| Port of [https://supertuxkart.net SuperTuxKart] to the Nintendo Switch<br />
| [[User:Mary|Mary]]<br />
| [https://github.com/supertuxkart/stk-code/releases/tag/preview Here]<br />
| [https://github.com/supertuxkart/stk-code Yes]<br />
| 2021-07-20<br />
|-<br />
| Super Methane Brothers<br />
| An elimination platformer remake similar to Bubble Bobble (originally released for AMIGA in 1993). Blast baddies with your methane gun and survive 100 floors in the tower of time.<br />
| [[User:carstene1ns|carstene1ns]]<br />
| [https://f4ke.de/dev/switch/ Here]<br />
| [https://github.com/carstene1ns/super-methane-brothers Yes]<br />
| 2018-05-08<br />
|-<br />
| Switch Pong<br />
| A port of pong for the Nintendo Switch<br />
| TheKgg<br />
| [https://github.com/TheKgg/switch-pong/releases Here]<br />
| [https://github.com/TheKgg/switch-pong Yes]<br />
| 2018-04-20<br />
|-<br />
| Taisei<br />
| A port of taisei for the Nintendo Switch<br />
| Taisei Project <br />
| [https://github.com/taisei-project/taisei/releases Here]<br />
| [https://github.com/taisei-project/taisei/ Yes]<br />
| 2021-01-01<br />
|-<br />
| Tetriswitch<br />
| A Tetris clone for Nintendo Switch.<br />
| Ryuzaki_MrL<br />
| [https://github.com/Ryuzaki-MrL/tetriswitch/releases Here]<br />
| [https://github.com/Ryuzaki-MrL/tetriswitch Yes]<br />
| 2018-03-13<br />
|-<br />
| TicTacToe<br />
| A Tic Tac Toe implementation for Switch.<br />
| SH3RLOCK<br />
| [https://sh3rlock.ch/ttt.nro Here]<br />
| [https://sh3rlock.ch/ttt.zip Yes]<br />
| 2018-02-23<br />
|-<br />
| Useless Homebrew<br />
| A "useless machine"-like software, ported from DS<br />
| Tcm0, Rydian (DS)<br />
| [https://drive.google.com/file/d/1r5pi5G20yEAT9eEckCJeyROsC3fn5MaJ/view Here]<br />
| [https://drive.google.com/file/d/1CDTMoUi6HnayhWUd_edmyzcJcP-mvpw3/view Yes]<br />
| 2018-03-03<br />
|}<br />
<br />
=== Emulators ===<br />
{| class="wikitable" border="1"<br />
! width="20%" | Name<br />
! width="50%" | Description<br />
! width="10%" | Author<br />
! width="10%" | Download<br />
! width="5%" | Open-Source<br />
! width="15%" | Last Updated<br />
|-<br />
| ScummVM<br />
| ScummVM is a program which allows you to run certain classic graphical point-and-click adventure games...<br />
| Cpasjuste<br />
| [https://github.com/Cpasjuste/scummvm/releases Here]<br />
| [https://github.com/Cpasjuste/scummvm/tree/switch Yes]<br />
| 2018-05-18<br />
|-<br />
<br />
|-<br />
| mGBA<br />
| Standalone version of mGBA for Switch<br />
| endrift<br />
| [https://github.com/mgba-emu/mgba/releases/ Here]<br />
| [https://github.com/mgba-emu/mgba/ Yes]<br />
|<br />
|-<br />
| pFBA<br />
| A port of final burn alpha to multiple platforms<br />
| Cpasjuste<br />
| [https://github.com/Cpasjuste/pfba/releases Here]<br />
| [https://github.com/Cpasjuste/pfba Yes]<br />
| 2018-08-25<br />
|-<br />
| PPSSPP<br />
| Port of the standalone PSP Emulator "PPSSPP" for the Switch<br />
| m4xw, Henrik Rydgård<br />
| [https://ppsspp.org/downloads.html Here]<br />
| No<br />
|<br />
|-<br />
| CHIP8-NX<br />
| CHIP8 emulator<br />
| Marice<br />
| [https://github.com/Marice/CHIP8-NX/releases Here]<br />
| [https://github.com/Marice/CHIP8-NX Yes]<br />
| 2018-05-25<br />
|-<br />
| LaiNESwitch<br />
| Compact, cycle-accurate NES emulator in ~1000 lines of C++.<br />
| Kevoot<br />
| [https://github.com/Kevoot/LaiNESwitch/releases Here]<br />
| [https://github.com/Kevoot/LaiNESwitch Yes]<br />
| 2018-07-26<br />
|-<br />
| pSNES<br />
| snes9x 1.56.2<br />
| Cpasjuste<br />
| [https://github.com/Cpasjuste/psnes/releases Here]<br />
| [https://github.com/Cpasjuste/psnes Yes]<br />
| 2018-08-24<br />
|-<br />
| RetroArch<br />
| RetroArch has advanced features like shaders, netplay, rewinding, and next-frame response times.<br />
|<br />
| [https://github.com/libretro/RetroArch/releases Here]<br />
| [https://github.com/libretro/RetroArch Yes]<br />
| 2018-10-01<br />
|-<br />
|}<br />
<br />
=== Save managers===<br />
{| class="wikitable" border="1"<br />
! width="20%" | Name<br />
! width="50%" | Description<br />
! width="10%" | Author<br />
! width="10%" | Download<br />
! width="5%" | Open-Source<br />
! width="15%" | Last Updated<br />
|-<br />
| Checkpoint<br />
| Fast and simple save manager for 3DS and Switch written in C++.<br />
| Bernardo Giordano<br />
| [https://github.com/BernardoGiordano/Checkpoint/releases/latest Here]<br />
| [https://github.com/BernardoGiordano/Checkpoint Yes]<br />
| 2018-05-14<br />
|-<br />
| JKSV<br />
| WIP save manager for more advanced users<br />
| JK_<br />
| [https://github.com/J-D-K/JKSV/releases Here]<br />
| [https://github.com/J-D-K/JKSV Yes]<br />
| 2018-06-25<br />
|-<br />
| EdiZon<br />
| Save file manager and editor with JSON+Lua plugin support for easy creation of new save editors for any game.<br />
| WerWolv<br />
| [https://github.com/thomasnet-mc/EdiZon/releases/latest Here]<br />
| [https://github.com/thomasnet-mc/EdiZon Yes]<br />
| 2018-08-19<br />
|}<br />
<br />
=== File servers ===<br />
{| class="wikitable" border="1"<br />
! width="20%" | Name<br />
! width="50%" | Description<br />
! width="10%" | Author<br />
! width="10%" | Download<br />
! width="5%" | Open-Source<br />
! width="15%" | Last Updated<br />
|-<br />
| Ftpd<br />
| A port of ftpd for 3DS.<br />
| mtheall, TuxSH, WinterMute<br />
| [https://github.com/mtheall/ftpd/releases/latest Here]<br />
| [https://github.com/mtheall/ftpd Yes]<br />
| 2018-09-24<br />
|-<br />
| sys-ftpd<br />
| A port of ftpd for 3DS that's running in the background.<br />
| mtheall, TuxSH, WinterMute, jakibaki<br />
| [https://github.com/jakibaki/sys-ftpd/releases/latest Here]<br />
| [https://github.com/jakibaki/sys-ftpd Yes]<br />
| 2018-09-24<br />
|-<br />
| mtp-server-nx<br />
| A port of [https://manpages.ubuntu.com/manpages/xenial/man1/mtp-server.1.html mtp-server] for Android.<br />
| Gillou68310<br />
| [https://github.com/retronx-team/mtp-server-nx/releases/latest Here]<br />
| [https://github.com/retronx-team/mtp-server-nx Yes]<br />
| 2019-09-19<br />
|-<br />
| nxmtp<br />
| A MTP implementation.<br />
| liuervehc<br />
| [https://github.com/liuervehc/nxmtp/releases/latest Here]<br />
| No<br />
| 2019-01-13<br />
|}<br />
<br />
=== Demos ===<br />
{| class="wikitable" border="1"<br />
! width="20%" | Name<br />
! width="50%" | Description<br />
! width="10%" | Author<br />
! width="10%" | Download<br />
! width="5%" | Open-Source<br />
! width="15%" | Last Updated<br />
|-<br />
| 34c3-demo<br />
| Demo from the 34c3 for Homebrew on the Switch.<br />
| [[User:plutoo|plutoo]]<br />
| [https://github.com/switchbrew/34c3-demo Here]<br />
| Yes<br />
| 2018-02-19<br />
|-<br />
| Dokkaebi Hack<br />
| Animated Demo using SDL on the Switch.<br />
| [[User:NicholeMattera|NicholeMattera]]<br />
| [https://git.nicholemattera.com/NicholeMattera/Dokkaebi-Hack/releases/latest Here]<br />
| [https://git.nicholemattera.com/NicholeMattera/Dokkaebi-Hack Yes]<br />
| 2020-06-27<br />
|-<br />
|}</div>
Behemoth
https://switchbrew.org/w/index.php?title=NPNS_services&diff=10763
NPNS services
2021-04-06T04:38:01Z
<p>Behemoth: ICreateTokenAsyncContext</p>
<hr />
<div>This is used for Push Notifications.<br />
<br />
It uses a version of the libstrophe[http://strophe.im/libstrophe/] xmpp library with libxml2.<br />
Modifications were made to use the SSL services[https://switchbrew.org/wiki/SSL_services] and support network proxy settings.<br />
<br />
= npns:u =<br />
This is "nn::npns::INpnsUser".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || [[#GetReceiveEvent]]<br />
|-<br />
| 7 || [[#GetStateChangeEvent]]<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|-<br />
| 154 || [12.0.0+] CreateTokenAsync<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
= npns:s =<br />
This is "nn::npns::INpnsSystem".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || [[#GetReceiveEvent]]<br />
|-<br />
| 6 || [[#ListenUndelivered]]<br />
|-<br />
| 7 || [[#GetStateChangeEvent]]<br />
|-<br />
| 11 || SubscribeTopic<br />
|-<br />
| 12 || UnsubscribeTopic<br />
|-<br />
| 13 || QueryIsTopicExist<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 22 || CreateTokenWithApplicationId<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 24 || DestroyTokenWithApplicationId<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 31 || UploadTokenToBaaS<br />
|-<br />
| 32 || [2.0.0+] DestroyTokenForBaaS<br />
|-<br />
| 33 || [7.0.0+] CreateTokenForBaas<br />
|-<br />
| 34 || [7.0.0+] SetBaasDeviceAccountIdList<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 105 || [3.0.0+] GetPlayReportRequestEvent<br />
|-<br />
| 111 || [[#GetJid]]<br />
|-<br />
| 112 || [[#CreateJid]]<br />
|-<br />
| 113 || [[#DestroyJid]]<br />
|-<br />
| 114 || AttachJid<br />
|-<br />
| 115 || DetachJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|-<br />
| 154 || [12.0.0+] CreateTokenAsync<br />
|-<br />
| 155 || [12.0.0+] CreateTokenAsyncWithApplicationId<br />
|-<br />
| 161 || [10.0.0+] GetRequestChangeStateCancelEvent<br />
|-<br />
| 162 || [10.0.0+] RequestChangeStateForceTimedWithCancelEvent<br />
|-<br />
| 201 || [3.0.0+] RequestChangeStateForceTimed<br />
|-<br />
| 202 || [3.0.0+] RequestChangeStateForceAsync<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
ListenAll, ReceiveRaw, CreateToken, DestroyToken, QueryIsTokenValid are stubbed. They return 0x7fc9a on [1.0.0] and 0x36dc9a on later versions.<br />
<br />
=== ListenTo ===<br />
Takes an input u64 program id, no output.<br />
<br />
=== GetReceiveEvent ===<br />
No input, returns an output Event handle with autoclear=true.<br />
<br />
=== GetStateChangeEvent ===<br />
No input, returns an output Event handle with autoclear=true. <br />
<br />
=== ListenUndelivered ===<br />
No input, same as calling [[#ListenTo]] with program id 0.<br />
<br />
=== GetJid ===<br />
No input, returns the current Jabber Identifier[https://xmpp.org/extensions/xep-0029.html] in a type-10 buffer.<br />
Locally it's stored in "npns_save:/persistent.bin"<br />
<br />
=== CreateJid ===<br />
No input, no output.<br />
Fetches a new Jid from the CDN. Invalidates the old one if existent.<br />
<br />
=== DestroyJid ===<br />
No input, no output.<br />
Invalidates and deletes the current Jid.<br />
<br />
=== CreateNotificationReceiver ===<br />
Returns an [[#INotificationReceiver]].<br />
<br />
== INotificationReceiver ==<br />
This is "nn::npns::INotificationReceiver".<br />
<br />
This was added with [7.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 1 || [[#ListenTo]] || Takes a total of 8-bytes of input, no output.<br />
|-<br />
| 2 || ListenToMyApplicationId || Takes a total of 8-bytes of input and a PID, no output.<br />
|-<br />
| 3 || Receive || Takes a total of 2-bytes of input and a type-0x6 output buffer.<br />
|-<br />
| 4 || GetReceiveEvent || No input, returns an output handle.<br />
|}<br />
<br />
== ICreateTokenAsyncContext ==<br />
This is "nn::npns::ICreateTokenAsyncContext".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || GetFinishEvent<br />
|-<br />
| 2 || Cancel<br />
|-<br />
| 3 || GetResult<br />
|-<br />
| 4 || GetToken<br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=Shared_Database_services&diff=10557
Shared Database services
2021-01-06T06:26:30Z
<p>Behemoth: /* avm */</p>
<hr />
<div>= pl:u, pl:s =<br />
These are "nn::pl::detail::IPlatformServiceManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#RequestLoad]]<br />
|-<br />
| 1 || [[#GetLoadState]]<br />
|-<br />
| 2 || [[#GetSize]]<br />
|-<br />
| 3 || [[#GetSharedMemoryAddressOffset]]<br />
|-<br />
| 4 || [[#GetSharedMemoryNativeHandle]]<br />
|-<br />
| 5 || [[#GetSharedFontInOrderOfPriority]]<br />
|-<br />
| 6 || [4.0.0+] GetSharedFontInOrderOfPriorityForSystem<br />
|-<br />
| 100 || [8.0.0+] RequestApplicationFunctionAuthorization<br />
|-<br />
| 101 || [8.0.0+] RequestApplicationFunctionAuthorizationByProcessId<br />
|-<br />
| 102 || [10.0.0+] RequestApplicationFunctionAuthorizationByApplicationId<br />
|-<br />
| 103 || [11.0.0+] RefreshApplicationFunctionBlackListDebugRecord<br />
|-<br />
| 104 || [11.0.0+] RequestApplicationFunctionAuthorizationByProgramId<br />
|-<br />
| 105 || [11.0.0+] GetFunctionBlackListSystemVersionToAuthorize<br />
|-<br />
| 106 || [11.0.0+] GetFunctionBlackListVersion<br />
|-<br />
| 1000 || [9.0.0+] LoadNgWordDataForPlatformRegionChina<br />
|-<br />
| 1001 || [9.0.0+] GetNgWordDataSizeForPlatformRegionChina<br />
|}<br />
<br />
== RequestLoad ==<br />
Takes a [[#SharedFontType]] (uint32), no output.<br />
<br />
== GetLoadState ==<br />
Takes a [[#SharedFontType]] (uint32), returns the [[#LoadState]] (uint32).<br />
<br />
=== LoadState ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value || Description<br />
|-<br />
| 0x00 || Loading<br />
|-<br />
| 0x01 || Loaded<br />
|}<br />
<br />
== GetSize ==<br />
Takes a [[#SharedFontType]] (uint32), returns the Font Size (uint32).<br />
<br />
== GetSharedMemoryAddressOffset ==<br />
Takes a [[#SharedFontType]] (uint32), returns the offset (uint32) to the Font Address.<br />
<br />
== GetSharedMemoryNativeHandle ==<br />
No input, returns an output SharedMemory handle.<br />
<br />
User-processes map this SharedMemory with size=0x1100000 and permissions=R--.<br />
<br />
Font data is TTF, located at the offset returned by [[#GetSharedFontAddress]].<br />
<br />
== GetSharedFontInOrderOfPriority ==<br />
Takes an input u64 [[Settings_services#LanguageCode|LanguageCode]] and 3 type-0x6 output buffers, returns an output u8 and u32. The u8 is a bool to specify if the fonts are loaded or not and the u32 is the font count.<br />
The first buffer contains a list of [[#SharedFontType|Shared font types]], the second buffer contains the font offsets and the final buffer contains the font sizes.<br />
The buffers are an array of u32s which specify information about a specific font. Buffer1[n] is related to Buffer2[n] and Buffer3[n].<br />
Example: Font index 0s offset is at Buffer2[0], size is at Buffer3[0].<br />
The fonts are relative to the shared memory created by [[#GetSharedFontSharedMemoryHandle]]<br />
<br />
== SharedFontType ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value || Description<br />
|-<br />
| 0x00 || Japan, US and Europe (Standard)<br />
|-<br />
| 0x01 || Chinese Simplified<br />
|-<br />
| 0x02 || Extended Chinese Simplified<br />
|-<br />
| 0x03 || Chinese Traditional<br />
|-<br />
| 0x04 || Korean (Hangul)<br />
|-<br />
| 0x05 || Nintendo Extended<br />
|}<br />
<br />
* Nintendo Extended: Contains Nintendo-specific characters, including HID buttons, HID controller styles, applet icons, Wii(U) icons, etc.<br />
<br />
= mii:u, mii:e =<br />
This is "nn::mii::detail::IStaticService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetDatabaseService<br />
|}<br />
<br />
== IDatabaseService ==<br />
This is "nn::mii::detail::IDatabaseService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || IsUpdated<br />
|-<br />
| 1 || IsFullDatabase<br />
|-<br />
| 2 || GetCount<br />
|-<br />
| 3 || Get<br />
|-<br />
| 4 || Get1<br />
|-<br />
| 5 || UpdateLatest<br />
|-<br />
| 6 || BuildRandom<br />
|-<br />
| 7 || BuildDefault<br />
|-<br />
| 8 || Get2<br />
|-<br />
| 9 || Get3<br />
|-<br />
| 10 || UpdateLatest1<br />
|-<br />
| 11 || FindIndex<br />
|-<br />
| 12 || Move<br />
|-<br />
| 13 || AddOrReplace<br />
|-<br />
| 14 || Delete<br />
|-<br />
| 15 || DestroyFile<br />
|-<br />
| 16 || DeleteFile<br />
|-<br />
| 17 || Format<br />
|-<br />
| 18 || Import<br />
|-<br />
| 19 || Export<br />
|-<br />
| 20 || IsBrokenDatabaseWithClearFlag<br />
|-<br />
| 21 || GetIndex<br />
|-<br />
| 22 || [5.0.0+] SetInterfaceVersion<br />
|-<br />
| 23 || [5.0.0+] Convert<br />
|-<br />
| 24 || [7.0.0+] ConvertCoreDataToCharInfo<br />
|-<br />
| 25 || [7.0.0+] ConvertCharInfoToCoreData<br />
|-<br />
| 26 || [10.2.0+] Append<br />
|}<br />
<br />
= miiimg =<br />
This is "nn::mii::detail::IImageDatabaseService".<br />
<br />
This was added with [5.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Initialize<br />
|-<br />
| 10 || Reload<br />
|-<br />
| 11 || GetCount<br />
|-<br />
| 12 || IsEmpty<br />
|-<br />
| 13 || IsFull<br />
|-<br />
| 14 || GetAttribute<br />
|-<br />
| 15 || LoadImage<br />
|-<br />
| 16 || AddOrUpdateImage<br />
|-<br />
| 17 || DeleteImages<br />
|-<br />
| 100 || DeleteFile<br />
|-<br />
| 101 || DestroyFile<br />
|-<br />
| 102 || ImportFile<br />
|-<br />
| 103 || ExportFile<br />
|-<br />
| 104 || ForceInitialize<br />
|}<br />
<br />
= pdm:ntfy =<br />
This is "nn::pdm::detail::INotifyService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#NotifyAppletEvent]]<br />
|-<br />
| 2 || [[#NotifyOperationModeChangeEvent]]<br />
|-<br />
| 3 || [[#NotifyPowerStateChangeEvent]]<br />
|-<br />
| 4 || [[#NotifyClearAllEvent]]<br />
|-<br />
| 5 || [[#NotifyEventForDebug]]<br />
|-<br />
| 6 || [4.0.0+] SuspendUserAccountEventService<br />
|-<br />
| 7 || [4.0.0+] ResumeUserAccountEventService<br />
|-<br />
| 8 || [6.0.0+]<br />
|-<br />
| 9 || [8.0.0+]<br />
|}<br />
<br />
== NotifyAppletEvent ==<br />
Takes an input u8 [[#AppletEventType]], an u8 [[Applet_Manager_services#AppletId|AppletId]], an u8 [[Filesystem_services#StorageId|StorageId]], an u8 [[#PlayLogPolicy]], an u32 '''event_x8''', and an u64 '''titleID'''. Returns no output.<br />
<br />
When [[#PlayLogPolicy]] is 2 ("None") this will immediately return 0.<br />
<br />
Logs a new [[#PlayEvent]] with the following data:<br />
* Clears the 0x10-bytes at +0x10.<br />
* u8 +0xF = [[#AppletEventType]].<br />
* Sets the 3 timestamps.<br />
* Converts '''titleID''' and writes it to +0x0.<br />
* u32 +0x8 = '''event_x8'''.<br />
* u8 +0xC = [[Applet_Manager_services#AppletId|AppletId]], u8 +0xD = [[Filesystem_services#StorageId|StorageId]], and u8 +0xE = [[#PlayLogPolicy]].<br />
<br />
After the initial logging, additional code runs with some of the above input params.<br />
<br />
== NotifyOperationModeChangeEvent ==<br />
Takes an input u8 '''inval''', no output.<br />
<br />
Logs a new [[#PlayEvent]] with the following data: clears the 0x20-bytes at +0x0, u8 +0x1C = 0x3, u8 +0x0 = '''inval''', and sets the 3 timestamps.<br />
<br />
== NotifyPowerStateChangeEvent ==<br />
Takes an input u8 '''inval''', no output.<br />
<br />
Logs a new [[#PlayEvent]] with the following data: clears the 0x20-bytes at +0x0, u8 +0x1C = 0x2, u8 +0x0 = '''inval''', and sets the 3 timestamps.<br />
<br />
After the initial logging, additional code runs which uses '''inval'''.<br />
<br />
== NotifyClearAllEvent ==<br />
No input/output.<br />
<br />
== NotifyEventForDebug ==<br />
Takes an input type-0x5 buffer containing an array of [[#PlayEvent]], no output.<br />
<br />
Gets the [[System_Settings|system-setting]] <code>pdm!is_production</code>, the size must be 1 and the value must be 0, otherwise an error is returned.<br />
<br />
Each [[#PlayEvent]] entry is validated, throwing an error on failure. After an entry is successfully validated, it is written to the log.<br />
<br />
== Cmd8 ==<br />
Takes an input u8 [[#AppletEventType]], an u8 [[Applet_Manager_services#LibraryAppletMode|LibraryAppletMode]], an u8 [[Applet_Manager_services#AppletId|AppletId]], an u8 [[Filesystem_services#StorageId|StorageId]], an u8 [[#PlayLogPolicy]], and an u64 '''titleID'''. Returns no output.<br />
<br />
This is similar to [[#NotifyAppletEvent]].<br />
<br />
When [[#PlayLogPolicy]] is 2 ("None") this will immediately return 0.<br />
<br />
Logs a new [[#PlayEvent]] with the following data:<br />
* Clears the 0x20-bytes at +0x0.<br />
* u8 +0xF = [[#AppletEventType]].<br />
* Sets the 3 timestamps.<br />
* Converts '''titleID''' and writes it to +0x0.<br />
* u8 +0x9 = [[Applet_Manager_services#LibraryAppletMode|LibraryAppletMode]].<br />
* u8 +0x8 = 1.<br />
* u8 +0xC = [[Applet_Manager_services#AppletId|AppletId]], u8 +0xD = [[Filesystem_services#StorageId|StorageId]], and u8 +0xE = [[#PlayLogPolicy]].<br />
<br />
After the initial logging, additional code runs with some of the above input params. This is handled the same as [[#NotifyAppletEvent]], except that the value passed for '''event_x8''' is value 0 here.<br />
<br />
== Cmd9 ==<br />
Takes an input u8 [[#AppletEventType]], an u8 [[Applet_Manager_services#AppletId|AppletId]], an u8 [[Filesystem_services#StorageId|StorageId]], an 0x20-byte struct, an u8 bool flag, an u8 [[#PlayLogPolicy]], an u32 '''event_x8''', and an u64 '''program_id'''. Returns no output.<br />
<br />
[10.0.0+] This now takes an additional input u64, new_program_id. At the very beginning a new func is now called, with params: ({constant value}, &[[#AppletEventType]], &program_id, &new_program_id, &StorageId). Afterwards, where it would originally use program_id, it now uses new_program_id instead. The called func eventually writes the input to a buffer using msgpack, with the output from that being added to a list in state.<br />
<br />
This is identical to [[#NotifyAppletEvent]] except for the additional struct/flag params.<br />
<br />
After the initial logging, additional code runs with some of the above input params. This is handled the same as [[#NotifyAppletEvent]], except that when the u8 bool flag is set the input struct is used with this.<br />
<br />
[10.0.0+] New code at the very end of this func was added. When [[Applet_Manager_services#AppletId|AppletId]] is 0x1, or 0x1F-0x20, the following runs:<br />
* If [[#AppletEventType]] is 1, 5, or 6, func1 is called with param &program_id. This runs msgpack code similar to the above, then does {other things}.<br />
* Otherwise, if [[#AppletEventType]] is 0, func0 is called with param &program_id.<br />
** This calls the same msgpack func at the start as func1. [[Glue_services#GetApplicationLaunchProperty|GetApplicationLaunchProperty]] is used, with the output being copied to state on success, otherwise the output Result is used with other msgpack code.<br />
* If [[#AppletEventType]] doesn't match any of these, nothing is done.<br />
<br />
= pdm:qry =<br />
This is "nn::pdm::detail::IQueryService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#QueryAppletEvent]] ([1.0.0-7.0.1] QueryApplicationEvent)<br />
|-<br />
| 1 || [1.0.0-6.2.0] [[#QueryPlayStatistics]]<br />
|-<br />
| 2 || [1.0.0-6.2.0] [[#QueryPlayStatisticsByUserAccountId]]<br />
|-<br />
| 3 || [1.0.0-6.2.0] [[#QueryPlayStatisticsByNetworkServiceAccountId]]<br />
|-<br />
| 4 || [[#QueryPlayStatisticsByApplicationId]]<br />
|-<br />
| 5 || [[#QueryPlayStatisticsByApplicationIdAndUserAccountId]]<br />
|-<br />
| 6 || [1.0.0-6.2.0] [[#QueryPlayStatisticsByApplicationIdAndNetworkServiceAccountId]]<br />
|-<br />
| 7 || [10.0.0+] [[#QueryLastPlayTimeV0]] ([1.0.0-9.2.0] QueryLastPlayTime)<br />
|-<br />
| 8 || [[#QueryPlayEvent]]<br />
|-<br />
| 9 || [[#GetAvailablePlayEventRange]]<br />
|-<br />
| 10 || [[#QueryAccountEvent]]<br />
|-<br />
| 11 || [4.0.0+] [[#QueryAccountPlayEvent]]<br />
|-<br />
| 12 || [4.0.0+] [[#GetAvailableAccountPlayEventRange]]<br />
|-<br />
| 13 || [10.0.0+] [[#QueryApplicationPlayStatisticsForSystemV0]] ([5.0.0-9.2.0] QueryApplicationPlayStatisticsForSystem)<br />
|-<br />
| 14 || [6.0.0+] [[#QueryRecentlyPlayedApplication]]<br />
|-<br />
| 15 || [6.0.0+] [[#GetRecentlyPlayedApplicationUpdateEvent]]<br />
|-<br />
| 16 || [10.0.0+] [[#QueryApplicationPlayStatisticsByUserAccountIdForSystemV0]] ([6.0.0-9.2.0] QueryApplicationPlayStatisticsByUserAccountIdForSystem)<br />
|-<br />
| 17 || [10.0.0+] [[#QueryLastPlayTime]]<br />
|-<br />
| 18 || [10.0.0+] [[#QueryApplicationPlayStatisticsForSystem]]<br />
|-<br />
| 19 || [10.0.0+] [[#QueryApplicationPlayStatisticsByUserAccountIdForSystem]]<br />
|}<br />
<br />
== QueryAppletEvent ==<br />
Takes ([10.0.0+] an input u8 bool), an input s32 entry_index, a type-0x6 output buffer containing an array of [[#AppletEvent]], and returns an output s32 for actual total output entries.<br />
<br />
== QueryPlayStatistics ==<br />
Takes a type-0x6 output buffer containing an array of [[#PlayStatistics]] and returns an output s32 for actual total output entries.<br />
<br />
[6.2.0+] This command was removed.<br />
<br />
== QueryPlayStatisticsByUserAccountId ==<br />
Takes an input u128 '''Uid''', a type-0x6 output buffer containing an array of [[#PlayStatistics]] and returns an output s32 for actual total output entries.<br />
<br />
[6.2.0+] This command was removed.<br />
<br />
== QueryPlayStatisticsByNetworkServiceAccountId ==<br />
Takes an input u64 '''NetworkServiceAccountId''', a type-0x6 output buffer containing an array of [[#PlayStatistics]] and returns an output s32 for actual total output entries.<br />
<br />
[6.2.0+] This command was removed.<br />
<br />
== QueryPlayStatisticsByApplicationId ==<br />
Takes ([10.0.0+] an input u8 bool), an input u64 '''ApplicationId''' and returns an output [[#PlayStatistics]].<br />
<br />
== QueryPlayStatisticsByApplicationIdAndUserAccountId ==<br />
Takes ([10.0.0+] an input u8 bool), an input u64 '''ApplicationId''', an input u128 '''Uid''' and returns an output [[#PlayStatistics]].<br />
<br />
== QueryPlayStatisticsByApplicationIdAndNetworkServiceAccountId ==<br />
Takes an input u64 '''ApplicationId''', an input u64 '''NetworkServiceAccountId''' and returns an output [[#PlayStatistics]].<br />
<br />
[6.2.0+] This command was removed.<br />
<br />
== QueryLastPlayTimeV0 ==<br />
Takes a type-0x6 output buffer containing an array of [[#LastPlayTime]], and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
[10.0.0+] This now calls the impl func for [[#QueryLastPlayTime]] with flag=0.<br />
<br />
== QueryPlayEvent ==<br />
Takes an input s32 entry_index, a type-0x6 output buffer containing an array of [[#PlayEvent]], and returns an output s32 for actual total output entries.<br />
<br />
== GetAvailablePlayEventRange ==<br />
No input, returns 3 output s32s: total_entries, start_entry_index, and end_entry_index.<br />
<br />
== QueryAccountEvent ==<br />
Takes an input s32 entry_index, a type-0x6 output buffer containing an array of [[#AccountEvent]], and returns an output s32 for actual total output entries.<br />
<br />
== QueryAccountPlayEvent ==<br />
Takes an input s32 entry_offset, an input u128 '''Uid''', a type-0x6 output buffer containing an array of [[#AccountPlayEvent]], and returns an output s32 for actual total output entries.<br />
<br />
== GetAvailableAccountPlayEventRange ==<br />
Takes an input u128 '''Uid''' and returns 3 output s32s: total_entries, start_entry_index, and end_entry_index.<br />
<br />
== QueryApplicationPlayStatisticsForSystemV0 ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationPlayStatistics]] and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
The number of entries in each array is the same.<br />
<br />
[10.0.0+] This now calls the impl func for [[#QueryApplicationPlayStatisticsForSystem]] with flag=0.<br />
<br />
== QueryRecentlyPlayedApplication ==<br />
Takes ([10.0.0+] an input u8 bool), an input u128 '''Uid''', a type-0x6 output buffer containing an array of u64 '''ApplicationId''', and returns an output s32 for actual total output entries.<br />
<br />
Returns a list of titles played by the specified user.<br />
<br />
== GetRecentlyPlayedApplicationUpdateEvent ==<br />
No input, returns an output Event handle with autoclear=false.<br />
<br />
This is signaled when logging a new [[#PlayEvent]] which would be available via [[#QueryAccountEvent]], where [[#PlayEvent]] +0x18 is 0.<br />
<br />
== QueryApplicationPlayStatisticsByUserAccountIdForSystemV0 ==<br />
Takes an [[Account_services#Uid|Uid]], a type-0x6 output buffer containing an array of [[#ApplicationPlayStatistics]] and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
Same as [[#QueryApplicationPlayStatisticsForSystemV0]] except this gets playstats specific to '''Uid'''.<br />
<br />
[10.0.0+] This now calls the impl func for [[#QueryApplicationPlayStatisticsByUserAccountIdForSystem]] with flag=0.<br />
<br />
== QueryLastPlayTime ==<br />
Takes an input u8 bool, a type-0x6 output buffer containing an array of [[#LastPlayTime]], and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
== QueryApplicationPlayStatisticsForSystem ==<br />
Takes an input u8 bool, a type-0x6 output buffer containing an array of [[#ApplicationPlayStatistics]] and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
The number of entries in each array is the same.<br />
<br />
== QueryApplicationPlayStatisticsByUserAccountIdForSystem ==<br />
Takes an input u8 bool, an [[Account_services#Uid|Uid]], a type-0x6 output buffer containing an array of [[#ApplicationPlayStatistics]] and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
Same as [[#QueryApplicationPlayStatisticsForSystem]] except this gets playstats specific to '''Uid'''.<br />
<br />
= avm =<br />
This is "nn::avm::srv::IAvmService".<br />
<br />
This was added with [6.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 100 || [[#GetHighestAvailableVersion]]<br />
|-<br />
| 101 || [[#GetHighestRequiredVersion]]<br />
|-<br />
| 102 || [[#GetVersionListEntry]]<br />
|-<br />
| 103 || [[#GetVersionListImporter]]<br />
|-<br />
| 200 || [[#GetLaunchRequiredVersion]]<br />
|-<br />
| 202 || [[#UpgradeLaunchRequiredVersion]]<br />
|-<br />
| 1000 || [[#PushLaunchVersion]]<br />
|-<br />
| 1001 || [[#ListVersionList]]<br />
|-<br />
| 1002 || [[#ListRequiredVersion]]<br />
|}<br />
<br />
=== GetHighestAvailableVersion ===<br />
Takes two u64 title ids. Returns the highest available version of both.<br />
<br />
Unused by official software.<br />
<br />
=== GetHighestRequiredVersion ===<br />
Takes two u64 title ids. Returns the highest available version of both.<br />
<br />
Official software calls this with the id of an application and its update.<br />
<br />
=== GetVersionListEntry ===<br />
Takes an input u64 title id. Returns associated [[#VersionListEntry]].<br />
<br />
=== GetVersionListImporter ===<br />
No input, returns an [[#IVersionListImporter]].<br />
<br />
=== GetLaunchRequiredVersion ===<br />
Takes an input u64 title id. Return the required launch version.<br />
<br />
=== UpgradeLaunchRequiredVersion ===<br />
Takes a u32 launch version and a u64 title id.<br />
<br />
Version has to be greater the result of GetLaunchRequiredVersion.<br />
<br />
=== PushLaunchVersion ===<br />
Takes a u32 launch version and a u64 title id.<br />
<br />
=== ListVersionList ===<br />
No input, returns a type 6 buffer of [[#VersionListEntry]] and a u32 count.<br />
<br />
=== ListRequiredVersion ===<br />
No input, returns a type 6 buffer of [[#RequiredVersionEntry]] and a u32 count.<br />
<br />
== IVersionListImporter ==<br />
This is "nn::avm::srv::IVersionListImporter".<br />
<br />
This was added with [6.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#SetTimestamp]]<br />
|-<br />
| 1 || [[#PushEntries]]<br />
|-<br />
| 2 || [[#Flush]]<br />
|}<br />
<br />
=== SetTimestamp ===<br />
Takes an input u64 unix timestamp, no output.<br />
<br />
=== PushEntries ===<br />
Takes an input type-6 buffer [[#VersionListEntry]], no output.<br />
<br />
=== Flush ===<br />
No input, no output. Flushed the commited data to its safe.<br />
<br />
= VersionListEntry =<br />
This is a 0x10-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || Update Id.<br />
|-<br />
| 0x8 || 0x4 || Available version.<br />
|-<br />
| 0xC || 0x4 || Required version.<br />
|}<br />
<br />
= RequiredVersionEntry =<br />
This is a 0x10-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || Id.<br />
|-<br />
| 0x8 || 0x4 || Required version.<br />
|-<br />
| 0xC || 0x4 || Padding.<br />
|}<br />
<br />
= AppletEvent =<br />
This is "nn::pdm::AppletEvent" ([1.0.0-7.0.1] "nn::pdm::ApplicationEvent").<br />
<br />
This is a 0x18-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x4 || entryindex<br />
|-<br />
| 0xC || 0x4 || timestamp0<br />
|-<br />
| 0x10 || 0x4 || timestamp1<br />
|-<br />
| 0x14 || 0x1 || [[#PlayEvent]] +0xF<br />
|-<br />
| 0x15 || 0x3 || Padding<br />
|}<br />
<br />
Timestamp format, converted from PosixTime: total minutes since epoch UTC 1999/12/31 00:00.<br />
<br />
= PlayStatistics =<br />
This is "nn::pdm::PlayStatistics".<br />
<br />
This is a 0x28-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x4 || First entryindex<br />
|-<br />
| 0xC || 0x4 || First timestamp0. Same as the first [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x10 || 0x4 || First timestamp1. Same as the second [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x14 || 0x4 || Last entryindex<br />
|-<br />
| 0x18 || 0x4 || Last timestamp0. Same as the first [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x1C || 0x4 || Last timestamp1. Same as the second [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x20 || 0x4 || Total play-time in minutes.<br />
|-<br />
| 0x24 || 0x4 || Total times the application title was launched.<br />
|}<br />
<br />
= LastPlayTime =<br />
This is "nn::pdm::LastPlayTime".<br />
<br />
This is a 0x18-byte struct and contains data from the last time the title was played.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x4 || Same as the first [[#AppletEvent]] timestamp.<br />
|-<br />
| 0xC || 0x4 || Same as the second [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x10 || 0x4 || Total minutes since the title was last played.<br />
|-<br />
| 0x14 || 0x1 || Flag indicating whether the above field is set.<br />
|-<br />
| 0x15 || 0x3 || Padding<br />
|}<br />
<br />
= PlayEventType =<br />
This is an enum for [[#PlayEvent]] +0x1C, which indicates the type of [[#PlayEvent]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Applet<br />
|-<br />
| 1 || Account<br />
|-<br />
| 2 || PowerStateChange<br />
|-<br />
| 3 || OperationModeChange<br />
|-<br />
| 4 || Initialize. Used for the very first [[#PlayEvent]] entry in the log.<br />
|}<br />
<br />
= AppletEventType =<br />
This is an enum for [[#PlayEvent]] +0xF with [[#PlayEventType]] = Applet, this indicates the type of the Applet event.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || "launch"<br />
|-<br />
| 1 || "exit"<br />
|-<br />
| 2 || "in_focus"<br />
|-<br />
| 3 || "out_of_focus"<br />
|-<br />
| 4 || "out_of_focus"<br />
|-<br />
| 5 || "exit"<br />
|-<br />
| 6 || "exit"<br />
|}<br />
<br />
= PlayLogPolicy =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Meaning<br />
! Description<br />
|-<br />
| 0 || All || All pdm:qry cmds which require [[#PlayEventType]] = Applet and AppletId = Application will only return the entry when PlayLogPolicy matches this value.<br />
|-<br />
| 1 || LogOnly || The above commands will filter out the entry with this.<br />
|-<br />
| 2 || None || pdm:ntfy [[#NotifyAppletEvent]], [[#Cmd8]], and [[#Cmd9]] will immediately return 0 when the input param matches this value.<br />
|-<br />
| 3 || || [10.0.0+] The cmds which require PlayLogPolicy == All, now also allow value 3 if the cmd input flag is set.<br />
|}<br />
<br />
This is an enum for [[#PlayEvent]] +0xE with [[#PlayEventType]] = Applet. This is set via the above commands, which uses this as an input param.<br />
<br />
= PlayEvent =<br />
This is "nn::pdm::PlayEvent".<br />
<br />
This is a 0x38-byte struct and is the raw entry struct directly read from FS, without any entry filtering. The other structs are extracted+converted from this one, with filtering.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x1C || 0x1 || [[#PlayEventType]]<br />
|-<br />
| 0x1D || 0x3 || Padding<br />
|-<br />
| 0x20 || 0x8 || PosixTime timestamp from [[PCV_services|StandardUserSystemClock]].<br />
|-<br />
| 0x28 || 0x8 || PosixTime timestamp from [[PCV_services|StandardNetworkSystemClock]].<br />
|-<br />
| 0x30 || 0x8 || Timestamp in seconds derived from [[PCV_services|StandardSteadyClock]].<br />
|}<br />
<br />
Filtering:<br />
* [[#QueryAppletEvent]], [[#QueryLastPlayTime]], and [[#QueryApplicationPlayStatisticsForSystem]]: PlayEvent +0x1C must be 0, and [[#PlayLogPolicy]] must be 0. [10.0.0+] These will also allow [[#PlayLogPolicy]] value 3, if the input flag is set.<br />
** With [[#QueryLastPlayTime]]/[[#QueryApplicationPlayStatisticsForSystem]] the [[Applet_Manager_services#AppletId|AppletId]] must be 1. [10.0.0+] These now also allow [[Applet_Manager_services#AppletId|AppletId]] 0x1F/0x20.<br />
* [[#QueryPlayStatisticsByApplicationId]]: PlayEvent +0x1C must be 0, +0xC must be 1 ([10.0.0+] or 0x1F/0x20), and the titleID must match. [10.0.0+] [[#PlayLogPolicy]] must be 0. Value 3 is allowed if the input flag is set.<br />
* [[#QueryAccountEvent]]: PlayEvent +0x1C must be 1 and PlayEvent +0x18 must be <=1.<br />
* [[#QueryApplicationPlayStatisticsForSystem]]: In addition to the above, this also handles [[#PlayEventType]] PowerStateChange, where PlayEvent +0x0 is value 0 or 1.<br />
<br />
The structure of the first 0x1C-bytes are determined by [[#PlayEventType]]. For titleIDs/userIDs, the low/high u32 in each u64 is swapped.<br />
<br />
Applet:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x4 || Title version, set by pdm:ntfy [[#NotifyAppletEvent]] and [[#Cmd9]].<br />
|-<br />
| 0x8 || 0x1 || When set to u8 0x1 by pdm:ntfy [[#Cmd8]], this indicates that +0x9 is set. Only used for non-applications.<br />
|-<br />
| 0x9 || 0x1 || See above. [[Applet_Manager_services#LibraryAppletMode|LibraryAppletMode]]<br />
|-<br />
| 0xC || 0x1 || [[Applet_Manager_services#AppletId|AppletId]]<br />
|-<br />
| 0xD || 0x1 || [[Filesystem_services#StorageId|StorageId]]<br />
|-<br />
| 0xE || 0x1 || [[#PlayLogPolicy]]<br />
|-<br />
| 0xF || 0x1 || [[#AppletEventType]]<br />
|-<br />
| 0x10 || 0xC || Unused<br />
|}<br />
<br />
Account:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x10 || userID<br />
|-<br />
| 0x10 || 0x8 || titleID, when u8 +0x18 = 2.<br />
|-<br />
| 0x18 || 0x1 || Type. 0-1 to be listed by [[#QueryAccountEvent]], or 2 to include the above titleID.<br />
|-<br />
| 0x19 || 0x3 || Padding<br />
|}<br />
<br />
PlayEventType PowerStateChange/OperationModeChange: u8 +0x0 is the input value from [[#NotifyOperationModeChangeEvent]]/[[#NotifyPowerStateChangeEvent]], the rest is unused.<br />
<br />
= AccountEvent =<br />
This is "nn::pdm::AccountEvent".<br />
<br />
This is a 0x38-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x10 || userID<br />
|-<br />
| 0x10 || 0x4 || entryindex<br />
|-<br />
| 0x14 || 0x4 || Padding<br />
|-<br />
| 0x18 || 0x8 || [[#PlayEvent]] +0x20<br />
|-<br />
| 0x20 || 0x8 || [[#PlayEvent]] +0x28<br />
|-<br />
| 0x28 || 0x8 || [[#PlayEvent]] +0x30<br />
|-<br />
| 0x30 || 0x1 || [[#PlayEvent]] +0x18<br />
|-<br />
| 0x31 || 0x7 || Padding<br />
|}<br />
<br />
= AccountPlayEvent =<br />
This is "nn::pdm::AccountPlayEvent".<br />
<br />
This is a 0x28-byte struct and is the raw entry struct directly read from FS, without any entry filtering. This is separate from [[#PlayEvent]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x4 || ?<br />
|-<br />
| 0x4 || 0x8 || titleID, with the u32 low/high words swapped.<br />
|-<br />
| 0xC || 0xC || ?<br />
|-<br />
| 0x18 || 0x8 || POSIX timestamp<br />
|-<br />
| 0x20 || 0x8 || POSIX timestamp<br />
|}<br />
<br />
= ApplicationPlayStatistics =<br />
This is "nn::pdm::ApplicationPlayStatistics".<br />
<br />
This is a 0x18-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x8 || Total play-time in nanoseconds.<br />
|-<br />
| 0x10 || 0x8 || Total times the application title was launched.<br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=Flash_Filesystem&diff=10556
Flash Filesystem
2021-01-05T10:42:27Z
<p>Behemoth: /* System Savegames */</p>
<hr />
<div>= NAND structure =<br />
The Switch's eMMC storage features a large user area, two smaller boot partitions and a replay-protected memory block which is unused (no authentication key is programmed).<br />
<br />
All official partition names come from [[SystemInitializer]].<br />
<br />
== Boot Partitions ==<br />
<br />
'''Boot Partition 0 (0 of 1)'''<br />
<br />
The official name for this partition is "BootPartition1Root" and it has [[Filesystem_services|Bis]] Partition ID == 0.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x000000<br />
| 0x4000<br />
| Normal Firmware [[BCT|BCT]] from [[Title_list#System_Data_Archives|Title 0100000000000819]]<br />
|-<br />
| 0x004000<br />
| 0x4000<br />
| SafeMode Firmware [[BCT|BCT]] from [[Title_list#System_Data_Archives|Title 010000000000081A]]<br />
|-<br />
| 0x008000<br />
| 0x4000<br />
| Normal Firmware [[BCT|BCT]] from [[Title_list#System_Data_Archives|Title 0100000000000819]] (backup)<br />
|-<br />
| 0x00C000<br />
| 0x4000<br />
| SafeMode Firmware [[BCT|BCT]] from [[Title_list#System_Data_Archives|Title 010000000000081A]] (backup)<br />
|-<br />
| 0x010000<br />
| 0xEC000<br />
| 59 additional BCTs, normally unused/empty on retail systems.<br />
|-<br />
| 0x0FC000<br />
| 0x4000<br />
| [[#System Update Control|System Update Control area]]<br />
|-<br />
| 0x100000<br />
| 0x40000<br />
| Normal Firmware [[Package1|package1]] from [[Title_list#System_Data_Archives|Title 0100000000000819]]<br />
|-<br />
| 0x140000<br />
| 0x40000<br />
| Normal Firmware [[Package1|package1]] from [[Title_list#System_Data_Archives|Title 0100000000000819]] (backup)<br />
|-<br />
| 0x180000<br />
| 0x4000<br />
| [[#Keyblob|Keyblob area]]<br />
|-<br />
| 0x184000<br />
| 0x200<br />
| [2.0.0+] [[#NAND Patrol|NAND Patrol area]]<br />
|}<br />
<br />
'''Boot Partition 1 (1 of 1)'''<br />
<br />
The official name for this partition is "BootPartition2Root" and it has [[Filesystem_services|Bis]] Partition ID == 10.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x000000<br />
| 0x40000<br />
| SafeMode Firmware [[Package1|package1]] from [[Title_list#System_Data_Archives|Title 010000000000081A]]<br />
|-<br />
| 0x040000<br />
| 0x40000<br />
| SafeMode Firmware [[Package1|package1]] from [[Title_list#System_Data_Archives|Title 010000000000081A]] (backup)<br />
|-<br />
| 0x080000<br />
| 0x40000<br />
| Reserved<br />
|-<br />
| 0x0C0000<br />
| 0x40000<br />
| Reserved<br />
|}<br />
<br />
=== System Update Control ===<br />
The 0x4000 bytes at offset 0xFC000 are used by [[NS_Services|NS]] and [[Boot|boot]] for keeping track of the status of a system update. This area is used by the [[NS_Services#ISystemUpdateControl|ISystemUpdateControl]] commands [[NS_Services#ApplyDownloadedUpdate|ApplyDownloadedUpdate]], [[NS_Services#ApplyCardUpdate|ApplyCardUpdate]] and [[NS_Services#ApplyReceivedUpdate|ApplyReceivedUpdate]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x1<br />
| BootImages status. Set to 1 by [[NS_Services|NS]] during a system update and cleared by [[Boot|boot]] after restarting.<br />
|-<br />
| 0x1<br />
| 0x1<br />
| BootImagesSafe status. Set to 1 by [[NS_Services|NS]] during a system update and cleared by [[Boot|boot]] after restarting.<br />
|}<br />
<br />
=== Keyblob ===<br />
Starting at offset 0x180000 is an array of 0x200-byte entries, for a total of 32 keyblobs. Each one is unique compared to the others and they are all console unique. This is officially known as the "EKS" (encryption key source) area.<br />
<br />
From each 0x200-byte entry only the first 0xB0 bytes effectively form the keyblob as below.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x10<br />
| Keyblob AES-CMAC over the next 0xA0 bytes (safe against timing attacks)<br />
|-<br />
| 0x10<br />
| 0x10<br />
| Keyblob AES CTR<br />
|-<br />
| 0x20<br />
| 0x90<br />
| Keyblob encrypted payload<br />
|-<br />
| 0xB0<br />
| 0x150<br />
| Unused, all-zero.<br />
|}<br />
<br />
The active bootloader's version (offset 0x2330 in the BCT) acts as an index to control which keyblob should be installed into the system.<br />
[[NS_Services|NS]] uses this during system updates to install the keyblob into the [[BCT#customer_data|customer data]] section in BCTs (offset 0x450).<br />
<br />
[[Boot]] also uses this index for repairing corrupt sectors.<br />
<br />
The currently active keyblob is officially known as "SecureInfo".<br />
<br />
=== NAND Patrol ===<br />
The 0x200 bytes at offset 0x184000 are used by [[Filesystem_services|FS]] for keeping track of NAND patrolling.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x20<br />
| HMAC-SHA-256 over the next 0x1E0 bytes<br />
|-<br />
| 0x20<br />
| 0x4<br />
| Last patrolled NAND block's offset<br />
|-<br />
| 0x24<br />
| 0x4<br />
| NAND patrol count<br />
|-<br />
| 0x28<br />
| 0x1D8<br />
| Unused, all-zero.<br />
|}<br />
<br />
== User Partitions ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Partition name<br />
! Partition type GUID<br />
! Offset<br />
! Size<br />
! [[Filesystem_services|Bis]] Partition ID<br />
! Encrypted<br />
! Description<br />
|-<br />
| N/A<br />
| <br />
| 0x0<br />
| <br />
| 20<br />
| No<br />
| GPT header, Bis-storage also allows raw access to the entire NAND eMMC sectors starting at sector0. The official name for this partition is "UserDataRoot".<br />
|-<br />
| [[Calibration|PRODINFO]]<br />
| {98109E25-64E2-4C95-8A77-414916F5BCEB}<br />
| 0x00004400<br />
| 0x003FBC00<br />
| 27<br />
| Yes (Bis key 0)<br />
| "CAL0" raw partition containing set:cal data. The official name for this partition is "CalibrationBinary".<br />
|-<br />
| [[Calibration|PRODINFOF]]<br />
| {F3056AEC-5449-494C-9F2C-5FDCB75B6E6E}<br />
| 0x00400000<br />
| 0x00400000<br />
| 28<br />
| Yes (Bis key 0)<br />
| FAT12 filesystem, additional calibration. The official name for this partition is "CalibrationFile".<br />
|-<br />
| BCPKG2-1-Normal-Main<br />
| {5365DE36-911B-4BB4-8FF9-AA1EBCD73990}<br />
| 0x00800000<br />
| 0x00800000<br />
| 21<br />
| No<br />
| Raw partition where the first 0x4000 bytes (usually empty) contain the [[BootConfig]] and the remaining space contains the [[Package2|package2]] image from [[Title_list#System_Data_Archives|Title 0100000000000819]] by default. With the exFAT update installed, the [[Package2|package2]] image is switched to the one from [[Title_list#System_Data_Archives|Title 010000000000081B]]. The official name for this partition is "BootConfigAndPackage2Part1".<br />
|-<br />
| BCPKG2-2-Normal-Sub<br />
| {8455717B-BD2B-4162-8454-91695218FC38}<br />
| 0x01000000<br />
| 0x00800000<br />
| 22<br />
| No<br />
| Backup partition for BCPKG2-1-Normal-Main. The official name for this partition is "BootConfigAndPackage2Part2".<br />
|-<br />
| BCPKG2-3-SafeMode-Main<br />
| {8ED6C9A6-9C48-490B-BBEB-001D17A4C0F7}<br />
| 0x01800000<br />
| 0x00800000<br />
| 23<br />
| No<br />
| Raw partition where the first 0x4000 bytes (usually empty) contain the [[BootConfig]] and the remaining space contains the [[Package2|package2]] image from [[Title_list#System_Data_Archives|Title 010000000000081A]] by default. On [4.0.0+] and with the exFAT update installed, the [[Package2|package2]] image is switched to the one from [[Title_list#System_Data_Archives|Title 010000000000081C]]. The official name for this partition is "BootConfigAndPackage2Part3".<br />
|-<br />
| BCPKG2-4-SafeMode-Sub<br />
| {5E99751C-56C9-47CC-AA30-B65039888917}<br />
| 0x02000000<br />
| 0x00800000<br />
| 24<br />
| No<br />
| Backup partition for BCPKG2-3-SafeMode-Main. The official name for this partition is "BootConfigAndPackage2Part4".<br />
|-<br />
| BCPKG2-5-Repair-Main<br />
| {C447D9A2-24B7-468A-98C8-595CD077165A}<br />
| 0x02800000<br />
| 0x00800000<br />
| 25<br />
| No<br />
| Installed at the factory, never written afterwards on retail. In one case this is identical to normal [[1.0.0]] [[Package2|package2]], except this has encrypted data at the end padded for 0x1000-byte alignment. The official name for this partition is "BootConfigAndPackage2Part5".<br />
|-<br />
| BCPKG2-6-Repair-Sub<br />
| {9586E1A1-3AA2-4C90-91B3-2F4A5195B4D2}<br />
| 0x03000000<br />
| 0x00800000<br />
| 26<br />
| No<br />
| Backup partition for BCPKG2-5-Repair-Main. The official name for this partition is "BootConfigAndPackage2Part6".<br />
|-<br />
| SAFE<br />
| {A44F9F6B-4ED3-441F-A34A-56AAA136BC6A}<br />
| 0x03800000<br />
| 0x04000000<br />
| 29<br />
| Yes (Bis key 1)<br />
| FAT32 filesystem. The official name for this partition is "SafeMode".<br />
|-<br />
| SYSTEM<br />
| {ACB0CDF0-4F72-432D-AA0D-5388C733B224}<br />
| 0x07800000 <br />
| 0xA0000000<br />
| 31, 32 and 33<br />
| Yes (Bis key 2)<br />
| FAT32 filesystem. The official names for these partitions are "System", "SystemProperEncryption" and "SystemProperPartition".<br />
|-<br />
| USER<br />
| {2B777F63-E842-47AF-94C4-25A7F18B2280}<br />
| 0xA7800000<br />
| 0x680000000<br />
| 30<br />
| Yes (Bis key 3)<br />
| FAT32 filesystem.<br />
|-<br />
| <br />
| <br />
| 0x747BFFE00<br />
| 0x200<br />
| <br />
| No<br />
| This is the backup GPT header specified by the main GPT header. This is also the last sector readable with Bis-storage paritionID 20.<br />
|}<br />
<br />
If the client process lacks the relevant permission for any of the above partition IDs, error 0x2EE202 is returned.<br />
<br />
[[NCA]]s stored in NAND are raw, identical to the data readable with [[NCM_services#ReadContentIdFile]].<br />
<br />
The filenames for saveimages is just "<lower-case hex u64 saveID>". SYSTEM-partition saveIDs are specified by [[Filesystem_services|FS]] commands, while USER-partition saveIDs are determined by FS-module internally. The high u32 of the saveID is normally either 0x00000000 or 0x80000000.<br />
<br />
Encrypted partitions use AES-XTS using the same non-standard tweak (tweak[0] = sectorIdx[MSB] .. tweak[15] = sectorIdx[LSB], if using 32bit sectorIdx that means tweak[0]..tweak[11] are 0, with tweak[12]..tweak[15] containing big-endian sectorIdx) as other Nintendo AES-XTS code, initial_sector = 0, and sector size 0x4000. All encrypted partitions use console unique keydata.<br />
<br />
=== PRODINFOF ===<br />
PRODINFOF<br />
├── Certifications<br />
│ └── WirelessCertification.png<br />
└── ptd<br />
├── DeviceIdWithEmsBit.dat<br />
├── Ecid.dat<br />
├── prodCode.dat<br />
└── log<br />
├── Process_asm1.log<br />
├── Process_board1.log<br />
├── TestFlagLine.log<br />
├── TestFlagQc.log<br />
├── AGING<br />
│ └── Sequence.log<br />
├── BOARD_TEST<br />
│ └── Sequence.log<br />
├── BOARD_WIRELESS<br />
│ └── Sequence.log<br />
├── FINAL_CHECK<br />
│ └── Sequence.log<br />
├── LCD_AND_KEY<br />
│ └── Sequence.log<br />
└── USB_AND_HP<br />
└── Sequence.log<br />
<br />
==== DeviceIdWithEmsBit.dat ====<br />
Contains a 0x10-byte uppercase hex string, identical to the DeviceId in the [[Settings_services|DeviceCert]].<br />
<br />
=== SYSTEM ===<br />
SYSTEM<br />
├── PRF2SAFE.RCV<br />
├── Contents<br />
│ ├── registered<br />
│ │ └── ... [[NCA]]<br />
│ └── placehld<br />
│ └── ... [[NCA]]<br />
├── [[Savegames|save]]<br />
│ └── ...<br />
└── saveMeta<br />
└── ... (empty?)<br />
<br />
The saves stored under this partition are only for system-titles / etc.<br />
<br />
=== USER ===<br />
USER<br />
├── PRF2SAFE.RCV<br />
├── Album (Same layout as [[SD_Filesystem|SD]])<br />
├── Contents<br />
│ ├── registered<br />
│ │ └── ... [[NCA]]<br />
│ └── placehld<br />
│ └── ... [[NCA]]<br />
├── [[Savegames|save]]<br />
│ └── ...<br />
├── saveMeta<br />
│ └── ... <br />
└── temp <br />
<br />
The saves for all non-system applications, regardless of where the application is located(storageID), is stored here. Each user account which has savedata has a separate saveimage. Save-common for an application is presumably a separate saveimage too. Every saveimage here is ''only'' for applications.<br />
<br />
=== SAFE ===<br />
SAFE<br />
├── PRF2SAFE.RCV<br />
├── Contents<br />
│ ├── registered<br />
│ │ └── ... [[NCA]] (nothing installed?)<br />
│ └── placehld<br />
│ └── ... [[NCA]]<br />
└── [[Savegames|save]]<br />
├── 8000000000000000<br />
└── 8000000000000120<br />
<br />
On a v2.1 system with MountBis, the only thing under here is "PRF2SAFE.RCV".<br />
<br />
= System Savegames =<br />
<br />
This is a listing of known System Savedata and what titles they correspond to.<br />
<br />
{| class="wikitable" border="1"<br />
! SaveID || Owner || Mount || Notes<br />
|-<br />
| 0x8000000000000000 || fs || <nowiki>saveDataIxrDb:/</nowiki>, <nowiki>saveDataIxrDbSf:/</nowiki>, <nowiki>saveDataIxrDbPr:/</nowiki>, <nowiki>saveDataIxrDbSd:/</nowiki> || Contains [[IMKV|imkvdb.arc]] and "lastPublishedId".<br />
|-<br />
| 0x8000000000000010 || account || <nowiki>account:/</nowiki> || Account database.<br />
|-<br />
| 0x8000000000000011 || account || <nowiki>idgen:/</nowiki> ||<br />
|-<br />
| 0x8000000000000020 || nfc || <nowiki>data:/</nowiki> || NFC data and backups.<br />
|-<br />
| 0x8000000000000030 || ns || <nowiki>mii:/</nowiki> || Mii database.<br />
|-<br />
| 0x8000000000000031 || ns || <nowiki>mii:/</nowiki> || Mii test mode database.<br />
|-<br />
| 0x8000000000000040 || ns || <nowiki>apprecdb:/</nowiki> ||<br />
|-<br />
| 0x8000000000000041 || ns || <nowiki>nsaccache:/</nowiki> || Home menu icondata/lru list for recently played games.<br />
|-<br />
| 0x8000000000000043 || ns || <nowiki>ns_appman:/</nowiki> ||<br />
|-<br />
| 0x8000000000000044 || ns || <nowiki>ns_sysup:/</nowiki> || Content update context.<br />
|-<br />
| 0x8000000000000045 || ns || <nowiki>[1.0.0-6.2.0] vmdb:/, [7.0.0+] lrdb:/</nowiki> || Required Version List storage. Also contained Version List storage before 7.0.0.<br />
|-<br />
| 0x8000000000000046 || ns || <nowiki>dtlman:/</nowiki> ||<br />
|-<br />
| 0x8000000000000047 || ns || <nowiki>ns_exfat:/</nowiki> ||<br />
|-<br />
| 0x8000000000000048 || ns || <nowiki>ns_systemseed:/</nowiki> ||<br />
|-<br />
| 0x8000000000000049 || ns || <nowiki>ns_ssversion:/</nowiki> || Safe System version.<br />
|-<br />
| 0x800000000000004A || ns || <nowiki>ns_rightsid:/</nowiki> || List of RightsIDs with NCA IDs for corresponding Program title.<br />
|-<br />
| 0x8000000000000050 || settings || <nowiki>SystemSettings:/</nowiki> ||<br />
|-<br />
| 0x8000000000000051 || settings || <nowiki>FwdbgSettingsS:/</nowiki> ||<br />
|-<br />
| 0x8000000000000052 || settings || <nowiki>PrivateSettings:/</nowiki> ||<br />
|-<br />
| 0x8000000000000053 || settings || <nowiki>DeviceSettings:/</nowiki> ||<br />
|-<br />
| 0x8000000000000054 || settings || <nowiki>ApplnSettings:/</nowiki> ||<br />
|-<br />
| 0x8000000000000060 || ssl || <nowiki>SslSave:/</nowiki> ||<br />
|-<br />
| 0x8000000000000070 || nim || <nowiki>nim_sys:/</nowiki> ||<br />
|-<br />
| 0x8000000000000071 || nim || <nowiki>nim_net:/</nowiki> ||<br />
|-<br />
| 0x8000000000000072 || nim || <nowiki>nim_tmp:/</nowiki> ||<br />
|-<br />
| 0x8000000000000073 || nim || <nowiki>nim_dac:/</nowiki> ||<br />
|-<br />
| 0x8000000000000074 || nim || <nowiki>nim_delta:/</nowiki> ||<br />
|-<br />
| 0x8000000000000075 || nim || <nowiki>nim_vac:/</nowiki> ||<br />
|-<br />
| 0x8000000000000076 || nim || <nowiki>nim_local:/</nowiki> ||<br />
|-<br />
| 0x8000000000000077 || nim || <nowiki>nim_lsys:/</nowiki> ||<br />
|-<br />
| 0x8000000000000078 || nim || <nowiki>nim_eca_dbg:/</nowiki> ||<br />
|-<br />
| 0x8000000000000080 || friends || <nowiki>friends:/</nowiki> || Per-user savedata.<br />
|-<br />
| 0x8000000000000081 || friends || <nowiki>friends-sys:/</nowiki> ||<br />
|-<br />
| 0x8000000000000082 || friends || <nowiki>friends-image:/</nowiki> ||<br />
|-<br />
| 0x8000000000000090 || bcat || <nowiki>news:/</nowiki> || Actual news msgpack archives.<br />
|-<br />
| 0x8000000000000091 || bcat || <nowiki>news-sys:/</nowiki> || News metadata, tasklist, history, database, required system version, etc.<br />
|-<br />
| 0x8000000000000092 || bcat || <nowiki>news-dl:/</nowiki> || Storage for newly(?) downloaded news list/data.<br />
|-<br />
| 0x80000000000000A0 || bcat || <nowiki>prepo-sys:/</nowiki> || Play Report system information.<br />
|-<br />
| 0x80000000000000A1 || bcat || <nowiki>prepo:/</nowiki> || Play Report msgpack archives.<br />
|-<br />
| 0x80000000000000A2 || bcat || <nowiki>prepo-ap:/</nowiki> || Play Report msgpack archives of EventId "application_execution_history".<br />
|-<br />
| 0x80000000000000B0 || bsdsockets || <nowiki>nsdsave:/</nowiki> || Socket configuration saved data.<br />
|-<br />
| 0x80000000000000C1 || bcat || <nowiki>bcat-sys:/</nowiki> ||<br />
|-<br />
| 0x80000000000000C2 || bcat || <nowiki>bcat-dl:/</nowiki> ||<br />
|-<br />
| 0x80000000000000D1 || erpt || <nowiki>save:/</nowiki> || Contains "/journal" report listing + actual crash reports ("/%08x-%04x-%04x-%02x%02x-%04x%08x"), which are serialized via [http://msgpack.org/ MsgPack].<br />
|-<br />
| 0x80000000000000E0 || es || <nowiki>escertificate:/</nowiki> ||<br />
|-<br />
| 0x80000000000000E1 || es || <nowiki>escommon:/</nowiki> ||<br />
|-<br />
| 0x80000000000000E2 || es || <nowiki>espersonalized:/</nowiki> ||<br />
|-<br />
| 0x80000000000000E3 || es || <nowiki>esmetarecord:/</nowiki> ||<br />
|-<br />
| 0x80000000000000E4 || es || <nowiki>eselicense:/</nowiki> ||<br />
|-<br />
| 0x80000000000000F0 || ns || <nowiki>pdm:/</nowiki> || Play Data log. Per-user savedata.<br />
|-<br />
| 0x8000000000000100 || pctl || <nowiki>pctlss:/</nowiki> || Parental Control settings.<br />
|-<br />
| 0x8000000000000110 || npns || <nowiki>npns_save:/</nowiki> || Push notifications persistent storage.<br />
|-<br />
| 0x8000000000000120 || ncm || ? || meta/[[IMKV|imkvdb.arc]] for system partition. Cache of data extracted from the [[CNMT]] for installed firmware titles (including 816).<br />
|-<br />
| 0x8000000000000121 || ncm || ? || meta/[[IMKV|imkvdb.arc]] for user partition. Cache of data extracted from the [[CNMT]] for installed game, update, and DLC titles.<br />
|-<br />
| 0x8000000000000122 || || || <br />
|-<br />
| 0x8000000000000130 || migration || <nowiki>state:/</nowiki> || <br />
|-<br />
| 0x8000000000000131 || migration || <nowiki>context:/</nowiki> || <br />
|-<br />
| 0x8000000000000132 || migration || <nowiki>sd_state:/</nowiki> || <br />
|-<br />
| 0x8000000000000133 || migration || <nowiki>sd_context:/</nowiki> || <br />
|-<br />
| 0x8000000000000140 || capsrv || <nowiki>TM:/</nowiki> || <br />
|-<br />
| 0x8000000000000150 || olsc || ? || <br />
|-<br />
| 0x8000000000000153 || olsc || ? || <br />
|-<br />
| 0x8000000000000180 || sdb || [7.0.0+] vmdb:/ || Version list was moved here in 7.0.0 or 7.0.1<br />
|-<br />
| 0x8000000000000190 || glue || ? || <br />
|-<br />
| 0x8000000000001010 || qlaunch || || Contains "savedata.dat".<br />
|-<br />
| 0x8000000000001020 || swkbd || || Per-user savedata.<br />
|-<br />
| 0x8000000000001040 || miiEdit || || <br />
|-<br />
| 0x8000000000001050 || miiEdit || || Contains "database.dat". Possibly Mii data and Mii texture data?<br />
|-<br />
| 0x8000000000001060 || shop || || <br />
|-<br />
| 0x8000000000001061 || shop || || Per-user savedata.<br />
|-<br />
| 0x8000000000001070 || web || || <br />
|-<br />
| 0x8000000000001071 || web || || Per-user savedata.<br />
|-<br />
| 0x8000000000001091 || loginShare || || Per-user savedata.<br />
|-<br />
| 0x80000000000010B0 || playerSelect || || Contains "savedata.dat". Per-user savedata.<br />
|-<br />
| 0x80000000000010C0 || myPage || || Per-user savedata.<br />
|-<br />
| 0x8000000000010002 || bcat || || Delivery cache storage for application 010099F00D810000<br />
|-<br />
| 0x8000000000010003 || bcat || || Delivery cache storage for application 0100000000001033<br />
|-<br />
| 0x8000000000010004 || bcat || || Delivery cache storage for application 0100000000001034<br />
|-<br />
| 0x8000000000010005 || bcat || || Delivery cache storage for application 010000000000102E<br />
|}</div>
Behemoth
https://switchbrew.org/w/index.php?title=Shared_Database_services&diff=10555
Shared Database services
2021-01-05T10:19:46Z
<p>Behemoth: /* IVersionListImporter */</p>
<hr />
<div>= pl:u, pl:s =<br />
These are "nn::pl::detail::IPlatformServiceManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#RequestLoad]]<br />
|-<br />
| 1 || [[#GetLoadState]]<br />
|-<br />
| 2 || [[#GetSize]]<br />
|-<br />
| 3 || [[#GetSharedMemoryAddressOffset]]<br />
|-<br />
| 4 || [[#GetSharedMemoryNativeHandle]]<br />
|-<br />
| 5 || [[#GetSharedFontInOrderOfPriority]]<br />
|-<br />
| 6 || [4.0.0+] GetSharedFontInOrderOfPriorityForSystem<br />
|-<br />
| 100 || [8.0.0+] RequestApplicationFunctionAuthorization<br />
|-<br />
| 101 || [8.0.0+] RequestApplicationFunctionAuthorizationByProcessId<br />
|-<br />
| 102 || [10.0.0+] RequestApplicationFunctionAuthorizationByApplicationId<br />
|-<br />
| 103 || [11.0.0+] RefreshApplicationFunctionBlackListDebugRecord<br />
|-<br />
| 104 || [11.0.0+] RequestApplicationFunctionAuthorizationByProgramId<br />
|-<br />
| 105 || [11.0.0+] GetFunctionBlackListSystemVersionToAuthorize<br />
|-<br />
| 106 || [11.0.0+] GetFunctionBlackListVersion<br />
|-<br />
| 1000 || [9.0.0+] LoadNgWordDataForPlatformRegionChina<br />
|-<br />
| 1001 || [9.0.0+] GetNgWordDataSizeForPlatformRegionChina<br />
|}<br />
<br />
== RequestLoad ==<br />
Takes a [[#SharedFontType]] (uint32), no output.<br />
<br />
== GetLoadState ==<br />
Takes a [[#SharedFontType]] (uint32), returns the [[#LoadState]] (uint32).<br />
<br />
=== LoadState ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value || Description<br />
|-<br />
| 0x00 || Loading<br />
|-<br />
| 0x01 || Loaded<br />
|}<br />
<br />
== GetSize ==<br />
Takes a [[#SharedFontType]] (uint32), returns the Font Size (uint32).<br />
<br />
== GetSharedMemoryAddressOffset ==<br />
Takes a [[#SharedFontType]] (uint32), returns the offset (uint32) to the Font Address.<br />
<br />
== GetSharedMemoryNativeHandle ==<br />
No input, returns an output SharedMemory handle.<br />
<br />
User-processes map this SharedMemory with size=0x1100000 and permissions=R--.<br />
<br />
Font data is TTF, located at the offset returned by [[#GetSharedFontAddress]].<br />
<br />
== GetSharedFontInOrderOfPriority ==<br />
Takes an input u64 [[Settings_services#LanguageCode|LanguageCode]] and 3 type-0x6 output buffers, returns an output u8 and u32. The u8 is a bool to specify if the fonts are loaded or not and the u32 is the font count.<br />
The first buffer contains a list of [[#SharedFontType|Shared font types]], the second buffer contains the font offsets and the final buffer contains the font sizes.<br />
The buffers are an array of u32s which specify information about a specific font. Buffer1[n] is related to Buffer2[n] and Buffer3[n].<br />
Example: Font index 0s offset is at Buffer2[0], size is at Buffer3[0].<br />
The fonts are relative to the shared memory created by [[#GetSharedFontSharedMemoryHandle]]<br />
<br />
== SharedFontType ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value || Description<br />
|-<br />
| 0x00 || Japan, US and Europe (Standard)<br />
|-<br />
| 0x01 || Chinese Simplified<br />
|-<br />
| 0x02 || Extended Chinese Simplified<br />
|-<br />
| 0x03 || Chinese Traditional<br />
|-<br />
| 0x04 || Korean (Hangul)<br />
|-<br />
| 0x05 || Nintendo Extended<br />
|}<br />
<br />
* Nintendo Extended: Contains Nintendo-specific characters, including HID buttons, HID controller styles, applet icons, Wii(U) icons, etc.<br />
<br />
= mii:u, mii:e =<br />
This is "nn::mii::detail::IStaticService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetDatabaseService<br />
|}<br />
<br />
== IDatabaseService ==<br />
This is "nn::mii::detail::IDatabaseService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || IsUpdated<br />
|-<br />
| 1 || IsFullDatabase<br />
|-<br />
| 2 || GetCount<br />
|-<br />
| 3 || Get<br />
|-<br />
| 4 || Get1<br />
|-<br />
| 5 || UpdateLatest<br />
|-<br />
| 6 || BuildRandom<br />
|-<br />
| 7 || BuildDefault<br />
|-<br />
| 8 || Get2<br />
|-<br />
| 9 || Get3<br />
|-<br />
| 10 || UpdateLatest1<br />
|-<br />
| 11 || FindIndex<br />
|-<br />
| 12 || Move<br />
|-<br />
| 13 || AddOrReplace<br />
|-<br />
| 14 || Delete<br />
|-<br />
| 15 || DestroyFile<br />
|-<br />
| 16 || DeleteFile<br />
|-<br />
| 17 || Format<br />
|-<br />
| 18 || Import<br />
|-<br />
| 19 || Export<br />
|-<br />
| 20 || IsBrokenDatabaseWithClearFlag<br />
|-<br />
| 21 || GetIndex<br />
|-<br />
| 22 || [5.0.0+] SetInterfaceVersion<br />
|-<br />
| 23 || [5.0.0+] Convert<br />
|-<br />
| 24 || [7.0.0+] ConvertCoreDataToCharInfo<br />
|-<br />
| 25 || [7.0.0+] ConvertCharInfoToCoreData<br />
|-<br />
| 26 || [10.2.0+] Append<br />
|}<br />
<br />
= miiimg =<br />
This is "nn::mii::detail::IImageDatabaseService".<br />
<br />
This was added with [5.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Initialize<br />
|-<br />
| 10 || Reload<br />
|-<br />
| 11 || GetCount<br />
|-<br />
| 12 || IsEmpty<br />
|-<br />
| 13 || IsFull<br />
|-<br />
| 14 || GetAttribute<br />
|-<br />
| 15 || LoadImage<br />
|-<br />
| 16 || AddOrUpdateImage<br />
|-<br />
| 17 || DeleteImages<br />
|-<br />
| 100 || DeleteFile<br />
|-<br />
| 101 || DestroyFile<br />
|-<br />
| 102 || ImportFile<br />
|-<br />
| 103 || ExportFile<br />
|-<br />
| 104 || ForceInitialize<br />
|}<br />
<br />
= pdm:ntfy =<br />
This is "nn::pdm::detail::INotifyService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#NotifyAppletEvent]]<br />
|-<br />
| 2 || [[#NotifyOperationModeChangeEvent]]<br />
|-<br />
| 3 || [[#NotifyPowerStateChangeEvent]]<br />
|-<br />
| 4 || [[#NotifyClearAllEvent]]<br />
|-<br />
| 5 || [[#NotifyEventForDebug]]<br />
|-<br />
| 6 || [4.0.0+] SuspendUserAccountEventService<br />
|-<br />
| 7 || [4.0.0+] ResumeUserAccountEventService<br />
|-<br />
| 8 || [6.0.0+]<br />
|-<br />
| 9 || [8.0.0+]<br />
|}<br />
<br />
== NotifyAppletEvent ==<br />
Takes an input u8 [[#AppletEventType]], an u8 [[Applet_Manager_services#AppletId|AppletId]], an u8 [[Filesystem_services#StorageId|StorageId]], an u8 [[#PlayLogPolicy]], an u32 '''event_x8''', and an u64 '''titleID'''. Returns no output.<br />
<br />
When [[#PlayLogPolicy]] is 2 ("None") this will immediately return 0.<br />
<br />
Logs a new [[#PlayEvent]] with the following data:<br />
* Clears the 0x10-bytes at +0x10.<br />
* u8 +0xF = [[#AppletEventType]].<br />
* Sets the 3 timestamps.<br />
* Converts '''titleID''' and writes it to +0x0.<br />
* u32 +0x8 = '''event_x8'''.<br />
* u8 +0xC = [[Applet_Manager_services#AppletId|AppletId]], u8 +0xD = [[Filesystem_services#StorageId|StorageId]], and u8 +0xE = [[#PlayLogPolicy]].<br />
<br />
After the initial logging, additional code runs with some of the above input params.<br />
<br />
== NotifyOperationModeChangeEvent ==<br />
Takes an input u8 '''inval''', no output.<br />
<br />
Logs a new [[#PlayEvent]] with the following data: clears the 0x20-bytes at +0x0, u8 +0x1C = 0x3, u8 +0x0 = '''inval''', and sets the 3 timestamps.<br />
<br />
== NotifyPowerStateChangeEvent ==<br />
Takes an input u8 '''inval''', no output.<br />
<br />
Logs a new [[#PlayEvent]] with the following data: clears the 0x20-bytes at +0x0, u8 +0x1C = 0x2, u8 +0x0 = '''inval''', and sets the 3 timestamps.<br />
<br />
After the initial logging, additional code runs which uses '''inval'''.<br />
<br />
== NotifyClearAllEvent ==<br />
No input/output.<br />
<br />
== NotifyEventForDebug ==<br />
Takes an input type-0x5 buffer containing an array of [[#PlayEvent]], no output.<br />
<br />
Gets the [[System_Settings|system-setting]] <code>pdm!is_production</code>, the size must be 1 and the value must be 0, otherwise an error is returned.<br />
<br />
Each [[#PlayEvent]] entry is validated, throwing an error on failure. After an entry is successfully validated, it is written to the log.<br />
<br />
== Cmd8 ==<br />
Takes an input u8 [[#AppletEventType]], an u8 [[Applet_Manager_services#LibraryAppletMode|LibraryAppletMode]], an u8 [[Applet_Manager_services#AppletId|AppletId]], an u8 [[Filesystem_services#StorageId|StorageId]], an u8 [[#PlayLogPolicy]], and an u64 '''titleID'''. Returns no output.<br />
<br />
This is similar to [[#NotifyAppletEvent]].<br />
<br />
When [[#PlayLogPolicy]] is 2 ("None") this will immediately return 0.<br />
<br />
Logs a new [[#PlayEvent]] with the following data:<br />
* Clears the 0x20-bytes at +0x0.<br />
* u8 +0xF = [[#AppletEventType]].<br />
* Sets the 3 timestamps.<br />
* Converts '''titleID''' and writes it to +0x0.<br />
* u8 +0x9 = [[Applet_Manager_services#LibraryAppletMode|LibraryAppletMode]].<br />
* u8 +0x8 = 1.<br />
* u8 +0xC = [[Applet_Manager_services#AppletId|AppletId]], u8 +0xD = [[Filesystem_services#StorageId|StorageId]], and u8 +0xE = [[#PlayLogPolicy]].<br />
<br />
After the initial logging, additional code runs with some of the above input params. This is handled the same as [[#NotifyAppletEvent]], except that the value passed for '''event_x8''' is value 0 here.<br />
<br />
== Cmd9 ==<br />
Takes an input u8 [[#AppletEventType]], an u8 [[Applet_Manager_services#AppletId|AppletId]], an u8 [[Filesystem_services#StorageId|StorageId]], an 0x20-byte struct, an u8 bool flag, an u8 [[#PlayLogPolicy]], an u32 '''event_x8''', and an u64 '''program_id'''. Returns no output.<br />
<br />
[10.0.0+] This now takes an additional input u64, new_program_id. At the very beginning a new func is now called, with params: ({constant value}, &[[#AppletEventType]], &program_id, &new_program_id, &StorageId). Afterwards, where it would originally use program_id, it now uses new_program_id instead. The called func eventually writes the input to a buffer using msgpack, with the output from that being added to a list in state.<br />
<br />
This is identical to [[#NotifyAppletEvent]] except for the additional struct/flag params.<br />
<br />
After the initial logging, additional code runs with some of the above input params. This is handled the same as [[#NotifyAppletEvent]], except that when the u8 bool flag is set the input struct is used with this.<br />
<br />
[10.0.0+] New code at the very end of this func was added. When [[Applet_Manager_services#AppletId|AppletId]] is 0x1, or 0x1F-0x20, the following runs:<br />
* If [[#AppletEventType]] is 1, 5, or 6, func1 is called with param &program_id. This runs msgpack code similar to the above, then does {other things}.<br />
* Otherwise, if [[#AppletEventType]] is 0, func0 is called with param &program_id.<br />
** This calls the same msgpack func at the start as func1. [[Glue_services#GetApplicationLaunchProperty|GetApplicationLaunchProperty]] is used, with the output being copied to state on success, otherwise the output Result is used with other msgpack code.<br />
* If [[#AppletEventType]] doesn't match any of these, nothing is done.<br />
<br />
= pdm:qry =<br />
This is "nn::pdm::detail::IQueryService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#QueryAppletEvent]] ([1.0.0-7.0.1] QueryApplicationEvent)<br />
|-<br />
| 1 || [1.0.0-6.2.0] [[#QueryPlayStatistics]]<br />
|-<br />
| 2 || [1.0.0-6.2.0] [[#QueryPlayStatisticsByUserAccountId]]<br />
|-<br />
| 3 || [1.0.0-6.2.0] [[#QueryPlayStatisticsByNetworkServiceAccountId]]<br />
|-<br />
| 4 || [[#QueryPlayStatisticsByApplicationId]]<br />
|-<br />
| 5 || [[#QueryPlayStatisticsByApplicationIdAndUserAccountId]]<br />
|-<br />
| 6 || [1.0.0-6.2.0] [[#QueryPlayStatisticsByApplicationIdAndNetworkServiceAccountId]]<br />
|-<br />
| 7 || [10.0.0+] [[#QueryLastPlayTimeV0]] ([1.0.0-9.2.0] QueryLastPlayTime)<br />
|-<br />
| 8 || [[#QueryPlayEvent]]<br />
|-<br />
| 9 || [[#GetAvailablePlayEventRange]]<br />
|-<br />
| 10 || [[#QueryAccountEvent]]<br />
|-<br />
| 11 || [4.0.0+] [[#QueryAccountPlayEvent]]<br />
|-<br />
| 12 || [4.0.0+] [[#GetAvailableAccountPlayEventRange]]<br />
|-<br />
| 13 || [10.0.0+] [[#QueryApplicationPlayStatisticsForSystemV0]] ([5.0.0-9.2.0] QueryApplicationPlayStatisticsForSystem)<br />
|-<br />
| 14 || [6.0.0+] [[#QueryRecentlyPlayedApplication]]<br />
|-<br />
| 15 || [6.0.0+] [[#GetRecentlyPlayedApplicationUpdateEvent]]<br />
|-<br />
| 16 || [10.0.0+] [[#QueryApplicationPlayStatisticsByUserAccountIdForSystemV0]] ([6.0.0-9.2.0] QueryApplicationPlayStatisticsByUserAccountIdForSystem)<br />
|-<br />
| 17 || [10.0.0+] [[#QueryLastPlayTime]]<br />
|-<br />
| 18 || [10.0.0+] [[#QueryApplicationPlayStatisticsForSystem]]<br />
|-<br />
| 19 || [10.0.0+] [[#QueryApplicationPlayStatisticsByUserAccountIdForSystem]]<br />
|}<br />
<br />
== QueryAppletEvent ==<br />
Takes ([10.0.0+] an input u8 bool), an input s32 entry_index, a type-0x6 output buffer containing an array of [[#AppletEvent]], and returns an output s32 for actual total output entries.<br />
<br />
== QueryPlayStatistics ==<br />
Takes a type-0x6 output buffer containing an array of [[#PlayStatistics]] and returns an output s32 for actual total output entries.<br />
<br />
[6.2.0+] This command was removed.<br />
<br />
== QueryPlayStatisticsByUserAccountId ==<br />
Takes an input u128 '''Uid''', a type-0x6 output buffer containing an array of [[#PlayStatistics]] and returns an output s32 for actual total output entries.<br />
<br />
[6.2.0+] This command was removed.<br />
<br />
== QueryPlayStatisticsByNetworkServiceAccountId ==<br />
Takes an input u64 '''NetworkServiceAccountId''', a type-0x6 output buffer containing an array of [[#PlayStatistics]] and returns an output s32 for actual total output entries.<br />
<br />
[6.2.0+] This command was removed.<br />
<br />
== QueryPlayStatisticsByApplicationId ==<br />
Takes ([10.0.0+] an input u8 bool), an input u64 '''ApplicationId''' and returns an output [[#PlayStatistics]].<br />
<br />
== QueryPlayStatisticsByApplicationIdAndUserAccountId ==<br />
Takes ([10.0.0+] an input u8 bool), an input u64 '''ApplicationId''', an input u128 '''Uid''' and returns an output [[#PlayStatistics]].<br />
<br />
== QueryPlayStatisticsByApplicationIdAndNetworkServiceAccountId ==<br />
Takes an input u64 '''ApplicationId''', an input u64 '''NetworkServiceAccountId''' and returns an output [[#PlayStatistics]].<br />
<br />
[6.2.0+] This command was removed.<br />
<br />
== QueryLastPlayTimeV0 ==<br />
Takes a type-0x6 output buffer containing an array of [[#LastPlayTime]], and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
[10.0.0+] This now calls the impl func for [[#QueryLastPlayTime]] with flag=0.<br />
<br />
== QueryPlayEvent ==<br />
Takes an input s32 entry_index, a type-0x6 output buffer containing an array of [[#PlayEvent]], and returns an output s32 for actual total output entries.<br />
<br />
== GetAvailablePlayEventRange ==<br />
No input, returns 3 output s32s: total_entries, start_entry_index, and end_entry_index.<br />
<br />
== QueryAccountEvent ==<br />
Takes an input s32 entry_index, a type-0x6 output buffer containing an array of [[#AccountEvent]], and returns an output s32 for actual total output entries.<br />
<br />
== QueryAccountPlayEvent ==<br />
Takes an input s32 entry_offset, an input u128 '''Uid''', a type-0x6 output buffer containing an array of [[#AccountPlayEvent]], and returns an output s32 for actual total output entries.<br />
<br />
== GetAvailableAccountPlayEventRange ==<br />
Takes an input u128 '''Uid''' and returns 3 output s32s: total_entries, start_entry_index, and end_entry_index.<br />
<br />
== QueryApplicationPlayStatisticsForSystemV0 ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationPlayStatistics]] and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
The number of entries in each array is the same.<br />
<br />
[10.0.0+] This now calls the impl func for [[#QueryApplicationPlayStatisticsForSystem]] with flag=0.<br />
<br />
== QueryRecentlyPlayedApplication ==<br />
Takes ([10.0.0+] an input u8 bool), an input u128 '''Uid''', a type-0x6 output buffer containing an array of u64 '''ApplicationId''', and returns an output s32 for actual total output entries.<br />
<br />
Returns a list of titles played by the specified user.<br />
<br />
== GetRecentlyPlayedApplicationUpdateEvent ==<br />
No input, returns an output Event handle with autoclear=false.<br />
<br />
This is signaled when logging a new [[#PlayEvent]] which would be available via [[#QueryAccountEvent]], where [[#PlayEvent]] +0x18 is 0.<br />
<br />
== QueryApplicationPlayStatisticsByUserAccountIdForSystemV0 ==<br />
Takes an [[Account_services#Uid|Uid]], a type-0x6 output buffer containing an array of [[#ApplicationPlayStatistics]] and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
Same as [[#QueryApplicationPlayStatisticsForSystemV0]] except this gets playstats specific to '''Uid'''.<br />
<br />
[10.0.0+] This now calls the impl func for [[#QueryApplicationPlayStatisticsByUserAccountIdForSystem]] with flag=0.<br />
<br />
== QueryLastPlayTime ==<br />
Takes an input u8 bool, a type-0x6 output buffer containing an array of [[#LastPlayTime]], and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
== QueryApplicationPlayStatisticsForSystem ==<br />
Takes an input u8 bool, a type-0x6 output buffer containing an array of [[#ApplicationPlayStatistics]] and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
The number of entries in each array is the same.<br />
<br />
== QueryApplicationPlayStatisticsByUserAccountIdForSystem ==<br />
Takes an input u8 bool, an [[Account_services#Uid|Uid]], a type-0x6 output buffer containing an array of [[#ApplicationPlayStatistics]] and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
Same as [[#QueryApplicationPlayStatisticsForSystem]] except this gets playstats specific to '''Uid'''.<br />
<br />
= avm =<br />
This is "nn::avm::srv::IAvmService".<br />
<br />
This was added with [6.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 100 || <br />
|-<br />
| 101 || <br />
|-<br />
| 102 || <br />
|-<br />
| 103 || No input, returns an [[#IVersionListImporter]].<br />
|-<br />
| 200 || GetLaunchRequiredVersion<br />
|-<br />
| 202 || UpgradeLaunchRequiredVersion<br />
|-<br />
| 1000 || PushLaunchVersion<br />
|-<br />
| 1001 || ListVersionList<br />
|-<br />
| 1002 || ListRequiredVersion<br />
|}<br />
<br />
== IVersionListImporter ==<br />
This is "nn::avm::srv::IVersionListImporter".<br />
<br />
This was added with [6.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || SetTimestamp<br />
|-<br />
| 1 || PushEntries<br />
|-<br />
| 2 || Flush<br />
|}<br />
<br />
= AppletEvent =<br />
This is "nn::pdm::AppletEvent" ([1.0.0-7.0.1] "nn::pdm::ApplicationEvent").<br />
<br />
This is a 0x18-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x4 || entryindex<br />
|-<br />
| 0xC || 0x4 || timestamp0<br />
|-<br />
| 0x10 || 0x4 || timestamp1<br />
|-<br />
| 0x14 || 0x1 || [[#PlayEvent]] +0xF<br />
|-<br />
| 0x15 || 0x3 || Padding<br />
|}<br />
<br />
Timestamp format, converted from PosixTime: total minutes since epoch UTC 1999/12/31 00:00.<br />
<br />
= PlayStatistics =<br />
This is "nn::pdm::PlayStatistics".<br />
<br />
This is a 0x28-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x4 || First entryindex<br />
|-<br />
| 0xC || 0x4 || First timestamp0. Same as the first [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x10 || 0x4 || First timestamp1. Same as the second [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x14 || 0x4 || Last entryindex<br />
|-<br />
| 0x18 || 0x4 || Last timestamp0. Same as the first [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x1C || 0x4 || Last timestamp1. Same as the second [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x20 || 0x4 || Total play-time in minutes.<br />
|-<br />
| 0x24 || 0x4 || Total times the application title was launched.<br />
|}<br />
<br />
= LastPlayTime =<br />
This is "nn::pdm::LastPlayTime".<br />
<br />
This is a 0x18-byte struct and contains data from the last time the title was played.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x4 || Same as the first [[#AppletEvent]] timestamp.<br />
|-<br />
| 0xC || 0x4 || Same as the second [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x10 || 0x4 || Total minutes since the title was last played.<br />
|-<br />
| 0x14 || 0x1 || Flag indicating whether the above field is set.<br />
|-<br />
| 0x15 || 0x3 || Padding<br />
|}<br />
<br />
= PlayEventType =<br />
This is an enum for [[#PlayEvent]] +0x1C, which indicates the type of [[#PlayEvent]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Applet<br />
|-<br />
| 1 || Account<br />
|-<br />
| 2 || PowerStateChange<br />
|-<br />
| 3 || OperationModeChange<br />
|-<br />
| 4 || Initialize. Used for the very first [[#PlayEvent]] entry in the log.<br />
|}<br />
<br />
= AppletEventType =<br />
This is an enum for [[#PlayEvent]] +0xF with [[#PlayEventType]] = Applet, this indicates the type of the Applet event.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || "launch"<br />
|-<br />
| 1 || "exit"<br />
|-<br />
| 2 || "in_focus"<br />
|-<br />
| 3 || "out_of_focus"<br />
|-<br />
| 4 || "out_of_focus"<br />
|-<br />
| 5 || "exit"<br />
|-<br />
| 6 || "exit"<br />
|}<br />
<br />
= PlayLogPolicy =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Meaning<br />
! Description<br />
|-<br />
| 0 || All || All pdm:qry cmds which require [[#PlayEventType]] = Applet and AppletId = Application will only return the entry when PlayLogPolicy matches this value.<br />
|-<br />
| 1 || LogOnly || The above commands will filter out the entry with this.<br />
|-<br />
| 2 || None || pdm:ntfy [[#NotifyAppletEvent]], [[#Cmd8]], and [[#Cmd9]] will immediately return 0 when the input param matches this value.<br />
|-<br />
| 3 || || [10.0.0+] The cmds which require PlayLogPolicy == All, now also allow value 3 if the cmd input flag is set.<br />
|}<br />
<br />
This is an enum for [[#PlayEvent]] +0xE with [[#PlayEventType]] = Applet. This is set via the above commands, which uses this as an input param.<br />
<br />
= PlayEvent =<br />
This is "nn::pdm::PlayEvent".<br />
<br />
This is a 0x38-byte struct and is the raw entry struct directly read from FS, without any entry filtering. The other structs are extracted+converted from this one, with filtering.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x1C || 0x1 || [[#PlayEventType]]<br />
|-<br />
| 0x1D || 0x3 || Padding<br />
|-<br />
| 0x20 || 0x8 || PosixTime timestamp from [[PCV_services|StandardUserSystemClock]].<br />
|-<br />
| 0x28 || 0x8 || PosixTime timestamp from [[PCV_services|StandardNetworkSystemClock]].<br />
|-<br />
| 0x30 || 0x8 || Timestamp in seconds derived from [[PCV_services|StandardSteadyClock]].<br />
|}<br />
<br />
Filtering:<br />
* [[#QueryAppletEvent]], [[#QueryLastPlayTime]], and [[#QueryApplicationPlayStatisticsForSystem]]: PlayEvent +0x1C must be 0, and [[#PlayLogPolicy]] must be 0. [10.0.0+] These will also allow [[#PlayLogPolicy]] value 3, if the input flag is set.<br />
** With [[#QueryLastPlayTime]]/[[#QueryApplicationPlayStatisticsForSystem]] the [[Applet_Manager_services#AppletId|AppletId]] must be 1. [10.0.0+] These now also allow [[Applet_Manager_services#AppletId|AppletId]] 0x1F/0x20.<br />
* [[#QueryPlayStatisticsByApplicationId]]: PlayEvent +0x1C must be 0, +0xC must be 1 ([10.0.0+] or 0x1F/0x20), and the titleID must match. [10.0.0+] [[#PlayLogPolicy]] must be 0. Value 3 is allowed if the input flag is set.<br />
* [[#QueryAccountEvent]]: PlayEvent +0x1C must be 1 and PlayEvent +0x18 must be <=1.<br />
* [[#QueryApplicationPlayStatisticsForSystem]]: In addition to the above, this also handles [[#PlayEventType]] PowerStateChange, where PlayEvent +0x0 is value 0 or 1.<br />
<br />
The structure of the first 0x1C-bytes are determined by [[#PlayEventType]]. For titleIDs/userIDs, the low/high u32 in each u64 is swapped.<br />
<br />
Applet:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x4 || Title version, set by pdm:ntfy [[#NotifyAppletEvent]] and [[#Cmd9]].<br />
|-<br />
| 0x8 || 0x1 || When set to u8 0x1 by pdm:ntfy [[#Cmd8]], this indicates that +0x9 is set. Only used for non-applications.<br />
|-<br />
| 0x9 || 0x1 || See above. [[Applet_Manager_services#LibraryAppletMode|LibraryAppletMode]]<br />
|-<br />
| 0xC || 0x1 || [[Applet_Manager_services#AppletId|AppletId]]<br />
|-<br />
| 0xD || 0x1 || [[Filesystem_services#StorageId|StorageId]]<br />
|-<br />
| 0xE || 0x1 || [[#PlayLogPolicy]]<br />
|-<br />
| 0xF || 0x1 || [[#AppletEventType]]<br />
|-<br />
| 0x10 || 0xC || Unused<br />
|}<br />
<br />
Account:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x10 || userID<br />
|-<br />
| 0x10 || 0x8 || titleID, when u8 +0x18 = 2.<br />
|-<br />
| 0x18 || 0x1 || Type. 0-1 to be listed by [[#QueryAccountEvent]], or 2 to include the above titleID.<br />
|-<br />
| 0x19 || 0x3 || Padding<br />
|}<br />
<br />
PlayEventType PowerStateChange/OperationModeChange: u8 +0x0 is the input value from [[#NotifyOperationModeChangeEvent]]/[[#NotifyPowerStateChangeEvent]], the rest is unused.<br />
<br />
= AccountEvent =<br />
This is "nn::pdm::AccountEvent".<br />
<br />
This is a 0x38-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x10 || userID<br />
|-<br />
| 0x10 || 0x4 || entryindex<br />
|-<br />
| 0x14 || 0x4 || Padding<br />
|-<br />
| 0x18 || 0x8 || [[#PlayEvent]] +0x20<br />
|-<br />
| 0x20 || 0x8 || [[#PlayEvent]] +0x28<br />
|-<br />
| 0x28 || 0x8 || [[#PlayEvent]] +0x30<br />
|-<br />
| 0x30 || 0x1 || [[#PlayEvent]] +0x18<br />
|-<br />
| 0x31 || 0x7 || Padding<br />
|}<br />
<br />
= AccountPlayEvent =<br />
This is "nn::pdm::AccountPlayEvent".<br />
<br />
This is a 0x28-byte struct and is the raw entry struct directly read from FS, without any entry filtering. This is separate from [[#PlayEvent]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x4 || ?<br />
|-<br />
| 0x4 || 0x8 || titleID, with the u32 low/high words swapped.<br />
|-<br />
| 0xC || 0xC || ?<br />
|-<br />
| 0x18 || 0x8 || POSIX timestamp<br />
|-<br />
| 0x20 || 0x8 || POSIX timestamp<br />
|}<br />
<br />
= ApplicationPlayStatistics =<br />
This is "nn::pdm::ApplicationPlayStatistics".<br />
<br />
This is a 0x18-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x8 || Total play-time in nanoseconds.<br />
|-<br />
| 0x10 || 0x8 || Total times the application title was launched.<br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=USB_services&diff=10473
USB services
2020-12-11T22:33:48Z
<p>Behemoth: add usb states enum</p>
<hr />
<div>One symbol in USB-sysmodule is: "vtable for nn::usb::detail::UsbComplexTegra21x".<br />
<br />
= usb:ds =<br />
Pre-11.0.0 this was [[#IDsService]].<br />
<br />
Used for Switch<>PC USB comms, aka Switch-as-device. This seems to only be usable in handheld-mode with the Switch directly connected to a host via an USB cable, not(?) in docked-mode.<br />
This service is used during [[Factory Setup|factory setup]] by [[Manu Services|manu]]. This is also used by [[Capmtp_services|capmtp]].<br />
<br />
This service session is used as an IPC [[IPC_Marshalling|domain]] by [[Manu Services|manu]].<br />
<br />
This service can be used by multiple processes at the same time, with separate interfaces. However, if one process does usbds shutdown, usbds will reset to defaults even if there's a process still using it. <br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || <br />
|}<br />
<br />
Cmd0: No input, returns an [[#IDsService]].<br />
<br />
== IDsService ==<br />
This is "nn::usb::ds::IDsService".<br />
<br />
Various cmds were updated/moved with [11.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#BindDevice]]<br />
|-<br />
| 1 || [[#BindClientProcess]]<br />
|-<br />
| 2 || [[#GetDsInterface]]<br />
|-<br />
| 3 || [[#GetStateChangeEvent]]<br />
|-<br />
| 4 || [[#GetState]]<br />
|-<br />
| [2.0.0-4.1.0] 5 || [[#SetVidPidBcd]]<br />
|-<br />
| [5.0.0+] 5 || ClearDeviceData<br />
|-<br />
| 6 || [5.0.0+] AddUsbStringDescriptor<br />
|-<br />
| 7 || [5.0.0+] DeleteUsbStringDescriptor<br />
|-<br />
| 8 || [5.0.0+] SetUsbDeviceDescriptor<br />
|-<br />
| 9 || [5.0.0+] SetBinaryObjectStore<br />
|-<br />
| 10 || [5.0.0+] Enable<br />
|-<br />
| 11 || [5.0.0+] Disable<br />
|-<br />
| 12 || [8.0.0+]<br />
|}<br />
<br />
Cmd12: No input, returns an output u32.<br />
<br />
Initialization done by [[Manu Services|manu]]:<br />
* Initial service init:<br />
** Get service/etc.<br />
** Uses [[#BindDevice]].<br />
** Uses [[#BindClientProcess]].<br />
** Uses [[#GetStateChangeEvent]].<br />
** Uses [[#SetVidPidBcd]].<br />
* Interface init:<br />
** Uses [[#GetDsInterface]], then uses commands from that with the rest of the following.<br />
** Uses [[#GetSetupEvent]].<br />
** Uses [[#GetCtrlInCompletionEvent]].<br />
** Uses [[#GetCtrlOutCompletionEvent]].<br />
* Initializes two endpoints via using [[#GetDsEndpoint]] twice.<br />
<br />
== Configuration ==<br />
The following is the default USB config strings, while the usbds service isn't being used. All of the below configuration will reset to the defaults when all usbds-related sessions are closed. These can be set with [[#SetVidPidBcd]]. The default string for Product is loaded from [[Settings_services|settings]] config. The default is referred to by usb-sysmodule as "Dummy".<br />
Product: Nintendo Switch<br />
Manufacturer: Nintendo<br />
SerialNumber: SerialNumber<br />
<br />
The following is the default <code>lsusb -v {...}</code> output when the usbds service wasn't used.<br />
<br />
pre-5.0.0: The endpoints are configured using [[#GetDsEndpoint]], the total number of endpoints is the number of open [[#IDsEndpoint]] sessions. bInterfaceNumber is {0-based index for the enabled [[#IDsInterface]] session.} Some of the interface fields are configured using [[#GetDsInterface]].<br />
<br />
When usbds is in use where [[#SetVidPidBcd]] wasn't used, the VID/PID is 057e:3000.<br />
<br />
Bus 003 Device 006: ID 057e:2000 Nintendo Co., Ltd <br />
Couldn't open device, some information will be missing<br />
Device Descriptor:<br />
bLength 18<br />
bDescriptorType 1<br />
bcdUSB 2.00<br />
bDeviceClass 0 (Defined at Interface level)<br />
bDeviceSubClass 0 <br />
bDeviceProtocol 0 <br />
bMaxPacketSize0 64<br />
idVendor 0x057e Nintendo Co., Ltd<br />
idProduct 0x2000 <br />
bcdDevice 1.00<br />
iManufacturer 1 <br />
iProduct 2 <br />
iSerial 3 <br />
bNumConfigurations 1<br />
Configuration Descriptor:<br />
bLength 9<br />
bDescriptorType 2<br />
wTotalLength 34<br />
bNumInterfaces 1<br />
bConfigurationValue 1<br />
iConfiguration 0 <br />
bmAttributes 0xc0<br />
Self Powered<br />
MaxPower {...}<br />
Interface Descriptor:<br />
bLength 9<br />
bDescriptorType 4<br />
bInterfaceNumber 0<br />
bAlternateSetting 0<br />
bNumEndpoints 1<br />
bInterfaceClass 3 Human Interface Device<br />
bInterfaceSubClass 0 No Subclass<br />
bInterfaceProtocol 0 None<br />
iInterface 0 <br />
HID Device Descriptor:<br />
bLength 9<br />
bDescriptorType 33<br />
bcdHID 2.00<br />
bCountryCode 0 Not supported<br />
bNumDescriptors 1<br />
bDescriptorType 34 Report<br />
wDescriptorLength 26<br />
Report Descriptors: <br />
** UNAVAILABLE **<br />
Endpoint Descriptor:<br />
bLength 7<br />
bDescriptorType 5<br />
bEndpointAddress 0x81 EP 1 IN<br />
bmAttributes 3<br />
Transfer Type Interrupt<br />
Synch Type None<br />
Usage Type Data<br />
wMaxPacketSize 0x0001 1x 1 bytes<br />
bInterval 16<br />
<br />
== BindDevice ==<br />
Takes an u32 ('''complexId'''). [[Manu_Services|Manu]] sends 0x02.<br />
<br />
Binding more than once with the current session is not allowed. Once this command is used, the USB device will not be listed with <code>lsusb</code> until [[#EnableInterface]] is used.<br />
<br />
Returns a not-found error when complexId isn't 0x02, for values 0x0-0x4 at least.<br />
<br />
== BindClientProcess ==<br />
Takes 1 copy-handle for the current process (0xFFFF8001).<br />
<br />
== GetDsInterface ==<br />
Takes 2 type-5 buffers and returns an output u8 and an [[#IDsInterface]]. [[Manu_Services|Manu]] sends a 0x09-byte descriptor (e.g.: 0x09, 0x04, 0x04, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00) in the first buffer and a string ("usb") in the second buffer.<br />
<br />
When the strlen output for the second buffer is >=0x40, size 0x40 is used instead for copying the string. This is the interface name, it's not sent over USB.<br />
<br />
Returns an error when [[#BindDevice]] wasn't used.<br />
<br />
Up to 4 interfaces can be used+[[#EnableInterface|enabled]].<br />
<br />
Structure of the first buffer(this is the same as [http://libusb.sourceforge.net/api-1.0/structlibusb__interface__descriptor.html libusb__interface__descriptor]):<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x1 || bLength. Must match 0x9.<br />
|-<br />
| 0x1 || 0x1 || bDescriptorType. Must match 0x4.<br />
|-<br />
| 0x2 || 0x1 || bInterfaceNumber. When 0x4, the bInterfaceNumber is automatically allocated(error will be thrown if no space). Otherwise, it's used directly and must be <=3.<br />
|-<br />
| 0x3 || 0x1 || bAlternateSetting. Must match 0x0.<br />
|-<br />
| 0x4 || 0x1 || bNumEndpoints. Ignored.<br />
|-<br />
| 0x5 || 0x1 || bInterfaceClass<br />
|-<br />
| 0x6 || 0x1 || bInterfaceSubClass<br />
|-<br />
| 0x7 || 0x1 || bInterfaceProtocol<br />
|-<br />
| 0x8 || 0x1 || iInterface. Ignored.<br />
|}<br />
<br />
Only the first 0x9-bytes are used.<br />
<br />
== GetStateChangeEvent ==<br />
Returns an event handle for when the state returned by [[#GetState]] changes. Signalled when Switch<->host USB comms change between started/stopped. USB cable connected/disconnected while at least 1 interface was enabled, or interface enabled/disabled while the USB cable was connected which then caused USB-comms state to change.<br />
<br />
== GetState ==<br />
No input. Returns an output u32. Returns an error when [[#BindDevice]] wasn't used.<br />
<br />
Returns the current state.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value || Name || Description<br />
|-<br />
| 0 || Detached || Device is not attached to USB.<br />
|-<br />
| 1 || Attached || Device is attached, but is not powered.<br />
|-<br />
| 2 || Powered || Device is attached and powered, but has not been reset.<br />
|-<br />
| 3 || Default || Device is attached, powered, and has been reset, but does not have an address.<br />
|-<br />
| 4 || Address || Device is attached, powered, has been reset, has an address, but is not configured.<br />
|-<br />
| 5 || Configured || Device is attached, powered, has been reset, has an address, configured, and may be used.<br />
|-<br />
| 6 || Suspended || Device is attached and powered, but has not seen bus activity for 3ms. Device is suspended and cannot be used.<br />
|-<br />
|}<br />
<br />
== SetVidPidBcd ==<br />
Takes a type-5 buffer with 0x66 bytes of USB descriptor data (see [[Manu_Services#manu|manu]]).<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x2 || VID (idVendor)<br />
|-<br />
| 0x2 || 0x2 || PID (idProduct)<br />
|-<br />
| 0x4 || 0x2 || bcdDevice<br />
|-<br />
| 0x6 || 0x20 || Manufacturer<br />
|-<br />
| 0x26 || 0x20 || Product<br />
|-<br />
| 0x46 || 0x20 || SerialNumber<br />
|}<br />
<br />
The last 3 blocks are ASCII strings. The data following each string is all-zero, for padding to size 0x20.<br />
<br />
== IDsInterface ==<br />
This is "nn::usb::ds::IDsInterface".<br />
<br />
Various cmds were updated/moved with [11.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || [[#GetDsEndpoint]] || <br />
|-<br />
| 1 || [[#GetSetupEvent]] || <br />
|-<br />
| 2 || || Takes a type-0x6 output buffer, no other output. Memcpys data to outbuf with outsize, uses size 0x8 if outsize is too large.<br />
|-<br />
| 3 || [[#EnableInterface]] || <br />
|-<br />
| 4 || [[#DisableInterface]] || <br />
|-<br />
| 5 || [[#CtrlInPostBufferAsync]] || <br />
|-<br />
| 6 || [[#CtrlOutPostBufferAsync]] || <br />
|-<br />
| 7 || [[#GetCtrlInCompletionEvent]] || <br />
|-<br />
| 8 || [[#GetCtrlInReportData]] || <br />
|-<br />
| 9 || [[#GetCtrlOutCompletionEvent]] || <br />
|-<br />
| 10 || [[#GetCtrlOutReportData]] || <br />
|-<br />
| 11 || [[#StallCtrl]] || <br />
|-<br />
| 12 || [5.0.0+] AppendConfigurationData || <br />
|}<br />
<br />
Commands cmd2, [[#CtrlInPostBufferAsync]], [[#CtrlOutPostBufferAsync]], and [[#StallCtrl]], will throw an error if the interface is not [[#EnableInterface|enabled]]. [[#GetDsEndpoint]] will throw an error if the interface is [[#EnableInterface|enabled]].<br />
<br />
=== GetDsEndpoint ===<br />
Takes a type-5 buffer and returns an output u8 and an [[#IDsEndpoint]]. [[Manu_Services|Manu]] uses this twice for getting two endpoint sessions, with the following 0x7-byte buffer data:<br />
* First endpoint: 0x07, 0x05, 0x80, 0x02, 0x00, 0x02, 0x00<br />
** bLength=0x7<br />
** bDescriptorType=LIBUSB_DT_ENDPOINT<br />
** bEndpointAddress=LIBUSB_ENDPOINT_IN<br />
** bmAttributes=LIBUSB_TRANSFER_TYPE_BULK<br />
** wMaxPacketSize=0x200<br />
** bInterval=0<br />
* Second endpoint: Same as above except byte2 is 0x00(bEndpointAddress=LIBUSB_ENDPOINT_OUT).<br />
<br />
Each field is an u8, except for offset 0x4-0x5 which is an u16.<br />
<br />
This structure matches [http://libusb.sourceforge.net/api-1.0/structlibusb__endpoint__descriptor.html libusb_endpoint_descriptor], with audio-only-devices fields bRefresh and bSynchAddress removed.<br />
<br />
The buffer size must be >=0x7. Only the first 0x7-bytes from the buffer are used.<br />
* Byte0(bLength) must match 0x7.<br />
* Byte1(bDescriptorType) must match 0x5.<br />
* Byte2(bEndpointAddress) is only compared with 0x80 to determine whether to use an input or output endpoint, the actual endpoint-number is allocated automatically by checking state. Hence, all input endpoints must use bEndpointAddress==0x80. Up to endpoint-number 0xF can be allocated for each endpoint-direction, for a total of 16 endpoints including control, and 15 for non-control endpoints([[#IDsEndpoint]] sessions for each direction). This matches the Tegra maximum.<br />
<br />
From the Tegra datasheet: "The maximum packet size supported on any endpoint is 1024 bytes in high-speed mode, for both device and host modes."<br />
<br />
=== GetSetupEvent ===<br />
Returns an event handle. Unknown what triggers signalling, not signalled during interface-enable / device<>host USB-comms init.<br />
<br />
=== EnableInterface ===<br />
Takes no arguments. Enables the current interface.<br />
<br />
Only one interface can be enabled at a time per bInterfaceNumber. When bInterfaceNumber is auto-allocate(0x4) for [[#GetDsEndpoint]] this isn't an issue since the final bInterfaceNumber will be unique.<br />
<br />
Once enabled, the device/interface can then actually be used over USB.<br />
<br />
=== DisableInterface ===<br />
Takes no arguments. Disables the current interface.<br />
<br />
=== CtrlInPostBufferAsync ===<br />
Same as [[#PostBufferAsync]](with same input/output), except this uses control input endpoint 0x80.<br />
<br />
=== CtrlOutPostBufferAsync ===<br />
Same as [[#PostBufferAsync]](with same input/output), except this uses control output endpoint 0x00.<br />
<br />
=== GetCtrlInCompletionEvent ===<br />
Returns an event handle for polling the completion of input control commands. Same as [[#GetCompletionEvent]], except this uses control input endpoint 0x80.<br />
<br />
=== GetCtrlInReportData ===<br />
Same as [[#GetReportData]](with same input/output), except this uses control input endpoint 0x80.<br />
<br />
=== GetCtrlOutCompletionEvent ===<br />
Returns an event handle for polling the completion of output control commands. Same as [[#GetCompletionEvent]], except this uses control output endpoint 0x00.<br />
<br />
=== GetCtrlOutReportData ===<br />
Same as [[#GetReportData]](with same input/output), except this uses control output endpoint 0x00.<br />
<br />
=== StallCtrl ===<br />
No input/output.<br />
<br />
Calls a function with both control endpoints(0x80 and 0x00) with the same function. From strings: "m_pProtocol->Stall(0x80)" "m_pProtocol->Stall(0x00)".<br />
<br />
=== IDsEndpoint ===<br />
This is "nn::usb::ds::IDsEndpoint".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || [[#PostBufferAsync]] || <br />
|-<br />
| 1 || || No input/output.<br />
|-<br />
| 2 || [[#GetCompletionEvent]] || <br />
|-<br />
| 3 || [[#GetReportData]] || <br />
|-<br />
| 4 || [[#Stall]] || <br />
|-<br />
| 5 || || Takes an input u8, no output.<br />
|-<br />
| 6 || [7.0.0+] || No input, returns an output bool.<br />
|-<br />
| 7 || [7.0.0+] || No input, returns an output handle.<br />
|-<br />
| 8 || [11.0.0+] || Takes an input u64 and a handle, no output. Stubbed, just returns an error.<br />
|-<br />
| 9 || [11.0.0+] || Takes an input u32 size, an u64 offset, returns an u32 urbId. Stubbed, just returns an error.<br />
|}<br />
<br />
[11.0.0+] The official sw wrapper for PostBufferAsync can optionally use cmd9 instead, if an object state flag is set. offset=input_addr-object_addr_field, this will Abort if offset is >= object_size_field.<br />
<br />
==== PostBufferAsync ====<br />
Takes an u32 ('''size''') and an u64 ('''buffer'''). Returns an output u32 ('''urbId'''). The output urbId can then be used while parsing the output of [[#GetReportData]], after waiting for the CompletionEvent to be signalled.<br />
<br />
The buffer address must be 0x1000-byte aligned. The input size doesn't matter. It helps to use svcSetMemoryAttribute to turn off caching on the buffer.<br />
<br />
Used for data-transfer with input/output endpoints.<br />
<br />
The user-process must flush dcache for the buffer before using this command.<br />
<br />
When sending data where size is larger than wMaxPacketSize, it will automatically send multiple USB packets where last packet size = {remaining size}. Every {wMaxPacketSize}-bytes is a different packet. This only occurs in some cases. When '''size''' is ~0x1000000(exact size unknown), Switch-side silently hangs, while host-side will timeout(no traffic on USB bus indicating failure).<br />
<br />
For receiving data, if size is less than {actual received USB packet size} the rest of the packet will be discarded. Later PostBufferAsync cmd(s) will only return data from new packets, not the remainder of the earlier packet(s).<br />
<br />
==== GetCompletionEvent ====<br />
No input. Returns an output event handle for polling the completion of [[#PostBufferAsync]], even when it finished via [[#Stall]].<br />
<br />
==== GetReportData ====<br />
No input. Returns 0x84 bytes of report data from the endpoint. Seems to be eventually loaded from state, since this doesn't trigger any USB bus activity. All-zero before PostBufferAsync was used at least once.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x10*0x8(0x80) || 0x8 entries 0x10-bytes each for each report.<br />
|-<br />
| 0x80 || 0x4 || u32 report count<br />
|}<br />
<br />
Entry data:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x4 || u32 id (urbId from post-buffer commands)<br />
|-<br />
| 0x4 || 0x4 || u32 requestedSize<br />
|-<br />
| 0x8 || 0x4 || u32 transferredSize<br />
|-<br />
| 0xC || 0x4 || u32 urb status, converted to error-codes. 0x3 = success, 0x4 = 0x828c, 0x5 = 0x748c. All other values are invalid.<br />
|-<br />
|}<br />
<br />
==== Stall ====<br />
No input/output.<br />
<br />
Calls the same function used by [[#StallCtrl]], except this uses the endpoint associated with the current session.<br />
<br />
Stops in-progress data-transfer done by [[#PostBufferAsync]].<br />
<br />
= usb:hs, usb:hs:a =<br />
This is "nn::usb::hs::IClientRootSession".<br />
<br />
[7.0.0+] usb:hs:a opens an nn::usb::hs::IClientRootSession, but sets an "isSystemClient" field in the object (and in interfaces/eps opened by the session) to false.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| [2.0.0+] 0 || [[#BindClientProcess_2|#BindClientProcess]] || <br />
|-<br />
| 1 ([1.0.0] 0) || [[#QueryAllInterfaces]] || <br />
|-<br />
| 2 ([1.0.0] 1) || [[#QueryAvailableInterfaces]] || <br />
|-<br />
| 3 ([1.0.0] 2) || [[#QueryAcquiredInterfaces]] || <br />
|-<br />
| 4 ([1.0.0] 3) || [[#CreateInterfaceAvailableEvent]] || <br />
|-<br />
| 5 ([1.0.0] 4) || [[#DestroyInterfaceAvailableEvent]] || <br />
|-<br />
| 6 ([1.0.0] 5) || [[#GetInterfaceStateChangeEvent]] || <br />
|-<br />
| 7 ([1.0.0] 6) || [[#AcquireUsbIf]] || <br />
|-<br />
| 8 ([1.0.0] 7) || [6.0.0+] ([1.0.0] [[#GetDescriptorString]]) || <br />
|-<br />
| [1.0.0] 8 || || Takes an input u32, no output. Stubbed, just returns 0.<br />
|}<br />
<br />
General USB devices usage, used by [[HID_services|hid]], [[Sockets_services|bsdsockets]], and [5.1.0+] [[Audio_services|audio]].<br />
<br />
Get-service-handle will fail if the current process is already using usb:ds, however it's successful if it's done separately from the process using usb:ds.<br />
<br />
== BindClientProcess ==<br />
Takes 1 copy-handle for the current process (0xFFFF8001).<br />
<br />
== QueryAllInterfaces ==<br />
Takes an [[#UsbHsInterfaceFilter]] and a type-0x6 output buffer, returns an output s32 total_entries.<br />
<br />
The output buffer contains an array of [[#UsbHsInterface]]. This returns the same interfaces as [[#QueryAvailableInterfaces]], followed by the interfaces also returned by [[#QueryAcquiredInterfaces]]. Except for the ID field in [[#UsbHsInterface]], which is set to -1.<br />
<br />
== QueryAvailableInterfaces ==<br />
Takes an [[#UsbHsInterfaceFilter]] and a type-0x6 output buffer, returns an output s32 total_entries.<br />
<br />
The output buffer contains an array of [[#UsbHsInterface]]. This only returns interfaces which are not acquired by any process.<br />
<br />
== QueryAcquiredInterfaces ==<br />
Takes a type-0x6 output buffer and returns an output s32 total_entries.<br />
<br />
The output buffer contains an array of [[#UsbHsInterface]], for each interface which was acquired with [[#AcquireUsbIf]].<br />
<br />
== CreateInterfaceAvailableEvent ==<br />
Takes an input u8 and an [[#UsbHsInterfaceFilter]], and returns an output handle. The input value must be 0..2. This is used as an index in a table.<br />
<br />
The struct is located at +2 from the u8 in IPC rawdata.<br />
<br />
When signaled, this indicates that the user-process should use [[#QueryAvailableInterfaces]] and [[#AcquireUsbIf]] with the output interfaces (and the rest of interface setup).<br />
<br />
== DestroyInterfaceAvailableEvent ==<br />
Takes an input u8, no output. The input value must be 0..2.<br />
<br />
Clears state associated with the input index. This is the same state setup by [[#CreateInterfaceAvailableEvent]].<br />
<br />
== GetInterfaceStateChangeEvent ==<br />
No input, returns an output event handle with autoclear disabled.<br />
<br />
When signaled, this indicates that the user-process should use [[#QueryAcquiredInterfaces]] and cleanup state for interfaces which were already initialized and don't have any matching ID in [[#UsbHsInterface]] +0x0. When total_entries is less than 1, this indicates that cleanup should be done for all currently open interfaces.<br />
<br />
== AcquireUsbIf ==<br />
Takes an input u32 and a type-0x6 output buffer, returns an [[#IClientIfSession]]. On [3.0.0+] this takes an additional type-0x6 output buffer, before the original buffer. On [3.0.0+] the first buffer is 0x70-bytes, while the second one is 0x1B8. The user-process has the second buffer address immediately after the first one, which allows getting a complete [[#UsbHsInterface]].<br />
<br />
The input u32 is from the u32 at entry+0 from the associated [[#QueryAvailableInterfaces]] output entry. User-processes use size 0x1B8 for the first output buffer. The first output buffer contains the first 0x1B8-bytes from [[#UsbHsInterface]].<br />
<br />
This returns an error if the interface was already acquired by another process.<br />
<br />
== GetDescriptorString ==<br />
Takes a type-0x6 output buffer, an input u8, an input u8 bool, and an u32. Returns an output u32.<br />
<br />
The u32 is located at +4 from the first u8 in the IPC rawdata.<br />
<br />
Gets a string from a string descriptor.<br />
<br />
The UTF-16 string from descriptor+2 is copied to descriptor/outbuf +0, where each character is transferred using u8 not u16.<br />
<br />
Official sw doesn't use this, [[#SubmitControlInRequest]] is used instead.<br />
<br />
== IClientIfSession ==<br />
This is "nn::usb::hs::IClientIfSession".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || No input, returns an output handle.<br />
|-<br />
| 1 || [[#SetInterface]] || <br />
|-<br />
| 2 || [[#GetInterface]] || <br />
|-<br />
| 3 || [[#GetAlternateInterface]] || <br />
|-<br />
| 4 [1.0.0] 5) || [[#GetCurrentFrame]] || <br />
|-<br />
| [2.0.0+] 5 || [[#CtrlXferAsync]] || <br />
|-<br />
| 6 || ([1.0.0] [[#SubmitControlInRequest]]) || No input, returns an output handle. Signaled when [[#CtrlXferAsync]] finishes.<br />
|-<br />
| 7 || [[#GetCtrlXferReport]] ([1.0.0] [[#SubmitControlOutRequest]]) || <br />
|-<br />
| 8 || [[#ResetDevice]] || <br />
|-<br />
| 9 ([1.0.0] 4) || [[#OpenUsbEp]] || <br />
|}<br />
<br />
Official sw uses autoclear=false for the above events.<br />
<br />
Immediately after opening the session, official sw uses cmd0 and cmd6.<br />
<br />
=== SetInterface ===<br />
Takes an input u8 and a type-0x6 output buffer, no output. The output buffer contains the first 0x1B8-bytes from [[#UsbHsInterface]].<br />
<br />
=== GetInterface ===<br />
Takes a type-0x6 output buffer, no output. The output buffer contains the first 0x1B8-bytes from [[#UsbHsInterface]].<br />
<br />
=== GetAlternateInterface ===<br />
Takes an input u8 and a type-0x6 output buffer, no output. The output buffer contains the first 0x1B8-bytes from [[#UsbHsInterface]]. The buffer size must match 0x1B8.<br />
<br />
=== GetCurrentFrame ===<br />
No input, returns an output u32.<br />
<br />
On 1.0.0 this stubbed: this returns 0 with output u32 = hard-coded 0.<br />
<br />
=== CtrlXferAsync ===<br />
Takes 2 input u8s ('''bmRequestType''' and '''bRequest'''), 3 input u16s ('''wValue''', '''wIndex''', and '''wLength'''), and an input u64 '''buffer''', no output.<br />
<br />
=== GetCtrlXferReport ===<br />
Takes a type-0x6 output buffer, no output. The output buffer contains a [[#XferReport]].<br />
<br />
=== SubmitControlInRequest ===<br />
Takes a type-0x6 output buffer, 2 input u8s ('''bRequest''' and '''bRequestType'''), 3 input u16s ('''wValue''', '''wIndex''', and '''wLength'''), and an input u32 '''timeoutInMs'''. Returns an output u32 for the actual transferred size.<br />
<br />
Official user-processes uses a buffer where the buffer address/size is page-aligned, where '''wLength''' is the original size before alignment. The user-process also flushes dcache for this buffer using '''wLength''', before/after using this command. Official sw passes value 0 for '''timeoutInMs'''.<br />
<br />
=== SubmitControlOutRequest ===<br />
Takes a type-0x5 input buffer, 2 input u8s ('''bRequest''' and '''bRequestType'''), 3 input u16s ('''wValue''', '''wIndex''', and '''wLength'''), and an input u32 '''timeoutInMs'''. Returns an output u32 for the actual transferred size.<br />
<br />
Official user-processes uses a buffer where the buffer address/size is page-aligned, where '''wLength''' is the original size before alignment. The user-process also flushes dcache for this buffer using '''wLength''', before using this command. Official sw passes value 0 for '''timeoutInMs'''.<br />
<br />
=== ResetDevice ===<br />
No input/output.<br />
<br />
Resets the device: has the same affect as unplugging the device and plugging it back in.<br />
<br />
=== OpenUsbEp ===<br />
Takes an input u16 and 4 input u32s, returns a 0x7-byte output struct and an [[#IClientEpSession]].<br />
<br />
The u16 is '''maxUrbCount'''. The u32s are: '''epType''', '''epNumber''', '''epDirection''', and '''maxXferSize'''.<br />
<br />
The user-process loads the input params from the endpoint descriptor. HID-sysmodule sets '''maxXferSize''' to wMaxPacketSize from the endpoint descriptor. However, other sysmodules pass hard-coded values for '''maxXferSize'''.<br />
<br />
HID-sysmodule passes hard-coded value 0x1 for '''maxUrbCount''', for bsd-sysmodule this is 0x2. For audio-sysmodule, this is 0x3 or 0x6.<br />
<br />
'''epType''' is <code>libusb_transfer_type+1</code>. '''epNumber''' is <code>bEndpointAddress & LIBUSB_ENDPOINT_ADDRESS_MASK</code>. '''epDirection''' is 0x1 for LIBUSB_ENDPOINT_OUT, and 0x2 for LIBUSB_ENDPOINT_IN.<br />
<br />
'''epType''', '''epNumber''', and '''epDirection''' must all match USB-sysmodule state for the associated endpoint. '''maxUrbCount''' must be <0x11. '''maxXferSize''' must be <=0xFF0000. <code>maxUrbCount*maxXferSize</code> must be non-zero.<br />
<br />
=== IClientEpSession ===<br />
This is "nn::usb::hs::IClientEpSession".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || [[#Open]] ([1.0.0] [[#SubmitOutRequest]]) || <br />
|-<br />
| 1 || [[#Close]] ([1.0.0] [[#SubmitInRequest]]) || <br />
|-<br />
| 2 || || No input, returns an output handle. Signaled when [[#PostBufferAsync_2|#PostBufferAsync]] finishes. ([1.0.0] [[#Open]])<br />
|-<br />
| 3 || [[#Populate]] ([1.0.0] [[#Close]]) || <br />
|-<br />
| [2.0.0+] 4 || [[#PostBufferAsync_2|#PostBufferAsync]] ||<br />
|-<br />
| [2.0.0+] 5 || [[#GetXferReport]] || <br />
|-<br />
| [2.0.0+] 6 || [[#PostBufferMultiAsync]] || <br />
|-<br />
| [4.0.0+] 7 || || Takes a total of 0x10-bytes of input, no output.<br />
|-<br />
| [4.0.0+] 8 || || Takes a total of 0x4-bytes of input and an input handle, no output.<br />
|}<br />
<br />
Official sw uses autoclear=false for the above event.<br />
<br />
Immediately after opening the endpoint session, official sw uses [[#Populate]] and cmd2.<br />
<br />
==== SubmitOutRequest ====<br />
Takes an type-0x5 input buffer, an u32 '''size''', and an u32 '''unk'''. Returns an output u32 for the actual transferred size.<br />
<br />
Official user-processes uses a buffer where the buffer address/size is page-aligned, where '''size''' is the original size before alignment. The user-process also flushes dcache for this buffer using '''size''', before using this command. Official sw passes value 0 for '''unk'''.<br />
<br />
==== SubmitInRequest ====<br />
Takes an type-0x6 output buffer, an u32 '''size''', and an u32 '''unk'''. Returns an output u32 for the actual transferred size.<br />
<br />
Official user-processes uses a buffer where the buffer address/size is page-aligned, where '''size''' is the original size before alignment. The user-process also flushes dcache for this buffer using '''size''', before/after using this command. Official sw passes value 0 for '''unk'''.<br />
<br />
==== Open ====<br />
No input/output.<br />
<br />
This is similar to [[#OpenUsbEp]] with the params being loaded from state instead.<br />
<br />
This is likely intended for re-opening after [[#Close]] was used, but this is not known to be used by any official user-processes.<br />
<br />
==== Close ====<br />
No input/output.<br />
<br />
Used by official sw prior to closing the endpoint session.<br />
<br />
==== Populate ====<br />
No input/output.<br />
<br />
Used after opening the endpoint session (see above).<br />
<br />
==== PostBufferAsync ====<br />
Takes an input u32 '''size''', an input u64 '''buffer''', and an input u64 '''unk''', returns an output u32 '''xferId'''.<br />
<br />
HID-sysmodule passes value 0 for the last u64.<br />
<br />
Starts a data transfer with a single urb.<br />
<br />
==== GetXferReport ====<br />
Takes an input u32 and a type-0x6 ([3.0.0+] type-0x22) output buffer, returns an output u32 '''count'''.<br />
<br />
The input u32 specifies the total number of entries to read, this must fit within the specified buffer size. The output u32 is the total actual output entries.<br />
<br />
The buffer contains an array of [[#XferReport]].<br />
<br />
==== PostBufferMultiAsync ====<br />
Unofficial name.<br />
<br />
Takes 3 input u32s ('''urbCount''', '''unk1''', and '''unk2'''), an input u64 '''buffer''' and u64 '''unk''', and a type-0x5 ([3.0.0+] type-0x21) input buffer, returns an output u32 '''xferId'''.<br />
<br />
Where '''unk''' is the same as [[#PostBufferAsync_2|#PostBufferAsync]].<br />
<br />
This uses the same func internally as [[#PostBufferAsync_2|#PostBufferAsync]] except multiple urbs are specified by the user: the input buffer contains an array of u32s for the size of each urb, where '''urbCount''' is the total number of entries in this array. With [[#PostBufferAsync_2|#PostBufferAsync]] the last 2 params passed to the internal func are hard-coded to 0, while with this command it's '''unk1''' and '''unk2'''.<br />
<br />
= UsbHsInterface =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x4 || ID value passed to other cmds. This is -1 with [[#QueryAllInterfaces]] output, hence this field is unused with that cmd.<br />
|-<br />
| 0x4 || 0x4 || deviceID<br />
|-<br />
| 0x8 || 0x4 || ?<br />
|-<br />
| 0xC || 0x9 || usb_interface_descriptor<br />
|-<br />
| 0x15 || 0x7 || Padding<br />
|-<br />
| 0x1C || 0x69 || OUTPUT usb_endpoint_descriptors, 15 max.<br />
|-<br />
| 0x85 || 0x7 || Padding<br />
|-<br />
| 0x8C || 0x69 || INPUT usb_endpoint_descriptors, 15 max.<br />
|-<br />
| 0xF5 || 0x6 || Padding<br />
|-<br />
| 0xFB || 0x5A || OUTPUT usb_ss_endpoint_companion_descriptors(?), 15 max.<br />
|-<br />
| 0x155 || 0x6 || Padding<br />
|-<br />
| 0x15B || 0x5A || INPUT usb_ss_endpoint_companion_descriptors(?), 15 max.<br />
|-<br />
| 0x1B5 || 0x3 || Padding<br />
|-<br />
| 0x1B8 || 0x40 || "HsDevice-/L<unk0>/P<portnum>/A<unk1>" string (this is "FsDevice..." for the Dock USB 3.0 bus).<br />
|-<br />
| 0x1F8 || 0x4 || busID<br />
|-<br />
| 0x1FC || 0x4 || deviceID<br />
|-<br />
| 0x200 || 0x12+0x9(0x1B) || usb_device_descriptor, then usb_config_descriptor immediately afterwards.<br />
|-<br />
| 0x21B || 0x5 || Padding<br />
|-<br />
| 0x220 || 0x8 || Unknown u64 timestamp for when the device was inserted?<br />
|}<br />
<br />
This is a 0x228-byte struct (unofficial name).<br />
<br />
The INPUT/OUTPUT endpoint descriptors (usb_endpoint_descriptors/usb_ss_endpoint_companion_descriptors) were swapped with [8.0.0+] (above layout has the pre-8.0.0 layout), however the sysmodule code which writes this output struct was basically unchanged.<br />
<br />
= UsbHsInterfaceFilter =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x2 || Flags<br />
|-<br />
| 0x2 || 0x2 ||idVendor<br />
|-<br />
| 0x4 || 0x2 || idProduct<br />
|-<br />
| 0x6 || 0x2 || bcdDevice_Min<br />
|-<br />
| 0x8 || 0x2 || bcdDevice_Max<br />
|-<br />
| 0xA || 0x1 || bDeviceClass<br />
|-<br />
| 0xB || 0x1 || bDeviceSubClass<br />
|-<br />
| 0xC || 0x1 || bDeviceProtocol<br />
|-<br />
| 0xD || 0x1 || bInterfaceClass<br />
|-<br />
| 0xE || 0x1 || bInterfaceSubClass<br />
|-<br />
| 0xF || 0x1 || bInterfaceProtocol<br />
|}<br />
<br />
This is a 0x10-byte struct (unofficial name).<br />
<br />
This is used to filter [[#UsbHsInterface]], the query commands will only return the interface when these checks pass. This is also used for events with [[#CreateInterfaceAvailableEvent]]. When a bit in Flags is set, the associated descriptor field and the field in this struct are compared, on mismatch the interface will be filtered out. Passing Flags=0 is equivalent to disabling filtering since none of these checks will run.<br />
<br />
[7.0.0+]: The filter struct has to be unique, it can't match any existing filter structs used by [[#CreateInterfaceAvailableEvent]] (including other processes). Hence, Flags has to be non-zero. When initialized with usb:hs:a and VID and/or PID filtering is enabled, the VID/PID will be checked [[#HidGamepad]], with an error being throw if a matching device is found with quirk "ApplicationBlacklist" ([[#usb:qdb|usb:qdb]] cmd1 is used internally for this with bcdDevice=0).<br />
<br />
Flags bits 0..6 use usb_device_descriptor, while 7..9 use usb_interface_descriptor. Support for bits 2..6 and the associated fields was added with [6.0.0+].<br />
<br />
Flags bits:<br />
* 0: idVendor<br />
* 1: idProduct<br />
* 2: bcdDevice (Descriptor value must be >= struct bcdDevice_Min)<br />
* 3: bcdDevice (Descriptor value must be <= struct bcdDevice_Max)<br />
* 4: bDeviceClass<br />
* 5: bDeviceSubClass<br />
* 6: bDeviceProtocol<br />
* 7: bInterfaceClass<br />
* 8: bInterfaceSubClass<br />
* 9: bInterfaceProtocol<br />
<br />
HID-sysmodule uses the following for the input struct: <code>80 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00</code><br />
<br />
= XferReport =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x4 || xferId (Only set for [[#GetXferReport]])<br />
|-<br />
| 0x4 || 0x4 || Result<br />
|-<br />
| 0x8 || 0x4 || requestedSize<br />
|-<br />
| 0xC || 0x4 || transferredSize<br />
|-<br />
| 0x10 || 0x8? || ?<br />
|}<br />
<br />
This is a 0x18-byte struct.<br />
<br />
Official sw only uses the Result/size fields.<br />
<br />
= usb:pd =<br />
This is "nn::usb::pd::detail::IPdManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetPdSession<br />
|}<br />
<br />
Only system-titles with access to this are [[PTM_services|ptm]] and [[AM_services|am]].<br />
<br />
== IPdSession ==<br />
This is "nn::usb::pd::detail::IPdSession".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || BindNoticeEvent<br />
|-<br />
| 1 || UnbindNoticeEvent<br />
|-<br />
| 2 || GetStatus<br />
|-<br />
| 3 || GetNotice<br />
|-<br />
| 4 || EnablePowerRequestNotice<br />
|-<br />
| 5 || DisablePowerRequestNotice<br />
|-<br />
| 6 || ReplyPowerRequest<br />
|}<br />
<br />
= usb:pd:c =<br />
This is "nn::usb::pd::detail::IPdCradleManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetPdCradleSession || Returns a session handle for the below.<br />
|}<br />
<br />
USB-sysmodule symbols for this refer to "Cradle", which is the [[Dock]].<br />
<br />
== IPdCradleSession ==<br />
This is "nn::usb::pd::detail::IPdCradleSession".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || VdmUserWrite || Input { u32 value; u32 VdmUserId; }. Output {}.<br />
If Cradle or RelayBox is connected, issues given VDM with value.<br />
|-<br />
| 1 || VdmUserRead || Input { u32 VdmUserId; }. Output { u32 value; }.<br />
If Cradle or RelayBox is connected, returns u32 response from issuing given VDM.<br />
|-<br />
| 2 || Vdm20Init || No input/output.<br />
If Cradle or RelayBox is connected, caches result of VDM 0x20.<br />
|-<br />
| 3 || [2.0.0+] GetFwType || No input. Returns an output u16.<br />
|-<br />
| 4 || [2.0.0+] GetFwRevision || No input. Returns an output u16.<br />
|-<br />
| 5 || [2.0.0+] GetManufacturerId || No input. Returns an output u16.<br />
|-<br />
| 6 || [2.0.0+] GetDeviceId || No input. Returns an output u16.<br />
|-<br />
| 7 || [3.0.0+] ||<br />
|-<br />
| 8 || [3.0.0+] ||<br />
|}<br />
<br />
Note: The VdmUserId given to VdmUserRead/VdmUserWrite is translated from the given (enum) value to the actual cmd to send.<br />
<br />
= usb:pd:m =<br />
This is "nn::usb::pd::detail::IPdManufactureManager". This is only available on 1.0.0.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || No input, returns an [[#IPdManufactureSession]].<br />
|}<br />
<br />
== IPdManufactureSession ==<br />
This is "nn::usb::pd::detail::IPdManufactureSession".<br />
<br />
These commands just load the u16 from global state.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || No input, returns an output u16.<br />
|-<br />
| 1 || || No input, returns an output u16.<br />
|-<br />
| 2 || || No input, returns an output u16.<br />
|-<br />
| 3 || || No input, returns an output u16.<br />
|-<br />
|}<br />
<br />
= usb:pm =<br />
This is "nn::usb::pm::IPmService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 ||<br />
|-<br />
| 1 ||<br />
|-<br />
| 2 ||<br />
|-<br />
| 3 ||<br />
|-<br />
| 4 ||<br />
|-<br />
| 5 ||<br />
|}<br />
<br />
USB Port Manager, only system-title using this is [[PTM_services|ptm]].<br />
<br />
= usb:qdb =<br />
Added with [[7.0.0]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || <br />
|-<br />
| 1 || <br />
|}<br />
<br />
== Cmd0 ==<br />
No input/output, takes a type-0x5 input buffer.<br />
<br />
This loads data for [[#HidGamepad]] with the input .json.<br />
<br />
== Cmd1 ==<br />
Takes 6-bytes of input (u16s '''vid''', '''pid''', '''bcdDevice''') and a type-0x5 input buffer, returns an output u8 bool indicating success.<br />
<br />
Locates an entry in the [[#HidGamepad]] state with the input u16s, and checks for a '''quirks''' array entry where '''name''' matches the input buffer string. Returns 1 when found, 0 otherwise.<br />
<br />
= usb:obsv =<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || <br />
|-<br />
| 1 || <br />
|}<br />
<br />
= HidGamepad =<br />
With [7.0.0+] usb-sysmodule now has .json data embedded in the codebin.<br />
<br />
This contains a list of USB devices' VID/PID, with the following structure:<br />
<br />
[<br />
{<br />
"vid" : "<VID>",<br />
"pid" : "<PID>",<br />
"quirks" : [<br />
{<br />
"name" : "<string>" //The .json has the following for <string> for various devices: "HidGamepadWhitelist", "ApplicationBlacklist", and "NoClearHaltOnEpInit".<br />
}<br />
//There can be multiple entries here.<br />
]<br />
},<br />
<more entries><br />
]<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=NS_services&diff=10430
NS services
2020-12-08T20:31:51Z
<p>Behemoth: /* ns:am2, ns:ec, ns:rid, ns:rt, ns:web */</p>
<hr />
<div>= aoc:u =<br />
This is "nn::aocsrv::detail::IAddOnContentManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [1.0.0-6.2.0] CountAddOnContentByApplicationId<br />
|-<br />
| 1 || [1.0.0-6.2.0] ListAddOnContentByApplicationId<br />
|-<br />
| 2 || CountAddOnContent<br />
|-<br />
| 3 || ListAddOnContent<br />
|-<br />
| 4 || [1.0.0-6.2.0] GetAddOnContentBaseIdByApplicationId<br />
|-<br />
| 5 || GetAddOnContentBaseId<br />
|-<br />
| 6 || [1.0.0-6.2.0] PrepareAddOnContentByApplicationId<br />
|-<br />
| 7 || PrepareAddOnContent<br />
|-<br />
| 8 || [4.0.0+] GetAddOnContentListChangedEvent<br />
|-<br />
| 9 || [10.0.0+] GetAddOnContentLostErrorCode<br />
|-<br />
| 10 || [11.0.0+] GetAddOnContentListChangedEventWithProcessId<br />
|-<br />
| 100 || [7.0.0+] [[#IPurchaseEventManager|CreateEcPurchasedEventManager]]<br />
|-<br />
| 101 || [9.0.0+] [[#IPurchaseEventManager|CreatePermanentEcPurchasedEventManager]]<br />
|}<br />
<br />
== IPurchaseEventManager ==<br />
This is "nn::ec::IPurchaseEventManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || SetDefaultDeliveryTarget<br />
|-<br />
| 1 || SetDeliveryTarget<br />
|-<br />
| 2 || GetPurchasedEventReadableHandle<br />
|-<br />
| 3 || PopPurchasedProductInfo<br />
|-<br />
| 4 || [9.0.0+] PopPurchasedProductInfoWithUid<br />
|}<br />
<br />
= ns:am =<br />
This is "nn::ns::detail::IApplicationManagerInterface".<br />
<br />
[3.0.0+] This service was replaced by [[#ns:am2, ns:ec, ns:rid, ns:rt, ns:web|ns:am2]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#ListApplicationRecord]]<br />
|-<br />
| 1 || GenerateApplicationRecordCount<br />
|-<br />
| 2 || GetApplicationRecordUpdateSystemEvent<br />
|-<br />
| 3 || GetApplicationViewDeprecated<br />
|-<br />
| 4 || DeleteApplicationEntity<br />
|-<br />
| 5 || DeleteApplicationCompletely<br />
|-<br />
| 6 || IsAnyApplicationEntityRedundant<br />
|-<br />
| 7 || DeleteRedundantApplicationEntity<br />
|-<br />
| 8 || IsApplicationEntityMovable<br />
|-<br />
| 9 || MoveApplicationEntity<br />
|-<br />
| 11 || [[#CalculateApplicationOccupiedSize]]<br />
|-<br />
| 16 || PushApplicationRecord<br />
|-<br />
| 17 || ListApplicationRecordContentMeta<br />
|-<br />
| 18 || CheckLaunchRights<br />
|-<br />
| 19 || [[#LaunchApplication]]<br />
|-<br />
| 21 || [[#GetApplicationContentPath]]<br />
|-<br />
| 22 || TerminateApplication<br />
|-<br />
| 23 || [2.0.0+] ResolveApplicationContentPath<br />
|-<br />
| 26 || BeginInstallApplication<br />
|-<br />
| 27 || DeleteApplicationRecord<br />
|-<br />
| 30 || RequestApplicationUpdateInfo<br />
|-<br />
| 31 || RequestUpdateApplication<br />
|-<br />
| 32 || CancelApplicationDownload<br />
|-<br />
| 33 || ResumeApplicationDownload<br />
|-<br />
| 34 || <br />
|-<br />
| 35 || UpdateVersionList<br />
|-<br />
| 36 || PushLaunchVersion<br />
|-<br />
| 37 || ListRequiredVersion<br />
|-<br />
| 38 || CheckApplicationLaunchVersion<br />
|-<br />
| 39 || CheckApplicationLaunchRights<br />
|-<br />
| 40 || GetApplicationLogoData<br />
|-<br />
| 41 || CalculateApplicationDownloadRequiredSize<br />
|-<br />
| 42 || CleanupSdCard<br />
|-<br />
| 43 || [[#CheckSdCardMountStatus]]<br />
|-<br />
| 44 || GetSdCardMountStatusChangedEvent<br />
|-<br />
| 45 || GetGameCardAttachmentEvent<br />
|-<br />
| 46 || GetGameCardAttachmentInfo<br />
|-<br />
| 47 || [[#GetTotalSpaceSize]]<br />
|-<br />
| 48 || [[#GetFreeSpaceSize]]<br />
|-<br />
| 49 || GetSdCardRemovedEvent<br />
|-<br />
| 52 || GetGameCardUpdateDetectionEvent<br />
|-<br />
| 53 || DisableApplicationAutoDelete<br />
|-<br />
| 54 || EnableApplicationAutoDelete<br />
|-<br />
| 55 || [[#GetApplicationDesiredLanguage]]<br />
|-<br />
| 56 || SetApplicationTerminateResult<br />
|-<br />
| 57 || ClearApplicationTerminateResult<br />
|-<br />
| 58 || GetLastSdCardMountUnexpectedResult<br />
|-<br />
| 59 || ConvertApplicationLanguageToLanguageCode<br />
|-<br />
| 60 || [[#ConvertLanguageCodeToApplicationLanguage]]<br />
|-<br />
| 61 || GetBackgroundDownloadStressTaskInfo<br />
|-<br />
| 62 || GetGameCardStopper<br />
|-<br />
| 63 || IsSystemProgramInstalled<br />
|-<br />
| 64 || [2.0.0+] StartApplyDeltaTask<br />
|-<br />
| 65 || [2.0.0+] GetRequestServerStopper<br />
|-<br />
| 100 || ResetToFactorySettings<br />
|-<br />
| 101 || ResetToFactorySettingsWithoutUserSaveData<br />
|-<br />
| 102 || [2.0.0+] ResetToFactorySettingsForRefurbishment<br />
|-<br />
| 200 || CalculateUserSaveDataStatistics<br />
|-<br />
| 201 || DeleteUserSaveDataAll<br />
|-<br />
| 210 || DeleteUserSystemSaveData<br />
|-<br />
| 220 || UnregisterNetworkServiceAccount<br />
|-<br />
| 300 || GetApplicationShellEvent<br />
|-<br />
| 301 || PopApplicationShellEventInfo<br />
|-<br />
| 302 || LaunchLibraryApplet<br />
|-<br />
| 303 || TerminateLibraryApplet<br />
|-<br />
| 304 || LaunchSystemApplet<br />
|-<br />
| 305 || TerminateSystemApplet<br />
|-<br />
| 306 || LaunchOverlayApplet<br />
|-<br />
| 307 || TerminateOverlayApplet<br />
|-<br />
| 400 || [[#GetApplicationControlData]]<br />
|-<br />
| 401 || InvalidateAllApplicationControlCache<br />
|-<br />
| 402 || RequestDownloadApplicationControlData<br />
|-<br />
| 403 || GetMaxApplicationControlCacheCount<br />
|-<br />
| 404 || [2.0.0+] InvalidateApplicationControlCache<br />
|-<br />
| 405 || [2.0.0+] ListApplicationControlCacheEntryInfo<br />
|-<br />
| 502 || [2.0.0+] RequestCheckGameCardRegistration<br />
|-<br />
| 503 || [2.0.0+] RequestGameCardRegistrationGoldPoint<br />
|-<br />
| 504 || [2.0.0+] RequestRegisterGameCard<br />
|-<br />
| 600 || [2.0.0+] [[#CountApplicationContentMeta]]<br />
|-<br />
| 601 || [2.0.0+] [[#ListApplicationContentMetaStatus]]<br />
|-<br />
| 602 || [2.0.0+] ListAvailableAddOnContent<br />
|-<br />
| 603 || [2.0.0+] GetOwnedApplicationContentMetaStatus<br />
|-<br />
| 604 || [2.0.0+] RegisterContentsExternalKey<br />
|-<br />
| 605 || [2.0.0+] ListApplicationContentMetaStatusWithRightsCheck<br />
|-<br />
| 700 || [2.0.0+] PushDownloadTaskList<br />
|-<br />
| 701 || [2.0.0+] [[#ClearTaskStatusList]]<br />
|-<br />
| 702 || [2.0.0+] [[#RequestDownloadTaskList]]<br />
|-<br />
| 703 || [2.0.0+] [[#RequestEnsureDownloadTask]]<br />
|-<br />
| 704 || [2.0.0+] [[#ListDownloadTaskStatus]]<br />
|-<br />
| 705 || [2.0.0+] RequestDownloadTaskListData<br />
|-<br />
| 800 || [2.0.0+] RequestVersionList<br />
|-<br />
| 801 || [2.0.0+] ListVersionList<br />
|-<br />
| 900 || [2.0.0+] GetApplicationRecord<br />
|-<br />
| 901 || [2.0.0+] GetApplicationRecordProperty<br />
|-<br />
| 902 || [2.0.0+] EnableApplicationAutoUpdate<br />
|-<br />
| 903 || [2.0.0+] DisableApplicationAutoUpdate<br />
|-<br />
| 904 || [2.0.0+] TouchApplication<br />
|-<br />
| 905 || [2.0.0+] RequestApplicationUpdate<br />
|-<br />
| 906 || [2.0.0+] IsApplicationUpdateRequested<br />
|-<br />
| 907 || [2.0.0+] WithdrawApplicationUpdateRequest<br />
|-<br />
| 908 || [2.0.0+] ListApplicationRecordInstalledContentMeta<br />
|-<br />
| 1000 || [2.0.0+] RequestVerifyApplicationDeprecated<br />
|-<br />
| 1001 || [2.0.0+] CorruptApplicationForDebug<br />
|-<br />
| 1200 || [2.0.0+] [[#NeedsUpdateVulnerability]]<br />
|-<br />
| 1300 || [2.0.0+] IsAnyApplicationEntityInstalled<br />
|-<br />
| 1301 || [2.0.0+] DeleteApplicationContentEntities<br />
|-<br />
| 1302 || [2.0.0+] CleanupUnrecordedApplicationEntity<br />
|-<br />
| 1400 || [2.0.0+] PrepareShutdown<br />
|-<br />
| 1500 || [2.0.0+] FormatSdCard<br />
|-<br />
| 1501 || [2.0.0+] NeedsSystemUpdateToFormatSdCard<br />
|-<br />
| 1502 || [2.0.0+] GetLastSdCardFormatUnexpectedResult<br />
|-<br />
| 1503 || [2.0.0+]<br />
|-<br />
| 1600 || [2.0.0+] GetSystemSeedForPseudoDeviceId<br />
|-<br />
| 1700 || [2.0.0+] ListApplicationDownloadingContentMeta<br />
|-<br />
| 1800 || [2.0.0+] IsNotificationSetupCompleted<br />
|-<br />
| 1801 || [2.0.0+] GetLastNotificationInfoCount<br />
|-<br />
| 1802 || [2.0.0+] ListLastNotificationInfo<br />
|}<br />
<br />
== ListApplicationRecord ==<br />
Takes a type-0x6 output buffer containing an array of the below record and an s32 entry_offset, returns an output s32 out_entrycount.<br />
<br />
Returns an array of entries with the below format using the specified offset and count.<br />
<br />
=== Application Record Format ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x8<br />
| [[NCM_services#ApplicationId|ApplicationId]]<br />
|-<br />
| 0x8<br />
| 0x1<br />
| Type? (Known values: 0x2=Installing?, 0x3=Installed / Gamecard inserted, 0x5=Gamecard not inserted, 0xB=Archived)<br />
|-<br />
| 0x9<br />
| 0x1<br />
| Unknown, usually 0x02<br />
|-<br />
| 0xA<br />
| 0x6<br />
| Unknown, usually zeros?<br />
|-<br />
| 0x10<br />
| 0x1<br />
| Unknown, seems to change between reboots and removing/reinserting gamecards<br />
|-<br />
| 0x11<br />
| 0x7<br />
| Unknown, usually zeros?<br />
|}<br />
<br />
== LaunchApplication ==<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u64 PID.<br />
<br />
Launches an application title which is registered with NS.<br />
<br />
== GetApplicationContentPath ==<br />
Takes a 0x16-type output buffer, an u8 [[NCM_services#ContentMetaType|ContentMetaType]], and an [[NCM_services#ApplicationId|ApplicationId]].<br />
<br />
The input [[NCM_services#ApplicationId|ApplicationId]] is used with the application-title table like various other cmds, anything not in that table can't be used with this.<br />
<br />
Returns a string path for the specified type of patch content with this [[NCM_services#ApplicationId|ApplicationId]], otherwise returns regular-application paths when update-title not installed. Returns an error when the specified type of content doesn't exist for this title. Starts with "@{SdCardContent,UserContent}://" and ends in ".nca".<br />
<br />
For gamecard content, the output path is: "@GcSXXXXXXXX:/<NcaId>.nca". NCA-type0 with gamecard returns 0 with an empty output string.<br />
<br />
The output string is then used by the user-process with [[Filesystem_services|FS]] to mount the content.<br />
<br />
== GetTotalSpaceSize ==<br />
Takes an input u8 [[NCM_services#StorageId|StorageId]], no output.<br />
<br />
The StorageId must be SdCard.<br />
<br />
Returns the s64 from [[NCM_services#IContentStorage]] GetFreeSpaceSize.<br />
<br />
== GetFreeSpaceSize ==<br />
Takes an input u8 [[NCM_services#StorageId|StorageId]], no output.<br />
<br />
The StorageId must be SdCard.<br />
<br />
Returns the s64 from [[NCM_services#IContentStorage]] GetTotalSpaceSize.<br />
<br />
== GetApplicationDesiredLanguage ==<br />
Takes an input u8 language-bitmask, returns an output u8 [[control.nacp]] langentry index.<br />
<br />
User-processes generate the language-bitmask with the following for all 16 lang-entries: <code>if(<either string in langentry[i] is non-empty>)bitmask |= 1<<i</code><br />
<br />
== ConvertLanguageCodeToApplicationLanguage ==<br />
Takes an input u8 pointer for the resulting Id to be written to and a string represented as a u64 (i.e 0x53552D6E65 for 'en-US').<br />
<br />
Returns 0 if an ID was successfully found, otherwise returns 0x25810.<br />
<br />
== GetApplicationControlData ==<br />
Takes an input u8 [[#ApplicationControlSource]], an [[NCM_services#ApplicationId|ApplicationId]], and a type-0x6 output buffer. Returns an output u32 for actual_size. Official user-processes use buffer size 0x24000. [[qlaunch]] only uses source value 0x1 (Storage if not in cache).<br />
<br />
Loads cached [[control.nacp]] to buf+0 and the cached icon to buf+0x4000. Returns an error if the buffer is too small.<br />
<br />
=== ApplicationControlSource ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0x0<br />
| CacheOnly (Returns data from cache)<br />
|-<br />
| 0x1<br />
| Storage (Returns data from storage if not present in cache)<br />
|-<br />
| 0x2<br />
| StorageOnly (Returns data from storage without using cache)<br />
|}<br />
<br />
== ListApplicationContentMetaStatus ==<br />
Takes a type-0x6 output buffer containing an array of the below entries, an input s32 index and [[NCM_services#ApplicationId|ApplicationId]], returns an output s32 out_entrycount.<br />
<br />
Returns 0x10-byte entries using the specified [[NCM_services#ApplicationId|ApplicationId]] starting at the specified index. Can only return game titles. The second entry if any is the update-title usually. When the input entryindex is >= totalentries, this will return 0 with out_entrycount=0.<br />
<br />
Entry structure:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x1<br />
| [[NCM_services#ContentMetaType|ContentMetaType]] ("type")<br />
|-<br />
| 0x1<br />
| 0x1<br />
| [[NCM_services#StorageId|StorageId]] ("installedStorage")<br />
|-<br />
| 0x2<br />
| 0x1<br />
| Unknown. Non-zero with output from cmd 605, differs for app/update titles.<br />
|-<br />
| 0x3<br />
| 0x1<br />
| Padding<br />
|-<br />
| 0x4<br />
| 0x4<br />
| Version<br />
|-<br />
| 0x8<br />
| 0x8<br />
| [[NCM_services#ApplicationId|ApplicationId]]<br />
|}<br />
<br />
= ns:am2, ns:ec, ns:rid, ns:rt, ns:web, ns:ro =<br />
These services are all, at the top level, "nn::ns::detail::IServiceGetterInterface". These commands check a state field for a command-specific bit and returns an error if not set, this is likely a permissions check for service+command.<br />
<br />
[11.0.0] ns:ro was added.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 7988 || [6.0.0+] [[#IDynamicRightsInterface|GetDynamicRightsInterface]]<br />
|-<br />
| 7989 || [5.1.0+] [[#IReadOnlyApplicationControlDataInterface|GetReadOnlyApplicationControlDataInterface]]<br />
|-<br />
| 7991 || [5.0.0+] [[#IReadOnlyApplicationRecordInterface|GetReadOnlyApplicationRecordInterface]]<br />
|-<br />
| 7992 || [4.0.0+] [[#IECommerceInterface|GetECommerceInterface]]<br />
|-<br />
| 7993 || [4.0.0+] [[#IApplicationVersionInterface|GetApplicationVersionInterface]]<br />
|-<br />
| 7994 || [[#IFactoryResetInterface|GetFactoryResetInterface]]<br />
|-<br />
| 7995 || [[#IAccountProxyInterface|GetAccountProxyInterface]]<br />
|-<br />
| 7996 || [[#IApplicationManagerInterface|GetApplicationManagerInterface]]<br />
|-<br />
| 7997 || [[#IDownloadTaskInterface|GetDownloadTaskInterface]]<br />
|-<br />
| 7998 || [[#IContentManagementInterface|GetContentManagementInterface]]<br />
|-<br />
| 7999 || [[#IDocumentInterface|GetDocumentInterface]]<br />
|}<br />
<br />
=== IAccountProxyInterface ===<br />
This is "nn::ns::detail::IAccountProxyInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || CreateUserAccount<br />
|}<br />
<br />
=== IApplicationManagerInterface ===<br />
This is "nn::ns::detail::IApplicationManagerInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#ListApplicationRecord]]<br />
|-<br />
| 1 || GenerateApplicationRecordCount<br />
|-<br />
| 2 || [[#GetApplicationRecordUpdateSystemEvent]]<br />
|-<br />
| 3 || [[#GetApplicationViewDeprecated]]<br />
|-<br />
| 4 || [[#DeleteApplicationEntity]]<br />
|-<br />
| 5 || [[#DeleteApplicationCompletely]]<br />
|-<br />
| 6 || IsAnyApplicationEntityRedundant<br />
|-<br />
| 7 || [[#DeleteRedundantApplicationEntity]]<br />
|-<br />
| 8 || [[#IsApplicationEntityMovable]]<br />
|-<br />
| 9 || [1.0.0-9.2.0] [[#MoveApplicationEntity]]<br />
|-<br />
| 11 || [[#CalculateApplicationOccupiedSize]]<br />
|-<br />
| 16 || PushApplicationRecord<br />
|-<br />
| 17 || ListApplicationRecordContentMeta<br />
|-<br />
| 19 || [1.0.0-5.1.0] LaunchApplicationOld<br />
|-<br />
| 21 || [[#GetApplicationContentPath]]<br />
|-<br />
| 22 || TerminateApplication<br />
|-<br />
| 23 || ResolveApplicationContentPath<br />
|-<br />
| 26 || BeginInstallApplication<br />
|-<br />
| 27 || DeleteApplicationRecord<br />
|-<br />
| 30 || [[#RequestApplicationUpdateInfo]]<br />
|-<br />
| 31 || [1.0.0-3.0.2] <br />
|-<br />
| 32 || [[#CancelApplicationDownload]]<br />
|-<br />
| 33 || [[#ResumeApplicationDownload]]<br />
|-<br />
| 35 || UpdateVersionList<br />
|-<br />
| 36 || PushLaunchVersion<br />
|-<br />
| 37 || ListRequiredVersion<br />
|-<br />
| 38 || [[#CheckApplicationLaunchVersion]]<br />
|-<br />
| 39 || [1.0.0-6.2.0] CheckApplicationLaunchRights<br />
|-<br />
| 40 || GetApplicationLogoData<br />
|-<br />
| 41 || CalculateApplicationDownloadRequiredSize<br />
|-<br />
| 42 || [[#CleanupSdCard]]<br />
|-<br />
| 43 || [[#CheckSdCardMountStatus]]<br />
|-<br />
| 44 || [[#GetSdCardMountStatusChangedEvent]]<br />
|-<br />
| 45 || GetGameCardAttachmentEvent<br />
|-<br />
| 46 || GetGameCardAttachmentInfo<br />
|-<br />
| 47 || [[#GetTotalSpaceSize]]<br />
|-<br />
| 48 || [[#GetFreeSpaceSize]]<br />
|-<br />
| 49 || GetSdCardRemovedEvent<br />
|-<br />
| 52 || [[#GetGameCardUpdateDetectionEvent]]<br />
|-<br />
| 53 || [[#DisableApplicationAutoDelete]]<br />
|-<br />
| 54 || [[#EnableApplicationAutoDelete]]<br />
|-<br />
| 55 || GetApplicationDesiredLanguage<br />
|-<br />
| 56 || [[#SetApplicationTerminateResult]]<br />
|-<br />
| 57 || [[#ClearApplicationTerminateResult]]<br />
|-<br />
| 58 || [[#GetLastSdCardMountUnexpectedResult]]<br />
|-<br />
| 59 || ConvertApplicationLanguageToLanguageCode<br />
|-<br />
| 60 || [[#ConvertLanguageCodeToApplicationLanguage]]<br />
|-<br />
| 61 || GetBackgroundDownloadStressTaskInfo<br />
|-<br />
| 62 || GetGameCardStopper<br />
|-<br />
| 63 || IsSystemProgramInstalled<br />
|-<br />
| 64 || StartApplyDeltaTask<br />
|-<br />
| 65 || [[#GetRequestServerStopper]]<br />
|-<br />
| 66 || [3.0.0+] GetBackgroundApplyDeltaStressTaskInfo<br />
|-<br />
| 67 || [3.0.0+] [[#CancelApplicationApplyDelta]]<br />
|-<br />
| 68 || [3.0.0+] [[#ResumeApplicationApplyDelta]]<br />
|-<br />
| 69 || [3.0.0+] [[#CalculateApplicationApplyDeltaRequiredSize]]<br />
|-<br />
| 70 || [3.0.0+] [[#ResumeAll]]<br />
|-<br />
| 71 || [3.0.0+] [[#GetStorageSize]]<br />
|-<br />
| 80 || [3.0.0+] RequestDownloadApplication<br />
|-<br />
| 81 || [3.0.0+] RequestDownloadAddOnContent<br />
|-<br />
| 82 || [3.0.0+] DownloadApplication<br />
|-<br />
| 83 || [4.0.0-6.2.0] CheckApplicationResumeRights<br />
|-<br />
| 84 || [4.0.0+] GetDynamicCommitEvent<br />
|-<br />
| 85 || [4.0.0+] [[#RequestUpdateApplication2]]<br />
|-<br />
| 86 || [4.0.0+] EnableApplicationCrashReport<br />
|-<br />
| 87 || [4.0.0+] IsApplicationCrashReportEnabled<br />
|-<br />
| 90 || [4.0.0-8.1.0] BoostSystemMemoryResourceLimit<br />
|-<br />
| 91 || [5.0.0+] DeprecatedLaunchApplication<br />
|-<br />
| 92 || [5.0.0+] GetRunningApplicationProgramId<br />
|-<br />
| 93 || [5.0.0+] GetMainApplicationProgramIndex<br />
|-<br />
| 94 || [6.0.0+] [[#LaunchApplication_2|LaunchApplication]]<br />
|-<br />
| 95 || [6.0.0+] [[#GetApplicationLaunchInfo]]<br />
|-<br />
| 96 || [6.0.0+] [[#AcquireApplicationLaunchInfo]]<br />
|-<br />
| 97 || [6.0.0+] GetMainApplicationProgramIndexByApplicationLaunchInfo<br />
|-<br />
| 98 || [6.0.0+] EnableApplicationAllThreadDumpOnCrash<br />
|-<br />
| 99 || [8.0.0+] [[#LaunchDevMenu]]<br />
|-<br />
| 100 || [[#ResetToFactorySettings]]<br />
|-<br />
| 101 || [[#ResetToFactorySettingsWithoutUserSaveData]]<br />
|-<br />
| 102 || [[#ResetToFactorySettingsForRefurbishment]]<br />
|-<br />
| 103 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegion]]<br />
|-<br />
| 104 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegionAuthentication]]<br />
|-<br />
| 105 || [10.0.0+] [[#RequestResetToFactorySettingsSecurely]]<br />
|-<br />
| 106 || [10.0.0+] [[#RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely]]<br />
|-<br />
| 200 || CalculateUserSaveDataStatistics<br />
|-<br />
| 201 || [[#DeleteUserSaveDataAll]]<br />
|-<br />
| 210 || [[#DeleteUserSystemSaveData]]<br />
|-<br />
| 211 || [6.0.0+] [[#DeleteSaveData]]<br />
|-<br />
| 220 || [[#UnregisterNetworkServiceAccount]]<br />
|-<br />
| 221 || [6.0.0+] [[#UnregisterNetworkServiceAccountWithUserSaveDataDeletion]]<br />
|-<br />
| 300 || GetApplicationShellEvent<br />
|-<br />
| 301 || PopApplicationShellEventInfo<br />
|-<br />
| 302 || [[#LaunchLibraryApplet]]<br />
|-<br />
| 303 || TerminateLibraryApplet<br />
|-<br />
| 304 || [[#LaunchSystemApplet]]<br />
|-<br />
| 305 || TerminateSystemApplet<br />
|-<br />
| 306 || [[#LaunchOverlayApplet]]<br />
|-<br />
| 307 || TerminateOverlayApplet<br />
|-<br />
| 400 || [[#GetApplicationControlData]]<br />
|-<br />
| 401 || InvalidateAllApplicationControlCache<br />
|-<br />
| 402 || [[#RequestDownloadApplicationControlData]]<br />
|-<br />
| 403 || GetMaxApplicationControlCacheCount<br />
|-<br />
| 404 || InvalidateApplicationControlCache<br />
|-<br />
| 405 || ListApplicationControlCacheEntryInfo<br />
|-<br />
| 406 || [6.0.0+] GetApplicationControlProperty<br />
|-<br />
| 407 || [8.0.0+] [[#ListApplicationTitle]]<br />
|-<br />
| 408 || [8.0.0+] [[#ListApplicationIcon]]<br />
|-<br />
| 502 || [[#RequestCheckGameCardRegistration]]<br />
|-<br />
| 503 || [[#RequestGameCardRegistrationGoldPoint]]<br />
|-<br />
| 504 || [[#RequestRegisterGameCard]]<br />
|-<br />
| 505 || [3.0.0+] [[#GetGameCardMountFailureEvent]]<br />
|-<br />
| 506 || [3.0.0+] [[#IsGameCardInserted]]<br />
|-<br />
| 507 || [3.0.0+] [[#EnsureGameCardAccess]]<br />
|-<br />
| 508 || [3.0.0+] [[#GetLastGameCardMountFailureResult]]<br />
|-<br />
| 509 || [5.0.0+] [[#ListApplicationIdOnGameCard]]<br />
|-<br />
| 510 || [9.0.0+] [[#GetGameCardPlatformRegion]]<br />
|-<br />
| 600 || [[#CountApplicationContentMeta]]<br />
|-<br />
| 601 || [[#ListApplicationContentMetaStatus]]<br />
|-<br />
| 602 || [2.0.0-5.1.0] ListAvailableAddOnContent<br />
|-<br />
| 603 || GetOwnedApplicationContentMetaStatus<br />
|-<br />
| 604 || RegisterContentsExternalKey<br />
|-<br />
| 605 || ListApplicationContentMetaStatusWithRightsCheck<br />
|-<br />
| 606 || [3.0.0+] GetContentMetaStorage<br />
|-<br />
| 607 || [6.0.0+] [[#ListAvailableAddOnContent]]<br />
|-<br />
| 700 || PushDownloadTaskList<br />
|-<br />
| 701 || [[#ClearTaskStatusList]]<br />
|-<br />
| 702 || [[#RequestDownloadTaskList]]<br />
|-<br />
| 703 || [[#RequestEnsureDownloadTask]]<br />
|-<br />
| 704 || [[#ListDownloadTaskStatus]]<br />
|-<br />
| 705 || [[#RequestDownloadTaskListData]]<br />
|-<br />
| 800 || RequestVersionList<br />
|-<br />
| 801 || ListVersionList<br />
|-<br />
| 802 || [3.0.0+] [[#RequestVersionListData]]<br />
|-<br />
| 900 || GetApplicationRecord<br />
|-<br />
| 901 || GetApplicationRecordProperty<br />
|-<br />
| 902 || EnableApplicationAutoUpdate<br />
|-<br />
| 903 || DisableApplicationAutoUpdate<br />
|-<br />
| 904 || [[#TouchApplication]]<br />
|-<br />
| 905 || RequestApplicationUpdate<br />
|-<br />
| 906 || [[#IsApplicationUpdateRequested]]<br />
|-<br />
| 907 || [[#WithdrawApplicationUpdateRequest]]<br />
|-<br />
| 908 || ListApplicationRecordInstalledContentMeta<br />
|-<br />
| 909 || [3.0.0+] WithdrawCleanupAddOnContentsWithNoRightsRecommendation<br />
|-<br />
| 910 || [5.0.0+] HasApplicationRecord<br />
|-<br />
| 911 || [5.1.0+] SetPreInstalledApplication<br />
|-<br />
| 912 || [5.1.0+] ClearPreInstalledApplicationFlag<br />
|-<br />
| 913 || [9.0.0+] ListAllApplicationRecord<br />
|-<br />
| 914 || [9.0.0+] HideApplicationRecord<br />
|-<br />
| 915 || [9.0.0+] ShowApplicationRecord<br />
|-<br />
| 916 || [11.0.0+] IsApplicationAutoDeleteDisabled<br />
|-<br />
| 1000 || [[#RequestVerifyApplicationDeprecated]]<br />
|-<br />
| 1001 || CorruptApplicationForDebug<br />
|-<br />
| 1002 || [3.0.0-9.2.0] [[#RequestVerifyAddOnContentsRights]]<br />
|-<br />
| 1003 || [5.0.0+] [[#RequestVerifyApplication]]<br />
|-<br />
| 1004 || [5.0.0+] CorruptContentForDebug<br />
|-<br />
| 1200 || [[#NeedsUpdateVulnerability]]<br />
|-<br />
| 1300 || [[#IsAnyApplicationEntityInstalled]]<br />
|-<br />
| 1301 || DeleteApplicationContentEntities<br />
|-<br />
| 1302 || CleanupUnrecordedApplicationEntity<br />
|-<br />
| 1303 || [3.0.0-9.2.0] CleanupAddOnContentsWithNoRights<br />
|-<br />
| 1304 || [3.0.0+] DeleteApplicationContentEntity<br />
|-<br />
| 1308 || [5.0.0+] DeleteApplicationCompletelyForDebug<br />
|-<br />
| 1309 || [6.0.0+] [[#CleanupUnavailableAddOnContents]]<br />
|-<br />
| 1310 || [10.0.0+] RequestMoveApplicationEntity<br />
|-<br />
| 1311 || [10.0.0+] EstimateSizeToMove<br />
|-<br />
| 1312 || [10.0.0+] HasMovableEntity<br />
|-<br />
| 1313 || [11.0.0+] CleanupOrphanContents<br />
|-<br />
| 1314 || [11.0.0+] CheckPreconditionSatisfiedToMove<br />
|-<br />
| 1400 || PrepareShutdown<br />
|-<br />
| 1500 || [[#FormatSdCard]]<br />
|-<br />
| 1501 || [[#NeedsSystemUpdateToFormatSdCard]]<br />
|-<br />
| 1502 || [[#GetLastSdCardFormatUnexpectedResult]]<br />
|-<br />
| 1504 || [3.0.0+] InsertSdCard<br />
|-<br />
| 1505 || [3.0.0+] RemoveSdCard<br />
|-<br />
| 1506 || [9.0.0+] GetSdCardStartupStatus<br />
|-<br />
| 1600 || GetSystemSeedForPseudoDeviceId<br />
|-<br />
| 1601 || [3.0.0+] ResetSystemSeedForPseudoDeviceId<br />
|-<br />
| 1700 || ListApplicationDownloadingContentMeta<br />
|-<br />
| 1701 || [3.0.0+] [[#GetApplicationView]]<br />
|-<br />
| 1702 || [3.0.0+] GetApplicationDownloadTaskStatus<br />
|-<br />
| 1703 || [4.0.0+] [[#GetApplicationViewDownloadErrorContext]]<br />
|-<br />
| 1704 || [8.0.0+] [[#GetApplicationViewWithPromotionInfo]]<br />
|-<br />
| 1705 || [11.0.0+] IsPatchAutoDeletableApplication<br />
|-<br />
| 1800 || IsNotificationSetupCompleted<br />
|-<br />
| 1801 || GetLastNotificationInfoCount<br />
|-<br />
| 1802 || ListLastNotificationInfo<br />
|-<br />
| 1803 || [3.0.0+] ListNotificationTask<br />
|-<br />
| 1900 || [3.0.0+] IsActiveAccount<br />
|-<br />
| 1901 || [4.0.0+] [[#RequestDownloadApplicationPrepurchasedRights]]<br />
|-<br />
| 1902 || [5.0.0+] GetApplicationTicketInfo<br />
|-<br />
| 2000 || [4.0.0+] [[#GetSystemDeliveryInfo]]<br />
|-<br />
| 2001 || [4.0.0+] [[#SelectLatestSystemDeliveryInfo]]<br />
|-<br />
| 2002 || [4.0.0+] [[#VerifyDeliveryProtocolVersion]]<br />
|-<br />
| 2003 || [4.0.0+] [[#GetApplicationDeliveryInfo]]<br />
|-<br />
| 2004 || [4.0.0+] [[#HasAllContentsToDeliver]]<br />
|-<br />
| 2005 || [4.0.0+] [[#CompareApplicationDeliveryInfo]]<br />
|-<br />
| 2006 || [4.0.0+] [[#CanDeliverApplication]]<br />
|-<br />
| 2007 || [4.0.0+] [[#ListContentMetaKeyToDeliverApplication]]<br />
|-<br />
| 2008 || [4.0.0+] [[#NeedsSystemUpdateToDeliverApplication]]<br />
|-<br />
| 2009 || [4.0.0+] [[#EstimateRequiredSize]]<br />
|-<br />
| 2010 || [4.0.0+] [[#RequestReceiveApplication]]<br />
|-<br />
| 2011 || [4.0.0+] [[#CommitReceiveApplication]]<br />
|-<br />
| 2012 || [4.0.0+] [[#GetReceiveApplicationProgress]]<br />
|-<br />
| 2013 || [4.0.0+] [[#RequestSendApplication]]<br />
|-<br />
| 2014 || [4.0.0+] [[#GetSendApplicationProgress]]<br />
|-<br />
| 2015 || [4.0.0+] [[#CompareSystemDeliveryInfo]]<br />
|-<br />
| 2016 || [4.0.0+] [[#ListNotCommittedContentMeta]]<br />
|-<br />
| 2017 || [4.0.0+] [[#RecoverDownloadTask]]<br />
|-<br />
| 2018 || [5.0.0+] [[#GetApplicationDeliveryInfoHash]]<br />
|-<br />
| 2050 || [6.0.0+] [[#GetApplicationRightsOnClient]]<br />
|-<br />
| 2051 || [9.0.0+] InvalidateRightsIdCache<br />
|-<br />
| 2100 || [6.0.0+] [[#GetApplicationTerminateResult]]<br />
|-<br />
| 2101 || [6.0.0+] GetRawApplicationTerminateResult<br />
|-<br />
| 2150 || [6.0.0+] CreateRightsEnvironment<br />
|-<br />
| 2151 || [6.0.0+] DestroyRightsEnvironment<br />
|-<br />
| 2152 || [6.0.0+] ActivateRightsEnvironment<br />
|-<br />
| 2153 || [6.0.0+] DeactivateRightsEnvironment<br />
|-<br />
| 2154 || [6.0.0+] ForceActivateRightsContextForExit<br />
|-<br />
| 2155 || [7.0.0+] UpdateRightsEnvironmentStatus<br />
|-<br />
| 2156 || [10.0.0+] CreateRightsEnvironmentForMicroApplication ([9.0.0-9.2.0] CreateRightsEnvironmentForPreomia)<br />
|-<br />
| 2160 || [6.0.0+] AddTargetApplicationToRightsEnvironment<br />
|-<br />
| 2161 || [6.0.0+] SetUsersToRightsEnvironment<br />
|-<br />
| 2170 || [6.0.0+] GetRightsEnvironmentStatus<br />
|-<br />
| 2171 || [6.0.0+] GetRightsEnvironmentStatusChangedEvent<br />
|-<br />
| 2180 || [6.0.0+] RequestExtendExpirationInRightsEnvironment<br />
|-<br />
| 2181 || [6.0.0+] GetResultOfExtendExpirationInRightsEnvironment<br />
|-<br />
| 2182 || [6.0.0+] SetActiveRightsContextUsingStateToRightsEnvironment<br />
|-<br />
| 2190 || [6.0.0+] [[#GetRightsEnvironmentHandleForApplication]]<br />
|-<br />
| 2199 || [6.0.0+] GetRightsEnvironmentCountForDebug<br />
|-<br />
| 2200 || [6.0.0-9.2.0] GetGameCardApplicationCopyIdentifier<br />
|-<br />
| 2201 || [6.0.0-9.2.0] GetInstalledApplicationCopyIdentifier<br />
|-<br />
| 2250 || [6.0.0-6.2.0] RequestReportActiveELicence<br />
|-<br />
| 2300 || [6.0.0-8.1.0] ListEventLog<br />
|-<br />
| 2350 || [7.0.0+] PerformAutoUpdateByApplicationId<br />
|-<br />
| 2351 || [9.0.0+] [[#RequestNoDownloadRightsErrorResolution]]<br />
|-<br />
| 2352 || [9.0.0+] [[#RequestResolveNoDownloadRightsError]]<br />
|-<br />
| 2353 || [10.0.0+] GetApplicationDownloadTaskInfo<br />
|-<br />
| 2354 || [11.0.0+] PrioritizeApplicationBackgroundTask<br />
|-<br />
| 2400 || [8.0.0+] [[#GetPromotionInfo]]<br />
|-<br />
| 2401 || [8.0.0+] CountPromotionInfo<br />
|-<br />
| 2402 || [8.0.0+] ListPromotionInfo<br />
|-<br />
| 2403 || [8.0.0+] [[#ImportPromotionJsonForDebug]]<br />
|-<br />
| 2404 || [8.0.0+] [[#ClearPromotionInfoForDebug]]<br />
|-<br />
| 2500 || [8.0.0+] ConfirmAvailableTime<br />
|-<br />
| 2510 || [9.0.0+] [[#CreateApplicationResource]]<br />
|-<br />
| 2511 || [9.0.0+] [[#GetApplicationResource]]<br />
|-<br />
| 2513 || [10.0.0+] LaunchMicroApplication ([9.0.0-9.2.0] LaunchPreomia)<br />
|-<br />
| 2514 || [9.0.0+] ClearTaskOfAsyncTaskManager<br />
|-<br />
| 2515 || [10.0.0+] CleanupAllPlaceHolderAndFragmentsIfNoTask<br />
|-<br />
| 2516 || [10.0.0+] EnsureApplicationCertificate<br />
|-<br />
| 2800 || [9.0.0+] GetApplicationIdOfPreomia<br />
|-<br />
| 3000 || [11.0.0+] RegisterDeviceLockKey<br />
|-<br />
| 3001 || [11.0.0+] UnregisterDeviceLockKey<br />
|-<br />
| 3002 || [11.0.0+] VerifyDeviceLockKey<br />
|-<br />
| 3003 || [11.0.0+] HideApplicationIcon<br />
|-<br />
| 3004 || [11.0.0+] ShowApplicationIcon<br />
|-<br />
| 3005 || [11.0.0+] HideApplicationTitle<br />
|-<br />
| 3006 || [11.0.0+] ShowApplicationTitle<br />
|-<br />
| 3007 || [11.0.0+] EnableGameCard<br />
|-<br />
| 3008 || [11.0.0+] DisableGameCard<br />
|-<br />
| 3009 || [11.0.0+] EnableLocalContentShare<br />
|-<br />
| 3010 || [11.0.0+] DisableLocalContentShare<br />
|-<br />
| 3011 || [11.0.0+] IsApplicationIconHidden<br />
|-<br />
| 3012 || [11.0.0+] IsApplicationTitleHidden<br />
|-<br />
| 3013 || [11.0.0+] IsGameCardEnabled<br />
|-<br />
| 3014 || [11.0.0+] IsLocalContentShareEnabled<br />
|-<br />
| 9999 || [10.0.0-10.2.0] GetApplicationCertificate<br />
|}<br />
<br />
[4.0.0+] RequestDownloadAddOnContent now takes an additional 8-bytes of input.<br />
<br />
==== GetApplicationRecordUpdateSystemEvent ====<br />
No input, returns an output Event handle with EventClearMode=1.<br />
<br />
==== GetApplicationViewDeprecated ====<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationViewDeprecated]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], no output.<br />
<br />
On newer system-versions this is the same as [[#GetApplicationView]], except this converts the output from the func called in the loop from [[#ApplicationView]] to [[#ApplicationViewDeprecated]].<br />
<br />
==== DeleteApplicationEntity ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== DeleteApplicationCompletely ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== DeleteRedundantApplicationEntity ====<br />
No input/output.<br />
<br />
==== IsApplicationEntityMovable ====<br />
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool.<br />
<br />
==== MoveApplicationEntity ====<br />
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== RequestApplicationUpdateInfo ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
The data that can be read from the [[#IAsyncValue]] is [[#ApplicationUpdateInfo]].<br />
<br />
Before using the cmd, official sw uses [[Network_Interface_services#IsAnyInternetRequestAccepted|IsAnyInternetRequestAccepted]] with the output from [[#Network_Interface_services#GetClientId|GetClientId]], throwing an error when the returned bool is false.<br />
<br />
==== CancelApplicationDownload ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== ResumeApplicationDownload ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== CheckApplicationLaunchVersion ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== CalculateApplicationDownloadRequiredSize ====<br />
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output s64.<br />
<br />
==== CleanupSdCard ====<br />
No input/output.<br />
<br />
==== GetSdCardMountStatusChangedEvent ====<br />
No input, returns an output Event handle with EventClearMode=0.<br />
<br />
==== GetGameCardUpdateDetectionEvent ====<br />
No input, returns an output Event handle with EventClearMode=0.<br />
<br />
==== DisableApplicationAutoDelete ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== EnableApplicationAutoDelete ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== SetApplicationTerminateResult ====<br />
Takes an input u32 Result, an [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== ClearApplicationTerminateResult ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== GetLastSdCardMountUnexpectedResult ====<br />
No input/output.<br />
<br />
==== GetRequestServerStopper ====<br />
No input, returns an output [[#IRequestServerStopper]].<br />
<br />
==== CancelApplicationApplyDelta ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== ResumeApplicationApplyDelta ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== CalculateApplicationApplyDeltaRequiredSize ====<br />
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output s64.<br />
<br />
==== ResumeAll ====<br />
No input/output.<br />
<br />
==== GetStorageSize ====<br />
Takes an input u8 [[NCM_services#StorageId|StorageId]], returns two output s64s.<br />
<br />
This temporarily mounts the [[Filesystem_services#OpenContentStorageFileSystem|ContentStorage]] specified by the StorageId (must be BuiltInUser or SdCard). The two output s64s are the output from [[Filesystem_services#GetTotalSpaceSize|GetTotalSpaceSize]] and [[Filesystem_services#GetFreeSpaceSize|GetFreeSpaceSize]] with this ContentStorage, with it this being unmounted afterwards.<br />
<br />
==== RequestUpdateApplication2 ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== LaunchApplication ====<br />
Takes an input u8 ProgramIndex, an input [[#ApplicationLaunchInfo]], returns an output u64.<br />
<br />
==== GetApplicationLaunchInfo ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationLaunchInfo]].<br />
<br />
==== AcquireApplicationLaunchInfo ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationLaunchInfo]].<br />
<br />
This verifies that a state flag is set and that a state field matches the input ApplicationId, throwing an error otherwise. The [[#ApplicationLaunchInfo]] from state is copied to output, then the state flag is cleared.<br />
<br />
==== LaunchDevMenu ====<br />
No input/output.<br />
<br />
This is used by AM cmd [[Applet_Manager_services#LaunchDevMenu|LaunchDevMenu]].<br />
<br />
This loads ProgramIds from [[System_Settings|system-settings]] <code>ns.applet!devmenu_id</code> and <code>ns.applet!devoverlaydisp_id</code>, which only exists on devunits. An error is thrown if loading these fail.<br />
<br />
[[NCM_services#ncm|OpenContentMetaDatabase]] is used with StorageId = NandSystem, then IContentMetaDatabase GetLatestContentMetaKey is used with both of the above ProgramIds to verify that the cmd is successful.<br />
<br />
Then if the above succeeds, the above titles are launched with the above StorageId via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0), with a 0.5s sleep-thread afterwards on success. [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0xB is used here.<br />
<br />
==== DeleteUserSaveDataAll ====<br />
Takes an input [[Account_services#Uid|Uid]], returns an output [[#IProgressMonitorForDeleteUserSaveDataAll]].<br />
<br />
On success, [[#IProgressMonitorForDeleteUserSaveDataAll]] GetProgress is used with the output being copied into object state.<br />
<br />
==== DeleteUserSystemSaveData ====<br />
Takes an input [[Account_services#Uid|Uid]], an u64 SystemSaveDataId, no output.<br />
<br />
==== DeleteSaveData ====<br />
Takes an input u8 [[Filesystem_services#SaveDataSpaceId|SaveDataSpaceId]], an u64 SaveDataId, no output.<br />
<br />
==== UnregisterNetworkServiceAccount ====<br />
Takes an input [[Account_services#Uid|Uid]], no output.<br />
<br />
==== UnregisterNetworkServiceAccountWithUserSaveDataDeletion ====<br />
Takes an input [[Account_services#Uid|Uid]], no output.<br />
<br />
==== LaunchLibraryApplet ====<br />
Takes an input u64 [[NCM_services#ProgramId|ProgramId]], returns an output u64.<br />
<br />
The specified program is launched with StorageId=BuiltInSystem via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0). [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0x9 is used here. The output u64 from here is written to the output for this cmd, on success.<br />
<br />
This is used by [[Applet_Manager_services|AM]].<br />
<br />
==== LaunchSystemApplet ====<br />
No input, returns an output u64.<br />
<br />
A state flag must be zero, otherwise an error is thrown. When a state field is value 1, a hard-coded ProgramId for MaintenanceMenu is used. Otherwise, the ProgramId is loaded from [[System_Settings|system-setting]] <code>ns.applet!system_applet_id</code>.<br />
<br />
The SystemApplet is launched with StorageId=BuiltInSystem via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0). [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0x9 is used here. The output u64 from here is written to the output for this cmd, on success.<br />
<br />
This is used by [[Applet_Manager_services|AM]].<br />
<br />
==== LaunchOverlayApplet ====<br />
No input, returns an output u64.<br />
<br />
A state flag must be zero, otherwise an error is thrown. The ProgramId is loaded from [[System_Settings|system-setting]] <code>ns.applet!overlay_applet_id</code>.<br />
<br />
The OverlayApplet is launched with StorageId=BuiltInSystem via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0). [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0x9 is used here. The output u64 from here is written to the output for this cmd, on success.<br />
<br />
This is used by [[Applet_Manager_services|AM]].<br />
<br />
==== RequestDownloadApplicationControlData ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== ListApplicationTitle ====<br />
Takes an input TransferMemory handle, a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], an u8 [[#ApplicationControlSource]], an u64 size, returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
[[qlaunch]] uses value 0x1 for the u8.<br />
<br />
The user-process creates the TransferMemory with permissions=R--.<br />
<br />
The data available with [[#IAsyncValue]] Get is a s32 for the offset within the TransferMemory where the output data is located, GetSize returns the total byte-size of the data located here. The data located here is the [[NACP_Format|NACP]] title-entry for each specified ApplicationId.<br />
<br />
The TransferMemory size must be at least: count*sizeof([[NACP_Format|title-entry]]) + count*sizeof(u64) + count*[[#GetApplicationControlData|0x24000]].<br />
<br />
This is essentially an async wrapper for [[#GetApplicationControlData]], with support for multiple ApplicationIds.<br />
<br />
==== ListApplicationIcon ====<br />
Takes an input TransferMemory handle, a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], an u8 [[#ApplicationControlSource]], an u64 size, returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
The user-process creates the TransferMemory with permissions=R--.<br />
<br />
The data available with [[#IAsyncValue]] Get is a s32 for the offset within the TransferMemory where the output data is located, GetSize returns the total byte-size of the data located here. This data is: an u64 for total entries, an array of u64s for each icon size, then the icon JPEGs for the specified ApplicationIds.<br />
<br />
The TransferMemory size must be at least: 0x4 + count*sizeof(u64) + count*[[#GetApplicationControlData|0x20000]] + count*sizeof(u64) + [[#GetApplicationControlData|0x24000]].<br />
<br />
This is essentially an async wrapper for [[#GetApplicationControlData]], with support for multiple ApplicationIds.<br />
<br />
==== RequestCheckGameCardRegistration ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== RequestGameCardRegistrationGoldPoint ====<br />
Takes an input [[Account_services#Uid|Uid]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
The data that can be read from the [[#IAsyncValue]] is 4-bytes.<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== RequestRegisterGameCard ====<br />
Takes an input s32, an [[Account_services#Uid|Uid]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== GetGameCardMountFailureEvent ====<br />
No input, returns an output Event handle with EventClearMode=0.<br />
<br />
==== IsGameCardInserted ====<br />
No input, returns an output u8 bool.<br />
<br />
==== EnsureGameCardAccess ====<br />
No input/output.<br />
<br />
==== GetLastGameCardMountFailureResult ====<br />
No input/output.<br />
<br />
==== ListApplicationIdOnGameCard ====<br />
Takes a type-0x6 output buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], returns an output s32 for total output entries.<br />
<br />
==== GetGameCardPlatformRegion ====<br />
No input, returns an u8 '''GameCardPlatformRegion''' (0x00 = Global, 0x01 = China).<br />
<br />
This calls [[Filesystem_services#IDeviceOperator|fsp-srv IDeviceOperator]] GetGameCardCompatibilityType and returns the result.<br />
<br />
==== ListAvailableAddOnContent ====<br />
[10.0.0+] This now takes a total of 0x10-bytes of input instead of a total of 0x18-bytes of input.<br />
<br />
==== RequestDownloadTaskListData ====<br />
No input, returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
==== TouchApplication ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== IsApplicationUpdateRequested ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool and an u32.<br />
<br />
The output u32 is only valid when the output bool is set.<br />
<br />
==== WithdrawApplicationUpdateRequest ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== RequestVerifyApplicationDeprecated ====<br />
Takes an input TransferMemory handle, an [[NCM_services#ApplicationId|ApplicationId]], an u64 size, returns an output Event handle and an [[#IProgressAsyncResult]].<br />
<br />
On newer system-versions this calls the same func as [[#RequestVerifyApplication]], with the u32 value set to 0x7.<br />
<br />
==== RequestVerifyAddOnContentsRights ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IProgressAsyncResult]].<br />
<br />
==== RequestVerifyApplication ====<br />
Takes an input TransferMemory handle, an u32, an [[NCM_services#ApplicationId|ApplicationId]], an u64 size, returns an output Event handle and an [[#IProgressAsyncResult]].<br />
<br />
Official sw creates the TransferMemory with an user-specified buffer with permissions=0. [[qlaunch]] uses buffer size 0x100000.<br />
<br />
Official sw has an additional wrapper func which calls the original wrapper func, this uses value 0x7 for the u32. This is the same func used by [[qlaunch]].<br />
<br />
==== IsAnyApplicationEntityInstalled ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool.<br />
<br />
==== CleanupUnavailableAddOnContents ====<br />
Takes an input u64 [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]], no output.<br />
<br />
==== FormatSdCard ====<br />
No input/output.<br />
<br />
==== NeedsSystemUpdateToFormatSdCard ====<br />
No input, returns an output u8 bool.<br />
<br />
==== GetLastSdCardFormatUnexpectedResult ====<br />
No input/output.<br />
<br />
==== GetApplicationView ====<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationView]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], no output.<br />
<br />
==== GetApplicationViewDownloadErrorContext ====<br />
Takes a type-0x16 output buffer containg an [[Error_Applet#ErrorContext|ErrorContext]], an u64 [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== GetApplicationViewWithPromotionInfo ====<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationViewWithPromotionInfo]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], no output.<br />
<br />
==== RequestDownloadApplicationPrepurchasedRights ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== GetSystemDeliveryInfo ====<br />
Takes a type-0x16 output buffer containing a [[#SystemDeliveryInfo]], no output.<br />
<br />
This generates a [[#SystemDeliveryInfo]] using the currently installed SystemUpdate meta title.<br />
<br />
==== SelectLatestSystemDeliveryInfo ====<br />
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], and returns an output s32.<br />
<br />
This determines the latest version from the input [[#ApplicationDeliveryInfo]] array, using value 0 if the array is empty. If this value is less than a state field, the state field value is used instead. Then this selects a [[#SystemDeliveryInfo]] with the latest version from the input array, where the minimum version is the previously mentioned value. The version must also be also be at least the version value from the type-0x15 [[#SystemDeliveryInfo]] buffer. This also does various validation, etc. The output s32 is an index in that array for the selected entry, -1 if none found.<br />
<br />
==== VerifyDeliveryProtocolVersion ====<br />
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], no output.<br />
<br />
This validates the [[#SystemDeliveryInfo]] HMAC and the protocol-version fields. Then the meta version is compared with a state field, an error is returned on match otherwise 0 is returned.<br />
<br />
==== GetApplicationDeliveryInfo ====<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationDeliveryInfo]], an input u32 bitmask <code>nn::ns::ApplicationDeliveryAttributeTag</code>, an [[NCM_services#ApplicationId|ApplicationId]], and returns an output s32 total_out.<br />
<br />
An error is thrown if any bit is set in ApplicationDeliveryAttributeTag besides bit1. The output array-count must be at least 1: only 1 entry will be written to this array (hence on success total_out will also only be 1 on success).<br />
<br />
==== HasAllContentsToDeliver ====<br />
Takes a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output u8 bool.<br />
<br />
The array-count must match 1. After validating the [[#ApplicationDeliveryInfo]], the output bool is set to u32 [[#ApplicationDeliveryInfo]]+0x1C & 0x10000002 != 0x2, then this returns 0.<br />
<br />
==== CompareApplicationDeliveryInfo ====<br />
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output s32.<br />
<br />
The array-count for both buffers must be 1, otherwise an error is returned.<br />
<br />
Both [[#ApplicationDeliveryInfo]] are validated, then the application-version in the first/second buffer are compared. The output s32 is set to the comparison result: -1 for less than, 0 for equal, and 1 for higher than.<br />
<br />
==== CanDeliverApplication ====<br />
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output u8 bool.<br />
<br />
The array-count for the second buffer must be 1 and the array-count for the first buffer must be <=1, otherwise an error is returned. If the array-count for the first buffer is 0, this will return 0 with the output bool set to 0.<br />
<br />
==== ListContentMetaKeyToDeliverApplication ====<br />
Takes a type-0x6 output buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], a s32, and returns an output s32 total_out.<br />
<br />
The array-count for ContentMetaKey must be at least 1, and for ApplicationDeliveryInfo it must match 1.<br />
<br />
This will only return 1 ContentMetaKey entry. This will not output the entry when the input s32 is larger than 0. This also does other validation, etc.<br />
<br />
==== NeedsSystemUpdateToDeliverApplication ====<br />
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], and returns an output u8 bool.<br />
<br />
The array-count must match 1.<br />
<br />
After validation etc, this sets the output bool by comparing system-version fields in the [[#SystemDeliveryInfo]]/[[#ApplicationDeliveryInfo]] and with a state field.<br />
<br />
==== EstimateRequiredSize ====<br />
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], returns an output s64.<br />
<br />
When the array-count is less than 1, this will return 0 with the s64 set to 0.<br />
<br />
==== RequestReceiveApplication ====<br />
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], a [[NCM_services#StorageId|StorageId]], an u16 port, an u32 Ipv4Address, an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
[[qlaunch]] uses value Any for the StorageId, and value 55556 for the port.<br />
<br />
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.<br />
<br />
This loops through the input [[NCM_services#ContentMetaKey|ContentMetaKey]] array, throwing an error if the [[NCM_services#ContentMetaType|ContentMetaType]] doesn't match Patch. The input array is copied into state which is used later by the thread for [[NIM_services|nim]] cmd53, max entries is 0x12.<br />
<br />
This does various setup then creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:<br />
<br />
* Calls a func which does:<br />
** Throws an error if a state flag is set.<br />
** Uses [[NIM_services|nim]] cmd53, returning the Result on failure.<br />
** Uses [[NIM_services|nim]] cmd56, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.<br />
** Handles cleanup and returns.<br />
* On success, this loads various data which is then used for saving a SystemPlayReport when the cached [[System_Settings|system-setting]] "systemreport!enabled" is set.<br />
** The EventId is "receive_app_contents" with ApplicationId <NS ProgramId>.<br />
<br />
==== CommitReceiveApplication ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== GetReceiveApplicationProgress ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ReceiveApplicationProgress]].<br />
<br />
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.<br />
<br />
Uses [[NIM_services|nim]] cmd67, throwing an error if no task is returned. Then [[NIM_services|nim]] cmd57 is used, returning the error from there on failure. Lastly, this writes the 0x10-bytes from output+8 from the latter cmd to the output [[#ReceiveApplicationProgress]], and returns 0.<br />
<br />
==== RequestSendApplication ====<br />
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], an u16 port, an u32 Ipv4Address, an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
[[qlaunch]] uses value 55556 for the port.<br />
<br />
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.<br />
<br />
The [[NCM_services#ContentMetaType|ContentMetaType]] must match Patch.<br />
<br />
This does various setup and selects a ContentMetaKey to use from the input, then creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:<br />
<br />
* Calls a func which does:<br />
** Throws an error if a state flag is set.<br />
** Uses [[NIM_services|nim]] cmd60, returning the Result on failure.<br />
** Uses [[NIM_services|nim]] cmd61, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.<br />
** Handles cleanup and returns.<br />
* On success, this loads various data which is then used for saving a SystemPlayReport when the cached [[System_Settings|system-setting]] "systemreport!enabled" is set.<br />
** The EventId is "send_app_contents" with ApplicationId <NS ProgramId>.<br />
<br />
==== GetSendApplicationProgress ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#SendApplicationProgress]].<br />
<br />
Same as [[#GetReceiveApplicationProgress]] except this is the Send version, and uses [[NIM_services|nim]] cmd68/cmd63 instead.<br />
<br />
==== CompareSystemDeliveryInfo ====<br />
Takes two type-0x15 input buffers containing a [[#SystemDeliveryInfo]], returns an output s32.<br />
<br />
This is essentially the same as [[#CompareApplicationDeliveryInfo]], except this compares the [[#SystemDeliveryInfo]] SystemUpdate version.<br />
<br />
==== ListNotCommittedContentMeta ====<br />
Takes a type-0x6 output buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], a s32, an [[NCM_services#ApplicationId|ApplicationId]], returns an output s32 total_out.<br />
<br />
==== RecoverDownloadTask ====<br />
Takes a type-0x5 input buffer containing an array of {unknown} and an input u64, no output.<br />
<br />
==== GetApplicationDeliveryInfoHash ====<br />
Takes a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output 0x20-byte SHA256 hash.<br />
<br />
This extracts data from the input array for hashing with SHA256, with validation being done when handling each entry.<br />
<br />
==== GetApplicationRightsOnClient ====<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationRightsOnClient]], an input u32 flags, an [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]], returns 4-bytes of output for total output entries.<br />
<br />
Official sw has at least two wrappers which use this cmd: one with an all-zero Uid, one with an user-specified Uid. With both of these, the passed flags are hard-coded to value 0x3.<br />
<br />
For the output array count, [[qlaunch]] uses value 3.<br />
<br />
==== GetApplicationTerminateResult ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u32 Result.<br />
<br />
==== GetRightsEnvironmentHandleForApplication ====<br />
No input, returns a total of 8-bytes of output.<br />
<br />
[9.0.0+] Now takes a total of 8-bytes of input, returns a total of 8-bytes of output.<br />
<br />
==== RequestNoDownloadRightsErrorResolution ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== RequestResolveNoDownloadRightsError ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== GetPromotionInfo ====<br />
Takes a type-0x6 output buffer containing an array of [[#PromotionInfo]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], a type-0x5 input buffer containing an array of [[Account_services#Uid|Uids]], no output.<br />
<br />
Official sw uses hard-coded value 1 for the count with each of these arrays.<br />
<br />
==== ImportPromotionJsonForDebug ====<br />
Takes a type-0x5 input buffer, no output.<br />
<br />
The output from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.<br />
<br />
==== ClearPromotionInfoForDebug ====<br />
No input/output.<br />
<br />
The output from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.<br />
<br />
This just clears 0xC-bytes in state.<br />
<br />
==== CreateApplicationResource ====<br />
Returns an [[#IApplicationResource]].<br />
<br />
==== GetApplicationResource ====<br />
Returns an [[#IApplicationResource]].<br />
<br />
=== IGameCardStopper ===<br />
This is "nn::ns::detail::IGameCardStopper".<br />
<br />
This interface has no commands.<br />
<br />
=== IRequestServerStopper ===<br />
This is "nn::ns::detail::IRequestServerStopper".<br />
<br />
This interface has no commands.<br />
<br />
=== IProgressMonitorForDeleteUserSaveDataAll ===<br />
This is "nn::ns::detail::IProgressMonitorForDeleteUserSaveDataAll".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetSystemEvent<br />
|-<br />
| 1 || IsFinished<br />
|-<br />
| 2 || GetResult<br />
|-<br />
| 10 || GetProgress<br />
|}<br />
<br />
When closing the object, official sw uses IsFinished first, asserting when the output bool is false.<br />
<br />
* GetSystemEvent: No input, returns an output Event handle. [[qlaunch]] doesn't use this.<br />
<br />
* IsFinished: No input, returns an output u8 bool.<br />
<br />
* GetResult: No input/output.<br />
<br />
* GetProgress: No input, returns an output [[#ProgressForDeleteUserSaveDataAll]]. Official sw writes this struct directly to object state.<br />
<br />
=== IProgressAsyncResult ===<br />
This is "nn::ns::detail::IProgressAsyncResult".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Get<br />
|-<br />
| 1 || Cancel<br />
|-<br />
| 2 || GetProgress<br />
|-<br />
| 3 || GetDetailResult<br />
|-<br />
| 4 || [4.0.0+] GetErrorContext<br />
|}<br />
<br />
=== IApplicationVersionInterface ===<br />
This is "nn::ns::detail::IApplicationVersionInterface".<br />
<br />
This was added with [4.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetLaunchRequiredVersion<br />
|-<br />
| 1 || UpgradeLaunchRequiredVersion<br />
|-<br />
| 35 || UpdateVersionList<br />
|-<br />
| 36 || PushLaunchVersion<br />
|-<br />
| 37 || ListRequiredVersion<br />
|-<br />
| 800 || RequestVersionList<br />
|-<br />
| 801 || ListVersionList<br />
|-<br />
| 802 || [[#RequestVersionListData]]<br />
|-<br />
| 1000 || PerformAutoUpdate<br />
|-<br />
| 1001 || [11.0.0+] ListAutoUpdateSchedule<br />
|}<br />
<br />
==== RequestVersionListData ====<br />
No input, returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
The data that can be read from the [[#IAsyncValue]] is [[#VersionListData]].<br />
<br />
=== IContentManagementInterface ===<br />
This is "nn::ns::detail::IContentManagementInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 11 || [[#CalculateApplicationOccupiedSize]]<br />
|-<br />
| 43 || [[#CheckSdCardMountStatus]]<br />
|-<br />
| 47 || [[#GetTotalSpaceSize]]<br />
|-<br />
| 48 || [[#GetFreeSpaceSize]]<br />
|-<br />
| 600 || [[#CountApplicationContentMeta]]<br />
|-<br />
| 601 || [[#ListApplicationContentMetaStatus]]<br />
|-<br />
| 605 || [[#ListApplicationContentMetaStatusWithRightsCheck]]<br />
|-<br />
| 607 || [[#IsAnyApplicationRunning]]<br />
|}<br />
<br />
==== CalculateApplicationOccupiedSize ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationOccupiedSize]].<br />
<br />
==== CheckSdCardMountStatus ====<br />
No input/output.<br />
<br />
==== CountApplicationContentMeta ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output s32.<br />
<br />
==== ListApplicationContentMetaStatusWithRightsCheck ====<br />
Same input/output as [[#ListApplicationContentMetaStatus]].<br />
<br />
==== IsAnyApplicationRunning ====<br />
No input, returns an output u8 bool.<br />
<br />
=== IDocumentInterface ===<br />
This is "nn::ns::detail::IDocumentInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 21 || GetApplicationContentPath<br />
|-<br />
| 23 || ResolveApplicationContentPath<br />
|-<br />
| 92 || [5.0.0+] GetRunningApplicationProgramId<br />
|}<br />
<br />
=== IDownloadTaskInterface ===<br />
This is "nn::ns::detail::IDownloadTaskInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 701 || [[#ClearTaskStatusList]]<br />
|-<br />
| 702 || [[#RequestDownloadTaskList]]<br />
|-<br />
| 703 || [[#RequestEnsureDownloadTask]]<br />
|-<br />
| 704 || [[#ListDownloadTaskStatus]]<br />
|-<br />
| 705 || [[#RequestDownloadTaskListData]]<br />
|-<br />
| 706 || [4.0.0+] [[#TryCommitCurrentApplicationDownloadTask]]<br />
|-<br />
| 707 || [4.0.0+] [[#EnableAutoCommit]]<br />
|-<br />
| 708 || [4.0.0+] [[#DisableAutoCommit]]<br />
|-<br />
| 709 || [4.0.0+] [[#TriggerDynamicCommitEvent]]<br />
|}<br />
<br />
==== ClearTaskStatusList ====<br />
No input/output.<br />
<br />
==== RequestDownloadTaskList ====<br />
No input/output.<br />
<br />
==== RequestEnsureDownloadTask ====<br />
No input, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== ListDownloadTaskStatus ====<br />
Takes a type-0x6 output buffer containing an array of [[#DownloadTaskStatus]], returns an output s32 total_out.<br />
<br />
A maximum of 0x100 tasks can be stored in state.<br />
<br />
==== TryCommitCurrentApplicationDownloadTask ====<br />
No input/output.<br />
<br />
==== EnableAutoCommit ====<br />
No input/output.<br />
<br />
==== DisableAutoCommit ====<br />
No input/output.<br />
<br />
==== TriggerDynamicCommitEvent ====<br />
No input/output.<br />
<br />
=== IReadOnlyApplicationRecordInterface ===<br />
This is "nn::ns::detail::IReadOnlyApplicationRecordInterface".<br />
<br />
This was added with [5.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || HasApplicationRecord || Same as [[#IApplicationManagerInterface]] cmd 910<br />
|-<br />
| 1 || [10.0.0+] NotifyApplicationFailure ||<br />
|-<br />
| 2 || [10.0.0+] IsDataCorruptedResult ||<br />
|}<br />
<br />
=== IReadOnlyApplicationControlDataInterface ===<br />
This is "nn::ns::detail::IReadOnlyApplicationControlDataInterface".<br />
<br />
This was added with [5.1.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || [[#GetApplicationControlData]] || Same as [[#IApplicationManagerInterface]] cmd 400<br />
|-<br />
| 1 || [[#GetApplicationDesiredLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 55<br />
|-<br />
| 2 || ConvertApplicationLanguageToLanguageCode || Same as [[#IApplicationManagerInterface]] cmd 59<br />
|-<br />
| 3 || [[#ConvertLanguageCodeToApplicationLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 60<br />
|-<br />
| 4 || [9.0.0+] SelectApplicationDesiredLanguage ||<br />
|}<br />
<br />
=== IDynamicRightsInterface ===<br />
This is "nn::ns::detail::IDynamicRightsInterface".<br />
<br />
This was added with [6.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#RequestApplicationRightsOnServer]]<br />
|-<br />
| 1 || [[#RequestAssignRights]]<br />
|-<br />
| 4 || [[#DeprecatedRequestAssignRightsToResume]]<br />
|-<br />
| 5 || [[#VerifyActivatedRightsOwners]]<br />
|-<br />
| 6 || [[#DeprecatedGetApplicationRightsStatus]]<br />
|-<br />
| 7 || [[#RequestPrefetchForDynamicRights]]<br />
|-<br />
| 8 || [[#GetDynamicRightsState]]<br />
|-<br />
| 9 || [7.0.0+] [[#RequestApplicationRightsOnServerToResume]]<br />
|-<br />
| 10 || [7.0.0+] [[#RequestAssignRightsToResume]]<br />
|-<br />
| 11 || [7.0.0+] [[#GetActivatedRightsUsers]]<br />
|-<br />
| 12 || [8.0.0+] [[#GetApplicationRightsStatus]]<br />
|-<br />
| 13 || [8.0.0+] [[#GetRunningApplicationStatus]]<br />
|-<br />
| 14 || [10.0.0+] SelectApplicationLicense<br />
|}<br />
<br />
==== RequestApplicationRightsOnServer ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]] and an u32. Returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
==== RequestAssignRights ====<br />
Takes a type-0x5 input buffer containing an array of "nn::ns::ApplicationRightsOnServer". Returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== DeprecatedRequestAssignRightsToResume ====<br />
Takes an input u64 "nn::ns::RightsEnvironmentHandle" and an [[Account_services#Uid|Uid]]. Returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== VerifyActivatedRightsOwners ====<br />
Takes an input u64 "nn::ns::RightsEnvironmentHandle". No output.<br />
<br />
==== DeprecatedGetApplicationRightsStatus ====<br />
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns a bool "nn::ns::ApplicationRightsStatus".<br />
<br />
==== RequestPrefetchForDynamicRights ====<br />
Takes an input [[Account_services#Uid|Uid]]. Returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== GetDynamicRightsState ====<br />
No input. Returns a bool "nn::ns::DynamicRightsState".<br />
<br />
==== RequestApplicationRightsOnServerToResume ====<br />
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
==== RequestAssignRightsToResume ====<br />
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== GetActivatedRightsUsers ====<br />
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns a bool, an u32 and a type-0x6 output buffer containing an array of [[Account_services#Uid|Uid]].<br />
<br />
==== GetApplicationRightsStatus ====<br />
Takes an input "nn::ns::RightsEnvironmentHandle". Returns 2 bools "nn::ns::ApplicationRightsStatus" and "nn::ns::ApplicationLicenseType".<br />
<br />
==== GetRunningApplicationStatus ====<br />
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an u32 "nn::ns::RunningApplicationStatus".<br />
<br />
=== IECommerceInterface===<br />
This is "nn::ns::detail::IECommerceInterface".<br />
<br />
This was added with [4.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#RequestLinkDevice]]<br />
|-<br />
| 1 || [6.0.0+] [[#RequestCleanupAllPreInstalledApplications]]<br />
|-<br />
| 2 || [6.0.0+] [[#RequestCleanupPreInstalledApplication]]<br />
|-<br />
| 3 || [6.0.0+] [[#RequestSyncRights]]<br />
|-<br />
| 4 || [6.0.0+] [[#RequestUnlinkDevice]]<br />
|-<br />
| 5 || [6.1.0+] [[#RequestRevokeAllELicense]]<br />
|-<br />
| 6 || [9.0.0+] [[#RequestSyncRightsBasedOnAssignedELicenses]]<br />
|}<br />
<br />
==== RequestLinkDevice ====<br />
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== RequestCleanupAllPreInstalledApplications ====<br />
No input, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== RequestCleanupPreInstalledApplication ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== RequestSyncRights ====<br />
No input, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== RequestUnlinkDevice ====<br />
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== RequestRevokeAllELicense ====<br />
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== RequestSyncRightsBasedOnAssignedELicenses ====<br />
No input, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
=== IFactoryResetInterface ===<br />
This is "nn::ns::detail::IFactoryResetInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 100 || [[#ResetToFactorySettings]]<br />
|-<br />
| 101 || [[#ResetToFactorySettingsWithoutUserSaveData]]<br />
|-<br />
| 102 || [[#ResetToFactorySettingsForRefurbishment]]<br />
|-<br />
| 103 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegion]]<br />
|-<br />
| 104 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegionAuthentication]]<br />
|-<br />
| 105 || [10.0.0+] [[#RequestResetToFactorySettingsSecurely]]<br />
|-<br />
| 106 || [10.0.0+] [[#RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely]]<br />
|}<br />
<br />
==== ResetToFactorySettings ====<br />
No input/output.<br />
<br />
As of [9.1.0] this is the only [[#IFactoryResetInterface]] cmd used by [[qlaunch]].<br />
<br />
==== ResetToFactorySettingsWithoutUserSaveData ====<br />
No input/output.<br />
<br />
==== ResetToFactorySettingsForRefurbishment ====<br />
No input/output.<br />
<br />
==== ResetToFactorySettingsWithPlatformRegion ====<br />
No input/output.<br />
<br />
==== ResetToFactorySettingsWithPlatformRegionAuthentication ====<br />
No input/output.<br />
<br />
==== RequestResetToFactorySettingsSecurely ====<br />
Takes a total of 8-bytes of input, a handle, returns an output [[#IAsyncValueAndProgress]] and a handle.<br />
<br />
==== RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely ====<br />
Takes a total of 0x10-bytes of input, a handle, returns an output [[#IAsyncValueAndProgress]] and a handle.<br />
<br />
===== IAsyncValueAndProgress =====<br />
This is "nn::ns::detail::IAsyncValueAndProgress".<br />
<br />
This was added with [10.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetSize<br />
|-<br />
| 1 || Get<br />
|-<br />
| 2 || Cancel<br />
|-<br />
| 3 || GetErrorContext<br />
|-<br />
| 4 || GetProgress<br />
|}<br />
<br />
=== IApplicationResource ===<br />
This is "nn::ns::detail::IApplicationResource".<br />
<br />
This was added with [9.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Attach<br />
|-<br />
| 1 || BoostSystemMemoryResourceLimit<br />
|}<br />
<br />
= ns:vm =<br />
This is "nn::ns::detail::IVulnerabilityManagerInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1200 || [3.0.0+] [[#NeedsUpdateVulnerability]]<br />
|-<br />
| 1201 || [4.0.0+] [[#UpdateSafeSystemVersionForDebug]]<br />
|-<br />
| 1202 || [4.0.0+] [[#GetSafeSystemVersion]]<br />
|}<br />
<br />
== NeedsUpdateVulnerability ==<br />
No input, returns an output u8 bool flag.<br />
<br />
Web-applets use this command to check if the system needs an update.<br />
<br />
== UpdateSafeSystemVersionForDebug ==<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]] and an u32 '''version'''.<br />
<br />
This command is not available for retail units. On a debug unit, if the [[System_Settings|system setting]] <code>vulnerability!enable_debug</code> is set, this mounts the system savegame [[Flash_Filesystem#System_Savegames|0x8000000000000049]] as "ns_ssversion:/", opens the file "ns_ssversion:/entry" and writes the supplied [[NCM_services#ApplicationId|ApplicationId]] and '''version''' in it.<br />
<br />
Finally, it calls [[NCM_services#ncm|OpenContentMetaDatabase]] with [[NCM_services#StorageId|StorageId]] 3, then calls [[NCM_services#IContentMetaDatabase|GetLatestContentMetaKey]] with the supplied [[NCM_services#ApplicationId|ApplicationId]] and compares the version field from the returned [[CNMT#Content_Meta_Records|Content Meta Record]] with the supplied '''version'''.<br />
<br />
If the supplied '''version''' is higher than the one in NCM's database, the value returned by [[NS_Services#NeedsUpdateVulnerability|NeedsUpdateVulnerability]] is set to "true".<br />
<br />
== GetSafeSystemVersion ==<br />
No input, returns an output [[NCM_services#ContentMetaKey|ContentMetaKey]] with the cached contents of "ns_ssversion:/entry" ([[NCM_services#ApplicationId|ApplicationId]], u32 '''version''' and u32 '''policy''' from <code>vulnerability!needs_update_vulnerability_policy</code>).<br />
<br />
= ns:su =<br />
This is "nn::ns::detail::ISystemUpdateInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#GetBackgroundNetworkUpdateState]]<br />
|-<br />
| 1 || [[#OpenSystemUpdateControl]]<br />
|-<br />
| 2 || [[#NotifyExFatDriverRequired]]<br />
|-<br />
| 3 || [[#ClearExFatDriverStatusForDebug]]<br />
|-<br />
| 4 || [[#RequestBackgroundNetworkUpdate]]<br />
|-<br />
| 5 || [[#NotifyBackgroundNetworkUpdate]]<br />
|-<br />
| 6 || [[#NotifyExFatDriverDownloadedForDebug]]<br />
|-<br />
| 9 || [[#GetSystemUpdateNotificationEventForContentDelivery]]<br />
|-<br />
| 10 || [[#NotifySystemUpdateForContentDelivery]]<br />
|-<br />
| 11 || [3.0.0+] [[#PrepareShutdown]]<br />
|-<br />
| 12 || [3.0.0-3.0.2]<br />
|-<br />
| 13 || [3.0.0-3.0.2]<br />
|-<br />
| 14 || [3.0.0-3.0.2]<br />
|-<br />
| 15 || [3.0.0-3.0.2]<br />
|-<br />
| 16 || [4.0.0+] [[#DestroySystemUpdateTask]]<br />
|-<br />
| 17 || [4.0.0+] [[#RequestSendSystemUpdate]]<br />
|-<br />
| 18 || [4.0.0+] [[#GetSendSystemUpdateProgress]]<br />
|}<br />
<br />
== GetBackgroundNetworkUpdateState ==<br />
No input, returns an output [[#BackgroundNetworkUpdateState]].<br />
<br />
This is similar to [[#HasDownloaded]], see [[#BackgroundNetworkUpdateState]].<br />
<br />
== OpenSystemUpdateControl ==<br />
No input, returns an [[#ISystemUpdateControl]].<br />
<br />
== NotifyExFatDriverRequired ==<br />
No input/output.<br />
<br />
Only usable when an [[#ISystemUpdateControl]] isn't open.<br />
<br />
This uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.<br />
<br />
Then this runs ExFat handling, updates state, and sets the same state flag as [[#RequestBackgroundNetworkUpdate]].<br />
<br />
== ClearExFatDriverStatusForDebug ==<br />
No input/output.<br />
<br />
== RequestBackgroundNetworkUpdate ==<br />
No input/output.<br />
<br />
Only usable when an [[#ISystemUpdateControl]] isn't open.<br />
<br />
This sets a state flag to value 1.<br />
<br />
== NotifyBackgroundNetworkUpdate ==<br />
Takes an input [[NCM_services#ContentMetaKey|ContentMetaKey]], no output.<br />
<br />
This checks whether a sysupdate is needed with the input ContentMetaKey using [[NCM_services|NCM]] commands, if not this will just return 0. Otherwise, this will then run code which is identical to [[#RequestBackgroundNetworkUpdate]].<br />
<br />
== NotifyExFatDriverDownloadedForDebug ==<br />
No input/output.<br />
<br />
== GetSystemUpdateNotificationEventForContentDelivery ==<br />
No input, returns an output Event handle with EventClearMode=0.<br />
<br />
== NotifySystemUpdateForContentDelivery ==<br />
No input/output.<br />
<br />
Signals the Event returned by [[#GetSystemUpdateNotificationEventForContentDelivery]].<br />
<br />
== PrepareShutdown ==<br />
No input/output.<br />
<br />
This is used by [[AM_services|AM]].<br />
<br />
Just returns 0 when an [[#ISystemUpdateControl]] is open. <br />
<br />
This does various cleanup / uses various service-cmds etc for shutdown preparation.<br />
<br />
== DestroySystemUpdateTask ==<br />
No input/output.<br />
<br />
Only usable when an [[#ISystemUpdateControl]] isn't open.<br />
<br />
This uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.<br />
<br />
== RequestSendSystemUpdate ==<br />
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], an u16 port, an u32 Ipv4Address, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
[[qlaunch]] uses value 55556 for the port. IP is normally a local-WLAN address, however this can be any address. port/addr are little-endian.<br />
<br />
[[NIM_services|NIM]] will use the input addr/port with [[Sockets_services|bind()]]. During [[Sockets_services|accept()]] handling the addr from there must match the input addr. Hence, addr must be the client addr. [[NIM_services|NIM]] will also eventually verify that the system is not Internet-connected.<br />
<br />
This validates the [[#SystemDeliveryInfo]] and generates a [[NCM_services#ContentMetaKey|ContentMetaKey]] from that, and creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:<br />
* Calls a func which does:<br />
** Uses [[NIM_services|nim]] cmd76, returning the Result on failure.<br />
** Uses [[NIM_services|nim]] cmd77, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.<br />
** Handles cleanup and returns.<br />
* Unlike [[#RequestReceiveSystemUpdate]], this doesn't save a SystemPlayReport.<br />
<br />
== GetSendSystemUpdateProgress ==<br />
No input, returns an output [[#SystemUpdateProgress]].<br />
<br />
Same as [[#GetReceiveProgress]] except this uses nim cmd81 and cmd78.<br />
<br />
== ISystemUpdateControl ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#HasDownloaded]]<br />
|-<br />
| 1 || [[#RequestCheckLatestUpdate]]<br />
|-<br />
| 2 || [[#RequestDownloadLatestUpdate]]<br />
|-<br />
| 3 || [[#GetDownloadProgress]]<br />
|-<br />
| 4 || [[#ApplyDownloadedUpdate]]<br />
|-<br />
| 5 || [[#RequestPrepareCardUpdate]]<br />
|-<br />
| 6 || [[#GetPrepareCardUpdateProgress]]<br />
|-<br />
| 7 || [[#HasPreparedCardUpdate]]<br />
|-<br />
| 8 || [[#ApplyCardUpdate]]<br />
|-<br />
| 9 || [[#GetDownloadedEulaDataSize]]<br />
|-<br />
| 10 || [[#GetDownloadedEulaData]]<br />
|-<br />
| 11 || [[#SetupCardUpdate]]<br />
|-<br />
| 12 || [[#GetPreparedCardUpdateEulaDataSize]]<br />
|-<br />
| 13 || [[#GetPreparedCardUpdateEulaData]]<br />
|-<br />
| 14 || [4.0.0+] [[#SetupCardUpdateViaSystemUpdater]]<br />
|-<br />
| 15 || [4.0.0+] [[#HasReceived]]<br />
|-<br />
| 16 || [4.0.0+] [[#RequestReceiveSystemUpdate]]<br />
|-<br />
| 17 || [4.0.0+] [[#GetReceiveProgress]]<br />
|-<br />
| 18 || [4.0.0+] [[#ApplyReceivedUpdate]]<br />
|-<br />
| 19 || [4.0.0+] [[#GetReceivedEulaDataSize]]<br />
|-<br />
| 20 || [4.0.0+] [[#GetReceivedEulaData]]<br />
|-<br />
| 21 || [4.0.0+] [[#SetupToReceiveSystemUpdate]]<br />
|-<br />
| 22 || [6.0.0+] [[#RequestCheckLatestUpdateIncludesRebootlessUpdate]]<br />
|}<br />
<br />
Only 1 ISystemUpdateControl can be open at a time.<br />
<br />
All Card cmds except SetupCardUpdate* require [[#SetupCardUpdate]]/[[#SetupCardUpdateViaSystemUpdater]] to be used previously. [[#GetPreparedCardUpdateEulaDataSize]]/[[#GetPreparedCardUpdateEulaData]] checks a different state flag.<br />
<br />
=== HasDownloaded ===<br />
No input, returns an output u8 bool flag.<br />
<br />
Gets whether a network sysupdate was downloaded, with install pending.<br />
<br />
Uses [[NIM_services|nim]] ListSystemUpdateTask and [[NIM_services|nim]] GetSystemUpdateTaskInfo. When ListSystemUpdateTask successfully returns a task and GetSystemUpdateTaskInfo is successful, the output flag is set to: <code>*((u8*)(taskinfo+0) == 0x3</code>. Otherwise, flag=0.<br />
<br />
This always returns 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89.<br />
<br />
=== RequestCheckLatestUpdate ===<br />
No input, returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
The data that can be read from the [[#IAsyncValue]] is [[#LatestSystemUpdate]].<br />
<br />
=== RequestDownloadLatestUpdate ===<br />
No input, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
=== GetDownloadProgress ===<br />
No input, returns an output [[#SystemUpdateProgress]].<br />
<br />
Similar to [[#HasDownloaded]] except instead of a flag, this returns the 0x10-bytes from taskinfo+8. The output struct is cleared when the task(info) isn't available.<br />
<br />
=== ApplyDownloadedUpdate ===<br />
No input/output.<br />
<br />
Runs code similar to [[#HasDownloaded]], throwing an error if a network sysupdate isn't ready for install. Then the sysupdate is installed:<br />
<br />
* Uses ListSystemUpdateTask again, then [[NIM_services|nim]] IsExFatDriverIncluded. Runs ExFat handling when the output flag is set.<br />
* On newer system-versions, this uses [[NIM_services|nim]] GetSystemUpdateTaskInfo then on success uses data from there to save a SystemPlayReport when the cached [[System_Settings|system-setting]] "systemreport!enabled" is set.<br />
** The EventId is "systemupdate_dl_throughput" with ApplicationId 0100000000001018.<br />
** The following fields are added to the report, see [[NIM_services#SystemUpdateTaskInfo|nim SystemUpdateTaskInfo]]: "ContentMetaId", "Version", "DownloadSize", and "ThroughputKBps".<br />
* On newer system-versions, this saves another SystemPlayReport when a state flag is set (same flag mentioned above).<br />
** The EventId is "systemupdate_pass" with ApplicationId 0100000000001021.<br />
** This report has the following fields:<br />
*** "Type"<br />
*** "SourceSystemUpdateMetaId"<br />
*** "SourceSystemUpdateMetaVersion"<br />
*** "SourceExFatStatus"<br />
*** "DestinationSystemUpdateMetaId"<br />
*** "DestinationSystemUpdateMetaVersion"<br />
*** "DestinationExFatStatus"<br />
*** "Rebootless"<br />
* Since FIRM will be installed later, the two flags in [[Flash_Filesystem#System_Update_Control]] are set to 1.<br />
* Uses [[NIM_services|nim]] CommitSystemUpdateTask and [[NIM_services|nim]] DestroySystemUpdateTask.<br />
* Installs FIRM. After installing each FIRM, the associated flag in [[Flash_Filesystem#System_Update_Control]] is set to 0.<br />
* On newer system versions when an input flag is set, this uses [[Filesystem_services|NotifySystemDataUpdateEvent]], however this doesn't happen with ApplyDownloadedUpdate since that input flag is 0.<br />
<br />
=== RequestPrepareCardUpdate ===<br />
No input, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
=== GetPrepareCardUpdateProgress ===<br />
No input, returns an output [[#SystemUpdateProgress]].<br />
<br />
=== HasPreparedCardUpdate ===<br />
No input, returns an output u8 bool flag.<br />
<br />
=== ApplyCardUpdate ===<br />
No input/output.<br />
<br />
=== GetDownloadedEulaDataSize ===<br />
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.<br />
<br />
Runs code similar to [[#HasDownloaded]], throwing an error if a network sysupdate isn't ready for install.<br />
<br />
Uses ListSystemUpdateTask again. Then [[NIM_services|nim]] GetDownloadedSystemDataPath, with the output ContentPath being used to mount the EULA title with FS.<br />
<br />
Then "<mountname>:/<[[#EulaDataPath]]>" is opened, gets the '''filesize''', then runs cleanup.<br />
<br />
=== GetDownloadedEulaData ===<br />
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.<br />
<br />
Similar to [[#GetDownloadedEulaDataSize]] except this reads the file instead, using the specified output buffer with size=filesize. This will throw an error if the filesize is larger than the buffer size.<br />
<br />
=== SetupCardUpdate ===<br />
Takes an input u64 size and a TransferMemory handle, no output.<br />
<br />
Official sw creates the TransferMemory with an user-specified buffer, with permissions=None.<br />
<br />
[[qlaunch]] uses size 0x100000 for the TransferMemory buffer.<br />
<br />
=== GetPreparedCardUpdateEulaDataSize ===<br />
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.<br />
<br />
This is similar to [[#GetDownloadedEulaDataSize]].<br />
<br />
=== GetPreparedCardUpdateEulaData ===<br />
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.<br />
<br />
This is similar to [[#GetDownloadedEulaData]].<br />
<br />
=== SetupCardUpdateViaSystemUpdater ===<br />
Takes an input u64 size and a TransferMemory handle, no output.<br />
<br />
The permissions for the TransferMemory is None.<br />
<br />
Same as [[#SetupCardUpdate]], except this doesn't have the code for [[Filesystem_services|GetGameCardHandle/GetGameCardUpdatePartitionInfo]], and uses [[Filesystem_services|OpenRegisteredUpdatePartition]] instead of [[Filesystem_services|OpenGameCardFileSystem]]. This uses the same is_initialized bool state flag.<br />
<br />
=== HasReceived ===<br />
No input, returns an output u8 bool.<br />
<br />
Same as [[#HasDownloaded]] except this uses [[NIM_services|nim]] cmd71 and cmd73.<br />
<br />
=== RequestReceiveSystemUpdate ===<br />
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], an u16 port, an u32 Ipv4Address, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
[[qlaunch]] uses the same value for the port as [[#RequestSendSystemUpdate]] (see [[#RequestSendSystemUpdate]] for addr as well).<br />
<br />
[[NIM_services|NIM]] will use the input addr/port with [[Sockets_services|connect()]].<br />
<br />
This validates the [[#SystemDeliveryInfo]] and generates a [[NCM_services#ContentMetaKey|ContentMetaKey]] from that, and creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:<br />
<br />
* Calls a func which does:<br />
** Throws an error if [[NIM_services#ListSystemUpdateTask|ListSystemUpdateTask]] returns any task.<br />
** Checks whether a sysupdate is actually required using the previously generated [[NCM_services#ContentMetaKey|ContentMetaKey]], throwing an error if not.<br />
** Uses [[NIM_services|nim]] cmd69, returning the Result on failure.<br />
** Uses [[NIM_services|nim]] cmd72, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.<br />
** Handles cleanup and returns.<br />
* On success, this loads various data which is then used for saving a SystemPlayReport when the cached [[System_Settings|system-setting]] "systemreport!enabled" is set.<br />
** The EventId is "receive_system_update" with ApplicationId <NS ProgramId>.<br />
** This report has the following fields: <br />
*** "SourceSystemUpdateId"<br />
*** "DestinationSystemUpdateId"<br />
*** "SourceSystemUpdateVersion"<br />
*** "DestinationSystemUpdateVersion"<br />
*** "SenderFirmwareVariationId"<br />
*** "ReceiverFirmwareVariationId"<br />
*** "SenderPlatformRegion"<br />
*** "ReceiverPlatformRegion"<br />
*** "SenderHasExFat"<br />
*** "ReceiverHasExFat"<br />
*** "Size"<br />
*** "ThroughputKBps"<br />
<br />
=== GetReceiveProgress ===<br />
No input, returns an output [[#SystemUpdateProgress]].<br />
<br />
Same as [[#GetDownloadProgress]] except this uses [[NIM_services|nim]] cmd71 and cmd73.<br />
<br />
=== ApplyReceivedUpdate ===<br />
No input/output.<br />
<br />
=== GetReceivedEulaDataSize ===<br />
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.<br />
<br />
This is similar to [[#GetDownloadedEulaDataSize]].<br />
<br />
=== GetReceivedEulaData ===<br />
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.<br />
<br />
This is similar to [[#GetDownloadedEulaData]].<br />
<br />
=== SetupToReceiveSystemUpdate ===<br />
No input/output.<br />
<br />
This just uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.<br />
<br />
[[qlaunch]] uses this before [[#RequestReceiveSystemUpdate]].<br />
<br />
=== RequestCheckLatestUpdateIncludesRebootlessUpdate ===<br />
No input, returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
= IAsyncValue =<br />
This is "nn::ns::detail::IAsyncValue".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetSize<br />
|-<br />
| 1 || Get<br />
|-<br />
| 2 || Cancel<br />
|-<br />
| 3 || [4.0.0+] GetErrorContext<br />
|}<br />
<br />
Official sw creates a container object for this using the output from the service commands, which contains the IAsyncValue object, and the Event with EventClearMode=0.<br />
<br />
* GetSize: No input, returns an output u64.<br />
* Get: Takes a type-0x6 output buffer, no output. Official sw waits on the Event prior to using this cmd.<br />
* Cancel: No input/output. Used by official sw when closing the object, when the serv-obj is initialized (after using the cmd, official sw will also wait on the Event). This cmd is also used in other official sw funcs.<br />
* GetErrorContext: No input/output, takes a type-0x16 output buffer containing an [[Error_Applet#ErrorContext|ErrorContext]].<br />
<br />
= IAsyncResult =<br />
This is "nn::ns::detail::IAsyncResult".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Get<br />
|-<br />
| 1 || Cancel<br />
|-<br />
| 2 || [4.0.0+] GetErrorContext<br />
|}<br />
<br />
Official sw creates a container object for this using the output from the service commands, which contains the IAsyncResult object, and the Event with EventClearMode=0.<br />
<br />
* Get: No input/output. Official sw waits on the Event prior to using this cmd.<br />
* Cancel: No input/output. Used by official sw when closing the object, when the serv-obj is initialized (after using the cmd, official sw will also wait on the Event). This cmd is also used in other official sw funcs.<br />
* GetErrorContext: No input/output, takes a type-0x16 output buffer containing an [[Error_Applet#ErrorContext|ErrorContext]].<br />
<br />
= ns:dev =<br />
This is "nn::ns::detail::IDevelopInterface".<br />
<br />
[10.0.0+] Some of these cmds were replaced by the [[PGL_services|pgl]] system module.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [1.0.0-9.2.0] [[#LaunchProgram]]<br />
|-<br />
| 1 || [[#TerminateProcess]]<br />
|-<br />
| 2 || [1.0.0-9.2.0] [[#TerminateProgram]]<br />
|-<br />
| 4 || [1.0.0-9.2.0] [[#GetShellEvent]]<br />
|-<br />
| 5 || [1.0.0-9.2.0] [[#GetShellEventInfo]]<br />
|-<br />
| 6 || [[#TerminateApplication]]<br />
|-<br />
| 7 || [1.0.0-9.2.0] [[#PrepareLaunchProgramFromHost]]<br />
|-<br />
| 8 || [10.0.0+] [[#LaunchApplicationFromHost]] ([1.0.0-9.2.0] [[#LaunchApplicationForDevelop]])<br />
|-<br />
| 9 || [[#LaunchApplicationWithStorageIdForDevelop]]<br />
|-<br />
| 10 || [6.0.0-8.1.0] [[#IsSystemMemoryResourceLimitBoosted]]<br />
|-<br />
| 11 || [6.0.0+] [[#GetRunningApplicationProcessIdForDevelop]]<br />
|-<br />
| 12 || [6.0.0+] [[#SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop]]<br />
|-<br />
| 13 || [9.0.0+] [[#CreateApplicationResourceForDevelop]]<br />
|-<br />
| 14 || [9.0.0+] [[#IsPreomiaForDevelop]]<br />
|-<br />
| 15 || [10.0.0+] [[#GetApplicationProgramIdFromHost]]<br />
|}<br />
<br />
== LaunchProgram ==<br />
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|LaunchProcess]].<br />
<br />
== TerminateProcess ==<br />
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|TerminateProcess]].<br />
<br />
== TerminateProgram ==<br />
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|TerminateProgram]].<br />
<br />
== GetShellEvent ==<br />
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|GetProcessEventHandle]].<br />
<br />
== GetShellEventInfo ==<br />
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|GetProcessEventInfo]].<br />
<br />
== TerminateApplication ==<br />
Calls "pm:shell" [[Process_Manager_services#pm:shell|GetApplicationProcessIdForShell]] and sends the ProcessId to [[Process_Manager_services#pm:shell|TerminateProcess]].<br />
<br />
== PrepareLaunchProgramFromHost ==<br />
Takes a type-0x5 input buffer containing the [[Filesystem_services|ContentPath]], returns an output 0x10-byte struct.<br />
<br />
Calls [[NCM_services#IPathResolverForStorage|IPathResolverForStorage]] Set...NcaPath functions.<br />
<br />
== LaunchApplicationForDevelop ==<br />
Takes an input u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]] and [[NCM_services#ApplicationId|ApplicationId]], returns an output u64 ProcessId.<br />
<br />
Same as [[#LaunchApplicationWithStorageIdForDevelop]] except the last two params passed to the internal vtable funcptr call are value 0x6, instead of from the command input.<br />
<br />
== LaunchApplicationFromHost ==<br />
Takes an input u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]] and a type-0x5 input buffer containing the [[Filesystem_services|ContentPath]]. Returns an output u64 ProcessId.<br />
<br />
== LaunchApplicationWithStorageIdForDevelop ==<br />
Takes 2 input u8 [[NCM_services#StorageId|StorageIds]], an u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]], and an [[NCM_services#ApplicationId|ApplicationId]]. Returns an output u64 ProcessId.<br />
<br />
Launches an application title which is registered with NS.<br />
<br />
== IsSystemMemoryResourceLimitBoosted ==<br />
No input. Returns a bool.<br />
<br />
== GetRunningApplicationProcessIdForDevelop ==<br />
Returns an output u64 ProcessId.<br />
<br />
== SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop ==<br />
Takes an input bool. No output.<br />
<br />
== CreateApplicationResourceForDevelop ==<br />
Takes an input u32 (1 = Preomia/MicroApplication). Returns an [[#IApplicationResource]].<br />
<br />
== IsPreomiaForDevelop ==<br />
Takes an input u64 [[NCM_services#ProgramId|ProgramId]]. Returns a bool.<br />
<br />
== GetApplicationProgramIdFromHost ==<br />
Takes a type-0x5 input buffer containing the [[Filesystem_services|ContentPath]]. Returns an u64 [[NCM_services#ProgramId|ProgramId]].<br />
<br />
= VersionListData =<br />
This is "nn::ns::VersionListData".<br />
<br />
= ApplicationUpdateInfo =<br />
This is "nn::ns::ApplicationUpdateInfo".<br />
<br />
This is an u8. [[qlaunch]] just checks whether this is 0.<br />
<br />
= ApplicationOccupiedSize =<br />
This is "nn::ns::ApplicationOccupiedSize". This is a 0x80-byte struct.<br />
<br />
= ProgressForDeleteUserSaveDataAll =<br />
This is "nn::ns::detail::ProgressForDeleteUserSaveDataAll". This is a 0x28-byte struct.<br />
<br />
= ApplicationViewDeprecated =<br />
This is "nn::ns::ApplicationViewDeprecated". This is a 0x40-byte struct.<br />
<br />
This is converted from [[#ApplicationView]] by [[#GetApplicationViewDeprecated]] on newer system-versions as follows:<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x20 || Same as [[#ApplicationView]] +0x0.<br />
|-<br />
| 0x20 || 0x4 || Same as [[#ApplicationView]] +0x20.<br />
|-<br />
| 0x24 || 0x2 || Same as [[#ApplicationView]] +0x24.<br />
|-<br />
| 0x26 || 0x2 || Cleared to 0.<br />
|-<br />
| 0x28 || 0x10 || Same as [[#ApplicationView]] +0x30.<br />
|-<br />
| 0x38 || 0x4 || Same as [[#ApplicationView]] +0x40.<br />
|-<br />
| 0x3C || 0x1 || Same as [[#ApplicationView]] +0x44.<br />
|-<br />
| 0x3D || 0x2 || Cleared to 0.<br />
|-<br />
| 0x3F || 0x1 || Cleared to 0.<br />
|}<br />
<br />
= ApplicationView =<br />
This is "nn::ns::ApplicationView". This is a 0x50-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]<br />
|-<br />
| 0x8 || 0x4 || ?<br />
|-<br />
| 0xC || 0x4 || Flags<br />
|-<br />
| 0x10 || 0x40 || ?<br />
|}<br />
<br />
= ApplicationViewWithPromotionInfo =<br />
This is a 0x70-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x50 || [[#ApplicationView]]<br />
|-<br />
| 0x50 || 0x20 || [[#PromotionInfo]]<br />
|}<br />
<br />
= PromotionInfo =<br />
This is a 0x20-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || PosixTime start_timestamp.<br />
|-<br />
| 0x8 || 0x8 || PosixTime end_timestamp.<br />
|-<br />
| 0x10 || 0x8 || Remaining time until the promotion ends, in nanoseconds ({end_timestamp - current_time} converted to nanoseconds).<br />
|-<br />
| 0x18 || 0x4 || Not set, left at zero.<br />
|-<br />
| 0x1C || 0x1 || Flags. Bit0: whether the PromotionInfo is valid (including bit1). Bit1 clear: u64 +0x10 is set.<br />
|-<br />
| 0x1D || 0x3 || Padding<br />
|}<br />
<br />
= NoDownloadRightsErrorResolution =<br />
This is "nn::ns::NoDownloadRightsErrorResolution".<br />
<br />
= BackgroundNetworkUpdateState =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || No sysupdate task exists.<br />
|-<br />
| 1 || Sysupdate download in progress.<br />
|-<br />
| 2 || Sysupdate ready, pending install.<br />
|}<br />
<br />
This is "nn::ns::BackgroundNetworkUpdateState". This is an u8.<br />
<br />
Similar to [[#HasDownloaded]], [[#GetBackgroundNetworkUpdateState]] uses [[NIM_services|nim]] ListSystemUpdateTask and [[NIM_services|nim]] GetSystemUpdateTaskInfo. When ListSystemUpdateTask successfully returns a task and GetSystemUpdateTaskInfo is successful, the output value is set to: <code>1 + *((u8*)(taskinfo+0) == 0x3</code>. Otherwise, value=0.<br />
<br />
[[#GetBackgroundNetworkUpdateState]] always returns Result 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89.<br />
<br />
= SystemUpdateProgress =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || s64 Current size. This value can be larger than total_size when the async operation is finishing. When total_size is <=0, this current_size field may contain a progress value for when the total_size is not yet determined.<br />
|-<br />
| 0x8 || 0x8 || s64 Total size, this field is only valid when >0.<br />
|}<br />
<br />
This is "nn::ns::SystemUpdateProgress". This is a 0x10-byte struct.<br />
<br />
Commands which have this as output will return 0 with the output cleared, when no task is available.<br />
<br />
= EulaDataPath =<br />
This is "nn::ns::detail::EulaDataPath". This is a 0x100-byte struct.<br />
<br />
This contains a file path.<br />
<br />
= SystemDeliveryInfo =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x4 || SystemDeliveryProtocolVersion. Must be <= to and match [[System_Settings|system-setting]] <code>contents_delivery!system_delivery_protocol_version</code>.<br />
|-<br />
| 0x4 || 0x4 || ApplicationDeliveryProtocolVersion. Loaded from [[System_Settings|system-setting]] <code>contents_delivery!application_delivery_protocol_version</code>. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.<br />
|-<br />
| 0x8 || 0x1 || HasExFat. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.<br />
|-<br />
| 0x9 || 0x3 || Reserved.<br />
|-<br />
| 0xC || 0x4 || SystemUpdateMetaVersion.<br />
|-<br />
| 0x10 || 0x8 || SystemUpdateMetaId.<br />
|-<br />
| 0x18 || 0x1 || FirmwareVariationId. Used by [[#RequestSendSystemUpdate]].<br />
|-<br />
| 0x19 || 0x1 || UpdatableFirmwareGroupId. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.<br />
|-<br />
| 0x1A || 0x1 || PlatformRegion (0x00 = Unknown, 0x01 = Global, 0x02 = China).<br />
|-<br />
| 0x1B || 0xC5 || Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.<br />
|-<br />
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes.<br />
|}<br />
<br />
This is "nn::ns::SystemDeliveryInfo". This is a 0x100-byte struct.<br />
<br />
= ApplicationDeliveryInfo =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || ?<br />
|-<br />
| 0x8 || 0x8 || ApplicationId.<br />
|-<br />
| 0x10 || 0x4 || ApplicationVersion.<br />
|-<br />
| 0x14 || 0x4 || ?<br />
|-<br />
| 0x18 || 0x4 || RequiredSystemVersion.<br />
|-<br />
| 0x1C || 0x4 || ?<br />
|-<br />
| 0x20 || 0xC0 || ?<br />
|-<br />
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes. Uses a different key than [[#SystemDeliveryInfo]].<br />
|}<br />
<br />
This is "nn::ns::ApplicationDeliveryInfo". This is a 0x100-byte struct.<br />
<br />
= LatestSystemUpdate =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 1 || Unknown.<br />
|-<br />
| 2 || Unknown.<br />
|-<br />
| Other values || Unknown.<br />
|}<br />
<br />
This is "nn::ns::LatestSystemUpdate". This is an u8.<br />
<br />
= ReceiveApplicationProgress =<br />
This is "nn::ns::ReceiveApplicationProgress". This is a 0x10-byte struct.<br />
<br />
= SendApplicationProgress =<br />
This is "nn::ns::SendApplicationProgress". This is a 0x10-byte struct.<br />
<br />
= ApplicationRightsOnClient =<br />
This is a 0x20-byte struct.<br />
<br />
[[qlaunch]] only uses +0x18/+0x19 in this struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]<br />
|-<br />
| 0x8 || 0x10 || [[Account_services#Uid|Uid]]<br />
|-<br />
| 0x18 || 0x1 || Flags, [[qlaunch]] only uses bit0-bit4 and bit7.<br />
|-<br />
| 0x19 || 0x1 || Flags, [[qlaunch]] only uses bit0.<br />
|-<br />
| 0x1A || 0x6 || Unknown<br />
|}<br />
<br />
= DownloadTaskStatus =<br />
This is "nn::ns::DownloadTaskStatus". This is a 0x20-byte struct.<br />
<br />
= ApplicationLaunchInfo =<br />
This is a 0x40-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]<br />
|-<br />
| 0x8 || 0x4 || Application version<br />
|-<br />
| 0xC || 0x4 || [[Process_Manager_services#LaunchFlags|LaunchFlags]], set to hard-coded value 0xB by [[#GetApplicationLaunchInfo]].<br />
|-<br />
| 0x10 || 0x1 || Application [[NCM_services#StorageId|StorageId]]<br />
|-<br />
| 0x11 || 0x1 || Update [[NCM_services#StorageId|StorageId]]<br />
|-<br />
| 0x12 || 0x2E || <br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=Services_API&diff=10429
Services API
2020-12-08T20:31:49Z
<p>Behemoth: /* Service List */</p>
<hr />
<div>Services are system processes running in the background which wait for incoming requests. When a process wants to communicate with a service, it first needs to get a handle to the named service, and then it can communicate with the service via inter-process communication (each service has a name up to 8 characters).<br />
<br />
Handles for services are retrieved from the service manager port, "sm:", and are released via svcCloseHandle or when a process is terminated or crashes. Manager service "sm:m" also exists. Services are an abstraction of ports, they operate the same way except regular ports can have their handles retrieved directly from a SVC. Services are also able to limit the number of handles given to other processes.<br />
<br />
= sm: =<br />
This is "nn::sm::detail::IUserInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#RegisterClient]]<br />
|-<br />
| 1 || [[#GetServiceHandle]]<br />
|-<br />
| 2 || [[#RegisterService]]<br />
|-<br />
| 3 || [[#UnregisterService]]<br />
|-<br />
| 4 || [11.0.0+] [[#DetachClient]]<br />
|}<br />
<br />
== RegisterClient ==<br />
Takes a PID-descriptor and a reserved input u64.<br />
<br />
== GetServiceHandle ==<br />
Takes a zero-padded service name encoded as an u64 integer. Returns a handle.<br />
<br />
== RegisterService ==<br />
Takes a zero-padded service name encoded as an u64 integer, an u8 bool '''IsLight''', and a s32 '''MaxSessions''' at the next word. Returns a handle.<br />
<br />
== UnregisterService ==<br />
Takes a zero-padded service name encoded as an u64 integer.<br />
<br />
== DetachClient ==<br />
Takes a PID-descriptor and a reserved input u64.<br />
<br />
= sm:m =<br />
This is "nn::sm::detail::IManagerInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#RegisterProcess]]<br />
|-<br />
| 1 || [[#UnregisterProcess]]<br />
|}<br />
<br />
== RegisterProcess ==<br />
Takes a PID and two type-0x5 input buffers with the ACID and ACI0 service lists. That data originates from [[NPDM]].<br />
<br />
== UnregisterProcess ==<br />
Takes a PID.<br />
<br />
= Service List =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Service names<br />
! scope="col" width="200" | Description<br />
! scope="col" width="200" | Notes<br />
|-<br />
| acc:u0, acc:u1, acc:aa, acc:su, [5.0.0+] dauth:0<br />
| [[Account services]]<br />
| u0: System, u1: User, su: Admin, aa: Baas<br />
|-<br />
| [1.0.0-8.1.0] ahid:cd, [1.0.0-8.1.0] ahid:hdr, hid, hid:dbg, hid:sys, irs, irs:sys, xcd:sys, [3.0.0-7.0.1] hid:tmp, [5.0.0+] hidbus<br />
| [[HID services]]<br />
|<br />
|-<br />
| appletAE, appletOE, idle:sys, omm, spsm, [5.0.0-10.2.0] tcap, [6.0.0+] caps:su, [8.0.0+] apm <br />
| [[Applet Manager services]]<br />
| <br />
|-<br />
| [1.0.0-2.3.0] aoc:u, mii:u, mii:e, ns:am, ns:su, ns:dev, pl:u, ovln:rcv, ovln:snd, pdm:ntfy, pdm:qry<br />
<br />
[3.0.0+] aoc:u, ns:am2, ns:dev, ns:ec, ns:rid, ns:rt, ns:su, ns:vm, ns:web, [1.0.0-7.0.1] ovln:rcv, [1.0.0-7.0.1] ovln:snd, [11.0.0+] ns:ro<br />
| [[NS Services]]<br />
| am: Application Manager, su: System Update<br />
|-<br />
| [1.0.0-8.1.0] apm:dbg, [1.0.0-8.1.0] apm:sys, [1.0.0] fgm:1, fgm:2, fgm:3, fgm:4, fgm:5, fgm:6, fgm:7, [1.0.0-8.1.0] fgm, [1.0.0-8.1.0] fgm:0, [1.0.0-8.1.0] fgm:9, [1.0.0-8.1.0] fgm:dbg, [1.0.0-7.0.1] apm, [1.0.0-7.0.1] apm:p, [8.0.0-8.1.0] apm:am<br />
| [[PPC services]]<br />
| <br />
|-<br />
| arp:r, arp:w, [2.0.0+] bgtc:t, [2.0.0+] bgtc:sc, [9.0.0+] time:a, [9.0.0+] time:r, [9.0.0+] time:u, [9.0.0+] notif:a, [9.0.0+] notif:s, [11.0.0+] ectx:aw, [11.0.0+] ectx:r, [11.0.0+] ectx:w<br />
| [[Glue services]]<br />
| <br />
|-<br />
| [1.0.0-10.2.0] audin:a, [1.0.0-10.2.0] audin:d, audin:u, [1.0.0-10.2.0] audout:a, [1.0.0-10.2.0] audout:d, audout:u, [1.0.0-10.2.0] audren:a, [1.0.0-10.2.0] audren:d, audren:u, audrec:a, audrec:d, audrec:u, audctl, [1.0.0-2.3.0] codecctl, hwopus, auddebug, [6.0.0+] auddev, [11.0.0+] aud:a, [11.0.0+] aud:d<br />
| [[Audio services]]<br />
|<br />
|-<br />
| <nowiki>banana</nowiki><br />
| [[Profiler services]]<br />
| Not currently available on retail units.<br />
|-<br />
| <nowiki>[2.0.0+] bcat:a, [2.0.0+] bcat:u, [2.0.0+] bcat:m, [2.0.0+] bcat:s, news:a, news:c, news:m, news:p, news:v, prepo:u, prepo:s, prepo:m, [1.0.0-5.1.0] prepo:a, [1.0.0] prepo:d, [6.0.0+] prepo:a2</nowiki><br />
| [[BCAT services]]<br />
|<br />
|-<br />
| [1.0.0] bpc:c, bpc:b, bpc:r, bpc:w, pcv, pcv:arb, pcv:imm, time:u, time:a, time:s<br />
[2.0.0+] bpc, bpc:r, pcv, [2.0.0-8.1.0] time:u, [2.0.0-8.1.0] time:a, [2.0.0-8.1.0] time:s, [1.0.0-7.0.1] pcv:arb, [1.0.0-7.0.1] pcv:imm, [8.0.0+] clkrst, [8.0.0+] clkrst:a, [8.0.0+] clkrst:i, [8.0.0+] rgltr, [8.0.0+] rtc<br />
| [[PCV services]]<br />
|<br />
|-<br />
| bsd:u, bsd:s, bsdcfg, ethc:c, ethc:i, nsd:u, nsd:a, sfdnsres<br />
| [[Sockets services]]<br />
|<br />
|-<br />
| btdrv, [5.0.0+] bt<br />
| [[Bluetooth Driver services]]<br />
| <br />
|-<br />
| btm, btm:dbg, btm:sys, [5.0.0+] btm:u<br />
| [[BTM services]]<br />
| <br />
|-<br />
| caps:a, caps:c, [1.0.0] mm:u, [5.0.0+] caps:u<br />
| [[Capture services]]<br />
| a: AlbumAccessor, c: AlbumControl<br />
|-<br />
| [2.0.0+] caps:sc, [2.0.0+] caps:ss, vi:m, vi:s, vi:u, cec-mgr, [2.0.0+] mm:u, [3.0.0-5.1.0] caps:su, [11.0.0+] lbl<br />
| [[Display services]]<br />
| <br />
|-<br />
| dispdrv<br />
| [[Nvnflinger services]]<br />
|<br />
|-<br />
| dmnt:-<br />
| [[Debug Monitor services]]<br />
| Not currently available on retail units.<br />
|-<br />
| erpt:c, erpt:r<br />
| [[Error Report services]]<br />
|<br />
|-<br />
| eupld:c, eupld:r<br />
| [[Error Upload services]]<br />
|<br />
|-<br />
| es<br />
| [[ETicket services]]<br />
|<br />
|-<br />
| fan, psm, tc, ts, <nowiki>pcm</nowiki>, [9.0.0+] apm:sys, [9.0.0+] fgm, [9.0.0+] fgm:0, [9.0.0+] fgm:9, [9.0.0+] fgm:dbg, [9.0.0+] apm:am, [10.0.0-10.2.0] lbl<br />
| [[PTM services]]<br />
| pcm is not available on retail units.<br />
|-<br />
| fatal:u, fatal:p<br />
| [[Fatal services]]<br />
| <br />
|-<br />
| friend:u, friend:v, friend:m, friend:s, friend:a, [5.0.0-6.0.0] nd:app, [5.0.0-6.0.0] nd:sys<br />
| [[Friend services]]<br />
|<br />
|-<br />
| fsp-srv, fsp-ldr, fsp-pr<br />
| [[Filesystem services]]<br />
| srv: Main, ldr: Loader, pr: Program Registry<br />
|-<br />
| gpio, i2c, i2c:pcv, pinmux, pwm, uart, [3.0.0+] sasbus, [8.1.1+] led<br />
| [[Bus services]]<br />
|<br />
|-<br />
| htc, htcs, htc:tenv, file_io, gds, tma_log, tmagent<br />
| [[TMA services]]<br />
| <br />
|-<br />
| jit:u<br />
| [[JIT services]]<br />
| <br />
|-<br />
| [1.0.0-9.2.0] lbl<br />
| [[Backlight services]]<br />
| <br />
|-<br />
| ldn:m, ldn:s, ldn:u, [5.0.0-6.0.0] ndd, [9.0.0+] lp2p:app, [9.0.0+] lp2p:sys, [9.1.0+] lp2p:m<br />
| [[LDN services]]<br />
|<br />
|-<br />
| [1.0.0+] ldr:pm, ldr:ro, ldr:shel, ldr:dmnt<br />
<br />
[3.0.0+] ldr:pm, ldr:shel, ldr:dmnt<br />
| [[Loader services]]<br />
|<br />
|-<br />
| lm, lm:get<br />
| [[Log services]]<br />
|<br />
|-<br />
| manu<br />
| [[Manu Services]]<br />
| "Manufacturing", present in factory firmware but not installed on retail systems.<br />
|-<br />
| lr, ncm, ncm:v<br />
| [[NCM services]]<br />
|<br />
|-<br />
| nfc:am, nfc:mf:u, nfc:user, nfc:sys, nfp:user, nfp:dbg, nfp:sys<br />
| [[NFC services]]<br />
| <br />
|-<br />
| nifm:u, nifm:a, nifm:s<br />
| [[Network Interface services]]<br />
| <br />
|-<br />
| nim, nim:shp, ntc, [5.0.0+] nim:eca, [7.0.0+] nim:ecas<br />
| [[NIM services]]<br />
| <br />
|-<br />
| npns:u, npns:s<br />
| [[NPNS services]]<br />
|<br />
|-<br />
| nvdrv:a, nvdrv:s, nvdrv:t, nvdrv, nvdrvdbg, nvgem:c, nvgem:cd, nvmemp, [10.0.0+] nvdbg:d<br />
| [[NV services]]<br />
|<br />
|-<br />
| pcie, [6.0.0+] pcie:log<br />
| [[PCIe services]]<br />
|<br />
|-<br />
| pctl, pctl:a, pctl:s, pctl:r<br />
| [[Parental Control services]]<br />
|<br />
|-<br />
| pm:bm, pm:info, pm:shell<br />
| [[Process Manager services]]<br />
|<br />
|-<br />
| psc:c, psc:m, [5.0.0+] srepo:u, [5.0.0+] srepo:a, [8.0.0+] ovln:rcv, [8.0.0+] ovln:snd, [9.0.0+] psc:l, [9.0.0+] time:su, [9.0.0+] time:s, [9.0.0+] time:al, [9.0.0+] time:m, [9.0.0+] time:p, [9.0.0+] ins:r, [9.0.0+] ins:s, [11.0.0+] hshl:set, [11.0.0+] hshl:sys<br />
| [[PSC services]]<br />
| <br />
|-<br />
| [3.0.0+] ldr:ro, ro:dmnt, [7.0.0+] ro:1<br />
| [[RO services]]<br />
|<br />
|-<br />
| set, set:fd, set:cal, set:sys<br />
| [[Settings services]]<br />
| cal: calibration, sys: System Settings<br />
|-<br />
| [3.0.0+] mii:u, [3.0.0+] mii:e, [3.0.0+] pdm:ntfy, [3.0.0+] pdm:qry, [3.0.0+] pl:u, [5.0.0+] miiimg, [6.0.0+] avm, [9.0.0+] pl:s<br />
| [[Shared Database services]]<br />
|<br />
|-<br />
| ssl<br />
| [[SSL services]]<br />
|<br />
|-<br />
| csrng, spl:, [4.0.0+] spl:mig, [4.0.0+] spl:fs, [4.0.0+] spl:ssl, [4.0.0+] spl:es, [5.0.0+] spl:manu<br />
| [[SPL services]]<br />
| <br />
|-<br />
| sf-uds<br />
| ?<br />
| System debug applet "recovery" has access to this service, but it doesn't appear to exist.<br />
|-<br />
| tspm<br />
| ?<br />
| Applications on [1.0.0] used to have access to this service, but it doesn't appear to be present on retail devices.<br />
|-<br />
| usb:ds, usb:hs, usb:pd, usb:pd:c, [1.0.0] usb:pd:m, usb:pm, [7.0.0+] usb:hs:a, [7.0.0+] usb:qdb, [8.0.0+] usb:obsv<br />
| [[USB services]]<br />
| <br />
|-<br />
| wlan:inf, wlan:lcl, wlan:lg, wlan:lga, wlan:sg, wlan:soc, [6.0.0+] wlan:dtc<br />
| [[WLAN services]]<br />
|<br />
|-<br />
| [4.0.0+] grc:c, [6.0.0+] grc:d<br />
| [[GRC services]]<br />
| <br />
|-<br />
| [4.0.0+] mig:usr<br />
| [[Migration services]]<br />
| <br />
|-<br />
| [4.0.0+] caps:dc<br />
| [[Jpegdec services]]<br />
| <br />
|-<br />
| [6.0.0+] olsc:s, [10.0.0+] olsc:u<br />
| [[OLSC services]]<br />
| <br />
|-<br />
| [9.0.0+] ngct:s, [9.0.0+] ngct:u<br />
| [[NGCT services]]<br />
| <br />
|-<br />
| [10.0.0+] pgl<br />
| [[PGL services]]<br />
| <br />
|-<br />
| [11.0.0+] capmtp<br />
| [[Capmtp services]]<br />
| <br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=Network&diff=10422
Network
2020-12-07T00:40:35Z
<p>Behemoth: /* Others */</p>
<hr />
<div>This page documents DNS domains and lists information relevant to the online services used by the Switch.<br />
<br />
= Domains =<br />
Only HTTPS is used with these domains unless noted otherwise.<br />
<br />
== CDN ==<br />
The URLs for content delivery network servers on the Switch usually follow this format:<br />
{server_name}.hac.{environment}.{serverset}.{host}<br />
<br />
Where:<br />
{server_name}: One of the registered server names.<br />
{environment}: "dp1", "lp1", "sp1", "dd1", "jd1", "sd1", "td1" or "xd1".<br />
{serverset}: "eshop" (online shop), "d4c" (content delivery) or "dragons" (online membership).<br />
{host}: "nintendo.net" (global cdn), "n.nintendoswitch.cn" (chinese cdn).<br />
<br />
=== Servers ===<br />
* "[[#sun|sun.hac.%.d4c.nintendo.net]]"<br />
* "[[#aqua|aqua.hac.%.d4c.nintendo.net]]"<br />
* "[[#atum/atumn|atum.hac.%.d4c.nintendo.net]]"<br />
* "[[#atum/atumn|atumn.hac.%.d4c.nintendo.net]]"<br />
* "atumn-dummy.hac.%.d4c.nintendo.net"<br />
* "[[#superfly|superfly.hac.%.d4c.nintendo.net]]"<br />
* "bugyo.hac.%.eshop.nintendo.net"<br />
* "[[#beach|beach.hac.%.eshop.nintendo.net]]"<br />
* "pushmo.hac.%.eshop.nintendo.net"<br />
* "[[#tagaya|tagaya.hac.%.eshop.nintendo.net]]"<br />
* [5.0.0+] "[[#pearljam|pearljam.hac.%.eshop.nintendo.net]]"<br />
* [6.0.0+] "dragons.hac.%.dragons.nintendo.net"<br />
* [6.0.0+] "dragonst.hac.%.dragons.nintendo.net"<br />
* [6.0.0+] "tigers.hac.%.dragons.nintendo.net"<br />
<br />
==== sun ====<br />
Used for checking whether a sysupdate is available. Equivalent to NetUpdateSOAP from past systems.<br />
<br />
[[NIM_services|NIM]] sends a HTTP GET with the sun URL to get the title-listing of the latest system-titles, as .json. The deviceid in the URL is the same one in the above User-Agent section. HTTP header "Accept:application/json" is sent in the request.<br />
<br />
The response is json with a "system_update_metas" block, containing "title_id" and "title_version" entries. The actual server response only contains 1 title.<br />
<br />
Example, from 2.0 system:<br />
<br />
<code>{"timestamp":REDACTED-TIMESTSAMP,"system_update_metas":[{"title_id":"0100000000000816","title_version":201327002}]}</code><br />
<br />
URLs:<br />
"<nowiki>https://sun.hac.%%.d4c.nintendo.net/v1/system_update_meta?device_id=%016llx</nowiki>"<br />
<br />
==== aqua ====<br />
The following response is json from accessing the aqua URL:<br />
<br />
<code>{<br />
"contents_delivery_required_title_id": "0100000000000816",<br />
"contents_delivery_required_title_version": 0<br />
}</code><br />
<br />
A while after [[3.0.0]] release, the above title-version was changed to the one for v3.0("Last-Modified: Thu, 29 Jun 2017 00:00:04 GMT").<br />
<br />
URLs:<br />
"<nowiki>https://aqua.hac.%%.d4c.nintendo.net/required_system_update_meta?device_id=%016llx</nowiki>"<br />
<br />
==== atum/atumn ====<br />
CDN for system-titles.<br />
<br />
While "atumn" seems to be for system-titles and "atum" for eShop titles, the latter titles are accessible fine with atumn (with "/t/" for NCA-type0 at least).<br />
<br />
'a' is used when an input u8 is not 0x3, otherwise 's' is used. A seperate function using the ".../c/" URL is hard-coded to use 'c'. This appears to match 's' usage attempts: the only URL that returned actual data with 's' was with titleID 0100000000000816.<br />
<br />
As of June 30, 2017, accessing old content via the atumn "/c/" and "/t/" URLs works fine.<br />
<br />
URLs:<br />
"<nowiki>https://%s.hac.%%.d4c.nintendo.net/t/%c/%016llx/%u?device_id=%016llx</nowiki>"<br />
Returns content like the below URL. First %s is atumn or atum. This is the content for [[NCA]]-type0. See below for %c. %016llx is titleID, %u is title-version.<br />
<br />
"<nowiki>https://%s.hac.%%.d4c.nintendo.net/c/%c/%s</nowiki>"<br />
Used for downloading content. First %s is atumn or atum. %c is one of: 'c', 'a', or 's'. %s is just the hex-string NcaId. The server also returns two HTTP headers: "X-Nintendo-Content-Hash: {entire lowercase hex-string of the content SHA256 hash}" and "X-Nintendo-Content-ID: {lowercase hex-string for NcaId}"<br />
<br />
==== superfly ====<br />
URLs:<br />
"<nowiki>https://superfly.hac.%%.d4c.nintendo.net/v1/t/%016llx/dv</nowiki>"<br />
%016llx is titleID, only for eShop titles it appears. Returns .json title-info.<br />
<br />
"<nowiki>https://superfly.hac.%%.d4c.nintendo.net/v1/a/%016llx/dv</nowiki>"<br />
%016llx is titleID, only for eShop titles it appears. Output is similar to above URL.<br />
<br />
==== tagaya ====<br />
VersionList for eShop titles.<br />
<br />
URLs:<br />
"<nowiki>https://tagaya.hac.%.eshop.nintendo.net/tagaya/hac_versionlist</nowiki>"<br />
<br />
==== beach ====<br />
URLs:<br />
"<nowiki>https://beach.hac.%.eshop.nintendo.net/v1/rom_cards?application_id=%016llx&rom_card_cert=%s</nowiki>"<br />
"<nowiki>https://beach.hac.%.eshop.nintendo.net/v1/rom_cards/register?application_id=%016llx&rom_card_cert=%s&expected_gold_point=%d</nowiki>"<br />
"<nowiki>https://beach.hac.%.eshop.nintendo.net/v1/my/devices/hac/link?lang=en</nowiki>"<br />
"<nowiki>https://beach.hac.%.eshop.nintendo.net/v1/my/virtual_account?lang=en</nowiki>"<br />
<br />
==== pearljam ====<br />
URLs:<br />
[5.0.0+] "<nowiki>https://pearljam.hac.%.eshop.nintendo.net/sugar</nowiki>"<br />
[5.0.0+] "<nowiki>https://pearljam.hac.%.eshop.nintendo.net/civil</nowiki>"<br />
<br />
== Shop API ==<br />
Domains for interacting with the online shop API.<br />
<br />
=== Servers ===<br />
* "[[#ecs|ecs-%.hac.shop.nintendo.net]]"<br />
* "[[#ias|ias-%.hac.shop.nintendo.net]]"<br />
<br />
==== ecs ====<br />
URLs:<br />
"<nowiki>https://ecs-%.hac.shop.nintendo.net/ecs/services/rest/AccountGetETickets</nowiki>"<br />
"<nowiki>https://ecs-%.hac.shop.nintendo.net/ecs/services/rest/GetAccountStatus</nowiki>"<br />
<br />
==== ias ====<br />
URLs:<br />
"<nowiki>https://ias-%.hac.shop.nintendo.net/ias/services/rest/Register</nowiki>"<br />
"<nowiki>https://ias-%.hac.shop.nintendo.net/ias/services/rest/GetChallenge</nowiki>"<br />
"<nowiki>https://ias-%.hac.shop.nintendo.net/ias/services/rest/Unregister</nowiki>"<br />
"<nowiki>https://ias-%.hac.shop.nintendo.net/ias/services/rest/GetRegistrationInfo</nowiki>"<br />
"<nowiki>https://ias-%.hac.shop.nintendo.net/ias/services/rest/CompleteETicketSync</nowiki>"<br />
"<nowiki>https://ias-%.hac.shop.nintendo.net/ias/services/rest/AccountTransfer</nowiki>"<br />
"<nowiki>https://ias-%.hac.shop.nintendo.net/ias/services/rest/SyncRegistration</nowiki>"<br />
<br />
== Services ==<br />
The URLs for general online service servers on the Switch usually follow one of these formats:<br />
{server_name}.{environment}.{service_name}.srv.nintendo.net<br />
{server_name}-{environment}.{service_name}.srv.nintendo.net<br />
<br />
Where:<br />
{server_name}: One of the registered server names.<br />
{environment}: "lp1" (production), "dd1" (development) or "sp1" (production lottest staging).<br />
{service_name}: One of the various service names.<br />
<br />
=== Servers ===<br />
* "[[#aauth|aauth-%.ndas.srv.nintendo.net]]"<br />
* "[[#dauth|dauth-%.ndas.srv.nintendo.net]]"<br />
* "[[#znc|api-%.znc.srv.nintendo.net]]"<br />
* "api-%.pctl.srv.nintendo.net"<br />
* "api-%.frs.srv.nintendo.net"<br />
* "app-a04.%.npns.srv.nintendo.net"<br />
* "app-b01.%.npns.srv.nintendo.net"<br />
* "broker.%.npns.srv.nintendo.net"<br />
* "consumer.%.npns.srv.nintendo.net"<br />
* "[[BCAT_services#Data_reporting|receive-%.dg.srv.nintendo.net]]"<br />
* "[[Error_Upload_services|receive-%.er.srv.nintendo.net]]"<br />
* "nncs1-%.n.n.srv.nintendo.net"<br />
* "nncs2-%.n.n.srv.nintendo.net"<br />
* "g<game_server_id>-%.s.n.srv.nintendo.net"<br />
* [4.0.0+] "[[#migration|migration.%.scsi.srv.nintendo.net]]"<br />
* [6.0.0+] "[[#storage|storage.%.scsi.srv.nintendo.net]]"<br />
* [9.0.0+] "[[#storage|storage.%.sata.srv.nintendo.net]]"<br />
* [9.0.0+] "[[#permission|permission.%.sata.srv.nintendo.net]]"<br />
<br />
==== aauth ====<br />
Application authentication.<br />
<br />
URLs:<br />
"<nowiki>https://aauth-%.ndas.srv.nintendo.net/v1/application_auth_token</nowiki>"<br />
"<nowiki>https://aauth-%.ndas.srv.nintendo.net/v1/time</nowiki>"<br />
<br />
[5.0.0+] "<nowiki>https://aauth-%.ndas.srv.nintendo.net/v2-44cd4221f90742b5f37a4948b37dacf024d0bb14dde86db0af20ec300a36a0fe/application_auth_token</nowiki>"<br />
Replaces previous application_auth_token URL.<br />
<br />
==== dauth ====<br />
Device authentication.<br />
<br />
URLs:<br />
"<nowiki>https://dauth-%.ndas.srv.nintendo.net/v1/device_auth_token</nowiki>"<br />
CURLOPT_POSTFIELDS is set to the output from: snprintf(..., "system_version=%08x&client_id=%s", <byte-swapped first 3 bytes from [[System_Version_Title]] loaded via [[Settings_services|settings]] cmd>, "<hard-coded hex string>");<br />
<br />
[4.0.0+] "<nowiki>https://dauth-%.ndas.srv.nintendo.net/439528b578b74475d24ec19264097f17d2cc578c8584816b644e7b7fa93044d7/device_auth_token</nowiki>"<br />
Replaces previous device_auth_token URL. <br />
<br />
[5.0.0+] "<nowiki>https://dauth-%.ndas.srv.nintendo.net/v3-59ed5fa1c25bb2aea8c4d73d74b919a94d89ed48d6865b728f63547943b17404/device_auth_token</nowiki>"<br />
Replaces previous device_auth_token URL.<br />
<br />
[5.0.0+] "<nowiki>https://dauth-%.ndas.srv.nintendo.net/v3-59ed5fa1c25bb2aea8c4d73d74b919a94d89ed48d6865b728f63547943b17404/challenge</nowiki>"<br />
CURLOPT_POSTFIELDS is set to the output from: snprintf(..., "key_generation=%u", 5);<br />
<br />
==== znc ====<br />
Used by the Switch Online app to get app data, like the list of game-specific services to display.<br />
<br />
==== app ====<br />
app-a04* uses XMPP with TLS over port 443, without HTTP. Sample request:<br />
<br />
<code><nowiki><?xml version="1.0"?><stream:stream to="app-a04.lp1.npns.srv.nintendo.net" xml:lang="en" version="1.0" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams"></nowiki></code><br />
<br />
==== migration ====<br />
[[Migration_services|Migration]] service storage.<br />
<br />
==== storage ====<br />
[[OLSC_services|OLSC]] service (.scsi) and repair service (.sata) storage.<br />
<br />
==== permission ====<br />
[[OLSC_services|OLSC]] repair service survey request.<br />
<br />
== Others ==<br />
Miscellaneous domains for various APIs and tests.<br />
<br />
=== Servers ===<br />
Account metadata:<br />
* "e0d67c509fb203858ebcb2fe3f88c2aa.baas.nintendo.com"<br />
* "accounts.nintendo.com"<br />
* "api.accounts.nintendo.com"<br />
* "c-%.accounts.nintendo.com"<br />
* "capi.%.op2.nintendo.net"<br />
<br />
News, friends and game content:<br />
* "bcat-topics-%.cdn.nintendo.net"<br />
* "bcat-list-%.cdn.nintendo.net"<br />
* "bcat-data-%.cdn.nintendo.net"<br />
* "bcat-web-%.cdn.nintendo.net"<br />
* "app.%.five.nintendo.net"<br />
* [6.0.0+] "scsi-policy-%.cdn.nintendo.net"<br />
<br />
NSO webapplet [11.0.0+]:<br />
* "%.nso.nintendo.net"<br />
* "atum-img-%.cdn.nintendo.net"<br />
<br />
Connection:<br />
* "ctest.cdn.nintendo.net" (replaces "conntest.nintendowifi.net")<br />
* "nasc.nintendowifi.net"<br />
<br />
Error and status:<br />
* "[[#service-status|service-status-%.cdn.nintendo.net]]"<br />
* "problems.dragons.nintendo.net"<br />
* "moon.nintendo.com"<br />
<br />
==== service-status ====<br />
[[Error_applet|Error applet]] status.<br />
<br />
URLs:<br />
"<nowiki>https://service-status-%.cdn.nintendo.net/service_status_hac.json</nowiki>"<br />
<br />
= User-Agent =<br />
[[NIM_services|NIM]] generates two User-Agent strings:<br />
snprintf(..., "User-Agent: NintendoSDK Firmware/%s-%u (platform:%s; did:%016llx; eid:%s)", <string at [[System_Version_Title|sysver]]+0x68>, {u32 from [[System_Version_Title|sysver]]+4}, "NX", DeviceId, {[[Sockets_services#GetEnvironmentIdentifier|GetEnvironmentIdentifier]] output});<br />
<br />
snprintf(..., "User-Agent: NintendoSDK Firmware/%s-%u (platform:%s; eid:%s)", <string at [[System_Version_Title|sysver]]+0x68>, {u32 from [[System_Version_Title|sysver]]+4}, "NX", DeviceId, {[[Sockets_services#GetEnvironmentIdentifier|GetEnvironmentIdentifier]] output});<br />
<br />
Where the 64bit DeviceId is parsed from the 0x10-bytes at outbuf+0xC6 from [[Settings_services|set:cal]] GetEciDeviceCertificate (DeviceCert_certname+2, aka where the hex string for the DeviceId is).</div>
Behemoth
https://switchbrew.org/w/index.php?title=Network&diff=10421
Network
2020-12-07T00:37:04Z
<p>Behemoth: /* Servers */</p>
<hr />
<div>This page documents DNS domains and lists information relevant to the online services used by the Switch.<br />
<br />
= Domains =<br />
Only HTTPS is used with these domains unless noted otherwise.<br />
<br />
== CDN ==<br />
The URLs for content delivery network servers on the Switch usually follow this format:<br />
{server_name}.hac.{environment}.{serverset}.{host}<br />
<br />
Where:<br />
{server_name}: One of the registered server names.<br />
{environment}: "dp1", "lp1", "sp1", "dd1", "jd1", "sd1", "td1" or "xd1".<br />
{serverset}: "eshop" (online shop), "d4c" (content delivery) or "dragons" (online membership).<br />
{host}: "nintendo.net" (global cdn), "n.nintendoswitch.cn" (chinese cdn).<br />
<br />
=== Servers ===<br />
* "[[#sun|sun.hac.%.d4c.nintendo.net]]"<br />
* "[[#aqua|aqua.hac.%.d4c.nintendo.net]]"<br />
* "[[#atum/atumn|atum.hac.%.d4c.nintendo.net]]"<br />
* "[[#atum/atumn|atumn.hac.%.d4c.nintendo.net]]"<br />
* "atumn-dummy.hac.%.d4c.nintendo.net"<br />
* "[[#superfly|superfly.hac.%.d4c.nintendo.net]]"<br />
* "bugyo.hac.%.eshop.nintendo.net"<br />
* "[[#beach|beach.hac.%.eshop.nintendo.net]]"<br />
* "pushmo.hac.%.eshop.nintendo.net"<br />
* "[[#tagaya|tagaya.hac.%.eshop.nintendo.net]]"<br />
* [5.0.0+] "[[#pearljam|pearljam.hac.%.eshop.nintendo.net]]"<br />
* [6.0.0+] "dragons.hac.%.dragons.nintendo.net"<br />
* [6.0.0+] "dragonst.hac.%.dragons.nintendo.net"<br />
* [6.0.0+] "tigers.hac.%.dragons.nintendo.net"<br />
<br />
==== sun ====<br />
Used for checking whether a sysupdate is available. Equivalent to NetUpdateSOAP from past systems.<br />
<br />
[[NIM_services|NIM]] sends a HTTP GET with the sun URL to get the title-listing of the latest system-titles, as .json. The deviceid in the URL is the same one in the above User-Agent section. HTTP header "Accept:application/json" is sent in the request.<br />
<br />
The response is json with a "system_update_metas" block, containing "title_id" and "title_version" entries. The actual server response only contains 1 title.<br />
<br />
Example, from 2.0 system:<br />
<br />
<code>{"timestamp":REDACTED-TIMESTSAMP,"system_update_metas":[{"title_id":"0100000000000816","title_version":201327002}]}</code><br />
<br />
URLs:<br />
"<nowiki>https://sun.hac.%%.d4c.nintendo.net/v1/system_update_meta?device_id=%016llx</nowiki>"<br />
<br />
==== aqua ====<br />
The following response is json from accessing the aqua URL:<br />
<br />
<code>{<br />
"contents_delivery_required_title_id": "0100000000000816",<br />
"contents_delivery_required_title_version": 0<br />
}</code><br />
<br />
A while after [[3.0.0]] release, the above title-version was changed to the one for v3.0("Last-Modified: Thu, 29 Jun 2017 00:00:04 GMT").<br />
<br />
URLs:<br />
"<nowiki>https://aqua.hac.%%.d4c.nintendo.net/required_system_update_meta?device_id=%016llx</nowiki>"<br />
<br />
==== atum/atumn ====<br />
CDN for system-titles.<br />
<br />
While "atumn" seems to be for system-titles and "atum" for eShop titles, the latter titles are accessible fine with atumn (with "/t/" for NCA-type0 at least).<br />
<br />
'a' is used when an input u8 is not 0x3, otherwise 's' is used. A seperate function using the ".../c/" URL is hard-coded to use 'c'. This appears to match 's' usage attempts: the only URL that returned actual data with 's' was with titleID 0100000000000816.<br />
<br />
As of June 30, 2017, accessing old content via the atumn "/c/" and "/t/" URLs works fine.<br />
<br />
URLs:<br />
"<nowiki>https://%s.hac.%%.d4c.nintendo.net/t/%c/%016llx/%u?device_id=%016llx</nowiki>"<br />
Returns content like the below URL. First %s is atumn or atum. This is the content for [[NCA]]-type0. See below for %c. %016llx is titleID, %u is title-version.<br />
<br />
"<nowiki>https://%s.hac.%%.d4c.nintendo.net/c/%c/%s</nowiki>"<br />
Used for downloading content. First %s is atumn or atum. %c is one of: 'c', 'a', or 's'. %s is just the hex-string NcaId. The server also returns two HTTP headers: "X-Nintendo-Content-Hash: {entire lowercase hex-string of the content SHA256 hash}" and "X-Nintendo-Content-ID: {lowercase hex-string for NcaId}"<br />
<br />
==== superfly ====<br />
URLs:<br />
"<nowiki>https://superfly.hac.%%.d4c.nintendo.net/v1/t/%016llx/dv</nowiki>"<br />
%016llx is titleID, only for eShop titles it appears. Returns .json title-info.<br />
<br />
"<nowiki>https://superfly.hac.%%.d4c.nintendo.net/v1/a/%016llx/dv</nowiki>"<br />
%016llx is titleID, only for eShop titles it appears. Output is similar to above URL.<br />
<br />
==== tagaya ====<br />
VersionList for eShop titles.<br />
<br />
URLs:<br />
"<nowiki>https://tagaya.hac.%.eshop.nintendo.net/tagaya/hac_versionlist</nowiki>"<br />
<br />
==== beach ====<br />
URLs:<br />
"<nowiki>https://beach.hac.%.eshop.nintendo.net/v1/rom_cards?application_id=%016llx&rom_card_cert=%s</nowiki>"<br />
"<nowiki>https://beach.hac.%.eshop.nintendo.net/v1/rom_cards/register?application_id=%016llx&rom_card_cert=%s&expected_gold_point=%d</nowiki>"<br />
"<nowiki>https://beach.hac.%.eshop.nintendo.net/v1/my/devices/hac/link?lang=en</nowiki>"<br />
"<nowiki>https://beach.hac.%.eshop.nintendo.net/v1/my/virtual_account?lang=en</nowiki>"<br />
<br />
==== pearljam ====<br />
URLs:<br />
[5.0.0+] "<nowiki>https://pearljam.hac.%.eshop.nintendo.net/sugar</nowiki>"<br />
[5.0.0+] "<nowiki>https://pearljam.hac.%.eshop.nintendo.net/civil</nowiki>"<br />
<br />
== Shop API ==<br />
Domains for interacting with the online shop API.<br />
<br />
=== Servers ===<br />
* "[[#ecs|ecs-%.hac.shop.nintendo.net]]"<br />
* "[[#ias|ias-%.hac.shop.nintendo.net]]"<br />
<br />
==== ecs ====<br />
URLs:<br />
"<nowiki>https://ecs-%.hac.shop.nintendo.net/ecs/services/rest/AccountGetETickets</nowiki>"<br />
"<nowiki>https://ecs-%.hac.shop.nintendo.net/ecs/services/rest/GetAccountStatus</nowiki>"<br />
<br />
==== ias ====<br />
URLs:<br />
"<nowiki>https://ias-%.hac.shop.nintendo.net/ias/services/rest/Register</nowiki>"<br />
"<nowiki>https://ias-%.hac.shop.nintendo.net/ias/services/rest/GetChallenge</nowiki>"<br />
"<nowiki>https://ias-%.hac.shop.nintendo.net/ias/services/rest/Unregister</nowiki>"<br />
"<nowiki>https://ias-%.hac.shop.nintendo.net/ias/services/rest/GetRegistrationInfo</nowiki>"<br />
"<nowiki>https://ias-%.hac.shop.nintendo.net/ias/services/rest/CompleteETicketSync</nowiki>"<br />
"<nowiki>https://ias-%.hac.shop.nintendo.net/ias/services/rest/AccountTransfer</nowiki>"<br />
"<nowiki>https://ias-%.hac.shop.nintendo.net/ias/services/rest/SyncRegistration</nowiki>"<br />
<br />
== Services ==<br />
The URLs for general online service servers on the Switch usually follow one of these formats:<br />
{server_name}.{environment}.{service_name}.srv.nintendo.net<br />
{server_name}-{environment}.{service_name}.srv.nintendo.net<br />
<br />
Where:<br />
{server_name}: One of the registered server names.<br />
{environment}: "lp1" (production), "dd1" (development) or "sp1" (production lottest staging).<br />
{service_name}: One of the various service names.<br />
<br />
=== Servers ===<br />
* "[[#aauth|aauth-%.ndas.srv.nintendo.net]]"<br />
* "[[#dauth|dauth-%.ndas.srv.nintendo.net]]"<br />
* "[[#znc|api-%.znc.srv.nintendo.net]]"<br />
* "api-%.pctl.srv.nintendo.net"<br />
* "api-%.frs.srv.nintendo.net"<br />
* "app-a04.%.npns.srv.nintendo.net"<br />
* "app-b01.%.npns.srv.nintendo.net"<br />
* "broker.%.npns.srv.nintendo.net"<br />
* "consumer.%.npns.srv.nintendo.net"<br />
* "[[BCAT_services#Data_reporting|receive-%.dg.srv.nintendo.net]]"<br />
* "[[Error_Upload_services|receive-%.er.srv.nintendo.net]]"<br />
* "nncs1-%.n.n.srv.nintendo.net"<br />
* "nncs2-%.n.n.srv.nintendo.net"<br />
* "g<game_server_id>-%.s.n.srv.nintendo.net"<br />
* [4.0.0+] "[[#migration|migration.%.scsi.srv.nintendo.net]]"<br />
* [6.0.0+] "[[#storage|storage.%.scsi.srv.nintendo.net]]"<br />
* [9.0.0+] "[[#storage|storage.%.sata.srv.nintendo.net]]"<br />
* [9.0.0+] "[[#permission|permission.%.sata.srv.nintendo.net]]"<br />
<br />
==== aauth ====<br />
Application authentication.<br />
<br />
URLs:<br />
"<nowiki>https://aauth-%.ndas.srv.nintendo.net/v1/application_auth_token</nowiki>"<br />
"<nowiki>https://aauth-%.ndas.srv.nintendo.net/v1/time</nowiki>"<br />
<br />
[5.0.0+] "<nowiki>https://aauth-%.ndas.srv.nintendo.net/v2-44cd4221f90742b5f37a4948b37dacf024d0bb14dde86db0af20ec300a36a0fe/application_auth_token</nowiki>"<br />
Replaces previous application_auth_token URL.<br />
<br />
==== dauth ====<br />
Device authentication.<br />
<br />
URLs:<br />
"<nowiki>https://dauth-%.ndas.srv.nintendo.net/v1/device_auth_token</nowiki>"<br />
CURLOPT_POSTFIELDS is set to the output from: snprintf(..., "system_version=%08x&client_id=%s", <byte-swapped first 3 bytes from [[System_Version_Title]] loaded via [[Settings_services|settings]] cmd>, "<hard-coded hex string>");<br />
<br />
[4.0.0+] "<nowiki>https://dauth-%.ndas.srv.nintendo.net/439528b578b74475d24ec19264097f17d2cc578c8584816b644e7b7fa93044d7/device_auth_token</nowiki>"<br />
Replaces previous device_auth_token URL. <br />
<br />
[5.0.0+] "<nowiki>https://dauth-%.ndas.srv.nintendo.net/v3-59ed5fa1c25bb2aea8c4d73d74b919a94d89ed48d6865b728f63547943b17404/device_auth_token</nowiki>"<br />
Replaces previous device_auth_token URL.<br />
<br />
[5.0.0+] "<nowiki>https://dauth-%.ndas.srv.nintendo.net/v3-59ed5fa1c25bb2aea8c4d73d74b919a94d89ed48d6865b728f63547943b17404/challenge</nowiki>"<br />
CURLOPT_POSTFIELDS is set to the output from: snprintf(..., "key_generation=%u", 5);<br />
<br />
==== znc ====<br />
Used by the Switch Online app to get app data, like the list of game-specific services to display.<br />
<br />
==== app ====<br />
app-a04* uses XMPP with TLS over port 443, without HTTP. Sample request:<br />
<br />
<code><nowiki><?xml version="1.0"?><stream:stream to="app-a04.lp1.npns.srv.nintendo.net" xml:lang="en" version="1.0" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams"></nowiki></code><br />
<br />
==== migration ====<br />
[[Migration_services|Migration]] service storage.<br />
<br />
==== storage ====<br />
[[OLSC_services|OLSC]] service (.scsi) and repair service (.sata) storage.<br />
<br />
==== permission ====<br />
[[OLSC_services|OLSC]] repair service survey request.<br />
<br />
== Others ==<br />
Miscellaneous domains for various APIs and tests.<br />
<br />
=== Servers ===<br />
Account metadata:<br />
* "e0d67c509fb203858ebcb2fe3f88c2aa.baas.nintendo.com"<br />
* "accounts.nintendo.com"<br />
* "api.accounts.nintendo.com"<br />
* "c-%.accounts.nintendo.com"<br />
* "capi.%.op2.nintendo.net"<br />
<br />
News, friends and game content:<br />
* "bcat-topics-%.cdn.nintendo.net"<br />
* "bcat-list-%.cdn.nintendo.net"<br />
* "bcat-data-%.cdn.nintendo.net"<br />
* "bcat-web-%.cdn.nintendo.net"<br />
* "app.%.five.nintendo.net"<br />
* [6.0.0+] "scsi-policy-%.cdn.nintendo.net"<br />
<br />
Connection:<br />
* "ctest.cdn.nintendo.net" (replaces "conntest.nintendowifi.net")<br />
* "nasc.nintendowifi.net"<br />
<br />
Error and status:<br />
* "[[#service-status|service-status-%.cdn.nintendo.net]]"<br />
* "problems.dragons.nintendo.net"<br />
* "moon.nintendo.com"<br />
<br />
==== service-status ====<br />
[[Error_applet|Error applet]] status.<br />
<br />
URLs:<br />
"<nowiki>https://service-status-%.cdn.nintendo.net/service_status_hac.json</nowiki>"<br />
<br />
= User-Agent =<br />
[[NIM_services|NIM]] generates two User-Agent strings:<br />
snprintf(..., "User-Agent: NintendoSDK Firmware/%s-%u (platform:%s; did:%016llx; eid:%s)", <string at [[System_Version_Title|sysver]]+0x68>, {u32 from [[System_Version_Title|sysver]]+4}, "NX", DeviceId, {[[Sockets_services#GetEnvironmentIdentifier|GetEnvironmentIdentifier]] output});<br />
<br />
snprintf(..., "User-Agent: NintendoSDK Firmware/%s-%u (platform:%s; eid:%s)", <string at [[System_Version_Title|sysver]]+0x68>, {u32 from [[System_Version_Title|sysver]]+4}, "NX", DeviceId, {[[Sockets_services#GetEnvironmentIdentifier|GetEnvironmentIdentifier]] output});<br />
<br />
Where the 64bit DeviceId is parsed from the 0x10-bytes at outbuf+0xC6 from [[Settings_services|set:cal]] GetEciDeviceCertificate (DeviceCert_certname+2, aka where the hex string for the DeviceId is).</div>
Behemoth
https://switchbrew.org/w/index.php?title=Flash_Filesystem&diff=10413
Flash Filesystem
2020-12-05T21:27:25Z
<p>Behemoth: /* System Savegames */</p>
<hr />
<div>= NAND structure =<br />
The Switch's eMMC storage features a large user area, two smaller boot partitions and a replay-protected memory block which is unused (no authentication key is programmed).<br />
<br />
All official partition names come from [[SystemInitializer]].<br />
<br />
== Boot Partitions ==<br />
<br />
'''Boot Partition 0 (0 of 1)'''<br />
<br />
The official name for this partition is "BootPartition1Root" and it has [[Filesystem_services|Bis]] Partition ID == 0.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x000000<br />
| 0x4000<br />
| Normal Firmware [[BCT|BCT]] from [[Title_list#System_Data_Archives|Title 0100000000000819]]<br />
|-<br />
| 0x004000<br />
| 0x4000<br />
| SafeMode Firmware [[BCT|BCT]] from [[Title_list#System_Data_Archives|Title 010000000000081A]]<br />
|-<br />
| 0x008000<br />
| 0x4000<br />
| Normal Firmware [[BCT|BCT]] from [[Title_list#System_Data_Archives|Title 0100000000000819]] (backup)<br />
|-<br />
| 0x00C000<br />
| 0x4000<br />
| SafeMode Firmware [[BCT|BCT]] from [[Title_list#System_Data_Archives|Title 010000000000081A]] (backup)<br />
|-<br />
| 0x010000<br />
| 0xEC000<br />
| 59 additional BCTs, normally unused/empty on retail systems.<br />
|-<br />
| 0x0FC000<br />
| 0x4000<br />
| [[#System Update Control|System Update Control area]]<br />
|-<br />
| 0x100000<br />
| 0x40000<br />
| Normal Firmware [[Package1|package1]] from [[Title_list#System_Data_Archives|Title 0100000000000819]]<br />
|-<br />
| 0x140000<br />
| 0x40000<br />
| Normal Firmware [[Package1|package1]] from [[Title_list#System_Data_Archives|Title 0100000000000819]] (backup)<br />
|-<br />
| 0x180000<br />
| 0x4000<br />
| [[#Keyblob|Keyblob area]]<br />
|-<br />
| 0x184000<br />
| 0x200<br />
| [2.0.0+] [[#NAND Patrol|NAND Patrol area]]<br />
|}<br />
<br />
'''Boot Partition 1 (1 of 1)'''<br />
<br />
The official name for this partition is "BootPartition2Root" and it has [[Filesystem_services|Bis]] Partition ID == 10.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x000000<br />
| 0x40000<br />
| SafeMode Firmware [[Package1|package1]] from [[Title_list#System_Data_Archives|Title 010000000000081A]]<br />
|-<br />
| 0x040000<br />
| 0x40000<br />
| SafeMode Firmware [[Package1|package1]] from [[Title_list#System_Data_Archives|Title 010000000000081A]] (backup)<br />
|-<br />
| 0x080000<br />
| 0x40000<br />
| Reserved<br />
|-<br />
| 0x0C0000<br />
| 0x40000<br />
| Reserved<br />
|}<br />
<br />
=== System Update Control ===<br />
The 0x4000 bytes at offset 0xFC000 are used by [[NS_Services|NS]] and [[Boot|boot]] for keeping track of the status of a system update. This area is used by the [[NS_Services#ISystemUpdateControl|ISystemUpdateControl]] commands [[NS_Services#ApplyDownloadedUpdate|ApplyDownloadedUpdate]], [[NS_Services#ApplyCardUpdate|ApplyCardUpdate]] and [[NS_Services#ApplyReceivedUpdate|ApplyReceivedUpdate]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x1<br />
| BootImages status. Set to 1 by [[NS_Services|NS]] during a system update and cleared by [[Boot|boot]] after restarting.<br />
|-<br />
| 0x1<br />
| 0x1<br />
| BootImagesSafe status. Set to 1 by [[NS_Services|NS]] during a system update and cleared by [[Boot|boot]] after restarting.<br />
|}<br />
<br />
=== Keyblob ===<br />
Starting at offset 0x180000 is an array of 0x200-byte entries, for a total of 32 keyblobs. Each one is unique compared to the others and they are all console unique. This is officially known as the "EKS" (encryption key source) area.<br />
<br />
From each 0x200-byte entry only the first 0xB0 bytes effectively form the keyblob as below.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x10<br />
| Keyblob AES-CMAC over the next 0xA0 bytes (safe against timing attacks)<br />
|-<br />
| 0x10<br />
| 0x10<br />
| Keyblob AES CTR<br />
|-<br />
| 0x20<br />
| 0x90<br />
| Keyblob encrypted payload<br />
|-<br />
| 0xB0<br />
| 0x150<br />
| Unused, all-zero.<br />
|}<br />
<br />
The active bootloader's version (offset 0x2330 in the BCT) acts as an index to control which keyblob should be installed into the system.<br />
[[NS_Services|NS]] uses this during system updates to install the keyblob into the [[BCT#customer_data|customer data]] section in BCTs (offset 0x450).<br />
<br />
[[Boot]] also uses this index for repairing corrupt sectors.<br />
<br />
The currently active keyblob is officially known as "SecureInfo".<br />
<br />
=== NAND Patrol ===<br />
The 0x200 bytes at offset 0x184000 are used by [[Filesystem_services|FS]] for keeping track of NAND patrolling.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x20<br />
| HMAC-SHA-256 over the next 0x1E0 bytes<br />
|-<br />
| 0x20<br />
| 0x4<br />
| Last patrolled NAND block's offset<br />
|-<br />
| 0x24<br />
| 0x4<br />
| NAND patrol count<br />
|-<br />
| 0x28<br />
| 0x1D8<br />
| Unused, all-zero.<br />
|}<br />
<br />
== User Partitions ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Partition name<br />
! Partition type GUID<br />
! Offset<br />
! Size<br />
! [[Filesystem_services|Bis]] Partition ID<br />
! Encrypted<br />
! Description<br />
|-<br />
| N/A<br />
| <br />
| 0x0<br />
| <br />
| 20<br />
| No<br />
| GPT header, Bis-storage also allows raw access to the entire NAND eMMC sectors starting at sector0. The official name for this partition is "UserDataRoot".<br />
|-<br />
| [[Calibration|PRODINFO]]<br />
| {98109E25-64E2-4C95-8A77-414916F5BCEB}<br />
| 0x00004400<br />
| 0x003FBC00<br />
| 27<br />
| Yes (Bis key 0)<br />
| "CAL0" raw partition containing set:cal data. The official name for this partition is "CalibrationBinary".<br />
|-<br />
| [[Calibration|PRODINFOF]]<br />
| {F3056AEC-5449-494C-9F2C-5FDCB75B6E6E}<br />
| 0x00400000<br />
| 0x00400000<br />
| 28<br />
| Yes (Bis key 0)<br />
| FAT12 filesystem, additional calibration. The official name for this partition is "CalibrationFile".<br />
|-<br />
| BCPKG2-1-Normal-Main<br />
| {5365DE36-911B-4BB4-8FF9-AA1EBCD73990}<br />
| 0x00800000<br />
| 0x00800000<br />
| 21<br />
| No<br />
| Raw partition where the first 0x4000 bytes (usually empty) contain the [[BootConfig]] and the remaining space contains the [[Package2|package2]] image from [[Title_list#System_Data_Archives|Title 0100000000000819]] by default. With the exFAT update installed, the [[Package2|package2]] image is switched to the one from [[Title_list#System_Data_Archives|Title 010000000000081B]]. The official name for this partition is "BootConfigAndPackage2Part1".<br />
|-<br />
| BCPKG2-2-Normal-Sub<br />
| {8455717B-BD2B-4162-8454-91695218FC38}<br />
| 0x01000000<br />
| 0x00800000<br />
| 22<br />
| No<br />
| Backup partition for BCPKG2-1-Normal-Main. The official name for this partition is "BootConfigAndPackage2Part2".<br />
|-<br />
| BCPKG2-3-SafeMode-Main<br />
| {8ED6C9A6-9C48-490B-BBEB-001D17A4C0F7}<br />
| 0x01800000<br />
| 0x00800000<br />
| 23<br />
| No<br />
| Raw partition where the first 0x4000 bytes (usually empty) contain the [[BootConfig]] and the remaining space contains the [[Package2|package2]] image from [[Title_list#System_Data_Archives|Title 010000000000081A]] by default. On [4.0.0+] and with the exFAT update installed, the [[Package2|package2]] image is switched to the one from [[Title_list#System_Data_Archives|Title 010000000000081C]]. The official name for this partition is "BootConfigAndPackage2Part3".<br />
|-<br />
| BCPKG2-4-SafeMode-Sub<br />
| {5E99751C-56C9-47CC-AA30-B65039888917}<br />
| 0x02000000<br />
| 0x00800000<br />
| 24<br />
| No<br />
| Backup partition for BCPKG2-3-SafeMode-Main. The official name for this partition is "BootConfigAndPackage2Part4".<br />
|-<br />
| BCPKG2-5-Repair-Main<br />
| {C447D9A2-24B7-468A-98C8-595CD077165A}<br />
| 0x02800000<br />
| 0x00800000<br />
| 25<br />
| No<br />
| Installed at the factory, never written afterwards on retail. In one case this is identical to normal [[1.0.0]] [[Package2|package2]], except this has encrypted data at the end padded for 0x1000-byte alignment. The official name for this partition is "BootConfigAndPackage2Part5".<br />
|-<br />
| BCPKG2-6-Repair-Sub<br />
| {9586E1A1-3AA2-4C90-91B3-2F4A5195B4D2}<br />
| 0x03000000<br />
| 0x00800000<br />
| 26<br />
| No<br />
| Backup partition for BCPKG2-5-Repair-Main. The official name for this partition is "BootConfigAndPackage2Part6".<br />
|-<br />
| SAFE<br />
| {A44F9F6B-4ED3-441F-A34A-56AAA136BC6A}<br />
| 0x03800000<br />
| 0x04000000<br />
| 29<br />
| Yes (Bis key 1)<br />
| FAT32 filesystem. The official name for this partition is "SafeMode".<br />
|-<br />
| SYSTEM<br />
| {ACB0CDF0-4F72-432D-AA0D-5388C733B224}<br />
| 0x07800000 <br />
| 0xA0000000<br />
| 31, 32 and 33<br />
| Yes (Bis key 2)<br />
| FAT32 filesystem. The official names for these partitions are "System", "SystemProperEncryption" and "SystemProperPartition".<br />
|-<br />
| USER<br />
| {2B777F63-E842-47AF-94C4-25A7F18B2280}<br />
| 0xA7800000<br />
| 0x680000000<br />
| 30<br />
| Yes (Bis key 3)<br />
| FAT32 filesystem.<br />
|-<br />
| <br />
| <br />
| 0x747BFFE00<br />
| 0x200<br />
| <br />
| No<br />
| This is the backup GPT header specified by the main GPT header. This is also the last sector readable with Bis-storage paritionID 20.<br />
|}<br />
<br />
If the client process lacks the relevant permission for any of the above partition IDs, error 0x2EE202 is returned.<br />
<br />
[[NCA]]s stored in NAND are raw, identical to the data readable with [[NCM_services#ReadContentIdFile]].<br />
<br />
The filenames for saveimages is just "<lower-case hex u64 saveID>". SYSTEM-partition saveIDs are specified by [[Filesystem_services|FS]] commands, while USER-partition saveIDs are determined by FS-module internally. The high u32 of the saveID is normally either 0x00000000 or 0x80000000.<br />
<br />
Encrypted partitions use AES-XTS using the same non-standard tweak (tweak[0] = sectorIdx[MSB] .. tweak[15] = sectorIdx[LSB], if using 32bit sectorIdx that means tweak[0]..tweak[11] are 0, with tweak[12]..tweak[15] containing big-endian sectorIdx) as other Nintendo AES-XTS code, initial_sector = 0, and sector size 0x4000. All encrypted partitions use console unique keydata.<br />
<br />
=== PRODINFOF ===<br />
PRODINFOF<br />
├── Certifications<br />
│ └── WirelessCertification.png<br />
└── ptd<br />
├── DeviceIdWithEmsBit.dat<br />
├── Ecid.dat<br />
├── prodCode.dat<br />
└── log<br />
├── Process_asm1.log<br />
├── Process_board1.log<br />
├── TestFlagLine.log<br />
├── TestFlagQc.log<br />
├── AGING<br />
│ └── Sequence.log<br />
├── BOARD_TEST<br />
│ └── Sequence.log<br />
├── BOARD_WIRELESS<br />
│ └── Sequence.log<br />
├── FINAL_CHECK<br />
│ └── Sequence.log<br />
├── LCD_AND_KEY<br />
│ └── Sequence.log<br />
└── USB_AND_HP<br />
└── Sequence.log<br />
<br />
==== DeviceIdWithEmsBit.dat ====<br />
Contains a 0x10-byte uppercase hex string, identical to the DeviceId in the [[Settings_services|DeviceCert]].<br />
<br />
=== SYSTEM ===<br />
SYSTEM<br />
├── PRF2SAFE.RCV<br />
├── Contents<br />
│ ├── registered<br />
│ │ └── ... [[NCA]]<br />
│ └── placehld<br />
│ └── ... [[NCA]]<br />
├── [[Savegames|save]]<br />
│ └── ...<br />
└── saveMeta<br />
└── ... (empty?)<br />
<br />
The saves stored under this partition are only for system-titles / etc.<br />
<br />
=== USER ===<br />
USER<br />
├── PRF2SAFE.RCV<br />
├── Album (Same layout as [[SD_Filesystem|SD]])<br />
├── Contents<br />
│ ├── registered<br />
│ │ └── ... [[NCA]]<br />
│ └── placehld<br />
│ └── ... [[NCA]]<br />
├── [[Savegames|save]]<br />
│ └── ...<br />
├── saveMeta<br />
│ └── ... <br />
└── temp <br />
<br />
The saves for all non-system applications, regardless of where the application is located(storageID), is stored here. Each user account which has savedata has a separate saveimage. Save-common for an application is presumably a separate saveimage too. Every saveimage here is ''only'' for applications.<br />
<br />
=== SAFE ===<br />
SAFE<br />
├── PRF2SAFE.RCV<br />
├── Contents<br />
│ ├── registered<br />
│ │ └── ... [[NCA]] (nothing installed?)<br />
│ └── placehld<br />
│ └── ... [[NCA]]<br />
└── [[Savegames|save]]<br />
├── 8000000000000000<br />
└── 8000000000000120<br />
<br />
On a v2.1 system with MountBis, the only thing under here is "PRF2SAFE.RCV".<br />
<br />
= System Savegames =<br />
<br />
This is a listing of known System Savedata and what titles they correspond to.<br />
<br />
{| class="wikitable" border="1"<br />
! SaveID || Owner || Mount || Notes<br />
|-<br />
| 0x8000000000000000 || fs || <nowiki>saveDataIxrDb:/</nowiki>, <nowiki>saveDataIxrDbSf:/</nowiki>, <nowiki>saveDataIxrDbPr:/</nowiki>, <nowiki>saveDataIxrDbSd:/</nowiki> || Contains [[IMKV|imkvdb.arc]] and "lastPublishedId".<br />
|-<br />
| 0x8000000000000010 || account || <nowiki>account:/</nowiki> || Account database.<br />
|-<br />
| 0x8000000000000011 || account || <nowiki>idgen:/</nowiki> ||<br />
|-<br />
| 0x8000000000000020 || nfc || <nowiki>data:/</nowiki> || NFC data and backups.<br />
|-<br />
| 0x8000000000000030 || ns || <nowiki>mii:/</nowiki> || Mii database.<br />
|-<br />
| 0x8000000000000031 || ns || <nowiki>mii:/</nowiki> || Mii test mode database.<br />
|-<br />
| 0x8000000000000040 || ns || <nowiki>apprecdb:/</nowiki> ||<br />
|-<br />
| 0x8000000000000041 || ns || <nowiki>nsaccache:/</nowiki> || Home menu icondata/lru list for recently played games.<br />
|-<br />
| 0x8000000000000043 || ns || <nowiki>ns_appman:/</nowiki> ||<br />
|-<br />
| 0x8000000000000044 || ns || <nowiki>ns_sysup:/</nowiki> || Content update context.<br />
|-<br />
| 0x8000000000000045 || ns || <nowiki>vmdb:/</nowiki> || Required Version List storage. Also contained Version List storage before 7.0.0.<br />
|-<br />
| 0x8000000000000046 || ns || <nowiki>dtlman:/</nowiki> ||<br />
|-<br />
| 0x8000000000000047 || ns || <nowiki>ns_exfat:/</nowiki> ||<br />
|-<br />
| 0x8000000000000048 || ns || <nowiki>ns_systemseed:/</nowiki> ||<br />
|-<br />
| 0x8000000000000049 || ns || <nowiki>ns_ssversion:/</nowiki> || Safe System version.<br />
|-<br />
| 0x800000000000004A || ns || <nowiki>ns_rightsid:/</nowiki> || List of RightsIDs with NCA IDs for corresponding Program title.<br />
|-<br />
| 0x8000000000000050 || settings || <nowiki>SystemSettings:/</nowiki> ||<br />
|-<br />
| 0x8000000000000051 || settings || <nowiki>FwdbgSettingsS:/</nowiki> ||<br />
|-<br />
| 0x8000000000000052 || settings || <nowiki>PrivateSettings:/</nowiki> ||<br />
|-<br />
| 0x8000000000000053 || settings || <nowiki>DeviceSettings:/</nowiki> ||<br />
|-<br />
| 0x8000000000000054 || settings || <nowiki>ApplnSettings:/</nowiki> ||<br />
|-<br />
| 0x8000000000000060 || ssl || <nowiki>SslSave:/</nowiki> ||<br />
|-<br />
| 0x8000000000000070 || nim || <nowiki>nim_sys:/</nowiki> ||<br />
|-<br />
| 0x8000000000000071 || nim || <nowiki>nim_net:/</nowiki> ||<br />
|-<br />
| 0x8000000000000072 || nim || <nowiki>nim_tmp:/</nowiki> ||<br />
|-<br />
| 0x8000000000000073 || nim || <nowiki>nim_dac:/</nowiki> ||<br />
|-<br />
| 0x8000000000000074 || nim || <nowiki>nim_delta:/</nowiki> ||<br />
|-<br />
| 0x8000000000000075 || nim || <nowiki>nim_vac:/</nowiki> ||<br />
|-<br />
| 0x8000000000000076 || nim || <nowiki>nim_local:/</nowiki> ||<br />
|-<br />
| 0x8000000000000077 || nim || <nowiki>nim_lsys:/</nowiki> ||<br />
|-<br />
| 0x8000000000000078 || nim || <nowiki>nim_eca_dbg:/</nowiki> ||<br />
|-<br />
| 0x8000000000000080 || friends || <nowiki>friends:/</nowiki> || Per-user savedata.<br />
|-<br />
| 0x8000000000000081 || friends || <nowiki>friends-sys:/</nowiki> ||<br />
|-<br />
| 0x8000000000000082 || friends || <nowiki>friends-image:/</nowiki> ||<br />
|-<br />
| 0x8000000000000090 || bcat || <nowiki>news:/</nowiki> || Actual news msgpack archives.<br />
|-<br />
| 0x8000000000000091 || bcat || <nowiki>news-sys:/</nowiki> || News metadata, tasklist, history, database, required system version, etc.<br />
|-<br />
| 0x8000000000000092 || bcat || <nowiki>news-dl:/</nowiki> || Storage for newly(?) downloaded news list/data.<br />
|-<br />
| 0x80000000000000A0 || bcat || <nowiki>prepo-sys:/</nowiki> || Play Report system information.<br />
|-<br />
| 0x80000000000000A1 || bcat || <nowiki>prepo:/</nowiki> || Play Report msgpack archives.<br />
|-<br />
| 0x80000000000000A2 || bcat || <nowiki>prepo-ap:/</nowiki> || Play Report msgpack archives of EventId "application_execution_history".<br />
|-<br />
| 0x80000000000000B0 || bsdsockets || <nowiki>nsdsave:/</nowiki> || Socket configuration saved data.<br />
|-<br />
| 0x80000000000000C1 || bcat || <nowiki>bcat-sys:/</nowiki> ||<br />
|-<br />
| 0x80000000000000C2 || bcat || <nowiki>bcat-dl:/</nowiki> ||<br />
|-<br />
| 0x80000000000000D1 || erpt || <nowiki>save:/</nowiki> || Contains "/journal" report listing + actual crash reports ("/%08x-%04x-%04x-%02x%02x-%04x%08x"), which are serialized via [http://msgpack.org/ MsgPack].<br />
|-<br />
| 0x80000000000000E0 || es || <nowiki>escertificate:/</nowiki> ||<br />
|-<br />
| 0x80000000000000E1 || es || <nowiki>escommon:/</nowiki> ||<br />
|-<br />
| 0x80000000000000E2 || es || <nowiki>espersonalized:/</nowiki> ||<br />
|-<br />
| 0x80000000000000E3 || es || <nowiki>esmetarecord:/</nowiki> ||<br />
|-<br />
| 0x80000000000000E4 || es || <nowiki>eselicense:/</nowiki> ||<br />
|-<br />
| 0x80000000000000F0 || ns || <nowiki>pdm:/</nowiki> || Play Data log. Per-user savedata.<br />
|-<br />
| 0x8000000000000100 || pctl || <nowiki>pctlss:/</nowiki> || Parental Control settings.<br />
|-<br />
| 0x8000000000000110 || npns || <nowiki>npns_save:/</nowiki> || Push notifications persistent storage.<br />
|-<br />
| 0x8000000000000120 || ncm || ? || meta/[[IMKV|imkvdb.arc]] for system partition. Cache of data extracted from the [[CNMT]] for installed firmware titles (including 816).<br />
|-<br />
| 0x8000000000000121 || ncm || ? || meta/[[IMKV|imkvdb.arc]] for user partition. Cache of data extracted from the [[CNMT]] for installed game, update, and DLC titles.<br />
|-<br />
| 0x8000000000000122 || || || <br />
|-<br />
| 0x8000000000000130 || migration || <nowiki>state:/</nowiki> || <br />
|-<br />
| 0x8000000000000131 || migration || <nowiki>context:/</nowiki> || <br />
|-<br />
| 0x8000000000000132 || migration || <nowiki>sd_state:/</nowiki> || <br />
|-<br />
| 0x8000000000000133 || migration || <nowiki>sd_context:/</nowiki> || <br />
|-<br />
| 0x8000000000000140 || capsrv || <nowiki>TM:/</nowiki> || <br />
|-<br />
| 0x8000000000000150 || olsc || ? || <br />
|-<br />
| 0x8000000000000153 || olsc || ? || <br />
|-<br />
| 0x8000000000000180 || sdb || ? || Version list was moved here in 7.0.0 or 7.0.1<br />
|-<br />
| 0x8000000000000190 || glue || ? || <br />
|-<br />
| 0x8000000000001010 || qlaunch || || Contains "savedata.dat".<br />
|-<br />
| 0x8000000000001020 || swkbd || || Per-user savedata.<br />
|-<br />
| 0x8000000000001040 || miiEdit || || <br />
|-<br />
| 0x8000000000001050 || miiEdit || || Contains "database.dat". Possibly Mii data and Mii texture data?<br />
|-<br />
| 0x8000000000001060 || shop || || <br />
|-<br />
| 0x8000000000001061 || shop || || Per-user savedata.<br />
|-<br />
| 0x8000000000001070 || web || || <br />
|-<br />
| 0x8000000000001071 || web || || Per-user savedata.<br />
|-<br />
| 0x8000000000001091 || loginShare || || Per-user savedata.<br />
|-<br />
| 0x80000000000010B0 || playerSelect || || Contains "savedata.dat". Per-user savedata.<br />
|-<br />
| 0x80000000000010C0 || myPage || || Per-user savedata.<br />
|-<br />
| 0x8000000000010002 || bcat || || Delivery cache storage for application 010099F00D810000<br />
|-<br />
| 0x8000000000010003 || bcat || || Delivery cache storage for application 0100000000001033<br />
|-<br />
| 0x8000000000010004 || bcat || || Delivery cache storage for application 0100000000001034<br />
|-<br />
| 0x8000000000010005 || bcat || || Delivery cache storage for application 010000000000102E<br />
|}</div>
Behemoth
https://switchbrew.org/w/index.php?title=Flash_Filesystem&diff=10412
Flash Filesystem
2020-12-05T21:27:08Z
<p>Behemoth: /* System Savegames */</p>
<hr />
<div>= NAND structure =<br />
The Switch's eMMC storage features a large user area, two smaller boot partitions and a replay-protected memory block which is unused (no authentication key is programmed).<br />
<br />
All official partition names come from [[SystemInitializer]].<br />
<br />
== Boot Partitions ==<br />
<br />
'''Boot Partition 0 (0 of 1)'''<br />
<br />
The official name for this partition is "BootPartition1Root" and it has [[Filesystem_services|Bis]] Partition ID == 0.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x000000<br />
| 0x4000<br />
| Normal Firmware [[BCT|BCT]] from [[Title_list#System_Data_Archives|Title 0100000000000819]]<br />
|-<br />
| 0x004000<br />
| 0x4000<br />
| SafeMode Firmware [[BCT|BCT]] from [[Title_list#System_Data_Archives|Title 010000000000081A]]<br />
|-<br />
| 0x008000<br />
| 0x4000<br />
| Normal Firmware [[BCT|BCT]] from [[Title_list#System_Data_Archives|Title 0100000000000819]] (backup)<br />
|-<br />
| 0x00C000<br />
| 0x4000<br />
| SafeMode Firmware [[BCT|BCT]] from [[Title_list#System_Data_Archives|Title 010000000000081A]] (backup)<br />
|-<br />
| 0x010000<br />
| 0xEC000<br />
| 59 additional BCTs, normally unused/empty on retail systems.<br />
|-<br />
| 0x0FC000<br />
| 0x4000<br />
| [[#System Update Control|System Update Control area]]<br />
|-<br />
| 0x100000<br />
| 0x40000<br />
| Normal Firmware [[Package1|package1]] from [[Title_list#System_Data_Archives|Title 0100000000000819]]<br />
|-<br />
| 0x140000<br />
| 0x40000<br />
| Normal Firmware [[Package1|package1]] from [[Title_list#System_Data_Archives|Title 0100000000000819]] (backup)<br />
|-<br />
| 0x180000<br />
| 0x4000<br />
| [[#Keyblob|Keyblob area]]<br />
|-<br />
| 0x184000<br />
| 0x200<br />
| [2.0.0+] [[#NAND Patrol|NAND Patrol area]]<br />
|}<br />
<br />
'''Boot Partition 1 (1 of 1)'''<br />
<br />
The official name for this partition is "BootPartition2Root" and it has [[Filesystem_services|Bis]] Partition ID == 10.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x000000<br />
| 0x40000<br />
| SafeMode Firmware [[Package1|package1]] from [[Title_list#System_Data_Archives|Title 010000000000081A]]<br />
|-<br />
| 0x040000<br />
| 0x40000<br />
| SafeMode Firmware [[Package1|package1]] from [[Title_list#System_Data_Archives|Title 010000000000081A]] (backup)<br />
|-<br />
| 0x080000<br />
| 0x40000<br />
| Reserved<br />
|-<br />
| 0x0C0000<br />
| 0x40000<br />
| Reserved<br />
|}<br />
<br />
=== System Update Control ===<br />
The 0x4000 bytes at offset 0xFC000 are used by [[NS_Services|NS]] and [[Boot|boot]] for keeping track of the status of a system update. This area is used by the [[NS_Services#ISystemUpdateControl|ISystemUpdateControl]] commands [[NS_Services#ApplyDownloadedUpdate|ApplyDownloadedUpdate]], [[NS_Services#ApplyCardUpdate|ApplyCardUpdate]] and [[NS_Services#ApplyReceivedUpdate|ApplyReceivedUpdate]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x1<br />
| BootImages status. Set to 1 by [[NS_Services|NS]] during a system update and cleared by [[Boot|boot]] after restarting.<br />
|-<br />
| 0x1<br />
| 0x1<br />
| BootImagesSafe status. Set to 1 by [[NS_Services|NS]] during a system update and cleared by [[Boot|boot]] after restarting.<br />
|}<br />
<br />
=== Keyblob ===<br />
Starting at offset 0x180000 is an array of 0x200-byte entries, for a total of 32 keyblobs. Each one is unique compared to the others and they are all console unique. This is officially known as the "EKS" (encryption key source) area.<br />
<br />
From each 0x200-byte entry only the first 0xB0 bytes effectively form the keyblob as below.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x10<br />
| Keyblob AES-CMAC over the next 0xA0 bytes (safe against timing attacks)<br />
|-<br />
| 0x10<br />
| 0x10<br />
| Keyblob AES CTR<br />
|-<br />
| 0x20<br />
| 0x90<br />
| Keyblob encrypted payload<br />
|-<br />
| 0xB0<br />
| 0x150<br />
| Unused, all-zero.<br />
|}<br />
<br />
The active bootloader's version (offset 0x2330 in the BCT) acts as an index to control which keyblob should be installed into the system.<br />
[[NS_Services|NS]] uses this during system updates to install the keyblob into the [[BCT#customer_data|customer data]] section in BCTs (offset 0x450).<br />
<br />
[[Boot]] also uses this index for repairing corrupt sectors.<br />
<br />
The currently active keyblob is officially known as "SecureInfo".<br />
<br />
=== NAND Patrol ===<br />
The 0x200 bytes at offset 0x184000 are used by [[Filesystem_services|FS]] for keeping track of NAND patrolling.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x20<br />
| HMAC-SHA-256 over the next 0x1E0 bytes<br />
|-<br />
| 0x20<br />
| 0x4<br />
| Last patrolled NAND block's offset<br />
|-<br />
| 0x24<br />
| 0x4<br />
| NAND patrol count<br />
|-<br />
| 0x28<br />
| 0x1D8<br />
| Unused, all-zero.<br />
|}<br />
<br />
== User Partitions ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Partition name<br />
! Partition type GUID<br />
! Offset<br />
! Size<br />
! [[Filesystem_services|Bis]] Partition ID<br />
! Encrypted<br />
! Description<br />
|-<br />
| N/A<br />
| <br />
| 0x0<br />
| <br />
| 20<br />
| No<br />
| GPT header, Bis-storage also allows raw access to the entire NAND eMMC sectors starting at sector0. The official name for this partition is "UserDataRoot".<br />
|-<br />
| [[Calibration|PRODINFO]]<br />
| {98109E25-64E2-4C95-8A77-414916F5BCEB}<br />
| 0x00004400<br />
| 0x003FBC00<br />
| 27<br />
| Yes (Bis key 0)<br />
| "CAL0" raw partition containing set:cal data. The official name for this partition is "CalibrationBinary".<br />
|-<br />
| [[Calibration|PRODINFOF]]<br />
| {F3056AEC-5449-494C-9F2C-5FDCB75B6E6E}<br />
| 0x00400000<br />
| 0x00400000<br />
| 28<br />
| Yes (Bis key 0)<br />
| FAT12 filesystem, additional calibration. The official name for this partition is "CalibrationFile".<br />
|-<br />
| BCPKG2-1-Normal-Main<br />
| {5365DE36-911B-4BB4-8FF9-AA1EBCD73990}<br />
| 0x00800000<br />
| 0x00800000<br />
| 21<br />
| No<br />
| Raw partition where the first 0x4000 bytes (usually empty) contain the [[BootConfig]] and the remaining space contains the [[Package2|package2]] image from [[Title_list#System_Data_Archives|Title 0100000000000819]] by default. With the exFAT update installed, the [[Package2|package2]] image is switched to the one from [[Title_list#System_Data_Archives|Title 010000000000081B]]. The official name for this partition is "BootConfigAndPackage2Part1".<br />
|-<br />
| BCPKG2-2-Normal-Sub<br />
| {8455717B-BD2B-4162-8454-91695218FC38}<br />
| 0x01000000<br />
| 0x00800000<br />
| 22<br />
| No<br />
| Backup partition for BCPKG2-1-Normal-Main. The official name for this partition is "BootConfigAndPackage2Part2".<br />
|-<br />
| BCPKG2-3-SafeMode-Main<br />
| {8ED6C9A6-9C48-490B-BBEB-001D17A4C0F7}<br />
| 0x01800000<br />
| 0x00800000<br />
| 23<br />
| No<br />
| Raw partition where the first 0x4000 bytes (usually empty) contain the [[BootConfig]] and the remaining space contains the [[Package2|package2]] image from [[Title_list#System_Data_Archives|Title 010000000000081A]] by default. On [4.0.0+] and with the exFAT update installed, the [[Package2|package2]] image is switched to the one from [[Title_list#System_Data_Archives|Title 010000000000081C]]. The official name for this partition is "BootConfigAndPackage2Part3".<br />
|-<br />
| BCPKG2-4-SafeMode-Sub<br />
| {5E99751C-56C9-47CC-AA30-B65039888917}<br />
| 0x02000000<br />
| 0x00800000<br />
| 24<br />
| No<br />
| Backup partition for BCPKG2-3-SafeMode-Main. The official name for this partition is "BootConfigAndPackage2Part4".<br />
|-<br />
| BCPKG2-5-Repair-Main<br />
| {C447D9A2-24B7-468A-98C8-595CD077165A}<br />
| 0x02800000<br />
| 0x00800000<br />
| 25<br />
| No<br />
| Installed at the factory, never written afterwards on retail. In one case this is identical to normal [[1.0.0]] [[Package2|package2]], except this has encrypted data at the end padded for 0x1000-byte alignment. The official name for this partition is "BootConfigAndPackage2Part5".<br />
|-<br />
| BCPKG2-6-Repair-Sub<br />
| {9586E1A1-3AA2-4C90-91B3-2F4A5195B4D2}<br />
| 0x03000000<br />
| 0x00800000<br />
| 26<br />
| No<br />
| Backup partition for BCPKG2-5-Repair-Main. The official name for this partition is "BootConfigAndPackage2Part6".<br />
|-<br />
| SAFE<br />
| {A44F9F6B-4ED3-441F-A34A-56AAA136BC6A}<br />
| 0x03800000<br />
| 0x04000000<br />
| 29<br />
| Yes (Bis key 1)<br />
| FAT32 filesystem. The official name for this partition is "SafeMode".<br />
|-<br />
| SYSTEM<br />
| {ACB0CDF0-4F72-432D-AA0D-5388C733B224}<br />
| 0x07800000 <br />
| 0xA0000000<br />
| 31, 32 and 33<br />
| Yes (Bis key 2)<br />
| FAT32 filesystem. The official names for these partitions are "System", "SystemProperEncryption" and "SystemProperPartition".<br />
|-<br />
| USER<br />
| {2B777F63-E842-47AF-94C4-25A7F18B2280}<br />
| 0xA7800000<br />
| 0x680000000<br />
| 30<br />
| Yes (Bis key 3)<br />
| FAT32 filesystem.<br />
|-<br />
| <br />
| <br />
| 0x747BFFE00<br />
| 0x200<br />
| <br />
| No<br />
| This is the backup GPT header specified by the main GPT header. This is also the last sector readable with Bis-storage paritionID 20.<br />
|}<br />
<br />
If the client process lacks the relevant permission for any of the above partition IDs, error 0x2EE202 is returned.<br />
<br />
[[NCA]]s stored in NAND are raw, identical to the data readable with [[NCM_services#ReadContentIdFile]].<br />
<br />
The filenames for saveimages is just "<lower-case hex u64 saveID>". SYSTEM-partition saveIDs are specified by [[Filesystem_services|FS]] commands, while USER-partition saveIDs are determined by FS-module internally. The high u32 of the saveID is normally either 0x00000000 or 0x80000000.<br />
<br />
Encrypted partitions use AES-XTS using the same non-standard tweak (tweak[0] = sectorIdx[MSB] .. tweak[15] = sectorIdx[LSB], if using 32bit sectorIdx that means tweak[0]..tweak[11] are 0, with tweak[12]..tweak[15] containing big-endian sectorIdx) as other Nintendo AES-XTS code, initial_sector = 0, and sector size 0x4000. All encrypted partitions use console unique keydata.<br />
<br />
=== PRODINFOF ===<br />
PRODINFOF<br />
├── Certifications<br />
│ └── WirelessCertification.png<br />
└── ptd<br />
├── DeviceIdWithEmsBit.dat<br />
├── Ecid.dat<br />
├── prodCode.dat<br />
└── log<br />
├── Process_asm1.log<br />
├── Process_board1.log<br />
├── TestFlagLine.log<br />
├── TestFlagQc.log<br />
├── AGING<br />
│ └── Sequence.log<br />
├── BOARD_TEST<br />
│ └── Sequence.log<br />
├── BOARD_WIRELESS<br />
│ └── Sequence.log<br />
├── FINAL_CHECK<br />
│ └── Sequence.log<br />
├── LCD_AND_KEY<br />
│ └── Sequence.log<br />
└── USB_AND_HP<br />
└── Sequence.log<br />
<br />
==== DeviceIdWithEmsBit.dat ====<br />
Contains a 0x10-byte uppercase hex string, identical to the DeviceId in the [[Settings_services|DeviceCert]].<br />
<br />
=== SYSTEM ===<br />
SYSTEM<br />
├── PRF2SAFE.RCV<br />
├── Contents<br />
│ ├── registered<br />
│ │ └── ... [[NCA]]<br />
│ └── placehld<br />
│ └── ... [[NCA]]<br />
├── [[Savegames|save]]<br />
│ └── ...<br />
└── saveMeta<br />
└── ... (empty?)<br />
<br />
The saves stored under this partition are only for system-titles / etc.<br />
<br />
=== USER ===<br />
USER<br />
├── PRF2SAFE.RCV<br />
├── Album (Same layout as [[SD_Filesystem|SD]])<br />
├── Contents<br />
│ ├── registered<br />
│ │ └── ... [[NCA]]<br />
│ └── placehld<br />
│ └── ... [[NCA]]<br />
├── [[Savegames|save]]<br />
│ └── ...<br />
├── saveMeta<br />
│ └── ... <br />
└── temp <br />
<br />
The saves for all non-system applications, regardless of where the application is located(storageID), is stored here. Each user account which has savedata has a separate saveimage. Save-common for an application is presumably a separate saveimage too. Every saveimage here is ''only'' for applications.<br />
<br />
=== SAFE ===<br />
SAFE<br />
├── PRF2SAFE.RCV<br />
├── Contents<br />
│ ├── registered<br />
│ │ └── ... [[NCA]] (nothing installed?)<br />
│ └── placehld<br />
│ └── ... [[NCA]]<br />
└── [[Savegames|save]]<br />
├── 8000000000000000<br />
└── 8000000000000120<br />
<br />
On a v2.1 system with MountBis, the only thing under here is "PRF2SAFE.RCV".<br />
<br />
= System Savegames =<br />
<br />
This is a listing of known System Savedata and what titles they correspond to.<br />
<br />
{| class="wikitable" border="1"<br />
! SaveID || Owner || Mount || Notes<br />
|-<br />
| 0x8000000000000000 || fs || <nowiki>saveDataIxrDb:/</nowiki>, <nowiki>saveDataIxrDbSf:/</nowiki>, <nowiki>saveDataIxrDbPr:/</nowiki>, <nowiki>saveDataIxrDbSd:/</nowiki> || Contains [[IMKV|imkvdb.arc]] and "lastPublishedId".<br />
|-<br />
| 0x8000000000000010 || account || <nowiki>account:/</nowiki> || Account database.<br />
|-<br />
| 0x8000000000000011 || account || <nowiki>idgen:/</nowiki> ||<br />
|-<br />
| 0x8000000000000020 || nfc || <nowiki>data:/</nowiki> || NFC data and backups.<br />
|-<br />
| 0x8000000000000030 || ns || <nowiki>mii:/</nowiki> || Mii database.<br />
|-<br />
| 0x8000000000000031 || ns || <nowiki>mii:/</nowiki> || Mii test mode database.<br />
|-<br />
| 0x8000000000000040 || ns || <nowiki>apprecdb:/</nowiki> ||<br />
|-<br />
| 0x8000000000000041 || ns || <nowiki>nsaccache:/</nowiki> || Home menu icondata/lru list for recently played games.<br />
|-<br />
| 0x8000000000000043 || ns || <nowiki>ns_appman:/</nowiki> ||<br />
|-<br />
| 0x8000000000000044 || ns || <nowiki>ns_sysup:/</nowiki> || Content update context.<br />
|-<br />
| 0x8000000000000045 || ns || <nowiki>vmdb:/</nowiki> || Required Version List storage. Also contained Version List storage before 7.0.0.<br />
|-<br />
| 0x8000000000000046 || ns || <nowiki>dtlman:/</nowiki> ||<br />
|-<br />
| 0x8000000000000047 || ns || <nowiki>ns_exfat:/</nowiki> ||<br />
|-<br />
| 0x8000000000000048 || ns || <nowiki>ns_systemseed:/</nowiki> ||<br />
|-<br />
| 0x8000000000000049 || ns || <nowiki>ns_ssversion:/</nowiki> || Safe System version.<br />
|-<br />
| 0x800000000000004A || ns || <nowiki>ns_rightsid:/</nowiki> || List of RightsIDs with NCA IDs for corresponding Program title.<br />
|-<br />
| 0x8000000000000050 || settings || <nowiki>SystemSettings:/</nowiki> ||<br />
|-<br />
| 0x8000000000000051 || settings || <nowiki>FwdbgSettingsS:/</nowiki> ||<br />
|-<br />
| 0x8000000000000052 || settings || <nowiki>PrivateSettings:/</nowiki> ||<br />
|-<br />
| 0x8000000000000053 || settings || <nowiki>DeviceSettings:/</nowiki> ||<br />
|-<br />
| 0x8000000000000054 || settings || <nowiki>ApplnSettings:/</nowiki> ||<br />
|-<br />
| 0x8000000000000060 || ssl || <nowiki>SslSave:/</nowiki> ||<br />
|-<br />
| 0x8000000000000070 || nim || <nowiki>nim_sys:/</nowiki> ||<br />
|-<br />
| 0x8000000000000071 || nim || <nowiki>nim_net:/</nowiki> ||<br />
|-<br />
| 0x8000000000000072 || nim || <nowiki>nim_tmp:/</nowiki> ||<br />
|-<br />
| 0x8000000000000073 || nim || <nowiki>nim_dac:/</nowiki> ||<br />
|-<br />
| 0x8000000000000074 || nim || <nowiki>nim_delta:/</nowiki> ||<br />
|-<br />
| 0x8000000000000075 || nim || <nowiki>nim_vac:/</nowiki> ||<br />
|-<br />
| 0x8000000000000076 || nim || <nowiki>nim_local:/</nowiki> ||<br />
|-<br />
| 0x8000000000000077 || nim || <nowiki>nim_lsys:/</nowiki> ||<br />
|-<br />
| 0x8000000000000078 || nim || <nowiki>nim_eca_dbg:/</nowiki> ||<br />
|-<br />
| 0x8000000000000080 || friends || <nowiki>friends:/</nowiki> || Per-user savedata.<br />
|-<br />
| 0x8000000000000081 || friends || <nowiki>friends-sys:/</nowiki> ||<br />
|-<br />
| 0x8000000000000082 || friends || <nowiki>friends-image:/</nowiki> ||<br />
|-<br />
| 0x8000000000000090 || bcat || <nowiki>news:/</nowiki> || Actual news msgpack archives.<br />
|-<br />
| 0x8000000000000091 || bcat || <nowiki>news-sys:/</nowiki> || News metadata, tasklist, history, database, required system version, etc.<br />
|-<br />
| 0x8000000000000092 || bcat || <nowiki>news-dl:/</nowiki> || Storage for newly(?) downloaded news list/data.<br />
|-<br />
| 0x80000000000000A0 || bcat || <nowiki>prepo-sys:/</nowiki> || Play Report system information.<br />
|-<br />
| 0x80000000000000A1 || bcat || <nowiki>prepo:/</nowiki> || Play Report msgpack archives.<br />
|-<br />
| 0x80000000000000A2 || bcat || <nowiki>prepo-ap:/</nowiki> || Play Report msgpack archives of EventId "application_execution_history".<br />
|-<br />
| 0x80000000000000B0 || bsdsockets || <nowiki>nsdsave:/</nowiki> || Socket configuration saved data.<br />
|-<br />
| 0x80000000000000C1 || bcat || <nowiki>bcat-sys:/</nowiki> ||<br />
|-<br />
| 0x80000000000000C2 || bcat || <nowiki>bcat-dl:/</nowiki> ||<br />
|-<br />
| 0x80000000000000D1 || erpt || <nowiki>save:/</nowiki> || Contains "/journal" report listing + actual crash reports ("/%08x-%04x-%04x-%02x%02x-%04x%08x"), which are serialized via [http://msgpack.org/ MsgPack].<br />
|-<br />
| 0x80000000000000E0 || es || <nowiki>escertificate:/</nowiki> ||<br />
|-<br />
| 0x80000000000000E1 || es || <nowiki>escommon:/</nowiki> ||<br />
|-<br />
| 0x80000000000000E2 || es || <nowiki>espersonalized:/</nowiki> ||<br />
|-<br />
| 0x80000000000000E3 || es || <nowiki>esmetarecord:/</nowiki> ||<br />
|-<br />
| 0x80000000000000E4 || es || <nowiki>eselicense:/</nowiki> ||<br />
|-<br />
| 0x80000000000000F0 || ns || <nowiki>pdm:/</nowiki> || Play Data log. Per-user savedata.<br />
|-<br />
| 0x8000000000000100 || pctl || <nowiki>pctlss:/</nowiki> || Parental Control settings.<br />
|-<br />
| 0x8000000000000110 || npns || <nowiki>npns_save:/</nowiki> || Push notifications persistent storage.<br />
|-<br />
| 0x8000000000000120 || ncm || ? || meta/[[IMKV|imkvdb.arc]] for system partition. Cache of data extracted from the [[CNMT]] for installed firmware titles (including 816).<br />
|-<br />
| 0x8000000000000121 || ncm || ? || meta/[[IMKV|imkvdb.arc]] for user partition. Cache of data extracted from the [[CNMT]] for installed game, update, and DLC titles.<br />
|-<br />
| 0x8000000000000122 || || || <br />
|-<br />
| 0x8000000000000130 || migration || <nowiki>state:/</nowiki> || <br />
|-<br />
| 0x8000000000000131 || migration || <nowiki>context:/</nowiki> || <br />
|-<br />
| 0x8000000000000132 || migration || <nowiki>sd_state:/</nowiki> || <br />
|-<br />
| 0x8000000000000133 || migration || <nowiki>sd_context:/</nowiki> || <br />
|-<br />
| 0x8000000000000140 || capsrv || <nowiki>TM:/</nowiki> || <br />
|-<br />
| 0x8000000000000150 || olsc || ? || <br />
|-<br />
| 0x8000000000000153 || olsc || ? || <br />
|-<br />
| 0x8000000000000180 || sdb || ? || Version list was moved here in 7.0.0 or 7.0.1<br />
|-<br />
| 0x8000000000000190 || glue || ? || <br />
|-<br />
| 0x8000000000001010 || qlaunch || || Contains "savedata.dat".<br />
|-<br />
| 0x8000000000001020 || swkbd || || Per-user savedata.<br />
|-<br />
| 0x8000000000001040 || miiEdit || || <br />
|-<br />
| 0x8000000000001050 || miiEdit || || Contains "database.dat". Possibly Mii data and Mii texture data?<br />
|-<br />
| 0x8000000000001060 || shop || || <br />
|-<br />
| 0x8000000000001061 || shop || || Per-user savedata.<br />
|-<br />
| 0x8000000000001070 || web || || <br />
|-<br />
| 0x8000000000001071 || web || || Per-user savedata.<br />
|-<br />
| 0x8000000000001091 || loginShare || || Per-user savedata.<br />
|-<br />
| 0x80000000000010B0 || playerSelect || || Contains "savedata.dat". Per-user savedata.<br />
|-<br />
| 0x80000000000010C0 || myPage || || Per-user savedata.<br />
|-<br />
| 0x8000000000010002 || bcat || || Delivery cache storage for application 010099F00D810000<br />
|-<br />
| 0x8000000000010003 || bcat || || Delivery cache storage for application 0100000000001033<br />
|-<br />
| 0x8000000000010004 || bcat || || Delivery cache storage for application 0100000000001033<br />
|-<br />
| 0x8000000000010005 || bcat || || Delivery cache storage for application 010000000000102E<br />
|}</div>
Behemoth
https://switchbrew.org/w/index.php?title=Capmtp_services&diff=10386
Capmtp services
2020-12-03T03:08:51Z
<p>Behemoth: </p>
<hr />
<div>This implements the MTP PTP protocol[https://www.usb.org/document-library/media-transfer-protocol-v11-spec-and-mtp-v11-adopters-agreement].<br />
<br />
= capmtp =<br />
This is "nn::capmtp::ICapmtpRootSession".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || No input. Returns a session of [[#ICapmtpInterface]]<br />
|-<br />
|}<br />
<br />
== ICapmtpInterface ==<br />
This is "nn::capmtp::ICapmtpInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || Takes a u32 max folder count, a u32 max image count, a u32 max video count, a transfer memory handle + u32 size and a type-0x5 buffer translated "Other" utf-16 string.<br />
|-<br />
| 1 || || No input or output. Unmaps transfer memory from Cmd0, stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 2 || || No input or output. Starts MTP command handler thread "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 3 || || No input or output. Stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 4 || || No input. Returns true if "nn.capmtp.CapmtpCommandLoop" is running.<br />
|-<br />
| 5 || || No input. Returns readable event handle. Signaled when the USB connection status changes.<br />
|-<br />
| 6 || || No input. Returns true if a USB connection is established.<br />
|-<br />
| 7 || || No input. Returns readable event handle. Signaled when an error occurred during album scan.<br />
|-<br />
| 8 || || No input or output. Returns the album scan Result.<br />
|-<br />
|}<br />
<br />
== Notes ==<br />
Only PTP operation calls 0x1001-0x100A are available.<br />
<br />
While this has access to [[Filesystem_services#fsp-srv|fsp-srv]] it remains unused.<br />
Images and Videos are loaded with [[Capture_services#caps:a|caps:a]].<br />
<br />
Program names are loaded with [[NS_Services|ns]] using the transfer memory from Cmd0.</div>
Behemoth
https://switchbrew.org/w/index.php?title=Capmtp_services&diff=10385
Capmtp services
2020-12-03T02:54:36Z
<p>Behemoth: </p>
<hr />
<div>This implements the MTP PTP protocol[https://www.usb.org/document-library/media-transfer-protocol-v11-spec-and-mtp-v11-adopters-agreement].<br />
<br />
= capmtp =<br />
This is "nn::capmtp::ICapmtpRootSession".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || No input. Returns a session of [[#ICapmtpInterface]]<br />
|-<br />
|}<br />
<br />
== ICapmtpInterface ==<br />
This is "nn::capmtp::ICapmtpInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || Takes a u32 max folder count, a u32 max image count, a u32 max video count, a transfer memory handle + u32 size and a type-0x5 buffer translated "Other" utf-16 string.<br />
|-<br />
| 1 || || No input or output. Unmaps transfer memory from Cmd0, stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 2 || || No input or output. Starts MTP command handler thread "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 3 || || No input or output. Stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 4 || || No input. Returns true if "nn.capmtp.CapmtpCommandLoop" is running.<br />
|-<br />
| 5 || || No input. Returns readable event handle. Signaled when the USB connection status changes.<br />
|-<br />
| 6 || || No input. Returns true if a USB connection is established.<br />
|-<br />
| 7 || || No input. Returns readable event handle.<br />
|-<br />
| 8 || || No input or output.<br />
|-<br />
|}<br />
<br />
== Notes ==<br />
Only PTP operation calls 0x1001-0x100A are available.<br />
<br />
While this has access to [[Filesystem_services#fsp-srv|fsp-srv]] it remains unused.<br />
Images and Videos are loaded with [[Capture_services#caps:a|caps:a]].<br />
<br />
Program names are loaded with [[NS_Services|ns]] using the transfer memory from Cmd0.</div>
Behemoth
https://switchbrew.org/w/index.php?title=Capmtp_services&diff=10384
Capmtp services
2020-12-03T02:31:53Z
<p>Behemoth: </p>
<hr />
<div>This implements the MTP PTP protocol[https://www.usb.org/document-library/media-transfer-protocol-v11-spec-and-mtp-v11-adopters-agreement].<br />
<br />
= capmtp =<br />
This is "nn::capmtp::ICapmtpRootSession".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || No input. Returns a session of [[#ICapmtpInterface]]<br />
|-<br />
|}<br />
<br />
== ICapmtpInterface ==<br />
This is "nn::capmtp::ICapmtpInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || Takes a u32 max folder count, a u32 max image count, a u32 max video count, a transfer memory handle + u32 size and a type-0x5 buffer translated "Other" utf-16 string.<br />
|-<br />
| 1 || || No input or output. Unmaps transfer memory from Cmd0, stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 2 || || No input or output. Starts MTP command handler thread "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 3 || || No input or output. Stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 4 || || No input. Returns true if "nn.capmtp.CapmtpCommandLoop" is running.<br />
|-<br />
| 5 || || No input. Returns readable event handle.<br />
|-<br />
| 6 || || No input. Returns a boolean.<br />
|-<br />
| 7 || || No input. Returns readable event handle.<br />
|-<br />
| 8 || || No input or output.<br />
|-<br />
|}<br />
<br />
== Notes ==<br />
Only PTP operation calls 0x1001-0x100A are available.<br />
<br />
While this has access to [[Filesystem_services#fsp-srv|fsp-srv]] it remains unused.<br />
Images and Videos are loaded with [[Capture_services#caps:a|caps:a]].<br />
<br />
Program names are loaded with [[NS_Services|ns]] using the transfer memory from Cmd0.</div>
Behemoth
https://switchbrew.org/w/index.php?title=Capmtp_services&diff=10355
Capmtp services
2020-12-01T21:46:24Z
<p>Behemoth: /* Notes */</p>
<hr />
<div>This implements the MTP PTP protocol[https://www.usb.org/document-library/media-transfer-protocol-v11-spec-and-mtp-v11-adopters-agreement].<br />
<br />
= capmtp =<br />
This is "nn::capmtp::ICapmtpRootSession".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || No input. Returns a session of [[#ICapmtpInterface]]<br />
|-<br />
|}<br />
<br />
== ICapmtpInterface ==<br />
This is "nn::capmtp::ICapmtpInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || Takes a u32 max folder count, a u32 max image count, a u32 max video count, a transfer memory handle + u32 size and a type-0x5 buffer translated "Other" string.<br />
|-<br />
| 1 || || No input or output. Unmaps transfer memory from Cmd0, stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 2 || || No input or output. Starts MTP command handler thread "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 3 || || No input or output. Stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 4 || || No input. Returns true if "nn.capmtp.CapmtpCommandLoop" is running.<br />
|-<br />
| 5 || || No input. Returns readable event handle.<br />
|-<br />
| 6 || || No input. Returns a boolean.<br />
|-<br />
| 7 || || No input. Returns readable event handle.<br />
|-<br />
| 8 || || No input or output.<br />
|-<br />
|}<br />
<br />
== Notes ==<br />
Only PTP operation calls 0x1001-0x100A are available.<br />
<br />
While this has access to [[Filesystem_services#fsp-srv|fsp-srv]] it remains unused.<br />
Images and Videos are loaded with [[Capture_services#caps:a|caps:a]].<br />
<br />
Program names are loaded with [[NS_Services|ns]] using the transfer memory from Cmd0.</div>
Behemoth
https://switchbrew.org/w/index.php?title=Capmtp_services&diff=10354
Capmtp services
2020-12-01T21:10:17Z
<p>Behemoth: /* ICapmtpInterface */</p>
<hr />
<div>This implements the MTP PTP protocol[https://www.usb.org/document-library/media-transfer-protocol-v11-spec-and-mtp-v11-adopters-agreement].<br />
<br />
= capmtp =<br />
This is "nn::capmtp::ICapmtpRootSession".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || No input. Returns a session of [[#ICapmtpInterface]]<br />
|-<br />
|}<br />
<br />
== ICapmtpInterface ==<br />
This is "nn::capmtp::ICapmtpInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || Takes a u32 max folder count, a u32 max image count, a u32 max video count, a transfer memory handle + u32 size and a type-0x5 buffer translated "Other" string.<br />
|-<br />
| 1 || || No input or output. Unmaps transfer memory from Cmd0, stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 2 || || No input or output. Starts MTP command handler thread "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 3 || || No input or output. Stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 4 || || No input. Returns true if "nn.capmtp.CapmtpCommandLoop" is running.<br />
|-<br />
| 5 || || No input. Returns readable event handle.<br />
|-<br />
| 6 || || No input. Returns a boolean.<br />
|-<br />
| 7 || || No input. Returns readable event handle.<br />
|-<br />
| 8 || || No input or output.<br />
|-<br />
|}<br />
<br />
== Notes ==<br />
Only operation calls 0x1001-0x100A are available.<br />
<br />
While this has access to [[Filesystem_services#fsp-srv|fsp-srv]] it remains unused.<br />
Images and Videos are loaded with [[Capture_services#caps:a|caps:a]].<br />
<br />
Program names are loaded with [[NS_Services|ns]] using the transfer memory from Cmd0.</div>
Behemoth
https://switchbrew.org/w/index.php?title=11.0.0&diff=10353
11.0.0
2020-12-01T20:34:38Z
<p>Behemoth: add capsrv to ipc changed sysmodules</p>
<hr />
<div>The Switch 11.0.0 system update was released on December 1, 2020 (UTC). This Switch update was released for the following regions: ALL, and CHN.<br />
<br />
Security flaws fixed: <fill this in manually later, see the updatedetails page from the ninupdates-report page(s) once available for now>.<br />
<br />
==Change-log==<br />
[https://en-americas-support.nintendo.com/app/answers/detail/a_id/22525/kw/nintendo%20switch%20system%20update Official] ALL change-log:<br />
* Nintendo Switch Online was added to the HOME Menu.<br />
* <br />
* Access all Nintendo Switch Online services, from getting the latest information to checking your membership status.<br />
* *This feature is not available in some countries/regions.<br />
* <br />
* A new feature that automatically downloads backed up save data was added to the Save Data Cloud.<br />
* <br />
* When using software with the same Nintendo Account linked to multiple systems, save data backed up from one console will automatically be downloaded to your other system(s).<br />
* *To use this feature, it must be enabled under System Settings > Data Management > Save Data Cloud.<br />
* *Save data will not be downloaded automatically unless save data for that software exists on the console. The first time only, users must download the save data manually.<br />
* *A Nintendo Switch Online membership is required to use the Save Data Cloud service.<br />
* <br />
* A new Trending feature was added to the User Page.<br />
* <br />
* Users can check what software their friends are playing or have started playing recently.<br />
* Information will not be displayed for friends who have their online status set to display to no one.<br />
* <br />
* Users can now transfer screenshots and videos from Album to their smart devices.<br />
* <br />
* Users can wirelessly connect their smart devices to Nintendo Switch to transfer the screenshots and videos saved within their Album.<br />
* For screenshots, users can transfer a maximum of 10 screenshots and 1 video capture at once.<br />
* *To connect, users must use their smart device to scan the QR Code displayed on the Nintendo Switch screen.<br />
* For more information, please refer to the Nintendo Support website.<br />
* *“QR Code” is a registered trademark of DENSO WAVE INCORPORATED.<br />
* <br />
* <br />
* A new Copy to a Computer via USB Connection feature was added under System Settings > Data Management > Manage Screenshots and Videos.<br />
* <br />
* Users can use a USB cable to connect Nintendo Switch to their computers to copy the screenshots and videos saved under Album.<br />
* * A USB charging cable [model HAC-010] or a USB-IF certified USB cable that supports data transfer is required to connect to a computer.<br />
* For more information, please refer to the Nintendo Support website.<br />
* * Connection via the Nintendo Switch dock is not supported. Please connect the Nintendo Switch system directly to the computer.<br />
* <br />
* <br />
* Users can now select what download to prioritize when there are multiple downloads in progress.<br />
* <br />
* When there are multiple software, update data, or downloadable content downloads in progress, users can now select which they want to download first.<br />
* You can set this under Download Options by selecting the icon for the software you want to download first on the HOME Menu.<br />
* <br />
* <br />
* User icons were added.<br />
* <br />
* 12 user icons that commemorate the 35th anniversary of the Super Mario Bros. series were added.<br />
* <br />
* Users can now name preset button mappings with the Change Button Mapping feature.<br />
* Brazilian Portuguese was added as a supported language.<br />
* <br />
* When users set their region to the Americas and their language to Português, the language used on the HOME Menu and in certain software will be displayed in Brazilian Portuguese.<br />
* <br />
* Several issues were fixed, and usability and stability were improved.<br />
<br />
===BootImagePackage===<br />
All files in RomFS were updated.<br />
<br />
====Secure Monitor====<br />
Secure Monitor was updated.<br />
<br />
* The firmware revision magic was changed from 0x1AD to 0x1CE.<br />
* Support was added for an additional DRAM model.<br />
<br />
====Warmboot====<br />
* The firmware revision magic was changed from 0x1AD to 0x1CE.<br />
<br />
====Kernel====<br />
* Kernel is now built with -Os instead of -O3<br />
** Many functions are no longer inlined.<br />
* crt0 deprivileging code now sets hypervisor EL2 registers.<br />
* Logic for flushing entire data cache and invalidating entire TLB during init is now a function called by JumpFromEL2ToEL1 and DisableMmuICacheAndDCache instead of being duplicated.<br />
* Initialize0 has had several things re-ordered/shuffled:<br />
** InsertDevicePhysicalMemoryBlocks is now called immediately after the KernelCode region is inserted.<br />
** "Needed device virtual space" is now calculated as 3 * (0x18000 + { sum of KernelAutoMap physical device regions } + GetUnknownDebugDeviceRegionSize()<br />
** KernelMisc region size is now util::AlignUp(std::max(needed_device_virtual_space, 32_MB), 2_MB).<br />
** Code for mapping the unknown debug address as UnknownDebug is no longer present.<br />
** Slab region is now memset to zero after the linear region is mapped instead of before.<br />
** Ranges are now more uniform; value in [range address / 2_MB, last_address / 2_MB] is generated and multipled by 2 MB instead of aligning down result.<br />
* KMemoryRegion now has a "last_address" member replacing its "size" member.<br />
** GetSize() now calculated as (last_address - address + 1)<br />
* KMemoryRegionTree::Insert now takes in last address instead of size.<br />
** Several callsites now verify that last_address != 0xFFFF...<br />
* "Virtual" cores now supported, KThread now stores core ID/affinity for both virtual and physical.<br />
* New SVC 0x37 "GetResourceLimitPeakValue"<br />
** Returns the highest value that a resource limit's current has ever achieved.<br />
** KResourceLimit now stores an array of peak values to enable this<br />
* Two new kernel objects, KAlpha and KBeta (placeholder names, true object names are unknown and cannot be guessed without observing purpose).<br />
** KAlpha has size 0x50, KBeta has size 0x88<br />
** KObjectAllocators for KAlpha/KBeta receive counts 1, 6.<br />
** KProcess has a list of KBeta, intrusive list node is at KBeta + 0x68.<br />
* Four new SVCs, ID 0x39, 0x3A, 0x46, 0x47<br />
** These are likely for interacting with KAlpha and KBeta, but on NX they are (presumably) if-def'd to be "return svc::ResultNotImplemented()"<br />
* KThread had all of its members reordered and its unused members deleted<br />
* Most KThread waits now use KThreadWaiterListIntrusiveNode instead of KThreadQueue<br />
* KConditionVariable no longer uses global threads for the call to .nfind()<br />
* KCoreLocalRegion deleted, replaced with pointer-to-current-thread<br />
** TPIDR_EL1 != X18 now, and TPIDR_EL1 now always points to the exception thread stack.<br />
* KSynchronization was deleted, replaced with namespaced or static-on-ksynchronization-object functions<br />
* KSynchronizationObject now contains a pointer to thread queue, instead of an inline list<br />
* KInterruptEvent no longer has an InterruptEventTask member<br />
* KInterruptEventTask::Reset no longer calls KInterruptManager::ClearInterrupt, instead it calls a new function which returns a result<br />
* KInterruptEventTask now has a KLightLock member<br />
* KHardwareTimer is now an interrupt task again<br />
* KHardwareTimer now has a new member "maximum_time", set to std::numeric_limits<s64>::value().<br />
** Tasks will only be added to the task list if their time is <= maximum_time, this is in addition to the >= 1 checks previously.<br />
* KIntrusiveRedBlackTreeNode now has common member functions instead of templated, size is now packed to 0x1C instead of 0x20.<br />
** All Insert/Remove/etc operations are common regardless of the type the node is intrusive in.<br />
* KDebugLogImpl::Initialize() now assumes uart has been configured for logging by the secure monitor, and does not perform tegra uart init sequence<br />
* vsprintf, KDebugString::PutString are now fully inlined inside KVPrintf.<br />
* KObjectContainer::Insert now returns void instead of Result<br />
** Code which previously did R_TRY() now just calls.<br />
* KPageHeapBitmapRng now has TinyMt as a data member, instead of directly implementing KPageHeap.<br />
** This affects how constructor is invoked.<br />
* KMemoryBlock/KMemoryInfo now has extra members tracking u8 non_contig_bitflags, u16 ipc_non_contig_lock_count, u16 device_non_contig_lock_count<br />
* KMemoryBlockManager Update now takes non-contig flags to determine where to coalesce (all coalescing must now happen forwards instead of either direction)<br />
* KMemoryBlockManagerUpdateAllocator no longer has a result member, instead it has ->Initialize() which takes in a number of blocks to allocate<br />
* KMemoryManager::Allocate, KMemoryManager::AllocatePageGroup, KMemoryManager::AllocatePageGroupForProcess, now call KPageGroup::Open on the returned page group.<br />
** All callsites for these functions no longer call open after allocating.<br />
* KMemoryManager::Open is now KMemoryManager::OpenAdditionalReference, now checks that refcount is >= 1 instead of >= 0<br />
* KPageTableBase now has an additional data member "disable_device_address_space_merge"<br />
** KProcessPageTable::Initialize now takes in (process flags & 0x1000) as a bool argument to set this.<br />
* Page table Query operations now return a number of blocks required to support the above when relevant<br />
* KPageTable now uses 4 sw-reserved bits instead of 1<br />
** Former bit 0x01.... ("Is Mapped") is now bit 0x40..... (PTE bit 58)<br />
** PTE bit 55 "contiguous not allowed" was reworked for significantly more fine-grained control<br />
*** PTE bit 55 is now "start of block non-contiguous", coalescing cannot occur if the first block in a coalesce has this block set.<br />
*** PTE bit 56 is now "not-end-of-block non-contiguous", coalescing cannot occur if a block other than the last in a coalesce has this bit set<br />
*** PTE bit 57 is now "end of block non-contiguous", coalescing cannot occur if the last block in a coalesce has this bit set<br />
*** The old non-contiguous semantics are equivalent to 56 + 57 together.<br />
** These bits are now returned by KPageTableImpl::Traverse<br />
** Upper byte of KPageProperties is now bitflags to control management of these bits.<br />
** Bit 0x1 = "Set/Clear PTE Bit55"<br />
** Bit 0x2 = "Set PTE Bit56"<br />
** Bit 0x4 = "Clear PTE Bit56"<br />
** Bit 0x8 = "Set PTE Bit57"<br />
** Bit 0x10 = "Clear PTE Bit57"<br />
** Bit 0x20 = Force-Clear 56+57 + attempt to merge<br />
* KMemoryBlockManager/KPageTable now prevent coalescing of blocks which are reprotected --- (for transfer memory, ipc, ...)<br />
* They also do not coalesce adjacent GPU mappings that were mapped separately.<br />
* They removed the 0x80 "AnyLocked" bit from KMemoryAttribute<br />
* KMemoryBlock/KMemoryInfo now have additional u16 "device_non_coalesce_right_count".<br />
** Like device_non_coalesce_left_count from previous 11.x, this now prevents merging with block to the right if set.<br />
* KMemoryBlock::Add now takes in the memory block to the right instead of the size of the block to the right.<br />
** This facilitates combining flags for the newly coalesced blocks.<br />
* KPageTableBase::SetProcessMemoryPermission no longer sets non-coalesce bit 24.<br />
* KDeviceAddressSpace::Map/KDeviceAddressSpace::Unmap now call new KPageTableBase function to update non-coalesce state according to partial map state.<br />
* KDevicePageTable::UnmapImpl now invalidates TlbGroup in the failure case of adding to the page group.<br />
* KPageTableBase::MakeAndOpenContiguousPageGroup is now KPageTableBase::MakePageGroupForDeviceAddressSpace, and now prevents coalescing until call completion.<br />
** non_coalesce_mask 0x10 is used for this.<br />
* KPageTableBase::UnmapCodeMemory no longer requires the whole range have the same state.<br />
** It now invalidates instruction cache if any pages are code.<br />
* KPageTable::UnknownVirtualFunction10 now takes in more arguments: _QWORD (address probably), _QWORD (size probably), two bools, _QWORD (address2 probably), _QWORD (size2 probably), void * (probably KAlpha * or KBeta *)<br />
** Returns whether a comparison between address_probably and address_2_probably holds depending on flags at pointer + 0x10.<br />
* KMemoryState_Io now goes to the alias code region in GetRegionAddress/Size (weird, seems like incorrect behavior)<br />
** Also very weird: KPageTableBase::MapIo maps IO into the kernel map region, but KPageTableBase::QueryMapping panics if it is not in the alias code region.<br />
** This "probably" causes kernel panic if mapping IO into process with 32-bit-no-alias address space type?<br />
<br />
====FIRM Sysmodules====<br />
FIRM sysmodules were updated. Specific diffs available below:<br />
<check back for more diffs later><br />
<br />
==System Titles==<br />
* All titles were updated, except for the following (minus stubbed titles): SharedFont, Dictionary, UrlBlackList, LibraryAppletMiiEdit.<br />
* The previously stubbed 010000000000001B sysmodule was replaced with [[Capmtp_services|capmtp]].<br />
<br />
The following sysmodules had IPC changes: [[USB_services|usb]], [[Settings_services|settings]], [[BCAT_services|bcat]], [[PTM_services|ptm]], [[Sockets_services|bsdsockets]], [[HID_services|hid]], [[Audio_services|audio]], [[WLAN_services|wlan]], [[Account_services|account]], [[NS_Services|ns]], [[PSC_services|psc]], [[Applet_Manager_services|am]], [[NIM_services|nim]], [[Display_services|vi]], [[Parental_Control_services|pctl]], [[Glue_services|glue]], [[ETicket_services|es]], [[Shared_Database_services|sdb]], [[OLSC_services|olsc]], [[PGL_services|pgl]], [[Filesystem_services|fs]], [[Loader_services|loader]], [[Services_API|sm]], [[Capture_services|capsrv]].<br />
<br />
[[NPDM]] changes (see [[Services_API]] for service-hosting changes):<br />
* All updated NPDMs now have [[NPDM#Flags|Flags]] bit5 set.<br />
* ptm: Access to hshl:set and ins:r were added.<br />
* ptm/hid: Various services were re-ordered in the Service Access Control.<br />
* wlan now has access to csrng.<br />
* ldn now has access to pl:u.<br />
* pcv now has access to hshl:set.<br />
* account now has access to ectx:w.<br />
* ns now has access to pl:u.<br />
* am: Access to the following was added: arp:r, aud:a, aud:d. Access to the following was removed: audin:a, audin:d, audout:a, audout:d, audren:a, audren:d. Access to hshl:set/hshl:sys was added.<br />
* erpt: Access to svcGetResourceLimitLimitValue and svc 0x37 were added. Access to ectx:r was added.<br />
* vi: The Handle Table Size was changed from 160 to 192. Access to the following services were added: erpt:c, gpio, i2c, lm, psc:m, pwm.<br />
* glue now has access to hshl:sys, and access to psm was removed.<br />
* creport now has access to fsp-srv.<br />
* sdb now has access to bcat:s and pm:info.<br />
* migration now has access to prepo:u.<br />
* qlaunch now has access to [[Capmtp_services|capmtp]].<br />
* [[Controller_Applet|LibraryAppletController]] now has access to [[NGCT_services|ngct:u]].<br />
* [[Profile_Selector|LibraryAppletPlayerSelect]] now has access to [[OLSC_services|olsc:s]].<br />
* [[Album_Applet|LibraryAppletPhotoViewer]]: Access to [[Sockets_services|bsd:u]] was replaced with [[Sockets_services|bsd:s]]. Access to [[LDN_services|lp2p:sys]] was added. Access to [[NS_Services|ns:am2]] was replaced with [[NS_Services|ns:ro]]. FS permission bit0 is now clear, MountContent* is no longer accessible.<br />
* [[Internet_Browser|LibraryAppletLoginShare]] now has access to [[NS_Services|ns:web]].<br />
<br />
RomFs changes:<br />
* CertStore was [[SSL_services#CertStore|updated]].<br />
* ErrorMessage: New errors were added / localization changes.<br />
* BrowserDll: The following was updated: "/browser/ErrorPageFilteringTemplate.html", "/browser/MediaControls.css", "/browser/MediaControls.js", "/browser/RootCaEtc.pem", "/browser/RootCaSdkAdditional.pem", "/buildinfo/buildinfo.dat". The following was added: "/browser/MediaControlsInline.css", "/browser/MediaControlsInline.js".<br />
** "/dll_0" and "/dll_1" were moved into "/nro/netfront/dll_{0/1}".<br />
** "/lyt/Lhub.arc" was added.<br />
** "/message/USpt/" was added.<br />
* Help:<br />
** "/legallines.htdocs/index.html" updated<br />
** "/safe.htdocs/html/USpt/" added<br />
** "/safe.htdocs/img/recyclenintendo.jpg" updated<br />
** "/safe.htdocs/js/tapaction.js" updated<br />
* NgWord: updated<br />
* AvatarImage: More icons added.<br />
* LocalNews: Added "/message/revision.txt" and "/message/USpt/".<br />
* Eula:<br />
** "/revision.txt" updated<br />
** Updated "/EUru/Eula.msbt.szs", "/JPja/Eula.msbt.szs".<br />
** Added "/USpt/".<br />
* TimeZoneBinary: TZ info updated.<br />
* FontNintendoExtension: "/nintendo_ext_003.bfttf" and "/nintendo_ext2_003.bfttf" were updated.<br />
* FirmwareDebugSettings: updated<br />
* FatalMessage: Updated "/pt-BR/GeneralMessage" and "/pt-BR/QuestMessage" were updated.<br />
* ControllerIcon: "/lyt/ColorTable" updated<br />
* PlatformConfigIcosa/PlatformConfigCopper/PlatformConfigHoag/PlatformConfigIcosaMariko: updated<br />
* ControllerFirmware: "/TouchScreenFirmwareInfo.csv" updated<br />
* NgWord2: updated<br />
* FunctionBlackList:<br />
** "/blacklist.dat" was replaced with "/blacklist.json".<br />
* NgWordT: updated<br />
* Applets: Various UI/graphics/sound/localization changes.<br />
* Web-applets: "/buildinfo/buildinfo.dat" was updated, and "/.nrr/netfront.nrr" was renamed to "/.nrr/dll.nrr".<br />
<br />
==See Also==<br />
System update report(s):<br />
* [https://yls8.mtheall.com/ninupdates/reports.php?date=2020-12-01_00-02-35&sys=hac]<br />
<br />
<br />
{{NavboxVersions}}<br />
<br />
[[Category:System versions]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=Capmtp_services&diff=10326
Capmtp services
2020-12-01T17:58:20Z
<p>Behemoth: </p>
<hr />
<div>This implements the MTP PTP protocol[https://www.usb.org/document-library/media-transfer-protocol-v11-spec-and-mtp-v11-adopters-agreement].<br />
<br />
= capmtp =<br />
This is "nn::capmtp::ICapmtpRootSession".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || No input. Returns a session of [[#ICapmtpInterface]]<br />
|-<br />
|}<br />
<br />
== ICapmtpInterface ==<br />
This is "nn::capmtp::ICapmtpInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || Takes a u32 max folder count, a u32 max image count, a u32 max video count, a transfer memory handle + u32 size and a type-0x5 buffer translated "Other" string.<br />
|-<br />
| 1 || || No input or output.<br />
|-<br />
| 2 || || No input or output. Starts MTP command handler "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 3 || || No input or output. Stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 4 || || No input. Returns true if "nn.capmtp.CapmtpCommandLoop" is running.<br />
|-<br />
| 5 || || No input. Returns readable event handle.<br />
|-<br />
| 6 || || No input. Returns a boolean.<br />
|-<br />
| 7 || || No input. Returns readable event handle.<br />
|-<br />
| 8 || || No input or output.<br />
|-<br />
|}<br />
<br />
== Notes ==<br />
Only operation calls 0x1001-0x100A are available.<br />
<br />
While this has access to [[Filesystem_services#fsp-srv|fsp-srv]] it remains unused.<br />
Images and Videos are loaded with [[Capture_services#caps:a|caps:a]].<br />
<br />
Program names are loaded with [[NS_Services|ns]] using the transfer memory from Cmd0.</div>
Behemoth
https://switchbrew.org/w/index.php?title=Capmtp_services&diff=10293
Capmtp services
2020-12-01T04:39:10Z
<p>Behemoth: </p>
<hr />
<div>This implements the MTP PTP protocol[https://www.usb.org/document-library/media-transfer-protocol-v11-spec-and-mtp-v11-adopters-agreement].<br />
<br />
= capmtp =<br />
This is "nn::capmtp::ICapmtpRootSession".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || No input. Returns a session of [[#ICapmtpInterface]]<br />
|-<br />
|}<br />
<br />
== ICapmtpInterface ==<br />
This is "nn::capmtp::ICapmtpInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || ||<br />
|-<br />
| 1 || || No input or output.<br />
|-<br />
| 2 || || No input or output. Starts MTP command handler "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 3 || || No input or output. Stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 4 || || No input. Returns true if "nn.capmtp.CapmtpCommandLoop" is running.<br />
|-<br />
| 5 || || No input. Returns readable event handle.<br />
|-<br />
| 6 || || No input. Returns a boolean.<br />
|-<br />
| 7 || || No input. Returns readable event handle.<br />
|-<br />
| 8 || || No input or output.<br />
|-<br />
|}<br />
<br />
== Notes ==<br />
Only operation calls 0x1001-0x100A are available.</div>
Behemoth
https://switchbrew.org/w/index.php?title=Capmtp_services&diff=10292
Capmtp services
2020-12-01T04:22:36Z
<p>Behemoth: </p>
<hr />
<div>This implements the MTP PTP protocol[https://www.usb.org/document-library/media-transfer-protocol-v11-spec-and-mtp-v11-adopters-agreement].<br />
<br />
= capmtp =<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || No input. Returns a session of [[#ICapmtpInterface]]<br />
|-<br />
|}<br />
<br />
== ICapmtpInterface ==<br />
This is "nn::capmtp::ICapmtpInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || ||<br />
|-<br />
| 1 || ||<br />
|-<br />
| 2 || || No input or output. Starts MTP command handler "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 3 || || No input or output. Stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 4 || || No input. Returns true if "nn.capmtp.CapmtpCommandLoop" is running.<br />
|-<br />
| 5 || ||<br />
|-<br />
| 6 || ||<br />
|-<br />
| 7 || ||<br />
|-<br />
| 8 || ||<br />
|-<br />
|}<br />
<br />
== Notes ==<br />
Only operation calls 0x1001-0x100A are available.</div>
Behemoth
https://switchbrew.org/w/index.php?title=Capmtp_services&diff=10291
Capmtp services
2020-12-01T04:20:58Z
<p>Behemoth: </p>
<hr />
<div>= capmtp =<br />
This implements the MTP PTP protocol[https://www.usb.org/document-library/media-transfer-protocol-v11-spec-and-mtp-v11-adopters-agreement].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || No input. Returns a session of [[#ICapmtpInterface]]<br />
|-<br />
|}<br />
<br />
== ICapmtpInterface ==<br />
This is "nn::capmtp::ICapmtpInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || ||<br />
|-<br />
| 1 || ||<br />
|-<br />
| 2 || || No input or output. Starts MTP command handler "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 3 || || No input or output. Stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 4 || || No input. Returns true if "nn.capmtp.CapmtpCommandLoop" is running.<br />
|-<br />
| 5 || ||<br />
|-<br />
| 6 || ||<br />
|-<br />
| 7 || ||<br />
|-<br />
| 8 || ||<br />
|-<br />
|}<br />
<br />
== Notes ==<br />
Only operation calls 0x1001-0x100A are available.</div>
Behemoth
https://switchbrew.org/w/index.php?title=Capmtp_services&diff=10290
Capmtp services
2020-12-01T04:20:31Z
<p>Behemoth: </p>
<hr />
<div>= capmtp =<br />
This implements the MTP PTP protocol[https://www.usb.org/document-library/media-transfer-protocol-v11-spec-and-mtp-v11-adopters-agreement].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || No input. Returns a session of [[#ICapmtpInterface]]<br />
|-<br />
|}<br />
<br />
== ICapmtpInterface ==<br />
This is "nn::capmtp::ICapmtpInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 ||<br />
|-<br />
| 1 ||<br />
|-<br />
| 2 || || No input or output. Starts MTP command handler "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 3 || || No input or output. Stops "nn.capmtp.CapmtpCommandLoop".<br />
|-<br />
| 4 || || No input. Returns true if "nn.capmtp.CapmtpCommandLoop" is running.<br />
|-<br />
| 5 ||<br />
|-<br />
| 6 ||<br />
|-<br />
| 7 ||<br />
|-<br />
| 8 ||<br />
|-<br />
|}<br />
<br />
== Notes ==<br />
Only operation calls 0x1001-0x100A are available.</div>
Behemoth
https://switchbrew.org/w/index.php?title=Capmtp_services&diff=10284
Capmtp services
2020-12-01T03:07:42Z
<p>Behemoth: Add capmtp</p>
<hr />
<div>= capmtp =<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || || No input or output. Returns a session of [[#ICapmtpInterface]]<br />
|-<br />
|}<br />
<br />
== ICapmtpInterface ==<br />
This is "nn::capmtp::ICapmtpInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 ||<br />
|-<br />
| 1 ||<br />
|-<br />
| 2 ||<br />
|-<br />
| 3 ||<br />
|-<br />
| 4 ||<br />
|-<br />
| 5 ||<br />
|-<br />
| 6 ||<br />
|-<br />
| 7 ||<br />
|-<br />
| 8 ||<br />
|-<br />
|}</div>
Behemoth
https://switchbrew.org/w/index.php?title=Capture_services&diff=10280
Capture services
2020-12-01T02:17:05Z
<p>Behemoth: /* caps:u */</p>
<hr />
<div>= caps:a =<br />
This is "nn::capsrv::sf::IAlbumAccessorService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetAlbumFileCount<br />
|-<br />
| 1 || GetAlbumFileList<br />
|-<br />
| 2 || LoadAlbumFile<br />
|-<br />
| 3 || DeleteAlbumFile<br />
|-<br />
| 4 || StorageCopyAlbumFile<br />
|-<br />
| 5 || IsAlbumMounted<br />
|-<br />
| 6 || GetAlbumUsage<br />
|-<br />
| 7 || GetAlbumFileSize<br />
|-<br />
| 8 || LoadAlbumFileThumbnail<br />
|-<br />
| 9 || [2.0.0+] LoadAlbumScreenShotImage<br />
|-<br />
| 10 || [2.0.0+] LoadAlbumScreenShotThumbnailImage<br />
|-<br />
| 11 || [2.0.0+] GetAlbumEntryFromApplicationAlbumEntry<br />
|-<br />
| 12 || [3.0.0+] LoadAlbumScreenShotImageEx<br />
|-<br />
| 13 || [3.0.0+] LoadAlbumScreenShotThumbnailImageEx<br />
|-<br />
| 14 || [3.0.0+] LoadAlbumScreenShotImageEx0<br />
|-<br />
| 15 || [4.0.0+] GetAlbumUsage3<br />
|-<br />
| 16 || [4.0.0+] GetAlbumMountResult<br />
|-<br />
| 17 || [4.0.0+] GetAlbumUsage16<br />
|-<br />
| 18 || [6.0.0+]<br />
|-<br />
| 19 || [11.0.0+]<br />
|-<br />
| 100 || [5.0.0+] GetAlbumFileCountEx0<br />
|-<br />
| 101 || [5.0.0+] GetAlbumFileListEx0<br />
|-<br />
| 202 || [1.0.0-2.3.0] SaveEditedScreenShot<br />
|-<br />
| 301 || GetLastOverlayScreenShotThumbnail<br />
|-<br />
| 302 || [4.0.0+] GetLastOverlayMovieThumbnail<br />
|-<br />
| 401 || GetAutoSavingStorage<br />
|-<br />
| 501 || GetRequiredStorageSpaceSizeToCopyAll<br />
|-<br />
| 1001 || [3.0.0+] LoadAlbumScreenShotThumbnailImageEx0<br />
|-<br />
| 1002 || [3.0.0+] LoadAlbumScreenShotImageEx1<br />
|-<br />
| 1003 || [4.0.0+] LoadAlbumScreenShotThumbnailImageEx1<br />
|-<br />
| 8001 || ForceAlbumUnmounted<br />
|-<br />
| 8002 || ResetAlbumMountStatus<br />
|-<br />
| 8011 || RefreshAlbumCache<br />
|-<br />
| 8012 || GetAlbumCache<br />
|-<br />
| 8013 || [4.0.0+] GetAlbumCacheEx<br />
|-<br />
| 8021 || [2.0.0+] GetAlbumEntryFromApplicationAlbumEntryAruid<br />
|-<br />
| 10011 || SetInternalErrorConversionEnabled<br />
|-<br />
| 50000 || [6.0.0+] LoadMakerNoteInfoForDebug<br />
|-<br />
| 60002 || [4.0.0+] OpenAccessorSession<br />
|}<br />
<br />
Cmd18: Takes a type-70 buffer and returns a bool. If the buffer is sufficient it writes two application ID's to the buffer (0x100000000001000 and 0x100000000001fff) and returns true. This is used by photoViewer to group all screenshots of applets.<br />
<br />
Cmd19: Takes an input [[#AlbumFileId]] and a type-0x6 output buffer. Writes the filename of the corresponding file to the buffer.<br />
<br />
Cmd1002: Takes a total of 0x38-bytes of input, two type-0x5 input buffers, and returns 0x20-bytes of output. [4.0.0+] No longer returns output, and now takes the following buffers instead: type-0x16, type-0x46, and type-0x6.<br />
<br />
Cmd60002: Takes a total of 8-bytes of input, a PID, and returns an [[#IAlbumAccessorSession]].<br />
<br />
== IAlbumAccessorSession ==<br />
This is "nn::capsrv::sf::IAlbumAccessorSession".<br />
<br />
This was added with [4.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 2001 || OpenAlbumMovieReadStream<br />
|-<br />
| 2002 || CloseAlbumMovieReadStream<br />
|-<br />
| 2003 || GetAlbumMovieReadStreamMovieDataSize<br />
|-<br />
| 2004 || ReadMovieDataFromAlbumMovieReadStream<br />
|-<br />
| 2005 || GetAlbumMovieReadStreamBrokenReason<br />
|-<br />
| 2006 || GetAlbumMovieReadStreamImageDataSize<br />
|-<br />
| 2007 || ReadImageDataFromAlbumMovieReadStream<br />
|-<br />
| 2008 || ReadFileAttributeFromAlbumMovieReadStream<br />
|}<br />
<br />
= caps:c =<br />
This is "nn::capsrv::sf::IAlbumControlService", previously "nn::capsrv::sf::ICaptureControllerService" with [1.0.0].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| [1.0.0] 1 || CaptureRawImage || <br />
|-<br />
| [1.0.0] 2 || CaptureRawImageWithTimeout || <br />
|-<br />
| 33 || [7.0.0+] || <br />
|-<br />
| [1.0.0] 1001 || RequestTakingScreenShot || <br />
|-<br />
| [1.0.0] 1002 || RequestTakingScreenShotWithTimeout || <br />
|-<br />
| [1.0.0] 1011 || NotifyTakingScreenShotRefused || <br />
|-<br />
| 2001 || NotifyAlbumStorageIsAvailable || <br />
|-<br />
| 2002 || NotifyAlbumStorageIsUnavailable || <br />
|-<br />
| 2011 || [2.0.0+] RegisterAppletResourceUserId || <br />
|-<br />
| 2012 || [2.0.0+] UnregisterAppletResourceUserId || <br />
|-<br />
| 2013 || [2.0.0+] GetApplicationIdFromAruid || <br />
|-<br />
| 2014 || [2.0.0+] CheckApplicationIdRegistered || <br />
|-<br />
| 2101 || [2.0.0+] GenerateCurrentAlbumFileId || Takes an input u8 and u64, returns a 0x18-byte struct.<br />
|-<br />
| 2102 || [2.0.0+] GenerateApplicationAlbumEnrty || <br />
|-<br />
| [2.0.0-3.0.2] 2201 || SaveAlbumScreenShotFile || <br />
|-<br />
| 2202 || [4.0.0+] SaveAlbumScreenShotFileEx || <br />
|-<br />
| 2301 || [2.0.0+] SetOverlayScreenShotThumbnailData || <br />
|-<br />
| 2302 || [4.0.0+] SetOverlayMovieThumbnailData || <br />
|-<br />
| 60001 || [4.0.0+] OpenControlSession || Takes a total of 8-bytes of input and a PID, returns an [[#IAlbumControlSession]].<br />
|}<br />
<br />
=== Cmd33 ===<br />
Takes an input u64 [[#ShimLibraryVersion]], an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and a PID, no output.<br />
<br />
This is used by [[Applet_Manager_services|caps:su]] SetShimLibraryVersion.<br />
<br />
== IAlbumControlSession ==<br />
This is "nn::capsrv::sf::IAlbumControlSession".<br />
<br />
This was added with [4.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 2001 || OpenAlbumMovieReadStream || <br />
|-<br />
| 2002 || CloseAlbumMovieReadStream || <br />
|-<br />
| 2003 || GetAlbumMovieReadStreamMovieDataSize || <br />
|-<br />
| 2004 || ReadMovieDataFromAlbumMovieReadStream || <br />
|-<br />
| 2005 || GetAlbumMovieReadStreamBrokenReason || <br />
|-<br />
| 2006 || GetAlbumMovieReadStreamImageDataSize || <br />
|-<br />
| 2007 || ReadImageDataFromAlbumMovieReadStream || <br />
|-<br />
| 2008 || ReadFileAttributeFromAlbumMovieReadStream || <br />
|-<br />
| 2401 || OpenAlbumMovieWriteStream || <br />
|-<br />
| 2402 || FinishAlbumMovieWriteStream || <br />
|-<br />
| 2403 || CommitAlbumMovieWriteStream || <br />
|-<br />
| 2404 || DiscardAlbumMovieWriteStream || <br />
|-<br />
| 2405 || DiscardAlbumMovieWriteStreamNoDelete || <br />
|-<br />
| 2406 || [7.0.0+] CommitAlbumMovieWriteStreamEx || <br />
|-<br />
| 2411 || StartAlbumMovieWriteStreamDataSection || <br />
|-<br />
| 2412 || EndAlbumMovieWriteStreamDataSection || <br />
|-<br />
| 2413 || StartAlbumMovieWriteStreamMetaSection || <br />
|-<br />
| 2414 || EndAlbumMovieWriteStreamMetaSection || <br />
|-<br />
| 2421 || ReadDataFromAlbumMovieWriteStream || <br />
|-<br />
| 2422 || WriteDataToAlbumMovieWriteStream || <br />
|-<br />
| 2424 || WriteMetaToAlbumMovieWriteStream || <br />
|-<br />
| 2431 || GetAlbumMovieWriteStreamBrokenReason || <br />
|-<br />
| 2433 || GetAlbumMovieWriteStreamDataSize || <br />
|-<br />
| 2434 || SetAlbumMovieWriteStreamDataSize || <br />
|}<br />
<br />
= caps:u =<br />
This is "nn::capsrv::sf::IAlbumApplicationService".<br />
<br />
This was added with [5.0.0+].<br />
<br />
Official sw via the <code>nn::album</code> wrappers uses start_DateTime = YYYY-MM-DD 1970-01-01 with the rest set to all-zero, end_DateTime is the same except year = 3000. With [[#GetAlbumFileList0AafeAruidDeprecated]], start_PosixTime = UTC 1999-12-31 00:00 (0x386BF200), and end_PosixTime = UTC 2100-01-01 00:00 (0xF4865700).<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 32 || [7.0.0+] [[#SetShimLibraryVersion]]<br />
|-<br />
| 102 || [[#GetAlbumFileList0AafeAruidDeprecated]]<br />
|-<br />
| 103 || [[#DeleteAlbumFileByAruid]]<br />
|-<br />
| 104 || [[#GetAlbumFileSizeByAruid]]<br />
|-<br />
| 105 || [[#DeleteAlbumFileByAruidForDebug]]<br />
|-<br />
| 110 || [[#LoadAlbumScreenShotImageByAruid]]<br />
|-<br />
| 120 || [[#LoadAlbumScreenShotThumbnailImageByAruid]]<br />
|-<br />
| 130 || [[#PrecheckToCreateContentsByAruid]]<br />
|-<br />
| 140 || [6.0.0+] [[#GetAlbumFileList1AafeAruidDeprecated]]<br />
|-<br />
| 141 || [6.0.0+] [[#GetAlbumFileList2AafeUidAruidDeprecated]]<br />
|-<br />
| 142 || [7.0.0+] [[#GetAlbumFileList3AaeAruid]]<br />
|-<br />
| 143 || [7.0.0+] [[#GetAlbumFileList4AaeUidAruid]]<br />
|-<br />
| 144 || [11.0.0+]<br />
|-<br />
| 60002 || [[#OpenAccessorSessionForApplication]]<br />
|}<br />
<br />
== SetShimLibraryVersion ==<br />
Takes an input u64 [[#ShimLibraryVersion]], an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and a PID, no output.<br />
<br />
== GetAlbumFileList0AafeAruidDeprecated ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumFileEntry]], a PID, an u8 [[#ContentType]], two s64s, and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The two s64s are the start/end PosixTime.<br />
<br />
== DeleteAlbumFileByAruid ==<br />
Takes a PID, an input u8 [[#ContentType]], an [[#ApplicationAlbumFileEntry]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and no output.<br />
<br />
The [[#ContentType]] must match 3.<br />
<br />
== GetAlbumFileSizeByAruid ==<br />
Takes a PID, an input [[#ApplicationAlbumFileEntry]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and returns an output u64.<br />
<br />
This gets the filesize for the entire specified Album file.<br />
<br />
== DeleteAlbumFileByAruidForDebug ==<br />
Takes a PID, an [[#ApplicationAlbumFileEntry]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and no output.<br />
<br />
The cached value loaded from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.<br />
<br />
== LoadAlbumScreenShotImageByAruid ==<br />
Takes a PID, a type-0x16 output buffer containing a [[#LoadAlbumScreenShotImageOutputForApplication]], a type-0x46 output buffer, a type-0x6 output buffer, an [[#ApplicationAlbumFileEntry]], a [[#ScreenShotDecodeOption]], and no output.<br />
<br />
The type-0x46 buffer contains the RGBA8 image data. The type-0x6 buffer is a work buffer used for reading the entire AlbumFile, the buffer size must be at least the AlbumFile filesize (cleared before the cmd returns).<br />
<br />
== LoadAlbumScreenShotThumbnailImageByAruid ==<br />
Takes a PID, a type-0x16 output buffer containing a [[#LoadAlbumScreenShotImageOutputForApplication]], a type-0x46 output buffer, a type-0x6 output buffer, an [[#ApplicationAlbumFileEntry]], a [[#ScreenShotDecodeOption]], and no output.<br />
<br />
The type-0x46 buffer contains the RGBA8 image data. The type-0x6 buffer is a work buffer used for reading the entire AlbumFile, the buffer size must be at least the AlbumFile filesize (cleared before the cmd returns).<br />
<br />
== PrecheckToCreateContentsByAruid ==<br />
Takes a PID, an input u8 [[#ContentType]], an u64, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and no output.<br />
<br />
== GetAlbumFileList1AafeAruidDeprecated ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumFileEntry]], a PID, an u8 [[#ContentType]], two [[#AlbumFileDateTime]], and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The first [[#AlbumFileDateTime]] is the start_DateTime, the second [[#AlbumFileDateTime]] is the end_DateTime. In the IPC rawdata, these use 2-byte alignment.<br />
<br />
== GetAlbumFileList2AafeUidAruidDeprecated ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumFileEntry]], a PID, an u8 [[#ContentType]], two [[#AlbumFileDateTime]], an u128 userID, and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The first [[#AlbumFileDateTime]] is the start_DateTime, the second [[#AlbumFileDateTime]] is the end_DateTime. In the IPC rawdata, these use 2-byte alignment.<br />
<br />
== GetAlbumFileList3AaeAruid ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumEntry]], a PID, an u8 [[#ContentType]], two [[#AlbumFileDateTime]], and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The first [[#AlbumFileDateTime]] is the start_DateTime, the second [[#AlbumFileDateTime]] is the end_DateTime. In the IPC rawdata, these use 2-byte alignment.<br />
<br />
== GetAlbumFileList4AaeUidAruid ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumEntry]], a PID, an u8 [[#ContentType]], two [[#AlbumFileDateTime]], an u128 userID, and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The first [[#AlbumFileDateTime]] is the start_DateTime, the second [[#AlbumFileDateTime]] is the end_DateTime. In the IPC rawdata, these use 2-byte alignment.<br />
<br />
== OpenAccessorSessionForApplication ==<br />
Takes a PID, an input [[#ApplicationAlbumFileEntry]], an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and returns an output [[#IAlbumAccessorApplicationSession]].<br />
<br />
== IAlbumAccessorApplicationSession ==<br />
This is "nn::capsrv::sf::IAlbumAccessorApplicationSession".<br />
<br />
This was added with [5.0.0+].<br />
<br />
This is opened prior to using [[#OpenAlbumMovieReadStream]], when it previously wasn't opened. Official sw only closes this session when closing caps:u, not when using [[#CloseAlbumMovieReadStream]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 2001 || [[#OpenAlbumMovieReadStream]]<br />
|-<br />
| 2002 || [[#CloseAlbumMovieReadStream]]<br />
|-<br />
| 2003 || [[#GetAlbumMovieReadStreamMovieDataSize]]<br />
|-<br />
| 2004 || [[#ReadMovieDataFromAlbumMovieReadStream]]<br />
|-<br />
| 2005 || [[#GetAlbumMovieReadStreamBrokenReason]]<br />
|}<br />
<br />
=== OpenAlbumMovieReadStream ===<br />
Takes a PID, an input [[#ApplicationAlbumFileEntry]], an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and returns an output u64 [[#AlbumMovieReadStreamHandle]].<br />
<br />
Up to 4 streams can be open at the same time. Multiple streams can be open at the same time for the same [[#ApplicationAlbumFileEntry]].<br />
<br />
=== CloseAlbumMovieReadStream ===<br />
Takes an input u64 [[#AlbumMovieReadStreamHandle]], no output.<br />
<br />
=== GetAlbumMovieReadStreamMovieDataSize ===<br />
Takes an input u64 [[#AlbumMovieReadStreamHandle]], returns an output u64.<br />
<br />
This gets the size of the actual MP4, without the JPEG at the end.<br />
<br />
=== ReadMovieDataFromAlbumMovieReadStream ===<br />
Takes a type-0x6 output buffer, an input u64 [[#AlbumMovieReadStreamHandle]], an input s64 offset, and returns an output u64 actual_size.<br />
<br />
offset(+size) must not be negative. offset and size must be aligned to 0x40000-bytes. When offset(+size) goes beyond the size from [[#GetAlbumMovieReadStreamMovieDataSize]], the regions of the buffer which goes beyond that are cleared to 0, and actual_size is still set to the input size.<br />
<br />
=== GetAlbumMovieReadStreamBrokenReason ===<br />
Takes an input u64 [[#AlbumMovieReadStreamHandle]], no output.<br />
<br />
Unused by official sw.<br />
<br />
= ShimLibraryVersion =<br />
This is a version field. Official sw uses func <code>nn::capsrv::GetShimLibraryVersion()</code> to load this from a global var, which is then used with various commands (the input for those cmds must match value 1).<br />
<br />
[7.0.0-9.0.0] This is value 1.<br />
<br />
Controls which struct version to use for [[#ApplicationAlbumEntry]] / [[#AlbumFileEntry]]. However, the struct size for the newer version is used regardless on [7.0.0+] for the actual cmds.<br />
<br />
= Enums =<br />
<br />
=== AlbumImageOrientation ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Unknown.<br />
|-<br />
| 1 || Unknown.<br />
|-<br />
| 2 || Unknown.<br />
|-<br />
| 3 || Unknown.<br />
|}<br />
<br />
This is "nn::album::ImageOrientation".<br />
<br />
=== AlbumReportOption ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Don't display the screenshot-taken Overlay-applet notification.<br />
|-<br />
| 1 || Display the screenshot-taken Overlay notification.<br />
|}<br />
<br />
This is "nn::album::AlbumReportOption".<br />
<br />
=== ContentType ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Screenshot. Album screenshots.<br />
|-<br />
| 1 || Movie. Album videos.<br />
|-<br />
| 3 || ExtraMovie. Videos recorded by the current Application title via [[GRC_services#IMovieMaker|GRC MovieMaker]].<br />
|}<br />
<br />
=== AlbumStorage ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Nand. ImageDirectory on the USER partition.<br />
|-<br />
| 1 || Sd. ImageDirectory on the Sd card<br />
|}<br />
<br />
= AlbumFileDateTime =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x2 || Year<br />
|-<br />
| 0x2 || 0x1 || Month<br />
|-<br />
| 0x3 || 0x1 || Day<br />
|-<br />
| 0x4 || 0x1 || Hour<br />
|-<br />
| 0x5 || 0x1 || Minute<br />
|-<br />
| 0x6 || 0x1 || Second<br />
|-<br />
| 0x7 || 0x1 || Unique ID for when there's multiple Album files with the same timestamp.<br />
|}<br />
<br />
This is "nn::capsrv::AlbumFileDateTime". This is a 0x8-byte struct.<br />
<br />
This corresponds to each field in the Album entry filename, prior to the "-": <code>YYYYMMDDHHMMSSII</code>.<br />
<br />
= AlbumEntry =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x8 || Size of the entry.<br />
|-<br />
| 0x8 || 0x8 || ApplicationId<br />
|-<br />
| 0x10 || 0x8 || [[#AlbumFileDateTime]]<br />
|-<br />
| 0x18 || 0x1 || [[#AlbumStorage]]<br />
|-<br />
| 0x19 || 0x1 || [[#ContentType]]<br />
|-<br />
| 0x1A || 0x6 || Padding.<br />
|}<br />
<br />
This is "nn::capsrv::AlbumEntry". This is a 0x20-byte struct.<br />
<br />
= AlbumFileEntry =<br />
This is "nn::album::AlbumFileEntry". This is identical to [[#ApplicationAlbumEntry]]. On older versions where official sw used to use cmds which use [[#ApplicationAlbumFileEntry]], this struct matches [[#ApplicationAlbumFileEntry]].<br />
<br />
= ApplicationAlbumEntry =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x8 || Size of the entry.<br />
|-<br />
| 0x8 || 0x8 || AES256 with hardcoded key over AlbumEntry. <br />
|-<br />
| 0x10 || 0x8 || [[#AlbumFileDateTime]]<br />
|-<br />
| 0x18 || 0x1 || [[#AlbumStorage]]<br />
|-<br />
| 0x19 || 0x1 || [[#ContentType]]<br />
|-<br />
| 0x1a || 0x5 || Padding.<br />
|-<br />
| 0x1f || 0x1 || Unknown. Set to 1 by official software.<br />
|}<br />
<br />
This is "nn::capsrv::ApplicationAlbumEntry". This is a 0x20-byte struct. On older versions where [[#ShimLibraryVersion]] is 0, this was a plain AES256 with a random key generated at application launch.<br />
<br />
With the output from [[Applet_Manager_services#caps:su|caps:su]] sdk-nso only uses this for the [[Internet_Browser|Share-applet]] (when the output is used at all), with everything else it's used as an [[#AlbumFileEntry]]. In those cases with the <code>nn::album</code> wrapper funcs, it's "converted" by just copying the struct (arrays are "converted" by just returning a ptr to the input array).<br />
<br />
= ApplicationAlbumFileEntry =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x20 || [[#ApplicationAlbumEntry]]<br />
|-<br />
| 0x20 || 0x8 || [[#AlbumFileDateTime]]<br />
|-<br />
| 0x28 || 0x8 || Unknown.<br />
|}<br />
<br />
This is "nn::capsrv::ApplicationAlbumFileEntry". This is a 0x30-byte struct.<br />
<br />
On newer versions where official sw uses [[#ApplicationAlbumEntry]], [[#ApplicationAlbumEntry]] is converted to ApplicationAlbumFileEntry when using cmds which need it with:<br />
* First 0x20-bytes are the same.<br />
* u64 ApplicationAlbumFileEntry+0x20 = [[#ApplicationAlbumEntry]]+0x10.<br />
* Last 8-bytes = 0.<br />
<br />
= ScreenShotAttribute =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x4 || Always set to 0 by official sw.<br />
|-<br />
| 0x4 || 0x4 || [[#AlbumImageOrientation]]<br />
|-<br />
| 0x8 || 0x4 || Always set to 0 by official sw.<br />
|-<br />
| 0xC || 0x4 || Always set to 1 by official sw.<br />
|-<br />
| 0x10 || 0x30 || Always set to 0 by official sw.<br />
|}<br />
<br />
This is "nn::capsrv::detail::ScreenShotAttributeEx0" / "nn::capsrv::ScreenShotAttribute". This is a 0x40-byte struct.<br />
<br />
= ApplicationData =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x400 || UserData<br />
|-<br />
| 0x400 || 0x4 || UserData size.<br />
|}<br />
<br />
This is "nn::capsrv::ApplicationData". This is a 0x404-byte struct.<br />
<br />
= UserIdList =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x80 || u128 userIDs<br />
|-<br />
| 0x80 || 0x1 || Total userIDs.<br />
|-<br />
| 0x81 || 0x7 || Padding.<br />
|}<br />
<br />
This is "nn::capsrv::UserIdList". This is a 0x88-byte struct.<br />
<br />
= LoadAlbumScreenShotImageOutputForApplication =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x8 || s64 Width. Official sw copies this to a s32 output field.<br />
|-<br />
| 0x8 || 0x8 || s64 Height. Official sw copies this to a s32 output field.<br />
|-<br />
| 0x10 || 0x40 || [[#ScreenShotAttributeForApplication]]<br />
|-<br />
| 0x50 || 0x404 || [[#ApplicationData]]<br />
|-<br />
| 0x454 || 0xAC || Unused<br />
|}<br />
<br />
This is "nn::capsrv::sf::LoadAlbumScreenShotImageOutputForApplication". This is a 0x500-byte struct.<br />
<br />
= ScreenShotDecodeOption =<br />
This is "nn::capsrv::ScreenShotDecodeOption". This is a 0x20-byte struct.<br />
<br />
Official sw sets this to all-zero with the input for [[#LoadAlbumScreenShotImageByAruid]]/[[#LoadAlbumScreenShotThumbnailImageByAruid]].<br />
<br />
= ScreenShotAttributeForApplication =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x4 || Unknown.<br />
|-<br />
| 0x4 || 0x1 || Unknown.<br />
|-<br />
| 0x5 || 0x1 || Unknown.<br />
|-<br />
| 0x6 || 0x1 || Unknown.<br />
|-<br />
| 0x7 || 0x1 || Padding.<br />
|-<br />
| 0x8 || 0x4 || Unknown.<br />
|-<br />
| 0xC || 0x4 || Unknown.<br />
|-<br />
| 0x10 || 0x4 || Unknown.<br />
|-<br />
| 0x14 || 0x4 || Unknown.<br />
|-<br />
| 0x18 || 0x4 || Unknown.<br />
|-<br />
| 0x1C || 0x4 || Unknown.<br />
|-<br />
| 0x20 || 0x2 || Unknown.<br />
|-<br />
| 0x22 || 0x2 || Unknown.<br />
|-<br />
| 0x24 || 0x2 || Unknown.<br />
|-<br />
| 0x26 || 0x2 || Unknown.<br />
|-<br />
| 0x28 || 0x18 || Always zero.<br />
|}<br />
<br />
This is "nn::capsrv::ScreenShotAttributeForApplication". This is a 0x40-byte struct.<br />
<br />
Official sw only uses this in <code>nn::album</code> funcs which convert this to [[#AlbumFileAttribute]], with the output from [[#LoadAlbumScreenShotImageByAruid]]/[[#LoadAlbumScreenShotThumbnailImageByAruid]] (only the first u32 is used).<br />
<br />
= AlbumFileAttribute =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x8 || The <code>nn::album</code> funcs referenced by [[#ScreenShotAttributeForApplication]] set this to: <code>ScreenShotAttributeForApplication.first_u32 == 2</code>.<br />
|-<br />
| 0x8 || 0x8 || Set to zero by official sw.<br />
|}<br />
<br />
This is "nn::album::AlbumFileAttribute". This is a 0x10-byte struct. See also [[#ScreenShotAttributeForApplication]].<br />
<br />
= AlbumMovieReadStreamHandle =<br />
This is "nn::capsrv::AlbumMovieReadStreamHandle" / "nn::album::MovieStreamHandle".<br />
<br />
This is an u64 stream handle.<br />
<br />
= Notes =<br />
capsrv is responsible for validating the MACs for screenshots stored on the SD card, if the setting capsrv!enable_album_screenshot_filedata_verification is non-zero. <br />
<br />
Screenshots are validated as follows: The JPEG's MAC is extracted from the EXIF maker note, and stored. A timestamp string is generated by calling snprintf(&str, 20, "%04d:%02d:%02d %02d:%02d:%02d", ...); with stored timestamp values. If this doesn't match the timestamp string stored in EXIF, then an error 0xA34CE is returned. Otherwise, the entire JPEG is loaded into memory, and the stored EXIF maker note is cleared to zeroes. Then, an HMAC-SHA256 is computed over the entire JPEG using a hardcoded secret key. if (memcmp(calculated_hmac, stored_hmac, 0x10) == 0), the screenshot is valid, else 0xA3ACE is returned.<br />
<br />
In [[3.0.0]], MAC calculation was changed: now, instead of calculating an HMAC, a plain SHA256 hash is calculated. capsrv basically does screenshot_kek = spl::GenerateAesKek(<hardcoded screenshot_kek_source>); spl::LoadAesKey(screenshot_kek, <hardcoded screenshot_key_source>); MAC = spl::ComputeCmac(hash);<br />
<br />
== Videos ==<br />
[[4.0.0]] includes video playback etc support in Album via mp4. These include a JPEG thumbnail, which is used for video "validation". The EXIF is also much larger: the MakerNote is 0x498-bytes, with encrypted data starting at offset +0x8. This encryption uses AES-CTR with hardcoded key/ctr. MAC calculation works the same way as the [[3.0.0]]+ JPEG MAC calculation, except with a different movie_kek_source/movie_key_source.<br />
<br />
Each 0x40000-byte chunk in the Movie data stream is validated with a SHA256 hash table, where hash_index=offset>>18. Whether an error is thrown on mismatch is controlled by [[System_Settings|system-setting]] "capsrv!enable_album_movie_filehash_verification".<br />
<br />
Note: the Album process itself uses libstagefright for video playback.<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=Capture_services&diff=10279
Capture services
2020-12-01T02:01:16Z
<p>Behemoth: /* caps:a */</p>
<hr />
<div>= caps:a =<br />
This is "nn::capsrv::sf::IAlbumAccessorService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetAlbumFileCount<br />
|-<br />
| 1 || GetAlbumFileList<br />
|-<br />
| 2 || LoadAlbumFile<br />
|-<br />
| 3 || DeleteAlbumFile<br />
|-<br />
| 4 || StorageCopyAlbumFile<br />
|-<br />
| 5 || IsAlbumMounted<br />
|-<br />
| 6 || GetAlbumUsage<br />
|-<br />
| 7 || GetAlbumFileSize<br />
|-<br />
| 8 || LoadAlbumFileThumbnail<br />
|-<br />
| 9 || [2.0.0+] LoadAlbumScreenShotImage<br />
|-<br />
| 10 || [2.0.0+] LoadAlbumScreenShotThumbnailImage<br />
|-<br />
| 11 || [2.0.0+] GetAlbumEntryFromApplicationAlbumEntry<br />
|-<br />
| 12 || [3.0.0+] LoadAlbumScreenShotImageEx<br />
|-<br />
| 13 || [3.0.0+] LoadAlbumScreenShotThumbnailImageEx<br />
|-<br />
| 14 || [3.0.0+] LoadAlbumScreenShotImageEx0<br />
|-<br />
| 15 || [4.0.0+] GetAlbumUsage3<br />
|-<br />
| 16 || [4.0.0+] GetAlbumMountResult<br />
|-<br />
| 17 || [4.0.0+] GetAlbumUsage16<br />
|-<br />
| 18 || [6.0.0+]<br />
|-<br />
| 19 || [11.0.0+]<br />
|-<br />
| 100 || [5.0.0+] GetAlbumFileCountEx0<br />
|-<br />
| 101 || [5.0.0+] GetAlbumFileListEx0<br />
|-<br />
| 202 || [1.0.0-2.3.0] SaveEditedScreenShot<br />
|-<br />
| 301 || GetLastOverlayScreenShotThumbnail<br />
|-<br />
| 302 || [4.0.0+] GetLastOverlayMovieThumbnail<br />
|-<br />
| 401 || GetAutoSavingStorage<br />
|-<br />
| 501 || GetRequiredStorageSpaceSizeToCopyAll<br />
|-<br />
| 1001 || [3.0.0+] LoadAlbumScreenShotThumbnailImageEx0<br />
|-<br />
| 1002 || [3.0.0+] LoadAlbumScreenShotImageEx1<br />
|-<br />
| 1003 || [4.0.0+] LoadAlbumScreenShotThumbnailImageEx1<br />
|-<br />
| 8001 || ForceAlbumUnmounted<br />
|-<br />
| 8002 || ResetAlbumMountStatus<br />
|-<br />
| 8011 || RefreshAlbumCache<br />
|-<br />
| 8012 || GetAlbumCache<br />
|-<br />
| 8013 || [4.0.0+] GetAlbumCacheEx<br />
|-<br />
| 8021 || [2.0.0+] GetAlbumEntryFromApplicationAlbumEntryAruid<br />
|-<br />
| 10011 || SetInternalErrorConversionEnabled<br />
|-<br />
| 50000 || [6.0.0+] LoadMakerNoteInfoForDebug<br />
|-<br />
| 60002 || [4.0.0+] OpenAccessorSession<br />
|}<br />
<br />
Cmd18: Takes a type-70 buffer and returns a bool. If the buffer is sufficient it writes two application ID's to the buffer (0x100000000001000 and 0x100000000001fff) and returns true. This is used by photoViewer to group all screenshots of applets.<br />
<br />
Cmd19: Takes an input [[#AlbumFileId]] and a type-0x6 output buffer. Writes the filename of the corresponding file to the buffer.<br />
<br />
Cmd1002: Takes a total of 0x38-bytes of input, two type-0x5 input buffers, and returns 0x20-bytes of output. [4.0.0+] No longer returns output, and now takes the following buffers instead: type-0x16, type-0x46, and type-0x6.<br />
<br />
Cmd60002: Takes a total of 8-bytes of input, a PID, and returns an [[#IAlbumAccessorSession]].<br />
<br />
== IAlbumAccessorSession ==<br />
This is "nn::capsrv::sf::IAlbumAccessorSession".<br />
<br />
This was added with [4.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 2001 || OpenAlbumMovieReadStream<br />
|-<br />
| 2002 || CloseAlbumMovieReadStream<br />
|-<br />
| 2003 || GetAlbumMovieReadStreamMovieDataSize<br />
|-<br />
| 2004 || ReadMovieDataFromAlbumMovieReadStream<br />
|-<br />
| 2005 || GetAlbumMovieReadStreamBrokenReason<br />
|-<br />
| 2006 || GetAlbumMovieReadStreamImageDataSize<br />
|-<br />
| 2007 || ReadImageDataFromAlbumMovieReadStream<br />
|-<br />
| 2008 || ReadFileAttributeFromAlbumMovieReadStream<br />
|}<br />
<br />
= caps:c =<br />
This is "nn::capsrv::sf::IAlbumControlService", previously "nn::capsrv::sf::ICaptureControllerService" with [1.0.0].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| [1.0.0] 1 || CaptureRawImage || <br />
|-<br />
| [1.0.0] 2 || CaptureRawImageWithTimeout || <br />
|-<br />
| 33 || [7.0.0+] || <br />
|-<br />
| [1.0.0] 1001 || RequestTakingScreenShot || <br />
|-<br />
| [1.0.0] 1002 || RequestTakingScreenShotWithTimeout || <br />
|-<br />
| [1.0.0] 1011 || NotifyTakingScreenShotRefused || <br />
|-<br />
| 2001 || NotifyAlbumStorageIsAvailable || <br />
|-<br />
| 2002 || NotifyAlbumStorageIsUnavailable || <br />
|-<br />
| 2011 || [2.0.0+] RegisterAppletResourceUserId || <br />
|-<br />
| 2012 || [2.0.0+] UnregisterAppletResourceUserId || <br />
|-<br />
| 2013 || [2.0.0+] GetApplicationIdFromAruid || <br />
|-<br />
| 2014 || [2.0.0+] CheckApplicationIdRegistered || <br />
|-<br />
| 2101 || [2.0.0+] GenerateCurrentAlbumFileId || Takes an input u8 and u64, returns a 0x18-byte struct.<br />
|-<br />
| 2102 || [2.0.0+] GenerateApplicationAlbumEnrty || <br />
|-<br />
| [2.0.0-3.0.2] 2201 || SaveAlbumScreenShotFile || <br />
|-<br />
| 2202 || [4.0.0+] SaveAlbumScreenShotFileEx || <br />
|-<br />
| 2301 || [2.0.0+] SetOverlayScreenShotThumbnailData || <br />
|-<br />
| 2302 || [4.0.0+] SetOverlayMovieThumbnailData || <br />
|-<br />
| 60001 || [4.0.0+] OpenControlSession || Takes a total of 8-bytes of input and a PID, returns an [[#IAlbumControlSession]].<br />
|}<br />
<br />
=== Cmd33 ===<br />
Takes an input u64 [[#ShimLibraryVersion]], an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and a PID, no output.<br />
<br />
This is used by [[Applet_Manager_services|caps:su]] SetShimLibraryVersion.<br />
<br />
== IAlbumControlSession ==<br />
This is "nn::capsrv::sf::IAlbumControlSession".<br />
<br />
This was added with [4.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 2001 || OpenAlbumMovieReadStream || <br />
|-<br />
| 2002 || CloseAlbumMovieReadStream || <br />
|-<br />
| 2003 || GetAlbumMovieReadStreamMovieDataSize || <br />
|-<br />
| 2004 || ReadMovieDataFromAlbumMovieReadStream || <br />
|-<br />
| 2005 || GetAlbumMovieReadStreamBrokenReason || <br />
|-<br />
| 2006 || GetAlbumMovieReadStreamImageDataSize || <br />
|-<br />
| 2007 || ReadImageDataFromAlbumMovieReadStream || <br />
|-<br />
| 2008 || ReadFileAttributeFromAlbumMovieReadStream || <br />
|-<br />
| 2401 || OpenAlbumMovieWriteStream || <br />
|-<br />
| 2402 || FinishAlbumMovieWriteStream || <br />
|-<br />
| 2403 || CommitAlbumMovieWriteStream || <br />
|-<br />
| 2404 || DiscardAlbumMovieWriteStream || <br />
|-<br />
| 2405 || DiscardAlbumMovieWriteStreamNoDelete || <br />
|-<br />
| 2406 || [7.0.0+] CommitAlbumMovieWriteStreamEx || <br />
|-<br />
| 2411 || StartAlbumMovieWriteStreamDataSection || <br />
|-<br />
| 2412 || EndAlbumMovieWriteStreamDataSection || <br />
|-<br />
| 2413 || StartAlbumMovieWriteStreamMetaSection || <br />
|-<br />
| 2414 || EndAlbumMovieWriteStreamMetaSection || <br />
|-<br />
| 2421 || ReadDataFromAlbumMovieWriteStream || <br />
|-<br />
| 2422 || WriteDataToAlbumMovieWriteStream || <br />
|-<br />
| 2424 || WriteMetaToAlbumMovieWriteStream || <br />
|-<br />
| 2431 || GetAlbumMovieWriteStreamBrokenReason || <br />
|-<br />
| 2433 || GetAlbumMovieWriteStreamDataSize || <br />
|-<br />
| 2434 || SetAlbumMovieWriteStreamDataSize || <br />
|}<br />
<br />
= caps:u =<br />
This is "nn::capsrv::sf::IAlbumApplicationService".<br />
<br />
This was added with [5.0.0+].<br />
<br />
Official sw via the <code>nn::album</code> wrappers uses start_DateTime = YYYY-MM-DD 1970-01-01 with the rest set to all-zero, end_DateTime is the same except year = 3000. With [[#GetAlbumFileList0AafeAruidDeprecated]], start_PosixTime = UTC 1999-12-31 00:00 (0x386BF200), and end_PosixTime = UTC 2100-01-01 00:00 (0xF4865700).<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 32 || [7.0.0+] [[#SetShimLibraryVersion]]<br />
|-<br />
| 102 || [[#GetAlbumFileList0AafeAruidDeprecated]]<br />
|-<br />
| 103 || [[#DeleteAlbumFileByAruid]]<br />
|-<br />
| 104 || [[#GetAlbumFileSizeByAruid]]<br />
|-<br />
| 105 || [[#DeleteAlbumFileByAruidForDebug]]<br />
|-<br />
| 110 || [[#LoadAlbumScreenShotImageByAruid]]<br />
|-<br />
| 120 || [[#LoadAlbumScreenShotThumbnailImageByAruid]]<br />
|-<br />
| 130 || [[#PrecheckToCreateContentsByAruid]]<br />
|-<br />
| 140 || [6.0.0+] [[#GetAlbumFileList1AafeAruidDeprecated]]<br />
|-<br />
| 141 || [6.0.0+] [[#GetAlbumFileList2AafeUidAruidDeprecated]]<br />
|-<br />
| 142 || [7.0.0+] [[#GetAlbumFileList3AaeAruid]]<br />
|-<br />
| 143 || [7.0.0+] [[#GetAlbumFileList4AaeUidAruid]]<br />
|-<br />
| 60002 || [[#OpenAccessorSessionForApplication]]<br />
|}<br />
<br />
== SetShimLibraryVersion ==<br />
Takes an input u64 [[#ShimLibraryVersion]], an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and a PID, no output.<br />
<br />
== GetAlbumFileList0AafeAruidDeprecated ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumFileEntry]], a PID, an u8 [[#ContentType]], two s64s, and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The two s64s are the start/end PosixTime.<br />
<br />
== DeleteAlbumFileByAruid ==<br />
Takes a PID, an input u8 [[#ContentType]], an [[#ApplicationAlbumFileEntry]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and no output.<br />
<br />
The [[#ContentType]] must match 3.<br />
<br />
== GetAlbumFileSizeByAruid ==<br />
Takes a PID, an input [[#ApplicationAlbumFileEntry]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and returns an output u64.<br />
<br />
This gets the filesize for the entire specified Album file.<br />
<br />
== DeleteAlbumFileByAruidForDebug ==<br />
Takes a PID, an [[#ApplicationAlbumFileEntry]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and no output.<br />
<br />
The cached value loaded from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.<br />
<br />
== LoadAlbumScreenShotImageByAruid ==<br />
Takes a PID, a type-0x16 output buffer containing a [[#LoadAlbumScreenShotImageOutputForApplication]], a type-0x46 output buffer, a type-0x6 output buffer, an [[#ApplicationAlbumFileEntry]], a [[#ScreenShotDecodeOption]], and no output.<br />
<br />
The type-0x46 buffer contains the RGBA8 image data. The type-0x6 buffer is a work buffer used for reading the entire AlbumFile, the buffer size must be at least the AlbumFile filesize (cleared before the cmd returns).<br />
<br />
== LoadAlbumScreenShotThumbnailImageByAruid ==<br />
Takes a PID, a type-0x16 output buffer containing a [[#LoadAlbumScreenShotImageOutputForApplication]], a type-0x46 output buffer, a type-0x6 output buffer, an [[#ApplicationAlbumFileEntry]], a [[#ScreenShotDecodeOption]], and no output.<br />
<br />
The type-0x46 buffer contains the RGBA8 image data. The type-0x6 buffer is a work buffer used for reading the entire AlbumFile, the buffer size must be at least the AlbumFile filesize (cleared before the cmd returns).<br />
<br />
== PrecheckToCreateContentsByAruid ==<br />
Takes a PID, an input u8 [[#ContentType]], an u64, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and no output.<br />
<br />
== GetAlbumFileList1AafeAruidDeprecated ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumFileEntry]], a PID, an u8 [[#ContentType]], two [[#AlbumFileDateTime]], and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The first [[#AlbumFileDateTime]] is the start_DateTime, the second [[#AlbumFileDateTime]] is the end_DateTime. In the IPC rawdata, these use 2-byte alignment.<br />
<br />
== GetAlbumFileList2AafeUidAruidDeprecated ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumFileEntry]], a PID, an u8 [[#ContentType]], two [[#AlbumFileDateTime]], an u128 userID, and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The first [[#AlbumFileDateTime]] is the start_DateTime, the second [[#AlbumFileDateTime]] is the end_DateTime. In the IPC rawdata, these use 2-byte alignment.<br />
<br />
== GetAlbumFileList3AaeAruid ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumEntry]], a PID, an u8 [[#ContentType]], two [[#AlbumFileDateTime]], and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The first [[#AlbumFileDateTime]] is the start_DateTime, the second [[#AlbumFileDateTime]] is the end_DateTime. In the IPC rawdata, these use 2-byte alignment.<br />
<br />
== GetAlbumFileList4AaeUidAruid ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumEntry]], a PID, an u8 [[#ContentType]], two [[#AlbumFileDateTime]], an u128 userID, and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The first [[#AlbumFileDateTime]] is the start_DateTime, the second [[#AlbumFileDateTime]] is the end_DateTime. In the IPC rawdata, these use 2-byte alignment.<br />
<br />
== OpenAccessorSessionForApplication ==<br />
Takes a PID, an input [[#ApplicationAlbumFileEntry]], an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and returns an output [[#IAlbumAccessorApplicationSession]].<br />
<br />
== IAlbumAccessorApplicationSession ==<br />
This is "nn::capsrv::sf::IAlbumAccessorApplicationSession".<br />
<br />
This was added with [5.0.0+].<br />
<br />
This is opened prior to using [[#OpenAlbumMovieReadStream]], when it previously wasn't opened. Official sw only closes this session when closing caps:u, not when using [[#CloseAlbumMovieReadStream]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 2001 || [[#OpenAlbumMovieReadStream]]<br />
|-<br />
| 2002 || [[#CloseAlbumMovieReadStream]]<br />
|-<br />
| 2003 || [[#GetAlbumMovieReadStreamMovieDataSize]]<br />
|-<br />
| 2004 || [[#ReadMovieDataFromAlbumMovieReadStream]]<br />
|-<br />
| 2005 || [[#GetAlbumMovieReadStreamBrokenReason]]<br />
|}<br />
<br />
=== OpenAlbumMovieReadStream ===<br />
Takes a PID, an input [[#ApplicationAlbumFileEntry]], an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and returns an output u64 [[#AlbumMovieReadStreamHandle]].<br />
<br />
Up to 4 streams can be open at the same time. Multiple streams can be open at the same time for the same [[#ApplicationAlbumFileEntry]].<br />
<br />
=== CloseAlbumMovieReadStream ===<br />
Takes an input u64 [[#AlbumMovieReadStreamHandle]], no output.<br />
<br />
=== GetAlbumMovieReadStreamMovieDataSize ===<br />
Takes an input u64 [[#AlbumMovieReadStreamHandle]], returns an output u64.<br />
<br />
This gets the size of the actual MP4, without the JPEG at the end.<br />
<br />
=== ReadMovieDataFromAlbumMovieReadStream ===<br />
Takes a type-0x6 output buffer, an input u64 [[#AlbumMovieReadStreamHandle]], an input s64 offset, and returns an output u64 actual_size.<br />
<br />
offset(+size) must not be negative. offset and size must be aligned to 0x40000-bytes. When offset(+size) goes beyond the size from [[#GetAlbumMovieReadStreamMovieDataSize]], the regions of the buffer which goes beyond that are cleared to 0, and actual_size is still set to the input size.<br />
<br />
=== GetAlbumMovieReadStreamBrokenReason ===<br />
Takes an input u64 [[#AlbumMovieReadStreamHandle]], no output.<br />
<br />
Unused by official sw.<br />
<br />
= ShimLibraryVersion =<br />
This is a version field. Official sw uses func <code>nn::capsrv::GetShimLibraryVersion()</code> to load this from a global var, which is then used with various commands (the input for those cmds must match value 1).<br />
<br />
[7.0.0-9.0.0] This is value 1.<br />
<br />
Controls which struct version to use for [[#ApplicationAlbumEntry]] / [[#AlbumFileEntry]]. However, the struct size for the newer version is used regardless on [7.0.0+] for the actual cmds.<br />
<br />
= Enums =<br />
<br />
=== AlbumImageOrientation ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Unknown.<br />
|-<br />
| 1 || Unknown.<br />
|-<br />
| 2 || Unknown.<br />
|-<br />
| 3 || Unknown.<br />
|}<br />
<br />
This is "nn::album::ImageOrientation".<br />
<br />
=== AlbumReportOption ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Don't display the screenshot-taken Overlay-applet notification.<br />
|-<br />
| 1 || Display the screenshot-taken Overlay notification.<br />
|}<br />
<br />
This is "nn::album::AlbumReportOption".<br />
<br />
=== ContentType ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Screenshot. Album screenshots.<br />
|-<br />
| 1 || Movie. Album videos.<br />
|-<br />
| 3 || ExtraMovie. Videos recorded by the current Application title via [[GRC_services#IMovieMaker|GRC MovieMaker]].<br />
|}<br />
<br />
=== AlbumStorage ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Nand. ImageDirectory on the USER partition.<br />
|-<br />
| 1 || Sd. ImageDirectory on the Sd card<br />
|}<br />
<br />
= AlbumFileDateTime =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x2 || Year<br />
|-<br />
| 0x2 || 0x1 || Month<br />
|-<br />
| 0x3 || 0x1 || Day<br />
|-<br />
| 0x4 || 0x1 || Hour<br />
|-<br />
| 0x5 || 0x1 || Minute<br />
|-<br />
| 0x6 || 0x1 || Second<br />
|-<br />
| 0x7 || 0x1 || Unique ID for when there's multiple Album files with the same timestamp.<br />
|}<br />
<br />
This is "nn::capsrv::AlbumFileDateTime". This is a 0x8-byte struct.<br />
<br />
This corresponds to each field in the Album entry filename, prior to the "-": <code>YYYYMMDDHHMMSSII</code>.<br />
<br />
= AlbumEntry =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x8 || Size of the entry.<br />
|-<br />
| 0x8 || 0x8 || ApplicationId<br />
|-<br />
| 0x10 || 0x8 || [[#AlbumFileDateTime]]<br />
|-<br />
| 0x18 || 0x1 || [[#AlbumStorage]]<br />
|-<br />
| 0x19 || 0x1 || [[#ContentType]]<br />
|-<br />
| 0x1A || 0x6 || Padding.<br />
|}<br />
<br />
This is "nn::capsrv::AlbumEntry". This is a 0x20-byte struct.<br />
<br />
= AlbumFileEntry =<br />
This is "nn::album::AlbumFileEntry". This is identical to [[#ApplicationAlbumEntry]]. On older versions where official sw used to use cmds which use [[#ApplicationAlbumFileEntry]], this struct matches [[#ApplicationAlbumFileEntry]].<br />
<br />
= ApplicationAlbumEntry =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x8 || Size of the entry.<br />
|-<br />
| 0x8 || 0x8 || AES256 with hardcoded key over AlbumEntry. <br />
|-<br />
| 0x10 || 0x8 || [[#AlbumFileDateTime]]<br />
|-<br />
| 0x18 || 0x1 || [[#AlbumStorage]]<br />
|-<br />
| 0x19 || 0x1 || [[#ContentType]]<br />
|-<br />
| 0x1a || 0x5 || Padding.<br />
|-<br />
| 0x1f || 0x1 || Unknown. Set to 1 by official software.<br />
|}<br />
<br />
This is "nn::capsrv::ApplicationAlbumEntry". This is a 0x20-byte struct. On older versions where [[#ShimLibraryVersion]] is 0, this was a plain AES256 with a random key generated at application launch.<br />
<br />
With the output from [[Applet_Manager_services#caps:su|caps:su]] sdk-nso only uses this for the [[Internet_Browser|Share-applet]] (when the output is used at all), with everything else it's used as an [[#AlbumFileEntry]]. In those cases with the <code>nn::album</code> wrapper funcs, it's "converted" by just copying the struct (arrays are "converted" by just returning a ptr to the input array).<br />
<br />
= ApplicationAlbumFileEntry =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x20 || [[#ApplicationAlbumEntry]]<br />
|-<br />
| 0x20 || 0x8 || [[#AlbumFileDateTime]]<br />
|-<br />
| 0x28 || 0x8 || Unknown.<br />
|}<br />
<br />
This is "nn::capsrv::ApplicationAlbumFileEntry". This is a 0x30-byte struct.<br />
<br />
On newer versions where official sw uses [[#ApplicationAlbumEntry]], [[#ApplicationAlbumEntry]] is converted to ApplicationAlbumFileEntry when using cmds which need it with:<br />
* First 0x20-bytes are the same.<br />
* u64 ApplicationAlbumFileEntry+0x20 = [[#ApplicationAlbumEntry]]+0x10.<br />
* Last 8-bytes = 0.<br />
<br />
= ScreenShotAttribute =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x4 || Always set to 0 by official sw.<br />
|-<br />
| 0x4 || 0x4 || [[#AlbumImageOrientation]]<br />
|-<br />
| 0x8 || 0x4 || Always set to 0 by official sw.<br />
|-<br />
| 0xC || 0x4 || Always set to 1 by official sw.<br />
|-<br />
| 0x10 || 0x30 || Always set to 0 by official sw.<br />
|}<br />
<br />
This is "nn::capsrv::detail::ScreenShotAttributeEx0" / "nn::capsrv::ScreenShotAttribute". This is a 0x40-byte struct.<br />
<br />
= ApplicationData =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x400 || UserData<br />
|-<br />
| 0x400 || 0x4 || UserData size.<br />
|}<br />
<br />
This is "nn::capsrv::ApplicationData". This is a 0x404-byte struct.<br />
<br />
= UserIdList =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x80 || u128 userIDs<br />
|-<br />
| 0x80 || 0x1 || Total userIDs.<br />
|-<br />
| 0x81 || 0x7 || Padding.<br />
|}<br />
<br />
This is "nn::capsrv::UserIdList". This is a 0x88-byte struct.<br />
<br />
= LoadAlbumScreenShotImageOutputForApplication =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x8 || s64 Width. Official sw copies this to a s32 output field.<br />
|-<br />
| 0x8 || 0x8 || s64 Height. Official sw copies this to a s32 output field.<br />
|-<br />
| 0x10 || 0x40 || [[#ScreenShotAttributeForApplication]]<br />
|-<br />
| 0x50 || 0x404 || [[#ApplicationData]]<br />
|-<br />
| 0x454 || 0xAC || Unused<br />
|}<br />
<br />
This is "nn::capsrv::sf::LoadAlbumScreenShotImageOutputForApplication". This is a 0x500-byte struct.<br />
<br />
= ScreenShotDecodeOption =<br />
This is "nn::capsrv::ScreenShotDecodeOption". This is a 0x20-byte struct.<br />
<br />
Official sw sets this to all-zero with the input for [[#LoadAlbumScreenShotImageByAruid]]/[[#LoadAlbumScreenShotThumbnailImageByAruid]].<br />
<br />
= ScreenShotAttributeForApplication =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x4 || Unknown.<br />
|-<br />
| 0x4 || 0x1 || Unknown.<br />
|-<br />
| 0x5 || 0x1 || Unknown.<br />
|-<br />
| 0x6 || 0x1 || Unknown.<br />
|-<br />
| 0x7 || 0x1 || Padding.<br />
|-<br />
| 0x8 || 0x4 || Unknown.<br />
|-<br />
| 0xC || 0x4 || Unknown.<br />
|-<br />
| 0x10 || 0x4 || Unknown.<br />
|-<br />
| 0x14 || 0x4 || Unknown.<br />
|-<br />
| 0x18 || 0x4 || Unknown.<br />
|-<br />
| 0x1C || 0x4 || Unknown.<br />
|-<br />
| 0x20 || 0x2 || Unknown.<br />
|-<br />
| 0x22 || 0x2 || Unknown.<br />
|-<br />
| 0x24 || 0x2 || Unknown.<br />
|-<br />
| 0x26 || 0x2 || Unknown.<br />
|-<br />
| 0x28 || 0x18 || Always zero.<br />
|}<br />
<br />
This is "nn::capsrv::ScreenShotAttributeForApplication". This is a 0x40-byte struct.<br />
<br />
Official sw only uses this in <code>nn::album</code> funcs which convert this to [[#AlbumFileAttribute]], with the output from [[#LoadAlbumScreenShotImageByAruid]]/[[#LoadAlbumScreenShotThumbnailImageByAruid]] (only the first u32 is used).<br />
<br />
= AlbumFileAttribute =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x8 || The <code>nn::album</code> funcs referenced by [[#ScreenShotAttributeForApplication]] set this to: <code>ScreenShotAttributeForApplication.first_u32 == 2</code>.<br />
|-<br />
| 0x8 || 0x8 || Set to zero by official sw.<br />
|}<br />
<br />
This is "nn::album::AlbumFileAttribute". This is a 0x10-byte struct. See also [[#ScreenShotAttributeForApplication]].<br />
<br />
= AlbumMovieReadStreamHandle =<br />
This is "nn::capsrv::AlbumMovieReadStreamHandle" / "nn::album::MovieStreamHandle".<br />
<br />
This is an u64 stream handle.<br />
<br />
= Notes =<br />
capsrv is responsible for validating the MACs for screenshots stored on the SD card, if the setting capsrv!enable_album_screenshot_filedata_verification is non-zero. <br />
<br />
Screenshots are validated as follows: The JPEG's MAC is extracted from the EXIF maker note, and stored. A timestamp string is generated by calling snprintf(&str, 20, "%04d:%02d:%02d %02d:%02d:%02d", ...); with stored timestamp values. If this doesn't match the timestamp string stored in EXIF, then an error 0xA34CE is returned. Otherwise, the entire JPEG is loaded into memory, and the stored EXIF maker note is cleared to zeroes. Then, an HMAC-SHA256 is computed over the entire JPEG using a hardcoded secret key. if (memcmp(calculated_hmac, stored_hmac, 0x10) == 0), the screenshot is valid, else 0xA3ACE is returned.<br />
<br />
In [[3.0.0]], MAC calculation was changed: now, instead of calculating an HMAC, a plain SHA256 hash is calculated. capsrv basically does screenshot_kek = spl::GenerateAesKek(<hardcoded screenshot_kek_source>); spl::LoadAesKey(screenshot_kek, <hardcoded screenshot_key_source>); MAC = spl::ComputeCmac(hash);<br />
<br />
== Videos ==<br />
[[4.0.0]] includes video playback etc support in Album via mp4. These include a JPEG thumbnail, which is used for video "validation". The EXIF is also much larger: the MakerNote is 0x498-bytes, with encrypted data starting at offset +0x8. This encryption uses AES-CTR with hardcoded key/ctr. MAC calculation works the same way as the [[3.0.0]]+ JPEG MAC calculation, except with a different movie_kek_source/movie_key_source.<br />
<br />
Each 0x40000-byte chunk in the Movie data stream is validated with a SHA256 hash table, where hash_index=offset>>18. Whether an error is thrown on mismatch is controlled by [[System_Settings|system-setting]] "capsrv!enable_album_movie_filehash_verification".<br />
<br />
Note: the Album process itself uses libstagefright for video playback.<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=Capture_services&diff=10278
Capture services
2020-12-01T01:43:39Z
<p>Behemoth: /* caps:a */</p>
<hr />
<div>= caps:a =<br />
This is "nn::capsrv::sf::IAlbumAccessorService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetAlbumFileCount<br />
|-<br />
| 1 || GetAlbumFileList<br />
|-<br />
| 2 || LoadAlbumFile<br />
|-<br />
| 3 || DeleteAlbumFile<br />
|-<br />
| 4 || StorageCopyAlbumFile<br />
|-<br />
| 5 || IsAlbumMounted<br />
|-<br />
| 6 || GetAlbumUsage<br />
|-<br />
| 7 || GetAlbumFileSize<br />
|-<br />
| 8 || LoadAlbumFileThumbnail<br />
|-<br />
| 9 || [2.0.0+] LoadAlbumScreenShotImage<br />
|-<br />
| 10 || [2.0.0+] LoadAlbumScreenShotThumbnailImage<br />
|-<br />
| 11 || [2.0.0+] GetAlbumEntryFromApplicationAlbumEntry<br />
|-<br />
| 12 || [3.0.0+] LoadAlbumScreenShotImageEx<br />
|-<br />
| 13 || [3.0.0+] LoadAlbumScreenShotThumbnailImageEx<br />
|-<br />
| 14 || [3.0.0+] LoadAlbumScreenShotImageEx0<br />
|-<br />
| 15 || [4.0.0+] GetAlbumUsage3<br />
|-<br />
| 16 || [4.0.0+] GetAlbumMountResult<br />
|-<br />
| 17 || [4.0.0+] GetAlbumUsage16<br />
|-<br />
| 18 || [6.0.0+]<br />
|-<br />
| 19 || [11.0.0+]<br />
|-<br />
| 100 || [5.0.0+] GetAlbumFileCountEx0<br />
|-<br />
| 101 || [5.0.0+] GetAlbumFileListEx0<br />
|-<br />
| 202 || [1.0.0-2.3.0] SaveEditedScreenShot<br />
|-<br />
| 301 || GetLastOverlayScreenShotThumbnail<br />
|-<br />
| 302 || [4.0.0+] GetLastOverlayMovieThumbnail<br />
|-<br />
| 401 || GetAutoSavingStorage<br />
|-<br />
| 501 || GetRequiredStorageSpaceSizeToCopyAll<br />
|-<br />
| 1001 || [3.0.0+] LoadAlbumScreenShotThumbnailImageEx0<br />
|-<br />
| 1002 || [3.0.0+] LoadAlbumScreenShotImageEx1<br />
|-<br />
| 1003 || [4.0.0+] LoadAlbumScreenShotThumbnailImageEx1<br />
|-<br />
| 8001 || ForceAlbumUnmounted<br />
|-<br />
| 8002 || ResetAlbumMountStatus<br />
|-<br />
| 8011 || RefreshAlbumCache<br />
|-<br />
| 8012 || GetAlbumCache<br />
|-<br />
| 8013 || [4.0.0+] GetAlbumCacheEx<br />
|-<br />
| 8021 || [2.0.0+] GetAlbumEntryFromApplicationAlbumEntryAruid<br />
|-<br />
| 10011 || SetInternalErrorConversionEnabled<br />
|-<br />
| 50000 || [6.0.0+] LoadMakerNoteInfoForDebug<br />
|-<br />
| 60002 || [4.0.0+] OpenAccessorSession<br />
|}<br />
<br />
Cmd18: Takes a type-70 buffer and returns a bool. If the buffer is sufficient it writes two application ID's to the buffer (0x100000000001000 and 0x100000000001fff) and returns true. This is used by photoViewer to group all screenshots of applets.<br />
<br />
Cmd1002: Takes a total of 0x38-bytes of input, two type-0x5 input buffers, and returns 0x20-bytes of output. [4.0.0+] No longer returns output, and now takes the following buffers instead: type-0x16, type-0x46, and type-0x6.<br />
<br />
Cmd60002: Takes a total of 8-bytes of input, a PID, and returns an [[#IAlbumAccessorSession]].<br />
<br />
== IAlbumAccessorSession ==<br />
This is "nn::capsrv::sf::IAlbumAccessorSession".<br />
<br />
This was added with [4.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 2001 || OpenAlbumMovieReadStream<br />
|-<br />
| 2002 || CloseAlbumMovieReadStream<br />
|-<br />
| 2003 || GetAlbumMovieReadStreamMovieDataSize<br />
|-<br />
| 2004 || ReadMovieDataFromAlbumMovieReadStream<br />
|-<br />
| 2005 || GetAlbumMovieReadStreamBrokenReason<br />
|-<br />
| 2006 || GetAlbumMovieReadStreamImageDataSize<br />
|-<br />
| 2007 || ReadImageDataFromAlbumMovieReadStream<br />
|-<br />
| 2008 || ReadFileAttributeFromAlbumMovieReadStream<br />
|}<br />
<br />
= caps:c =<br />
This is "nn::capsrv::sf::IAlbumControlService", previously "nn::capsrv::sf::ICaptureControllerService" with [1.0.0].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| [1.0.0] 1 || CaptureRawImage || <br />
|-<br />
| [1.0.0] 2 || CaptureRawImageWithTimeout || <br />
|-<br />
| 33 || [7.0.0+] || <br />
|-<br />
| [1.0.0] 1001 || RequestTakingScreenShot || <br />
|-<br />
| [1.0.0] 1002 || RequestTakingScreenShotWithTimeout || <br />
|-<br />
| [1.0.0] 1011 || NotifyTakingScreenShotRefused || <br />
|-<br />
| 2001 || NotifyAlbumStorageIsAvailable || <br />
|-<br />
| 2002 || NotifyAlbumStorageIsUnavailable || <br />
|-<br />
| 2011 || [2.0.0+] RegisterAppletResourceUserId || <br />
|-<br />
| 2012 || [2.0.0+] UnregisterAppletResourceUserId || <br />
|-<br />
| 2013 || [2.0.0+] GetApplicationIdFromAruid || <br />
|-<br />
| 2014 || [2.0.0+] CheckApplicationIdRegistered || <br />
|-<br />
| 2101 || [2.0.0+] GenerateCurrentAlbumFileId || Takes an input u8 and u64, returns a 0x18-byte struct.<br />
|-<br />
| 2102 || [2.0.0+] GenerateApplicationAlbumEnrty || <br />
|-<br />
| [2.0.0-3.0.2] 2201 || SaveAlbumScreenShotFile || <br />
|-<br />
| 2202 || [4.0.0+] SaveAlbumScreenShotFileEx || <br />
|-<br />
| 2301 || [2.0.0+] SetOverlayScreenShotThumbnailData || <br />
|-<br />
| 2302 || [4.0.0+] SetOverlayMovieThumbnailData || <br />
|-<br />
| 60001 || [4.0.0+] OpenControlSession || Takes a total of 8-bytes of input and a PID, returns an [[#IAlbumControlSession]].<br />
|}<br />
<br />
=== Cmd33 ===<br />
Takes an input u64 [[#ShimLibraryVersion]], an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and a PID, no output.<br />
<br />
This is used by [[Applet_Manager_services|caps:su]] SetShimLibraryVersion.<br />
<br />
== IAlbumControlSession ==<br />
This is "nn::capsrv::sf::IAlbumControlSession".<br />
<br />
This was added with [4.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 2001 || OpenAlbumMovieReadStream || <br />
|-<br />
| 2002 || CloseAlbumMovieReadStream || <br />
|-<br />
| 2003 || GetAlbumMovieReadStreamMovieDataSize || <br />
|-<br />
| 2004 || ReadMovieDataFromAlbumMovieReadStream || <br />
|-<br />
| 2005 || GetAlbumMovieReadStreamBrokenReason || <br />
|-<br />
| 2006 || GetAlbumMovieReadStreamImageDataSize || <br />
|-<br />
| 2007 || ReadImageDataFromAlbumMovieReadStream || <br />
|-<br />
| 2008 || ReadFileAttributeFromAlbumMovieReadStream || <br />
|-<br />
| 2401 || OpenAlbumMovieWriteStream || <br />
|-<br />
| 2402 || FinishAlbumMovieWriteStream || <br />
|-<br />
| 2403 || CommitAlbumMovieWriteStream || <br />
|-<br />
| 2404 || DiscardAlbumMovieWriteStream || <br />
|-<br />
| 2405 || DiscardAlbumMovieWriteStreamNoDelete || <br />
|-<br />
| 2406 || [7.0.0+] CommitAlbumMovieWriteStreamEx || <br />
|-<br />
| 2411 || StartAlbumMovieWriteStreamDataSection || <br />
|-<br />
| 2412 || EndAlbumMovieWriteStreamDataSection || <br />
|-<br />
| 2413 || StartAlbumMovieWriteStreamMetaSection || <br />
|-<br />
| 2414 || EndAlbumMovieWriteStreamMetaSection || <br />
|-<br />
| 2421 || ReadDataFromAlbumMovieWriteStream || <br />
|-<br />
| 2422 || WriteDataToAlbumMovieWriteStream || <br />
|-<br />
| 2424 || WriteMetaToAlbumMovieWriteStream || <br />
|-<br />
| 2431 || GetAlbumMovieWriteStreamBrokenReason || <br />
|-<br />
| 2433 || GetAlbumMovieWriteStreamDataSize || <br />
|-<br />
| 2434 || SetAlbumMovieWriteStreamDataSize || <br />
|}<br />
<br />
= caps:u =<br />
This is "nn::capsrv::sf::IAlbumApplicationService".<br />
<br />
This was added with [5.0.0+].<br />
<br />
Official sw via the <code>nn::album</code> wrappers uses start_DateTime = YYYY-MM-DD 1970-01-01 with the rest set to all-zero, end_DateTime is the same except year = 3000. With [[#GetAlbumFileList0AafeAruidDeprecated]], start_PosixTime = UTC 1999-12-31 00:00 (0x386BF200), and end_PosixTime = UTC 2100-01-01 00:00 (0xF4865700).<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 32 || [7.0.0+] [[#SetShimLibraryVersion]]<br />
|-<br />
| 102 || [[#GetAlbumFileList0AafeAruidDeprecated]]<br />
|-<br />
| 103 || [[#DeleteAlbumFileByAruid]]<br />
|-<br />
| 104 || [[#GetAlbumFileSizeByAruid]]<br />
|-<br />
| 105 || [[#DeleteAlbumFileByAruidForDebug]]<br />
|-<br />
| 110 || [[#LoadAlbumScreenShotImageByAruid]]<br />
|-<br />
| 120 || [[#LoadAlbumScreenShotThumbnailImageByAruid]]<br />
|-<br />
| 130 || [[#PrecheckToCreateContentsByAruid]]<br />
|-<br />
| 140 || [6.0.0+] [[#GetAlbumFileList1AafeAruidDeprecated]]<br />
|-<br />
| 141 || [6.0.0+] [[#GetAlbumFileList2AafeUidAruidDeprecated]]<br />
|-<br />
| 142 || [7.0.0+] [[#GetAlbumFileList3AaeAruid]]<br />
|-<br />
| 143 || [7.0.0+] [[#GetAlbumFileList4AaeUidAruid]]<br />
|-<br />
| 60002 || [[#OpenAccessorSessionForApplication]]<br />
|}<br />
<br />
== SetShimLibraryVersion ==<br />
Takes an input u64 [[#ShimLibraryVersion]], an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and a PID, no output.<br />
<br />
== GetAlbumFileList0AafeAruidDeprecated ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumFileEntry]], a PID, an u8 [[#ContentType]], two s64s, and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The two s64s are the start/end PosixTime.<br />
<br />
== DeleteAlbumFileByAruid ==<br />
Takes a PID, an input u8 [[#ContentType]], an [[#ApplicationAlbumFileEntry]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and no output.<br />
<br />
The [[#ContentType]] must match 3.<br />
<br />
== GetAlbumFileSizeByAruid ==<br />
Takes a PID, an input [[#ApplicationAlbumFileEntry]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and returns an output u64.<br />
<br />
This gets the filesize for the entire specified Album file.<br />
<br />
== DeleteAlbumFileByAruidForDebug ==<br />
Takes a PID, an [[#ApplicationAlbumFileEntry]], an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and no output.<br />
<br />
The cached value loaded from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.<br />
<br />
== LoadAlbumScreenShotImageByAruid ==<br />
Takes a PID, a type-0x16 output buffer containing a [[#LoadAlbumScreenShotImageOutputForApplication]], a type-0x46 output buffer, a type-0x6 output buffer, an [[#ApplicationAlbumFileEntry]], a [[#ScreenShotDecodeOption]], and no output.<br />
<br />
The type-0x46 buffer contains the RGBA8 image data. The type-0x6 buffer is a work buffer used for reading the entire AlbumFile, the buffer size must be at least the AlbumFile filesize (cleared before the cmd returns).<br />
<br />
== LoadAlbumScreenShotThumbnailImageByAruid ==<br />
Takes a PID, a type-0x16 output buffer containing a [[#LoadAlbumScreenShotImageOutputForApplication]], a type-0x46 output buffer, a type-0x6 output buffer, an [[#ApplicationAlbumFileEntry]], a [[#ScreenShotDecodeOption]], and no output.<br />
<br />
The type-0x46 buffer contains the RGBA8 image data. The type-0x6 buffer is a work buffer used for reading the entire AlbumFile, the buffer size must be at least the AlbumFile filesize (cleared before the cmd returns).<br />
<br />
== PrecheckToCreateContentsByAruid ==<br />
Takes a PID, an input u8 [[#ContentType]], an u64, an [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and no output.<br />
<br />
== GetAlbumFileList1AafeAruidDeprecated ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumFileEntry]], a PID, an u8 [[#ContentType]], two [[#AlbumFileDateTime]], and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The first [[#AlbumFileDateTime]] is the start_DateTime, the second [[#AlbumFileDateTime]] is the end_DateTime. In the IPC rawdata, these use 2-byte alignment.<br />
<br />
== GetAlbumFileList2AafeUidAruidDeprecated ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumFileEntry]], a PID, an u8 [[#ContentType]], two [[#AlbumFileDateTime]], an u128 userID, and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The first [[#AlbumFileDateTime]] is the start_DateTime, the second [[#AlbumFileDateTime]] is the end_DateTime. In the IPC rawdata, these use 2-byte alignment.<br />
<br />
== GetAlbumFileList3AaeAruid ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumEntry]], a PID, an u8 [[#ContentType]], two [[#AlbumFileDateTime]], and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The first [[#AlbumFileDateTime]] is the start_DateTime, the second [[#AlbumFileDateTime]] is the end_DateTime. In the IPC rawdata, these use 2-byte alignment.<br />
<br />
== GetAlbumFileList4AaeUidAruid ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationAlbumEntry]], a PID, an u8 [[#ContentType]], two [[#AlbumFileDateTime]], an u128 userID, and an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]]. Returns an output u64 for total output entries (which is copied to a s32 by official sw).<br />
<br />
The first [[#AlbumFileDateTime]] is the start_DateTime, the second [[#AlbumFileDateTime]] is the end_DateTime. In the IPC rawdata, these use 2-byte alignment.<br />
<br />
== OpenAccessorSessionForApplication ==<br />
Takes a PID, an input [[#ApplicationAlbumFileEntry]], an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and returns an output [[#IAlbumAccessorApplicationSession]].<br />
<br />
== IAlbumAccessorApplicationSession ==<br />
This is "nn::capsrv::sf::IAlbumAccessorApplicationSession".<br />
<br />
This was added with [5.0.0+].<br />
<br />
This is opened prior to using [[#OpenAlbumMovieReadStream]], when it previously wasn't opened. Official sw only closes this session when closing caps:u, not when using [[#CloseAlbumMovieReadStream]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 2001 || [[#OpenAlbumMovieReadStream]]<br />
|-<br />
| 2002 || [[#CloseAlbumMovieReadStream]]<br />
|-<br />
| 2003 || [[#GetAlbumMovieReadStreamMovieDataSize]]<br />
|-<br />
| 2004 || [[#ReadMovieDataFromAlbumMovieReadStream]]<br />
|-<br />
| 2005 || [[#GetAlbumMovieReadStreamBrokenReason]]<br />
|}<br />
<br />
=== OpenAlbumMovieReadStream ===<br />
Takes a PID, an input [[#ApplicationAlbumFileEntry]], an u64 [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], and returns an output u64 [[#AlbumMovieReadStreamHandle]].<br />
<br />
Up to 4 streams can be open at the same time. Multiple streams can be open at the same time for the same [[#ApplicationAlbumFileEntry]].<br />
<br />
=== CloseAlbumMovieReadStream ===<br />
Takes an input u64 [[#AlbumMovieReadStreamHandle]], no output.<br />
<br />
=== GetAlbumMovieReadStreamMovieDataSize ===<br />
Takes an input u64 [[#AlbumMovieReadStreamHandle]], returns an output u64.<br />
<br />
This gets the size of the actual MP4, without the JPEG at the end.<br />
<br />
=== ReadMovieDataFromAlbumMovieReadStream ===<br />
Takes a type-0x6 output buffer, an input u64 [[#AlbumMovieReadStreamHandle]], an input s64 offset, and returns an output u64 actual_size.<br />
<br />
offset(+size) must not be negative. offset and size must be aligned to 0x40000-bytes. When offset(+size) goes beyond the size from [[#GetAlbumMovieReadStreamMovieDataSize]], the regions of the buffer which goes beyond that are cleared to 0, and actual_size is still set to the input size.<br />
<br />
=== GetAlbumMovieReadStreamBrokenReason ===<br />
Takes an input u64 [[#AlbumMovieReadStreamHandle]], no output.<br />
<br />
Unused by official sw.<br />
<br />
= ShimLibraryVersion =<br />
This is a version field. Official sw uses func <code>nn::capsrv::GetShimLibraryVersion()</code> to load this from a global var, which is then used with various commands (the input for those cmds must match value 1).<br />
<br />
[7.0.0-9.0.0] This is value 1.<br />
<br />
Controls which struct version to use for [[#ApplicationAlbumEntry]] / [[#AlbumFileEntry]]. However, the struct size for the newer version is used regardless on [7.0.0+] for the actual cmds.<br />
<br />
= Enums =<br />
<br />
=== AlbumImageOrientation ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Unknown.<br />
|-<br />
| 1 || Unknown.<br />
|-<br />
| 2 || Unknown.<br />
|-<br />
| 3 || Unknown.<br />
|}<br />
<br />
This is "nn::album::ImageOrientation".<br />
<br />
=== AlbumReportOption ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Don't display the screenshot-taken Overlay-applet notification.<br />
|-<br />
| 1 || Display the screenshot-taken Overlay notification.<br />
|}<br />
<br />
This is "nn::album::AlbumReportOption".<br />
<br />
=== ContentType ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Screenshot. Album screenshots.<br />
|-<br />
| 1 || Movie. Album videos.<br />
|-<br />
| 3 || ExtraMovie. Videos recorded by the current Application title via [[GRC_services#IMovieMaker|GRC MovieMaker]].<br />
|}<br />
<br />
=== AlbumStorage ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Nand. ImageDirectory on the USER partition.<br />
|-<br />
| 1 || Sd. ImageDirectory on the Sd card<br />
|}<br />
<br />
= AlbumFileDateTime =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x2 || Year<br />
|-<br />
| 0x2 || 0x1 || Month<br />
|-<br />
| 0x3 || 0x1 || Day<br />
|-<br />
| 0x4 || 0x1 || Hour<br />
|-<br />
| 0x5 || 0x1 || Minute<br />
|-<br />
| 0x6 || 0x1 || Second<br />
|-<br />
| 0x7 || 0x1 || Unique ID for when there's multiple Album files with the same timestamp.<br />
|}<br />
<br />
This is "nn::capsrv::AlbumFileDateTime". This is a 0x8-byte struct.<br />
<br />
This corresponds to each field in the Album entry filename, prior to the "-": <code>YYYYMMDDHHMMSSII</code>.<br />
<br />
= AlbumEntry =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x8 || Size of the entry.<br />
|-<br />
| 0x8 || 0x8 || ApplicationId<br />
|-<br />
| 0x10 || 0x8 || [[#AlbumFileDateTime]]<br />
|-<br />
| 0x18 || 0x1 || [[#AlbumStorage]]<br />
|-<br />
| 0x19 || 0x1 || [[#ContentType]]<br />
|-<br />
| 0x1A || 0x6 || Padding.<br />
|}<br />
<br />
This is "nn::capsrv::AlbumEntry". This is a 0x20-byte struct.<br />
<br />
= AlbumFileEntry =<br />
This is "nn::album::AlbumFileEntry". This is identical to [[#ApplicationAlbumEntry]]. On older versions where official sw used to use cmds which use [[#ApplicationAlbumFileEntry]], this struct matches [[#ApplicationAlbumFileEntry]].<br />
<br />
= ApplicationAlbumEntry =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x8 || Size of the entry.<br />
|-<br />
| 0x8 || 0x8 || AES256 with hardcoded key over AlbumEntry. <br />
|-<br />
| 0x10 || 0x8 || [[#AlbumFileDateTime]]<br />
|-<br />
| 0x18 || 0x1 || [[#AlbumStorage]]<br />
|-<br />
| 0x19 || 0x1 || [[#ContentType]]<br />
|-<br />
| 0x1a || 0x5 || Padding.<br />
|-<br />
| 0x1f || 0x1 || Unknown. Set to 1 by official software.<br />
|}<br />
<br />
This is "nn::capsrv::ApplicationAlbumEntry". This is a 0x20-byte struct. On older versions where [[#ShimLibraryVersion]] is 0, this was a plain AES256 with a random key generated at application launch.<br />
<br />
With the output from [[Applet_Manager_services#caps:su|caps:su]] sdk-nso only uses this for the [[Internet_Browser|Share-applet]] (when the output is used at all), with everything else it's used as an [[#AlbumFileEntry]]. In those cases with the <code>nn::album</code> wrapper funcs, it's "converted" by just copying the struct (arrays are "converted" by just returning a ptr to the input array).<br />
<br />
= ApplicationAlbumFileEntry =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x20 || [[#ApplicationAlbumEntry]]<br />
|-<br />
| 0x20 || 0x8 || [[#AlbumFileDateTime]]<br />
|-<br />
| 0x28 || 0x8 || Unknown.<br />
|}<br />
<br />
This is "nn::capsrv::ApplicationAlbumFileEntry". This is a 0x30-byte struct.<br />
<br />
On newer versions where official sw uses [[#ApplicationAlbumEntry]], [[#ApplicationAlbumEntry]] is converted to ApplicationAlbumFileEntry when using cmds which need it with:<br />
* First 0x20-bytes are the same.<br />
* u64 ApplicationAlbumFileEntry+0x20 = [[#ApplicationAlbumEntry]]+0x10.<br />
* Last 8-bytes = 0.<br />
<br />
= ScreenShotAttribute =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x4 || Always set to 0 by official sw.<br />
|-<br />
| 0x4 || 0x4 || [[#AlbumImageOrientation]]<br />
|-<br />
| 0x8 || 0x4 || Always set to 0 by official sw.<br />
|-<br />
| 0xC || 0x4 || Always set to 1 by official sw.<br />
|-<br />
| 0x10 || 0x30 || Always set to 0 by official sw.<br />
|}<br />
<br />
This is "nn::capsrv::detail::ScreenShotAttributeEx0" / "nn::capsrv::ScreenShotAttribute". This is a 0x40-byte struct.<br />
<br />
= ApplicationData =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x400 || UserData<br />
|-<br />
| 0x400 || 0x4 || UserData size.<br />
|}<br />
<br />
This is "nn::capsrv::ApplicationData". This is a 0x404-byte struct.<br />
<br />
= UserIdList =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x80 || u128 userIDs<br />
|-<br />
| 0x80 || 0x1 || Total userIDs.<br />
|-<br />
| 0x81 || 0x7 || Padding.<br />
|}<br />
<br />
This is "nn::capsrv::UserIdList". This is a 0x88-byte struct.<br />
<br />
= LoadAlbumScreenShotImageOutputForApplication =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x8 || s64 Width. Official sw copies this to a s32 output field.<br />
|-<br />
| 0x8 || 0x8 || s64 Height. Official sw copies this to a s32 output field.<br />
|-<br />
| 0x10 || 0x40 || [[#ScreenShotAttributeForApplication]]<br />
|-<br />
| 0x50 || 0x404 || [[#ApplicationData]]<br />
|-<br />
| 0x454 || 0xAC || Unused<br />
|}<br />
<br />
This is "nn::capsrv::sf::LoadAlbumScreenShotImageOutputForApplication". This is a 0x500-byte struct.<br />
<br />
= ScreenShotDecodeOption =<br />
This is "nn::capsrv::ScreenShotDecodeOption". This is a 0x20-byte struct.<br />
<br />
Official sw sets this to all-zero with the input for [[#LoadAlbumScreenShotImageByAruid]]/[[#LoadAlbumScreenShotThumbnailImageByAruid]].<br />
<br />
= ScreenShotAttributeForApplication =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x4 || Unknown.<br />
|-<br />
| 0x4 || 0x1 || Unknown.<br />
|-<br />
| 0x5 || 0x1 || Unknown.<br />
|-<br />
| 0x6 || 0x1 || Unknown.<br />
|-<br />
| 0x7 || 0x1 || Padding.<br />
|-<br />
| 0x8 || 0x4 || Unknown.<br />
|-<br />
| 0xC || 0x4 || Unknown.<br />
|-<br />
| 0x10 || 0x4 || Unknown.<br />
|-<br />
| 0x14 || 0x4 || Unknown.<br />
|-<br />
| 0x18 || 0x4 || Unknown.<br />
|-<br />
| 0x1C || 0x4 || Unknown.<br />
|-<br />
| 0x20 || 0x2 || Unknown.<br />
|-<br />
| 0x22 || 0x2 || Unknown.<br />
|-<br />
| 0x24 || 0x2 || Unknown.<br />
|-<br />
| 0x26 || 0x2 || Unknown.<br />
|-<br />
| 0x28 || 0x18 || Always zero.<br />
|}<br />
<br />
This is "nn::capsrv::ScreenShotAttributeForApplication". This is a 0x40-byte struct.<br />
<br />
Official sw only uses this in <code>nn::album</code> funcs which convert this to [[#AlbumFileAttribute]], with the output from [[#LoadAlbumScreenShotImageByAruid]]/[[#LoadAlbumScreenShotThumbnailImageByAruid]] (only the first u32 is used).<br />
<br />
= AlbumFileAttribute =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x8 || The <code>nn::album</code> funcs referenced by [[#ScreenShotAttributeForApplication]] set this to: <code>ScreenShotAttributeForApplication.first_u32 == 2</code>.<br />
|-<br />
| 0x8 || 0x8 || Set to zero by official sw.<br />
|}<br />
<br />
This is "nn::album::AlbumFileAttribute". This is a 0x10-byte struct. See also [[#ScreenShotAttributeForApplication]].<br />
<br />
= AlbumMovieReadStreamHandle =<br />
This is "nn::capsrv::AlbumMovieReadStreamHandle" / "nn::album::MovieStreamHandle".<br />
<br />
This is an u64 stream handle.<br />
<br />
= Notes =<br />
capsrv is responsible for validating the MACs for screenshots stored on the SD card, if the setting capsrv!enable_album_screenshot_filedata_verification is non-zero. <br />
<br />
Screenshots are validated as follows: The JPEG's MAC is extracted from the EXIF maker note, and stored. A timestamp string is generated by calling snprintf(&str, 20, "%04d:%02d:%02d %02d:%02d:%02d", ...); with stored timestamp values. If this doesn't match the timestamp string stored in EXIF, then an error 0xA34CE is returned. Otherwise, the entire JPEG is loaded into memory, and the stored EXIF maker note is cleared to zeroes. Then, an HMAC-SHA256 is computed over the entire JPEG using a hardcoded secret key. if (memcmp(calculated_hmac, stored_hmac, 0x10) == 0), the screenshot is valid, else 0xA3ACE is returned.<br />
<br />
In [[3.0.0]], MAC calculation was changed: now, instead of calculating an HMAC, a plain SHA256 hash is calculated. capsrv basically does screenshot_kek = spl::GenerateAesKek(<hardcoded screenshot_kek_source>); spl::LoadAesKey(screenshot_kek, <hardcoded screenshot_key_source>); MAC = spl::ComputeCmac(hash);<br />
<br />
== Videos ==<br />
[[4.0.0]] includes video playback etc support in Album via mp4. These include a JPEG thumbnail, which is used for video "validation". The EXIF is also much larger: the MakerNote is 0x498-bytes, with encrypted data starting at offset +0x8. This encryption uses AES-CTR with hardcoded key/ctr. MAC calculation works the same way as the [[3.0.0]]+ JPEG MAC calculation, except with a different movie_kek_source/movie_key_source.<br />
<br />
Each 0x40000-byte chunk in the Movie data stream is validated with a SHA256 hash table, where hash_index=offset>>18. Whether an error is thrown on mismatch is controlled by [[System_Settings|system-setting]] "capsrv!enable_album_movie_filehash_verification".<br />
<br />
Note: the Album process itself uses libstagefright for video playback.<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=BCAT_Content_Container&diff=10182
BCAT Content Container
2020-11-18T16:28:39Z
<p>Behemoth: </p>
<hr />
<div>Content downloaded by [[BCAT_services|BCAT]] normally uses this container.<br />
<br />
=Header=<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x4<br />
| Magicnum "bcat"<br />
|-<br />
| 0x4<br />
| 0x1<br />
| ? Required to be 1.<br />
|-<br />
| 0x5<br />
| 0x1<br />
| Crypto type: 0x1 = AES-128-CTR, 0x2 = AES-192-CTR, 0x3 = AES-256-CTR. Everything else indicates plaintext.<br />
|-<br />
| 0x6<br />
| 0x1<br />
| RSA/Hash Type: {0x0,0x2} = SHA1, {0x1,0x3} = SHA256. The former value in each pair is RSA PKCS1, while the later value in each pair is RSA PSS. Value >0x3 eventually results in an error being thrown.<br />
|-<br />
| 0x7<br />
| 0x1<br />
| Secret-data index<br />
|-<br />
| 0x8<br />
| 0x8<br />
| Normally zero?<br />
|-<br />
| 0x10<br />
| 0x10<br />
| Base IV/CTR<br />
|-<br />
| 0x20<br />
| 0x100<br />
| RSA-2048 signature<br />
|}<br />
<br />
The header is 0x120-bytes.<br />
<br />
Settings config for 1-byte <"bcat", "production_mode"> is loaded, the output is used to determine which RSA modulo and secret data array to use.<br />
<br />
=Key generation=<br />
The AES keydata is the output from pkcs5_pbkdf2_hmac, with SHA256: password = <passphrase string loaded from file>, salt = <below salt string>, and iteration_count=4096.<br />
<br />
The passphrase is loaded from "<basepath>/passphrase.bin" (this data originally comes from the title's control.nacp @ 0x3100). passphrase_len=strlen(passphrase). 0x40-bytes are read from the file, with 0x0 being written to passphrase[total_read_data]. salt_len = strlen(salt).<br />
<br />
salt is the snprintf output from "%016llx%s", where the former is the titleID, while the latter is secretdata_str. secretdata_str = secretdata_array[<value of hdr+0x7>].<br />
<br />
Settings config for 1-byte <"bcat", "production_mode"> is loaded, when retval!=1 or output_config!=0, then secretdata_array = secretdata_array0(retail), otherwise secretdata_array = secretdata_array1(devunit). The latter only contains empty strings, while the former contains lower-case hex strings. There are 16 entries in each array.</div>
Behemoth
https://switchbrew.org/w/index.php?title=BCAT_services&diff=10180
BCAT services
2020-11-18T16:26:21Z
<p>Behemoth: /* 30500 */</p>
<hr />
<div>BCAT (Background Content Asymmetric synchronized delivery and Transmission) encompasses a set of content download/upload related services.<br />
<br />
= bcat:a, bcat:m, bcat:u, bcat:s =<br />
These are "nn::bcat::detail::ipc::IServiceCreator".<br />
<br />
These were added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || CreateBcatService || Takes an input u64 ProcessId, returns an [[#IBcatService]]<br />
|-<br />
| 1 || CreateDeliveryCacheStorageService || Takes an input u64 ProcessId, returns an [[#IDeliveryCacheStorageService]]<br />
|-<br />
| 2 || CreateDeliveryCacheStorageServiceWithApplicationId || Takes an input u64 TitleId, returns an [[#IDeliveryCacheStorageService]]<br />
|-<br />
| 3 || [2.0.0-2.3.0] CreateDeliveryCacheProgressService || Takes an input u64 ProcessId, returns an [[#IDeliveryCacheProgressService]]<br />
|-<br />
| 4 || [2.0.0-2.3.0] CreateDeliveryCacheProgressServiceWithApplicationId || Takes an input u64 TitleId, returns an [[#IDeliveryCacheProgressService]]<br />
|}<br />
<br />
Equivalent to 3DS BOSS(SpotPass). See [[BCAT_Content_Container|here]] for BCAT-content-container.<br />
<br />
== IBcatService ==<br />
This is "nn::bcat::detail::ipc::IBcatService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || [[#RequestSyncDeliveryCache]]<br />
|-<br />
| 10101 || [5.0.0+] RequestSyncDeliveryCacheWithDirectoryName<br />
|-<br />
| 10200 || [5.0.0+] CancelSyncDeliveryCacheRequest<br />
|-<br />
| 20100 || [[#RequestSyncDeliveryCacheWithApplicationId]]<br />
|-<br />
| 20101 || [5.0.0+] RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName<br />
|-<br />
| 20300 || [8.0.0+] [[#GetDeliveryCacheStorageUpdateNotifier]]<br />
|-<br />
| 20301 || [8.0.0+] [[#RequestSuspendDeliveryTask]]<br />
|-<br />
| 20400 || [9.0.0+] [[#RegisterSystemApplicationDeliveryTask]]<br />
|-<br />
| 20401 || [9.0.0+] [[#UnregisterSystemApplicationDeliveryTask]]<br />
|-<br />
| 20410 || [9.1.0+] SetSystemApplicationDeliveryTaskTimer<br />
|-<br />
| 30100 || SetPassphrase<br />
|-<br />
| 30101 || [2.0.0-2.3.0] <br />
|-<br />
| 30102 || [2.0.0-2.3.0] <br />
|-<br />
| 30200 || [3.0.0+] RegisterDeliveryTask<br />
|-<br />
| 30201 || [3.0.0+] UnregisterDeliveryTask<br />
|-<br />
| 30202 || [3.0.0+] BlockDeliveryTask<br />
|-<br />
| 30203 || [3.0.0+] UnblockDeliveryTask<br />
|-<br />
| 30210 || [9.1.0+] SetDeliveryTaskTimer<br />
|-<br />
| 30300 || [8.0.0+] RegisterSystemApplicationDeliveryTasks<br />
|-<br />
| 90100 || GetDeliveryTaskList<br />
|-<br />
| 90200 || [[#GetDeliveryList]]<br />
|-<br />
| 90201 || [3.0.0+] ClearDeliveryCacheStorage<br />
|-<br />
| 90202 || [8.0.0+] ClearDeliveryTaskSubscriptionStatus<br />
|-<br />
| 90300 || [3.0.0+] GetPushNotificationLog<br />
|}<br />
<br />
=== RequestSyncDeliveryCache ===<br />
No input/output.<br />
<br />
[3.0.0+] Now returns an [[#IDeliveryCacheProgressService]].<br />
<br />
=== RequestSyncDeliveryCacheWithApplicationId ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
[3.0.0+] Now takes an additional 8-bytes of input, and returns an [[#IDeliveryCacheProgressService]].<br />
<br />
=== GetDeliveryCacheStorageUpdateNotifier ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, returns an [[#INotifierService]].<br />
<br />
=== RequestSuspendDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, returns an [[#IDeliveryTaskSuspensionService]].<br />
<br />
=== RegisterSystemApplicationDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
=== UnregisterSystemApplicationDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
=== GetDeliveryList ===<br />
Takes a type-0x6 output buffer, returns a total of 4-bytes of output.<br />
<br />
[3.0.0+] Now takes a total of 8-bytes of input, and returns an additional 4-bytes of output.<br />
<br />
=== IDeliveryCacheProgressService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheProgressService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetEvent<br />
|-<br />
| 1 || GetImpl<br />
|}<br />
<br />
== IDeliveryCacheStorageService ==<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheStorageService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || CreateFileService<br />
|-<br />
| 1 || CreateDirectoryService<br />
|-<br />
| 10 || EnumerateDeliveryCacheDirectory<br />
|}<br />
<br />
=== IDeliveryCacheFileService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheFileService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Open<br />
|-<br />
| 1 || Read<br />
|-<br />
| 2 || GetSize<br />
|-<br />
| 3 || GetDigest<br />
|}<br />
<br />
=== IDeliveryCacheDirectoryService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheDirectoryService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Open<br />
|-<br />
| 1 || Read<br />
|-<br />
| 2 || GetCount<br />
|}<br />
<br />
=== INotifierService ===<br />
This is "nn::bcat::detail::ipc::INotifierService".<br />
<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetEvent || <br />
|}<br />
<br />
=== IDeliveryTaskSuspensionService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryTaskSuspensionService".<br />
<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetEvent || <br />
|}<br />
<br />
= <nowiki>news:a, news:c, news:m, news:p, news:v</nowiki> =<br />
These are <nowiki>"nn::news::detail::ipc::IServiceCreator"</nowiki>.<br />
<br />
On [1.0.0] these are <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>, see [[#INewsService]].<br />
<br />
News entries are fetched from CDN[https://switchbrew.org/wiki/Network#Others].<br />
Metadata for each entry is stored and queried from an internal SQLite database.<br />
Official software uses sqlite[https://www.sqlite.org/download.html] for processing.<br />
<br />
All sessions have 32 sessions.<br />
Permission masks are:<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Name || Mask<br />
|-<br />
| <nowiki>news:a</nowiki> || 0xffffffff<br />
|-<br />
| <nowiki>news:p</nowiki> || 0x1<br />
|-<br />
| <nowiki>news:c</nowiki> || 0x2<br />
|-<br />
| <nowiki>news:v</nowiki> || 0x4<br />
|-<br />
| <nowiki>news:m</nowiki> || 0xd<br />
|}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || CreateNewsService || No input, returns an [[#INewsService]].<br />
|-<br />
| 1 || CreateNewlyArrivedEventHolder || No input, returns an [[#INewlyArrivedEventHolder]].<br />
|-<br />
| 2 || CreateNewsDataService || No input, returns an [[#INewsDataService]].<br />
|-<br />
| 3 || CreateNewsDatabaseService || No input, returns an [[#INewsDatabaseService]].<br />
|-<br />
| 4 || CreateOverwriteEventHolder || No input, returns an [[#IOverwriteEventHolder]].<br />
|}<br />
<br />
CreateNewsDataService and CreateNewsDatabaseService require permission bit 2.<br />
<br />
== INewsService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Required Permission Bits<br />
|-<br />
| 10100 || [[#PostLocalNews]] || 0<br />
|-<br />
| 20100 || SetPassphrase || 1<br />
|-<br />
| 30100 || GetSubscriptionStatus || 1 or 2<br />
|-<br />
| 30101 || [3.0.0+] GetTopicList || 2<br />
|-<br />
| [[#30110]] || [6.0.0+] || 2<br />
|-<br />
| 30200 || [[#IsSystemUpdateRequired]] || 2<br />
|-<br />
| 30201 || [8.0.0+] || 2<br />
|-<br />
| [[#30210]] || [10.0.0+] || 2<br />
|-<br />
| 30300 || RequestImmediateReception || 2<br />
|-<br />
| 30400 || [3.0.0+] DecodeArchiveFile || 2<br />
|-<br />
| [[#30500]] || [8.0.0+] ? || 2<br />
|-<br />
| 30900 || [1.0.0] (No input, returns an [[#INewlyArrivedEventHolder]]) || 2<br />
|-<br />
| 30901 || [1.0.0] (No input, returns an [[#INewsDataService]]) || 2<br />
|-<br />
| 30902 || [1.0.0] (No input, returns an [[#INewsDatabaseService]]) || 2<br />
|-<br />
| 40100 || SetSubscriptionStatus || 1 or 3<br />
|-<br />
| 40101 || [3.0.0+] RequestAutoSubscription || 3<br />
|-<br />
| 40200 || ClearStorage || 3<br />
|-<br />
| 40201 || ClearSubscriptionStatusAll || 1 or 3<br />
|-<br />
| 90100 || [[#GetNewsDatabaseDump]] || 4<br />
|}<br />
<br />
=== PostLocalNews ===<br />
Takes an input buffer msgpack.<br />
<br />
=== 30110 ===<br />
Returns two u64s. Current usage and total size of the news-mounted savedata 0x8000000000000090.<br />
<br />
=== IsSystemUpdateRequired ===<br />
Matches the version in news-sys:/sup.version against the result from system setting news!system_version.<br />
<br />
=== 30210 ===<br />
Returns the Database version retrieved from system setting news!db_version<br />
<br />
=== 30500 ===<br />
Takes a type-0x9 input buffer URL, the size of the transfer memory and a handle for the latter, returns an [[#IUnknown2]].<br />
Downloaded files need to be encrypted [https://switchbrew.org/wiki/BCAT_Content_Container BCAT Content Container] (Crypto type 1-3).<br />
Files will be decrypted before being stored in the transfer memory.<br />
<br />
=== GetNewsDatabaseDump ===<br />
Dumps internal SQLite file.<br />
<br />
== INewlyArrivedEventHolder ==<br />
This is <nowiki>"nn::news::detail::ipc::INewlyArrivedEventHolder"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|}<br />
<br />
=== Get ===<br />
Returns readable event.<br />
Event is signaled on PostLocalNews or on fetch from CDN if the file doesn't exist.<br />
<br />
== INewsDataService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsDataService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Open]]<br />
|-<br />
| 1 || [[#OpenWithNewsRecordV1]]<br />
|-<br />
| 2 || [[#Read]]<br />
|-<br />
| 3 || [[#GetSize]]<br />
|-<br />
| 1001 || [6.0.0+] [[#OpenWithNewsRecord]]<br />
|}<br />
<br />
=== Open ===<br />
Takes an input string. Opens file with the output of snprintf from <nowiki>"news:/data/%s"</nowiki> with input.<br />
<br />
=== OpenWithNewsRecordV1 ===<br />
Takes an input [[#NewsRecordV1]]. Opens file with the output of snprintf of <nowiki>"news:/data/D00000000000000000000_%s.msgpack"</nowiki> with news_id if user_id is empty or else of <nowiki>"news:/data/U%s_%s.msgpack"</nowiki> with user_id and news_id of input.<br />
<br />
=== Read ===<br />
Read from file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]].<br />
<br />
=== GetSize ===<br />
Get size of file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]].<br />
<br />
=== OpenWithNewsRecord===<br />
Takes an input [[#NewsRecord]]. Same behavior as [[#OpenWithNewsRecordV1]].<br />
<br />
== INewsDatabaseService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsDatabaseService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetListV1<br />
|-<br />
| 1 || Count<br />
|-<br />
| 2 || CountWithKey<br />
|-<br />
| 3 || UpdateIntegerValue<br />
|-<br />
| 4 || UpdateIntegerValueWithAddition<br />
|-<br />
| 5 || UpdateStringValue<br />
|-<br />
| 1000 || [6.0.0+] GetList<br />
|}<br />
<br />
== IOverwriteEventHolder ==<br />
This is <nowiki>"nn::news::detail::ipc::IOverwriteEventHolder"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|}<br />
<br />
=== Get ===<br />
Returns readable event.<br />
Event is signaled on fetch from CDN if the file already exists.<br />
<br />
== IUnknown2 ==<br />
This was added with [8.0.0+].<br />
On creation this object is enqueued and an event is signaled prompting a download from another thread (nn.news.Downloader).<br />
<br />
(Made up names)<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|-<br />
| 1 || [[#Cancel]]<br />
|-<br />
| 2 || [[#GetResult]]<br />
|-<br />
| 3 || [[#GetSize]]<br />
|}<br />
<br />
=== Get ===<br />
Return event handle. Signaled on download finish.<br />
<br />
=== Cancel ===<br />
Cancels Download.<br />
<br />
=== GetResult ===<br />
Returns last result.<br />
<br />
=== GetSize ===<br />
Returns final decoded size. 0 if the result of [[#GetResult]] is not 0 or Download isn't finished/was canceled.<br />
<br />
== NewsDatabase ==<br />
<br />
Internal SQLite database. Has a second version since 6.0.0.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Name<br />
! Type<br />
! Exists<br />
|-<br />
| news_id || TEXT || All<br />
|-<br />
| user_id || TEXT || All<br />
|-<br />
| topic_id || TEXT || All<br />
|-<br />
| application_ids || TEXT || All<br />
|-<br />
| received_at || INTEGER || All<br />
|-<br />
| published_at || INTEGER || All<br />
|-<br />
| expire_at || INTEGER || All<br />
|-<br />
| pickup_limit || INTEGER || All<br />
|-<br />
| essential_pickup_limit || INTEGER || Only V2<br />
|-<br />
| priority || INTEGER || All<br />
|-<br />
| deletion_priority || INTEGER || All<br />
|-<br />
| age_limit || INTEGER || All<br />
|-<br />
| surprise || INTEGER || All<br />
|-<br />
| bashotorya || INTEGER || Only V1<br />
|-<br />
| decoration_type || INTEGER || Only V2<br />
|-<br />
| point || INTEGER || All<br />
|-<br />
| read || INTEGER || All<br />
|-<br />
| newly || INTEGER || All<br />
|-<br />
| displayed || INTEGER || All<br />
|-<br />
| opted_in || INTEGER || All<br />
|-<br />
| point_status || INTEGER || All<br />
|-<br />
| feedback || INTEGER || Only V2<br />
|-<br />
| extra_1 || INTEGER || All<br />
|-<br />
| extra_2 || INTEGER || All<br />
|-<br />
|}<br />
<br />
== NewsRecordV1 ==<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! SQLite association<br />
|-<br />
| 0x0 || 0x18 || TEXT news_id<br />
|-<br />
| 0x18 || 0x18 || TEXT user_id<br />
|-<br />
| 0x30 || 0x8 || INTEGER received_id<br />
|-<br />
| 0x38 || 0x4 || INTEGER news<br />
|-<br />
| 0x3c || 0x4 || INTEGER newly<br />
|-<br />
| 0x40 || 0x4 || INTEGER displayed<br />
|-<br />
| 0x44 || 0x4 || none<br />
|-<br />
|}<br />
<br />
== NewsRecord ==<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! SQLite association<br />
|-<br />
| 0x0 || 0x18 || TEXT news_id<br />
|-<br />
| 0x18 || 0x18 || TEXT user_id<br />
|-<br />
| 0x30 || 0x20 || TEXT topic_id<br />
|-<br />
| 0x50 || 0x8 || INTEGER received_id<br />
|-<br />
| 0x58 || 0x8 || none<br />
|-<br />
| 0x60 || 0x4 || INTEGER decoration_type<br />
|-<br />
| 0x64 || 0x4 || INTEGER read<br />
|-<br />
| 0x68 || 0x4 || INTEGER newly<br />
|-<br />
| 0x6c || 0x4 || INTEGER displayed<br />
|-<br />
| 0x70 || 0x4 || INTEGER feedback<br />
|-<br />
| 0x74 || 0x4 || none<br />
|-<br />
| 0x78 || 0x4 || INTEGER extra_1<br />
|-<br />
| 0x7c || 0x4 || INTEGER extra_2<br />
|-<br />
|}<br />
<br />
= prepo:a, prepo:a2, prepo:m, prepo:u, prepo:s =<br />
These are "nn::prepo::detail::ipc::IPrepoService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || SaveReportOld ([1.0.0-5.1.0] SaveReport)<br />
|-<br />
| 10101 || SaveReportWithUserOld ([1.0.0-5.1.0] SaveReportWithUser)<br />
|-<br />
| 10102 || [6.0.0+] SaveReportOld2 ([1.0.0-9.2.0] SaveReport)<br />
|-<br />
| 10103 || [6.0.0+] SaveReportWithUserOld2 ([1.0.0-9.2.0] SaveReportWithUser)<br />
|-<br />
| 10104 || [10.0.0+] SaveReport<br />
|-<br />
| 10105 || [10.0.0+] SaveReportWithUser<br />
|-<br />
| 10200 || RequestImmediateTransmission<br />
|-<br />
| 10300 || GetTransmissionStatus<br />
|-<br />
| 10400 || [9.0.0+] GetSystemSessionId<br />
|-<br />
| 20100 || SaveSystemReport<br />
|-<br />
| 20101 || SaveSystemReportWithUser<br />
|-<br />
| 20200 || [4.0.0+] SetOperationMode<br />
|-<br />
| 30100 || ClearStorage<br />
|-<br />
| 30200 || [6.0.0+] ClearStatistics<br />
|-<br />
| 30300 || [6.0.0+] GetStorageUsage<br />
|-<br />
| 30400 || [6.0.0+] GetStatistics<br />
|-<br />
| 30401 || [6.0.0+] GetThroughputHistory<br />
|-<br />
| 30500 || [6.0.0+] GetLastUploadError<br />
|-<br />
| 30600 || [10.0.0+] GetApplicationUploadSummary<br />
|-<br />
| 40100 || [2.0.0+] IsUserAgreementCheckEnabled<br />
|-<br />
| 40101 || [2.0.0+] SetUserAgreementCheckEnabled<br />
|-<br />
| 50100 || [10.0.0+] ReadAllApplicationReportFiles<br />
|-<br />
| 90100 || [6.0.0+] ReadAllReportFiles ([1.0.0-5.1.0] GetStorageUsage)<br />
|-<br />
| 90101 || [1.0.0]<br />
|-<br />
| 90102 || [1.0.0] <br />
|-<br />
| 90200 || [5.0.0-5.1.0] GetStatistics<br />
|-<br />
| 90201 || [5.0.0-5.1.0] GetThroughputHistory<br />
|-<br />
| 90300 || [5.0.0-5.1.0] GetLastUploadError<br />
|}<br />
<br />
== Data reporting ==<br />
The "Play Report" (prepo) service uploads system and user information to a cloud server.<br />
This includes the following fields:<br />
sys_info<br />
data<br />
application_id<br />
event_id<br />
operation_mode<br />
lc_recorded_at (followed by a timestamp)<br />
nc_recorded_at (followed by a timestamp)<br />
nsa_id<br />
os_version<br />
<br />
And the contents of the following file:<br />
is_user_agreement_check_enabled.bin<br />
<br />
All the information is periodically uploaded to the following URL:<br><br />
* <nowiki>https://receive-%.dg.srv.nintendo.net/post</nowiki><br />
<br />
It also checks the validity of the device's authentication token using the following URL:<br><br />
* <nowiki>https://dauth-%.ndas.srv.nintendo.net/v1/device_auth_token</nowiki><br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=BCAT_services&diff=10179
BCAT services
2020-11-18T16:25:35Z
<p>Behemoth: /* 30500 */</p>
<hr />
<div>BCAT (Background Content Asymmetric synchronized delivery and Transmission) encompasses a set of content download/upload related services.<br />
<br />
= bcat:a, bcat:m, bcat:u, bcat:s =<br />
These are "nn::bcat::detail::ipc::IServiceCreator".<br />
<br />
These were added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || CreateBcatService || Takes an input u64 ProcessId, returns an [[#IBcatService]]<br />
|-<br />
| 1 || CreateDeliveryCacheStorageService || Takes an input u64 ProcessId, returns an [[#IDeliveryCacheStorageService]]<br />
|-<br />
| 2 || CreateDeliveryCacheStorageServiceWithApplicationId || Takes an input u64 TitleId, returns an [[#IDeliveryCacheStorageService]]<br />
|-<br />
| 3 || [2.0.0-2.3.0] CreateDeliveryCacheProgressService || Takes an input u64 ProcessId, returns an [[#IDeliveryCacheProgressService]]<br />
|-<br />
| 4 || [2.0.0-2.3.0] CreateDeliveryCacheProgressServiceWithApplicationId || Takes an input u64 TitleId, returns an [[#IDeliveryCacheProgressService]]<br />
|}<br />
<br />
Equivalent to 3DS BOSS(SpotPass). See [[BCAT_Content_Container|here]] for BCAT-content-container.<br />
<br />
== IBcatService ==<br />
This is "nn::bcat::detail::ipc::IBcatService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || [[#RequestSyncDeliveryCache]]<br />
|-<br />
| 10101 || [5.0.0+] RequestSyncDeliveryCacheWithDirectoryName<br />
|-<br />
| 10200 || [5.0.0+] CancelSyncDeliveryCacheRequest<br />
|-<br />
| 20100 || [[#RequestSyncDeliveryCacheWithApplicationId]]<br />
|-<br />
| 20101 || [5.0.0+] RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName<br />
|-<br />
| 20300 || [8.0.0+] [[#GetDeliveryCacheStorageUpdateNotifier]]<br />
|-<br />
| 20301 || [8.0.0+] [[#RequestSuspendDeliveryTask]]<br />
|-<br />
| 20400 || [9.0.0+] [[#RegisterSystemApplicationDeliveryTask]]<br />
|-<br />
| 20401 || [9.0.0+] [[#UnregisterSystemApplicationDeliveryTask]]<br />
|-<br />
| 20410 || [9.1.0+] SetSystemApplicationDeliveryTaskTimer<br />
|-<br />
| 30100 || SetPassphrase<br />
|-<br />
| 30101 || [2.0.0-2.3.0] <br />
|-<br />
| 30102 || [2.0.0-2.3.0] <br />
|-<br />
| 30200 || [3.0.0+] RegisterDeliveryTask<br />
|-<br />
| 30201 || [3.0.0+] UnregisterDeliveryTask<br />
|-<br />
| 30202 || [3.0.0+] BlockDeliveryTask<br />
|-<br />
| 30203 || [3.0.0+] UnblockDeliveryTask<br />
|-<br />
| 30210 || [9.1.0+] SetDeliveryTaskTimer<br />
|-<br />
| 30300 || [8.0.0+] RegisterSystemApplicationDeliveryTasks<br />
|-<br />
| 90100 || GetDeliveryTaskList<br />
|-<br />
| 90200 || [[#GetDeliveryList]]<br />
|-<br />
| 90201 || [3.0.0+] ClearDeliveryCacheStorage<br />
|-<br />
| 90202 || [8.0.0+] ClearDeliveryTaskSubscriptionStatus<br />
|-<br />
| 90300 || [3.0.0+] GetPushNotificationLog<br />
|}<br />
<br />
=== RequestSyncDeliveryCache ===<br />
No input/output.<br />
<br />
[3.0.0+] Now returns an [[#IDeliveryCacheProgressService]].<br />
<br />
=== RequestSyncDeliveryCacheWithApplicationId ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
[3.0.0+] Now takes an additional 8-bytes of input, and returns an [[#IDeliveryCacheProgressService]].<br />
<br />
=== GetDeliveryCacheStorageUpdateNotifier ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, returns an [[#INotifierService]].<br />
<br />
=== RequestSuspendDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, returns an [[#IDeliveryTaskSuspensionService]].<br />
<br />
=== RegisterSystemApplicationDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
=== UnregisterSystemApplicationDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
=== GetDeliveryList ===<br />
Takes a type-0x6 output buffer, returns a total of 4-bytes of output.<br />
<br />
[3.0.0+] Now takes a total of 8-bytes of input, and returns an additional 4-bytes of output.<br />
<br />
=== IDeliveryCacheProgressService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheProgressService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetEvent<br />
|-<br />
| 1 || GetImpl<br />
|}<br />
<br />
== IDeliveryCacheStorageService ==<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheStorageService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || CreateFileService<br />
|-<br />
| 1 || CreateDirectoryService<br />
|-<br />
| 10 || EnumerateDeliveryCacheDirectory<br />
|}<br />
<br />
=== IDeliveryCacheFileService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheFileService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Open<br />
|-<br />
| 1 || Read<br />
|-<br />
| 2 || GetSize<br />
|-<br />
| 3 || GetDigest<br />
|}<br />
<br />
=== IDeliveryCacheDirectoryService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheDirectoryService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Open<br />
|-<br />
| 1 || Read<br />
|-<br />
| 2 || GetCount<br />
|}<br />
<br />
=== INotifierService ===<br />
This is "nn::bcat::detail::ipc::INotifierService".<br />
<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetEvent || <br />
|}<br />
<br />
=== IDeliveryTaskSuspensionService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryTaskSuspensionService".<br />
<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetEvent || <br />
|}<br />
<br />
= <nowiki>news:a, news:c, news:m, news:p, news:v</nowiki> =<br />
These are <nowiki>"nn::news::detail::ipc::IServiceCreator"</nowiki>.<br />
<br />
On [1.0.0] these are <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>, see [[#INewsService]].<br />
<br />
News entries are fetched from CDN[https://switchbrew.org/wiki/Network#Others].<br />
Metadata for each entry is stored and queried from an internal SQLite database.<br />
Official software uses sqlite[https://www.sqlite.org/download.html] for processing.<br />
<br />
All sessions have 32 sessions.<br />
Permission masks are:<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Name || Mask<br />
|-<br />
| <nowiki>news:a</nowiki> || 0xffffffff<br />
|-<br />
| <nowiki>news:p</nowiki> || 0x1<br />
|-<br />
| <nowiki>news:c</nowiki> || 0x2<br />
|-<br />
| <nowiki>news:v</nowiki> || 0x4<br />
|-<br />
| <nowiki>news:m</nowiki> || 0xd<br />
|}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || CreateNewsService || No input, returns an [[#INewsService]].<br />
|-<br />
| 1 || CreateNewlyArrivedEventHolder || No input, returns an [[#INewlyArrivedEventHolder]].<br />
|-<br />
| 2 || CreateNewsDataService || No input, returns an [[#INewsDataService]].<br />
|-<br />
| 3 || CreateNewsDatabaseService || No input, returns an [[#INewsDatabaseService]].<br />
|-<br />
| 4 || CreateOverwriteEventHolder || No input, returns an [[#IOverwriteEventHolder]].<br />
|}<br />
<br />
CreateNewsDataService and CreateNewsDatabaseService require permission bit 2.<br />
<br />
== INewsService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Required Permission Bits<br />
|-<br />
| 10100 || [[#PostLocalNews]] || 0<br />
|-<br />
| 20100 || SetPassphrase || 1<br />
|-<br />
| 30100 || GetSubscriptionStatus || 1 or 2<br />
|-<br />
| 30101 || [3.0.0+] GetTopicList || 2<br />
|-<br />
| [[#30110]] || [6.0.0+] || 2<br />
|-<br />
| 30200 || [[#IsSystemUpdateRequired]] || 2<br />
|-<br />
| 30201 || [8.0.0+] || 2<br />
|-<br />
| [[#30210]] || [10.0.0+] || 2<br />
|-<br />
| 30300 || RequestImmediateReception || 2<br />
|-<br />
| 30400 || [3.0.0+] DecodeArchiveFile || 2<br />
|-<br />
| [[#30500]] || [8.0.0+] ? || 2<br />
|-<br />
| 30900 || [1.0.0] (No input, returns an [[#INewlyArrivedEventHolder]]) || 2<br />
|-<br />
| 30901 || [1.0.0] (No input, returns an [[#INewsDataService]]) || 2<br />
|-<br />
| 30902 || [1.0.0] (No input, returns an [[#INewsDatabaseService]]) || 2<br />
|-<br />
| 40100 || SetSubscriptionStatus || 1 or 3<br />
|-<br />
| 40101 || [3.0.0+] RequestAutoSubscription || 3<br />
|-<br />
| 40200 || ClearStorage || 3<br />
|-<br />
| 40201 || ClearSubscriptionStatusAll || 1 or 3<br />
|-<br />
| 90100 || [[#GetNewsDatabaseDump]] || 4<br />
|}<br />
<br />
=== PostLocalNews ===<br />
Takes an input buffer msgpack.<br />
<br />
=== 30110 ===<br />
Returns two u64s. Current usage and total size of the news-mounted savedata 0x8000000000000090.<br />
<br />
=== IsSystemUpdateRequired ===<br />
Matches the version in news-sys:/sup.version against the result from system setting news!system_version.<br />
<br />
=== 30210 ===<br />
Returns the Database version retrieved from system setting news!db_version<br />
<br />
=== 30500 ===<br />
Takes a type-0x9 input buffer URL, the size of the transfer memory and a handle for the latter, returns an [[#IUnknown2]].<br />
Downloaded files need to be encrypted [https://switchbrew.org/wiki/BCAT_Content_Container BCAT Content Container] (Crypto type 1-3).<br />
Files will be decrypted before being stored in the tmem of [[#IUnknown2]].<br />
<br />
=== GetNewsDatabaseDump ===<br />
Dumps internal SQLite file.<br />
<br />
== INewlyArrivedEventHolder ==<br />
This is <nowiki>"nn::news::detail::ipc::INewlyArrivedEventHolder"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|}<br />
<br />
=== Get ===<br />
Returns readable event.<br />
Event is signaled on PostLocalNews or on fetch from CDN if the file doesn't exist.<br />
<br />
== INewsDataService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsDataService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Open]]<br />
|-<br />
| 1 || [[#OpenWithNewsRecordV1]]<br />
|-<br />
| 2 || [[#Read]]<br />
|-<br />
| 3 || [[#GetSize]]<br />
|-<br />
| 1001 || [6.0.0+] [[#OpenWithNewsRecord]]<br />
|}<br />
<br />
=== Open ===<br />
Takes an input string. Opens file with the output of snprintf from <nowiki>"news:/data/%s"</nowiki> with input.<br />
<br />
=== OpenWithNewsRecordV1 ===<br />
Takes an input [[#NewsRecordV1]]. Opens file with the output of snprintf of <nowiki>"news:/data/D00000000000000000000_%s.msgpack"</nowiki> with news_id if user_id is empty or else of <nowiki>"news:/data/U%s_%s.msgpack"</nowiki> with user_id and news_id of input.<br />
<br />
=== Read ===<br />
Read from file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]].<br />
<br />
=== GetSize ===<br />
Get size of file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]].<br />
<br />
=== OpenWithNewsRecord===<br />
Takes an input [[#NewsRecord]]. Same behavior as [[#OpenWithNewsRecordV1]].<br />
<br />
== INewsDatabaseService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsDatabaseService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetListV1<br />
|-<br />
| 1 || Count<br />
|-<br />
| 2 || CountWithKey<br />
|-<br />
| 3 || UpdateIntegerValue<br />
|-<br />
| 4 || UpdateIntegerValueWithAddition<br />
|-<br />
| 5 || UpdateStringValue<br />
|-<br />
| 1000 || [6.0.0+] GetList<br />
|}<br />
<br />
== IOverwriteEventHolder ==<br />
This is <nowiki>"nn::news::detail::ipc::IOverwriteEventHolder"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|}<br />
<br />
=== Get ===<br />
Returns readable event.<br />
Event is signaled on fetch from CDN if the file already exists.<br />
<br />
== IUnknown2 ==<br />
This was added with [8.0.0+].<br />
On creation this object is enqueued and an event is signaled prompting a download from another thread (nn.news.Downloader).<br />
<br />
(Made up names)<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|-<br />
| 1 || [[#Cancel]]<br />
|-<br />
| 2 || [[#GetResult]]<br />
|-<br />
| 3 || [[#GetSize]]<br />
|}<br />
<br />
=== Get ===<br />
Return event handle. Signaled on download finish.<br />
<br />
=== Cancel ===<br />
Cancels Download.<br />
<br />
=== GetResult ===<br />
Returns last result.<br />
<br />
=== GetSize ===<br />
Returns final decoded size. 0 if the result of [[#GetResult]] is not 0 or Download isn't finished/was canceled.<br />
<br />
== NewsDatabase ==<br />
<br />
Internal SQLite database. Has a second version since 6.0.0.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Name<br />
! Type<br />
! Exists<br />
|-<br />
| news_id || TEXT || All<br />
|-<br />
| user_id || TEXT || All<br />
|-<br />
| topic_id || TEXT || All<br />
|-<br />
| application_ids || TEXT || All<br />
|-<br />
| received_at || INTEGER || All<br />
|-<br />
| published_at || INTEGER || All<br />
|-<br />
| expire_at || INTEGER || All<br />
|-<br />
| pickup_limit || INTEGER || All<br />
|-<br />
| essential_pickup_limit || INTEGER || Only V2<br />
|-<br />
| priority || INTEGER || All<br />
|-<br />
| deletion_priority || INTEGER || All<br />
|-<br />
| age_limit || INTEGER || All<br />
|-<br />
| surprise || INTEGER || All<br />
|-<br />
| bashotorya || INTEGER || Only V1<br />
|-<br />
| decoration_type || INTEGER || Only V2<br />
|-<br />
| point || INTEGER || All<br />
|-<br />
| read || INTEGER || All<br />
|-<br />
| newly || INTEGER || All<br />
|-<br />
| displayed || INTEGER || All<br />
|-<br />
| opted_in || INTEGER || All<br />
|-<br />
| point_status || INTEGER || All<br />
|-<br />
| feedback || INTEGER || Only V2<br />
|-<br />
| extra_1 || INTEGER || All<br />
|-<br />
| extra_2 || INTEGER || All<br />
|-<br />
|}<br />
<br />
== NewsRecordV1 ==<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! SQLite association<br />
|-<br />
| 0x0 || 0x18 || TEXT news_id<br />
|-<br />
| 0x18 || 0x18 || TEXT user_id<br />
|-<br />
| 0x30 || 0x8 || INTEGER received_id<br />
|-<br />
| 0x38 || 0x4 || INTEGER news<br />
|-<br />
| 0x3c || 0x4 || INTEGER newly<br />
|-<br />
| 0x40 || 0x4 || INTEGER displayed<br />
|-<br />
| 0x44 || 0x4 || none<br />
|-<br />
|}<br />
<br />
== NewsRecord ==<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! SQLite association<br />
|-<br />
| 0x0 || 0x18 || TEXT news_id<br />
|-<br />
| 0x18 || 0x18 || TEXT user_id<br />
|-<br />
| 0x30 || 0x20 || TEXT topic_id<br />
|-<br />
| 0x50 || 0x8 || INTEGER received_id<br />
|-<br />
| 0x58 || 0x8 || none<br />
|-<br />
| 0x60 || 0x4 || INTEGER decoration_type<br />
|-<br />
| 0x64 || 0x4 || INTEGER read<br />
|-<br />
| 0x68 || 0x4 || INTEGER newly<br />
|-<br />
| 0x6c || 0x4 || INTEGER displayed<br />
|-<br />
| 0x70 || 0x4 || INTEGER feedback<br />
|-<br />
| 0x74 || 0x4 || none<br />
|-<br />
| 0x78 || 0x4 || INTEGER extra_1<br />
|-<br />
| 0x7c || 0x4 || INTEGER extra_2<br />
|-<br />
|}<br />
<br />
= prepo:a, prepo:a2, prepo:m, prepo:u, prepo:s =<br />
These are "nn::prepo::detail::ipc::IPrepoService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || SaveReportOld ([1.0.0-5.1.0] SaveReport)<br />
|-<br />
| 10101 || SaveReportWithUserOld ([1.0.0-5.1.0] SaveReportWithUser)<br />
|-<br />
| 10102 || [6.0.0+] SaveReportOld2 ([1.0.0-9.2.0] SaveReport)<br />
|-<br />
| 10103 || [6.0.0+] SaveReportWithUserOld2 ([1.0.0-9.2.0] SaveReportWithUser)<br />
|-<br />
| 10104 || [10.0.0+] SaveReport<br />
|-<br />
| 10105 || [10.0.0+] SaveReportWithUser<br />
|-<br />
| 10200 || RequestImmediateTransmission<br />
|-<br />
| 10300 || GetTransmissionStatus<br />
|-<br />
| 10400 || [9.0.0+] GetSystemSessionId<br />
|-<br />
| 20100 || SaveSystemReport<br />
|-<br />
| 20101 || SaveSystemReportWithUser<br />
|-<br />
| 20200 || [4.0.0+] SetOperationMode<br />
|-<br />
| 30100 || ClearStorage<br />
|-<br />
| 30200 || [6.0.0+] ClearStatistics<br />
|-<br />
| 30300 || [6.0.0+] GetStorageUsage<br />
|-<br />
| 30400 || [6.0.0+] GetStatistics<br />
|-<br />
| 30401 || [6.0.0+] GetThroughputHistory<br />
|-<br />
| 30500 || [6.0.0+] GetLastUploadError<br />
|-<br />
| 30600 || [10.0.0+] GetApplicationUploadSummary<br />
|-<br />
| 40100 || [2.0.0+] IsUserAgreementCheckEnabled<br />
|-<br />
| 40101 || [2.0.0+] SetUserAgreementCheckEnabled<br />
|-<br />
| 50100 || [10.0.0+] ReadAllApplicationReportFiles<br />
|-<br />
| 90100 || [6.0.0+] ReadAllReportFiles ([1.0.0-5.1.0] GetStorageUsage)<br />
|-<br />
| 90101 || [1.0.0]<br />
|-<br />
| 90102 || [1.0.0] <br />
|-<br />
| 90200 || [5.0.0-5.1.0] GetStatistics<br />
|-<br />
| 90201 || [5.0.0-5.1.0] GetThroughputHistory<br />
|-<br />
| 90300 || [5.0.0-5.1.0] GetLastUploadError<br />
|}<br />
<br />
== Data reporting ==<br />
The "Play Report" (prepo) service uploads system and user information to a cloud server.<br />
This includes the following fields:<br />
sys_info<br />
data<br />
application_id<br />
event_id<br />
operation_mode<br />
lc_recorded_at (followed by a timestamp)<br />
nc_recorded_at (followed by a timestamp)<br />
nsa_id<br />
os_version<br />
<br />
And the contents of the following file:<br />
is_user_agreement_check_enabled.bin<br />
<br />
All the information is periodically uploaded to the following URL:<br><br />
* <nowiki>https://receive-%.dg.srv.nintendo.net/post</nowiki><br />
<br />
It also checks the validity of the device's authentication token using the following URL:<br><br />
* <nowiki>https://dauth-%.ndas.srv.nintendo.net/v1/device_auth_token</nowiki><br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=News_Applet&diff=10152
News Applet
2020-11-10T09:20:47Z
<p>Behemoth: </p>
<hr />
<div>Displays news downloaded in the background. News pages can link to specific eShop pages, network videos, the system update screen and [[Parental_Control_services|parental control settings]]<br />
<br />
This runs under [[qlaunch]].<br />
<br />
The video URLs use HTTPS with the bugyo domain. Video playback is handled by launching [[Internet_Browser|WebApplet]]/LibAppletWeb(titleID 010000000000100A) just for the media-player. This doesn't seem to use a WebApplet whitelist loaded from any RomFS.<br />
<br />
=Invalid TLS Cert Handling=<br />
With videos it doesn't accept the cert. It hangs during video loading without displaying any error, have to press B to exit.</div>
Behemoth
https://switchbrew.org/w/index.php?title=NS_services&diff=10149
NS services
2020-11-04T19:52:23Z
<p>Behemoth: /* ns:am2, ns:ec, ns:rid, ns:rt, ns:web */</p>
<hr />
<div>= aoc:u =<br />
This is "nn::aocsrv::detail::IAddOnContentManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [1.0.0-6.2.0] CountAddOnContentByApplicationId<br />
|-<br />
| 1 || [1.0.0-6.2.0] ListAddOnContentByApplicationId<br />
|-<br />
| 2 || CountAddOnContent<br />
|-<br />
| 3 || ListAddOnContent<br />
|-<br />
| 4 || [1.0.0-6.2.0] GetAddOnContentBaseIdByApplicationId<br />
|-<br />
| 5 || GetAddOnContentBaseId<br />
|-<br />
| 6 || [1.0.0-6.2.0] PrepareAddOnContentByApplicationId<br />
|-<br />
| 7 || PrepareAddOnContent<br />
|-<br />
| 8 || [4.0.0+] GetAddOnContentListChangedEvent<br />
|-<br />
| 9 || [10.0.0+] GetAddOnContentLostErrorCode<br />
|-<br />
| 100 || [7.0.0+] [[#IPurchaseEventManager|CreateEcPurchasedEventManager]]<br />
|-<br />
| 101 || [9.0.0+] [[#IPurchaseEventManager|CreatePermanentEcPurchasedEventManager]]<br />
|}<br />
<br />
== IPurchaseEventManager ==<br />
This is "nn::ec::IPurchaseEventManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || SetDefaultDeliveryTarget<br />
|-<br />
| 1 || SetDeliveryTarget<br />
|-<br />
| 2 || GetPurchasedEventReadableHandle<br />
|-<br />
| 3 || PopPurchasedProductInfo<br />
|-<br />
| 4 || [9.0.0+] PopPurchasedProductInfoWithUid<br />
|}<br />
<br />
= ns:am =<br />
This is "nn::ns::detail::IApplicationManagerInterface".<br />
<br />
[3.0.0+] This service was replaced by [[#ns:am2, ns:ec, ns:rid, ns:rt, ns:web|ns:am2]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#ListApplicationRecord]]<br />
|-<br />
| 1 || GenerateApplicationRecordCount<br />
|-<br />
| 2 || GetApplicationRecordUpdateSystemEvent<br />
|-<br />
| 3 || GetApplicationViewDeprecated<br />
|-<br />
| 4 || DeleteApplicationEntity<br />
|-<br />
| 5 || DeleteApplicationCompletely<br />
|-<br />
| 6 || IsAnyApplicationEntityRedundant<br />
|-<br />
| 7 || DeleteRedundantApplicationEntity<br />
|-<br />
| 8 || IsApplicationEntityMovable<br />
|-<br />
| 9 || MoveApplicationEntity<br />
|-<br />
| 11 || [[#CalculateApplicationOccupiedSize]]<br />
|-<br />
| 16 || PushApplicationRecord<br />
|-<br />
| 17 || ListApplicationRecordContentMeta<br />
|-<br />
| 18 || CheckLaunchRights<br />
|-<br />
| 19 || [[#LaunchApplication]]<br />
|-<br />
| 21 || [[#GetApplicationContentPath]]<br />
|-<br />
| 22 || TerminateApplication<br />
|-<br />
| 23 || [2.0.0+] ResolveApplicationContentPath<br />
|-<br />
| 26 || BeginInstallApplication<br />
|-<br />
| 27 || DeleteApplicationRecord<br />
|-<br />
| 30 || RequestApplicationUpdateInfo<br />
|-<br />
| 31 || RequestUpdateApplication<br />
|-<br />
| 32 || CancelApplicationDownload<br />
|-<br />
| 33 || ResumeApplicationDownload<br />
|-<br />
| 34 || <br />
|-<br />
| 35 || UpdateVersionList<br />
|-<br />
| 36 || PushLaunchVersion<br />
|-<br />
| 37 || ListRequiredVersion<br />
|-<br />
| 38 || CheckApplicationLaunchVersion<br />
|-<br />
| 39 || CheckApplicationLaunchRights<br />
|-<br />
| 40 || GetApplicationLogoData<br />
|-<br />
| 41 || CalculateApplicationDownloadRequiredSize<br />
|-<br />
| 42 || CleanupSdCard<br />
|-<br />
| 43 || [[#CheckSdCardMountStatus]]<br />
|-<br />
| 44 || GetSdCardMountStatusChangedEvent<br />
|-<br />
| 45 || GetGameCardAttachmentEvent<br />
|-<br />
| 46 || GetGameCardAttachmentInfo<br />
|-<br />
| 47 || [[#GetTotalSpaceSize]]<br />
|-<br />
| 48 || [[#GetFreeSpaceSize]]<br />
|-<br />
| 49 || GetSdCardRemovedEvent<br />
|-<br />
| 52 || GetGameCardUpdateDetectionEvent<br />
|-<br />
| 53 || DisableApplicationAutoDelete<br />
|-<br />
| 54 || EnableApplicationAutoDelete<br />
|-<br />
| 55 || [[#GetApplicationDesiredLanguage]]<br />
|-<br />
| 56 || SetApplicationTerminateResult<br />
|-<br />
| 57 || ClearApplicationTerminateResult<br />
|-<br />
| 58 || GetLastSdCardMountUnexpectedResult<br />
|-<br />
| 59 || ConvertApplicationLanguageToLanguageCode<br />
|-<br />
| 60 || [[#ConvertLanguageCodeToApplicationLanguage]]<br />
|-<br />
| 61 || GetBackgroundDownloadStressTaskInfo<br />
|-<br />
| 62 || GetGameCardStopper<br />
|-<br />
| 63 || IsSystemProgramInstalled<br />
|-<br />
| 64 || [2.0.0+] StartApplyDeltaTask<br />
|-<br />
| 65 || [2.0.0+] GetRequestServerStopper<br />
|-<br />
| 100 || ResetToFactorySettings<br />
|-<br />
| 101 || ResetToFactorySettingsWithoutUserSaveData<br />
|-<br />
| 102 || [2.0.0+] ResetToFactorySettingsForRefurbishment<br />
|-<br />
| 200 || CalculateUserSaveDataStatistics<br />
|-<br />
| 201 || DeleteUserSaveDataAll<br />
|-<br />
| 210 || DeleteUserSystemSaveData<br />
|-<br />
| 220 || UnregisterNetworkServiceAccount<br />
|-<br />
| 300 || GetApplicationShellEvent<br />
|-<br />
| 301 || PopApplicationShellEventInfo<br />
|-<br />
| 302 || LaunchLibraryApplet<br />
|-<br />
| 303 || TerminateLibraryApplet<br />
|-<br />
| 304 || LaunchSystemApplet<br />
|-<br />
| 305 || TerminateSystemApplet<br />
|-<br />
| 306 || LaunchOverlayApplet<br />
|-<br />
| 307 || TerminateOverlayApplet<br />
|-<br />
| 400 || [[#GetApplicationControlData]]<br />
|-<br />
| 401 || InvalidateAllApplicationControlCache<br />
|-<br />
| 402 || RequestDownloadApplicationControlData<br />
|-<br />
| 403 || GetMaxApplicationControlCacheCount<br />
|-<br />
| 404 || [2.0.0+] InvalidateApplicationControlCache<br />
|-<br />
| 405 || [2.0.0+] ListApplicationControlCacheEntryInfo<br />
|-<br />
| 502 || [2.0.0+] RequestCheckGameCardRegistration<br />
|-<br />
| 503 || [2.0.0+] RequestGameCardRegistrationGoldPoint<br />
|-<br />
| 504 || [2.0.0+] RequestRegisterGameCard<br />
|-<br />
| 600 || [2.0.0+] [[#CountApplicationContentMeta]]<br />
|-<br />
| 601 || [2.0.0+] [[#ListApplicationContentMetaStatus]]<br />
|-<br />
| 602 || [2.0.0+] ListAvailableAddOnContent<br />
|-<br />
| 603 || [2.0.0+] GetOwnedApplicationContentMetaStatus<br />
|-<br />
| 604 || [2.0.0+] RegisterContentsExternalKey<br />
|-<br />
| 605 || [2.0.0+] ListApplicationContentMetaStatusWithRightsCheck<br />
|-<br />
| 700 || [2.0.0+] PushDownloadTaskList<br />
|-<br />
| 701 || [2.0.0+] [[#ClearTaskStatusList]]<br />
|-<br />
| 702 || [2.0.0+] [[#RequestDownloadTaskList]]<br />
|-<br />
| 703 || [2.0.0+] [[#RequestEnsureDownloadTask]]<br />
|-<br />
| 704 || [2.0.0+] [[#ListDownloadTaskStatus]]<br />
|-<br />
| 705 || [2.0.0+] RequestDownloadTaskListData<br />
|-<br />
| 800 || [2.0.0+] RequestVersionList<br />
|-<br />
| 801 || [2.0.0+] ListVersionList<br />
|-<br />
| 900 || [2.0.0+] GetApplicationRecord<br />
|-<br />
| 901 || [2.0.0+] GetApplicationRecordProperty<br />
|-<br />
| 902 || [2.0.0+] EnableApplicationAutoUpdate<br />
|-<br />
| 903 || [2.0.0+] DisableApplicationAutoUpdate<br />
|-<br />
| 904 || [2.0.0+] TouchApplication<br />
|-<br />
| 905 || [2.0.0+] RequestApplicationUpdate<br />
|-<br />
| 906 || [2.0.0+] IsApplicationUpdateRequested<br />
|-<br />
| 907 || [2.0.0+] WithdrawApplicationUpdateRequest<br />
|-<br />
| 908 || [2.0.0+] ListApplicationRecordInstalledContentMeta<br />
|-<br />
| 1000 || [2.0.0+] RequestVerifyApplicationDeprecated<br />
|-<br />
| 1001 || [2.0.0+] CorruptApplicationForDebug<br />
|-<br />
| 1200 || [2.0.0+] [[#NeedsUpdateVulnerability]]<br />
|-<br />
| 1300 || [2.0.0+] IsAnyApplicationEntityInstalled<br />
|-<br />
| 1301 || [2.0.0+] DeleteApplicationContentEntities<br />
|-<br />
| 1302 || [2.0.0+] CleanupUnrecordedApplicationEntity<br />
|-<br />
| 1400 || [2.0.0+] PrepareShutdown<br />
|-<br />
| 1500 || [2.0.0+] FormatSdCard<br />
|-<br />
| 1501 || [2.0.0+] NeedsSystemUpdateToFormatSdCard<br />
|-<br />
| 1502 || [2.0.0+] GetLastSdCardFormatUnexpectedResult<br />
|-<br />
| 1503 || [2.0.0+]<br />
|-<br />
| 1600 || [2.0.0+] GetSystemSeedForPseudoDeviceId<br />
|-<br />
| 1700 || [2.0.0+] ListApplicationDownloadingContentMeta<br />
|-<br />
| 1800 || [2.0.0+] IsNotificationSetupCompleted<br />
|-<br />
| 1801 || [2.0.0+] GetLastNotificationInfoCount<br />
|-<br />
| 1802 || [2.0.0+] ListLastNotificationInfo<br />
|}<br />
<br />
== ListApplicationRecord ==<br />
Takes a type-0x6 output buffer containing an array of the below record and an s32 entry_offset, returns an output s32 out_entrycount.<br />
<br />
Returns an array of entries with the below format using the specified offset and count.<br />
<br />
=== Application Record Format ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x8<br />
| [[NCM_services#ApplicationId|ApplicationId]]<br />
|-<br />
| 0x8<br />
| 0x1<br />
| Type? (Known values: 0x2=Installing?, 0x3=Installed / Gamecard inserted, 0x5=Gamecard not inserted, 0xB=Archived)<br />
|-<br />
| 0x9<br />
| 0x1<br />
| Unknown, usually 0x02<br />
|-<br />
| 0xA<br />
| 0x6<br />
| Unknown, usually zeros?<br />
|-<br />
| 0x10<br />
| 0x1<br />
| Unknown, seems to change between reboots and removing/reinserting gamecards<br />
|-<br />
| 0x11<br />
| 0x7<br />
| Unknown, usually zeros?<br />
|}<br />
<br />
== LaunchApplication ==<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u64 PID.<br />
<br />
Launches an application title which is registered with NS.<br />
<br />
== GetApplicationContentPath ==<br />
Takes a 0x16-type output buffer, an u8 [[NCM_services#ContentMetaType|ContentMetaType]], and an [[NCM_services#ApplicationId|ApplicationId]].<br />
<br />
The input [[NCM_services#ApplicationId|ApplicationId]] is used with the application-title table like various other cmds, anything not in that table can't be used with this.<br />
<br />
Returns a string path for the specified type of patch content with this [[NCM_services#ApplicationId|ApplicationId]], otherwise returns regular-application paths when update-title not installed. Returns an error when the specified type of content doesn't exist for this title. Starts with "@{SdCardContent,UserContent}://" and ends in ".nca".<br />
<br />
For gamecard content, the output path is: "@GcSXXXXXXXX:/<NcaId>.nca". NCA-type0 with gamecard returns 0 with an empty output string.<br />
<br />
The output string is then used by the user-process with [[Filesystem_services|FS]] to mount the content.<br />
<br />
== GetTotalSpaceSize ==<br />
Takes an input u8 [[NCM_services#StorageId|StorageId]], no output.<br />
<br />
The StorageId must be SdCard.<br />
<br />
Returns the s64 from [[NCM_services#IContentStorage]] GetFreeSpaceSize.<br />
<br />
== GetFreeSpaceSize ==<br />
Takes an input u8 [[NCM_services#StorageId|StorageId]], no output.<br />
<br />
The StorageId must be SdCard.<br />
<br />
Returns the s64 from [[NCM_services#IContentStorage]] GetTotalSpaceSize.<br />
<br />
== GetApplicationDesiredLanguage ==<br />
Takes an input u8 language-bitmask, returns an output u8 [[control.nacp]] langentry index.<br />
<br />
User-processes generate the language-bitmask with the following for all 16 lang-entries: <code>if(<either string in langentry[i] is non-empty>)bitmask |= 1<<i</code><br />
<br />
== ConvertLanguageCodeToApplicationLanguage ==<br />
Takes an input u8 pointer for the resulting Id to be written to and a string represented as a u64 (i.e 0x53552D6E65 for 'en-US').<br />
<br />
Returns 0 if an ID was successfully found, otherwise returns 0x25810.<br />
<br />
== GetApplicationControlData ==<br />
Takes an input u8 [[#ApplicationControlSource]], an [[NCM_services#ApplicationId|ApplicationId]], and a type-0x6 output buffer. Returns an output u32 for actual_size. Official user-processes use buffer size 0x24000. [[qlaunch]] only uses source value 0x1 (Storage if not in cache).<br />
<br />
Loads cached [[control.nacp]] to buf+0 and the cached icon to buf+0x4000. Returns an error if the buffer is too small.<br />
<br />
=== ApplicationControlSource ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0x0<br />
| CacheOnly (Returns data from cache)<br />
|-<br />
| 0x1<br />
| Storage (Returns data from storage if not present in cache)<br />
|-<br />
| 0x2<br />
| StorageOnly (Returns data from storage without using cache)<br />
|}<br />
<br />
== ListApplicationContentMetaStatus ==<br />
Takes a type-0x6 output buffer containing an array of the below entries, an input s32 index and [[NCM_services#ApplicationId|ApplicationId]], returns an output s32 out_entrycount.<br />
<br />
Returns 0x10-byte entries using the specified [[NCM_services#ApplicationId|ApplicationId]] starting at the specified index. Can only return game titles. The second entry if any is the update-title usually. When the input entryindex is >= totalentries, this will return 0 with out_entrycount=0.<br />
<br />
Entry structure:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x1<br />
| [[NCM_services#ContentMetaType|ContentMetaType]] ("type")<br />
|-<br />
| 0x1<br />
| 0x1<br />
| [[NCM_services#StorageId|StorageId]] ("installedStorage")<br />
|-<br />
| 0x2<br />
| 0x1<br />
| Unknown. Non-zero with output from cmd 605, differs for app/update titles.<br />
|-<br />
| 0x3<br />
| 0x1<br />
| Padding<br />
|-<br />
| 0x4<br />
| 0x4<br />
| Version<br />
|-<br />
| 0x8<br />
| 0x8<br />
| [[NCM_services#ApplicationId|ApplicationId]]<br />
|}<br />
<br />
= ns:am2, ns:ec, ns:rid, ns:rt, ns:web =<br />
These services are all, at the top level, "nn::ns::detail::IServiceGetterInterface". These commands check a state field for a command-specific bit and returns an error if not set, this is likely a permissions check for service+command.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 7988 || [6.0.0+] [[#IDynamicRightsInterface|GetDynamicRightsInterface]]<br />
|-<br />
| 7989 || [5.1.0+] [[#IReadOnlyApplicationControlDataInterface|GetReadOnlyApplicationControlDataInterface]]<br />
|-<br />
| 7991 || [5.0.0+] [[#IReadOnlyApplicationRecordInterface|GetReadOnlyApplicationRecordInterface]]<br />
|-<br />
| 7992 || [4.0.0+] [[#IECommerceInterface|GetECommerceInterface]]<br />
|-<br />
| 7993 || [4.0.0+] [[#IApplicationVersionInterface|GetApplicationVersionInterface]]<br />
|-<br />
| 7994 || [[#IFactoryResetInterface|GetFactoryResetInterface]]<br />
|-<br />
| 7995 || [[#IAccountProxyInterface|GetAccountProxyInterface]]<br />
|-<br />
| 7996 || [[#IApplicationManagerInterface|GetApplicationManagerInterface]]<br />
|-<br />
| 7997 || [[#IDownloadTaskInterface|GetDownloadTaskInterface]]<br />
|-<br />
| 7998 || [[#IContentManagementInterface|GetContentManagementInterface]]<br />
|-<br />
| 7999 || [[#IDocumentInterface|GetDocumentInterface]]<br />
|}<br />
<br />
=== IAccountProxyInterface ===<br />
This is "nn::ns::detail::IAccountProxyInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || CreateUserAccount<br />
|}<br />
<br />
=== IApplicationManagerInterface ===<br />
This is "nn::ns::detail::IApplicationManagerInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#ListApplicationRecord]]<br />
|-<br />
| 1 || GenerateApplicationRecordCount<br />
|-<br />
| 2 || [[#GetApplicationRecordUpdateSystemEvent]]<br />
|-<br />
| 3 || [[#GetApplicationViewDeprecated]]<br />
|-<br />
| 4 || [[#DeleteApplicationEntity]]<br />
|-<br />
| 5 || [[#DeleteApplicationCompletely]]<br />
|-<br />
| 6 || IsAnyApplicationEntityRedundant<br />
|-<br />
| 7 || [[#DeleteRedundantApplicationEntity]]<br />
|-<br />
| 8 || [[#IsApplicationEntityMovable]]<br />
|-<br />
| 9 || [1.0.0-9.2.0] [[#MoveApplicationEntity]]<br />
|-<br />
| 11 || [[#CalculateApplicationOccupiedSize]]<br />
|-<br />
| 16 || PushApplicationRecord<br />
|-<br />
| 17 || ListApplicationRecordContentMeta<br />
|-<br />
| 19 || [1.0.0-5.1.0] LaunchApplicationOld<br />
|-<br />
| 21 || [[#GetApplicationContentPath]]<br />
|-<br />
| 22 || TerminateApplication<br />
|-<br />
| 23 || ResolveApplicationContentPath<br />
|-<br />
| 26 || BeginInstallApplication<br />
|-<br />
| 27 || DeleteApplicationRecord<br />
|-<br />
| 30 || [[#RequestApplicationUpdateInfo]]<br />
|-<br />
| 31 || [1.0.0-3.0.2] <br />
|-<br />
| 32 || [[#CancelApplicationDownload]]<br />
|-<br />
| 33 || [[#ResumeApplicationDownload]]<br />
|-<br />
| 35 || UpdateVersionList<br />
|-<br />
| 36 || PushLaunchVersion<br />
|-<br />
| 37 || ListRequiredVersion<br />
|-<br />
| 38 || [[#CheckApplicationLaunchVersion]]<br />
|-<br />
| 39 || [1.0.0-6.2.0] CheckApplicationLaunchRights<br />
|-<br />
| 40 || GetApplicationLogoData<br />
|-<br />
| 41 || CalculateApplicationDownloadRequiredSize<br />
|-<br />
| 42 || [[#CleanupSdCard]]<br />
|-<br />
| 43 || [[#CheckSdCardMountStatus]]<br />
|-<br />
| 44 || [[#GetSdCardMountStatusChangedEvent]]<br />
|-<br />
| 45 || GetGameCardAttachmentEvent<br />
|-<br />
| 46 || GetGameCardAttachmentInfo<br />
|-<br />
| 47 || [[#GetTotalSpaceSize]]<br />
|-<br />
| 48 || [[#GetFreeSpaceSize]]<br />
|-<br />
| 49 || GetSdCardRemovedEvent<br />
|-<br />
| 52 || [[#GetGameCardUpdateDetectionEvent]]<br />
|-<br />
| 53 || [[#DisableApplicationAutoDelete]]<br />
|-<br />
| 54 || [[#EnableApplicationAutoDelete]]<br />
|-<br />
| 55 || GetApplicationDesiredLanguage<br />
|-<br />
| 56 || [[#SetApplicationTerminateResult]]<br />
|-<br />
| 57 || [[#ClearApplicationTerminateResult]]<br />
|-<br />
| 58 || [[#GetLastSdCardMountUnexpectedResult]]<br />
|-<br />
| 59 || ConvertApplicationLanguageToLanguageCode<br />
|-<br />
| 60 || [[#ConvertLanguageCodeToApplicationLanguage]]<br />
|-<br />
| 61 || GetBackgroundDownloadStressTaskInfo<br />
|-<br />
| 62 || GetGameCardStopper<br />
|-<br />
| 63 || IsSystemProgramInstalled<br />
|-<br />
| 64 || StartApplyDeltaTask<br />
|-<br />
| 65 || [[#GetRequestServerStopper]]<br />
|-<br />
| 66 || [3.0.0+] GetBackgroundApplyDeltaStressTaskInfo<br />
|-<br />
| 67 || [3.0.0+] [[#CancelApplicationApplyDelta]]<br />
|-<br />
| 68 || [3.0.0+] [[#ResumeApplicationApplyDelta]]<br />
|-<br />
| 69 || [3.0.0+] [[#CalculateApplicationApplyDeltaRequiredSize]]<br />
|-<br />
| 70 || [3.0.0+] [[#ResumeAll]]<br />
|-<br />
| 71 || [3.0.0+] [[#GetStorageSize]]<br />
|-<br />
| 80 || [3.0.0+] RequestDownloadApplication<br />
|-<br />
| 81 || [3.0.0+] RequestDownloadAddOnContent<br />
|-<br />
| 82 || [3.0.0+] DownloadApplication<br />
|-<br />
| 83 || [4.0.0-6.2.0] CheckApplicationResumeRights<br />
|-<br />
| 84 || [4.0.0+] GetDynamicCommitEvent<br />
|-<br />
| 85 || [4.0.0+] [[#RequestUpdateApplication2]]<br />
|-<br />
| 86 || [4.0.0+] EnableApplicationCrashReport<br />
|-<br />
| 87 || [4.0.0+] IsApplicationCrashReportEnabled<br />
|-<br />
| 90 || [4.0.0-8.1.0] BoostSystemMemoryResourceLimit<br />
|-<br />
| 91 || [5.0.0+] DeprecatedLaunchApplication<br />
|-<br />
| 92 || [5.0.0+] GetRunningApplicationProgramId<br />
|-<br />
| 93 || [5.0.0+] GetMainApplicationProgramIndex<br />
|-<br />
| 94 || [6.0.0+] [[#LaunchApplication_2|LaunchApplication]]<br />
|-<br />
| 95 || [6.0.0+] [[#GetApplicationLaunchInfo]]<br />
|-<br />
| 96 || [6.0.0+] [[#AcquireApplicationLaunchInfo]]<br />
|-<br />
| 97 || [6.0.0+] GetMainApplicationProgramIndexByApplicationLaunchInfo<br />
|-<br />
| 98 || [6.0.0+] EnableApplicationAllThreadDumpOnCrash<br />
|-<br />
| 99 || [8.0.0+] [[#LaunchDevMenu]]<br />
|-<br />
| 100 || [[#ResetToFactorySettings]]<br />
|-<br />
| 101 || [[#ResetToFactorySettingsWithoutUserSaveData]]<br />
|-<br />
| 102 || [[#ResetToFactorySettingsForRefurbishment]]<br />
|-<br />
| 103 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegion]]<br />
|-<br />
| 104 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegionAuthentication]]<br />
|-<br />
| 105 || [10.0.0+] [[#RequestResetToFactorySettingsSecurely]]<br />
|-<br />
| 106 || [10.0.0+] [[#RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely]]<br />
|-<br />
| 200 || CalculateUserSaveDataStatistics<br />
|-<br />
| 201 || [[#DeleteUserSaveDataAll]]<br />
|-<br />
| 210 || [[#DeleteUserSystemSaveData]]<br />
|-<br />
| 211 || [6.0.0+] [[#DeleteSaveData]]<br />
|-<br />
| 220 || [[#UnregisterNetworkServiceAccount]]<br />
|-<br />
| 221 || [6.0.0+] [[#UnregisterNetworkServiceAccountWithUserSaveDataDeletion]]<br />
|-<br />
| 300 || GetApplicationShellEvent<br />
|-<br />
| 301 || PopApplicationShellEventInfo<br />
|-<br />
| 302 || [[#LaunchLibraryApplet]]<br />
|-<br />
| 303 || TerminateLibraryApplet<br />
|-<br />
| 304 || [[#LaunchSystemApplet]]<br />
|-<br />
| 305 || TerminateSystemApplet<br />
|-<br />
| 306 || [[#LaunchOverlayApplet]]<br />
|-<br />
| 307 || TerminateOverlayApplet<br />
|-<br />
| 400 || [[#GetApplicationControlData]]<br />
|-<br />
| 401 || InvalidateAllApplicationControlCache<br />
|-<br />
| 402 || [[#RequestDownloadApplicationControlData]]<br />
|-<br />
| 403 || GetMaxApplicationControlCacheCount<br />
|-<br />
| 404 || InvalidateApplicationControlCache<br />
|-<br />
| 405 || ListApplicationControlCacheEntryInfo<br />
|-<br />
| 406 || [6.0.0+] GetApplicationControlProperty<br />
|-<br />
| 407 || [8.0.0+] [[#ListApplicationTitle]]<br />
|-<br />
| 408 || [8.0.0+] [[#ListApplicationIcon]]<br />
|-<br />
| 502 || [[#RequestCheckGameCardRegistration]]<br />
|-<br />
| 503 || [[#RequestGameCardRegistrationGoldPoint]]<br />
|-<br />
| 504 || [[#RequestRegisterGameCard]]<br />
|-<br />
| 505 || [3.0.0+] [[#GetGameCardMountFailureEvent]]<br />
|-<br />
| 506 || [3.0.0+] [[#IsGameCardInserted]]<br />
|-<br />
| 507 || [3.0.0+] [[#EnsureGameCardAccess]]<br />
|-<br />
| 508 || [3.0.0+] [[#GetLastGameCardMountFailureResult]]<br />
|-<br />
| 509 || [5.0.0+] [[#ListApplicationIdOnGameCard]]<br />
|-<br />
| 510 || [9.0.0+] [[#GetGameCardPlatformRegion]]<br />
|-<br />
| 600 || [[#CountApplicationContentMeta]]<br />
|-<br />
| 601 || [[#ListApplicationContentMetaStatus]]<br />
|-<br />
| 602 || [2.0.0-5.1.0] ListAvailableAddOnContent<br />
|-<br />
| 603 || GetOwnedApplicationContentMetaStatus<br />
|-<br />
| 604 || RegisterContentsExternalKey<br />
|-<br />
| 605 || ListApplicationContentMetaStatusWithRightsCheck<br />
|-<br />
| 606 || [3.0.0+] GetContentMetaStorage<br />
|-<br />
| 607 || [6.0.0+] [[#ListAvailableAddOnContent]]<br />
|-<br />
| 700 || PushDownloadTaskList<br />
|-<br />
| 701 || [[#ClearTaskStatusList]]<br />
|-<br />
| 702 || [[#RequestDownloadTaskList]]<br />
|-<br />
| 703 || [[#RequestEnsureDownloadTask]]<br />
|-<br />
| 704 || [[#ListDownloadTaskStatus]]<br />
|-<br />
| 705 || [[#RequestDownloadTaskListData]]<br />
|-<br />
| 800 || RequestVersionList<br />
|-<br />
| 801 || ListVersionList<br />
|-<br />
| 802 || [3.0.0+] [[#RequestVersionListData]]<br />
|-<br />
| 900 || GetApplicationRecord<br />
|-<br />
| 901 || GetApplicationRecordProperty<br />
|-<br />
| 902 || EnableApplicationAutoUpdate<br />
|-<br />
| 903 || DisableApplicationAutoUpdate<br />
|-<br />
| 904 || [[#TouchApplication]]<br />
|-<br />
| 905 || RequestApplicationUpdate<br />
|-<br />
| 906 || [[#IsApplicationUpdateRequested]]<br />
|-<br />
| 907 || [[#WithdrawApplicationUpdateRequest]]<br />
|-<br />
| 908 || ListApplicationRecordInstalledContentMeta<br />
|-<br />
| 909 || [3.0.0+] WithdrawCleanupAddOnContentsWithNoRightsRecommendation<br />
|-<br />
| 910 || [5.0.0+] HasApplicationRecord<br />
|-<br />
| 911 || [5.1.0+] SetPreInstalledApplication<br />
|-<br />
| 912 || [5.1.0+] ClearPreInstalledApplicationFlag<br />
|-<br />
| 913 || [9.0.0+] ListAllApplicationRecord<br />
|-<br />
| 914 || [9.0.0+] HideApplicationRecord<br />
|-<br />
| 915 || [9.0.0+] ShowApplicationRecord<br />
|-<br />
| 1000 || [[#RequestVerifyApplicationDeprecated]]<br />
|-<br />
| 1001 || CorruptApplicationForDebug<br />
|-<br />
| 1002 || [3.0.0-9.2.0] [[#RequestVerifyAddOnContentsRights]]<br />
|-<br />
| 1003 || [5.0.0+] [[#RequestVerifyApplication]]<br />
|-<br />
| 1004 || [5.0.0+] CorruptContentForDebug<br />
|-<br />
| 1200 || [[#NeedsUpdateVulnerability]]<br />
|-<br />
| 1300 || [[#IsAnyApplicationEntityInstalled]]<br />
|-<br />
| 1301 || DeleteApplicationContentEntities<br />
|-<br />
| 1302 || CleanupUnrecordedApplicationEntity<br />
|-<br />
| 1303 || [3.0.0-9.2.0] CleanupAddOnContentsWithNoRights<br />
|-<br />
| 1304 || [3.0.0+] DeleteApplicationContentEntity<br />
|-<br />
| 1308 || [5.0.0+] DeleteApplicationCompletelyForDebug<br />
|-<br />
| 1309 || [6.0.0+] [[#CleanupUnavailableAddOnContents]]<br />
|-<br />
| 1310 || [10.0.0+] RequestMoveApplicationEntity<br />
|-<br />
| 1311 || [10.0.0+] EstimateSizeToMove<br />
|-<br />
| 1312 || [10.0.0+] HasMovableEntity<br />
|-<br />
| 1400 || PrepareShutdown<br />
|-<br />
| 1500 || [[#FormatSdCard]]<br />
|-<br />
| 1501 || [[#NeedsSystemUpdateToFormatSdCard]]<br />
|-<br />
| 1502 || [[#GetLastSdCardFormatUnexpectedResult]]<br />
|-<br />
| 1504 || [3.0.0+] InsertSdCard<br />
|-<br />
| 1505 || [3.0.0+] RemoveSdCard<br />
|-<br />
| 1506 || [9.0.0+] GetSdCardStartupStatus<br />
|-<br />
| 1600 || GetSystemSeedForPseudoDeviceId<br />
|-<br />
| 1601 || [3.0.0+] ResetSystemSeedForPseudoDeviceId<br />
|-<br />
| 1700 || ListApplicationDownloadingContentMeta<br />
|-<br />
| 1701 || [3.0.0+] [[#GetApplicationView]]<br />
|-<br />
| 1702 || [3.0.0+] GetApplicationDownloadTaskStatus<br />
|-<br />
| 1703 || [4.0.0+] [[#GetApplicationViewDownloadErrorContext]]<br />
|-<br />
| 1704 || [8.0.0+] [[#GetApplicationViewWithPromotionInfo]]<br />
|-<br />
| 1800 || IsNotificationSetupCompleted<br />
|-<br />
| 1801 || GetLastNotificationInfoCount<br />
|-<br />
| 1802 || ListLastNotificationInfo<br />
|-<br />
| 1803 || [3.0.0+] ListNotificationTask<br />
|-<br />
| 1900 || [3.0.0+] IsActiveAccount<br />
|-<br />
| 1901 || [4.0.0+] [[#RequestDownloadApplicationPrepurchasedRights]]<br />
|-<br />
| 1902 || [5.0.0+] GetApplicationTicketInfo<br />
|-<br />
| 2000 || [4.0.0+] [[#GetSystemDeliveryInfo]]<br />
|-<br />
| 2001 || [4.0.0+] [[#SelectLatestSystemDeliveryInfo]]<br />
|-<br />
| 2002 || [4.0.0+] [[#VerifyDeliveryProtocolVersion]]<br />
|-<br />
| 2003 || [4.0.0+] [[#GetApplicationDeliveryInfo]]<br />
|-<br />
| 2004 || [4.0.0+] [[#HasAllContentsToDeliver]]<br />
|-<br />
| 2005 || [4.0.0+] [[#CompareApplicationDeliveryInfo]]<br />
|-<br />
| 2006 || [4.0.0+] [[#CanDeliverApplication]]<br />
|-<br />
| 2007 || [4.0.0+] [[#ListContentMetaKeyToDeliverApplication]]<br />
|-<br />
| 2008 || [4.0.0+] [[#NeedsSystemUpdateToDeliverApplication]]<br />
|-<br />
| 2009 || [4.0.0+] [[#EstimateRequiredSize]]<br />
|-<br />
| 2010 || [4.0.0+] [[#RequestReceiveApplication]]<br />
|-<br />
| 2011 || [4.0.0+] [[#CommitReceiveApplication]]<br />
|-<br />
| 2012 || [4.0.0+] [[#GetReceiveApplicationProgress]]<br />
|-<br />
| 2013 || [4.0.0+] [[#RequestSendApplication]]<br />
|-<br />
| 2014 || [4.0.0+] [[#GetSendApplicationProgress]]<br />
|-<br />
| 2015 || [4.0.0+] [[#CompareSystemDeliveryInfo]]<br />
|-<br />
| 2016 || [4.0.0+] [[#ListNotCommittedContentMeta]]<br />
|-<br />
| 2017 || [4.0.0+] [[#RecoverDownloadTask]]<br />
|-<br />
| 2018 || [5.0.0+] [[#GetApplicationDeliveryInfoHash]]<br />
|-<br />
| 2050 || [6.0.0+] [[#GetApplicationRightsOnClient]]<br />
|-<br />
| 2051 || [9.0.0+] InvalidateRightsIdCache<br />
|-<br />
| 2100 || [6.0.0+] [[#GetApplicationTerminateResult]]<br />
|-<br />
| 2101 || [6.0.0+] GetRawApplicationTerminateResult<br />
|-<br />
| 2150 || [6.0.0+] CreateRightsEnvironment<br />
|-<br />
| 2151 || [6.0.0+] DestroyRightsEnvironment<br />
|-<br />
| 2152 || [6.0.0+] ActivateRightsEnvironment<br />
|-<br />
| 2153 || [6.0.0+] DeactivateRightsEnvironment<br />
|-<br />
| 2154 || [6.0.0+] ForceActivateRightsContextForExit<br />
|-<br />
| 2155 || [7.0.0+] UpdateRightsEnvironmentStatus<br />
|-<br />
| 2156 || [10.0.0+] CreateRightsEnvironmentForMicroApplication ([9.0.0-9.2.0] CreateRightsEnvironmentForPreomia)<br />
|-<br />
| 2160 || [6.0.0+] AddTargetApplicationToRightsEnvironment<br />
|-<br />
| 2161 || [6.0.0+] SetUsersToRightsEnvironment<br />
|-<br />
| 2170 || [6.0.0+] GetRightsEnvironmentStatus<br />
|-<br />
| 2171 || [6.0.0+] GetRightsEnvironmentStatusChangedEvent<br />
|-<br />
| 2180 || [6.0.0+] RequestExtendExpirationInRightsEnvironment<br />
|-<br />
| 2181 || [6.0.0+] GetResultOfExtendExpirationInRightsEnvironment<br />
|-<br />
| 2182 || [6.0.0+] SetActiveRightsContextUsingStateToRightsEnvironment<br />
|-<br />
| 2190 || [6.0.0+] [[#GetRightsEnvironmentHandleForApplication]]<br />
|-<br />
| 2199 || [6.0.0+] GetRightsEnvironmentCountForDebug<br />
|-<br />
| 2200 || [6.0.0-9.2.0] GetGameCardApplicationCopyIdentifier<br />
|-<br />
| 2201 || [6.0.0-9.2.0] GetInstalledApplicationCopyIdentifier<br />
|-<br />
| 2250 || [6.0.0-6.2.0] RequestReportActiveELicence<br />
|-<br />
| 2300 || [6.0.0-8.1.0] ListEventLog<br />
|-<br />
| 2350 || [7.0.0+] PerformAutoUpdateByApplicationId<br />
|-<br />
| 2351 || [9.0.0+] [[#RequestNoDownloadRightsErrorResolution]]<br />
|-<br />
| 2352 || [9.0.0+] [[#RequestResolveNoDownloadRightsError]]<br />
|-<br />
| 2353 || [10.0.0+] GetApplicationDownloadTaskInfo<br />
|-<br />
| 2400 || [8.0.0+] [[#GetPromotionInfo]]<br />
|-<br />
| 2401 || [8.0.0+] CountPromotionInfo<br />
|-<br />
| 2402 || [8.0.0+] ListPromotionInfo<br />
|-<br />
| 2403 || [8.0.0+] [[#ImportPromotionJsonForDebug]]<br />
|-<br />
| 2404 || [8.0.0+] [[#ClearPromotionInfoForDebug]]<br />
|-<br />
| 2500 || [8.0.0+] ConfirmAvailableTime<br />
|-<br />
| 2510 || [9.0.0+] [[#CreateApplicationResource]]<br />
|-<br />
| 2511 || [9.0.0+] [[#GetApplicationResource]]<br />
|-<br />
| 2513 || [10.0.0+] LaunchMicroApplication ([9.0.0-9.2.0] LaunchPreomia)<br />
|-<br />
| 2514 || [9.0.0+] ClearTaskOfAsyncTaskManager<br />
|-<br />
| 2515 || [10.0.0+] CleanupAllPlaceHolderAndFragmentsIfNoTask<br />
|-<br />
| 2516 || [10.0.0+] EnsureApplicationCertificate<br />
|-<br />
| 2800 || [9.0.0+] GetApplicationIdOfPreomia<br />
|-<br />
| 9999 || [10.0.0+] GetApplicationCertificate<br />
|}<br />
<br />
[4.0.0+] RequestDownloadAddOnContent now takes an additional 8-bytes of input.<br />
<br />
==== GetApplicationRecordUpdateSystemEvent ====<br />
No input, returns an output Event handle with EventClearMode=1.<br />
<br />
==== GetApplicationViewDeprecated ====<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationViewDeprecated]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], no output.<br />
<br />
On newer system-versions this is the same as [[#GetApplicationView]], except this converts the output from the func called in the loop from [[#ApplicationView]] to [[#ApplicationViewDeprecated]].<br />
<br />
==== DeleteApplicationEntity ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== DeleteApplicationCompletely ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== DeleteRedundantApplicationEntity ====<br />
No input/output.<br />
<br />
==== IsApplicationEntityMovable ====<br />
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool.<br />
<br />
==== MoveApplicationEntity ====<br />
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== RequestApplicationUpdateInfo ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
The data that can be read from the [[#IAsyncValue]] is [[#ApplicationUpdateInfo]].<br />
<br />
Before using the cmd, official sw uses [[Network_Interface_services#IsAnyInternetRequestAccepted|IsAnyInternetRequestAccepted]] with the output from [[#Network_Interface_services#GetClientId|GetClientId]], throwing an error when the returned bool is false.<br />
<br />
==== CancelApplicationDownload ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== ResumeApplicationDownload ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== CheckApplicationLaunchVersion ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== CalculateApplicationDownloadRequiredSize ====<br />
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output s64.<br />
<br />
==== CleanupSdCard ====<br />
No input/output.<br />
<br />
==== GetSdCardMountStatusChangedEvent ====<br />
No input, returns an output Event handle with EventClearMode=0.<br />
<br />
==== GetGameCardUpdateDetectionEvent ====<br />
No input, returns an output Event handle with EventClearMode=0.<br />
<br />
==== DisableApplicationAutoDelete ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== EnableApplicationAutoDelete ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== SetApplicationTerminateResult ====<br />
Takes an input u32 Result, an [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== ClearApplicationTerminateResult ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== GetLastSdCardMountUnexpectedResult ====<br />
No input/output.<br />
<br />
==== GetRequestServerStopper ====<br />
No input, returns an output [[#IRequestServerStopper]].<br />
<br />
==== CancelApplicationApplyDelta ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== ResumeApplicationApplyDelta ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== CalculateApplicationApplyDeltaRequiredSize ====<br />
Takes an input u8 [[NCM_services#StorageId|StorageId]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output s64.<br />
<br />
==== ResumeAll ====<br />
No input/output.<br />
<br />
==== GetStorageSize ====<br />
Takes an input u8 [[NCM_services#StorageId|StorageId]], returns two output s64s.<br />
<br />
This temporarily mounts the [[Filesystem_services#OpenContentStorageFileSystem|ContentStorage]] specified by the StorageId (must be BuiltInUser or SdCard). The two output s64s are the output from [[Filesystem_services#GetTotalSpaceSize|GetTotalSpaceSize]] and [[Filesystem_services#GetFreeSpaceSize|GetFreeSpaceSize]] with this ContentStorage, with it this being unmounted afterwards.<br />
<br />
==== RequestUpdateApplication2 ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== LaunchApplication ====<br />
Takes an input u8 ProgramIndex, an input [[#ApplicationLaunchInfo]], returns an output u64.<br />
<br />
==== GetApplicationLaunchInfo ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationLaunchInfo]].<br />
<br />
==== AcquireApplicationLaunchInfo ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationLaunchInfo]].<br />
<br />
This verifies that a state flag is set and that a state field matches the input ApplicationId, throwing an error otherwise. The [[#ApplicationLaunchInfo]] from state is copied to output, then the state flag is cleared.<br />
<br />
==== LaunchDevMenu ====<br />
No input/output.<br />
<br />
This is used by AM cmd [[Applet_Manager_services#LaunchDevMenu|LaunchDevMenu]].<br />
<br />
This loads ProgramIds from [[System_Settings|system-settings]] <code>ns.applet!devmenu_id</code> and <code>ns.applet!devoverlaydisp_id</code>, which only exists on devunits. An error is thrown if loading these fail.<br />
<br />
[[NCM_services#ncm|OpenContentMetaDatabase]] is used with StorageId = NandSystem, then IContentMetaDatabase GetLatestContentMetaKey is used with both of the above ProgramIds to verify that the cmd is successful.<br />
<br />
Then if the above succeeds, the above titles are launched with the above StorageId via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0), with a 0.5s sleep-thread afterwards on success. [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0xB is used here.<br />
<br />
==== DeleteUserSaveDataAll ====<br />
Takes an input [[Account_services#Uid|Uid]], returns an output [[#IProgressMonitorForDeleteUserSaveDataAll]].<br />
<br />
On success, [[#IProgressMonitorForDeleteUserSaveDataAll]] GetProgress is used with the output being copied into object state.<br />
<br />
==== DeleteUserSystemSaveData ====<br />
Takes an input [[Account_services#Uid|Uid]], an u64 SystemSaveDataId, no output.<br />
<br />
==== DeleteSaveData ====<br />
Takes an input u8 [[Filesystem_services#SaveDataSpaceId|SaveDataSpaceId]], an u64 SaveDataId, no output.<br />
<br />
==== UnregisterNetworkServiceAccount ====<br />
Takes an input [[Account_services#Uid|Uid]], no output.<br />
<br />
==== UnregisterNetworkServiceAccountWithUserSaveDataDeletion ====<br />
Takes an input [[Account_services#Uid|Uid]], no output.<br />
<br />
==== LaunchLibraryApplet ====<br />
Takes an input u64 [[NCM_services#ProgramId|ProgramId]], returns an output u64.<br />
<br />
The specified program is launched with StorageId=BuiltInSystem via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0). [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0x9 is used here. The output u64 from here is written to the output for this cmd, on success.<br />
<br />
This is used by [[Applet_Manager_services|AM]].<br />
<br />
==== LaunchSystemApplet ====<br />
No input, returns an output u64.<br />
<br />
A state flag must be zero, otherwise an error is thrown. When a state field is value 1, a hard-coded ProgramId for MaintenanceMenu is used. Otherwise, the ProgramId is loaded from [[System_Settings|system-setting]] <code>ns.applet!system_applet_id</code>.<br />
<br />
The SystemApplet is launched with StorageId=BuiltInSystem via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0). [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0x9 is used here. The output u64 from here is written to the output for this cmd, on success.<br />
<br />
This is used by [[Applet_Manager_services|AM]].<br />
<br />
==== LaunchOverlayApplet ====<br />
No input, returns an output u64.<br />
<br />
A state flag must be zero, otherwise an error is thrown. The ProgramId is loaded from [[System_Settings|system-setting]] <code>ns.applet!overlay_applet_id</code>.<br />
<br />
The OverlayApplet is launched with StorageId=BuiltInSystem via [[Process_Manager_services|pmshell]] LaunchProgram ([10.0.0+] [[PGL_services#LaunchProgram|pgl]] with pgl_launch_flags=0). [[Process_Manager_services#LaunchFlags|LaunchFlags]] value 0x9 is used here. The output u64 from here is written to the output for this cmd, on success.<br />
<br />
This is used by [[Applet_Manager_services|AM]].<br />
<br />
==== RequestDownloadApplicationControlData ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== ListApplicationTitle ====<br />
Takes an input TransferMemory handle, a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], an u8 [[#ApplicationControlSource]], an u64 size, returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
[[qlaunch]] uses value 0x1 for the u8.<br />
<br />
The user-process creates the TransferMemory with permissions=R--.<br />
<br />
The data available with [[#IAsyncValue]] Get is a s32 for the offset within the TransferMemory where the output data is located, GetSize returns the total byte-size of the data located here. The data located here is the [[NACP_Format|NACP]] title-entry for each specified ApplicationId.<br />
<br />
The TransferMemory size must be at least: count*sizeof([[NACP_Format|title-entry]]) + count*sizeof(u64) + count*[[#GetApplicationControlData|0x24000]].<br />
<br />
This is essentially an async wrapper for [[#GetApplicationControlData]], with support for multiple ApplicationIds.<br />
<br />
==== ListApplicationIcon ====<br />
Takes an input TransferMemory handle, a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], an u8 [[#ApplicationControlSource]], an u64 size, returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
The user-process creates the TransferMemory with permissions=R--.<br />
<br />
The data available with [[#IAsyncValue]] Get is a s32 for the offset within the TransferMemory where the output data is located, GetSize returns the total byte-size of the data located here. This data is: an u64 for total entries, an array of u64s for each icon size, then the icon JPEGs for the specified ApplicationIds.<br />
<br />
The TransferMemory size must be at least: 0x4 + count*sizeof(u64) + count*[[#GetApplicationControlData|0x20000]] + count*sizeof(u64) + [[#GetApplicationControlData|0x24000]].<br />
<br />
This is essentially an async wrapper for [[#GetApplicationControlData]], with support for multiple ApplicationIds.<br />
<br />
==== RequestCheckGameCardRegistration ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== RequestGameCardRegistrationGoldPoint ====<br />
Takes an input [[Account_services#Uid|Uid]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
The data that can be read from the [[#IAsyncValue]] is 4-bytes.<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== RequestRegisterGameCard ====<br />
Takes an input s32, an [[Account_services#Uid|Uid]], an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== GetGameCardMountFailureEvent ====<br />
No input, returns an output Event handle with EventClearMode=0.<br />
<br />
==== IsGameCardInserted ====<br />
No input, returns an output u8 bool.<br />
<br />
==== EnsureGameCardAccess ====<br />
No input/output.<br />
<br />
==== GetLastGameCardMountFailureResult ====<br />
No input/output.<br />
<br />
==== ListApplicationIdOnGameCard ====<br />
Takes a type-0x6 output buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], returns an output s32 for total output entries.<br />
<br />
==== GetGameCardPlatformRegion ====<br />
No input, returns an u8 '''GameCardPlatformRegion''' (0x00 = Global, 0x01 = China).<br />
<br />
This calls [[Filesystem_services#IDeviceOperator|fsp-srv IDeviceOperator]] GetGameCardCompatibilityType and returns the result.<br />
<br />
==== ListAvailableAddOnContent ====<br />
[10.0.0+] This now takes a total of 0x10-bytes of input instead of a total of 0x18-bytes of input.<br />
<br />
==== RequestDownloadTaskListData ====<br />
No input, returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
==== TouchApplication ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== IsApplicationUpdateRequested ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool and an u32.<br />
<br />
The output u32 is only valid when the output bool is set.<br />
<br />
==== WithdrawApplicationUpdateRequest ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== RequestVerifyApplicationDeprecated ====<br />
Takes an input TransferMemory handle, an [[NCM_services#ApplicationId|ApplicationId]], an u64 size, returns an output Event handle and an [[#IProgressAsyncResult]].<br />
<br />
On newer system-versions this calls the same func as [[#RequestVerifyApplication]], with the u32 value set to 0x7.<br />
<br />
==== RequestVerifyAddOnContentsRights ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IProgressAsyncResult]].<br />
<br />
==== RequestVerifyApplication ====<br />
Takes an input TransferMemory handle, an u32, an [[NCM_services#ApplicationId|ApplicationId]], an u64 size, returns an output Event handle and an [[#IProgressAsyncResult]].<br />
<br />
Official sw creates the TransferMemory with an user-specified buffer with permissions=0. [[qlaunch]] uses buffer size 0x100000.<br />
<br />
Official sw has an additional wrapper func which calls the original wrapper func, this uses value 0x7 for the u32. This is the same func used by [[qlaunch]].<br />
<br />
==== IsAnyApplicationEntityInstalled ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u8 bool.<br />
<br />
==== CleanupUnavailableAddOnContents ====<br />
Takes an input u64 [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]], no output.<br />
<br />
==== FormatSdCard ====<br />
No input/output.<br />
<br />
==== NeedsSystemUpdateToFormatSdCard ====<br />
No input, returns an output u8 bool.<br />
<br />
==== GetLastSdCardFormatUnexpectedResult ====<br />
No input/output.<br />
<br />
==== GetApplicationView ====<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationView]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], no output.<br />
<br />
==== GetApplicationViewDownloadErrorContext ====<br />
Takes a type-0x16 output buffer containg an [[Error_Applet#ErrorContext|ErrorContext]], an u64 [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== GetApplicationViewWithPromotionInfo ====<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationViewWithPromotionInfo]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], no output.<br />
<br />
==== RequestDownloadApplicationPrepurchasedRights ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== GetSystemDeliveryInfo ====<br />
Takes a type-0x16 output buffer containing a [[#SystemDeliveryInfo]], no output.<br />
<br />
This generates a [[#SystemDeliveryInfo]] using the currently installed SystemUpdate meta title.<br />
<br />
==== SelectLatestSystemDeliveryInfo ====<br />
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], and returns an output s32.<br />
<br />
This determines the latest version from the input [[#ApplicationDeliveryInfo]] array, using value 0 if the array is empty. If this value is less than a state field, the state field value is used instead. Then this selects a [[#SystemDeliveryInfo]] with the latest version from the input array, where the minimum version is the previously mentioned value. The version must also be also be at least the version value from the type-0x15 [[#SystemDeliveryInfo]] buffer. This also does various validation, etc. The output s32 is an index in that array for the selected entry, -1 if none found.<br />
<br />
==== VerifyDeliveryProtocolVersion ====<br />
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], no output.<br />
<br />
This validates the [[#SystemDeliveryInfo]] HMAC and the protocol-version fields. Then the meta version is compared with a state field, an error is returned on match otherwise 0 is returned.<br />
<br />
==== GetApplicationDeliveryInfo ====<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationDeliveryInfo]], an input u32 bitmask <code>nn::ns::ApplicationDeliveryAttributeTag</code>, an [[NCM_services#ApplicationId|ApplicationId]], and returns an output s32 total_out.<br />
<br />
An error is thrown if any bit is set in ApplicationDeliveryAttributeTag besides bit1. The output array-count must be at least 1: only 1 entry will be written to this array (hence on success total_out will also only be 1 on success).<br />
<br />
==== HasAllContentsToDeliver ====<br />
Takes a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output u8 bool.<br />
<br />
The array-count must match 1. After validating the [[#ApplicationDeliveryInfo]], the output bool is set to u32 [[#ApplicationDeliveryInfo]]+0x1C & 0x10000002 != 0x2, then this returns 0.<br />
<br />
==== CompareApplicationDeliveryInfo ====<br />
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output s32.<br />
<br />
The array-count for both buffers must be 1, otherwise an error is returned.<br />
<br />
Both [[#ApplicationDeliveryInfo]] are validated, then the application-version in the first/second buffer are compared. The output s32 is set to the comparison result: -1 for less than, 0 for equal, and 1 for higher than.<br />
<br />
==== CanDeliverApplication ====<br />
Takes two type-0x5 input buffers containing an array of [[#ApplicationDeliveryInfo]], returns an output u8 bool.<br />
<br />
The array-count for the second buffer must be 1 and the array-count for the first buffer must be <=1, otherwise an error is returned. If the array-count for the first buffer is 0, this will return 0 with the output bool set to 0.<br />
<br />
==== ListContentMetaKeyToDeliverApplication ====<br />
Takes a type-0x6 output buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], a s32, and returns an output s32 total_out.<br />
<br />
The array-count for ContentMetaKey must be at least 1, and for ApplicationDeliveryInfo it must match 1.<br />
<br />
This will only return 1 ContentMetaKey entry. This will not output the entry when the input s32 is larger than 0. This also does other validation, etc.<br />
<br />
==== NeedsSystemUpdateToDeliverApplication ====<br />
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], and returns an output u8 bool.<br />
<br />
The array-count must match 1.<br />
<br />
After validation etc, this sets the output bool by comparing system-version fields in the [[#SystemDeliveryInfo]]/[[#ApplicationDeliveryInfo]] and with a state field.<br />
<br />
==== EstimateRequiredSize ====<br />
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], returns an output s64.<br />
<br />
When the array-count is less than 1, this will return 0 with the s64 set to 0.<br />
<br />
==== RequestReceiveApplication ====<br />
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], a [[NCM_services#StorageId|StorageId]], an u16 port, an u32 Ipv4Address, an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
[[qlaunch]] uses value Any for the StorageId, and value 55556 for the port.<br />
<br />
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.<br />
<br />
This loops through the input [[NCM_services#ContentMetaKey|ContentMetaKey]] array, throwing an error if the [[NCM_services#ContentMetaType|ContentMetaType]] doesn't match Patch. The input array is copied into state which is used later by the thread for [[NIM_services|nim]] cmd53, max entries is 0x12.<br />
<br />
This does various setup then creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:<br />
<br />
* Calls a func which does:<br />
** Throws an error if a state flag is set.<br />
** Uses [[NIM_services|nim]] cmd53, returning the Result on failure.<br />
** Uses [[NIM_services|nim]] cmd56, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.<br />
** Handles cleanup and returns.<br />
* On success, this loads various data which is then used for saving a SystemPlayReport when the cached [[System_Settings|system-setting]] "systemreport!enabled" is set.<br />
** The EventId is "receive_app_contents" with ApplicationId <NS ProgramId>.<br />
<br />
==== CommitReceiveApplication ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], no output.<br />
<br />
==== GetReceiveApplicationProgress ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ReceiveApplicationProgress]].<br />
<br />
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.<br />
<br />
Uses [[NIM_services|nim]] cmd67, throwing an error if no task is returned. Then [[NIM_services|nim]] cmd57 is used, returning the error from there on failure. Lastly, this writes the 0x10-bytes from output+8 from the latter cmd to the output [[#ReceiveApplicationProgress]], and returns 0.<br />
<br />
==== RequestSendApplication ====<br />
Takes a type-0x5 input buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], an u16 port, an u32 Ipv4Address, an [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
[[qlaunch]] uses value 55556 for the port.<br />
<br />
An error is thrown if a state ref-count is zero. An error is thrown if [[NIM_services|nim]] ListApplicationApplyDeltaTask returns a task.<br />
<br />
The [[NCM_services#ContentMetaType|ContentMetaType]] must match Patch.<br />
<br />
This does various setup and selects a ContentMetaKey to use from the input, then creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:<br />
<br />
* Calls a func which does:<br />
** Throws an error if a state flag is set.<br />
** Uses [[NIM_services|nim]] cmd60, returning the Result on failure.<br />
** Uses [[NIM_services|nim]] cmd61, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.<br />
** Handles cleanup and returns.<br />
* On success, this loads various data which is then used for saving a SystemPlayReport when the cached [[System_Settings|system-setting]] "systemreport!enabled" is set.<br />
** The EventId is "send_app_contents" with ApplicationId <NS ProgramId>.<br />
<br />
==== GetSendApplicationProgress ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#SendApplicationProgress]].<br />
<br />
Same as [[#GetReceiveApplicationProgress]] except this is the Send version, and uses [[NIM_services|nim]] cmd68/cmd63 instead.<br />
<br />
==== CompareSystemDeliveryInfo ====<br />
Takes two type-0x15 input buffers containing a [[#SystemDeliveryInfo]], returns an output s32.<br />
<br />
This is essentially the same as [[#CompareApplicationDeliveryInfo]], except this compares the [[#SystemDeliveryInfo]] SystemUpdate version.<br />
<br />
==== ListNotCommittedContentMeta ====<br />
Takes a type-0x6 output buffer containing an array of [[NCM_services#ContentMetaKey|ContentMetaKey]], a s32, an [[NCM_services#ApplicationId|ApplicationId]], returns an output s32 total_out.<br />
<br />
==== RecoverDownloadTask ====<br />
Takes a type-0x5 input buffer containing an array of {unknown} and an input u64, no output.<br />
<br />
==== GetApplicationDeliveryInfoHash ====<br />
Takes a type-0x5 input buffer containing an array of [[#ApplicationDeliveryInfo]], returns an output 0x20-byte SHA256 hash.<br />
<br />
This extracts data from the input array for hashing with SHA256, with validation being done when handling each entry.<br />
<br />
==== GetApplicationRightsOnClient ====<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationRightsOnClient]], an input u32 flags, an [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]], returns 4-bytes of output for total output entries.<br />
<br />
Official sw has at least two wrappers which use this cmd: one with an all-zero Uid, one with an user-specified Uid. With both of these, the passed flags are hard-coded to value 0x3.<br />
<br />
For the output array count, [[qlaunch]] uses value 3.<br />
<br />
==== GetApplicationTerminateResult ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output u32 Result.<br />
<br />
==== GetRightsEnvironmentHandleForApplication ====<br />
No input, returns a total of 8-bytes of output.<br />
<br />
[9.0.0+] Now takes a total of 8-bytes of input, returns a total of 8-bytes of output.<br />
<br />
==== RequestNoDownloadRightsErrorResolution ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== RequestResolveNoDownloadRightsError ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
The data that can be read from the [[#IAsyncValue]] is [[#NoDownloadRightsErrorResolution]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== GetPromotionInfo ====<br />
Takes a type-0x6 output buffer containing an array of [[#PromotionInfo]], a type-0x5 input buffer containing an array of u64 [[NCM_services#ApplicationId|ApplicationIds]], a type-0x5 input buffer containing an array of [[Account_services#Uid|Uids]], no output.<br />
<br />
Official sw uses hard-coded value 1 for the count with each of these arrays.<br />
<br />
==== ImportPromotionJsonForDebug ====<br />
Takes a type-0x5 input buffer, no output.<br />
<br />
The output from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.<br />
<br />
==== ClearPromotionInfoForDebug ====<br />
No input/output.<br />
<br />
The output from [[Settings_services#GetDebugModeFlag]] must be 1, otherwise an error is returned.<br />
<br />
This just clears 0xC-bytes in state.<br />
<br />
==== CreateApplicationResource ====<br />
Returns an [[#IApplicationResource]].<br />
<br />
==== GetApplicationResource ====<br />
Returns an [[#IApplicationResource]].<br />
<br />
=== IGameCardStopper ===<br />
This is "nn::ns::detail::IGameCardStopper".<br />
<br />
This interface has no commands.<br />
<br />
=== IRequestServerStopper ===<br />
This is "nn::ns::detail::IRequestServerStopper".<br />
<br />
This interface has no commands.<br />
<br />
=== IProgressMonitorForDeleteUserSaveDataAll ===<br />
This is "nn::ns::detail::IProgressMonitorForDeleteUserSaveDataAll".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetSystemEvent<br />
|-<br />
| 1 || IsFinished<br />
|-<br />
| 2 || GetResult<br />
|-<br />
| 10 || GetProgress<br />
|}<br />
<br />
When closing the object, official sw uses IsFinished first, asserting when the output bool is false.<br />
<br />
* GetSystemEvent: No input, returns an output Event handle. [[qlaunch]] doesn't use this.<br />
<br />
* IsFinished: No input, returns an output u8 bool.<br />
<br />
* GetResult: No input/output.<br />
<br />
* GetProgress: No input, returns an output [[#ProgressForDeleteUserSaveDataAll]]. Official sw writes this struct directly to object state.<br />
<br />
=== IProgressAsyncResult ===<br />
This is "nn::ns::detail::IProgressAsyncResult".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Get<br />
|-<br />
| 1 || Cancel<br />
|-<br />
| 2 || GetProgress<br />
|-<br />
| 3 || GetDetailResult<br />
|-<br />
| 4 || [4.0.0+] GetErrorContext<br />
|}<br />
<br />
=== IApplicationVersionInterface ===<br />
This is "nn::ns::detail::IApplicationVersionInterface".<br />
<br />
This was added with [4.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetLaunchRequiredVersion<br />
|-<br />
| 1 || UpgradeLaunchRequiredVersion<br />
|-<br />
| 35 || UpdateVersionList<br />
|-<br />
| 36 || PushLaunchVersion<br />
|-<br />
| 37 || ListRequiredVersion<br />
|-<br />
| 800 || RequestVersionList<br />
|-<br />
| 801 || ListVersionList<br />
|-<br />
| 802 || [[#RequestVersionListData]]<br />
|-<br />
| 1000 || PerformAutoUpdate<br />
|}<br />
<br />
==== RequestVersionListData ====<br />
No input, returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
The data that can be read from the [[#IAsyncValue]] is [[#VersionListData]].<br />
<br />
=== IContentManagementInterface ===<br />
This is "nn::ns::detail::IContentManagementInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 11 || [[#CalculateApplicationOccupiedSize]]<br />
|-<br />
| 43 || [[#CheckSdCardMountStatus]]<br />
|-<br />
| 47 || [[#GetTotalSpaceSize]]<br />
|-<br />
| 48 || [[#GetFreeSpaceSize]]<br />
|-<br />
| 600 || [[#CountApplicationContentMeta]]<br />
|-<br />
| 601 || [[#ListApplicationContentMetaStatus]]<br />
|-<br />
| 605 || [[#ListApplicationContentMetaStatusWithRightsCheck]]<br />
|-<br />
| 607 || [[#IsAnyApplicationRunning]]<br />
|}<br />
<br />
==== CalculateApplicationOccupiedSize ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output [[#ApplicationOccupiedSize]].<br />
<br />
==== CheckSdCardMountStatus ====<br />
No input/output.<br />
<br />
==== CountApplicationContentMeta ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output s32.<br />
<br />
==== ListApplicationContentMetaStatusWithRightsCheck ====<br />
Same input/output as [[#ListApplicationContentMetaStatus]].<br />
<br />
==== IsAnyApplicationRunning ====<br />
No input, returns an output u8 bool.<br />
<br />
=== IDocumentInterface ===<br />
This is "nn::ns::detail::IDocumentInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 21 || GetApplicationContentPath<br />
|-<br />
| 23 || ResolveApplicationContentPath<br />
|-<br />
| 92 || [5.0.0+] GetRunningApplicationProgramId<br />
|}<br />
<br />
=== IDownloadTaskInterface ===<br />
This is "nn::ns::detail::IDownloadTaskInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 701 || [[#ClearTaskStatusList]]<br />
|-<br />
| 702 || [[#RequestDownloadTaskList]]<br />
|-<br />
| 703 || [[#RequestEnsureDownloadTask]]<br />
|-<br />
| 704 || [[#ListDownloadTaskStatus]]<br />
|-<br />
| 705 || [[#RequestDownloadTaskListData]]<br />
|-<br />
| 706 || [4.0.0+] [[#TryCommitCurrentApplicationDownloadTask]]<br />
|-<br />
| 707 || [4.0.0+] [[#EnableAutoCommit]]<br />
|-<br />
| 708 || [4.0.0+] [[#DisableAutoCommit]]<br />
|-<br />
| 709 || [4.0.0+] [[#TriggerDynamicCommitEvent]]<br />
|}<br />
<br />
==== ClearTaskStatusList ====<br />
No input/output.<br />
<br />
==== RequestDownloadTaskList ====<br />
No input/output.<br />
<br />
==== RequestEnsureDownloadTask ====<br />
No input, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== ListDownloadTaskStatus ====<br />
Takes a type-0x6 output buffer containing an array of [[#DownloadTaskStatus]], returns an output s32 total_out.<br />
<br />
A maximum of 0x100 tasks can be stored in state.<br />
<br />
==== TryCommitCurrentApplicationDownloadTask ====<br />
No input/output.<br />
<br />
==== EnableAutoCommit ====<br />
No input/output.<br />
<br />
==== DisableAutoCommit ====<br />
No input/output.<br />
<br />
==== TriggerDynamicCommitEvent ====<br />
No input/output.<br />
<br />
=== IReadOnlyApplicationRecordInterface ===<br />
This is "nn::ns::detail::IReadOnlyApplicationRecordInterface".<br />
<br />
This was added with [5.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || HasApplicationRecord || Same as [[#IApplicationManagerInterface]] cmd 910<br />
|-<br />
| 1 || [10.0.0+] NotifyApplicationFailure ||<br />
|-<br />
| 2 || [10.0.0+] IsDataCorruptedResult ||<br />
|}<br />
<br />
=== IReadOnlyApplicationControlDataInterface ===<br />
This is "nn::ns::detail::IReadOnlyApplicationControlDataInterface".<br />
<br />
This was added with [5.1.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || [[#GetApplicationControlData]] || Same as [[#IApplicationManagerInterface]] cmd 400<br />
|-<br />
| 1 || [[#GetApplicationDesiredLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 55<br />
|-<br />
| 2 || ConvertApplicationLanguageToLanguageCode || Same as [[#IApplicationManagerInterface]] cmd 59<br />
|-<br />
| 3 || [[#ConvertLanguageCodeToApplicationLanguage]] || Same as [[#IApplicationManagerInterface]] cmd 60<br />
|-<br />
| 4 || [9.0.0+] SelectApplicationDesiredLanguage ||<br />
|}<br />
<br />
=== IDynamicRightsInterface ===<br />
This is "nn::ns::detail::IDynamicRightsInterface".<br />
<br />
This was added with [6.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#RequestApplicationRightsOnServer]]<br />
|-<br />
| 1 || [[#RequestAssignRights]]<br />
|-<br />
| 4 || [[#DeprecatedRequestAssignRightsToResume]]<br />
|-<br />
| 5 || [[#VerifyActivatedRightsOwners]]<br />
|-<br />
| 6 || [[#DeprecatedGetApplicationRightsStatus]]<br />
|-<br />
| 7 || [[#RequestPrefetchForDynamicRights]]<br />
|-<br />
| 8 || [[#GetDynamicRightsState]]<br />
|-<br />
| 9 || [7.0.0+] [[#RequestApplicationRightsOnServerToResume]]<br />
|-<br />
| 10 || [7.0.0+] [[#RequestAssignRightsToResume]]<br />
|-<br />
| 11 || [7.0.0+] [[#GetActivatedRightsUsers]]<br />
|-<br />
| 12 || [8.0.0+] [[#GetApplicationRightsStatus]]<br />
|-<br />
| 13 || [8.0.0+] [[#GetRunningApplicationStatus]]<br />
|-<br />
| 14 || [10.0.0+] SelectApplicationLicense<br />
|}<br />
<br />
==== RequestApplicationRightsOnServer ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], an [[Account_services#Uid|Uid]] and an u32. Returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
==== RequestAssignRights ====<br />
Takes a type-0x5 input buffer containing an array of "nn::ns::ApplicationRightsOnServer". Returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== DeprecatedRequestAssignRightsToResume ====<br />
Takes an input u64 "nn::ns::RightsEnvironmentHandle" and an [[Account_services#Uid|Uid]]. Returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== VerifyActivatedRightsOwners ====<br />
Takes an input u64 "nn::ns::RightsEnvironmentHandle". No output.<br />
<br />
==== DeprecatedGetApplicationRightsStatus ====<br />
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns a bool "nn::ns::ApplicationRightsStatus".<br />
<br />
==== RequestPrefetchForDynamicRights ====<br />
Takes an input [[Account_services#Uid|Uid]]. Returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== GetDynamicRightsState ====<br />
No input. Returns a bool "nn::ns::DynamicRightsState".<br />
<br />
==== RequestApplicationRightsOnServerToResume ====<br />
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
==== RequestAssignRightsToResume ====<br />
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== GetActivatedRightsUsers ====<br />
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns a bool, an u32 and a type-0x6 output buffer containing an array of [[Account_services#Uid|Uid]].<br />
<br />
==== GetApplicationRightsStatus ====<br />
Takes an input "nn::ns::RightsEnvironmentHandle". Returns 2 bools "nn::ns::ApplicationRightsStatus" and "nn::ns::ApplicationLicenseType".<br />
<br />
==== GetRunningApplicationStatus ====<br />
Takes an input u64 "nn::ns::RightsEnvironmentHandle". Returns an u32 "nn::ns::RunningApplicationStatus".<br />
<br />
=== IECommerceInterface===<br />
This is "nn::ns::detail::IECommerceInterface".<br />
<br />
This was added with [4.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#RequestLinkDevice]]<br />
|-<br />
| 1 || [6.0.0+] [[#RequestCleanupAllPreInstalledApplications]]<br />
|-<br />
| 2 || [6.0.0+] [[#RequestCleanupPreInstalledApplication]]<br />
|-<br />
| 3 || [6.0.0+] [[#RequestSyncRights]]<br />
|-<br />
| 4 || [6.0.0+] [[#RequestUnlinkDevice]]<br />
|-<br />
| 5 || [6.1.0+] [[#RequestRevokeAllELicense]]<br />
|-<br />
| 6 || [9.0.0+] [[#RequestSyncRightsBasedOnAssignedELicenses]]<br />
|}<br />
<br />
==== RequestLinkDevice ====<br />
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== RequestCleanupAllPreInstalledApplications ====<br />
No input, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== RequestCleanupPreInstalledApplication ====<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== RequestSyncRights ====<br />
No input, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== RequestUnlinkDevice ====<br />
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
See [[#RequestApplicationUpdateInfo]] regarding nifm.<br />
<br />
==== RequestRevokeAllELicense ====<br />
Takes an input [[Account_services#Uid|Uid]], returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
==== RequestSyncRightsBasedOnAssignedELicenses ====<br />
No input, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
=== IFactoryResetInterface ===<br />
This is "nn::ns::detail::IFactoryResetInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 100 || [[#ResetToFactorySettings]]<br />
|-<br />
| 101 || [[#ResetToFactorySettingsWithoutUserSaveData]]<br />
|-<br />
| 102 || [[#ResetToFactorySettingsForRefurbishment]]<br />
|-<br />
| 103 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegion]]<br />
|-<br />
| 104 || [9.1.0+] [[#ResetToFactorySettingsWithPlatformRegionAuthentication]]<br />
|-<br />
| 105 || [10.0.0+] [[#RequestResetToFactorySettingsSecurely]]<br />
|-<br />
| 106 || [10.0.0+] [[#RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely]]<br />
|}<br />
<br />
==== ResetToFactorySettings ====<br />
No input/output.<br />
<br />
As of [9.1.0] this is the only [[#IFactoryResetInterface]] cmd used by [[qlaunch]].<br />
<br />
==== ResetToFactorySettingsWithoutUserSaveData ====<br />
No input/output.<br />
<br />
==== ResetToFactorySettingsForRefurbishment ====<br />
No input/output.<br />
<br />
==== ResetToFactorySettingsWithPlatformRegion ====<br />
No input/output.<br />
<br />
==== ResetToFactorySettingsWithPlatformRegionAuthentication ====<br />
No input/output.<br />
<br />
==== RequestResetToFactorySettingsSecurely ====<br />
Takes a total of 8-bytes of input, a handle, returns an output [[#IAsyncValueAndProgress]] and a handle.<br />
<br />
==== RequestResetToFactorySettingsWithPlatformRegionAuthenticationSecurely ====<br />
Takes a total of 0x10-bytes of input, a handle, returns an output [[#IAsyncValueAndProgress]] and a handle.<br />
<br />
===== IAsyncValueAndProgress =====<br />
This is "nn::ns::detail::IAsyncValueAndProgress".<br />
<br />
This was added with [10.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetSize<br />
|-<br />
| 1 || Get<br />
|-<br />
| 2 || Cancel<br />
|-<br />
| 3 || GetErrorContext<br />
|-<br />
| 4 || GetProgress<br />
|}<br />
<br />
=== IApplicationResource ===<br />
This is "nn::ns::detail::IApplicationResource".<br />
<br />
This was added with [9.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Attach<br />
|-<br />
| 1 || BoostSystemMemoryResourceLimit<br />
|}<br />
<br />
= ns:vm =<br />
This is "nn::ns::detail::IVulnerabilityManagerInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1200 || [3.0.0+] [[#NeedsUpdateVulnerability]]<br />
|-<br />
| 1201 || [4.0.0+] [[#UpdateSafeSystemVersionForDebug]]<br />
|-<br />
| 1202 || [4.0.0+] [[#GetSafeSystemVersion]]<br />
|}<br />
<br />
== NeedsUpdateVulnerability ==<br />
No input, returns an output u8 bool flag.<br />
<br />
Web-applets use this command to check if the system needs an update.<br />
<br />
== UpdateSafeSystemVersionForDebug ==<br />
Takes an input [[NCM_services#ApplicationId|ApplicationId]] and an u32 '''version'''.<br />
<br />
This command is not available for retail units. On a debug unit, if the [[System_Settings|system setting]] <code>vulnerability!enable_debug</code> is set, this mounts the system savegame [[Flash_Filesystem#System_Savegames|0x8000000000000049]] as "ns_ssversion:/", opens the file "ns_ssversion:/entry" and writes the supplied [[NCM_services#ApplicationId|ApplicationId]] and '''version''' in it.<br />
<br />
Finally, it calls [[NCM_services#ncm|OpenContentMetaDatabase]] with [[NCM_services#StorageId|StorageId]] 3, then calls [[NCM_services#IContentMetaDatabase|GetLatestContentMetaKey]] with the supplied [[NCM_services#ApplicationId|ApplicationId]] and compares the version field from the returned [[CNMT#Content_Meta_Records|Content Meta Record]] with the supplied '''version'''.<br />
<br />
If the supplied '''version''' is higher than the one in NCM's database, the value returned by [[NS_Services#NeedsUpdateVulnerability|NeedsUpdateVulnerability]] is set to "true".<br />
<br />
== GetSafeSystemVersion ==<br />
No input, returns an output [[NCM_services#ContentMetaKey|ContentMetaKey]] with the cached contents of "ns_ssversion:/entry" ([[NCM_services#ApplicationId|ApplicationId]], u32 '''version''' and u32 '''policy''' from <code>vulnerability!needs_update_vulnerability_policy</code>).<br />
<br />
= ns:su =<br />
This is "nn::ns::detail::ISystemUpdateInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#GetBackgroundNetworkUpdateState]]<br />
|-<br />
| 1 || [[#OpenSystemUpdateControl]]<br />
|-<br />
| 2 || [[#NotifyExFatDriverRequired]]<br />
|-<br />
| 3 || [[#ClearExFatDriverStatusForDebug]]<br />
|-<br />
| 4 || [[#RequestBackgroundNetworkUpdate]]<br />
|-<br />
| 5 || [[#NotifyBackgroundNetworkUpdate]]<br />
|-<br />
| 6 || [[#NotifyExFatDriverDownloadedForDebug]]<br />
|-<br />
| 9 || [[#GetSystemUpdateNotificationEventForContentDelivery]]<br />
|-<br />
| 10 || [[#NotifySystemUpdateForContentDelivery]]<br />
|-<br />
| 11 || [3.0.0+] [[#PrepareShutdown]]<br />
|-<br />
| 12 || [3.0.0-3.0.2]<br />
|-<br />
| 13 || [3.0.0-3.0.2]<br />
|-<br />
| 14 || [3.0.0-3.0.2]<br />
|-<br />
| 15 || [3.0.0-3.0.2]<br />
|-<br />
| 16 || [4.0.0+] [[#DestroySystemUpdateTask]]<br />
|-<br />
| 17 || [4.0.0+] [[#RequestSendSystemUpdate]]<br />
|-<br />
| 18 || [4.0.0+] [[#GetSendSystemUpdateProgress]]<br />
|}<br />
<br />
== GetBackgroundNetworkUpdateState ==<br />
No input, returns an output [[#BackgroundNetworkUpdateState]].<br />
<br />
This is similar to [[#HasDownloaded]], see [[#BackgroundNetworkUpdateState]].<br />
<br />
== OpenSystemUpdateControl ==<br />
No input, returns an [[#ISystemUpdateControl]].<br />
<br />
== NotifyExFatDriverRequired ==<br />
No input/output.<br />
<br />
Only usable when an [[#ISystemUpdateControl]] isn't open.<br />
<br />
This uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.<br />
<br />
Then this runs ExFat handling, updates state, and sets the same state flag as [[#RequestBackgroundNetworkUpdate]].<br />
<br />
== ClearExFatDriverStatusForDebug ==<br />
No input/output.<br />
<br />
== RequestBackgroundNetworkUpdate ==<br />
No input/output.<br />
<br />
Only usable when an [[#ISystemUpdateControl]] isn't open.<br />
<br />
This sets a state flag to value 1.<br />
<br />
== NotifyBackgroundNetworkUpdate ==<br />
Takes an input [[NCM_services#ContentMetaKey|ContentMetaKey]], no output.<br />
<br />
This checks whether a sysupdate is needed with the input ContentMetaKey using [[NCM_services|NCM]] commands, if not this will just return 0. Otherwise, this will then run code which is identical to [[#RequestBackgroundNetworkUpdate]].<br />
<br />
== NotifyExFatDriverDownloadedForDebug ==<br />
No input/output.<br />
<br />
== GetSystemUpdateNotificationEventForContentDelivery ==<br />
No input, returns an output Event handle with EventClearMode=0.<br />
<br />
== NotifySystemUpdateForContentDelivery ==<br />
No input/output.<br />
<br />
Signals the Event returned by [[#GetSystemUpdateNotificationEventForContentDelivery]].<br />
<br />
== PrepareShutdown ==<br />
No input/output.<br />
<br />
This is used by [[AM_services|AM]].<br />
<br />
Just returns 0 when an [[#ISystemUpdateControl]] is open. <br />
<br />
This does various cleanup / uses various service-cmds etc for shutdown preparation.<br />
<br />
== DestroySystemUpdateTask ==<br />
No input/output.<br />
<br />
Only usable when an [[#ISystemUpdateControl]] isn't open.<br />
<br />
This uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.<br />
<br />
== RequestSendSystemUpdate ==<br />
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], an u16 port, an u32 Ipv4Address, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
[[qlaunch]] uses value 55556 for the port. IP is normally a local-WLAN address, however this can be any address. port/addr are little-endian.<br />
<br />
[[NIM_services|NIM]] will use the input addr/port with [[Sockets_services|bind()]]. During [[Sockets_services|accept()]] handling the addr from there must match the input addr. Hence, addr must be the client addr. [[NIM_services|NIM]] will also eventually verify that the system is not Internet-connected.<br />
<br />
This validates the [[#SystemDeliveryInfo]] and generates a [[NCM_services#ContentMetaKey|ContentMetaKey]] from that, and creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:<br />
* Calls a func which does:<br />
** Uses [[NIM_services|nim]] cmd76, returning the Result on failure.<br />
** Uses [[NIM_services|nim]] cmd77, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.<br />
** Handles cleanup and returns.<br />
* Unlike [[#RequestReceiveSystemUpdate]], this doesn't save a SystemPlayReport.<br />
<br />
== GetSendSystemUpdateProgress ==<br />
No input, returns an output [[#SystemUpdateProgress]].<br />
<br />
Same as [[#GetReceiveProgress]] except this uses nim cmd81 and cmd78.<br />
<br />
== ISystemUpdateControl ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#HasDownloaded]]<br />
|-<br />
| 1 || [[#RequestCheckLatestUpdate]]<br />
|-<br />
| 2 || [[#RequestDownloadLatestUpdate]]<br />
|-<br />
| 3 || [[#GetDownloadProgress]]<br />
|-<br />
| 4 || [[#ApplyDownloadedUpdate]]<br />
|-<br />
| 5 || [[#RequestPrepareCardUpdate]]<br />
|-<br />
| 6 || [[#GetPrepareCardUpdateProgress]]<br />
|-<br />
| 7 || [[#HasPreparedCardUpdate]]<br />
|-<br />
| 8 || [[#ApplyCardUpdate]]<br />
|-<br />
| 9 || [[#GetDownloadedEulaDataSize]]<br />
|-<br />
| 10 || [[#GetDownloadedEulaData]]<br />
|-<br />
| 11 || [[#SetupCardUpdate]]<br />
|-<br />
| 12 || [[#GetPreparedCardUpdateEulaDataSize]]<br />
|-<br />
| 13 || [[#GetPreparedCardUpdateEulaData]]<br />
|-<br />
| 14 || [4.0.0+] [[#SetupCardUpdateViaSystemUpdater]]<br />
|-<br />
| 15 || [4.0.0+] [[#HasReceived]]<br />
|-<br />
| 16 || [4.0.0+] [[#RequestReceiveSystemUpdate]]<br />
|-<br />
| 17 || [4.0.0+] [[#GetReceiveProgress]]<br />
|-<br />
| 18 || [4.0.0+] [[#ApplyReceivedUpdate]]<br />
|-<br />
| 19 || [4.0.0+] [[#GetReceivedEulaDataSize]]<br />
|-<br />
| 20 || [4.0.0+] [[#GetReceivedEulaData]]<br />
|-<br />
| 21 || [4.0.0+] [[#SetupToReceiveSystemUpdate]]<br />
|-<br />
| 22 || [6.0.0+] [[#RequestCheckLatestUpdateIncludesRebootlessUpdate]]<br />
|}<br />
<br />
Only 1 ISystemUpdateControl can be open at a time.<br />
<br />
All Card cmds except SetupCardUpdate* require [[#SetupCardUpdate]]/[[#SetupCardUpdateViaSystemUpdater]] to be used previously. [[#GetPreparedCardUpdateEulaDataSize]]/[[#GetPreparedCardUpdateEulaData]] checks a different state flag.<br />
<br />
=== HasDownloaded ===<br />
No input, returns an output u8 bool flag.<br />
<br />
Gets whether a network sysupdate was downloaded, with install pending.<br />
<br />
Uses [[NIM_services|nim]] ListSystemUpdateTask and [[NIM_services|nim]] GetSystemUpdateTaskInfo. When ListSystemUpdateTask successfully returns a task and GetSystemUpdateTaskInfo is successful, the output flag is set to: <code>*((u8*)(taskinfo+0) == 0x3</code>. Otherwise, flag=0.<br />
<br />
This always returns 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89.<br />
<br />
=== RequestCheckLatestUpdate ===<br />
No input, returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
The data that can be read from the [[#IAsyncValue]] is [[#LatestSystemUpdate]].<br />
<br />
=== RequestDownloadLatestUpdate ===<br />
No input, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
=== GetDownloadProgress ===<br />
No input, returns an output [[#SystemUpdateProgress]].<br />
<br />
Similar to [[#HasDownloaded]] except instead of a flag, this returns the 0x10-bytes from taskinfo+8. The output struct is cleared when the task(info) isn't available.<br />
<br />
=== ApplyDownloadedUpdate ===<br />
No input/output.<br />
<br />
Runs code similar to [[#HasDownloaded]], throwing an error if a network sysupdate isn't ready for install. Then the sysupdate is installed:<br />
<br />
* Uses ListSystemUpdateTask again, then [[NIM_services|nim]] IsExFatDriverIncluded. Runs ExFat handling when the output flag is set.<br />
* On newer system-versions, this uses [[NIM_services|nim]] GetSystemUpdateTaskInfo then on success uses data from there to save a SystemPlayReport when the cached [[System_Settings|system-setting]] "systemreport!enabled" is set.<br />
** The EventId is "systemupdate_dl_throughput" with ApplicationId 0100000000001018.<br />
** The following fields are added to the report, see [[NIM_services#SystemUpdateTaskInfo|nim SystemUpdateTaskInfo]]: "ContentMetaId", "Version", "DownloadSize", and "ThroughputKBps".<br />
* On newer system-versions, this saves another SystemPlayReport when a state flag is set (same flag mentioned above).<br />
** The EventId is "systemupdate_pass" with ApplicationId 0100000000001021.<br />
** This report has the following fields:<br />
*** "Type"<br />
*** "SourceSystemUpdateMetaId"<br />
*** "SourceSystemUpdateMetaVersion"<br />
*** "SourceExFatStatus"<br />
*** "DestinationSystemUpdateMetaId"<br />
*** "DestinationSystemUpdateMetaVersion"<br />
*** "DestinationExFatStatus"<br />
*** "Rebootless"<br />
* Since FIRM will be installed later, the two flags in [[Flash_Filesystem#System_Update_Control]] are set to 1.<br />
* Uses [[NIM_services|nim]] CommitSystemUpdateTask and [[NIM_services|nim]] DestroySystemUpdateTask.<br />
* Installs FIRM. After installing each FIRM, the associated flag in [[Flash_Filesystem#System_Update_Control]] is set to 0.<br />
* On newer system versions when an input flag is set, this uses [[Filesystem_services|NotifySystemDataUpdateEvent]], however this doesn't happen with ApplyDownloadedUpdate since that input flag is 0.<br />
<br />
=== RequestPrepareCardUpdate ===<br />
No input, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
=== GetPrepareCardUpdateProgress ===<br />
No input, returns an output [[#SystemUpdateProgress]].<br />
<br />
=== HasPreparedCardUpdate ===<br />
No input, returns an output u8 bool flag.<br />
<br />
=== ApplyCardUpdate ===<br />
No input/output.<br />
<br />
=== GetDownloadedEulaDataSize ===<br />
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.<br />
<br />
Runs code similar to [[#HasDownloaded]], throwing an error if a network sysupdate isn't ready for install.<br />
<br />
Uses ListSystemUpdateTask again. Then [[NIM_services|nim]] GetDownloadedSystemDataPath, with the output ContentPath being used to mount the EULA title with FS.<br />
<br />
Then "<mountname>:/<[[#EulaDataPath]]>" is opened, gets the '''filesize''', then runs cleanup.<br />
<br />
=== GetDownloadedEulaData ===<br />
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.<br />
<br />
Similar to [[#GetDownloadedEulaDataSize]] except this reads the file instead, using the specified output buffer with size=filesize. This will throw an error if the filesize is larger than the buffer size.<br />
<br />
=== SetupCardUpdate ===<br />
Takes an input u64 size and a TransferMemory handle, no output.<br />
<br />
Official sw creates the TransferMemory with an user-specified buffer, with permissions=None.<br />
<br />
[[qlaunch]] uses size 0x100000 for the TransferMemory buffer.<br />
<br />
=== GetPreparedCardUpdateEulaDataSize ===<br />
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.<br />
<br />
This is similar to [[#GetDownloadedEulaDataSize]].<br />
<br />
=== GetPreparedCardUpdateEulaData ===<br />
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.<br />
<br />
This is similar to [[#GetDownloadedEulaData]].<br />
<br />
=== SetupCardUpdateViaSystemUpdater ===<br />
Takes an input u64 size and a TransferMemory handle, no output.<br />
<br />
The permissions for the TransferMemory is None.<br />
<br />
Same as [[#SetupCardUpdate]], except this doesn't have the code for [[Filesystem_services|GetGameCardHandle/GetGameCardUpdatePartitionInfo]], and uses [[Filesystem_services|OpenRegisteredUpdatePartition]] instead of [[Filesystem_services|OpenGameCardFileSystem]]. This uses the same is_initialized bool state flag.<br />
<br />
=== HasReceived ===<br />
No input, returns an output u8 bool.<br />
<br />
Same as [[#HasDownloaded]] except this uses [[NIM_services|nim]] cmd71 and cmd73.<br />
<br />
=== RequestReceiveSystemUpdate ===<br />
Takes a type-0x15 input buffer containing a [[#SystemDeliveryInfo]], an u16 port, an u32 Ipv4Address, returns an output Event handle and an [[#IAsyncResult]].<br />
<br />
[[qlaunch]] uses the same value for the port as [[#RequestSendSystemUpdate]] (see [[#RequestSendSystemUpdate]] for addr as well).<br />
<br />
[[NIM_services|NIM]] will use the input addr/port with [[Sockets_services|connect()]].<br />
<br />
This validates the [[#SystemDeliveryInfo]] and generates a [[NCM_services#ContentMetaKey|ContentMetaKey]] from that, and creates the [[#IAsyncResult]] + the async thread which handles the [[#IAsyncResult]] operation. Then the thread does:<br />
<br />
* Calls a func which does:<br />
** Throws an error if [[NIM_services#ListSystemUpdateTask|ListSystemUpdateTask]] returns any task.<br />
** Checks whether a sysupdate is actually required using the previously generated [[NCM_services#ContentMetaKey|ContentMetaKey]], throwing an error if not.<br />
** Uses [[NIM_services|nim]] cmd69, returning the Result on failure.<br />
** Uses [[NIM_services|nim]] cmd72, returning the Result on failure. Waits for the IAsyncResult operation from this to finish, then uses the Get cmd to get the output Result.<br />
** Handles cleanup and returns.<br />
* On success, this loads various data which is then used for saving a SystemPlayReport when the cached [[System_Settings|system-setting]] "systemreport!enabled" is set.<br />
** The EventId is "receive_system_update" with ApplicationId <NS ProgramId>.<br />
** This report has the following fields: <br />
*** "SourceSystemUpdateId"<br />
*** "DestinationSystemUpdateId"<br />
*** "SourceSystemUpdateVersion"<br />
*** "DestinationSystemUpdateVersion"<br />
*** "SenderFirmwareVariationId"<br />
*** "ReceiverFirmwareVariationId"<br />
*** "SenderPlatformRegion"<br />
*** "ReceiverPlatformRegion"<br />
*** "SenderHasExFat"<br />
*** "ReceiverHasExFat"<br />
*** "Size"<br />
*** "ThroughputKBps"<br />
<br />
=== GetReceiveProgress ===<br />
No input, returns an output [[#SystemUpdateProgress]].<br />
<br />
Same as [[#GetDownloadProgress]] except this uses [[NIM_services|nim]] cmd71 and cmd73.<br />
<br />
=== ApplyReceivedUpdate ===<br />
No input/output.<br />
<br />
=== GetReceivedEulaDataSize ===<br />
Takes a type-0x15 input buffer [[#EulaDataPath]], returns an output u64 '''filesize'''.<br />
<br />
This is similar to [[#GetDownloadedEulaDataSize]].<br />
<br />
=== GetReceivedEulaData ===<br />
Takes a type-0x15 input buffer [[#EulaDataPath]] and a type-0x6 output buffer, returns an output u64 '''filesize'''.<br />
<br />
This is similar to [[#GetDownloadedEulaData]].<br />
<br />
=== SetupToReceiveSystemUpdate ===<br />
No input/output.<br />
<br />
This just uses [[NIM_services|nim]] ListSystemUpdateTask, then when a task is returned uses it with DestroySystemUpdateTask.<br />
<br />
[[qlaunch]] uses this before [[#RequestReceiveSystemUpdate]].<br />
<br />
=== RequestCheckLatestUpdateIncludesRebootlessUpdate ===<br />
No input, returns an output Event handle and an [[#IAsyncValue]].<br />
<br />
= IAsyncValue =<br />
This is "nn::ns::detail::IAsyncValue".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetSize<br />
|-<br />
| 1 || Get<br />
|-<br />
| 2 || Cancel<br />
|-<br />
| 3 || [4.0.0+] GetErrorContext<br />
|}<br />
<br />
Official sw creates a container object for this using the output from the service commands, which contains the IAsyncValue object, and the Event with EventClearMode=0.<br />
<br />
* GetSize: No input, returns an output u64.<br />
* Get: Takes a type-0x6 output buffer, no output. Official sw waits on the Event prior to using this cmd.<br />
* Cancel: No input/output. Used by official sw when closing the object, when the serv-obj is initialized (after using the cmd, official sw will also wait on the Event). This cmd is also used in other official sw funcs.<br />
* GetErrorContext: No input/output, takes a type-0x16 output buffer containing an [[Error_Applet#ErrorContext|ErrorContext]].<br />
<br />
= IAsyncResult =<br />
This is "nn::ns::detail::IAsyncResult".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Get<br />
|-<br />
| 1 || Cancel<br />
|-<br />
| 2 || [4.0.0+] GetErrorContext<br />
|}<br />
<br />
Official sw creates a container object for this using the output from the service commands, which contains the IAsyncResult object, and the Event with EventClearMode=0.<br />
<br />
* Get: No input/output. Official sw waits on the Event prior to using this cmd.<br />
* Cancel: No input/output. Used by official sw when closing the object, when the serv-obj is initialized (after using the cmd, official sw will also wait on the Event). This cmd is also used in other official sw funcs.<br />
* GetErrorContext: No input/output, takes a type-0x16 output buffer containing an [[Error_Applet#ErrorContext|ErrorContext]].<br />
<br />
= ns:dev =<br />
This is "nn::ns::detail::IDevelopInterface".<br />
<br />
[10.0.0+] Some of these cmds were replaced by the [[PGL_services|pgl]] system module.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [1.0.0-9.2.0] [[#LaunchProgram]]<br />
|-<br />
| 1 || [[#TerminateProcess]]<br />
|-<br />
| 2 || [1.0.0-9.2.0] [[#TerminateProgram]]<br />
|-<br />
| 4 || [1.0.0-9.2.0] [[#GetShellEvent]]<br />
|-<br />
| 5 || [1.0.0-9.2.0] [[#GetShellEventInfo]]<br />
|-<br />
| 6 || [[#TerminateApplication]]<br />
|-<br />
| 7 || [1.0.0-9.2.0] [[#PrepareLaunchProgramFromHost]]<br />
|-<br />
| 8 || [10.0.0+] [[#LaunchApplicationFromHost]] ([1.0.0-9.2.0] [[#LaunchApplicationForDevelop]])<br />
|-<br />
| 9 || [[#LaunchApplicationWithStorageIdForDevelop]]<br />
|-<br />
| 10 || [6.0.0-8.1.0] [[#IsSystemMemoryResourceLimitBoosted]]<br />
|-<br />
| 11 || [6.0.0+] [[#GetRunningApplicationProcessIdForDevelop]]<br />
|-<br />
| 12 || [6.0.0+] [[#SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop]]<br />
|-<br />
| 13 || [9.0.0+] [[#CreateApplicationResourceForDevelop]]<br />
|-<br />
| 14 || [9.0.0+] [[#IsPreomiaForDevelop]]<br />
|-<br />
| 15 || [10.0.0+] [[#GetApplicationProgramIdFromHost]]<br />
|}<br />
<br />
== LaunchProgram ==<br />
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|LaunchProcess]].<br />
<br />
== TerminateProcess ==<br />
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|TerminateProcess]].<br />
<br />
== TerminateProgram ==<br />
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|TerminateProgram]].<br />
<br />
== GetShellEvent ==<br />
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|GetProcessEventHandle]].<br />
<br />
== GetShellEventInfo ==<br />
Wrapper for "pm:shell" [[Process_Manager_services#pm:shell|GetProcessEventInfo]].<br />
<br />
== TerminateApplication ==<br />
Calls "pm:shell" [[Process_Manager_services#pm:shell|GetApplicationProcessIdForShell]] and sends the ProcessId to [[Process_Manager_services#pm:shell|TerminateProcess]].<br />
<br />
== PrepareLaunchProgramFromHost ==<br />
Takes a type-0x5 input buffer containing the [[Filesystem_services|ContentPath]], returns an output 0x10-byte struct.<br />
<br />
Calls [[NCM_services#IPathResolverForStorage|IPathResolverForStorage]] Set...NcaPath functions.<br />
<br />
== LaunchApplicationForDevelop ==<br />
Takes an input u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]] and [[NCM_services#ApplicationId|ApplicationId]], returns an output u64 ProcessId.<br />
<br />
Same as [[#LaunchApplicationWithStorageIdForDevelop]] except the last two params passed to the internal vtable funcptr call are value 0x6, instead of from the command input.<br />
<br />
== LaunchApplicationFromHost ==<br />
Takes an input u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]] and a type-0x5 input buffer containing the [[Filesystem_services|ContentPath]]. Returns an output u64 ProcessId.<br />
<br />
== LaunchApplicationWithStorageIdForDevelop ==<br />
Takes 2 input u8 [[NCM_services#StorageId|StorageIds]], an u32 [[Process_Manager_services#LaunchFlags|LaunchFlags]], and an [[NCM_services#ApplicationId|ApplicationId]]. Returns an output u64 ProcessId.<br />
<br />
Launches an application title which is registered with NS.<br />
<br />
== IsSystemMemoryResourceLimitBoosted ==<br />
No input. Returns a bool.<br />
<br />
== GetRunningApplicationProcessIdForDevelop ==<br />
Returns an output u64 ProcessId.<br />
<br />
== SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop ==<br />
Takes an input bool. No output.<br />
<br />
== CreateApplicationResourceForDevelop ==<br />
Takes an input u32 (1 = Preomia/MicroApplication). Returns an [[#IApplicationResource]].<br />
<br />
== IsPreomiaForDevelop ==<br />
Takes an input u64 [[NCM_services#ProgramId|ProgramId]]. Returns a bool.<br />
<br />
== GetApplicationProgramIdFromHost ==<br />
Takes a type-0x5 input buffer containing the [[Filesystem_services|ContentPath]]. Returns an u64 [[NCM_services#ProgramId|ProgramId]].<br />
<br />
= VersionListData =<br />
This is "nn::ns::VersionListData".<br />
<br />
= ApplicationUpdateInfo =<br />
This is "nn::ns::ApplicationUpdateInfo".<br />
<br />
This is an u8. [[qlaunch]] just checks whether this is 0.<br />
<br />
= ApplicationOccupiedSize =<br />
This is "nn::ns::ApplicationOccupiedSize". This is a 0x80-byte struct.<br />
<br />
= ProgressForDeleteUserSaveDataAll =<br />
This is "nn::ns::detail::ProgressForDeleteUserSaveDataAll". This is a 0x28-byte struct.<br />
<br />
= ApplicationViewDeprecated =<br />
This is "nn::ns::ApplicationViewDeprecated". This is a 0x40-byte struct.<br />
<br />
This is converted from [[#ApplicationView]] by [[#GetApplicationViewDeprecated]] on newer system-versions as follows:<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x20 || Same as [[#ApplicationView]] +0x0.<br />
|-<br />
| 0x20 || 0x4 || Same as [[#ApplicationView]] +0x20.<br />
|-<br />
| 0x24 || 0x2 || Same as [[#ApplicationView]] +0x24.<br />
|-<br />
| 0x26 || 0x2 || Cleared to 0.<br />
|-<br />
| 0x28 || 0x10 || Same as [[#ApplicationView]] +0x30.<br />
|-<br />
| 0x38 || 0x4 || Same as [[#ApplicationView]] +0x40.<br />
|-<br />
| 0x3C || 0x1 || Same as [[#ApplicationView]] +0x44.<br />
|-<br />
| 0x3D || 0x2 || Cleared to 0.<br />
|-<br />
| 0x3F || 0x1 || Cleared to 0.<br />
|}<br />
<br />
= ApplicationView =<br />
This is "nn::ns::ApplicationView". This is a 0x50-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]<br />
|-<br />
| 0x8 || 0x4 || ?<br />
|-<br />
| 0xC || 0x4 || Flags<br />
|-<br />
| 0x10 || 0x40 || ?<br />
|}<br />
<br />
= ApplicationViewWithPromotionInfo =<br />
This is a 0x70-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x50 || [[#ApplicationView]]<br />
|-<br />
| 0x50 || 0x20 || [[#PromotionInfo]]<br />
|}<br />
<br />
= PromotionInfo =<br />
This is a 0x20-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || PosixTime start_timestamp.<br />
|-<br />
| 0x8 || 0x8 || PosixTime end_timestamp.<br />
|-<br />
| 0x10 || 0x8 || Remaining time until the promotion ends, in nanoseconds ({end_timestamp - current_time} converted to nanoseconds).<br />
|-<br />
| 0x18 || 0x4 || Not set, left at zero.<br />
|-<br />
| 0x1C || 0x1 || Flags. Bit0: whether the PromotionInfo is valid (including bit1). Bit1 clear: u64 +0x10 is set.<br />
|-<br />
| 0x1D || 0x3 || Padding<br />
|}<br />
<br />
= NoDownloadRightsErrorResolution =<br />
This is "nn::ns::NoDownloadRightsErrorResolution".<br />
<br />
= BackgroundNetworkUpdateState =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || No sysupdate task exists.<br />
|-<br />
| 1 || Sysupdate download in progress.<br />
|-<br />
| 2 || Sysupdate ready, pending install.<br />
|}<br />
<br />
This is "nn::ns::BackgroundNetworkUpdateState". This is an u8.<br />
<br />
Similar to [[#HasDownloaded]], [[#GetBackgroundNetworkUpdateState]] uses [[NIM_services|nim]] ListSystemUpdateTask and [[NIM_services|nim]] GetSystemUpdateTaskInfo. When ListSystemUpdateTask successfully returns a task and GetSystemUpdateTaskInfo is successful, the output value is set to: <code>1 + *((u8*)(taskinfo+0) == 0x3</code>. Otherwise, value=0.<br />
<br />
[[#GetBackgroundNetworkUpdateState]] always returns Result 0, however this will assert if GetSystemUpdateTaskInfo fails with ret!=0x3C89.<br />
<br />
= SystemUpdateProgress =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || s64 Current size. This value can be larger than total_size when the async operation is finishing. When total_size is <=0, this current_size field may contain a progress value for when the total_size is not yet determined.<br />
|-<br />
| 0x8 || 0x8 || s64 Total size, this field is only valid when >0.<br />
|}<br />
<br />
This is "nn::ns::SystemUpdateProgress". This is a 0x10-byte struct.<br />
<br />
Commands which have this as output will return 0 with the output cleared, when no task is available.<br />
<br />
= EulaDataPath =<br />
This is "nn::ns::detail::EulaDataPath". This is a 0x100-byte struct.<br />
<br />
This contains a file path.<br />
<br />
= SystemDeliveryInfo =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x4 || SystemDeliveryProtocolVersion. Must be <= to and match [[System_Settings|system-setting]] <code>contents_delivery!system_delivery_protocol_version</code>.<br />
|-<br />
| 0x4 || 0x4 || ApplicationDeliveryProtocolVersion. Loaded from [[System_Settings|system-setting]] <code>contents_delivery!application_delivery_protocol_version</code>. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.<br />
|-<br />
| 0x8 || 0x1 || HasExFat. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.<br />
|-<br />
| 0x9 || 0x3 || Reserved.<br />
|-<br />
| 0xC || 0x4 || SystemUpdateMetaVersion.<br />
|-<br />
| 0x10 || 0x8 || SystemUpdateMetaId.<br />
|-<br />
| 0x18 || 0x1 || FirmwareVariationId. Used by [[#RequestSendSystemUpdate]].<br />
|-<br />
| 0x19 || 0x1 || UpdatableFirmwareGroupId. Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.<br />
|-<br />
| 0x1A || 0x1 || PlatformRegion (0x00 = Unknown, 0x01 = Global, 0x02 = China).<br />
|-<br />
| 0x1B || 0xC5 || Unused by [[#RequestSendSystemUpdate]]/[[#RequestReceiveSystemUpdate]], besides HMAC validation.<br />
|-<br />
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes.<br />
|}<br />
<br />
This is "nn::ns::SystemDeliveryInfo". This is a 0x100-byte struct.<br />
<br />
= ApplicationDeliveryInfo =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || ?<br />
|-<br />
| 0x8 || 0x8 || ApplicationId.<br />
|-<br />
| 0x10 || 0x4 || ApplicationVersion.<br />
|-<br />
| 0x14 || 0x4 || ?<br />
|-<br />
| 0x18 || 0x4 || RequiredSystemVersion.<br />
|-<br />
| 0x1C || 0x4 || ?<br />
|-<br />
| 0x20 || 0xC0 || ?<br />
|-<br />
| 0xE0 || 0x20 || HMAC-SHA256 over the previous 0xE0-bytes. Uses a different key than [[#SystemDeliveryInfo]].<br />
|}<br />
<br />
This is "nn::ns::ApplicationDeliveryInfo". This is a 0x100-byte struct.<br />
<br />
= LatestSystemUpdate =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 1 || Unknown.<br />
|-<br />
| 2 || Unknown.<br />
|-<br />
| Other values || Unknown.<br />
|}<br />
<br />
This is "nn::ns::LatestSystemUpdate". This is an u8.<br />
<br />
= ReceiveApplicationProgress =<br />
This is "nn::ns::ReceiveApplicationProgress". This is a 0x10-byte struct.<br />
<br />
= SendApplicationProgress =<br />
This is "nn::ns::SendApplicationProgress". This is a 0x10-byte struct.<br />
<br />
= ApplicationRightsOnClient =<br />
This is a 0x20-byte struct.<br />
<br />
[[qlaunch]] only uses +0x18/+0x19 in this struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]<br />
|-<br />
| 0x8 || 0x10 || [[Account_services#Uid|Uid]]<br />
|-<br />
| 0x18 || 0x1 || Flags, [[qlaunch]] only uses bit0-bit4 and bit7.<br />
|-<br />
| 0x19 || 0x1 || Flags, [[qlaunch]] only uses bit0.<br />
|-<br />
| 0x1A || 0x6 || Unknown<br />
|}<br />
<br />
= DownloadTaskStatus =<br />
This is "nn::ns::DownloadTaskStatus". This is a 0x20-byte struct.<br />
<br />
= ApplicationLaunchInfo =<br />
This is a 0x40-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]]<br />
|-<br />
| 0x8 || 0x4 || Application version<br />
|-<br />
| 0xC || 0x4 || [[Process_Manager_services#LaunchFlags|LaunchFlags]], set to hard-coded value 0xB by [[#GetApplicationLaunchInfo]].<br />
|-<br />
| 0x10 || 0x1 || Application [[NCM_services#StorageId|StorageId]]<br />
|-<br />
| 0x11 || 0x1 || Update [[NCM_services#StorageId|StorageId]]<br />
|-<br />
| 0x12 || 0x2E || <br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=Shared_Database_services&diff=10148
Shared Database services
2020-11-02T22:51:26Z
<p>Behemoth: /* avm */ Add names from ns parent calls</p>
<hr />
<div>= pl:u, pl:s =<br />
These are "nn::pl::detail::IPlatformServiceManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#RequestLoad]]<br />
|-<br />
| 1 || [[#GetLoadState]]<br />
|-<br />
| 2 || [[#GetSize]]<br />
|-<br />
| 3 || [[#GetSharedMemoryAddressOffset]]<br />
|-<br />
| 4 || [[#GetSharedMemoryNativeHandle]]<br />
|-<br />
| 5 || [[#GetSharedFontInOrderOfPriority]]<br />
|-<br />
| 6 || [4.0.0+] GetSharedFontInOrderOfPriorityForSystem<br />
|-<br />
| 100 || [8.0.0+] RequestApplicationFunctionAuthorization<br />
|-<br />
| 101 || [8.0.0+] RequestApplicationFunctionAuthorizationByProcessId<br />
|-<br />
| 102 || [10.0.0+] RequestApplicationFunctionAuthorizationByApplicationId<br />
|-<br />
| 1000 || [9.0.0+] LoadNgWordDataForPlatformRegionChina<br />
|-<br />
| 1001 || [9.0.0+] GetNgWordDataSizeForPlatformRegionChina<br />
|}<br />
<br />
== RequestLoad ==<br />
Takes a [[#SharedFontType]] (uint32), no output.<br />
<br />
== GetLoadState ==<br />
Takes a [[#SharedFontType]] (uint32), returns the [[#LoadState]] (uint32).<br />
<br />
=== LoadState ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value || Description<br />
|-<br />
| 0x00 || Loading<br />
|-<br />
| 0x01 || Loaded<br />
|}<br />
<br />
== GetSize ==<br />
Takes a [[#SharedFontType]] (uint32), returns the Font Size (uint32).<br />
<br />
== GetSharedMemoryAddressOffset ==<br />
Takes a [[#SharedFontType]] (uint32), returns the offset (uint32) to the Font Address.<br />
<br />
== GetSharedMemoryNativeHandle ==<br />
No input, returns an output SharedMemory handle.<br />
<br />
User-processes map this SharedMemory with size=0x1100000 and permissions=R--.<br />
<br />
Font data is TTF, located at the offset returned by [[#GetSharedFontAddress]].<br />
<br />
== GetSharedFontInOrderOfPriority ==<br />
Takes an input u64 [[Settings_services#LanguageCode|LanguageCode]] and 3 type-0x6 output buffers, returns an output u8 and u32. The u8 is a bool to specify if the fonts are loaded or not and the u32 is the font count.<br />
The first buffer contains a list of [[#SharedFontType|Shared font types]], the second buffer contains the font offsets and the final buffer contains the font sizes.<br />
The buffers are an array of u32s which specify information about a specific font. Buffer1[n] is related to Buffer2[n] and Buffer3[n].<br />
Example: Font index 0s offset is at Buffer2[0], size is at Buffer3[0].<br />
The fonts are relative to the shared memory created by [[#GetSharedFontSharedMemoryHandle]]<br />
<br />
== SharedFontType ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value || Description<br />
|-<br />
| 0x00 || Japan, US and Europe (Standard)<br />
|-<br />
| 0x01 || Chinese Simplified<br />
|-<br />
| 0x02 || Extended Chinese Simplified<br />
|-<br />
| 0x03 || Chinese Traditional<br />
|-<br />
| 0x04 || Korean (Hangul)<br />
|-<br />
| 0x05 || Nintendo Extended<br />
|}<br />
<br />
* Nintendo Extended: Contains Nintendo-specific characters, including HID buttons, HID controller styles, applet icons, Wii(U) icons, etc.<br />
<br />
= mii:u, mii:e =<br />
This is "nn::mii::detail::IStaticService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetDatabaseService<br />
|}<br />
<br />
== IDatabaseService ==<br />
This is "nn::mii::detail::IDatabaseService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || IsUpdated<br />
|-<br />
| 1 || IsFullDatabase<br />
|-<br />
| 2 || GetCount<br />
|-<br />
| 3 || Get<br />
|-<br />
| 4 || Get1<br />
|-<br />
| 5 || UpdateLatest<br />
|-<br />
| 6 || BuildRandom<br />
|-<br />
| 7 || BuildDefault<br />
|-<br />
| 8 || Get2<br />
|-<br />
| 9 || Get3<br />
|-<br />
| 10 || UpdateLatest1<br />
|-<br />
| 11 || FindIndex<br />
|-<br />
| 12 || Move<br />
|-<br />
| 13 || AddOrReplace<br />
|-<br />
| 14 || Delete<br />
|-<br />
| 15 || DestroyFile<br />
|-<br />
| 16 || DeleteFile<br />
|-<br />
| 17 || Format<br />
|-<br />
| 18 || Import<br />
|-<br />
| 19 || Export<br />
|-<br />
| 20 || IsBrokenDatabaseWithClearFlag<br />
|-<br />
| 21 || GetIndex<br />
|-<br />
| 22 || [5.0.0+] SetInterfaceVersion<br />
|-<br />
| 23 || [5.0.0+] Convert<br />
|-<br />
| 24 || [7.0.0+] ConvertCoreDataToCharInfo<br />
|-<br />
| 25 || [7.0.0+] ConvertCharInfoToCoreData<br />
|-<br />
| 26 || [10.2.0+] Append<br />
|}<br />
<br />
= miiimg =<br />
This is "nn::mii::detail::IImageDatabaseService".<br />
<br />
This was added with [5.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Initialize<br />
|-<br />
| 10 || Reload<br />
|-<br />
| 11 || GetCount<br />
|-<br />
| 12 || IsEmpty<br />
|-<br />
| 13 || IsFull<br />
|-<br />
| 14 || GetAttribute<br />
|-<br />
| 15 || LoadImage<br />
|-<br />
| 16 || AddOrUpdateImage<br />
|-<br />
| 17 || DeleteImages<br />
|-<br />
| 100 || DeleteFile<br />
|-<br />
| 101 || DestroyFile<br />
|-<br />
| 102 || ImportFile<br />
|-<br />
| 103 || ExportFile<br />
|-<br />
| 104 || ForceInitialize<br />
|}<br />
<br />
= pdm:ntfy =<br />
This is "nn::pdm::detail::INotifyService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#NotifyAppletEvent]]<br />
|-<br />
| 2 || [[#NotifyOperationModeChangeEvent]]<br />
|-<br />
| 3 || [[#NotifyPowerStateChangeEvent]]<br />
|-<br />
| 4 || [[#NotifyClearAllEvent]]<br />
|-<br />
| 5 || [[#NotifyEventForDebug]]<br />
|-<br />
| 6 || [4.0.0+] SuspendUserAccountEventService<br />
|-<br />
| 7 || [4.0.0+] ResumeUserAccountEventService<br />
|-<br />
| 8 || [6.0.0+]<br />
|-<br />
| 9 || [8.0.0+]<br />
|}<br />
<br />
== NotifyAppletEvent ==<br />
Takes an input u8 [[#AppletEventType]], an u8 [[Applet_Manager_services#AppletId|AppletId]], an u8 [[Filesystem_services#StorageId|StorageId]], an u8 [[#PlayLogPolicy]], an u32 '''event_x8''', and an u64 '''titleID'''. Returns no output.<br />
<br />
When [[#PlayLogPolicy]] is 2 ("None") this will immediately return 0.<br />
<br />
Logs a new [[#PlayEvent]] with the following data:<br />
* Clears the 0x10-bytes at +0x10.<br />
* u8 +0xF = [[#AppletEventType]].<br />
* Sets the 3 timestamps.<br />
* Converts '''titleID''' and writes it to +0x0.<br />
* u32 +0x8 = '''event_x8'''.<br />
* u8 +0xC = [[Applet_Manager_services#AppletId|AppletId]], u8 +0xD = [[Filesystem_services#StorageId|StorageId]], and u8 +0xE = [[#PlayLogPolicy]].<br />
<br />
After the initial logging, additional code runs with some of the above input params.<br />
<br />
== NotifyOperationModeChangeEvent ==<br />
Takes an input u8 '''inval''', no output.<br />
<br />
Logs a new [[#PlayEvent]] with the following data: clears the 0x20-bytes at +0x0, u8 +0x1C = 0x3, u8 +0x0 = '''inval''', and sets the 3 timestamps.<br />
<br />
== NotifyPowerStateChangeEvent ==<br />
Takes an input u8 '''inval''', no output.<br />
<br />
Logs a new [[#PlayEvent]] with the following data: clears the 0x20-bytes at +0x0, u8 +0x1C = 0x2, u8 +0x0 = '''inval''', and sets the 3 timestamps.<br />
<br />
After the initial logging, additional code runs which uses '''inval'''.<br />
<br />
== NotifyClearAllEvent ==<br />
No input/output.<br />
<br />
== NotifyEventForDebug ==<br />
Takes an input type-0x5 buffer containing an array of [[#PlayEvent]], no output.<br />
<br />
Gets the [[System_Settings|system-setting]] <code>pdm!is_production</code>, the size must be 1 and the value must be 0, otherwise an error is returned.<br />
<br />
Each [[#PlayEvent]] entry is validated, throwing an error on failure. After an entry is successfully validated, it is written to the log.<br />
<br />
== Cmd8 ==<br />
Takes an input u8 [[#AppletEventType]], an u8 [[Applet_Manager_services#LibraryAppletMode|LibraryAppletMode]], an u8 [[Applet_Manager_services#AppletId|AppletId]], an u8 [[Filesystem_services#StorageId|StorageId]], an u8 [[#PlayLogPolicy]], and an u64 '''titleID'''. Returns no output.<br />
<br />
This is similar to [[#NotifyAppletEvent]].<br />
<br />
When [[#PlayLogPolicy]] is 2 ("None") this will immediately return 0.<br />
<br />
Logs a new [[#PlayEvent]] with the following data:<br />
* Clears the 0x20-bytes at +0x0.<br />
* u8 +0xF = [[#AppletEventType]].<br />
* Sets the 3 timestamps.<br />
* Converts '''titleID''' and writes it to +0x0.<br />
* u8 +0x9 = [[Applet_Manager_services#LibraryAppletMode|LibraryAppletMode]].<br />
* u8 +0x8 = 1.<br />
* u8 +0xC = [[Applet_Manager_services#AppletId|AppletId]], u8 +0xD = [[Filesystem_services#StorageId|StorageId]], and u8 +0xE = [[#PlayLogPolicy]].<br />
<br />
After the initial logging, additional code runs with some of the above input params. This is handled the same as [[#NotifyAppletEvent]], except that the value passed for '''event_x8''' is value 0 here.<br />
<br />
== Cmd9 ==<br />
Takes an input u8 [[#AppletEventType]], an u8 [[Applet_Manager_services#AppletId|AppletId]], an u8 [[Filesystem_services#StorageId|StorageId]], an 0x20-byte struct, an u8 bool flag, an u8 [[#PlayLogPolicy]], an u32 '''event_x8''', and an u64 '''program_id'''. Returns no output.<br />
<br />
[10.0.0+] This now takes an additional input u64, new_program_id. At the very beginning a new func is now called, with params: ({constant value}, &[[#AppletEventType]], &program_id, &new_program_id, &StorageId). Afterwards, where it would originally use program_id, it now uses new_program_id instead. The called func eventually writes the input to a buffer using msgpack, with the output from that being added to a list in state.<br />
<br />
This is identical to [[#NotifyAppletEvent]] except for the additional struct/flag params.<br />
<br />
After the initial logging, additional code runs with some of the above input params. This is handled the same as [[#NotifyAppletEvent]], except that when the u8 bool flag is set the input struct is used with this.<br />
<br />
[10.0.0+] New code at the very end of this func was added. When [[Applet_Manager_services#AppletId|AppletId]] is 0x1, or 0x1F-0x20, the following runs:<br />
* If [[#AppletEventType]] is 1, 5, or 6, func1 is called with param &program_id. This runs msgpack code similar to the above, then does {other things}.<br />
* Otherwise, if [[#AppletEventType]] is 0, func0 is called with param &program_id.<br />
** This calls the same msgpack func at the start as func1. [[Glue_services#GetApplicationLaunchProperty|GetApplicationLaunchProperty]] is used, with the output being copied to state on success, otherwise the output Result is used with other msgpack code.<br />
* If [[#AppletEventType]] doesn't match any of these, nothing is done.<br />
<br />
= pdm:qry =<br />
This is "nn::pdm::detail::IQueryService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#QueryAppletEvent]] ([1.0.0-7.0.1] QueryApplicationEvent)<br />
|-<br />
| 1 || [1.0.0-6.2.0] [[#QueryPlayStatistics]]<br />
|-<br />
| 2 || [1.0.0-6.2.0] [[#QueryPlayStatisticsByUserAccountId]]<br />
|-<br />
| 3 || [1.0.0-6.2.0] [[#QueryPlayStatisticsByNetworkServiceAccountId]]<br />
|-<br />
| 4 || [[#QueryPlayStatisticsByApplicationId]]<br />
|-<br />
| 5 || [[#QueryPlayStatisticsByApplicationIdAndUserAccountId]]<br />
|-<br />
| 6 || [1.0.0-6.2.0] [[#QueryPlayStatisticsByApplicationIdAndNetworkServiceAccountId]]<br />
|-<br />
| 7 || [10.0.0+] [[#QueryLastPlayTimeV0]] ([1.0.0-9.2.0] QueryLastPlayTime)<br />
|-<br />
| 8 || [[#QueryPlayEvent]]<br />
|-<br />
| 9 || [[#GetAvailablePlayEventRange]]<br />
|-<br />
| 10 || [[#QueryAccountEvent]]<br />
|-<br />
| 11 || [4.0.0+] [[#QueryAccountPlayEvent]]<br />
|-<br />
| 12 || [4.0.0+] [[#GetAvailableAccountPlayEventRange]]<br />
|-<br />
| 13 || [10.0.0+] [[#QueryApplicationPlayStatisticsForSystemV0]] ([5.0.0-9.2.0] QueryApplicationPlayStatisticsForSystem)<br />
|-<br />
| 14 || [6.0.0+] [[#QueryRecentlyPlayedApplication]]<br />
|-<br />
| 15 || [6.0.0+] [[#GetRecentlyPlayedApplicationUpdateEvent]]<br />
|-<br />
| 16 || [10.0.0+] [[#QueryApplicationPlayStatisticsByUserAccountIdForSystemV0]] ([6.0.0-9.2.0] QueryApplicationPlayStatisticsByUserAccountIdForSystem)<br />
|-<br />
| 17 || [10.0.0+] [[#QueryLastPlayTime]]<br />
|-<br />
| 18 || [10.0.0+] [[#QueryApplicationPlayStatisticsForSystem]]<br />
|-<br />
| 19 || [10.0.0+] [[#QueryApplicationPlayStatisticsByUserAccountIdForSystem]]<br />
|}<br />
<br />
== QueryAppletEvent ==<br />
Takes ([10.0.0+] an input u8 bool), an input s32 entry_index, a type-0x6 output buffer containing an array of [[#AppletEvent]], and returns an output s32 for actual total output entries.<br />
<br />
== QueryPlayStatistics ==<br />
Takes a type-0x6 output buffer containing an array of [[#PlayStatistics]] and returns an output s32 for actual total output entries.<br />
<br />
[6.2.0+] This command was removed.<br />
<br />
== QueryPlayStatisticsByUserAccountId ==<br />
Takes an input u128 '''Uid''', a type-0x6 output buffer containing an array of [[#PlayStatistics]] and returns an output s32 for actual total output entries.<br />
<br />
[6.2.0+] This command was removed.<br />
<br />
== QueryPlayStatisticsByNetworkServiceAccountId ==<br />
Takes an input u64 '''NetworkServiceAccountId''', a type-0x6 output buffer containing an array of [[#PlayStatistics]] and returns an output s32 for actual total output entries.<br />
<br />
[6.2.0+] This command was removed.<br />
<br />
== QueryPlayStatisticsByApplicationId ==<br />
Takes ([10.0.0+] an input u8 bool), an input u64 '''ApplicationId''' and returns an output [[#PlayStatistics]].<br />
<br />
== QueryPlayStatisticsByApplicationIdAndUserAccountId ==<br />
Takes ([10.0.0+] an input u8 bool), an input u64 '''ApplicationId''', an input u128 '''Uid''' and returns an output [[#PlayStatistics]].<br />
<br />
== QueryPlayStatisticsByApplicationIdAndNetworkServiceAccountId ==<br />
Takes an input u64 '''ApplicationId''', an input u64 '''NetworkServiceAccountId''' and returns an output [[#PlayStatistics]].<br />
<br />
[6.2.0+] This command was removed.<br />
<br />
== QueryLastPlayTimeV0 ==<br />
Takes a type-0x6 output buffer containing an array of [[#LastPlayTime]], and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
[10.0.0+] This now calls the impl func for [[#QueryLastPlayTime]] with flag=0.<br />
<br />
== QueryPlayEvent ==<br />
Takes an input s32 entry_index, a type-0x6 output buffer containing an array of [[#PlayEvent]], and returns an output s32 for actual total output entries.<br />
<br />
== GetAvailablePlayEventRange ==<br />
No input, returns 3 output s32s: total_entries, start_entry_index, and end_entry_index.<br />
<br />
== QueryAccountEvent ==<br />
Takes an input s32 entry_index, a type-0x6 output buffer containing an array of [[#AccountEvent]], and returns an output s32 for actual total output entries.<br />
<br />
== QueryAccountPlayEvent ==<br />
Takes an input s32 entry_offset, an input u128 '''Uid''', a type-0x6 output buffer containing an array of [[#AccountPlayEvent]], and returns an output s32 for actual total output entries.<br />
<br />
== GetAvailableAccountPlayEventRange ==<br />
Takes an input u128 '''Uid''' and returns 3 output s32s: total_entries, start_entry_index, and end_entry_index.<br />
<br />
== QueryApplicationPlayStatisticsForSystemV0 ==<br />
Takes a type-0x6 output buffer containing an array of [[#ApplicationPlayStatistics]] and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
The number of entries in each array is the same.<br />
<br />
[10.0.0+] This now calls the impl func for [[#QueryApplicationPlayStatisticsForSystem]] with flag=0.<br />
<br />
== QueryRecentlyPlayedApplication ==<br />
Takes ([10.0.0+] an input u8 bool), an input u128 '''Uid''', a type-0x6 output buffer containing an array of u64 '''ApplicationId''', and returns an output s32 for actual total output entries.<br />
<br />
Returns a list of titles played by the specified user.<br />
<br />
== GetRecentlyPlayedApplicationUpdateEvent ==<br />
No input, returns an output Event handle with autoclear=false.<br />
<br />
This is signaled when logging a new [[#PlayEvent]] which would be available via [[#QueryAccountEvent]], where [[#PlayEvent]] +0x18 is 0.<br />
<br />
== QueryApplicationPlayStatisticsByUserAccountIdForSystemV0 ==<br />
Takes an [[Account_services#Uid|Uid]], a type-0x6 output buffer containing an array of [[#ApplicationPlayStatistics]] and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
Same as [[#QueryApplicationPlayStatisticsForSystemV0]] except this gets playstats specific to '''Uid'''.<br />
<br />
[10.0.0+] This now calls the impl func for [[#QueryApplicationPlayStatisticsByUserAccountIdForSystem]] with flag=0.<br />
<br />
== QueryLastPlayTime ==<br />
Takes an input u8 bool, a type-0x6 output buffer containing an array of [[#LastPlayTime]], and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
== QueryApplicationPlayStatisticsForSystem ==<br />
Takes an input u8 bool, a type-0x6 output buffer containing an array of [[#ApplicationPlayStatistics]] and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
The number of entries in each array is the same.<br />
<br />
== QueryApplicationPlayStatisticsByUserAccountIdForSystem ==<br />
Takes an input u8 bool, an [[Account_services#Uid|Uid]], a type-0x6 output buffer containing an array of [[#ApplicationPlayStatistics]] and a type-0x5 input buffer containing an array of u64 '''ApplicationId'''. Returns an output s32 for actual total output entries.<br />
<br />
Same as [[#QueryApplicationPlayStatisticsForSystem]] except this gets playstats specific to '''Uid'''.<br />
<br />
= avm =<br />
This is "nn::avm::srv::IAvmService".<br />
<br />
This was added with [6.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 100 || <br />
|-<br />
| 101 || <br />
|-<br />
| 102 || <br />
|-<br />
| 103 || No input, returns an [[#IVersionListImporter]].<br />
|-<br />
| 200 || GetLaunchRequiredVersion<br />
|-<br />
| 202 || UpgradeLaunchRequiredVersion<br />
|-<br />
| 1000 || PushLaunchVersion<br />
|-<br />
| 1001 || ListVersionList<br />
|-<br />
| 1002 || ListRequiredVersion<br />
|}<br />
<br />
== IVersionListImporter ==<br />
This is "nn::avm::srv::IVersionListImporter".<br />
<br />
This was added with [6.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || <br />
|-<br />
| 1 || <br />
|-<br />
| 2 || <br />
|}<br />
<br />
= AppletEvent =<br />
This is "nn::pdm::AppletEvent" ([1.0.0-7.0.1] "nn::pdm::ApplicationEvent").<br />
<br />
This is a 0x18-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x4 || entryindex<br />
|-<br />
| 0xC || 0x4 || timestamp0<br />
|-<br />
| 0x10 || 0x4 || timestamp1<br />
|-<br />
| 0x14 || 0x1 || [[#PlayEvent]] +0xF<br />
|-<br />
| 0x15 || 0x3 || Padding<br />
|}<br />
<br />
Timestamp format, converted from PosixTime: total minutes since epoch UTC 1999/12/31 00:00.<br />
<br />
= PlayStatistics =<br />
This is "nn::pdm::PlayStatistics".<br />
<br />
This is a 0x28-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x4 || First entryindex<br />
|-<br />
| 0xC || 0x4 || First timestamp0. Same as the first [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x10 || 0x4 || First timestamp1. Same as the second [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x14 || 0x4 || Last entryindex<br />
|-<br />
| 0x18 || 0x4 || Last timestamp0. Same as the first [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x1C || 0x4 || Last timestamp1. Same as the second [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x20 || 0x4 || Total play-time in minutes.<br />
|-<br />
| 0x24 || 0x4 || Total times the application title was launched.<br />
|}<br />
<br />
= LastPlayTime =<br />
This is "nn::pdm::LastPlayTime".<br />
<br />
This is a 0x18-byte struct and contains data from the last time the title was played.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x4 || Same as the first [[#AppletEvent]] timestamp.<br />
|-<br />
| 0xC || 0x4 || Same as the second [[#AppletEvent]] timestamp.<br />
|-<br />
| 0x10 || 0x4 || Total minutes since the title was last played.<br />
|-<br />
| 0x14 || 0x1 || Flag indicating whether the above field is set.<br />
|-<br />
| 0x15 || 0x3 || Padding<br />
|}<br />
<br />
= PlayEventType =<br />
This is an enum for [[#PlayEvent]] +0x1C, which indicates the type of [[#PlayEvent]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || Applet<br />
|-<br />
| 1 || Account<br />
|-<br />
| 2 || PowerStateChange<br />
|-<br />
| 3 || OperationModeChange<br />
|-<br />
| 4 || Initialize. Used for the very first [[#PlayEvent]] entry in the log.<br />
|}<br />
<br />
= AppletEventType =<br />
This is an enum for [[#PlayEvent]] +0xF with [[#PlayEventType]] = Applet, this indicates the type of the Applet event.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Description<br />
|-<br />
| 0 || "launch"<br />
|-<br />
| 1 || "exit"<br />
|-<br />
| 2 || "in_focus"<br />
|-<br />
| 3 || "out_of_focus"<br />
|-<br />
| 4 || "out_of_focus"<br />
|-<br />
| 5 || "exit"<br />
|-<br />
| 6 || "exit"<br />
|}<br />
<br />
= PlayLogPolicy =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value<br />
! Meaning<br />
! Description<br />
|-<br />
| 0 || All || All pdm:qry cmds which require [[#PlayEventType]] = Applet and AppletId = Application will only return the entry when PlayLogPolicy matches this value.<br />
|-<br />
| 1 || LogOnly || The above commands will filter out the entry with this.<br />
|-<br />
| 2 || None || pdm:ntfy [[#NotifyAppletEvent]], [[#Cmd8]], and [[#Cmd9]] will immediately return 0 when the input param matches this value.<br />
|-<br />
| 3 || || [10.0.0+] The cmds which require PlayLogPolicy == All, now also allow value 3 if the cmd input flag is set.<br />
|}<br />
<br />
This is an enum for [[#PlayEvent]] +0xE with [[#PlayEventType]] = Applet. This is set via the above commands, which uses this as an input param.<br />
<br />
= PlayEvent =<br />
This is "nn::pdm::PlayEvent".<br />
<br />
This is a 0x38-byte struct and is the raw entry struct directly read from FS, without any entry filtering. The other structs are extracted+converted from this one, with filtering.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x1C || 0x1 || [[#PlayEventType]]<br />
|-<br />
| 0x1D || 0x3 || Padding<br />
|-<br />
| 0x20 || 0x8 || PosixTime timestamp from [[PCV_services|StandardUserSystemClock]].<br />
|-<br />
| 0x28 || 0x8 || PosixTime timestamp from [[PCV_services|StandardNetworkSystemClock]].<br />
|-<br />
| 0x30 || 0x8 || Timestamp in seconds derived from [[PCV_services|StandardSteadyClock]].<br />
|}<br />
<br />
Filtering:<br />
* [[#QueryAppletEvent]], [[#QueryLastPlayTime]], and [[#QueryApplicationPlayStatisticsForSystem]]: PlayEvent +0x1C must be 0, and [[#PlayLogPolicy]] must be 0. [10.0.0+] These will also allow [[#PlayLogPolicy]] value 3, if the input flag is set.<br />
** With [[#QueryLastPlayTime]]/[[#QueryApplicationPlayStatisticsForSystem]] the [[Applet_Manager_services#AppletId|AppletId]] must be 1. [10.0.0+] These now also allow [[Applet_Manager_services#AppletId|AppletId]] 0x1F/0x20.<br />
* [[#QueryPlayStatisticsByApplicationId]]: PlayEvent +0x1C must be 0, +0xC must be 1 ([10.0.0+] or 0x1F/0x20), and the titleID must match. [10.0.0+] [[#PlayLogPolicy]] must be 0. Value 3 is allowed if the input flag is set.<br />
* [[#QueryAccountEvent]]: PlayEvent +0x1C must be 1 and PlayEvent +0x18 must be <=1.<br />
* [[#QueryApplicationPlayStatisticsForSystem]]: In addition to the above, this also handles [[#PlayEventType]] PowerStateChange, where PlayEvent +0x0 is value 0 or 1.<br />
<br />
The structure of the first 0x1C-bytes are determined by [[#PlayEventType]]. For titleIDs/userIDs, the low/high u32 in each u64 is swapped.<br />
<br />
Applet:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x4 || Title version, set by pdm:ntfy [[#NotifyAppletEvent]] and [[#Cmd9]].<br />
|-<br />
| 0x8 || 0x1 || When set to u8 0x1 by pdm:ntfy [[#Cmd8]], this indicates that +0x9 is set. Only used for non-applications.<br />
|-<br />
| 0x9 || 0x1 || See above. [[Applet_Manager_services#LibraryAppletMode|LibraryAppletMode]]<br />
|-<br />
| 0xC || 0x1 || [[Applet_Manager_services#AppletId|AppletId]]<br />
|-<br />
| 0xD || 0x1 || [[Filesystem_services#StorageId|StorageId]]<br />
|-<br />
| 0xE || 0x1 || [[#PlayLogPolicy]]<br />
|-<br />
| 0xF || 0x1 || [[#AppletEventType]]<br />
|-<br />
| 0x10 || 0xC || Unused<br />
|}<br />
<br />
Account:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x10 || userID<br />
|-<br />
| 0x10 || 0x8 || titleID, when u8 +0x18 = 2.<br />
|-<br />
| 0x18 || 0x1 || Type. 0-1 to be listed by [[#QueryAccountEvent]], or 2 to include the above titleID.<br />
|-<br />
| 0x19 || 0x3 || Padding<br />
|}<br />
<br />
PlayEventType PowerStateChange/OperationModeChange: u8 +0x0 is the input value from [[#NotifyOperationModeChangeEvent]]/[[#NotifyPowerStateChangeEvent]], the rest is unused.<br />
<br />
= AccountEvent =<br />
This is "nn::pdm::AccountEvent".<br />
<br />
This is a 0x38-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x10 || userID<br />
|-<br />
| 0x10 || 0x4 || entryindex<br />
|-<br />
| 0x14 || 0x4 || Padding<br />
|-<br />
| 0x18 || 0x8 || [[#PlayEvent]] +0x20<br />
|-<br />
| 0x20 || 0x8 || [[#PlayEvent]] +0x28<br />
|-<br />
| 0x28 || 0x8 || [[#PlayEvent]] +0x30<br />
|-<br />
| 0x30 || 0x1 || [[#PlayEvent]] +0x18<br />
|-<br />
| 0x31 || 0x7 || Padding<br />
|}<br />
<br />
= AccountPlayEvent =<br />
This is "nn::pdm::AccountPlayEvent".<br />
<br />
This is a 0x28-byte struct and is the raw entry struct directly read from FS, without any entry filtering. This is separate from [[#PlayEvent]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x4 || ?<br />
|-<br />
| 0x4 || 0x8 || titleID, with the u32 low/high words swapped.<br />
|-<br />
| 0xC || 0xC || ?<br />
|-<br />
| 0x18 || 0x8 || POSIX timestamp<br />
|-<br />
| 0x20 || 0x8 || POSIX timestamp<br />
|}<br />
<br />
= ApplicationPlayStatistics =<br />
This is "nn::pdm::ApplicationPlayStatistics".<br />
<br />
This is a 0x18-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0 || 0x8 || titleID<br />
|-<br />
| 0x8 || 0x8 || Total play-time in nanoseconds.<br />
|-<br />
| 0x10 || 0x8 || Total times the application title was launched.<br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=Services_API&diff=10147
Services API
2020-11-02T19:27:00Z
<p>Behemoth: /* Service List */ add pgl service</p>
<hr />
<div>Services are system processes running in the background which wait for incoming requests. When a process wants to communicate with a service, it first needs to get a handle to the named service, and then it can communicate with the service via inter-process communication (each service has a name up to 8 characters).<br />
<br />
Handles for services are retrieved from the service manager port, "sm:", and are released via svcCloseHandle or when a process is terminated or crashes. Manager service "sm:m" also exists. Services are an abstraction of ports, they operate the same way except regular ports can have their handles retrieved directly from a SVC. Services are also able to limit the number of handles given to other processes.<br />
<br />
= sm: =<br />
This is "nn::sm::detail::IUserInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Initialize]]<br />
|-<br />
| 1 || [[#GetService]]<br />
|-<br />
| 2 || [[#RegisterService]]<br />
|-<br />
| 3 || [[#UnregisterService]]<br />
|}<br />
<br />
== Initialize ==<br />
Takes a pid descriptor and a reserved input u64.<br />
<br />
== GetService ==<br />
Takes a zero-padded service name encoded as an u64 integer. Returns a handle.<br />
<br />
== RegisterService ==<br />
Takes a zero-padded service name encoded as an u64 integer, an u8 bool is_light, and a s32 max_sessions at the next word. Returns a handle.<br />
<br />
== UnregisterService ==<br />
Takes a zero-padded service name encoded as an u64 integer.<br />
<br />
= sm:m =<br />
This is "nn::sm::detail::IManagerInterface".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#RegisterProcess]]<br />
|-<br />
| 1 || [[#UnregisterProcess]]<br />
|}<br />
<br />
== RegisterProcess ==<br />
Takes a pid and two A descriptors with the ACID and ACI0 service lists. That data originates from [[NPDM]].<br />
<br />
== UnregisterProcess ==<br />
Takes a pid.<br />
<br />
= Service List =<br />
{| class="wikitable" border="1"<br />
|-<br />
! Service names<br />
! scope="col" width="200" | Description<br />
! scope="col" width="200" | Notes<br />
|-<br />
| acc:u0, acc:u1, acc:aa, acc:su, [5.0.0+] dauth:0<br />
| [[Account services]]<br />
| u0: System, u1: User, su: Admin, aa: Baas<br />
|-<br />
| [1.0.0-8.1.0] ahid:cd, [1.0.0-8.1.0] ahid:hdr, hid, hid:dbg, hid:sys, irs, irs:sys, xcd:sys, [3.0.0-7.0.1] hid:tmp, [5.0.0+] hidbus<br />
| [[HID services]]<br />
|<br />
|-<br />
| appletAE, appletOE, idle:sys, omm, spsm, [5.0.0+] tcap, [6.0.0+] caps:su, [8.0.0+] apm <br />
| [[Applet Manager services]]<br />
| <br />
|-<br />
| [1.0.0-2.3.0] aoc:u, mii:u, mii:e, ns:am, ns:su, ns:dev, pl:u, ovln:rcv, ovln:snd, pdm:ntfy, pdm:qry<br />
<br />
[3.0.0+] aoc:u, ns:am2, ns:dev, ns:ec, ns:rid, ns:rt, ns:su, ns:vm, ns:web, [1.0.0-7.0.1] ovln:rcv, [1.0.0-7.0.1] ovln:snd<br />
| [[NS Services]]<br />
| am: Application Manager, su: System Update<br />
|-<br />
| [1.0.0-8.1.0] apm:dbg, [1.0.0-8.1.0] apm:sys, [1.0.0] fgm:1, fgm:2, fgm:3, fgm:4, fgm:5, fgm:6, fgm:7, [1.0.0-8.1.0] fgm, [1.0.0-8.1.0] fgm:0, [1.0.0-8.1.0] fgm:9, [1.0.0-8.1.0] fgm:dbg, [1.0.0-7.0.1] apm, [1.0.0-7.0.1] apm:p, [8.0.0-8.1.0] apm:am<br />
| [[PPC services]]<br />
| <br />
|-<br />
| arp:r, arp:w, [2.0.0+] bgtc:t, [2.0.0+] bgtc:sc, [9.0.0+] time:a, [9.0.0+] time:r, [9.0.0+] time:u, [9.0.0+] notif:a, [9.0.0+] notif:s<br />
| [[Glue services]]<br />
| <br />
|-<br />
| audin:a, audin:d, audin:u, audout:a, audout:d, audout:u, audren:a, audren:d, audren:u, audrec:a, audrec:d, audrec:u, audctl, [1.0.0-2.3.0] codecctl, hwopus, auddebug, [6.0.0+] auddev<br />
| [[Audio services]]<br />
|<br />
|-<br />
| <nowiki>banana</nowiki><br />
| [[Profiler services]]<br />
| Not currently available on retail units.<br />
|-<br />
| <nowiki>[2.0.0+] bcat:a, [2.0.0+] bcat:u, [2.0.0+] bcat:m, [2.0.0+] bcat:s, news:a, news:c, news:m, news:p, news:v, prepo:u, prepo:s, prepo:m, [1.0.0-5.1.0] prepo:a, [1.0.0] prepo:d, [6.0.0+] prepo:a2</nowiki><br />
| [[BCAT services]]<br />
|<br />
|-<br />
| [1.0.0] bpc:c, bpc:b, bpc:r, bpc:w, pcv, pcv:arb, pcv:imm, time:u, time:a, time:s<br />
[2.0.0+] bpc, bpc:r, pcv, [2.0.0-8.1.0] time:u, [2.0.0-8.1.0] time:a, [2.0.0-8.1.0] time:s, [1.0.0-7.0.1] pcv:arb, [1.0.0-7.0.1] pcv:imm, [8.0.0+] clkrst, [8.0.0+] clkrst:a, [8.0.0+] clkrst:i, [8.0.0+] rgltr, [8.0.0+] rtc<br />
| [[PCV services]]<br />
|<br />
|-<br />
| bsd:u, bsd:s, bsdcfg, ethc:c, ethc:i, nsd:u, nsd:a, sfdnsres<br />
| [[Sockets services]]<br />
|<br />
|-<br />
| btdrv, [5.0.0+] bt<br />
| [[Bluetooth Driver services]]<br />
| <br />
|-<br />
| btm, btm:dbg, btm:sys, [5.0.0+] btm:u<br />
| [[BTM services]]<br />
| <br />
|-<br />
| caps:a, caps:c, [1.0.0] mm:u, [5.0.0+] caps:u<br />
| [[Capture services]]<br />
| a: AlbumAccessor, c: AlbumControl<br />
|-<br />
| [2.0.0+] caps:sc, [2.0.0+] caps:ss, vi:m, vi:s, vi:u, cec-mgr, [2.0.0+] mm:u, [3.0.0-5.1.0] caps:su<br />
| [[Display services]]<br />
| <br />
|-<br />
| dispdrv<br />
| [[Nvnflinger services]]<br />
|<br />
|-<br />
| dmnt:-<br />
| [[Debug Monitor services]]<br />
| Not currently available on retail units.<br />
|-<br />
| erpt:c, erpt:r<br />
| [[Error Report services]]<br />
|<br />
|-<br />
| eupld:c, eupld:r<br />
| [[Error Upload services]]<br />
|<br />
|-<br />
| es<br />
| [[ETicket services]]<br />
|<br />
|-<br />
| fan, psm, tc, ts, <nowiki>pcm</nowiki>, [9.0.0+] apm:sys, [9.0.0+] fgm, [9.0.0+] fgm:0, [9.0.0+] fgm:9, [9.0.0+] fgm:dbg, [9.0.0+] apm:am, [10.0.0+] lbl<br />
| [[PTM services]]<br />
| pcm is not available on retail units.<br />
|-<br />
| fatal:u, fatal:p<br />
| [[Fatal services]]<br />
| <br />
|-<br />
| friend:u, friend:v, friend:m, friend:s, friend:a, [5.0.0-6.0.0] nd:app, [5.0.0-6.0.0] nd:sys<br />
| [[Friend services]]<br />
|<br />
|-<br />
| fsp-srv, fsp-ldr, fsp-pr<br />
| [[Filesystem services]]<br />
| srv: Main, ldr: Loader, pr: Program Registry<br />
|-<br />
| gpio, i2c, i2c:pcv, pinmux, pwm, uart, [3.0.0+] sasbus, [8.1.1+] led<br />
| [[Bus services]]<br />
|<br />
|-<br />
| htc, htcs, htc:tenv, file_io, gds, tma_log, tmagent<br />
| [[TMA services]]<br />
| <br />
|-<br />
| jit:u<br />
| [[JIT services]]<br />
| <br />
|-<br />
| [1.0.0-9.2.0] lbl<br />
| [[Backlight services]]<br />
| <br />
|-<br />
| ldn:m, ldn:s, ldn:u, [5.0.0-6.0.0] ndd, [9.0.0+] lp2p:app, [9.0.0+] lp2p:sys, [9.1.0+] lp2p:m<br />
| [[LDN services]]<br />
|<br />
|-<br />
| [1.0.0+] ldr:pm, ldr:ro, ldr:shel, ldr:dmnt<br />
<br />
[3.0.0+] ldr:pm, ldr:shel, ldr:dmnt<br />
| [[Loader services]]<br />
|<br />
|-<br />
| lm, lm:get<br />
| [[Log services]]<br />
|<br />
|-<br />
| manu<br />
| [[Manu Services]]<br />
| "Manufacturing", present in factory firmware but not installed on retail systems.<br />
|-<br />
| lr, ncm, ncm:v<br />
| [[NCM services]]<br />
|<br />
|-<br />
| nfc:am, nfc:mf:u, nfc:user, nfc:sys, nfp:user, nfp:dbg, nfp:sys<br />
| [[NFC services]]<br />
| <br />
|-<br />
| nifm:u, nifm:a, nifm:s<br />
| [[Network Interface services]]<br />
| <br />
|-<br />
| nim, nim:shp, ntc, [5.0.0+] nim:eca, [7.0.0+] nim:ecas<br />
| [[NIM services]]<br />
| <br />
|-<br />
| npns:u, npns:s<br />
| [[NPNS services]]<br />
|<br />
|-<br />
| nvdrv:a, nvdrv:s, nvdrv:t, nvdrv, nvdrvdbg, nvgem:c, nvgem:cd, nvmemp, [10.0.0+] nvdbg:d<br />
| [[NV services]]<br />
|<br />
|-<br />
| pcie, [6.0.0+] pcie:log<br />
| [[PCIe services]]<br />
|<br />
|-<br />
| pctl, pctl:a, pctl:s, pctl:r<br />
| [[Parental Control services]]<br />
|<br />
|-<br />
| pm:bm, pm:info, pm:shell<br />
| [[Process Manager services]]<br />
|<br />
|-<br />
| psc:c, psc:m, [5.0.0+] srepo:u, [5.0.0+] srepo:a, [8.0.0+] ovln:rcv, [8.0.0+] ovln:snd, [9.0.0+] psc:l, [9.0.0+] time:su, [9.0.0+] time:s, [9.0.0+] time:al, [9.0.0+] time:m, [9.0.0+] time:p, [9.0.0+] ins:r, [9.0.0+] ins:s<br />
| [[PSC services]]<br />
| <br />
|-<br />
| [3.0.0+] ldr:ro, ro:dmnt, [7.0.0+] ro:1<br />
| [[RO services]]<br />
|<br />
|-<br />
| set, set:fd, set:cal, set:sys<br />
| [[Settings services]]<br />
| cal: calibration, sys: System Settings<br />
|-<br />
| [3.0.0+] mii:u, [3.0.0+] mii:e, [3.0.0+] pdm:ntfy, [3.0.0+] pdm:qry, [3.0.0+] pl:u, [5.0.0+] miiimg, [6.0.0+] avm, [9.0.0+] pl:s<br />
| [[Shared Database services]]<br />
|<br />
|-<br />
| ssl<br />
| [[SSL services]]<br />
|<br />
|-<br />
| csrng, spl:, [4.0.0+] spl:mig, [4.0.0+] spl:fs, [4.0.0+] spl:ssl, [4.0.0+] spl:es, [5.0.0+] spl:manu<br />
| [[SPL services]]<br />
| <br />
|-<br />
| sf-uds<br />
| ?<br />
| System debug applet "recovery" has access to this service, but it doesn't appear to exist.<br />
|-<br />
| tspm<br />
| ?<br />
| Applications on [1.0.0] used to have access to this service, but it doesn't appear to be present on retail devices.<br />
|-<br />
| usb:ds, usb:hs, usb:pd, usb:pd:c, [1.0.0] usb:pd:m, usb:pm, [7.0.0+] usb:hs:a, [7.0.0+] usb:qdb, [8.0.0+] usb:obsv<br />
| [[USB services]]<br />
| <br />
|-<br />
| wlan:inf, wlan:lcl, wlan:lg, wlan:lga, wlan:sg, wlan:soc, [6.0.0+] wlan:dtc<br />
| [[WLAN services]]<br />
|<br />
|-<br />
| [4.0.0+] grc:c, [6.0.0+] grc:d<br />
| [[GRC services]]<br />
| <br />
|-<br />
| [4.0.0+] mig:usr<br />
| [[Migration services]]<br />
| <br />
|-<br />
| [4.0.0+] caps:dc<br />
| [[Jpegdec services]]<br />
| <br />
|-<br />
| [6.0.0+] olsc:s, [10.0.0+] olsc:u<br />
| [[OLSC services]]<br />
| <br />
|-<br />
| [9.0.0+] ngct:s, [9.0.0+] ngct:u<br />
| [[NGCT services]]<br />
| <br />
|-<br />
| [10.0.0+] pgl<br />
| [[PGL services]]<br />
| <br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=Audio_services&diff=10146
Audio services
2020-11-02T18:42:05Z
<p>Behemoth: /* audctl */</p>
<hr />
<div>= audout:u =<br />
This is "nn::audio::detail::IAudioOutManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#ListAudioOuts]]<br />
|-<br />
| 1 || [[#OpenAudioOut]]<br />
|-<br />
| 2 || [3.0.0+] [[#ListAudioOutsAuto]]<br />
|-<br />
| 3 || [3.0.0+] [[#OpenAudioOutAuto]]<br />
|}<br />
<br />
== ListAudioOuts ==<br />
Takes a type-6 output buffer.<br />
Populates the output buffer with the available audio output devices' names and returns an u32 with the number of device names written.<br />
<br />
== OpenAudioOut ==<br />
Takes a type-5 input buffer ('''DeviceNameIn'''), a type-6 output buffer ('''DeviceNameOut'''), two u32s '''SampleRate''' (must be 48000) and '''ChannelCount''' (only the higher u16 is used), one [[Applet_Manager_services#AppletResourceUserId|AppletResourceUserId]], a PID and a copy-handle.<br />
Returns an [[#IAudioOut]] object and four u32s: the sample rate, channel count, [[#PCM_format|PCM format]], and the initial AudioOutState.<br />
<br />
=== PCM format ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Value || Name<br />
|-<br />
| 0 || Invalid<br />
|-<br />
| 1 || INT8<br />
|-<br />
| 2 || INT16<br />
|-<br />
| 3 || INT24<br />
|-<br />
| 4 || INT32<br />
|-<br />
| 5 || PCM Float<br />
|-<br />
| 6 || ADPCM<br />
|}<br />
<br />
== ListAudioOutsAuto ==<br />
Same as [[#ListAudioOuts]], but takes a type-0x22 output buffer instead.<br />
<br />
== OpenAudioOutAuto ==<br />
Same as [[#OpenAudioOut]], but takes a type-0x21 input buffer and a type-0x22 output buffer instead.<br />
<br />
== IAudioOut ==<br />
This is "nn::audio::detail::IAudioOut".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#GetAudioOutState]]<br />
|-<br />
| 1 || [[#StartAudioOut]]<br />
|-<br />
| 2 || [[#StopAudioOut]]<br />
|-<br />
| 3 || [[#AppendAudioOutBuffer]]<br />
|-<br />
| 4 || [[#RegisterBufferEvent]]<br />
|-<br />
| 5 || [[#GetReleasedAudioOutBuffer]]<br />
|-<br />
| 6 || [[#ContainsAudioOutBuffer]]<br />
|-<br />
| 7 || [3.0.0+] [[#AppendAudioOutBufferAuto]]<br />
|-<br />
| 8 || [3.0.0+] [[#GetReleasedAudioOutBufferAuto]]<br />
|-<br />
| 9 || [4.0.0+] [[#GetAudioOutBufferCount]]<br />
|-<br />
| 10 || [4.0.0+] [[#GetAudioOutPlayedSampleCount]]<br />
|-<br />
| 11 || [4.0.0+] [[#FlushAudioOutBuffers]]<br />
|-<br />
| 12 || [6.0.0+] [[#SetAudioOutVolume]]<br />
|-<br />
| 13 || [6.0.0+] [[#GetAudioOutVolume]]<br />
|}<br />
<br />
=== GetAudioOutState ===<br />
Returns an u32 '''AudioOutState''' (0x00=Started, 0x01=Stopped).<br />
<br />
=== StartAudioOut ===<br />
Starts audio playback using data from appended buffers.<br />
<br />
=== StopAudioOut ===<br />
Stops audio playback. This waits for audio playback to finish before returning.<br />
<br />
=== AppendAudioOutBuffer ===<br />
Takes a type-5 input buffer for sample data and a u64 which acts as a tag for the supplied buffer (official apps use the buffer's address).<br />
<br />
The format of the input buffer is as follows:<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x00 || 8 || Pointer to next buffer (unused)<br />
|-<br />
| 0x08 || 8 || Pointer to sample buffer<br />
|-<br />
| 0x10 || 8 || Capacity of sample buffer<br />
|-<br />
| 0x18 || 8 || Size of data in the sample buffer<br />
|-<br />
| 0x20 || 8 || Offset of data in the sample buffer (unused/ignored?)<br />
|}<br />
<br />
=== RegisterBufferEvent ===<br />
Returns an event handle that is signalled when a buffer is released.<br />
<br />
=== GetReleasedAudioOutBuffer ===<br />
Takes a type-6 output buffer which will be filled with the identifiers from [[#AppendAudioOutBuffer]] of audio buffers that have been released.<br />
Returns an u32 '''ReleasedBuffersCount'''.<br />
<br />
=== ContainsAudioOutBuffer ===<br />
Takes an u64 '''tag''' for the desired buffer. Returns 1 if the buffer was appended and not yet released.<br />
<br />
=== AppendAudioOutBufferAuto ===<br />
Same as [[#AppendAudioOutBuffer]] but takes a type-0x21 buffer instead.<br />
<br />
=== GetReleasedAudioOutBufferAuto ===<br />
Same as [[#GetReleasedAudioOutBuffer]] but takes a type-0x22 buffer instead.<br />
<br />
=== GetAudioOutBufferCount ===<br />
Returns u32 amount of buffers awaiting playback.<br />
<br />
=== GetAudioOutPlayedSampleCount ===<br />
Returns u64 total amount of samples played back.<br />
<br />
=== FlushAudioOutBuffers ===<br />
Flushes all pending buffers. Returns 1 if buffers were pending.<br />
<br />
=== SetAudioOutVolume ===<br />
Set float playback volume for this interface.<br />
<br />
=== GetAudioOutVolume ===<br />
Get float playback volume for this interface. Default is 1.0.<br />
<br />
= audin:u =<br />
This is "nn::audio::detail::IAudioInManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || ListAudioIns<br />
|-<br />
| 1 || OpenAudioIn<br />
|-<br />
| 2 || [3.0.0+] ListAudioInsAuto<br />
|-<br />
| 3 || [3.0.0+] OpenAudioInAuto<br />
|-<br />
| 4 || [3.0.0+] ListAudioInsAutoFiltered<br />
|-<br />
| 5 || [5.0.0+] OpenAudioInProtocolSpecified<br />
|}<br />
<br />
== IAudioIn ==<br />
This is "nn::audio::detail::IAudioIn".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#GetAudioInState]]<br />
|-<br />
| 1 || StartAudioIn<br />
|-<br />
| 2 || StopAudioIn<br />
|-<br />
| 3 || AppendAudioInBuffer<br />
|-<br />
| 4 || RegisterBufferEvent<br />
|-<br />
| 5 || GetReleasedAudioInBuffer<br />
|-<br />
| 6 || ContainsAudioInBuffer<br />
|-<br />
| 7 || [3.0.0+] AppendAudioInBufferWithUserEvent<br />
|-<br />
| 8 || [3.0.0+] AppendAudioInBufferAuto<br />
|-<br />
| 9 || [3.0.0+] GetReleasedAudioInBufferAuto<br />
|-<br />
| 10 || [3.0.0+] AppendAudioInBufferWithUserEventAuto<br />
|-<br />
| 11 || [4.0.0+] GetAudioInBufferCount<br />
|-<br />
| 12 || [4.0.0+] SetAudioInDeviceGain<br />
|-<br />
| 13 || [4.0.0+] GetAudioInDeviceGain<br />
|-<br />
| 14 || [6.0.0+] FlushAudioInBuffers<br />
|}<br />
<br />
=== GetAudioInState ===<br />
Returns an u32 '''AudioInState''' (0x00=Started, 0x01=Stopped).<br />
<br />
= audrec:u =<br />
This is "nn::audio::detail::IFinalOutputRecorderManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || OpenFinalOutputRecorder<br />
|}<br />
<br />
== IFinalOutputRecorder ==<br />
This is "nn::audio::detail::IFinalOutputRecorder".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetFinalOutputRecorderState<br />
|-<br />
| 1 || Start<br />
|-<br />
| 2 || Stop<br />
|-<br />
| 3 || AppendFinalOutputRecorderBuffer<br />
|-<br />
| 4 || RegisterBufferEvent<br />
|-<br />
| 5 || GetReleasedFinalOutputRecorderBuffers<br />
|-<br />
| 6 || ContainsFinalOutputRecorderBuffer<br />
|-<br />
| 7 || GetFinalOutputRecorderBufferEndTime<br />
|-<br />
| 8 || [3.0.0+] AppendFinalOutputRecorderBufferAuto<br />
|-<br />
| 9 || [3.0.0+] GetReleasedFinalOutputRecorderBuffersAuto<br />
|-<br />
| 10 || [6.0.0+] FlushFinalOutputRecorderBuffers<br />
|-<br />
| 11 || [9.0.0+] AttachWorkBuffer<br />
|}<br />
<br />
= auddev =<br />
This is "nn::audio::detail::IAudioSnoopManager".<br />
<br />
This was added with [6.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || EnableDspUsageMeasurement<br />
|-<br />
| 1 || DisableDspUsageMeasurement<br />
|-<br />
| 6 || GetDspUsage<br />
|}<br />
<br />
= audren:u =<br />
This is "nn::audio::detail::IAudioRendererManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || OpenAudioRenderer<br />
|-<br />
| 1 || GetWorkBufferSize<br />
|-<br />
| 2 || [[#GetAudioDeviceService]]<br />
|-<br />
| 3 || [3.0.0+] OpenAudioRendererForManualExecution<br />
|-<br />
| 4 || [4.0.0+] GetAudioDeviceServiceWithRevisionInfo<br />
|}<br />
<br />
=== GetAudioDeviceService ===<br />
Takes an input u64 [[AM_services#AppletResourceUserId|AppletResourceUserId]], returns an output [[#IAudioDevice]].<br />
<br />
== IAudioRenderer ==<br />
This is "nn::audio::detail::IAudioRenderer".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#GetSampleRate]]<br />
|-<br />
| 1 || [[#GetSampleCount]]<br />
|-<br />
| 2 || [[#GetMixBufferCount]]<br />
|-<br />
| 3 || [[#GetAudioRendererState]]<br />
|-<br />
| 4 || RequestUpdate<br />
|-<br />
| 5 || Start<br />
|-<br />
| 6 || Stop<br />
|-<br />
| 7 || QuerySystemEvent<br />
|-<br />
| 8 || [[#SetRenderingTimeLimit]]<br />
|-<br />
| 9 || [[#GetRenderingTimeLimit]]<br />
|-<br />
| 10 || [3.0.0+] RequestUpdateAuto<br />
|-<br />
| 11 || [3.0.0+] ExecuteAudioRendererRendering<br />
|}<br />
<br />
=== GetSampleRate ===<br />
Returns the Sample Rate. (u32)<br />
<br />
=== GetSampleCount ===<br />
Returns the Sample Count. (u32)<br />
<br />
=== GetMixBufferCount ===<br />
Returns the number of Mix Buffers. (u32)<br />
<br />
=== GetAudioRendererState ===<br />
Returns an AudioRenderState, 0x00=Started 0x01=Stopped (u32)<br />
<br />
=== SetRenderingTimeLimit ===<br />
Takes a upper limit of the rendering time in percent. (u32)<br />
<br />
=== GetRenderingTimeLimit ===<br />
Returns the upper limit of the rendering time in percent. (u32)<br />
<br />
== IAudioDevice ==<br />
This is "nn::audio::detail::IAudioDevice".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#ListAudioDeviceName]]<br />
|-<br />
| 1 || [[#SetAudioDeviceOutputVolume]]<br />
|-<br />
| 2 || [[#GetAudioDeviceOutputVolume]]<br />
|-<br />
| 3 || GetActiveAudioDeviceName<br />
|-<br />
| 4 || QueryAudioDeviceSystemEvent<br />
|-<br />
| 5 || GetActiveChannelCount<br />
|-<br />
| 6 || [3.0.0+] [[#ListAudioDeviceNameAuto]]<br />
|-<br />
| 7 || [3.0.0+] [[#SetAudioDeviceOutputVolumeAuto]]<br />
|-<br />
| 8 || [3.0.0+] [[#GetAudioDeviceOutputVolumeAuto]]<br />
|-<br />
| 10 || [3.0.0+] GetActiveAudioDeviceNameAuto<br />
|-<br />
| 11 || [3.0.0+] QueryAudioDeviceInputEvent<br />
|-<br />
| 12 || [3.0.0+] QueryAudioDeviceOutputEvent<br />
|-<br />
| 13 || [5.0.0+] GetAudioSystemMasterVolumeSetting<br />
|}<br />
<br />
=== ListAudioDeviceName ===<br />
Takes a type-0x6 output buffer containing an array of '''DeviceName''', returns an output s32 for total number of output entries.<br />
<br />
=== SetAudioDeviceOutputVolume ===<br />
Takes a type-0x5 input buffer containing the '''DeviceName''' and a float. No output.<br />
<br />
=== GetAudioDeviceOutputVolume ===<br />
Takes a type-0x5 input buffer containing the '''DeviceName'''. Returns an output float.<br />
<br />
=== ListAudioDeviceNameAuto ===<br />
Takes a type-0x22 output buffer containing an array of '''DeviceName''', returns an output s32 for total number of output entries.<br />
<br />
=== SetAudioDeviceOutputVolumeAuto ===<br />
Takes a type-0x21 input buffer containing the '''DeviceName''' and a float. No output.<br />
<br />
=== GetAudioDeviceOutputVolumeAuto ===<br />
Takes a type-0x21 input buffer containing the '''DeviceName'''. Returns an output float.<br />
<br />
= audout:a =<br />
This is "nn::audio::detail::IAudioOutManagerForApplet".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || RequestSuspendAudioOuts<br />
|-<br />
| 1 || RequestResumeAudioOuts<br />
|-<br />
| 2 || GetAudioOutsProcessMasterVolume<br />
|-<br />
| 3 || SetAudioOutsProcessMasterVolume<br />
|-<br />
| 4 || [4.0.0+] GetAudioOutsProcessRecordVolume<br />
|-<br />
| 5 || [4.0.0+] SetAudioOutsProcessRecordVolume<br />
|}<br />
<br />
[4.0.0+] RequestSuspendAudioOuts/RequestResumeAudioOuts no longer returns an output handle.<br />
<br />
= audin:a =<br />
This is "nn::audio::detail::IAudioInManagerForApplet".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || RequestSuspendAudioIns<br />
|-<br />
| 1 || RequestResumeAudioIns<br />
|-<br />
| 2 || GetAudioInsProcessMasterVolume<br />
|-<br />
| 3 || SetAudioInsProcessMasterVolume<br />
|}<br />
<br />
[4.0.0+] RequestSuspendAudioIns/RequestResumeAudioIns no longer returns an output handle.<br />
<br />
= audrec:a =<br />
This is "nn::audio::detail::IFinalOutputRecorderManagerForApplet".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || RequestSuspendFinalOutputRecorders<br />
|-<br />
| 1 || RequestResumeFinalOutputRecorders<br />
|}<br />
<br />
[4.0.0+] RequestSuspendFinalOutputRecorders/RequestResumeFinalOutputRecorders no longer returns an output handle.<br />
<br />
= audren:a =<br />
This is "nn::audio::detail::IAudioRendererManagerForApplet".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || RequestSuspendAudioRenderers<br />
|-<br />
| 1 || RequestResumeAudioRenderers<br />
|-<br />
| 2 || GetAudioRenderersProcessMasterVolume<br />
|-<br />
| 3 || SetAudioRenderersProcessMasterVolume<br />
|-<br />
| 4 || RegisterAppletResourceUserId<br />
|-<br />
| 5 || UnregisterAppletResourceUserId<br />
|-<br />
| 6 || [4.0.0+] GetAudioRenderersProcessRecordVolume<br />
|-<br />
| 7 || [4.0.0+] SetAudioRenderersProcessRecordVolume<br />
|}<br />
<br />
[4.0.0+] RequestSuspendAudioRenderers/RequestResumeAudioRenderers no longer returns an output handle.<br />
<br />
= audout:d, audin:d, audrec:d, audren:d =<br />
This is "nn::audio::detail::IAudioOutManagerForDebugger", "nn::audio::detail::IAudioInManagerForDebugger", "nn::audio::detail::IFinalOutputRecorderManagerForDebugger", "nn::audio::detail::IAudioRendererManagerForDebugger".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#RequestSuspendForDebug]]<br />
|-<br />
| 1 || [[#RequestResumeForDebug]]<br />
|}<br />
<br />
== RequestSuspendForDebug ==<br />
Takes an u64 [[AM_services#AppletResourceUserId|AppletResourceUserId]].<br />
<br />
== RequestResumeForDebug ==<br />
Takes an u64 [[AM_services#AppletResourceUserId|AppletResourceUserId]].<br />
<br />
= audctl =<br />
This is "nn::audioctrl::detail::IAudioController".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetTargetVolume<br />
|-<br />
| 1 || SetTargetVolume<br />
|-<br />
| 2 || GetTargetVolumeMin<br />
|-<br />
| 3 || GetTargetVolumeMax<br />
|-<br />
| 4 || IsTargetMute<br />
|-<br />
| 5 || SetTargetMute<br />
|-<br />
| 6 || IsTargetConnected<br />
|-<br />
| 7 || SetDefaultTarget<br />
|-<br />
| 8 || GetDefaultTarget<br />
|-<br />
| 9 || GetAudioOutputMode<br />
|-<br />
| 10 || SetAudioOutputMode<br />
|-<br />
| 11 || SetForceMutePolicy<br />
|-<br />
| 12 || GetForceMutePolicy<br />
|-<br />
| 13 || GetOutputModeSetting<br />
|-<br />
| 14 || SetOutputModeSetting<br />
|-<br />
| 15 || SetOutputTarget<br />
|-<br />
| 16 || SetInputTargetForceEnabled<br />
|-<br />
| 17 || [3.0.0+] SetHeadphoneOutputLevelMode<br />
|-<br />
| 18 || [3.0.0+] GetHeadphoneOutputLevelMode<br />
|-<br />
| 19 || [3.0.0+] AcquireAudioVolumeUpdateEventForPlayReport<br />
|-<br />
| 20 || [3.0.0+] AcquireAudioOutputDeviceUpdateEventForPlayReport<br />
|-<br />
| 21 || [3.0.0+] GetAudioOutputTargetForPlayReport<br />
|-<br />
| 22 || [3.0.0+] NotifyHeadphoneVolumeWarningDisplayedEvent<br />
|-<br />
| 23 || [4.0.0+] SetSystemOutputMasterVolume<br />
|-<br />
| 24 || [4.0.0+] GetSystemOutputMasterVolume<br />
|-<br />
| 25 || [4.0.0+] GetAudioVolumeDataForPlayReport<br />
|-<br />
| 26 || [4.0.0+] [[#UpdateHeadphoneSettings]]<br />
|-<br />
| 27 || [7.0.0+] SetVolumeMappingTableForDev<br />
|-<br />
| 28 || [10.0.0+] GetAudioOutputChannelCountForPlayReport<br />
|-<br />
| 29 || [10.0.0+] BindAudioOutputChannelCountUpdateEventForPlayReport<br />
|}<br />
<br />
=== UpdateHeadphoneSettings ===<br />
<br />
Takes one input byte bool, no output.<br />
NS calls this with the result of IParentalControlService::IsRestrictionEnabled[https://switchbrew.org/wiki/Parental_Control_services#IParentalControlService].<br />
<br />
= codecctl =<br />
This is "nn::audio::detail::ICodecController".<br />
<br />
This service no longer exists in [3.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#InitializeCodecController]]<br />
|-<br />
| 1 || [[#FinalizeCodecController]]<br />
|-<br />
| 2 || [[#SleepCodecController]]<br />
|-<br />
| 3 || [[#WakeCodecController]]<br />
|-<br />
| 4 || [[#SetCodecVolume]]<br />
|-<br />
| 5 || [[#GetCodecVolumeMax]]<br />
|-<br />
| 6 || [[#GetCodecVolumeMin]]<br />
|-<br />
| 7 || [[#SetCodecActiveTarget]]<br />
|-<br />
| 8 || [[#GetCodecActiveTarget]]<br />
|-<br />
| 9 || [[#BindCodecHeadphoneMicJackInterrupt]]<br />
|-<br />
| 10 || [[#IsCodecHeadphoneMicJackInserted]]<br />
|-<br />
| 11 || [[#ClearCodecHeadphoneMicJackInterrupt]]<br />
|-<br />
| 12 || [[#IsCodecDeviceRequested]]<br />
|}<br />
<br />
== InitializeCodecController ==<br />
Takes no input.<br />
<br />
== FinalizeCodecController ==<br />
Takes no input.<br />
<br />
== SleepCodecController ==<br />
Takes no input.<br />
<br />
== WakeCodecController ==<br />
Takes no input.<br />
<br />
== SetCodecVolume ==<br />
Takes an u32 '''Volume'''.<br />
<br />
== GetCodecVolumeMax ==<br />
Returns an u32 '''VolumeMax'''.<br />
<br />
== GetCodecVolumeMin ==<br />
Returns an u32 '''VolumeMin'''.<br />
<br />
== SetCodecActiveTarget ==<br />
Takes an u32 '''Target'''.<br />
<br />
== GetCodecActiveTarget ==<br />
Returns an u32 '''Target'''.<br />
<br />
== BindCodecHeadphoneMicJackInterrupt ==<br />
Returns an event handle.<br />
<br />
== IsCodecHeadphoneMicJackInserted ==<br />
Returns a bool.<br />
<br />
== ClearCodecHeadphoneMicJackInterrupt ==<br />
Takes no input.<br />
<br />
== IsCodecDeviceRequested ==<br />
Returns a bool.<br />
<br />
= hwopus =<br />
This is "nn::codec::detail::IHardwareOpusDecoderManager".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Initialize]]<br />
|-<br />
| 1 || [[#GetWorkBufferSize]]<br />
|-<br />
| 2 || [3.0.0+] [[#OpenHardwareOpusDecoderForMultiStream]]<br />
|-<br />
| 3 || [3.0.0+] [[#GetWorkBufferSizeForMultiStream]]<br />
|}<br />
<br />
Official sw can use either software libopus, or hwopus via "nn::codec::HardwareOpus*" (separate from the former).<br />
<br />
== Initialize ==<br />
Takes two s32s '''SampleRate''' and '''ChannelCount''' packed as an u64, an u32 '''WorkBufferSize''' and a TransferMemory handle for '''WorkBuffer'''. Returns an [[#IHardwareOpusDecoder]] object. The TransferMemory is created by the user-process with permissions=0.<br />
<br />
== GetWorkBufferSize==<br />
Takes two s32s '''SampleRate''' and '''ChannelCount''' packed as an u64. Returns the u32 required size for the decoder's work buffer. Official user-processes align the output size to page-alignment.<br />
<br />
== OpenHardwareOpusDecoderForMultiStream ==<br />
Takes a type-0x19 input buffer, an u32 '''WorkBufferSize''' and a TransferMemory handle for '''WorkBuffer'''. Returns an [[#IHardwareOpusDecoder]] object. The TransferMemory is created by the user-process with permissions=0.<br />
<br />
The input buffer is a [[#MultiStreamParameters]] struct. The user-process initializes this struct the same way as [[#GetWorkBufferSizeForMultiStream]], except that an u8-array specified by the user is copied to +0x10 with size '''ChannelCount''', when '''ChannelCount''' above 0.<br />
<br />
== GetWorkBufferSizeForMultiStream ==<br />
Takes a type-0x19 input buffer. Returns the u32 required size for the decoder's work buffer. Official user-processes align the output size to page-alignment.<br />
<br />
The input buffer is a [[#MultiStreamParameters]] struct.<br />
<br />
== MultiStreamParameters ==<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x0<br />
| 0x4<br />
| Sample rate (Hz)<br />
|-<br />
| 0x4<br />
| 0x4<br />
| Number of channels<br />
|-<br />
| 0x8<br />
| 0x4<br />
| Number of streams<br />
|-<br />
| 0xC<br />
| 0x4<br />
| Number of stereo streams<br />
|-<br />
| 0x10<br />
| 0x100<br />
| u8 array of channel mappings<br />
|}<br />
<br />
== IHardwareOpusDecoder ==<br />
This is "nn::codec::detail::IHardwareOpusDecoder".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [4.0.0+] [[#DecodeInterleavedOld]] ([1.0.0-3.0.2] DecodeInterleaved)<br />
|-<br />
| 1 || [[#SetContext]]<br />
|-<br />
| 2 || [4.0.0+] [[#DecodeInterleavedForMultiStreamOld]] ([3.0.0-3.0.2] DecodeInterleavedForMultiStream)<br />
|-<br />
| 3 || [3.0.0+] [[#SetContextForMultiStream]]<br />
|-<br />
| 4 || [6.0.0+] [[#DecodeInterleavedWithPerfOld]] ([4.0.0-5.1.0] DecodeInterleavedWithPerf)<br />
|-<br />
| 5 || [6.0.0+] [[#DecodeInterleavedForMultiStreamWithPerfOld]] ([4.0.0-5.1.0] DecodeInterleavedForMultiStreamWithPerf)<br />
|-<br />
| 6 || [6.0.0+] DecodeInterleavedWithPerfAndResetOld ([6.0.0-6.2.0] DecodeInterleaved)<br />
|-<br />
| 7 || [6.0.0+] DecodeInterleavedForMultiStreamWithPerfAndResetOld ([6.0.0-6.2.0] DecodeInterleavedForMultiStream)<br />
|-<br />
| 8 || [7.0.0+] [[#DecodeInterleaved]]<br />
|-<br />
| 9 || [7.0.0+] [[#DecodeInterleavedForMultiStream]]<br />
|}<br />
<br />
=== DecodeInterleavedOld ===<br />
Takes a type-5 input buffer ('''OpusDataIn''') and a type-6 output buffer ('''PcmDataOut'''). Decodes the Opus source data to PCM and returns output s32 '''DecodedDataSize''' and s32 '''DecodedSampleCount'''.<br />
<br />
Calls the same func as [[#DecodeInterleaved]] internally with flag=0 and out_u64_ptr=NULL.<br />
<br />
=== SetContext ===<br />
Takes a type-5 input buffer ('''DecoderContextIn'''). Sends the unknown context data to the hardware decoder. The input buffer is unused.<br />
<br />
=== DecodeInterleavedForMultiStreamOld ===<br />
Takes a type-5 input buffer ('''OpusDataIn''') and a type-6 output buffer ('''PcmDataOut'''). Decodes the Opus source data to PCM and returns output s32 '''DecodedDataSize''' and s32 '''DecodedSampleCount'''.<br />
<br />
Calls the same func as [[#DecodeInterleavedForMultiStream]] internally with flag=0 and out_u64_ptr=NULL.<br />
<br />
=== SetContextForMultiStream ===<br />
Takes a type-5 input buffer ('''DecoderContextIn'''). Sends the unknown context data to the hardware decoder.<br />
<br />
=== DecodeInterleavedWithPerfOld ===<br />
Takes a type-0x5 input buffer ('''OpusDataIn''') and a type-0x46 output buffer ('''PcmDataOut'''). Decodes the Opus source data to PCM and returns output s32 '''DecodedDataSize''', s32 '''DecodedSampleCount''', and an u64.<br />
<br />
The output u64 is ignored by official user-processes.<br />
<br />
Calls the same func as [[#DecodeInterleaved]] internally with flag=0.<br />
<br />
=== DecodeInterleavedForMultiStreamWithPerfOld ===<br />
Takes a type-0x5 input buffer ('''OpusDataIn''') and a type-0x46 output buffer ('''PcmDataOut'''). Decodes the Opus source data to PCM and returns output s32 '''DecodedDataSize''', s32 '''DecodedSampleCount''', and an u64.<br />
<br />
The output u64 is ignored by official user-processes.<br />
<br />
Calls the same func as [[#DecodeInterleavedForMultiStream]] internally with flag=0.<br />
<br />
=== DecodeInterleaved ===<br />
Takes an input u8 bool flag, a type-0x5 input buffer ('''OpusDataIn''') and a type-0x46 output buffer ('''PcmDataOut'''). Decodes the Opus source data to PCM and returns output s32 '''DecodedDataSize''', s32 '''DecodedSampleCount''', and an u64.<br />
<br />
The bool flag indicates whether or not a reset of the decoder context is being requested.<br />
<br />
=== DecodeInterleavedForMultiStream ===<br />
Takes an input u8 bool flag, a type-0x5 input buffer ('''OpusDataIn''') and a type-0x46 output buffer ('''PcmDataOut'''). Decodes the Opus source data to PCM and returns output s32 '''DecodedDataSize''', s32 '''DecodedSampleCount''', and an u64.<br />
<br />
The bool flag indicates whether or not a reset of the decoder context is being requested.<br />
<br />
= auddebug =<br />
This is "nn::audio::detail::IAudioDebugManager".<br />
<br />
This service doesn't exist in retail units.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || StartDspProfiler<br />
|-<br />
| 1 || StopDspProfiler<br />
|-<br />
| 2 || StartCpuProfiler<br />
|-<br />
| 3 || StopCpuProfiler<br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=Glue_services&diff=10141
Glue services
2020-11-01T13:02:58Z
<p>Behemoth: /* arp:r */ fix link</p>
<hr />
<div>= arp:r =<br />
This is "nn::arp::detail::IReader".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#GetApplicationLaunchProperty]]<br />
|-<br />
| 1 || [10.0.0+] [[#GetApplicationControlProperty]] ([1.0.0-9.2.0] [[#GetApplicationLaunchPropertyWithApplicationId]])<br />
|-<br />
| 2 || [10.0.0+] GetApplicationProcessProperty ([1.0.0-9.2.0] [[#GetApplicationControlProperty]])<br />
|-<br />
| 3 || [10.0.0+] GetApplicationInstanceId ([1.0.0-9.2.0] [[#GetApplicationControlPropertyWithApplicationId]])<br />
|-<br />
| 4 || [10.0.0+] [[#GetApplicationInstanceUnregistrationNotifier]]<br />
|-<br />
| 5 || [10.0.0+] ListApplicationInstanceId<br />
|-<br />
| 6 || [10.0.0+] GetMicroApplicationInstanceId<br />
|-<br />
| 7 || [10.0.0+] GetApplicationCertificate<br />
|-<br />
| 9998 || [9.0.0-9.2.0] GetPreomiaApplicationLaunchProperty<br />
|-<br />
| 9999 || [9.0.0-9.2.0] GetPreomiaApplicationControlProperty<br />
|}<br />
<br />
== GetApplicationLaunchProperty ==<br />
Takes an input u64 ProcessId (1.0.0-9.2.0) or u64 ApplicationInstanceId (10.0.0+), returns an [[#ApplicationLaunchProperty]].<br />
<br />
== GetApplicationLaunchPropertyWithApplicationId ==<br />
Takes an input u64 ApplicationId, returns an [[#ApplicationLaunchProperty]].<br />
<br />
== GetApplicationControlProperty ==<br />
Takes an input u64 ProcessId (1.0.0-9.2.0) or u64 ApplicationInstanceId (10.0.0+), returns a type-0x16 buffer filled with the contents of [[NACP_Format|control.nacp]]<br />
<br />
== GetApplicationControlPropertyWithApplicationId ==<br />
Takes an input u64 ApplicationId, returns a type-0x16 buffer filled with the contents of [[NACP_Format|control.nacp]]<br />
<br />
== GetApplicationInstanceUnregistrationNotifier ==<br />
Returns an [[#IUnregistrationNotifier]].<br />
<br />
== IUnregistrationNotifier ==<br />
This is "nn::arp::detail::IUnregistrationNotifier".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetReadableHandle<br />
|}<br />
<br />
= arp:w =<br />
This is "nn::arp::detail::IWriter".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#AcquireRegistrar]]<br />
|-<br />
| 1 || [10.0.0+] UnregisterApplicationInstance ([1.0.0-9.2.0] DeleteProperties)<br />
|-<br />
| 2 || [10.0.0+] [[#AcquireUpdater]]<br />
|}<br />
<br />
== AcquireRegistrar ==<br />
Returns an [[#IRegistrar]].<br />
<br />
== AcquireUpdater ==<br />
Returns an [[#IUpdater]].<br />
<br />
== IRegistrar ==<br />
This is "nn::arp::detail::IRegistrar".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Issue]]<br />
|-<br />
| 1 || [[#SetApplicationLaunchProperty]]<br />
|-<br />
| 2 || [[#SetApplicationControlProperty]]<br />
|}<br />
<br />
=== Issue ===<br />
Takes an input u64.<br />
<br />
=== SetApplicationLaunchProperty ===<br />
Takes an input [[#ApplicationLaunchProperty]].<br />
<br />
=== SetApplicationControlProperty ===<br />
Takes an input type-0x15 buffer filled with the contents of [[NACP_Format|control.nacp]].<br />
<br />
== IUpdater ==<br />
This is "nn::arp::detail::IUpdater".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Issue<br />
|-<br />
| 1 || SetApplicationProcessProperty<br />
|-<br />
| 2 || DeleteApplicationProcessProperty<br />
|-<br />
| 3 || SetApplicationCertificate<br />
|}<br />
<br />
= bgtc:t =<br />
This is "nn::bgtc::ITaskService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || NotifyTaskStarting<br />
|-<br />
| 2 || NotifyTaskFinished<br />
|-<br />
| 3 || GetTriggerEvent<br />
|-<br />
| 4 || IsInHalfAwake<br />
|-<br />
| 5 || NotifyClientName<br />
|-<br />
| 6 || [3.0.0+] IsInFullAwake<br />
|-<br />
| 11 || ScheduleTask<br />
|-<br />
| 12 || GetScheduledTaskInterval<br />
|-<br />
| 13 || UnscheduleTask<br />
|-<br />
| 14 || GetScheduleEvent<br />
|-<br />
| 15 || SchedulePeriodicTask<br />
|-<br />
| 16 || [9.0.0+]<br />
|-<br />
| 101 || [3.0.0+] GetOperationMode<br />
|-<br />
| 102 || [3.0.0+] WillDisconnectNetworkWhenEnteringSleep<br />
|-<br />
| 103 || [3.0.0+] WillStayHalfAwakeInsteadSleep<br />
|}<br />
<br />
= bgtc:sc =<br />
This is "nn::bgtc::IStateControlService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || GetState<br />
|-<br />
| 2 || GetStateChangedEvent<br />
|-<br />
| 3 || NotifyEnteringHalfAwake<br />
|-<br />
| 4 || NotifyLeavingHalfAwake<br />
|-<br />
| 5 || [3.0.0+] SetIsUsingSleepUnsupportedDevices<br />
|}<br />
<br />
[10.0.0+] NotifyEnteringHalfAwake now takes 1-byte of input.<br />
<br />
= time:a, time:r, time:u =<br />
These are "nn::timesrv::detail::service::IStaticService".<br />
<br />
These were added with [9.0.0+].<br />
<br />
The time:u service has max_sessions 17, time:a has max_sessions 4, and time:r has max_sessions 2.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetStandardUserSystemClock || Returns an [[#ISystemClock]].<br />
|-<br />
| 1 || GetStandardNetworkSystemClock || Returns an [[#ISystemClock]].<br />
|-<br />
| 2 || GetStandardSteadyClock || Returns an [[#ISteadyClock]].<br />
|-<br />
| 3 || GetTimeZoneService || Returns an [[#ITimeZoneService]].<br />
|-<br />
| 4 || GetStandardLocalSystemClock || Returns an [[#ISystemClock]].<br />
|-<br />
| 5 || [4.0.0+] GetEphemeralNetworkSystemClock || Returns an [[#ISystemClock]].<br />
|-<br />
| 20 || [6.0.0+] GetSharedMemoryNativeHandle || <br />
|-<br />
| 30 || [6.0.0-8.1.0] GetStandardNetworkClockOperationEventReadableHandle || <br />
|-<br />
| 31 || [6.0.0-8.1.0] GetEphemeralNetworkClockOperationEventReadableHandle || <br />
|-<br />
| 50 || [4.0.0+] SetStandardSteadyClockInternalOffset || <br />
|-<br />
| 51 || [9.0.0+] GetStandardSteadyClockRtcValue || <br />
|-<br />
| 100 || IsStandardUserSystemClockAutomaticCorrectionEnabled || <br />
|-<br />
| 101 || SetStandardUserSystemClockAutomaticCorrectionEnabled || <br />
|-<br />
| 102 || [5.0.0+] GetStandardUserSystemClockInitialYear || <br />
|-<br />
| 200 || [3.0.0+] IsStandardNetworkSystemClockAccuracySufficient || <br />
|-<br />
| 201 || [6.0.0+] GetStandardUserSystemClockAutomaticCorrectionUpdatedTime || <br />
|-<br />
| 300 || [4.0.0+] CalculateMonotonicSystemClockBaseTimePoint || <br />
|-<br />
| 400 || [4.0.0+] GetClockSnapshot || <br />
|-<br />
| 401 || [4.0.0+] GetClockSnapshotFromSystemClockContext || <br />
|-<br />
| 500 || [4.0.0+] CalculateStandardUserSystemClockDifferenceByUser || <br />
|-<br />
| 501 || [4.0.0+] CalculateSpanBetween || <br />
|}<br />
<br />
== ISteadyClock ==<br />
This is "nn::timesrv::detail::service::ISteadyClock".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetCurrentTimePoint || No input, returns an output [[#SteadyClockTimePoint]].<br />
|-<br />
| 2 || GetTestOffset || No input, returns an output [[#TimeSpanType]].<br />
|-<br />
| 3 || SetTestOffset || Takes an input [[#TimeSpanType]], no output.<br />
|-<br />
| 100 || [2.0.0+] GetRtcValue || No input, returns an output s64.<br />
|-<br />
| 101 || [2.0.0+] IsRtcResetDetected || No input, returns an output u8 bool.<br />
|-<br />
| 102 || [2.0.0+] GetSetupResultValue || No input, returns an output u32.<br />
|-<br />
| 200 || [3.0.0+] GetInternalOffset || No input, returns an output [[#TimeSpanType]].<br />
|-<br />
| 201 || [3.0.0-3.0.2] SetInternalOffset || Takes an input [[#TimeSpanType]], no output.<br />
|}<br />
<br />
=== SteadyClockTimePoint ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x8|| A u64 representing a point in time.<br />
|-<br />
| 0x8 || 0x10 || An ID representing the clock source.<br />
|}<br />
<br />
This is a 0x18-byte struct.<br />
<br />
=== TimeSpanType ===<br />
This is an u64.<br />
<br />
== ISystemClock ==<br />
This is "nn::timesrv::detail::service::ISystemClock".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetCurrentTime || Returns an output [[#PosixTime]].<br />
|-<br />
| 1 || SetCurrentTime || Takes an input [[#PosixTime]].<br />
|-<br />
| 2 || GetSystemClockContext || Returns an output [[#SystemClockContext]].<br />
|-<br />
| 3 || SetSystemClockContext || Takes an input [[#SystemClockContext]].<br />
|-<br />
| 4 || [9.0.0+] GetOperationEventReadableHandle ||<br />
|}<br />
<br />
=== PosixTime ===<br />
This is an s64 for UTC POSIX time.<br />
<br />
=== SystemClockContext ===<br />
This is an 0x20-byte struct.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x8|| a [[#PosixTime]] representing the system clock epoch.<br />
|-<br />
| 0x8 || 0x18 || a [[#SteadyClockTimePoint]]<br />
|}<br />
<br />
== ITimeZoneService ==<br />
This is "nn::timesrv::detail::service::ITimeZoneService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetDeviceLocationName || No input, returns an output [[#LocationName]].<br />
|-<br />
| 1 || SetDeviceLocationName || Takes an input [[#LocationName]], no output.<br />
|-<br />
| 2 || GetTotalLocationNameCount || No input, returns an output s32.<br />
|-<br />
| 3 || LoadLocationNameList || <br />
|-<br />
| 4 || LoadTimeZoneRule || Takes an input [[#LocationName]] and a type-0x16 output buffer for [[#TimeZoneRule]], no output.<br />
|-<br />
| 5 || [2.0.0+] GetTimeZoneRuleVersion || No input, returns an output [[#TimeZoneRuleVersion]].<br />
|-<br />
| 6 || [5.0.0+] GetDeviceLocationNameAndUpdatedTime || <br />
|-<br />
| 7 || [9.0.0+] SetDeviceLocationNameWithTimeZoneRule || <br />
|-<br />
| 8 || [9.0.0+] ParseTimeZoneBinary || Stubbed, return 0x7BC74. <br />
|-<br />
| 20 || [9.0.0+] GetDeviceLocationNameOperationEventReadableHandle || <br />
|-<br />
| 100 || ToCalendarTime || Takes an input [[#PosixTime]] and a type-0x15 input buffer for [[#TimeZoneRule]], returns an output [[#CalendarTime]] and [[#CalendarAdditionalInfo]].<br />
|-<br />
| 101 || ToCalendarTimeWithMyRule || Takes an input [[#PosixTime]], returns an output [[#CalendarTime]] and [[#CalendarAdditionalInfo]].<br />
|-<br />
| 201 || ToPosixTime || Takes an input [[#CalendarTime]], a type-0x15 input buffer for [[#TimeZoneRule]], an type-0xA output buffer for [[#PosixTime]] array, and returns an output s32.<br />
|-<br />
| 202 || ToPosixTimeWithMyRule || Takes an input [[#CalendarTime]], an type-0xA output buffer for [[#PosixTime]] array, and returns an output s32.<br />
|}<br />
<br />
=== LoadLocationNameList ===<br />
Takes an input s32 LocationName_index and a type-0x6 output buffer for [[#LocationName]], returns an output s32 for total output entries.<br />
<br />
=== LocationName ===<br />
This contains a TimeZone location string with a max size of 0x24 bytes.<br />
<br />
=== TimeZoneRule ===<br />
This is an 0x4000-byte struct. Official sw uses fixed-size 0x4000 for the buffer size with the above commands.<br />
<br />
This is loaded from the [[Title_list|TimeZoneBinary]] title with the specified LocationName under the zoneinfo/ directory, the content is then converted into this TimeZoneRule structure.<br />
<br />
The files contained under zoneinfo/ directory are Tzif2 files without Tzif1 header and data at the begining of them (see [https://tools.ietf.org/html/rfc8536 RFC8536] for more information).<br />
<br />
The conversion of a Tzif2 file to a TimeZoneRule structure is based on [https://github.com/eggert/tz/blob/master/localtime.c tz database code] with some custom modifications (Leap seconds aren't handled, no usage of "posixrules" and Tzif1 support stripped out).<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x4 || timecnt<br />
|-<br />
| 0x4 || 0x4 || typecnt<br />
|-<br />
| 0x8 || 0x4 || charcnt<br />
|-<br />
| 0xC || 0x1 || goback<br />
|-<br />
| 0xD || 0x1 || goahead<br />
|-<br />
| 0xE || 0x2 || Padding<br />
|-<br />
| 0x10 || 0x8 * 1000 || ats<br />
|-<br />
| 0x1f50 || 0x1 * 1000 || types<br />
|-<br />
| 0x2338 || 0x10 * 128 || ttis (time type information), struct ttinfo[1000]<br />
|-<br />
| 0x2b38 || 0x1 * 512 || chars<br />
|-<br />
| 0x2d38 || 0x4 || defaulttype<br />
|-<br />
| 0x2d3c || 0x12c4 || Reserved / Unused<br />
|}<br />
<br />
=== ttinfo ===<br />
This is an 0x10-byte struct.<br />
Represent a Time Type Information used in [[#TimeZoneRule]].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x4 || tt_gmtoff<br />
|-<br />
| 0x4 || 0x1 || tt_isdst<br />
|-<br />
| 0x5 || 0x3 || Padding<br />
|-<br />
| 0x8 || 0x4 || tt_abbrind<br />
|-<br />
| 0xC || 0x1 || tt_ttisstd<br />
|-<br />
| 0xD || 0x1 || tt_ttisgmt<br />
|-<br />
| 0xE || 0x2 || Padding<br />
|}<br />
<br />
=== TimeZoneRuleVersion ===<br />
This is an u128.<br />
<br />
=== CalendarTime ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x2 || Year<br />
|-<br />
| 0x2 || 0x1 || Month<br />
|-<br />
| 0x3 || 0x1 || Day<br />
|-<br />
| 0x4 || 0x1 || Hour<br />
|-<br />
| 0x5 || 0x1 || Minute<br />
|-<br />
| 0x6 || 0x1 || Second<br />
|-<br />
| 0x7 || 0x1 || Padding / unknown?<br />
|}<br />
<br />
This is an 0x8-byte struct.<br />
<br />
=== CalendarAdditionalInfo ===<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset || Size || Description<br />
|-<br />
| 0x0 || 0x4 || 0-based day-of-week.<br />
|-<br />
| 0x4 || 0x4 || 0-based day-of-year.<br />
|-<br />
| 0x8 || 0x8 || Timezone name string.<br />
|-<br />
| 0x10 || 0x4 || 0 = no DST, 1 = DST.<br />
|-<br />
| 0x14 || 0x4 || s32 seconds relative to UTC for this timezone.<br />
|}<br />
<br />
This is an 0x18-byte struct. This stores timezone info.<br />
<br />
= notif:a =<br />
This is "nn::notification::server::INotificationServicesForApplication".<br />
<br />
This was added with [9.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 500 || [[#RegisterAlarmSetting]]<br />
|-<br />
| 510 || [[#UpdateAlarmSetting]]<br />
|-<br />
| 520 || [[#ListAlarmSettings]]<br />
|-<br />
| 530 || [[#LoadApplicationParameter]]<br />
|-<br />
| 540 || [[#DeleteAlarmSetting]]<br />
|-<br />
| 1000 || [[#Initialize]]<br />
|}<br />
<br />
== RegisterAlarmSetting ==<br />
Takes a type-0x15 input buffer [[#AlarmSetting]] and a type-0x5 input buffer. Returns an [[#AlarmSettingId]].<br />
<br />
The second buffer can be empty (addr=0/size=0). Size must be <=0x400. This is the ApplicationParameter.<br />
<br />
A maximum of 8 Alarms can be registered by an Application at the same time.<br />
<br />
Before using the cmd, sdknso uses [[HID_services|hid]] IsFirmwareUpdateNeededForNotification then if needed launches the controller-applet for firmware-update.<br />
<br />
After using the cmd when it failed, [[Error_Applet|ShowError]] will be used when the Result is in a certain range, otherwise this will assert.<br />
<br />
== UpdateAlarmSetting ==<br />
Takes a type-0x15 input buffer [[#AlarmSetting]] and a type-0x5 input buffer. No output.<br />
<br />
The second buffer can be empty (addr=0/size=0). Size must be <=0x400. This is the ApplicationParameter.<br />
<br />
== ListAlarmSettings ==<br />
Takes a type-0x6 output buffer to receive an array of [[#AlarmSetting]]. Returns a s32 '''AlarmSettingsCount'''.<br />
<br />
== LoadApplicationParameter ==<br />
Takes an input [[#AlarmSettingId]] and a type-0x6 output buffer containing the ApplicationParameter. Returns an u32 actual_size.<br />
<br />
== DeleteAlarmSetting ==<br />
Takes an input [[#AlarmSettingId]].<br />
<br />
== Initialize ==<br />
Takes a PID-descriptor and an input u64 pid_reserved.<br />
<br />
= notif:s =<br />
This is "nn::notification::server::INotificationServicesForSystem".<br />
<br />
This was added with [9.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 500 || [[#RegisterAlarmSetting]]<br />
|-<br />
| 510 || [[#UpdateAlarmSetting]]<br />
|-<br />
| 520 || [[#ListAlarmSettings]]<br />
|-<br />
| 530 || [[#LoadApplicationParameter]]<br />
|-<br />
| 540 || [[#DeleteAlarmSetting]]<br />
|-<br />
| 1000 || <br />
|-<br />
| 1010 || [[#ListNotifications]]<br />
|-<br />
| 1020 || [[#DeleteNotification]]<br />
|-<br />
| 1030 || [[#ClearNotifications]]<br />
|-<br />
| 1040 || [[#OpenNotificationSystemEventAccessor]]<br />
|-<br />
| 1500 || [[#SetPresentationSetting]]<br />
|-<br />
| 1510 || [[#GetPresentationSetting]]<br />
|-<br />
| 2000 || [[#GetAlarmSetting]]<br />
|-<br />
| 2001 ||<br />
|-<br />
| 2010 || [[#MuteAlarmSetting]]<br />
|-<br />
| 2020 || [[#IsAlarmSettingReady]]<br />
|-<br />
| 8000 ||<br />
|-<br />
| 8010 ||<br />
|-<br />
| 8999 || [10.0.0+]<br />
|-<br />
| 9000 || [[#GetNextAlarm]]<br />
|}<br />
<br />
== Cmd1000 ==<br />
No input, returns a total of 4-bytes of output.<br />
<br />
== ListNotifications ==<br />
Unofficial name.<br />
<br />
== DeleteNotification ==<br />
Unofficial name.<br />
<br />
== ClearNotifications ==<br />
Unofficial name.<br />
<br />
No input/output.<br />
<br />
== OpenNotificationSystemEventAccessor ==<br />
Unofficial name.<br />
<br />
No input, returns an output [[#INotificationSystemEventAccessor]].<br />
<br />
== INotificationSystemEventAccessor ==<br />
This is "nn::notification::server::INotificationSystemEventAccessor".<br />
<br />
This was added with [9.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || <br />
|}<br />
<br />
Cmd0: no input, returns an output handle.<br />
<br />
== SetPresentationSetting ==<br />
Unofficial name.<br />
<br />
== GetPresentationSetting ==<br />
Unofficial name.<br />
<br />
== GetAlarmSetting ==<br />
Unofficial name.<br />
<br />
Takes an input [[#AlarmSettingId]]. Returns an [[#AlarmSetting]].<br />
<br />
== MuteAlarmSetting ==<br />
Unofficial name.<br />
<br />
Takes an input [[#AlarmSettingId]] and a bool.<br />
<br />
== IsAlarmSettingReady ==<br />
Unofficial name.<br />
<br />
Takes an input [[#AlarmSettingId]]. Returns a bool.<br />
<br />
== GetNextAlarm ==<br />
Unofficial name.<br />
<br />
Takes an input [[#AlarmSettingId]]. Returns an u8 '''IsAlarmScheduled''' and a [[Glue_services#PosixTime|PosixTime]] for the next scheduled alarm.<br />
<br />
= ApplicationLaunchProperty =<br />
Total size is 0x10 bytes.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x00<br />
| 0x08<br />
| Title ID<br />
|-<br />
| 0x08<br />
| 0x04<br />
| Version<br />
|-<br />
| 0x0C<br />
| 0x01<br />
| Base Game [[Filesystem_services#StorageId|Storage Id]]<br />
|-<br />
| 0x0D<br />
| 0x01<br />
| Update [[Filesystem_services#StorageId|Storage Id]]<br />
|-<br />
| 0x0E<br />
| 0x02<br />
| Padding<br />
|}<br />
<br />
= AlarmSettingId =<br />
This is "nn::notification::AlarmSettingId". This is an u16.<br />
<br />
= AlarmSetting =<br />
This is "nn::notification::AlarmSetting". Total size is 0x40 bytes. When initializing this to the defaults, the entire struct is cleared then the last 0xE-bytes are set to 0xFF.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x00<br />
| 0x02<br />
| [[#AlarmSettingId]]<br />
|-<br />
| 0x02<br />
| 0x01<br />
| Kind (0 = WeeklySchedule)<br />
|-<br />
| 0x03<br />
| 0x01<br />
| u8 bool Muted (non-zero/true = AlarmSetting turned off, zero/false = on).<br />
|-<br />
| 0x04<br />
| 0x04<br />
| Padding<br />
|-<br />
| 0x08<br />
| 0x10<br />
| UID. User account associated with this AlarmSetting. Used for the PreselectedUser when launching the Application when the system was previously in sleep-mode, instead of launching the applet for selecting the user.<br />
|-<br />
| 0x18<br />
| 0x08<br />
| ApplicationId<br />
|-<br />
| 0x20<br />
| 0x08<br />
| Not set by sdksno, besides clearing it during initialization.<br />
|-<br />
| 0x28<br />
| 0x18<br />
| Alarm schedule (WeeklyScheduleAlarmSetting)<br />
|}<br />
<br />
Schedule:<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! Description<br />
|-<br />
| 0x00 || 0x0A || Not set by sdksno, besides clearing it during initialization.<br />
|-<br />
| 0x0A || 0xE(7*2) || Array of 7 entries where each entry is 2-bytes. Index is <code>nn::time::DayOfWeek</code>, Sun-Sat.<br />
|}<br />
<br />
Array entries:<br />
<br />
Each byte is set using an input s32. An entry with value 0xFFFF (the default) indicates that it's disabled. The high byte is the hour, the low byte is the minute. This uses local-time.<br />
<br />
sdknso checks whether an entry is enabled with: <code>return ({last 5-bits of the entry} < 3) && ((entry & 0xfc) < 60);</code>. The first check is equivalent to comparing the second entry byte with value 24.<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=BCAT_services&diff=10038
BCAT services
2020-10-18T16:07:03Z
<p>Behemoth: /* news:a, news:c, news:m, news:p, news:v */ document async downloader</p>
<hr />
<div>BCAT (Background Content Asymmetric synchronized delivery and Transmission) encompasses a set of content download/upload related services.<br />
<br />
= bcat:a, bcat:m, bcat:u, bcat:s =<br />
These are "nn::bcat::detail::ipc::IServiceCreator".<br />
<br />
These were added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || CreateBcatService || Takes an input u64 ProcessId, returns an [[#IBcatService]]<br />
|-<br />
| 1 || CreateDeliveryCacheStorageService || Takes an input u64 ProcessId, returns an [[#IDeliveryCacheStorageService]]<br />
|-<br />
| 2 || CreateDeliveryCacheStorageServiceWithApplicationId || Takes an input u64 TitleId, returns an [[#IDeliveryCacheStorageService]]<br />
|-<br />
| 3 || [2.0.0-2.3.0] CreateDeliveryCacheProgressService || Takes an input u64 ProcessId, returns an [[#IDeliveryCacheProgressService]]<br />
|-<br />
| 4 || [2.0.0-2.3.0] CreateDeliveryCacheProgressServiceWithApplicationId || Takes an input u64 TitleId, returns an [[#IDeliveryCacheProgressService]]<br />
|}<br />
<br />
Equivalent to 3DS BOSS(SpotPass). See [[BCAT_Content_Container|here]] for BCAT-content-container.<br />
<br />
== IBcatService ==<br />
This is "nn::bcat::detail::ipc::IBcatService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || [[#RequestSyncDeliveryCache]]<br />
|-<br />
| 10101 || [5.0.0+] RequestSyncDeliveryCacheWithDirectoryName<br />
|-<br />
| 10200 || [5.0.0+] CancelSyncDeliveryCacheRequest<br />
|-<br />
| 20100 || [[#RequestSyncDeliveryCacheWithApplicationId]]<br />
|-<br />
| 20101 || [5.0.0+] RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName<br />
|-<br />
| 20300 || [8.0.0+] [[#GetDeliveryCacheStorageUpdateNotifier]]<br />
|-<br />
| 20301 || [8.0.0+] [[#RequestSuspendDeliveryTask]]<br />
|-<br />
| 20400 || [9.0.0+] [[#RegisterSystemApplicationDeliveryTask]]<br />
|-<br />
| 20401 || [9.0.0+] [[#UnregisterSystemApplicationDeliveryTask]]<br />
|-<br />
| 20410 || [9.1.0+] SetSystemApplicationDeliveryTaskTimer<br />
|-<br />
| 30100 || SetPassphrase<br />
|-<br />
| 30101 || [2.0.0-2.3.0] <br />
|-<br />
| 30102 || [2.0.0-2.3.0] <br />
|-<br />
| 30200 || [3.0.0+] RegisterDeliveryTask<br />
|-<br />
| 30201 || [3.0.0+] UnregisterDeliveryTask<br />
|-<br />
| 30202 || [3.0.0+] BlockDeliveryTask<br />
|-<br />
| 30203 || [3.0.0+] UnblockDeliveryTask<br />
|-<br />
| 30210 || [9.1.0+] SetDeliveryTaskTimer<br />
|-<br />
| 30300 || [8.0.0+] RegisterSystemApplicationDeliveryTasks<br />
|-<br />
| 90100 || GetDeliveryTaskList<br />
|-<br />
| 90200 || [[#GetDeliveryList]]<br />
|-<br />
| 90201 || [3.0.0+] ClearDeliveryCacheStorage<br />
|-<br />
| 90202 || [8.0.0+] ClearDeliveryTaskSubscriptionStatus<br />
|-<br />
| 90300 || [3.0.0+] GetPushNotificationLog<br />
|}<br />
<br />
=== RequestSyncDeliveryCache ===<br />
No input/output.<br />
<br />
[3.0.0+] Now returns an [[#IDeliveryCacheProgressService]].<br />
<br />
=== RequestSyncDeliveryCacheWithApplicationId ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
[3.0.0+] Now takes an additional 8-bytes of input, and returns an [[#IDeliveryCacheProgressService]].<br />
<br />
=== GetDeliveryCacheStorageUpdateNotifier ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, returns an [[#INotifierService]].<br />
<br />
=== RequestSuspendDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, returns an [[#IDeliveryTaskSuspensionService]].<br />
<br />
=== RegisterSystemApplicationDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
=== UnregisterSystemApplicationDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
=== GetDeliveryList ===<br />
Takes a type-0x6 output buffer, returns a total of 4-bytes of output.<br />
<br />
[3.0.0+] Now takes a total of 8-bytes of input, and returns an additional 4-bytes of output.<br />
<br />
=== IDeliveryCacheProgressService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheProgressService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetEvent<br />
|-<br />
| 1 || GetImpl<br />
|}<br />
<br />
== IDeliveryCacheStorageService ==<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheStorageService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || CreateFileService<br />
|-<br />
| 1 || CreateDirectoryService<br />
|-<br />
| 10 || EnumerateDeliveryCacheDirectory<br />
|}<br />
<br />
=== IDeliveryCacheFileService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheFileService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Open<br />
|-<br />
| 1 || Read<br />
|-<br />
| 2 || GetSize<br />
|-<br />
| 3 || GetDigest<br />
|}<br />
<br />
=== IDeliveryCacheDirectoryService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheDirectoryService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Open<br />
|-<br />
| 1 || Read<br />
|-<br />
| 2 || GetCount<br />
|}<br />
<br />
=== INotifierService ===<br />
This is "nn::bcat::detail::ipc::INotifierService".<br />
<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetEvent || <br />
|}<br />
<br />
=== IDeliveryTaskSuspensionService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryTaskSuspensionService".<br />
<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetEvent || <br />
|}<br />
<br />
= <nowiki>news:a, news:c, news:m, news:p, news:v</nowiki> =<br />
These are <nowiki>"nn::news::detail::ipc::IServiceCreator"</nowiki>.<br />
<br />
On [1.0.0] these are <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>, see [[#INewsService]].<br />
<br />
News entries are fetched from CDN[https://switchbrew.org/wiki/Network#Others].<br />
Metadata for each entry is stored and queried from an internal SQLite database.<br />
Official software uses sqlite[https://www.sqlite.org/download.html] for processing.<br />
<br />
All sessions have 32 sessions.<br />
Permission masks are:<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Name || Mask<br />
|-<br />
| <nowiki>news:a</nowiki> || 0xffffffff<br />
|-<br />
| <nowiki>news:p</nowiki> || 0x1<br />
|-<br />
| <nowiki>news:c</nowiki> || 0x2<br />
|-<br />
| <nowiki>news:v</nowiki> || 0x4<br />
|-<br />
| <nowiki>news:m</nowiki> || 0xd<br />
|}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || CreateNewsService || No input, returns an [[#INewsService]].<br />
|-<br />
| 1 || CreateNewlyArrivedEventHolder || No input, returns an [[#INewlyArrivedEventHolder]].<br />
|-<br />
| 2 || CreateNewsDataService || No input, returns an [[#INewsDataService]].<br />
|-<br />
| 3 || CreateNewsDatabaseService || No input, returns an [[#INewsDatabaseService]].<br />
|-<br />
| 4 || CreateOverwriteEventHolder || No input, returns an [[#IOverwriteEventHolder]].<br />
|}<br />
<br />
CreateNewsDataService and CreateNewsDatabaseService require permission bit 2.<br />
<br />
== INewsService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Required Permission Bits<br />
|-<br />
| 10100 || [[#PostLocalNews]] || 0<br />
|-<br />
| 20100 || SetPassphrase || 1<br />
|-<br />
| 30100 || GetSubscriptionStatus || 1 or 2<br />
|-<br />
| 30101 || [3.0.0+] GetTopicList || 2<br />
|-<br />
| [[#30110]] || [6.0.0+] || 2<br />
|-<br />
| 30200 || [[#IsSystemUpdateRequired]] || 2<br />
|-<br />
| 30201 || [8.0.0+] || 2<br />
|-<br />
| [[#30210]] || [10.0.0+] || 2<br />
|-<br />
| 30300 || RequestImmediateReception || 2<br />
|-<br />
| 30400 || [3.0.0+] DecodeArchiveFile || 2<br />
|-<br />
| [[#30500]] || [8.0.0+] ? || 2<br />
|-<br />
| 30900 || [1.0.0] (No input, returns an [[#INewlyArrivedEventHolder]]) || 2<br />
|-<br />
| 30901 || [1.0.0] (No input, returns an [[#INewsDataService]]) || 2<br />
|-<br />
| 30902 || [1.0.0] (No input, returns an [[#INewsDatabaseService]]) || 2<br />
|-<br />
| 40100 || SetSubscriptionStatus || 1 or 3<br />
|-<br />
| 40101 || [3.0.0+] RequestAutoSubscription || 3<br />
|-<br />
| 40200 || ClearStorage || 3<br />
|-<br />
| 40201 || ClearSubscriptionStatusAll || 1 or 3<br />
|-<br />
| 90100 || [[#GetNewsDatabaseDump]] || 4<br />
|}<br />
<br />
=== PostLocalNews ===<br />
Takes an input buffer msgpack.<br />
<br />
=== 30110 ===<br />
Returns two u64s. Current usage and total size of the news-mounted savedata 0x8000000000000090.<br />
<br />
=== IsSystemUpdateRequired ===<br />
Matches the version in news-sys:/sup.version against the result from system setting news!system_version.<br />
<br />
=== 30210 ===<br />
Returns the Database version retrieved from system setting news!db_version<br />
<br />
=== 30500 ===<br />
Takes a type-0x9 input buffer URL, the size of the transfer memory and a handle for the latter, returns an [[#IUnknown2]].<br />
<br />
=== GetNewsDatabaseDump ===<br />
Dumps internal SQLite file.<br />
<br />
== INewlyArrivedEventHolder ==<br />
This is <nowiki>"nn::news::detail::ipc::INewlyArrivedEventHolder"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|}<br />
<br />
=== Get ===<br />
Returns readable event.<br />
Event is signaled on PostLocalNews or on fetch from CDN if the file doesn't exist.<br />
<br />
== INewsDataService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsDataService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Open]]<br />
|-<br />
| 1 || [[#OpenWithNewsRecordV1]]<br />
|-<br />
| 2 || [[#Read]]<br />
|-<br />
| 3 || [[#GetSize]]<br />
|-<br />
| 1001 || [6.0.0+] [[#OpenWithNewsRecord]]<br />
|}<br />
<br />
=== Open ===<br />
Takes an input string. Opens file with the output of snprintf from <nowiki>"news:/data/%s"</nowiki> with input.<br />
<br />
=== OpenWithNewsRecordV1 ===<br />
Takes an input [[#NewsRecordV1]]. Opens file with the output of snprintf of <nowiki>"news:/data/D00000000000000000000_%s.msgpack"</nowiki> with news_id if user_id is empty or else of <nowiki>"news:/data/U%s_%s.msgpack"</nowiki> with user_id and news_id of input.<br />
<br />
=== Read ===<br />
Read from file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]].<br />
<br />
=== GetSize ===<br />
Get size of file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]].<br />
<br />
=== OpenWithNewsRecord===<br />
Takes an input [[#NewsRecord]]. Same behavior as [[#OpenWithNewsRecordV1]].<br />
<br />
== INewsDatabaseService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsDatabaseService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetListV1<br />
|-<br />
| 1 || Count<br />
|-<br />
| 2 || CountWithKey<br />
|-<br />
| 3 || UpdateIntegerValue<br />
|-<br />
| 4 || UpdateIntegerValueWithAddition<br />
|-<br />
| 5 || UpdateStringValue<br />
|-<br />
| 1000 || [6.0.0+] GetList<br />
|}<br />
<br />
== IOverwriteEventHolder ==<br />
This is <nowiki>"nn::news::detail::ipc::IOverwriteEventHolder"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|}<br />
<br />
=== Get ===<br />
Returns readable event.<br />
Event is signaled on fetch from CDN if the file already exists.<br />
<br />
== IUnknown2 ==<br />
This was added with [8.0.0+].<br />
On creation this object is enqueued and an event is signaled prompting a download from another thread (nn.news.Downloader).<br />
<br />
(Made up names)<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|-<br />
| 1 || [[#Cancel]]<br />
|-<br />
| 2 || [[#GetResult]]<br />
|-<br />
| 3 || [[#GetSize]]<br />
|}<br />
<br />
=== Get ===<br />
Return event handle. Signaled on download finish.<br />
<br />
=== Cancel ===<br />
Cancels Download.<br />
<br />
=== GetResult ===<br />
Returns last result.<br />
<br />
=== GetSize ===<br />
Returns final decoded size. 0 if the result of [[#GetResult]] is not 0 or Download isn't finished/was canceled.<br />
<br />
== NewsDatabase ==<br />
<br />
Internal SQLite database. Has a second version since 6.0.0.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Name<br />
! Type<br />
! Exists<br />
|-<br />
| news_id || TEXT || All<br />
|-<br />
| user_id || TEXT || All<br />
|-<br />
| topic_id || TEXT || All<br />
|-<br />
| application_ids || TEXT || All<br />
|-<br />
| received_at || INTEGER || All<br />
|-<br />
| published_at || INTEGER || All<br />
|-<br />
| expire_at || INTEGER || All<br />
|-<br />
| pickup_limit || INTEGER || All<br />
|-<br />
| essential_pickup_limit || INTEGER || Only V2<br />
|-<br />
| priority || INTEGER || All<br />
|-<br />
| deletion_priority || INTEGER || All<br />
|-<br />
| age_limit || INTEGER || All<br />
|-<br />
| surprise || INTEGER || All<br />
|-<br />
| bashotorya || INTEGER || Only V1<br />
|-<br />
| decoration_type || INTEGER || Only V2<br />
|-<br />
| point || INTEGER || All<br />
|-<br />
| read || INTEGER || All<br />
|-<br />
| newly || INTEGER || All<br />
|-<br />
| displayed || INTEGER || All<br />
|-<br />
| opted_in || INTEGER || All<br />
|-<br />
| point_status || INTEGER || All<br />
|-<br />
| feedback || INTEGER || Only V2<br />
|-<br />
| extra_1 || INTEGER || All<br />
|-<br />
| extra_2 || INTEGER || All<br />
|-<br />
|}<br />
<br />
== NewsRecordV1 ==<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! SQLite association<br />
|-<br />
| 0x0 || 0x18 || TEXT news_id<br />
|-<br />
| 0x18 || 0x18 || TEXT user_id<br />
|-<br />
| 0x30 || 0x8 || INTEGER received_id<br />
|-<br />
| 0x38 || 0x4 || INTEGER news<br />
|-<br />
| 0x3c || 0x4 || INTEGER newly<br />
|-<br />
| 0x40 || 0x4 || INTEGER displayed<br />
|-<br />
| 0x44 || 0x4 || none<br />
|-<br />
|}<br />
<br />
== NewsRecord ==<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! SQLite association<br />
|-<br />
| 0x0 || 0x18 || TEXT news_id<br />
|-<br />
| 0x18 || 0x18 || TEXT user_id<br />
|-<br />
| 0x30 || 0x20 || TEXT topic_id<br />
|-<br />
| 0x50 || 0x8 || INTEGER received_id<br />
|-<br />
| 0x58 || 0x8 || none<br />
|-<br />
| 0x60 || 0x4 || INTEGER decoration_type<br />
|-<br />
| 0x64 || 0x4 || INTEGER read<br />
|-<br />
| 0x68 || 0x4 || INTEGER newly<br />
|-<br />
| 0x6c || 0x4 || INTEGER displayed<br />
|-<br />
| 0x70 || 0x4 || INTEGER feedback<br />
|-<br />
| 0x74 || 0x4 || none<br />
|-<br />
| 0x78 || 0x4 || INTEGER extra_1<br />
|-<br />
| 0x7c || 0x4 || INTEGER extra_2<br />
|-<br />
|}<br />
<br />
= prepo:a, prepo:a2, prepo:m, prepo:u, prepo:s =<br />
These are "nn::prepo::detail::ipc::IPrepoService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || SaveReportOld ([1.0.0-5.1.0] SaveReport)<br />
|-<br />
| 10101 || SaveReportWithUserOld ([1.0.0-5.1.0] SaveReportWithUser)<br />
|-<br />
| 10102 || [6.0.0+] SaveReportOld2 ([1.0.0-9.2.0] SaveReport)<br />
|-<br />
| 10103 || [6.0.0+] SaveReportWithUserOld2 ([1.0.0-9.2.0] SaveReportWithUser)<br />
|-<br />
| 10104 || [10.0.0+] SaveReport<br />
|-<br />
| 10105 || [10.0.0+] SaveReportWithUser<br />
|-<br />
| 10200 || RequestImmediateTransmission<br />
|-<br />
| 10300 || GetTransmissionStatus<br />
|-<br />
| 10400 || [9.0.0+] GetSystemSessionId<br />
|-<br />
| 20100 || SaveSystemReport<br />
|-<br />
| 20101 || SaveSystemReportWithUser<br />
|-<br />
| 20200 || [4.0.0+] SetOperationMode<br />
|-<br />
| 30100 || ClearStorage<br />
|-<br />
| 30200 || [6.0.0+] ClearStatistics<br />
|-<br />
| 30300 || [6.0.0+] GetStorageUsage<br />
|-<br />
| 30400 || [6.0.0+] GetStatistics<br />
|-<br />
| 30401 || [6.0.0+] GetThroughputHistory<br />
|-<br />
| 30500 || [6.0.0+] GetLastUploadError<br />
|-<br />
| 30600 || [10.0.0+] GetApplicationUploadSummary<br />
|-<br />
| 40100 || [2.0.0+] IsUserAgreementCheckEnabled<br />
|-<br />
| 40101 || [2.0.0+] SetUserAgreementCheckEnabled<br />
|-<br />
| 50100 || [10.0.0+] ReadAllApplicationReportFiles<br />
|-<br />
| 90100 || [6.0.0+] ReadAllReportFiles ([1.0.0-5.1.0] GetStorageUsage)<br />
|-<br />
| 90101 || [1.0.0]<br />
|-<br />
| 90102 || [1.0.0] <br />
|-<br />
| 90200 || [5.0.0-5.1.0] GetStatistics<br />
|-<br />
| 90201 || [5.0.0-5.1.0] GetThroughputHistory<br />
|-<br />
| 90300 || [5.0.0-5.1.0] GetLastUploadError<br />
|}<br />
<br />
== Data reporting ==<br />
The "Play Report" (prepo) service uploads system and user information to a cloud server.<br />
This includes the following fields:<br />
sys_info<br />
data<br />
application_id<br />
event_id<br />
operation_mode<br />
lc_recorded_at (followed by a timestamp)<br />
nc_recorded_at (followed by a timestamp)<br />
nsa_id<br />
os_version<br />
<br />
And the contents of the following file:<br />
is_user_agreement_check_enabled.bin<br />
<br />
All the information is periodically uploaded to the following URL:<br><br />
* <nowiki>https://receive-%.dg.srv.nintendo.net/post</nowiki><br />
<br />
It also checks the validity of the device's authentication token using the following URL:<br><br />
* <nowiki>https://dauth-%.ndas.srv.nintendo.net/v1/device_auth_token</nowiki><br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=BCAT_services&diff=10035
BCAT services
2020-10-17T23:59:39Z
<p>Behemoth: </p>
<hr />
<div>BCAT (Background Content Asymmetric synchronized delivery and Transmission) encompasses a set of content download/upload related services.<br />
<br />
= bcat:a, bcat:m, bcat:u, bcat:s =<br />
These are "nn::bcat::detail::ipc::IServiceCreator".<br />
<br />
These were added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || CreateBcatService || Takes an input u64 ProcessId, returns an [[#IBcatService]]<br />
|-<br />
| 1 || CreateDeliveryCacheStorageService || Takes an input u64 ProcessId, returns an [[#IDeliveryCacheStorageService]]<br />
|-<br />
| 2 || CreateDeliveryCacheStorageServiceWithApplicationId || Takes an input u64 TitleId, returns an [[#IDeliveryCacheStorageService]]<br />
|-<br />
| 3 || [2.0.0-2.3.0] CreateDeliveryCacheProgressService || Takes an input u64 ProcessId, returns an [[#IDeliveryCacheProgressService]]<br />
|-<br />
| 4 || [2.0.0-2.3.0] CreateDeliveryCacheProgressServiceWithApplicationId || Takes an input u64 TitleId, returns an [[#IDeliveryCacheProgressService]]<br />
|}<br />
<br />
Equivalent to 3DS BOSS(SpotPass). See [[BCAT_Content_Container|here]] for BCAT-content-container.<br />
<br />
== IBcatService ==<br />
This is "nn::bcat::detail::ipc::IBcatService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || [[#RequestSyncDeliveryCache]]<br />
|-<br />
| 10101 || [5.0.0+] RequestSyncDeliveryCacheWithDirectoryName<br />
|-<br />
| 10200 || [5.0.0+] CancelSyncDeliveryCacheRequest<br />
|-<br />
| 20100 || [[#RequestSyncDeliveryCacheWithApplicationId]]<br />
|-<br />
| 20101 || [5.0.0+] RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName<br />
|-<br />
| 20300 || [8.0.0+] [[#GetDeliveryCacheStorageUpdateNotifier]]<br />
|-<br />
| 20301 || [8.0.0+] [[#RequestSuspendDeliveryTask]]<br />
|-<br />
| 20400 || [9.0.0+] [[#RegisterSystemApplicationDeliveryTask]]<br />
|-<br />
| 20401 || [9.0.0+] [[#UnregisterSystemApplicationDeliveryTask]]<br />
|-<br />
| 20410 || [9.1.0+] SetSystemApplicationDeliveryTaskTimer<br />
|-<br />
| 30100 || SetPassphrase<br />
|-<br />
| 30101 || [2.0.0-2.3.0] <br />
|-<br />
| 30102 || [2.0.0-2.3.0] <br />
|-<br />
| 30200 || [3.0.0+] RegisterDeliveryTask<br />
|-<br />
| 30201 || [3.0.0+] UnregisterDeliveryTask<br />
|-<br />
| 30202 || [3.0.0+] BlockDeliveryTask<br />
|-<br />
| 30203 || [3.0.0+] UnblockDeliveryTask<br />
|-<br />
| 30210 || [9.1.0+] SetDeliveryTaskTimer<br />
|-<br />
| 30300 || [8.0.0+] RegisterSystemApplicationDeliveryTasks<br />
|-<br />
| 90100 || GetDeliveryTaskList<br />
|-<br />
| 90200 || [[#GetDeliveryList]]<br />
|-<br />
| 90201 || [3.0.0+] ClearDeliveryCacheStorage<br />
|-<br />
| 90202 || [8.0.0+] ClearDeliveryTaskSubscriptionStatus<br />
|-<br />
| 90300 || [3.0.0+] GetPushNotificationLog<br />
|}<br />
<br />
=== RequestSyncDeliveryCache ===<br />
No input/output.<br />
<br />
[3.0.0+] Now returns an [[#IDeliveryCacheProgressService]].<br />
<br />
=== RequestSyncDeliveryCacheWithApplicationId ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
[3.0.0+] Now takes an additional 8-bytes of input, and returns an [[#IDeliveryCacheProgressService]].<br />
<br />
=== GetDeliveryCacheStorageUpdateNotifier ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, returns an [[#INotifierService]].<br />
<br />
=== RequestSuspendDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, returns an [[#IDeliveryTaskSuspensionService]].<br />
<br />
=== RegisterSystemApplicationDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
=== UnregisterSystemApplicationDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
=== GetDeliveryList ===<br />
Takes a type-0x6 output buffer, returns a total of 4-bytes of output.<br />
<br />
[3.0.0+] Now takes a total of 8-bytes of input, and returns an additional 4-bytes of output.<br />
<br />
=== IDeliveryCacheProgressService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheProgressService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetEvent<br />
|-<br />
| 1 || GetImpl<br />
|}<br />
<br />
== IDeliveryCacheStorageService ==<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheStorageService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || CreateFileService<br />
|-<br />
| 1 || CreateDirectoryService<br />
|-<br />
| 10 || EnumerateDeliveryCacheDirectory<br />
|}<br />
<br />
=== IDeliveryCacheFileService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheFileService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Open<br />
|-<br />
| 1 || Read<br />
|-<br />
| 2 || GetSize<br />
|-<br />
| 3 || GetDigest<br />
|}<br />
<br />
=== IDeliveryCacheDirectoryService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheDirectoryService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Open<br />
|-<br />
| 1 || Read<br />
|-<br />
| 2 || GetCount<br />
|}<br />
<br />
=== INotifierService ===<br />
This is "nn::bcat::detail::ipc::INotifierService".<br />
<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetEvent || <br />
|}<br />
<br />
=== IDeliveryTaskSuspensionService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryTaskSuspensionService".<br />
<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetEvent || <br />
|}<br />
<br />
= <nowiki>news:a, news:c, news:m, news:p, news:v</nowiki> =<br />
These are <nowiki>"nn::news::detail::ipc::IServiceCreator"</nowiki>.<br />
<br />
On [1.0.0] these are <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>, see [[#INewsService]].<br />
<br />
News entries are fetched from CDN[https://switchbrew.org/wiki/Network#Others].<br />
Metadata for each entry is stored and queried from an internal SQLite database.<br />
Official software uses sqlite[https://www.sqlite.org/download.html] for processing.<br />
<br />
All sessions have 32 sessions.<br />
Permission masks are:<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Name || Mask<br />
|-<br />
| <nowiki>news:a</nowiki> || 0xffffffff<br />
|-<br />
| <nowiki>news:p</nowiki> || 0x1<br />
|-<br />
| <nowiki>news:c</nowiki> || 0x2<br />
|-<br />
| <nowiki>news:v</nowiki> || 0x4<br />
|-<br />
| <nowiki>news:m</nowiki> || 0xd<br />
|}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || CreateNewsService || No input, returns an [[#INewsService]].<br />
|-<br />
| 1 || CreateNewlyArrivedEventHolder || No input, returns an [[#INewlyArrivedEventHolder]].<br />
|-<br />
| 2 || CreateNewsDataService || No input, returns an [[#INewsDataService]].<br />
|-<br />
| 3 || CreateNewsDatabaseService || No input, returns an [[#INewsDatabaseService]].<br />
|-<br />
| 4 || CreateOverwriteEventHolder || No input, returns an [[#IOverwriteEventHolder]].<br />
|}<br />
<br />
CreateNewsDataService and CreateNewsDatabaseService require permission bit 2.<br />
<br />
== INewsService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Required Permission Bits<br />
|-<br />
| 10100 || [[#PostLocalNews]] || 0<br />
|-<br />
| 20100 || SetPassphrase || 1<br />
|-<br />
| 30100 || GetSubscriptionStatus || 1 or 2<br />
|-<br />
| 30101 || [3.0.0+] GetTopicList || 2<br />
|-<br />
| [[#30110]] || [6.0.0+] || 2<br />
|-<br />
| 30200 || [[#IsSystemUpdateRequired]] || 2<br />
|-<br />
| 30201 || [8.0.0+] || 2<br />
|-<br />
| [[#30210]] || [10.0.0+] || 2<br />
|-<br />
| 30300 || RequestImmediateReception || 2<br />
|-<br />
| 30400 || [3.0.0+] DecodeArchiveFile || 2<br />
|-<br />
| 30500 || [8.0.0+] ? (Takes a total of 8-bytes of input, a handle, and a type-0x9 input buffer, returns an [[#IUnknown2]]) || 2<br />
|-<br />
| 30900 || [1.0.0] (No input, returns an [[#INewlyArrivedEventHolder]]) || 2<br />
|-<br />
| 30901 || [1.0.0] (No input, returns an [[#INewsDataService]]) || 2<br />
|-<br />
| 30902 || [1.0.0] (No input, returns an [[#INewsDatabaseService]]) || 2<br />
|-<br />
| 40100 || SetSubscriptionStatus || 1 or 3<br />
|-<br />
| 40101 || [3.0.0+] RequestAutoSubscription || 3<br />
|-<br />
| 40200 || ClearStorage || 3<br />
|-<br />
| 40201 || ClearSubscriptionStatusAll || 1 or 3<br />
|-<br />
| 90100 || [[#GetNewsDatabaseDump]] || 4<br />
|}<br />
<br />
=== PostLocalNews ===<br />
Takes an input buffer msgpack.<br />
<br />
=== 30110 ===<br />
Returns two u64s. Current usage and total size of the news-mounted savedata 0x8000000000000090.<br />
<br />
=== IsSystemUpdateRequired ===<br />
Matches the version in news-sys:/sup.version against the result from system setting news!system_version.<br />
<br />
=== 30210 ===<br />
Returns the Database version retrieved from system setting news!db_version<br />
<br />
=== GetNewsDatabaseDump ===<br />
Dumps internal SQLite file.<br />
<br />
== INewlyArrivedEventHolder ==<br />
This is <nowiki>"nn::news::detail::ipc::INewlyArrivedEventHolder"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|}<br />
<br />
=== Get ===<br />
Returns readable event.<br />
Event is signaled on PostLocalNews or on fetch from CDN if the file doesn't exist.<br />
<br />
== INewsDataService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsDataService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Open]]<br />
|-<br />
| 1 || [[#OpenWithNewsRecordV1]]<br />
|-<br />
| 2 || [[#Read]]<br />
|-<br />
| 3 || [[#GetSize]]<br />
|-<br />
| 1001 || [6.0.0+] [[#OpenWithNewsRecord]]<br />
|}<br />
<br />
=== Open ===<br />
Takes an input string. Opens file with the output of snprintf from <nowiki>"news:/data/%s"</nowiki> with input.<br />
<br />
=== OpenWithNewsRecordV1 ===<br />
Takes an input [[#NewsRecordV1]]. Opens file with the output of snprintf of <nowiki>"news:/data/D00000000000000000000_%s.msgpack"</nowiki> with news_id if user_id is empty or else of <nowiki>"news:/data/U%s_%s.msgpack"</nowiki> with user_id and news_id of input.<br />
<br />
=== Read ===<br />
Read from file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]].<br />
<br />
=== GetSize ===<br />
Get size of file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]].<br />
<br />
=== OpenWithNewsRecord===<br />
Takes an input [[#NewsRecord]]. Same behavior as [[#OpenWithNewsRecordV1]].<br />
<br />
== INewsDatabaseService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsDatabaseService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetListV1<br />
|-<br />
| 1 || Count<br />
|-<br />
| 2 || CountWithKey<br />
|-<br />
| 3 || UpdateIntegerValue<br />
|-<br />
| 4 || UpdateIntegerValueWithAddition<br />
|-<br />
| 5 || UpdateStringValue<br />
|-<br />
| 1000 || [6.0.0+] GetList<br />
|}<br />
<br />
== IOverwriteEventHolder ==<br />
This is <nowiki>"nn::news::detail::ipc::IOverwriteEventHolder"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|}<br />
<br />
=== Get ===<br />
Returns readable event.<br />
Event is signaled on fetch from CDN if the file already exists.<br />
<br />
== IUnknown2 ==<br />
This was added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || <br />
|-<br />
| 1 || <br />
|-<br />
| 2 || <br />
|-<br />
| 3 || <br />
|}<br />
<br />
== NewsDatabase ==<br />
<br />
Internal SQLite database. Has a second version since 6.0.0.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Name<br />
! Type<br />
! Exists<br />
|-<br />
| news_id || TEXT || All<br />
|-<br />
| user_id || TEXT || All<br />
|-<br />
| topic_id || TEXT || All<br />
|-<br />
| application_ids || TEXT || All<br />
|-<br />
| received_at || INTEGER || All<br />
|-<br />
| published_at || INTEGER || All<br />
|-<br />
| expire_at || INTEGER || All<br />
|-<br />
| pickup_limit || INTEGER || All<br />
|-<br />
| essential_pickup_limit || INTEGER || Only V2<br />
|-<br />
| priority || INTEGER || All<br />
|-<br />
| deletion_priority || INTEGER || All<br />
|-<br />
| age_limit || INTEGER || All<br />
|-<br />
| surprise || INTEGER || All<br />
|-<br />
| bashotorya || INTEGER || Only V1<br />
|-<br />
| decoration_type || INTEGER || Only V2<br />
|-<br />
| point || INTEGER || All<br />
|-<br />
| read || INTEGER || All<br />
|-<br />
| newly || INTEGER || All<br />
|-<br />
| displayed || INTEGER || All<br />
|-<br />
| opted_in || INTEGER || All<br />
|-<br />
| point_status || INTEGER || All<br />
|-<br />
| feedback || INTEGER || Only V2<br />
|-<br />
| extra_1 || INTEGER || All<br />
|-<br />
| extra_2 || INTEGER || All<br />
|-<br />
|}<br />
<br />
== NewsRecordV1 ==<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! SQLite association<br />
|-<br />
| 0x0 || 0x18 || TEXT news_id<br />
|-<br />
| 0x18 || 0x18 || TEXT user_id<br />
|-<br />
| 0x30 || 0x8 || INTEGER received_id<br />
|-<br />
| 0x38 || 0x4 || INTEGER news<br />
|-<br />
| 0x3c || 0x4 || INTEGER newly<br />
|-<br />
| 0x40 || 0x4 || INTEGER displayed<br />
|-<br />
| 0x44 || 0x4 || none<br />
|-<br />
|}<br />
<br />
== NewsRecord ==<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! SQLite association<br />
|-<br />
| 0x0 || 0x18 || TEXT news_id<br />
|-<br />
| 0x18 || 0x18 || TEXT user_id<br />
|-<br />
| 0x30 || 0x20 || TEXT topic_id<br />
|-<br />
| 0x50 || 0x8 || INTEGER received_id<br />
|-<br />
| 0x58 || 0x8 || none<br />
|-<br />
| 0x60 || 0x4 || INTEGER decoration_type<br />
|-<br />
| 0x64 || 0x4 || INTEGER read<br />
|-<br />
| 0x68 || 0x4 || INTEGER newly<br />
|-<br />
| 0x6c || 0x4 || INTEGER displayed<br />
|-<br />
| 0x70 || 0x4 || INTEGER feedback<br />
|-<br />
| 0x74 || 0x4 || none<br />
|-<br />
| 0x78 || 0x4 || INTEGER extra_1<br />
|-<br />
| 0x7c || 0x4 || INTEGER extra_2<br />
|-<br />
|}<br />
<br />
= prepo:a, prepo:a2, prepo:m, prepo:u, prepo:s =<br />
These are "nn::prepo::detail::ipc::IPrepoService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || SaveReportOld ([1.0.0-5.1.0] SaveReport)<br />
|-<br />
| 10101 || SaveReportWithUserOld ([1.0.0-5.1.0] SaveReportWithUser)<br />
|-<br />
| 10102 || [6.0.0+] SaveReportOld2 ([1.0.0-9.2.0] SaveReport)<br />
|-<br />
| 10103 || [6.0.0+] SaveReportWithUserOld2 ([1.0.0-9.2.0] SaveReportWithUser)<br />
|-<br />
| 10104 || [10.0.0+] SaveReport<br />
|-<br />
| 10105 || [10.0.0+] SaveReportWithUser<br />
|-<br />
| 10200 || RequestImmediateTransmission<br />
|-<br />
| 10300 || GetTransmissionStatus<br />
|-<br />
| 10400 || [9.0.0+] GetSystemSessionId<br />
|-<br />
| 20100 || SaveSystemReport<br />
|-<br />
| 20101 || SaveSystemReportWithUser<br />
|-<br />
| 20200 || [4.0.0+] SetOperationMode<br />
|-<br />
| 30100 || ClearStorage<br />
|-<br />
| 30200 || [6.0.0+] ClearStatistics<br />
|-<br />
| 30300 || [6.0.0+] GetStorageUsage<br />
|-<br />
| 30400 || [6.0.0+] GetStatistics<br />
|-<br />
| 30401 || [6.0.0+] GetThroughputHistory<br />
|-<br />
| 30500 || [6.0.0+] GetLastUploadError<br />
|-<br />
| 30600 || [10.0.0+] GetApplicationUploadSummary<br />
|-<br />
| 40100 || [2.0.0+] IsUserAgreementCheckEnabled<br />
|-<br />
| 40101 || [2.0.0+] SetUserAgreementCheckEnabled<br />
|-<br />
| 50100 || [10.0.0+] ReadAllApplicationReportFiles<br />
|-<br />
| 90100 || [6.0.0+] ReadAllReportFiles ([1.0.0-5.1.0] GetStorageUsage)<br />
|-<br />
| 90101 || [1.0.0]<br />
|-<br />
| 90102 || [1.0.0] <br />
|-<br />
| 90200 || [5.0.0-5.1.0] GetStatistics<br />
|-<br />
| 90201 || [5.0.0-5.1.0] GetThroughputHistory<br />
|-<br />
| 90300 || [5.0.0-5.1.0] GetLastUploadError<br />
|}<br />
<br />
== Data reporting ==<br />
The "Play Report" (prepo) service uploads system and user information to a cloud server.<br />
This includes the following fields:<br />
sys_info<br />
data<br />
application_id<br />
event_id<br />
operation_mode<br />
lc_recorded_at (followed by a timestamp)<br />
nc_recorded_at (followed by a timestamp)<br />
nsa_id<br />
os_version<br />
<br />
And the contents of the following file:<br />
is_user_agreement_check_enabled.bin<br />
<br />
All the information is periodically uploaded to the following URL:<br><br />
* <nowiki>https://receive-%.dg.srv.nintendo.net/post</nowiki><br />
<br />
It also checks the validity of the device's authentication token using the following URL:<br><br />
* <nowiki>https://dauth-%.ndas.srv.nintendo.net/v1/device_auth_token</nowiki><br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=BCAT_services&diff=10030
BCAT services
2020-10-17T14:18:53Z
<p>Behemoth: /* INewsDataService */ Fix links</p>
<hr />
<div>BCAT (Background Content Asymmetric synchronized delivery and Transmission) encompasses a set of content download/upload related services.<br />
<br />
= bcat:a, bcat:m, bcat:u, bcat:s =<br />
These are "nn::bcat::detail::ipc::IServiceCreator".<br />
<br />
These were added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || CreateBcatService || Takes an input u64 ProcessId, returns an [[#IBcatService]]<br />
|-<br />
| 1 || CreateDeliveryCacheStorageService || Takes an input u64 ProcessId, returns an [[#IDeliveryCacheStorageService]]<br />
|-<br />
| 2 || CreateDeliveryCacheStorageServiceWithApplicationId || Takes an input u64 TitleId, returns an [[#IDeliveryCacheStorageService]]<br />
|-<br />
| 3 || [2.0.0-2.3.0] CreateDeliveryCacheProgressService || Takes an input u64 ProcessId, returns an [[#IDeliveryCacheProgressService]]<br />
|-<br />
| 4 || [2.0.0-2.3.0] CreateDeliveryCacheProgressServiceWithApplicationId || Takes an input u64 TitleId, returns an [[#IDeliveryCacheProgressService]]<br />
|}<br />
<br />
Equivalent to 3DS BOSS(SpotPass). See [[BCAT_Content_Container|here]] for BCAT-content-container.<br />
<br />
== IBcatService ==<br />
This is "nn::bcat::detail::ipc::IBcatService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || [[#RequestSyncDeliveryCache]]<br />
|-<br />
| 10101 || [5.0.0+] RequestSyncDeliveryCacheWithDirectoryName<br />
|-<br />
| 10200 || [5.0.0+] CancelSyncDeliveryCacheRequest<br />
|-<br />
| 20100 || [[#RequestSyncDeliveryCacheWithApplicationId]]<br />
|-<br />
| 20101 || [5.0.0+] RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName<br />
|-<br />
| 20300 || [8.0.0+] [[#GetDeliveryCacheStorageUpdateNotifier]]<br />
|-<br />
| 20301 || [8.0.0+] [[#RequestSuspendDeliveryTask]]<br />
|-<br />
| 20400 || [9.0.0+] [[#RegisterSystemApplicationDeliveryTask]]<br />
|-<br />
| 20401 || [9.0.0+] [[#UnregisterSystemApplicationDeliveryTask]]<br />
|-<br />
| 20410 || [9.1.0+] SetSystemApplicationDeliveryTaskTimer<br />
|-<br />
| 30100 || SetPassphrase<br />
|-<br />
| 30101 || [2.0.0-2.3.0] <br />
|-<br />
| 30102 || [2.0.0-2.3.0] <br />
|-<br />
| 30200 || [3.0.0+] RegisterDeliveryTask<br />
|-<br />
| 30201 || [3.0.0+] UnregisterDeliveryTask<br />
|-<br />
| 30202 || [3.0.0+] BlockDeliveryTask<br />
|-<br />
| 30203 || [3.0.0+] UnblockDeliveryTask<br />
|-<br />
| 30210 || [9.1.0+] SetDeliveryTaskTimer<br />
|-<br />
| 30300 || [8.0.0+] RegisterSystemApplicationDeliveryTasks<br />
|-<br />
| 90100 || GetDeliveryTaskList<br />
|-<br />
| 90200 || [[#GetDeliveryList]]<br />
|-<br />
| 90201 || [3.0.0+] ClearDeliveryCacheStorage<br />
|-<br />
| 90202 || [8.0.0+] ClearDeliveryTaskSubscriptionStatus<br />
|-<br />
| 90300 || [3.0.0+] GetPushNotificationLog<br />
|}<br />
<br />
=== RequestSyncDeliveryCache ===<br />
No input/output.<br />
<br />
[3.0.0+] Now returns an [[#IDeliveryCacheProgressService]].<br />
<br />
=== RequestSyncDeliveryCacheWithApplicationId ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
[3.0.0+] Now takes an additional 8-bytes of input, and returns an [[#IDeliveryCacheProgressService]].<br />
<br />
=== GetDeliveryCacheStorageUpdateNotifier ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, returns an [[#INotifierService]].<br />
<br />
=== RequestSuspendDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, returns an [[#IDeliveryTaskSuspensionService]].<br />
<br />
=== RegisterSystemApplicationDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
=== UnregisterSystemApplicationDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
=== GetDeliveryList ===<br />
Takes a type-0x6 output buffer, returns a total of 4-bytes of output.<br />
<br />
[3.0.0+] Now takes a total of 8-bytes of input, and returns an additional 4-bytes of output.<br />
<br />
=== IDeliveryCacheProgressService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheProgressService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetEvent<br />
|-<br />
| 1 || GetImpl<br />
|}<br />
<br />
== IDeliveryCacheStorageService ==<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheStorageService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || CreateFileService<br />
|-<br />
| 1 || CreateDirectoryService<br />
|-<br />
| 10 || EnumerateDeliveryCacheDirectory<br />
|}<br />
<br />
=== IDeliveryCacheFileService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheFileService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Open<br />
|-<br />
| 1 || Read<br />
|-<br />
| 2 || GetSize<br />
|-<br />
| 3 || GetDigest<br />
|}<br />
<br />
=== IDeliveryCacheDirectoryService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheDirectoryService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Open<br />
|-<br />
| 1 || Read<br />
|-<br />
| 2 || GetCount<br />
|}<br />
<br />
=== INotifierService ===<br />
This is "nn::bcat::detail::ipc::INotifierService".<br />
<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetEvent || <br />
|}<br />
<br />
=== IDeliveryTaskSuspensionService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryTaskSuspensionService".<br />
<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetEvent || <br />
|}<br />
<br />
= <nowiki>news:a, news:c, news:m, news:p, news:v</nowiki> =<br />
These are <nowiki>"nn::news::detail::ipc::IServiceCreator"</nowiki>.<br />
<br />
On [1.0.0] these are <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>, see [[#INewsService]].<br />
<br />
News entries are fetched from CDN[https://switchbrew.org/wiki/Network#Others].<br />
Metadata for each entry is stored and queried from an internal SQLite database.<br />
Official software uses sqlite[https://www.sqlite.org/download.html] for processing.<br />
<br />
All sessions have 32 sessions.<br />
Permission masks are:<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Name || Mask<br />
|-<br />
| <nowiki>news:a</nowiki> || 0xffffffff<br />
|-<br />
| <nowiki>news:p</nowiki> || 0x1<br />
|-<br />
| <nowiki>news:c</nowiki> || 0x2<br />
|-<br />
| <nowiki>news:v</nowiki> || 0x4<br />
|-<br />
| <nowiki>news:m</nowiki> || 0xd<br />
|}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || CreateNewsService || No input, returns an [[#INewsService]].<br />
|-<br />
| 1 || CreateNewlyArrivedEventHolder || No input, returns an [[#INewlyArrivedEventHolder]].<br />
|-<br />
| 2 || CreateNewsDataService || No input, returns an [[#INewsDataService]].<br />
|-<br />
| 3 || CreateNewsDatabaseService || No input, returns an [[#INewsDatabaseService]].<br />
|-<br />
| 4 || CreateOverwriteEventHolder || No input, returns an [[#IOverwriteEventHolder]].<br />
|}<br />
<br />
CreateNewsDataService and CreateNewsDatabaseService require permission bit 2.<br />
<br />
== INewsService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Required Permission Bits<br />
|-<br />
| 10100 || [[#PostLocalNews]] || 0<br />
|-<br />
| 20100 || SetPassphrase || 1<br />
|-<br />
| 30100 || GetSubscriptionStatus || 1 or 2<br />
|-<br />
| 30101 || [3.0.0+] GetTopicList || 2<br />
|-<br />
| [[#30110]] || [6.0.0+] || 2<br />
|-<br />
| 30200 || [[#IsSystemUpdateRequired]] || 2<br />
|-<br />
| 30201 || [8.0.0+] || 2<br />
|-<br />
| [[#30210]] || [10.0.0+] || 2<br />
|-<br />
| 30300 || RequestImmediateReception || 2<br />
|-<br />
| 30400 || [3.0.0+] DecodeArchiveFile || 2<br />
|-<br />
| 30500 || [8.0.0+] ? (Takes a total of 8-bytes of input, a handle, and a type-0x9 input buffer, returns an [[#IUnknown2]]) || 2<br />
|-<br />
| 30900 || [1.0.0] (No input, returns an [[#INewlyArrivedEventHolder]]) || 2<br />
|-<br />
| 30901 || [1.0.0] (No input, returns an [[#INewsDataService]]) || 2<br />
|-<br />
| 30902 || [1.0.0] (No input, returns an [[#INewsDatabaseService]]) || 2<br />
|-<br />
| 40100 || SetSubscriptionStatus || 1 or 3<br />
|-<br />
| 40101 || [3.0.0+] RequestAutoSubscription || 3<br />
|-<br />
| 40200 || ClearStorage || 3<br />
|-<br />
| 40201 || ClearSubscriptionStatusAll || 1 or 3<br />
|-<br />
| 90100 || [[#GetNewsDatabaseDump]] || 4<br />
|}<br />
<br />
=== PostLocalNews ===<br />
Takes an input buffer msgpack.<br />
<br />
=== 30110 ===<br />
Returns two u64s. Current usage and total size of the news-mounted savedata 0x8000000000000090.<br />
<br />
=== IsSystemUpdateRequired ===<br />
Matches the version in news-sys:/sup.version against the result from system setting news!system_version.<br />
<br />
=== 30210 ===<br />
Returns the Database version retrieved from system setting news!db_version<br />
<br />
=== GetNewsDatabaseDump ===<br />
Dumps internal SQLite file.<br />
<br />
== INewlyArrivedEventHolder ==<br />
This is <nowiki>"nn::news::detail::ipc::INewlyArrivedEventHolder"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|}<br />
<br />
=== Get ===<br />
Returns readable event.<br />
Event is signaled on PostLocalNews or on fetch from CDN if the file doesn't exist.<br />
<br />
== INewsDataService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsDataService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Open]]<br />
|-<br />
| 1 || [[#OpenWithNewsRecordV1]]<br />
|-<br />
| 2 || [[#Read]]<br />
|-<br />
| 3 || [[#GetSize]]<br />
|-<br />
| 1001 || [6.0.0+] [[#OpenWithNewsRecord]]<br />
|}<br />
<br />
=== Open ===<br />
Takes an input string. Opens file with the output of snprintf from <nowiki>"news:/data/%s"</nowiki> with input.<br />
<br />
=== OpenWithNewsRecordV1 ===<br />
Takes an input [[#NewsRecordV1]]. Opens file with the output of snprintf of <nowiki>"news:/data/D00000000000000000000_%s.msgpack"</nowiki> with news_id if user_id is empty or else of <nowiki>"news:/data/U%s_%s.msgpack"</nowiki> with user_id and news_id of input.<br />
<br />
=== Read ===<br />
Read from file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]].<br />
<br />
=== GetSize ===<br />
Get size of file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]].<br />
<br />
=== OpenWithNewsRecord===<br />
Takes an input [[#NewsRecord]]. Same behavior as [[#OpenWithNewsRecordV1]].<br />
<br />
== INewsDatabaseService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsDatabaseService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetListV1<br />
|-<br />
| 1 || Count<br />
|-<br />
| 2 || CountWithKey<br />
|-<br />
| 3 || UpdateIntegerValue<br />
|-<br />
| 4 || UpdateIntegerValueWithAddition<br />
|-<br />
| 5 || UpdateStringValue<br />
|-<br />
| 1000 || [6.0.0+] GetList<br />
|}<br />
<br />
== IOverwriteEventHolder ==<br />
This is <nowiki>"nn::news::detail::ipc::IOverwriteEventHolder"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|}<br />
<br />
=== Get ===<br />
Returns readable event.<br />
Event is signaled on fetch from CDN if the file already exists.<br />
<br />
== IUnknown2 ==<br />
This was added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || <br />
|-<br />
| 1 || <br />
|-<br />
| 2 || <br />
|-<br />
| 3 || <br />
|}<br />
<br />
= NewsDatabase =<br />
<br />
Internal SQLite database. Has a second version since 6.0.0.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Name<br />
! Type<br />
! Exists<br />
|-<br />
| news_id || TEXT || All<br />
|-<br />
| user_id || TEXT || All<br />
|-<br />
| topic_id || TEXT || All<br />
|-<br />
| application_ids || TEXT || All<br />
|-<br />
| received_at || INTEGER || All<br />
|-<br />
| published_at || INTEGER || All<br />
|-<br />
| expire_at || INTEGER || All<br />
|-<br />
| pickup_limit || INTEGER || All<br />
|-<br />
| essential_pickup_limit || INTEGER || Only V2<br />
|-<br />
| priority || INTEGER || All<br />
|-<br />
| deletion_priority || INTEGER || All<br />
|-<br />
| age_limit || INTEGER || All<br />
|-<br />
| surprise || INTEGER || All<br />
|-<br />
| bashotorya || INTEGER || Only V1<br />
|-<br />
| decoration_type || INTEGER || Only V2<br />
|-<br />
| point || INTEGER || All<br />
|-<br />
| read || INTEGER || All<br />
|-<br />
| newly || INTEGER || All<br />
|-<br />
| displayed || INTEGER || All<br />
|-<br />
| opted_in || INTEGER || All<br />
|-<br />
| point_status || INTEGER || All<br />
|-<br />
| feedback || INTEGER || Only V2<br />
|-<br />
| extra_1 || INTEGER || All<br />
|-<br />
| extra_2 || INTEGER || All<br />
|-<br />
|}<br />
<br />
= NewsRecordV1 =<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! SQLite association<br />
|-<br />
| 0x0 || 0x18 || TEXT news_id<br />
|-<br />
| 0x18 || 0x18 || TEXT user_id<br />
|-<br />
| 0x30 || 0x8 || INTEGER received_id<br />
|-<br />
| 0x38 || 0x4 || INTEGER news<br />
|-<br />
| 0x3c || 0x4 || INTEGER newly<br />
|-<br />
| 0x40 || 0x4 || INTEGER displayed<br />
|-<br />
| 0x44 || 0x4 || none<br />
|-<br />
|}<br />
<br />
= NewsRecord =<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! SQLite association<br />
|-<br />
| 0x0 || 0x18 || TEXT news_id<br />
|-<br />
| 0x18 || 0x18 || TEXT user_id<br />
|-<br />
| 0x30 || 0x20 || TEXT topic_id<br />
|-<br />
| 0x50 || 0x8 || INTEGER received_id<br />
|-<br />
| 0x58 || 0x8 || none<br />
|-<br />
| 0x60 || 0x4 || INTEGER decoration_type<br />
|-<br />
| 0x64 || 0x4 || INTEGER read<br />
|-<br />
| 0x68 || 0x4 || INTEGER newly<br />
|-<br />
| 0x6c || 0x4 || INTEGER displayed<br />
|-<br />
| 0x70 || 0x4 || INTEGER feedback<br />
|-<br />
| 0x74 || 0x4 || none<br />
|-<br />
| 0x78 || 0x4 || INTEGER extra_1<br />
|-<br />
| 0x7c || 0x4 || INTEGER extra_2<br />
|-<br />
|}<br />
<br />
= prepo:a, prepo:a2, prepo:m, prepo:u, prepo:s =<br />
These are "nn::prepo::detail::ipc::IPrepoService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || SaveReportOld ([1.0.0-5.1.0] SaveReport)<br />
|-<br />
| 10101 || SaveReportWithUserOld ([1.0.0-5.1.0] SaveReportWithUser)<br />
|-<br />
| 10102 || [6.0.0+] SaveReportOld2 ([1.0.0-9.2.0] SaveReport)<br />
|-<br />
| 10103 || [6.0.0+] SaveReportWithUserOld2 ([1.0.0-9.2.0] SaveReportWithUser)<br />
|-<br />
| 10104 || [10.0.0+] SaveReport<br />
|-<br />
| 10105 || [10.0.0+] SaveReportWithUser<br />
|-<br />
| 10200 || RequestImmediateTransmission<br />
|-<br />
| 10300 || GetTransmissionStatus<br />
|-<br />
| 10400 || [9.0.0+] GetSystemSessionId<br />
|-<br />
| 20100 || SaveSystemReport<br />
|-<br />
| 20101 || SaveSystemReportWithUser<br />
|-<br />
| 20200 || [4.0.0+] SetOperationMode<br />
|-<br />
| 30100 || ClearStorage<br />
|-<br />
| 30200 || [6.0.0+] ClearStatistics<br />
|-<br />
| 30300 || [6.0.0+] GetStorageUsage<br />
|-<br />
| 30400 || [6.0.0+] GetStatistics<br />
|-<br />
| 30401 || [6.0.0+] GetThroughputHistory<br />
|-<br />
| 30500 || [6.0.0+] GetLastUploadError<br />
|-<br />
| 30600 || [10.0.0+] GetApplicationUploadSummary<br />
|-<br />
| 40100 || [2.0.0+] IsUserAgreementCheckEnabled<br />
|-<br />
| 40101 || [2.0.0+] SetUserAgreementCheckEnabled<br />
|-<br />
| 50100 || [10.0.0+] ReadAllApplicationReportFiles<br />
|-<br />
| 90100 || [6.0.0+] ReadAllReportFiles ([1.0.0-5.1.0] GetStorageUsage)<br />
|-<br />
| 90101 || [1.0.0]<br />
|-<br />
| 90102 || [1.0.0] <br />
|-<br />
| 90200 || [5.0.0-5.1.0] GetStatistics<br />
|-<br />
| 90201 || [5.0.0-5.1.0] GetThroughputHistory<br />
|-<br />
| 90300 || [5.0.0-5.1.0] GetLastUploadError<br />
|}<br />
<br />
== Data reporting ==<br />
The "Play Report" (prepo) service uploads system and user information to a cloud server.<br />
This includes the following fields:<br />
sys_info<br />
data<br />
application_id<br />
event_id<br />
operation_mode<br />
lc_recorded_at (followed by a timestamp)<br />
nc_recorded_at (followed by a timestamp)<br />
nsa_id<br />
os_version<br />
<br />
And the contents of the following file:<br />
is_user_agreement_check_enabled.bin<br />
<br />
All the information is periodically uploaded to the following URL:<br><br />
* <nowiki>https://receive-%.dg.srv.nintendo.net/post</nowiki><br />
<br />
It also checks the validity of the device's authentication token using the following URL:<br><br />
* <nowiki>https://dauth-%.ndas.srv.nintendo.net/v1/device_auth_token</nowiki><br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=BCAT_services&diff=10029
BCAT services
2020-10-17T14:16:56Z
<p>Behemoth: News: add permission masks</p>
<hr />
<div>BCAT (Background Content Asymmetric synchronized delivery and Transmission) encompasses a set of content download/upload related services.<br />
<br />
= bcat:a, bcat:m, bcat:u, bcat:s =<br />
These are "nn::bcat::detail::ipc::IServiceCreator".<br />
<br />
These were added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || CreateBcatService || Takes an input u64 ProcessId, returns an [[#IBcatService]]<br />
|-<br />
| 1 || CreateDeliveryCacheStorageService || Takes an input u64 ProcessId, returns an [[#IDeliveryCacheStorageService]]<br />
|-<br />
| 2 || CreateDeliveryCacheStorageServiceWithApplicationId || Takes an input u64 TitleId, returns an [[#IDeliveryCacheStorageService]]<br />
|-<br />
| 3 || [2.0.0-2.3.0] CreateDeliveryCacheProgressService || Takes an input u64 ProcessId, returns an [[#IDeliveryCacheProgressService]]<br />
|-<br />
| 4 || [2.0.0-2.3.0] CreateDeliveryCacheProgressServiceWithApplicationId || Takes an input u64 TitleId, returns an [[#IDeliveryCacheProgressService]]<br />
|}<br />
<br />
Equivalent to 3DS BOSS(SpotPass). See [[BCAT_Content_Container|here]] for BCAT-content-container.<br />
<br />
== IBcatService ==<br />
This is "nn::bcat::detail::ipc::IBcatService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || [[#RequestSyncDeliveryCache]]<br />
|-<br />
| 10101 || [5.0.0+] RequestSyncDeliveryCacheWithDirectoryName<br />
|-<br />
| 10200 || [5.0.0+] CancelSyncDeliveryCacheRequest<br />
|-<br />
| 20100 || [[#RequestSyncDeliveryCacheWithApplicationId]]<br />
|-<br />
| 20101 || [5.0.0+] RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName<br />
|-<br />
| 20300 || [8.0.0+] [[#GetDeliveryCacheStorageUpdateNotifier]]<br />
|-<br />
| 20301 || [8.0.0+] [[#RequestSuspendDeliveryTask]]<br />
|-<br />
| 20400 || [9.0.0+] [[#RegisterSystemApplicationDeliveryTask]]<br />
|-<br />
| 20401 || [9.0.0+] [[#UnregisterSystemApplicationDeliveryTask]]<br />
|-<br />
| 20410 || [9.1.0+] SetSystemApplicationDeliveryTaskTimer<br />
|-<br />
| 30100 || SetPassphrase<br />
|-<br />
| 30101 || [2.0.0-2.3.0] <br />
|-<br />
| 30102 || [2.0.0-2.3.0] <br />
|-<br />
| 30200 || [3.0.0+] RegisterDeliveryTask<br />
|-<br />
| 30201 || [3.0.0+] UnregisterDeliveryTask<br />
|-<br />
| 30202 || [3.0.0+] BlockDeliveryTask<br />
|-<br />
| 30203 || [3.0.0+] UnblockDeliveryTask<br />
|-<br />
| 30210 || [9.1.0+] SetDeliveryTaskTimer<br />
|-<br />
| 30300 || [8.0.0+] RegisterSystemApplicationDeliveryTasks<br />
|-<br />
| 90100 || GetDeliveryTaskList<br />
|-<br />
| 90200 || [[#GetDeliveryList]]<br />
|-<br />
| 90201 || [3.0.0+] ClearDeliveryCacheStorage<br />
|-<br />
| 90202 || [8.0.0+] ClearDeliveryTaskSubscriptionStatus<br />
|-<br />
| 90300 || [3.0.0+] GetPushNotificationLog<br />
|}<br />
<br />
=== RequestSyncDeliveryCache ===<br />
No input/output.<br />
<br />
[3.0.0+] Now returns an [[#IDeliveryCacheProgressService]].<br />
<br />
=== RequestSyncDeliveryCacheWithApplicationId ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
[3.0.0+] Now takes an additional 8-bytes of input, and returns an [[#IDeliveryCacheProgressService]].<br />
<br />
=== GetDeliveryCacheStorageUpdateNotifier ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, returns an [[#INotifierService]].<br />
<br />
=== RequestSuspendDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, returns an [[#IDeliveryTaskSuspensionService]].<br />
<br />
=== RegisterSystemApplicationDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
=== UnregisterSystemApplicationDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
=== GetDeliveryList ===<br />
Takes a type-0x6 output buffer, returns a total of 4-bytes of output.<br />
<br />
[3.0.0+] Now takes a total of 8-bytes of input, and returns an additional 4-bytes of output.<br />
<br />
=== IDeliveryCacheProgressService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheProgressService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetEvent<br />
|-<br />
| 1 || GetImpl<br />
|}<br />
<br />
== IDeliveryCacheStorageService ==<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheStorageService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || CreateFileService<br />
|-<br />
| 1 || CreateDirectoryService<br />
|-<br />
| 10 || EnumerateDeliveryCacheDirectory<br />
|}<br />
<br />
=== IDeliveryCacheFileService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheFileService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Open<br />
|-<br />
| 1 || Read<br />
|-<br />
| 2 || GetSize<br />
|-<br />
| 3 || GetDigest<br />
|}<br />
<br />
=== IDeliveryCacheDirectoryService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheDirectoryService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Open<br />
|-<br />
| 1 || Read<br />
|-<br />
| 2 || GetCount<br />
|}<br />
<br />
=== INotifierService ===<br />
This is "nn::bcat::detail::ipc::INotifierService".<br />
<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetEvent || <br />
|}<br />
<br />
=== IDeliveryTaskSuspensionService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryTaskSuspensionService".<br />
<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetEvent || <br />
|}<br />
<br />
= <nowiki>news:a, news:c, news:m, news:p, news:v</nowiki> =<br />
These are <nowiki>"nn::news::detail::ipc::IServiceCreator"</nowiki>.<br />
<br />
On [1.0.0] these are <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>, see [[#INewsService]].<br />
<br />
News entries are fetched from CDN[https://switchbrew.org/wiki/Network#Others].<br />
Metadata for each entry is stored and queried from an internal SQLite database.<br />
Official software uses sqlite[https://www.sqlite.org/download.html] for processing.<br />
<br />
All sessions have 32 sessions.<br />
Permission masks are:<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Name || Mask<br />
|-<br />
| <nowiki>news:a</nowiki> || 0xffffffff<br />
|-<br />
| <nowiki>news:p</nowiki> || 0x1<br />
|-<br />
| <nowiki>news:c</nowiki> || 0x2<br />
|-<br />
| <nowiki>news:v</nowiki> || 0x4<br />
|-<br />
| <nowiki>news:m</nowiki> || 0xd<br />
|}<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || CreateNewsService || No input, returns an [[#INewsService]].<br />
|-<br />
| 1 || CreateNewlyArrivedEventHolder || No input, returns an [[#INewlyArrivedEventHolder]].<br />
|-<br />
| 2 || CreateNewsDataService || No input, returns an [[#INewsDataService]].<br />
|-<br />
| 3 || CreateNewsDatabaseService || No input, returns an [[#INewsDatabaseService]].<br />
|-<br />
| 4 || CreateOverwriteEventHolder || No input, returns an [[#IOverwriteEventHolder]].<br />
|}<br />
<br />
CreateNewsDataService and CreateNewsDatabaseService require permission bit 2.<br />
<br />
== INewsService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Required Permission Bits<br />
|-<br />
| 10100 || [[#PostLocalNews]] || 0<br />
|-<br />
| 20100 || SetPassphrase || 1<br />
|-<br />
| 30100 || GetSubscriptionStatus || 1 or 2<br />
|-<br />
| 30101 || [3.0.0+] GetTopicList || 2<br />
|-<br />
| [[#30110]] || [6.0.0+] || 2<br />
|-<br />
| 30200 || [[#IsSystemUpdateRequired]] || 2<br />
|-<br />
| 30201 || [8.0.0+] || 2<br />
|-<br />
| [[#30210]] || [10.0.0+] || 2<br />
|-<br />
| 30300 || RequestImmediateReception || 2<br />
|-<br />
| 30400 || [3.0.0+] DecodeArchiveFile || 2<br />
|-<br />
| 30500 || [8.0.0+] ? (Takes a total of 8-bytes of input, a handle, and a type-0x9 input buffer, returns an [[#IUnknown2]]) || 2<br />
|-<br />
| 30900 || [1.0.0] (No input, returns an [[#INewlyArrivedEventHolder]]) || 2<br />
|-<br />
| 30901 || [1.0.0] (No input, returns an [[#INewsDataService]]) || 2<br />
|-<br />
| 30902 || [1.0.0] (No input, returns an [[#INewsDatabaseService]]) || 2<br />
|-<br />
| 40100 || SetSubscriptionStatus || 1 or 3<br />
|-<br />
| 40101 || [3.0.0+] RequestAutoSubscription || 3<br />
|-<br />
| 40200 || ClearStorage || 3<br />
|-<br />
| 40201 || ClearSubscriptionStatusAll || 1 or 3<br />
|-<br />
| 90100 || [[#GetNewsDatabaseDump]] || 4<br />
|}<br />
<br />
=== PostLocalNews ===<br />
Takes an input buffer msgpack.<br />
<br />
=== 30110 ===<br />
Returns two u64s. Current usage and total size of the news-mounted savedata 0x8000000000000090.<br />
<br />
=== IsSystemUpdateRequired ===<br />
Matches the version in news-sys:/sup.version against the result from system setting news!system_version.<br />
<br />
=== 30210 ===<br />
Returns the Database version retrieved from system setting news!db_version<br />
<br />
=== GetNewsDatabaseDump ===<br />
Dumps internal SQLite file.<br />
<br />
== INewlyArrivedEventHolder ==<br />
This is <nowiki>"nn::news::detail::ipc::INewlyArrivedEventHolder"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|}<br />
<br />
=== Get ===<br />
Returns readable event.<br />
Event is signaled on PostLocalNews or on fetch from CDN if the file doesn't exist.<br />
<br />
== INewsDataService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsDataService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Open]]<br />
|-<br />
| 1 || [[#OpenWithNewsRecordV1]]<br />
|-<br />
| 2 || [[#Read]]<br />
|-<br />
| 3 || [[#GetSize]]<br />
|-<br />
| 1001 || [6.0.0+] [[#OpenWithNewsRecord]]<br />
|}<br />
<br />
=== Open ===<br />
Takes an input string. Opens file with the output of snprintf from "news:/data/%s" with input.<br />
<br />
=== OpenWithNewsRecordV1 ===<br />
Takes an input #NewsRecordV1. Opens file with the output of snprintf of "news:/data/D00000000000000000000_%s.msgpack" with news_id if user_id is empty or else of "news:/data/U%s_%s.msgpack" with user_id and news_id of input.<br />
<br />
=== Read ===<br />
Read from file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]].<br />
<br />
=== GetSize ===<br />
Get size of file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]].<br />
<br />
=== OpenWithNewsRecord===<br />
Takes an input #NewsRecord. Same behavior as [[#OpenWithNewsRecordV1]].<br />
<br />
== INewsDatabaseService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsDatabaseService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetListV1<br />
|-<br />
| 1 || Count<br />
|-<br />
| 2 || CountWithKey<br />
|-<br />
| 3 || UpdateIntegerValue<br />
|-<br />
| 4 || UpdateIntegerValueWithAddition<br />
|-<br />
| 5 || UpdateStringValue<br />
|-<br />
| 1000 || [6.0.0+] GetList<br />
|}<br />
<br />
== IOverwriteEventHolder ==<br />
This is <nowiki>"nn::news::detail::ipc::IOverwriteEventHolder"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|}<br />
<br />
=== Get ===<br />
Returns readable event.<br />
Event is signaled on fetch from CDN if the file already exists.<br />
<br />
== IUnknown2 ==<br />
This was added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || <br />
|-<br />
| 1 || <br />
|-<br />
| 2 || <br />
|-<br />
| 3 || <br />
|}<br />
<br />
= NewsDatabase =<br />
<br />
Internal SQLite database. Has a second version since 6.0.0.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Name<br />
! Type<br />
! Exists<br />
|-<br />
| news_id || TEXT || All<br />
|-<br />
| user_id || TEXT || All<br />
|-<br />
| topic_id || TEXT || All<br />
|-<br />
| application_ids || TEXT || All<br />
|-<br />
| received_at || INTEGER || All<br />
|-<br />
| published_at || INTEGER || All<br />
|-<br />
| expire_at || INTEGER || All<br />
|-<br />
| pickup_limit || INTEGER || All<br />
|-<br />
| essential_pickup_limit || INTEGER || Only V2<br />
|-<br />
| priority || INTEGER || All<br />
|-<br />
| deletion_priority || INTEGER || All<br />
|-<br />
| age_limit || INTEGER || All<br />
|-<br />
| surprise || INTEGER || All<br />
|-<br />
| bashotorya || INTEGER || Only V1<br />
|-<br />
| decoration_type || INTEGER || Only V2<br />
|-<br />
| point || INTEGER || All<br />
|-<br />
| read || INTEGER || All<br />
|-<br />
| newly || INTEGER || All<br />
|-<br />
| displayed || INTEGER || All<br />
|-<br />
| opted_in || INTEGER || All<br />
|-<br />
| point_status || INTEGER || All<br />
|-<br />
| feedback || INTEGER || Only V2<br />
|-<br />
| extra_1 || INTEGER || All<br />
|-<br />
| extra_2 || INTEGER || All<br />
|-<br />
|}<br />
<br />
= NewsRecordV1 =<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! SQLite association<br />
|-<br />
| 0x0 || 0x18 || TEXT news_id<br />
|-<br />
| 0x18 || 0x18 || TEXT user_id<br />
|-<br />
| 0x30 || 0x8 || INTEGER received_id<br />
|-<br />
| 0x38 || 0x4 || INTEGER news<br />
|-<br />
| 0x3c || 0x4 || INTEGER newly<br />
|-<br />
| 0x40 || 0x4 || INTEGER displayed<br />
|-<br />
| 0x44 || 0x4 || none<br />
|-<br />
|}<br />
<br />
= NewsRecord =<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! SQLite association<br />
|-<br />
| 0x0 || 0x18 || TEXT news_id<br />
|-<br />
| 0x18 || 0x18 || TEXT user_id<br />
|-<br />
| 0x30 || 0x20 || TEXT topic_id<br />
|-<br />
| 0x50 || 0x8 || INTEGER received_id<br />
|-<br />
| 0x58 || 0x8 || none<br />
|-<br />
| 0x60 || 0x4 || INTEGER decoration_type<br />
|-<br />
| 0x64 || 0x4 || INTEGER read<br />
|-<br />
| 0x68 || 0x4 || INTEGER newly<br />
|-<br />
| 0x6c || 0x4 || INTEGER displayed<br />
|-<br />
| 0x70 || 0x4 || INTEGER feedback<br />
|-<br />
| 0x74 || 0x4 || none<br />
|-<br />
| 0x78 || 0x4 || INTEGER extra_1<br />
|-<br />
| 0x7c || 0x4 || INTEGER extra_2<br />
|-<br />
|}<br />
<br />
= prepo:a, prepo:a2, prepo:m, prepo:u, prepo:s =<br />
These are "nn::prepo::detail::ipc::IPrepoService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || SaveReportOld ([1.0.0-5.1.0] SaveReport)<br />
|-<br />
| 10101 || SaveReportWithUserOld ([1.0.0-5.1.0] SaveReportWithUser)<br />
|-<br />
| 10102 || [6.0.0+] SaveReportOld2 ([1.0.0-9.2.0] SaveReport)<br />
|-<br />
| 10103 || [6.0.0+] SaveReportWithUserOld2 ([1.0.0-9.2.0] SaveReportWithUser)<br />
|-<br />
| 10104 || [10.0.0+] SaveReport<br />
|-<br />
| 10105 || [10.0.0+] SaveReportWithUser<br />
|-<br />
| 10200 || RequestImmediateTransmission<br />
|-<br />
| 10300 || GetTransmissionStatus<br />
|-<br />
| 10400 || [9.0.0+] GetSystemSessionId<br />
|-<br />
| 20100 || SaveSystemReport<br />
|-<br />
| 20101 || SaveSystemReportWithUser<br />
|-<br />
| 20200 || [4.0.0+] SetOperationMode<br />
|-<br />
| 30100 || ClearStorage<br />
|-<br />
| 30200 || [6.0.0+] ClearStatistics<br />
|-<br />
| 30300 || [6.0.0+] GetStorageUsage<br />
|-<br />
| 30400 || [6.0.0+] GetStatistics<br />
|-<br />
| 30401 || [6.0.0+] GetThroughputHistory<br />
|-<br />
| 30500 || [6.0.0+] GetLastUploadError<br />
|-<br />
| 30600 || [10.0.0+] GetApplicationUploadSummary<br />
|-<br />
| 40100 || [2.0.0+] IsUserAgreementCheckEnabled<br />
|-<br />
| 40101 || [2.0.0+] SetUserAgreementCheckEnabled<br />
|-<br />
| 50100 || [10.0.0+] ReadAllApplicationReportFiles<br />
|-<br />
| 90100 || [6.0.0+] ReadAllReportFiles ([1.0.0-5.1.0] GetStorageUsage)<br />
|-<br />
| 90101 || [1.0.0]<br />
|-<br />
| 90102 || [1.0.0] <br />
|-<br />
| 90200 || [5.0.0-5.1.0] GetStatistics<br />
|-<br />
| 90201 || [5.0.0-5.1.0] GetThroughputHistory<br />
|-<br />
| 90300 || [5.0.0-5.1.0] GetLastUploadError<br />
|}<br />
<br />
== Data reporting ==<br />
The "Play Report" (prepo) service uploads system and user information to a cloud server.<br />
This includes the following fields:<br />
sys_info<br />
data<br />
application_id<br />
event_id<br />
operation_mode<br />
lc_recorded_at (followed by a timestamp)<br />
nc_recorded_at (followed by a timestamp)<br />
nsa_id<br />
os_version<br />
<br />
And the contents of the following file:<br />
is_user_agreement_check_enabled.bin<br />
<br />
All the information is periodically uploaded to the following URL:<br><br />
* <nowiki>https://receive-%.dg.srv.nintendo.net/post</nowiki><br />
<br />
It also checks the validity of the device's authentication token using the following URL:<br><br />
* <nowiki>https://dauth-%.ndas.srv.nintendo.net/v1/device_auth_token</nowiki><br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=BCAT_services&diff=10023
BCAT services
2020-10-17T03:30:58Z
<p>Behemoth: News docs</p>
<hr />
<div>BCAT (Background Content Asymmetric synchronized delivery and Transmission) encompasses a set of content download/upload related services.<br />
<br />
= bcat:a, bcat:m, bcat:u, bcat:s =<br />
These are "nn::bcat::detail::ipc::IServiceCreator".<br />
<br />
These were added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || CreateBcatService || Takes an input u64 ProcessId, returns an [[#IBcatService]]<br />
|-<br />
| 1 || CreateDeliveryCacheStorageService || Takes an input u64 ProcessId, returns an [[#IDeliveryCacheStorageService]]<br />
|-<br />
| 2 || CreateDeliveryCacheStorageServiceWithApplicationId || Takes an input u64 TitleId, returns an [[#IDeliveryCacheStorageService]]<br />
|-<br />
| 3 || [2.0.0-2.3.0] CreateDeliveryCacheProgressService || Takes an input u64 ProcessId, returns an [[#IDeliveryCacheProgressService]]<br />
|-<br />
| 4 || [2.0.0-2.3.0] CreateDeliveryCacheProgressServiceWithApplicationId || Takes an input u64 TitleId, returns an [[#IDeliveryCacheProgressService]]<br />
|}<br />
<br />
Equivalent to 3DS BOSS(SpotPass). See [[BCAT_Content_Container|here]] for BCAT-content-container.<br />
<br />
== IBcatService ==<br />
This is "nn::bcat::detail::ipc::IBcatService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || [[#RequestSyncDeliveryCache]]<br />
|-<br />
| 10101 || [5.0.0+] RequestSyncDeliveryCacheWithDirectoryName<br />
|-<br />
| 10200 || [5.0.0+] CancelSyncDeliveryCacheRequest<br />
|-<br />
| 20100 || [[#RequestSyncDeliveryCacheWithApplicationId]]<br />
|-<br />
| 20101 || [5.0.0+] RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName<br />
|-<br />
| 20300 || [8.0.0+] [[#GetDeliveryCacheStorageUpdateNotifier]]<br />
|-<br />
| 20301 || [8.0.0+] [[#RequestSuspendDeliveryTask]]<br />
|-<br />
| 20400 || [9.0.0+] [[#RegisterSystemApplicationDeliveryTask]]<br />
|-<br />
| 20401 || [9.0.0+] [[#UnregisterSystemApplicationDeliveryTask]]<br />
|-<br />
| 20410 || [9.1.0+] SetSystemApplicationDeliveryTaskTimer<br />
|-<br />
| 30100 || SetPassphrase<br />
|-<br />
| 30101 || [2.0.0-2.3.0] <br />
|-<br />
| 30102 || [2.0.0-2.3.0] <br />
|-<br />
| 30200 || [3.0.0+] RegisterDeliveryTask<br />
|-<br />
| 30201 || [3.0.0+] UnregisterDeliveryTask<br />
|-<br />
| 30202 || [3.0.0+] BlockDeliveryTask<br />
|-<br />
| 30203 || [3.0.0+] UnblockDeliveryTask<br />
|-<br />
| 30210 || [9.1.0+] SetDeliveryTaskTimer<br />
|-<br />
| 30300 || [8.0.0+] RegisterSystemApplicationDeliveryTasks<br />
|-<br />
| 90100 || GetDeliveryTaskList<br />
|-<br />
| 90200 || [[#GetDeliveryList]]<br />
|-<br />
| 90201 || [3.0.0+] ClearDeliveryCacheStorage<br />
|-<br />
| 90202 || [8.0.0+] ClearDeliveryTaskSubscriptionStatus<br />
|-<br />
| 90300 || [3.0.0+] GetPushNotificationLog<br />
|}<br />
<br />
=== RequestSyncDeliveryCache ===<br />
No input/output.<br />
<br />
[3.0.0+] Now returns an [[#IDeliveryCacheProgressService]].<br />
<br />
=== RequestSyncDeliveryCacheWithApplicationId ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
[3.0.0+] Now takes an additional 8-bytes of input, and returns an [[#IDeliveryCacheProgressService]].<br />
<br />
=== GetDeliveryCacheStorageUpdateNotifier ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, returns an [[#INotifierService]].<br />
<br />
=== RequestSuspendDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, returns an [[#IDeliveryTaskSuspensionService]].<br />
<br />
=== RegisterSystemApplicationDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
=== UnregisterSystemApplicationDeliveryTask ===<br />
Takes an input u64 <code>nn::ApplicationId</code>, no output.<br />
<br />
=== GetDeliveryList ===<br />
Takes a type-0x6 output buffer, returns a total of 4-bytes of output.<br />
<br />
[3.0.0+] Now takes a total of 8-bytes of input, and returns an additional 4-bytes of output.<br />
<br />
=== IDeliveryCacheProgressService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheProgressService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetEvent<br />
|-<br />
| 1 || GetImpl<br />
|}<br />
<br />
== IDeliveryCacheStorageService ==<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheStorageService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || CreateFileService<br />
|-<br />
| 1 || CreateDirectoryService<br />
|-<br />
| 10 || EnumerateDeliveryCacheDirectory<br />
|}<br />
<br />
=== IDeliveryCacheFileService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheFileService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Open<br />
|-<br />
| 1 || Read<br />
|-<br />
| 2 || GetSize<br />
|-<br />
| 3 || GetDigest<br />
|}<br />
<br />
=== IDeliveryCacheDirectoryService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryCacheDirectoryService".<br />
<br />
This was added with [2.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || Open<br />
|-<br />
| 1 || Read<br />
|-<br />
| 2 || GetCount<br />
|}<br />
<br />
=== INotifierService ===<br />
This is "nn::bcat::detail::ipc::INotifierService".<br />
<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetEvent || <br />
|}<br />
<br />
=== IDeliveryTaskSuspensionService ===<br />
This is "nn::bcat::detail::ipc::IDeliveryTaskSuspensionService".<br />
<br />
Added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || GetEvent || <br />
|}<br />
<br />
= <nowiki>news:a, news:c, news:m, news:p, news:v</nowiki> =<br />
These are <nowiki>"nn::news::detail::ipc::IServiceCreator"</nowiki>.<br />
<br />
On [1.0.0] these are <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>, see [[#INewsService]].<br />
<br />
News entries are fetched from CDN[https://switchbrew.org/wiki/Network#Others].<br />
Metadata for each entry is stored and queried from an internal SQLite database.<br />
Official software uses sqlite[https://www.sqlite.org/download.html] for processing.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 0 || CreateNewsService || No input, returns an [[#INewsService]].<br />
|-<br />
| 1 || CreateNewlyArrivedEventHolder || No input, returns an [[#INewlyArrivedEventHolder]].<br />
|-<br />
| 2 || CreateNewsDataService || No input, returns an [[#INewsDataService]].<br />
|-<br />
| 3 || CreateNewsDatabaseService || No input, returns an [[#INewsDatabaseService]].<br />
|-<br />
| 4 || CreateOverwriteEventHolder || No input, returns an [[#IOverwriteEventHolder]].<br />
|}<br />
<br />
== INewsService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || [[#PostLocalNews]]<br />
|-<br />
| 20100 || SetPassphrase<br />
|-<br />
| 30100 || GetSubscriptionStatus<br />
|-<br />
| 30101 || [3.0.0+] GetTopicList<br />
|-<br />
| [[#30110]] || [6.0.0+]<br />
|-<br />
| 30200 || [[#IsSystemUpdateRequired]]<br />
|-<br />
| 30201 || [8.0.0+]<br />
|-<br />
| [[#30210]] || [10.0.0+]<br />
|-<br />
| 30300 || RequestImmediateReception<br />
|-<br />
| 30400 || [3.0.0+] DecodeArchiveFile<br />
|-<br />
| 30500 || [8.0.0+] ? (Takes a total of 8-bytes of input, a handle, and a type-0x9 input buffer, returns an [[#IUnknown2]])<br />
|-<br />
| 30900 || [1.0.0] (No input, returns an [[#INewlyArrivedEventHolder]])<br />
|-<br />
| 30901 || [1.0.0] (No input, returns an [[#INewsDataService]])<br />
|-<br />
| 30902 || [1.0.0] (No input, returns an [[#INewsDatabaseService]])<br />
|-<br />
| 40100 || SetSubscriptionStatus<br />
|-<br />
| 40101 || [3.0.0+] RequestAutoSubscription<br />
|-<br />
| 40200 || ClearStorage<br />
|-<br />
| 40201 || ClearSubscriptionStatusAll<br />
|-<br />
| 90100 || [[#GetNewsDatabaseDump]]<br />
|}<br />
<br />
=== PostLocalNews ===<br />
Takes an input buffer msgpack.<br />
<br />
=== 30110 ===<br />
Returns two u64s. Current usage and total size of the news-mounted savedata 0x8000000000000090.<br />
<br />
=== IsSystemUpdateRequired ===<br />
Matches the version in news-sys:/sup.version against the result from system setting news!system_version.<br />
<br />
=== 30210 ===<br />
Returns the Database version retrieved from system setting news!db_version<br />
<br />
=== GetNewsDatabaseDump ===<br />
Dumps internal SQLite file.<br />
<br />
== INewlyArrivedEventHolder ==<br />
This is <nowiki>"nn::news::detail::ipc::INewlyArrivedEventHolder"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|}<br />
<br />
=== Get ===<br />
Returns readable event.<br />
Event is signaled on PostLocalNews or on fetch from CDN if the file doesn't exist.<br />
<br />
== INewsDataService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsDataService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Open]]<br />
|-<br />
| 1 || [[#OpenWithNewsRecordV1]]<br />
|-<br />
| 2 || [[#Read]]<br />
|-<br />
| 3 || [[#GetSize]]<br />
|-<br />
| 1001 || [6.0.0+] [[#OpenWithNewsRecord]]<br />
|}<br />
<br />
=== Open ===<br />
Takes an input string. Opens file with the output of snprintf from "news:/data/%s" with input.<br />
<br />
=== OpenWithNewsRecordV1 ===<br />
Takes an input #NewsRecordV1. Opens file with the output of snprintf of "news:/data/D00000000000000000000_%s.msgpack" with news_id if user_id is empty or else of "news:/data/U%s_%s.msgpack" with user_id and news_id of input.<br />
<br />
=== Read ===<br />
Read from file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]].<br />
<br />
=== GetSize ===<br />
Get size of file opened with [[#Open]], [[#OpenWithNewsRecordV1]] or [[#OpenWithNewsRecord]].<br />
<br />
=== OpenWithNewsRecord===<br />
Takes an input #NewsRecord. Same behavior as [[#OpenWithNewsRecordV1]].<br />
<br />
== INewsDatabaseService ==<br />
This is <nowiki>"nn::news::detail::ipc::INewsDatabaseService"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || GetListV1<br />
|-<br />
| 1 || Count<br />
|-<br />
| 2 || CountWithKey<br />
|-<br />
| 3 || UpdateIntegerValue<br />
|-<br />
| 4 || UpdateIntegerValueWithAddition<br />
|-<br />
| 5 || UpdateStringValue<br />
|-<br />
| 1000 || [6.0.0+] GetList<br />
|}<br />
<br />
== IOverwriteEventHolder ==<br />
This is <nowiki>"nn::news::detail::ipc::IOverwriteEventHolder"</nowiki>.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || [[#Get]]<br />
|}<br />
<br />
=== Get ===<br />
Returns readable event.<br />
Event is signaled on fetch from CDN if the file already exists.<br />
<br />
== IUnknown2 ==<br />
This was added with [8.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 0 || <br />
|-<br />
| 1 || <br />
|-<br />
| 2 || <br />
|-<br />
| 3 || <br />
|}<br />
<br />
= NewsDatabase =<br />
<br />
Internal SQLite database. Has a second version since 6.0.0.<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Name<br />
! Type<br />
! Exists<br />
|-<br />
| news_id || TEXT || All<br />
|-<br />
| user_id || TEXT || All<br />
|-<br />
| topic_id || TEXT || All<br />
|-<br />
| application_ids || TEXT || All<br />
|-<br />
| received_at || INTEGER || All<br />
|-<br />
| published_at || INTEGER || All<br />
|-<br />
| expire_at || INTEGER || All<br />
|-<br />
| pickup_limit || INTEGER || All<br />
|-<br />
| essential_pickup_limit || INTEGER || Only V2<br />
|-<br />
| priority || INTEGER || All<br />
|-<br />
| deletion_priority || INTEGER || All<br />
|-<br />
| age_limit || INTEGER || All<br />
|-<br />
| surprise || INTEGER || All<br />
|-<br />
| bashotorya || INTEGER || Only V1<br />
|-<br />
| decoration_type || INTEGER || Only V2<br />
|-<br />
| point || INTEGER || All<br />
|-<br />
| read || INTEGER || All<br />
|-<br />
| newly || INTEGER || All<br />
|-<br />
| displayed || INTEGER || All<br />
|-<br />
| opted_in || INTEGER || All<br />
|-<br />
| point_status || INTEGER || All<br />
|-<br />
| feedback || INTEGER || Only V2<br />
|-<br />
| extra_1 || INTEGER || All<br />
|-<br />
| extra_2 || INTEGER || All<br />
|-<br />
|}<br />
<br />
= NewsRecordV1 =<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! SQLite association<br />
|-<br />
| 0x0 || 0x18 || TEXT news_id<br />
|-<br />
| 0x18 || 0x18 || TEXT user_id<br />
|-<br />
| 0x30 || 0x8 || INTEGER received_id<br />
|-<br />
| 0x38 || 0x4 || INTEGER news<br />
|-<br />
| 0x3c || 0x4 || INTEGER newly<br />
|-<br />
| 0x40 || 0x4 || INTEGER displayed<br />
|-<br />
| 0x44 || 0x4 || none<br />
|-<br />
|}<br />
<br />
= NewsRecord =<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Offset<br />
! Size<br />
! SQLite association<br />
|-<br />
| 0x0 || 0x18 || TEXT news_id<br />
|-<br />
| 0x18 || 0x18 || TEXT user_id<br />
|-<br />
| 0x30 || 0x20 || TEXT topic_id<br />
|-<br />
| 0x50 || 0x8 || INTEGER received_id<br />
|-<br />
| 0x58 || 0x8 || none<br />
|-<br />
| 0x60 || 0x4 || INTEGER decoration_type<br />
|-<br />
| 0x64 || 0x4 || INTEGER read<br />
|-<br />
| 0x68 || 0x4 || INTEGER newly<br />
|-<br />
| 0x6c || 0x4 || INTEGER displayed<br />
|-<br />
| 0x70 || 0x4 || INTEGER feedback<br />
|-<br />
| 0x74 || 0x4 || none<br />
|-<br />
| 0x78 || 0x4 || INTEGER extra_1<br />
|-<br />
| 0x7c || 0x4 || INTEGER extra_2<br />
|-<br />
|}<br />
<br />
= prepo:a, prepo:a2, prepo:m, prepo:u, prepo:s =<br />
These are "nn::prepo::detail::ipc::IPrepoService".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 10100 || SaveReportOld ([1.0.0-5.1.0] SaveReport)<br />
|-<br />
| 10101 || SaveReportWithUserOld ([1.0.0-5.1.0] SaveReportWithUser)<br />
|-<br />
| 10102 || [6.0.0+] SaveReportOld2 ([1.0.0-9.2.0] SaveReport)<br />
|-<br />
| 10103 || [6.0.0+] SaveReportWithUserOld2 ([1.0.0-9.2.0] SaveReportWithUser)<br />
|-<br />
| 10104 || [10.0.0+] SaveReport<br />
|-<br />
| 10105 || [10.0.0+] SaveReportWithUser<br />
|-<br />
| 10200 || RequestImmediateTransmission<br />
|-<br />
| 10300 || GetTransmissionStatus<br />
|-<br />
| 10400 || [9.0.0+] GetSystemSessionId<br />
|-<br />
| 20100 || SaveSystemReport<br />
|-<br />
| 20101 || SaveSystemReportWithUser<br />
|-<br />
| 20200 || [4.0.0+] SetOperationMode<br />
|-<br />
| 30100 || ClearStorage<br />
|-<br />
| 30200 || [6.0.0+] ClearStatistics<br />
|-<br />
| 30300 || [6.0.0+] GetStorageUsage<br />
|-<br />
| 30400 || [6.0.0+] GetStatistics<br />
|-<br />
| 30401 || [6.0.0+] GetThroughputHistory<br />
|-<br />
| 30500 || [6.0.0+] GetLastUploadError<br />
|-<br />
| 30600 || [10.0.0+] GetApplicationUploadSummary<br />
|-<br />
| 40100 || [2.0.0+] IsUserAgreementCheckEnabled<br />
|-<br />
| 40101 || [2.0.0+] SetUserAgreementCheckEnabled<br />
|-<br />
| 50100 || [10.0.0+] ReadAllApplicationReportFiles<br />
|-<br />
| 90100 || [6.0.0+] ReadAllReportFiles ([1.0.0-5.1.0] GetStorageUsage)<br />
|-<br />
| 90101 || [1.0.0]<br />
|-<br />
| 90102 || [1.0.0] <br />
|-<br />
| 90200 || [5.0.0-5.1.0] GetStatistics<br />
|-<br />
| 90201 || [5.0.0-5.1.0] GetThroughputHistory<br />
|-<br />
| 90300 || [5.0.0-5.1.0] GetLastUploadError<br />
|}<br />
<br />
== Data reporting ==<br />
The "Play Report" (prepo) service uploads system and user information to a cloud server.<br />
This includes the following fields:<br />
sys_info<br />
data<br />
application_id<br />
event_id<br />
operation_mode<br />
lc_recorded_at (followed by a timestamp)<br />
nc_recorded_at (followed by a timestamp)<br />
nsa_id<br />
os_version<br />
<br />
And the contents of the following file:<br />
is_user_agreement_check_enabled.bin<br />
<br />
All the information is periodically uploaded to the following URL:<br><br />
* <nowiki>https://receive-%.dg.srv.nintendo.net/post</nowiki><br />
<br />
It also checks the validity of the device's authentication token using the following URL:<br><br />
* <nowiki>https://dauth-%.ndas.srv.nintendo.net/v1/device_auth_token</nowiki><br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=NPNS_services&diff=9810
NPNS services
2020-07-25T01:11:10Z
<p>Behemoth: /* npns */ General functionality information</p>
<hr />
<div>This is used for Push Notifications.<br />
<br />
It uses a version of the libstrophe[http://strophe.im/libstrophe/] xmpp library with libxml2.<br />
Modifications were made to use the SSL services[https://switchbrew.org/wiki/SSL_services] and support network proxy settings.<br />
<br />
= npns:u =<br />
This is "nn::npns::INpnsUser".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || [[#GetReceiveEvent]]<br />
|-<br />
| 7 || [[#GetStateChangeEvent]]<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
= npns:s =<br />
This is "nn::npns::INpnsSystem".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || [[#GetReceiveEvent]]<br />
|-<br />
| 6 || [[#ListenUndelivered]]<br />
|-<br />
| 7 || [[#GetStateChangeEvent]]<br />
|-<br />
| 11 || SubscribeTopic<br />
|-<br />
| 12 || UnsubscribeTopic<br />
|-<br />
| 13 || QueryIsTopicExist<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 22 || CreateTokenWithApplicationId<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 24 || DestroyTokenWithApplicationId<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 31 || UploadTokenToBaaS<br />
|-<br />
| 32 || [2.0.0+] DestroyTokenForBaaS<br />
|-<br />
| 33 || [7.0.0+] CreateTokenForBaas<br />
|-<br />
| 34 || [7.0.0+] SetBaasDeviceAccountIdList<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 105 || [3.0.0+] GetPlayReportRequestEvent<br />
|-<br />
| 111 || [[#GetJid]]<br />
|-<br />
| 112 || [[#CreateJid]]<br />
|-<br />
| 113 || [[#DestroyJid]]<br />
|-<br />
| 114 || AttachJid<br />
|-<br />
| 115 || DetachJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|-<br />
| 161 || [10.0.0+] GetRequestChangeStateCancelEvent<br />
|-<br />
| 162 || [10.0.0+] RequestChangeStateForceTimedWithCancelEvent<br />
|-<br />
| 201 || [3.0.0+] RequestChangeStateForceTimed<br />
|-<br />
| 202 || [3.0.0+] RequestChangeStateForceAsync<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
ListenAll, ReceiveRaw, CreateToken, DestroyToken, QueryIsTokenValid are stubbed. They return 0x7fc9a on [1.0.0] and 0x36dc9a on later versions.<br />
<br />
=== ListenTo ===<br />
Takes an input u64 program id, no output.<br />
<br />
=== GetReceiveEvent ===<br />
No input, returns an output Event handle with autoclear=true.<br />
<br />
=== GetStateChangeEvent ===<br />
No input, returns an output Event handle with autoclear=true. <br />
<br />
=== ListenUndelivered ===<br />
No input, same as calling [[#ListenTo]] with program id 0.<br />
<br />
=== GetJid ===<br />
No input, returns the current Jabber Identifier[https://xmpp.org/extensions/xep-0029.html] in a type-10 buffer.<br />
Locally it's stored in "npns_save:/persistent.bin"<br />
<br />
=== CreateJid ===<br />
No input, no output.<br />
Fetches a new Jid from the CDN. Invalidates the old one if existent.<br />
<br />
=== DestroyJid ===<br />
No input, no output.<br />
Invalidates and deletes the current Jid.<br />
<br />
=== CreateNotificationReceiver ===<br />
Returns an [[#INotificationReceiver]].<br />
<br />
== INotificationReceiver ==<br />
This is "nn::npns::INotificationReceiver".<br />
<br />
This was added with [7.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 1 || [[#ListenTo]] || Takes a total of 8-bytes of input, no output.<br />
|-<br />
| 2 || ListenToMyApplicationId || Takes a total of 8-bytes of input and a PID, no output.<br />
|-<br />
| 3 || Receive || Takes a total of 2-bytes of input and a type-0x6 output buffer.<br />
|-<br />
| 4 || GetReceiveEvent || No input, returns an output handle.<br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=NPNS_services&diff=9805
NPNS services
2020-07-23T12:04:07Z
<p>Behemoth: /* npns */ Events and minor cleanup</p>
<hr />
<div>This is used for Push Notifications.<br />
<br />
= npns:u =<br />
This is "nn::npns::INpnsUser".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || [[#GetReceiveEvent]]<br />
|-<br />
| 7 || [[#GetStateChangeEvent]]<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
= npns:s =<br />
This is "nn::npns::INpnsSystem".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || [[#GetReceiveEvent]]<br />
|-<br />
| 6 || [[#ListenUndelivered]]<br />
|-<br />
| 7 || [[#GetStateChangeEvent]]<br />
|-<br />
| 11 || SubscribeTopic<br />
|-<br />
| 12 || UnsubscribeTopic<br />
|-<br />
| 13 || QueryIsTopicExist<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 22 || CreateTokenWithApplicationId<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 24 || DestroyTokenWithApplicationId<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 31 || UploadTokenToBaaS<br />
|-<br />
| 32 || [2.0.0+] DestroyTokenForBaaS<br />
|-<br />
| 33 || [7.0.0+] CreateTokenForBaas<br />
|-<br />
| 34 || [7.0.0+] SetBaasDeviceAccountIdList<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 105 || [3.0.0+] GetPlayReportRequestEvent<br />
|-<br />
| 111 || [[#GetJid]]<br />
|-<br />
| 112 || [[#CreateJid]]<br />
|-<br />
| 113 || [[#DestroyJid]]<br />
|-<br />
| 114 || AttachJid<br />
|-<br />
| 115 || DetachJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|-<br />
| 161 || [10.0.0+] GetRequestChangeStateCancelEvent<br />
|-<br />
| 162 || [10.0.0+] RequestChangeStateForceTimedWithCancelEvent<br />
|-<br />
| 201 || [3.0.0+] RequestChangeStateForceTimed<br />
|-<br />
| 202 || [3.0.0+] RequestChangeStateForceAsync<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
ListenAll, ReceiveRaw, CreateToken, DestroyToken, QueryIsTokenValid are stubbed. They return 0x7fc9a on [1.0.0] and 0x36dc9a on later versions.<br />
<br />
=== ListenTo ===<br />
Takes an input u64 program id, no output.<br />
<br />
=== GetReceiveEvent ===<br />
No input, returns an output Event handle with autoclear=true.<br />
<br />
=== GetStateChangeEvent ===<br />
No input, returns an output Event handle with autoclear=true. <br />
<br />
=== ListenUndelivered ===<br />
No input, same as calling [[#ListenTo]] with program id 0.<br />
<br />
=== GetJid ===<br />
No input, returns the current Jabber Identifier[https://xmpp.org/extensions/xep-0029.html] in a type-10 buffer.<br />
Locally it's stored in "npns_save:/persistent.bin"<br />
<br />
=== CreateJid ===<br />
No input, no output.<br />
Fetches a new Jid from the CDN. Invalidates the old one if existent.<br />
<br />
=== DestroyJid ===<br />
No input, no output.<br />
Invalidates and deletes the current Jid.<br />
<br />
=== CreateNotificationReceiver ===<br />
Returns an [[#INotificationReceiver]].<br />
<br />
== INotificationReceiver ==<br />
This is "nn::npns::INotificationReceiver".<br />
<br />
This was added with [7.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 1 || [[#ListenTo]] || Takes a total of 8-bytes of input, no output.<br />
|-<br />
| 2 || ListenToMyApplicationId || Takes a total of 8-bytes of input and a PID, no output.<br />
|-<br />
| 3 || Receive || Takes a total of 2-bytes of input and a type-0x6 output buffer.<br />
|-<br />
| 4 || GetReceiveEvent || No input, returns an output handle.<br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=NPNS_services&diff=9804
NPNS services
2020-07-23T11:24:24Z
<p>Behemoth: /* npns:s */ version for DestroyTokenForBaaS</p>
<hr />
<div>This is used for Push Notifications.<br />
<br />
= npns:u =<br />
This is "nn::npns::INpnsUser".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || GetReceiveEvent<br />
|-<br />
| 7 || GetStateChangeEvent<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
= npns:s =<br />
This is "nn::npns::INpnsSystem".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || GetReceiveEvent<br />
|-<br />
| 6 || [[#ListenUndelivered]]<br />
|-<br />
| 7 || GetStateChangeEvent<br />
|-<br />
| 11 || SubscribeTopic<br />
|-<br />
| 12 || UnsubscribeTopic<br />
|-<br />
| 13 || QueryIsTopicExist<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 22 || CreateTokenWithApplicationId<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 24 || DestroyTokenWithApplicationId<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 31 || UploadTokenToBaaS<br />
|-<br />
| 32 || [2.0.0+] DestroyTokenForBaaS<br />
|-<br />
| 33 || [7.0.0+] CreateTokenForBaas<br />
|-<br />
| 34 || [7.0.0+] SetBaasDeviceAccountIdList<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 105 || [3.0.0+] GetPlayReportRequestEvent<br />
|-<br />
| 111 || [[#GetJid]]<br />
|-<br />
| 112 || [[#CreateJid]]<br />
|-<br />
| 113 || [[#DestroyJid]]<br />
|-<br />
| 114 || AttachJid<br />
|-<br />
| 115 || DetachJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|-<br />
| 161 || [10.0.0+] GetRequestChangeStateCancelEvent<br />
|-<br />
| 162 || [10.0.0+] RequestChangeStateForceTimedWithCancelEvent<br />
|-<br />
| 201 || [3.0.0+] RequestChangeStateForceTimed<br />
|-<br />
| 202 || [3.0.0+] RequestChangeStateForceAsync<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
ListenAll, ReceiveRaw, CreateToken, DestroyToken, QueryIsTokenValid are stubbed. They return 0x7fc9a on [1.0.0] and 0x36dc9a on later versions.<br />
<br />
=== ListenTo ===<br />
Takes an input u64 program id.<br />
<br />
=== ListenUndelivered ===<br />
Same as calling [[#ListenTo]] with program id 0.<br />
<br />
=== GetJid ===<br />
Returns the current Jabber Identifier[https://xmpp.org/extensions/xep-0029.html].<br />
Locally it's stored in "npns_save:/persistent.bin"<br />
<br />
=== CreateJid ===<br />
Fetches a new Jid from the CDN. Invalidates the old one if existent.<br />
<br />
=== DestroyJid ===<br />
Invalidates and deletes the local Jid.<br />
<br />
=== CreateNotificationReceiver ===<br />
Returns an [[#INotificationReceiver]].<br />
<br />
== INotificationReceiver ==<br />
This is "nn::npns::INotificationReceiver".<br />
<br />
This was added with [7.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 1 || [[#ListenTo]] || Takes a total of 8-bytes of input, no output.<br />
|-<br />
| 2 || ListenToMyApplicationId || Takes a total of 8-bytes of input and a PID, no output.<br />
|-<br />
| 3 || Receive || Takes a total of 2-bytes of input and a type-0x6 output buffer.<br />
|-<br />
| 4 || GetReceiveEvent || No input, returns an output handle.<br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=NPNS_services&diff=9801
NPNS services
2020-07-22T17:34:50Z
<p>Behemoth: /* npns:s */ Jid</p>
<hr />
<div>This is used for Push Notifications.<br />
<br />
= npns:u =<br />
This is "nn::npns::INpnsUser".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || GetReceiveEvent<br />
|-<br />
| 7 || GetStateChangeEvent<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
= npns:s =<br />
This is "nn::npns::INpnsSystem".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || GetReceiveEvent<br />
|-<br />
| 6 || [[#ListenUndelivered]]<br />
|-<br />
| 7 || GetStateChangeEvent<br />
|-<br />
| 11 || SubscribeTopic<br />
|-<br />
| 12 || UnsubscribeTopic<br />
|-<br />
| 13 || QueryIsTopicExist<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 22 || CreateTokenWithApplicationId<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 24 || DestroyTokenWithApplicationId<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 31 || UploadTokenToBaaS<br />
|-<br />
| 32 || DestroyTokenForBaaS<br />
|-<br />
| 33 || [7.0.0+] CreateTokenForBaas<br />
|-<br />
| 34 || [7.0.0+] SetBaasDeviceAccountIdList<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 105 || [3.0.0+] GetPlayReportRequestEvent<br />
|-<br />
| 111 || [[#GetJid]]<br />
|-<br />
| 112 || [[#CreateJid]]<br />
|-<br />
| 113 || [[#DestroyJid]]<br />
|-<br />
| 114 || AttachJid<br />
|-<br />
| 115 || DetachJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|-<br />
| 161 || [10.0.0+] GetRequestChangeStateCancelEvent<br />
|-<br />
| 162 || [10.0.0+] RequestChangeStateForceTimedWithCancelEvent<br />
|-<br />
| 201 || [3.0.0+] RequestChangeStateForceTimed<br />
|-<br />
| 202 || [3.0.0+] RequestChangeStateForceAsync<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
ListenAll, ReceiveRaw, CreateToken, DestroyToken, QueryIsTokenValid are stubbed. They return 0x7fc9a on [1.0.0] and 0x36dc9a on later versions.<br />
<br />
=== ListenTo ===<br />
Takes an input u64 program id.<br />
<br />
=== ListenUndelivered ===<br />
Same as calling [[#ListenTo]] with program id 0.<br />
<br />
=== GetJid ===<br />
Returns the current Jabber Identifier[https://xmpp.org/extensions/xep-0029.html].<br />
Locally it's stored in "npns_save:/persistent.bin"<br />
<br />
=== CreateJid ===<br />
Fetches a new Jid from the CDN. Invalidates the old one if existent.<br />
<br />
=== DestroyJid ===<br />
Invalidates and deletes the local Jid.<br />
<br />
=== CreateNotificationReceiver ===<br />
Returns an [[#INotificationReceiver]].<br />
<br />
== INotificationReceiver ==<br />
This is "nn::npns::INotificationReceiver".<br />
<br />
This was added with [7.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 1 || [[#ListenTo]] || Takes a total of 8-bytes of input, no output.<br />
|-<br />
| 2 || ListenToMyApplicationId || Takes a total of 8-bytes of input and a PID, no output.<br />
|-<br />
| 3 || Receive || Takes a total of 2-bytes of input and a type-0x6 output buffer.<br />
|-<br />
| 4 || GetReceiveEvent || No input, returns an output handle.<br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=NPNS_services&diff=9800
NPNS services
2020-07-22T17:23:15Z
<p>Behemoth: /* npns:u */</p>
<hr />
<div>This is used for Push Notifications.<br />
<br />
= npns:u =<br />
This is "nn::npns::INpnsUser".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || GetReceiveEvent<br />
|-<br />
| 7 || GetStateChangeEvent<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
= npns:s =<br />
This is "nn::npns::INpnsSystem".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || GetReceiveEvent<br />
|-<br />
| 6 || [[#ListenUndelivered]]<br />
|-<br />
| 7 || GetStateChangeEvent<br />
|-<br />
| 11 || SubscribeTopic<br />
|-<br />
| 12 || UnsubscribeTopic<br />
|-<br />
| 13 || QueryIsTopicExist<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 22 || CreateTokenWithApplicationId<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 24 || DestroyTokenWithApplicationId<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 31 || UploadTokenToBaaS<br />
|-<br />
| 32 || DestroyTokenForBaaS<br />
|-<br />
| 33 || [7.0.0+] CreateTokenForBaas<br />
|-<br />
| 34 || [7.0.0+] SetBaasDeviceAccountIdList<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 105 || [3.0.0+] GetPlayReportRequestEvent<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 112 || CreateJid<br />
|-<br />
| 113 || DestroyJid<br />
|-<br />
| 114 || AttachJid<br />
|-<br />
| 115 || DetachJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|-<br />
| 161 || [10.0.0+] GetRequestChangeStateCancelEvent<br />
|-<br />
| 162 || [10.0.0+] RequestChangeStateForceTimedWithCancelEvent<br />
|-<br />
| 201 || [3.0.0+] RequestChangeStateForceTimed<br />
|-<br />
| 202 || [3.0.0+] RequestChangeStateForceAsync<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
ListenAll, ReceiveRaw, CreateToken, DestroyToken, QueryIsTokenValid are stubbed. They return 0x7fc9a on [1.0.0] and 0x36dc9a on later versions.<br />
<br />
=== ListenTo ===<br />
Takes an input u64 program id.<br />
<br />
=== ListenUndelivered ===<br />
Same as calling [[#ListenTo]] with program id 0.<br />
<br />
=== CreateNotificationReceiver ===<br />
Returns an [[#INotificationReceiver]].<br />
<br />
== INotificationReceiver ==<br />
This is "nn::npns::INotificationReceiver".<br />
<br />
This was added with [7.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 1 || [[#ListenTo]] || Takes a total of 8-bytes of input, no output.<br />
|-<br />
| 2 || ListenToMyApplicationId || Takes a total of 8-bytes of input and a PID, no output.<br />
|-<br />
| 3 || Receive || Takes a total of 2-bytes of input and a type-0x6 output buffer.<br />
|-<br />
| 4 || GetReceiveEvent || No input, returns an output handle.<br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=NPNS_services&diff=9799
NPNS services
2020-07-22T17:22:16Z
<p>Behemoth: /* npns:s */</p>
<hr />
<div>This is used for Push Notifications.<br />
<br />
= npns:u =<br />
This is "nn::npns::INpnsUser".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || [[#ListenAll]]<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || [[#ReceiveRaw]]<br />
|-<br />
| 5 || GetReceiveEvent<br />
|-<br />
| 7 || GetStateChangeEvent<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
= npns:s =<br />
This is "nn::npns::INpnsSystem".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || GetReceiveEvent<br />
|-<br />
| 6 || [[#ListenUndelivered]]<br />
|-<br />
| 7 || GetStateChangeEvent<br />
|-<br />
| 11 || SubscribeTopic<br />
|-<br />
| 12 || UnsubscribeTopic<br />
|-<br />
| 13 || QueryIsTopicExist<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 22 || CreateTokenWithApplicationId<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 24 || DestroyTokenWithApplicationId<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 31 || UploadTokenToBaaS<br />
|-<br />
| 32 || DestroyTokenForBaaS<br />
|-<br />
| 33 || [7.0.0+] CreateTokenForBaas<br />
|-<br />
| 34 || [7.0.0+] SetBaasDeviceAccountIdList<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 105 || [3.0.0+] GetPlayReportRequestEvent<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 112 || CreateJid<br />
|-<br />
| 113 || DestroyJid<br />
|-<br />
| 114 || AttachJid<br />
|-<br />
| 115 || DetachJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|-<br />
| 161 || [10.0.0+] GetRequestChangeStateCancelEvent<br />
|-<br />
| 162 || [10.0.0+] RequestChangeStateForceTimedWithCancelEvent<br />
|-<br />
| 201 || [3.0.0+] RequestChangeStateForceTimed<br />
|-<br />
| 202 || [3.0.0+] RequestChangeStateForceAsync<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
ListenAll, ReceiveRaw, CreateToken, DestroyToken, QueryIsTokenValid are stubbed. They return 0x7fc9a on [1.0.0] and 0x36dc9a on later versions.<br />
<br />
=== ListenTo ===<br />
Takes an input u64 program id.<br />
<br />
=== ListenUndelivered ===<br />
Same as calling [[#ListenTo]] with program id 0.<br />
<br />
=== CreateNotificationReceiver ===<br />
Returns an [[#INotificationReceiver]].<br />
<br />
== INotificationReceiver ==<br />
This is "nn::npns::INotificationReceiver".<br />
<br />
This was added with [7.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 1 || [[#ListenTo]] || Takes a total of 8-bytes of input, no output.<br />
|-<br />
| 2 || ListenToMyApplicationId || Takes a total of 8-bytes of input and a PID, no output.<br />
|-<br />
| 3 || Receive || Takes a total of 2-bytes of input and a type-0x6 output buffer.<br />
|-<br />
| 4 || GetReceiveEvent || No input, returns an output handle.<br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=NPNS_services&diff=9798
NPNS services
2020-07-22T17:21:43Z
<p>Behemoth: /* npns:s */ add stub notes. Unify notes</p>
<hr />
<div>This is used for Push Notifications.<br />
<br />
= npns:u =<br />
This is "nn::npns::INpnsUser".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || [[#ListenAll]]<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || [[#ReceiveRaw]]<br />
|-<br />
| 5 || GetReceiveEvent<br />
|-<br />
| 7 || GetStateChangeEvent<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
= npns:s =<br />
This is "nn::npns::INpnsSystem".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || GetReceiveEvent<br />
|-<br />
| 6 || [[#ListenUndelivered]]<br />
|-<br />
| 7 || GetStateChangeEvent<br />
|-<br />
| 11 || SubscribeTopic<br />
|-<br />
| 12 || UnsubscribeTopic<br />
|-<br />
| 13 || QueryIsTopicExist<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 22 || CreateTokenWithApplicationId<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 24 || DestroyTokenWithApplicationId<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 31 || UploadTokenToBaaS<br />
|-<br />
| 32 || DestroyTokenForBaaS<br />
|-<br />
| 33 || [7.0.0+] CreateTokenForBaas<br />
|-<br />
| 34 || [7.0.0+] SetBaasDeviceAccountIdList<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 105 || [3.0.0+] GetPlayReportRequestEvent<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 112 || CreateJid<br />
|-<br />
| 113 || DestroyJid<br />
|-<br />
| 114 || AttachJid<br />
|-<br />
| 115 || DetachJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|-<br />
| 161 || [10.0.0+] GetRequestChangeStateCancelEvent<br />
|-<br />
| 162 || [10.0.0+] RequestChangeStateForceTimedWithCancelEvent<br />
|-<br />
| 201 || [3.0.0+] RequestChangeStateForceTimed<br />
|-<br />
| 202 || [3.0.0+] RequestChangeStateForceAsync<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
ListenAll, ReceiveRaw, CreateToken, DestroyToken, QueryIsTokenValid are stubbed. They return 0x7fc9a on [1.0.0] and 0x36dc9a on later versions.<br />
<br />
=== ListenTo ===<br />
Takes an input u64 program id.<br />
<br />
=== ReceiveRaw ===<br />
Stubbed. Returns 0x7fc9a on [1.0.0] and 0x36dc9a on later versions.<br />
<br />
=== ListenUndelivered ===<br />
Same as calling [[#ListenTo]] with program id 0.<br />
<br />
=== CreateNotificationReceiver ===<br />
Returns an [[#INotificationReceiver]].<br />
<br />
== INotificationReceiver ==<br />
This is "nn::npns::INotificationReceiver".<br />
<br />
This was added with [7.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 1 || [[#ListenTo]] || Takes a total of 8-bytes of input, no output.<br />
|-<br />
| 2 || ListenToMyApplicationId || Takes a total of 8-bytes of input and a PID, no output.<br />
|-<br />
| 3 || Receive || Takes a total of 2-bytes of input and a type-0x6 output buffer.<br />
|-<br />
| 4 || GetReceiveEvent || No input, returns an output handle.<br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=NPNS_services&diff=9794
NPNS services
2020-07-21T01:02:39Z
<p>Behemoth: npns: move function notes to bottom. Link from both services.</p>
<hr />
<div>This is used for Push Notifications.<br />
<br />
= npns:u =<br />
This is "nn::npns::INpnsUser".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || [[#ListenAll]]<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || [[#ReceiveRaw]]<br />
|-<br />
| 5 || GetReceiveEvent<br />
|-<br />
| 7 || GetStateChangeEvent<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
= npns:s =<br />
This is "nn::npns::INpnsSystem".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || [[#ListenAll]]<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || [[#ReceiveRaw]]<br />
|-<br />
| 5 || GetReceiveEvent<br />
|-<br />
| 6 || [[#ListenUndelivered]]<br />
|-<br />
| 7 || GetStateChangeEvent<br />
|-<br />
| 11 || SubscribeTopic<br />
|-<br />
| 12 || UnsubscribeTopic<br />
|-<br />
| 13 || QueryIsTopicExist<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 22 || CreateTokenWithApplicationId<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 24 || DestroyTokenWithApplicationId<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 31 || UploadTokenToBaaS<br />
|-<br />
| 32 || DestroyTokenForBaaS<br />
|-<br />
| 33 || [7.0.0+] CreateTokenForBaas<br />
|-<br />
| 34 || [7.0.0+] SetBaasDeviceAccountIdList<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 105 || [3.0.0+] GetPlayReportRequestEvent<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 112 || CreateJid<br />
|-<br />
| 113 || DestroyJid<br />
|-<br />
| 114 || AttachJid<br />
|-<br />
| 115 || DetachJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|-<br />
| 161 || [10.0.0+] GetRequestChangeStateCancelEvent<br />
|-<br />
| 162 || [10.0.0+] RequestChangeStateForceTimedWithCancelEvent<br />
|-<br />
| 201 || [3.0.0+] RequestChangeStateForceTimed<br />
|-<br />
| 202 || [3.0.0+] RequestChangeStateForceAsync<br />
|}<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
=== ListenAll ===<br />
Stubbed. Returns 0x7fc9a on [1.0.0] and 0x36dc9a on later versions.<br />
<br />
=== ListenTo ===<br />
Takes an input u64 program id.<br />
<br />
=== ReceiveRaw ===<br />
Stubbed. Returns 0x7fc9a on [1.0.0] and 0x36dc9a on later versions.<br />
<br />
=== ListenUndelivered ===<br />
Same as calling [[#ListenTo]] with program id 0.<br />
<br />
=== CreateNotificationReceiver ===<br />
Returns an [[#INotificationReceiver]].<br />
<br />
== INotificationReceiver ==<br />
This is "nn::npns::INotificationReceiver".<br />
<br />
This was added with [7.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 1 || [[#ListenTo]] || Takes a total of 8-bytes of input, no output.<br />
|-<br />
| 2 || ListenToMyApplicationId || Takes a total of 8-bytes of input and a PID, no output.<br />
|-<br />
| 3 || Receive || Takes a total of 2-bytes of input and a type-0x6 output buffer.<br />
|-<br />
| 4 || GetReceiveEvent || No input, returns an output handle.<br />
|}<br />
<br />
[[Category:Services]]</div>
Behemoth
https://switchbrew.org/w/index.php?title=NPNS_services&diff=9793
NPNS services
2020-07-21T00:50:57Z
<p>Behemoth: npns: fix</p>
<hr />
<div>This is used for Push Notifications.<br />
<br />
= npns:u =<br />
This is "nn::npns::INpnsUser".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || [[#ListenAll]]<br />
|-<br />
| 2 || [[#ListenTo]]<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || GetReceiveEvent<br />
|-<br />
| 7 || GetStateChangeEvent<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|}<br />
<br />
=== ListenAll ===<br />
Stubbed. Returns 0x7fc9a on [1.0.0] and 0x36dc9a on later versions.<br />
<br />
=== ListenTo ===<br />
Takes an input u64 program id.<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
=== CreateNotificationReceiver ===<br />
Returns an [[#INotificationReceiver]].<br />
<br />
== INotificationReceiver ==<br />
This is "nn::npns::INotificationReceiver".<br />
<br />
This was added with [7.0.0+].<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name || Notes<br />
|-<br />
| 1 || ListenTo || Takes a total of 8-bytes of input, no output.<br />
|-<br />
| 2 || ListenToMyApplicationId || Takes a total of 8-bytes of input and a PID, no output.<br />
|-<br />
| 3 || Receive || Takes a total of 2-bytes of input and a type-0x6 output buffer.<br />
|-<br />
| 4 || GetReceiveEvent || No input, returns an output handle.<br />
|}<br />
<br />
= npns:s =<br />
This is "nn::npns::INpnsSystem".<br />
<br />
{| class="wikitable" border="1"<br />
|-<br />
! Cmd || Name<br />
|-<br />
| 1 || ListenAll<br />
|-<br />
| 2 || ListenTo<br />
|-<br />
| 3 || Receive<br />
|-<br />
| 4 || ReceiveRaw<br />
|-<br />
| 5 || GetReceiveEvent<br />
|-<br />
| 6 || [[#ListenUndelivered]]<br />
|-<br />
| 7 || GetStateChangeEvent<br />
|-<br />
| 11 || SubscribeTopic<br />
|-<br />
| 12 || UnsubscribeTopic<br />
|-<br />
| 13 || QueryIsTopicExist<br />
|-<br />
| 21 || CreateToken<br />
|-<br />
| 22 || CreateTokenWithApplicationId<br />
|-<br />
| 23 || DestroyToken<br />
|-<br />
| 24 || DestroyTokenWithApplicationId<br />
|-<br />
| 25 || QueryIsTokenValid<br />
|-<br />
| 26 || [5.0.0+] ListenToMyApplicationId<br />
|-<br />
| 31 || UploadTokenToBaaS<br />
|-<br />
| 32 || DestroyTokenForBaaS<br />
|-<br />
| 33 || [7.0.0+] CreateTokenForBaas<br />
|-<br />
| 34 || [7.0.0+] SetBaasDeviceAccountIdList<br />
|-<br />
| 101 || Suspend<br />
|-<br />
| 102 || Resume<br />
|-<br />
| 103 || GetState<br />
|-<br />
| 104 || [3.0.0+] GetStatistics<br />
|-<br />
| 105 || [3.0.0+] GetPlayReportRequestEvent<br />
|-<br />
| 111 || GetJid<br />
|-<br />
| 112 || CreateJid<br />
|-<br />
| 113 || DestroyJid<br />
|-<br />
| 114 || AttachJid<br />
|-<br />
| 115 || DetachJid<br />
|-<br />
| 120 || [7.0.0+] [[#CreateNotificationReceiver]]<br />
|-<br />
| 151 || [8.0.0+] GetStateWithHandover<br />
|-<br />
| 152 || [8.0.0+] GetStateChangeEventWithHandover<br />
|-<br />
| 153 || [8.0.0+] GetDropEventWithHandover<br />
|-<br />
| 161 || [10.0.0+] GetRequestChangeStateCancelEvent<br />
|-<br />
| 162 || [10.0.0+] RequestChangeStateForceTimedWithCancelEvent<br />
|-<br />
| 201 || [3.0.0+] RequestChangeStateForceTimed<br />
|-<br />
| 202 || [3.0.0+] RequestChangeStateForceAsync<br />
|}<br />
<br />
=== ListenUndelivered ===<br />
Same as calling [[#ListenTo]] with program id 0.<br />
<br />
[5.0.0+] CreateToken/DestroyToken now takes an additional 8-bytes of input and a PID.<br />
<br />
[[Category:Services]]</div>
Behemoth