Skip to content

Commit

Permalink
added possible sx/rnx detection, based on EdiZons detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartie95 committed Sep 25, 2021
1 parent 68f4534 commit 68f92af
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ class FastCFWSwitchOverlay : public tsl::Overlay {
private:
Result splInitializeResult;
Result spsmInitializeResult;
bool useClassic;
bool useClassic = false;
public:
// libtesla already initialized fs, hid, pl, pmdmnt, hid:sys and set:sys
virtual void initServices() override {
splInitializeResult = splInitialize();
spsmInitializeResult = spsmInitialize();

useClassic = isServiceRunning("tx") || isServiceRunning("rnx");

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

bool isServiceRunning(const char *serviceName) {
u8 tmp=0;
SmServiceName service_name = smEncodeName(serviceName);
Result rc = serviceDispatchInOut(smGetServiceSession(), 65100, service_name, tmp);
if (R_SUCCEEDED(rc) && tmp & 1)
return true;
else
return false;
}

virtual std::unique_ptr<tsl::Gui> loadInitialGui() override {
if(R_FAILED(splInitializeResult)){
//unable to init spl, cant reboot this way
Expand Down

0 comments on commit 68f92af

Please sign in to comment.