-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crypto/sys_fs: NPDRM decryption performance improvememts, memory usage reduction #15139
Conversation
a6228e4 to
02cf543
Compare
|
Found another and more severe performance issue: when installing SDATs from PKG files data would first be decrypted as a mid-stage to disk, then loaded in whole to RAM, then flushed to destination as final decrypted data. |
3b60965 to
2b3febf
Compare
rpcs3/Crypto/unedat.cpp
Outdated
| u64 size_left = edat->file_size; | ||
| std::unique_ptr<u8[]> data(new u8[edat->block_size]); | ||
|
|
||
| std::vector<u8> data(edat->block_size); | ||
|
|
||
| for (int i = 0; i < total_blocks; i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signed mismatch
rpcs3/Crypto/unedat.cpp
Outdated
| @@ -326,22 +320,24 @@ s64 decrypt_block(const fs::file* in, u8* out, EDAT_HEADER *edat, NPD_HEADER *np | |||
| // reset file to beginning of data before calling | |||
| int decrypt_data(const fs::file* in, const fs::file* out, EDAT_HEADER *edat, NPD_HEADER *npd, unsigned char* crypt_key, bool /*verbose*/) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should return a bool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
ee01ac3 to
6dacf3d
Compare
bd17764 to
307b184
Compare
Previous code was structured very naively: if 8GB read is requested, it would allocate 8GB of memory. Without considering recycling memory for each block.
TODO:
Additional / Side effects: