Skip to content

Commit

Permalink
Support latest libnx
Browse files Browse the repository at this point in the history
  • Loading branch information
Genwald committed Dec 11, 2019
1 parent 501cdeb commit b9606de
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion source/dumper.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void copy(const char* from, const char* to, bool exfat = false)
mkdirs(folder, 0744);
}
if(!exfat) {
rc = fsdevCreateFile(to, 0, FS_CREATE_BIG_FILE);
rc = fsdevCreateFile(to, 0, FsCreateOption_BigFile);
if (R_FAILED(rc)) {
printf("\nfsdevCreateFile() failed: 0x%x", rc);
fclose(source);
Expand Down
2 changes: 1 addition & 1 deletion source/ftp_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ ftp_main()
sdmcWriteSafe(false);
/* initialize needed Switch services */
#elif defined(__SWITCH__)
nifmInitialize();
nifmInitialize(NifmServiceType_User);
#endif

/* initialize console subsystem */
Expand Down
4 changes: 2 additions & 2 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void mainMenuLoop(int kDown) {
}

else if (kDown & KEY_Y) {
nifmInitialize();
nifmInitialize(NifmServiceType_User);
NifmInternetConnectionStatus connectionStatus;
if(R_SUCCEEDED(nifmGetInternetConnectionStatus(nullptr, nullptr, &connectionStatus))) {
if(connectionStatus == NifmInternetConnectionStatus_Connected)
Expand All @@ -47,7 +47,7 @@ int main(int argc, char **argv)
mkdirs(mods_root, 0777);
mkdir(backups_root, 0777);
if(std::filesystem::is_directory(std::filesystem::status(arc_path)) && !std::filesystem::is_empty(arc_path))
fsdevSetArchiveBit(arc_path.c_str());
fsdevSetConcatenationFileAttribute(arc_path.c_str());
if(!std::filesystem::exists(outPath) || std::filesystem::is_empty(arc_path))
{
menu = ARC_DUMPER_MENU;
Expand Down
16 changes: 9 additions & 7 deletions source/utils.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include <filesystem>
#include <map>
#include <vector>
#include <stdarg.h>
#include "menu.h"
#include "switch.h"
Expand Down Expand Up @@ -103,9 +104,9 @@ int getRegion() {
void getVersion(u64 tid, char version[0x10]) {
nsInitialize();
NsApplicationControlData contolData;
nsGetApplicationControlData(1, tid, &contolData, sizeof(NsApplicationControlData), NULL);
nsGetApplicationControlData(NsApplicationControlSource_Storage, tid, &contolData, sizeof(NsApplicationControlData), NULL);
nsExit();
strcpy(version, contolData.nacp.version);
strcpy(version, contolData.nacp.display_version);
}

int getSmashVersion() {
Expand Down Expand Up @@ -172,14 +173,15 @@ void log(const char* format, ...) {
va_end(args);
}

bool isServiceRunning(const char *serviceName) {
bool isServiceRunning(const char* serviceName) {
Handle handle;
bool running = R_FAILED(smRegisterService(&handle, serviceName, false, 1));
SmServiceName encodedName = smEncodeName(serviceName);
bool running = R_FAILED(smRegisterService(&handle, encodedName, false, 1));

svcCloseHandle(handle);

if (!running)
smUnregisterService(serviceName);
smUnregisterService(encodedName);

return running;
}
Expand Down Expand Up @@ -223,8 +225,8 @@ u64 runningTID()
u64 tid = 0;
pmdmntInitialize();
pminfoInitialize();
pmdmntGetApplicationPid(&pid);
pminfoGetTitleId(&tid, pid);
pmdmntGetApplicationProcessId(&pid);
pminfoGetProgramId(&tid, pid);
pminfoExit();
pmdmntExit();
return tid;
Expand Down

0 comments on commit b9606de

Please sign in to comment.