skyline/app/src/main/cpp/skyline/loader/nro.h
◱ PixelyIon c37f350c02 Move from GPLv3 to LGPLv3 or later
Skyline has been licensed with GPLv3 but as we want to look into optional ads in the future, and that would require linking AdMob SDKs which are proprietary. So, we decided to move to LGPLv3 so we could keep that option open as a revenue stream. 

We've gathered consent from all contributors for the license change:
* PixelyIon - https://github.com/PixelyIon (Commit Author)
* Zephyren25 - https://github.com/zephyren25
* ByLaws - https://github.com/bylaws
* IvarWithoutBones - https://github.com/IvarWithoutBones
* Cyuubi - https://github.com/Cyuubi
* greggamesplayer - https://github.com/greggameplayer
2020-04-23 22:26:27 +05:30

61 lines
1.9 KiB
C++

// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
#pragma once
#include <cstdint>
#include "loader.h"
namespace skyline::loader {
class NroLoader : public Loader {
private:
/**
* @brief This holds a single data segment's offset and size
*/
struct NroSegmentHeader {
u32 offset; //!< The offset of the region
u32 size; //!< The size of the region
};
/**
* @brief This holds the header of an NRO file
*/
struct NroHeader {
u32 : 32;
u32 modOffset; //!< The offset of the MOD metadata
u64 : 64;
u32 magic; //!< The NRO magic "NRO0"
u32 version; //!< The version of the application
u32 size; //!< The size of the NRO
u32 flags; //!< The flags used with the NRO
NroSegmentHeader text; //!< The .text segment header
NroSegmentHeader ro; //!< The .ro segment header
NroSegmentHeader data; //!< The .data segment header
u32 bssSize; //!< The size of the bss segment
u32 : 32;
u64 buildId[4]; //!< The build ID of the NRO
u64 : 64;
NroSegmentHeader apiInfo; //!< The .apiInfo segment header
NroSegmentHeader dynstr; //!< The .dynstr segment header
NroSegmentHeader dynsym; //!< The .dynsym segment header
} header{};
public:
/**
* @param filePath The path to the ROM file
*/
NroLoader(const int romFd);
/**
* This loads in the data of the main process
* @param process The process to load in the data
* @param state The state of the device
*/
void LoadProcessData(const std::shared_ptr<kernel::type::KProcess> process, const DeviceState &state);
};
}