build: Fix web service functionality. (#6903)
This commit is contained in:
parent
6ddf4b241f
commit
b2092de871
7 changed files with 15 additions and 19 deletions
|
@ -341,6 +341,10 @@ if (USE_DISCORD_PRESENCE)
|
||||||
target_compile_definitions(citra-qt PRIVATE -DUSE_DISCORD_PRESENCE)
|
target_compile_definitions(citra-qt PRIVATE -DUSE_DISCORD_PRESENCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_WEB_SERVICE)
|
||||||
|
target_link_libraries(citra-qt PRIVATE web_service)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -551,7 +551,6 @@ void ConfigureSystem::SetupPerGameUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureSystem::DownloadFromNUS() {
|
void ConfigureSystem::DownloadFromNUS() {
|
||||||
#ifdef ENABLE_WEB_SERVICE
|
|
||||||
ui->button_start_download->setEnabled(false);
|
ui->button_start_download->setEnabled(false);
|
||||||
|
|
||||||
const auto mode =
|
const auto mode =
|
||||||
|
@ -590,5 +589,4 @@ void ConfigureSystem::DownloadFromNUS() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->button_start_download->setEnabled(true);
|
ui->button_start_download->setEnabled(true);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -458,6 +458,8 @@ add_library(citra_core STATIC
|
||||||
mmio.h
|
mmio.h
|
||||||
movie.cpp
|
movie.cpp
|
||||||
movie.h
|
movie.h
|
||||||
|
nus_download.cpp
|
||||||
|
nus_download.h
|
||||||
perf_stats.cpp
|
perf_stats.cpp
|
||||||
perf_stats.h
|
perf_stats.h
|
||||||
precompiled_headers.h
|
precompiled_headers.h
|
||||||
|
|
|
@ -31,9 +31,7 @@
|
||||||
#include "core/hle/service/fs/fs_user.h"
|
#include "core/hle/service/fs/fs_user.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
#include "core/loader/smdh.h"
|
#include "core/loader/smdh.h"
|
||||||
#ifdef ENABLE_WEB_SERVICE
|
#include "core/nus_download.h"
|
||||||
#include "web_service/nus_download.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
|
@ -463,7 +461,6 @@ InstallStatus InstallCIA(const std::string& path,
|
||||||
}
|
}
|
||||||
|
|
||||||
InstallStatus InstallFromNus(u64 title_id, int version) {
|
InstallStatus InstallFromNus(u64 title_id, int version) {
|
||||||
#ifdef ENABLE_WEB_SERVICE
|
|
||||||
LOG_DEBUG(Service_AM, "Downloading {:X}", title_id);
|
LOG_DEBUG(Service_AM, "Downloading {:X}", title_id);
|
||||||
|
|
||||||
CIAFile install_file{GetTitleMediaType(title_id)};
|
CIAFile install_file{GetTitleMediaType(title_id)};
|
||||||
|
@ -472,7 +469,7 @@ InstallStatus InstallFromNus(u64 title_id, int version) {
|
||||||
if (version != -1) {
|
if (version != -1) {
|
||||||
path += fmt::format(".{}", version);
|
path += fmt::format(".{}", version);
|
||||||
}
|
}
|
||||||
auto tmd_response = WebService::NUS::Download(path);
|
auto tmd_response = Core::NUS::Download(path);
|
||||||
if (!tmd_response) {
|
if (!tmd_response) {
|
||||||
LOG_ERROR(Service_AM, "Failed to download tmd for {:016X}", title_id);
|
LOG_ERROR(Service_AM, "Failed to download tmd for {:016X}", title_id);
|
||||||
return InstallStatus::ErrorFileNotFound;
|
return InstallStatus::ErrorFileNotFound;
|
||||||
|
@ -481,7 +478,7 @@ InstallStatus InstallFromNus(u64 title_id, int version) {
|
||||||
tmd.Load(*tmd_response);
|
tmd.Load(*tmd_response);
|
||||||
|
|
||||||
path = fmt::format("/ccs/download/{:016X}/cetk", title_id);
|
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) {
|
if (!cetk_response) {
|
||||||
LOG_ERROR(Service_AM, "Failed to download cetk for {:016X}", title_id);
|
LOG_ERROR(Service_AM, "Failed to download cetk for {:016X}", title_id);
|
||||||
return InstallStatus::ErrorFileNotFound;
|
return InstallStatus::ErrorFileNotFound;
|
||||||
|
@ -492,7 +489,7 @@ InstallStatus InstallFromNus(u64 title_id, int version) {
|
||||||
for (std::size_t i = 0; i < content_count; ++i) {
|
for (std::size_t i = 0; i < content_count; ++i) {
|
||||||
const std::string filename = fmt::format("{:08x}", tmd.GetContentIDByIndex(i));
|
const std::string filename = fmt::format("{:08x}", tmd.GetContentIDByIndex(i));
|
||||||
path = fmt::format("/ccs/download/{:016X}/{}", title_id, filename);
|
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) {
|
if (!temp_response) {
|
||||||
LOG_ERROR(Service_AM, "Failed to download content for {:016X}", title_id);
|
LOG_ERROR(Service_AM, "Failed to download content for {:016X}", title_id);
|
||||||
return InstallStatus::ErrorFileNotFound;
|
return InstallStatus::ErrorFileNotFound;
|
||||||
|
@ -550,9 +547,6 @@ InstallStatus InstallFromNus(u64 title_id, int version) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return InstallStatus::Success;
|
return InstallStatus::Success;
|
||||||
#else
|
|
||||||
return InstallStatus::ErrorFileNotFound;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 GetTitleUpdateId(u64 title_id) {
|
u64 GetTitleUpdateId(u64 title_id) {
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <httplib.h>
|
#include <httplib.h>
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "web_service/nus_download.h"
|
#include "core/nus_download.h"
|
||||||
|
|
||||||
namespace WebService::NUS {
|
namespace Core::NUS {
|
||||||
|
|
||||||
std::optional<std::vector<u8>> Download(const std::string& path) {
|
std::optional<std::vector<u8>> Download(const std::string& path) {
|
||||||
constexpr auto HOST = "http://nus.cdn.c.shop.nintendowifi.net";
|
constexpr auto HOST = "http://nus.cdn.c.shop.nintendowifi.net";
|
||||||
|
@ -46,4 +46,4 @@ std::optional<std::vector<u8>> Download(const std::string& path) {
|
||||||
return std::vector<u8>(response.body.begin(), response.body.end());
|
return std::vector<u8>(response.body.begin(), response.body.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace WebService::NUS
|
} // namespace Core::NUS
|
|
@ -8,8 +8,8 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
namespace WebService::NUS {
|
namespace Core::NUS {
|
||||||
|
|
||||||
std::optional<std::vector<u8>> Download(const std::string& path);
|
std::optional<std::vector<u8>> Download(const std::string& path);
|
||||||
|
|
||||||
}
|
} // namespace Core::NUS
|
|
@ -1,8 +1,6 @@
|
||||||
add_library(web_service STATIC
|
add_library(web_service STATIC
|
||||||
announce_room_json.cpp
|
announce_room_json.cpp
|
||||||
announce_room_json.h
|
announce_room_json.h
|
||||||
nus_download.cpp
|
|
||||||
nus_download.h
|
|
||||||
precompiled_headers.h
|
precompiled_headers.h
|
||||||
telemetry_json.cpp
|
telemetry_json.cpp
|
||||||
telemetry_json.h
|
telemetry_json.h
|
||||||
|
|
Loading…
Reference in a new issue