diff --git a/rpcs3/Emu/CMakeLists.txt b/rpcs3/Emu/CMakeLists.txt
index 3b86abd091..a8b55808ab 100644
--- a/rpcs3/Emu/CMakeLists.txt
+++ b/rpcs3/Emu/CMakeLists.txt
@@ -30,6 +30,7 @@ target_sources(rpcs3_emu PRIVATE
../util/atomic.cpp
../util/atomic2.cpp
../util/shared_cptr.cpp
+ ../util/fixed_typemap.cpp
../../Utilities/bin_patch.cpp
../../Utilities/cond.cpp
../../Utilities/Config.cpp
diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj
index a43bd06a74..017cfde63b 100644
--- a/rpcs3/emucore.vcxproj
+++ b/rpcs3/emucore.vcxproj
@@ -88,6 +88,9 @@
NotUsing
+
+ NotUsing
+
NotUsing
diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters
index d9ee40b716..dd6b05fcc6 100644
--- a/rpcs3/emucore.vcxproj.filters
+++ b/rpcs3/emucore.vcxproj.filters
@@ -869,6 +869,9 @@
Utilities
+
+ Utilities
+
Crypto
diff --git a/rpcs3/util/fixed_typemap.cpp b/rpcs3/util/fixed_typemap.cpp
new file mode 100644
index 0000000000..fdb6d1f256
--- /dev/null
+++ b/rpcs3/util/fixed_typemap.cpp
@@ -0,0 +1,15 @@
+#include "fixed_typemap.hpp"
+
+#include
+
+namespace stx::detail
+{
+ void destroy_info::sort_by_reverse_creation_order(destroy_info* begin, destroy_info* end)
+ {
+ std::sort(begin, end, [](const destroy_info& a, const destroy_info& b)
+ {
+ // Destroy order is the inverse of creation order
+ return a.created > b.created;
+ });
+ }
+}
diff --git a/rpcs3/util/fixed_typemap.hpp b/rpcs3/util/fixed_typemap.hpp
index 2e28b4f15d..a7749ea334 100644
--- a/rpcs3/util/fixed_typemap.hpp
+++ b/rpcs3/util/fixed_typemap.hpp
@@ -1,13 +1,27 @@
#pragma once
#include
+#include
#include
#include
-#include
#include
namespace stx
{
+ namespace detail
+ {
+ // Destroy list element
+ struct destroy_info
+ {
+ void** object_pointer;
+ unsigned long long created;
+ void(*destroy)(void*& ptr) noexcept;
+ const char* name;
+
+ static void sort_by_reverse_creation_order(destroy_info* begin, destroy_info* end);
+ };
+ }
+
// Typemap with exactly one object of each used type, created on init() and destroyed on clear()
template
class manual_fixed_typemap
@@ -111,14 +125,7 @@ namespace stx
return;
}
- // Destroy list element
- struct destroy_info
- {
- void** object_pointer;
- unsigned long long created;
- void(*destroy)(void*& ptr) noexcept;
- const char* name;
- };
+ using detail::destroy_info;
auto all_data = std::make_unique(stx::typelist().count());
@@ -145,11 +152,7 @@ namespace stx
}
// Sort destroy list according to absolute creation order
- std::sort(all_data.get(), all_data.get() + _max, [](const destroy_info& a, const destroy_info& b)
- {
- // Destroy order is the inverse of creation order
- return a.created > b.created;
- });
+ destroy_info::sort_by_reverse_creation_order(all_data.get(), all_data.get() + _max);
// Destroy objects in correct order
for (unsigned i = 0; i < _max; i++)