mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-11-24 18:42:05 +00:00
refactored title id listing code
This commit is contained in:
parent
743109c7b3
commit
c755d19f58
3 changed files with 22 additions and 39 deletions
10
.github/workflows/main.yml
vendored
10
.github/workflows/main.yml
vendored
|
@ -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
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -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
|
||||||
|
|
|
@ -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)) {
|
|
||||||
if (R_FAILED(rc))
|
|
||||||
printf("nsInitialize() failed: 0x%x\n", rc);
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = nsGetApplicationControlData(NsApplicationControlSource_Storage, recs[i].application_id, buf, sizeof(NsApplicationControlData), &outsize);
|
s32 recordCount = 0;
|
||||||
|
u64 controlSize = 0;
|
||||||
|
|
||||||
if (outsize < sizeof(buf->nacp))
|
if (R_SUCCEEDED(nsListApplicationRecord(records, MaxTitleCount, 0, &recordCount))){
|
||||||
rc = -1;
|
for (s32 i = 0; i < recordCount; i++){
|
||||||
|
controlSize = 0;
|
||||||
|
controlData = (NsApplicationControlData*)malloc(sizeof(NsApplicationControlData));
|
||||||
|
if(controlData != NULL)
|
||||||
|
memset(controlData, 0, sizeof(NsApplicationControlData));
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc))
|
if(R_FAILED(nsGetApplicationControlData(NsApplicationControlSource_Storage, records[i].application_id, controlData, sizeof(NsApplicationControlData), &controlSize))) continue;
|
||||||
rc = nacpGetLanguageEntry(&buf->nacp, &langentry);
|
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
if(controlSize < sizeof(controlData->nacp)) continue;
|
||||||
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[] records;
|
||||||
delete[] recs;
|
|
||||||
std::sort(titles.begin(), titles.end());
|
std::sort(titles.begin(), titles.end());
|
||||||
return titles;
|
return titles;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue