sys_fs_test, sys_fs_fcntl draft

This commit is contained in:
Nekotekina 2015-03-15 03:41:08 +03:00
parent 1f05275ac4
commit fae7ddc611
6 changed files with 24 additions and 5 deletions

View file

@ -45,7 +45,8 @@ int cellGifDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellGifDecSrc
case se32(CELL_GIFDEC_FILE):
{
// Get file descriptor and size
std::shared_ptr<fs_file_t> file(new fs_file_t(std::shared_ptr<vfsStream>(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead)), 0, 0));
std::shared_ptr<vfsStream> file_s(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead));
std::shared_ptr<fs_file_t> file(new fs_file_t(file_s, 0, 0));
if (!file) return CELL_GIFDEC_ERROR_OPEN_FILE;
current_subHandle->fd = Emu.GetIdManager().GetNewID(file, TYPE_FS_FILE);
current_subHandle->fileSize = file->file->GetSize();

View file

@ -51,7 +51,8 @@ int cellJpgDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellJpgDecSrc
case se32(CELL_JPGDEC_FILE):
{
// Get file descriptor and size
std::shared_ptr<fs_file_t> file(new fs_file_t(std::shared_ptr<vfsStream>(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead)), 0, 0));
std::shared_ptr<vfsStream> file_s(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead));
std::shared_ptr<fs_file_t> file(new fs_file_t(file_s, 0, 0));
if (!file) return CELL_JPGDEC_ERROR_OPEN_FILE;
current_subHandle->fd = Emu.GetIdManager().GetNewID(file, TYPE_FS_FILE);
current_subHandle->fileSize = file->file->GetSize();

View file

@ -82,7 +82,8 @@ s32 pngDecOpen(
case se32(CELL_PNGDEC_FILE):
{
// Get file descriptor and size
std::shared_ptr<fs_file_t> file(new fs_file_t(std::shared_ptr<vfsStream>(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead)), 0, 0));
std::shared_ptr<vfsStream> file_s(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead));
std::shared_ptr<fs_file_t> file(new fs_file_t(file_s, 0, 0));
if (!file) return CELL_PNGDEC_ERROR_OPEN_FILE;
stream->fd = Emu.GetIdManager().GetNewID(file, TYPE_FS_FILE);
stream->fileSize = file->file->GetSize();

View file

@ -695,7 +695,7 @@ const ppu_func_caller sc_table[1024] =
null_func, null_func, null_func, null_func, null_func, //794 UNS
null_func, null_func, null_func, null_func, null_func, //799 UNS
null_func,//bind_func(sys_fs_test), //800 (0x320)
bind_func(sys_fs_test), //800 (0x320)
bind_func(sys_fs_open), //801 (0x321)
bind_func(sys_fs_read), //802 (0x322)
bind_func(sys_fs_write), //803 (0x323)
@ -712,7 +712,7 @@ const ppu_func_caller sc_table[1024] =
bind_func(sys_fs_unlink), //814 (0x32E)
null_func,//bind_func(sys_fs_utime), //815 (0x32F)
null_func,//bind_func(sys_fs_access), //816 (0x330)
null_func,//bind_func(sys_fs_fcntl), //817 (0x331)
bind_func(sys_fs_fcntl), //817 (0x331)
bind_func(sys_fs_lseek), //818 (0x332)
null_func,//bind_func(sys_fs_fdatasync), //819 (0x333)
null_func,//bind_func(sys_fs_fsync), //820 (0x334)

View file

@ -20,6 +20,13 @@
SysCallBase sys_fs("sys_fs");
s32 sys_fs_test(u32 arg1, u32 arg2, vm::ptr<u32> arg3, u32 arg4, vm::ptr<char> arg5, u32 arg6)
{
sys_fs.Todo("sys_fs_test(arg1=0x%x, arg2=0x%x, arg3=*0x%x, arg4=0x%x, arg5=*0x%x, arg6=0x%x) -> CELL_OK", arg1, arg2, arg3, arg4, arg5, arg6);
return CELL_OK;
}
s32 sys_fs_open(vm::ptr<const char> path, s32 flags, vm::ptr<u32> fd, s32 mode, vm::ptr<const void> arg, u64 size)
{
sys_fs.Warning("sys_fs_open(path=*0x%x, flags=%#o, fd=*0x%x, mode=%#o, arg=*0x%x, size=0x%llx)", path, flags, fd, mode, arg, size);
@ -438,6 +445,13 @@ s32 sys_fs_unlink(vm::ptr<const char> path)
return CELL_OK;
}
s32 sys_fs_fcntl(u32 fd, s32 flags, u32 addr, u32 arg4, u32 arg5, u32 arg6)
{
sys_fs.Todo("sys_fs_fcntl(fd=0x%x, flags=0x%x, addr=*0x%x, arg4=0x%x, arg5=0x%x, arg6=0x%x) -> CELL_OK", fd, flags, addr, arg4, arg5, arg6);
return CELL_OK;
}
s32 sys_fs_lseek(u32 fd, s64 offset, s32 whence, vm::ptr<u64> pos)
{
sys_fs.Log("sys_fs_lseek(fd=0x%x, offset=0x%llx, whence=0x%x, pos=*0x%x)", fd, offset, whence, pos);

View file

@ -159,6 +159,7 @@ struct fs_file_t
};
// SysCalls
s32 sys_fs_test(u32 arg1, u32 arg2, vm::ptr<u32> arg3, u32 arg4, vm::ptr<char> arg5, u32 arg6);
s32 sys_fs_open(vm::ptr<const char> path, s32 flags, vm::ptr<u32> fd, s32 mode, vm::ptr<const void> arg, u64 size);
s32 sys_fs_read(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<u64> nread);
s32 sys_fs_write(u32 fd, vm::ptr<const void> buf, u64 nbytes, vm::ptr<u64> nwrite);
@ -172,6 +173,7 @@ s32 sys_fs_mkdir(vm::ptr<const char> path, s32 mode);
s32 sys_fs_rename(vm::ptr<const char> from, vm::ptr<const char> to);
s32 sys_fs_rmdir(vm::ptr<const char> path);
s32 sys_fs_unlink(vm::ptr<const char> path);
s32 sys_fs_fcntl(u32 fd, s32 flags, u32 addr, u32 arg4, u32 arg5, u32 arg6);
s32 sys_fs_lseek(u32 fd, s64 offset, s32 whence, vm::ptr<u64> pos);
s32 sys_fs_fget_block_size(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_size, vm::ptr<u64> arg4, vm::ptr<u64> arg5);
s32 sys_fs_get_block_size(vm::ptr<const char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size, vm::ptr<u64> arg4);