mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-05 01:03:43 -04:00
util::string_view, update pgl for new sf semantics
This commit is contained in:
parent
83c04fa5d7
commit
3bb94aa146
13 changed files with 448 additions and 70 deletions
|
@ -18,10 +18,7 @@
|
|||
|
||||
namespace ams::pgl::srv {
|
||||
|
||||
void Initialize(ShellInterface *interface, MemoryResource *mr) {
|
||||
/* Set the memory resource for the interface. */
|
||||
interface->Initialize(mr);
|
||||
|
||||
void Initialize() {
|
||||
/* Enable extra application threads, if we should. */
|
||||
u8 enable_application_extra_thread;
|
||||
const size_t sz = settings::fwdbg::GetSettingsItemValue(std::addressof(enable_application_extra_thread), sizeof(enable_application_extra_thread), "application_extra_thread", "enable_application_extra_thread");
|
||||
|
|
|
@ -25,16 +25,16 @@ namespace ams::pgl::srv {
|
|||
static_assert(sizeof(HostPackageMountName) - 1 <= fs::MountNameLengthMax);
|
||||
|
||||
struct CaseInsensitiveCharTraits : public std::char_traits<char> {
|
||||
static char to_upper(char c) {
|
||||
static constexpr char to_upper(char c) {
|
||||
return std::toupper(static_cast<unsigned char>(c));
|
||||
}
|
||||
static bool eq(char c1, char c2) {
|
||||
static constexpr bool eq(char c1, char c2) {
|
||||
return to_upper(c1) == to_upper(c2);
|
||||
}
|
||||
static bool lt(char c1, char c2) {
|
||||
static constexpr bool lt(char c1, char c2) {
|
||||
return to_upper(c1) < to_upper(c2);
|
||||
}
|
||||
static int compare(const char *s1, const char *s2, size_t n) {
|
||||
static constexpr int compare(const char *s1, const char *s2, size_t n) {
|
||||
while ( n-- != 0 ) {
|
||||
if ( to_upper(*s1) < to_upper(*s2) ) return -1;
|
||||
if ( to_upper(*s1) > to_upper(*s2) ) return 1;
|
||||
|
@ -42,7 +42,7 @@ namespace ams::pgl::srv {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
static const char *find(const char *s, int n, char a) {
|
||||
static constexpr const char *find(const char *s, int n, char a) {
|
||||
auto const ua (to_upper(a));
|
||||
while ( n-- != 0 )
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ namespace ams::pgl::srv {
|
|||
}
|
||||
};
|
||||
|
||||
using PathView = std::basic_string_view<char, CaseInsensitiveCharTraits>;
|
||||
using PathView = util::basic_string_view<char, CaseInsensitiveCharTraits>;
|
||||
|
||||
enum class ExtensionType {
|
||||
None = 0,
|
||||
|
|
|
@ -20,12 +20,6 @@
|
|||
|
||||
namespace ams::pgl::srv {
|
||||
|
||||
namespace {
|
||||
|
||||
using ShellEventObjectFactory = ams::sf::ObjectFactory<ams::sf::MemoryResourceAllocationPolicy>;
|
||||
|
||||
}
|
||||
|
||||
Result ShellInterface::LaunchProgram(ams::sf::Out<os::ProcessId> out, const ncm::ProgramLocation &loc, u32 pm_flags, u8 pgl_flags) {
|
||||
return pgl::srv::LaunchProgram(out.GetPointer(), loc, pm_flags, pgl_flags);
|
||||
}
|
||||
|
@ -76,7 +70,7 @@ namespace ams::pgl::srv {
|
|||
|
||||
Result ShellInterface::GetShellEventObserver(ams::sf::Out<ams::sf::SharedPointer<pgl::sf::IEventObserver>> out) {
|
||||
/* Allocate a new interface. */
|
||||
auto session = ShellEventObjectFactory::CreateSharedEmplaced<pgl::sf::IEventObserver, ShellEventObserver>(this->memory_resource);
|
||||
auto session = ObjectFactory::CreateSharedEmplaced<pgl::sf::IEventObserver, ShellEventObserver>(m_allocator);
|
||||
R_UNLESS(session != nullptr, pgl::ResultOutOfMemory());
|
||||
|
||||
*out = std::move(session);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue