...
 
Commits (181)
image: devkitpro/devkita64:latest
stages:
- package
- create image
package:
stage: package
before_script:
- dkp-pacman -Syy
- dkp-pacman -S --noconfirm devkitARM
- export DEVKITPRO=/opt/devkitpro
- export DEVKITARM=/opt/devkitpro/devkitARM
script:
- make -j10
- make install
- rm -rf libnx/
- mv /opt/devkitpro/libnx libnx/
artifacts:
name: libnx
paths:
- libnx/
docker image:
stage: create image
script:
- "curl -X POST -F token=$TOKEN_DOCKER_IMAGE -F ref=master https://git.m4xw.net/api/v4/projects/103/trigger/pipeline"
when: on_success
only:
- master
nightly image:
stage: create image
script:
- "curl -X POST -F token=$TOKEN_DOCKER_IMAGE -F ref=develop https://git.m4xw.net/api/v4/projects/103/trigger/pipeline"
when: on_success
only:
- develop
- cicd/updates
......@@ -24,7 +24,7 @@ VERSION := $(LIBNX_MAJOR).$(LIBNX_MINOR).$(LIBNX_PATCH)
#---------------------------------------------------------------------------------
TARGET := nx
#BUILD := build
SOURCES := source/arm source/kernel source/services source/crypto source/nvidia source/nvidia/ioctl source/display source/audio source/applets source/runtime source/runtime/devices source/runtime/util/utf
SOURCES := source/arm source/kernel source/sf source/services source/crypto source/nvidia source/nvidia/ioctl source/display source/audio source/applets source/runtime source/runtime/devices source/runtime/util source/runtime/util/utf
DATA := data
INCLUDES := include external/bsd/include
......@@ -33,13 +33,13 @@ INCLUDES := include external/bsd/include
#---------------------------------------------------------------------------------
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec
CFLAGS := -g -Wall -Werror \
CFLAGS := -g -Wall \
-ffunction-sections \
-fdata-sections \
$(ARCH) \
$(BUILD_CFLAGS)
CFLAGS += $(INCLUDE) -DSWITCH
CFLAGS += $(INCLUDE) -D__SWITCH__ -DLIBNX_NO_DEPRECATION
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
......@@ -122,7 +122,7 @@ debug:
lib/libnx.a : lib release $(SOURCES) $(INCLUDES)
@$(MAKE) BUILD=release OUTPUT=$(CURDIR)/$@ \
BUILD_CFLAGS="-DNDEBUG=1 -O2" \
BUILD_CFLAGS="-DNDEBUG=1 -O3 -ffast-math" \
DEPSDIR=$(CURDIR)/release \
--no-print-directory -C release \
-f $(CURDIR)/Makefile
......
......@@ -36,9 +36,14 @@ extern "C" {
#include "switch/kernel/detect.h"
#include "switch/kernel/random.h"
#include "switch/kernel/jit.h"
#include "switch/kernel/ipc.h"
#include "switch/kernel/ipc.h" // Deprecated
#include "switch/kernel/barrier.h"
#include "switch/sf/hipc.h"
#include "switch/sf/cmif.h"
#include "switch/sf/service.h"
#include "switch/sf/sessionmgr.h"
#include "switch/services/sm.h"
#include "switch/services/smm.h"
#include "switch/services/fs.h"
......@@ -47,6 +52,7 @@ extern "C" {
#include "switch/services/acc.h"
#include "switch/services/apm.h"
#include "switch/services/applet.h"
#include "switch/services/async.h"
#include "switch/services/audin.h"
#include "switch/services/audout.h"
#include "switch/services/audren.h"
......@@ -61,7 +67,8 @@ extern "C" {
#include "switch/services/clkrst.h"
#include "switch/services/psm.h"
#include "switch/services/spsm.h"
//#include "switch/services/bsd.h" Use switch/runtime/devices/socket.h instead
//#include "switch/services/bsd.h" Use <sys/socket.h> instead
//#include "switch/services/sfdnsres.h" Use <netdb.h> instead
#include "switch/services/fatal.h"
#include "switch/services/time.h"
#include "switch/services/usb.h"
......@@ -78,6 +85,7 @@ extern "C" {
#include "switch/services/ns.h"
#include "switch/services/ldr.h"
#include "switch/services/ro.h"
#include "switch/services/ts.h"
#include "switch/services/pm.h"
#include "switch/services/set.h"
#include "switch/services/lr.h"
......@@ -93,6 +101,7 @@ extern "C" {
#include "switch/services/pctl.h"
#include "switch/services/pdm.h"
#include "switch/services/grc.h"
#include "switch/services/friends.h"
#include "switch/display/binder.h"
#include "switch/display/parcel.h"
......@@ -113,6 +122,7 @@ extern "C" {
#include "switch/applets/libapplet.h"
#include "switch/applets/album_la.h"
#include "switch/applets/friends_la.h"
#include "switch/applets/pctlauth.h"
#include "switch/applets/error.h"
#include "switch/applets/swkbd.h"
......@@ -121,6 +131,7 @@ extern "C" {
#include "switch/runtime/env.h"
#include "switch/runtime/hosversion.h"
#include "switch/runtime/nxlink.h"
#include "switch/runtime/resolver.h"
#include "switch/runtime/util/utf.h"
......
......@@ -9,7 +9,7 @@
/// Arg type values pushed for the applet input storage, stored as an u8.
typedef enum {
AlbumLaArg_ShowAlbumFiles = 0, ///< ShowAlbumFiles. Only displays AlbumFiles associated with the title which launched the Album applet, with the filter button disabled.
AlbumLaArg_ShowAlbumFiles = 0, ///< ShowAlbumFiles. Only displays AlbumFiles associated with the application which launched the Album applet, with the filter button disabled.
AlbumLaArg_ShowAllAlbumFiles = 1, ///< ShowAllAlbumFiles. Displays all AlbumFiles, with filtering allowed.
AlbumLaArg_ShowAllAlbumFilesForHomeMenu = 2, ///< ShowAllAlbumFilesForHomeMenu. Similar to ::AlbumLaArg_ShowAllAlbumFiles.
} AlbumLaArg;
......
/**
* @file friends_la.h
* @brief Wrapper for using the MyPage (friends) LibraryApplet.
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../services/acc.h"
#include "../services/friends.h"
/// Arg type values used with \ref FriendsLaArg.
typedef enum {
FriendsLaArgType_ShowFriendList = 0, ///< ShowFriendList. Launches the applet with the "Friend List" menu initially selected.
FriendsLaArgType_ShowUserDetailInfo = 1, ///< ShowUserDetailInfo
FriendsLaArgType_StartSendingFriendRequest = 2, ///< StartSendingFriendRequest
FriendsLaArgType_ShowMethodsOfSendingFriendRequest = 3, ///< ShowMethodsOfSendingFriendRequest. Launches the applet with the "Add Friend" menu initially selected.
FriendsLaArgType_StartFacedFriendRequest = 4, ///< StartFacedFriendRequest. Launches the applet where the "Search for Local Users" menu is initially shown. Returning from this menu will exit the applet.
FriendsLaArgType_ShowReceivedFriendRequestList = 5, ///< ShowReceivedFriendRequestList. Launches the applet where the "Received Friend Requests" menu is initially shown. Returning from this menu will exit the applet.
FriendsLaArgType_ShowBlockedUserList = 6, ///< ShowBlockedUserList. Launches the applet where the "Blocked-User List" menu is initially shown. Returning from this menu will exit the applet.
FriendsLaArgType_ShowMyProfile = 7, ///< ShowMyProfile. Launches the applet with the "Profile" menu initially selected. ShowMyProfileForHomeMenu is identical to this except for playStartupSound=true.
} FriendsLaArgType;
/// Arg struct pushed for the applet input storage.
/// The fields following the uid are only set for ::FriendsLaArgType_ShowUserDetailInfo/::FriendsLaArgType_StartSendingFriendRequest, for everything else these are cleared.
typedef struct {
u32 type; ///< \ref FriendsLaArgType
u32 pad; ///< Padding.
AccountUid uid; ///< \ref AccountUid
u64 networkServiceAccountId; ///< NetworkServiceAccountId for the other account.
FriendsInAppScreenName first_inAppScreenName; ///< First InAppScreenName.
FriendsInAppScreenName second_inAppScreenName; ///< Second InAppScreenName.
} FriendsLaArg;
/**
* @brief Launches the applet with ::FriendsLaArgType_ShowFriendList, the specified input, and playStartupSound=false.
* @param[in] uid \ref AccountUid
*/
Result friendsLaShowFriendList(AccountUid uid);
/**
* @brief Launches the applet with ::FriendsLaArgType_ShowUserDetailInfo, the specified input, and playStartupSound=false.
* @param[in] uid \ref AccountUid
* @param[in] networkServiceAccountId NetworkServiceAccountId for the user to show UserDetailInfo for.
* @param[in] first_inAppScreenName First \ref FriendsInAppScreenName.
* @param[in] second_inAppScreenName Second \ref FriendsInAppScreenName.
*/
Result friendsLaShowUserDetailInfo(AccountUid uid, u64 networkServiceAccountId, const FriendsInAppScreenName *first_inAppScreenName, const FriendsInAppScreenName *second_inAppScreenName);
/**
* @brief Launches the applet with ::FriendsLaArgType_StartSendingFriendRequest, the specified input, and playStartupSound=false. On success, this will load the output Result from the output storage.
* @param[in] uid \ref AccountUid
* @param[in] networkServiceAccountId NetworkServiceAccountId to send the friend request to.
* @param[in] first_inAppScreenName First \ref FriendsInAppScreenName.
* @param[in] second_inAppScreenName Second \ref FriendsInAppScreenName.
*/
Result friendsLaStartSendingFriendRequest(AccountUid uid, u64 networkServiceAccountId, const FriendsInAppScreenName *first_inAppScreenName, const FriendsInAppScreenName *second_inAppScreenName);
/**
* @brief Launches the applet with ::FriendsLaArgType_ShowMethodsOfSendingFriendRequest, the specified input, and playStartupSound=false.
* @param[in] uid \ref AccountUid
*/
Result friendsLaShowMethodsOfSendingFriendRequest(AccountUid uid);
/**
* @brief Launches the applet with ::FriendsLaArgType_StartFacedFriendRequest, the specified input, and playStartupSound=false.
* @param[in] uid \ref AccountUid
*/
Result friendsLaStartFacedFriendRequest(AccountUid uid);
/**
* @brief Launches the applet with ::FriendsLaArgType_ShowReceivedFriendRequestList, the specified input, and playStartupSound=false.
* @param[in] uid \ref AccountUid
*/
Result friendsLaShowReceivedFriendRequestList(AccountUid uid);
/**
* @brief Launches the applet with ::FriendsLaArgType_ShowBlockedUserList, the specified input, and playStartupSound=false.
* @param[in] uid \ref AccountUid
*/
Result friendsLaShowBlockedUserList(AccountUid uid);
/**
* @brief Launches the applet with ::FriendsLaArgType_ShowMyProfile, the specified input, and playStartupSound=false.
* @param[in] uid \ref AccountUid
*/
Result friendsLaShowMyProfile(AccountUid uid);
/**
* @brief Same as \ref friendsLaShowMyProfile except with playStartupSound=true.
* @param[in] uid \ref AccountUid
*/
Result friendsLaShowMyProfileForHomeMenu(AccountUid uid);
......@@ -197,12 +197,13 @@ typedef struct {
s32 unk_x20;
s32 unk_x24;
u8 returnButtonFlag; ///< Controls whether the Return button is enabled, for newlines input. 0 = disabled, non-zero = enabled.
u16 unk_x29;
u8 unk_x29;
u8 unk_x2a;
u8 unk_x2b;
u32 flags; ///< Bitmask 0x4: unknown.
u8 unk_x30;
u8 unk_x31[0x17];
} PACKED SwkbdAppearArg;
} SwkbdAppearArg;
typedef struct {
u32 unk_x0;
......@@ -226,7 +227,8 @@ typedef struct {
u8 disableTouch; ///< Flags bitmask 0x200.
u8 disableUSBKeyboard; ///< Flags bitmask 0x800.
u8 unk_x468[5];
u16 unk_x46d;
u8 unk_x46d;
u8 unk_x46e;
u8 unk_x46f;
float keytopScaleX; ///< Flags bitmask 0x200.
float keytopScaleY; ///< Flags bitmask 0x200.
......@@ -241,7 +243,7 @@ typedef struct {
u8 triggerFlag; ///< [6.0.0+] Enables using the trigger field when set.
u8 trigger; ///< [6.0.0+] Trigger
u8 pad_x49f;
} PACKED SwkbdInlineCalcArg;
} SwkbdInlineCalcArg;
/// Struct data for SwkbdInline Interactive reply storage ChangedString*, at the end following the string.
typedef struct {
......
This diff is collapsed.
#pragma once
#include "../types.h"
#include "../kernel/event.h"
#include "../services/sm.h"
#include "../sf/service.h"
#define BINDER_FIRST_CALL_TRANSACTION 0x1
typedef struct {
bool created : 1;
bool initialized : 1;
bool has_transact_auto : 1;
bool created;
bool initialized;
s32 id;
size_t ipc_buffer_size;
size_t dummy;
Service* relay;
} Binder;
......
This diff is collapsed.
......@@ -164,7 +164,7 @@ typedef enum {
InfoType_StackRegionSize = 15, ///< [2.0.0+] Size of the Stack memory region.
InfoType_SystemResourceSizeTotal = 16, ///< [3.0.0+] Total memory allocated for process memory management.
InfoType_SystemResourceSizeUsed = 17, ///< [3.0.0+] Amount of memory currently used by process memory management.
InfoType_TitleId = 18, ///< [3.0.0+] Title ID for the process.
InfoType_ProgramId = 18, ///< [3.0.0+] Program ID for the process.
InfoType_InitialProcessIdRange = 19, ///< [4.0.0-4.1.0] Min/max initial process IDs.
InfoType_UserExceptionContextAddress = 20, ///< [5.0.0+] Address of the process's exception context (for break).
InfoType_TotalNonSystemMemorySize = 21, ///< [6.0.0+] Total amount of memory available for process, excluding that for process memory management.
......
......@@ -11,10 +11,11 @@
/// Thread information structure.
typedef struct Thread {
Handle handle; ///< Thread handle.
void* stack_mem; ///< Pointer to stack memory.
void* stack_mirror; ///< Pointer to stack memory mirror.
size_t stack_sz; ///< Stack size.
Handle handle; ///< Thread handle.
bool owns_stack_mem; ///< Whether the stack memory is automatically allocated.
void* stack_mem; ///< Pointer to stack memory.
void* stack_mirror; ///< Pointer to stack memory mirror.
size_t stack_sz; ///< Stack size.
void** tls_array;
struct Thread* next;
struct Thread** prev_next;
......@@ -31,14 +32,15 @@ static inline Waiter waiterForThread(Thread* t)
* @param t Thread information structure which will be filled in.
* @param entry Entrypoint of the thread.
* @param arg Argument to pass to the entrypoint.
* @param stack_sz Stack size (rounded up to page alignment).
* @param stack_mem Memory to use as backing for stack/tls/reent. Must be page-aligned. NULL argument means to allocate new memory.
* @param stack_sz If stack_mem is NULL, size to use for stack. If stack_mem is non-NULL, size to use for stack + reent + tls (must be page-aligned).
* @param prio Thread priority (0x00~0x3F); 0x2C is the usual priority of the main thread, 0x3B is a special priority on cores 0..2 that enables preemptive multithreading (0x3F on core 3).
* @param cpuid ID of the core on which to create the thread (0~3); or -2 to use the default core for the current process.
* @return Result code.
*/
Result threadCreate(
Thread* t, ThreadFunc entry, void* arg, size_t stack_sz, int prio,
int cpuid);
Thread* t, ThreadFunc entry, void* arg, void *stack_mem, size_t stack_sz,
int prio, int cpuid);
/**
* @brief Starts the execution of a thread.
......
......@@ -123,6 +123,7 @@ enum {
LibnxError_NvinfoFailedToInitialize,
LibnxError_NvbufFailedToInitialize,
LibnxError_LibAppletBadExit,
LibnxError_InvalidCmifOutHeader,
};
/// libnx binder error codes
......
......@@ -19,12 +19,23 @@ typedef struct
FsDir fd; ///< File descriptor
ssize_t index; ///< Current entry index
size_t size; ///< Current batch size
FsDirectoryEntry entry_data[32]; ///< Temporary storage for reading entries
} fsdev_dir_t;
/// Initializes and mounts the sdmc device if accessible. Also initializes current working directory to point to the folder containing the path to the executable (argv[0]), if it is provided by the environment.
/// Retrieves a pointer to temporary stage for reading entries
NX_CONSTEXPR FsDirectoryEntry* fsdevDirGetEntries(fsdev_dir_t *dir)
{
return (FsDirectoryEntry*)(void*)(dir+1);
}
/// Initializes and mounts the sdmc device if accessible.
Result fsdevMountSdmc(void);
/// Mounts the specified save data.
Result fsdevMountSaveData(const char *name, u64 program_id, AccountUid uid);
/// Mounts the specified system save data.
Result fsdevMountSystemSaveData(const char *name, FsSaveDataSpaceId saveDataSpaceId, u64 saveID, AccountUid uid);
/// Mounts the input fs with the specified device name. fsdev will handle closing the fs when required, including when fsdevMountDevice() fails.
/// Returns -1 when any errors occur.
int fsdevMountDevice(const char *name, FsFileSystem fs);
......@@ -39,9 +50,6 @@ Result fsdevCommitDevice(const char *name);
/// Returns the FsFileSystem for the specified device. Returns NULL when the specified device isn't found.
FsFileSystem* fsdevGetDeviceFileSystem(const char *name);
/// Returns the FsFileSystem for the default device (SD card), if mounted. Used internally by romfs_dev.
FsFileSystem* fsdevGetDefaultFileSystem(void);
/// Writes the FS-path to outpath (which has buffer size FS_MAX_PATH), for the input path (as used in stdio). The FsFileSystem is also written to device when not NULL.
int fsdevTranslatePath(const char *path, FsFileSystem** device, char *outpath);
......@@ -49,7 +57,7 @@ int fsdevTranslatePath(const char *path, FsFileSystem** device, char *outpath);
Result fsdevSetArchiveBit(const char *path);
/// This calls fsFsCreateFile on the filesystem specified by the input path (as used in stdio).
Result fsdevCreateFile(const char* path, size_t size, int flags);
Result fsdevCreateFile(const char* path, size_t size, u32 flags);
/// Recursively deletes the directory specified by the input path (as used in stdio).
Result fsdevDeleteDirectoryRecursively(const char *path);
......
......@@ -53,12 +53,11 @@ typedef struct
/**
* @brief Mounts the Application's RomFS.
* @param name Device mount name.
* @remark This function is intended to be used to access one's own RomFS.
* If the application is running as NRO, it mounts the embedded RomFS section inside the NRO.
* If on the other hand it's an NSO, it behaves identically to \ref romfsMountFromCurrentProcess.
*/
Result romfsMount(const char *name);
static inline Result romfsInit(void)
{
return romfsMount("romfs");
}
Result romfsMountSelf(const char *name);
/**
* @brief Mounts RomFS from an open file.
......@@ -67,10 +66,6 @@ static inline Result romfsInit(void)
* @param name Device mount name.
*/
Result romfsMountFromFile(FsFile file, u64 offset, const char *name);
static inline Result romfsInitFromFile(FsFile file, u64 offset)
{
return romfsMountFromFile(file, offset, "romfs");
}
/**
* @brief Mounts RomFS from an open storage.
......@@ -79,13 +74,9 @@ static inline Result romfsInitFromFile(FsFile file, u64 offset)
* @param name Device mount name.
*/
Result romfsMountFromStorage(FsStorage storage, u64 offset, const char *name);
static inline Result romfsInitFromStorage(FsStorage storage, u64 offset)
{
return romfsMountFromStorage(storage, offset, "romfs");
}
/**
* @brief Mounts RomFS using the current process host title RomFS.
* @brief Mounts RomFS using the current process host program RomFS.
* @param name Device mount name.
*/
Result romfsMountFromCurrentProcess(const char *name);
......@@ -99,8 +90,8 @@ Result romfsMountFromCurrentProcess(const char *name);
Result romfsMountFromFsdev(const char *path, u64 offset, const char *name);
/**
* @brief Mounts RomFS from a system data archive.
* @param dataId Title ID of system data archive to mount.
* @brief Mounts RomFS from SystemData.
* @param dataId SystemDataId to mount.
* @param storageId Storage ID to mount from.
* @param name Device mount name.
*/
......@@ -108,8 +99,15 @@ Result romfsMountFromDataArchive(u64 dataId, FsStorageId storageId, const char *
/// Unmounts the RomFS device.
Result romfsUnmount(const char *name);
/// Wrapper for \ref romfsMountSelf with the default "romfs" device name.
static inline Result romfsInit(void)
{
return romfsMountSelf("romfs");
}
/// Wrapper for \ref romfsUnmount with the default "romfs" device name.
static inline Result romfsExit(void)
{
return romfsUnmount("romfs");
}
#pragma once
#include "../../types.h"
/// BSD service type used by the socket driver.
typedef enum {
BsdServiceType_User = BIT(0), ///< Uses bsd:u (default).
BsdServiceType_System = BIT(1), ///< Uses bsd:s.
BsdServiceType_Auto = BsdServiceType_User | BsdServiceType_System, ///< Tries to use bsd:s first, and if that fails uses bsd:u (official software behavior).
} BsdServiceType;
/// Configuration structure for socketInitalize
typedef struct {
u32 bsdsockets_version; ///< Observed 1 on 2.0 LibAppletWeb, 2 on 3.0.
......@@ -15,10 +22,8 @@ typedef struct {
u32 sb_efficiency; ///< Number of buffers for each socket (standard values range from 1 to 8).
size_t serialized_out_addrinfos_max_size; ///< For getaddrinfo.
size_t serialized_out_hostent_max_size; ///< For gethostbyname/gethostbyaddr.
bool bypass_nsd; ///< For name gethostbyname/getaddrinfo: bypass the Name Server Daemon.
int dns_timeout; ///< For DNS requests: timeout or 0.
u32 num_bsd_sessions; ///< Number of BSD service sessions (typically 3).
BsdServiceType bsd_service_type; ///< BSD service type (typically \ref BsdServiceType_User).
} SocketInitConfig;
/// Fetch the default configuration for the socket driver.
......@@ -26,14 +31,11 @@ const SocketInitConfig *socketGetDefaultInitConfig(void);
/// Initalize the socket driver.
Result socketInitialize(const SocketInitConfig *config);
/// Fetch the last bsd:u/s Switch result code (thread-local).
Result socketGetLastBsdResult(void);
/// Fetch the last sfdnsres Switch result code (thread-local).
Result socketGetLastSfdnsresResult(void);
Result socketGetLastResult(void);
/// Deinitialize the socket driver.
void socketExit(void);
/// Initalize the socket driver using the default configuration.
static inline Result socketInitializeDefault(void) {
return socketInitialize(socketGetDefaultInitConfig());
NX_INLINE Result socketInitializeDefault(void) {
return socketInitialize(NULL);
}
......@@ -6,6 +6,7 @@
*/
#pragma once
#include "../types.h"
#include "../services/acc.h"
/// Structure representing an entry in the homebrew environment configuration.
typedef struct {
......@@ -114,4 +115,4 @@ bool envHasRandomSeed(void);
void envGetRandomSeed(u64 out[2]);
/// Returns a pointer to the user id storage area (if present).
u128* envGetUserIdStorage(void);
AccountUid* envGetUserIdStorage(void);
#pragma once
#include "../types.h"
/// Fetches the last resolver Switch result code of the current thread.
Result resolverGetLastResult(void);
/// Retrieves a handle used to cancel the next resolver command on the current thread.
u32 resolverGetCancelHandle(void);
/// Retrieves whether service discovery is enabled for resolver commands on the current thread.
bool resolverGetEnableServiceDiscovery(void);
/// [5.0.0+] Retrieves whether the DNS cache is used to resolve queries on the current thread (not implemented).
bool resolverGetEnableDnsCache(void);
/// Enables or disables service discovery for the current thread.
void resolverSetEnableServiceDiscovery(bool enable);
/// [5.0.0+] Enables or disables the usage of the DNS cache on the current thread (not implemented).
void resolverSetEnableDnsCache(bool enable);
/// Cancels a previous resolver command (handle obtained with \ref resolverGetCancelHandle prior to calling the command).
Result resolverCancel(u32 handle);
/// [5.0.0+] Removes a hostname from the DNS cache (not implemented).
Result resolverRemoveHostnameFromCache(const char* hostname);
/// [5.0.0+] Removes an IP address from the DNS cache (not implemented).
Result resolverRemoveIpAddressFromCache(u32 ip);
......@@ -6,65 +6,97 @@
*/
#pragma once
#include "../types.h"
#include "sm.h"
#include "../sf/service.h"
#define ACC_USER_LIST_SIZE 8
typedef enum {
AccountServiceType_NotInitialized = 0, ///< Same as ::AccountServiceType_Application during \ref accountInitialize.
AccountServiceType_Application = 1, ///< Initializes acc:u0.
AccountServiceType_System = 2, ///< Initializes acc:u1.
AccountServiceType_Administrator = 3, ///< Initializes acc:su.
} AccountServiceType;
/// Profile
typedef struct {
Service s;
Service s; ///< IProfile
} AccountProfile;
typedef struct
{
u32 unk_x0;
u32 iconID; ///< Icon ID. 0 = Mii, the rest are character icon IDs.
u8 iconBackgroundColorID; ///< Profile icon background color ID
u8 unk_x9[0x7];
u8 miiID[0x10]; ///< Some ID related to the Mii? All zeros when a character icon is used.
/// Account UserId.
typedef struct {
u64 uid[2]; ///< UserId. All-zero is invalid / Uid not set. See also \ref accountUidIsValid.
} AccountUid;
/// UserData
typedef struct {
u32 unk_x0; ///< Unknown.
u32 iconID; ///< Icon ID. 0 = Mii, the rest are character icon IDs.
u8 iconBackgroundColorID; ///< Profile icon background color ID
u8 unk_x9[0x7]; ///< Unknown.
u8 miiID[0x10]; ///< Some ID related to the Mii? All zeros when a character icon is used.
u8 unk_x20[0x60]; ///< Usually zeros?
} PACKED AccountUserData;
} AccountUserData;
typedef struct
{
u128 userID;
/// ProfileBase
typedef struct {
AccountUid uid; ///< \ref AccountUid
u64 lastEditTimestamp; ///< POSIX UTC timestamp, for the last account edit.
char username[0x20]; ///< UTF-8 Username.
} PACKED AccountProfileBase;
char nickname[0x20]; ///< UTF-8 Nickname.
} AccountProfileBase;
/**
* @brief Sets the \ref AccountServiceType for initialization. Call this function before \ref accountInitialize, if needed.
* @note By default ::AccountServiceType_NotInitialized will be used.
*/
void accountSetServiceType(AccountServiceType serviceType);
/// Initialize account.
Result accountInitialize(void);
/// Exit account.
void accountExit(void);
/// Gets the Service object for the actual account service session.
Service* accountGetServiceSession(void);
/// Get the total number of user profiles
/// Get the total number of user profiles.
Result accountGetUserCount(s32* user_count);
/**
* @brief Get a list of all user IDs. The returned list will never be larger than ACC_USER_LIST_SIZE.
* @param userIDs Pointer to array of user IDs.
* @param max_userIDs Maximum number of user IDs to return.
* @param actual_total The actual total number of user IDs found.
* @brief Get a list of all userIds. The returned list will never be larger than ACC_USER_LIST_SIZE.
* @param uids Pointer to array of userIds.
* @param max_uids Maximum number of userIds to return.
* @param actual_total The actual total number of userIds found.
*/
Result accountListAllUsers(u128* userIDs, size_t max_userIDs, size_t *actual_total);
Result accountListAllUsers(AccountUid* uids, s32 max_uids, s32 *actual_total);
/// Get the userId for the last opened user.
Result accountGetLastOpenedUser(AccountUid *uid);
/// Get the userID for the last opened user. The output userID is only valid when the output account_selected==1.
Result accountGetLastOpenedUser(u128 *userID, bool *account_selected);
/// Get an AccountProfile for the specified userId.
Result accountGetProfile(AccountProfile* out, AccountUid uid);
/// Get an AccountProfile for the specified userID.
Result accountGetProfile(AccountProfile* out, u128 userID);
/// Close the AccountProfile.
void accountProfileClose(AccountProfile* profile);
/// Get \ref AccountUserData and \ref AccountProfileBase for the specified profile, userdata is optional (can be NULL).
Result accountProfileGet(AccountProfile* profile, AccountUserData* userdata, AccountProfileBase* profilebase);
/// Get the icon image size.
Result accountProfileGetImageSize(AccountProfile* profile, size_t* image_size);
Result accountProfileGetImageSize(AccountProfile* profile, u32* image_size);
/// Load the JPEG profile icon, valid for both Miis and character icons. The output image_size is the same as the one from \ref accountProfileGetImageSize.
Result accountProfileLoadImage(AccountProfile* profile, void* buf, size_t len, size_t* image_size);
void accountProfileClose(AccountProfile* profile);
Result accountProfileLoadImage(AccountProfile* profile, void* buf, size_t len, u32* image_size);
/// Gets the userID which was selected by the profile-selector applet (if any), prior to launching the currently running Application title.
/// Gets the userId which was selected by the profile-selector applet (if any), prior to launching the currently running Application.
/// This gets the cached PreselectedUser loaded during accountInitialize, when PreselectedUser is available.
Result accountGetPreselectedUser(u128 *userID);
Result accountGetPreselectedUser(AccountUid *uid);
/**
* @brief Checks whether the specified \ref AccountUid is valid/set (non-zero).
* @param[in] Uid \ref AccountUid
*/
NX_CONSTEXPR bool accountUidIsValid(const AccountUid *Uid) {
return Uid->uid[0]!=0 || Uid->uid[1]!=0;
}
/**
* @file apm.h
* @brief Performance management (apm) service IPC wrapper. This is used internally by applet with __nx_applet_PerformanceConfiguration, however if you prefer non-init/exit can be used manually.
* @brief Performance management (apm) service IPC wrapper. This is used internally by applet with __nx_applet_PerformanceConfiguration, however if you prefer non-init/exit can be used manually. See also: https://switchbrew.org/wiki/PTM_services#apm:am
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../services/sm.h"
#include "../sf/service.h"
/// PerformanceMode
typedef enum {
ApmPerformanceMode_Handheld = 0, ///< Handheld
ApmPerformanceMode_Docked = 1, ///< Docked
} ApmPerformanceMode;
/// CpuBoostMode. With \ref appletSetCpuBoostMode, only values 0/1 are available. This allows using higher clock rates.
typedef enum {
......@@ -15,9 +21,28 @@ typedef enum {
ApmCpuBoostMode_Type2 = 2, ///< Use performance configurations 0x9222000B and 0x9222000C.
} ApmCpuBoostMode;
/// Initialize apm. Used automatically by \ref appletInitialize.
Result apmInitialize(void);
/// Exit apm. Used automatically by \ref appletExit.
void apmExit(void);
/// Gets the Service object for the actual apm service session.
Service* apmGetServiceSession(void);
Result apmSetPerformanceConfiguration(u32 PerformanceMode, u32 PerformanceConfiguration);
Result apmGetPerformanceConfiguration(u32 PerformanceMode, u32 *PerformanceConfiguration);
/// Gets the Service object for ISession.
Service* apmGetServiceSession_Session(void);
/**
* @brief Sets the PerformanceConfiguration for the specified PerformanceMode.
* @param[in] PerformanceMode \ref ApmPerformanceMode
* @param[in] PerformanceConfiguration PerformanceConfiguration
*/
Result apmSetPerformanceConfiguration(ApmPerformanceMode PerformanceMode, u32 PerformanceConfiguration);
/**
* @brief Gets the PerformanceConfiguration for the specified PerformanceMode.
* @param[in] PerformanceMode \ref ApmPerformanceMode
* @param[out] PerformanceConfiguration PerformanceConfiguration
*/
Result apmGetPerformanceConfiguration(ApmPerformanceMode PerformanceMode, u32 *PerformanceConfiguration);
This diff is collapsed.
/**
* @file async.h
* @brief NS/NIM IAsync* IPC wrapper.
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../sf/service.h"
#include "../applets/error.h"
#include "../kernel/event.h"
/// AsyncValue
typedef struct {
Service s; ///< IAsyncValue
Event event; ///< Event with autoclear=false.
} AsyncValue;
/// AsyncResult
typedef struct {
Service s; ///< IAsyncResult
Event event; ///< Event with autoclear=false.
} AsyncResult;
///@name IAsyncValue
///@{
/**
* @brief Close a \ref AsyncValue.
* @note When the object is initialized, this uses \ref asyncValueCancel then \ref asyncValueWait with timeout=U64_MAX.
* @param a \ref AsyncValue
*/
void asyncValueClose(AsyncValue *a);
/**
* @brief Waits for the async operation to finish using the specified timeout.
* @param a \ref AsyncValue
* @param[in] timeout Timeout in nanoseconds. U64_MAX for no timeout.
*/
Result asyncValueWait(AsyncValue *a, u64 timeout);
/**
* @brief Gets the value size.
* @param a \ref AsyncValue
* @param[out] size Output size.
*/
Result asyncValueGetSize(AsyncValue *a, u64 *size);
/**
* @brief Gets the value.
* @note Prior to using the cmd, this uses \ref asyncResultWait with timeout=U64_MAX.
* @param a \ref AsyncValue
* @param[out] buffer Output buffer.
* @param[in] size Output buffer size.
*/
Result asyncValueGet(AsyncValue *a, void* buffer, size_t size);
/**
* @brief Cancels the async operation.
* @note Used automatically by \ref asyncValueClose.
* @param a \ref AsyncValue
*/
Result asyncValueCancel(AsyncValue *a);
/**
* @brief Gets the \ref ErrorContext.
* @param a \ref AsyncValue
* @param[out] context \ref ErrorContext
*/
Result asyncValueGetErrorContext(AsyncValue *a, ErrorContext *context);
///@}
///@name IAsyncResult
///@{
/**
* @brief Close a \ref AsyncResult.
* @note When the object is initialized, this uses \ref asyncResultCancel then \ref asyncResultWait with timeout=U64_MAX.
* @param a \ref AsyncResult
*/
void asyncResultClose(AsyncResult *a);
/**
* @brief Waits for the async operation to finish using the specified timeout.
* @param a \ref AsyncResult
* @param[in] timeout Timeout in nanoseconds. U64_MAX for no timeout.
*/
Result asyncResultWait(AsyncResult *a, u64 timeout);
/**
* @brief Gets the Result.
* @note Prior to using the cmd, this uses \ref asyncResultWait with timeout=U64_MAX.
* @param a \ref AsyncResult
*/
Result asyncResultGet(AsyncResult *a);
/**
* @brief Cancels the async operation.
* @note Used automatically by \ref asyncResultClose.
* @param a \ref AsyncResult
*/
Result asyncResultCancel(AsyncResult *a);
/**
* @brief Gets the \ref ErrorContext.
* @param a \ref AsyncResult
* @param[out] context \ref ErrorContext
*/
Result asyncResultGetErrorContext(AsyncResult *a, ErrorContext *context);
///@}
/**
* @file auddev.h
* @brief Audio device.
* @brief IAudioDevice IPC wrapper.
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../audio/audio.h"
#include "../services/sm.h"
#include "../sf/service.h"
/// Initialize IAudioDevice.
Result auddevInitialize(void);
/// Exit IAudioDevice.
void auddevExit(void);
/// Gets the Service object for IAudioDevice.
Service* auddevGetServiceSession(void);
Result auddevListAudioDeviceName(AudioDeviceName *DeviceNames, s32 max_names, s32 *total_names);
......
......@@ -6,7 +6,9 @@
*/
#pragma once
#include "../types.h"
#include "../audio/audio.h"
#include "../sf/service.h"
typedef enum {
AudioInState_Started = 0,
......@@ -25,10 +27,19 @@ struct AudioInBuffer
u64 data_offset; ///< Offset of data inside the buffer. (Unused?)
};
/// Initialize audin.
Result audinInitialize(void);
/// Exit audin.
void audinExit(void);
Result audinListAudioIns(char *DeviceNames, u32 *DeviceNamesCount);
/// Gets the Service object for the actual audin service session.
Service* audinGetServiceSession(void);
/// Gets the Service object for IAudioIn.
Service* audinGetServiceSession_AudioIn(void);
Result audinListAudioIns(char *DeviceNames, s32 count, u32 *DeviceNamesCount);
Result audinOpenAudioIn(const char *DeviceNameIn, char *DeviceNameOut, u32 SampleRateIn, u32 ChannelCountIn, u32 *SampleRateOut, u32 *ChannelCountOut, PcmFormat *Format, AudioInState *State);
Result audinGetAudioInState(AudioInState *State);
Result audinStartAudioIn(void);
......
......@@ -6,7 +6,9 @@
*/
#pragma once
#include "../types.h"
#include "../audio/audio.h"
#include "../sf/service.h"
typedef enum {
AudioOutState_Started = 0,
......@@ -25,10 +27,19 @@ struct AudioOutBuffer
u64 data_offset; ///< Offset of data inside the buffer. (Unused?)
};
/// Initialize audout.
Result audoutInitialize(void);
/// Exit audout.
void audoutExit(void);
Result audoutListAudioOuts(char *DeviceNames, u32 *DeviceNamesCount);
/// Gets the Service object for the actual audout service session.
Service* audoutGetServiceSession(void);
/// Gets the Service object for IAudioOut.
Service* audoutGetServiceSession_AudioOut(void);
Result audoutListAudioOuts(char *DeviceNames, s32 count, u32 *DeviceNamesCount);
Result audoutOpenAudioOut(const char *DeviceNameIn, char *DeviceNameOut, u32 SampleRateIn, u32 ChannelCountIn, u32 *SampleRateOut, u32 *ChannelCountOut, PcmFormat *Format, AudioOutState *State);
Result audoutGetAudioOutState(AudioOutState *State);
Result audoutStartAudioOut(void);
......
......@@ -6,14 +6,9 @@
*/
#pragma once
#include "../types.h"
#include "../audio/audio.h"
#include "../services/sm.h"
#if __cplusplus >= 201402L
#define AUDREN_CONSTEXPR constexpr
#else
#define AUDREN_CONSTEXPR static inline
#endif
#include "../sf/service.h"
#define AUDREN_TIMER_FREQ_HZ 200.0f
#define AUDREN_TIMER_PERIOD_MS 5.0f
......@@ -287,12 +282,12 @@ static inline u32 audrenGetRevision(void)
return g_audrenRevision;
}
AUDREN_CONSTEXPR int audrenGetMemPoolCount(const AudioRendererConfig* config)
NX_CONSTEXPR int audrenGetMemPoolCount(const AudioRendererConfig* config)
{
return config->num_effects + 4 * config->num_voices;
}
AUDREN_CONSTEXPR size_t audrenGetInputParamSize(const AudioRendererConfig* config)
NX_CONSTEXPR size_t audrenGetInputParamSize(const AudioRendererConfig* config)
{
size_t size = 0;
size += sizeof(AudioRendererUpdateDataHeader);
......@@ -307,7 +302,7 @@ AUDREN_CONSTEXPR size_t audrenGetInputParamSize(const AudioRendererConfig* confi
return size;
}
AUDREN_CONSTEXPR size_t audrenGetOutputParamSize(const AudioRendererConfig* config)
NX_CONSTEXPR size_t audrenGetOutputParamSize(const AudioRendererConfig* config)
{
size_t size = 0;
size += sizeof(AudioRendererUpdateDataHeader);
......@@ -320,9 +315,15 @@ AUDREN_CONSTEXPR size_t audrenGetOutputParamSize(const AudioRendererConfig* conf
return size;
}
/// Initialize audren.
Result audrenInitialize(const AudioRendererConfig* config);
/// Exit audren.
void audrenExit(void);
Service* audrenGetServiceSession(void);
/// Gets the Service object for IAudioRenderer.
Service* audrenGetServiceSession_AudioRenderer(void);
void audrenWaitFrame(void);
Result audrenGetState(u32* out_state);
Result audrenRequestUpdateAudioRenderer(const void* in_param_buf, size_t in_param_buf_size, void* out_param_buf, size_t out_param_buf_size, void* perf_buf, size_t perf_buf_size);
......
......@@ -6,15 +6,20 @@
*/
#pragma once
#include "../types.h"
#include "../services/sm.h"
#include "../sf/service.h"
typedef enum {
BpcSleepButtonState_Held = 0,
BpcSleepButtonState_Released = 1,
} BpcSleepButtonState;
/// Initialize bpc.
Result bpcInitialize(void);
/// Exit bpc.
void bpcExit(void);
/// Gets the Service object for the actual bpc service session.
Service* bpcGetServiceSession(void);
Result bpcShutdownSystem(void);
......
/**
* @file bsd.h
* @brief BSD sockets (bsd:u/s) service IPC wrapper. Please use socket.c instead.
* @brief BSD sockets (bsd:u/s) service IPC wrapper. Please use the standard <sys/socket.h> interface instead.
* @author plutoo
* @author TuxSH
* @copyright libnx Authors
......@@ -12,7 +12,7 @@
#include "../types.h"
#include "../kernel/tmem.h"
#include "../services/sm.h"
#include "../sf/service.h"
/// Configuration structure for bsdInitalize
typedef struct {
......@@ -34,10 +34,14 @@ extern __thread int g_bsdErrno; ///< Last errno, per-thread
/// Fetch the default configuration for bsdInitialize.
const BsdInitConfig *bsdGetDefaultInitConfig(void);
/// Initialize the BSD service.
Result bsdInitialize(const BsdInitConfig *config);
/// Deinitialize the BSD service.
Result bsdInitialize(const BsdInitConfig *config, u32 num_sessions, u32 service_type);
/// Exit the BSD service.
void bsdExit(void);
/// Gets the Service object for the actual BSD service session.
Service* bsdGetServiceSession(void);
/// Creates a socket.
......@@ -73,8 +77,3 @@ int bsdClose(int fd);
int bsdDuplicateSocket(int sockfd);
// TODO: Reverse-engineer GetResourceStatistics. Implement sendmmsg/recvmmsg (custom (un)serialization)
/// Initialize the BSD service using the default configuration.
static inline Result bsdInitializeDefault(void) {
return bsdInitialize(bsdGetDefaultInitConfig());
}
......@@ -6,7 +6,6 @@
*/
#pragma once
#include "../types.h"
#include "../services/sm.h"
#include "../services/acc.h"
/// ImageOrientation
......@@ -27,7 +26,7 @@ typedef enum {
typedef enum {
CapsContentType_Screenshot = 0, ///< Album screenshots.
CapsContentType_Movie = 1, ///< Album videos.
CapsContentType_ExtraMovie = 3, ///< Videos recorded by the current Application host title via \ref grcCreateMovieMaker.
CapsContentType_ExtraMovie = 3, ///< Videos recorded by the current host Application via \ref grcCreateMovieMaker.
} CapsContentType;
/// ScreenShotAttribute
......@@ -77,7 +76,7 @@ typedef struct {
/// AlbumEntryId
typedef struct {
u64 titleID; ///< titleID.
u64 program_id; ///< ProgramId.
CapsAlbumFileDateTime datetime; ///< \ref CapsAlbumFileDateTime
u8 unk_x10; ///< Unknown.
u8 unk_x11; ///< Unknown.
......@@ -123,7 +122,7 @@ typedef struct {
/// UserIdList
typedef struct {
union { u128 userIDs[ACC_USER_LIST_SIZE]; } PACKED; ///< userIDs.
AccountUid uids[ACC_USER_LIST_SIZE]; ///< \ref AccountUid
u8 count; ///< Total userIDs.
u8 pad[7]; ///< Padding.
} CapsUserIdList;
......
......@@ -6,7 +6,7 @@
*/
#pragma once
#include "../types.h"
#include "../services/sm.h"
#include "../sf/service.h"
#include "../services/caps.h"
/// Initialize caps:sc. Only available on [2.0.0+].
......@@ -24,12 +24,12 @@ Service* capsscGetServiceSession(void);
* @note buffer_index and buffer_count correspond to buffers with size 0x384000(1280*720*4). These must not be negative.
* @param buf Output buffer containing the RGBA8 image.
* @param size Size of buf, should be 0x384000(1280*720*4) * buffer_count.
* @param inval Value 0 can be used for this.
* @param layer_stack Value 0 can be used for this.
* @param width Image width, must be 1280.
* @param height Image height, must be 720.
* @param buffer_count Total number of output image buffers.
* @param buffer_index Starting image buffer index. Must be < buffer_count.
* @param timeout Timeout in nanoseconds. A default value of 100000000 can be used.
*/
Result capsscCaptureRawImageWithTimeout(void* buf, size_t size, u32 inval, u64 width, u64 height, s64 buffer_count, s64 buffer_index, u64 timeout);
Result capsscCaptureRawImageWithTimeout(void* buf, size_t size, u32 layer_stack, u64 width, u64 height, s64 buffer_count, s64 buffer_index, u64 timeout);
......@@ -6,7 +6,8 @@
*/
#pragma once
#include "../types.h"
#include "../services/sm.h"
#include "../sf/service.h"
#include "../services/acc.h"
#include "../services/caps.h"
/// Initialize caps:su. Only available on [4.0.0+].
......@@ -51,11 +52,11 @@ Result capssuSaveScreenShotWithUserData(const void* buffer, size_t size, AlbumRe
* @param[in] size Size of the buffer.
* @param[in] reportoption \ref AlbumReportOption
* @param[in] orientation \ref AlbumImageOrientation
* @param[in] userIDs Input array of account userIDs. If NULL, the \ref CapsUserIdList will be empty.
* @param[in] userID_count Size of the userID array in entries, must be within bounds for CapsUserIdList::userIDs. If 0, the \ref CapsUserIdList will be empty.
* @param[in] uids Input array of \ref AccountUid. If NULL, the \ref CapsUserIdList will be empty.
* @param[in] uid_count Size of the uids array in entries, must be within bounds for CapsUserIdList::uids. If 0, the \ref CapsUserIdList will be empty.
* @param[out] out \ref CapsApplicationAlbumEntry. Optional, can be NULL.
*/
Result capssuSaveScreenShotWithUserIds(const void* buffer, size_t size, AlbumReportOption reportoption, AlbumImageOrientation orientation, const u128* userIDs, size_t userID_count, CapsApplicationAlbumEntry *out);
Result capssuSaveScreenShotWithUserIds(const void* buffer, size_t size, AlbumReportOption reportoption, AlbumImageOrientation orientation, const AccountUid* uids, size_t uid_count, CapsApplicationAlbumEntry *out);
/**
* @brief Saves an Album screenshot using the specified gfx data in the buffer, with the specified \ref CapsScreenShotAttribute.
......
/**
* @file capsu.h
* @brief Application Album (caps:u) service IPC wrapper.
* This is only usable with AlbumFiles associated with the current Application host title.
* This is only usable with AlbumFiles associated with the current host Application.
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../services/sm.h"
#include "../sf/service.h"
#include "../services/caps.h"
#include "../services/acc.h"
/// Initialize caps:u. Only available on [5.0.0+].
Result capsuInitialize(void);
......@@ -19,7 +20,7 @@ void capsuExit(void);
/// Gets the Service for caps:u.
Service* capsuGetServiceSession(void);
/// Gets the Service for IAlbumAccessorApplicationSession, only initialized after \ref capsuOpenAlbumMovieStream (unaffected by using \ref capsuCloseAlbumMovieStream).
/// Gets the Service for IAlbumAccessorApplicationSession, only initialized after \ref capsuOpenAlbumMovieStream was used (unaffected by using \ref capsuCloseAlbumMovieStream).
Service* capsuGetServiceSession_Accessor(void);
/**
......@@ -33,7 +34,7 @@ Service* capsuGetServiceSession_Accessor(void);
* @param[in] end_datetime End \ref CapsAlbumFileDateTime, when NULL the default is used.
* @param[out] total_entries Total output entries.
*/
Result capsuGetAlbumFileListDeprecated1(CapsApplicationAlbumFileEntry *entries, size_t count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, u64 *total_entries);
Result capsuGetAlbumFileListDeprecated1(CapsApplicationAlbumFileEntry *entries, s32 count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, s32 *total_entries);
/**
* @brief Gets a listing of \ref CapsApplicationAlbumFileEntry, where the AlbumFile has an UserId which matches the input one. See also \ref capssuSaveScreenShotWithUserIds.
......@@ -44,10 +45,10 @@ Result capsuGetAlbumFileListDeprecated1(CapsApplicationAlbumFileEntry *entries,
* @param[in] type \ref CapsContentType
* @param[in] start_datetime Start \ref CapsAlbumFileDateTime, when NULL the default is used.
* @param[in] end_datetime End \ref CapsAlbumFileDateTime, when NULL the default is used.
* @param[in] userID userID.
* @param[in] uid \ref AccountUid
* @param[out] total_entries Total output entries.
*/
Result capsuGetAlbumFileListDeprecated2(CapsApplicationAlbumFileEntry *entries, size_t count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, u128 userID, u64 *total_entries);
Result capsuGetAlbumFileListDeprecated2(CapsApplicationAlbumFileEntry *entries, s32 count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, AccountUid uid, s32 *total_entries);
/**
* @brief Gets a listing of \ref CapsApplicationAlbumEntry.
......@@ -59,7 +60,7 @@ Result capsuGetAlbumFileListDeprecated2(CapsApplicationAlbumFileEntry *entries,
* @param[in] end_datetime End \ref CapsAlbumFileDateTime, when NULL the default is used.
* @param[out] total_entries Total output entries.
*/
Result capsuGetAlbumFileList3(CapsApplicationAlbumEntry *entries, size_t count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, u64 *total_entries);
Result capsuGetAlbumFileList3(CapsApplicationAlbumEntry *entries, s32 count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, s32 *total_entries);
/**
* @brief Gets a listing of \ref CapsApplicationAlbumEntry, where the AlbumFile has an UserId which matches the input one. See also \ref capssuSaveScreenShotWithUserIds.
......@@ -69,10 +70,10 @@ Result capsuGetAlbumFileList3(CapsApplicationAlbumEntry *entries, size_t count,
* @param[in] type \ref CapsContentType
* @param[in] start_datetime Start \ref CapsAlbumFileDateTime, when NULL the default is used.
* @param[in] end_datetime End \ref CapsAlbumFileDateTime, when NULL the default is used.
* @param[in] userID userID.
* @param[in] uid \ref AccountUid
* @param[out] total_entries Total output entries.
*/
Result capsuGetAlbumFileList4(CapsApplicationAlbumEntry *entries, size_t count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, u128 userID, u64 *total_entries);
Result capsuGetAlbumFileList4(CapsApplicationAlbumEntry *entries, s32 count, CapsContentType type, const CapsAlbumFileDateTime *start_datetime, const CapsAlbumFileDateTime *end_datetime, AccountUid uid, s32 *total_entries);
/**
* @brief Deletes the specified AlbumFile.
......
......@@ -6,15 +6,20 @@
*/
#pragma once
#include "../types.h"
#include "../services/sm.h"
#include "../sf/service.h"
#include "../services/pcv.h"
typedef struct {
Service s;
Service s;
} ClkrstSession;
/// Initialize clkrst. Only available on [8.0.0+].
Result clkrstInitialize(void);
/// Exit clkrst.
void clkrstExit(void);
/// Gets the Service object for the actual clkrst service session.
Service* clkrstGetServiceSession(void);
/// Opens a ClkrstSession for the requested PcvModuleId, unk is set to 3 in official sysmodules.
......
......@@ -6,10 +6,15 @@
*/
#pragma once
#include "../types.h"
#include "../services/sm.h"
#include "../sf/service.h"
/// Initialize csrng.
Result csrngInitialize(void);
/// Exit csrng.
void csrngExit(void);
/// Gets the Service object for the actual csrng service session.
Service* csrngGetServiceSession(void);
Result csrngGetRandomBytes(void *out, size_t out_size);
......@@ -9,10 +9,10 @@
/// Type of thrown fatal error.
typedef enum {
FatalType_ErrorReportAndErrorScreen = 0,
FatalType_ErrorReport = 1,
FatalType_ErrorScreen = 2 ///< Only available with [3.0.0+]. If specified, FatalType_ErrorReportAndErrorScreen will be used instead on pre-3.0.0.
} FatalType;
FatalPolicy_ErrorReportAndErrorScreen = 0,
FatalPolicy_ErrorReport = 1,
FatalPolicy_ErrorScreen = 2 ///< Only available with [3.0.0+]. If specified, FatalPolicy_ErrorReportAndErrorScreen will be used instead on pre-3.0.0.
} FatalPolicy;
/// Struct for fatal Cpu context, 64-bit.
typedef struct {
......@@ -68,32 +68,32 @@ typedef struct {
FatalAarch64Context aarch64_ctx;
FatalAarch32Context aarch32_ctx;
};
bool is_aarch32;
u32 type;
} FatalContext;
} FatalCpuContext;
/**
* @brief Triggers a system fatal error.
* @param[in] err Result code to throw.
* @note This function does not return.
* @note This uses \ref fatalWithType with \ref FatalType_ErrorScreen internally.
* @note This uses \ref fatalThrowWithPolicy with \ref FatalPolicy_ErrorScreen internally.
*/
void NORETURN fatalSimple(Result err);
void NORETURN fatalThrow(Result err);
/**
* @brief Triggers a system fatal error with a custom \ref FatalType.
* @brief Triggers a system fatal error with a custom \ref FatalPolicy.
* @param[in] err Result code to throw.
* @param[in] type Type of fatal error to throw.
* @note This function may not return, depending on \ref FatalType.
* @note This function may not return, depending on \ref FatalPolicy.
*/
void fatalWithType(Result err, FatalType type);
void fatalThrowWithPolicy(Result err, FatalPolicy type);
/**
* @brief Triggers a system fatal error with a custom \ref FatalType and \ref FatalContext.
* @brief Triggers a system fatal error with a custom \ref FatalPolicy and \ref FatalCpuContext.
* @param[in] err Result code to throw.
* @param[in] type Type of fatal error to throw.
* @param[in] ctx Cpu context for fatal error to throw.
* @note This function may not return, depending on \ref FatalType.
* @note This function may not return, depending on \ref FatalPolicy.
*/
void fatalWithContext(Result err, FatalType type, FatalContext *ctx);
void fatalThrowWithContext(Result err, FatalPolicy type, FatalCpuContext *ctx);
/**
* @file friend.h
* @brief Friends (friend:*) service IPC wrapper.
* @author yellows8
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../sf/service.h"
/// InAppScreenName
typedef struct {