1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-08 11:31:43 +00:00

refactored title id listing code

This commit is contained in:
flb 2021-03-27 01:33:20 +01:00
parent 743109c7b3
commit c755d19f58
3 changed files with 22 additions and 39 deletions

View file

@ -7,22 +7,18 @@ on:
jobs:
AIO-switch-updater:
runs-on: ubuntu-latest
container: hamletdufromage/devkita64_devkitarm
#container: hamletdufromage/devkita64_devkitarm
container: devkitpro/devkita64_devkitarm
steps:
- uses: actions/checkout@v1
#- name: update libnx
#run: |
#dkp-pacman -Syu --noconfirm
- name: update repo
run: |
git submodule update --init --recursive
- name: Building aio-switch-updater
run: |
cd aiosu-forwarder
make
cd ..
make -C aiosu-forwarder -f Makefile
make -j$(nproc)
- uses: actions/upload-artifact@master

View file

@ -22,7 +22,7 @@ DATA := data
INCLUDES := include lib/zipper/include /lib/borealis/library/include/borealis/extern/nlohmann
APP_TITLE := All-in-One Switch Updater
APP_AUTHOR := HamletDuFromage
APP_VERSION := 2.4.3
APP_VERSION := 2.4.4
TARGET := $(notdir $(CURDIR))
ROMFS := resources

View file

@ -111,45 +111,32 @@ void extract(const char * filename, const char* workingPath, const char* toExclu
}
std::vector<std::string> getInstalledTitlesNs(){
Result rc = 0;
std::vector<std::string> titles;
NsApplicationRecord *recs = new NsApplicationRecord[MaxTitleCount]();
NsApplicationControlData *buf=NULL;
u64 outsize = 0;
NacpLanguageEntry *langentry = NULL;
s32 total = 0;
rc = nsListApplicationRecord(recs, MaxTitleCount, 0, &total);
if (R_SUCCEEDED(rc)){
for (s32 i = 0; i < total; i++){
outsize = 0;
buf = (NsApplicationControlData*)malloc(sizeof(NsApplicationControlData));
if (buf == NULL) {
rc = MAKERESULT(Module_Libnx, LibnxError_OutOfMemory);
} else {
memset(buf, 0, sizeof(NsApplicationControlData));
}
NsApplicationRecord *records = new NsApplicationRecord[MaxTitleCount]();
NsApplicationControlData *controlData = NULL;
NacpLanguageEntry* langEntry = NULL;
if (R_SUCCEEDED(rc)) {
if (R_FAILED(rc))
printf("nsInitialize() failed: 0x%x\n", rc);
}
s32 recordCount = 0;
u64 controlSize = 0;
rc = nsGetApplicationControlData(NsApplicationControlSource_Storage, recs[i].application_id, buf, sizeof(NsApplicationControlData), &outsize);
if (R_SUCCEEDED(nsListApplicationRecord(records, MaxTitleCount, 0, &recordCount))){
for (s32 i = 0; i < recordCount; i++){
controlSize = 0;
controlData = (NsApplicationControlData*)malloc(sizeof(NsApplicationControlData));
if(controlData != NULL)
memset(controlData, 0, sizeof(NsApplicationControlData));
if (outsize < sizeof(buf->nacp))
rc = -1;
if(R_FAILED(nsGetApplicationControlData(NsApplicationControlSource_Storage, records[i].application_id, controlData, sizeof(NsApplicationControlData), &controlSize))) continue;
if (R_SUCCEEDED(rc))
rc = nacpGetLanguageEntry(&buf->nacp, &langentry);
if(controlSize < sizeof(controlData->nacp)) continue;
if (R_SUCCEEDED(rc)) {
titles.push_back(util::formatApplicationId(recs[i].application_id));
if(R_FAILED(nacpGetLanguageEntry(&controlData->nacp, &langEntry))) continue;
titles.push_back(util::formatApplicationId(records[i].application_id));
}
}
}
free(buf);
delete[] recs;
delete[] records;
std::sort(titles.begin(), titles.end());
return titles;
}