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()); FromBE(value.ToBE());
} }
T ToBE() const const T& ToBE() const
{ {
return m_data; return m_data;
} }

View file

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

View file

@ -45,7 +45,7 @@ bool vfsLocalFile::Open(const wxString& path, vfsOpenMode mode)
{ {
Close(); 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)) && return m_file.Open(vfsDevice::GetWinPath(GetLocalPath(), path), vfs2wx_mode(mode)) &&
vfsFileBase::Open(vfsDevice::GetPs3Path(GetPs3Path(), path), mode); vfsFileBase::Open(vfsDevice::GetPs3Path(GetPs3Path(), path), mode);
@ -53,12 +53,33 @@ bool vfsLocalFile::Open(const wxString& path, vfsOpenMode mode)
bool vfsLocalFile::Create(const wxString& path) 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;
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; wxFile f;
return f.Create(path); return f.Create(path);
} }
return true;
}
bool vfsLocalFile::Close() bool vfsLocalFile::Close()
{ {
return m_file.Close() && vfsFileBase::Close(); return m_file.Close() && vfsFileBase::Close();

View file

@ -1452,8 +1452,10 @@ void RSXThread::Task()
{ {
wxCriticalSectionLocker lock(m_cs_main); wxCriticalSectionLocker lock(m_cs_main);
const u32 get = re(m_ctrl->get); u32 put, get;
const u32 put = re(m_ctrl->put); 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 || !Emu.IsRunning())
{ {
if(put == get) if(put == get)

View file

@ -305,12 +305,12 @@ public:
if(len) memcpy(wxStringBuffer(ret, len), GetMemFromAddr(addr), len); if(len) memcpy(wxStringBuffer(ret, len), GetMemFromAddr(addr), len);
return ret; return wxString(ret, wxConvUTF8);
} }
wxString ReadString(const u64 addr) 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) 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; Callback cb;
cb.SetAddr(m_addr); cb.SetAddr(m_addr);
cb.Handle(_get_func_arg(a1)); cb.Handle(_func_arg<T1>::get_value(a1));
cb.Branch(!is_async); 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) 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)", 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); 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) if(flags & CELL_O_CREAT)
{ {
_oflags &= ~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); Emu.GetVFS().Create(ppath);
} }

View file

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

View file

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