### Start Source: https://switchbrew.org/wiki/Audio_services Starts audio playback. ```APIDOC ## Start ### Description Starts audio playback using data from appended buffers. ``` -------------------------------- ### StartProcess Source: https://switchbrew.org/wiki/SVC Starts the execution of a created process. ```APIDOC ## StartProcess ### Description Starts the execution of a process with specified thread priority, CPU ID, and stack size. ### Parameters - **ProcessHandle** (Handle) - In - The handle of the process to start. - **MainThreadPriority** (int32_t) - In - Priority for the main thread. - **DefaultCpuId** (int32_t) - In - The default CPU ID for the process. - **MainThreadStackSize** (uint64_t) - In - The stack size for the main thread. ### Response - **Result** (#Result) - Out - The result of the operation. ``` -------------------------------- ### IAudioIn::Start Source: https://switchbrew.org/wiki/Audio_services Starts the audio input stream. ```APIDOC ## Start ### Description Starts the audio input stream for the current #IAudioIn session. ``` -------------------------------- ### CreateApplicationAndPushAndRequestToStart Source: https://switchbrew.org/wiki/AM_services Creates an application, pushes storage, and requests it to start. ```APIDOC ## CreateApplicationAndPushAndRequestToStart ### Description Creates an application and pushes an IStorage object, then requests the application to start. ApplicationId 0 can be used to relaunch the current application. ### Parameters - **ApplicationId** (u64) - Required - The ID of the application to start. - **IStorage** (Object) - Required - The storage object to push. ``` -------------------------------- ### RequestNetworkInstallTaskRun Source: https://switchbrew.org/wiki/NIM_services Initiates a network installation task. ```APIDOC ## RequestNetworkInstallTaskRun ### Description Requests the execution of a network install task. Version 13.0.0+ requires an additional 1-byte input. ### Parameters - **input** (0x10-bytes) - **input_extra** (1-byte, 13.0.0+) ### Returns - **IAsyncResult** - **Handle** ``` -------------------------------- ### Initialize a new homebrew project Source: https://switchbrew.org/wiki/Setting_up_Development_Environment Copy the application template to a new directory and navigate into it to start development. ```bash cp -r $DEVKITPRO/examples/switch/templates/application **~/projects/myswitchproject** cd **~/projects/myswitchproject** ``` -------------------------------- ### StartOffscreenRecordingEx Source: https://switchbrew.org/wiki/GRC_services Starts an offscreen recording session with specified parameters. ```APIDOC ## StartOffscreenRecordingEx ### Description Initiates recording for the specified offscreen layer. ### Parameters #### Request Body - **LayerHandle** (u64) - Required - The handle for the layer. - **OffscreenRecordingParameter** (object) - Required - Configuration parameters for the recording. ``` -------------------------------- ### Sample File Association Configuration Source: https://switchbrew.org/wiki/Homebrew_Menu Example of a .cfg file structure defining application paths, icons, and argument handling for specific file extensions and filenames. ```text fileassoc={ app_path="/switch/myapp/app.nro"; icon_path="/switch/myapp/myicon.jpg"; app_args = ["arg1", "arg2", "%f"]; targets=( { file_extension=".ext3"; icon_path="/switch/myapp/myicon2.jpg"; app_args = ["arg1", "arg2", "--path=%f"]; // Optional, overrides fileassoc.app_args. }, { file_extension=".ext4"; icon_path="/switch/myapp/myicon3.jpg"; }, { filename="main.py"; icon_path="/switch/myapp/myicon4.jpg"; } ); }; ``` -------------------------------- ### StartLrAssignmentMode Source: https://switchbrew.org/wiki/HID_services Starts the L/R assignment mode. ```APIDOC ## StartLrAssignmentMode ### Description Takes a PID and an AppletResourceUserId, no output. ### Parameters - **PID** (PID) - Required - **AppletResourceUserId** (u64) - Required ``` -------------------------------- ### Controller Version Format Source: https://switchbrew.org/wiki/Support_Information Example of the version string format for controllers and touch screen. ```text ⑥ TS.32.00.00.01 / JL.04.20.00.00 / JR.04.20.09.20 ``` -------------------------------- ### StartAudioOut Source: https://switchbrew.org/wiki/Bluetooth_Driver_services Starts an audio output stream. ```APIDOC ## StartAudioOut ### Description Starts an AV stream using the specified audio handle and parameters. ### Parameters - **audio_handle** (u32) - Required - **PcmParameter** (input) - Required - **latency** (nn::TimeSpan) - Required ### Response - **latency** (nn::TimeSpan) - The resulting latency. - **value** (u64) ``` -------------------------------- ### SecureBootLdr Address Calculation [6.2.0+] Source: https://switchbrew.org/wiki/TSEC_Firmware Calculates the start address for SecureBootLdr using key data offsets and jumps to the next blob. ```C u8 key_data_buf[0x84]; // Read the key data blob u32 key_data_addr = 0x300; u32 key_data_size = 0x84; memcpy_i2d(key_data_buf, key_data_addr, key_data_size); // Calculate the next blob's address in Falcon code segment u32 blob4_size = *(u32 *)(key_data_buf + 0x80); u32 blob0_size = *(u32 *)(key_data_buf + 0x70); u32 blob1_size = *(u32 *)(key_data_buf + 0x74); u32 blob2_size = *(u32 *)(key_data_buf + 0x78); u32 blob3_addr = blob0_size + blob1_size + 0x100 + blob2_size + blob4_size; // Jump to next blob (void *)blob3_addr(); return 0; ``` -------------------------------- ### Game Case ID Examples Source: https://switchbrew.org/wiki/Talk%3ATitle_list/Games Examples of game case identifiers found on the back of physical game packaging. ```text Zelda BotW - HAC P AAAAA CAN | 105212A Disgaea 5 - HAC P AACAC | DISS-SWI-US-VG ``` -------------------------------- ### SystemInitializer Command-Line Help Output Source: https://switchbrew.org/wiki/SystemInitializer Displays the usage instructions and available command-line arguments for the SystemInitializer tool. ```text [ERROR] Argument(-i | --input) is not found. SystemUpdater: Update the system by the system initial image. Usage: SystemUpdater -i | --input [--dry-run] [--print-info] [--enable-overwriting-production-info] [--enable-erase-emmc] -r | --output-request -s | --input-response -o | --output-result [--verify-key] [--cal-image ] [-s | --silent] [-v | --verbose] [--debug] [-h |--help] Arguments: -i | --input Input the initial image. --dry-run Run without writing to the storage. --print-info Print about the initial image. --enable-overwriting-production-info For device production. --enable-erase-emmc For device production. -r | --output-request set request path as output. -s | --input-response set response path as input. -o | --output-result set result path as output. --verify-key verify key pairs in cal. --cal-image set cal image path. -s | --silent Disable logs except errors. -v | --verbose Output many logs. --debug Output many logs for developer. -h | --help Display help. ``` -------------------------------- ### IsLlrStarted Source: https://switchbrew.org/wiki/BTM_services Checks if LLR is started. ```APIDOC ## IsLlrStarted ### Description Returns a boolean indicating if LLR is started. ``` -------------------------------- ### CreateApplicationAndPushAndRequestToLaunch Source: https://switchbrew.org/wiki/Applet_Manager_services Creates an application, pushes storage, and requests a launch. ```APIDOC ## CreateApplicationAndPushAndRequestToLaunch ### Description Creates an application, pushes storage, and requests a launch. ### Parameters - **ApplicationId** (input) - The ID of the application. - **IStorage** (input) - The storage object. ``` -------------------------------- ### CreateApplicationAndPushAndRequestToLaunch Source: https://switchbrew.org/wiki/AM_services Launches an application with a provided storage object. ```APIDOC ## CreateApplicationAndPushAndRequestToLaunch ### Description Launches an application using the specified ApplicationId and IStorage. ### Parameters - **ApplicationId** (input) - The ID of the application to launch. - **IStorage** (input) - The storage object to push. ``` -------------------------------- ### StartJcms Source: https://switchbrew.org/wiki/HID_services Starts Jcms (exclusive to S2). ```APIDOC ## StartJcms ### Description Starts Jcms functionality. Exclusive to S2 hardware. ### Parameters - **PID** (s32) - Required - **JcmsHandle** (handle) - Required - **AppletResourceUserId** (u64) - Required ``` -------------------------------- ### EndPermitVibrationSession Source: https://switchbrew.org/wiki/HID_services Ends the session started by BeginPermitVibrationSession. ```APIDOC ## EndPermitVibrationSession ### Description Ends the current forced-permitted vibration session. ``` -------------------------------- ### Switch 2 Controller Version Format Source: https://switchbrew.org/wiki/Support_Information Example of the version string format for Switch 2 controllers. ```text ⑥ OJL.02.01.04 / OJR.02.01.04-16 ``` -------------------------------- ### Main SecureBoot Initialization Source: https://switchbrew.org/wiki/TSEC_Firmware Reads hardware configuration, sets the stack pointer, and initiates the SecureBoot process. ```C // Read data segment size from IO space u32 data_seg_size = *(u32 *)FALCON_HWCFG; data_seg_size >>= 0x01; data_seg_size &= 0xFF00; // Set the stack pointer $sp = data_seg_size; // Jump to the SecureBoot blob's Falcon OS image boot stub init_secboot(); // Halt execution exit(); return; ``` -------------------------------- ### GetInitialLaunchSettings Source: https://switchbrew.org/wiki/Settings_services Retrieves the initial launch settings. ```APIDOC ## GetInitialLaunchSettings ### Description Retrieves the initial launch settings. ### Response - **InitialLaunchSettings** (object) - The initial launch configuration. ``` -------------------------------- ### StartBleScanForGeneral Source: https://switchbrew.org/wiki/BTM_services Starts a general BLE scan. ```APIDOC ## StartBleScanForGeneral ### Description Starts a general BLE scan using the provided BleAdvertisePacketParameter. ### Parameters - **BleAdvertisePacketParameter** (BleAdvertisePacketParameter) - Required ``` -------------------------------- ### IsAnyApplicationEntityInstalled Source: https://switchbrew.org/wiki/NS_Services Checks if any entity for an application is installed. ```APIDOC ## IsAnyApplicationEntityInstalled ### Description Checks if any entity associated with the application ID is currently installed. ### Parameters - **ApplicationId** (u64) - Required - The ID of the application. ### Response - **bool** (u8) - True if installed, false otherwise. ``` -------------------------------- ### Socket Setup Logic for CreateLocalCommunicationSendSystemUpdateTask Source: https://switchbrew.org/wiki/NIM_services Outlines the socket configuration steps performed during the creation of a send system update task, including non-blocking mode and socket options. ```c * Sets the output sockfds in state to -1 (unrelated to "sockfd" below). * Clears the sockaddr_in. * sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); {handle error on fail} * Uses fcntl with F_GETFL/F_SETFL to set O_NONBLOCK, handling error on fail. * u64 tmpval=1; setsockopt(sockfd, SOL_SOCKET, SO_VENDOR + 0x1, &tmpval, sizeof(tmpval)); {handle error on fail} * u32 tmpval2=1; setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &tmpval2, sizeof(tmpval2)); {handle error on fail} * Initializes sockaddr_in: sin_addr = htonl(INADDR_ANY), sin_port = htons({input port}), and sin_family = AF_INET (sin_len is left at 0). * bind(sockfd, sockaddr_in, sizeof(sockaddr_in)); {handle error on fail} * listen(sockfd, 1); {handle error on fail} * Writes sockfd to the output sockfd state field, copies the input ipaddr u32 into state, then returns 0. * The error handling for bind()/listen() will also close the socket, when certain errors occur. ``` -------------------------------- ### Package1 Layout and Entrypoint Calculation Source: https://switchbrew.org/wiki/2.0.0 Comparison of the binary layout and entrypoint calculation logic between pre-2.0.0 and 2.0.0+ versions. ```text Old layout (before 2.0.0): 1.- PK11 header 2.- Secure Monitor blob 3.- NX bootloader blob 4.- Warmboot blob NX bootloader entrypoint is calculated as: 0x40013FE0 + 0x20 + 0x20 + NX bootloader blob's offset + Secure Monitor blob's size ``` ```text New layout (2.0.0+): 1.- PK11 header 2.- Warmboot blob 3.- NX bootloader blob 4.- Secure Monitor blob NX bootloader entrypoint is calculated as: 0x40013FE0 + 0x20 + 0x20 + NX bootloader blob's offset + Warmboot blob's size ``` -------------------------------- ### init_secboot Routine Source: https://switchbrew.org/wiki/TSEC_Firmware Handles loading, authenticating, and executing the SecureBoot image. Includes version-specific logic for IMEM protection. ```C // Read the transfer base address from IO space u32 xfer_ext_base_addr = *(u32 *)FALCON_DMATRFBASE; // Copy transfer base address to data memory u32 scratch_data_addr = 0x300; *(u32 *)scratch_data_addr = xfer_ext_base_addr; // Set the transfer base address xcbase(xfer_ext_base_addr); // The next xfer instruction will be overridden // and target changes from DMA to crypto cxset(0x01); u32 crypto_reg_flag = 0x00060000; u32 blob4_flcn_os_img_hash_addr = 0; // Transfer data to crypto register c6 xdst(0, (blob4_flcn_os_img_hash_addr | crypto_reg_flag)); // The next xfer instruction will be overridden // and target changes from DMA to crypto cxset(0x01); // Wait for all data loads/stores to finish xdwait(); cmov($c7, $c6); cxor($c7, $c7); // Set auth_addr to 0x100, auth_size to 0x1300, // bit 16 (use_secret) and bit 17 (is_encrypted) $cauth = ((0x02 << 0x10) | (0x01 << 0x10) | (0x1300 << 0x10) | (0x100 >> 0x08)); // Clear interrupt flags $flags.ie0 = 0; $flags.ie1 = 0; $flags.ie2 = 0; // Jump to the SecureBoot blob's Falcon OS image exec_secboot(); return 0x0F0F0F0F; ``` ```C // The next xfer instruction will be overridden // and target changes from DMA to crypto cxset(0x01); u32 crypto_reg_flag = 0x00060000; u32 blob4_flcn_os_img_hash_addr = 0; // Transfer data to crypto register c6 xdst(0, (blob4_flcn_os_img_hash_addr | crypto_reg_flag)); // The next xfer instruction will be overridden // and target changes from DMA to crypto cxset(0x01); // Wait for all data loads/stores to finish xdwait(); cmov($c7, $c6); cxor($c7, $c7); // Set auth_addr to 0x100, auth_size to 0x1D00, // bit 16 (use_secret) and bit 17 (is_encrypted) $cauth = ((0x02 << 0x10) | (0x01 << 0x10) | (0x1D00 << 0x10) | (0x100 >> 0x08)); // Clear interrupt flags $flags.ie0 = 0; $flags.ie1 = 0; $flags.ie2 = 0; // Fill remaining IMEM with secret pages bool use_secret = true; memcpy_d2i(0x1E00, 0, 0x2200, 0x1E00, use_secret); memcpy_d2i(0x4000, 0, 0x4000, 0x4000, use_secret); // Wait for all code loads to finish xcwait(); // Jump to the SecureBoot blob's Falcon OS image exec_secboot(); return 0x0F0F0F0F; ``` -------------------------------- ### GetNotificationStorageChannelEvent Source: https://switchbrew.org/wiki/AM_services Gets the event for notification storage. ```APIDOC ## GetNotificationStorageChannelEvent ### Description Returns an Event handle for the notification storage channel. ``` -------------------------------- ### GetPreviousProgramIndex Source: https://switchbrew.org/wiki/AM_services Gets the ProgramIndex of the launching application. ```APIDOC ## GetPreviousProgramIndex ### Description Returns the ProgramIndex of the application that launched the current title. Returns -1 if there was no previous title. ``` -------------------------------- ### StartMonitoring Source: https://switchbrew.org/wiki/NSD_services Initializes monitoring for a specific process after client registration. ```APIDOC ## StartMonitoring ### Description Used after the RegisterClient command by the user-process to start monitoring. ### Parameters - **PID** (u32) - Required - Process ID. - **pid_reserved** (u64) - Required - Reserved PID value. ``` -------------------------------- ### StartThread Source: https://switchbrew.org/wiki/SVC Starts execution of a thread given its handle. ```APIDOC ## StartThread ### Description Starts the thread for the provided handle. ### Parameters - **ThreadHandle** (Handle) - Input (W0) ``` -------------------------------- ### BootWithRemoteMemory Source: https://switchbrew.org/wiki/%28Switch_2%29_GSV_services Initializes the service using a Process handle and remote memory configuration. ```APIDOC ## BootWithRemoteMemory ### Description Initializes the service using a Process handle, AppletResourceUserId, and specific configuration parameters. ### Parameters - **Process handle** (handle) - Required - The handle for the process. - **AppletResourceUserId** (u64) - Required - The resource ID for the applet. - **Version** (u64) - Required - The version identifier (e.g., 0x8000000000000001). - **InfoType Output** (u64) - Required - The output from InfoType 31 or 32. - **Reserved** (u64) - Required - Three additional u64 parameters set to 0. ``` -------------------------------- ### NotifyAudioInStarted Source: https://switchbrew.org/wiki/PSC_services Notifies the service that audio input has started. ```APIDOC ## NotifyAudioInStarted ### Description Notifies the service that audio input has started. ### Parameters - **buffer** (type-0x5) - Required - **input** (u64) - Required ``` -------------------------------- ### CreateVideoProxy Source: https://switchbrew.org/wiki/GRC_services Initializes a video proxy and returns an IHOSBinderDriver. ```APIDOC ## CreateVideoProxy ### Description Creates a video proxy instance. ### Response - **IHOSBinderDriver** (object) - The binder driver instance. ``` -------------------------------- ### StartBleScanForSmartDevice Source: https://switchbrew.org/wiki/BTM_services Starts a BLE scan for smart devices. ```APIDOC ## StartBleScanForSmartDevice ### Description Starts a BLE scan for smart devices using the provided GattAttributeUuid. ### Parameters - **GattAttributeUuid** (GattAttributeUuid) - Required ``` -------------------------------- ### InitializeApplicationInfoV0 Source: https://switchbrew.org/wiki/Account_services Initializes application information version 0. ```APIDOC ## InitializeApplicationInfoV0 ### Description Initializes application info version 0 during service init. ### Parameters - **PID** (integer) - Required - Process ID - **pid_placeholder** (u64) - Required - Placeholder value ``` -------------------------------- ### StartBleScanForPaired Source: https://switchbrew.org/wiki/BTM_services Starts a BLE scan for paired devices. ```APIDOC ## StartBleScanForPaired ### Description Starts a BLE scan for paired devices using the provided BleAdvertisePacketParameter. ### Parameters - **BleAdvertisePacketParameter** (BleAdvertisePacketParameter) - Required ``` -------------------------------- ### Main Bootloader Execution Flow Source: https://switchbrew.org/wiki/Bootloader Performs system initialization, security checks, key generation, and decryption of the PK11 blob to prepare for the next boot stage. ```c // Poison all exception vectors *(u32 *)0x6000F200 = panic(); *(u32 *)0x6000F204 = panic(); *(u32 *)0x6000F208 = panic(); *(u32 *)0x6000F20C = panic(); *(u32 *)0x6000F210 = panic(); *(u32 *)0x6000F214 = panic(); *(u32 *)0x6000F218 = panic(); *(u32 *)0x6000F21C = panic(); u32 bss_addr_end = bss_addr_start; u32 bss_offset = 0; u32 bss_size = bss_addr_end - bss_addr_start; // Clear .bss region // Never happens due to bss_size being set to 0 while (bss_offset < bss_size) { *(u32 *)bss_addr_start + bss_offset = 0; bss_offset += 0x04; } u32 init_array_addr_end = init_array_addr_start; u32 init_array_offset = init_array_addr_start; // Call init methods // Never happens due to init_array_addr_end being set to init_array_addr_start while (init_array_offset < init_array_addr_end) { u32 init_method_offset = *(u32 *)init_array_offset; call_init_method(init_method_offset + init_array_offset); init_array_offset += 0x04; } // Setup I2S1, I2S2, I2S3, I2S4, DISPLAY and VIC mbist_workaround(); // Program the SE clock and resets // Uses RST_DEVICES_V, CLK_OUT_ENB_V, CLK_SOURCE_SE and CLK_V_SE enable_se_clkrst(); // Set MISC_CLK_ENB // This makes fuse registers visible enable_misc_clk(0x01); // Read FUSE_SKU_INFO and compare with 0x83 check_sku(); // Check configuration fuses check_config_fuses(); u32 bct_iram_addr = 0x40000000; // Check bootloader version from BCT check_bootloader_ver(bct_iram_addr); // Check anti-downgrade fuses check_downgrade(); // Set FUSE_DIS_PGM // Disables fuse programming until next reboot disable_fuse_pgm(); // Setup memory controllers enable_mem_ctl(); // Setup the security engine's address set_se_addr(0x70012000); // Check SE global config check_se_status(); // Generate keys keygen(bct_iram_addr); u32 pk11_blob_addr = 0x40013FE0; // Decrypt the PK11 blob and get the next stage's entrypoint nx_boot_addr = decrypt_pk11_blob(pk11_blob_addr); u32 nx_boot_sp = 0x40007000; // Set the stack pointer and jump to a stub responsible // for cleaning up and branching into the next stage exec_nx_boot_stub(nx_boot_addr, nx_boot_stub_addr, nx_boot_sp); return; ``` -------------------------------- ### GetNetworkInstallTaskInfo Source: https://switchbrew.org/wiki/NIM_services Retrieves information about a network installation task. ```APIDOC ## GetNetworkInstallTaskInfo ### Description Returns information for the specified network install task. ### Parameters - **NetworkInstallTaskId** (NetworkInstallTaskId) - Required ### Returns - **NetworkInstallTaskInfo** ``` -------------------------------- ### GetThreadPriority Source: https://switchbrew.org/wiki/SVC Gets the priority of provided thread handle. ```APIDOC ## GetThreadPriority ### Description Gets the priority of provided thread handle. ### Parameters - **ThreadHandle** (Handle) - Required - The handle of the thread to query. ### Response - **Result** (#Result) - Operation result code. - **Priority** (int32_t) - The priority of the thread. ``` -------------------------------- ### Initialize Source: https://switchbrew.org/wiki/Local_Network_Monitor_services Initializes the service using a PID and a placeholder. Used immediately after object creation. ```APIDOC ## Initialize ### Description Initializes the service object. On newer system versions, this is an alias for InitializeWithVersion with version=0. ### Parameters - **PID** (input) - Required - **pid_placeholder** (u64) - Required ``` -------------------------------- ### IRequest::Get Source: https://switchbrew.org/wiki/PTM_services Gets the actual clock rate. ```APIDOC ## Get ### Description Retrieves the current actual clock rate. ### Response - **ClockRateActual** (u32) ``` -------------------------------- ### InitializeApplicationInfoV1 Source: https://switchbrew.org/wiki/Account_services Initializes application information version 1. ```APIDOC ## InitializeApplicationInfoV1 ### Description Initializes application info version 1 during service init. ### Parameters - **PID** (integer) - Required - Process ID - **pid_placeholder** (u64) - Required - Placeholder value ``` -------------------------------- ### GetFriendInvitationStorageChannelEvent Source: https://switchbrew.org/wiki/AM_services Gets the event for friend invitation storage. ```APIDOC ## GetFriendInvitationStorageChannelEvent ### Description Returns an Event handle for the friend invitation storage channel. ``` -------------------------------- ### GetGpuErrorDetectedSystemEvent Source: https://switchbrew.org/wiki/AM_services Gets the system event for GPU errors. ```APIDOC ## GetGpuErrorDetectedSystemEvent ### Description Returns an Event handle that is signaled when a GPU error is detected. ``` -------------------------------- ### CreateJitEnvironment Source: https://switchbrew.org/wiki/JIT_services Initializes the JIT environment by mapping CodeMemory regions and setting up the process state. ```APIDOC ## CreateJitEnvironment ### Description Initializes the JIT environment. It takes process and CodeMemory handles to map memory regions for run-time code generation. ### Parameters - **CodeMemory sizes** (u64, u64) - Required - Sizes for the two CodeMemory regions. - **Process handle** (handle) - Required - Handle to the target process. - **CodeMemory handles** (handle, handle) - Required - Handles for the CodeMemory regions. ### Returns - **IJitEnvironment** - The initialized JIT environment object. ``` -------------------------------- ### SetupStandardNetworkSystemClockCore Source: https://switchbrew.org/wiki/PSC_services Configures the standard network system clock core. ```APIDOC ## SetupStandardNetworkSystemClockCore ### Description Takes an input #SystemClockContext and an input sufficient_accuracy_minutes u64. No output. ``` -------------------------------- ### GetCurrentApplicationId Source: https://switchbrew.org/wiki/AM_services Gets the ApplicationId for the currently running application. ```APIDOC ## GetCurrentApplicationId ### Description Gets the ApplicationId for the currently running Application. Returns 0 when no Application is running. ### Response - **ApplicationId** (output) - The ID of the current application. ``` -------------------------------- ### BatchBufferAsync Source: https://switchbrew.org/wiki/USB_services Starts an asynchronous data transfer with multiple urbs. ```APIDOC ## BatchBufferAsync ### Description Uses the same internal logic as PostBufferAsync but allows specifying multiple urbs via an input buffer. ### Parameters - **urbCount** (u32) - Total number of entries in the input buffer array. - **unk1** (u32) - Unknown parameter. - **unk2** (u32) - Unknown parameter. - **buffer** (u64) - Input buffer address. - **Id** (u64) - Identifier for the request. ``` -------------------------------- ### BootWithTransferMemory Source: https://switchbrew.org/wiki/%28Switch_2%29_GSV_services Initializes the service using a TransferMemory handle and associated resource ID. ```APIDOC ## BootWithTransferMemory ### Description Initializes the service using a provided TransferMemory handle and AppletResourceUserId. ### Parameters - **TransferMemory handle** (handle) - Required - The handle for the transfer memory. - **AppletResourceUserId** (u64) - Required - The resource ID for the applet. - **TransferMemorySize** (u64) - Required - The size of the transfer memory. ``` -------------------------------- ### PostBufferAsync Source: https://switchbrew.org/wiki/USB_services Starts an asynchronous data transfer with a single urb. ```APIDOC ## PostBufferAsync ### Description Starts a data transfer with a single urb. Returns an output xferId. ### Parameters - **size** (u32) - Input size. - **buffer** (u64) - Input buffer address. - **Id** (u64) - Identifier for the request. ``` -------------------------------- ### StartFirmwareUpdate Source: https://switchbrew.org/wiki/HID_services Initiates a firmware update. ```APIDOC ## StartFirmwareUpdate ### Description Initiates a firmware update. Requires 0x20-bytes of input and 2 handles (pre-3.0.0) or 8-bytes of input (3.0.0+). ``` -------------------------------- ### StartDiscovery Source: https://switchbrew.org/wiki/BTM_services Initiates the Bluetooth device discovery process. ```APIDOC ## StartDiscovery ### Description Starts the discovery process for Bluetooth devices. ``` -------------------------------- ### IGameMovieTrimmer - BeginTrim Source: https://switchbrew.org/wiki/GRC_services Starts the trimming process for a game movie. ```APIDOC ## BeginTrim ### Description Initiates the trimming of a game movie based on start and end timestamps. ### Parameters - **start** (s32) - Required - Start timestamp in 0.5s units. - **end** (s32) - Required - End timestamp in 0.5s units. - **GameMovieId** (struct) - Required - Identifier for the movie to be trimmed. ``` -------------------------------- ### Initialize and Execute KeygenLdr Source: https://switchbrew.org/wiki/TSEC_Firmware Configures the Falcon crypto co-processor, validates stack bounds, and triggers the Keygen loading process. ```C // Clear interrupt flags $flags.ie0 = 0; $flags.ie1 = 0; $flags.ie2 = 0; // Clear overrides cxset(0x80); // Clear bit 0x13 in cauth $cauth = ($cauth & ~(1 << 0x13)); // Set the target port for memory transfers $xtargets = 0; // Wait for all data loads/stores to finish xdwait(); // Wait for all code loads to finish xcwait(); // The next 2 xfer instructions will be overridden // and target changes from DMA to crypto cxset(0x02); // Transfer data to crypto register c0 // This should clear any leftover data xdst(0, 0); // Wait for all data loads/stores to finish xdwait(); // Clear all crypto registers, except c6 which is used for auth cxor($c0, $c0); cmov($c1, $c0); cmov($c2, $c0); cmov($c3, $c0); cmov($c4, $c0); cmov($c5, $c0); cmov($c7, $c0); // Clear TSEC_TEGRA_CTL_TKFI_KFUSE // This is TSEC_MMIO + 0x1000 + (0x20E00 / 0x40) *(u32 *)TSEC_TEGRA_CTL &= 0xFFFEFFFF; // Set TSEC_SCP_CTL_PKEY_REQUEST_RELOAD // This is TSEC_MMIO + 0x1000 + (0x10600 / 0x40) *(u32 *)TSEC_SCP_CTL_PKEY |= 0x01; u32 is_pkey_loaded = 0; // Wait for TSEC_SCP_CTL_PKEY_LOADED while (!is_pkey_loaded) is_pkey_loaded = (*(u32 *)TSEC_SCP_CTL_PKEY & 0x02); // Read data segment size from IO space u32 data_seg_size = *(u32 *)FALCON_HWCFG; data_seg_size >>= 0x09; data_seg_size &= 0x1FF; data_seg_size <<= 0x08; // Check stack bounds if (($sp >= data_seg_size) || ($sp < 0x800)) exit(); // Load and execute the Keygen stage load_keygen(key_buf, key_version, is_blob_dec); // Clear the cauth signature csigclr(); // Clear all crypto registers cxor($c0, $c0); cxor($c1, $c1); cxor($c2, $c2); cxor($c3, $c3); cxor($c4, $c4); cxor($c5, $c5); cxor($c6, $c6); cxor($c7, $c7); // Take SCP out of lockdown // This is TSEC_MMIO + 0x1000 + (0x10300 / 0x40) *(u32 *)TSEC_SCP_CTL_LOCK = 0; return; ``` -------------------------------- ### OpenMainApplication Source: https://switchbrew.org/wiki/Applet_Manager_services Opens the main application and returns an accessor. ```APIDOC ## OpenMainApplication ### Description Opens the main application. Should not be called when no application is currently running. ### Response - **accessor** (#IApplicationAccessor) - The accessor for the opened application. ``` -------------------------------- ### GetThreadCoreMask Source: https://switchbrew.org/wiki/SVC Gets the affinity mask of provided thread handle. ```APIDOC ## GetThreadCoreMask ### Description Gets the affinity mask of provided thread handle. ### Parameters - **ThreadHandle** (Handle) - Required - The handle of the thread to query. ### Response - **Result** (#Result) - Operation result code. - **CoreMask0** (int32_t) - Core mask part 0. - **CoreMask1** (uint64_t) - Core mask part 1. ``` -------------------------------- ### Open Source: https://switchbrew.org/wiki/NSD_services Opens a device file, specifically limited to /dev/bpf. ```APIDOC ## Open ### Description FreeBSD's open command, limited to opening /dev/bpf for operations like enabling promiscuous mode. ``` -------------------------------- ### NVGPU_TSG_IOCTL_GET_TIMESLICE Source: https://switchbrew.org/wiki/NV_services Gets how long a channel occupies an engine uninterrupted. ```APIDOC ## NVGPU_TSG_IOCTL_GET_TIMESLICE ### Description Gets how long a channel occupies an engine uninterrupted. ### Response - **timeslice_us** (u32) - The timeslice duration in microseconds. ``` -------------------------------- ### GetClkrstStateTableUpdateEvent Source: https://switchbrew.org/wiki/BPC_services Gets an event handle for state table updates. ```APIDOC ## GetClkrstStateTableUpdateEvent ### Description Returns an event handle that signals when the state table has been updated. ### Returns - **Event handle** ``` -------------------------------- ### Initialize Source: https://switchbrew.org/wiki/NV_services Initializes the NV driver service session. ```APIDOC ## Initialize ### Description Initializes the service with process and transfer memory handles. ### Parameters - **ProcessHandle** (handle) - Required - The process handle. - **TransferMemoryHandle** (handle) - Required - The transfer memory handle. - **Size** (u32) - Required - The size of the memory. ### Response - **Err** (u32) - Error code. ``` -------------------------------- ### Start Transfer JSON Request Source: https://switchbrew.org/wiki/Domains JSON structure for the /start endpoint. ```json {"type":,"scope":,"src_device_appearance_main":"","src_device_appearance_controller":""} ``` -------------------------------- ### StartInquiry Source: https://switchbrew.org/wiki/Bluetooth_Driver_services Initiates a Bluetooth device inquiry process. ```APIDOC ## StartInquiry ### Description Starts the device inquiry process. Results are retrieved via GetEventInfo. In versions 12.0.0+, duration and service filters can be specified. ### Parameters - **services** (BitFlagSet 32bit) - Optional - Service filter for inquiry (12.0.0+). - **nanoseconds_duration** (s64) - Optional - Duration of the inquiry (12.0.0+). ``` -------------------------------- ### GetDownloadedSystemDataPath Source: https://switchbrew.org/wiki/NIM_services Gets the filesystem path for a downloaded system data title. ```APIDOC ## GetDownloadedSystemDataPath ### Description Retrieves the FS FspPath for the specified task and title. ### Parameters - **titleID** (u64) - Required - **SystemUpdateTaskId** (SystemUpdateTaskId) - Required ### Returns - **FspPath** (type-0x16 buffer) ``` -------------------------------- ### SetupCardUpdate Source: https://switchbrew.org/wiki/NS_Services Initializes a card update process using a TransferMemory handle. ```APIDOC ## SetupCardUpdate ### Description Sets up a card update with a specified buffer size and TransferMemory handle. ### Parameters - **size** (u64) - Required - **TransferMemory** (handle) - Required ``` -------------------------------- ### SetupStandardSteadyClockCore Source: https://switchbrew.org/wiki/PSC_services Configures the standard steady clock core with provided offsets and reset status. ```APIDOC ## SetupStandardSteadyClockCore ### Description Takes an input rtc_clock_source UUID, an input rtc_offset s64, an input internal_offset s64, an input test_offset s64 and a is_rtc_reset_detected bool. No output. ``` -------------------------------- ### IHomeMenuFunctions::GetWriterLockAccessorEx Source: https://switchbrew.org/wiki/AM_services Gets a writer lock accessor with a specific ID. ```APIDOC ## GetWriterLockAccessorEx ### Description Gets a writer lock accessor. ### Parameters - **inval** (u32) - Required - The lock ID (0-3, where 0 is HomeButton). ### Response - **ILockAccessor** (Object) - The returned lock accessor. ``` -------------------------------- ### InitializeApplicationCopyrightSharedBuffer Source: https://switchbrew.org/wiki/OMM_services Initializes the application copyright shared buffer using a handle and 0x10-bytes of input. ```APIDOC ## InitializeApplicationCopyrightSharedBuffer ### Description Initializes the application copyright shared buffer. This method is used by InitializeApplicationCopyrightFrameBuffer. ### Parameters - **Input** (0x10-bytes) - Required - **Handle** (Handle) - Required ``` -------------------------------- ### StartConsoleSixAxisSensor Source: https://switchbrew.org/wiki/HID_services Starts the console SixAxis sensor for a given process and applet resource. ```APIDOC ## StartConsoleSixAxisSensor ### Description Starts the console SixAxis sensor using the provided PID, handle, and AppletResourceUserId. ### Parameters - **PID** (u64) - Required - **ConsoleSixAxisSensorHandle** (handle) - Required - **AppletResourceUserId** (u64) - Required ``` -------------------------------- ### Sample Theme Configuration File Source: https://switchbrew.org/wiki/Homebrew_Menu A template showing the structure of a .cfg theme file, including theme information, light/dark color definitions, layout objects, and asset paths. ```text themeInfo={ name="Theme Name"; author="Theme Author Name"; version="1.0.0"; }; lightTheme={ textColor=(0,0,0,255); frontWaveColor=(255,102,204,255); middleWaveColor=(255,51,153,255); backWaveColor=(204,0,153,255); backgroundColor=(233,236,241,255); highlightColor=(255,77,166,255); separatorColor=(128,0,128,255); enableWaveBlending=0; }; darkTheme={ textColor=(255,255,255,255); frontWaveColor=(255,51,153,255); middleWaveColor=(255,102,204,255); backWaveColor=(204,0,153,255); backgroundColor=(0,0,0,255); highlightColor=(255,77,166,255); separatorColor=(255,255,255,255); enableWaveBlending=0; }; layout={ ={ visible=true; posType=true; posStart = (100,400); posEnd = (170,0); size = (0,680); }; // Any other objects here. }; assets={ ={ path = "relative_path_in_romfs"; imageSize = (256,256); }; // Any other objects here. }; ``` -------------------------------- ### QueryAccountEvent Source: https://switchbrew.org/wiki/Shared_Database_services Retrieves an array of AccountEvent objects starting from a specified entry index. ```APIDOC ## QueryAccountEvent ### Description Retrieves an array of AccountEvent objects starting from the provided entry index. ### Parameters - **entry_index** (s32) - Required - The starting index for the query. - **output_buffer** (type-0x6) - Required - Buffer to store the array of AccountEvent objects. ### Response - **output_count** (s32) - The actual number of entries returned. ``` -------------------------------- ### InitializeForUfio Source: https://switchbrew.org/wiki/Manu_Services Configures a transfer pipe over usb:ds for file access mode. ```APIDOC ## InitializeForUfio ### Description Configures a transfer pipe over usb:ds for file access mode. ### Parameters - **input** (u32) - Required - Input value ``` -------------------------------- ### QueryPlayEvent Source: https://switchbrew.org/wiki/Shared_Database_services Retrieves an array of PlayEvent objects starting from a specified entry index. ```APIDOC ## QueryPlayEvent ### Description Retrieves an array of PlayEvent objects starting from the provided entry index. ### Parameters - **entry_index** (s32) - Required - The starting index for the query. - **output_buffer** (type-0x6) - Required - Buffer to store the array of PlayEvent objects. ### Response - **output_count** (s32) - The actual number of entries returned. ``` -------------------------------- ### TransactParcelAuto Source: https://switchbrew.org/wiki/Nvnflinger_services Performs a parcel transaction using auto-buffers. Used starting with 3.0.0. ```APIDOC ## TransactParcelAuto ### Description Performs a parcel transaction using auto-buffers. Used starting with 3.0.0. ### Parameters - **ID** (s32) - Required - The ID loaded from the layer's NativeWindow. - **code** (u32) - Required - The transaction code. - **parcel_data** (type-0x21 buffer) - Required - Input buffer containing parcel data. - **parcel_reply** (type-0x22 buffer) - Required - Output buffer for parcel reply. - **flags** (u32) - Required - Transaction flags. ``` -------------------------------- ### SetupEphemeralNetworkSystemClockCore Source: https://switchbrew.org/wiki/PSC_services Configures the ephemeral network system clock core. ```APIDOC ## SetupEphemeralNetworkSystemClockCore ### Description No input, no output. ``` -------------------------------- ### BadBlockTable Structure Source: https://switchbrew.org/wiki/BCT Defines the layout of the bad block table at the start of the BCT. ```text 0x0: EntriesUsed (0x200) 0x4: VirtualBlockSizeLog2 (0xF) 0x5: BlockSizeLog2 (0xE) 0x6: BadBlocks 0x206: Reserved ``` -------------------------------- ### InitializeWithPriority Source: https://switchbrew.org/wiki/Local_Network_Monitor_services Initializes the service with a specific priority, version, and process ID. ```APIDOC ## InitializeWithPriority ### Description Similar to InitializeWithVersion, but allows explicit priority specification. ### Parameters - **PID** (input) - Required - **version** (s32) - Required - **priority** (s32) - Required - **pid_placeholder** (u64) - Required ``` -------------------------------- ### Initialize Source: https://switchbrew.org/wiki/Glue_services Initializes the notification service. ```APIDOC ## Initialize ### Description Initializes the service for the application. ### Parameters - **PID-descriptor** (input) - Required - **pid_reserved** (u64) - Required ``` -------------------------------- ### Handle Exception Return Source: https://switchbrew.org/wiki/Homebrew_ABI Example of the fallback mechanism for the loader when an NRO is not mapped. ```asm svcReturnFromException(0xf801); while(1); ``` -------------------------------- ### NVSCHED_CTRL_PUT_CONDUCTOR_FLIP_FENCE Structure Source: https://switchbrew.org/wiki/NV_services Defines the input structure for installing a fence swap event. ```c struct { __in u32 fence_id; __in u32 fence_value; __in u32 swap_interval; }; ``` -------------------------------- ### Get TPC Masks IOCTL Source: https://switchbrew.org/wiki/NV_services Returns the TPC mask value for each GPC. ```c struct { __in u32 mask_buf_size; // ignored, but must not be NULL __inout u32 reserved[3]; __out u64 mask_buf; // receives one 32-bit TPC mask per GPC (GPC 0 and GPC 1) }; ``` -------------------------------- ### LaunchProgramFromHost Source: https://switchbrew.org/wiki/PGL_services Launches a program from a host content path. ```APIDOC ## LaunchProgramFromHost ### Description Launches a program from a specified host content path (must be .nsp or .nspd, starting with @Host). ### Parameters - **LaunchProgramFlags** (LaunchProgramFlags) - Required - Flags for the launch. - **ContentPath** (MapAlias) - Required - The path to the content on the host. ``` -------------------------------- ### RequestLaunchApplicationWithUserAndArgumentForDebug Source: https://switchbrew.org/wiki/AM_services Requests to launch a specific application with provided user IDs and arguments for debugging. ```APIDOC ## RequestLaunchApplicationWithUserAndArgumentForDebug ### Description Requests to launch the specified Application with the specified users. If the flag is true, the second buffer is used to create storage pushed to the UserChannel. ### Parameters - **flag** (u8) - Required - Boolean flag for storage creation. - **applicationId** (ApplicationId) - Required - The ID of the application to launch. - **userIds** (u128[]) - Required - Array of user IDs. - **argumentBuffer** (buffer) - Required - Input buffer for application arguments. ``` -------------------------------- ### GET https://service-status-%.cdn.nintendo.net/service_status_hac.json Source: https://switchbrew.org/wiki/Domains Retrieves the service status for the error applet. ```APIDOC ## GET https://service-status-%.cdn.nintendo.net/service_status_hac.json ### Description Retrieves the current service status for the error applet. ### Method GET ### Endpoint https://service-status-%.cdn.nintendo.net/service_status_hac.json ```