From 43184a271fae68fd1dbb2245a0f5513117e4f194 Mon Sep 17 00:00:00 2001 From: brian218 Date: Mon, 1 May 2023 21:07:24 +0800 Subject: [PATCH] sys_fs: Improved lv2_fs_object constructor --- rpcs3/Emu/Cell/lv2/sys_fs.cpp | 1 - rpcs3/Emu/Cell/lv2/sys_fs.h | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.cpp b/rpcs3/Emu/Cell/lv2/sys_fs.cpp index 9dd49721f2..0d9dcb0db2 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_fs.cpp @@ -307,7 +307,6 @@ bool lv2_fs_object::vfs_unmount(std::string_view vpath) lv2_fs_object::lv2_fs_object(utils::serial& ar, bool) : name(ar) - , mp(get_mp(name.data())) { } diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.h b/rpcs3/Emu/Cell/lv2/sys_fs.h index 8daa35aaff..9fceb4cde8 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.h +++ b/rpcs3/Emu/Cell/lv2/sys_fs.h @@ -173,12 +173,11 @@ struct lv2_fs_object const std::array name; // Mount Point - const std::add_pointer_t mp; + lv2_fs_mount_point* const mp = get_mp(name.data()); protected: - lv2_fs_object(lv2_fs_mount_point* mp, std::string_view filename) + lv2_fs_object(std::string_view filename) : name(get_name(filename)) - , mp(mp) { } @@ -235,7 +234,7 @@ struct lv2_file final : lv2_fs_object } restore_data{}; lv2_file(std::string_view filename, fs::file&& file, s32 mode, s32 flags, const std::string& real_path, lv2_file_type type = {}) - : lv2_fs_object(lv2_fs_object::get_mp(filename), filename) + : lv2_fs_object(filename) , file(std::move(file)) , mode(mode) , flags(flags) @@ -245,7 +244,7 @@ struct lv2_file final : lv2_fs_object } lv2_file(const lv2_file& host, fs::file&& file, s32 mode, s32 flags, const std::string& real_path, lv2_file_type type = {}) - : lv2_fs_object(host.mp, host.name.data()) + : lv2_fs_object(host.name.data()) , file(std::move(file)) , mode(mode) , flags(flags) @@ -309,7 +308,7 @@ struct lv2_dir final : lv2_fs_object atomic_t pos{0}; lv2_dir(std::string_view filename, std::vector&& entries) - : lv2_fs_object(lv2_fs_object::get_mp(filename), filename) + : lv2_fs_object(filename) , entries(std::move(entries)) { }