mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 22:19:02 +00:00
Improve narrow() and size32() with src_loc detection
This commit is contained in:
parent
e055d16b2c
commit
5d934c8759
16 changed files with 69 additions and 48 deletions
|
|
@ -745,7 +745,7 @@ bool SCEDecrypter::DecryptData()
|
|||
// Calculate the total data size.
|
||||
for (unsigned int i = 0; i < meta_hdr.section_count; i++)
|
||||
{
|
||||
data_buf_length += ::narrow<u32>(meta_shdr[i].data_size, HERE);
|
||||
data_buf_length += ::narrow<u32>(meta_shdr[i].data_size);
|
||||
}
|
||||
|
||||
// Allocate a buffer to store decrypted data.
|
||||
|
|
@ -799,7 +799,7 @@ bool SCEDecrypter::DecryptData()
|
|||
}
|
||||
|
||||
// Advance the buffer's offset.
|
||||
data_buf_offset += ::narrow<u32>(meta_shdr[i].data_size, HERE);
|
||||
data_buf_offset += ::narrow<u32>(meta_shdr[i].data_size);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -829,7 +829,7 @@ std::vector<fs::file> SCEDecrypter::MakeFile()
|
|||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
strm.avail_in = ::narrow<uInt>(meta_shdr[i].data_size, HERE);
|
||||
strm.avail_in = ::narrow<uInt>(meta_shdr[i].data_size);
|
||||
strm.avail_out = BUFSIZE;
|
||||
strm.next_in = data_buf.get()+data_buf_offset;
|
||||
strm.next_out = tempbuf;
|
||||
|
|
@ -874,7 +874,7 @@ std::vector<fs::file> SCEDecrypter::MakeFile()
|
|||
}
|
||||
|
||||
// Advance the data buffer offset by data size.
|
||||
data_buf_offset += ::narrow<u32>(meta_shdr[i].data_size, HERE);
|
||||
data_buf_offset += ::narrow<u32>(meta_shdr[i].data_size);
|
||||
|
||||
if (out_f.pos() != out_f.size())
|
||||
fmt::throw_exception("MakeELF written bytes (%llu) does not equal buffer size (%llu).", out_f.pos(), out_f.size());
|
||||
|
|
@ -1243,7 +1243,7 @@ bool SELFDecrypter::DecryptData()
|
|||
if (meta_shdr[i].encrypted == 3)
|
||||
{
|
||||
if ((meta_shdr[i].key_idx <= meta_hdr.key_count - 1) && (meta_shdr[i].iv_idx <= meta_hdr.key_count))
|
||||
data_buf_length += ::narrow<u32>(meta_shdr[i].data_size, HERE);
|
||||
data_buf_length += ::narrow<u32>(meta_shdr[i].data_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1289,7 +1289,7 @@ bool SELFDecrypter::DecryptData()
|
|||
memcpy(data_buf.get() + data_buf_offset, buf.get(), meta_shdr[i].data_size);
|
||||
|
||||
// Advance the buffer's offset.
|
||||
data_buf_offset += ::narrow<u32>(meta_shdr[i].data_size, HERE);
|
||||
data_buf_offset += ::narrow<u32>(meta_shdr[i].data_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue