Skip to content

Commit 68f92af

Browse files
committed
added possible sx/rnx detection, based on EdiZons detection
1 parent 68f4534 commit 68f92af

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Diff for: source/main.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,14 @@ class FastCFWSwitchOverlay : public tsl::Overlay {
7474
private:
7575
Result splInitializeResult;
7676
Result spsmInitializeResult;
77-
bool useClassic;
77+
bool useClassic = false;
7878
public:
7979
// libtesla already initialized fs, hid, pl, pmdmnt, hid:sys and set:sys
8080
virtual void initServices() override {
8181
splInitializeResult = splInitialize();
8282
spsmInitializeResult = spsmInitialize();
8383

84+
useClassic = isServiceRunning("tx") || isServiceRunning("rnx");
8485

8586
} // Called at the start to initialize all services necessary for this Overlay
8687
virtual void exitServices() override {
@@ -92,6 +93,16 @@ class FastCFWSwitchOverlay : public tsl::Overlay {
9293
virtual void onShow() override {} // Called before overlay wants to change from invisible to visible state
9394
virtual void onHide() override {} // Called before overlay wants to change from visible to invisible state
9495

96+
bool isServiceRunning(const char *serviceName) {
97+
u8 tmp=0;
98+
SmServiceName service_name = smEncodeName(serviceName);
99+
Result rc = serviceDispatchInOut(smGetServiceSession(), 65100, service_name, tmp);
100+
if (R_SUCCEEDED(rc) && tmp & 1)
101+
return true;
102+
else
103+
return false;
104+
}
105+
95106
virtual std::unique_ptr<tsl::Gui> loadInitialGui() override {
96107
if(R_FAILED(splInitializeResult)){
97108
//unable to init spl, cant reboot this way

0 commit comments

Comments
 (0)