Skip to content

Commit 567310b

Browse files
authored
Merge pull request #54 from berichan/master
Add check for if program is running and build with latest libnx (2.1)
2 parents e4c86a2 + 5a6d921 commit 567310b

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

sys-botbase/source/commands.c

+10
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ MetaData getMetaData(){
120120
return meta;
121121
}
122122

123+
bool getIsProgramOpen(u64 id)
124+
{
125+
u64 pid = 0;
126+
Result rc = pmdmntGetProcessId(&pid, id);
127+
if (pid == 0 || R_FAILED(rc))
128+
return false;
129+
130+
return true;
131+
}
132+
123133
void initController()
124134
{
125135
if(bControllerIsInitialised) return;

sys-botbase/source/commands.h

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ u64 getHeapBase(Handle handle);
4444
u64 getTitleId(u64 pid);
4545
void getBuildID(MetaData* meta, u64 pid);
4646
MetaData getMetaData(void);
47+
bool getIsProgramOpen(u64 id);
4748

4849
void poke(u64 offset, u64 size, u8* val);
4950
void writeMem(u64 offset, u64 size, u8* val);

sys-botbase/source/main.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,14 @@ int argmain(int argc, char **argv)
453453
printf("%016lX\n", meta.heap_base);
454454
}
455455

456+
if(!strcmp(argv[0], "isProgramRunning")){
457+
if(argc != 2)
458+
return 0;
459+
u64 programId = parseStringToInt(argv[1]);
460+
bool isRunning = getIsProgramOpen(programId);
461+
printf("%d\n", isRunning);
462+
}
463+
456464
if(!strcmp(argv[0], "pixelPeek")){
457465
//errors with 0x668CE, unless debugunit flag is patched
458466
u64 bSize = 0x7D000;
@@ -475,7 +483,7 @@ int argmain(int argc, char **argv)
475483
}
476484

477485
if(!strcmp(argv[0], "getVersion")){
478-
printf("2.0\n");
486+
printf("2.1\n");
479487
}
480488

481489
// follow pointers and print absolute offset (little endian, flip it yourself if required)

0 commit comments

Comments
 (0)