diff --git a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_host_utils.cpp b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_host_utils.cpp index e1e6cb7da..c3ae7fe6c 100644 --- a/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_host_utils.cpp +++ b/libraries/libstratosphere/source/pgl/srv/pgl_srv_shell_host_utils.cpp @@ -75,15 +75,15 @@ namespace ams::pgl::srv { NON_COPYABLE(HostPackageReader); NON_MOVEABLE(HostPackageReader); private: - char m_content_path[fs::EntryNameLengthMax] = {}; - ExtensionType m_extension_type = ExtensionType::None; - char m_mount_name[fs::MountNameLengthMax] = {}; - bool m_is_mounted = false; + char m_content_path[fs::EntryNameLengthMax] = {}; + ExtensionType m_extension_type = ExtensionType::None; + char m_mount_name[fs::MountNameLengthMax + 1] = {}; + bool m_is_mounted = false; ncm::AutoBuffer m_content_meta_buffer; - ncm::ProgramId m_program_id = ncm::InvalidProgramId; - u32 m_program_version = 0; - ncm::ContentMetaType m_content_meta_type = static_cast(0); - u8 m_program_index = 0; + ncm::ProgramId m_program_id = ncm::InvalidProgramId; + u32 m_program_version = 0; + ncm::ContentMetaType m_content_meta_type = static_cast(0); + u8 m_program_index = 0; public: HostPackageReader() : m_content_meta_buffer() { /* ... */ } ~HostPackageReader() { diff --git a/stratosphere/pgl/source/pgl_main.cpp b/stratosphere/pgl/source/pgl_main.cpp index 50d5ca114..a0408502e 100644 --- a/stratosphere/pgl/source/pgl_main.cpp +++ b/stratosphere/pgl/source/pgl_main.cpp @@ -37,6 +37,7 @@ namespace ams { R_ABORT_UNLESS(pmshellInitialize()); R_ABORT_UNLESS(ldrShellInitialize()); R_ABORT_UNLESS(lrInitialize()); + lr::Initialize(); /* Verify that we can sanely execute. */ ams::CheckApiVersion(); @@ -58,3 +59,36 @@ namespace ams { } } + +/* Override operator new. */ +void *operator new(size_t size) { + return ams::pgl::srv::Allocate(size); +} + +void *operator new(size_t size, const std::nothrow_t &) { + return ams::pgl::srv::Allocate(size); +} + +void operator delete(void *p) { + return ams::pgl::srv::Deallocate(p, 0); +} + +void operator delete(void *p, size_t size) { + return ams::pgl::srv::Deallocate(p, size); +} + +void *operator new[](size_t size) { + return ams::pgl::srv::Allocate(size); +} + +void *operator new[](size_t size, const std::nothrow_t &) { + return ams::pgl::srv::Allocate(size); +} + +void operator delete[](void *p) { + return ams::pgl::srv::Deallocate(p, 0); +} + +void operator delete[](void *p, size_t size) { + return ams::pgl::srv::Deallocate(p, size); +}