diff --git a/src/Core/PS4/Linker.cpp b/src/Core/PS4/Linker.cpp index a4e00cc6..76e4a6b3 100644 --- a/src/Core/PS4/Linker.cpp +++ b/src/Core/PS4/Linker.cpp @@ -500,7 +500,6 @@ static void relocate(u32 idx, elf_relocation* rel, Module* m, bool isJmpRel) { bool rel_isResolved = false; u08 rel_sym_type = 0; std::string rel_name; - u08 rel_bind_type = -1; //-1 means it didn't resolve switch (type) { case R_X86_64_RELATIVE: @@ -531,7 +530,6 @@ static void relocate(u32 idx, elf_relocation* rel, Module* m, bool isJmpRel) { } switch (sym_bind) { case STB_GLOBAL: - rel_bind_type = STB_GLOBAL; rel_name = namesTlb + sym.st_name; m->linker->Resolve(rel_name, rel_sym_type, m, &symrec); symbol_vitrual_addr = symrec.virtual_address; diff --git a/src/Emulator/Util/singleton.h b/src/Emulator/Util/singleton.h index a401a380..d5086133 100644 --- a/src/Emulator/Util/singleton.h +++ b/src/Emulator/Util/singleton.h @@ -1,24 +1,21 @@ #pragma once -#include -#include +#include template class singleton { - public: +public: static T* instance() { if (!m_instance) { - m_instance = static_cast(std::malloc(sizeof(T))); - new (m_instance) T; + m_instance = std::make_unique(); } - return m_instance; } - protected: +protected: singleton(); ~singleton(); - private: - static inline T* m_instance = nullptr; -}; \ No newline at end of file +private: + static inline std::unique_ptr m_instance{}; +}; diff --git a/src/main.cpp b/src/main.cpp index 172ede3a..022a4c30 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -54,7 +54,7 @@ int main(int argc, char* argv[]) { const char* const path = argv[1]; // argument 1 is the path of self file to boot auto* linker = singleton::instance(); - HLE::Libs::Init_HLE_Libs(linker->getHLESymbols()); + HLE::Libs::Init_HLE_Libs(&linker->getHLESymbols()); auto* module = linker->LoadModule(path); // load main executable std::jthread mainthread( [](std::stop_token stop_token, void*) {