diff --git a/rpcs3/Emu/Cell/PPUModule.cpp b/rpcs3/Emu/Cell/PPUModule.cpp index 868d59009f..335f0a89e8 100644 --- a/rpcs3/Emu/Cell/PPUModule.cpp +++ b/rpcs3/Emu/Cell/PPUModule.cpp @@ -1469,7 +1469,7 @@ void ppu_load_exec(const ppu_exec_object& elf) mem_size += 0xC000000; } - fxm::make(mem_size); + g_fxo->init(mem_size); ppu->cmd_push({ppu_cmd::initialize, 0}); diff --git a/rpcs3/Emu/Cell/lv2/sys_memory.cpp b/rpcs3/Emu/Cell/lv2/sys_memory.cpp index 35f74e4733..4ba2372f2c 100644 --- a/rpcs3/Emu/Cell/lv2/sys_memory.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_memory.cpp @@ -44,7 +44,7 @@ error_code sys_memory_allocate(u32 size, u64 flags, vm::ptr alloc_addr) } // Get "default" memory container - const auto dct = fxm::get(); + const auto dct = g_fxo->get(); // Try to get "physical memory" if (!dct->take(size)) @@ -179,7 +179,7 @@ error_code sys_memory_free(u32 addr) } // Return "physical memory" to the default container - fxm::get()->used -= shm.second->size(); + g_fxo->get()->used -= shm.second->size(); return CELL_OK; } @@ -244,7 +244,7 @@ error_code sys_memory_get_user_memory_size(vm::ptr mem_info) sys_memory.warning("sys_memory_get_user_memory_size(mem_info=*0x%x)", mem_info); // Get "default" memory container - const auto dct = fxm::get(); + const auto dct = g_fxo->get(); ::reader_lock lock(s_memstats_mtx); @@ -274,7 +274,7 @@ error_code sys_memory_container_create(vm::ptr cid, u32 size) return CELL_ENOMEM; } - const auto dct = fxm::get(); + const auto dct = g_fxo->get(); std::lock_guard lock(s_memstats_mtx); @@ -325,7 +325,7 @@ error_code sys_memory_container_destroy(u32 cid) } // Return "physical memory" to the default container - fxm::get()->used -= ct->size; + g_fxo->get()->used -= ct->size; return CELL_OK; } diff --git a/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp b/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp index 6e4fb154d4..1c8b950cb9 100644 --- a/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp @@ -10,7 +10,7 @@ LOG_CHANNEL(sys_mmapper); -lv2_memory::lv2_memory(u32 size, u32 align, u64 flags, const std::shared_ptr& ct) +lv2_memory::lv2_memory(u32 size, u32 align, u64 flags, lv2_memory_container* ct) : size(size) , align(align) , flags(flags) @@ -113,7 +113,7 @@ error_code sys_mmapper_allocate_shared_memory(ppu_thread& ppu, u64 unk, u32 size } // Get "default" memory container - const auto dct = fxm::get(); + const auto dct = g_fxo->get(); if (!dct->take(size)) { @@ -184,7 +184,7 @@ error_code sys_mmapper_allocate_shared_memory_from_container(ppu_thread& ppu, u6 } // Generate a new mem ID - *mem_id = idm::make(size, flags & SYS_MEMORY_PAGE_SIZE_64K ? 0x10000 : 0x100000, flags, ct.ptr); + *mem_id = idm::make(size, flags & SYS_MEMORY_PAGE_SIZE_64K ? 0x10000 : 0x100000, flags, ct.ptr.get()); return CELL_OK; } diff --git a/rpcs3/Emu/Cell/lv2/sys_mmapper.h b/rpcs3/Emu/Cell/lv2/sys_mmapper.h index 24b46f39a6..b1c929e80d 100644 --- a/rpcs3/Emu/Cell/lv2/sys_mmapper.h +++ b/rpcs3/Emu/Cell/lv2/sys_mmapper.h @@ -15,12 +15,12 @@ struct lv2_memory : lv2_obj const u32 size; // Memory size const u32 align; // Alignment required const u64 flags; - const std::shared_ptr ct; // Associated memory container + lv2_memory_container* const ct; // Associated memory container const std::shared_ptr shm; atomic_t counter{0}; - lv2_memory(u32 size, u32 align, u64 flags, const std::shared_ptr& ct); + lv2_memory(u32 size, u32 align, u64 flags, lv2_memory_container* ct); }; enum : u64 diff --git a/rpcs3/Emu/Cell/lv2/sys_vm.cpp b/rpcs3/Emu/Cell/lv2/sys_vm.cpp index 2df52c2cc6..42ed234b02 100644 --- a/rpcs3/Emu/Cell/lv2/sys_vm.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_vm.cpp @@ -3,7 +3,7 @@ #include "Emu/Cell/PPUThread.h" #include "Emu/Memory/vm_locking.h" -sys_vm_t::sys_vm_t(u32 _addr, u32 vsize, const std::shared_ptr& ct, u32 psize) +sys_vm_t::sys_vm_t(u32 _addr, u32 vsize, lv2_memory_container* ct, u32 psize) : ct(ct) , psize(psize) , addr(_addr) @@ -38,7 +38,9 @@ error_code sys_vm_memory_map(ppu_thread& ppu, u32 vsize, u32 psize, u32 cid, u64 return CELL_EINVAL; } - auto ct = cid == SYS_MEMORY_CONTAINER_ID_INVALID ? fxm::get() : idm::get(cid); + const auto idm_ct = idm::get(cid); + + const auto ct = cid == SYS_MEMORY_CONTAINER_ID_INVALID ? g_fxo->get() : idm_ct.get(); if (!ct) { diff --git a/rpcs3/Emu/Cell/lv2/sys_vm.h b/rpcs3/Emu/Cell/lv2/sys_vm.h index 66e1fee7d7..947277f508 100644 --- a/rpcs3/Emu/Cell/lv2/sys_vm.h +++ b/rpcs3/Emu/Cell/lv2/sys_vm.h @@ -35,13 +35,13 @@ struct sys_vm_t static const u32 id_step = 0x1; static const u32 id_count = 16; - const std::shared_ptr ct; + lv2_memory_container* const ct; const u32 addr; const u32 size; u32 psize; shared_mutex mutex; - sys_vm_t(u32 addr, u32 vsize, const std::shared_ptr& ct, u32 psize); + sys_vm_t(u32 addr, u32 vsize, lv2_memory_container* ct, u32 psize); ~sys_vm_t(); static std::array, id_count> g_ids; diff --git a/rpcs3/Emu/RSX/Capture/rsx_replay.cpp b/rpcs3/Emu/RSX/Capture/rsx_replay.cpp index 9968643279..1d751d8dbc 100644 --- a/rpcs3/Emu/RSX/Capture/rsx_replay.cpp +++ b/rpcs3/Emu/RSX/Capture/rsx_replay.cpp @@ -28,7 +28,7 @@ namespace rsx // User memory + fifo size buffer_size = ::align(buffer_size, 0x100000) + 0x10000000; // We are not allowed to drain all memory so add a little - fxm::make(buffer_size + 0x1000000); + g_fxo->init(buffer_size + 0x1000000); const u32 contextAddr = vm::alloc(sizeof(rsx_context), vm::main); if (contextAddr == 0) diff --git a/rpcs3/rpcs3qt/kernel_explorer.cpp b/rpcs3/rpcs3qt/kernel_explorer.cpp index c19e7e7474..73567e88cb 100644 --- a/rpcs3/rpcs3qt/kernel_explorer.cpp +++ b/rpcs3/rpcs3qt/kernel_explorer.cpp @@ -64,7 +64,7 @@ void kernel_explorer::Update() { m_tree->clear(); - const auto dct = fxm::get(); + const auto dct = g_fxo->get(); if (!dct) {