3
0
Fork 0
forked from suyu/suyu

nvmap: Make IocFromId return the same existing handle instead of creating a new one.

Games like Puyo Puyo Tetris and BOTW seem to depend on the buffer always having the same handle
This commit is contained in:
Subv 2018-02-17 13:56:21 -05:00
parent d758332425
commit 416f692f6e

View file

@ -103,11 +103,8 @@ u32 nvmap::IocFromId(const std::vector<u8>& input, std::vector<u8>& output) {
[&](const auto& entry) { return entry.second->id == params.id; });
ASSERT(itr != handles.end());
// Make a new handle for the object
u32 handle = next_handle++;
handles[handle] = itr->second;
params.handle = handle;
// Return the existing handle instead of creating a new one.
params.handle = itr->first;
std::memcpy(output.data(), &params, sizeof(params));
return 0;