erpt: update for new sf semantics

This commit is contained in:
Michael Scire 2021-01-17 22:55:39 -08:00
parent b58f3d9174
commit 9ce7e67114

View File

@ -18,6 +18,22 @@
namespace ams::psc { namespace ams::psc {
/* TODO: Nintendo uses sf::ShimLobraryObjectHolder here, we should similarly consider switching. */
namespace {
struct PscRemotePmModuleTag;
using RemoteAllocator = ams::sf::ExpHeapStaticAllocator<2_KB, PscRemotePmModuleTag>;
using RemoteObjectFactory = ams::sf::ObjectFactory<typename RemoteAllocator::Policy>;
class StaticAllocatorInitializer {
public:
StaticAllocatorInitializer() {
RemoteAllocator::Initialize(lmem::CreateOption_None);
}
} g_static_allocator_initializer;
}
PmModule::PmModule() : intf(nullptr), initialized(false), reserved(0) { /* ... */ } PmModule::PmModule() : intf(nullptr), initialized(false), reserved(0) { /* ... */ }
PmModule::~PmModule() { PmModule::~PmModule() {
@ -34,8 +50,7 @@ namespace ams::psc {
::PscPmModule module; ::PscPmModule module;
R_TRY(::pscmGetPmModule(std::addressof(module), static_cast<::PscPmModuleId>(mid), reinterpret_cast<const u16 *>(dependencies), dependency_count, clear_mode == os::EventClearMode_AutoClear)); R_TRY(::pscmGetPmModule(std::addressof(module), static_cast<::PscPmModuleId>(mid), reinterpret_cast<const u16 *>(dependencies), dependency_count, clear_mode == os::EventClearMode_AutoClear));
/* TODO: Proper allocator */ this->intf = RemoteObjectFactory::CreateSharedEmplaced<psc::sf::IPmModule, RemotePmModule>(module);
this->intf = ams::sf::CreateSharedObjectEmplaced<psc::sf::IPmModule, RemotePmModule>(module);
this->system_event.AttachReadableHandle(module.event.revent, false, clear_mode); this->system_event.AttachReadableHandle(module.event.revent, false, clear_mode);
this->initialized = true; this->initialized = true;
return ResultSuccess(); return ResultSuccess();