mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 08:51:28 +12:00
Fix sys_storage_read
This commit is contained in:
parent
f6e4cc14a2
commit
a06a93d5ba
1 changed files with 17 additions and 13 deletions
|
@ -3,7 +3,8 @@
|
||||||
#include "Emu/IdManager.h"
|
#include "Emu/IdManager.h"
|
||||||
|
|
||||||
#include "Emu/Cell/ErrorCodes.h"
|
#include "Emu/Cell/ErrorCodes.h"
|
||||||
#include "Emu/Cell/lv2/sys_event.h"
|
#include "sys_event.h"
|
||||||
|
#include "sys_fs.h"
|
||||||
#include "util/shared_ptr.hpp"
|
#include "util/shared_ptr.hpp"
|
||||||
|
|
||||||
#include "sys_storage.h"
|
#include "sys_storage.h"
|
||||||
|
@ -63,24 +64,20 @@ error_code sys_storage_read(u32 fd, u32 mode, u32 start_sector, u32 num_sectors,
|
||||||
return CELL_EFAULT;
|
return CELL_EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(bounce_buf.get_ptr(), 0, num_sectors * 0x200);
|
std::memset(bounce_buf.get_ptr(), 0, num_sectors * 0x200ull);
|
||||||
|
const auto handle = idm::get<lv2_storage>(fd);
|
||||||
|
|
||||||
auto handle = idm::get<lv2_storage>(fd);
|
|
||||||
if (!handle)
|
if (!handle)
|
||||||
{
|
{
|
||||||
return CELL_ESRCH; // idk
|
return CELL_ESRCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle->device_id == 0x100000200000004 && handle->file)
|
if (handle->file)
|
||||||
{
|
{
|
||||||
handle->file.seek(start_sector * 0x200);
|
handle->file.seek(start_sector * 0x200ull);
|
||||||
u64 size = num_sectors * 0x200;
|
const u64 size = num_sectors * 0x200ull;
|
||||||
const u64 result = handle->file.read(bounce_buf.get_ptr(), size);
|
const u64 result = lv2_file::op_read(handle->file, bounce_buf, size);
|
||||||
|
num_sectors = result / 0x200;
|
||||||
if (result != size) // mjau
|
|
||||||
{
|
|
||||||
fmt::throw_exception("didnt read expected");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*sectors_read = num_sectors;
|
*sectors_read = num_sectors;
|
||||||
|
@ -97,6 +94,13 @@ error_code sys_storage_write(u32 fd, u32 mode, u32 start_sector, u32 num_sectors
|
||||||
return CELL_EFAULT;
|
return CELL_EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto handle = idm::get<lv2_storage>(fd);
|
||||||
|
|
||||||
|
if (!handle)
|
||||||
|
{
|
||||||
|
return CELL_ESRCH;
|
||||||
|
}
|
||||||
|
|
||||||
*sectors_wrote = num_sectors;
|
*sectors_wrote = num_sectors;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue