mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-03 06:38:46 +00:00
SaveDataMemory: increase memory if needed
This commit is contained in:
parent
cc99f52606
commit
4eef3f4df0
1 changed files with 1 additions and 7 deletions
|
@ -268,9 +268,6 @@ bool TriggerSave() {
|
||||||
|
|
||||||
void ReadMemory(void* buf, size_t buf_size, int64_t offset) {
|
void ReadMemory(void* buf, size_t buf_size, int64_t offset) {
|
||||||
std::scoped_lock lk{g_saving_memory_mutex};
|
std::scoped_lock lk{g_saving_memory_mutex};
|
||||||
if (offset > g_save_memory.size()) {
|
|
||||||
UNREACHABLE_MSG("ReadMemory out of bounds");
|
|
||||||
}
|
|
||||||
if (offset + buf_size > g_save_memory.size()) {
|
if (offset + buf_size > g_save_memory.size()) {
|
||||||
UNREACHABLE_MSG("ReadMemory out of bounds");
|
UNREACHABLE_MSG("ReadMemory out of bounds");
|
||||||
}
|
}
|
||||||
|
@ -279,11 +276,8 @@ void ReadMemory(void* buf, size_t buf_size, int64_t offset) {
|
||||||
|
|
||||||
void WriteMemory(void* buf, size_t buf_size, int64_t offset) {
|
void WriteMemory(void* buf, size_t buf_size, int64_t offset) {
|
||||||
std::scoped_lock lk{g_saving_memory_mutex};
|
std::scoped_lock lk{g_saving_memory_mutex};
|
||||||
if (offset > g_save_memory.size()) {
|
|
||||||
UNREACHABLE_MSG("WriteMemory out of bounds");
|
|
||||||
}
|
|
||||||
if (offset + buf_size > g_save_memory.size()) {
|
if (offset + buf_size > g_save_memory.size()) {
|
||||||
UNREACHABLE_MSG("WriteMemory out of bounds");
|
g_save_memory.resize(offset + buf_size);
|
||||||
}
|
}
|
||||||
std::memcpy(g_save_memory.data() + offset, buf, buf_size);
|
std::memcpy(g_save_memory.data() + offset, buf, buf_size);
|
||||||
g_memory_dirty = true;
|
g_memory_dirty = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue