erpt: update for new sf semantics

This commit is contained in:
Michael Scire 2021-01-17 22:55:39 -08:00 committed by SciresM
parent 5191f0e305
commit dc4ee1a5bc
2 changed files with 50 additions and 3 deletions

View file

@ -18,6 +18,22 @@
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() {
@ -34,8 +50,7 @@ namespace ams::psc {
::PscPmModule module;
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 = ams::sf::CreateSharedObjectEmplaced<psc::sf::IPmModule, RemotePmModule>(module);
this->intf = RemoteObjectFactory::CreateSharedEmplaced<psc::sf::IPmModule, RemotePmModule>(module);
this->system_event.AttachReadableHandle(module.event.revent, false, clear_mode);
this->initialized = true;
return ResultSuccess();