diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index dfc45e0af..e04b71783 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -341,6 +341,10 @@ if (USE_DISCORD_PRESENCE) target_compile_definitions(citra-qt PRIVATE -DUSE_DISCORD_PRESENCE) endif() +if (ENABLE_WEB_SERVICE) + target_link_libraries(citra-qt PRIVATE web_service) +endif() + if(UNIX AND NOT APPLE) install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") endif() diff --git a/src/citra_qt/configuration/configure_system.cpp b/src/citra_qt/configuration/configure_system.cpp index 0a5c14a84..e63f5399e 100644 --- a/src/citra_qt/configuration/configure_system.cpp +++ b/src/citra_qt/configuration/configure_system.cpp @@ -551,7 +551,6 @@ void ConfigureSystem::SetupPerGameUI() { } void ConfigureSystem::DownloadFromNUS() { -#ifdef ENABLE_WEB_SERVICE ui->button_start_download->setEnabled(false); const auto mode = @@ -590,5 +589,4 @@ void ConfigureSystem::DownloadFromNUS() { } ui->button_start_download->setEnabled(true); -#endif } diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 0a36a945b..b25a8c388 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -458,6 +458,8 @@ add_library(citra_core STATIC mmio.h movie.cpp movie.h + nus_download.cpp + nus_download.h perf_stats.cpp perf_stats.h precompiled_headers.h diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 855deebd6..8a7939ea1 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -31,9 +31,7 @@ #include "core/hle/service/fs/fs_user.h" #include "core/loader/loader.h" #include "core/loader/smdh.h" -#ifdef ENABLE_WEB_SERVICE -#include "web_service/nus_download.h" -#endif +#include "core/nus_download.h" namespace Service::AM { @@ -463,7 +461,6 @@ InstallStatus InstallCIA(const std::string& path, } InstallStatus InstallFromNus(u64 title_id, int version) { -#ifdef ENABLE_WEB_SERVICE LOG_DEBUG(Service_AM, "Downloading {:X}", title_id); CIAFile install_file{GetTitleMediaType(title_id)}; @@ -472,7 +469,7 @@ InstallStatus InstallFromNus(u64 title_id, int version) { if (version != -1) { path += fmt::format(".{}", version); } - auto tmd_response = WebService::NUS::Download(path); + auto tmd_response = Core::NUS::Download(path); if (!tmd_response) { LOG_ERROR(Service_AM, "Failed to download tmd for {:016X}", title_id); return InstallStatus::ErrorFileNotFound; @@ -481,7 +478,7 @@ InstallStatus InstallFromNus(u64 title_id, int version) { tmd.Load(*tmd_response); path = fmt::format("/ccs/download/{:016X}/cetk", title_id); - auto cetk_response = WebService::NUS::Download(path); + auto cetk_response = Core::NUS::Download(path); if (!cetk_response) { LOG_ERROR(Service_AM, "Failed to download cetk for {:016X}", title_id); return InstallStatus::ErrorFileNotFound; @@ -492,7 +489,7 @@ InstallStatus InstallFromNus(u64 title_id, int version) { for (std::size_t i = 0; i < content_count; ++i) { const std::string filename = fmt::format("{:08x}", tmd.GetContentIDByIndex(i)); path = fmt::format("/ccs/download/{:016X}/{}", title_id, filename); - const auto temp_response = WebService::NUS::Download(path); + const auto temp_response = Core::NUS::Download(path); if (!temp_response) { LOG_ERROR(Service_AM, "Failed to download content for {:016X}", title_id); return InstallStatus::ErrorFileNotFound; @@ -550,9 +547,6 @@ InstallStatus InstallFromNus(u64 title_id, int version) { return result; } return InstallStatus::Success; -#else - return InstallStatus::ErrorFileNotFound; -#endif } u64 GetTitleUpdateId(u64 title_id) { diff --git a/src/web_service/nus_download.cpp b/src/core/nus_download.cpp similarity index 93% rename from src/web_service/nus_download.cpp rename to src/core/nus_download.cpp index af7a068a6..d9d79ae2b 100644 --- a/src/web_service/nus_download.cpp +++ b/src/core/nus_download.cpp @@ -5,9 +5,9 @@ #include #include #include "common/logging/log.h" -#include "web_service/nus_download.h" +#include "core/nus_download.h" -namespace WebService::NUS { +namespace Core::NUS { std::optional> Download(const std::string& path) { constexpr auto HOST = "http://nus.cdn.c.shop.nintendowifi.net"; @@ -46,4 +46,4 @@ std::optional> Download(const std::string& path) { return std::vector(response.body.begin(), response.body.end()); } -} // namespace WebService::NUS +} // namespace Core::NUS diff --git a/src/web_service/nus_download.h b/src/core/nus_download.h similarity index 85% rename from src/web_service/nus_download.h rename to src/core/nus_download.h index 34633b767..8953906bf 100644 --- a/src/web_service/nus_download.h +++ b/src/core/nus_download.h @@ -8,8 +8,8 @@ #include #include "common/common_types.h" -namespace WebService::NUS { +namespace Core::NUS { std::optional> Download(const std::string& path); -} +} // namespace Core::NUS diff --git a/src/web_service/CMakeLists.txt b/src/web_service/CMakeLists.txt index 653985229..feb158b68 100644 --- a/src/web_service/CMakeLists.txt +++ b/src/web_service/CMakeLists.txt @@ -1,8 +1,6 @@ add_library(web_service STATIC announce_room_json.cpp announce_room_json.h - nus_download.cpp - nus_download.h precompiled_headers.h telemetry_json.cpp telemetry_json.h