diff --git a/rpcs3/Emu/VFS.cpp b/rpcs3/Emu/VFS.cpp index 9408285aab..cbc665eb07 100644 --- a/rpcs3/Emu/VFS.cpp +++ b/rpcs3/Emu/VFS.cpp @@ -29,11 +29,8 @@ struct vfs_manager bool vfs::mount(std::string_view vpath, std::string_view path) { - if (!g_fxo->get()) - { - // Init (TODO) - g_fxo->init(); - } + // Workaround + g_fxo->need(); const auto table = g_fxo->get(); diff --git a/rpcs3/util/fixed_typemap.hpp b/rpcs3/util/fixed_typemap.hpp index 197d22eeb4..8aa3274e98 100644 --- a/rpcs3/util/fixed_typemap.hpp +++ b/rpcs3/util/fixed_typemap.hpp @@ -148,6 +148,16 @@ namespace stx } } + // Check if object is not initialized but shall be initialized first (to use in initializing other objects) + template + void need() noexcept + { + if (!get()) + { + init(); + } + } + // Explicitly (re)initialize object of type T possibly with dynamic type As and arguments template As* init(Args&&... args) noexcept