mirror of
https://github.com/switchbrew/switch-examples.git
synced 2025-06-20 21:12:38 +02:00
Update for latest libnx changes
This commit is contained in:
parent
9b44df4132
commit
c1524e86d6
@ -36,7 +36,7 @@ int main(int argc, char **argv)
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
printf("Current userID: 0x%lx 0x%lx\n", userID.uid[1], userID.uid[0]);
|
||||
|
||||
rc = accountGetProfile(&profile, &userID);
|
||||
rc = accountGetProfile(&profile, userID);
|
||||
|
||||
if (R_FAILED(rc)) {
|
||||
printf("accountGetProfile() failed: 0x%x\n", rc);
|
||||
|
@ -72,7 +72,7 @@ int main(int argc, char* argv[])
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
rc = appletQueryApplicationPlayStatistics(stats, titleIDs, sizeof(titleIDs)/sizeof(u64), &total_out);
|
||||
printf("appletQueryApplicationPlayStatistics(): 0x%x\n", rc);
|
||||
//rc = appletQueryApplicationPlayStatisticsByUid(&preselected_uid, stats, titleIDs, sizeof(titleIDs)/sizeof(u64), &total_out);
|
||||
//rc = appletQueryApplicationPlayStatisticsByUid(preselected_uid, stats, titleIDs, sizeof(titleIDs)/sizeof(u64), &total_out);
|
||||
//printf("appletQueryApplicationPlayStatisticsByUid(): 0x%x\n", rc);
|
||||
}
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
@ -108,7 +108,7 @@ int main(int argc, char* argv[])
|
||||
if (R_SUCCEEDED(rc)) printf("titleID = 0x%08lX, playtimeMinutes = %u, totalLaunches = %u\n", playstats[0].titleID, playstats[0].playtimeMinutes, playstats[0].totalLaunches);
|
||||
|
||||
// Get PdmPlayStatistics for the specified title and user.
|
||||
rc = pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(titleIDs[0], &preselected_uid, &playstats[0]);
|
||||
rc = pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(titleIDs[0], preselected_uid, &playstats[0]);
|
||||
printf("pdmqryQueryPlayStatisticsByApplicationIdAndUserAccountId(): 0x%x\n", rc);
|
||||
if (R_SUCCEEDED(rc)) printf("titleID = 0x%08lX, playtimeMinutes = %u, totalLaunches = %u\n", playstats[0].titleID, playstats[0].playtimeMinutes, playstats[0].totalLaunches);
|
||||
|
||||
@ -127,7 +127,7 @@ int main(int argc, char* argv[])
|
||||
printf("pdmqryGetAvailablePlayEventRange(): 0x%x, 0x%x, 0x%x, 0x%x\n", rc, total_entries, start_entryindex, end_entryindex);
|
||||
|
||||
// Get a listing of titles recently played by the specified user.
|
||||
rc = pdmqryQueryRecentlyPlayedApplication(&preselected_uid, titleIDs, 1, &total_out);
|
||||
rc = pdmqryQueryRecentlyPlayedApplication(preselected_uid, titleIDs, 1, &total_out);
|
||||
printf("pdmqryQueryRecentlyPlayedApplication(): 0x%x, %d\n", rc, total_out);
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
for (i=0; i<total_out; i++)
|
||||
|
@ -9,19 +9,19 @@
|
||||
Result get_save(u64 *titleID, AccountUid *userID)
|
||||
{
|
||||
Result rc=0;
|
||||
FsSaveDataIterator iterator;
|
||||
FsSaveDataInfoReader reader;
|
||||
size_t total_entries=0;
|
||||
FsSaveDataInfo info;
|
||||
|
||||
rc = fsOpenSaveDataIterator(&iterator, FsSaveDataSpaceId_NandUser);//See libnx fs.h.
|
||||
rc = fsOpenSaveDataInfoReader(&reader, FsSaveDataSpaceId_NandUser);//See libnx fs.h.
|
||||
if (R_FAILED(rc)) {
|
||||
printf("fsOpenSaveDataIterator() failed: 0x%x\n", rc);
|
||||
printf("fsOpenSaveDataInfoReader() failed: 0x%x\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
//Find the first savedata with FsSaveDataType_SaveData.
|
||||
while(1) {
|
||||
rc = fsSaveDataIteratorRead(&iterator, &info, 1, &total_entries);//See libnx fs.h.
|
||||
rc = fsSaveDataInfoReaderRead(&reader, &info, 1, &total_entries);//See libnx fs.h.
|
||||
if (R_FAILED(rc) || total_entries==0) break;
|
||||
|
||||
if (info.saveDataType == FsSaveDataType_SaveData) {//Filter by FsSaveDataType_SaveData, however note that NandUser can have non-FsSaveDataType_SaveData.
|
||||
@ -31,7 +31,7 @@ Result get_save(u64 *titleID, AccountUid *userID)
|
||||
}
|
||||
}
|
||||
|
||||
fsSaveDataIteratorClose(&iterator);
|
||||
fsSaveDataInfoReaderClose(&reader);
|
||||
|
||||
if (R_SUCCEEDED(rc)) return MAKERESULT(Module_Libnx, LibnxError_NotFound);
|
||||
|
||||
@ -41,12 +41,10 @@ Result get_save(u64 *titleID, AccountUid *userID)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Result rc=0;
|
||||
int ret=0;
|
||||
|
||||
DIR* dir;
|
||||
struct dirent* ent;
|
||||
|
||||
FsFileSystem tmpfs;
|
||||
AccountUid userID={0};
|
||||
u64 titleID=0x01007ef00011e000;//titleID of the save to mount, in this case BOTW.
|
||||
|
||||
@ -77,19 +75,11 @@ int main(int argc, char **argv)
|
||||
printf("Using titleID=0x%016lx userID: 0x%lx 0x%lx\n", titleID, userID.uid[1], userID.uid[0]);
|
||||
}
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
rc = fsMount_SaveData(&tmpfs, titleID, &userID);//See also libnx fs.h.
|
||||
if (R_FAILED(rc)) {
|
||||
printf("fsMount_SaveData() failed: 0x%x\n", rc);
|
||||
}
|
||||
}
|
||||
|
||||
//You can use any device-name. If you want multiple saves mounted at the same time, you must use different device-names for each one.
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
ret = fsdevMountDevice("save", tmpfs);
|
||||
if (ret==-1) {
|
||||
printf("fsdevMountDevice() failed.\n");
|
||||
rc = ret;
|
||||
rc = fsdevMountSaveData("save", titleID, userID);//See also libnx fs.h/fs_dev.h
|
||||
if (R_FAILED(rc)) {
|
||||
printf("fsdevMountSaveData() failed: 0x%x\n", rc);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user