DownloadManager: Always use Nintendo servers + additional streamlining

- Download manager now always uses Nintendo servers. Requires only a valid OTP and SEEPROM dump so you can use it in combination with a Pretendo setup even without a NNID
- Account drop down removed from download manager since it's not required
- Internally all our API requests now support overriding which service to use
- Drop support for act-url and ecs-url command line parameters. Usage of network_services.xml ("custom" option in the UI) is preferred
This commit is contained in:
Exzap 2024-04-20 12:19:06 +02:00
parent 989e2b8c8c
commit efbbb817fe
29 changed files with 323 additions and 338 deletions

View file

@ -39,7 +39,6 @@ ActiveSettings::LoadOnce(
g_config.SetFilename(GetConfigPath("settings.xml").generic_wstring());
g_config.Load();
LaunchSettings::ChangeNetworkServiceURL(GetConfig().account.active_service);
std::string additionalErrorInfo;
s_has_required_online_files = iosuCrypt_checkRequirementsForOnlineMode(additionalErrorInfo) == IOS_CRYPTO_ONLINE_REQ_OK;
return failed_write_access;

View file

@ -69,11 +69,7 @@ bool LaunchSettings::HandleCommandline(const std::vector<std::wstring>& args)
("account,a", po::value<std::string>(), "Persistent id of account")
("force-interpreter", po::value<bool>()->implicit_value(true), "Force interpreter CPU emulation, disables recompiler")
("enable-gdbstub", po::value<bool>()->implicit_value(true), "Enable GDB stub to debug executables inside Cemu using an external debugger")
("act-url", po::value<std::string>(), "URL prefix for account server")
("ecs-url", po::value<std::string>(), "URL for ECS service");
("enable-gdbstub", po::value<bool>()->implicit_value(true), "Enable GDB stub to debug executables inside Cemu using an external debugger");
po::options_description hidden{ "Hidden options" };
hidden.add_options()
@ -190,16 +186,6 @@ bool LaunchSettings::HandleCommandline(const std::vector<std::wstring>& args)
if (vm.count("output"))
log_path = vm["output"].as<std::wstring>();
// urls
if (vm.count("act-url"))
{
serviceURL_ACT = vm["act-url"].as<std::string>();
if (serviceURL_ACT.size() > 0 && serviceURL_ACT.back() == '/')
serviceURL_ACT.pop_back();
}
if (vm.count("ecs-url"))
serviceURL_ECS = vm["ecs-url"].as<std::string>();
if(!extract_path.empty())
{
ExtractorTool(extract_path, output_path, log_path);
@ -280,24 +266,3 @@ bool LaunchSettings::ExtractorTool(std::wstring_view wud_path, std::string_view
return true;
}
void LaunchSettings::ChangeNetworkServiceURL(int ID){
NetworkService Network = static_cast<NetworkService>(ID);
switch (Network)
{
case NetworkService::Pretendo:
serviceURL_ACT = PretendoURLs::ACTURL;
serviceURL_ECS = PretendoURLs::ECSURL;
break;
case NetworkService::Custom:
serviceURL_ACT = GetNetworkConfig().urls.ACT.GetValue();
serviceURL_ECS = GetNetworkConfig().urls.ECS.GetValue();
break;
case NetworkService::Nintendo:
default:
serviceURL_ACT = NintendoURLs::ACTURL;
serviceURL_ECS = NintendoURLs::ECSURL;
break;
}
}

View file

@ -29,10 +29,6 @@ public:
static std::optional<uint32> GetPersistentId() { return s_persistent_id; }
static std::string GetActURLPrefix() { return serviceURL_ACT; }
static std::string GetServiceURL_ecs() { return serviceURL_ECS; }
static void ChangeNetworkServiceURL(int ID);
private:
inline static std::optional<fs::path> s_load_game_file{};
inline static std::optional<uint64> s_load_title_id{};
@ -48,12 +44,6 @@ private:
inline static std::optional<uint32> s_persistent_id{};
// service URLS
inline static std::string serviceURL_ACT;
inline static std::string serviceURL_ECS;
// todo - npts and other boss urls
static bool ExtractorTool(std::wstring_view wud_path, std::string_view output_path, std::wstring_view log_path);
};

View file

@ -30,8 +30,6 @@ void NetworkConfig::Load(XMLConfigParser& parser)
urls.BOSS = u.get("boss", NintendoURLs::BOSSURL);
urls.TAGAYA = u.get("tagaya", NintendoURLs::TAGAYAURL);
urls.OLV = u.get("olv", NintendoURLs::OLVURL);
if (static_cast<NetworkService>(GetConfig().account.active_service.GetValue()) == NetworkService::Custom)
LaunchSettings::ChangeNetworkServiceURL(2);
}
bool NetworkConfig::XMLExists()
@ -41,7 +39,6 @@ bool NetworkConfig::XMLExists()
{
if (static_cast<NetworkService>(GetConfig().account.active_service.GetValue()) == NetworkService::Custom)
{
LaunchSettings::ChangeNetworkServiceURL(0);
GetConfig().account.active_service = 0;
}
return false;

View file

@ -3,13 +3,15 @@
#include "ConfigValue.h"
#include "XMLConfig.h"
enum class NetworkService {
Nintendo,
Pretendo,
Custom,
enum class NetworkService
{
Nintendo,
Pretendo,
Custom
};
struct NetworkConfig {
struct NetworkConfig
{
NetworkConfig()
{
@ -69,4 +71,15 @@ struct PretendoURLs {
typedef XMLDataConfig<NetworkConfig, &NetworkConfig::Load, &NetworkConfig::Save> XMLNetworkConfig_t;
extern XMLNetworkConfig_t n_config;
inline NetworkConfig& GetNetworkConfig() { return n_config.data();};
inline NetworkConfig& GetNetworkConfig() { return n_config.data();};
inline bool IsNetworkServiceSSLDisabled(NetworkService service)
{
if(service == NetworkService::Nintendo)
return false;
else if(service == NetworkService::Pretendo)
return true;
else if(service == NetworkService::Custom)
return GetNetworkConfig().disablesslver.GetValue();
return false;
}