mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-04-22 20:44:49 +00:00
lr: Organise types
This commit is contained in:
parent
6f99b0bf2b
commit
f044c52e7d
10 changed files with 75 additions and 37 deletions
|
@ -47,6 +47,7 @@
|
|||
#include "stratosphere/cfg.hpp"
|
||||
#include "stratosphere/fatal.hpp"
|
||||
#include "stratosphere/hid.hpp"
|
||||
#include "stratosphere/lr.hpp"
|
||||
#include "stratosphere/ncm.hpp"
|
||||
#include "stratosphere/pm.hpp"
|
||||
#include "stratosphere/rnd.hpp"
|
||||
|
|
20
stratosphere/libstratosphere/include/stratosphere/lr.hpp
Normal file
20
stratosphere/libstratosphere/include/stratosphere/lr.hpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2019 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 <switch.h>
|
||||
|
||||
#include "lr/lr_types.hpp"
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Adubbz
|
||||
*
|
||||
* 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 <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
namespace sts::lr {
|
||||
|
||||
constexpr size_t MaxPathLen = 0x300;
|
||||
|
||||
struct Path {
|
||||
char path[MaxPathLen];
|
||||
|
||||
Path() {
|
||||
path[0] = '\0';
|
||||
}
|
||||
|
||||
Path(const char* path) {
|
||||
strncpy(this->path, path, MaxPathLen-1);
|
||||
this->EnsureNullTerminated();
|
||||
}
|
||||
|
||||
Path& operator=(const Path& other) {
|
||||
/* N appears to always memcpy paths, so we will too. */
|
||||
std::memcpy(this->path, other.path, MaxPathLen);
|
||||
this->EnsureNullTerminated();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void EnsureNullTerminated() {
|
||||
path[MaxPathLen-1] = '\0';
|
||||
}
|
||||
};
|
||||
|
||||
}
|
|
@ -17,12 +17,13 @@
|
|||
#include "../lr_contentlocationresolver.hpp"
|
||||
#include "../lr_redirectonlylocationresolver.hpp"
|
||||
#include "lr_manager.hpp"
|
||||
#include "ncm_bounded_map.hpp"
|
||||
|
||||
namespace sts::lr::impl {
|
||||
|
||||
namespace {
|
||||
|
||||
BoundedMap<ncm::StorageId, std::shared_ptr<ILocationResolver>, 5> g_location_resolvers;
|
||||
ncm::impl::BoundedMap<ncm::StorageId, std::shared_ptr<ILocationResolver>, 5> g_location_resolvers;
|
||||
std::shared_ptr<RegisteredLocationResolverInterface> g_registered_location_resolver = nullptr;
|
||||
std::shared_ptr<AddOnContentLocationResolverInterface> g_add_on_content_location_resolver = nullptr;
|
||||
HosMutex g_mutex;
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
#include "../lr_types.hpp"
|
||||
|
||||
namespace sts::lr::impl {
|
||||
|
||||
enum RedirectionFlags {
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
#include "../lr_types.hpp"
|
||||
|
||||
namespace sts::lr::impl {
|
||||
|
||||
template<typename Key, typename Value, size_t NumEntries>
|
||||
|
|
|
@ -18,34 +18,8 @@
|
|||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
namespace sts::lr {
|
||||
|
||||
constexpr size_t MaxPathLen = 0x300;
|
||||
|
||||
struct Path {
|
||||
char path[MaxPathLen];
|
||||
|
||||
Path() {
|
||||
path[0] = '\0';
|
||||
}
|
||||
|
||||
Path(const char* path) {
|
||||
strncpy(this->path, path, MaxPathLen-1);
|
||||
this->EnsureNullTerminated();
|
||||
}
|
||||
|
||||
Path& operator=(const Path& other) {
|
||||
/* N appears to always memcpy paths, so we will too. */
|
||||
std::memcpy(this->path, other.path, MaxPathLen);
|
||||
this->EnsureNullTerminated();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void EnsureNullTerminated() {
|
||||
path[MaxPathLen-1] = '\0';
|
||||
}
|
||||
};
|
||||
|
||||
namespace sts::ncm::impl {
|
||||
|
||||
template<class Key, class Value, size_t N>
|
||||
class BoundedMap {
|
||||
private:
|
||||
|
@ -107,4 +81,4 @@ namespace sts::lr {
|
|||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
|
@ -19,7 +19,6 @@
|
|||
#include <stratosphere.hpp>
|
||||
|
||||
#include "impl/lr_registered_data.hpp"
|
||||
#include "lr_types.hpp"
|
||||
|
||||
namespace sts::lr {
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include "impl/lr_redirection.hpp"
|
||||
#include "impl/lr_registered_data.hpp"
|
||||
#include "lr_types.hpp"
|
||||
|
||||
namespace sts::lr {
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
#include "lr_types.hpp"
|
||||
#include "ncm_types.hpp"
|
||||
|
||||
namespace sts::ncm {
|
||||
|
|
Loading…
Add table
Reference in a new issue