mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 22:57:22 +00:00
service: bcat: Implement news interfaces
This commit is contained in:
parent
7c2e9a6596
commit
909f7eb3d2
14 changed files with 425 additions and 0 deletions
|
@ -512,6 +512,18 @@ add_library(core STATIC
|
|||
hle/service/audio/hwopus.h
|
||||
hle/service/bcat/backend/backend.cpp
|
||||
hle/service/bcat/backend/backend.h
|
||||
hle/service/bcat/news/newly_arrived_event_holder.cpp
|
||||
hle/service/bcat/news/newly_arrived_event_holder.h
|
||||
hle/service/bcat/news/news_data_service.cpp
|
||||
hle/service/bcat/news/news_data_service.h
|
||||
hle/service/bcat/news/news_database_service.cpp
|
||||
hle/service/bcat/news/news_database_service.h
|
||||
hle/service/bcat/news/news_interface.cpp
|
||||
hle/service/bcat/news/news_interface.h
|
||||
hle/service/bcat/news/news_service.cpp
|
||||
hle/service/bcat/news/news_service.h
|
||||
hle/service/bcat/news/overwrite_event_holder.cpp
|
||||
hle/service/bcat/news/overwrite_event_holder.h
|
||||
hle/service/bcat/bcat.cpp
|
||||
hle/service/bcat/bcat.h
|
||||
hle/service/bcat/bcat_interface.cpp
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "core/hle/service/bcat/backend/backend.h"
|
||||
#include "core/hle/service/bcat/bcat.h"
|
||||
#include "core/hle/service/bcat/bcat_interface.h"
|
||||
#include "core/hle/service/bcat/news/news_interface.h"
|
||||
#include "core/hle/service/server_manager.h"
|
||||
|
||||
namespace Service::BCAT {
|
||||
|
@ -20,6 +21,17 @@ void LoopProcess(Core::System& system) {
|
|||
server_manager->RegisterNamedService("bcat:s",
|
||||
std::make_shared<BcatInterface>(system, "bcat:s"));
|
||||
|
||||
server_manager->RegisterNamedService(
|
||||
"news:a", std::make_shared<NewsInterface>(system, 0xffffffff, "news:a"));
|
||||
server_manager->RegisterNamedService("news:p",
|
||||
std::make_shared<NewsInterface>(system, 0x1, "news:p"));
|
||||
server_manager->RegisterNamedService("news:c",
|
||||
std::make_shared<NewsInterface>(system, 0x2, "news:c"));
|
||||
server_manager->RegisterNamedService("news:v",
|
||||
std::make_shared<NewsInterface>(system, 0x4, "news:v"));
|
||||
server_manager->RegisterNamedService("news:m",
|
||||
std::make_shared<NewsInterface>(system, 0xd, "news:m"));
|
||||
|
||||
ServerManager::RunServer(std::move(server_manager));
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "core/hle/service/bcat/news/newly_arrived_event_holder.h"
|
||||
#include "core/hle/service/cmif_serialization.h"
|
||||
|
||||
namespace Service::BCAT {
|
||||
|
||||
INewlyArrivedEventHolder::INewlyArrivedEventHolder(Core::System& system_)
|
||||
: ServiceFramework{system_, "INewlyArrivedEventHolder"}, service_context{
|
||||
system_,
|
||||
"INewlyArrivedEventHolder"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, C<&INewlyArrivedEventHolder::Get>, "Get"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
RegisterHandlers(functions);
|
||||
arrived_event = service_context.CreateEvent("INewlyArrivedEventHolder::ArrivedEvent");
|
||||
}
|
||||
|
||||
INewlyArrivedEventHolder::~INewlyArrivedEventHolder() = default;
|
||||
|
||||
Result INewlyArrivedEventHolder::Get(OutCopyHandle<Kernel::KReadableEvent> out_event) {
|
||||
LOG_INFO(Service_BCAT, "called");
|
||||
|
||||
*out_event = &arrived_event->GetReadableEvent();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
} // namespace Service::BCAT
|
33
src/core/hle/service/bcat/news/newly_arrived_event_holder.h
Normal file
33
src/core/hle/service/bcat/news/newly_arrived_event_holder.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/hle/service/cmif_types.h"
|
||||
#include "core/hle/service/kernel_helpers.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Kernel {
|
||||
class KEvent;
|
||||
class KReadableEvent;
|
||||
} // namespace Kernel
|
||||
|
||||
namespace Service::BCAT {
|
||||
|
||||
class INewlyArrivedEventHolder final : public ServiceFramework<INewlyArrivedEventHolder> {
|
||||
public:
|
||||
explicit INewlyArrivedEventHolder(Core::System& system_);
|
||||
~INewlyArrivedEventHolder() override;
|
||||
|
||||
private:
|
||||
Result Get(OutCopyHandle<Kernel::KReadableEvent> out_event);
|
||||
|
||||
Kernel::KEvent* arrived_event;
|
||||
KernelHelpers::ServiceContext service_context;
|
||||
};
|
||||
|
||||
} // namespace Service::BCAT
|
25
src/core/hle/service/bcat/news/news_data_service.cpp
Normal file
25
src/core/hle/service/bcat/news/news_data_service.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "core/hle/service/bcat/news/news_data_service.h"
|
||||
|
||||
namespace Service::BCAT {
|
||||
|
||||
INewsDataService::INewsDataService(Core::System& system_)
|
||||
: ServiceFramework{system_, "INewsDataService"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "Open"},
|
||||
{1, nullptr, "OpenWithNewsRecordV1"},
|
||||
{2, nullptr, "Read"},
|
||||
{3, nullptr, "GetSize"},
|
||||
{1001, nullptr, "OpenWithNewsRecord"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
INewsDataService::~INewsDataService() = default;
|
||||
|
||||
} // namespace Service::BCAT
|
20
src/core/hle/service/bcat/news/news_data_service.h
Normal file
20
src/core/hle/service/bcat/news/news_data_service.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Service::BCAT {
|
||||
|
||||
class INewsDataService final : public ServiceFramework<INewsDataService> {
|
||||
public:
|
||||
explicit INewsDataService(Core::System& system_);
|
||||
~INewsDataService() override;
|
||||
};
|
||||
|
||||
} // namespace Service::BCAT
|
35
src/core/hle/service/bcat/news/news_database_service.cpp
Normal file
35
src/core/hle/service/bcat/news/news_database_service.cpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "core/hle/service/bcat/news/news_database_service.h"
|
||||
#include "core/hle/service/cmif_serialization.h"
|
||||
|
||||
namespace Service::BCAT {
|
||||
|
||||
INewsDatabaseService::INewsDatabaseService(Core::System& system_)
|
||||
: ServiceFramework{system_, "INewsDatabaseService"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "GetListV1"},
|
||||
{1, C<&INewsDatabaseService::Count>, "Count"},
|
||||
{2, nullptr, "CountWithKey"},
|
||||
{3, nullptr, "UpdateIntegerValue"},
|
||||
{4, nullptr, "UpdateIntegerValueWithAddition"},
|
||||
{5, nullptr, "UpdateStringValue"},
|
||||
{1000, nullptr, "GetList"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
INewsDatabaseService::~INewsDatabaseService() = default;
|
||||
|
||||
Result INewsDatabaseService::Count(Out<u32> out_count,
|
||||
InBuffer<BufferAttr_HipcPointer> buffer_data) {
|
||||
LOG_WARNING(Service_BCAT, "(STUBBED) called, buffer_size={}", buffer_data.size());
|
||||
*out_count = 0;
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
} // namespace Service::BCAT
|
24
src/core/hle/service/bcat/news/news_database_service.h
Normal file
24
src/core/hle/service/bcat/news/news_database_service.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/hle/service/cmif_types.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Service::BCAT {
|
||||
|
||||
class INewsDatabaseService final : public ServiceFramework<INewsDatabaseService> {
|
||||
public:
|
||||
explicit INewsDatabaseService(Core::System& system_);
|
||||
~INewsDatabaseService() override;
|
||||
|
||||
private:
|
||||
Result Count(Out<u32> out_count, InBuffer<BufferAttr_HipcPointer> buffer_data);
|
||||
};
|
||||
|
||||
} // namespace Service::BCAT
|
63
src/core/hle/service/bcat/news/news_interface.cpp
Normal file
63
src/core/hle/service/bcat/news/news_interface.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "core/hle/service/bcat/news/newly_arrived_event_holder.h"
|
||||
#include "core/hle/service/bcat/news/news_data_service.h"
|
||||
#include "core/hle/service/bcat/news/news_database_service.h"
|
||||
#include "core/hle/service/bcat/news/news_interface.h"
|
||||
#include "core/hle/service/bcat/news/news_service.h"
|
||||
#include "core/hle/service/bcat/news/overwrite_event_holder.h"
|
||||
#include "core/hle/service/cmif_serialization.h"
|
||||
|
||||
namespace Service::BCAT {
|
||||
|
||||
NewsInterface::NewsInterface(Core::System& system_, u32 permissions_, const char* name_)
|
||||
: ServiceFramework{system_, name_}, permissions{permissions_} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, C<&NewsInterface::CreateNewsService>, "CreateNewsService"},
|
||||
{1, C<&NewsInterface::CreateNewlyArrivedEventHolder>, "CreateNewlyArrivedEventHolder"},
|
||||
{2, C<&NewsInterface::CreateNewsDataService>, "CreateNewsDataService"},
|
||||
{3, C<&NewsInterface::CreateNewsDatabaseService>, "CreateNewsDatabaseService"},
|
||||
{4, C<&NewsInterface::CreateOverwriteEventHolder>, "CreateOverwriteEventHolder"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
NewsInterface::~NewsInterface() = default;
|
||||
|
||||
Result NewsInterface::CreateNewsService(OutInterface<INewsService> out_interface) {
|
||||
LOG_INFO(Service_BCAT, "called");
|
||||
*out_interface = std::make_shared<INewsService>(system);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result NewsInterface::CreateNewlyArrivedEventHolder(
|
||||
OutInterface<INewlyArrivedEventHolder> out_interface) {
|
||||
LOG_INFO(Service_BCAT, "called");
|
||||
*out_interface = std::make_shared<INewlyArrivedEventHolder>(system);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result NewsInterface::CreateNewsDataService(OutInterface<INewsDataService> out_interface) {
|
||||
LOG_INFO(Service_BCAT, "called");
|
||||
*out_interface = std::make_shared<INewsDataService>(system);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result NewsInterface::CreateNewsDatabaseService(OutInterface<INewsDatabaseService> out_interface) {
|
||||
LOG_INFO(Service_BCAT, "called");
|
||||
*out_interface = std::make_shared<INewsDatabaseService>(system);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result NewsInterface::CreateOverwriteEventHolder(
|
||||
OutInterface<IOverwriteEventHolder> out_interface) {
|
||||
LOG_INFO(Service_BCAT, "called");
|
||||
*out_interface = std::make_shared<IOverwriteEventHolder>(system);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
} // namespace Service::BCAT
|
35
src/core/hle/service/bcat/news/news_interface.h
Normal file
35
src/core/hle/service/bcat/news/news_interface.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/hle/service/cmif_types.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Service::BCAT {
|
||||
class INewsService;
|
||||
class INewlyArrivedEventHolder;
|
||||
class INewsDataService;
|
||||
class INewsDatabaseService;
|
||||
class IOverwriteEventHolder;
|
||||
|
||||
class NewsInterface final : public ServiceFramework<NewsInterface> {
|
||||
public:
|
||||
explicit NewsInterface(Core::System& system_, u32 permissions_, const char* name_);
|
||||
~NewsInterface() override;
|
||||
|
||||
private:
|
||||
Result CreateNewsService(OutInterface<INewsService> out_interface);
|
||||
Result CreateNewlyArrivedEventHolder(OutInterface<INewlyArrivedEventHolder> out_interface);
|
||||
Result CreateNewsDataService(OutInterface<INewsDataService> out_interface);
|
||||
Result CreateNewsDatabaseService(OutInterface<INewsDatabaseService> out_interface);
|
||||
Result CreateOverwriteEventHolder(OutInterface<IOverwriteEventHolder> out_interface);
|
||||
|
||||
u32 permissions;
|
||||
};
|
||||
|
||||
} // namespace Service::BCAT
|
46
src/core/hle/service/bcat/news/news_service.cpp
Normal file
46
src/core/hle/service/bcat/news/news_service.cpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "core/hle/service/bcat/news/news_service.h"
|
||||
#include "core/hle/service/cmif_serialization.h"
|
||||
|
||||
namespace Service::BCAT {
|
||||
|
||||
INewsService::INewsService(Core::System& system_) : ServiceFramework{system_, "INewsService"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{10100, nullptr, "PostLocalNews"},
|
||||
{20100, nullptr, "SetPassphrase"},
|
||||
{30100, C<&INewsService::GetSubscriptionStatus>, "GetSubscriptionStatus"},
|
||||
{30101, nullptr, "GetTopicList"},
|
||||
{30110, nullptr, "Unknown30110"},
|
||||
{30200, nullptr, "IsSystemUpdateRequired"},
|
||||
{30201, nullptr, "Unknown30201"},
|
||||
{30210, nullptr, "Unknown30210"},
|
||||
{30300, nullptr, "RequestImmediateReception"},
|
||||
{30400, nullptr, "DecodeArchiveFile"},
|
||||
{30500, nullptr, "Unknown30500"},
|
||||
{30900, nullptr, "Unknown30900"},
|
||||
{30901, nullptr, "Unknown30901"},
|
||||
{30902, nullptr, "Unknown30902"},
|
||||
{40100, nullptr, "SetSubscriptionStatus"},
|
||||
{40101, nullptr, "RequestAutoSubscription"},
|
||||
{40200, nullptr, "ClearStorage"},
|
||||
{40201, nullptr, "ClearSubscriptionStatusAll"},
|
||||
{90100, nullptr, "GetNewsDatabaseDump"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
INewsService::~INewsService() = default;
|
||||
|
||||
Result INewsService::GetSubscriptionStatus(Out<u32> out_status,
|
||||
InBuffer<BufferAttr_HipcPointer> buffer_data) {
|
||||
LOG_WARNING(Service_BCAT, "(STUBBED) called, buffer_size={}", buffer_data.size());
|
||||
*out_status = 0;
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
} // namespace Service::BCAT
|
24
src/core/hle/service/bcat/news/news_service.h
Normal file
24
src/core/hle/service/bcat/news/news_service.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/hle/service/cmif_types.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Service::BCAT {
|
||||
|
||||
class INewsService final : public ServiceFramework<INewsService> {
|
||||
public:
|
||||
explicit INewsService(Core::System& system_);
|
||||
~INewsService() override;
|
||||
|
||||
private:
|
||||
Result GetSubscriptionStatus(Out<u32> out_status, InBuffer<BufferAttr_HipcPointer> buffer_data);
|
||||
};
|
||||
|
||||
} // namespace Service::BCAT
|
31
src/core/hle/service/bcat/news/overwrite_event_holder.cpp
Normal file
31
src/core/hle/service/bcat/news/overwrite_event_holder.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "core/hle/service/bcat/news/overwrite_event_holder.h"
|
||||
#include "core/hle/service/cmif_serialization.h"
|
||||
|
||||
namespace Service::BCAT {
|
||||
|
||||
IOverwriteEventHolder::IOverwriteEventHolder(Core::System& system_)
|
||||
: ServiceFramework{system_, "IOverwriteEventHolder"}, service_context{system_,
|
||||
"IOverwriteEventHolder"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, C<&IOverwriteEventHolder::Get>, "Get"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
RegisterHandlers(functions);
|
||||
overwrite_event = service_context.CreateEvent("IOverwriteEventHolder::OverwriteEvent");
|
||||
}
|
||||
|
||||
IOverwriteEventHolder::~IOverwriteEventHolder() = default;
|
||||
|
||||
Result IOverwriteEventHolder::Get(OutCopyHandle<Kernel::KReadableEvent> out_event) {
|
||||
LOG_INFO(Service_BCAT, "called");
|
||||
|
||||
*out_event = &overwrite_event->GetReadableEvent();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
} // namespace Service::BCAT
|
33
src/core/hle/service/bcat/news/overwrite_event_holder.h
Normal file
33
src/core/hle/service/bcat/news/overwrite_event_holder.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/hle/service/cmif_types.h"
|
||||
#include "core/hle/service/kernel_helpers.h"
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Core {
|
||||
class System;
|
||||
}
|
||||
|
||||
namespace Kernel {
|
||||
class KEvent;
|
||||
class KReadableEvent;
|
||||
} // namespace Kernel
|
||||
|
||||
namespace Service::BCAT {
|
||||
|
||||
class IOverwriteEventHolder final : public ServiceFramework<IOverwriteEventHolder> {
|
||||
public:
|
||||
explicit IOverwriteEventHolder(Core::System& system_);
|
||||
~IOverwriteEventHolder() override;
|
||||
|
||||
private:
|
||||
Result Get(OutCopyHandle<Kernel::KReadableEvent> out_event);
|
||||
|
||||
Kernel::KEvent* overwrite_event;
|
||||
KernelHelpers::ServiceContext service_context;
|
||||
};
|
||||
|
||||
} // namespace Service::BCAT
|
Loading…
Reference in a new issue