summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/acc/acc_su.h6
-rw-r--r--src/core/hle/service/acc/profile_manager.cpp21
-rw-r--r--src/core/hle/service/acc/profile_manager.h22
-rw-r--r--src/core/hle/service/am/am.cpp2
-rw-r--r--src/core/hle/service/audio/audio.cpp1
-rw-r--r--src/core/hle/service/audio/audio.h4
-rw-r--r--src/core/hle/service/audio/audout_u.cpp17
-rw-r--r--src/core/hle/service/audio/audout_u.h17
-rw-r--r--src/core/hle/service/audio/audren_u.cpp6
-rw-r--r--src/core/hle/service/audio/audren_u.h1
-rw-r--r--src/core/hle/service/audio/hwopus.cpp11
-rw-r--r--src/core/hle/service/hid/hid.cpp2
-rw-r--r--src/core/hle/service/lm/lm.cpp2
-rw-r--r--src/core/hle/service/ns/pl_u.cpp156
-rw-r--r--src/core/hle/service/ns/pl_u.h8
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp2
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.cpp6
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.h6
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp2
-rw-r--r--src/core/hle/service/prepo/prepo.cpp63
-rw-r--r--src/core/hle/service/prepo/prepo.h16
-rw-r--r--src/core/hle/service/service.cpp6
-rw-r--r--src/core/hle/service/service.h6
-rw-r--r--src/core/hle/service/set/set.cpp10
-rw-r--r--src/core/hle/service/set/set.h2
-rw-r--r--src/core/hle/service/sm/sm.cpp8
-rw-r--r--src/core/hle/service/sm/sm.h6
-rw-r--r--src/core/hle/service/spl/module.cpp2
-rw-r--r--src/core/hle/service/vi/vi.cpp19
-rw-r--r--src/core/hle/service/vi/vi.h5
30 files changed, 237 insertions, 198 deletions
diff --git a/src/core/hle/service/acc/acc_su.h b/src/core/hle/service/acc/acc_su.h
index a3eb885bf..fcced063a 100644
--- a/src/core/hle/service/acc/acc_su.h
+++ b/src/core/hle/service/acc/acc_su.h
@@ -6,8 +6,7 @@
#include "core/hle/service/acc/acc.h"
-namespace Service {
-namespace Account {
+namespace Service::Account {
class ACC_SU final : public Module::Interface {
public:
@@ -16,5 +15,4 @@ public:
~ACC_SU() override;
};
-} // namespace Account
-} // namespace Service
+} // namespace Service::Account
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp
index 4ccebef23..0071ca613 100644
--- a/src/core/hle/service/acc/profile_manager.cpp
+++ b/src/core/hle/service/acc/profile_manager.cpp
@@ -33,7 +33,7 @@ ProfileManager::~ProfileManager() = default;
/// After a users creation it needs to be "registered" to the system. AddToProfiles handles the
/// internal management of the users profiles
-boost::optional<size_t> ProfileManager::AddToProfiles(const ProfileInfo& user) {
+boost::optional<std::size_t> ProfileManager::AddToProfiles(const ProfileInfo& user) {
if (user_count >= MAX_USERS) {
return boost::none;
}
@@ -42,7 +42,7 @@ boost::optional<size_t> ProfileManager::AddToProfiles(const ProfileInfo& user) {
}
/// Deletes a specific profile based on it's profile index
-bool ProfileManager::RemoveProfileAtIndex(size_t index) {
+bool ProfileManager::RemoveProfileAtIndex(std::size_t index) {
if (index >= MAX_USERS || index >= user_count) {
return false;
}
@@ -101,7 +101,7 @@ ResultCode ProfileManager::CreateNewUser(UUID uuid, const std::string& username)
}
/// Returns a users profile index based on their user id.
-boost::optional<size_t> ProfileManager::GetUserIndex(const UUID& uuid) const {
+boost::optional<std::size_t> ProfileManager::GetUserIndex(const UUID& uuid) const {
if (!uuid) {
return boost::none;
}
@@ -110,16 +110,17 @@ boost::optional<size_t> ProfileManager::GetUserIndex(const UUID& uuid) const {
if (iter == profiles.end()) {
return boost::none;
}
- return static_cast<size_t>(std::distance(profiles.begin(), iter));
+ return static_cast<std::size_t>(std::distance(profiles.begin(), iter));
}
/// Returns a users profile index based on their profile
-boost::optional<size_t> ProfileManager::GetUserIndex(const ProfileInfo& user) const {
+boost::optional<std::size_t> ProfileManager::GetUserIndex(const ProfileInfo& user) const {
return GetUserIndex(user.user_uuid);
}
/// Returns the data structure used by the switch when GetProfileBase is called on acc:*
-bool ProfileManager::GetProfileBase(boost::optional<size_t> index, ProfileBase& profile) const {
+bool ProfileManager::GetProfileBase(boost::optional<std::size_t> index,
+ ProfileBase& profile) const {
if (index == boost::none || index >= MAX_USERS) {
return false;
}
@@ -143,14 +144,16 @@ bool ProfileManager::GetProfileBase(const ProfileInfo& user, ProfileBase& profil
/// Returns the current user count on the system. We keep a variable which tracks the count so we
/// don't have to loop the internal profile array every call.
-size_t ProfileManager::GetUserCount() const {
+
+std::size_t ProfileManager::GetUserCount() const {
return user_count;
}
/// Lists the current "opened" users on the system. Users are typically not open until they sign
/// into something or pick a profile. As of right now users should all be open until qlaunch is
/// booting
-size_t ProfileManager::GetOpenUserCount() const {
+
+std::size_t ProfileManager::GetOpenUserCount() const {
return std::count_if(profiles.begin(), profiles.end(),
[](const ProfileInfo& p) { return p.is_open; });
}
@@ -206,7 +209,7 @@ UUID ProfileManager::GetLastOpenedUser() const {
}
/// Return the users profile base and the unknown arbitary data.
-bool ProfileManager::GetProfileBaseAndData(boost::optional<size_t> index, ProfileBase& profile,
+bool ProfileManager::GetProfileBaseAndData(boost::optional<std::size_t> index, ProfileBase& profile,
ProfileData& data) const {
if (GetProfileBase(index, profile)) {
data = profiles[index.get()].data;
diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h
index cd8df93a5..bffd4cf4d 100644
--- a/src/core/hle/service/acc/profile_manager.h
+++ b/src/core/hle/service/acc/profile_manager.h
@@ -12,8 +12,8 @@
#include "core/hle/result.h"
namespace Service::Account {
-constexpr size_t MAX_USERS = 8;
-constexpr size_t MAX_DATA = 128;
+constexpr std::size_t MAX_USERS = 8;
+constexpr std::size_t MAX_DATA = 128;
constexpr u128 INVALID_UUID{{0, 0}};
struct UUID {
@@ -87,18 +87,18 @@ public:
ResultCode AddUser(const ProfileInfo& user);
ResultCode CreateNewUser(UUID uuid, const ProfileUsername& username);
ResultCode CreateNewUser(UUID uuid, const std::string& username);
- boost::optional<size_t> GetUserIndex(const UUID& uuid) const;
- boost::optional<size_t> GetUserIndex(const ProfileInfo& user) const;
- bool GetProfileBase(boost::optional<size_t> index, ProfileBase& profile) const;
+ boost::optional<std::size_t> GetUserIndex(const UUID& uuid) const;
+ boost::optional<std::size_t> GetUserIndex(const ProfileInfo& user) const;
+ bool GetProfileBase(boost::optional<std::size_t> index, ProfileBase& profile) const;
bool GetProfileBase(UUID uuid, ProfileBase& profile) const;
bool GetProfileBase(const ProfileInfo& user, ProfileBase& profile) const;
- bool GetProfileBaseAndData(boost::optional<size_t> index, ProfileBase& profile,
+ bool GetProfileBaseAndData(boost::optional<std::size_t> index, ProfileBase& profile,
ProfileData& data) const;
bool GetProfileBaseAndData(UUID uuid, ProfileBase& profile, ProfileData& data) const;
bool GetProfileBaseAndData(const ProfileInfo& user, ProfileBase& profile,
ProfileData& data) const;
- size_t GetUserCount() const;
- size_t GetOpenUserCount() const;
+ std::size_t GetUserCount() const;
+ std::size_t GetOpenUserCount() const;
bool UserExists(UUID uuid) const;
void OpenUser(UUID uuid);
void CloseUser(UUID uuid);
@@ -110,9 +110,9 @@ public:
private:
std::array<ProfileInfo, MAX_USERS> profiles{};
- size_t user_count = 0;
- boost::optional<size_t> AddToProfiles(const ProfileInfo& profile);
- bool RemoveProfileAtIndex(size_t index);
+ std::size_t user_count = 0;
+ boost::optional<std::size_t> AddToProfiles(const ProfileInfo& profile);
+ bool RemoveProfileAtIndex(std::size_t index);
UUID last_opened_user{INVALID_UUID};
};
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index a57ed3042..d1f7007ec 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -456,7 +456,7 @@ private:
IPC::RequestParser rp{ctx};
const u64 offset{rp.Pop<u64>()};
- const size_t size{ctx.GetWriteBufferSize()};
+ const std::size_t size{ctx.GetWriteBufferSize()};
ASSERT(offset + size <= buffer.size());
diff --git a/src/core/hle/service/audio/audio.cpp b/src/core/hle/service/audio/audio.cpp
index 6b5e15633..128df7db5 100644
--- a/src/core/hle/service/audio/audio.cpp
+++ b/src/core/hle/service/audio/audio.cpp
@@ -15,6 +15,7 @@
#include "core/hle/service/audio/audren_u.h"
#include "core/hle/service/audio/codecctl.h"
#include "core/hle/service/audio/hwopus.h"
+#include "core/hle/service/service.h"
namespace Service::Audio {
diff --git a/src/core/hle/service/audio/audio.h b/src/core/hle/service/audio/audio.h
index 95e5691f7..f5bd3bf5f 100644
--- a/src/core/hle/service/audio/audio.h
+++ b/src/core/hle/service/audio/audio.h
@@ -4,7 +4,9 @@
#pragma once
-#include "core/hle/service/service.h"
+namespace Service::SM {
+class ServiceManager;
+}
namespace Service::Audio {
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp
index 05100ca8f..80a002322 100644
--- a/src/core/hle/service/audio/audout_u.cpp
+++ b/src/core/hle/service/audio/audout_u.cpp
@@ -3,15 +3,20 @@
// Refer to the license.txt file included.
#include <array>
+#include <cstring>
#include <vector>
+#include "audio_core/audio_out.h"
#include "audio_core/codec.h"
+#include "common/common_funcs.h"
#include "common/logging/log.h"
+#include "common/swap.h"
#include "core/core.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/event.h"
#include "core/hle/kernel/hle_ipc.h"
#include "core/hle/service/audio/audout_u.h"
+#include "core/memory.h"
namespace Service::Audio {
@@ -25,6 +30,18 @@ enum {
constexpr std::array<char, 10> DefaultDevice{{"DeviceOut"}};
constexpr int DefaultSampleRate{48000};
+struct AudoutParams {
+ s32_le sample_rate;
+ u16_le channel_count;
+ INSERT_PADDING_BYTES(2);
+};
+static_assert(sizeof(AudoutParams) == 0x8, "AudoutParams is an invalid size");
+
+enum class AudioState : u32 {
+ Started,
+ Stopped,
+};
+
class IAudioOut final : public ServiceFramework<IAudioOut> {
public:
IAudioOut(AudoutParams audio_params, AudioCore::AudioOut& audio_core)
diff --git a/src/core/hle/service/audio/audout_u.h b/src/core/hle/service/audio/audout_u.h
index aa52d3855..dcaf64708 100644
--- a/src/core/hle/service/audio/audout_u.h
+++ b/src/core/hle/service/audio/audout_u.h
@@ -4,27 +4,18 @@
#pragma once
-#include "audio_core/audio_out.h"
#include "core/hle/service/service.h"
+namespace AudioCore {
+class AudioOut;
+}
+
namespace Kernel {
class HLERequestContext;
}
namespace Service::Audio {
-struct AudoutParams {
- s32_le sample_rate;
- u16_le channel_count;
- INSERT_PADDING_BYTES(2);
-};
-static_assert(sizeof(AudoutParams) == 0x8, "AudoutParams is an invalid size");
-
-enum class AudioState : u32 {
- Started,
- Stopped,
-};
-
class IAudioOut;
class AudOutU final : public ServiceFramework<AudOutU> {
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index 3870bec65..e84c4fa2b 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -2,12 +2,14 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <algorithm>
#include <array>
+#include <memory>
+#include "audio_core/audio_renderer.h"
#include "common/alignment.h"
+#include "common/common_funcs.h"
#include "common/logging/log.h"
-#include "core/core_timing.h"
-#include "core/core_timing_util.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/event.h"
#include "core/hle/kernel/hle_ipc.h"
diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h
index 85a995a2f..c6bc3a90a 100644
--- a/src/core/hle/service/audio/audren_u.h
+++ b/src/core/hle/service/audio/audren_u.h
@@ -4,7 +4,6 @@
#pragma once
-#include "audio_core/audio_renderer.h"
#include "core/hle/service/service.h"
namespace Kernel {
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp
index 341bfda42..fc6067e59 100644
--- a/src/core/hle/service/audio/hwopus.cpp
+++ b/src/core/hle/service/audio/hwopus.cpp
@@ -3,7 +3,12 @@
// Refer to the license.txt file included.
#include <cstring>
+#include <memory>
+#include <vector>
+
#include <opus.h>
+
+#include "common/common_funcs.h"
#include "common/logging/log.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/hle_ipc.h"
@@ -56,7 +61,7 @@ private:
bool Decoder_DecodeInterleaved(u32& consumed, u32& sample_count, const std::vector<u8>& input,
std::vector<opus_int16>& output) {
- size_t raw_output_sz = output.size() * sizeof(opus_int16);
+ std::size_t raw_output_sz = output.size() * sizeof(opus_int16);
if (sizeof(OpusHeader) > input.size())
return false;
OpusHeader hdr{};
@@ -91,7 +96,7 @@ private:
u32 channel_count;
};
-static size_t WorkerBufferSize(u32 channel_count) {
+static std::size_t WorkerBufferSize(u32 channel_count) {
ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count");
return opus_decoder_get_size(static_cast<int>(channel_count));
}
@@ -124,7 +129,7 @@ void HwOpus::OpenOpusDecoder(Kernel::HLERequestContext& ctx) {
"Invalid sample rate");
ASSERT_MSG(channel_count == 1 || channel_count == 2, "Invalid channel count");
- size_t worker_sz = WorkerBufferSize(channel_count);
+ std::size_t worker_sz = WorkerBufferSize(channel_count);
ASSERT_MSG(buffer_sz < worker_sz, "Worker buffer too large");
std::unique_ptr<OpusDecoder, OpusDeleter> decoder{
static_cast<OpusDecoder*>(operator new(worker_sz))};
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index a8e0c869f..ab2f17db9 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -89,7 +89,7 @@ private:
controller_header.left_color_body = JOYCON_BODY_NEON_BLUE;
controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE;
- for (size_t controller = 0; controller < mem.controllers.size(); controller++) {
+ for (std::size_t controller = 0; controller < mem.controllers.size(); controller++) {
for (auto& layout : mem.controllers[controller].layouts) {
layout.header.num_entries = HID_NUM_ENTRIES;
layout.header.max_entry_index = HID_NUM_ENTRIES - 1;
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp
index 098da2a41..c89157a4d 100644
--- a/src/core/hle/service/lm/lm.cpp
+++ b/src/core/hle/service/lm/lm.cpp
@@ -99,7 +99,7 @@ private:
std::string thread;
while (addr < end_addr) {
const Field field{static_cast<Field>(Memory::Read8(addr++))};
- const size_t length{Memory::Read8(addr++)};
+ const std::size_t length{Memory::Read8(addr++)};
if (static_cast<Field>(Memory::Read8(addr)) == Field::Skip) {
++addr;
diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp
index da1c46d59..1069d103f 100644
--- a/src/core/hle/service/ns/pl_u.cpp
+++ b/src/core/hle/service/ns/pl_u.cpp
@@ -2,6 +2,10 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <algorithm>
+#include <cstring>
+#include <vector>
+
#include <FontChineseSimplified.h>
#include <FontChineseTraditional.h>
#include <FontExtendedChineseSimplified.h>
@@ -9,14 +13,19 @@
#include <FontNintendoExtended.h>
#include <FontStandard.h>
+#include "common/assert.h"
#include "common/common_paths.h"
+#include "common/common_types.h"
#include "common/file_util.h"
+#include "common/logging/log.h"
+#include "common/swap.h"
#include "core/core.h"
#include "core/file_sys/content_archive.h"
#include "core/file_sys/nca_metadata.h"
#include "core/file_sys/registered_cache.h"
#include "core/file_sys/romfs.h"
#include "core/hle/ipc_helpers.h"
+#include "core/hle/kernel/shared_memory.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/ns/pl_u.h"
@@ -35,49 +44,41 @@ struct FontRegion {
u32 size;
};
-static constexpr std::array<std::pair<FontArchives, const char*>, 7> SHARED_FONTS{
+constexpr std::array<std::pair<FontArchives, const char*>, 7> SHARED_FONTS{
std::make_pair(FontArchives::Standard, "nintendo_udsg-r_std_003.bfttf"),
std::make_pair(FontArchives::ChineseSimple, "nintendo_udsg-r_org_zh-cn_003.bfttf"),
std::make_pair(FontArchives::ChineseSimple, "nintendo_udsg-r_ext_zh-cn_003.bfttf"),
std::make_pair(FontArchives::ChineseTraditional, "nintendo_udjxh-db_zh-tw_003.bfttf"),
std::make_pair(FontArchives::Korean, "nintendo_udsg-r_ko_003.bfttf"),
std::make_pair(FontArchives::Extension, "nintendo_ext_003.bfttf"),
- std::make_pair(FontArchives::Extension, "nintendo_ext2_003.bfttf")};
+ std::make_pair(FontArchives::Extension, "nintendo_ext2_003.bfttf"),
+};
-static constexpr std::array<const char*, 7> SHARED_FONTS_TTF{"FontStandard.ttf",
- "FontChineseSimplified.ttf",
- "FontExtendedChineseSimplified.ttf",
- "FontChineseTraditional.ttf",
- "FontKorean.ttf",
- "FontNintendoExtended.ttf",
- "FontNintendoExtended2.ttf"};
+constexpr std::array<const char*, 7> SHARED_FONTS_TTF{
+ "FontStandard.ttf",
+ "FontChineseSimplified.ttf",
+ "FontExtendedChineseSimplified.ttf",
+ "FontChineseTraditional.ttf",
+ "FontKorean.ttf",
+ "FontNintendoExtended.ttf",
+ "FontNintendoExtended2.ttf",
+};
// The below data is specific to shared font data dumped from Switch on f/w 2.2
// Virtual address and offsets/sizes likely will vary by dump
-static constexpr VAddr SHARED_FONT_MEM_VADDR{0x00000009d3016000ULL};
-static constexpr u32 EXPECTED_RESULT{
- 0x7f9a0218}; // What we expect the decrypted bfttf first 4 bytes to be
-static constexpr u32 EXPECTED_MAGIC{
- 0x36f81a1e}; // What we expect the encrypted bfttf first 4 bytes to be
-static constexpr u64 SHARED_FONT_MEM_SIZE{0x1100000};
-static constexpr FontRegion EMPTY_REGION{0, 0};
-std::vector<FontRegion>
- SHARED_FONT_REGIONS{}; // Automatically populated based on shared_fonts dump or system archives
-
-const FontRegion& GetSharedFontRegion(size_t index) {
- if (index >= SHARED_FONT_REGIONS.size() || SHARED_FONT_REGIONS.empty()) {
- // No font fallback
- return EMPTY_REGION;
- }
- return SHARED_FONT_REGIONS.at(index);
-}
+constexpr VAddr SHARED_FONT_MEM_VADDR{0x00000009d3016000ULL};
+constexpr u32 EXPECTED_RESULT{0x7f9a0218}; // What we expect the decrypted bfttf first 4 bytes to be
+constexpr u32 EXPECTED_MAGIC{0x36f81a1e}; // What we expect the encrypted bfttf first 4 bytes to be
+constexpr u64 SHARED_FONT_MEM_SIZE{0x1100000};
+constexpr FontRegion EMPTY_REGION{0, 0};
enum class LoadState : u32 {
Loading = 0,
Done = 1,
};
-void DecryptSharedFont(const std::vector<u32>& input, std::vector<u8>& output, size_t& offset) {
+static void DecryptSharedFont(const std::vector<u32>& input, std::vector<u8>& output,
+ std::size_t& offset) {
ASSERT_MSG(offset + (input.size() * sizeof(u32)) < SHARED_FONT_MEM_SIZE,
"Shared fonts exceeds 17mb!");
ASSERT_MSG(input[0] == EXPECTED_MAGIC, "Failed to derive key, unexpected magic number");
@@ -94,7 +95,7 @@ void DecryptSharedFont(const std::vector<u32>& input, std::vector<u8>& output, s
}
static void EncryptSharedFont(const std::vector<u8>& input, std::vector<u8>& output,
- size_t& offset) {
+ std::size_t& offset) {
ASSERT_MSG(offset + input.size() + 8 < SHARED_FONT_MEM_SIZE, "Shared fonts exceeds 17mb!");
const u32 KEY = EXPECTED_MAGIC ^ EXPECTED_RESULT;
std::memcpy(output.data() + offset, &EXPECTED_RESULT, sizeof(u32)); // Magic header
@@ -104,28 +105,52 @@ static void EncryptSharedFont(const std::vector<u8>& input, std::vector<u8>& out
offset += input.size() + (sizeof(u32) * 2);
}
+// Helper function to make BuildSharedFontsRawRegions a bit nicer
static u32 GetU32Swapped(const u8* data) {
u32 value;
std::memcpy(&value, data, sizeof(value));
- return Common::swap32(value); // Helper function to make BuildSharedFontsRawRegions a bit nicer
+ return Common::swap32(value);
}
-void BuildSharedFontsRawRegions(const std::vector<u8>& input) {
- unsigned cur_offset = 0; // As we can derive the xor key we can just populate the offsets based
- // on the shared memory dump
- for (size_t i = 0; i < SHARED_FONTS.size(); i++) {
- // Out of shared fonts/Invalid font
- if (GetU32Swapped(input.data() + cur_offset) != EXPECTED_RESULT)
- break;
- const u32 KEY = GetU32Swapped(input.data() + cur_offset) ^
- EXPECTED_MAGIC; // Derive key withing inverse xor
- const u32 SIZE = GetU32Swapped(input.data() + cur_offset + 4) ^ KEY;
- SHARED_FONT_REGIONS.push_back(FontRegion{cur_offset + 8, SIZE});
- cur_offset += SIZE + 8;
+struct PL_U::Impl {
+ const FontRegion& GetSharedFontRegion(std::size_t index) const {
+ if (index >= shared_font_regions.size() || shared_font_regions.empty()) {
+ // No font fallback
+ return EMPTY_REGION;
+ }
+ return shared_font_regions.at(index);
}
-}
-PL_U::PL_U() : ServiceFramework("pl:u") {
+ void BuildSharedFontsRawRegions(const std::vector<u8>& input) {
+ // As we can derive the xor key we can just populate the offsets
+ // based on the shared memory dump
+ unsigned cur_offset = 0;
+
+ for (std::size_t i = 0; i < SHARED_FONTS.size(); i++) {
+ // Out of shared fonts/invalid font
+ if (GetU32Swapped(input.data() + cur_offset) != EXPECTED_RESULT) {
+ break;
+ }
+
+ // Derive key withing inverse xor
+ const u32 KEY = GetU32Swapped(input.data() + cur_offset) ^ EXPECTED_MAGIC;
+ const u32 SIZE = GetU32Swapped(input.data() + cur_offset + 4) ^ KEY;
+ shared_font_regions.push_back(FontRegion{cur_offset + 8, SIZE});
+ cur_offset += SIZE + 8;
+ }
+ }
+
+ /// Handle to shared memory region designated for a shared font
+ Kernel::SharedPtr<Kernel::SharedMemory> shared_font_mem;
+
+ /// Backing memory for the shared font data
+ std::shared_ptr<std::vector<u8>> shared_font;
+
+ // Automatically populated based on shared_fonts dump or system archives.
+ std::vector<FontRegion> shared_font_regions;
+};
+
+PL_U::PL_U() : ServiceFramework("pl:u"), impl{std::make_unique<Impl>()} {
static const FunctionInfo functions[] = {
{0, &PL_U::RequestLoad, "RequestLoad"},
{1, &PL_U::GetLoadState, "GetLoadState"},
@@ -137,11 +162,11 @@ PL_U::PL_U() : ServiceFramework("pl:u") {
RegisterHandlers(functions);
// Attempt to load shared font data from disk
const auto nand = FileSystem::GetSystemNANDContents();
- size_t offset = 0;
+ std::size_t offset = 0;
// Rebuild shared fonts from data ncas
if (nand->HasEntry(static_cast<u64>(FontArchives::Standard),
FileSys::ContentRecordType::Data)) {
- shared_font = std::make_shared<std::vector<u8>>(SHARED_FONT_MEM_SIZE);
+ impl->shared_font = std::make_shared<std::vector<u8>>(SHARED_FONT_MEM_SIZE);
for (auto font : SHARED_FONTS) {
const auto nca =
nand->GetEntry(static_cast<u64>(font.first), FileSys::ContentRecordType::Data);
@@ -177,12 +202,12 @@ PL_U::PL_U() : ServiceFramework("pl:u") {
static_cast<u32>(offset + 8),
static_cast<u32>((font_data_u32.size() * sizeof(u32)) -
8)}; // Font offset and size do not account for the header
- DecryptSharedFont(font_data_u32, *shared_font, offset);
- SHARED_FONT_REGIONS.push_back(region);
+ DecryptSharedFont(font_data_u32, *impl->shared_font, offset);
+ impl->shared_font_regions.push_back(region);
}
} else {
- shared_font = std::make_shared<std::vector<u8>>(
+ impl->shared_font = std::make_shared<std::vector<u8>>(
SHARED_FONT_MEM_SIZE); // Shared memory needs to always be allocated and a fixed size
const std::string user_path = FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir);
@@ -206,8 +231,8 @@ PL_U::PL_U() : ServiceFramework("pl:u") {
static_cast<u32>(offset + 8),
static_cast<u32>(ttf_bytes.size())}; // Font offset and size do not account
// for the header
- EncryptSharedFont(ttf_bytes, *shared_font, offset);
- SHARED_FONT_REGIONS.push_back(region);
+ EncryptSharedFont(ttf_bytes, *impl->shared_font, offset);
+ impl->shared_font_regions.push_back(region);
} else {
LOG_WARNING(Service_NS, "Unable to load font: {}", font_ttf);
}
@@ -222,26 +247,28 @@ PL_U::PL_U() : ServiceFramework("pl:u") {
if (file.IsOpen()) {
// Read shared font data
ASSERT(file.GetSize() == SHARED_FONT_MEM_SIZE);
- file.ReadBytes(shared_font->data(), shared_font->size());
- BuildSharedFontsRawRegions(*shared_font);
+ file.ReadBytes(impl->shared_font->data(), impl->shared_font->size());
+ impl->BuildSharedFontsRawRegions(*impl->shared_font);
} else {
LOG_WARNING(Service_NS,
"Shared Font file missing. Loading open source replacement from memory");
+ // clang-format off
const std::vector<std::vector<u8>> open_source_shared_fonts_ttf = {
{std::begin(FontChineseSimplified), std::end(FontChineseSimplified)},
{std::begin(FontChineseTraditional), std::end(FontChineseTraditional)},
- {std::begin(FontExtendedChineseSimplified),
- std::end(FontExtendedChineseSimplified)},
+ {std::begin(FontExtendedChineseSimplified), std::end(FontExtendedChineseSimplified)},
+ {std::begin(FontKorean), std::end(FontKorean)},
{std::begin(FontNintendoExtended), std::end(FontNintendoExtended)},
{std::begin(FontStandard), std::end(FontStandard)},
};
+ // clang-format on
for (const std::vector<u8>& font_ttf : open_source_shared_fonts_ttf) {
const FontRegion region{static_cast<u32>(offset + 8),
static_cast<u32>(font_ttf.size())};
- EncryptSharedFont(font_ttf, *shared_font, offset);
- SHARED_FONT_REGIONS.push_back(region);
+ EncryptSharedFont(font_ttf, *impl->shared_font, offset);
+ impl->shared_font_regions.push_back(region);
}
}
}
@@ -275,7 +302,7 @@ void PL_U::GetSize(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_NS, "called, font_id={}", font_id);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
- rb.Push<u32>(GetSharedFontRegion(font_id).size);
+ rb.Push<u32>(impl->GetSharedFontRegion(font_id).size);
}
void PL_U::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) {
@@ -285,17 +312,18 @@ void PL_U::GetSharedMemoryAddressOffset(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_NS, "called, font_id={}", font_id);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
- rb.Push<u32>(GetSharedFontRegion(font_id).offset);
+ rb.Push<u32>(impl->GetSharedFontRegion(font_id).offset);
}
void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) {
// Map backing memory for the font data
- Core::CurrentProcess()->vm_manager.MapMemoryBlock(
- SHARED_FONT_MEM_VADDR, shared_font, 0, SHARED_FONT_MEM_SIZE, Kernel::MemoryState::Shared);
+ Core::CurrentProcess()->vm_manager.MapMemoryBlock(SHARED_FONT_MEM_VADDR, impl->shared_font, 0,
+ SHARED_FONT_MEM_SIZE,
+ Kernel::MemoryState::Shared);
// Create shared font memory object
auto& kernel = Core::System::GetInstance().Kernel();
- shared_font_mem = Kernel::SharedMemory::Create(
+ impl->shared_font_mem = Kernel::SharedMemory::Create(
kernel, Core::CurrentProcess(), SHARED_FONT_MEM_SIZE, Kernel::MemoryPermission::ReadWrite,
Kernel::MemoryPermission::Read, SHARED_FONT_MEM_VADDR, Kernel::MemoryRegion::BASE,
"PL_U:shared_font_mem");
@@ -303,7 +331,7 @@ void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_NS, "called");
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
- rb.PushCopyObjects(shared_font_mem);
+ rb.PushCopyObjects(impl->shared_font_mem);
}
void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) {
@@ -316,9 +344,9 @@ void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) {
std::vector<u32> font_sizes;
// TODO(ogniK): Have actual priority order
- for (size_t i = 0; i < SHARED_FONT_REGIONS.size(); i++) {
+ for (std::size_t i = 0; i < impl->shared_font_regions.size(); i++) {
font_codes.push_back(static_cast<u32>(i));
- auto region = GetSharedFontRegion(i);
+ auto region = impl->GetSharedFontRegion(i);
font_offsets.push_back(region.offset);
font_sizes.push_back(region.size);
}
diff --git a/src/core/hle/service/ns/pl_u.h b/src/core/hle/service/ns/pl_u.h
index 296c3db05..253f26a2a 100644
--- a/src/core/hle/service/ns/pl_u.h
+++ b/src/core/hle/service/ns/pl_u.h
@@ -5,7 +5,6 @@
#pragma once
#include <memory>
-#include "core/hle/kernel/shared_memory.h"
#include "core/hle/service/service.h"
namespace Service::NS {
@@ -23,11 +22,8 @@ private:
void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx);
void GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx);
- /// Handle to shared memory region designated for a shared font
- Kernel::SharedPtr<Kernel::SharedMemory> shared_font_mem;
-
- /// Backing memory for the shared font data
- std::shared_ptr<std::vector<u8>> shared_font;
+ struct Impl;
+ std::unique_ptr<Impl> impl;
};
} // namespace Service::NS
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
index 25d5a93fa..d8b8037a8 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
@@ -71,7 +71,7 @@ u32 nvhost_as_gpu::AllocateSpace(const std::vector<u8>& input, std::vector<u8>&
}
u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output) {
- size_t num_entries = input.size() / sizeof(IoctlRemapEntry);
+ std::size_t num_entries = input.size() / sizeof(IoctlRemapEntry);
LOG_WARNING(Service_NVDRV, "(STUBBED) called, num_entries=0x{:X}", num_entries);
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp
index 34f98fe5a..fd98d541d 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.cpp
+++ b/src/core/hle/service/nvflinger/buffer_queue.cpp
@@ -9,8 +9,7 @@
#include "core/core.h"
#include "core/hle/service/nvflinger/buffer_queue.h"
-namespace Service {
-namespace NVFlinger {
+namespace Service::NVFlinger {
BufferQueue::BufferQueue(u32 id, u64 layer_id) : id(id), layer_id(layer_id) {
auto& kernel = Core::System::GetInstance().Kernel();
@@ -104,5 +103,4 @@ u32 BufferQueue::Query(QueryType type) {
return 0;
}
-} // namespace NVFlinger
-} // namespace Service
+} // namespace Service::NVFlinger
diff --git a/src/core/hle/service/nvflinger/buffer_queue.h b/src/core/hle/service/nvflinger/buffer_queue.h
index 17c81928a..50b767732 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.h
+++ b/src/core/hle/service/nvflinger/buffer_queue.h
@@ -15,8 +15,7 @@ namespace CoreTiming {
struct EventType;
}
-namespace Service {
-namespace NVFlinger {
+namespace Service::NVFlinger {
struct IGBPBuffer {
u32_le magic;
@@ -98,5 +97,4 @@ private:
Kernel::SharedPtr<Kernel::Event> buffer_wait_event;
};
-} // namespace NVFlinger
-} // namespace Service
+} // namespace Service::NVFlinger
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index 7455ddd19..d47b6f659 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -23,7 +23,7 @@
namespace Service::NVFlinger {
-constexpr size_t SCREEN_REFRESH_RATE = 60;
+constexpr std::size_t SCREEN_REFRESH_RATE = 60;
constexpr u64 frame_ticks = static_cast<u64>(CoreTiming::BASE_CLOCK_RATE / SCREEN_REFRESH_RATE);
NVFlinger::NVFlinger() {
diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp
index 3c43b8d8c..6a9eccfb5 100644
--- a/src/core/hle/service/prepo/prepo.cpp
+++ b/src/core/hle/service/prepo/prepo.cpp
@@ -1,36 +1,47 @@
-#include <cinttypes>
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
#include "common/logging/log.h"
#include "core/hle/ipc_helpers.h"
-#include "core/hle/kernel/event.h"
#include "core/hle/service/prepo/prepo.h"
+#include "core/hle/service/service.h"
namespace Service::PlayReport {
-PlayReport::PlayReport(const char* name) : ServiceFramework(name) {
- static const FunctionInfo functions[] = {
- {10100, nullptr, "SaveReport"},
- {10101, &PlayReport::SaveReportWithUser, "SaveReportWithUser"},
- {10200, nullptr, "RequestImmediateTransmission"},
- {10300, nullptr, "GetTransmissionStatus"},
- {20100, nullptr, "SaveSystemReport"},
- {20200, nullptr, "SetOperationMode"},
- {20101, nullptr, "SaveSystemReportWithUser"},
- {30100, nullptr, "ClearStorage"},
- {40100, nullptr, "IsUserAgreementCheckEnabled"},
- {40101, nullptr, "SetUserAgreementCheckEnabled"},
- {90100, nullptr, "GetStorageUsage"},
- {90200, nullptr, "GetStatistics"},
- {90201, nullptr, "GetThroughputHistory"},
- {90300, nullptr, "GetLastUploadError"},
- };
- RegisterHandlers(functions);
-};
-void PlayReport::SaveReportWithUser(Kernel::HLERequestContext& ctx) {
- // TODO(ogniK): Do we want to add play report?
- LOG_WARNING(Service_PREPO, "(STUBBED) called");
+class PlayReport final : public ServiceFramework<PlayReport> {
+public:
+ explicit PlayReport(const char* name) : ServiceFramework{name} {
+ // clang-format off
+ static const FunctionInfo functions[] = {
+ {10100, nullptr, "SaveReport"},
+ {10101, &PlayReport::SaveReportWithUser, "SaveReportWithUser"},
+ {10200, nullptr, "RequestImmediateTransmission"},
+ {10300, nullptr, "GetTransmissionStatus"},
+ {20100, nullptr, "SaveSystemReport"},
+ {20200, nullptr, "SetOperationMode"},
+ {20101, nullptr, "SaveSystemReportWithUser"},
+ {30100, nullptr, "ClearStorage"},
+ {40100, nullptr, "IsUserAgreementCheckEnabled"},
+ {40101, nullptr, "SetUserAgreementCheckEnabled"},
+ {90100, nullptr, "GetStorageUsage"},
+ {90200, nullptr, "GetStatistics"},
+ {90201, nullptr, "GetThroughputHistory"},
+ {90300, nullptr, "GetLastUploadError"},
+ };
+ // clang-format on
+
+ RegisterHandlers(functions);
+ }
+
+private:
+ void SaveReportWithUser(Kernel::HLERequestContext& ctx) {
+ // TODO(ogniK): Do we want to add play report?
+ LOG_WARNING(Service_PREPO, "(STUBBED) called");
- IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(RESULT_SUCCESS);
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(RESULT_SUCCESS);
+ }
};
void InstallInterfaces(SM::ServiceManager& service_manager) {
diff --git a/src/core/hle/service/prepo/prepo.h b/src/core/hle/service/prepo/prepo.h
index f5a6aba6d..0e7b01331 100644
--- a/src/core/hle/service/prepo/prepo.h
+++ b/src/core/hle/service/prepo/prepo.h
@@ -4,22 +4,12 @@
#pragma once
-#include <memory>
-#include <string>
-#include "core/hle/kernel/event.h"
-#include "core/hle/service/service.h"
+namespace Service::SM {
+class ServiceManager;
+}
namespace Service::PlayReport {
-class PlayReport final : public ServiceFramework<PlayReport> {
-public:
- explicit PlayReport(const char* name);
- ~PlayReport() = default;
-
-private:
- void SaveReportWithUser(Kernel::HLERequestContext& ctx);
-};
-
void InstallInterfaces(SM::ServiceManager& service_manager);
} // namespace Service::PlayReport
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 9bb7c7b26..62f049660 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -50,6 +50,7 @@
#include "core/hle/service/nim/nim.h"
#include "core/hle/service/ns/ns.h"
#include "core/hle/service/nvdrv/nvdrv.h"
+#include "core/hle/service/nvflinger/nvflinger.h"
#include "core/hle/service/pcie/pcie.h"
#include "core/hle/service/pctl/pctl.h"
#include "core/hle/service/pcv/pcv.h"
@@ -58,7 +59,6 @@
#include "core/hle/service/psc/psc.h"
#include "core/hle/service/service.h"
#include "core/hle/service/set/settings.h"
-#include "core/hle/service/sm/controller.h"
#include "core/hle/service/sm/sm.h"
#include "core/hle/service/sockets/sockets.h"
#include "core/hle/service/spl/module.h"
@@ -129,9 +129,9 @@ Kernel::SharedPtr<Kernel::ClientPort> ServiceFrameworkBase::CreatePort() {
return client_port;
}
-void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, size_t n) {
+void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n) {
handlers.reserve(handlers.size() + n);
- for (size_t i = 0; i < n; ++i) {
+ for (std::size_t i = 0; i < n; ++i) {
// Usually this array is sorted by id already, so hint to insert at the end
handlers.emplace_hint(handlers.cend(), functions[i].expected_header, functions[i]);
}
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 7a051523e..2fc57a82e 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -88,7 +88,7 @@ private:
ServiceFrameworkBase(const char* service_name, u32 max_sessions, InvokerFn* handler_invoker);
~ServiceFrameworkBase();
- void RegisterHandlersBase(const FunctionInfoBase* functions, size_t n);
+ void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n);
void ReportUnimplementedFunction(Kernel::HLERequestContext& ctx, const FunctionInfoBase* info);
/// Identifier string used to connect to the service.
@@ -152,7 +152,7 @@ protected:
: ServiceFrameworkBase(service_name, max_sessions, Invoker) {}
/// Registers handlers in the service.
- template <size_t N>
+ template <std::size_t N>
void RegisterHandlers(const FunctionInfo (&functions)[N]) {
RegisterHandlers(functions, N);
}
@@ -161,7 +161,7 @@ protected:
* Registers handlers in the service. Usually prefer using the other RegisterHandlers
* overload in order to avoid needing to specify the array size.
*/
- void RegisterHandlers(const FunctionInfo* functions, size_t n) {
+ void RegisterHandlers(const FunctionInfo* functions, std::size_t n) {
RegisterHandlersBase(functions, n);
}
diff --git a/src/core/hle/service/set/set.cpp b/src/core/hle/service/set/set.cpp
index 59eb20155..9e5af7839 100644
--- a/src/core/hle/service/set/set.cpp
+++ b/src/core/hle/service/set/set.cpp
@@ -32,21 +32,21 @@ constexpr std::array<LanguageCode, 17> available_language_codes = {{
LanguageCode::ZH_HANT,
}};
-constexpr size_t pre4_0_0_max_entries = 0xF;
-constexpr size_t post4_0_0_max_entries = 0x40;
+constexpr std::size_t pre4_0_0_max_entries = 0xF;
+constexpr std::size_t post4_0_0_max_entries = 0x40;
-LanguageCode GetLanguageCodeFromIndex(size_t index) {
+LanguageCode GetLanguageCodeFromIndex(std::size_t index) {
return available_language_codes.at(index);
}
-template <size_t size>
+template <std::size_t size>
static std::array<LanguageCode, size> MakeLanguageCodeSubset() {
std::array<LanguageCode, size> arr;
std::copy_n(available_language_codes.begin(), size, arr.begin());
return arr;
}
-static void PushResponseLanguageCode(Kernel::HLERequestContext& ctx, size_t max_size) {
+static void PushResponseLanguageCode(Kernel::HLERequestContext& ctx, std::size_t max_size) {
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
if (available_language_codes.size() > max_size)
diff --git a/src/core/hle/service/set/set.h b/src/core/hle/service/set/set.h
index 5f0214359..266f13e46 100644
--- a/src/core/hle/service/set/set.h
+++ b/src/core/hle/service/set/set.h
@@ -28,7 +28,7 @@ enum class LanguageCode : u64 {
ZH_HANS = 0x00736E61482D687A,
ZH_HANT = 0x00746E61482D687A,
};
-LanguageCode GetLanguageCodeFromIndex(size_t idx);
+LanguageCode GetLanguageCodeFromIndex(std::size_t idx);
class SET final : public ServiceFramework<SET> {
public:
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp
index 18d1641b8..096f0fd52 100644
--- a/src/core/hle/service/sm/sm.cpp
+++ b/src/core/hle/service/sm/sm.cpp
@@ -15,6 +15,10 @@
namespace Service::SM {
+constexpr ResultCode ERR_ALREADY_REGISTERED(ErrorModule::SM, 4);
+constexpr ResultCode ERR_INVALID_NAME(ErrorModule::SM, 6);
+constexpr ResultCode ERR_SERVICE_NOT_REGISTERED(ErrorModule::SM, 7);
+
ServiceManager::ServiceManager() = default;
ServiceManager::~ServiceManager() = default;
@@ -24,10 +28,10 @@ void ServiceManager::InvokeControlRequest(Kernel::HLERequestContext& context) {
static ResultCode ValidateServiceName(const std::string& name) {
if (name.size() <= 0 || name.size() > 8) {
- return ERR_INVALID_NAME_SIZE;
+ return ERR_INVALID_NAME;
}
if (name.find('\0') != std::string::npos) {
- return ERR_NAME_CONTAINS_NUL;
+ return ERR_INVALID_NAME;
}
return RESULT_SUCCESS;
}
diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h
index a58d922a0..da2c51082 100644
--- a/src/core/hle/service/sm/sm.h
+++ b/src/core/hle/service/sm/sm.h
@@ -36,12 +36,6 @@ private:
std::shared_ptr<ServiceManager> service_manager;
};
-constexpr ResultCode ERR_SERVICE_NOT_REGISTERED(-1);
-constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1);
-constexpr ResultCode ERR_INVALID_NAME_SIZE(-1);
-constexpr ResultCode ERR_NAME_CONTAINS_NUL(-1);
-constexpr ResultCode ERR_ALREADY_REGISTERED(-1);
-
class ServiceManager {
public:
static void InstallInterfaces(std::shared_ptr<ServiceManager> self);
diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp
index 0d8441fb1..44a6717d0 100644
--- a/src/core/hle/service/spl/module.cpp
+++ b/src/core/hle/service/spl/module.cpp
@@ -21,7 +21,7 @@ Module::Interface::~Interface() = default;
void Module::Interface::GetRandomBytes(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
- size_t size = ctx.GetWriteBufferSize();
+ std::size_t size = ctx.GetWriteBufferSize();
std::vector<u8> data(size);
std::generate(data.begin(), data.end(), std::rand);
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 85244ac3b..d0cde5ede 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -4,25 +4,28 @@
#include <algorithm>
#include <array>
+#include <cstring>
#include <memory>
#include <type_traits>
#include <utility>
#include <boost/optional.hpp>
#include "common/alignment.h"
+#include "common/assert.h"
+#include "common/common_funcs.h"
+#include "common/logging/log.h"
#include "common/math_util.h"
-#include "common/scope_exit.h"
+#include "common/swap.h"
#include "core/core_timing.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/event.h"
#include "core/hle/service/nvdrv/nvdrv.h"
#include "core/hle/service/nvflinger/buffer_queue.h"
+#include "core/hle/service/nvflinger/nvflinger.h"
#include "core/hle/service/vi/vi.h"
#include "core/hle/service/vi/vi_m.h"
#include "core/hle/service/vi/vi_s.h"
#include "core/hle/service/vi/vi_u.h"
#include "core/settings.h"
-#include "video_core/renderer_base.h"
-#include "video_core/video_core.h"
namespace Service::VI {
@@ -38,7 +41,7 @@ static_assert(sizeof(DisplayInfo) == 0x60, "DisplayInfo has wrong size");
class Parcel {
public:
// This default size was chosen arbitrarily.
- static constexpr size_t DefaultBufferSize = 0x40;
+ static constexpr std::size_t DefaultBufferSize = 0x40;
Parcel() : buffer(DefaultBufferSize) {}
explicit Parcel(std::vector<u8> data) : buffer(std::move(data)) {}
virtual ~Parcel() = default;
@@ -66,7 +69,7 @@ public:
return val;
}
- std::vector<u8> ReadBlock(size_t length) {
+ std::vector<u8> ReadBlock(std::size_t length) {
ASSERT(read_index + length <= buffer.size());
const u8* const begin = buffer.data() + read_index;
const u8* const end = begin + length;
@@ -156,8 +159,8 @@ private:
static_assert(sizeof(Header) == 16, "ParcelHeader has wrong size");
std::vector<u8> buffer;
- size_t read_index = 0;
- size_t write_index = 0;
+ std::size_t read_index = 0;
+ std::size_t write_index = 0;
};
class NativeWindow : public Parcel {
@@ -514,7 +517,7 @@ private:
ctx.SleepClientThread(
Kernel::GetCurrentThread(), "IHOSBinderDriver::DequeueBuffer", -1,
[=](Kernel::SharedPtr<Kernel::Thread> thread, Kernel::HLERequestContext& ctx,
- ThreadWakeupReason reason) {
+ Kernel::ThreadWakeupReason reason) {
// Repeat TransactParcel DequeueBuffer when a buffer is available
auto buffer_queue = nv_flinger->GetBufferQueue(id);
boost::optional<u32> slot = buffer_queue->DequeueBuffer(width, height);
diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h
index c2dc83605..e3963502a 100644
--- a/src/core/hle/service/vi/vi.h
+++ b/src/core/hle/service/vi/vi.h
@@ -4,11 +4,10 @@
#pragma once
-#include "core/hle/service/nvflinger/nvflinger.h"
#include "core/hle/service/service.h"
-namespace CoreTiming {
-struct EventType;
+namespace Service::NVFlinger {
+class NVFlinger;
}
namespace Service::VI {