Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions nx/include/switch/services/ns.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,17 @@ Result nsGetDocumentInterface(Service* srv_out);
*/
Result nsGetApplicationControlData(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u64* actual_size);

/**
* @brief Gets the \ref NsApplicationControlData for the specified application.
* @note Only available on [19.0.0+].
* @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 nsGetApplicationControlData2(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.
Expand Down
26 changes: 26 additions & 0 deletions nx/source/services/ns.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,32 @@ Result nsGetApplicationControlData(NsApplicationControlSource source, u64 applic
return rc;
}

Result nsGetApplicationControlData2(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u64* actual_size) {
if (hosversionBefore(19,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
Service srv={0}, *srv_ptr = &srv;
Result rc=0;
u32 cmd_id = 6;
rc = nsGetReadOnlyApplicationControlDataInterface(&srv);

const struct {
u8 source;
u8 pad[7];
Comment thread
masagrator marked this conversation as resolved.
Outdated
u64 application_id;
} in = { source, {0}, application_id };

u64 tmp=0;

if (R_SUCCEEDED(rc)) rc = serviceDispatchInOut(srv_ptr, cmd_id, in, tmp,
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
.buffers = { { buffer, size } },
);
if (R_SUCCEEDED(rc) && actual_size) *actual_size = tmp >> 32;
Comment thread
masagrator marked this conversation as resolved.
Outdated

serviceClose(&srv);
return rc;
}

Result nsGetApplicationDesiredLanguage(NacpStruct *nacp, NacpLanguageEntry **langentry) {
if (nacp==NULL || langentry==NULL)
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
Expand Down