summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/CMakeLists.txt8
-rw-r--r--src/core/file_sys/errors.h1
-rw-r--r--src/core/hle/service/bcat/bcat.cpp30
-rw-r--r--src/core/hle/service/bcat/bcat_result.h5
-rw-r--r--src/core/hle/service/bcat/bcat_service.cpp31
-rw-r--r--src/core/hle/service/bcat/bcat_service.h6
-rw-r--r--src/core/hle/service/bcat/bcat_types.h10
-rw-r--r--src/core/hle/service/bcat/delivery_cache_directory_service.cpp23
-rw-r--r--src/core/hle/service/bcat/delivery_cache_directory_service.h6
-rw-r--r--src/core/hle/service/bcat/delivery_cache_file_service.cpp11
-rw-r--r--src/core/hle/service/bcat/delivery_cache_file_service.h2
-rw-r--r--src/core/hle/service/bcat/delivery_cache_progress_service.cpp4
-rw-r--r--src/core/hle/service/bcat/delivery_cache_storage_service.cpp16
-rw-r--r--src/core/hle/service/bcat/delivery_cache_storage_service.h4
-rw-r--r--src/core/hle/service/bcat/news/newly_arrived_event_holder.cpp8
-rw-r--r--src/core/hle/service/bcat/news/newly_arrived_event_holder.h4
-rw-r--r--src/core/hle/service/bcat/news/news_data_service.cpp4
-rw-r--r--src/core/hle/service/bcat/news/news_data_service.h4
-rw-r--r--src/core/hle/service/bcat/news/news_database_service.cpp6
-rw-r--r--src/core/hle/service/bcat/news/news_database_service.h6
-rw-r--r--src/core/hle/service/bcat/news/news_service.cpp4
-rw-r--r--src/core/hle/service/bcat/news/news_service.h4
-rw-r--r--src/core/hle/service/bcat/news/overwrite_event_holder.cpp8
-rw-r--r--src/core/hle/service/bcat/news/overwrite_event_holder.h4
-rw-r--r--src/core/hle/service/bcat/news/service_creator.cpp (renamed from src/core/hle/service/bcat/news/news_interface.cpp)31
-rw-r--r--src/core/hle/service/bcat/news/service_creator.h (renamed from src/core/hle/service/bcat/news/news_interface.h)10
-rw-r--r--src/core/hle/service/bcat/service_creator.cpp (renamed from src/core/hle/service/bcat/bcat_interface.cpp)33
-rw-r--r--src/core/hle/service/bcat/service_creator.h (renamed from src/core/hle/service/bcat/bcat_interface.h)12
-rw-r--r--src/core/hle/service/service.cpp2
29 files changed, 153 insertions, 144 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 539e09894..c7157ff4c 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -518,16 +518,14 @@ add_library(core STATIC
518 hle/service/bcat/news/news_data_service.h 518 hle/service/bcat/news/news_data_service.h
519 hle/service/bcat/news/news_database_service.cpp 519 hle/service/bcat/news/news_database_service.cpp
520 hle/service/bcat/news/news_database_service.h 520 hle/service/bcat/news/news_database_service.h
521 hle/service/bcat/news/news_interface.cpp
522 hle/service/bcat/news/news_interface.h
523 hle/service/bcat/news/news_service.cpp 521 hle/service/bcat/news/news_service.cpp
524 hle/service/bcat/news/news_service.h 522 hle/service/bcat/news/news_service.h
525 hle/service/bcat/news/overwrite_event_holder.cpp 523 hle/service/bcat/news/overwrite_event_holder.cpp
526 hle/service/bcat/news/overwrite_event_holder.h 524 hle/service/bcat/news/overwrite_event_holder.h
525 hle/service/bcat/news/service_creator.cpp
526 hle/service/bcat/news/service_creator.h
527 hle/service/bcat/bcat.cpp 527 hle/service/bcat/bcat.cpp
528 hle/service/bcat/bcat.h 528 hle/service/bcat/bcat.h
529 hle/service/bcat/bcat_interface.cpp
530 hle/service/bcat/bcat_interface.h
531 hle/service/bcat/bcat_result.h 529 hle/service/bcat/bcat_result.h
532 hle/service/bcat/bcat_service.cpp 530 hle/service/bcat/bcat_service.cpp
533 hle/service/bcat/bcat_service.h 531 hle/service/bcat/bcat_service.h
@@ -541,6 +539,8 @@ add_library(core STATIC
541 hle/service/bcat/delivery_cache_progress_service.h 539 hle/service/bcat/delivery_cache_progress_service.h
542 hle/service/bcat/delivery_cache_storage_service.cpp 540 hle/service/bcat/delivery_cache_storage_service.cpp
543 hle/service/bcat/delivery_cache_storage_service.h 541 hle/service/bcat/delivery_cache_storage_service.h
542 hle/service/bcat/service_creator.cpp
543 hle/service/bcat/service_creator.h
544 hle/service/bpc/bpc.cpp 544 hle/service/bpc/bpc.cpp
545 hle/service/bpc/bpc.h 545 hle/service/bpc/bpc.h
546 hle/service/btdrv/btdrv.cpp 546 hle/service/btdrv/btdrv.cpp
diff --git a/src/core/file_sys/errors.h b/src/core/file_sys/errors.h
index d4e0eb6f4..b22767bf5 100644
--- a/src/core/file_sys/errors.h
+++ b/src/core/file_sys/errors.h
@@ -91,6 +91,7 @@ constexpr Result ResultWriteNotPermitted{ErrorModule::FS, 6203};
91constexpr Result ResultUnsupportedSetSizeForIndirectStorage{ErrorModule::FS, 6325}; 91constexpr Result ResultUnsupportedSetSizeForIndirectStorage{ErrorModule::FS, 6325};
92constexpr Result ResultUnsupportedWriteForCompressedStorage{ErrorModule::FS, 6387}; 92constexpr Result ResultUnsupportedWriteForCompressedStorage{ErrorModule::FS, 6387};
93constexpr Result ResultUnsupportedOperateRangeForCompressedStorage{ErrorModule::FS, 6388}; 93constexpr Result ResultUnsupportedOperateRangeForCompressedStorage{ErrorModule::FS, 6388};
94constexpr Result ResultPermissionDenied{ErrorModule::FS, 6400};
94constexpr Result ResultBufferAllocationFailed{ErrorModule::FS, 6705}; 95constexpr Result ResultBufferAllocationFailed{ErrorModule::FS, 6705};
95 96
96} // namespace FileSys 97} // namespace FileSys
diff --git a/src/core/hle/service/bcat/bcat.cpp b/src/core/hle/service/bcat/bcat.cpp
index 02995ddee..ea8b15998 100644
--- a/src/core/hle/service/bcat/bcat.cpp
+++ b/src/core/hle/service/bcat/bcat.cpp
@@ -3,8 +3,8 @@
3 3
4#include "core/hle/service/bcat/backend/backend.h" 4#include "core/hle/service/bcat/backend/backend.h"
5#include "core/hle/service/bcat/bcat.h" 5#include "core/hle/service/bcat/bcat.h"
6#include "core/hle/service/bcat/bcat_interface.h" 6#include "core/hle/service/bcat/news/service_creator.h"
7#include "core/hle/service/bcat/news/news_interface.h" 7#include "core/hle/service/bcat/service_creator.h"
8#include "core/hle/service/server_manager.h" 8#include "core/hle/service/server_manager.h"
9 9
10namespace Service::BCAT { 10namespace Service::BCAT {
@@ -13,24 +13,24 @@ void LoopProcess(Core::System& system) {
13 auto server_manager = std::make_unique<ServerManager>(system); 13 auto server_manager = std::make_unique<ServerManager>(system);
14 14
15 server_manager->RegisterNamedService("bcat:a", 15 server_manager->RegisterNamedService("bcat:a",
16 std::make_shared<BcatInterface>(system, "bcat:a")); 16 std::make_shared<IServiceCreator>(system, "bcat:a"));
17 server_manager->RegisterNamedService("bcat:m", 17 server_manager->RegisterNamedService("bcat:m",
18 std::make_shared<BcatInterface>(system, "bcat:m")); 18 std::make_shared<IServiceCreator>(system, "bcat:m"));
19 server_manager->RegisterNamedService("bcat:u", 19 server_manager->RegisterNamedService("bcat:u",
20 std::make_shared<BcatInterface>(system, "bcat:u")); 20 std::make_shared<IServiceCreator>(system, "bcat:u"));
21 server_manager->RegisterNamedService("bcat:s", 21 server_manager->RegisterNamedService("bcat:s",
22 std::make_shared<BcatInterface>(system, "bcat:s")); 22 std::make_shared<IServiceCreator>(system, "bcat:s"));
23 23
24 server_manager->RegisterNamedService( 24 server_manager->RegisterNamedService(
25 "news:a", std::make_shared<NewsInterface>(system, 0xffffffff, "news:a")); 25 "news:a", std::make_shared<News::IServiceCreator>(system, 0xffffffff, "news:a"));
26 server_manager->RegisterNamedService("news:p", 26 server_manager->RegisterNamedService(
27 std::make_shared<NewsInterface>(system, 0x1, "news:p")); 27 "news:p", std::make_shared<News::IServiceCreator>(system, 0x1, "news:p"));
28 server_manager->RegisterNamedService("news:c", 28 server_manager->RegisterNamedService(
29 std::make_shared<NewsInterface>(system, 0x2, "news:c")); 29 "news:c", std::make_shared<News::IServiceCreator>(system, 0x2, "news:c"));
30 server_manager->RegisterNamedService("news:v", 30 server_manager->RegisterNamedService(
31 std::make_shared<NewsInterface>(system, 0x4, "news:v")); 31 "news:v", std::make_shared<News::IServiceCreator>(system, 0x4, "news:v"));
32 server_manager->RegisterNamedService("news:m", 32 server_manager->RegisterNamedService(
33 std::make_shared<NewsInterface>(system, 0xd, "news:m")); 33 "news:m", std::make_shared<News::IServiceCreator>(system, 0xd, "news:m"));
34 34
35 ServerManager::RunServer(std::move(server_manager)); 35 ServerManager::RunServer(std::move(server_manager));
36} 36}
diff --git a/src/core/hle/service/bcat/bcat_result.h b/src/core/hle/service/bcat/bcat_result.h
index d711924b1..edf8a6564 100644
--- a/src/core/hle/service/bcat/bcat_result.h
+++ b/src/core/hle/service/bcat/bcat_result.h
@@ -12,9 +12,4 @@ constexpr Result ResultFailedOpenEntity{ErrorModule::BCAT, 2};
12constexpr Result ResultEntityAlreadyOpen{ErrorModule::BCAT, 6}; 12constexpr Result ResultEntityAlreadyOpen{ErrorModule::BCAT, 6};
13constexpr Result ResultNoOpenEntry{ErrorModule::BCAT, 7}; 13constexpr Result ResultNoOpenEntry{ErrorModule::BCAT, 7};
14 14
15// The command to clear the delivery cache just calls fs IFileSystem DeleteFile on all of the
16// files and if any of them have a non-zero result it just forwards that result. This is the FS
17// error code for permission denied, which is the closest approximation of this scenario.
18constexpr Result ResultFailedClearCache{ErrorModule::FS, 6400};
19
20} // namespace Service::BCAT 15} // namespace Service::BCAT
diff --git a/src/core/hle/service/bcat/bcat_service.cpp b/src/core/hle/service/bcat/bcat_service.cpp
index 2eacec3ae..63b1072d2 100644
--- a/src/core/hle/service/bcat/bcat_service.cpp
+++ b/src/core/hle/service/bcat/bcat_service.cpp
@@ -4,6 +4,7 @@
4#include "common/hex_util.h" 4#include "common/hex_util.h"
5#include "common/string_util.h" 5#include "common/string_util.h"
6#include "core/core.h" 6#include "core/core.h"
7#include "core/file_sys/errors.h"
7#include "core/hle/service/bcat/backend/backend.h" 8#include "core/hle/service/bcat/backend/backend.h"
8#include "core/hle/service/bcat/bcat_result.h" 9#include "core/hle/service/bcat/bcat_result.h"
9#include "core/hle/service/bcat/bcat_service.h" 10#include "core/hle/service/bcat/bcat_service.h"
@@ -14,7 +15,7 @@
14 15
15namespace Service::BCAT { 16namespace Service::BCAT {
16 17
17u64 GetCurrentBuildID(const Core::System::CurrentBuildProcessID& id) { 18static u64 GetCurrentBuildID(const Core::System::CurrentBuildProcessID& id) {
18 u64 out{}; 19 u64 out{};
19 std::memcpy(&out, id.data(), sizeof(u64)); 20 std::memcpy(&out, id.data(), sizeof(u64));
20 return out; 21 return out;
@@ -28,8 +29,8 @@ IBcatService::IBcatService(Core::System& system_, BcatBackend& backend_)
28 }} { 29 }} {
29 // clang-format off 30 // clang-format off
30 static const FunctionInfo functions[] = { 31 static const FunctionInfo functions[] = {
31 {10100, C<&IBcatService::RequestSyncDeliveryCache>, "RequestSyncDeliveryCache"}, 32 {10100, D<&IBcatService::RequestSyncDeliveryCache>, "RequestSyncDeliveryCache"},
32 {10101, C<&IBcatService::RequestSyncDeliveryCacheWithDirectoryName>, "RequestSyncDeliveryCacheWithDirectoryName"}, 33 {10101, D<&IBcatService::RequestSyncDeliveryCacheWithDirectoryName>, "RequestSyncDeliveryCacheWithDirectoryName"},
33 {10200, nullptr, "CancelSyncDeliveryCacheRequest"}, 34 {10200, nullptr, "CancelSyncDeliveryCacheRequest"},
34 {20100, nullptr, "RequestSyncDeliveryCacheWithApplicationId"}, 35 {20100, nullptr, "RequestSyncDeliveryCacheWithApplicationId"},
35 {20101, nullptr, "RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName"}, 36 {20101, nullptr, "RequestSyncDeliveryCacheWithApplicationIdAndDirectoryName"},
@@ -38,7 +39,7 @@ IBcatService::IBcatService(Core::System& system_, BcatBackend& backend_)
38 {20400, nullptr, "RegisterSystemApplicationDeliveryTask"}, 39 {20400, nullptr, "RegisterSystemApplicationDeliveryTask"},
39 {20401, nullptr, "UnregisterSystemApplicationDeliveryTask"}, 40 {20401, nullptr, "UnregisterSystemApplicationDeliveryTask"},
40 {20410, nullptr, "SetSystemApplicationDeliveryTaskTimer"}, 41 {20410, nullptr, "SetSystemApplicationDeliveryTaskTimer"},
41 {30100, C<&IBcatService::SetPassphrase>, "SetPassphrase"}, 42 {30100, D<&IBcatService::SetPassphrase>, "SetPassphrase"},
42 {30101, nullptr, "Unknown30101"}, 43 {30101, nullptr, "Unknown30101"},
43 {30102, nullptr, "Unknown30102"}, 44 {30102, nullptr, "Unknown30102"},
44 {30200, nullptr, "RegisterBackgroundDeliveryTask"}, 45 {30200, nullptr, "RegisterBackgroundDeliveryTask"},
@@ -46,11 +47,11 @@ IBcatService::IBcatService(Core::System& system_, BcatBackend& backend_)
46 {30202, nullptr, "BlockDeliveryTask"}, 47 {30202, nullptr, "BlockDeliveryTask"},
47 {30203, nullptr, "UnblockDeliveryTask"}, 48 {30203, nullptr, "UnblockDeliveryTask"},
48 {30210, nullptr, "SetDeliveryTaskTimer"}, 49 {30210, nullptr, "SetDeliveryTaskTimer"},
49 {30300, C<&IBcatService::RegisterSystemApplicationDeliveryTasks>, "RegisterSystemApplicationDeliveryTasks"}, 50 {30300, D<&IBcatService::RegisterSystemApplicationDeliveryTasks>, "RegisterSystemApplicationDeliveryTasks"},
50 {90100, nullptr, "EnumerateBackgroundDeliveryTask"}, 51 {90100, nullptr, "EnumerateBackgroundDeliveryTask"},
51 {90101, nullptr, "Unknown90101"}, 52 {90101, nullptr, "Unknown90101"},
52 {90200, nullptr, "GetDeliveryList"}, 53 {90200, nullptr, "GetDeliveryList"},
53 {90201, C<&IBcatService::ClearDeliveryCacheStorage>, "ClearDeliveryCacheStorage"}, 54 {90201, D<&IBcatService::ClearDeliveryCacheStorage>, "ClearDeliveryCacheStorage"},
54 {90202, nullptr, "ClearDeliveryTaskSubscriptionStatus"}, 55 {90202, nullptr, "ClearDeliveryTaskSubscriptionStatus"},
55 {90300, nullptr, "GetPushNotificationLog"}, 56 {90300, nullptr, "GetPushNotificationLog"},
56 {90301, nullptr, "Unknown90301"}, 57 {90301, nullptr, "Unknown90301"},
@@ -76,7 +77,7 @@ Result IBcatService::RequestSyncDeliveryCache(
76} 77}
77 78
78Result IBcatService::RequestSyncDeliveryCacheWithDirectoryName( 79Result IBcatService::RequestSyncDeliveryCacheWithDirectoryName(
79 DirectoryName name_raw, OutInterface<IDeliveryCacheProgressService> out_interface) { 80 const DirectoryName& name_raw, OutInterface<IDeliveryCacheProgressService> out_interface) {
80 const auto name = Common::StringFromFixedZeroTerminatedBuffer(name_raw.data(), name_raw.size()); 81 const auto name = Common::StringFromFixedZeroTerminatedBuffer(name_raw.data(), name_raw.size());
81 82
82 LOG_DEBUG(Service_BCAT, "called, name={}", name); 83 LOG_DEBUG(Service_BCAT, "called, name={}", name);
@@ -91,19 +92,19 @@ Result IBcatService::RequestSyncDeliveryCacheWithDirectoryName(
91 R_SUCCEED(); 92 R_SUCCEED();
92} 93}
93 94
94Result IBcatService::SetPassphrase(u64 title_id, 95Result IBcatService::SetPassphrase(u64 application_id,
95 InBuffer<BufferAttr_HipcPointer> passphrase_buffer) { 96 InBuffer<BufferAttr_HipcPointer> passphrase_buffer) {
96 LOG_DEBUG(Service_BCAT, "called, title_id={:016X}, passphrase={}", title_id, 97 LOG_DEBUG(Service_BCAT, "called, application_id={:016X}, passphrase={}", application_id,
97 Common::HexToString(passphrase_buffer)); 98 Common::HexToString(passphrase_buffer));
98 99
99 R_UNLESS(title_id != 0, ResultInvalidArgument); 100 R_UNLESS(application_id != 0, ResultInvalidArgument);
100 R_UNLESS(passphrase_buffer.size() <= 0x40, ResultInvalidArgument); 101 R_UNLESS(passphrase_buffer.size() <= 0x40, ResultInvalidArgument);
101 102
102 Passphrase passphrase{}; 103 Passphrase passphrase{};
103 std::memcpy(passphrase.data(), passphrase_buffer.data(), 104 std::memcpy(passphrase.data(), passphrase_buffer.data(),
104 std::min(passphrase.size(), passphrase_buffer.size())); 105 std::min(passphrase.size(), passphrase_buffer.size()));
105 106
106 backend.SetPassphrase(title_id, passphrase); 107 backend.SetPassphrase(application_id, passphrase);
107 R_SUCCEED(); 108 R_SUCCEED();
108} 109}
109 110
@@ -112,11 +113,11 @@ Result IBcatService::RegisterSystemApplicationDeliveryTasks() {
112 R_SUCCEED(); 113 R_SUCCEED();
113} 114}
114 115
115Result IBcatService::ClearDeliveryCacheStorage(u64 title_id) { 116Result IBcatService::ClearDeliveryCacheStorage(u64 application_id) {
116 LOG_DEBUG(Service_BCAT, "called, title_id={:016X}", title_id); 117 LOG_DEBUG(Service_BCAT, "called, title_id={:016X}", application_id);
117 118
118 R_UNLESS(title_id != 0, ResultInvalidArgument); 119 R_UNLESS(application_id != 0, ResultInvalidArgument);
119 R_UNLESS(backend.Clear(title_id), ResultFailedClearCache); 120 R_UNLESS(backend.Clear(application_id), FileSys::ResultPermissionDenied);
120 R_SUCCEED(); 121 R_SUCCEED();
121} 122}
122 123
diff --git a/src/core/hle/service/bcat/bcat_service.h b/src/core/hle/service/bcat/bcat_service.h
index 3e1ed98c3..dda5a2d5f 100644
--- a/src/core/hle/service/bcat/bcat_service.h
+++ b/src/core/hle/service/bcat/bcat_service.h
@@ -26,13 +26,13 @@ private:
26 Result RequestSyncDeliveryCache(OutInterface<IDeliveryCacheProgressService> out_interface); 26 Result RequestSyncDeliveryCache(OutInterface<IDeliveryCacheProgressService> out_interface);
27 27
28 Result RequestSyncDeliveryCacheWithDirectoryName( 28 Result RequestSyncDeliveryCacheWithDirectoryName(
29 DirectoryName name, OutInterface<IDeliveryCacheProgressService> out_interface); 29 const DirectoryName& name, OutInterface<IDeliveryCacheProgressService> out_interface);
30 30
31 Result SetPassphrase(u64 title_id, InBuffer<BufferAttr_HipcPointer> passphrase_buffer); 31 Result SetPassphrase(u64 application_id, InBuffer<BufferAttr_HipcPointer> passphrase_buffer);
32 32
33 Result RegisterSystemApplicationDeliveryTasks(); 33 Result RegisterSystemApplicationDeliveryTasks();
34 34
35 Result ClearDeliveryCacheStorage(u64 title_id); 35 Result ClearDeliveryCacheStorage(u64 application_id);
36 36
37private: 37private:
38 ProgressServiceBackend& GetProgressBackend(SyncType type); 38 ProgressServiceBackend& GetProgressBackend(SyncType type);
diff --git a/src/core/hle/service/bcat/bcat_types.h b/src/core/hle/service/bcat/bcat_types.h
index a56f9248f..b35dab7c5 100644
--- a/src/core/hle/service/bcat/bcat_types.h
+++ b/src/core/hle/service/bcat/bcat_types.h
@@ -3,9 +3,13 @@
3 3
4#pragma once 4#pragma once
5 5
6#include <array>
7#include <functional>
8
6#include "common/common_funcs.h" 9#include "common/common_funcs.h"
7#include "common/common_types.h" 10#include "common/common_types.h"
8#include "core/file_sys/vfs/vfs_types.h" 11#include "core/file_sys/vfs/vfs_types.h"
12#include "core/hle/result.h"
9 13
10namespace Service::BCAT { 14namespace Service::BCAT {
11 15
@@ -44,17 +48,19 @@ struct TitleIDVersion {
44 48
45struct DeliveryCacheProgressImpl { 49struct DeliveryCacheProgressImpl {
46 DeliveryCacheProgressStatus status; 50 DeliveryCacheProgressStatus status;
47 Result result = ResultSuccess; 51 Result result;
48 DirectoryName current_directory; 52 DirectoryName current_directory;
49 FileName current_file; 53 FileName current_file;
50 s64 current_downloaded_bytes; ///< Bytes downloaded on current file. 54 s64 current_downloaded_bytes; ///< Bytes downloaded on current file.
51 s64 current_total_bytes; ///< Bytes total on current file. 55 s64 current_total_bytes; ///< Bytes total on current file.
52 s64 total_downloaded_bytes; ///< Bytes downloaded on overall download. 56 s64 total_downloaded_bytes; ///< Bytes downloaded on overall download.
53 s64 total_bytes; ///< Bytes total on overall download. 57 s64 total_bytes; ///< Bytes total on overall download.
54 INSERT_PADDING_BYTES( 58 INSERT_PADDING_BYTES_NOINIT(
55 0x198); ///< Appears to be unused in official code, possibly reserved for future use. 59 0x198); ///< Appears to be unused in official code, possibly reserved for future use.
56}; 60};
57static_assert(sizeof(DeliveryCacheProgressImpl) == 0x200, 61static_assert(sizeof(DeliveryCacheProgressImpl) == 0x200,
58 "DeliveryCacheProgressImpl has incorrect size."); 62 "DeliveryCacheProgressImpl has incorrect size.");
63static_assert(std::is_trivial_v<DeliveryCacheProgressImpl>,
64 "DeliveryCacheProgressImpl type must be trivially copyable.");
59 65
60} // namespace Service::BCAT 66} // namespace Service::BCAT
diff --git a/src/core/hle/service/bcat/delivery_cache_directory_service.cpp b/src/core/hle/service/bcat/delivery_cache_directory_service.cpp
index 8bda1168a..01f08a2fc 100644
--- a/src/core/hle/service/bcat/delivery_cache_directory_service.cpp
+++ b/src/core/hle/service/bcat/delivery_cache_directory_service.cpp
@@ -12,7 +12,7 @@ namespace Service::BCAT {
12 12
13// The digest is only used to determine if a file is unique compared to others of the same name. 13// The digest is only used to determine if a file is unique compared to others of the same name.
14// Since the algorithm isn't ever checked in game, MD5 is safe. 14// Since the algorithm isn't ever checked in game, MD5 is safe.
15BcatDigest DigestFile(const FileSys::VirtualFile& file) { 15static BcatDigest DigestFile(const FileSys::VirtualFile& file) {
16 BcatDigest out{}; 16 BcatDigest out{};
17 const auto bytes = file->ReadAllBytes(); 17 const auto bytes = file->ReadAllBytes();
18 mbedtls_md5_ret(bytes.data(), bytes.size(), out.data()); 18 mbedtls_md5_ret(bytes.data(), bytes.size(), out.data());
@@ -24,9 +24,9 @@ IDeliveryCacheDirectoryService::IDeliveryCacheDirectoryService(Core::System& sys
24 : ServiceFramework{system_, "IDeliveryCacheDirectoryService"}, root(std::move(root_)) { 24 : ServiceFramework{system_, "IDeliveryCacheDirectoryService"}, root(std::move(root_)) {
25 // clang-format off 25 // clang-format off
26 static const FunctionInfo functions[] = { 26 static const FunctionInfo functions[] = {
27 {0, C<&IDeliveryCacheDirectoryService::Open>, "Open"}, 27 {0, D<&IDeliveryCacheDirectoryService::Open>, "Open"},
28 {1, C<&IDeliveryCacheDirectoryService::Read>, "Read"}, 28 {1, D<&IDeliveryCacheDirectoryService::Read>, "Read"},
29 {2, C<&IDeliveryCacheDirectoryService::GetCount>, "GetCount"}, 29 {2, D<&IDeliveryCacheDirectoryService::GetCount>, "GetCount"},
30 }; 30 };
31 // clang-format on 31 // clang-format on
32 32
@@ -35,13 +35,13 @@ IDeliveryCacheDirectoryService::IDeliveryCacheDirectoryService(Core::System& sys
35 35
36IDeliveryCacheDirectoryService::~IDeliveryCacheDirectoryService() = default; 36IDeliveryCacheDirectoryService::~IDeliveryCacheDirectoryService() = default;
37 37
38Result IDeliveryCacheDirectoryService::Open(DirectoryName dir_name_raw) { 38Result IDeliveryCacheDirectoryService::Open(const DirectoryName& dir_name_raw) {
39 const auto dir_name = 39 const auto dir_name =
40 Common::StringFromFixedZeroTerminatedBuffer(dir_name_raw.data(), dir_name_raw.size()); 40 Common::StringFromFixedZeroTerminatedBuffer(dir_name_raw.data(), dir_name_raw.size());
41 41
42 LOG_DEBUG(Service_BCAT, "called, dir_name={}", dir_name); 42 LOG_DEBUG(Service_BCAT, "called, dir_name={}", dir_name);
43 43
44 // R_TRY(VerifyNameValidDir(dir_name_raw)); 44 R_TRY(VerifyNameValidDir(dir_name_raw));
45 R_UNLESS(current_dir == nullptr, ResultEntityAlreadyOpen); 45 R_UNLESS(current_dir == nullptr, ResultEntityAlreadyOpen);
46 46
47 const auto dir = root->GetSubdirectory(dir_name); 47 const auto dir = root->GetSubdirectory(dir_name);
@@ -51,15 +51,14 @@ Result IDeliveryCacheDirectoryService::Open(DirectoryName dir_name_raw) {
51} 51}
52 52
53Result IDeliveryCacheDirectoryService::Read( 53Result IDeliveryCacheDirectoryService::Read(
54 Out<u32> out_buffer_size, 54 Out<s32> out_count, OutArray<DeliveryCacheDirectoryEntry, BufferAttr_HipcMapAlias> out_buffer) {
55 OutArray<DeliveryCacheDirectoryEntry, BufferAttr_HipcMapAlias> out_buffer) {
56 LOG_DEBUG(Service_BCAT, "called, write_size={:016X}", out_buffer.size()); 55 LOG_DEBUG(Service_BCAT, "called, write_size={:016X}", out_buffer.size());
57 56
58 R_UNLESS(current_dir != nullptr, ResultNoOpenEntry); 57 R_UNLESS(current_dir != nullptr, ResultNoOpenEntry);
59 58
60 const auto files = current_dir->GetFiles(); 59 const auto files = current_dir->GetFiles();
61 *out_buffer_size = static_cast<u32>(std::min(files.size(), out_buffer.size())); 60 *out_count = static_cast<s32>(std::min(files.size(), out_buffer.size()));
62 std::transform(files.begin(), files.begin() + *out_buffer_size, out_buffer.begin(), 61 std::transform(files.begin(), files.begin() + *out_count, out_buffer.begin(),
63 [](const auto& file) { 62 [](const auto& file) {
64 FileName name{}; 63 FileName name{};
65 std::memcpy(name.data(), file->GetName().data(), 64 std::memcpy(name.data(), file->GetName().data(),
@@ -69,12 +68,12 @@ Result IDeliveryCacheDirectoryService::Read(
69 R_SUCCEED(); 68 R_SUCCEED();
70} 69}
71 70
72Result IDeliveryCacheDirectoryService::GetCount(Out<u32> out_count) { 71Result IDeliveryCacheDirectoryService::GetCount(Out<s32> out_count) {
73 LOG_DEBUG(Service_BCAT, "called"); 72 LOG_DEBUG(Service_BCAT, "called");
74 73
75 R_UNLESS(current_dir != nullptr, ResultNoOpenEntry); 74 R_UNLESS(current_dir != nullptr, ResultNoOpenEntry);
76 75
77 *out_count = static_cast<u32>(current_dir->GetFiles().size()); 76 *out_count = static_cast<s32>(current_dir->GetFiles().size());
78 R_SUCCEED(); 77 R_SUCCEED();
79} 78}
80 79
diff --git a/src/core/hle/service/bcat/delivery_cache_directory_service.h b/src/core/hle/service/bcat/delivery_cache_directory_service.h
index f544d0947..b902c6495 100644
--- a/src/core/hle/service/bcat/delivery_cache_directory_service.h
+++ b/src/core/hle/service/bcat/delivery_cache_directory_service.h
@@ -21,10 +21,10 @@ public:
21 ~IDeliveryCacheDirectoryService() override; 21 ~IDeliveryCacheDirectoryService() override;
22 22
23private: 23private:
24 Result Open(DirectoryName dir_name_raw); 24 Result Open(const DirectoryName& dir_name_raw);
25 Result Read(Out<u32> out_buffer_size, 25 Result Read(Out<s32> out_count,
26 OutArray<DeliveryCacheDirectoryEntry, BufferAttr_HipcMapAlias> out_buffer); 26 OutArray<DeliveryCacheDirectoryEntry, BufferAttr_HipcMapAlias> out_buffer);
27 Result GetCount(Out<u32> out_count); 27 Result GetCount(Out<s32> out_count);
28 28
29 FileSys::VirtualDir root; 29 FileSys::VirtualDir root;
30 FileSys::VirtualDir current_dir; 30 FileSys::VirtualDir current_dir;
diff --git a/src/core/hle/service/bcat/delivery_cache_file_service.cpp b/src/core/hle/service/bcat/delivery_cache_file_service.cpp
index c91efd47e..b75fac4bf 100644
--- a/src/core/hle/service/bcat/delivery_cache_file_service.cpp
+++ b/src/core/hle/service/bcat/delivery_cache_file_service.cpp
@@ -14,10 +14,10 @@ IDeliveryCacheFileService::IDeliveryCacheFileService(Core::System& system_,
14 : ServiceFramework{system_, "IDeliveryCacheFileService"}, root(std::move(root_)) { 14 : ServiceFramework{system_, "IDeliveryCacheFileService"}, root(std::move(root_)) {
15 // clang-format off 15 // clang-format off
16 static const FunctionInfo functions[] = { 16 static const FunctionInfo functions[] = {
17 {0, C<&IDeliveryCacheFileService::Open>, "Open"}, 17 {0, D<&IDeliveryCacheFileService::Open>, "Open"},
18 {1, C<&IDeliveryCacheFileService::Read>, "Read"}, 18 {1, D<&IDeliveryCacheFileService::Read>, "Read"},
19 {2, C<&IDeliveryCacheFileService::GetSize>, "GetSize"}, 19 {2, D<&IDeliveryCacheFileService::GetSize>, "GetSize"},
20 {3, C<&IDeliveryCacheFileService::GetDigest>, "GetDigest"}, 20 {3, D<&IDeliveryCacheFileService::GetDigest>, "GetDigest"},
21 }; 21 };
22 // clang-format on 22 // clang-format on
23 23
@@ -26,7 +26,8 @@ IDeliveryCacheFileService::IDeliveryCacheFileService(Core::System& system_,
26 26
27IDeliveryCacheFileService::~IDeliveryCacheFileService() = default; 27IDeliveryCacheFileService::~IDeliveryCacheFileService() = default;
28 28
29Result IDeliveryCacheFileService::Open(DirectoryName dir_name_raw, FileName file_name_raw) { 29Result IDeliveryCacheFileService::Open(const DirectoryName& dir_name_raw,
30 const FileName& file_name_raw) {
30 const auto dir_name = 31 const auto dir_name =
31 Common::StringFromFixedZeroTerminatedBuffer(dir_name_raw.data(), dir_name_raw.size()); 32 Common::StringFromFixedZeroTerminatedBuffer(dir_name_raw.data(), dir_name_raw.size());
32 const auto file_name = 33 const auto file_name =
diff --git a/src/core/hle/service/bcat/delivery_cache_file_service.h b/src/core/hle/service/bcat/delivery_cache_file_service.h
index 7583b4d1d..e1012e687 100644
--- a/src/core/hle/service/bcat/delivery_cache_file_service.h
+++ b/src/core/hle/service/bcat/delivery_cache_file_service.h
@@ -20,7 +20,7 @@ public:
20 ~IDeliveryCacheFileService() override; 20 ~IDeliveryCacheFileService() override;
21 21
22private: 22private:
23 Result Open(DirectoryName dir_name_raw, FileName file_name_raw); 23 Result Open(const DirectoryName& dir_name_raw, const FileName& file_name_raw);
24 Result Read(Out<u64> out_buffer_size, u64 offset, 24 Result Read(Out<u64> out_buffer_size, u64 offset,
25 OutBuffer<BufferAttr_HipcMapAlias> out_buffer); 25 OutBuffer<BufferAttr_HipcMapAlias> out_buffer);
26 Result GetSize(Out<u64> out_size); 26 Result GetSize(Out<u64> out_size);
diff --git a/src/core/hle/service/bcat/delivery_cache_progress_service.cpp b/src/core/hle/service/bcat/delivery_cache_progress_service.cpp
index 94d341f7e..79e7e0d95 100644
--- a/src/core/hle/service/bcat/delivery_cache_progress_service.cpp
+++ b/src/core/hle/service/bcat/delivery_cache_progress_service.cpp
@@ -13,8 +13,8 @@ IDeliveryCacheProgressService::IDeliveryCacheProgressService(Core::System& syste
13 : ServiceFramework{system_, "IDeliveryCacheProgressService"}, event{event_}, impl{impl_} { 13 : ServiceFramework{system_, "IDeliveryCacheProgressService"}, event{event_}, impl{impl_} {
14 // clang-format off 14 // clang-format off
15 static const FunctionInfo functions[] = { 15 static const FunctionInfo functions[] = {
16 {0, C<&IDeliveryCacheProgressService::GetEvent>, "Get"}, 16 {0, D<&IDeliveryCacheProgressService::GetEvent>, "Get"},
17 {0, C<&IDeliveryCacheProgressService::GetImpl>, "Get"}, 17 {1, D<&IDeliveryCacheProgressService::GetImpl>, "Get"},
18 }; 18 };
19 // clang-format on 19 // clang-format on
20 20
diff --git a/src/core/hle/service/bcat/delivery_cache_storage_service.cpp b/src/core/hle/service/bcat/delivery_cache_storage_service.cpp
index 5d03df1e7..4c79d71f4 100644
--- a/src/core/hle/service/bcat/delivery_cache_storage_service.cpp
+++ b/src/core/hle/service/bcat/delivery_cache_storage_service.cpp
@@ -14,9 +14,9 @@ IDeliveryCacheStorageService::IDeliveryCacheStorageService(Core::System& system_
14 : ServiceFramework{system_, "IDeliveryCacheStorageService"}, root(std::move(root_)) { 14 : ServiceFramework{system_, "IDeliveryCacheStorageService"}, root(std::move(root_)) {
15 // clang-format off 15 // clang-format off
16 static const FunctionInfo functions[] = { 16 static const FunctionInfo functions[] = {
17 {0, C<&IDeliveryCacheStorageService::CreateFileService>, "CreateFileService"}, 17 {0, D<&IDeliveryCacheStorageService::CreateFileService>, "CreateFileService"},
18 {1, C<&IDeliveryCacheStorageService::CreateDirectoryService>, "CreateDirectoryService"}, 18 {1, D<&IDeliveryCacheStorageService::CreateDirectoryService>, "CreateDirectoryService"},
19 {2, C<&IDeliveryCacheStorageService::EnumerateDeliveryCacheDirectory>, "EnumerateDeliveryCacheDirectory"}, 19 {10, D<&IDeliveryCacheStorageService::EnumerateDeliveryCacheDirectory>, "EnumerateDeliveryCacheDirectory"},
20 }; 20 };
21 // clang-format on 21 // clang-format on
22 22
@@ -42,15 +42,15 @@ Result IDeliveryCacheStorageService::CreateDirectoryService(
42} 42}
43 43
44Result IDeliveryCacheStorageService::EnumerateDeliveryCacheDirectory( 44Result IDeliveryCacheStorageService::EnumerateDeliveryCacheDirectory(
45 Out<u32> out_directories_size, 45 Out<s32> out_directory_count,
46 OutArray<DirectoryName, BufferAttr_HipcMapAlias> out_directories) { 46 OutArray<DirectoryName, BufferAttr_HipcMapAlias> out_directories) {
47 LOG_DEBUG(Service_BCAT, "called, size={:016X}", out_directories.size()); 47 LOG_DEBUG(Service_BCAT, "called, size={:016X}", out_directories.size());
48 48
49 *out_directories_size = 49 *out_directory_count =
50 static_cast<u32>(std::min(out_directories.size(), entries.size() - next_read_index)); 50 static_cast<s32>(std::min(out_directories.size(), entries.size() - next_read_index));
51 memcpy(out_directories.data(), entries.data() + next_read_index, 51 memcpy(out_directories.data(), entries.data() + next_read_index,
52 *out_directories_size * sizeof(DirectoryName)); 52 *out_directory_count * sizeof(DirectoryName));
53 next_read_index += *out_directories_size; 53 next_read_index += *out_directory_count;
54 R_SUCCEED(); 54 R_SUCCEED();
55} 55}
56 56
diff --git a/src/core/hle/service/bcat/delivery_cache_storage_service.h b/src/core/hle/service/bcat/delivery_cache_storage_service.h
index 1e86d3dbf..3b8dfb1a3 100644
--- a/src/core/hle/service/bcat/delivery_cache_storage_service.h
+++ b/src/core/hle/service/bcat/delivery_cache_storage_service.h
@@ -25,12 +25,12 @@ private:
25 Result CreateFileService(OutInterface<IDeliveryCacheFileService> out_interface); 25 Result CreateFileService(OutInterface<IDeliveryCacheFileService> out_interface);
26 Result CreateDirectoryService(OutInterface<IDeliveryCacheDirectoryService> out_interface); 26 Result CreateDirectoryService(OutInterface<IDeliveryCacheDirectoryService> out_interface);
27 Result EnumerateDeliveryCacheDirectory( 27 Result EnumerateDeliveryCacheDirectory(
28 Out<u32> out_directories_size, 28 Out<s32> out_directory_count,
29 OutArray<DirectoryName, BufferAttr_HipcMapAlias> out_directories); 29 OutArray<DirectoryName, BufferAttr_HipcMapAlias> out_directories);
30 30
31 FileSys::VirtualDir root; 31 FileSys::VirtualDir root;
32 std::vector<DirectoryName> entries; 32 std::vector<DirectoryName> entries;
33 u64 next_read_index = 0; 33 std::size_t next_read_index = 0;
34}; 34};
35 35
36} // namespace Service::BCAT 36} // namespace Service::BCAT
diff --git a/src/core/hle/service/bcat/news/newly_arrived_event_holder.cpp b/src/core/hle/service/bcat/news/newly_arrived_event_holder.cpp
index b3f9e4683..5be167fce 100644
--- a/src/core/hle/service/bcat/news/newly_arrived_event_holder.cpp
+++ b/src/core/hle/service/bcat/news/newly_arrived_event_holder.cpp
@@ -4,7 +4,7 @@
4#include "core/hle/service/bcat/news/newly_arrived_event_holder.h" 4#include "core/hle/service/bcat/news/newly_arrived_event_holder.h"
5#include "core/hle/service/cmif_serialization.h" 5#include "core/hle/service/cmif_serialization.h"
6 6
7namespace Service::BCAT { 7namespace Service::News {
8 8
9INewlyArrivedEventHolder::INewlyArrivedEventHolder(Core::System& system_) 9INewlyArrivedEventHolder::INewlyArrivedEventHolder(Core::System& system_)
10 : ServiceFramework{system_, "INewlyArrivedEventHolder"}, service_context{ 10 : ServiceFramework{system_, "INewlyArrivedEventHolder"}, service_context{
@@ -20,7 +20,9 @@ INewlyArrivedEventHolder::INewlyArrivedEventHolder(Core::System& system_)
20 arrived_event = service_context.CreateEvent("INewlyArrivedEventHolder::ArrivedEvent"); 20 arrived_event = service_context.CreateEvent("INewlyArrivedEventHolder::ArrivedEvent");
21} 21}
22 22
23INewlyArrivedEventHolder::~INewlyArrivedEventHolder() = default; 23INewlyArrivedEventHolder::~INewlyArrivedEventHolder() {
24 service_context.CloseEvent(arrived_event);
25}
24 26
25Result INewlyArrivedEventHolder::Get(OutCopyHandle<Kernel::KReadableEvent> out_event) { 27Result INewlyArrivedEventHolder::Get(OutCopyHandle<Kernel::KReadableEvent> out_event) {
26 LOG_INFO(Service_BCAT, "called"); 28 LOG_INFO(Service_BCAT, "called");
@@ -29,4 +31,4 @@ Result INewlyArrivedEventHolder::Get(OutCopyHandle<Kernel::KReadableEvent> out_e
29 R_SUCCEED(); 31 R_SUCCEED();
30} 32}
31 33
32} // namespace Service::BCAT 34} // namespace Service::News
diff --git a/src/core/hle/service/bcat/news/newly_arrived_event_holder.h b/src/core/hle/service/bcat/news/newly_arrived_event_holder.h
index af19d81a7..6cc9ae099 100644
--- a/src/core/hle/service/bcat/news/newly_arrived_event_holder.h
+++ b/src/core/hle/service/bcat/news/newly_arrived_event_holder.h
@@ -16,7 +16,7 @@ class KEvent;
16class KReadableEvent; 16class KReadableEvent;
17} // namespace Kernel 17} // namespace Kernel
18 18
19namespace Service::BCAT { 19namespace Service::News {
20 20
21class INewlyArrivedEventHolder final : public ServiceFramework<INewlyArrivedEventHolder> { 21class INewlyArrivedEventHolder final : public ServiceFramework<INewlyArrivedEventHolder> {
22public: 22public:
@@ -30,4 +30,4 @@ private:
30 KernelHelpers::ServiceContext service_context; 30 KernelHelpers::ServiceContext service_context;
31}; 31};
32 32
33} // namespace Service::BCAT 33} // namespace Service::News
diff --git a/src/core/hle/service/bcat/news/news_data_service.cpp b/src/core/hle/service/bcat/news/news_data_service.cpp
index eba2e6064..08103c9c3 100644
--- a/src/core/hle/service/bcat/news/news_data_service.cpp
+++ b/src/core/hle/service/bcat/news/news_data_service.cpp
@@ -3,7 +3,7 @@
3 3
4#include "core/hle/service/bcat/news/news_data_service.h" 4#include "core/hle/service/bcat/news/news_data_service.h"
5 5
6namespace Service::BCAT { 6namespace Service::News {
7 7
8INewsDataService::INewsDataService(Core::System& system_) 8INewsDataService::INewsDataService(Core::System& system_)
9 : ServiceFramework{system_, "INewsDataService"} { 9 : ServiceFramework{system_, "INewsDataService"} {
@@ -22,4 +22,4 @@ INewsDataService::INewsDataService(Core::System& system_)
22 22
23INewsDataService::~INewsDataService() = default; 23INewsDataService::~INewsDataService() = default;
24 24
25} // namespace Service::BCAT 25} // namespace Service::News
diff --git a/src/core/hle/service/bcat/news/news_data_service.h b/src/core/hle/service/bcat/news/news_data_service.h
index 441e0ea8e..12082ada4 100644
--- a/src/core/hle/service/bcat/news/news_data_service.h
+++ b/src/core/hle/service/bcat/news/news_data_service.h
@@ -9,7 +9,7 @@ namespace Core {
9class System; 9class System;
10} 10}
11 11
12namespace Service::BCAT { 12namespace Service::News {
13 13
14class INewsDataService final : public ServiceFramework<INewsDataService> { 14class INewsDataService final : public ServiceFramework<INewsDataService> {
15public: 15public:
@@ -17,4 +17,4 @@ public:
17 ~INewsDataService() override; 17 ~INewsDataService() override;
18}; 18};
19 19
20} // namespace Service::BCAT 20} // namespace Service::News
diff --git a/src/core/hle/service/bcat/news/news_database_service.cpp b/src/core/hle/service/bcat/news/news_database_service.cpp
index 3b4b33901..18109f9b0 100644
--- a/src/core/hle/service/bcat/news/news_database_service.cpp
+++ b/src/core/hle/service/bcat/news/news_database_service.cpp
@@ -4,7 +4,7 @@
4#include "core/hle/service/bcat/news/news_database_service.h" 4#include "core/hle/service/bcat/news/news_database_service.h"
5#include "core/hle/service/cmif_serialization.h" 5#include "core/hle/service/cmif_serialization.h"
6 6
7namespace Service::BCAT { 7namespace Service::News {
8 8
9INewsDatabaseService::INewsDatabaseService(Core::System& system_) 9INewsDatabaseService::INewsDatabaseService(Core::System& system_)
10 : ServiceFramework{system_, "INewsDatabaseService"} { 10 : ServiceFramework{system_, "INewsDatabaseService"} {
@@ -25,11 +25,11 @@ INewsDatabaseService::INewsDatabaseService(Core::System& system_)
25 25
26INewsDatabaseService::~INewsDatabaseService() = default; 26INewsDatabaseService::~INewsDatabaseService() = default;
27 27
28Result INewsDatabaseService::Count(Out<u32> out_count, 28Result INewsDatabaseService::Count(Out<s32> out_count,
29 InBuffer<BufferAttr_HipcPointer> buffer_data) { 29 InBuffer<BufferAttr_HipcPointer> buffer_data) {
30 LOG_WARNING(Service_BCAT, "(STUBBED) called, buffer_size={}", buffer_data.size()); 30 LOG_WARNING(Service_BCAT, "(STUBBED) called, buffer_size={}", buffer_data.size());
31 *out_count = 0; 31 *out_count = 0;
32 R_SUCCEED(); 32 R_SUCCEED();
33} 33}
34 34
35} // namespace Service::BCAT 35} // namespace Service::News
diff --git a/src/core/hle/service/bcat/news/news_database_service.h b/src/core/hle/service/bcat/news/news_database_service.h
index dd09a1662..f5916634b 100644
--- a/src/core/hle/service/bcat/news/news_database_service.h
+++ b/src/core/hle/service/bcat/news/news_database_service.h
@@ -10,7 +10,7 @@ namespace Core {
10class System; 10class System;
11} 11}
12 12
13namespace Service::BCAT { 13namespace Service::News {
14 14
15class INewsDatabaseService final : public ServiceFramework<INewsDatabaseService> { 15class INewsDatabaseService final : public ServiceFramework<INewsDatabaseService> {
16public: 16public:
@@ -18,7 +18,7 @@ public:
18 ~INewsDatabaseService() override; 18 ~INewsDatabaseService() override;
19 19
20private: 20private:
21 Result Count(Out<u32> out_count, InBuffer<BufferAttr_HipcPointer> buffer_data); 21 Result Count(Out<s32> out_count, InBuffer<BufferAttr_HipcPointer> buffer_data);
22}; 22};
23 23
24} // namespace Service::BCAT 24} // namespace Service::News
diff --git a/src/core/hle/service/bcat/news/news_service.cpp b/src/core/hle/service/bcat/news/news_service.cpp
index 372937351..e19cea7b5 100644
--- a/src/core/hle/service/bcat/news/news_service.cpp
+++ b/src/core/hle/service/bcat/news/news_service.cpp
@@ -4,7 +4,7 @@
4#include "core/hle/service/bcat/news/news_service.h" 4#include "core/hle/service/bcat/news/news_service.h"
5#include "core/hle/service/cmif_serialization.h" 5#include "core/hle/service/cmif_serialization.h"
6 6
7namespace Service::BCAT { 7namespace Service::News {
8 8
9INewsService::INewsService(Core::System& system_) : ServiceFramework{system_, "INewsService"} { 9INewsService::INewsService(Core::System& system_) : ServiceFramework{system_, "INewsService"} {
10 // clang-format off 10 // clang-format off
@@ -43,4 +43,4 @@ Result INewsService::GetSubscriptionStatus(Out<u32> out_status,
43 R_SUCCEED(); 43 R_SUCCEED();
44} 44}
45 45
46} // namespace Service::BCAT 46} // namespace Service::News
diff --git a/src/core/hle/service/bcat/news/news_service.h b/src/core/hle/service/bcat/news/news_service.h
index bb2e49848..8d06be9d6 100644
--- a/src/core/hle/service/bcat/news/news_service.h
+++ b/src/core/hle/service/bcat/news/news_service.h
@@ -10,7 +10,7 @@ namespace Core {
10class System; 10class System;
11} 11}
12 12
13namespace Service::BCAT { 13namespace Service::News {
14 14
15class INewsService final : public ServiceFramework<INewsService> { 15class INewsService final : public ServiceFramework<INewsService> {
16public: 16public:
@@ -21,4 +21,4 @@ private:
21 Result GetSubscriptionStatus(Out<u32> out_status, InBuffer<BufferAttr_HipcPointer> buffer_data); 21 Result GetSubscriptionStatus(Out<u32> out_status, InBuffer<BufferAttr_HipcPointer> buffer_data);
22}; 22};
23 23
24} // namespace Service::BCAT 24} // namespace Service::News
diff --git a/src/core/hle/service/bcat/news/overwrite_event_holder.cpp b/src/core/hle/service/bcat/news/overwrite_event_holder.cpp
index 4b06bfc5e..c32a5ca8f 100644
--- a/src/core/hle/service/bcat/news/overwrite_event_holder.cpp
+++ b/src/core/hle/service/bcat/news/overwrite_event_holder.cpp
@@ -4,7 +4,7 @@
4#include "core/hle/service/bcat/news/overwrite_event_holder.h" 4#include "core/hle/service/bcat/news/overwrite_event_holder.h"
5#include "core/hle/service/cmif_serialization.h" 5#include "core/hle/service/cmif_serialization.h"
6 6
7namespace Service::BCAT { 7namespace Service::News {
8 8
9IOverwriteEventHolder::IOverwriteEventHolder(Core::System& system_) 9IOverwriteEventHolder::IOverwriteEventHolder(Core::System& system_)
10 : ServiceFramework{system_, "IOverwriteEventHolder"}, service_context{system_, 10 : ServiceFramework{system_, "IOverwriteEventHolder"}, service_context{system_,
@@ -19,7 +19,9 @@ IOverwriteEventHolder::IOverwriteEventHolder(Core::System& system_)
19 overwrite_event = service_context.CreateEvent("IOverwriteEventHolder::OverwriteEvent"); 19 overwrite_event = service_context.CreateEvent("IOverwriteEventHolder::OverwriteEvent");
20} 20}
21 21
22IOverwriteEventHolder::~IOverwriteEventHolder() = default; 22IOverwriteEventHolder::~IOverwriteEventHolder() {
23 service_context.CloseEvent(overwrite_event);
24}
23 25
24Result IOverwriteEventHolder::Get(OutCopyHandle<Kernel::KReadableEvent> out_event) { 26Result IOverwriteEventHolder::Get(OutCopyHandle<Kernel::KReadableEvent> out_event) {
25 LOG_INFO(Service_BCAT, "called"); 27 LOG_INFO(Service_BCAT, "called");
@@ -28,4 +30,4 @@ Result IOverwriteEventHolder::Get(OutCopyHandle<Kernel::KReadableEvent> out_even
28 R_SUCCEED(); 30 R_SUCCEED();
29} 31}
30 32
31} // namespace Service::BCAT 33} // namespace Service::News
diff --git a/src/core/hle/service/bcat/news/overwrite_event_holder.h b/src/core/hle/service/bcat/news/overwrite_event_holder.h
index 4b016b2fe..cdc87d782 100644
--- a/src/core/hle/service/bcat/news/overwrite_event_holder.h
+++ b/src/core/hle/service/bcat/news/overwrite_event_holder.h
@@ -16,7 +16,7 @@ class KEvent;
16class KReadableEvent; 16class KReadableEvent;
17} // namespace Kernel 17} // namespace Kernel
18 18
19namespace Service::BCAT { 19namespace Service::News {
20 20
21class IOverwriteEventHolder final : public ServiceFramework<IOverwriteEventHolder> { 21class IOverwriteEventHolder final : public ServiceFramework<IOverwriteEventHolder> {
22public: 22public:
@@ -30,4 +30,4 @@ private:
30 KernelHelpers::ServiceContext service_context; 30 KernelHelpers::ServiceContext service_context;
31}; 31};
32 32
33} // namespace Service::BCAT 33} // namespace Service::News
diff --git a/src/core/hle/service/bcat/news/news_interface.cpp b/src/core/hle/service/bcat/news/service_creator.cpp
index 0eaef2ddc..d5ba5dff7 100644
--- a/src/core/hle/service/bcat/news/news_interface.cpp
+++ b/src/core/hle/service/bcat/news/service_creator.cpp
@@ -4,60 +4,61 @@
4#include "core/hle/service/bcat/news/newly_arrived_event_holder.h" 4#include "core/hle/service/bcat/news/newly_arrived_event_holder.h"
5#include "core/hle/service/bcat/news/news_data_service.h" 5#include "core/hle/service/bcat/news/news_data_service.h"
6#include "core/hle/service/bcat/news/news_database_service.h" 6#include "core/hle/service/bcat/news/news_database_service.h"
7#include "core/hle/service/bcat/news/news_interface.h"
8#include "core/hle/service/bcat/news/news_service.h" 7#include "core/hle/service/bcat/news/news_service.h"
9#include "core/hle/service/bcat/news/overwrite_event_holder.h" 8#include "core/hle/service/bcat/news/overwrite_event_holder.h"
9#include "core/hle/service/bcat/news/service_creator.h"
10#include "core/hle/service/cmif_serialization.h" 10#include "core/hle/service/cmif_serialization.h"
11 11
12namespace Service::BCAT { 12namespace Service::News {
13 13
14NewsInterface::NewsInterface(Core::System& system_, u32 permissions_, const char* name_) 14IServiceCreator::IServiceCreator(Core::System& system_, u32 permissions_, const char* name_)
15 : ServiceFramework{system_, name_}, permissions{permissions_} { 15 : ServiceFramework{system_, name_}, permissions{permissions_} {
16 // clang-format off 16 // clang-format off
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, C<&NewsInterface::CreateNewsService>, "CreateNewsService"}, 18 {0, C<&IServiceCreator::CreateNewsService>, "CreateNewsService"},
19 {1, C<&NewsInterface::CreateNewlyArrivedEventHolder>, "CreateNewlyArrivedEventHolder"}, 19 {1, C<&IServiceCreator::CreateNewlyArrivedEventHolder>, "CreateNewlyArrivedEventHolder"},
20 {2, C<&NewsInterface::CreateNewsDataService>, "CreateNewsDataService"}, 20 {2, C<&IServiceCreator::CreateNewsDataService>, "CreateNewsDataService"},
21 {3, C<&NewsInterface::CreateNewsDatabaseService>, "CreateNewsDatabaseService"}, 21 {3, C<&IServiceCreator::CreateNewsDatabaseService>, "CreateNewsDatabaseService"},
22 {4, C<&NewsInterface::CreateOverwriteEventHolder>, "CreateOverwriteEventHolder"}, 22 {4, C<&IServiceCreator::CreateOverwriteEventHolder>, "CreateOverwriteEventHolder"},
23 }; 23 };
24 // clang-format on 24 // clang-format on
25 25
26 RegisterHandlers(functions); 26 RegisterHandlers(functions);
27} 27}
28 28
29NewsInterface::~NewsInterface() = default; 29IServiceCreator::~IServiceCreator() = default;
30 30
31Result NewsInterface::CreateNewsService(OutInterface<INewsService> out_interface) { 31Result IServiceCreator::CreateNewsService(OutInterface<INewsService> out_interface) {
32 LOG_INFO(Service_BCAT, "called"); 32 LOG_INFO(Service_BCAT, "called");
33 *out_interface = std::make_shared<INewsService>(system); 33 *out_interface = std::make_shared<INewsService>(system);
34 R_SUCCEED(); 34 R_SUCCEED();
35} 35}
36 36
37Result NewsInterface::CreateNewlyArrivedEventHolder( 37Result IServiceCreator::CreateNewlyArrivedEventHolder(
38 OutInterface<INewlyArrivedEventHolder> out_interface) { 38 OutInterface<INewlyArrivedEventHolder> out_interface) {
39 LOG_INFO(Service_BCAT, "called"); 39 LOG_INFO(Service_BCAT, "called");
40 *out_interface = std::make_shared<INewlyArrivedEventHolder>(system); 40 *out_interface = std::make_shared<INewlyArrivedEventHolder>(system);
41 R_SUCCEED(); 41 R_SUCCEED();
42} 42}
43 43
44Result NewsInterface::CreateNewsDataService(OutInterface<INewsDataService> out_interface) { 44Result IServiceCreator::CreateNewsDataService(OutInterface<INewsDataService> out_interface) {
45 LOG_INFO(Service_BCAT, "called"); 45 LOG_INFO(Service_BCAT, "called");
46 *out_interface = std::make_shared<INewsDataService>(system); 46 *out_interface = std::make_shared<INewsDataService>(system);
47 R_SUCCEED(); 47 R_SUCCEED();
48} 48}
49 49
50Result NewsInterface::CreateNewsDatabaseService(OutInterface<INewsDatabaseService> out_interface) { 50Result IServiceCreator::CreateNewsDatabaseService(
51 OutInterface<INewsDatabaseService> out_interface) {
51 LOG_INFO(Service_BCAT, "called"); 52 LOG_INFO(Service_BCAT, "called");
52 *out_interface = std::make_shared<INewsDatabaseService>(system); 53 *out_interface = std::make_shared<INewsDatabaseService>(system);
53 R_SUCCEED(); 54 R_SUCCEED();
54} 55}
55 56
56Result NewsInterface::CreateOverwriteEventHolder( 57Result IServiceCreator::CreateOverwriteEventHolder(
57 OutInterface<IOverwriteEventHolder> out_interface) { 58 OutInterface<IOverwriteEventHolder> out_interface) {
58 LOG_INFO(Service_BCAT, "called"); 59 LOG_INFO(Service_BCAT, "called");
59 *out_interface = std::make_shared<IOverwriteEventHolder>(system); 60 *out_interface = std::make_shared<IOverwriteEventHolder>(system);
60 R_SUCCEED(); 61 R_SUCCEED();
61} 62}
62 63
63} // namespace Service::BCAT 64} // namespace Service::News
diff --git a/src/core/hle/service/bcat/news/news_interface.h b/src/core/hle/service/bcat/news/service_creator.h
index d95edba3d..5a62e7c1a 100644
--- a/src/core/hle/service/bcat/news/news_interface.h
+++ b/src/core/hle/service/bcat/news/service_creator.h
@@ -10,17 +10,17 @@ namespace Core {
10class System; 10class System;
11} 11}
12 12
13namespace Service::BCAT { 13namespace Service::News {
14class INewsService; 14class INewsService;
15class INewlyArrivedEventHolder; 15class INewlyArrivedEventHolder;
16class INewsDataService; 16class INewsDataService;
17class INewsDatabaseService; 17class INewsDatabaseService;
18class IOverwriteEventHolder; 18class IOverwriteEventHolder;
19 19
20class NewsInterface final : public ServiceFramework<NewsInterface> { 20class IServiceCreator final : public ServiceFramework<IServiceCreator> {
21public: 21public:
22 explicit NewsInterface(Core::System& system_, u32 permissions_, const char* name_); 22 explicit IServiceCreator(Core::System& system_, u32 permissions_, const char* name_);
23 ~NewsInterface() override; 23 ~IServiceCreator() override;
24 24
25private: 25private:
26 Result CreateNewsService(OutInterface<INewsService> out_interface); 26 Result CreateNewsService(OutInterface<INewsService> out_interface);
@@ -32,4 +32,4 @@ private:
32 u32 permissions; 32 u32 permissions;
33}; 33};
34 34
35} // namespace Service::BCAT 35} // namespace Service::News
diff --git a/src/core/hle/service/bcat/bcat_interface.cpp b/src/core/hle/service/bcat/service_creator.cpp
index 2d9a0efcc..ca339e5a6 100644
--- a/src/core/hle/service/bcat/bcat_interface.cpp
+++ b/src/core/hle/service/bcat/service_creator.cpp
@@ -1,9 +1,9 @@
1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include "core/hle/service/bcat/bcat_interface.h"
5#include "core/hle/service/bcat/bcat_service.h" 4#include "core/hle/service/bcat/bcat_service.h"
6#include "core/hle/service/bcat/delivery_cache_storage_service.h" 5#include "core/hle/service/bcat/delivery_cache_storage_service.h"
6#include "core/hle/service/bcat/service_creator.h"
7#include "core/hle/service/cmif_serialization.h" 7#include "core/hle/service/cmif_serialization.h"
8#include "core/hle/service/filesystem/filesystem.h" 8#include "core/hle/service/filesystem/filesystem.h"
9 9
@@ -14,13 +14,13 @@ std::unique_ptr<BcatBackend> CreateBackendFromSettings([[maybe_unused]] Core::Sy
14 return std::make_unique<NullBcatBackend>(std::move(getter)); 14 return std::make_unique<NullBcatBackend>(std::move(getter));
15} 15}
16 16
17BcatInterface::BcatInterface(Core::System& system_, const char* name_) 17IServiceCreator::IServiceCreator(Core::System& system_, const char* name_)
18 : ServiceFramework{system_, name_}, fsc{system.GetFileSystemController()} { 18 : ServiceFramework{system_, name_}, fsc{system.GetFileSystemController()} {
19 // clang-format off 19 // clang-format off
20 static const FunctionInfo functions[] = { 20 static const FunctionInfo functions[] = {
21 {0, C<&BcatInterface::CreateBcatService>, "CreateBcatService"}, 21 {0, D<&IServiceCreator::CreateBcatService>, "CreateBcatService"},
22 {1, C<&BcatInterface::CreateDeliveryCacheStorageService>, "CreateDeliveryCacheStorageService"}, 22 {1, D<&IServiceCreator::CreateDeliveryCacheStorageService>, "CreateDeliveryCacheStorageService"},
23 {2, C<&BcatInterface::CreateDeliveryCacheStorageServiceWithApplicationId>, "CreateDeliveryCacheStorageServiceWithApplicationId"}, 23 {2, D<&IServiceCreator::CreateDeliveryCacheStorageServiceWithApplicationId>, "CreateDeliveryCacheStorageServiceWithApplicationId"},
24 {3, nullptr, "CreateDeliveryCacheProgressService"}, 24 {3, nullptr, "CreateDeliveryCacheProgressService"},
25 {4, nullptr, "CreateDeliveryCacheProgressServiceWithApplicationId"}, 25 {4, nullptr, "CreateDeliveryCacheProgressServiceWithApplicationId"},
26 }; 26 };
@@ -32,17 +32,18 @@ BcatInterface::BcatInterface(Core::System& system_, const char* name_)
32 CreateBackendFromSettings(system_, [this](u64 tid) { return fsc.GetBCATDirectory(tid); }); 32 CreateBackendFromSettings(system_, [this](u64 tid) { return fsc.GetBCATDirectory(tid); });
33} 33}
34 34
35BcatInterface::~BcatInterface() = default; 35IServiceCreator::~IServiceCreator() = default;
36 36
37Result BcatInterface::CreateBcatService(OutInterface<IBcatService> out_interface) { 37Result IServiceCreator::CreateBcatService(ClientProcessId process_id,
38 LOG_INFO(Service_BCAT, "called"); 38 OutInterface<IBcatService> out_interface) {
39 LOG_INFO(Service_BCAT, "called, process_id={}", process_id.pid);
39 *out_interface = std::make_shared<IBcatService>(system, *backend); 40 *out_interface = std::make_shared<IBcatService>(system, *backend);
40 R_SUCCEED(); 41 R_SUCCEED();
41} 42}
42 43
43Result BcatInterface::CreateDeliveryCacheStorageService( 44Result IServiceCreator::CreateDeliveryCacheStorageService(
44 OutInterface<IDeliveryCacheStorageService> out_interface) { 45 ClientProcessId process_id, OutInterface<IDeliveryCacheStorageService> out_interface) {
45 LOG_INFO(Service_BCAT, "called"); 46 LOG_INFO(Service_BCAT, "called, process_id={}", process_id.pid);
46 47
47 const auto title_id = system.GetApplicationProcessProgramID(); 48 const auto title_id = system.GetApplicationProcessProgramID();
48 *out_interface = 49 *out_interface =
@@ -50,11 +51,11 @@ Result BcatInterface::CreateDeliveryCacheStorageService(
50 R_SUCCEED(); 51 R_SUCCEED();
51} 52}
52 53
53Result BcatInterface::CreateDeliveryCacheStorageServiceWithApplicationId( 54Result IServiceCreator::CreateDeliveryCacheStorageServiceWithApplicationId(
54 u64 title_id, OutInterface<IDeliveryCacheStorageService> out_interface) { 55 u64 application_id, OutInterface<IDeliveryCacheStorageService> out_interface) {
55 LOG_DEBUG(Service_BCAT, "called, title_id={:016X}", title_id); 56 LOG_DEBUG(Service_BCAT, "called, application_id={:016X}", application_id);
56 *out_interface = 57 *out_interface = std::make_shared<IDeliveryCacheStorageService>(
57 std::make_shared<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id)); 58 system, fsc.GetBCATDirectory(application_id));
58 R_SUCCEED(); 59 R_SUCCEED();
59} 60}
60 61
diff --git a/src/core/hle/service/bcat/bcat_interface.h b/src/core/hle/service/bcat/service_creator.h
index 9282b57bb..50e663324 100644
--- a/src/core/hle/service/bcat/bcat_interface.h
+++ b/src/core/hle/service/bcat/service_creator.h
@@ -19,19 +19,19 @@ class BcatBackend;
19class IBcatService; 19class IBcatService;
20class IDeliveryCacheStorageService; 20class IDeliveryCacheStorageService;
21 21
22class BcatInterface final : public ServiceFramework<BcatInterface> { 22class IServiceCreator final : public ServiceFramework<IServiceCreator> {
23public: 23public:
24 explicit BcatInterface(Core::System& system_, const char* name_); 24 explicit IServiceCreator(Core::System& system_, const char* name_);
25 ~BcatInterface() override; 25 ~IServiceCreator() override;
26 26
27private: 27private:
28 Result CreateBcatService(OutInterface<IBcatService> out_interface); 28 Result CreateBcatService(ClientProcessId process_id, OutInterface<IBcatService> out_interface);
29 29
30 Result CreateDeliveryCacheStorageService( 30 Result CreateDeliveryCacheStorageService(
31 OutInterface<IDeliveryCacheStorageService> out_interface); 31 ClientProcessId process_id, OutInterface<IDeliveryCacheStorageService> out_interface);
32 32
33 Result CreateDeliveryCacheStorageServiceWithApplicationId( 33 Result CreateDeliveryCacheStorageServiceWithApplicationId(
34 u64 title_id, OutInterface<IDeliveryCacheStorageService> out_interface); 34 u64 application_id, OutInterface<IDeliveryCacheStorageService> out_interface);
35 35
36 std::unique_ptr<BcatBackend> backend; 36 std::unique_ptr<BcatBackend> backend;
37 Service::FileSystem::FileSystemController& fsc; 37 Service::FileSystem::FileSystemController& fsc;
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 06cbad268..f68c3c686 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -15,7 +15,7 @@
15#include "core/hle/service/aoc/aoc_u.h" 15#include "core/hle/service/aoc/aoc_u.h"
16#include "core/hle/service/apm/apm.h" 16#include "core/hle/service/apm/apm.h"
17#include "core/hle/service/audio/audio.h" 17#include "core/hle/service/audio/audio.h"
18#include "core/hle/service/bcat/bcat_module.h" 18#include "core/hle/service/bcat/bcat.h"
19#include "core/hle/service/bpc/bpc.h" 19#include "core/hle/service/bpc/bpc.h"
20#include "core/hle/service/btdrv/btdrv.h" 20#include "core/hle/service/btdrv/btdrv.h"
21#include "core/hle/service/btm/btm.h" 21#include "core/hle/service/btm/btm.h"