1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-25 02:52:05 +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: jobs:
AIO-switch-updater: AIO-switch-updater:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: hamletdufromage/devkita64_devkitarm #container: hamletdufromage/devkita64_devkitarm
container: devkitpro/devkita64_devkitarm
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
#- name: update libnx
#run: |
#dkp-pacman -Syu --noconfirm
- name: update repo - name: update repo
run: | run: |
git submodule update --init --recursive git submodule update --init --recursive
- name: Building aio-switch-updater - name: Building aio-switch-updater
run: | run: |
cd aiosu-forwarder make -C aiosu-forwarder -f Makefile
make
cd ..
make -j$(nproc) make -j$(nproc)
- uses: actions/upload-artifact@master - 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 INCLUDES := include lib/zipper/include /lib/borealis/library/include/borealis/extern/nlohmann
APP_TITLE := All-in-One Switch Updater APP_TITLE := All-in-One Switch Updater
APP_AUTHOR := HamletDuFromage APP_AUTHOR := HamletDuFromage
APP_VERSION := 2.4.3 APP_VERSION := 2.4.4
TARGET := $(notdir $(CURDIR)) TARGET := $(notdir $(CURDIR))
ROMFS := resources ROMFS := resources

View file

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