Improved vfsDevice.

Minor fixes.
This commit is contained in:
DH 2014-01-19 18:05:27 +02:00
parent ab41540064
commit dc2fd8c39e
8 changed files with 46 additions and 36 deletions

View File

@ -63,7 +63,7 @@ public:
FromBE(value.ToBE());
}
T ToBE() const
const T& ToBE() const
{
return m_data;
}

View File

@ -42,12 +42,18 @@ u32 vfsDevice::CmpPs3Path(const wxString& ps3_path)
u32 vfsDevice::CmpLocalPath(const wxString& local_path)
{
if(local_path.Len() < m_local_path.Len())
return 0;
const u32 lim = min(m_local_path.Len(), local_path.Len());
u32 ret = 0;
for(u32 i=0; i<lim; ++i, ++ret)
{
if(m_local_path[i] != local_path[i]) break;
if(m_local_path[i] != local_path[i])
{
return 0;
}
}
return ret;
@ -87,6 +93,8 @@ wxString vfsDevice::ErasePath(const wxString& path, u32 start_dir_count, u32 end
wxString vfsDevice::GetRoot(const wxString& path)
{
return wxFileName(path, wxPATH_UNIX).GetPath();
/*
if(path.IsEmpty()) return wxEmptyString;
u32 first_dir = path.Len() - 1;
@ -111,6 +119,7 @@ wxString vfsDevice::GetRoot(const wxString& path)
}
return path(0, first_dir + 1);
*/
}
wxString vfsDevice::GetRootPs3(const wxString& path)

View File

@ -45,7 +45,7 @@ bool vfsLocalFile::Open(const wxString& path, vfsOpenMode mode)
{
Close();
if(mode == vfsRead && !m_file.Access(vfsDevice::GetWinPath(GetLocalPath(), path), vfs2wx_mode(mode))) return false;
if(!m_file.Access(vfsDevice::GetWinPath(GetLocalPath(), path), vfs2wx_mode(mode))) return false;
return m_file.Open(vfsDevice::GetWinPath(GetLocalPath(), path), vfs2wx_mode(mode)) &&
vfsFileBase::Open(vfsDevice::GetPs3Path(GetPs3Path(), path), mode);
@ -53,10 +53,31 @@ bool vfsLocalFile::Open(const wxString& path, vfsOpenMode mode)
bool vfsLocalFile::Create(const wxString& path)
{
if(wxFileExists(path)) return false;
ConLog.Warning("vfsLocalFile::Create('%s')", path.c_str());
for(uint p=1;p<path.Length();p++)
{
for(; path[p] != '\0'; p++)
if(path[p] == '\\') break;
wxFile f;
return f.Create(path);
if(path[p] == '\0')
break;
const wxString& dir = path(0, p);
if(!wxDirExists(dir))
{
ConLog.Write("create dir: %s", dir.c_str());
wxMkdir(dir);
}
}
//create file
if(path(path.Len() - 1, 1) != '\\' && !wxFileExists(path))
{
wxFile f;
return f.Create(path);
}
return true;
}
bool vfsLocalFile::Close()

View File

@ -1452,8 +1452,10 @@ void RSXThread::Task()
{
wxCriticalSectionLocker lock(m_cs_main);
const u32 get = re(m_ctrl->get);
const u32 put = re(m_ctrl->put);
u32 put, get;
se_t<u32>::func(put, std::atomic_load((volatile std::atomic<u32>*)((u8*)m_ctrl + offsetof(CellGcmControl, put))));
se_t<u32>::func(get, std::atomic_load((volatile std::atomic<u32>*)((u8*)m_ctrl + offsetof(CellGcmControl, get))));
if(put == get || !Emu.IsRunning())
{
if(put == get)

View File

@ -305,12 +305,12 @@ public:
if(len) memcpy(wxStringBuffer(ret, len), GetMemFromAddr(addr), len);
return ret;
return wxString(ret, wxConvUTF8);
}
wxString ReadString(const u64 addr)
{
return wxString((const char*)GetMemFromAddr(addr));
return wxString((const char*)GetMemFromAddr(addr), wxConvUTF8);
}
void WriteString(const u64 addr, const wxString& str)
@ -737,7 +737,7 @@ class mem_func_ptr_t<RT (*)(T1)> : public mem_base_t<u64>
{
Callback cb;
cb.SetAddr(m_addr);
cb.Handle(_get_func_arg(a1));
cb.Handle(_func_arg<T1>::get_value(a1));
cb.Branch(!is_async);
}

View File

@ -6,7 +6,7 @@ extern Module sys_fs;
int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
{
const wxString& path = wxString(Memory.ReadString(path_addr), wxConvUTF8);
const wxString& path = Memory.ReadString(path_addr);
sys_fs.Log("cellFsOpen(path: %s, flags: 0x%x, fd_addr: 0x%x, arg_addr: 0x%x, size: 0x%llx)",
path.mb_str(), flags, fd.GetAddr(), arg.GetAddr(), size);
@ -17,29 +17,6 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
if(flags & CELL_O_CREAT)
{
_oflags &= ~CELL_O_CREAT;
/*
//create path
for(uint p=1;p<ppath.Length();p++)
{
for(;p<ppath.Length(); p++) if(ppath[p] == '/') break;
if(p == ppath.Length()) break;
const wxString& dir = ppath(0, p);
if(!wxDirExists(dir))
{
ConLog.Write("create dir: %s", dir);
wxMkdir(dir);
}
}
//create file
if(!wxFileExists(ppath))
{
wxFile f;
f.Create(ppath);
f.Close();
}
*/
Emu.GetVFS().Create(ppath);
}

View File

@ -32,6 +32,7 @@ bool Rpcs3App::OnInit()
m_MainFrame->Show();
m_MainFrame->DoSettings(true);
return true;
}

View File

@ -131,7 +131,7 @@
<DataExecutionPrevention>false</DataExecutionPrevention>
</Link>
<PreBuildEvent>
<Command>$(SolutionDir)\Utilities\git-version-gen.cmd</Command>
<Command>"$(SolutionDir)\Utilities\git-version-gen.cmd"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">