mirror of
https://github.com/yuzu-emu/yuzu
synced 2024-11-24 12:28:08 +00:00
removed unused commented-out code
This commit is contained in:
parent
59020e8d9c
commit
e83de18f4b
1 changed files with 0 additions and 154 deletions
|
@ -669,157 +669,3 @@ void DirectoryFileSystem::DoState(PointerWrap &p) {
|
|||
ERROR_LOG(FILESYS, "FIXME: Open files during savestate, could go badly.");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
VFSFileSystem::VFSFileSystem(IHandleAllocator *_hAlloc, std::string _basePath) : basePath(_basePath) {
|
||||
INFO_LOG(FILESYS, "Creating VFS file system");
|
||||
hAlloc = _hAlloc;
|
||||
}
|
||||
|
||||
VFSFileSystem::~VFSFileSystem() {
|
||||
for (auto iter = entries.begin(); iter != entries.end(); ++iter) {
|
||||
delete [] iter->second.fileData;
|
||||
}
|
||||
entries.clear();
|
||||
}
|
||||
|
||||
std::string VFSFileSystem::GetLocalPath(std::string localPath) {
|
||||
return basePath + localPath;
|
||||
}
|
||||
|
||||
bool VFSFileSystem::MkDir(const std::string &dirname) {
|
||||
// NOT SUPPORTED - READ ONLY
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VFSFileSystem::RmDir(const std::string &dirname) {
|
||||
// NOT SUPPORTED - READ ONLY
|
||||
return false;
|
||||
}
|
||||
|
||||
int VFSFileSystem::RenameFile(const std::string &from, const std::string &to) {
|
||||
// NOT SUPPORTED - READ ONLY
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool VFSFileSystem::RemoveFile(const std::string &filename) {
|
||||
// NOT SUPPORTED - READ ONLY
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 VFSFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename) {
|
||||
if (access != FILEACCESS_READ) {
|
||||
ERROR_LOG(FILESYS, "VFSFileSystem only supports plain reading");
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string fullName = GetLocalPath(filename);
|
||||
const char *fullNameC = fullName.c_str();
|
||||
INFO_LOG(FILESYS,"VFSFileSystem actually opening %s (%s)", fullNameC, filename.c_str());
|
||||
|
||||
size_t size;
|
||||
u8 *data = VFSReadFile(fullNameC, &size);
|
||||
if (!data) {
|
||||
ERROR_LOG(FILESYS, "VFSFileSystem failed to open %s", filename.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
OpenFileEntry entry;
|
||||
entry.fileData = data;
|
||||
entry.size = size;
|
||||
entry.seekPos = 0;
|
||||
u32 newHandle = hAlloc->GetNewHandle();
|
||||
entries[newHandle] = entry;
|
||||
return newHandle;
|
||||
}
|
||||
|
||||
FileInfo VFSFileSystem::GetFileInfo(std::string filename) {
|
||||
FileInfo x;
|
||||
x.name = filename;
|
||||
|
||||
std::string fullName = GetLocalPath(filename);
|
||||
INFO_LOG(FILESYS,"Getting VFS file info %s (%s)", fullName.c_str(), filename.c_str());
|
||||
FileInfo fo;
|
||||
VFSGetFileInfo(fullName.c_str(), &fo);
|
||||
x.exists = fo.exists;
|
||||
if (x.exists) {
|
||||
x.size = fo.size;
|
||||
x.type = fo.isDirectory ? FILETYPE_DIRECTORY : FILETYPE_NORMAL;
|
||||
}
|
||||
INFO_LOG(FILESYS,"Got VFS file info: size = %i", (int)x.size);
|
||||
return x;
|
||||
}
|
||||
|
||||
void VFSFileSystem::CloseFile(u32 handle) {
|
||||
EntryMap::iterator iter = entries.find(handle);
|
||||
if (iter != entries.end()) {
|
||||
delete [] iter->second.fileData;
|
||||
entries.erase(iter);
|
||||
} else {
|
||||
//This shouldn't happen...
|
||||
ERROR_LOG(FILESYS,"Cannot close file that hasn't been opened: %08x", handle);
|
||||
}
|
||||
}
|
||||
|
||||
bool VFSFileSystem::OwnsHandle(u32 handle) {
|
||||
EntryMap::iterator iter = entries.find(handle);
|
||||
return (iter != entries.end());
|
||||
}
|
||||
|
||||
size_t VFSFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size) {
|
||||
INFO_LOG(FILESYS,"VFSFileSystem::ReadFile %08x %p %i", handle, pointer, (u32)size);
|
||||
EntryMap::iterator iter = entries.find(handle);
|
||||
if (iter != entries.end())
|
||||
{
|
||||
size_t bytesRead = size;
|
||||
memcpy(pointer, iter->second.fileData + iter->second.seekPos, size);
|
||||
iter->second.seekPos += size;
|
||||
return bytesRead;
|
||||
} else {
|
||||
ERROR_LOG(FILESYS,"Cannot read file that hasn't been opened: %08x", handle);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
size_t VFSFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size) {
|
||||
// NOT SUPPORTED - READ ONLY
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t VFSFileSystem::SeekFile(u32 handle, s32 position, FileMove type) {
|
||||
EntryMap::iterator iter = entries.find(handle);
|
||||
if (iter != entries.end()) {
|
||||
switch (type) {
|
||||
case FILEMOVE_BEGIN: iter->second.seekPos = position; break;
|
||||
case FILEMOVE_CURRENT: iter->second.seekPos += position; break;
|
||||
case FILEMOVE_END: iter->second.seekPos = iter->second.size + position; break;
|
||||
}
|
||||
return iter->second.seekPos;
|
||||
} else {
|
||||
//This shouldn't happen...
|
||||
ERROR_LOG(FILESYS,"Cannot seek in file that hasn't been opened: %08x", handle);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool VFSFileSystem::GetHostPath(const std::string &inpath, std::string &outpath) {
|
||||
// NOT SUPPORTED
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<FileInfo> VFSFileSystem::GetDirListing(std::string path) {
|
||||
std::vector<FileInfo> myVector;
|
||||
// TODO
|
||||
return myVector;
|
||||
}
|
||||
|
||||
void VFSFileSystem::DoState(PointerWrap &p) {
|
||||
if (!entries.empty()) {
|
||||
p.SetError(p.ERROR_WARNING);
|
||||
ERROR_LOG(FILESYS, "FIXME: Open files during savestate, could go badly.");
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue