mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
core/aoc: Move IPurchaseEventManager to separate file
This commit is contained in:
parent
58c7e846cb
commit
aa6532cf34
4 changed files with 110 additions and 78 deletions
|
@ -483,6 +483,8 @@ add_library(core STATIC
|
||||||
hle/service/am/service/window_controller.h
|
hle/service/am/service/window_controller.h
|
||||||
hle/service/aoc/aoc_u.cpp
|
hle/service/aoc/aoc_u.cpp
|
||||||
hle/service/aoc/aoc_u.h
|
hle/service/aoc/aoc_u.h
|
||||||
|
hle/service/aoc/purchase_event_manager.cpp
|
||||||
|
hle/service/aoc/purchase_event_manager.h
|
||||||
hle/service/apm/apm.cpp
|
hle/service/apm/apm.cpp
|
||||||
hle/service/apm/apm.h
|
hle/service/apm/apm.h
|
||||||
hle/service/apm/apm_controller.cpp
|
hle/service/apm/apm_controller.cpp
|
||||||
|
|
|
@ -16,14 +16,13 @@
|
||||||
#include "core/file_sys/registered_cache.h"
|
#include "core/file_sys/registered_cache.h"
|
||||||
#include "core/hle/kernel/k_event.h"
|
#include "core/hle/kernel/k_event.h"
|
||||||
#include "core/hle/service/aoc/aoc_u.h"
|
#include "core/hle/service/aoc/aoc_u.h"
|
||||||
|
#include "core/hle/service/aoc/purchase_event_manager.h"
|
||||||
#include "core/hle/service/ipc_helpers.h"
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
#include "core/hle/service/server_manager.h"
|
#include "core/hle/service/server_manager.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
|
|
||||||
namespace Service::AOC {
|
namespace Service::AOC {
|
||||||
|
|
||||||
constexpr Result ResultNoPurchasedProductInfoAvailable{ErrorModule::NIMShop, 400};
|
|
||||||
|
|
||||||
static bool CheckAOCTitleIDMatchesBase(u64 title_id, u64 base) {
|
static bool CheckAOCTitleIDMatchesBase(u64 title_id, u64 base) {
|
||||||
return FileSys::GetBaseTitleID(title_id) == base;
|
return FileSys::GetBaseTitleID(title_id) == base;
|
||||||
}
|
}
|
||||||
|
@ -46,82 +45,6 @@ static std::vector<u64> AccumulateAOCTitleIDs(Core::System& system) {
|
||||||
return add_on_content;
|
return add_on_content;
|
||||||
}
|
}
|
||||||
|
|
||||||
class IPurchaseEventManager final : public ServiceFramework<IPurchaseEventManager> {
|
|
||||||
public:
|
|
||||||
explicit IPurchaseEventManager(Core::System& system_)
|
|
||||||
: ServiceFramework{system_, "IPurchaseEventManager"}, service_context{
|
|
||||||
system, "IPurchaseEventManager"} {
|
|
||||||
// clang-format off
|
|
||||||
static const FunctionInfo functions[] = {
|
|
||||||
{0, &IPurchaseEventManager::SetDefaultDeliveryTarget, "SetDefaultDeliveryTarget"},
|
|
||||||
{1, &IPurchaseEventManager::SetDeliveryTarget, "SetDeliveryTarget"},
|
|
||||||
{2, &IPurchaseEventManager::GetPurchasedEventReadableHandle, "GetPurchasedEventReadableHandle"},
|
|
||||||
{3, &IPurchaseEventManager::PopPurchasedProductInfo, "PopPurchasedProductInfo"},
|
|
||||||
{4, &IPurchaseEventManager::PopPurchasedProductInfoWithUid, "PopPurchasedProductInfoWithUid"},
|
|
||||||
};
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
RegisterHandlers(functions);
|
|
||||||
|
|
||||||
purchased_event = service_context.CreateEvent("IPurchaseEventManager:PurchasedEvent");
|
|
||||||
}
|
|
||||||
|
|
||||||
~IPurchaseEventManager() override {
|
|
||||||
service_context.CloseEvent(purchased_event);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void SetDefaultDeliveryTarget(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
|
|
||||||
const auto unknown_1 = rp.Pop<u64>();
|
|
||||||
[[maybe_unused]] const auto unknown_2 = ctx.ReadBuffer();
|
|
||||||
|
|
||||||
LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetDeliveryTarget(HLERequestContext& ctx) {
|
|
||||||
IPC::RequestParser rp{ctx};
|
|
||||||
|
|
||||||
const auto unknown_1 = rp.Pop<u64>();
|
|
||||||
[[maybe_unused]] const auto unknown_2 = ctx.ReadBuffer();
|
|
||||||
|
|
||||||
LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1);
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetPurchasedEventReadableHandle(HLERequestContext& ctx) {
|
|
||||||
LOG_WARNING(Service_AOC, "called");
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 1};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.PushCopyObjects(purchased_event->GetReadableEvent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void PopPurchasedProductInfo(HLERequestContext& ctx) {
|
|
||||||
LOG_DEBUG(Service_AOC, "(STUBBED) called");
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultNoPurchasedProductInfoAvailable);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PopPurchasedProductInfoWithUid(HLERequestContext& ctx) {
|
|
||||||
LOG_DEBUG(Service_AOC, "(STUBBED) called");
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultNoPurchasedProductInfoAvailable);
|
|
||||||
}
|
|
||||||
|
|
||||||
KernelHelpers::ServiceContext service_context;
|
|
||||||
|
|
||||||
Kernel::KEvent* purchased_event;
|
|
||||||
};
|
|
||||||
|
|
||||||
AOC_U::AOC_U(Core::System& system_)
|
AOC_U::AOC_U(Core::System& system_)
|
||||||
: ServiceFramework{system_, "aoc:u"}, add_on_content{AccumulateAOCTitleIDs(system)},
|
: ServiceFramework{system_, "aoc:u"}, add_on_content{AccumulateAOCTitleIDs(system)},
|
||||||
service_context{system_, "aoc:u"} {
|
service_context{system_, "aoc:u"} {
|
||||||
|
|
79
src/core/hle/service/aoc/purchase_event_manager.cpp
Normal file
79
src/core/hle/service/aoc/purchase_event_manager.cpp
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/aoc/purchase_event_manager.h"
|
||||||
|
#include "core/hle/service/ipc_helpers.h"
|
||||||
|
|
||||||
|
namespace Service::AOC {
|
||||||
|
|
||||||
|
constexpr Result ResultNoPurchasedProductInfoAvailable{ErrorModule::NIMShop, 400};
|
||||||
|
|
||||||
|
IPurchaseEventManager::IPurchaseEventManager(Core::System& system_)
|
||||||
|
: ServiceFramework{system_, "IPurchaseEventManager"},
|
||||||
|
service_context{system, "IPurchaseEventManager"} {
|
||||||
|
// clang-format off
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{0, &IPurchaseEventManager::SetDefaultDeliveryTarget, "SetDefaultDeliveryTarget"},
|
||||||
|
{1, &IPurchaseEventManager::SetDeliveryTarget, "SetDeliveryTarget"},
|
||||||
|
{2, &IPurchaseEventManager::GetPurchasedEventReadableHandle, "GetPurchasedEventReadableHandle"},
|
||||||
|
{3, &IPurchaseEventManager::PopPurchasedProductInfo, "PopPurchasedProductInfo"},
|
||||||
|
{4, &IPurchaseEventManager::PopPurchasedProductInfoWithUid, "PopPurchasedProductInfoWithUid"},
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
|
||||||
|
purchased_event = service_context.CreateEvent("IPurchaseEventManager:PurchasedEvent");
|
||||||
|
}
|
||||||
|
|
||||||
|
IPurchaseEventManager::~IPurchaseEventManager() {
|
||||||
|
service_context.CloseEvent(purchased_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPurchaseEventManager::SetDefaultDeliveryTarget(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
|
||||||
|
const auto unknown_1 = rp.Pop<u64>();
|
||||||
|
[[maybe_unused]] const auto unknown_2 = ctx.ReadBuffer();
|
||||||
|
|
||||||
|
LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPurchaseEventManager::SetDeliveryTarget(HLERequestContext& ctx) {
|
||||||
|
IPC::RequestParser rp{ctx};
|
||||||
|
|
||||||
|
const auto unknown_1 = rp.Pop<u64>();
|
||||||
|
[[maybe_unused]] const auto unknown_2 = ctx.ReadBuffer();
|
||||||
|
|
||||||
|
LOG_WARNING(Service_AOC, "(STUBBED) called, unknown_1={}", unknown_1);
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPurchaseEventManager::GetPurchasedEventReadableHandle(HLERequestContext& ctx) {
|
||||||
|
LOG_WARNING(Service_AOC, "called");
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2, 1};
|
||||||
|
rb.Push(ResultSuccess);
|
||||||
|
rb.PushCopyObjects(purchased_event->GetReadableEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPurchaseEventManager::PopPurchasedProductInfo(HLERequestContext& ctx) {
|
||||||
|
LOG_DEBUG(Service_AOC, "(STUBBED) called");
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultNoPurchasedProductInfoAvailable);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IPurchaseEventManager::PopPurchasedProductInfoWithUid(HLERequestContext& ctx) {
|
||||||
|
LOG_DEBUG(Service_AOC, "(STUBBED) called");
|
||||||
|
|
||||||
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
rb.Push(ResultNoPurchasedProductInfoAvailable);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::AOC
|
28
src/core/hle/service/aoc/purchase_event_manager.h
Normal file
28
src/core/hle/service/aoc/purchase_event_manager.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/hle/service/kernel_helpers.h"
|
||||||
|
#include "core/hle/service/os/event.h"
|
||||||
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
|
namespace Service::AOC {
|
||||||
|
|
||||||
|
class IPurchaseEventManager final : public ServiceFramework<IPurchaseEventManager> {
|
||||||
|
public:
|
||||||
|
explicit IPurchaseEventManager(Core::System& system_);
|
||||||
|
~IPurchaseEventManager() override;
|
||||||
|
|
||||||
|
void SetDefaultDeliveryTarget(HLERequestContext& ctx);
|
||||||
|
void SetDeliveryTarget(HLERequestContext& ctx);
|
||||||
|
void GetPurchasedEventReadableHandle(HLERequestContext& ctx);
|
||||||
|
void PopPurchasedProductInfo(HLERequestContext& ctx);
|
||||||
|
void PopPurchasedProductInfoWithUid(HLERequestContext& ctx);
|
||||||
|
|
||||||
|
private:
|
||||||
|
KernelHelpers::ServiceContext service_context;
|
||||||
|
Kernel::KEvent* purchased_event;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Service::AOC
|
Loading…
Reference in a new issue