From 9760053c8c88a2e8ea9cc68d429373a9cc206ed9 Mon Sep 17 00:00:00 2001 From: Eladash Date: Wed, 12 Feb 2020 17:17:45 +0200 Subject: [PATCH] cellSearch: Fix id memory access (#7476) --- rpcs3/Emu/Cell/Modules/cellSearch.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellSearch.cpp b/rpcs3/Emu/Cell/Modules/cellSearch.cpp index 94cb97bc57..004a3f26df 100644 --- a/rpcs3/Emu/Cell/Modules/cellSearch.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSearch.cpp @@ -91,7 +91,7 @@ struct search_object_t // TODO: Figured out the correct values to set here static const u32 id_base = 1; static const u32 id_step = 1; - static const u32 id_count = 64; + static const u32 id_count = 1024; // TODO static const u32 invalid = 0xFFFFFFFF; std::vector content_ids; @@ -222,12 +222,12 @@ error_code cellSearchStartListSearch(CellSearchListSearchType type, CellSearchSo return CELL_SEARCH_ERROR_GENERIC; } - *outSearchId = idm::make(); + const u32 id = *outSearchId = idm::make(); sysutil_register_cb([=](ppu_thread& ppu) -> s32 { vm::var resultParam; - resultParam->searchId = *outSearchId; + resultParam->searchId = id; resultParam->resultNum = 0; // TODO search->func(ppu, CELL_SEARCH_EVENT_LISTSEARCH_RESULT, CELL_OK, vm::cast(resultParam.addr()), search->userData); @@ -287,12 +287,12 @@ error_code cellSearchStartContentSearchInList(vm::cptr list return CELL_SEARCH_ERROR_GENERIC; } - *outSearchId = idm::make(); + const u32 id = *outSearchId = idm::make(); sysutil_register_cb([=](ppu_thread& ppu) -> s32 { vm::var resultParam; - resultParam->searchId = *outSearchId; + resultParam->searchId = id; resultParam->resultNum = 0; // TODO search->func(ppu, CELL_SEARCH_EVENT_CONTENTSEARCH_INLIST_RESULT, CELL_OK, vm::cast(resultParam.addr()), search->userData); @@ -362,13 +362,13 @@ error_code cellSearchStartContentSearch(CellSearchContentSearchType type, CellSe return CELL_SEARCH_ERROR_GENERIC; } - *outSearchId = idm::make(); + const u32 id = *outSearchId = idm::make(); sysutil_register_cb([=, content_map = g_fxo->get()](ppu_thread& ppu) -> s32 { auto curr_search = idm::get(*outSearchId); vm::var resultParam; - resultParam->searchId = *outSearchId; + resultParam->searchId = id; resultParam->resultNum = 0; // Set again later std::function searchInFolder = [&, type](const std::string& vpath, const std::string& prev) @@ -549,12 +549,12 @@ error_code cellSearchStartSceneSearchInVideo(vm::cptr video return CELL_SEARCH_ERROR_GENERIC; } - *outSearchId = idm::make(); + const u32 id = *outSearchId = idm::make(); sysutil_register_cb([=](ppu_thread& ppu) -> s32 { vm::var resultParam; - resultParam->searchId = *outSearchId; + resultParam->searchId = id; resultParam->resultNum = 0; // TODO search->func(ppu, CELL_SEARCH_EVENT_SCENESEARCH_INVIDEO_RESULT, CELL_OK, vm::cast(resultParam.addr()), search->userData); @@ -605,12 +605,12 @@ error_code cellSearchStartSceneSearch(CellSearchSceneSearchType searchType, vm:: return CELL_SEARCH_ERROR_GENERIC; } - *outSearchId = idm::make(); + const u32 id = *outSearchId = idm::make(); sysutil_register_cb([=](ppu_thread& ppu) -> s32 { vm::var resultParam; - resultParam->searchId = *outSearchId; + resultParam->searchId = id; resultParam->resultNum = 0; // TODO search->func(ppu, CELL_SEARCH_EVENT_SCENESEARCH_RESULT, CELL_OK, vm::cast(resultParam.addr()), search->userData);