| 239 | } |
| 240 | |
| 241 | static void cdvdReadNVM(u8* dst, int offset, int bytes) |
| 242 | { |
| 243 | int to_read = bytes; |
| 244 | if (static_cast<size_t>(offset + bytes) > sizeof(s_nvram)) [[unlikely]] |
| 245 | { |
| 246 | WARNING_LOG("CDVD: Out of bounds NVRAM read: offset={}, bytes={}", offset, bytes); |
| 247 | to_read = std::max(static_cast<int>(sizeof(s_nvram)) - offset, 0); |
| 248 | pxAssert((bytes - to_read) > 0); |
| 249 | std::memset(dst + to_read, 0, bytes - to_read); |
| 250 | } |
| 251 | |
| 252 | if (to_read > 0) [[likely]] |
| 253 | std::memcpy(dst, &s_nvram[offset], to_read); |
| 254 | } |
| 255 | |
| 256 | static void cdvdWriteNVM(const u8* src, int offset, int bytes) |
| 257 | { |
no test coverage detected