diff options
| author | 2013-09-23 21:57:54 -0400 | |
|---|---|---|
| committer | 2013-09-23 21:57:54 -0400 | |
| commit | e83de18f4b06430080d5bd2fb069bd089dd4f9ae (patch) | |
| tree | 71c18b0ff2be311a4e3ed710d59d917d5f8a36ff /src | |
| parent | renamed PSPFileInfo to just FileInfo (diff) | |
| download | yuzu-e83de18f4b06430080d5bd2fb069bd089dd4f9ae.tar.gz yuzu-e83de18f4b06430080d5bd2fb069bd089dd4f9ae.tar.xz yuzu-e83de18f4b06430080d5bd2fb069bd089dd4f9ae.zip | |
removed unused commented-out code
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/src/file_sys/file_sys_directory.cpp | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/src/core/src/file_sys/file_sys_directory.cpp b/src/core/src/file_sys/file_sys_directory.cpp index e4ae47677..c20557bad 100644 --- a/src/core/src/file_sys/file_sys_directory.cpp +++ b/src/core/src/file_sys/file_sys_directory.cpp | |||
| @@ -669,157 +669,3 @@ void DirectoryFileSystem::DoState(PointerWrap &p) { | |||
| 669 | ERROR_LOG(FILESYS, "FIXME: Open files during savestate, could go badly."); | 669 | ERROR_LOG(FILESYS, "FIXME: Open files during savestate, could go badly."); |
| 670 | } | 670 | } |
| 671 | } | 671 | } |
| 672 | |||
| 673 | /* | ||
| 674 | |||
| 675 | VFSFileSystem::VFSFileSystem(IHandleAllocator *_hAlloc, std::string _basePath) : basePath(_basePath) { | ||
| 676 | INFO_LOG(FILESYS, "Creating VFS file system"); | ||
| 677 | hAlloc = _hAlloc; | ||
| 678 | } | ||
| 679 | |||
| 680 | VFSFileSystem::~VFSFileSystem() { | ||
| 681 | for (auto iter = entries.begin(); iter != entries.end(); ++iter) { | ||
| 682 | delete [] iter->second.fileData; | ||
| 683 | } | ||
| 684 | entries.clear(); | ||
| 685 | } | ||
| 686 | |||
| 687 | std::string VFSFileSystem::GetLocalPath(std::string localPath) { | ||
| 688 | return basePath + localPath; | ||
| 689 | } | ||
| 690 | |||
| 691 | bool VFSFileSystem::MkDir(const std::string &dirname) { | ||
| 692 | // NOT SUPPORTED - READ ONLY | ||
| 693 | return false; | ||
| 694 | } | ||
| 695 | |||
| 696 | bool VFSFileSystem::RmDir(const std::string &dirname) { | ||
| 697 | // NOT SUPPORTED - READ ONLY | ||
| 698 | return false; | ||
| 699 | } | ||
| 700 | |||
| 701 | int VFSFileSystem::RenameFile(const std::string &from, const std::string &to) { | ||
| 702 | // NOT SUPPORTED - READ ONLY | ||
| 703 | return -1; | ||
| 704 | } | ||
| 705 | |||
| 706 | bool VFSFileSystem::RemoveFile(const std::string &filename) { | ||
| 707 | // NOT SUPPORTED - READ ONLY | ||
| 708 | return false; | ||
| 709 | } | ||
| 710 | |||
| 711 | u32 VFSFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename) { | ||
| 712 | if (access != FILEACCESS_READ) { | ||
| 713 | ERROR_LOG(FILESYS, "VFSFileSystem only supports plain reading"); | ||
| 714 | return 0; | ||
| 715 | } | ||
| 716 | |||
| 717 | std::string fullName = GetLocalPath(filename); | ||
| 718 | const char *fullNameC = fullName.c_str(); | ||
| 719 | INFO_LOG(FILESYS,"VFSFileSystem actually opening %s (%s)", fullNameC, filename.c_str()); | ||
| 720 | |||
| 721 | size_t size; | ||
| 722 | u8 *data = VFSReadFile(fullNameC, &size); | ||
| 723 | if (!data) { | ||
| 724 | ERROR_LOG(FILESYS, "VFSFileSystem failed to open %s", filename.c_str()); | ||
| 725 | return 0; | ||
| 726 | } | ||
| 727 | |||
| 728 | OpenFileEntry entry; | ||
| 729 | entry.fileData = data; | ||
| 730 | entry.size = size; | ||
| 731 | entry.seekPos = 0; | ||
| 732 | u32 newHandle = hAlloc->GetNewHandle(); | ||
| 733 | entries[newHandle] = entry; | ||
| 734 | return newHandle; | ||
| 735 | } | ||
| 736 | |||
| 737 | FileInfo VFSFileSystem::GetFileInfo(std::string filename) { | ||
| 738 | FileInfo x; | ||
| 739 | x.name = filename; | ||
| 740 | |||
| 741 | std::string fullName = GetLocalPath(filename); | ||
| 742 | INFO_LOG(FILESYS,"Getting VFS file info %s (%s)", fullName.c_str(), filename.c_str()); | ||
| 743 | FileInfo fo; | ||
| 744 | VFSGetFileInfo(fullName.c_str(), &fo); | ||
| 745 | x.exists = fo.exists; | ||
| 746 | if (x.exists) { | ||
| 747 | x.size = fo.size; | ||
| 748 | x.type = fo.isDirectory ? FILETYPE_DIRECTORY : FILETYPE_NORMAL; | ||
| 749 | } | ||
| 750 | INFO_LOG(FILESYS,"Got VFS file info: size = %i", (int)x.size); | ||
| 751 | return x; | ||
| 752 | } | ||
| 753 | |||
| 754 | void VFSFileSystem::CloseFile(u32 handle) { | ||
| 755 | EntryMap::iterator iter = entries.find(handle); | ||
| 756 | if (iter != entries.end()) { | ||
| 757 | delete [] iter->second.fileData; | ||
| 758 | entries.erase(iter); | ||
| 759 | } else { | ||
| 760 | //This shouldn't happen... | ||
| 761 | ERROR_LOG(FILESYS,"Cannot close file that hasn't been opened: %08x", handle); | ||
| 762 | } | ||
| 763 | } | ||
| 764 | |||
| 765 | bool VFSFileSystem::OwnsHandle(u32 handle) { | ||
| 766 | EntryMap::iterator iter = entries.find(handle); | ||
| 767 | return (iter != entries.end()); | ||
| 768 | } | ||
| 769 | |||
| 770 | size_t VFSFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size) { | ||
| 771 | INFO_LOG(FILESYS,"VFSFileSystem::ReadFile %08x %p %i", handle, pointer, (u32)size); | ||
| 772 | EntryMap::iterator iter = entries.find(handle); | ||
| 773 | if (iter != entries.end()) | ||
| 774 | { | ||
| 775 | size_t bytesRead = size; | ||
| 776 | memcpy(pointer, iter->second.fileData + iter->second.seekPos, size); | ||
| 777 | iter->second.seekPos += size; | ||
| 778 | return bytesRead; | ||
| 779 | } else { | ||
| 780 | ERROR_LOG(FILESYS,"Cannot read file that hasn't been opened: %08x", handle); | ||
| 781 | return 0; | ||
| 782 | } | ||
| 783 | } | ||
| 784 | |||
| 785 | size_t VFSFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size) { | ||
| 786 | // NOT SUPPORTED - READ ONLY | ||
| 787 | return 0; | ||
| 788 | } | ||
| 789 | |||
| 790 | size_t VFSFileSystem::SeekFile(u32 handle, s32 position, FileMove type) { | ||
| 791 | EntryMap::iterator iter = entries.find(handle); | ||
| 792 | if (iter != entries.end()) { | ||
| 793 | switch (type) { | ||
| 794 | case FILEMOVE_BEGIN: iter->second.seekPos = position; break; | ||
| 795 | case FILEMOVE_CURRENT: iter->second.seekPos += position; break; | ||
| 796 | case FILEMOVE_END: iter->second.seekPos = iter->second.size + position; break; | ||
| 797 | } | ||
| 798 | return iter->second.seekPos; | ||
| 799 | } else { | ||
| 800 | //This shouldn't happen... | ||
| 801 | ERROR_LOG(FILESYS,"Cannot seek in file that hasn't been opened: %08x", handle); | ||
| 802 | return 0; | ||
| 803 | } | ||
| 804 | } | ||
| 805 | |||
| 806 | |||
| 807 | bool VFSFileSystem::GetHostPath(const std::string &inpath, std::string &outpath) { | ||
| 808 | // NOT SUPPORTED | ||
| 809 | return false; | ||
| 810 | } | ||
| 811 | |||
| 812 | std::vector<FileInfo> VFSFileSystem::GetDirListing(std::string path) { | ||
| 813 | std::vector<FileInfo> myVector; | ||
| 814 | // TODO | ||
| 815 | return myVector; | ||
| 816 | } | ||
| 817 | |||
| 818 | void VFSFileSystem::DoState(PointerWrap &p) { | ||
| 819 | if (!entries.empty()) { | ||
| 820 | p.SetError(p.ERROR_WARNING); | ||
| 821 | ERROR_LOG(FILESYS, "FIXME: Open files during savestate, could go badly."); | ||
| 822 | } | ||
| 823 | } | ||
| 824 | |||
| 825 | */ | ||