From e524a6c16d8a96abc096d466e3fdc50805ca8041 Mon Sep 17 00:00:00 2001 From: tastymeatball <44088711+tastymeatball@users.noreply.github.com> Date: Fri, 26 Aug 2022 17:04:46 +0200 Subject: [PATCH] Add Rudimentray Proxy Support (#68) * Add Rudimentray Proxy Support to NAPI --- src/Cemu/napi/napi_helper.cpp | 12 +++++++++++- src/config/CemuConfig.cpp | 4 +++- src/config/CemuConfig.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Cemu/napi/napi_helper.cpp b/src/Cemu/napi/napi_helper.cpp index 2f96567d..188c8840 100644 --- a/src/Cemu/napi/napi_helper.cpp +++ b/src/Cemu/napi/napi_helper.cpp @@ -73,6 +73,11 @@ CurlRequestHelper::CurlRequestHelper() curl_easy_setopt(m_curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(m_curl, CURLOPT_MAXREDIRS, 2); + + if(GetConfig().proxy_server.GetValue() != "") + { + curl_easy_setopt(m_curl, CURLOPT_PROXY, GetConfig().proxy_server.GetValue().c_str()); + } } CurlRequestHelper::~CurlRequestHelper() @@ -216,6 +221,11 @@ CurlSOAPHelper::CurlSOAPHelper() // 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()); + } } CurlSOAPHelper::~CurlSOAPHelper() @@ -390,4 +400,4 @@ namespace NAPI result.apiError = NAPI_RESULT::SUCCESS; return true; } -}; \ No newline at end of file +}; diff --git a/src/config/CemuConfig.cpp b/src/config/CemuConfig.cpp index c4280893..0cbd3c97 100644 --- a/src/config/CemuConfig.cpp +++ b/src/config/CemuConfig.cpp @@ -65,6 +65,7 @@ void CemuConfig::Load(XMLConfigParser& parser) did_show_vulkan_warning = parser.get("vk_warning", did_show_vulkan_warning); did_show_graphic_pack_download = parser.get("gp_download", did_show_graphic_pack_download); fullscreen = parser.get("fullscreen", fullscreen); + proxy_server = parser.get("proxy_server", ""); // cpu_mode = parser.get("cpu_mode", cpu_mode.GetInitValue()); //console_region = parser.get("console_region", console_region.GetInitValue()); @@ -340,6 +341,7 @@ void CemuConfig::Save(XMLConfigParser& parser) config.set("vk_warning", did_show_vulkan_warning); config.set("gp_download", did_show_graphic_pack_download); config.set("fullscreen", fullscreen); + config.set("proxy_server", proxy_server.GetValue().c_str()); // config.set("cpu_mode", cpu_mode.GetValue()); //config.set("console_region", console_region.GetValue()); @@ -576,4 +578,4 @@ void CemuConfig::AddRecentNfcFile(std::wstring_view file) // keep maximum of entries while (recent_nfc_files.size() > kMaxRecentEntries) recent_nfc_files.pop_back(); -} \ No newline at end of file +} diff --git a/src/config/CemuConfig.h b/src/config/CemuConfig.h index 247a0a83..8c43f0a5 100644 --- a/src/config/CemuConfig.h +++ b/src/config/CemuConfig.h @@ -331,6 +331,7 @@ struct CemuConfig ConfigValue mlc_path {}; ConfigValue fullscreen_menubar{ false }; ConfigValue fullscreen{ false }; + ConfigValue proxy_server{}; std::vector game_paths; std::mutex game_cache_entries_mutex;