diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.cpp b/rpcs3/Emu/Cell/lv2/sys_fs.cpp index 6bb4573678..e3cc526eaf 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_fs.cpp @@ -1218,9 +1218,36 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr _arg, u32 { const auto arg = vm::static_ptr_cast(_arg); - sys_fs.warning("0xc0000006: 0x%x, 0x%x, 0x%x, %s, 0x%x, 0x%x, 0x%x", arg->size, arg->_x4, arg->_x8, arg->name, arg->_x14, arg->code, arg->_x1c); + if (arg->size != 0x20) + { + sys_fs.error("sys_fs_fcntl(0xc0000006): invalid size (0x%x)", arg->size); + break; + } - arg->code = CELL_ENOTSUP; + if (arg->_x4 != 0x10 || arg->_x8 != 0x18) + { + sys_fs.error("sys_fs_fcntl(0xc0000006): invalid args (0x%x, 0x%x)", arg->_x4, arg->_x8); + break; + } + + // Load mountpoint (doesn't support multiple // at the start) + std::string_view vpath{arg->name.get_ptr(), arg->name_size}; + + sys_fs.notice("sys_fs_fcntl(0xc0000006): %s", vpath); + + // Check only mountpoint + vpath = vpath.substr(0, vpath.find_first_of("/", 1)); + + // Some mountpoints seem to be handled specially + if (false) + { + // TODO: /dev_hdd1, /dev_usb000, /dev_flash + //arg->out_code = CELL_OK; + //arg->out_id = 0x1b5; + } + + arg->out_code = CELL_ENOTSUP; + arg->out_id = 0; return CELL_OK; } diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.h b/rpcs3/Emu/Cell/lv2/sys_fs.h index 9380b9957f..eb39e46592 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.h +++ b/rpcs3/Emu/Cell/lv2/sys_fs.h @@ -336,12 +336,12 @@ struct lv2_file_c0000006 : lv2_file_op { be_t size; // 0x20 be_t _x4; // 0x10 - be_t _x8; // 0x18 - be_t _xc; // 0x9 + be_t _x8; // 0x18 - offset of out_code + be_t name_size; vm::bcptr name; be_t _x14; // 0 - be_t code; // 0x80010003 - be_t _x1c; // 0 + be_t out_code; // 0x80010003 + be_t out_id; // set to 0, may return 0x1b5 }; CHECK_SIZE(lv2_file_c0000006, 0x20);