The platform

The NPDM tells an Ounce program (snx_npdm_ounce in loader/ounce.h). An Ounce ACID's signature and key are 0x180 bytes each, where a Switch's are 0x100, so its magic is at 0x300 of the ACID, not at 0x200. The recompiler and the runtime read the same NPDM, and g_ounce is the one flag. It gives the game these, with no setting:

tools/nvn_missing.py work/Game lists the NVN functions of a game's driver that nvn.hook doesn't implement for its API version.

GameChat's images and the camera

The update of a racing game (a newer SDK than its first version) starts GameChat at boot, and makes its camera video storage with nn::chat::gsv: three NV12 images of 384x216 (kind 1) in each storage. The SDK sends TIPC types 1307, 1227 and 1228, which are gsv commands 1291, 1211 and 1212. CalculateRequiredBufferMemory (1291), CreateImagePool (1211) and DestroyImagePool (1212) send the request of the decoder's 991, 911 and 912, and read the same answer. The chat's pools are thus the video service's pools (native_video.c).

NVN makes a memory pool of each image with nvnNativeImageInitialize. That function asks QueryNativeImage (428) for the image's page span, and gives it to NvRmMemHandleAllocNativeImage, which makes an NvRm memory handle for the image. Then it gives the handle to nvnMemoryPoolBuilderSetNativeHandleNVX. The SDK's NvRm numbers its handles from 1, for each handle it makes, so the handle is not a native memory or an image number. The runtime's nvnMemoryPoolInitialize asks the SDK's NvRmMemGetNativeImageHandle for the image, as the driver does. Before, it took the handle for a native memory number, which was right only while the two numbers agreed. Another game, whose title movie uses the video pools, makes no such pool.

The camera session (gsv 602) answers as a console with no camera plugged in. The SDK's nn::camera::Initialize sends command 3 with the device name "Default" and keeps the u64 of the answer as the camera's device handle. It aborts on every result but success and 0xdc4 (module 452, description 6), and gives 0xdc4 to the game. A game with its own webcam code reads 0xdc4 as a platform without the camera function, skips the setup of its webcam, and then reads a pointer of that webcam that is still zero. An Ounce has the camera function whether or not a camera is plugged in, so 3 and Finalize's 4 succeed. Each other command answers 0x7c4 (description 3), which QueryDeviceConnection (29, sent again and again) lets pass and the game logs as no camera device found. Command 21 must give an event, which the module attaches as a system event. The module stops if 21 fails. With no camera, the event is never signaled.


Made from docs/platforms/nx/ounce.md at 69237645142c. GPL-3.0-or-later.