2018-09-07 17:00:13 +02:00
|
|
|
/*
|
2019-04-08 04:00:49 +02:00
|
|
|
* Copyright (c) 2018-2019 Atmosphère-NX
|
2018-09-07 17:00:13 +02:00
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2018-04-19 23:28:27 +02:00
|
|
|
#pragma once
|
|
|
|
#include <switch.h>
|
|
|
|
|
|
|
|
#include "ldr_registration.hpp"
|
|
|
|
|
2019-02-23 16:17:33 +01:00
|
|
|
struct OverrideKey {
|
|
|
|
u64 key_combination;
|
|
|
|
bool override_by_default;
|
|
|
|
};
|
|
|
|
|
2018-04-19 23:28:27 +02:00
|
|
|
class ContentManagement {
|
|
|
|
public:
|
2018-04-21 07:58:42 +02:00
|
|
|
static Result MountCode(u64 tid, FsStorageId sid);
|
2018-07-30 01:35:43 +02:00
|
|
|
static Result MountCodeNspOnSd(u64 tid);
|
2018-09-20 01:21:46 +02:00
|
|
|
static void TryMountHblNspOnSd();
|
2018-04-21 07:58:42 +02:00
|
|
|
static Result UnmountCode();
|
|
|
|
static Result MountCodeForTidSid(Registration::TidSid *tid_sid);
|
2018-04-19 23:28:27 +02:00
|
|
|
|
2018-05-08 10:59:18 +02:00
|
|
|
static Result ResolveContentPath(char *out_path, u64 tid, FsStorageId sid);
|
|
|
|
static Result RedirectContentPath(const char *path, u64 tid, FsStorageId sid);
|
|
|
|
static Result ResolveContentPathForTidSid(char *out_path, Registration::TidSid *tid_sid);
|
|
|
|
static Result RedirectContentPathForTidSid(const char *path, Registration::TidSid *tid_sid);
|
2019-03-20 15:53:56 +01:00
|
|
|
|
|
|
|
static void RedirectHtmlDocumentPathForHbl(u64 tid, FsStorageId sid);
|
|
|
|
|
2018-05-02 00:49:20 +02:00
|
|
|
static bool HasCreatedTitle(u64 tid);
|
|
|
|
static void SetCreatedTitle(u64 tid);
|
2018-10-23 07:53:40 +02:00
|
|
|
static void RefreshConfigurationData();
|
2018-05-02 00:49:20 +02:00
|
|
|
static void TryMountSdCard();
|
2019-03-20 15:53:56 +01:00
|
|
|
|
2019-02-23 16:17:33 +01:00
|
|
|
static OverrideKey GetTitleOverrideKey(u64 tid);
|
|
|
|
static bool ShouldOverrideContentsWithSD(u64 tid);
|
|
|
|
static bool ShouldOverrideContentsWithHBL(u64 tid);
|
2018-10-25 21:52:01 +02:00
|
|
|
|
|
|
|
/* SetExternalContentSource extension */
|
|
|
|
class ExternalContentSource {
|
|
|
|
public:
|
|
|
|
static void GenerateMountpointName(u64 tid, char *out, size_t max_length);
|
|
|
|
|
|
|
|
ExternalContentSource(u64 tid, const char *mountpoint);
|
|
|
|
~ExternalContentSource();
|
|
|
|
|
|
|
|
ExternalContentSource(const ExternalContentSource &other) = delete;
|
|
|
|
ExternalContentSource(ExternalContentSource &&other) = delete;
|
|
|
|
ExternalContentSource &operator=(const ExternalContentSource &other) = delete;
|
|
|
|
ExternalContentSource &operator=(ExternalContentSource &&other) = delete;
|
|
|
|
|
|
|
|
const u64 tid;
|
|
|
|
char mountpoint[32];
|
|
|
|
};
|
|
|
|
static ExternalContentSource *GetExternalContentSource(u64 tid); /* returns nullptr if no ECS is set */
|
|
|
|
static Result SetExternalContentSource(u64 tid, FsFileSystem filesystem); /* takes ownership of filesystem */
|
|
|
|
static void ClearExternalContentSource(u64 tid);
|
2018-04-19 23:28:27 +02:00
|
|
|
};
|