mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 06:26:49 +00:00
vfsLocalDir, rFile routines improved
This commit is contained in:
parent
2798827066
commit
d032bc5691
9 changed files with 334 additions and 667 deletions
|
|
@ -16,12 +16,14 @@ struct DirEntryInfo
|
|||
{
|
||||
std::string name;
|
||||
u32 flags;
|
||||
u64 size;
|
||||
time_t create_time;
|
||||
time_t access_time;
|
||||
time_t modify_time;
|
||||
|
||||
DirEntryInfo()
|
||||
: flags(0)
|
||||
, size(0)
|
||||
, create_time(0)
|
||||
, access_time(0)
|
||||
, modify_time(0)
|
||||
|
|
|
|||
|
|
@ -12,30 +12,29 @@ vfsLocalDir::~vfsLocalDir()
|
|||
|
||||
bool vfsLocalDir::Open(const std::string& path)
|
||||
{
|
||||
if(!vfsDirBase::Open(path))
|
||||
return false;
|
||||
|
||||
if(!dir.Open(path))
|
||||
if (!vfsDirBase::Open(path) || !dir.Open(path))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string name;
|
||||
for(bool is_ok = dir.GetFirst(&name); is_ok; is_ok = dir.GetNext(&name))
|
||||
|
||||
for (bool is_ok = dir.GetFirst(&name); is_ok; is_ok = dir.GetNext(&name))
|
||||
{
|
||||
std::string dir_path = path + "/" + name;
|
||||
FileInfo file_info;
|
||||
get_file_info(path + "/" + name, file_info);
|
||||
|
||||
m_entries.emplace_back();
|
||||
// TODO: Use same info structure as fileinfo?
|
||||
|
||||
DirEntryInfo& info = m_entries.back();
|
||||
|
||||
info.name = name;
|
||||
|
||||
FileInfo fileinfo;
|
||||
getFileInfo(dir_path.c_str(), &fileinfo);
|
||||
|
||||
// Not sure of purpose for below. I hope these don't need to be correct
|
||||
info.flags |= rIsDir(dir_path) ? DirEntry_TypeDir : DirEntry_TypeFile;
|
||||
if(fileinfo.isWritable) info.flags |= DirEntry_PermWritable;
|
||||
info.flags |= DirEntry_PermReadable; // Always?
|
||||
info.flags |= DirEntry_PermExecutable; // Always?
|
||||
info.flags |= file_info.isDirectory ? DirEntry_TypeDir | DirEntry_PermExecutable : DirEntry_TypeFile;
|
||||
info.flags |= file_info.isWritable ? DirEntry_PermWritable | DirEntry_PermReadable : DirEntry_PermReadable;
|
||||
info.size = file_info.size;
|
||||
info.access_time = file_info.atime;
|
||||
info.modify_time = file_info.mtime;
|
||||
info.create_time = file_info.ctime;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -410,35 +410,47 @@ namespace vm
|
|||
static_assert(!sizeof(AT), "vm::_ptr_base<> error: use RT(T...) format for functions instead of RT(*)(T...)");
|
||||
};
|
||||
|
||||
//BE pointer to LE data
|
||||
// BE pointer to LE data
|
||||
template<typename T, int lvl = 1, typename AT = u32> using bptrl = _ptr_base<T, lvl, typename to_be_t<AT>::type>;
|
||||
|
||||
//BE pointer to BE data
|
||||
// BE pointer to BE data
|
||||
template<typename T, int lvl = 1, typename AT = u32> using bptrb = _ptr_base<typename to_be_t<T>::type, lvl, typename to_be_t<AT>::type>;
|
||||
|
||||
//LE pointer to BE data
|
||||
// LE pointer to BE data
|
||||
template<typename T, int lvl = 1, typename AT = u32> using lptrb = _ptr_base<typename to_be_t<T>::type, lvl, AT>;
|
||||
|
||||
//LE pointer to LE data
|
||||
// LE pointer to LE data
|
||||
template<typename T, int lvl = 1, typename AT = u32> using lptrl = _ptr_base<T, lvl, AT>;
|
||||
|
||||
namespace ps3
|
||||
{
|
||||
//default pointer for HLE functions (LE pointer to BE data)
|
||||
// default pointer for HLE functions (LE pointer to BE data)
|
||||
template<typename T, int lvl = 1, typename AT = u32> using ptr = lptrb<T, lvl, AT>;
|
||||
|
||||
//default pointer for HLE structures (BE pointer to BE data)
|
||||
// default pointer for HLE structures (BE pointer to BE data)
|
||||
template<typename T, int lvl = 1, typename AT = u32> using bptr = bptrb<T, lvl, AT>;
|
||||
}
|
||||
|
||||
namespace psv
|
||||
{
|
||||
//default pointer for HLE functions & structures (LE pointer to LE data)
|
||||
// default pointer for HLE functions & structures (LE pointer to LE data)
|
||||
template<typename T, int lvl = 1, typename AT = u32> using ptr = lptrl<T, lvl, AT>;
|
||||
}
|
||||
|
||||
//PS3 emulation is main now, so lets it be as default
|
||||
// PS3 emulation is main now, so lets it be as default
|
||||
using namespace ps3;
|
||||
|
||||
struct null_t
|
||||
{
|
||||
template<typename T, int lvl, typename AT> operator _ptr_base<T, lvl, AT>() const
|
||||
{
|
||||
const std::array<AT, 1> value = {};
|
||||
return _ptr_base<T, lvl, AT>::make(value[0]);
|
||||
}
|
||||
};
|
||||
|
||||
// vm::null is convertible to any vm::ptr type as null pointer in virtual memory
|
||||
static const null_t null;
|
||||
}
|
||||
|
||||
namespace fmt
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -271,11 +271,11 @@ struct SaveDataEntry
|
|||
std::string title;
|
||||
std::string subtitle;
|
||||
std::string details;
|
||||
u32 sizeKB;
|
||||
s64 st_atime_;
|
||||
s64 st_mtime_;
|
||||
s64 st_ctime_;
|
||||
void* iconBuf;
|
||||
u32 iconBufSize;
|
||||
u64 sizeKB;
|
||||
s64 atime;
|
||||
s64 mtime;
|
||||
s64 ctime;
|
||||
//void* iconBuf;
|
||||
//u32 iconBufSize;
|
||||
bool isNew;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ Emulator::~Emulator()
|
|||
delete m_callback_manager;
|
||||
delete m_event_manager;
|
||||
delete m_module_manager;
|
||||
delete m_sync_prim_manager;
|
||||
delete m_vfs;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ class CallbackManager;
|
|||
class CPUThread;
|
||||
class EventManager;
|
||||
class ModuleManager;
|
||||
class SyncPrimManager;
|
||||
struct VFS;
|
||||
|
||||
struct EmuInfo
|
||||
|
|
@ -91,7 +90,6 @@ class Emulator
|
|||
CallbackManager* m_callback_manager;
|
||||
EventManager* m_event_manager;
|
||||
ModuleManager* m_module_manager;
|
||||
SyncPrimManager* m_sync_prim_manager;
|
||||
VFS* m_vfs;
|
||||
|
||||
EmuInfo m_info;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue