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/FileSystems/BlobFileSystem.h
Views: 1401
// Copyright (c) 2017- 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/.1617#pragma once1819// This is used for opening a debug file as a blob, and mounting it.20// Importantly, uses a fileLoader for all access, so http:// URLs are supported.21// As of writing, only used by GE dump replay.2223#include <map>24#include <string>2526#include "Common/File/Path.h"27#include "Core/Loaders.h"28#include "Core/FileSystems/FileSystem.h"2930class BlobFileSystem : public IFileSystem {31public:32BlobFileSystem(IHandleAllocator *hAlloc, FileLoader *fileLoader, std::string alias);33~BlobFileSystem();3435void DoState(PointerWrap &p) override;36std::vector<PSPFileInfo> GetDirListing(const std::string &path, bool *exists = nullptr) override;37int OpenFile(std::string filename, FileAccess access, const char *devicename = nullptr) override;38void CloseFile(u32 handle) override;39size_t ReadFile(u32 handle, u8 *pointer, s64 size) override;40size_t ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) override;41size_t WriteFile(u32 handle, const u8 *pointer, s64 size) override;42size_t WriteFile(u32 handle, const u8 *pointer, s64 size, int &usec) override;43size_t SeekFile(u32 handle, s32 position, FileMove type) override;44PSPFileInfo GetFileInfo(std::string filename) override;45bool OwnsHandle(u32 handle) override;46int Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) override;47PSPDevType DevType(u32 handle) override;48FileSystemFlags Flags() override { return FileSystemFlags::FLASH; }4950bool MkDir(const std::string &dirname) override;51bool RmDir(const std::string &dirname) override;52int RenameFile(const std::string &from, const std::string &to) override;53bool RemoveFile(const std::string &filename) override;54u64 FreeSpace(const std::string &path) override;5556bool ComputeRecursiveDirSizeIfFast(const std::string &path, int64_t *size) override { return false; }5758private:59// File positions.60std::map<u32, s64> entries_;6162IHandleAllocator *alloc_;63FileLoader *fileLoader_;64std::string alias_;65};666768