### User Application Initialization and Exit Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Added overridable userAppInit and userAppExit functions that extend, rather than replace, __appInit and __appExit, allowing for more flexible application setup. ```c /* Added overridable userAppInit and userAppExit functions that add to instead of replacing __appInit and __appExit */ ``` -------------------------------- ### APIDOC: libnx LBL Functions Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md API documentation for libnx LBL (Light Bar Brightness) functions, including setting and getting brightness, and controlling auto-brightness. ```APIDOC lblSetCurrentBrightnessSetting(u8 brightness) - Sets the current brightness setting for the light bar. - Parameters: - brightness: The desired brightness value (0-100). - Returns: Result code. lblGetCurrentBrightnessSetting(u8* brightness) - Gets the current brightness setting for the light bar. - Parameters: - brightness: Pointer to store the current brightness value. - Returns: Result code. lblEnableAutoBrightnessControl() - Enables automatic brightness control for the light bar. - Returns: Result code. lblDisableAutoBrightnessControl() - Disables automatic brightness control for the light bar. - Returns: Result code. lblIsAutoBrightnessControlEnabled() - Checks if automatic brightness control is enabled. - Returns: True if enabled, false otherwise. ``` -------------------------------- ### Filesystem Initialization and Mounts Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Revised fsdev initialization by removing fsdevInit/Exit and automatically initializing fsdev state on first mount. Added fsdevMountSdmc and fsdevUnmountAll. ```c /* Revise fsdev initialization */ /* Removed fsdevInit/Exit */ /* Now automatically initializing fsdev state on first mount */ /* Added fsdevMountSdmc (replaces fsdevInit) */ /* Added fsdevUnmountAll (replaces fsdevExit) */ ``` -------------------------------- ### SET:SYS Command: Get Firmware Version Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Adds a command to retrieve the firmware version from the set:sys service. ```c // Get firmware version // setsysGetFirmwareVersion(...); ``` -------------------------------- ### PM:SHELL Command: Get Application PID Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Adds a command to retrieve the PID of an application from the pm:shell service. ```c // Get application PID // pmshellGetApplicationPid(...); ``` -------------------------------- ### Libapplets and Album Applet Launching Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Details the integration of libapplets and the specific functionality for launching the Album applet using albumLa. ```c /* libapplets */ // Added support for launching the Album applet via albumLa. ``` -------------------------------- ### Light Sensor Applet Functions Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Provides functions to access the light sensor data from applets. Availability starts from 3.0.0+. ```APIDOC Light Sensor: appletGetCurrentIlluminance() - Gets the current illuminance value. - Availability: 3.0.0+ appletGetCurrentIlluminanceEx() - Gets the current illuminance value (extended). - Availability: 5.0.0+ appletIsIlluminanceAvailable() - Checks if the light sensor is available. ``` -------------------------------- ### System and Applet Initialization Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Functions for managing system-level features and applet-specific information, including support for new ABI keys and applet identity structures. ```c // System ABI Keys // UserIdStorage, HosVersion // Applet Structures and Enums struct AppletIdentityInfo; struct LibAppletInfo; enum AppletId { AppletId_application, // ... other applet IDs }; enum LibAppletMode { // ... lib applet modes }; enum AppletSystemButtonType { // ... system button types }; enum AppletHookType { AppletHookType_RequestToDisplay, AppletNotificationMessage_RequestToDisplay, // ... other hook types }; // Applet Holder Functions void appletHolderSetOutOfFocusApplicationSuspendingEnabled(bool enabled); void appletGetLibraryAppletInfo(LibAppletInfo* info); void appletGetHomeButtonReaderLockAccessor(void); void appletGetReaderLockAccessorEx(void); void appletGetWriterLockAccessorEx(void); void appletGetHomeButtonWriterLockAccessor(void); void appletSetHandlesRequestToDisplay(bool handle); bool appletApproveToDisplay(void); ``` -------------------------------- ### LD Script ELF Generation Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md This snippet explains that generated ELFs now start with the .text section, which is a requirement for GDB compatibility. ```c // Version 4.2.1 // ldscript: Generated ELFs now start with the `.text` section (required by GDB). ``` -------------------------------- ### Applet Initialization and Focus Handling Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Fixes applet exit mode handling, optimizes APM usage, simplifies applet resource user ID retrieval, and adds error handling for focus mode changes. ```c /* Fixed `__nx_applet_exit_mode` handling. */ /* `apm` is now only used/initialized for `AppletType_Application`. */ /* Simplified `appletGetAppletResourceUserId` to return the aruid directly, or 0 on "failure" (which is not really a failure condition). */ /* Changed `appletSetFocusHandlingMode` to return error if the applet type is not `AppletType_Application`. */ /* Added more fields to `SwkbdType` enum. */ ``` -------------------------------- ### libnx NIFM Network Profile Functions Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Adds functions to get and set network profiles and IP configuration information using the nifm service. ```c /* Added nifmGetCurrentNetworkProfile, nifmGetNetworkProfile, nifmSetNetworkProfile, nifmGetCurrentIpConfigInfo. */ ``` -------------------------------- ### NVidia ioctl Wrappers Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Provides wrappers for various NVidia ioctl commands related to buffer management and kickoff. ```c // NVidia ioctl wrappers // nvioctlNvhostAsGpu_UnmapBuffer(...); // nvioctlNvmap_Free(...); // nvioctlChannel_KickoffPb(...); ``` -------------------------------- ### APIDOC: System Settings Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Provides an overview of system settings functionalities available in libnx. ```APIDOC APIDOC: System Settings: - setsysGetPlatformRegion(): Retrieves the current platform region. - setsysSetPlatformRegion(SetSysPlatformRegion region): Sets the platform region. - setsysGetHomeMenuScheme(): Retrieves the current Home Menu scheme. - setsysGetHomeMenuSchemeModel(): Retrieves the Home Menu scheme model. - setsysGetMemoryUsageRateFlag(): Gets the memory usage rate flag. - setsysGetTouchScreenMode(): Retrieves the touch screen mode. - setsysSetTouchScreenMode(SetSysTouchScreenMode mode): Sets the touch screen mode. - setsysGetPctlReadyFlag(): Gets the PCTL ready flag. - setsysSetPctlReadyFlag(bool flag): Sets the PCTL ready flag. - setsysIsUserSystemClockAutomaticCorrectionEnabled(): Checks if user system clock automatic correction is enabled. - setsysSetUserSystemClockAutomaticCorrectionEnabled(bool enabled): Enables or disables user system clock automatic correction. - setsysSetLanguageCode(char* code): Sets the system language code. - setsysGetAccountSettings(): Retrieves account settings. - setsysSetAccountSettings(SetSysAccountSettings* settings): Sets account settings. - setsysGetEulaVersions(): Retrieves EULA versions. - setsysSetEulaVersions(SetSysEulaVersion* versions): Sets EULA versions. - setsysGetNotificationSettings(): Retrieves notification settings. - setsysSetNotificationSettings(SetSysNotificationSettings* settings): Sets notification settings. - setsysGetAccountNotificationSettings(): Retrieves account notification settings. - setsysSetAccountNotificationSettings(SetSysAccountNotificationSettings* settings): Sets account notification settings. - setsysGetTvSettings(): Retrieves TV settings. - setsysSetTvSettings(SetSysTvSettings* settings): Sets TV settings. - setsysGetDataDeletionSettings(): Retrieves data deletion settings. - setsysSetDataDeletionSettings(SetSysDataDeletionSettings* settings): Sets data deletion settings. - setsysGetWirelessCertificationFileSize(): Gets the wireless certification file size. - setsysGetWirelessCertificationFile(): Gets the wireless certification file. - setsysSetRegionCode(char* code): Sets the region code. - setsysGetPrimaryAlbumStorage(): Retrieves the primary album storage. - setsysSetPrimaryAlbumStorage(SetSysPrimaryAlbumStorage storage): Sets the primary album storage. - setsysGetBatteryLot(): Retrieves the battery lot information. - setsysGetSleepSettings(): Retrieves sleep settings. - setsysSetSleepSettings(SetSysSleepSettings* settings): Sets sleep settings. - setsysGetInitialLaunchSettings(): Retrieves initial launch settings. - setsysSetInitialLaunchSettings(SetSysInitialLaunchSettings* settings): Sets initial launch settings. - setsysGetProductModel(): Retrieves the product model. - setsysGetMiiAuthorId(): Retrieves the Mii author ID. - setsysGetErrorReportSharePermission(): Retrieves the error report share permission. - setsysSetErrorReportSharePermission(SetSysErrorReportSharePermission permission): Sets the error report share permission. - setsysGetAppletLaunchFlags(): Retrieves applet launch flags. - setsysSetAppletLaunchFlags(u32 flags): Sets applet launch flags. - setsysGetKeyboardLayout(): Retrieves the keyboard layout. - setsysSetKeyboardLayout(SetKeyboardLayout layout): Sets the keyboard layout. - setsysGetRebootlessSystemUpdateVersion(): Retrieves the rebootless system update version. - setsysGetChineseTraditionalInputMethod(): Retrieves the Chinese traditional input method setting. - setsysSetChineseTraditionalInputMethod(SetChineseTraditionalInputMethod method): Sets the Chinese traditional input method. Enums: - SetSysPlatformRegion: Enum for platform regions. - SetSysHomeMenuScheme: Enum for Home Menu schemes. - SetSysTouchScreenMode: Enum for touch screen modes. - SetSysUserSelectorFlag: Enum for user selector flags. - SetSysEulaVersionClockType: Enum for EULA version clock types. - SetSysNotificationVolume: Enum for notification volumes. - SetSysFriendPresenceOverlayPermission: Enum for friend presence overlay permissions. - SetSysPrimaryAlbumStorage: Enum for primary album storage options. - SetSysHandheldSleepPlan: Enum for handheld sleep plans. - SetSysConsoleSleepPlan: Enum for console sleep plans. - SetSysErrorReportSharePermission: Enum for error report share permissions. - SetKeyboardLayout: Enum for keyboard layouts. - SetChineseTraditionalInputMethod: Enum for Chinese traditional input methods. Structs: - SetBatteryLot: Structure for battery lot information. - SetSysUserSelectorSettings: Structure for user selector settings. - SetSysAccountSettings: Structure for account settings. - SetSysEulaVersion: Structure for EULA versions. - SetSysNotificationTime: Structure for notification times. - SetSysNotificationSettings: Structure for notification settings. - SetSysAccountNotificationSettings: Structure for account notification settings. - SetSysTvSettings: Structure for TV settings. - SetSysDataDeletionSettings: Structure for data deletion settings. - SetSysSleepSettings: Structure for sleep settings. - SetSysInitialLaunchSettings: Structure for initial launch settings. - SetSysRebootlessSystemUpdateVersion: Structure for rebootless system update versions. ``` -------------------------------- ### Process Management in libnx Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Introduces process management functions including pmshell init/exit and pmshellLaunchProcess. ```c pmshell init/exit pmshellLaunchProcess ``` -------------------------------- ### APIDOC: libnx NWindow API Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Documentation for the libnx NWindow (Native Window) API, which allows for direct management of renderable surfaces. Includes functions for creating, retrieving, and managing native windows. ```APIDOC NWindow* nwindowGetDefault() - Retrieves the default native window. - Returns: Pointer to the default NWindow. NWindow* nwindowCreateFromLayer(ViLayer* layer) - Creates a NWindow from a ViLayer. - Parameters: - layer: Pointer to the ViLayer. - Returns: Pointer to the created NWindow. void nwindowDestroy(NWindow* window) - Destroys a NWindow. - Parameters: - window: Pointer to the NWindow to destroy. void nwindowSetSize(NWindow* window, u32 width, u32 height) - Sets the size of a NWindow. - Parameters: - window: Pointer to the NWindow. - width: The desired width. - height: The desired height. void nwindowSetPosition(NWindow* window, u32 x, u32 y) - Sets the position of a NWindow. - Parameters: - window: Pointer to the NWindow. - x: The desired X-coordinate. - y: The desired Y-coordinate. void nwindowSetZOrder(NWindow* window, u32 zOrder) - Sets the Z-order of a NWindow. - Parameters: - window: Pointer to the NWindow. - zOrder: The desired Z-order. void nwindowSetVisibility(NWindow* window, bool visible) - Sets the visibility of a NWindow. - Parameters: - window: Pointer to the NWindow. - visible: True to make visible, false otherwise. ``` -------------------------------- ### Graphics and NVChannel Updates Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md This snippet covers changes related to graphics, specifically NVChannel operations like setting and getting clock rates, and GPU timestamp retrieval. ```c // Version 4.7.0 // nvchannel: Fix SET_CLK_RATE, implement GET_CLK_RATE and SET_SUBMIT_TIMEOUT // Version 4.2.2 // Added nvGpuGetTimestamp, nvioctlNvhostCtrlGpu_GetGpuTime. ``` -------------------------------- ### Libnx Network Service Session Getters and Service Type Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Provides functions to get service sessions for NIFM and introduces the BsdServiceType enum for revised service type handling. ```c /* Service session getters */ nifmGetServiceSession_StaticService(); nifmGetServiceSession_GeneralService(); /* Introduced BsdServiceType enum, which is now used for revised service type handling (bsd:u is now the default service). */ typedef enum { BsdServiceType_Default = 0, /* bsd:u */ /* ... other types ... */ } BsdServiceType; ``` -------------------------------- ### Applet Commands Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Provides functions for launching and interacting with libapplet and software keyboard (swkbd) applets, managing applet parameters, and handling focus states. ```c appletPopLaunchParameter appletPushToGeneralChannel appletSetTerminateResult appletSetMediaPlaybackState accountGetPreselectedUser libappletRequestHomeMenu libappletRequestJumpToSystemUpdate AppletStorage AppletHolder LibAppletArgs AppletFocusState AppletFocusHandlingMode ``` -------------------------------- ### APIDOC: libnx System Synchronization Primitives Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Documentation for libnx user mode synchronization primitives, including UEvent and UTimer, and functions for managing events and memory. ```APIDOC eventActive(EventHandle event) - Checks if an event is active. - Parameters: - event: The event handle. - Returns: True if active, false otherwise. tmemCreateFromMemory(u32 size, void* memory) - Creates a TMEM region from existing memory. - Parameters: - size: The size of the memory region. - memory: Pointer to the memory. - Returns: TMEM handle. svcTerminateDebugProcess() - Terminates the debug process. - Returns: Result code. svcMapPhysicalMemory(u32 address, u32 size) - Maps physical memory into the process address space. - Parameters: - address: The physical address to map. - size: The size of the memory region to map. - Returns: Result code. svcUnmapPhysicalMemory(u32 address, u32 size) - Unmaps physical memory from the process address space. - Parameters: - address: The physical address to unmap. - size: The size of the memory region to unmap. - Returns: Result code. serviceSendObject(Handle handle, Handle targetHandle) - Sends an object handle to another service. - Parameters: - handle: The handle to send. - targetHandle: The handle of the target service. - Returns: Result code. ``` -------------------------------- ### Audio Control (audctl) and Audio Device (auddev) Updates Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md This snippet details updates to audio services, including adding functions to get the active output target and audio device name, and fixing target volume functions. ```c // Version 4.3.0 // audctl: // Added audctlGetActiveOutputTarget. // Fixed TargetVolume functions. // auddev: Added auddevGetActiveAudioDeviceName. ``` -------------------------------- ### Other Service Wrappers and Commands Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Provides wrappers for various system services like ldr:ro, ro:dmnt, ns:dev, pm:dmnt, pm:shell, psc, spsm, pcv, lbl, i2c, gpio, and setsys, along with specific commands for each. ```c ldr:ro and ro:dmnt service wrappers ns:dev commands: nsdevLaunchProgram, nsdevGetShellEvent, nsdevGetShellEventInfo, nsdevTerminateApplication, nsdevPrepareLaunchProgramFromHost, nsdevLaunchApplication, nsdevLaunchApplicationWithStorageId, nsdevIsSystemMemoryResourceLimitBoosted, nsdevGetRunningApplicationProcessId, nsdevSetCurrentApplicationRightsEnvironmentCanBeActive pm:dmnt commands: pmdmntGetDebugProcesses, pmdmntDisableDebug pm:shell commands: pmshellTerminateProcessByProcessId, pmshellGetProcessEvent, pmshellGetProcessEventInfo, pmshellFinalizeDeadProcess, pmshellClearProcessExceptionOccurred, pmshellNotifyBootFinished, pmshellBoostSystemMemoryResourceLimit psc (psc:m) service wrapper spsm service wrapper psm wrapper with PsmSession object pcv service wrapper lbl service wrapper i2c service wrapper gpio service wrapper bpc commands: bpcGetSleepButtonState setsys commands: setsysBindFatalDirtyFlagEvent, setsysGetFatalDirtyFlags appletSetFocusHandlingMode ``` -------------------------------- ### Filesystem Rights and Save Data Operations (libnx) Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Introduces functions to get rights IDs by path, create and delete save data file systems, disable auto save data creation, and create system save data with owner information. ```c // Added fsGetRightsIdByPath, fsGetRightsIdAndKeyGenerationByPath // Added fsCreateSaveDataFileSystemBySystemSaveDataId, fsDeleteSaveDataFileSystemBySaveDataSpaceId // Added fsDisableAutoSaveDataCreation, fsCreate_SystemSaveDataWithOwner, fsCreate_SystemSaveData ``` -------------------------------- ### libnx Naming Conventions Source: https://github.com/switchbrew/libnx/blob/master/CODESTYLE.md This section details the naming conventions for different code elements within the libnx project. It covers types, enums, struct members, local and global variables, functions, submodule functions, singletons, objects, and macros. ```text Types: `TypesAreCapitalizedLikeThis` Enums: `EnumType_EnumName` Struct members: `like_this` Local variables: `like_this` Global variables (or global statics): `g_variableName` Functions: `modulenameFunctionName` Submodule function naming: Singletons: `smInitialize`/`smExit` Objects: `tmemCreate`/`tmemClose` Macros: `LIKE_THIS` ``` -------------------------------- ### Web Applet Configuration Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Updated web support with new functionalities for media playback control and album entry management, available on 6.0.0+. ```APIDOC Web Configuration: webConfigSetMediaAutoPlay(WebConfig* config, bool enable) - Enables or disables media auto-play. webConfigSetMediaPlayerSpeedControl(WebConfig* config, float speed) - Sets the media player speed. webConfigAddAlbumEntryAndMediaData(WebConfig* config, ...) - Adds an album entry with associated media data. webConfigSetBootFooterButtonVisible(WebConfig* config, bool visible) - Sets the visibility of the boot footer button. webConfigSetOverrideWebAudioVolume(WebConfig* config, float volume) - Overrides the web audio volume. webConfigSetOverrideMediaAudioVolume(WebConfig* config, float volume) - Overrides the media audio volume. ``` -------------------------------- ### Build System Updates Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Added rules for building .npdm, .nsp, and .kip files. Supports building .npdm from JSON, embedding .npdm into .pfs0, and building .kip from elf and JSON descriptors. ```c /* Add rules for building .npdm, .nsp and .kip */ /* Now building .npdm from .json if specified */ /* .pfs0 now embeds previously built npdm if available */ /* .nsp accepted as an alternative file extension to .pfs0 */ /* .kip can be built from elf and json descriptor (subset of .npdm) */ ``` -------------------------------- ### System IPC and Synchronization Primitives Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Enhancements to service IPC support for domains, random seed handling for NROs, and the Barrier synchronization primitive. ```c Service IPC support for domains RandomSeed HBABI key handling Barrier synchronization primitive threadGetCurHandle ``` -------------------------------- ### Other Services Wrappers and Commands in libnx Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Details new service wrappers for caps:sc/caps:su and nfp:user, along with new lbl commands for brightness control and a function to retrieve the pm:dmnt session. It also notes a renaming of a USB endpoint function. ```c // Other Services Wrappers and Commands // Added caps:sc/caps:su service wrappers. // Added nfp:user service wrappers. // Added lbl commands: lblSetCurrentBrightnessSetting, lblGetCurrentBrightnessSetting, lblEnableAutoBrightnessControl, lblDisableAutoBrightnessControl, lblIsAutoBrightnessControlEnabled. // Added pmdmntGetServiceSession for retrieving the pm:dmnt session. // Renamed usbDsEndpoint_StallCtrl to usbDsEndpoint_Stall. ``` -------------------------------- ### Settings Services in libnx Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Includes support for interacting with settings services. ```c settings-services support ``` -------------------------------- ### Applet Command Wrappers (libnx) Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Expands applet functionality with numerous new command wrappers, including those for application statistics, GPU errors, display version, home button blocking, shutdown/reboot requests, copyright frames, pseudo device IDs, album user data, fatal sections, restart messages, capture button messages, and album image notifications. Some functions are for newer system versions. ```c // Added many new applet command wrappers appletQueryApplicationPlayStatisticsByUid(...); appletGetGpuErrorDetectedSystemEvent(...); appletGetDisplayVersion(...); appletBeginBlockingHomeButtonShortAndLongPressed(...); appletEndBlockingHomeButtonShortAndLongPressed(...); appletRequestToShutdown(...); appletRequestToReboot(...); appletInitializeApplicationCopyrightFrameBuffer(...); appletSetApplicationCopyrightImage(...); appletSetApplicationCopyrightVisibility(...); appletGetPseudoDeviceId(...); appletSetApplicationAlbumUserData(...); appletEnterFatalSection(...); appletLeaveFatalSection(...); appletSetRestartMessageEnabled(...); appletSetRequiresCaptureButtonShortPressedMessage(...); appletSetAlbumImageTakenNotificationEnabled(...); ``` -------------------------------- ### Applet Services: Running as Application with Video Recording Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Enables running libnx applications with nx-hbloader and supports video recording if a specific flag is set in the host title's NACP. ```c // Example usage for enabling video recording (requires NACP flag) // appletSetVideoRecordingEnabled(true); ``` -------------------------------- ### AudioDriver Wrapper Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Provides a higher-level AudioDriver wrapper around audren, simplifying audio mixing and playback. ```c #include // AudioDriver driver; audioDriverInit(&driver); // audioDriverPlaySound(&driver, sound_data, size); ``` -------------------------------- ### Build System Path Configuration Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Added the portlibs bin folder to the system's PATH environment variable for build system accessibility. ```c /* add portlibs bin folder to path */ ``` -------------------------------- ### Service Reference Acquisition Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md HID, IRS, VI, and NV services now acquire a reference to applet services, improving inter-service communication and dependency management. ```c // HID, IRS, VI, NV services now acquire applet service references. ``` -------------------------------- ### Account and NS Commands Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Added account commands (accountGetUserCount, accountListAllUsers) and ns commands (nsGetTotalSpaceSize, nsGetFreeSpaceSize) for managing user accounts and storage. ```c /* Added account commands: accountGetUserCount, accountListAllUsers */ /* Added ns commands: nsGetTotalSpaceSize, nsGetFreeSpaceSize */ ``` -------------------------------- ### APIDOC: Filesystem Services Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Outlines the filesystem service functions and enums. ```APIDOC APIDOC: Filesystem Services: - fsExtendSaveDataFileSystem(): Extends the save data filesystem. - fsOpenCustomStorageFileSystem(FsCustomStorageId id): Opens a custom storage filesystem. - fsSetGlobalAccessLogMode(u32 mode): Sets the global access log mode. - fsGetGlobalAccessLogMode(): Gets the global access log mode. Enums: - FsCustomStorageId: Enum for custom storage IDs. ``` -------------------------------- ### APIDOC: libnx HID Functions Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Documentation for libnx HID (Human Interface Device) functions, including mouse input, controller ID mapping, and system service wrappers. ```APIDOC hidMouseMultiRead(MousePosition* positions, u32 maxCount) - Reads multiple mouse positions. - Parameters: - positions: Array of MousePosition structures to store the read positions. - maxCount: The maximum number of positions to read. - Returns: Number of positions read. hidControllerIDToOfficial(ControllerID id) - Converts a libnx ControllerID to an official controller ID. - Parameters: - id: The libnx ControllerID. - Returns: The official controller ID. hidControllerIDFromOfficial(u32 officialId) - Converts an official controller ID to a libnx ControllerID. - Parameters: - officialId: The official controller ID. - Returns: The libnx ControllerID. ``` -------------------------------- ### APIDOC: libnx Filesystem Functions Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Documentation for libnx filesystem functions, including romfs mounting and data storage operations. Covers `fsOpenDataStorageByDataId` and `romfsMountFromDataArchive`. ```APIDOC fsOpenDataStorageByDataId(u64 dataId) - Opens a data storage by its data ID. - Parameters: - dataId: The data ID of the storage. - Returns: File handle. romfsMountFromDataArchive(u64 dataId, const char* mountName) - Mounts a romfs from a data archive. - Parameters: - dataId: The data ID of the romfs archive. - mountName: The name to mount the romfs under. - Returns: Result code. ``` -------------------------------- ### Filesystem Operations and Mounts Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Enhances RomFS support for uncached buffers and adds various commands for mounting different types of storage devices and opening file system objects. ```c /* RomFS code now properly supports reading to uncached buffers. */ /* Added fsdev commands: fsdevMountDeviceSaveData, fsdevMountBcatSaveData, fsdevMountSystemBcatSaveData, fsdevMountTemporaryStorage, fsdevMountCacheStorage, fsdevMountSaveDataReadOnly. */ /* Added commands: fsOpenImageDirectoryFileSystem, fsOpenReadOnlySaveDataFileSystem, fsIsSignedSystemPartitionOnSdCardValid, fsOpen_DeviceSaveData, fsOpen_BcatSaveData, fsOpen_SystemBcatSaveData, fsOpen_TemporaryStorage, fsOpen_CacheStorage, fsOpen_SaveDataReadOnly. */ /* Added enum: FsImageDirectoryId. */ /* Removed path stack copy logic from fsFsQueryEntry. */ ``` -------------------------------- ### Applet Service Enhancements Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Includes enhancements to the Applet service, such as proper initialization for system applets and functions to block/unblock the Home button. ```c #include // appletBeginBlockingHomeButton(); // appletEndBlockingHomeButton(); ``` -------------------------------- ### libnx Ectx:r and Capmtp Service Wrappers (11.0.0+) Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Introduces service wrappers for ectx:r and capmtp, available from system version 11.0.0 onwards. ```c /* Added ectx:r service wrapper [11.0.0+]. */ /* Added capmtp service wrapper [11.0.0+]. */ ``` -------------------------------- ### Nvidia Driver Experimental Wrappers Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Introduces experimental wrapper objects for the Nvidia driver to enable GPU usage. These are in the RE phase and subject to change. ```c // Experimental Nvidia driver wrappers for GPU access. ``` -------------------------------- ### Return-from-main Handler Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Ensures that the return-from-main mechanism correctly honors atexit handlers. ```c // return-from-main now honors atexit handlers. ``` -------------------------------- ### Mii and Mii Image (miiimg) Service Updates Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Introduces service wrappers for both the Mii and Mii Image services. ```c /* Added service wrappers. */ ``` -------------------------------- ### Account Profile and NACP Handling Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Added implementation for accountProfile* and attempts to use 'acc:u0' if smGetService fails. Added nsGetApplicationControlData and imported nacp.h. ```c /* Added impl for accountProfile*. If the inital smGetService fails, attempt to use 'acc:u0' */ /* Added nsGetApplicationControlData. Imported nacp.h from nx-hbmenu with adjustments */ ``` -------------------------------- ### System Settings Structs Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Defines new structures to hold system setting data, including battery lot information, user selector settings, account settings, EULA versions, notification times and settings, TV settings, data deletion settings, sleep settings, initial launch settings, and rebootless system update versions. ```c struct SetBatteryLot; struct SetSysUserSelectorSettings; struct SetSysAccountSettings; struct SetSysEulaVersion; struct SetSysNotificationTime; struct SetSysNotificationSettings; struct SetSysAccountNotificationSettings; struct SetSysTvSettings; struct SetSysDataDeletionSettings; struct SetSysSleepSettings; struct SetSysInitialLaunchSettings; struct SetSysRebootlessSystemUpdateVersion; ``` -------------------------------- ### Network: Socket Initialization and Hostname Resolution Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Added nifm handling to socketInitialize/Exit, enabling gethostid/gethostname to work by default. Also includes changes to use IPC domains and optimized select/poll. ```c // Network initialization and hostname functions // socketInitialize(); // socketExit(); // gethostid(); // gethostname(); ``` -------------------------------- ### libnx Service Wrapper Conversion and Improvements Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Covers the conversion of all service wrappers to use the new IPC interface, addressing thread safety, fixing IPC bugs, and improving documentation and data structures. It also details changes in naming conventions and the handling of IDs. ```c // All service wrappers converted to use new IPC interface Thread safety during service init/exit fixed Numerous commands with IPC bugs fixed Improved documentation for many services System version checks corrected and documented Structs corrected for alignment and size Field names in structs made more consistent Parameter types and names corrected for consistency with official software Non-existent "Title ID" concept phased out in favor of "Program ID" or other official ID names AccountUid struct added, replacing u128 user ids accountUidIsValid added Uuid struct added, replacing u128 uuids NacpSendReceiveConfiguration struct added NacpStruct updated with fixes and additions Locking issue in usbComms fixed (usbCommsInitialize(Ex) hang on failure) ``` -------------------------------- ### GPU IOCTLs and Service Improvements (libnx) Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Adds and corrects several /dev/nvhost-ctrl-gpu ioctls for GPU information and Zcull/ZBC operations. Improves I2cDevice enum and accountInitialize function. ```c // Added and corrected several /dev/nvhost-ctrl-gpu ioctls // Added nvGpuGetZcullInfo, nvGpuGetTpcMasks, nvGpuZbcGetActiveSlotMask, nvGpuZbcAddColor, nvGpuZbcAddDepth // Improved I2cDevice enum // Improved accountInitialize to internally call InitializeApplicationInfo ``` -------------------------------- ### USB Services Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Wrappers for USB services, including support for high-speed USB and domain-based handling for USB:DS. ```c usb:hs service wrapper usb:ds domain handling ``` -------------------------------- ### System and Other Service Updates in libnx Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md This section covers various system-level changes, including new SVCs, thread structure pre-population, support for new OS versions, and updates to services like bpc, btdrv, ncm, setsys, psel, and more. It also includes additions for TIPC serialization and memory allocation overrides. ```c // Added BITL() macro (unsigned long, i.e. 64-bit unsigned integer). // bpc: Adjusted for removed commands in [14.0.0+]. // bpc: Added bpcGetPowerButton [6.0.0+]. // btdrv: Adjusted for removed commands in [14.0.0+]. // btm: Corrected inverted hos version check affecting several commands. // nfc: Added nfcSendCommandByPassThrough, nfcKeepPassThroughSession, nfcReleasePassThroughSession. // pm: Added support for [14.0.0+]. // ts: Adjusted for removed commands in [14.0.0+]. // Added new SVCs introduced in [13.0.0+]. // Thread structures are now pre-populated with information prior to creation. // ncm: Added support for [13.0.0+]. // setsys: Added support for [13.0.0+]. // Filled in SetSysNxControllerSettings structure definition (which was previously unpopulated). // btm: Added support for [13.0.0+]. // btdrv: Added support for [13.0.0+]. // Fixed btdrvRespondToSspRequest for [12.0.0+]. // psel: Added support for [13.0.0+] (pselShowUserQualificationPromoter). // Corrected ldr:ro/ro:1 initialization. // Removed old virtmem API. // Added mechanism for overriding libnx's dynamic memory allocation behavior. // This also added specific mechanisms for NV and BSD transfer memory handling. // Added hosversionIsAtmosphere, together with support for receiving this information through HBABI. // Added tipc (Tiny IPC) serialization support, introduced in [12.0.0+]. // Updated sm, sm:m and pgl wrappers for tipc support. // Fixed certain serialization bug in cmif handling code. // argv setup code can now be overriden. // virtmem RNG algorithm can now be overriden. // Added support for incremental CRC calculations. // fs: Added fsOpenHostFileSystem(WithOption). // Updated btdrv service wrapper for [12.0.0+], along with fixes and improved support. // Added audctl service wrapper. // Added audrec service wrapper. // Added avm service wrapper. // Added friends service wrapper (minimal functionality needed for retrieving the user's friend code). // Added htcs service wrapper. // Added mm:u service wrapper. // Added new nvioctlChannel_* wrappers: Submit, GetSyncpt, GetModuleClockRate, MapCommandBuffer, UnmapCommandBuffer. // Added SetSysProductModel enum, now used by setsysGetProductModel. // Added audrvVoiceIsPaused. // Updated BtmDeviceCondition struct, including compatibility with all system versions. // Corrected pscmGetPmModule prototype. // Renamed ChargerType to PsmChargerType, corrected enum names. // Fixed bug in time offset handling. // Fixed bug in BSD (sockets) initialization. // Fixed deadlock issue when multi-threaded services (e.g. filesystem, sockets) are starved of free sessions. // Fixed crashes caused by arbitrary sizes in linear framebuffers. // Fixed inet_pton implementation. ``` -------------------------------- ### Filesystem Device Operations (libnx) Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Adds new functions for filesystem device management, including file creation, recursive directory deletion, and retrieving the last result. Also includes functions for opening filesystems with patches and content storage. ```c // Added fsdevCreateFile, fsdevDeleteDirectoryRecursively, fsdevGetLastResult // Added fsOpenFileSystemWithPatch, fsOpenContentStorageFileSystem ``` -------------------------------- ### Graphics Functions Added Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Adds a binder session argument to `nwindowCreate` and enables domain object support for binder code. Fixes a bug in `nvAddressSpaceCreate`. ```c void nwindowCreate(); void nvAddressSpaceCreate(); ``` -------------------------------- ### APIDOC: libnx Applet Functions Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Provides documentation for libnx applet-related functions, including those for managing applet holders, querying application statistics, launching applications, and handling home button messages. It also covers functions for reading and writing applet storage data. ```APIDOC appletHolderActive() - Checks if an applet holder is active. appletHolderCheckFinished() - Checks if an applet holder has finished its operation. appletHolderRequestExit() - Requests the applet holder to exit. appletQueryApplicationPlayStatistics(u64 titleId) - Queries play statistics for a given application title ID. - Parameters: - titleId: The title ID of the application. appletRequestLaunchApplication(u64 titleId) - Requests to launch a specified application. - Parameters: - titleId: The title ID of the application to launch. appletRequestLaunchApplicationForQuest(u64 titleId) - Requests to launch a specified application for a quest. - Parameters: - titleId: The title ID of the application to launch. appletBeginToWatchShortHomeButtonMessage() - Begins watching for short home button messages. appletEndToWatchShortHomeButtonMessage() - Ends watching for short home button messages. appletHomeButtonReaderLockAccessorGetEvent() - Gets the event accessor for home button reader lock. appletGetMessage(u32* message) - Gets an applet message. - Parameters: - message: Pointer to store the message. - Returns: Result code. appletProcessMessage() - Processes an applet message. - Returns: Result code. libappletReadStorage(u32 storageId, void* buffer, size_t size) - Reads data from applet storage. - Parameters: - storageId: The ID of the storage to read from. - buffer: Buffer to store the read data. - size: The size of the data to read. - Returns: Result code. libappletPopOutData(u32 storageId, void* buffer, size_t size) - Pops data from applet storage. - Parameters: - storageId: The ID of the storage to pop from. - buffer: Buffer to store the popped data. - size: The size of the data to pop. - Returns: Result code. libappletCreateWriteStorage(u32 storageId, void* buffer, size_t size) - Creates and writes data to applet storage. - Parameters: - storageId: The ID of the storage to write to. - buffer: Buffer containing the data to write. - size: The size of the data to write. - Returns: Result code. ``` -------------------------------- ### libnx News and LP2P Service Wrappers Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Adds service wrappers for the news service and the peer-to-peer (lp2p) communication. ```c /* Added news service wrapper. */ /* Added lp2p service wrapper. */ ``` -------------------------------- ### libnx Service Wrappers and Commands Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md This snippet details new and updated service wrappers and commands added to libnx, including apm, caps, fan, lbl, nifm, nim, ns, set:cal, set:sys, and tc services. It also covers specific functions like ldrShellFlushArguments and spl*GetServiceSession, along with corrections to system version checks and fixes for specific functions. ```c apmGetPerformanceMode; // caps:a, caps:c, caps:dc service wrappers // fan service wrappers // many missing lbl commands // nifmGetClientId, nifmIsAnyInternetRequestAccepted // nimListSystemUpdateTask, nimDestroySystemUpdateTask // ns service support overhaul // set:cal service wrappers // set:sys commands completion // tc service wrappers ldrShellFlushArguments, ldrDmntFlushArguments, spl*GetServiceSession // setsysGetHomeMenuScheme minimum sysver correction // nsListApplicationContentMetaStatus minimum sysver correction // splSslLoadSecureExpModKey/splEsLoadSecureExpModKey/splRsaDecryptPrivateKey/splSslLoadSecureExpModKey/splEsLoadRsaOaepKey/splEsLoadSecureExpModKey/splFsLoadSecureExpModKey fixes on 5.0+ // plInitialize failure handling fix // fsldrSetCurrentProcess removal ``` -------------------------------- ### HID System (hidsys) Updates Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md This snippet details the addition of support for numerous commands within the hidsys service. ```c // Version 4.5.0 // hidsys: Support was added for many commands ``` -------------------------------- ### USB Services: Refactored for 5.x+ Systems Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Major refactor of USB services to add support for 5.x+ systems, including new error handling options. ```c // USB service function // usbCommsSetErrorHandling(...); ``` -------------------------------- ### RomFS and Filesystem Enums/Structs (libnx) Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Adds functionality for mounting RomFS from the current process and introduces new enums for file creation flags, read/write options, operation IDs, directory flags, and a struct for range information. ```c // Added romfsMountFromCurrentProcess // Added FsBisStorageId, FsFileCreateFlags, FsReadOption, FsWriteOption and FsOperationId enums // Added FS_DIROPEN_NO_FILE_SIZE to FsDirectoryFlags enum // Added FsRangeInfo struct ``` -------------------------------- ### System Stability and Compatibility Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Includes general system stability improvements, compatibility fixes for C99 and C11 standards, and handling of userland exceptions. ```c sys/poll.h alias for poll.h C99 compatibility fixes C11 thread support standard compliance fixes Userland exception handling support ``` -------------------------------- ### System Call Wrappers and Definitions Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Details the deletion of the old IPC system, addition of wrappers for missing system calls, correction of system call signatures, and removal of deprecated defines. ```c /* Deleted the old and deprecated IPC system. */ /* Added wrappers for all missing system calls. */ /* Corrected signatures of many system calls. */ /* Removed `arm/atomics.h` (use C `` or C++ `` instead). */ /* Removed `U64_MAX` define (use `UINT64_MAX` instead). */ /* Added UtilFloat3 struct. */ ``` -------------------------------- ### libnx Input and UART Service Wrappers Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Introduces service wrappers for input (ins:r, ins:s) and UART communication. ```c /* Added ins:r and ins:s service wrappers. */ /* Added uart service wrapper. */ ``` -------------------------------- ### Input Handling for 9.0.0+ Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Explicitly announces support for System/SystemExt layouts, fixing input on 9.0.0+. Recompilation of homebrew is highly recommended. Fixes Hdls to work on 9.0.0+ by redefining affected structs (HiddbgHdlsDeviceInfo, HiddbgHdlsState, HiddbgHdlsStateListEntry, HiddbgHdlsStateList) with a `V7` suffix for compatibility. Adds `hiddbgGetUniquePadDeviceTypeSetInternal`. Also adds `hidGetNpadInterfaceType`, `HidNpadInterfaceType`, `HidDeviceTypeBits`, and `HidDeviceType` enums. Prevents AbstractedPad/VirtualPad commands on 9.0.0+ and corrects commands by internally calling `hidControllerIDToOfficial`. ```c void hiddbgGetUniquePadDeviceTypeSetInternal(); void hidGetNpadInterfaceType(); enum HidNpadInterfaceType; enum HidDeviceTypeBits; enum HidDeviceType; void hidControllerIDToOfficial(); ``` -------------------------------- ### Graphics: Fence Management Source: https://github.com/switchbrew/libnx/blob/master/Changelog.md Introduces gfxAppendFence for managing graphics fences. ```c // Append graphics fence // gfxAppendFence(...); ```