Fcntl 0xc0000007, 0xc0000015, 0xc000001c

This commit is contained in:
clienthax 2021-12-02 15:41:53 +00:00 committed by Ivan
parent 0e07d3c58f
commit 350257e1a4
2 changed files with 108 additions and 3 deletions

View file

@ -1649,7 +1649,10 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr<void> _arg, u32
case 0xc0000007: // cellFsArcadeHddSerialNumber
{
break;
const auto arg = vm::static_ptr_cast<lv2_file_c000007>(_arg);
// TODO populate arg-> unk1+2
arg->out_code = CELL_OK;
return CELL_OK;
}
case 0xc0000008: // cellFsSetDefaultContainer, cellFsSetIoBuffer, cellFsSetIoBufferFromDefaultContainer
@ -1657,9 +1660,35 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr<void> _arg, u32
break;
}
case 0xc0000015: // Unknown
case 0xc0000015: // USB Vid/Pid lookup - Used by arcade games on dev_usbXXX
{
break;
const auto arg = vm::static_ptr_cast<lv2_file_c0000015>(_arg);
if (arg->size != 0x20u)
{
sys_fs.error("sys_fs_fcntl(0xc0000015): invalid size (0x%x)", arg->size);
break;
}
if (arg->_x4 != 0x10u || arg->_x8 != 0x18u)
{
sys_fs.error("sys_fs_fcntl(0xc0000015): invalid args (0x%x, 0x%x)", arg->_x4, arg->_x8);
break;
}
std::string_view vpath{ arg->name.get_ptr(), arg->name_size };
if (!vpath.starts_with("/dev_usb"sv))
{
arg->out_code = CELL_ENOTSUP;
break;
}
// TODO hook up to config for dev_usb
// arg->vendorID = 0x0000;
// arg->productID = 0x0000;
arg->out_code = CELL_OK;
return CELL_OK;
}
case 0xc0000016: // ps2disc_8160A811
@ -1672,6 +1701,38 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr<void> _arg, u32
break;
}
case 0xc000001c: // USB Vid/Pid/Serial lookup
{
const auto arg = vm::static_ptr_cast<lv2_file_c000001c>(_arg);
if (arg->size != 0x60u)
{
sys_fs.error("sys_fs_fcntl(0xc000001c): invalid size (0x%x)", arg->size);
break;
}
if (arg->_x4 != 0x10u || arg->_x8 != 0x18u)
{
sys_fs.error("sys_fs_fcntl(0xc000001c): invalid args (0x%x, 0x%x)", arg->_x4, arg->_x8);
break;
}
std::string_view vpath{ arg->name.get_ptr(), arg->name_size };
if (!vpath.starts_with("/dev_usb"sv))
{
arg->out_code = CELL_ENOTSUP;
break;
}
// TODO hook up to config for dev_usb
// arg->vendorID = 0x0000;
// arg->productID = 0x0000;
// arg->serial = "blabla"; // String needs to be encoded to utf-16 BE
arg->out_code = CELL_OK;
return CELL_OK;
}
case 0xc0000021: // 9FDBBA89
{
break;

View file

@ -435,6 +435,50 @@ struct lv2_file_c0000006 : lv2_file_op
CHECK_SIZE(lv2_file_c0000006, 0x20);
struct lv2_file_c000007 : lv2_file_op
{
be_t<u32> out_code;
vm::bcptr<char> name;
be_t<u32> name_size; // 0x14
vm::bptr<char> unk1;
be_t<u32> unk1_size; //0x41
vm::bptr<char> unk2;
be_t<u32> unk2_size; //0x21
};
CHECK_SIZE(lv2_file_c000007, 0x1c);
struct lv2_file_c0000015 : lv2_file_op
{
be_t<u32> size; // 0x20
be_t<u32> _x4; // 0x10
be_t<u32> _x8; // 0x18 - offset of out_code
be_t<u32> name_size;
vm::bcptr<char> name;
be_t<u32> _x14; //
be_t<u16> vendorID;
be_t<u16> productID;
be_t<u32> out_code; // set to 0
};
CHECK_SIZE(lv2_file_c0000015, 0x20);
struct lv2_file_c000001c : lv2_file_op
{
be_t<u32> size; // 0x20
be_t<u32> _x4; // 0x10
be_t<u32> _x8; // 0x18 - offset of out_code
be_t<u32> name_size;
vm::bcptr<char> name;
be_t<u32> unk1;
be_t<u16> vendorID;
be_t<u16> productID;
be_t<u32> out_code; // set to 0
u8 serial[64];
};
CHECK_SIZE(lv2_file_c000001c, 0x60);
// sys_fs_fcntl: cellFsAllocateFileAreaWithoutZeroFill
struct lv2_file_e0000017 : lv2_file_op
{