From fae7ddc61148bf7957c9366fc015060150ca8cae Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sun, 15 Mar 2015 03:41:08 +0300 Subject: [PATCH] sys_fs_test, sys_fs_fcntl draft --- rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp | 3 ++- rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp | 3 ++- rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp | 3 ++- rpcs3/Emu/SysCalls/SysCalls.cpp | 4 ++-- rpcs3/Emu/SysCalls/lv2/sys_fs.cpp | 14 ++++++++++++++ rpcs3/Emu/SysCalls/lv2/sys_fs.h | 2 ++ 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp index ce29a0f55e..1ce25e3082 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp @@ -45,7 +45,8 @@ int cellGifDecOpen(u32 mainHandle, vm::ptr subHandle, vm::ptr file(new fs_file_t(std::shared_ptr(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead)), 0, 0)); + std::shared_ptr file_s(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead)); + std::shared_ptr 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(); diff --git a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp index c2b58805d5..600f58bb40 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp @@ -51,7 +51,8 @@ int cellJpgDecOpen(u32 mainHandle, vm::ptr subHandle, vm::ptr file(new fs_file_t(std::shared_ptr(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead)), 0, 0)); + std::shared_ptr file_s(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead)); + std::shared_ptr 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(); diff --git a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp index b3de15a608..162e7a6ee9 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp @@ -82,7 +82,8 @@ s32 pngDecOpen( case se32(CELL_PNGDEC_FILE): { // Get file descriptor and size - std::shared_ptr file(new fs_file_t(std::shared_ptr(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead)), 0, 0)); + std::shared_ptr file_s(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead)); + std::shared_ptr 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(); diff --git a/rpcs3/Emu/SysCalls/SysCalls.cpp b/rpcs3/Emu/SysCalls/SysCalls.cpp index 39f94edfd2..5525a77513 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.cpp +++ b/rpcs3/Emu/SysCalls/SysCalls.cpp @@ -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) diff --git a/rpcs3/Emu/SysCalls/lv2/sys_fs.cpp b/rpcs3/Emu/SysCalls/lv2/sys_fs.cpp index 4b4a0d5ca6..635cf6b615 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_fs.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_fs.cpp @@ -20,6 +20,13 @@ SysCallBase sys_fs("sys_fs"); +s32 sys_fs_test(u32 arg1, u32 arg2, vm::ptr arg3, u32 arg4, vm::ptr 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 path, s32 flags, vm::ptr fd, s32 mode, vm::ptr 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 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 pos) { sys_fs.Log("sys_fs_lseek(fd=0x%x, offset=0x%llx, whence=0x%x, pos=*0x%x)", fd, offset, whence, pos); diff --git a/rpcs3/Emu/SysCalls/lv2/sys_fs.h b/rpcs3/Emu/SysCalls/lv2/sys_fs.h index 08f5d86773..4b7b602464 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_fs.h +++ b/rpcs3/Emu/SysCalls/lv2/sys_fs.h @@ -159,6 +159,7 @@ struct fs_file_t }; // SysCalls +s32 sys_fs_test(u32 arg1, u32 arg2, vm::ptr arg3, u32 arg4, vm::ptr arg5, u32 arg6); s32 sys_fs_open(vm::ptr path, s32 flags, vm::ptr fd, s32 mode, vm::ptr arg, u64 size); s32 sys_fs_read(u32 fd, vm::ptr buf, u64 nbytes, vm::ptr nread); s32 sys_fs_write(u32 fd, vm::ptr buf, u64 nbytes, vm::ptr nwrite); @@ -172,6 +173,7 @@ s32 sys_fs_mkdir(vm::ptr path, s32 mode); s32 sys_fs_rename(vm::ptr from, vm::ptr to); s32 sys_fs_rmdir(vm::ptr path); s32 sys_fs_unlink(vm::ptr 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 pos); s32 sys_fs_fget_block_size(u32 fd, vm::ptr sector_size, vm::ptr block_size, vm::ptr arg4, vm::ptr arg5); s32 sys_fs_get_block_size(vm::ptr path, vm::ptr sector_size, vm::ptr block_size, vm::ptr arg4);