mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-21 16:49:19 +01:00
Add support for choosing network service (incl Pretendo+Custom) (#302)
This commit is contained in:
parent
52cc7c5996
commit
b07e9efba4
1
.gitignore
vendored
1
.gitignore
vendored
@ -30,6 +30,7 @@ bin/Cemu_*.ilk
|
||||
bin/Cemu.exe.backup
|
||||
bin/mlc01/*
|
||||
bin/settings.xml
|
||||
bin/network_services.xml
|
||||
bin/title_list_cache.xml
|
||||
bin/debugger/*
|
||||
bin/sdcard/*
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <fstream>
|
||||
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "config/NetworkSettings.h"
|
||||
#include "curl/curl.h"
|
||||
#include "openssl/bn.h"
|
||||
#include "openssl/x509.h"
|
||||
@ -497,9 +498,13 @@ namespace iosu
|
||||
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, task_header_callback);
|
||||
curl_easy_setopt(curl, CURLOPT_HEADERDATA, &(*it));
|
||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 0x3C);
|
||||
if (GetNetworkConfig().disablesslver.GetValue() && ActiveSettings::GetNetworkService() == NetworkService::Custom || ActiveSettings::GetNetworkService() == NetworkService::Pretendo){ //Remove Pretendo Function once SSL is in the Service
|
||||
curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,0L);
|
||||
} else {
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_CTX_FUNCTION, task_sslctx_function);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_CTX_DATA, &it->task_settings);
|
||||
curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_0);
|
||||
}
|
||||
|
||||
char url[512];
|
||||
if(it->task_settings.taskType == kRawDlTaskSetting)
|
||||
@ -561,8 +566,21 @@ namespace iosu
|
||||
|
||||
char boss_code[0x20];
|
||||
strncpy(boss_code, (char*)&it->task_settings.settings[TaskSetting::kBossCode], TaskSetting::kBossCodeLen);
|
||||
|
||||
sprintf(url, "https://npts.app.nintendo.net/p01/tasksheet/%s/%s/%s?c=%s&l=%s", "1", boss_code, it->task_id, countryCode, languageCode);
|
||||
switch (ActiveSettings::GetNetworkService())
|
||||
{
|
||||
case NetworkService::Nintendo:
|
||||
sprintf(url, NintendoURLs::BOSSURL.append("/%s/%s/%s?c=%s&l=%s").c_str(), "1", boss_code, it->task_id, countryCode, languageCode);
|
||||
break;
|
||||
case NetworkService::Pretendo:
|
||||
sprintf(url, PretendoURLs::BOSSURL.append("/%s/%s/%s?c=%s&l=%s").c_str(), "1", boss_code, it->task_id, countryCode, languageCode);
|
||||
break;
|
||||
case NetworkService::Custom:
|
||||
sprintf(url, GetNetworkConfig().urls.BOSS.GetValue().append("/%s/%s/%s?c=%s&l=%s").c_str(), "1", boss_code, it->task_id, countryCode, languageCode);
|
||||
break;
|
||||
default:
|
||||
sprintf(url, NintendoURLs::BOSSURL.append("/%s/%s/%s?c=%s&l=%s").c_str(), "1", boss_code, it->task_id, countryCode, languageCode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list_headerParam);
|
||||
|
@ -8,7 +8,8 @@
|
||||
#include "Cemu/ncrypto/ncrypto.h"
|
||||
#include "util/crypto/md5.h"
|
||||
#include "config/LaunchSettings.h"
|
||||
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "config/NetworkSettings.h"
|
||||
#include "pugixml.hpp"
|
||||
#include <charconv>
|
||||
|
||||
@ -26,14 +27,42 @@ namespace NAPI
|
||||
{
|
||||
if (!s_serviceURL_NusURL.empty())
|
||||
return s_serviceURL_NusURL;
|
||||
return "https://nus.wup.shop.nintendo.net/nus/services/NetUpdateSOAP";
|
||||
switch (ActiveSettings::GetNetworkService())
|
||||
{
|
||||
case NetworkService::Nintendo:
|
||||
return NintendoURLs::NUSURL;
|
||||
break;
|
||||
case NetworkService::Pretendo:
|
||||
return PretendoURLs::NUSURL;
|
||||
break;
|
||||
case NetworkService::Custom:
|
||||
return GetNetworkConfig().urls.NUS;
|
||||
break;
|
||||
default:
|
||||
return NintendoURLs::NUSURL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string _getIASUrl()
|
||||
{
|
||||
if (!s_serviceURL_IasURL.empty())
|
||||
return s_serviceURL_IasURL;
|
||||
return "https://ias.wup.shop.nintendo.net/ias/services/IdentityAuthenticationSOAP";
|
||||
switch (ActiveSettings::GetNetworkService())
|
||||
{
|
||||
case NetworkService::Nintendo:
|
||||
return NintendoURLs::IASURL;
|
||||
break;
|
||||
case NetworkService::Pretendo:
|
||||
return PretendoURLs::IASURL;
|
||||
break;
|
||||
case NetworkService::Custom:
|
||||
return GetNetworkConfig().urls.IAS;
|
||||
break;
|
||||
default:
|
||||
return NintendoURLs::IASURL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string _getECSUrl()
|
||||
@ -48,14 +77,42 @@ namespace NAPI
|
||||
{
|
||||
if (!s_serviceURL_UncachedContentPrefixURL.empty())
|
||||
return s_serviceURL_UncachedContentPrefixURL;
|
||||
return "https://ccs.wup.shop.nintendo.net/ccs/download";
|
||||
switch (ActiveSettings::GetNetworkService())
|
||||
{
|
||||
case NetworkService::Nintendo:
|
||||
return NintendoURLs::CCSUURL;
|
||||
break;
|
||||
case NetworkService::Pretendo:
|
||||
return PretendoURLs::CCSUURL;
|
||||
break;
|
||||
case NetworkService::Custom:
|
||||
return GetNetworkConfig().urls.CCSU;
|
||||
break;
|
||||
default:
|
||||
return NintendoURLs::CCSUURL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string _getCCSUrl() // used for game data downloads
|
||||
{
|
||||
if (!s_serviceURL_ContentPrefixURL.empty())
|
||||
return s_serviceURL_ContentPrefixURL;
|
||||
return "http://ccs.cdn.wup.shop.nintendo.net/ccs/download";
|
||||
switch (ActiveSettings::GetNetworkService())
|
||||
{
|
||||
case NetworkService::Nintendo:
|
||||
return NintendoURLs::CCSURL;
|
||||
break;
|
||||
case NetworkService::Pretendo:
|
||||
return PretendoURLs::CCSURL;
|
||||
break;
|
||||
case NetworkService::Custom:
|
||||
return GetNetworkConfig().urls.CCS;
|
||||
break;
|
||||
default:
|
||||
return NintendoURLs::CCSURL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* NUS */
|
||||
|
@ -7,7 +7,9 @@
|
||||
#include "Cemu/ncrypto/ncrypto.h"
|
||||
#include "napi_helper.h"
|
||||
#include "util/highresolutiontimer/HighResolutionTimer.h"
|
||||
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "config/NetworkSettings.h"
|
||||
#include "config/LaunchSettings.h"
|
||||
#include "pugixml.hpp"
|
||||
#include <charconv>
|
||||
|
||||
@ -97,7 +99,10 @@ void CurlRequestHelper::initate(std::string url, SERVER_SSL_CONTEXT sslContext)
|
||||
curl_easy_setopt(m_curl, CURLOPT_TIMEOUT, 60);
|
||||
|
||||
// SSL
|
||||
if (sslContext == SERVER_SSL_CONTEXT::ACT || sslContext == SERVER_SSL_CONTEXT::TAGAYA)
|
||||
if (GetNetworkConfig().disablesslver.GetValue() && ActiveSettings::GetNetworkService() == NetworkService::Custom || ActiveSettings::GetNetworkService() == NetworkService::Pretendo){ //Remove once Pretendo has SSL
|
||||
curl_easy_setopt(m_curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
}
|
||||
else if (sslContext == SERVER_SSL_CONTEXT::ACT || sslContext == SERVER_SSL_CONTEXT::TAGAYA)
|
||||
{
|
||||
curl_easy_setopt(m_curl, CURLOPT_SSL_CTX_FUNCTION, _sslctx_function_NUS);
|
||||
curl_easy_setopt(m_curl, CURLOPT_SSL_CTX_DATA, NULL);
|
||||
@ -219,9 +224,10 @@ CurlSOAPHelper::CurlSOAPHelper()
|
||||
curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, this);
|
||||
|
||||
// SSL
|
||||
if (!GetNetworkConfig().disablesslver.GetValue() && ActiveSettings::GetNetworkService() != NetworkService::Pretendo && ActiveSettings::GetNetworkService() != NetworkService::Custom) { //Remove once Pretendo has SSL
|
||||
curl_easy_setopt(m_curl, CURLOPT_SSL_CTX_FUNCTION, _sslctx_function_SOAP);
|
||||
curl_easy_setopt(m_curl, CURLOPT_SSL_CTX_DATA, NULL);
|
||||
|
||||
}
|
||||
if(GetConfig().proxy_server.GetValue() != "")
|
||||
{
|
||||
curl_easy_setopt(m_curl, CURLOPT_PROXY, GetConfig().proxy_server.GetValue().c_str());
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "openssl/sha.h"
|
||||
#include "util/crypto/aes128.h"
|
||||
#include "util/helpers/StringHelpers.h"
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "config/NetworkSettings.h"
|
||||
|
||||
namespace NAPI
|
||||
{
|
||||
@ -55,7 +57,21 @@ namespace NAPI
|
||||
std::vector<uint8> IDBE_RequestRawEncrypted(uint64 titleId)
|
||||
{
|
||||
CurlRequestHelper req;
|
||||
req.initate(fmt::format("https://idbe-wup.cdn.nintendo.net/icondata/{0:02X}/{1:016X}.idbe", (uint32)((titleId >> 8) & 0xFF), titleId), CurlRequestHelper::SERVER_SSL_CONTEXT::IDBE);
|
||||
switch (ActiveSettings::GetNetworkService())
|
||||
{
|
||||
case NetworkService::Nintendo:
|
||||
req.initate(fmt::format(fmt::runtime(NintendoURLs::IDBEURL + "/{0:02X}/{1:016X}.idbe"), (uint32)((titleId >> 8) & 0xFF), titleId), CurlRequestHelper::SERVER_SSL_CONTEXT::IDBE);
|
||||
break;
|
||||
case NetworkService::Pretendo:
|
||||
req.initate(fmt::format(fmt::runtime(PretendoURLs::IDBEURL + "/{0:02X}/{1:016X}.idbe"), (uint32)((titleId >> 8) & 0xFF), titleId), CurlRequestHelper::SERVER_SSL_CONTEXT::IDBE);
|
||||
break;
|
||||
case NetworkService::Custom:
|
||||
req.initate(fmt::format(fmt::runtime(GetNetworkConfig().urls.IDBE.GetValue() + "/{0:02X}/{1:016X}.idbe"), (uint32)((titleId >> 8) & 0xFF), titleId), CurlRequestHelper::SERVER_SSL_CONTEXT::IDBE);
|
||||
break;
|
||||
default:
|
||||
req.initate(fmt::format(fmt::runtime(NintendoURLs::IDBEURL + "/{0:02X}/{1:016X}.idbe"), (uint32)((titleId >> 8) & 0xFF), titleId), CurlRequestHelper::SERVER_SSL_CONTEXT::IDBE);
|
||||
break;
|
||||
}
|
||||
if (!req.submitRequest(false))
|
||||
{
|
||||
cemuLog_log(LogType::Force, fmt::format("Failed to request IDBE icon for title {0:016X}", titleId));
|
||||
@ -84,7 +100,22 @@ namespace NAPI
|
||||
}
|
||||
|
||||
CurlRequestHelper req;
|
||||
req.initate(fmt::format("https://idbe-wup.cdn.nintendo.net/icondata/{0:02X}/{1:016X}.idbe", (uint32)((titleId >> 8) & 0xFF), titleId), CurlRequestHelper::SERVER_SSL_CONTEXT::IDBE);
|
||||
switch (ActiveSettings::GetNetworkService())
|
||||
{
|
||||
case NetworkService::Nintendo:
|
||||
req.initate(fmt::format(fmt::runtime(NintendoURLs::IDBEURL + "/{0:02X}/{1:016X}.idbe"), (uint32)((titleId >> 8) & 0xFF), titleId), CurlRequestHelper::SERVER_SSL_CONTEXT::IDBE);
|
||||
break;
|
||||
case NetworkService::Pretendo:
|
||||
req.initate(fmt::format(fmt::runtime(PretendoURLs::IDBEURL + "/{0:02X}/{1:016X}.idbe"), (uint32)((titleId >> 8) & 0xFF), titleId), CurlRequestHelper::SERVER_SSL_CONTEXT::IDBE);
|
||||
break;
|
||||
case NetworkService::Custom:
|
||||
req.initate(fmt::format(fmt::runtime(GetNetworkConfig().urls.IDBE.GetValue() + "/{0:02X}/{1:016X}.idbe"), (uint32)((titleId >> 8) & 0xFF), titleId), CurlRequestHelper::SERVER_SSL_CONTEXT::IDBE);
|
||||
break;
|
||||
default:
|
||||
req.initate(fmt::format(fmt::runtime(NintendoURLs::IDBEURL + "/{0:02X}/{1:016X}.idbe"), (uint32)((titleId >> 8) & 0xFF), titleId), CurlRequestHelper::SERVER_SSL_CONTEXT::IDBE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!req.submitRequest(false))
|
||||
{
|
||||
cemuLog_log(LogType::Force, fmt::format("Failed to request IDBE icon for title {0:016X}", titleId));
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
#include "Cemu/ncrypto/ncrypto.h"
|
||||
#include <charconv>
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "config/NetworkSettings.h"
|
||||
|
||||
namespace NAPI
|
||||
{
|
||||
@ -14,7 +16,22 @@ namespace NAPI
|
||||
{
|
||||
NAPI_VersionListVersion_Result result;
|
||||
CurlRequestHelper req;
|
||||
req.initate(fmt::format("https://tagaya.wup.shop.nintendo.net/tagaya/versionlist/{}/{}/latest_version", NCrypto::GetRegionAsString(authInfo.region), authInfo.country), CurlRequestHelper::SERVER_SSL_CONTEXT::TAGAYA);
|
||||
switch (ActiveSettings::GetNetworkService())
|
||||
{
|
||||
case NetworkService::Nintendo:
|
||||
req.initate(fmt::format(fmt::runtime(NintendoURLs::TAGAYAURL + "/{}/{}/latest_version"), NCrypto::GetRegionAsString(authInfo.region), authInfo.country), CurlRequestHelper::SERVER_SSL_CONTEXT::TAGAYA);
|
||||
break;
|
||||
case NetworkService::Pretendo:
|
||||
req.initate(fmt::format(fmt::runtime(PretendoURLs::TAGAYAURL + "/{}/{}/latest_version"), NCrypto::GetRegionAsString(authInfo.region), authInfo.country), CurlRequestHelper::SERVER_SSL_CONTEXT::TAGAYA);
|
||||
break;
|
||||
case NetworkService::Custom:
|
||||
req.initate(fmt::format(fmt::runtime(GetNetworkConfig().urls.TAGAYA.GetValue() + "/{}/{}/latest_version"), NCrypto::GetRegionAsString(authInfo.region), authInfo.country), CurlRequestHelper::SERVER_SSL_CONTEXT::TAGAYA);
|
||||
break;
|
||||
default:
|
||||
req.initate(fmt::format(fmt::runtime(NintendoURLs::TAGAYAURL + "/{}/{}/latest_version"), NCrypto::GetRegionAsString(authInfo.region), authInfo.country), CurlRequestHelper::SERVER_SSL_CONTEXT::TAGAYA);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!req.submitRequest(false))
|
||||
{
|
||||
cemuLog_log(LogType::Force, fmt::format("Failed to request version of update list"));
|
||||
|
@ -20,7 +20,7 @@ void ActiveSettings::LoadOnce()
|
||||
|
||||
g_config.SetFilename(GetPath("settings.xml").generic_wstring());
|
||||
g_config.Load();
|
||||
|
||||
LaunchSettings::ChangeNetworkServiceURL(GetConfig().account.active_service);
|
||||
std::wstring additionalErrorInfo;
|
||||
s_has_required_online_files = iosuCrypt_checkRequirementsForOnlineMode(additionalErrorInfo) == IOS_CRYPTO_ONLINE_REQ_OK;
|
||||
}
|
||||
@ -121,6 +121,10 @@ bool ActiveSettings::HasRequiredOnlineFiles()
|
||||
return s_has_required_online_files;
|
||||
}
|
||||
|
||||
NetworkService ActiveSettings::GetNetworkService() {
|
||||
return static_cast<NetworkService>(GetConfig().account.active_service.GetValue());
|
||||
}
|
||||
|
||||
bool ActiveSettings::DumpShadersEnabled()
|
||||
{
|
||||
return s_dump_shaders;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "config/CemuConfig.h"
|
||||
#include "config/NetworkSettings.h"
|
||||
|
||||
// global active settings for fast access (reflects settings from command line and game profile)
|
||||
class ActiveSettings
|
||||
@ -92,7 +93,7 @@ public:
|
||||
[[nodiscard]] static uint32 GetPersistentId();
|
||||
[[nodiscard]] static bool IsOnlineEnabled();
|
||||
[[nodiscard]] static bool HasRequiredOnlineFiles();
|
||||
|
||||
[[nodiscard]] static NetworkService GetNetworkService();
|
||||
// dump options
|
||||
[[nodiscard]] static bool DumpShadersEnabled();
|
||||
[[nodiscard]] static bool DumpTexturesEnabled();
|
||||
|
@ -6,6 +6,8 @@ add_library(CemuConfig
|
||||
ConfigValue.h
|
||||
LaunchSettings.cpp
|
||||
LaunchSettings.h
|
||||
NetworkSettings.cpp
|
||||
NetworkSettings.h
|
||||
PermanentConfig.cpp
|
||||
PermanentConfig.h
|
||||
PermanentStorage.cpp
|
||||
|
@ -322,7 +322,7 @@ void CemuConfig::Load(XMLConfigParser& parser)
|
||||
auto acc = parser.get("Account");
|
||||
account.m_persistent_id = acc.get("PersistentId", account.m_persistent_id);
|
||||
account.online_enabled = acc.get("OnlineEnabled", account.online_enabled);
|
||||
|
||||
account.active_service = acc.get("ActiveService",account.active_service);
|
||||
// debug
|
||||
auto debug = parser.get("Debug");
|
||||
#if BOOST_OS_WINDOWS
|
||||
@ -497,7 +497,7 @@ void CemuConfig::Save(XMLConfigParser& parser)
|
||||
auto acc = config.set("Account");
|
||||
acc.set("PersistentId", account.m_persistent_id.GetValue());
|
||||
acc.set("OnlineEnabled", account.online_enabled.GetValue());
|
||||
|
||||
acc.set("ActiveService",account.active_service.GetValue());
|
||||
// debug
|
||||
auto debug = config.set("Debug");
|
||||
#if BOOST_OS_WINDOWS
|
||||
|
@ -471,6 +471,7 @@ struct CemuConfig
|
||||
{
|
||||
ConfigValueBounds<uint32> m_persistent_id{ Account::kMinPersistendId, Account::kMinPersistendId, 0xFFFFFFFF };
|
||||
ConfigValue<bool> online_enabled{false};
|
||||
ConfigValue<int> active_service{0};
|
||||
}account{};
|
||||
|
||||
// input
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "config/NetworkSettings.h"
|
||||
#include "util/crypto/aes128.h"
|
||||
|
||||
#include "Cafe/Filesystem/FST/FST.h"
|
||||
@ -265,3 +266,26 @@ bool LaunchSettings::ExtractorTool(std::wstring_view wud_path, std::string_view
|
||||
}
|
||||
|
||||
|
||||
void LaunchSettings::ChangeNetworkServiceURL(int ID){
|
||||
NetworkService Network = static_cast<NetworkService>(ID);
|
||||
switch (Network)
|
||||
{
|
||||
case NetworkService::Nintendo:
|
||||
serviceURL_ACT = NintendoURLs::ACTURL;
|
||||
serviceURL_ECS = NintendoURLs::ECSURL;
|
||||
break;
|
||||
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;
|
||||
default:
|
||||
serviceURL_ACT = NintendoURLs::ACTURL;
|
||||
serviceURL_ECS = NintendoURLs::ECSURL;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
@ -30,6 +30,7 @@ public:
|
||||
|
||||
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{};
|
||||
@ -46,8 +47,8 @@ private:
|
||||
inline static std::optional<uint32> s_persistent_id{};
|
||||
|
||||
// service URLS
|
||||
inline static std::string serviceURL_ACT = "https://account.nintendo.net";
|
||||
inline static std::string serviceURL_ECS = "https://ecs.wup.shop.nintendo.net/ecs/services/ECommerceSOAP";
|
||||
inline static std::string serviceURL_ACT;
|
||||
inline static std::string serviceURL_ECS;
|
||||
// todo - npts and other boss urls
|
||||
|
||||
|
||||
|
43
src/config/NetworkSettings.cpp
Normal file
43
src/config/NetworkSettings.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
#include "NetworkSettings.h"
|
||||
#include "LaunchSettings.h"
|
||||
#include "CemuConfig.h"
|
||||
#include <boost/dll/runtime_symbol_info.hpp>
|
||||
#include "Common/FileStream.h"
|
||||
XMLNetworkConfig_t n_config(L"network_services.xml");
|
||||
|
||||
void NetworkConfig::LoadOnce() {
|
||||
s_full_path = boost::dll::program_location().generic_wstring();
|
||||
s_path = s_full_path.parent_path();
|
||||
n_config.SetFilename(GetPath("network_services.xml").generic_wstring());
|
||||
if(XMLExists()) {
|
||||
n_config.Load();
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkConfig::Load(XMLConfigParser& parser){
|
||||
auto config = parser.get("content");
|
||||
networkname = config.get("networkname","[Nintendo]");
|
||||
disablesslver = config.get("disablesslverification",disablesslver);
|
||||
auto u = config.get("urls");
|
||||
urls.ACT = u.get("act",NintendoURLs::ACTURL);
|
||||
urls.ECS = u.get("ecs",NintendoURLs::ECSURL);
|
||||
urls.NUS = u.get("nus",NintendoURLs::NUSURL);
|
||||
urls.IAS = u.get("ias",NintendoURLs::IASURL);
|
||||
urls.CCSU = u.get("ccsu",NintendoURLs::CCSUURL);
|
||||
urls.CCS = u.get("ccs",NintendoURLs::CCSURL);
|
||||
urls.IDBE = u.get("idbe",NintendoURLs::IDBEURL);
|
||||
urls.BOSS = u.get("boss",NintendoURLs::BOSSURL);
|
||||
urls.TAGAYA = u.get("tagaya",NintendoURLs::TAGAYAURL);
|
||||
if (static_cast<NetworkService>(GetConfig().account.active_service.GetValue()) == NetworkService::Custom) {
|
||||
LaunchSettings::ChangeNetworkServiceURL(2);
|
||||
}
|
||||
}
|
||||
bool NetworkConfig::XMLExists() {
|
||||
if (!fs::exists(GetPath("network_services.xml"))) {
|
||||
if (static_cast<NetworkService>(GetConfig().account.active_service.GetValue()) == NetworkService::Custom) {
|
||||
LaunchSettings::ChangeNetworkServiceURL(0);
|
||||
GetConfig().account.active_service = 0;
|
||||
}
|
||||
return false;
|
||||
} else {return true;}
|
||||
}
|
77
src/config/NetworkSettings.h
Normal file
77
src/config/NetworkSettings.h
Normal file
@ -0,0 +1,77 @@
|
||||
#pragma once
|
||||
|
||||
#include "ConfigValue.h"
|
||||
#include "XMLConfig.h"
|
||||
|
||||
|
||||
enum class NetworkService {
|
||||
Nintendo,
|
||||
Pretendo,
|
||||
Custom,
|
||||
};
|
||||
struct NetworkConfig {
|
||||
NetworkConfig()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
NetworkConfig(const NetworkConfig&) = delete;
|
||||
|
||||
ConfigValue<std::string> networkname;
|
||||
ConfigValue<bool> disablesslver = false;
|
||||
struct
|
||||
{
|
||||
ConfigValue<std::string> ACT;
|
||||
ConfigValue<std::string> ECS;
|
||||
ConfigValue<std::string> NUS;
|
||||
ConfigValue<std::string> IAS;
|
||||
ConfigValue<std::string> CCSU;
|
||||
ConfigValue<std::string> CCS;
|
||||
ConfigValue<std::string> IDBE;
|
||||
ConfigValue<std::string> BOSS;
|
||||
ConfigValue<std::string> TAGAYA;
|
||||
}urls{};
|
||||
|
||||
public:
|
||||
static void LoadOnce();
|
||||
void Load(XMLConfigParser& parser);
|
||||
void Save(XMLConfigParser& parser);
|
||||
|
||||
static bool XMLExists();
|
||||
private:
|
||||
inline static fs::path s_path;
|
||||
inline static fs::path s_full_path;
|
||||
[[nodiscard]] static fs::path GetPath(std::string_view p)
|
||||
{
|
||||
std::basic_string_view<char8_t> s((const char8_t*)p.data(), p.size());
|
||||
return s_path / fs::path(s);
|
||||
}
|
||||
};
|
||||
|
||||
struct NintendoURLs {
|
||||
inline static std::string ACTURL = "https://account.nintendo.net";
|
||||
inline static std::string ECSURL = "https://ecs.wup.shop.nintendo.net/ecs/services/ECommerceSOAP";
|
||||
inline static std::string NUSURL = "https://nus.wup.shop.nintendo.net/nus/services/NetUpdateSOAP";
|
||||
inline static std::string IASURL = "https://ias.wup.shop.nintendo.net/ias/services/IdentityAuthenticationSOAP";
|
||||
inline static std::string CCSUURL = "https://ccs.wup.shop.nintendo.net/ccs/download";
|
||||
inline static std::string CCSURL = "http://ccs.cdn.wup.shop.nintendo.net/ccs/download";
|
||||
inline static std::string IDBEURL = "https://idbe-wup.cdn.nintendo.net/icondata";
|
||||
inline static std::string BOSSURL = "https://npts.app.nintendo.net/p01/tasksheet";
|
||||
inline static std::string TAGAYAURL = "https://tagaya.wup.shop.nintendo.net/tagaya/versionlist";
|
||||
};
|
||||
|
||||
struct PretendoURLs {
|
||||
inline static std::string ACTURL = "https://account.pretendo.cc";
|
||||
inline static std::string ECSURL = "https://ecs.wup.shop.pretendo.cc/ecs/services/ECommerceSOAP";
|
||||
inline static std::string NUSURL = "https://nus.c.shop.pretendo.cc/nus/services/NetUpdateSOAP";
|
||||
inline static std::string IASURL = "https://ias.c.shop.pretendo.cc/ias/services/IdentityAuthenticationSOAP";
|
||||
inline static std::string CCSUURL = "https://ccs.c.shop.pretendo.cc/ccs/download";
|
||||
inline static std::string CCSURL = "http://ccs.cdn.c.shop.pretendo.cc/ccs/download";
|
||||
inline static std::string IDBEURL = "https://idbe-wup.cdn.pretendo.cc/icondata";
|
||||
inline static std::string BOSSURL = "https://npts.app.pretendo.cc/p01/tasksheet";
|
||||
inline static std::string TAGAYAURL = "https://tagaya.wup.shop.pretendo.cc/tagaya/versionlist";
|
||||
};
|
||||
|
||||
typedef XMLDataConfig<NetworkConfig, &NetworkConfig::Load, &NetworkConfig::Save> XMLNetworkConfig_t;
|
||||
extern XMLNetworkConfig_t n_config;
|
||||
inline NetworkConfig& GetNetworkConfig() { return n_config.data();};
|
@ -14,6 +14,7 @@
|
||||
#include <wx/hyperlink.h>
|
||||
|
||||
#include "config/CemuConfig.h"
|
||||
#include "config/NetworkSettings.h"
|
||||
|
||||
#include "audio/IAudioAPI.h"
|
||||
#if BOOST_OS_WINDOWS
|
||||
@ -604,6 +605,18 @@ wxPanel* GeneralSettings2::AddAccountPage(wxNotebook* notebook)
|
||||
content->Add(m_delete_account, 0, wxEXPAND | wxALL | wxALIGN_RIGHT, 5);
|
||||
m_delete_account->Bind(wxEVT_BUTTON, &GeneralSettings2::OnAccountDelete, this);
|
||||
|
||||
if (NetworkConfig::XMLExists()) {
|
||||
wxString choices[] = { _("Nintendo"), _("Pretendo"), _("Custom") };
|
||||
m_active_service= new wxRadioBox(online_panel, wxID_ANY, _("Network Service"), wxDefaultPosition, wxDefaultSize, std::size(choices), choices, 3, wxRA_SPECIFY_COLS);
|
||||
}
|
||||
else {
|
||||
wxString choices[] = { _("Nintendo"), _("Pretendo") };
|
||||
m_active_service= new wxRadioBox(online_panel, wxID_ANY, _("Network Service"), wxDefaultPosition, wxDefaultSize, std::size(choices), choices, 2, wxRA_SPECIFY_COLS);
|
||||
}
|
||||
m_active_service->SetToolTip(_("Connect to which Network Service"));
|
||||
m_active_service->Bind(wxEVT_RADIOBOX, &GeneralSettings2::OnAccountServiceChanged,this);
|
||||
content->Add(m_active_service, 0, wxEXPAND | wxALL, 5);
|
||||
|
||||
box_sizer->Add(content, 1, wxEXPAND, 5);
|
||||
|
||||
online_panel_sizer->Add(box_sizer, 0, wxEXPAND | wxALL, 5);
|
||||
@ -613,6 +626,7 @@ wxPanel* GeneralSettings2::AddAccountPage(wxNotebook* notebook)
|
||||
m_active_account->Enable(false);
|
||||
m_create_account->Enable(false);
|
||||
m_delete_account->Enable(false);
|
||||
m_active_service->Enable(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -919,6 +933,7 @@ void GeneralSettings2::StoreConfig()
|
||||
config.account.m_persistent_id = dynamic_cast<wxAccountData*>(m_active_account->GetClientObject(active_account))->GetAccount().GetPersistentId();
|
||||
|
||||
config.account.online_enabled = m_online_enabled->GetValue();
|
||||
config.account.active_service = m_active_service->GetSelection();
|
||||
|
||||
// debug
|
||||
config.crash_dump = (CrashDump)m_crash_dump->GetSelection();
|
||||
@ -1488,6 +1503,7 @@ void GeneralSettings2::ApplyConfig()
|
||||
}
|
||||
|
||||
m_online_enabled->SetValue(config.account.online_enabled);
|
||||
m_active_service->SetSelection(config.account.active_service);
|
||||
UpdateAccountInformation();
|
||||
|
||||
// debug
|
||||
@ -1722,6 +1738,13 @@ void GeneralSettings2::OnActiveAccountChanged(wxCommandEvent& event)
|
||||
m_has_account_change = true;
|
||||
}
|
||||
|
||||
void GeneralSettings2::OnAccountServiceChanged(wxCommandEvent& event)
|
||||
{
|
||||
LaunchSettings::ChangeNetworkServiceURL(m_active_service->GetSelection());
|
||||
|
||||
UpdateAccountInformation();
|
||||
}
|
||||
|
||||
void GeneralSettings2::OnMLCPathSelect(wxCommandEvent& event)
|
||||
{
|
||||
if (!CemuApp::SelectMLCPath(this))
|
||||
|
@ -65,6 +65,7 @@ private:
|
||||
// Account
|
||||
wxButton* m_create_account, * m_delete_account;
|
||||
wxChoice* m_active_account;
|
||||
wxRadioBox* m_active_service;
|
||||
wxCheckBox* m_online_enabled;
|
||||
wxCollapsiblePane* m_account_information;
|
||||
wxPropertyGrid* m_account_grid;
|
||||
@ -93,6 +94,7 @@ private:
|
||||
void OnMLCPathChar(wxKeyEvent& event);
|
||||
void OnShowOnlineValidator(wxCommandEvent& event);
|
||||
void OnOnlineEnable(wxCommandEvent& event);
|
||||
void OnAccountServiceChanged(wxCommandEvent& event);
|
||||
|
||||
// updates cemu audio devices
|
||||
void UpdateAudioDevice();
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "gui/debugger/DebuggerWindow2.h"
|
||||
#include "Cafe/HW/Latte/Core/Latte.h"
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "config/NetworkSettings.h"
|
||||
#include "config/CemuConfig.h"
|
||||
#include "Cafe/HW/Latte/Renderer/Renderer.h"
|
||||
#include "Cafe/CafeSystem.h"
|
||||
@ -96,9 +97,18 @@ void gui_updateWindowTitles(bool isIdle, bool isLoading, double fps)
|
||||
const uint64 titleId = CafeSystem::GetForegroundTitleId();
|
||||
windowText.append(fmt::format(" - FPS: {:.2f} {} {} [TitleId: {:08x}-{:08x}]", (double)fps, renderer, graphicMode, (uint32)(titleId >> 32), (uint32)(titleId & 0xFFFFFFFF)));
|
||||
|
||||
if (ActiveSettings::IsOnlineEnabled())
|
||||
if (ActiveSettings::IsOnlineEnabled()){
|
||||
windowText.append(" [Online]");
|
||||
|
||||
if (ActiveSettings::GetNetworkService() == NetworkService::Nintendo) {
|
||||
windowText.append("[Nintendo]");
|
||||
}
|
||||
else if (ActiveSettings::GetNetworkService() == NetworkService::Pretendo) {
|
||||
windowText.append("[Pretendo]");
|
||||
}
|
||||
else if (ActiveSettings::GetNetworkService() == NetworkService::Custom) {
|
||||
windowText.append("[" + GetNetworkConfig().networkname.GetValue() + "]");
|
||||
}
|
||||
}
|
||||
windowText.append(" ");
|
||||
windowText.append(CafeSystem::GetForegroundTitleName());
|
||||
// append region
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "Cafe/GameProfile/GameProfile.h"
|
||||
#include "Cafe/GraphicPack/GraphicPack2.h"
|
||||
#include "config/CemuConfig.h"
|
||||
#include "config/NetworkSettings.h"
|
||||
#include "gui/CemuApp.h"
|
||||
#include "Cafe/HW/Latte/Core/LatteOverlay.h"
|
||||
#include "config/LaunchSettings.h"
|
||||
@ -216,6 +217,8 @@ void mainEmulatorCommonInit()
|
||||
ExceptionHandler_init();
|
||||
// read config
|
||||
g_config.Load();
|
||||
if (NetworkConfig::XMLExists())
|
||||
n_config.Load();
|
||||
// symbol storage
|
||||
rplSymbolStorage_init();
|
||||
// static initialization
|
||||
@ -345,6 +348,7 @@ int wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ L
|
||||
if (!LaunchSettings::HandleCommandline(lpCmdLine))
|
||||
return 0;
|
||||
ActiveSettings::LoadOnce();
|
||||
NetworkConfig::LoadOnce();
|
||||
HandlePostUpdate();
|
||||
return mainEmulatorHLE();
|
||||
}
|
||||
@ -356,6 +360,7 @@ int main(int argc, char* argv[])
|
||||
if (!LaunchSettings::HandleCommandline(argc, argv))
|
||||
return 0;
|
||||
ActiveSettings::LoadOnce();
|
||||
NetworkConfig::LoadOnce();
|
||||
HandlePostUpdate();
|
||||
return mainEmulatorHLE();
|
||||
}
|
||||
@ -371,7 +376,7 @@ int main(int argc, char *argv[])
|
||||
return 0;
|
||||
|
||||
ActiveSettings::LoadOnce();
|
||||
|
||||
NetworkConfig::LoadOnce();
|
||||
HandlePostUpdate();
|
||||
return mainEmulatorHLE();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user