From 3b475158905f6e6049fe4855c1e48bc21a3b0c7c Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Tue, 15 Feb 2022 22:08:56 +0100 Subject: [PATCH] early-access version 2493 --- README.md | 2 +- src/audio_core/common.h | 4 +++- src/common/fs/fs_util.cpp | 8 ++++++++ src/common/fs/fs_util.h | 18 ++++++++++++++++++ src/core/file_sys/patch_manager.cpp | 18 +++++++++--------- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 48d63a353..fbb079b96 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 2491. +This is the source code for early-access 2493. ## Legal Notice diff --git a/src/audio_core/common.h b/src/audio_core/common.h index 1ab537588..e6b95769f 100755 --- a/src/audio_core/common.h +++ b/src/audio_core/common.h @@ -15,7 +15,9 @@ constexpr ResultCode ERR_INVALID_PARAMETERS{ErrorModule::Audio, 41}; constexpr ResultCode ERR_SPLITTER_SORT_FAILED{ErrorModule::Audio, 43}; } // namespace Audren -constexpr u32_le CURRENT_PROCESS_REVISION = Common::MakeMagic('R', 'E', 'V', '9'); +constexpr u8 BASE_REVISION = '0'; +constexpr u32_le CURRENT_PROCESS_REVISION = + Common::MakeMagic('R', 'E', 'V', static_cast(BASE_REVISION + 0xA)); constexpr std::size_t MAX_MIX_BUFFERS = 24; constexpr std::size_t MAX_BIQUAD_FILTERS = 2; constexpr std::size_t MAX_CHANNEL_COUNT = 6; diff --git a/src/common/fs/fs_util.cpp b/src/common/fs/fs_util.cpp index 9f8671982..0068112e6 100755 --- a/src/common/fs/fs_util.cpp +++ b/src/common/fs/fs_util.cpp @@ -16,6 +16,10 @@ std::u8string BufferToU8String(std::span buffer) { return std::u8string{buffer.begin(), std::ranges::find(buffer, u8{0})}; } +std::u8string_view BufferToU8StringView(std::span buffer) { + return std::u8string_view{reinterpret_cast(buffer.data())}; +} + std::string ToUTF8String(std::u8string_view u8_string) { return std::string{u8_string.begin(), u8_string.end()}; } @@ -24,6 +28,10 @@ std::string BufferToUTF8String(std::span buffer) { return std::string{buffer.begin(), std::ranges::find(buffer, u8{0})}; } +std::string_view BufferToUTF8StringView(std::span buffer) { + return std::string_view{reinterpret_cast(buffer.data())}; +} + std::string PathToUTF8String(const std::filesystem::path& path) { return ToUTF8String(path.u8string()); } diff --git a/src/common/fs/fs_util.h b/src/common/fs/fs_util.h index 1ec82eb35..1620d38c9 100755 --- a/src/common/fs/fs_util.h +++ b/src/common/fs/fs_util.h @@ -37,6 +37,15 @@ concept IsChar = std::same_as; */ [[nodiscard]] std::u8string BufferToU8String(std::span buffer); +/** + * Same as BufferToU8String, but returns a string view of the buffer. + * + * @param buffer Buffer of bytes + * + * @returns UTF-8 encoded std::u8string_view. + */ +[[nodiscard]] std::u8string_view BufferToU8StringView(std::span buffer); + /** * Converts a std::u8string or std::u8string_view to a UTF-8 encoded std::string. * @@ -57,6 +66,15 @@ concept IsChar = std::same_as; */ [[nodiscard]] std::string BufferToUTF8String(std::span buffer); +/** + * Same as BufferToUTF8String, but returns a string view of the buffer. + * + * @param buffer Buffer of bytes + * + * @returns UTF-8 encoded std::string_view. + */ +[[nodiscard]] std::string_view BufferToUTF8StringView(std::span buffer); + /** * Converts a filesystem path to a UTF-8 encoded std::string. * diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp index 7c0950bb0..f19ac4607 100755 --- a/src/core/file_sys/patch_manager.cpp +++ b/src/core/file_sys/patch_manager.cpp @@ -128,15 +128,6 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const { if (exefs == nullptr) return exefs; - if (Settings::values.dump_exefs) { - LOG_INFO(Loader, "Dumping ExeFS for title_id={:016X}", title_id); - const auto dump_dir = fs_controller.GetModificationDumpRoot(title_id); - if (dump_dir != nullptr) { - const auto exefs_dir = GetOrCreateDirectoryRelative(dump_dir, "/exefs"); - VfsRawCopyD(exefs, exefs_dir); - } - } - const auto& disabled = Settings::values.disabled_addons[title_id]; const auto update_disabled = std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend(); @@ -179,6 +170,15 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const { } } + if (Settings::values.dump_exefs) { + LOG_INFO(Loader, "Dumping ExeFS for title_id={:016X}", title_id); + const auto dump_dir = fs_controller.GetModificationDumpRoot(title_id); + if (dump_dir != nullptr) { + const auto exefs_dir = GetOrCreateDirectoryRelative(dump_dir, "/exefs"); + VfsRawCopyD(exefs, exefs_dir); + } + } + return exefs; }