summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio_core/common.h4
-rw-r--r--src/common/fs/fs_util.cpp8
-rw-r--r--src/common/fs/fs_util.h18
-rw-r--r--src/common/logging/filter.cpp1
-rw-r--r--src/common/logging/types.h1
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/file_sys/patch_manager.cpp18
-rw-r--r--src/core/hle/service/mnpp/mnpp_app.cpp45
-rw-r--r--src/core/hle/service/mnpp/mnpp_app.h20
-rw-r--r--src/core/hle/service/service.cpp2
10 files changed, 109 insertions, 10 deletions
diff --git a/src/audio_core/common.h b/src/audio_core/common.h
index 1ab537588..e6b95769f 100644
--- a/src/audio_core/common.h
+++ b/src/audio_core/common.h
@@ -15,7 +15,9 @@ constexpr ResultCode ERR_INVALID_PARAMETERS{ErrorModule::Audio, 41};
15constexpr ResultCode ERR_SPLITTER_SORT_FAILED{ErrorModule::Audio, 43}; 15constexpr ResultCode ERR_SPLITTER_SORT_FAILED{ErrorModule::Audio, 43};
16} // namespace Audren 16} // namespace Audren
17 17
18constexpr u32_le CURRENT_PROCESS_REVISION = Common::MakeMagic('R', 'E', 'V', '9'); 18constexpr u8 BASE_REVISION = '0';
19constexpr u32_le CURRENT_PROCESS_REVISION =
20 Common::MakeMagic('R', 'E', 'V', static_cast<u8>(BASE_REVISION + 0xA));
19constexpr std::size_t MAX_MIX_BUFFERS = 24; 21constexpr std::size_t MAX_MIX_BUFFERS = 24;
20constexpr std::size_t MAX_BIQUAD_FILTERS = 2; 22constexpr std::size_t MAX_BIQUAD_FILTERS = 2;
21constexpr std::size_t MAX_CHANNEL_COUNT = 6; 23constexpr 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 100644
--- a/src/common/fs/fs_util.cpp
+++ b/src/common/fs/fs_util.cpp
@@ -16,6 +16,10 @@ std::u8string BufferToU8String(std::span<const u8> buffer) {
16 return std::u8string{buffer.begin(), std::ranges::find(buffer, u8{0})}; 16 return std::u8string{buffer.begin(), std::ranges::find(buffer, u8{0})};
17} 17}
18 18
19std::u8string_view BufferToU8StringView(std::span<const u8> buffer) {
20 return std::u8string_view{reinterpret_cast<const char8_t*>(buffer.data())};
21}
22
19std::string ToUTF8String(std::u8string_view u8_string) { 23std::string ToUTF8String(std::u8string_view u8_string) {
20 return std::string{u8_string.begin(), u8_string.end()}; 24 return std::string{u8_string.begin(), u8_string.end()};
21} 25}
@@ -24,6 +28,10 @@ std::string BufferToUTF8String(std::span<const u8> buffer) {
24 return std::string{buffer.begin(), std::ranges::find(buffer, u8{0})}; 28 return std::string{buffer.begin(), std::ranges::find(buffer, u8{0})};
25} 29}
26 30
31std::string_view BufferToUTF8StringView(std::span<const u8> buffer) {
32 return std::string_view{reinterpret_cast<const char*>(buffer.data())};
33}
34
27std::string PathToUTF8String(const std::filesystem::path& path) { 35std::string PathToUTF8String(const std::filesystem::path& path) {
28 return ToUTF8String(path.u8string()); 36 return ToUTF8String(path.u8string());
29} 37}
diff --git a/src/common/fs/fs_util.h b/src/common/fs/fs_util.h
index 1ec82eb35..1620d38c9 100644
--- a/src/common/fs/fs_util.h
+++ b/src/common/fs/fs_util.h
@@ -38,6 +38,15 @@ concept IsChar = std::same_as<T, char>;
38[[nodiscard]] std::u8string BufferToU8String(std::span<const u8> buffer); 38[[nodiscard]] std::u8string BufferToU8String(std::span<const u8> buffer);
39 39
40/** 40/**
41 * Same as BufferToU8String, but returns a string view of the buffer.
42 *
43 * @param buffer Buffer of bytes
44 *
45 * @returns UTF-8 encoded std::u8string_view.
46 */
47[[nodiscard]] std::u8string_view BufferToU8StringView(std::span<const u8> buffer);
48
49/**
41 * Converts a std::u8string or std::u8string_view to a UTF-8 encoded std::string. 50 * Converts a std::u8string or std::u8string_view to a UTF-8 encoded std::string.
42 * 51 *
43 * @param u8_string UTF-8 encoded u8string 52 * @param u8_string UTF-8 encoded u8string
@@ -58,6 +67,15 @@ concept IsChar = std::same_as<T, char>;
58[[nodiscard]] std::string BufferToUTF8String(std::span<const u8> buffer); 67[[nodiscard]] std::string BufferToUTF8String(std::span<const u8> buffer);
59 68
60/** 69/**
70 * Same as BufferToUTF8String, but returns a string view of the buffer.
71 *
72 * @param buffer Buffer of bytes
73 *
74 * @returns UTF-8 encoded std::string_view.
75 */
76[[nodiscard]] std::string_view BufferToUTF8StringView(std::span<const u8> buffer);
77
78/**
61 * Converts a filesystem path to a UTF-8 encoded std::string. 79 * Converts a filesystem path to a UTF-8 encoded std::string.
62 * 80 *
63 * @param path Filesystem path 81 * @param path Filesystem path
diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp
index b898a652c..4afc1369a 100644
--- a/src/common/logging/filter.cpp
+++ b/src/common/logging/filter.cpp
@@ -108,6 +108,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
108 SUB(Service, Migration) \ 108 SUB(Service, Migration) \
109 SUB(Service, Mii) \ 109 SUB(Service, Mii) \
110 SUB(Service, MM) \ 110 SUB(Service, MM) \
111 SUB(Service, MNPP) \
111 SUB(Service, NCM) \ 112 SUB(Service, NCM) \
112 SUB(Service, NFC) \ 113 SUB(Service, NFC) \
113 SUB(Service, NFP) \ 114 SUB(Service, NFP) \
diff --git a/src/common/logging/types.h b/src/common/logging/types.h
index 9ed0c7ad6..2b6e4daa7 100644
--- a/src/common/logging/types.h
+++ b/src/common/logging/types.h
@@ -76,6 +76,7 @@ enum class Class : u8 {
76 Service_Migration, ///< The migration service 76 Service_Migration, ///< The migration service
77 Service_Mii, ///< The Mii service 77 Service_Mii, ///< The Mii service
78 Service_MM, ///< The MM (Multimedia) service 78 Service_MM, ///< The MM (Multimedia) service
79 Service_MNPP, ///< The MNPP service
79 Service_NCM, ///< The NCM service 80 Service_NCM, ///< The NCM service
80 Service_NFC, ///< The NFC (Near-field communication) service 81 Service_NFC, ///< The NFC (Near-field communication) service
81 Service_NFP, ///< The NFP service 82 Service_NFP, ///< The NFP service
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 6e8d11919..0c10cd019 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -467,6 +467,8 @@ add_library(core STATIC
467 hle/service/mii/types.h 467 hle/service/mii/types.h
468 hle/service/mm/mm_u.cpp 468 hle/service/mm/mm_u.cpp
469 hle/service/mm/mm_u.h 469 hle/service/mm/mm_u.h
470 hle/service/mnpp/mnpp_app.cpp
471 hle/service/mnpp/mnpp_app.h
470 hle/service/ncm/ncm.cpp 472 hle/service/ncm/ncm.cpp
471 hle/service/ncm/ncm.h 473 hle/service/ncm/ncm.h
472 hle/service/nfc/nfc.cpp 474 hle/service/nfc/nfc.cpp
diff --git a/src/core/file_sys/patch_manager.cpp b/src/core/file_sys/patch_manager.cpp
index 7c0950bb0..f19ac4607 100644
--- 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 {
128 if (exefs == nullptr) 128 if (exefs == nullptr)
129 return exefs; 129 return exefs;
130 130
131 if (Settings::values.dump_exefs) {
132 LOG_INFO(Loader, "Dumping ExeFS for title_id={:016X}", title_id);
133 const auto dump_dir = fs_controller.GetModificationDumpRoot(title_id);
134 if (dump_dir != nullptr) {
135 const auto exefs_dir = GetOrCreateDirectoryRelative(dump_dir, "/exefs");
136 VfsRawCopyD(exefs, exefs_dir);
137 }
138 }
139
140 const auto& disabled = Settings::values.disabled_addons[title_id]; 131 const auto& disabled = Settings::values.disabled_addons[title_id];
141 const auto update_disabled = 132 const auto update_disabled =
142 std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend(); 133 std::find(disabled.cbegin(), disabled.cend(), "Update") != disabled.cend();
@@ -179,6 +170,15 @@ VirtualDir PatchManager::PatchExeFS(VirtualDir exefs) const {
179 } 170 }
180 } 171 }
181 172
173 if (Settings::values.dump_exefs) {
174 LOG_INFO(Loader, "Dumping ExeFS for title_id={:016X}", title_id);
175 const auto dump_dir = fs_controller.GetModificationDumpRoot(title_id);
176 if (dump_dir != nullptr) {
177 const auto exefs_dir = GetOrCreateDirectoryRelative(dump_dir, "/exefs");
178 VfsRawCopyD(exefs, exefs_dir);
179 }
180 }
181
182 return exefs; 182 return exefs;
183} 183}
184 184
diff --git a/src/core/hle/service/mnpp/mnpp_app.cpp b/src/core/hle/service/mnpp/mnpp_app.cpp
new file mode 100644
index 000000000..53497612f
--- /dev/null
+++ b/src/core/hle/service/mnpp/mnpp_app.cpp
@@ -0,0 +1,45 @@
1// Copyright 2022 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "common/logging/log.h"
6#include "core/hle/ipc_helpers.h"
7#include "core/hle/service/mnpp/mnpp_app.h"
8#include "core/hle/service/sm/sm.h"
9
10namespace Service::MNPP {
11
12class MNPP_APP final : public ServiceFramework<MNPP_APP> {
13public:
14 explicit MNPP_APP(Core::System& system_) : ServiceFramework{system_, "mnpp:app"} {
15 // clang-format off
16 static const FunctionInfo functions[] = {
17 {0, &MNPP_APP::Unknown0, "unknown0"},
18 {1, &MNPP_APP::Unknown1, "unknown1"},
19 };
20 // clang-format on
21
22 RegisterHandlers(functions);
23 }
24
25private:
26 void Unknown0(Kernel::HLERequestContext& ctx) {
27 LOG_WARNING(Service_MNPP, "(STUBBED) called");
28
29 IPC::ResponseBuilder rb{ctx, 2};
30 rb.Push(ResultSuccess);
31 }
32
33 void Unknown1(Kernel::HLERequestContext& ctx) {
34 LOG_WARNING(Service_MNPP, "(STUBBED) called");
35
36 IPC::ResponseBuilder rb{ctx, 2};
37 rb.Push(ResultSuccess);
38 }
39};
40
41void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
42 std::make_shared<MNPP_APP>(system)->InstallAsService(service_manager);
43}
44
45} // namespace Service::MNPP
diff --git a/src/core/hle/service/mnpp/mnpp_app.h b/src/core/hle/service/mnpp/mnpp_app.h
new file mode 100644
index 000000000..6bf20b494
--- /dev/null
+++ b/src/core/hle/service/mnpp/mnpp_app.h
@@ -0,0 +1,20 @@
1// Copyright 2022 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7namespace Core {
8class System;
9}
10
11namespace Service::SM {
12class ServiceManager;
13}
14
15namespace Service::MNPP {
16
17/// Registers all MNPP services with the specified service manager.
18void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system);
19
20} // namespace Service::MNPP
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index f54e6fe56..eb1138313 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -39,6 +39,7 @@
39#include "core/hle/service/mig/mig.h" 39#include "core/hle/service/mig/mig.h"
40#include "core/hle/service/mii/mii.h" 40#include "core/hle/service/mii/mii.h"
41#include "core/hle/service/mm/mm_u.h" 41#include "core/hle/service/mm/mm_u.h"
42#include "core/hle/service/mnpp/mnpp_app.h"
42#include "core/hle/service/ncm/ncm.h" 43#include "core/hle/service/ncm/ncm.h"
43#include "core/hle/service/nfc/nfc.h" 44#include "core/hle/service/nfc/nfc.h"
44#include "core/hle/service/nfp/nfp.h" 45#include "core/hle/service/nfp/nfp.h"
@@ -265,6 +266,7 @@ Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system
265 Migration::InstallInterfaces(*sm, system); 266 Migration::InstallInterfaces(*sm, system);
266 Mii::InstallInterfaces(*sm, system); 267 Mii::InstallInterfaces(*sm, system);
267 MM::InstallInterfaces(*sm, system); 268 MM::InstallInterfaces(*sm, system);
269 MNPP::InstallInterfaces(*sm, system);
268 NCM::InstallInterfaces(*sm, system); 270 NCM::InstallInterfaces(*sm, system);
269 NFC::InstallInterfaces(*sm, system); 271 NFC::InstallInterfaces(*sm, system);
270 NFP::InstallInterfaces(*sm, system); 272 NFP::InstallInterfaces(*sm, system);