From 5dd7792c3dfff7ad94cdd2e0f31244ba2cc2117e Mon Sep 17 00:00:00 2001 From: Elad <18193363+elad335@users.noreply.github.com> Date: Sun, 3 May 2026 05:26:25 +0300 Subject: [PATCH] Remove vm_ref.h --- rpcs3/Emu/Cell/Modules/cellL10n.cpp | 1 - rpcs3/Emu/Cell/PPUThread.h | 14 -- rpcs3/Emu/Memory/vm.cpp | 1 - rpcs3/Emu/Memory/vm.h | 3 - rpcs3/Emu/Memory/vm_ptr.h | 23 ---- rpcs3/Emu/Memory/vm_ref.h | 200 ---------------------------- rpcs3/emucore.vcxproj | 1 - rpcs3/emucore.vcxproj.filters | 3 - 8 files changed, 246 deletions(-) delete mode 100644 rpcs3/Emu/Memory/vm_ref.h diff --git a/rpcs3/Emu/Cell/Modules/cellL10n.cpp b/rpcs3/Emu/Cell/Modules/cellL10n.cpp index 0f47c682e6..60fe8f3583 100644 --- a/rpcs3/Emu/Cell/Modules/cellL10n.cpp +++ b/rpcs3/Emu/Cell/Modules/cellL10n.cpp @@ -1,6 +1,5 @@ #include "stdafx.h" #include "Emu/Cell/PPUModule.h" -#include "Emu/Memory/vm_ref.h" #ifdef _WIN32 #include diff --git a/rpcs3/Emu/Cell/PPUThread.h b/rpcs3/Emu/Cell/PPUThread.h index cf5b91c487..9a135c00c7 100644 --- a/rpcs3/Emu/Cell/PPUThread.h +++ b/rpcs3/Emu/Cell/PPUThread.h @@ -436,20 +436,6 @@ struct ppu_gpr_cast_impl> } }; -template -struct ppu_gpr_cast_impl> -{ - static inline u64 to(const vm::_ref_base& value) - { - return ppu_gpr_cast_impl::to(value.addr()); - } - - static inline vm::_ref_base from(const u64 reg) - { - return vm::cast(ppu_gpr_cast_impl::from(reg)); - } -}; - template <> struct ppu_gpr_cast_impl { diff --git a/rpcs3/Emu/Memory/vm.cpp b/rpcs3/Emu/Memory/vm.cpp index 112b1f8354..266da6a1df 100644 --- a/rpcs3/Emu/Memory/vm.cpp +++ b/rpcs3/Emu/Memory/vm.cpp @@ -1,7 +1,6 @@ #include "stdafx.h" #include "vm_locking.h" #include "vm_ptr.h" -#include "vm_ref.h" #include "vm_reservation.h" #include "Utilities/Thread.h" diff --git a/rpcs3/Emu/Memory/vm.h b/rpcs3/Emu/Memory/vm.h index 09d2d15421..87e798aadb 100644 --- a/rpcs3/Emu/Memory/vm.h +++ b/rpcs3/Emu/Memory/vm.h @@ -377,7 +377,4 @@ namespace vm template class _ptr_base; - - template - class _ref_base; } diff --git a/rpcs3/Emu/Memory/vm_ptr.h b/rpcs3/Emu/Memory/vm_ptr.h index 5081e0701d..4e87a9a6f7 100644 --- a/rpcs3/Emu/Memory/vm_ptr.h +++ b/rpcs3/Emu/Memory/vm_ptr.h @@ -10,9 +10,6 @@ struct ppu_func_opd_t; namespace vm { - template - class _ref_base; - // Enables comparison between comparable types of pointers template concept PtrComparable = requires (T1* t1, T2* t2) { t1 == t2; }; @@ -81,26 +78,6 @@ namespace vm return vm::cast(vm::cast(m_addr) + offset32(mptr) + u32{sizeof(ET)} * index); } - // Get vm reference to a struct member - template requires PtrComparable && (!std::is_void_v) - _ref_base ref(MT T2::*const mptr) const - { - return vm::cast(vm::cast(m_addr) + offset32(mptr)); - } - - // Get vm reference to a struct member with array subscription - template > requires PtrComparable && (!std::is_void_v) - _ref_base ref(MT T2::*const mptr, u32 index) const - { - return vm::cast(vm::cast(m_addr) + offset32(mptr) + u32{sizeof(ET)} * index); - } - - // Get vm reference - _ref_base ref() const requires (!std::is_void_v) - { - return vm::cast(m_addr); - } - template T* get_ptr() const { diff --git a/rpcs3/Emu/Memory/vm_ref.h b/rpcs3/Emu/Memory/vm_ref.h deleted file mode 100644 index 59e6daa8f0..0000000000 --- a/rpcs3/Emu/Memory/vm_ref.h +++ /dev/null @@ -1,200 +0,0 @@ -#pragma once - -#include -#include "vm.h" - -#include "util/to_endian.hpp" - -#ifndef _MSC_VER -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Weffc++" -#endif - -namespace vm -{ - template - class _ptr_base; - - template - class _ref_base - { - AT m_addr; - - static_assert(!std::is_pointer_v, "vm::_ref_base<> error: invalid type (pointer)"); - static_assert(!std::is_reference_v, "vm::_ref_base<> error: invalid type (reference)"); - static_assert(!std::is_function_v, "vm::_ref_base<> error: invalid type (function)"); - static_assert(!std::is_void_v, "vm::_ref_base<> error: invalid type (void)"); - - public: - using type = T; - using addr_type = std::remove_cv_t; - - _ref_base(const _ref_base&) = default; - - _ref_base(vm::addr_t addr) - : m_addr(addr) - { - } - - addr_type addr() const - { - return m_addr; - } - - T& get_ref() const - { - return *static_cast(vm::base(vm::cast(m_addr))); - } - - // convert to vm pointer - vm::_ptr_base ptr() const - { - return vm::cast(m_addr); - } - - operator std::common_type_t() const - { - return get_ref(); - } - - operator T&() const - { - return get_ref(); - } - - T& operator =(const _ref_base& right) - { - return get_ref() = right.get_ref(); - } - - T& operator =(const std::common_type_t& right) const - { - return get_ref() = right; - } - - decltype(auto) operator ++(int) const - { - return get_ref()++; - } - - decltype(auto) operator ++() const - { - return ++get_ref(); - } - - decltype(auto) operator --(int) const - { - return get_ref()--; - } - - decltype(auto) operator --() const - { - return --get_ref(); - } - - template - decltype(auto) operator +=(const T2& right) - { - return get_ref() += right; - } - - template - decltype(auto) operator -=(const T2& right) - { - return get_ref() -= right; - } - - template - decltype(auto) operator *=(const T2& right) - { - return get_ref() *= right; - } - - template - decltype(auto) operator /=(const T2& right) - { - return get_ref() /= right; - } - - template - decltype(auto) operator %=(const T2& right) - { - return get_ref() %= right; - } - - template - decltype(auto) operator &=(const T2& right) - { - return get_ref() &= right; - } - - template - decltype(auto) operator |=(const T2& right) - { - return get_ref() |= right; - } - - template - decltype(auto) operator ^=(const T2& right) - { - return get_ref() ^= right; - } - - template - decltype(auto) operator <<=(const T2& right) - { - return get_ref() <<= right; - } - - template - decltype(auto) operator >>=(const T2& right) - { - return get_ref() >>= right; - } - }; - - // Native endianness reference to LE data - template using refl = _ref_base, AT>; - - // Native endianness reference to BE data - template using refb = _ref_base, AT>; - - // BE reference to LE data - template using brefl = _ref_base, to_be_t>; - - // BE reference to BE data - template using brefb = _ref_base, to_be_t>; - - // LE reference to LE data - template using lrefl = _ref_base, to_le_t>; - - // LE reference to BE data - template using lrefb = _ref_base, to_le_t>; - - inline namespace ps3_ - { - // default reference for PS3 HLE functions (Native endianness reference to BE data) - template using ref = refb; - - // default reference for PS3 HLE structures (BE reference to BE data) - template using bref = brefb; - } -} - -#ifndef _MSC_VER -#pragma GCC diagnostic pop -#endif - -// Change AT endianness to BE/LE -template -struct to_se, Se> -{ - using type = vm::_ref_base::type>; -}; - -// Forbid formatting -template -struct fmt_unveil> -{ - static_assert(!sizeof(T), "vm::_ref_base<>: ambiguous format argument"); -}; diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index 3606a20918..d08cac380e 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -1048,7 +1048,6 @@ - diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index 87bf4fed67..c6b10021cd 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -1578,9 +1578,6 @@ Emu\Memory - - Emu\Memory - Emu\Memory