CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Core/ELF/PBPReader.h
Views: 1401
// Copyright (c) 2013- PPSSPP Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official git repository and contact information can be found at15// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.161718#pragma once1920#include <vector>2122#include "Common/CommonTypes.h"23#include "Common/Swap.h"2425enum PBPSubFile {26PBP_PARAM_SFO,27PBP_ICON0_PNG,28PBP_ICON1_PMF,29PBP_PIC0_PNG,30PBP_PIC1_PNG,31PBP_SND0_AT3,32PBP_EXECUTABLE_PSP,33PBP_UNKNOWN_PSAR,34};3536struct PBPHeader {37char magic[4];38u32_le version;39u32_le offsets[8];40};4142class FileLoader;4344class PBPReader {45public:46PBPReader(FileLoader *fileLoader);47~PBPReader();4849bool IsValid() const { return file_ != nullptr; }50bool IsELF() const { return file_ == nullptr && isELF_; }5152bool GetSubFile(PBPSubFile file, std::vector<u8> *out);53void GetSubFileAsString(PBPSubFile file, std::string *out);5455size_t GetSubFileSize(PBPSubFile file) {56int num = (int)file;57if (num < 7) {58return header_.offsets[file + 1] - header_.offsets[file];59} else {60return fileSize_ - header_.offsets[file];61}62}6364private:65FileLoader *file_;66size_t fileSize_;67const PBPHeader header_;68bool isELF_;69};707172