diff --git a/rpcs3/Emu/Cell/SPUAnalyser.cpp b/rpcs3/Emu/Cell/SPUAnalyser.cpp index 6df784cfb9..e93abfd151 100644 --- a/rpcs3/Emu/Cell/SPUAnalyser.cpp +++ b/rpcs3/Emu/Cell/SPUAnalyser.cpp @@ -5,7 +5,7 @@ const spu_decoder s_spu_itype; -std::shared_ptr SPUDatabase::find(const be_t* data, u64 key, u32 max_size) +spu_function_t* SPUDatabase::find(const be_t* data, u64 key, u32 max_size) { for (auto found = m_db.equal_range(key); found.first != found.second; found.first++) { @@ -14,7 +14,7 @@ std::shared_ptr SPUDatabase::find(const be_t* data, u64 key // Compare binary data explicitly (TODO: optimize) if (LIKELY(func->size <= max_size) && std::memcmp(func->data.data(), data, func->size) == 0) { - return func; + return func.get(); } } @@ -33,7 +33,7 @@ SPUDatabase::~SPUDatabase() // TODO: serialize database } -std::shared_ptr SPUDatabase::analyse(const be_t* ls, u32 entry, u32 max_limit) +spu_function_t* SPUDatabase::analyse(const be_t* ls, u32 entry, u32 max_limit) { // Check arguments (bounds and alignment) if (max_limit > 0x40000 || entry >= max_limit || entry % 4 || max_limit % 4) @@ -330,5 +330,5 @@ std::shared_ptr SPUDatabase::analyse(const be_t* ls, u32 en LOG_NOTICE(SPU, "Function detected [0x%05x-0x%05x] (size=0x%x)", func->addr, func->addr + func->size, func->size); - return func; + return func.get(); } diff --git a/rpcs3/Emu/Cell/SPUAnalyser.h b/rpcs3/Emu/Cell/SPUAnalyser.h index aa29413a63..dfd29f9181 100644 --- a/rpcs3/Emu/Cell/SPUAnalyser.h +++ b/rpcs3/Emu/Cell/SPUAnalyser.h @@ -289,12 +289,12 @@ class SPUDatabase final : spu_itype std::unordered_multimap> m_db; // For internal use - std::shared_ptr find(const be_t* data, u64 key, u32 max_size); + spu_function_t* find(const be_t* data, u64 key, u32 max_size); public: SPUDatabase(); ~SPUDatabase(); // Try to retrieve SPU function information - std::shared_ptr analyse(const be_t* ls, u32 entry, u32 limit = 0x40000); + spu_function_t* analyse(const be_t* ls, u32 entry, u32 limit = 0x40000); }; diff --git a/rpcs3/Emu/Cell/SPURecompiler.cpp b/rpcs3/Emu/Cell/SPURecompiler.cpp index f9102a3b32..60cecc7bdf 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -29,7 +29,7 @@ void spu_recompiler_base::enter(SPUThread& spu) // Check shared db if we dont have a match if (!func || !std::equal(func->data.begin(), func->data.end(), _ls + spu.pc / 4, [](const be_t& l, const be_t& r) { return *(u32*)(u8*)&l == *(u32*)(u8*)&r; })) { - func = spu.spu_db->analyse(_ls, spu.pc).get(); + func = spu.spu_db->analyse(_ls, spu.pc); spu.compiled_cache[spu.pc / 4] = func; }