diff --git a/CMakeLists.txt b/CMakeLists.txt index aa9f8313a..2d276857c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,7 +153,12 @@ endif() # Set game compilation version set(VERSION us) -set(USE_NETWORKING ON) +if(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch" OR CMAKE_SYSTEM_NAME STREQUAL "CafeOS") + set(USE_NETWORKING_DEFAULT OFF) +else() + set(USE_NETWORKING_DEFAULT ON) +endif() +option(USE_NETWORKING "Enable the Satella online relay / networking features" ${USE_NETWORKING_DEFAULT}) set(SKIP_XCODE_VERSION_CHECK ON) # Add compile definitions for the target diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index 50d0d374c..8231cdc8c 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -554,7 +554,7 @@ void GameEngine::RunExtract(int argc, char* argv[]) { #endif std::shared_ptr threadPool = std::make_shared(1); while (true) { -#ifndef __SWITCH__ +#ifdef USE_NETWORKING auto satellaPhase = Satella::Client::Instance().GetPhase(); bool satellaActive = satellaPhase == Satella::Phase::Connecting || satellaPhase == Satella::Phase::FetchingKeys; #else @@ -837,7 +837,7 @@ void GameEngine::RunExtract(int argc, char* argv[]) { continue; } case GS_COMPILE: { -#ifndef __SWITCH__ +#ifdef USE_NETWORKING threadPool->submit_task([&]() -> void { Satella::Client::Instance().Execute(); extractStep = GS_LOAD; @@ -937,7 +937,7 @@ void GameEngine::RunExtract(int argc, char* argv[]) { ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings)) { -#ifndef __SWITCH__ +#ifdef USE_NETWORKING if (satellaActive) { const char* msg = satellaPhase == Satella::Phase::Connecting ? "Connecting to Satella..." : "Retrieving public keys..."; diff --git a/src/port/api/relay.cpp b/src/port/api/relay.cpp index aabcde7a6..4b53eaf15 100644 --- a/src/port/api/relay.cpp +++ b/src/port/api/relay.cpp @@ -1,4 +1,4 @@ -#ifndef __SWITCH__ +#ifdef USE_NETWORKING #include "relay.h" #include "port/net/Relay.h" #include "spdlog/spdlog.h" diff --git a/src/port/net/Relay.cpp b/src/port/net/Relay.cpp index 6ddaf5ce8..08344b05e 100644 --- a/src/port/net/Relay.cpp +++ b/src/port/net/Relay.cpp @@ -1,4 +1,4 @@ -#ifndef __SWITCH__ +#ifdef USE_NETWORKING #include "Relay.h" #include "SatellaClient.h" diff --git a/src/port/net/Relay.h b/src/port/net/Relay.h index 329092542..2e7eb3cf8 100644 --- a/src/port/net/Relay.h +++ b/src/port/net/Relay.h @@ -1,5 +1,5 @@ #pragma once -#ifndef __SWITCH__ +#ifdef USE_NETWORKING #include #include diff --git a/src/port/net/SatellaClient.cpp b/src/port/net/SatellaClient.cpp index 251a990b4..9fe7a97e6 100644 --- a/src/port/net/SatellaClient.cpp +++ b/src/port/net/SatellaClient.cpp @@ -1,4 +1,4 @@ -#ifndef __SWITCH__ +#ifdef USE_NETWORKING #include "port/net/SatellaClient.h" #include "ship/Context.h" diff --git a/src/port/net/SatellaClient.h b/src/port/net/SatellaClient.h index 3d1e21eec..e7967cb6c 100644 --- a/src/port/net/SatellaClient.h +++ b/src/port/net/SatellaClient.h @@ -1,6 +1,6 @@ #pragma once -#ifndef __SWITCH__ +#ifdef USE_NETWORKING #include #include #include