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-06-15 01:50:01 +02:00
|
|
|
#pragma once
|
|
|
|
#include <switch.h>
|
|
|
|
#include <stratosphere.hpp>
|
|
|
|
|
2019-06-03 21:15:39 +02:00
|
|
|
#include "fs_istorage.hpp"
|
2018-06-15 01:50:01 +02:00
|
|
|
#include "fsmitm_romfsbuild.hpp"
|
2019-01-29 11:29:29 +01:00
|
|
|
#include "../utils.hpp"
|
2018-06-15 01:50:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* Represents a merged RomFS. */
|
|
|
|
class LayeredRomFS : public IROStorage {
|
|
|
|
private:
|
|
|
|
/* Data Sources. */
|
2019-06-03 21:15:39 +02:00
|
|
|
std::shared_ptr<IROStorage> storage_romfs;
|
|
|
|
std::shared_ptr<IROStorage> file_romfs;
|
2018-06-15 01:50:01 +02:00
|
|
|
/* Information about the merged RomFS. */
|
|
|
|
u64 title_id;
|
|
|
|
std::shared_ptr<std::vector<RomFSSourceInfo>> p_source_infos;
|
|
|
|
|
|
|
|
public:
|
2019-06-03 21:15:39 +02:00
|
|
|
LayeredRomFS(std::shared_ptr<IROStorage> s_r, std::shared_ptr<IROStorage> f_r, u64 tid);
|
2018-06-19 20:07:31 +02:00
|
|
|
virtual ~LayeredRomFS() = default;
|
2018-06-15 01:50:01 +02:00
|
|
|
|
2018-10-30 01:30:39 +01:00
|
|
|
virtual Result Read(void *buffer, size_t size, u64 offset) override;
|
|
|
|
virtual Result GetSize(u64 *out_size) override;
|
2019-06-03 21:15:39 +02:00
|
|
|
virtual Result OperateRange(FsOperationId operation_type, u64 offset, u64 size, FsRangeInfo *out_range_info) override;
|
2018-06-15 01:50:01 +02:00
|
|
|
};
|