mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-27 17:11:00 +01:00
erpt: skeleton sprofile apis
This commit is contained in:
parent
5c89aaf31a
commit
39688c7d47
@ -88,6 +88,7 @@
|
||||
#include <stratosphere/sm.hpp>
|
||||
#include <stratosphere/socket.hpp>
|
||||
#include <stratosphere/spl.hpp>
|
||||
#include <stratosphere/sprofile.hpp>
|
||||
#include <stratosphere/time.hpp>
|
||||
#include <stratosphere/tipc.hpp>
|
||||
#include <stratosphere/tma.hpp>
|
||||
|
@ -168,6 +168,9 @@ namespace ams::impl {
|
||||
AMS_DEFINE_SYSTEM_THREAD(21, TioServer, FileServerHtcsServer);
|
||||
AMS_DEFINE_SYSTEM_THREAD(21, TioServer, SdCardObserver);
|
||||
|
||||
/* ServiceProfile */
|
||||
AMS_DEFINE_SYSTEM_THREAD(-1, sprofile, IpcServer);
|
||||
|
||||
|
||||
#undef AMS_DEFINE_SYSTEM_THREAD
|
||||
|
||||
|
@ -171,6 +171,9 @@
|
||||
HANDLER(AcpUserAccountSettingsInfo, 130) \
|
||||
HANDLER(AudioDeviceInfo, 131) \
|
||||
HANDLER(AbnormalWakeInfo, 132) \
|
||||
HANDLER(ServiceProfileInfo, 133) \
|
||||
HANDLER(BluetoothAudioInfo, 134) \
|
||||
HANDLER(BluetoothPairingCountInfo, 135) \
|
||||
|
||||
#define AMS_ERPT_FOREACH_FIELD(HANDLER) \
|
||||
HANDLER(TestU64, 0, Test, FieldType_NumericU64, FieldFlag_None ) \
|
||||
@ -812,4 +815,15 @@
|
||||
HANDLER(AppletTotalActiveTime, 636, ErrorInfoAuto, FieldType_NumericI64, FieldFlag_None ) \
|
||||
HANDLER(WakeCount, 637, AbnormalWakeInfo, FieldType_NumericU32, FieldFlag_None ) \
|
||||
HANDLER(PredominantWakeReason, 638, AbnormalWakeInfo, FieldType_NumericU32, FieldFlag_None ) \
|
||||
HANDLER(EdidExtensionBlock2, 639, EdidInfo, FieldType_U8Array, FieldFlag_None ) \
|
||||
HANDLER(EdidExtensionBlock3, 640, EdidInfo, FieldType_U8Array, FieldFlag_None ) \
|
||||
HANDLER(LumenRequestId, 641, ErrorInfo, FieldType_String, FieldFlag_None ) \
|
||||
HANDLER(LlnwLlid, 642, ErrorInfo, FieldType_String, FieldFlag_None ) \
|
||||
HANDLER(SupportingLimitedLicenses, 643, RunningApplicationInfo, FieldType_NumericU32, FieldFlag_None ) \
|
||||
HANDLER(RuntimeLimitedLicenseUpgrade, 644, RunningApplicationInfo, FieldType_NumericU8, FieldFlag_None ) \
|
||||
HANDLER(ServiceProfileRevisionKey, 645, ServiceProfileInfo, FieldType_NumericU64, FieldFlag_None ) \
|
||||
HANDLER(BluetoothAudioConnectionCount, 646, BluetoothAudioInfo, FieldType_NumericU8, FieldFlag_None ) \
|
||||
HANDLER(BluetoothHidPairingInfoCount, 647, BluetoothPairingCountInfo, FieldType_NumericU8, FieldFlag_None ) \
|
||||
HANDLER(BluetoothAudioPairingInfoCount, 648, BluetoothPairingCountInfo, FieldType_NumericU8, FieldFlag_None ) \
|
||||
HANDLER(BluetoothLePairingInfoCount, 649, BluetoothPairingCountInfo, FieldType_NumericU8, FieldFlag_None ) \
|
||||
|
||||
|
19
libraries/libstratosphere/include/stratosphere/sprofile.hpp
Normal file
19
libraries/libstratosphere/include/stratosphere/sprofile.hpp
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stratosphere/sprofile/sprofile_types.hpp>
|
||||
#include <stratosphere/sprofile/srv/sprofile_srv_api.hpp>
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::sprofile {
|
||||
|
||||
struct Identifier {
|
||||
u8 data[7];
|
||||
|
||||
friend bool operator==(const Identifier &lhs, const Identifier &rhs) {
|
||||
return std::memcmp(lhs.data, rhs.data, sizeof(lhs.data)) == 0;
|
||||
}
|
||||
|
||||
friend bool operator!=(const Identifier &lhs, const Identifier &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(Identifier) == 7);
|
||||
static_assert(util::is_pod<Identifier>::value);
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::sprofile::srv {
|
||||
|
||||
void Initialize();
|
||||
void StartIpcServer();
|
||||
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
#include "sprofile_srv_profile_manager.hpp"
|
||||
#include "sprofile_srv_service_for_bg_agent.hpp"
|
||||
#include "sprofile_srv_service_for_system_process.hpp"
|
||||
|
||||
namespace ams::sprofile::srv {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr const ProfileManager::SaveDataInfo SaveDataInfo = {
|
||||
.id = 0x8000000000000220,
|
||||
.mount_name = "sprof",
|
||||
.size = 0x1C0000,
|
||||
.journal_size = 0x80000,
|
||||
.flags = fs::SaveDataFlags_KeepAfterResettingSystemSaveData,
|
||||
};
|
||||
|
||||
constexpr const sm::ServiceName ServiceNameForBgAgent = sm::ServiceName::Encode("sprof:bg");
|
||||
constexpr const sm::ServiceName ServiceNameForSystemProcess = sm::ServiceName::Encode("sprof:sp");
|
||||
|
||||
constexpr inline size_t BgAgentSessionCountMax = 2;
|
||||
constexpr inline size_t SystemProcessSessionCountMax = 5;
|
||||
|
||||
constexpr inline size_t SessionCountMax = BgAgentSessionCountMax + SystemProcessSessionCountMax;
|
||||
|
||||
constexpr inline size_t PortCountMax = 2;
|
||||
|
||||
struct ServerManagerOptions {
|
||||
static constexpr size_t PointerBufferSize = 0x0;
|
||||
static constexpr size_t MaxDomains = SessionCountMax; /* NOTE: Official is 3 */
|
||||
static constexpr size_t MaxDomainObjects = 16; /* NOTE: Official is 8 */
|
||||
};
|
||||
|
||||
using ServerManager = sf::hipc::ServerManager<PortCountMax, ServerManagerOptions, SessionCountMax>;
|
||||
|
||||
constinit util::TypedStorage<ProfileManager> g_profile_manager;
|
||||
|
||||
constinit util::TypedStorage<sf::UnmanagedServiceObject<ISprofileServiceForBgAgent, ServiceForBgAgent>> g_bg_service_object;
|
||||
constinit util::TypedStorage<sf::UnmanagedServiceObject<ISprofileServiceForSystemProcess, ServiceForSystemProcess>> g_sp_service_object;
|
||||
|
||||
constinit util::TypedStorage<ServerManager> g_server_manager;
|
||||
|
||||
alignas(os::ThreadStackAlignment) constinit u8 g_ipc_thread_stack[0x3000];
|
||||
constinit u8 g_heap[16_KB];
|
||||
|
||||
constinit os::ThreadType g_ipc_thread;
|
||||
|
||||
constinit lmem::HeapHandle g_heap_handle;
|
||||
constinit sf::ExpHeapMemoryResource g_sf_memory_resource;
|
||||
|
||||
void IpcServerThreadFunction(void *) {
|
||||
/* Get the server manager. */
|
||||
auto &server_manager = util::GetReference(g_server_manager);
|
||||
|
||||
/* Resume processing. */
|
||||
server_manager.ResumeProcessing();
|
||||
|
||||
/* Loop processing. */
|
||||
server_manager.LoopProcess();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Initialize() {
|
||||
/* Initialize heap. */
|
||||
g_heap_handle = lmem::CreateExpHeap(g_heap, sizeof(g_heap), lmem::CreateOption_ThreadSafe);
|
||||
|
||||
/* Attach the memory resource to heap. */
|
||||
g_sf_memory_resource.Attach(g_heap_handle);
|
||||
|
||||
/* Create the profile manager. */
|
||||
util::ConstructAt(g_profile_manager, SaveDataInfo);
|
||||
|
||||
/* Create the service objects. */
|
||||
util::ConstructAt(g_bg_service_object, std::addressof(g_sf_memory_resource), util::GetPointer(g_profile_manager));
|
||||
util::ConstructAt(g_sp_service_object, std::addressof(g_sf_memory_resource), util::GetPointer(g_profile_manager));
|
||||
|
||||
/* Create the server manager. */
|
||||
util::ConstructAt(g_server_manager);
|
||||
|
||||
/* Create services. */
|
||||
R_ABORT_UNLESS(util::GetReference(g_server_manager).RegisterObjectForServer(util::GetReference(g_bg_service_object).GetShared(), ServiceNameForBgAgent, BgAgentSessionCountMax));
|
||||
R_ABORT_UNLESS(util::GetReference(g_server_manager).RegisterObjectForServer(util::GetReference(g_sp_service_object).GetShared(), ServiceNameForSystemProcess, SystemProcessSessionCountMax));
|
||||
}
|
||||
|
||||
void StartIpcServer() {
|
||||
/* Create the ipc server thread. */
|
||||
R_ABORT_UNLESS(os::CreateThread(std::addressof(g_ipc_thread), IpcServerThreadFunction, nullptr, g_ipc_thread_stack, sizeof(g_ipc_thread_stack), AMS_GET_SYSTEM_THREAD_PRIORITY(sprofile, IpcServer)));
|
||||
os::SetThreadNamePointer(std::addressof(g_ipc_thread), AMS_GET_SYSTEM_THREAD_NAME(sprofile, IpcServer));
|
||||
|
||||
/* Start the ipc server thread. */
|
||||
os::StartThread(std::addressof(g_ipc_thread));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
#define AMS_SPROFILE_I_PROFILE_CONTROLLER_FOR_DEBUG_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 2000, Result, Reset, (), ()) \
|
||||
AMS_SF_METHOD_INFO(C, H, 2001, Result, GetRaw, (sf::Out<u8> out_type, sf::Out<u64> out_value, sprofile::Identifier profile, sprofile::Identifier key), (out_type, out_value, profile, key))
|
||||
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(ams::sprofile, IProfileControllerForDebug, AMS_SPROFILE_I_PROFILE_CONTROLLER_FOR_DEBUG_INTERFACE_INFO)
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
/* TODO: sf::LargeData types, not buffers */
|
||||
#define AMS_SPROFILE_I_PROFILE_IMPORTER_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 0, Result, ImportProfile, (const sf::InBuffer &data), (data)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 1, Result, Commit, (), ()) \
|
||||
AMS_SF_METHOD_INFO(C, H, 0, Result, ImportMetadata, (const sf::InBuffer &data), (data)) \
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(ams::sprofile, IProfileImporter, AMS_SPROFILE_I_PROFILE_IMPORTER_INTERFACE_INFO)
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
#define AMS_SPROFILE_I_PROFILE_READER_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 0, Result, GetSigned64, (sf::Out<s64> out, sprofile::Identifier profile, sprofile::Identifier key), (out, profile, key)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 1, Result, GetUnsigned64, (sf::Out<u64> out, sprofile::Identifier profile, sprofile::Identifier key), (out, profile, key)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 2, Result, GetSigned32, (sf::Out<s32> out, sprofile::Identifier profile, sprofile::Identifier key), (out, profile, key)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 3, Result, GetUnsigned32, (sf::Out<u32> out, sprofile::Identifier profile, sprofile::Identifier key), (out, profile, key)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 3, Result, GetByte, (sf::Out<u8> out, sprofile::Identifier profile, sprofile::Identifier key), (out, profile, key))
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(ams::sprofile, IProfileReader, AMS_SPROFILE_I_PROFILE_READER_INTERFACE_INFO)
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
#define AMS_SPROFILE_I_PROFILE_UPDATE_OBSERVER_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 0, Result, Listen, (sprofile::Identifier profile), (profile)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 1, Result, Unlisten, (sprofile::Identifier profile), (profile)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 2, Result, GetEventHandle, (ams::sf::OutCopyHandle out), (out))
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(ams::sprofile, IProfileUpdateObserver, AMS_SPROFILE_I_PROFILE_UPDATE_OBSERVER_INTERFACE_INFO)
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <stratosphere.hpp>
|
||||
#include "sprofile_srv_i_profile_importer.hpp"
|
||||
|
||||
/* TODO: sf::LargeData types, not buffers */
|
||||
#define AMS_SPROFILE_I_SPROFILE_SERVICE_FOR_BG_AGENT_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 100, Result, OpenProfileImporter, (sf::Out<sf::SharedPointer<::ams::sprofile::IProfileImporter>> out), (out)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 200, Result, ReadMetadata, (sf::Out<u32> out_count, const sf::OutBuffer &out_buf, const sf::InBuffer &meta), (out_count, out_buf, meta)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 201, Result, IsUpdateNeeded, (sf::Out<bool> out, sprofile::Identifier revision_key), (out, revision_key)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 2000, Result, Reset, (), ())
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(ams::sprofile, ISprofileServiceForBgAgent, AMS_SPROFILE_I_SPROFILE_SERVICE_FOR_BG_AGENT_INTERFACE_INFO)
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <stratosphere.hpp>
|
||||
#include "sprofile_srv_i_profile_reader.hpp"
|
||||
#include "sprofile_srv_i_profile_update_observer.hpp"
|
||||
#include "sprofile_srv_i_profile_controller_for_debug.hpp"
|
||||
|
||||
#define AMS_SPROFILE_I_SPROFILE_SERVICE_FOR_SYSTEM_PROCESS_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 100, Result, OpenProfileReader, (sf::Out<sf::SharedPointer<::ams::sprofile::IProfileReader>> out), (out)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 101, Result, OpenProfileUpdateObserver, (sf::Out<sf::SharedPointer<::ams::sprofile::IProfileUpdateObserver>> out), (out)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 900, Result, OpenProfileControllerForDebug, (sf::Out<sf::SharedPointer<::ams::sprofile::IProfileControllerForDebug>> out), (out))
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(ams::sprofile, ISprofileServiceForSystemProcess, AMS_SPROFILE_I_SPROFILE_SERVICE_FOR_SYSTEM_PROCESS_INTERFACE_INFO)
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
namespace ams::sprofile::srv {
|
||||
|
||||
class ProfileManager {
|
||||
public:
|
||||
struct SaveDataInfo {
|
||||
u64 id;
|
||||
const char *mount_name;
|
||||
size_t size;
|
||||
size_t journal_size;
|
||||
u32 flags;
|
||||
};
|
||||
private:
|
||||
class UpdateObserverManager;
|
||||
private:
|
||||
os::SdkMutex m_general_mutex;
|
||||
os::SdkMutex m_fs_mutex;
|
||||
SaveDataInfo m_save_data_info;
|
||||
/* TODO: util::optional<ProfileImporter> m_profile_importer; */
|
||||
/* TODO: util::optional<ProfileMetadata> m_profile_metadata; */
|
||||
/* TODO: util::optional<ServiceProfile> m_service_profile; */
|
||||
UpdateObserverManager *m_update_observer_manager;
|
||||
public:
|
||||
ProfileManager(const SaveDataInfo &save_data_info);
|
||||
public:
|
||||
/* TODO */
|
||||
private:
|
||||
/* TODO */
|
||||
};
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <stratosphere.hpp>
|
||||
#include "sprofile_srv_i_service_for_bg_agent.hpp"
|
||||
|
||||
namespace ams::sprofile::srv {
|
||||
|
||||
class ProfileManager;
|
||||
|
||||
class ServiceForBgAgent {
|
||||
private:
|
||||
MemoryResource *m_memory_resource;
|
||||
ProfileManager *m_profile_manager;
|
||||
public:
|
||||
constexpr ServiceForBgAgent(MemoryResource *mr, ProfileManager *pm) : m_memory_resource(mr), m_profile_manager(pm) { /* ... */ }
|
||||
public:
|
||||
Result OpenProfileImporter(sf::Out<sf::SharedPointer<::ams::sprofile::IProfileImporter>> out);
|
||||
Result ReadMetadata(sf::Out<u32> out_count, const sf::OutBuffer &out_buf, const sf::InBuffer &meta);
|
||||
Result IsUpdateNeeded(sf::Out<bool> out, Identifier revision_key);
|
||||
Result Reset();
|
||||
};
|
||||
static_assert(sprofile::IsISprofileServiceForBgAgent<ServiceForBgAgent>);
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <stratosphere.hpp>
|
||||
#include "sprofile_srv_i_service_for_system_process.hpp"
|
||||
|
||||
namespace ams::sprofile::srv {
|
||||
|
||||
class ProfileManager;
|
||||
|
||||
class ServiceForSystemProcess {
|
||||
private:
|
||||
MemoryResource *m_memory_resource;
|
||||
ProfileManager *m_profile_manager;
|
||||
public:
|
||||
constexpr ServiceForSystemProcess(MemoryResource *mr, ProfileManager *pm) : m_memory_resource(mr), m_profile_manager(pm) { /* ... */ }
|
||||
public:
|
||||
Result OpenProfileReader(sf::Out<sf::SharedPointer<::ams::sprofile::IProfileReader>> out);
|
||||
Result OpenProfileUpdateObserver(sf::Out<sf::SharedPointer<::ams::sprofile::IProfileUpdateObserver>> out);
|
||||
Result OpenProfileControllerForDebug(sf::Out<sf::SharedPointer<::ams::sprofile::IProfileControllerForDebug>> out);
|
||||
};
|
||||
static_assert(sprofile::IsISprofileServiceForSystemProcess<ServiceForSystemProcess>);
|
||||
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
"permissions": "0xFFFFFFFFFFFFFFFF"
|
||||
},
|
||||
"service_access": ["lm", "fsp-srv", "time:u", "set", "set:sys", "srepo:u", "psc:m", "csrng", "ectx:r"],
|
||||
"service_host": ["erpt:r", "erpt:c"],
|
||||
"service_host": ["erpt:r", "erpt:c", "sprof:sp", "sprof:bg"],
|
||||
"kernel_capabilities": [{
|
||||
"type": "kernel_flags",
|
||||
"value": {
|
||||
|
@ -201,6 +201,12 @@ int main(int argc, char **argv)
|
||||
/* Start the erpt server. */
|
||||
R_ABORT_UNLESS(erpt::srv::InitializeAndStartService());
|
||||
|
||||
/* Initialize the sprofile server. */
|
||||
sprofile::srv::Initialize();
|
||||
|
||||
/* Start the sprofile ipc server. */
|
||||
sprofile::srv::StartIpcServer();
|
||||
|
||||
/* Wait forever. */
|
||||
erpt::srv::Wait();
|
||||
|
||||
|
@ -224,6 +224,9 @@ CATEGORIES = {
|
||||
130 : 'AcpUserAccountSettingsInfo',
|
||||
131 : 'AudioDeviceInfo',
|
||||
132 : 'AbnormalWakeInfo',
|
||||
133 : 'ServiceProfileInfo',
|
||||
134 : 'BluetoothAudioInfo',
|
||||
135 : 'BluetoothPairingCountInfo',
|
||||
}
|
||||
|
||||
FIELD_TYPES = {
|
||||
|
Loading…
Reference in New Issue
Block a user