summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/am/am.cpp5
-rw-r--r--src/core/hle/service/bcat/backend/backend.cpp4
-rw-r--r--src/core/hle/service/bcat/backend/backend.h12
-rw-r--r--src/core/hle/service/bcat/backend/boxcat.cpp29
-rw-r--r--src/core/hle/service/bcat/backend/boxcat.h10
-rw-r--r--src/core/hle/service/bcat/module.cpp24
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.cpp4
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.h6
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp2
-rw-r--r--src/video_core/gpu.cpp2
10 files changed, 64 insertions, 34 deletions
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 941ebc93a..3a32d5b41 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -1140,8 +1140,9 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
1140 LOG_DEBUG(Service_AM, "called, kind={:08X}", static_cast<u8>(kind)); 1140 LOG_DEBUG(Service_AM, "called, kind={:08X}", static_cast<u8>(kind));
1141 1141
1142 if (kind == LaunchParameterKind::ApplicationSpecific && !launch_popped_application_specific) { 1142 if (kind == LaunchParameterKind::ApplicationSpecific && !launch_popped_application_specific) {
1143 const auto backend = BCAT::CreateBackendFromSettings( 1143 const auto backend = BCAT::CreateBackendFromSettings(system, [this](u64 tid) {
1144 [this](u64 tid) { return system.GetFileSystemController().GetBCATDirectory(tid); }); 1144 return system.GetFileSystemController().GetBCATDirectory(tid);
1145 });
1145 const auto build_id_full = system.GetCurrentProcessBuildID(); 1146 const auto build_id_full = system.GetCurrentProcessBuildID();
1146 u64 build_id{}; 1147 u64 build_id{};
1147 std::memcpy(&build_id, build_id_full.data(), sizeof(u64)); 1148 std::memcpy(&build_id, build_id_full.data(), sizeof(u64));
diff --git a/src/core/hle/service/bcat/backend/backend.cpp b/src/core/hle/service/bcat/backend/backend.cpp
index 9d6946bc5..b86fda29a 100644
--- a/src/core/hle/service/bcat/backend/backend.cpp
+++ b/src/core/hle/service/bcat/backend/backend.cpp
@@ -10,8 +10,8 @@
10 10
11namespace Service::BCAT { 11namespace Service::BCAT {
12 12
13ProgressServiceBackend::ProgressServiceBackend(std::string_view event_name) { 13ProgressServiceBackend::ProgressServiceBackend(Kernel::KernelCore& kernel,
14 auto& kernel{Core::System::GetInstance().Kernel()}; 14 std::string_view event_name) {
15 event = Kernel::WritableEvent::CreateEventPair( 15 event = Kernel::WritableEvent::CreateEventPair(
16 kernel, Kernel::ResetType::Automatic, 16 kernel, Kernel::ResetType::Automatic,
17 std::string("ProgressServiceBackend:UpdateEvent:").append(event_name)); 17 std::string("ProgressServiceBackend:UpdateEvent:").append(event_name));
diff --git a/src/core/hle/service/bcat/backend/backend.h b/src/core/hle/service/bcat/backend/backend.h
index 51dbd3316..ea4b16ad0 100644
--- a/src/core/hle/service/bcat/backend/backend.h
+++ b/src/core/hle/service/bcat/backend/backend.h
@@ -15,6 +15,14 @@
15#include "core/hle/kernel/writable_event.h" 15#include "core/hle/kernel/writable_event.h"
16#include "core/hle/result.h" 16#include "core/hle/result.h"
17 17
18namespace Core {
19class System;
20}
21
22namespace Kernel {
23class KernelCore;
24}
25
18namespace Service::BCAT { 26namespace Service::BCAT {
19 27
20struct DeliveryCacheProgressImpl; 28struct DeliveryCacheProgressImpl;
@@ -88,7 +96,7 @@ public:
88 void FinishDownload(ResultCode result); 96 void FinishDownload(ResultCode result);
89 97
90private: 98private:
91 explicit ProgressServiceBackend(std::string_view event_name); 99 explicit ProgressServiceBackend(Kernel::KernelCore& kernel, std::string_view event_name);
92 100
93 Kernel::SharedPtr<Kernel::ReadableEvent> GetEvent() const; 101 Kernel::SharedPtr<Kernel::ReadableEvent> GetEvent() const;
94 DeliveryCacheProgressImpl& GetImpl(); 102 DeliveryCacheProgressImpl& GetImpl();
@@ -145,6 +153,6 @@ public:
145 std::optional<std::vector<u8>> GetLaunchParameter(TitleIDVersion title) override; 153 std::optional<std::vector<u8>> GetLaunchParameter(TitleIDVersion title) override;
146}; 154};
147 155
148std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter); 156std::unique_ptr<Backend> CreateBackendFromSettings(Core::System& system, DirectoryGetter getter);
149 157
150} // namespace Service::BCAT 158} // namespace Service::BCAT
diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp
index 64022982b..918159e11 100644
--- a/src/core/hle/service/bcat/backend/boxcat.cpp
+++ b/src/core/hle/service/bcat/backend/boxcat.cpp
@@ -104,14 +104,15 @@ std::string GetZIPFilePath(u64 title_id) {
104 104
105// If the error is something the user should know about (build ID mismatch, bad client version), 105// If the error is something the user should know about (build ID mismatch, bad client version),
106// display an error. 106// display an error.
107void HandleDownloadDisplayResult(DownloadResult res) { 107void HandleDownloadDisplayResult(const AM::Applets::AppletManager& applet_manager,
108 DownloadResult res) {
108 if (res == DownloadResult::Success || res == DownloadResult::NoResponse || 109 if (res == DownloadResult::Success || res == DownloadResult::NoResponse ||
109 res == DownloadResult::GeneralWebError || res == DownloadResult::GeneralFSError || 110 res == DownloadResult::GeneralWebError || res == DownloadResult::GeneralFSError ||
110 res == DownloadResult::NoMatchTitleId || res == DownloadResult::InvalidContentType) { 111 res == DownloadResult::NoMatchTitleId || res == DownloadResult::InvalidContentType) {
111 return; 112 return;
112 } 113 }
113 114
114 const auto& frontend{Core::System::GetInstance().GetAppletManager().GetAppletFrontendSet()}; 115 const auto& frontend{applet_manager.GetAppletFrontendSet()};
115 frontend.error->ShowCustomErrorText( 116 frontend.error->ShowCustomErrorText(
116 ResultCode(-1), "There was an error while attempting to use Boxcat.", 117 ResultCode(-1), "There was an error while attempting to use Boxcat.",
117 DOWNLOAD_RESULT_LOG_MESSAGES[static_cast<std::size_t>(res)], [] {}); 118 DOWNLOAD_RESULT_LOG_MESSAGES[static_cast<std::size_t>(res)], [] {});
@@ -264,12 +265,13 @@ private:
264 u64 build_id; 265 u64 build_id;
265}; 266};
266 267
267Boxcat::Boxcat(DirectoryGetter getter) : Backend(std::move(getter)) {} 268Boxcat::Boxcat(AM::Applets::AppletManager& applet_manager_, DirectoryGetter getter)
269 : Backend(std::move(getter)), applet_manager{applet_manager_} {}
268 270
269Boxcat::~Boxcat() = default; 271Boxcat::~Boxcat() = default;
270 272
271void SynchronizeInternal(DirectoryGetter dir_getter, TitleIDVersion title, 273void SynchronizeInternal(AM::Applets::AppletManager& applet_manager, DirectoryGetter dir_getter,
272 ProgressServiceBackend& progress, 274 TitleIDVersion title, ProgressServiceBackend& progress,
273 std::optional<std::string> dir_name = {}) { 275 std::optional<std::string> dir_name = {}) {
274 progress.SetNeedHLELock(true); 276 progress.SetNeedHLELock(true);
275 277
@@ -295,7 +297,7 @@ void SynchronizeInternal(DirectoryGetter dir_getter, TitleIDVersion title,
295 FileUtil::Delete(zip_path); 297 FileUtil::Delete(zip_path);
296 } 298 }
297 299
298 HandleDownloadDisplayResult(res); 300 HandleDownloadDisplayResult(applet_manager, res);
299 progress.FinishDownload(ERROR_GENERAL_BCAT_FAILURE); 301 progress.FinishDownload(ERROR_GENERAL_BCAT_FAILURE);
300 return; 302 return;
301 } 303 }
@@ -364,17 +366,24 @@ void SynchronizeInternal(DirectoryGetter dir_getter, TitleIDVersion title,
364 366
365bool Boxcat::Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) { 367bool Boxcat::Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) {
366 is_syncing.exchange(true); 368 is_syncing.exchange(true);
367 std::thread([this, title, &progress] { SynchronizeInternal(dir_getter, title, progress); }) 369
370 std::thread([this, title, &progress] {
371 SynchronizeInternal(applet_manager, dir_getter, title, progress);
372 })
368 .detach(); 373 .detach();
374
369 return true; 375 return true;
370} 376}
371 377
372bool Boxcat::SynchronizeDirectory(TitleIDVersion title, std::string name, 378bool Boxcat::SynchronizeDirectory(TitleIDVersion title, std::string name,
373 ProgressServiceBackend& progress) { 379 ProgressServiceBackend& progress) {
374 is_syncing.exchange(true); 380 is_syncing.exchange(true);
375 std::thread( 381
376 [this, title, name, &progress] { SynchronizeInternal(dir_getter, title, progress, name); }) 382 std::thread([this, title, name, &progress] {
383 SynchronizeInternal(applet_manager, dir_getter, title, progress, name);
384 })
377 .detach(); 385 .detach();
386
378 return true; 387 return true;
379} 388}
380 389
@@ -420,7 +429,7 @@ std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title)
420 FileUtil::Delete(path); 429 FileUtil::Delete(path);
421 } 430 }
422 431
423 HandleDownloadDisplayResult(res); 432 HandleDownloadDisplayResult(applet_manager, res);
424 return std::nullopt; 433 return std::nullopt;
425 } 434 }
426 } 435 }
diff --git a/src/core/hle/service/bcat/backend/boxcat.h b/src/core/hle/service/bcat/backend/boxcat.h
index 601151189..d65b42e58 100644
--- a/src/core/hle/service/bcat/backend/boxcat.h
+++ b/src/core/hle/service/bcat/backend/boxcat.h
@@ -9,6 +9,10 @@
9#include <optional> 9#include <optional>
10#include "core/hle/service/bcat/backend/backend.h" 10#include "core/hle/service/bcat/backend/backend.h"
11 11
12namespace Service::AM::Applets {
13class AppletManager;
14}
15
12namespace Service::BCAT { 16namespace Service::BCAT {
13 17
14struct EventStatus { 18struct EventStatus {
@@ -20,12 +24,13 @@ struct EventStatus {
20/// Boxcat is yuzu's custom backend implementation of Nintendo's BCAT service. It is free to use and 24/// Boxcat is yuzu's custom backend implementation of Nintendo's BCAT service. It is free to use and
21/// doesn't require a switch or nintendo account. The content is controlled by the yuzu team. 25/// doesn't require a switch or nintendo account. The content is controlled by the yuzu team.
22class Boxcat final : public Backend { 26class Boxcat final : public Backend {
23 friend void SynchronizeInternal(DirectoryGetter dir_getter, TitleIDVersion title, 27 friend void SynchronizeInternal(AM::Applets::AppletManager& applet_manager,
28 DirectoryGetter dir_getter, TitleIDVersion title,
24 ProgressServiceBackend& progress, 29 ProgressServiceBackend& progress,
25 std::optional<std::string> dir_name); 30 std::optional<std::string> dir_name);
26 31
27public: 32public:
28 explicit Boxcat(DirectoryGetter getter); 33 explicit Boxcat(AM::Applets::AppletManager& applet_manager_, DirectoryGetter getter);
29 ~Boxcat() override; 34 ~Boxcat() override;
30 35
31 bool Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) override; 36 bool Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) override;
@@ -53,6 +58,7 @@ private:
53 58
54 class Client; 59 class Client;
55 std::unique_ptr<Client> client; 60 std::unique_ptr<Client> client;
61 AM::Applets::AppletManager& applet_manager;
56}; 62};
57 63
58} // namespace Service::BCAT 64} // namespace Service::BCAT
diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp
index 4e4aa758b..6d9d1527d 100644
--- a/src/core/hle/service/bcat/module.cpp
+++ b/src/core/hle/service/bcat/module.cpp
@@ -125,7 +125,11 @@ private:
125class IBcatService final : public ServiceFramework<IBcatService> { 125class IBcatService final : public ServiceFramework<IBcatService> {
126public: 126public:
127 explicit IBcatService(Core::System& system_, Backend& backend_) 127 explicit IBcatService(Core::System& system_, Backend& backend_)
128 : ServiceFramework("IBcatService"), system{system_}, backend{backend_} { 128 : ServiceFramework("IBcatService"), system{system_}, backend{backend_},
129 progress{{
130 ProgressServiceBackend{system_.Kernel(), "Normal"},
131 ProgressServiceBackend{system_.Kernel(), "Directory"},
132 }} {
129 // clang-format off 133 // clang-format off
130 static const FunctionInfo functions[] = { 134 static const FunctionInfo functions[] = {
131 {10100, &IBcatService::RequestSyncDeliveryCache, "RequestSyncDeliveryCache"}, 135 {10100, &IBcatService::RequestSyncDeliveryCache, "RequestSyncDeliveryCache"},
@@ -249,10 +253,7 @@ private:
249 Core::System& system; 253 Core::System& system;
250 Backend& backend; 254 Backend& backend;
251 255
252 std::array<ProgressServiceBackend, static_cast<std::size_t>(SyncType::Count)> progress{ 256 std::array<ProgressServiceBackend, static_cast<std::size_t>(SyncType::Count)> progress;
253 ProgressServiceBackend{"Normal"},
254 ProgressServiceBackend{"Directory"},
255 };
256}; 257};
257 258
258void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) { 259void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) {
@@ -557,12 +558,12 @@ void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId(
557 rb.PushIpcInterface<IDeliveryCacheStorageService>(fsc.GetBCATDirectory(title_id)); 558 rb.PushIpcInterface<IDeliveryCacheStorageService>(fsc.GetBCATDirectory(title_id));
558} 559}
559 560
560std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) { 561std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System& system,
561 const auto backend = Settings::values.bcat_backend; 562 DirectoryGetter getter) {
562
563#ifdef YUZU_ENABLE_BOXCAT 563#ifdef YUZU_ENABLE_BOXCAT
564 if (backend == "boxcat") 564 if (Settings::values.bcat_backend == "boxcat") {
565 return std::make_unique<Boxcat>(std::move(getter)); 565 return std::make_unique<Boxcat>(system.GetAppletManager(), std::move(getter));
566 }
566#endif 567#endif
567 568
568 return std::make_unique<NullBackend>(std::move(getter)); 569 return std::make_unique<NullBackend>(std::move(getter));
@@ -571,7 +572,8 @@ std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) {
571Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_, 572Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_,
572 FileSystem::FileSystemController& fsc_, const char* name) 573 FileSystem::FileSystemController& fsc_, const char* name)
573 : ServiceFramework(name), fsc{fsc_}, module{std::move(module_)}, 574 : ServiceFramework(name), fsc{fsc_}, module{std::move(module_)},
574 backend{CreateBackendFromSettings([&fsc_](u64 tid) { return fsc_.GetBCATDirectory(tid); })}, 575 backend{CreateBackendFromSettings(system_,
576 [&fsc_](u64 tid) { return fsc_.GetBCATDirectory(tid); })},
575 system{system_} {} 577 system{system_} {}
576 578
577Module::Interface::~Interface() = default; 579Module::Interface::~Interface() = default;
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp
index e1a07d3ee..55b68eb0c 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.cpp
+++ b/src/core/hle/service/nvflinger/buffer_queue.cpp
@@ -14,8 +14,8 @@
14 14
15namespace Service::NVFlinger { 15namespace Service::NVFlinger {
16 16
17BufferQueue::BufferQueue(u32 id, u64 layer_id) : id(id), layer_id(layer_id) { 17BufferQueue::BufferQueue(Kernel::KernelCore& kernel, u32 id, u64 layer_id)
18 auto& kernel = Core::System::GetInstance().Kernel(); 18 : id(id), layer_id(layer_id) {
19 buffer_wait_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, 19 buffer_wait_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual,
20 "BufferQueue NativeHandle"); 20 "BufferQueue NativeHandle");
21} 21}
diff --git a/src/core/hle/service/nvflinger/buffer_queue.h b/src/core/hle/service/nvflinger/buffer_queue.h
index 356bedb81..8f9b18547 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.h
+++ b/src/core/hle/service/nvflinger/buffer_queue.h
@@ -15,6 +15,10 @@
15#include "core/hle/kernel/writable_event.h" 15#include "core/hle/kernel/writable_event.h"
16#include "core/hle/service/nvdrv/nvdata.h" 16#include "core/hle/service/nvdrv/nvdata.h"
17 17
18namespace Kernel {
19class KernelCore;
20}
21
18namespace Service::NVFlinger { 22namespace Service::NVFlinger {
19 23
20struct IGBPBuffer { 24struct IGBPBuffer {
@@ -44,7 +48,7 @@ public:
44 NativeWindowFormat = 2, 48 NativeWindowFormat = 2,
45 }; 49 };
46 50
47 BufferQueue(u32 id, u64 layer_id); 51 explicit BufferQueue(Kernel::KernelCore& kernel, u32 id, u64 layer_id);
48 ~BufferQueue(); 52 ~BufferQueue();
49 53
50 enum class BufferTransformFlags : u32 { 54 enum class BufferTransformFlags : u32 {
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index 2e4d707b9..368f83f6c 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -83,7 +83,7 @@ std::optional<u64> NVFlinger::CreateLayer(u64 display_id) {
83 83
84 const u64 layer_id = next_layer_id++; 84 const u64 layer_id = next_layer_id++;
85 const u32 buffer_queue_id = next_buffer_queue_id++; 85 const u32 buffer_queue_id = next_buffer_queue_id++;
86 buffer_queues.emplace_back(buffer_queue_id, layer_id); 86 buffer_queues.emplace_back(system.Kernel(), buffer_queue_id, layer_id);
87 display->CreateLayer(layer_id, buffer_queues.back()); 87 display->CreateLayer(layer_id, buffer_queues.back());
88 return layer_id; 88 return layer_id;
89} 89}
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index 76cfe8107..fbb9105d6 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -326,7 +326,7 @@ void GPU::ProcessSemaphoreTriggerMethod() {
326 block.sequence = regs.semaphore_sequence; 326 block.sequence = regs.semaphore_sequence;
327 // TODO(Kmather73): Generate a real GPU timestamp and write it here instead of 327 // TODO(Kmather73): Generate a real GPU timestamp and write it here instead of
328 // CoreTiming 328 // CoreTiming
329 block.timestamp = Core::System::GetInstance().CoreTiming().GetTicks(); 329 block.timestamp = system.CoreTiming().GetTicks();
330 memory_manager->WriteBlock(regs.semaphore_address.SemaphoreAddress(), &block, 330 memory_manager->WriteBlock(regs.semaphore_address.SemaphoreAddress(), &block,
331 sizeof(block)); 331 sizeof(block));
332 } else { 332 } else {