mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	olsc: rewrite IOlscServiceForApplication
This commit is contained in:
		@@ -12,10 +12,16 @@ namespace Service::OLSC {
 | 
				
			|||||||
void LoopProcess(Core::System& system) {
 | 
					void LoopProcess(Core::System& system) {
 | 
				
			||||||
    auto server_manager = std::make_unique<ServerManager>(system);
 | 
					    auto server_manager = std::make_unique<ServerManager>(system);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    server_manager->RegisterNamedService("olsc:u",
 | 
					    const auto OlscFactoryForApplication = [&] {
 | 
				
			||||||
                                         std::make_shared<IOlscServiceForApplication>(system));
 | 
					        return std::make_shared<IOlscServiceForApplication>(system);
 | 
				
			||||||
    server_manager->RegisterNamedService("olsc:s",
 | 
					    };
 | 
				
			||||||
                                         std::make_shared<IOlscServiceForSystemService>(system));
 | 
					
 | 
				
			||||||
 | 
					    const auto OlscFactoryForSystemService = [&] {
 | 
				
			||||||
 | 
					        return std::make_shared<IOlscServiceForSystemService>(system);
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    server_manager->RegisterNamedService("olsc:u", OlscFactoryForApplication);
 | 
				
			||||||
 | 
					    server_manager->RegisterNamedService("olsc:s", OlscFactoryForSystemService);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ServerManager::RunServer(std::move(server_manager));
 | 
					    ServerManager::RunServer(std::move(server_manager));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
 | 
					// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
 | 
				
			||||||
// SPDX-License-Identifier: GPL-2.0-or-later
 | 
					// SPDX-License-Identifier: GPL-2.0-or-later
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "core/hle/service/ipc_helpers.h"
 | 
					#include "core/hle/service/cmif_serialization.h"
 | 
				
			||||||
#include "core/hle/service/olsc/olsc_service_for_application.h"
 | 
					#include "core/hle/service/olsc/olsc_service_for_application.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Service::OLSC {
 | 
					namespace Service::OLSC {
 | 
				
			||||||
@@ -10,10 +10,10 @@ IOlscServiceForApplication::IOlscServiceForApplication(Core::System& system_)
 | 
				
			|||||||
    : ServiceFramework{system_, "olsc:u"} {
 | 
					    : ServiceFramework{system_, "olsc:u"} {
 | 
				
			||||||
    // clang-format off
 | 
					    // clang-format off
 | 
				
			||||||
        static const FunctionInfo functions[] = {
 | 
					        static const FunctionInfo functions[] = {
 | 
				
			||||||
            {0, &IOlscServiceForApplication::Initialize, "Initialize"},
 | 
					            {0, D<&IOlscServiceForApplication::Initialize>, "Initialize"},
 | 
				
			||||||
            {10, nullptr, "VerifySaveDataBackupLicenseAsync"},
 | 
					            {10, nullptr, "VerifySaveDataBackupLicenseAsync"},
 | 
				
			||||||
            {13, &IOlscServiceForApplication::GetSaveDataBackupSetting, "GetSaveDataBackupSetting"},
 | 
					            {13, D<&IOlscServiceForApplication::GetSaveDataBackupSetting>, "GetSaveDataBackupSetting"},
 | 
				
			||||||
            {14, &IOlscServiceForApplication::SetSaveDataBackupSettingEnabled, "SetSaveDataBackupSettingEnabled"},
 | 
					            {14, D<&IOlscServiceForApplication::SetSaveDataBackupSettingEnabled>, "SetSaveDataBackupSettingEnabled"},
 | 
				
			||||||
            {15, nullptr, "SetCustomData"},
 | 
					            {15, nullptr, "SetCustomData"},
 | 
				
			||||||
            {16, nullptr, "DeleteSaveDataBackupSetting"},
 | 
					            {16, nullptr, "DeleteSaveDataBackupSetting"},
 | 
				
			||||||
            {18, nullptr, "GetSaveDataBackupInfoCache"},
 | 
					            {18, nullptr, "GetSaveDataBackupInfoCache"},
 | 
				
			||||||
@@ -40,31 +40,24 @@ IOlscServiceForApplication::IOlscServiceForApplication(Core::System& system_)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
IOlscServiceForApplication::~IOlscServiceForApplication() = default;
 | 
					IOlscServiceForApplication::~IOlscServiceForApplication() = default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void IOlscServiceForApplication::Initialize(HLERequestContext& ctx) {
 | 
					Result IOlscServiceForApplication::Initialize(ClientProcessId process_id) {
 | 
				
			||||||
    LOG_WARNING(Service_OLSC, "(STUBBED) called");
 | 
					    LOG_WARNING(Service_OLSC, "(STUBBED) called");
 | 
				
			||||||
 | 
					 | 
				
			||||||
    initialized = true;
 | 
					    initialized = true;
 | 
				
			||||||
 | 
					    R_SUCCEED();
 | 
				
			||||||
    IPC::ResponseBuilder rb{ctx, 2};
 | 
					 | 
				
			||||||
    rb.Push(ResultSuccess);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void IOlscServiceForApplication::GetSaveDataBackupSetting(HLERequestContext& ctx) {
 | 
					Result IOlscServiceForApplication::GetSaveDataBackupSetting(Out<u8> out_save_data_backup_setting) {
 | 
				
			||||||
    LOG_WARNING(Service_OLSC, "(STUBBED) called");
 | 
					    LOG_WARNING(Service_OLSC, "(STUBBED) called");
 | 
				
			||||||
 | 
					 | 
				
			||||||
    // backup_setting is set to 0 since real value is unknown
 | 
					    // backup_setting is set to 0 since real value is unknown
 | 
				
			||||||
    constexpr u64 backup_setting = 0;
 | 
					    *out_save_data_backup_setting = 0;
 | 
				
			||||||
 | 
					    R_SUCCEED();
 | 
				
			||||||
    IPC::ResponseBuilder rb{ctx, 4};
 | 
					 | 
				
			||||||
    rb.Push(ResultSuccess);
 | 
					 | 
				
			||||||
    rb.Push(backup_setting);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void IOlscServiceForApplication::SetSaveDataBackupSettingEnabled(HLERequestContext& ctx) {
 | 
					Result IOlscServiceForApplication::SetSaveDataBackupSettingEnabled(bool enabled,
 | 
				
			||||||
    LOG_WARNING(Service_OLSC, "(STUBBED) called");
 | 
					                                                                   NS::Uid account_id) {
 | 
				
			||||||
 | 
					    LOG_WARNING(Service_OLSC, "(STUBBED) called, enabled={}, account_id={}", enabled,
 | 
				
			||||||
    IPC::ResponseBuilder rb{ctx, 2};
 | 
					                account_id.uuid.FormattedString());
 | 
				
			||||||
    rb.Push(ResultSuccess);
 | 
					    R_SUCCEED();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} // namespace Service::OLSC
 | 
					} // namespace Service::OLSC
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,8 @@
 | 
				
			|||||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
 | 
					// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
 | 
				
			||||||
// SPDX-License-Identifier: GPL-2.0-or-later
 | 
					// SPDX-License-Identifier: GPL-2.0-or-later
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "core/hle/service/cmif_types.h"
 | 
				
			||||||
 | 
					#include "core/hle/service/ns/ns_types.h"
 | 
				
			||||||
#include "core/hle/service/service.h"
 | 
					#include "core/hle/service/service.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Service::OLSC {
 | 
					namespace Service::OLSC {
 | 
				
			||||||
@@ -11,9 +13,9 @@ public:
 | 
				
			|||||||
    ~IOlscServiceForApplication() override;
 | 
					    ~IOlscServiceForApplication() override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    void Initialize(HLERequestContext& ctx);
 | 
					    Result Initialize(ClientProcessId process_id);
 | 
				
			||||||
    void GetSaveDataBackupSetting(HLERequestContext& ctx);
 | 
					    Result GetSaveDataBackupSetting(Out<u8> out_save_data_backup_setting);
 | 
				
			||||||
    void SetSaveDataBackupSettingEnabled(HLERequestContext& ctx);
 | 
					    Result SetSaveDataBackupSettingEnabled(bool enabled, NS::Uid account_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool initialized{};
 | 
					    bool initialized{};
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user