1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

sys_fs: Fixed up sys_fs_fcntl(0xc0000007) aka cellFsArcadeHddSerialNumber according to real hardware testing

This commit is contained in:
brian218 2023-07-26 17:36:44 +08:00 committed by Elad Ashkenazi
parent 94bb75fb7c
commit 0b829be798
3 changed files with 13 additions and 22 deletions

View File

@ -2064,27 +2064,18 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr<void> _arg, u32
{ {
const auto arg = vm::static_ptr_cast<lv2_file_c0000007>(_arg); const auto arg = vm::static_ptr_cast<lv2_file_c0000007>(_arg);
std::string_view device{arg->device.get_ptr(), arg->device_size};
// Trim trailing '\0'
if (const auto trim_pos = device.find('\0'); trim_pos != umax)
device.remove_suffix(device.size() - trim_pos);
if (device != "CELL_FS_IOS:ATA_HDD"sv)
{
arg->out_code = CELL_ENOTSUP;
return {CELL_ENOTSUP, device};
}
const auto model = g_cfg.sys.hdd_model.to_string();
const auto serial = g_cfg.sys.hdd_serial.to_string();
strcpy_trunc(std::span(arg->model.get_ptr(), arg->model_size), model);
strcpy_trunc(std::span(arg->serial.get_ptr(), arg->serial_size), serial);
arg->out_code = CELL_OK; arg->out_code = CELL_OK;
sys_fs.trace("sys_fs_fcntl(0xc0000007): found device \"%s\" (model=\"%s\", serial=\"%s\")", device, model, serial); if (const auto size = arg->model_size; size > 0)
strcpy_trunc(std::span(arg->model.get_ptr(), size),
fmt::format("%-*s", size - 1, g_cfg.sys.hdd_model.to_string())); // Example: "TOSHIBA MK3265GSX H "
if (const auto size = arg->serial_size; size > 0)
strcpy_trunc(std::span(arg->serial.get_ptr(), size),
fmt::format("%*s", size - 1, g_cfg.sys.hdd_serial.to_string())); // Example: " 0A1B2C3D4"
else
return CELL_EFAULT; // CELL_EFAULT is returned only when arg->serial_size == 0
return CELL_OK; return CELL_OK;
} }

View File

@ -529,8 +529,8 @@ CHECK_SIZE(lv2_file_c0000006, 0x20);
// sys_fs_fcntl: cellFsArcadeHddSerialNumber // sys_fs_fcntl: cellFsArcadeHddSerialNumber
struct lv2_file_c0000007 : lv2_file_op struct lv2_file_c0000007 : lv2_file_op
{ {
be_t<u32> out_code; be_t<u32> out_code; // set to 0
vm::bcptr<char> device; vm::bcptr<char> device; // CELL_FS_IOS:ATA_HDD
be_t<u32> device_size; // 0x14 be_t<u32> device_size; // 0x14
vm::bptr<char> model; vm::bptr<char> model;
be_t<u32> model_size; // 0x29 be_t<u32> model_size; // 0x29

View File

@ -334,7 +334,7 @@ void usb_device_usio::translate_input_tekken()
} }
break; break;
case usio_btn::down: case usio_btn::down:
if ( pressed) if (pressed)
{ {
digital_input |= 0x100000ULL << shift; digital_input |= 0x100000ULL << shift;
if (player == 0) if (player == 0)