mirror of
https://github.com/wiiu-env/homebrew_on_menu_plugin.git
synced 2024-11-22 02:29:15 +01:00
Change the scope of the mutex when hooking into the FSReadfile to avoid a possible deadlook when exiting some games.
This commit is contained in:
parent
6d868eabb9
commit
b10a288150
@ -451,6 +451,7 @@ DECL_FUNCTION(int32_t, MCP_TitleList, uint32_t handle, uint32_t *outTitleCount,
|
||||
|
||||
uint32_t titleCount = *outTitleCount;
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(fileInfosMutex);
|
||||
readCustomTitlesFromSD();
|
||||
|
||||
@ -458,6 +459,7 @@ DECL_FUNCTION(int32_t, MCP_TitleList, uint32_t handle, uint32_t *outTitleCount,
|
||||
memcpy(&(titleList[titleCount]), &(gFileInfo->titleInfo), sizeof(MCPTitleListType));
|
||||
titleCount++;
|
||||
}
|
||||
}
|
||||
|
||||
*outTitleCount = titleCount;
|
||||
|
||||
@ -540,12 +542,14 @@ DECL_FUNCTION(FSStatus, FSCloseFile, FSClient *client, FSCmdBlock *block, FSFile
|
||||
}
|
||||
|
||||
DECL_FUNCTION(FSStatus, FSReadFile, FSClient *client, FSCmdBlock *block, uint8_t *buffer, uint32_t size, uint32_t count, FSFileHandle handle, uint32_t unk1, uint32_t flags) {
|
||||
{
|
||||
const std::lock_guard<std::mutex> lock(fileReaderListMutex);
|
||||
for (auto &reader : openFileReaders) {
|
||||
if ((uint32_t) reader.get() == (uint32_t) handle) {
|
||||
return (FSStatus) (reader->read(buffer, size * count) / size);
|
||||
}
|
||||
}
|
||||
}
|
||||
FSStatus result = real_FSReadFile(client, block, buffer, size, count, handle, unk1, flags);
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user