Update NacpStruct to match switchbrew wiki#716
Open
masagrator wants to merge 8 commits intoswitchbrew:masterfrom
Open
Update NacpStruct to match switchbrew wiki#716masagrator wants to merge 8 commits intoswitchbrew:masterfrom
masagrator wants to merge 8 commits intoswitchbrew:masterfrom
Conversation
Contributor
|
Contributor
Author
We can solve this by providing externally buffer for decompressing as optional argument. Something like this: Result nsGetApplicationControlData2(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u8 flag1, u8 flag2, u64* actual_size, u32* unk, NacpLanguageEntry* langs, size_t langs_size) {
// Old code here
if (!langs)
return 0;
return nacp_decompress(buffer, langs, langs_size);
}or Result nsGetApplicationControlData2(NsApplicationControlSource source, u64 application_id, NsApplicationControlData* buffer, size_t size, u8 flag1, u8 flag2, u64* actual_size, u32* unk, NacpLanguageEntry* langs, size_t langs_size) {
// Old code here
if (!langs)
return 0;
rc = nacp_decompress(buffer, langs, langs_size);
if (R_FAILED(rc))
return rc;
memcpy(buffer, langs_size, sizeof(NacpLanguageEntry[16]);
return 0;
}Or create new AppControlData struct with new NacpStruct to which we will convert original AppControlData and NacpStruct with NacpLanguageEntry[32], then put on top of it decompressed data. Something like this: /// ApplicationControlDataV21
typedef struct {
NacpStructV21 nacp; ///< \ref NacpStructV21
u8 icon[0x20000]; ///< JPEG
} NsApplicationControlDataV21;
Result nsGetApplicationControlData2V21(NsApplicationControlSource source, u64 application_id, NsApplicationControlDataV21* buffer, size_t size, u8 flag1, u8 flag2, u64* actual_size, u32* unk, void* dec_buffer, size_t dec_buffer_size) {
Result rc = nsGetApplicationControlData2(source, application_id, buffer, flag1, flag2, actual_size, unk);
if (R_FAILED(rc))
return rc;
memmove(&buffer->icon, ((NsApplicationControlData*)buffer)->icon, sizeof(buffer->icon));
// Our custom decompress function, returns false on fail - but noone stops you from implementing proper result handling
if (!nacp_decompress(buffer, dec_buffer, dec_buffer_size)) {
return MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen);
}
return 0;
} |
Contributor
|
I'm comfortable with any of those options. Let's wait and see what others think about this. |
yellows8
reviewed
Feb 21, 2026
yellows8
approved these changes
Feb 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To figure out: