From b1844a87531d6ef6d494b41297240892cd184998 Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Fri, 2 Sep 2022 09:14:55 +0200 Subject: [PATCH] Fix online for NA console logins (#147) This is just a quick fix. In the future we can look into avoiding hardcoded firmware version numbers. On the console it gets read from some system file --- src/Cemu/napi/napi_act.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Cemu/napi/napi_act.cpp b/src/Cemu/napi/napi_act.cpp index 9638dbba..b9a9c16c 100644 --- a/src/Cemu/napi/napi_act.cpp +++ b/src/Cemu/napi/napi_act.cpp @@ -61,7 +61,7 @@ namespace NAPI return true; } - void _ACTSetCommonHeaderParameters(CurlRequestHelper& req) + void _ACTSetCommonHeaderParameters(CurlRequestHelper& req, AuthInfo& authInfo) { req.addHeaderField("X-Nintendo-Platform-ID", "1"); req.addHeaderField("X-Nintendo-Device-Type", "2"); @@ -71,7 +71,10 @@ namespace NAPI req.addHeaderField("Accept", "*/*"); - req.addHeaderField("X-Nintendo-System-Version", "0260"); + if(authInfo.region == CafeConsoleRegion::USA) + req.addHeaderField("X-Nintendo-System-Version", "0270"); + else + req.addHeaderField("X-Nintendo-System-Version", "0260"); } void _ACTSetDeviceParameters(CurlRequestHelper& req, AuthInfo& authInfo) @@ -143,7 +146,7 @@ namespace NAPI CurlRequestHelper req; req.initate(fmt::format("{}/v1/api/oauth20/access_token/generate", LaunchSettings::GetActURLPrefix()), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT); - _ACTSetCommonHeaderParameters(req); + _ACTSetCommonHeaderParameters(req, authInfo); _ACTSetDeviceParameters(req, authInfo); _ACTSetRegionAndCountryParameters(req, authInfo); req.addHeaderField("X-Nintendo-Device-Cert", authInfo.deviceCertBase64); @@ -229,7 +232,7 @@ namespace NAPI req.initate(fmt::format("{}/v1/api/people/@me/profile", LaunchSettings::GetActURLPrefix()), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT); - _ACTSetCommonHeaderParameters(req); + _ACTSetCommonHeaderParameters(req, authInfo); _ACTSetDeviceParameters(req, authInfo); // get oauth2 token @@ -295,7 +298,7 @@ namespace NAPI // do request CurlRequestHelper req; req.initate(fmt::format("{}/v1/api/provider/nex_token/@me?game_server_id={:08X}", LaunchSettings::GetActURLPrefix(), serverId), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT); - _ACTSetCommonHeaderParameters(req); + _ACTSetCommonHeaderParameters(req, authInfo); _ACTSetDeviceParameters(req, authInfo); _ACTSetRegionAndCountryParameters(req, authInfo); req.addHeaderField("X-Nintendo-FPD-Version", "0000"); @@ -448,7 +451,7 @@ namespace NAPI // do request CurlRequestHelper req; req.initate(fmt::format("{}/v1/api/provider/service_token/@me?client_id={}", LaunchSettings::GetActURLPrefix(), clientId), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT); - _ACTSetCommonHeaderParameters(req); + _ACTSetCommonHeaderParameters(req, authInfo); _ACTSetDeviceParameters(req, authInfo); _ACTSetRegionAndCountryParameters(req, authInfo); req.addHeaderField("X-Nintendo-FPD-Version", "0000"); @@ -519,7 +522,7 @@ namespace NAPI // do request CurlRequestHelper req; req.initate(fmt::format("{}/v1/api/admin/mapped_ids?input_type=user_id&output_type=pid&input={}", LaunchSettings::GetActURLPrefix(), nnid), CurlRequestHelper::SERVER_SSL_CONTEXT::ACT); - _ACTSetCommonHeaderParameters(req); + _ACTSetCommonHeaderParameters(req, authInfo); _ACTSetDeviceParameters(req, authInfo); _ACTSetRegionAndCountryParameters(req, authInfo); req.addHeaderField("X-Nintendo-FPD-Version", "0000");