mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-04 02:22:15 +02:00
Merge branch 'master' of https://github.com/switchbrew/libnx into dev
This commit is contained in:
commit
7486373428
@ -64,6 +64,7 @@ extern "C" {
|
||||
#include "switch/services/bpc.h"
|
||||
#include "switch/services/pcv.h"
|
||||
#include "switch/services/clkrst.h"
|
||||
#include "switch/services/fan.h"
|
||||
#include "switch/services/psm.h"
|
||||
#include "switch/services/spsm.h"
|
||||
//#include "switch/services/bsd.h" Use <sys/socket.h> instead
|
||||
@ -84,6 +85,7 @@ extern "C" {
|
||||
#include "switch/services/ns.h"
|
||||
#include "switch/services/ldr.h"
|
||||
#include "switch/services/ro.h"
|
||||
#include "switch/services/tc.h"
|
||||
#include "switch/services/ts.h"
|
||||
#include "switch/services/pm.h"
|
||||
#include "switch/services/set.h"
|
||||
|
@ -77,5 +77,6 @@ typedef struct {
|
||||
} NacpStruct;
|
||||
|
||||
/// Get the NacpLanguageEntry from the input nacp corresponding to the current system language (this may fallback to other languages when needed). Output langentry is NULL if none found / content of entry is empty.
|
||||
/// If you're using ns you may want to use \ref nsGetApplicationDesiredLanguage instead.
|
||||
Result nacpGetLanguageEntry(NacpStruct* nacp, NacpLanguageEntry** langentry);
|
||||
|
||||
|
@ -33,6 +33,12 @@ Service* apmGetServiceSession(void);
|
||||
/// Gets the Service object for ISession.
|
||||
Service* apmGetServiceSession_Session(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the current ApmPerformanceMode.
|
||||
* @param[out] out_performanceMode ApmPerformanceMode
|
||||
*/
|
||||
Result apmGetPerformanceMode(ApmPerformanceMode* out_performanceMode);
|
||||
|
||||
/**
|
||||
* @brief Sets the PerformanceConfiguration for the specified PerformanceMode.
|
||||
* @param[in] PerformanceMode \ref ApmPerformanceMode
|
||||
|
@ -2468,6 +2468,10 @@ AppletOperationMode appletGetOperationMode(void);
|
||||
ApmPerformanceMode appletGetPerformanceMode(void);
|
||||
AppletFocusState appletGetFocusState(void);
|
||||
|
||||
/**
|
||||
* @brief Sets the current \ref AppletFocusHandlingMode.
|
||||
* @note Should only be called with AppletType_Application.
|
||||
*/
|
||||
Result appletSetFocusHandlingMode(AppletFocusHandlingMode mode);
|
||||
|
||||
///@}
|
||||
|
32
nx/include/switch/services/fan.h
Normal file
32
nx/include/switch/services/fan.h
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @file fan.h
|
||||
* @brief Fan service IPC wrapper.
|
||||
* @author Behemoth
|
||||
* @copyright libnx Authors
|
||||
*/
|
||||
#pragma once
|
||||
#include "../types.h"
|
||||
#include "../sf/service.h"
|
||||
|
||||
typedef struct {
|
||||
Service s;
|
||||
} FanController;
|
||||
|
||||
/// Initialize fan.
|
||||
Result fanInitialize(void);
|
||||
|
||||
/// Exit fan.
|
||||
void fanExit(void);
|
||||
|
||||
/// Gets the Service object for the actual fan service session.
|
||||
Service* fanGetServiceSession(void);
|
||||
|
||||
/// Opens IController session.
|
||||
Result fanOpenController(FanController *out, u32 device_code);
|
||||
|
||||
/// Close IController session.
|
||||
void fanControllerClose(FanController *controller);
|
||||
|
||||
/// @warning Disabling your fan can damage your system.
|
||||
Result fanControllerSetRotationSpeedLevel(FanController *controller, float level);
|
||||
Result fanControllerGetRotationSpeedLevel(FanController *controller, float *level);
|
@ -350,6 +350,8 @@ Result fsOpenDataStorageByDataId(FsStorage* out, u64 dataId, NcmStorageId storag
|
||||
Result fsOpenDeviceOperator(FsDeviceOperator* out);
|
||||
Result fsOpenSdCardDetectionEventNotifier(FsEventNotifier* out);
|
||||
|
||||
Result fsIsSignedSystemPartitionOnSdCardValid(bool *out);
|
||||
|
||||
/// Retrieves the rights id corresponding to the content path. Only available on [2.0.0+].
|
||||
Result fsGetRightsIdByPath(const char* path, FsRightsId* out_rights_id);
|
||||
|
||||
|
@ -8,6 +8,13 @@
|
||||
#include "../types.h"
|
||||
#include "../sf/service.h"
|
||||
|
||||
typedef enum {
|
||||
LblBacklightSwitchStatus_Disabled = 0,
|
||||
LblBacklightSwitchStatus_Enabled = 1,
|
||||
LblBacklightSwitchStatus_Enabling = 2,
|
||||
LblBacklightSwitchStatus_Disabling = 3,
|
||||
} LblBacklightSwitchStatus;
|
||||
|
||||
/// Initialize lbl.
|
||||
Result lblInitialize(void);
|
||||
|
||||
@ -17,8 +24,8 @@ void lblExit(void);
|
||||
/// Gets the Service object for the actual lbl service session.
|
||||
Service* lblGetServiceSession(void);
|
||||
|
||||
Result lblSwitchBacklightOn(u64 fade_time);
|
||||
Result lblSwitchBacklightOff(u64 fade_time);
|
||||
Result lblSaveCurrentSetting(void);
|
||||
Result lblLoadCurrentSetting(void);
|
||||
|
||||
/**
|
||||
* @note The brightness goes from 0 to 1.0.
|
||||
@ -26,6 +33,58 @@ Result lblSwitchBacklightOff(u64 fade_time);
|
||||
Result lblSetCurrentBrightnessSetting(float brightness);
|
||||
Result lblGetCurrentBrightnessSetting(float *out_value);
|
||||
|
||||
Result lblApplyCurrentBrightnessSettingToBacklight(void);
|
||||
Result lblGetBrightnessSettingAppliedToBacklight(float *out_value);
|
||||
|
||||
Result lblSwitchBacklightOn(u64 fade_time);
|
||||
Result lblSwitchBacklightOff(u64 fade_time);
|
||||
Result lblGetBacklightSwitchStatus(LblBacklightSwitchStatus *out_value);
|
||||
|
||||
Result lblEnableDimming(void);
|
||||
Result lblDisableDimming(void);
|
||||
Result lblIsDimmingEnabled(bool *out_value);
|
||||
|
||||
Result lblEnableAutoBrightnessControl(void);
|
||||
Result lblDisableAutoBrightnessControl(void);
|
||||
Result lblIsAutoBrightnessControlEnabled(bool *out_value);
|
||||
|
||||
Result lblSetAmbientLightSensorValue(float value);
|
||||
|
||||
/**
|
||||
* @note Used internally by \ref appletGetAmbientLightSensorValue and \ref appletGetCurrentIlluminanceEx.
|
||||
*/
|
||||
Result lblGetAmbientLightSensorValue(bool *over_limit, float *lux);
|
||||
|
||||
/**
|
||||
* @note Only available on [3.0.0+].
|
||||
* @note Used internally by \ref appletIsIlluminanceAvailable.
|
||||
*/
|
||||
Result lblIsAmbientLightSensorAvailable(bool *out_value);
|
||||
|
||||
/**
|
||||
* @note Only available on [3.0.0+].
|
||||
*/
|
||||
Result lblSetCurrentBrightnessSettingForVrMode(float brightness);
|
||||
|
||||
/**
|
||||
* @note Only available on [3.0.0+].
|
||||
*/
|
||||
Result lblGetCurrentBrightnessSettingForVrMode(float *out_value);
|
||||
|
||||
/**
|
||||
* @note Only available on [3.0.0+].
|
||||
* @note Used internally by \ref appletSetVrModeEnabled.
|
||||
*/
|
||||
Result lblEnableVrMode(void);
|
||||
|
||||
/**
|
||||
* @note Only available on [3.0.0+].
|
||||
* @note Used internally by \ref appletSetVrModeEnabled.
|
||||
*/
|
||||
Result lblDisableVrMode(void);
|
||||
|
||||
/**
|
||||
* @note Only available on [3.0.0+].
|
||||
* @note Used internally by \ref appletIsVrModeEnabled.
|
||||
*/
|
||||
Result lblIsVrModeEnabled(bool *out_value);
|
||||
|
@ -74,6 +74,11 @@ typedef struct {
|
||||
u8 icon[0x20000]; ///< JPEG
|
||||
} NsApplicationControlData;
|
||||
|
||||
/// ApplicationOccupiedSize
|
||||
typedef struct {
|
||||
u8 unk_x0[0x80]; ///< Unknown.
|
||||
} NsApplicationOccupiedSize;
|
||||
|
||||
/// NsApplicationContentMetaStatus
|
||||
typedef struct {
|
||||
u8 meta_type; ///< \ref NcmContentMetaType
|
||||
@ -216,6 +221,11 @@ typedef struct {
|
||||
u8 unk_x1a[0x6]; ///< Unknown.
|
||||
} NsApplicationRightsOnClient;
|
||||
|
||||
/// DownloadTaskStatus
|
||||
typedef struct {
|
||||
u8 unk_x0[0x20]; ///< Unknown.
|
||||
} NsDownloadTaskStatus;
|
||||
|
||||
/// Default size for \ref nssuControlSetupCardUpdate / \ref nssuControlSetupCardUpdateViaSystemUpdater. This is the size used by qlaunch for SetupCardUpdate.
|
||||
#define NSSU_CARDUPDATE_TMEM_SIZE_DEFAULT 0x100000
|
||||
|
||||
@ -231,9 +241,148 @@ void nsExit(void);
|
||||
/// Gets the Service object for the actual ns:* service session. Only initialized on [3.0.0+], on pre-3.0.0 see \ref nsGetServiceSession_ApplicationManagerInterface.
|
||||
Service* nsGetServiceSession_GetterInterface(void);
|
||||
|
||||
/// Gets the Service object for IApplicationManagerInterface.
|
||||
/// Gets the Service object for IApplicationManagerInterface. Only initialized on pre-3.0.0, on [3.0.0+] use \ref nsGetApplicationManagerInterface.
|
||||
Service* nsGetServiceSession_ApplicationManagerInterface(void);
|
||||
|
||||
/// Gets the Service object for IDynamicRightsInterface via the cmd for that.
|
||||
/// Only available on [6.0.0+].
|
||||
Result nsGetDynamicRightsInterface(Service* srv_out);
|
||||
|
||||
/// Gets the Service object for IReadOnlyApplicationControlDataInterface via the cmd for that.
|
||||
/// Only available on [5.1.0+].
|
||||
Result nsGetReadOnlyApplicationControlDataInterface(Service* srv_out);
|
||||
|
||||
/// Gets the Service object for IReadOnlyApplicationRecordInterface via the cmd for that.
|
||||
/// Only available on [5.0.0+].
|
||||
Result nsGetReadOnlyApplicationRecordInterface(Service* srv_out);
|
||||
|
||||
/// Gets the Service object for IECommerceInterface via the cmd for that.
|
||||
/// Only available on [4.0.0+].
|
||||
Result nsGetECommerceInterface(Service* srv_out);
|
||||
|
||||
/// Gets the Service object for IApplicationVersionInterface via the cmd for that.
|
||||
/// Only available on [4.0.0+].
|
||||
Result nsGetApplicationVersionInterface(Service* srv_out);
|
||||
|
||||
/// Gets the Service object for IFactoryResetInterface via the cmd for that.
|
||||
/// Only available on [3.0.0+].
|
||||
Result nsGetFactoryResetInterface(Service* srv_out);
|
||||
|
||||
/// Gets the Service object for IAccountProxyInterface via the cmd for that.
|
||||
/// Only available on [3.0.0+].
|
||||
Result nsGetAccountProxyInterface(Service* srv_out);
|
||||
|
||||
/// Gets the Service object for IApplicationManagerInterface via the cmd for that.
|
||||
/// Only available on [3.0.0+], on prior sysvers use \ref nsGetServiceSession_ApplicationManagerInterface.
|
||||
Result nsGetApplicationManagerInterface(Service* srv_out);
|
||||
|
||||
/// Gets the Service object for IDownloadTaskInterface via the cmd for that.
|
||||
/// Only available on [3.0.0+].
|
||||
Result nsGetDownloadTaskInterface(Service* srv_out);
|
||||
|
||||
/// Gets the Service object for IContentManagementInterface via the cmd for that.
|
||||
/// Only available on [3.0.0+].
|
||||
Result nsGetContentManagementInterface(Service* srv_out);
|
||||
|
||||
/// Gets the Service object for IDocumentInterface via the cmd for that.
|
||||
/// Only available on [3.0.0+].
|
||||
Result nsGetDocumentInterface(Service* srv_out);
|
||||
|
||||
///@}
|
||||
|
||||
///@name IReadOnlyApplicationControlDataInterface
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief Gets the \ref NsApplicationControlData for the specified application.
|
||||
* @note Uses \ref nsGetReadOnlyApplicationControlDataInterface on [5.1.0+], otherwise IApplicationManagerInterface is used.
|
||||
* @param[in] source Source, official sw uses ::NsApplicationControlSource_Storage.
|
||||
* @param[in] application_id ApplicationId.
|
||||
* @param[out] buffer \ref NsApplicationControlData
|
||||
* @param[in] size Size of the buffer.
|
||||
* @param[out] actual_size Actual output size.
|
||||
*/
|
||||
Result nsGetApplicationControlData(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u64* actual_size);
|
||||
|
||||
/**
|
||||
* @brief GetApplicationDesiredLanguage. Selects a \ref NacpLanguageEntry to use from the specified \ref NacpStruct.
|
||||
* @note Uses \ref nsGetReadOnlyApplicationControlDataInterface on [5.1.0+], otherwise IApplicationManagerInterface is used.
|
||||
* @param[in] nacp \ref NacpStruct
|
||||
* @param[out] langentry \ref NacpLanguageEntry
|
||||
*/
|
||||
Result nsGetApplicationDesiredLanguage(NacpStruct *nacp, NacpLanguageEntry **langentry);
|
||||
|
||||
///@}
|
||||
|
||||
///@name IECommerceInterface
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief RequestLinkDevice
|
||||
* @note \ref nifmInitialize must be used prior to this. Before using the cmd, this calls \ref nifmIsAnyInternetRequestAccepted with the output from \ref nifmGetClientId, an error is returned when that returns false.
|
||||
* @note Only available on [4.0.0+].
|
||||
* @param[out] a \ref AsyncResult
|
||||
* @param[in] uid \ref AccountUid
|
||||
*/
|
||||
Result nsRequestLinkDevice(AsyncResult *a, AccountUid uid);
|
||||
|
||||
/**
|
||||
* @brief RequestSyncRights
|
||||
* @note Only available on [6.0.0+].
|
||||
* @param[out] a \ref AsyncResult
|
||||
*/
|
||||
Result nsRequestSyncRights(AsyncResult *a);
|
||||
|
||||
/**
|
||||
* @brief RequestUnlinkDevice
|
||||
* @note \ref nifmInitialize must be used prior to this. Before using the cmd, this calls \ref nifmIsAnyInternetRequestAccepted with the output from \ref nifmGetClientId, an error is returned when that returns false.
|
||||
* @note Only available on [6.0.0+].
|
||||
* @param[out] a \ref AsyncResult
|
||||
* @param[in] uid \ref AccountUid
|
||||
*/
|
||||
Result nsRequestUnlinkDevice(AsyncResult *a, AccountUid uid);
|
||||
|
||||
///@}
|
||||
|
||||
///@name IFactoryResetInterface
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief ResetToFactorySettings
|
||||
* @note Uses \ref nsGetFactoryResetInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
|
||||
*/
|
||||
Result nsResetToFactorySettings(void);
|
||||
|
||||
/**
|
||||
* @brief ResetToFactorySettingsWithoutUserSaveData
|
||||
* @note Uses \ref nsGetFactoryResetInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
|
||||
*/
|
||||
Result nsResetToFactorySettingsWithoutUserSaveData(void);
|
||||
|
||||
/**
|
||||
* @brief ResetToFactorySettingsForRefurbishment
|
||||
* @note Uses \ref nsGetFactoryResetInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
|
||||
* @note Only available on [2.0.0+].
|
||||
*/
|
||||
Result nsResetToFactorySettingsForRefurbishment(void);
|
||||
|
||||
/**
|
||||
* @brief ResetToFactorySettingsWithPlatformRegion
|
||||
* @note Only available on [9.1.0+].
|
||||
*/
|
||||
Result nsResetToFactorySettingsWithPlatformRegion(void);
|
||||
|
||||
/**
|
||||
* @brief ResetToFactorySettingsWithPlatformRegionAuthentication
|
||||
* @note Only available on [9.1.0+].
|
||||
*/
|
||||
Result nsResetToFactorySettingsWithPlatformRegionAuthentication(void);
|
||||
|
||||
///@}
|
||||
|
||||
///@name IApplicationManagerInterface
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief Gets an listing of \ref NsApplicationRecord.
|
||||
* @param[out] records Output array of \ref NsApplicationRecord.
|
||||
@ -337,20 +486,6 @@ Result nsCleanupSdCard(void);
|
||||
*/
|
||||
Result nsGetSdCardMountStatusChangedEvent(Event* out_event);
|
||||
|
||||
/**
|
||||
* @brief Returns the total storage capacity (used + free) from content manager services.
|
||||
* @param[in] storage_id \ref NcmStorageId. Must be ::NcmStorageId_SdCard.
|
||||
* @param[out] size Pointer to output the total storage size to.
|
||||
*/
|
||||
Result nsGetTotalSpaceSize(NcmStorageId storage_id, s64 *size);
|
||||
|
||||
/**
|
||||
* @brief Returns the available storage capacity from content manager services.
|
||||
* @param[in] storage_id \ref NcmStorageId. Must be ::NcmStorageId_SdCard.
|
||||
* @param[out] size Pointer to output the free storage size to.
|
||||
*/
|
||||
Result nsGetFreeSpaceSize(NcmStorageId storage_id, s64 *size);
|
||||
|
||||
/**
|
||||
* @brief GetGameCardUpdateDetectionEvent
|
||||
* @note The Event must be closed by the user once finished with it.
|
||||
@ -477,16 +612,6 @@ Result nsUnregisterNetworkServiceAccount(AccountUid uid);
|
||||
*/
|
||||
Result nsUnregisterNetworkServiceAccountWithUserSaveDataDeletion(AccountUid uid);
|
||||
|
||||
/**
|
||||
* @brief Gets the \ref NsApplicationControlData for the specified application.
|
||||
* @param[in] source Source, official sw uses ::NsApplicationControlSource_Storage.
|
||||
* @param[in] application_id ApplicationId.
|
||||
* @param[out] buffer \ref NsApplicationControlData
|
||||
* @param[in] size Size of the buffer.
|
||||
* @param[out] actual_size Actual output size.
|
||||
*/
|
||||
Result nsGetApplicationControlData(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u64* actual_size);
|
||||
|
||||
/**
|
||||
* @brief RequestDownloadApplicationControlData
|
||||
* @note \ref nifmInitialize must be used prior to this. Before using the cmd, this calls \ref nifmIsAnyInternetRequestAccepted with the output from \ref nifmGetClientId, an error is returned when that returns false.
|
||||
@ -587,17 +712,6 @@ Result nsGetLastGameCardMountFailureResult(void);
|
||||
*/
|
||||
Result nsListApplicationIdOnGameCard(u64 *application_ids, s32 count, s32 *total_out);
|
||||
|
||||
/**
|
||||
* @brief Gets an listing of \ref NsApplicationContentMetaStatus.
|
||||
* @note Only available on [2.0.0+].
|
||||
* @param[in] application_id ApplicationId.
|
||||
* @param[in] index Starting entry index.
|
||||
* @param[out] list Output array of \ref NsApplicationContentMetaStatus.
|
||||
* @param[in] count Size of the list array in entries.
|
||||
* @param[out] out_entrycount Total output entries.
|
||||
*/
|
||||
Result nsListApplicationContentMetaStatus(u64 application_id, s32 index, NsApplicationContentMetaStatus* list, s32 count, s32* out_entrycount);
|
||||
|
||||
/**
|
||||
* @brief TouchApplication
|
||||
* @note Only available on [2.0.0+].
|
||||
@ -938,6 +1052,138 @@ Result nsGetPromotionInfo(NsPromotionInfo *promotion, u64 application_id, Accoun
|
||||
|
||||
///@}
|
||||
|
||||
///@name IDownloadTaskInterface
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief ClearTaskStatusList
|
||||
* @note Uses \ref nsGetDownloadTaskInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
|
||||
* @note Only available on [2.0.0+].
|
||||
*/
|
||||
Result nsClearTaskStatusList(void);
|
||||
|
||||
/**
|
||||
* @brief RequestDownloadTaskList
|
||||
* @note Uses \ref nsGetDownloadTaskInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
|
||||
* @note Only available on [2.0.0+].
|
||||
*/
|
||||
Result nsRequestDownloadTaskList(void);
|
||||
|
||||
/**
|
||||
* @brief RequestEnsureDownloadTask
|
||||
* @note Uses \ref nsGetDownloadTaskInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
|
||||
* @note Only available on [2.0.0+].
|
||||
* @param[out] a \ref AsyncResult
|
||||
*/
|
||||
Result nsRequestEnsureDownloadTask(AsyncResult *a);
|
||||
|
||||
/**
|
||||
* @brief ListDownloadTaskStatus
|
||||
* @note Uses \ref nsGetDownloadTaskInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
|
||||
* @note Only available on [2.0.0+].
|
||||
* @param[out] tasks Output array of \ref NsDownloadTaskStatus.
|
||||
* @param[in] count Size of the tasks array in entries. A maximum of 0x100 tasks can be stored in state.
|
||||
* @param[out] total_out Total output entries.
|
||||
*/
|
||||
Result nsListDownloadTaskStatus(NsDownloadTaskStatus* tasks, s32 count, s32 *total_out);
|
||||
|
||||
/**
|
||||
* @brief RequestDownloadTaskListData
|
||||
* @note Uses \ref nsGetDownloadTaskInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
|
||||
* @note Only available on [2.0.0+].
|
||||
* @param[out] a \ref AsyncValue
|
||||
*/
|
||||
Result nsRequestDownloadTaskListData(AsyncValue *a);
|
||||
|
||||
/**
|
||||
* @brief TryCommitCurrentApplicationDownloadTask
|
||||
* @note Only available on [4.0.0+].
|
||||
*/
|
||||
Result nsTryCommitCurrentApplicationDownloadTask(void);
|
||||
|
||||
/**
|
||||
* @brief EnableAutoCommit
|
||||
* @note Only available on [4.0.0+].
|
||||
*/
|
||||
Result nsEnableAutoCommit(void);
|
||||
|
||||
/**
|
||||
* @brief DisableAutoCommit
|
||||
* @note Only available on [4.0.0+].
|
||||
*/
|
||||
Result nsDisableAutoCommit(void);
|
||||
|
||||
/**
|
||||
* @brief TriggerDynamicCommitEvent
|
||||
* @note Only available on [4.0.0+].
|
||||
*/
|
||||
Result nsTriggerDynamicCommitEvent(void);
|
||||
|
||||
///@}
|
||||
|
||||
///@name IContentManagementInterface
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief CalculateApplicationOccupiedSize
|
||||
* @note Uses \ref nsGetContentManagementInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
|
||||
* @param[in] application_id ApplicationId.
|
||||
* @param[out] out \ref NsApplicationOccupiedSize
|
||||
*/
|
||||
Result nsCalculateApplicationOccupiedSize(u64 application_id, NsApplicationOccupiedSize *out);
|
||||
|
||||
/**
|
||||
* @brief CheckSdCardMountStatus
|
||||
* @note Uses \ref nsGetContentManagementInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
|
||||
*/
|
||||
Result nsCheckSdCardMountStatus(void);
|
||||
|
||||
/**
|
||||
* @brief Returns the total storage capacity (used + free) from content manager services.
|
||||
* @note Uses \ref nsGetContentManagementInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
|
||||
* @param[in] storage_id \ref NcmStorageId. Must be ::NcmStorageId_SdCard.
|
||||
* @param[out] size Pointer to output the total storage size to.
|
||||
*/
|
||||
Result nsGetTotalSpaceSize(NcmStorageId storage_id, s64 *size);
|
||||
|
||||
/**
|
||||
* @brief Returns the available storage capacity from content manager services.
|
||||
* @note Uses \ref nsGetContentManagementInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
|
||||
* @param[in] storage_id \ref NcmStorageId. Must be ::NcmStorageId_SdCard.
|
||||
* @param[out] size Pointer to output the free storage size to.
|
||||
*/
|
||||
Result nsGetFreeSpaceSize(NcmStorageId storage_id, s64 *size);
|
||||
|
||||
/**
|
||||
* @brief CountApplicationContentMeta
|
||||
* @note Uses \ref nsGetContentManagementInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
|
||||
* @note Only available on [2.0.0+].
|
||||
* @param[in] application_id ApplicationId.
|
||||
* @param[out] out Output count.
|
||||
*/
|
||||
Result nsCountApplicationContentMeta(u64 application_id, s32 *out);
|
||||
|
||||
/**
|
||||
* @brief Gets an listing of \ref NsApplicationContentMetaStatus.
|
||||
* @note Uses \ref nsGetContentManagementInterface on [3.0.0+], otherwise IApplicationManagerInterface is used.
|
||||
* @note Only available on [2.0.0+].
|
||||
* @param[in] application_id ApplicationId.
|
||||
* @param[in] index Starting entry index.
|
||||
* @param[out] list Output array of \ref NsApplicationContentMetaStatus.
|
||||
* @param[in] count Size of the list array in entries.
|
||||
* @param[out] out_entrycount Total output entries.
|
||||
*/
|
||||
Result nsListApplicationContentMetaStatus(u64 application_id, s32 index, NsApplicationContentMetaStatus* list, s32 count, s32* out_entrycount);
|
||||
|
||||
/**
|
||||
* @brief IsAnyApplicationRunning
|
||||
* @note Only available on [3.0.0+].
|
||||
* @param[out] out Output flag.
|
||||
*/
|
||||
Result nsIsAnyApplicationRunning(bool *out);
|
||||
|
||||
///@}
|
||||
|
||||
///@name IRequestServerStopper
|
||||
///@{
|
||||
|
||||
|
26
nx/include/switch/services/tc.h
Normal file
26
nx/include/switch/services/tc.h
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @file tc.h
|
||||
* @brief Temperature control (tc) service IPC wrapper.
|
||||
* @author Behemoth
|
||||
* @copyright libnx Authors
|
||||
*/
|
||||
#pragma once
|
||||
#include "../types.h"
|
||||
#include "../sf/service.h"
|
||||
|
||||
/// Initialize tc.
|
||||
Result tcInitialize(void);
|
||||
|
||||
/// Exit tc.
|
||||
void tcExit(void);
|
||||
|
||||
/// Gets the Service for tc.
|
||||
Service* tcGetServiceSession(void);
|
||||
|
||||
Result tcEnableFanControl(void);
|
||||
/// @warning Disabling your fan can damage your system.
|
||||
Result tcDisableFanControl(void);
|
||||
Result tcIsFanControlEnabled(bool *status);
|
||||
/// Only available on [5.0.0+].
|
||||
Result tcGetSkinTemperatureMilliC(s32 *skinTemp);
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
/// Location
|
||||
typedef enum {
|
||||
TsLocation_Internal = 0, ///< Internal
|
||||
TsLocation_External = 1, ///< External
|
||||
TsLocation_Internal = 0, ///< TMP451 Internal: PCB
|
||||
TsLocation_External = 1, ///< TMP451 External: SoC
|
||||
} TsLocation;
|
||||
|
||||
/// Initialize ts.
|
||||
|
@ -324,13 +324,8 @@ Result nwindowReleaseBuffers(NWindow* nw)
|
||||
|
||||
if (nw->cur_slot >= 0)
|
||||
rc = MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
else if (nw->is_connected && nw->slots_configured) {
|
||||
for (u32 i = 0; i < 64; i ++)
|
||||
if (nw->slots_configured & (1UL << i))
|
||||
bqDetachBuffer(&nw->bq, i);
|
||||
|
||||
else if (nw->is_connected && nw->slots_configured)
|
||||
rc = _nwindowDisconnect(nw);
|
||||
}
|
||||
|
||||
mutexUnlock(&nw->mutex);
|
||||
return rc;
|
||||
|
@ -39,6 +39,10 @@ static Result _apmCmdGetSession(Service* srv, Service* srv_out, u32 cmd_id) {
|
||||
);
|
||||
}
|
||||
|
||||
Result apmGetPerformanceMode(ApmPerformanceMode* out_performanceMode) {
|
||||
return serviceDispatchOut(&g_apmSrv, 1, *out_performanceMode);
|
||||
}
|
||||
|
||||
Result apmSetPerformanceConfiguration(ApmPerformanceMode PerformanceMode, u32 PerformanceConfiguration) {
|
||||
const struct {
|
||||
u32 PerformanceMode;
|
||||
|
@ -541,6 +541,8 @@ Result appletSetFocusHandlingMode(AppletFocusHandlingMode mode) {
|
||||
Result rc;
|
||||
bool invals[4];
|
||||
|
||||
if (__nx_applet_type != AppletType_Application)
|
||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||
if (mode >= AppletFocusHandlingMode_Max)
|
||||
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||
|
||||
|
39
nx/source/services/fan.c
Normal file
39
nx/source/services/fan.c
Normal file
@ -0,0 +1,39 @@
|
||||
#define NX_SERVICE_ASSUME_NON_DOMAIN
|
||||
#include "service_guard.h"
|
||||
#include "services/fan.h"
|
||||
#include "runtime/hosversion.h"
|
||||
|
||||
static Service g_fanSrv;
|
||||
|
||||
NX_GENERATE_SERVICE_GUARD(fan);
|
||||
|
||||
Result _fanInitialize(void) {
|
||||
return smGetService(&g_fanSrv, "fan");
|
||||
}
|
||||
|
||||
void _fanCleanup(void) {
|
||||
serviceClose(&g_fanSrv);
|
||||
}
|
||||
|
||||
Result fanOpenController(FanController *out, u32 device_code) {
|
||||
return serviceDispatchIn(&g_fanSrv, 0, device_code,
|
||||
.out_num_objects = 1,
|
||||
.out_objects = &out->s,
|
||||
);
|
||||
}
|
||||
|
||||
Service* fanGetServiceSession(void) {
|
||||
return &g_fanSrv;
|
||||
}
|
||||
|
||||
void fanControllerClose(FanController *controller) {
|
||||
serviceClose(&controller->s);
|
||||
}
|
||||
|
||||
Result fanControllerSetRotationSpeedLevel(FanController *controller, float level) {
|
||||
return serviceDispatchIn(&controller->s, 0, level);
|
||||
}
|
||||
|
||||
Result fanControllerGetRotationSpeedLevel(FanController *controller, float *level) {
|
||||
return serviceDispatchOut(&controller->s, 2, *level);
|
||||
}
|
@ -402,6 +402,13 @@ Result fsOpenSdCardDetectionEventNotifier(FsEventNotifier* out) {
|
||||
return _fsCmdGetSession(&g_fsSrv, &out->s, 500);
|
||||
}
|
||||
|
||||
Result fsIsSignedSystemPartitionOnSdCardValid(bool *out) {
|
||||
if (!hosversionBetween(4, 8))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _fsCmdNoInOutBool(&g_fsSrv, out, 640);
|
||||
}
|
||||
|
||||
Result fsGetRightsIdByPath(const char* path, FsRightsId* out_rights_id) {
|
||||
if (hosversionBefore(2,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
@ -622,9 +629,6 @@ Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *
|
||||
if (hosversionBefore(4,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
char send_path[FS_MAX_PATH] = {0};
|
||||
strncpy(send_path, path, sizeof(send_path)-1);
|
||||
|
||||
return _fsObjectDispatchIn(&fs->s, 15, query_id,
|
||||
.buffer_attrs = {
|
||||
SfBufferAttr_HipcPointer | SfBufferAttr_In,
|
||||
@ -632,9 +636,9 @@ Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *
|
||||
SfBufferAttr_HipcMapAlias | SfBufferAttr_Out | SfBufferAttr_HipcMapTransferAllowsNonSecure,
|
||||
},
|
||||
.buffers = {
|
||||
{ send_path, sizeof(send_path) },
|
||||
{ in, in_size },
|
||||
{ out, out_size },
|
||||
{ path, FS_MAX_PATH },
|
||||
{ in, in_size },
|
||||
{ out, out_size },
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -648,7 +652,8 @@ Result fsFsIsValidSignedSystemPartitionOnSdCard(FsFileSystem* fs, bool *out) {
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
u8 tmp=0;
|
||||
Result rc = fsFsQueryEntry(fs, &tmp, sizeof(tmp), NULL, 0, "/", FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard);
|
||||
char send_path[FS_MAX_PATH] = "/";
|
||||
Result rc = fsFsQueryEntry(fs, &tmp, sizeof(tmp), NULL, 0, send_path, FsFileSystemQueryId_IsValidSignedSystemPartitionOnSdCard);
|
||||
if (R_SUCCEEDED(rc) && out) *out = tmp & 1;
|
||||
return rc;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#define NX_SERVICE_ASSUME_NON_DOMAIN
|
||||
#include "service_guard.h"
|
||||
#include "services/lbl.h"
|
||||
#include "runtime/hosversion.h"
|
||||
|
||||
static Service g_lblSrv;
|
||||
|
||||
@ -37,6 +38,38 @@ static Result _lblCmdNoInOutBool(bool *out, u32 cmd_id) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Result _lblCmdNoInOutFloat(float *out, u32 cmd_id) {
|
||||
return serviceDispatchOut(&g_lblSrv, cmd_id, *out);
|
||||
}
|
||||
|
||||
static Result _lblCmdInFloatNoOut(float in, u32 cmd_id) {
|
||||
return serviceDispatchIn(&g_lblSrv, cmd_id, in);
|
||||
}
|
||||
|
||||
Result lblSaveCurrentSetting(void) {
|
||||
return _lblCmdNoIO(0);
|
||||
}
|
||||
|
||||
Result lblLoadCurrentSetting(void) {
|
||||
return _lblCmdNoIO(1);
|
||||
}
|
||||
|
||||
Result lblSetCurrentBrightnessSetting(float brightness) {
|
||||
return _lblCmdInFloatNoOut(brightness, 2);
|
||||
}
|
||||
|
||||
Result lblGetCurrentBrightnessSetting(float *out_value) {
|
||||
return _lblCmdNoInOutFloat(out_value, 3);
|
||||
}
|
||||
|
||||
Result lblApplyCurrentBrightnessSettingToBacklight(void) {
|
||||
return _lblCmdNoIO(4);
|
||||
}
|
||||
|
||||
Result lblGetBrightnessSettingAppliedToBacklight(float *out_value) {
|
||||
return _lblCmdNoInOutFloat(out_value, 5);
|
||||
}
|
||||
|
||||
Result lblSwitchBacklightOn(u64 fade_time) {
|
||||
return _lblCmdInU64NoOut(fade_time, 6);
|
||||
}
|
||||
@ -45,12 +78,20 @@ Result lblSwitchBacklightOff(u64 fade_time) {
|
||||
return _lblCmdInU64NoOut(fade_time, 7);
|
||||
}
|
||||
|
||||
Result lblSetCurrentBrightnessSetting(float brightness) {
|
||||
return serviceDispatchIn(&g_lblSrv, 2, brightness);
|
||||
Result lblGetBacklightSwitchStatus(LblBacklightSwitchStatus *out_value) {
|
||||
return serviceDispatchOut(&g_lblSrv, 8, *out_value);
|
||||
}
|
||||
|
||||
Result lblGetCurrentBrightnessSetting(float *out_value) {
|
||||
return serviceDispatchOut(&g_lblSrv, 3, *out_value);
|
||||
Result lblEnableDimming(void) {
|
||||
return _lblCmdNoIO(9);
|
||||
}
|
||||
|
||||
Result lblDisableDimming(void) {
|
||||
return _lblCmdNoIO(10);
|
||||
}
|
||||
|
||||
Result lblIsDimmingEnabled(bool *out_value) {
|
||||
return _lblCmdNoInOutBool(out_value, 11);
|
||||
}
|
||||
|
||||
Result lblEnableAutoBrightnessControl(void) {
|
||||
@ -64,3 +105,55 @@ Result lblDisableAutoBrightnessControl(void) {
|
||||
Result lblIsAutoBrightnessControlEnabled(bool *out_value){
|
||||
return _lblCmdNoInOutBool(out_value, 14);
|
||||
}
|
||||
|
||||
Result lblSetAmbientLightSensorValue(float value) {
|
||||
return _lblCmdInFloatNoOut(value, 15);
|
||||
}
|
||||
|
||||
Result lblGetAmbientLightSensorValue(bool *over_limit, float *lux) {
|
||||
struct {
|
||||
u32 over_limit;
|
||||
float lux;
|
||||
} out;
|
||||
|
||||
Result rc = serviceDispatchOut(&g_lblSrv, 16, out);
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
if (over_limit) *over_limit = out.over_limit & 1;
|
||||
if (lux) *lux = out.lux;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result lblIsAmbientLightSensorAvailable(bool *out_value) {
|
||||
if (hosversionBefore(3,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return _lblCmdNoInOutBool(out_value, 23);
|
||||
}
|
||||
Result lblSetCurrentBrightnessSettingForVrMode(float brightness) {
|
||||
if (hosversionBefore(3,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return _lblCmdInFloatNoOut(brightness, 24);
|
||||
}
|
||||
Result lblGetCurrentBrightnessSettingForVrMode(float *out_value) {
|
||||
if (hosversionBefore(3,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return _lblCmdNoInOutFloat(out_value, 25);
|
||||
}
|
||||
|
||||
Result lblEnableVrMode(void) {
|
||||
if (hosversionBefore(3,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return _lblCmdNoIO(26);
|
||||
}
|
||||
|
||||
Result lblDisableVrMode(void) {
|
||||
if (hosversionBefore(3,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return _lblCmdNoIO(27);
|
||||
}
|
||||
|
||||
Result lblIsVrModeEnabled(bool *out_value) {
|
||||
if (hosversionBefore(3,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
return _lblCmdNoInOutBool(out_value, 28);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,8 +29,6 @@ Result _plInitialize(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (R_FAILED(rc)) plExit();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
47
nx/source/services/tc.c
Normal file
47
nx/source/services/tc.c
Normal file
@ -0,0 +1,47 @@
|
||||
#define NX_SERVICE_ASSUME_NON_DOMAIN
|
||||
#include <string.h>
|
||||
#include "service_guard.h"
|
||||
#include "runtime/hosversion.h"
|
||||
#include "services/tc.h"
|
||||
|
||||
static Service g_tcSrv;
|
||||
|
||||
NX_GENERATE_SERVICE_GUARD(tc);
|
||||
|
||||
Result _tcInitialize(void) {
|
||||
return smGetService(&g_tcSrv, "tc");
|
||||
}
|
||||
|
||||
void _tcCleanup(void) {
|
||||
serviceClose(&g_tcSrv);
|
||||
}
|
||||
|
||||
Service* tcGetServiceSession(void) {
|
||||
return &g_tcSrv;
|
||||
}
|
||||
|
||||
static Result _tcNoInNoOut(u32 cmd_id) {
|
||||
return serviceDispatch(&g_tcSrv, cmd_id);
|
||||
}
|
||||
|
||||
Result tcEnableFanControl(void) {
|
||||
return _tcNoInNoOut(6);
|
||||
}
|
||||
|
||||
Result tcDisableFanControl(void) {
|
||||
return _tcNoInNoOut(7);
|
||||
}
|
||||
|
||||
Result tcIsFanControlEnabled(bool *status) {
|
||||
u8 tmp=0;
|
||||
Result rc = serviceDispatchOut(&g_tcSrv, 8, tmp);
|
||||
if (R_SUCCEEDED(rc) && status) *status = tmp & 1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result tcGetSkinTemperatureMilliC(s32 *skinTemp) {
|
||||
if (hosversionBefore(5,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return serviceDispatchOut(&g_tcSrv, 9, *skinTemp);
|
||||
}
|
Loading…
Reference in New Issue
Block a user