mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-15 07:10:05 +00:00
ns: rewrite IContentManagementInterface
This commit is contained in:
parent
8ea72cc99d
commit
04887953ff
@ -743,6 +743,8 @@ add_library(core STATIC
|
|||||||
hle/service/ns/account_proxy_interface.h
|
hle/service/ns/account_proxy_interface.h
|
||||||
hle/service/ns/application_version_interface.cpp
|
hle/service/ns/application_version_interface.cpp
|
||||||
hle/service/ns/application_version_interface.h
|
hle/service/ns/application_version_interface.h
|
||||||
|
hle/service/ns/content_management_interface.cpp
|
||||||
|
hle/service/ns/content_management_interface.h
|
||||||
hle/service/ns/ecommerce_interface.cpp
|
hle/service/ns/ecommerce_interface.cpp
|
||||||
hle/service/ns/ecommerce_interface.h
|
hle/service/ns/ecommerce_interface.h
|
||||||
hle/service/ns/factory_reset_interface.cpp
|
hle/service/ns/factory_reset_interface.cpp
|
||||||
|
72
src/core/hle/service/ns/content_management_interface.cpp
Normal file
72
src/core/hle/service/ns/content_management_interface.cpp
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "common/common_funcs.h"
|
||||||
|
#include "core/core.h"
|
||||||
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
#include "core/hle/service/filesystem/filesystem.h"
|
||||||
|
#include "core/hle/service/ns/content_management_interface.h"
|
||||||
|
#include "core/hle/service/ns/ns_types.h"
|
||||||
|
|
||||||
|
namespace Service::NS {
|
||||||
|
|
||||||
|
IContentManagementInterface::IContentManagementInterface(Core::System& system_)
|
||||||
|
: ServiceFramework{system_, "IContentManagementInterface"} {
|
||||||
|
// clang-format off
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{11, D<&IContentManagementInterface::CalculateApplicationOccupiedSize>, "CalculateApplicationOccupiedSize"},
|
||||||
|
{43, D<&IContentManagementInterface::CheckSdCardMountStatus>, "CheckSdCardMountStatus"},
|
||||||
|
{47, D<&IContentManagementInterface::GetTotalSpaceSize>, "GetTotalSpaceSize"},
|
||||||
|
{48, D<&IContentManagementInterface::GetFreeSpaceSize>, "GetFreeSpaceSize"},
|
||||||
|
{600, nullptr, "CountApplicationContentMeta"},
|
||||||
|
{601, nullptr, "ListApplicationContentMetaStatus"},
|
||||||
|
{605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"},
|
||||||
|
{607, nullptr, "IsAnyApplicationRunning"},
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
IContentManagementInterface::~IContentManagementInterface() = default;
|
||||||
|
|
||||||
|
Result IContentManagementInterface::CalculateApplicationOccupiedSize(
|
||||||
|
Out<ApplicationOccupiedSize> out_size, u64 application_id) {
|
||||||
|
LOG_WARNING(Service_NS, "(STUBBED) called, application_id={:016X}", application_id);
|
||||||
|
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
|
constexpr ApplicationOccupiedSizeEntity stub_entity{
|
||||||
|
.storage_id = FileSys::StorageId::SdCard,
|
||||||
|
.app_size = 8_GiB,
|
||||||
|
.patch_size = 2_GiB,
|
||||||
|
.aoc_size = 12_MiB,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (auto& entity : out_size->entities) {
|
||||||
|
entity = stub_entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IContentManagementInterface::CheckSdCardMountStatus() {
|
||||||
|
LOG_WARNING(Service_NS, "(STUBBED) called");
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IContentManagementInterface::GetTotalSpaceSize(Out<s64> out_total_space_size,
|
||||||
|
FileSys::StorageId storage_id) {
|
||||||
|
LOG_INFO(Service_NS, "(STUBBED) called, storage_id={}", storage_id);
|
||||||
|
*out_total_space_size = system.GetFileSystemController().GetTotalSpaceSize(storage_id);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IContentManagementInterface::GetFreeSpaceSize(Out<s64> out_free_space_size,
|
||||||
|
FileSys::StorageId storage_id) {
|
||||||
|
LOG_INFO(Service_NS, "(STUBBED) called, storage_id={}", storage_id);
|
||||||
|
*out_free_space_size = system.GetFileSystemController().GetFreeSpaceSize(storage_id);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::NS
|
25
src/core/hle/service/ns/content_management_interface.h
Normal file
25
src/core/hle/service/ns/content_management_interface.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/hle/service/cmif_types.h"
|
||||||
|
#include "core/hle/service/ns/ns_types.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
namespace Service::NS {
|
||||||
|
|
||||||
|
class IContentManagementInterface final : public ServiceFramework<IContentManagementInterface> {
|
||||||
|
public:
|
||||||
|
explicit IContentManagementInterface(Core::System& system_);
|
||||||
|
~IContentManagementInterface() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Result CalculateApplicationOccupiedSize(Out<ApplicationOccupiedSize> out_size,
|
||||||
|
u64 application_id);
|
||||||
|
Result CheckSdCardMountStatus();
|
||||||
|
Result GetTotalSpaceSize(Out<s64> out_total_space_size, FileSys::StorageId storage_id);
|
||||||
|
Result GetFreeSpaceSize(Out<s64> out_free_space_size, FileSys::StorageId storage_id);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::NS
|
@ -13,6 +13,7 @@
|
|||||||
#include "core/hle/service/ipc_helpers.h"
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
#include "core/hle/service/ns/account_proxy_interface.h"
|
#include "core/hle/service/ns/account_proxy_interface.h"
|
||||||
#include "core/hle/service/ns/application_version_interface.h"
|
#include "core/hle/service/ns/application_version_interface.h"
|
||||||
|
#include "core/hle/service/ns/content_management_interface.h"
|
||||||
#include "core/hle/service/ns/ecommerce_interface.h"
|
#include "core/hle/service/ns/ecommerce_interface.h"
|
||||||
#include "core/hle/service/ns/factory_reset_interface.h"
|
#include "core/hle/service/ns/factory_reset_interface.h"
|
||||||
#include "core/hle/service/ns/language.h"
|
#include "core/hle/service/ns/language.h"
|
||||||
@ -464,48 +465,6 @@ Result IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode(
|
|||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
IContentManagementInterface::IContentManagementInterface(Core::System& system_)
|
|
||||||
: ServiceFramework{system_, "IContentManagementInterface"} {
|
|
||||||
// clang-format off
|
|
||||||
static const FunctionInfo functions[] = {
|
|
||||||
{11, nullptr, "CalculateApplicationOccupiedSize"},
|
|
||||||
{43, nullptr, "CheckSdCardMountStatus"},
|
|
||||||
{47, &IContentManagementInterface::GetTotalSpaceSize, "GetTotalSpaceSize"},
|
|
||||||
{48, &IContentManagementInterface::GetFreeSpaceSize, "GetFreeSpaceSize"},
|
|
||||||
{600, nullptr, "CountApplicationContentMeta"},
|
|
||||||
{601, nullptr, "ListApplicationContentMetaStatus"},
|
|
||||||
{605, nullptr, "ListApplicationContentMetaStatusWithRightsCheck"},
|
|
||||||
{607, nullptr, "IsAnyApplicationRunning"},
|
|
||||||
};
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
RegisterHandlers(functions);
|
|
||||||
}
|
|
||||||
|
|
||||||
IContentManagementInterface::~IContentManagementInterface() = default;
|
|
||||||
|
|
||||||
void IContentManagementInterface::GetTotalSpaceSize(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
const auto storage{rp.PopEnum<FileSys::StorageId>()};
|
|
||||||
|
|
||||||
LOG_INFO(Service_Capture, "called, storage={}", storage);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.Push<u64>(system.GetFileSystemController().GetTotalSpaceSize(storage));
|
|
||||||
}
|
|
||||||
|
|
||||||
void IContentManagementInterface::GetFreeSpaceSize(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
const auto storage{rp.PopEnum<FileSys::StorageId>()};
|
|
||||||
|
|
||||||
LOG_INFO(Service_Capture, "called, storage={}", storage);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.Push<u64>(system.GetFileSystemController().GetFreeSpaceSize(storage));
|
|
||||||
}
|
|
||||||
|
|
||||||
IDocumentInterface::IDocumentInterface(Core::System& system_)
|
IDocumentInterface::IDocumentInterface(Core::System& system_)
|
||||||
: ServiceFramework{system_, "IDocumentInterface"} {
|
: ServiceFramework{system_, "IDocumentInterface"} {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
@ -32,16 +32,6 @@ private:
|
|||||||
void ConvertApplicationLanguageToLanguageCode(HLERequestContext& ctx);
|
void ConvertApplicationLanguageToLanguageCode(HLERequestContext& ctx);
|
||||||
};
|
};
|
||||||
|
|
||||||
class IContentManagementInterface final : public ServiceFramework<IContentManagementInterface> {
|
|
||||||
public:
|
|
||||||
explicit IContentManagementInterface(Core::System& system_);
|
|
||||||
~IContentManagementInterface() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void GetTotalSpaceSize(HLERequestContext& ctx);
|
|
||||||
void GetFreeSpaceSize(HLERequestContext& ctx);
|
|
||||||
};
|
|
||||||
|
|
||||||
class IDocumentInterface final : public ServiceFramework<IDocumentInterface> {
|
class IDocumentInterface final : public ServiceFramework<IDocumentInterface> {
|
||||||
public:
|
public:
|
||||||
explicit IDocumentInterface(Core::System& system_);
|
explicit IDocumentInterface(Core::System& system_);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
|
#include "core/file_sys/romfs_factory.h"
|
||||||
|
|
||||||
namespace Service::NS {
|
namespace Service::NS {
|
||||||
|
|
||||||
@ -59,4 +60,17 @@ struct ApplicationViewWithPromotionInfo {
|
|||||||
PromotionInfo promotion; ///< \ref NsPromotionInfo
|
PromotionInfo promotion; ///< \ref NsPromotionInfo
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ApplicationOccupiedSizeEntity {
|
||||||
|
FileSys::StorageId storage_id;
|
||||||
|
u64 app_size;
|
||||||
|
u64 patch_size;
|
||||||
|
u64 aoc_size;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(ApplicationOccupiedSizeEntity) == 0x20,
|
||||||
|
"ApplicationOccupiedSizeEntity has incorrect size.");
|
||||||
|
|
||||||
|
struct ApplicationOccupiedSize {
|
||||||
|
std::array<ApplicationOccupiedSizeEntity, 4> entities;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Service::NS
|
} // namespace Service::NS
|
||||||
|
Loading…
Reference in New Issue
Block a user