summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/gdbstub/gdbstub.cpp14
-rw-r--r--src/core/hle/kernel/svc.cpp7
-rw-r--r--src/core/hle/service/acc/acc.cpp33
-rw-r--r--src/core/hle/service/acc/acc.h2
-rw-r--r--src/core/hle/service/am/am.h2
-rw-r--r--src/core/hle/service/am/applet_ae.cpp2
-rw-r--r--src/core/hle/service/am/applet_ae.h2
-rw-r--r--src/core/hle/service/am/applet_oe.cpp2
-rw-r--r--src/core/hle/service/am/applet_oe.h2
-rw-r--r--src/core/hle/service/apm/interface.h2
-rw-r--r--src/core/hle/service/audio/audren_u.cpp4
-rw-r--r--src/core/hle/service/bcat/module.h2
-rw-r--r--src/core/hle/service/fatal/fatal.h2
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp4
-rw-r--r--src/core/hle/service/friend/friend.h2
-rw-r--r--src/core/hle/service/hid/hid.cpp10
-rw-r--r--src/core/hle/service/hid/hid.h2
-rw-r--r--src/core/hle/service/nfp/nfp.h2
-rw-r--r--src/core/hle/service/nifm/nifm.h2
-rw-r--r--src/core/hle/service/ns/pl_u.cpp2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvdisp_disp0.h2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h2
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_gpu.h2
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h2
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp13
-rw-r--r--src/core/hle/service/pctl/module.h2
-rw-r--r--src/core/hle/service/sm/sm.h2
-rw-r--r--src/core/hle/service/spl/module.h2
-rw-r--r--src/core/hle/service/time/time.h2
-rw-r--r--src/core/hle/service/vi/vi.cpp4
-rw-r--r--src/core/hle/service/vi/vi.h4
-rw-r--r--src/core/loader/loader.cpp4
-rw-r--r--src/core/loader/loader.h6
-rw-r--r--src/core/loader/nso.cpp10
34 files changed, 83 insertions, 74 deletions
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index 6062de13c..5ca573652 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -205,7 +205,7 @@ static Kernel::Thread* FindThreadById(int id) {
205 for (u32 core = 0; core < Core::NUM_CPU_CORES; core++) { 205 for (u32 core = 0; core < Core::NUM_CPU_CORES; core++) {
206 const auto& threads = Core::System::GetInstance().Scheduler(core)->GetThreadList(); 206 const auto& threads = Core::System::GetInstance().Scheduler(core)->GetThreadList();
207 for (auto& thread : threads) { 207 for (auto& thread : threads) {
208 if (thread->GetThreadId() == id) { 208 if (thread->GetThreadId() == static_cast<u32>(id)) {
209 current_core = core; 209 current_core = core;
210 return thread.get(); 210 return thread.get();
211 } 211 }
@@ -214,7 +214,7 @@ static Kernel::Thread* FindThreadById(int id) {
214 return nullptr; 214 return nullptr;
215} 215}
216 216
217static u64 RegRead(int id, Kernel::Thread* thread = nullptr) { 217static u64 RegRead(std::size_t id, Kernel::Thread* thread = nullptr) {
218 if (!thread) { 218 if (!thread) {
219 return 0; 219 return 0;
220 } 220 }
@@ -234,7 +234,7 @@ static u64 RegRead(int id, Kernel::Thread* thread = nullptr) {
234 } 234 }
235} 235}
236 236
237static void RegWrite(int id, u64 val, Kernel::Thread* thread = nullptr) { 237static void RegWrite(std::size_t id, u64 val, Kernel::Thread* thread = nullptr) {
238 if (!thread) { 238 if (!thread) {
239 return; 239 return;
240 } 240 }
@@ -744,7 +744,7 @@ static bool IsDataAvailable() {
744 fd_set fd_socket; 744 fd_set fd_socket;
745 745
746 FD_ZERO(&fd_socket); 746 FD_ZERO(&fd_socket);
747 FD_SET(gdbserver_socket, &fd_socket); 747 FD_SET(static_cast<u32>(gdbserver_socket), &fd_socket);
748 748
749 struct timeval t; 749 struct timeval t;
750 t.tv_sec = 0; 750 t.tv_sec = 0;
@@ -793,7 +793,7 @@ static void ReadRegisters() {
793 793
794 u8* bufptr = buffer; 794 u8* bufptr = buffer;
795 795
796 for (int reg = 0; reg <= SP_REGISTER; reg++) { 796 for (u32 reg = 0; reg <= SP_REGISTER; reg++) {
797 LongToGdbHex(bufptr + reg * 16, RegRead(reg, current_thread)); 797 LongToGdbHex(bufptr + reg * 16, RegRead(reg, current_thread));
798 } 798 }
799 799
@@ -807,7 +807,7 @@ static void ReadRegisters() {
807 807
808 bufptr += 8; 808 bufptr += 8;
809 809
810 for (int reg = UC_ARM64_REG_Q0; reg <= UC_ARM64_REG_Q0 + 31; reg++) { 810 for (u32 reg = UC_ARM64_REG_Q0; reg <= UC_ARM64_REG_Q0 + 31; reg++) {
811 LongToGdbHex(bufptr + reg * 16, RegRead(reg, current_thread)); 811 LongToGdbHex(bufptr + reg * 16, RegRead(reg, current_thread));
812 } 812 }
813 813
@@ -858,7 +858,7 @@ static void WriteRegisters() {
858 if (command_buffer[0] != 'G') 858 if (command_buffer[0] != 'G')
859 return SendReply("E01"); 859 return SendReply("E01");
860 860
861 for (int i = 0, reg = 0; reg <= FPSCR_REGISTER; i++, reg++) { 861 for (u32 i = 0, reg = 0; reg <= FPSCR_REGISTER; i++, reg++) {
862 if (reg <= SP_REGISTER) { 862 if (reg <= SP_REGISTER) {
863 RegWrite(reg, GdbHexToLong(buffer_ptr + i * 16), current_thread); 863 RegWrite(reg, GdbHexToLong(buffer_ptr + i * 16), current_thread);
864 } else if (reg == PC_REGISTER) { 864 } else if (reg == PC_REGISTER) {
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 5ad923fe7..c6b0bb442 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -795,8 +795,9 @@ static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) {
795 return ERR_INVALID_HANDLE; 795 return ERR_INVALID_HANDLE;
796 } 796 }
797 797
798 if (core == THREADPROCESSORID_DEFAULT) { 798 if (core == static_cast<u32>(THREADPROCESSORID_DEFAULT)) {
799 ASSERT(thread->owner_process->ideal_processor != THREADPROCESSORID_DEFAULT); 799 ASSERT(thread->owner_process->ideal_processor !=
800 static_cast<u8>(THREADPROCESSORID_DEFAULT));
800 // Set the target CPU to the one specified in the process' exheader. 801 // Set the target CPU to the one specified in the process' exheader.
801 core = thread->owner_process->ideal_processor; 802 core = thread->owner_process->ideal_processor;
802 mask = 1ull << core; 803 mask = 1ull << core;
@@ -811,7 +812,7 @@ static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) {
811 812
812 if (core == OnlyChangeMask) { 813 if (core == OnlyChangeMask) {
813 core = thread->ideal_core; 814 core = thread->ideal_core;
814 } else if (core >= Core::NUM_CPU_CORES && core != -1) { 815 } else if (core >= Core::NUM_CPU_CORES && core != static_cast<u32>(-1)) {
815 return ResultCode(ErrorModule::Kernel, ErrCodes::InvalidProcessorId); 816 return ResultCode(ErrorModule::Kernel, ErrCodes::InvalidProcessorId);
816 } 817 }
817 818
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index 6bafb2dce..8ee39b54c 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -2,6 +2,7 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <array>
5#include "common/logging/log.h" 6#include "common/logging/log.h"
6#include "core/hle/ipc_helpers.h" 7#include "core/hle/ipc_helpers.h"
7#include "core/hle/service/acc/acc.h" 8#include "core/hle/service/acc/acc.h"
@@ -24,18 +25,17 @@ struct UserData {
24static_assert(sizeof(UserData) == 0x80, "UserData structure has incorrect size"); 25static_assert(sizeof(UserData) == 0x80, "UserData structure has incorrect size");
25 26
26struct ProfileBase { 27struct ProfileBase {
27 u8 user_id[0x10]; 28 u128 user_id;
28 u64 timestamp; 29 u64 timestamp;
29 u8 username[0x20]; 30 std::array<u8, 0x20> username;
30}; 31};
31static_assert(sizeof(ProfileBase) == 0x38, "ProfileBase structure has incorrect size"); 32static_assert(sizeof(ProfileBase) == 0x38, "ProfileBase structure has incorrect size");
32 33
33using Uid = std::array<u64, 2>; 34static constexpr u128 DEFAULT_USER_ID{1ull, 0ull};
34static constexpr Uid DEFAULT_USER_ID{0x10ull, 0x20ull};
35 35
36class IProfile final : public ServiceFramework<IProfile> { 36class IProfile final : public ServiceFramework<IProfile> {
37public: 37public:
38 IProfile() : ServiceFramework("IProfile") { 38 IProfile(u128 user_id) : ServiceFramework("IProfile"), user_id(user_id) {
39 static const FunctionInfo functions[] = { 39 static const FunctionInfo functions[] = {
40 {0, nullptr, "Get"}, 40 {0, nullptr, "Get"},
41 {1, &IProfile::GetBase, "GetBase"}, 41 {1, &IProfile::GetBase, "GetBase"},
@@ -48,11 +48,18 @@ public:
48private: 48private:
49 void GetBase(Kernel::HLERequestContext& ctx) { 49 void GetBase(Kernel::HLERequestContext& ctx) {
50 LOG_WARNING(Service_ACC, "(STUBBED) called"); 50 LOG_WARNING(Service_ACC, "(STUBBED) called");
51
52 // TODO(Subv): Retrieve this information from somewhere.
51 ProfileBase profile_base{}; 53 ProfileBase profile_base{};
54 profile_base.user_id = user_id;
55 profile_base.username = {'y', 'u', 'z', 'u'};
56
52 IPC::ResponseBuilder rb{ctx, 16}; 57 IPC::ResponseBuilder rb{ctx, 16};
53 rb.Push(RESULT_SUCCESS); 58 rb.Push(RESULT_SUCCESS);
54 rb.PushRaw(profile_base); 59 rb.PushRaw(profile_base);
55 } 60 }
61
62 u128 user_id; ///< The user id this profile refers to.
56}; 63};
57 64
58class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { 65class IManagerForApplication final : public ServiceFramework<IManagerForApplication> {
@@ -95,25 +102,29 @@ void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) {
95 102
96void Module::Interface::ListAllUsers(Kernel::HLERequestContext& ctx) { 103void Module::Interface::ListAllUsers(Kernel::HLERequestContext& ctx) {
97 LOG_WARNING(Service_ACC, "(STUBBED) called"); 104 LOG_WARNING(Service_ACC, "(STUBBED) called");
98 constexpr std::array<u128, 10> user_ids{DEFAULT_USER_ID}; 105 // TODO(Subv): There is only one user for now.
99 ctx.WriteBuffer(user_ids.data(), user_ids.size()); 106 const std::vector<u128> user_ids = {DEFAULT_USER_ID};
107 ctx.WriteBuffer(user_ids.data(), user_ids.size() * sizeof(u128));
100 IPC::ResponseBuilder rb{ctx, 2}; 108 IPC::ResponseBuilder rb{ctx, 2};
101 rb.Push(RESULT_SUCCESS); 109 rb.Push(RESULT_SUCCESS);
102} 110}
103 111
104void Module::Interface::ListOpenUsers(Kernel::HLERequestContext& ctx) { 112void Module::Interface::ListOpenUsers(Kernel::HLERequestContext& ctx) {
105 LOG_WARNING(Service_ACC, "(STUBBED) called"); 113 LOG_WARNING(Service_ACC, "(STUBBED) called");
106 constexpr std::array<u128, 10> user_ids{DEFAULT_USER_ID}; 114 // TODO(Subv): There is only one user for now.
107 ctx.WriteBuffer(user_ids.data(), user_ids.size()); 115 const std::vector<u128> user_ids = {DEFAULT_USER_ID};
116 ctx.WriteBuffer(user_ids.data(), user_ids.size() * sizeof(u128));
108 IPC::ResponseBuilder rb{ctx, 2}; 117 IPC::ResponseBuilder rb{ctx, 2};
109 rb.Push(RESULT_SUCCESS); 118 rb.Push(RESULT_SUCCESS);
110} 119}
111 120
112void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) { 121void Module::Interface::GetProfile(Kernel::HLERequestContext& ctx) {
122 IPC::RequestParser rp{ctx};
123 u128 user_id = rp.PopRaw<u128>();
113 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 124 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
114 rb.Push(RESULT_SUCCESS); 125 rb.Push(RESULT_SUCCESS);
115 rb.PushIpcInterface<IProfile>(); 126 rb.PushIpcInterface<IProfile>(user_id);
116 LOG_DEBUG(Service_ACC, "called"); 127 LOG_DEBUG(Service_ACC, "called user_id=0x{:016X}{:016X}", user_id[1], user_id[0]);
117} 128}
118 129
119void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) { 130void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) {
diff --git a/src/core/hle/service/acc/acc.h b/src/core/hle/service/acc/acc.h
index 58f8d260c..0a01d954c 100644
--- a/src/core/hle/service/acc/acc.h
+++ b/src/core/hle/service/acc/acc.h
@@ -12,7 +12,7 @@ class Module final {
12public: 12public:
13 class Interface : public ServiceFramework<Interface> { 13 class Interface : public ServiceFramework<Interface> {
14 public: 14 public:
15 Interface(std::shared_ptr<Module> module, const char* name); 15 explicit Interface(std::shared_ptr<Module> module, const char* name);
16 16
17 void GetUserExistence(Kernel::HLERequestContext& ctx); 17 void GetUserExistence(Kernel::HLERequestContext& ctx);
18 void ListAllUsers(Kernel::HLERequestContext& ctx); 18 void ListAllUsers(Kernel::HLERequestContext& ctx);
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h
index 1da79fd01..8f4f98346 100644
--- a/src/core/hle/service/am/am.h
+++ b/src/core/hle/service/am/am.h
@@ -72,7 +72,7 @@ public:
72 72
73class ISelfController final : public ServiceFramework<ISelfController> { 73class ISelfController final : public ServiceFramework<ISelfController> {
74public: 74public:
75 ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger); 75 explicit ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger);
76 76
77private: 77private:
78 void SetFocusHandlingMode(Kernel::HLERequestContext& ctx); 78 void SetFocusHandlingMode(Kernel::HLERequestContext& ctx);
diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp
index 180057ec2..7cebc918a 100644
--- a/src/core/hle/service/am/applet_ae.cpp
+++ b/src/core/hle/service/am/applet_ae.cpp
@@ -12,7 +12,7 @@ namespace Service::AM {
12 12
13class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> { 13class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> {
14public: 14public:
15 ILibraryAppletProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger) 15 explicit ILibraryAppletProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
16 : ServiceFramework("ILibraryAppletProxy"), nvflinger(std::move(nvflinger)) { 16 : ServiceFramework("ILibraryAppletProxy"), nvflinger(std::move(nvflinger)) {
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"}, 18 {0, &ILibraryAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
diff --git a/src/core/hle/service/am/applet_ae.h b/src/core/hle/service/am/applet_ae.h
index f3a96651e..bdc57b9bc 100644
--- a/src/core/hle/service/am/applet_ae.h
+++ b/src/core/hle/service/am/applet_ae.h
@@ -17,7 +17,7 @@ namespace AM {
17 17
18class AppletAE final : public ServiceFramework<AppletAE> { 18class AppletAE final : public ServiceFramework<AppletAE> {
19public: 19public:
20 AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger); 20 explicit AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger);
21 ~AppletAE() = default; 21 ~AppletAE() = default;
22 22
23private: 23private:
diff --git a/src/core/hle/service/am/applet_oe.cpp b/src/core/hle/service/am/applet_oe.cpp
index 278259eda..beea7d19b 100644
--- a/src/core/hle/service/am/applet_oe.cpp
+++ b/src/core/hle/service/am/applet_oe.cpp
@@ -12,7 +12,7 @@ namespace Service::AM {
12 12
13class IApplicationProxy final : public ServiceFramework<IApplicationProxy> { 13class IApplicationProxy final : public ServiceFramework<IApplicationProxy> {
14public: 14public:
15 IApplicationProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger) 15 explicit IApplicationProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
16 : ServiceFramework("IApplicationProxy"), nvflinger(std::move(nvflinger)) { 16 : ServiceFramework("IApplicationProxy"), nvflinger(std::move(nvflinger)) {
17 static const FunctionInfo functions[] = { 17 static const FunctionInfo functions[] = {
18 {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"}, 18 {0, &IApplicationProxy::GetCommonStateGetter, "GetCommonStateGetter"},
diff --git a/src/core/hle/service/am/applet_oe.h b/src/core/hle/service/am/applet_oe.h
index d2ab44c67..c52e2a322 100644
--- a/src/core/hle/service/am/applet_oe.h
+++ b/src/core/hle/service/am/applet_oe.h
@@ -17,7 +17,7 @@ namespace AM {
17 17
18class AppletOE final : public ServiceFramework<AppletOE> { 18class AppletOE final : public ServiceFramework<AppletOE> {
19public: 19public:
20 AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger); 20 explicit AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger);
21 ~AppletOE() = default; 21 ~AppletOE() = default;
22 22
23private: 23private:
diff --git a/src/core/hle/service/apm/interface.h b/src/core/hle/service/apm/interface.h
index b99dbb412..85258a666 100644
--- a/src/core/hle/service/apm/interface.h
+++ b/src/core/hle/service/apm/interface.h
@@ -10,7 +10,7 @@ namespace Service::APM {
10 10
11class APM final : public ServiceFramework<APM> { 11class APM final : public ServiceFramework<APM> {
12public: 12public:
13 APM(std::shared_ptr<Module> apm, const char* name); 13 explicit APM(std::shared_ptr<Module> apm, const char* name);
14 ~APM() = default; 14 ~APM() = default;
15 15
16private: 16private:
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index b7f591c6d..2a8b3e216 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -17,7 +17,7 @@ constexpr u64 audio_ticks{static_cast<u64>(CoreTiming::BASE_CLOCK_RATE / 200)};
17 17
18class IAudioRenderer final : public ServiceFramework<IAudioRenderer> { 18class IAudioRenderer final : public ServiceFramework<IAudioRenderer> {
19public: 19public:
20 IAudioRenderer(AudioRendererParameter audren_params) 20 explicit IAudioRenderer(AudioRendererParameter audren_params)
21 : ServiceFramework("IAudioRenderer"), worker_params(audren_params) { 21 : ServiceFramework("IAudioRenderer"), worker_params(audren_params) {
22 static const FunctionInfo functions[] = { 22 static const FunctionInfo functions[] = {
23 {0, nullptr, "GetAudioRendererSampleRate"}, 23 {0, nullptr, "GetAudioRendererSampleRate"},
@@ -176,7 +176,7 @@ private:
176 struct UpdateDataHeader { 176 struct UpdateDataHeader {
177 UpdateDataHeader() {} 177 UpdateDataHeader() {}
178 178
179 UpdateDataHeader(const AudioRendererParameter& config) { 179 explicit UpdateDataHeader(const AudioRendererParameter& config) {
180 revision = Common::MakeMagic('R', 'E', 'V', '4'); // 5.1.0 Revision 180 revision = Common::MakeMagic('R', 'E', 'V', '4'); // 5.1.0 Revision
181 behavior_size = 0xb0; 181 behavior_size = 0xb0;
182 memory_pools_size = (config.effect_count + (config.voice_count * 4)) * 0x10; 182 memory_pools_size = (config.effect_count + (config.voice_count * 4)) * 0x10;
diff --git a/src/core/hle/service/bcat/module.h b/src/core/hle/service/bcat/module.h
index 8366fb877..62f6f5f9d 100644
--- a/src/core/hle/service/bcat/module.h
+++ b/src/core/hle/service/bcat/module.h
@@ -12,7 +12,7 @@ class Module final {
12public: 12public:
13 class Interface : public ServiceFramework<Interface> { 13 class Interface : public ServiceFramework<Interface> {
14 public: 14 public:
15 Interface(std::shared_ptr<Module> module, const char* name); 15 explicit Interface(std::shared_ptr<Module> module, const char* name);
16 16
17 void CreateBcatService(Kernel::HLERequestContext& ctx); 17 void CreateBcatService(Kernel::HLERequestContext& ctx);
18 18
diff --git a/src/core/hle/service/fatal/fatal.h b/src/core/hle/service/fatal/fatal.h
index 5bd111a14..ca607e236 100644
--- a/src/core/hle/service/fatal/fatal.h
+++ b/src/core/hle/service/fatal/fatal.h
@@ -12,7 +12,7 @@ class Module final {
12public: 12public:
13 class Interface : public ServiceFramework<Interface> { 13 class Interface : public ServiceFramework<Interface> {
14 public: 14 public:
15 Interface(std::shared_ptr<Module> module, const char* name); 15 explicit Interface(std::shared_ptr<Module> module, const char* name);
16 16
17 void ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx); 17 void ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx);
18 void ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx); 18 void ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx);
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index 55282f3af..dffcdfbaf 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -193,6 +193,10 @@ ResultVal<FileSys::EntryType> VfsDirectoryServiceWrapper::GetEntryType(
193 if (dir == nullptr) 193 if (dir == nullptr)
194 return FileSys::ERROR_PATH_NOT_FOUND; 194 return FileSys::ERROR_PATH_NOT_FOUND;
195 auto filename = FileUtil::GetFilename(path); 195 auto filename = FileUtil::GetFilename(path);
196 // TODO(Subv): Some games use the '/' path, find out what this means.
197 if (filename.empty())
198 return MakeResult(FileSys::EntryType::Directory);
199
196 if (dir->GetFile(filename) != nullptr) 200 if (dir->GetFile(filename) != nullptr)
197 return MakeResult(FileSys::EntryType::File); 201 return MakeResult(FileSys::EntryType::File);
198 if (dir->GetSubdirectory(filename) != nullptr) 202 if (dir->GetSubdirectory(filename) != nullptr)
diff --git a/src/core/hle/service/friend/friend.h b/src/core/hle/service/friend/friend.h
index 4b72115c0..c1b36518a 100644
--- a/src/core/hle/service/friend/friend.h
+++ b/src/core/hle/service/friend/friend.h
@@ -12,7 +12,7 @@ class Module final {
12public: 12public:
13 class Interface : public ServiceFramework<Interface> { 13 class Interface : public ServiceFramework<Interface> {
14 public: 14 public:
15 Interface(std::shared_ptr<Module> module, const char* name); 15 explicit Interface(std::shared_ptr<Module> module, const char* name);
16 16
17 void CreateFriendService(Kernel::HLERequestContext& ctx); 17 void CreateFriendService(Kernel::HLERequestContext& ctx);
18 18
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 4f18c0fd3..475a0a5cf 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -85,8 +85,7 @@ private:
85 controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE; 85 controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE;
86 86
87 for (size_t controller = 0; controller < mem.controllers.size(); controller++) { 87 for (size_t controller = 0; controller < mem.controllers.size(); controller++) {
88 for (int index = 0; index < HID_NUM_LAYOUTS; index++) { 88 for (auto& layout : mem.controllers[controller].layouts) {
89 ControllerLayout& layout = mem.controllers[controller].layouts[index];
90 layout.header.num_entries = HID_NUM_ENTRIES; 89 layout.header.num_entries = HID_NUM_ENTRIES;
91 layout.header.max_entry_index = HID_NUM_ENTRIES - 1; 90 layout.header.max_entry_index = HID_NUM_ENTRIES - 1;
92 91
@@ -213,8 +212,7 @@ private:
213 keyboard.entries[curr_keyboard_entry].timestamp_2 = keyboard_sample_counter; 212 keyboard.entries[curr_keyboard_entry].timestamp_2 = keyboard_sample_counter;
214 213
215 // TODO(shinyquagsire23): Figure out what any of these are 214 // TODO(shinyquagsire23): Figure out what any of these are
216 for (size_t i = 0; i < mem.unk_input_1.size(); i++) { 215 for (auto& input : mem.unk_input_1) {
217 UnkInput1& input = mem.unk_input_1[i];
218 const u64 last_input_entry = input.header.latest_entry; 216 const u64 last_input_entry = input.header.latest_entry;
219 const u64 curr_input_entry = (input.header.latest_entry + 1) % input.entries.size(); 217 const u64 curr_input_entry = (input.header.latest_entry + 1) % input.entries.size();
220 const u64 input_sample_counter = input.entries[last_input_entry].timestamp + 1; 218 const u64 input_sample_counter = input.entries[last_input_entry].timestamp + 1;
@@ -228,9 +226,7 @@ private:
228 input.entries[curr_input_entry].timestamp_2 = input_sample_counter; 226 input.entries[curr_input_entry].timestamp_2 = input_sample_counter;
229 } 227 }
230 228
231 for (size_t i = 0; i < mem.unk_input_2.size(); i++) { 229 for (auto& input : mem.unk_input_2) {
232 UnkInput2& input = mem.unk_input_2[i];
233
234 input.header.timestamp_ticks = timestamp; 230 input.header.timestamp_ticks = timestamp;
235 input.header.num_entries = 17; 231 input.header.num_entries = 17;
236 input.header.latest_entry = 0; 232 input.header.latest_entry = 0;
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index b499308d6..e298f23a6 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -380,7 +380,7 @@ static_assert(sizeof(ControllerLayout) == 0x350,
380 380
381struct Controller { 381struct Controller {
382 ControllerHeader header; 382 ControllerHeader header;
383 std::array<ControllerLayout, 7> layouts; 383 std::array<ControllerLayout, HID_NUM_LAYOUTS> layouts;
384 std::array<u8, 0x2a70> unk_1; 384 std::array<u8, 0x2a70> unk_1;
385 ControllerMAC mac_left; 385 ControllerMAC mac_left;
386 ControllerMAC mac_right; 386 ControllerMAC mac_right;
diff --git a/src/core/hle/service/nfp/nfp.h b/src/core/hle/service/nfp/nfp.h
index 262a666cb..0cd7be3d5 100644
--- a/src/core/hle/service/nfp/nfp.h
+++ b/src/core/hle/service/nfp/nfp.h
@@ -12,7 +12,7 @@ class Module final {
12public: 12public:
13 class Interface : public ServiceFramework<Interface> { 13 class Interface : public ServiceFramework<Interface> {
14 public: 14 public:
15 Interface(std::shared_ptr<Module> module, const char* name); 15 explicit Interface(std::shared_ptr<Module> module, const char* name);
16 16
17 void CreateUserInterface(Kernel::HLERequestContext& ctx); 17 void CreateUserInterface(Kernel::HLERequestContext& ctx);
18 18
diff --git a/src/core/hle/service/nifm/nifm.h b/src/core/hle/service/nifm/nifm.h
index 4ad3f3bcf..11f1b5831 100644
--- a/src/core/hle/service/nifm/nifm.h
+++ b/src/core/hle/service/nifm/nifm.h
@@ -12,7 +12,7 @@ class Module final {
12public: 12public:
13 class Interface : public ServiceFramework<Interface> { 13 class Interface : public ServiceFramework<Interface> {
14 public: 14 public:
15 Interface(std::shared_ptr<Module> module, const char* name); 15 explicit Interface(std::shared_ptr<Module> module, const char* name);
16 16
17 void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx); 17 void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx);
18 void CreateGeneralService(Kernel::HLERequestContext& ctx); 18 void CreateGeneralService(Kernel::HLERequestContext& ctx);
diff --git a/src/core/hle/service/ns/pl_u.cpp b/src/core/hle/service/ns/pl_u.cpp
index 9b6f400e9..d4e0f615a 100644
--- a/src/core/hle/service/ns/pl_u.cpp
+++ b/src/core/hle/service/ns/pl_u.cpp
@@ -119,7 +119,7 @@ void PL_U::GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx) {
119void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) { 119void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) {
120 IPC::RequestParser rp{ctx}; 120 IPC::RequestParser rp{ctx};
121 const u64 language_code{rp.Pop<u64>()}; // TODO(ogniK): Find out what this is used for 121 const u64 language_code{rp.Pop<u64>()}; // TODO(ogniK): Find out what this is used for
122 LOG_DEBUG(Service_NS, "called, language_code=%lx", language_code); 122 LOG_DEBUG(Service_NS, "called, language_code={:X}", language_code);
123 IPC::ResponseBuilder rb{ctx, 4}; 123 IPC::ResponseBuilder rb{ctx, 4};
124 std::vector<u32> font_codes; 124 std::vector<u32> font_codes;
125 std::vector<u32> font_offsets; 125 std::vector<u32> font_offsets;
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
index d4631a32b..6f0697b58 100644
--- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
+++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
@@ -17,7 +17,7 @@ class nvmap;
17 17
18class nvdisp_disp0 final : public nvdevice { 18class nvdisp_disp0 final : public nvdevice {
19public: 19public:
20 nvdisp_disp0(std::shared_ptr<nvmap> nvmap_dev) : nvdevice(), nvmap_dev(std::move(nvmap_dev)) {} 20 explicit nvdisp_disp0(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {}
21 ~nvdisp_disp0() = default; 21 ~nvdisp_disp0() = default;
22 22
23 u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; 23 u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
index d4c4b4db3..9f8999d9c 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h
@@ -18,7 +18,7 @@ class nvmap;
18 18
19class nvhost_as_gpu final : public nvdevice { 19class nvhost_as_gpu final : public nvdevice {
20public: 20public:
21 nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} 21 explicit nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {}
22 ~nvhost_as_gpu() override = default; 22 ~nvhost_as_gpu() override = default;
23 23
24 u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; 24 u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
index 56b5ed60d..c9f6b9b6a 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h
@@ -18,7 +18,7 @@ constexpr u32 NVGPU_IOCTL_CHANNEL_SUBMIT_GPFIFO(0x8);
18 18
19class nvhost_gpu final : public nvdevice { 19class nvhost_gpu final : public nvdevice {
20public: 20public:
21 nvhost_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} 21 explicit nvhost_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {}
22 ~nvhost_gpu() override = default; 22 ~nvhost_gpu() override = default;
23 23
24 u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override; 24 u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index 579940817..35b2c65fc 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -30,7 +30,7 @@ public:
30 30
31 /// Returns a pointer to one of the available devices, identified by its name. 31 /// Returns a pointer to one of the available devices, identified by its name.
32 template <typename T> 32 template <typename T>
33 std::shared_ptr<T> GetDevice(std::string name) { 33 std::shared_ptr<T> GetDevice(const std::string& name) {
34 auto itr = devices.find(name); 34 auto itr = devices.find(name);
35 if (itr == devices.end()) 35 if (itr == devices.end())
36 return nullptr; 36 return nullptr;
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index d580f779e..1fca1743d 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -23,15 +23,10 @@ constexpr u64 frame_ticks = static_cast<u64>(CoreTiming::BASE_CLOCK_RATE / SCREE
23 23
24NVFlinger::NVFlinger() { 24NVFlinger::NVFlinger() {
25 // Add the different displays to the list of displays. 25 // Add the different displays to the list of displays.
26 Display default_{0, "Default"}; 26 displays.emplace_back(0, "Default");
27 Display external{1, "External"}; 27 displays.emplace_back(1, "External");
28 Display edid{2, "Edid"}; 28 displays.emplace_back(2, "Edid");
29 Display internal{3, "Internal"}; 29 displays.emplace_back(3, "Internal");
30
31 displays.emplace_back(default_);
32 displays.emplace_back(external);
33 displays.emplace_back(edid);
34 displays.emplace_back(internal);
35 30
36 // Schedule the screen composition events 31 // Schedule the screen composition events
37 composition_event = 32 composition_event =
diff --git a/src/core/hle/service/pctl/module.h b/src/core/hle/service/pctl/module.h
index 68da628a8..e7d492760 100644
--- a/src/core/hle/service/pctl/module.h
+++ b/src/core/hle/service/pctl/module.h
@@ -12,7 +12,7 @@ class Module final {
12public: 12public:
13 class Interface : public ServiceFramework<Interface> { 13 class Interface : public ServiceFramework<Interface> {
14 public: 14 public:
15 Interface(std::shared_ptr<Module> module, const char* name); 15 explicit Interface(std::shared_ptr<Module> module, const char* name);
16 16
17 void CreateService(Kernel::HLERequestContext& ctx); 17 void CreateService(Kernel::HLERequestContext& ctx);
18 void CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx); 18 void CreateServiceWithoutInitialize(Kernel::HLERequestContext& ctx);
diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h
index 13f5c4c28..e2a00e4f6 100644
--- a/src/core/hle/service/sm/sm.h
+++ b/src/core/hle/service/sm/sm.h
@@ -22,7 +22,7 @@ namespace Service::SM {
22/// Interface to "sm:" service 22/// Interface to "sm:" service
23class SM final : public ServiceFramework<SM> { 23class SM final : public ServiceFramework<SM> {
24public: 24public:
25 SM(std::shared_ptr<ServiceManager> service_manager); 25 explicit SM(std::shared_ptr<ServiceManager> service_manager);
26 ~SM() override; 26 ~SM() override;
27 27
28private: 28private:
diff --git a/src/core/hle/service/spl/module.h b/src/core/hle/service/spl/module.h
index 6ab91b400..f24d998e8 100644
--- a/src/core/hle/service/spl/module.h
+++ b/src/core/hle/service/spl/module.h
@@ -12,7 +12,7 @@ class Module final {
12public: 12public:
13 class Interface : public ServiceFramework<Interface> { 13 class Interface : public ServiceFramework<Interface> {
14 public: 14 public:
15 Interface(std::shared_ptr<Module> module, const char* name); 15 explicit Interface(std::shared_ptr<Module> module, const char* name);
16 16
17 void GetRandomBytes(Kernel::HLERequestContext& ctx); 17 void GetRandomBytes(Kernel::HLERequestContext& ctx);
18 18
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h
index 49af38589..8dde28a94 100644
--- a/src/core/hle/service/time/time.h
+++ b/src/core/hle/service/time/time.h
@@ -57,7 +57,7 @@ class Module final {
57public: 57public:
58 class Interface : public ServiceFramework<Interface> { 58 class Interface : public ServiceFramework<Interface> {
59 public: 59 public:
60 Interface(std::shared_ptr<Module> time, const char* name); 60 explicit Interface(std::shared_ptr<Module> time, const char* name);
61 61
62 void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx); 62 void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx);
63 void GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx); 63 void GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx);
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index eccee6e33..3a69b85f9 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -579,7 +579,7 @@ private:
579 579
580class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> { 580class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> {
581public: 581public:
582 ISystemDisplayService() : ServiceFramework("ISystemDisplayService") { 582 explicit ISystemDisplayService() : ServiceFramework("ISystemDisplayService") {
583 static const FunctionInfo functions[] = { 583 static const FunctionInfo functions[] = {
584 {1200, nullptr, "GetZOrderCountMin"}, 584 {1200, nullptr, "GetZOrderCountMin"},
585 {1202, nullptr, "GetZOrderCountMax"}, 585 {1202, nullptr, "GetZOrderCountMax"},
@@ -777,7 +777,7 @@ private:
777 777
778class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> { 778class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> {
779public: 779public:
780 IApplicationDisplayService(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger); 780 explicit IApplicationDisplayService(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger);
781 ~IApplicationDisplayService() = default; 781 ~IApplicationDisplayService() = default;
782 782
783private: 783private:
diff --git a/src/core/hle/service/vi/vi.h b/src/core/hle/service/vi/vi.h
index e8bda01d7..92f5b6059 100644
--- a/src/core/hle/service/vi/vi.h
+++ b/src/core/hle/service/vi/vi.h
@@ -24,8 +24,8 @@ class Module final {
24public: 24public:
25 class Interface : public ServiceFramework<Interface> { 25 class Interface : public ServiceFramework<Interface> {
26 public: 26 public:
27 Interface(std::shared_ptr<Module> module, const char* name, 27 explicit Interface(std::shared_ptr<Module> module, const char* name,
28 std::shared_ptr<NVFlinger::NVFlinger> nv_flinger); 28 std::shared_ptr<NVFlinger::NVFlinger> nv_flinger);
29 29
30 void GetDisplayService(Kernel::HLERequestContext& ctx); 30 void GetDisplayService(Kernel::HLERequestContext& ctx);
31 31
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index 1574345a1..e70f37677 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -87,8 +87,8 @@ const char* GetFileTypeString(FileType type) {
87 * Get a loader for a file with a specific type 87 * Get a loader for a file with a specific type
88 * @param file The file to load 88 * @param file The file to load
89 * @param type The type of the file 89 * @param type The type of the file
90 * @param filename the file name (without path) 90 * @param file the file to retrieve the loader for
91 * @param filepath the file full path (with name) 91 * @param type the file type
92 * @return std::unique_ptr<AppLoader> a pointer to a loader object; nullptr for unsupported type 92 * @return std::unique_ptr<AppLoader> a pointer to a loader object; nullptr for unsupported type
93 */ 93 */
94static std::unique_ptr<AppLoader> GetFileLoader(FileSys::VirtualFile file, FileType type) { 94static std::unique_ptr<AppLoader> GetFileLoader(FileSys::VirtualFile file, FileType type) {
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index 1da9e8099..6f517ca8c 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -154,7 +154,7 @@ public:
154 /** 154 /**
155 * Get the RomFS of the application 155 * Get the RomFS of the application
156 * Since the RomFS can be huge, we return a file reference instead of copying to a buffer 156 * Since the RomFS can be huge, we return a file reference instead of copying to a buffer
157 * @param file The file containing the RomFS 157 * @param dir The directory containing the RomFS
158 * @return ResultStatus result of function 158 * @return ResultStatus result of function
159 */ 159 */
160 virtual ResultStatus ReadRomFS(FileSys::VirtualFile& dir) { 160 virtual ResultStatus ReadRomFS(FileSys::VirtualFile& dir) {
@@ -193,8 +193,8 @@ extern const std::initializer_list<Kernel::AddressMapping> default_address_mappi
193 193
194/** 194/**
195 * Identifies a bootable file and return a suitable loader 195 * Identifies a bootable file and return a suitable loader
196 * @param filename String filename of bootable file 196 * @param file The bootable file
197 * @return best loader for this file 197 * @return the best loader for this file
198 */ 198 */
199std::unique_ptr<AppLoader> GetLoader(FileSys::VirtualFile file); 199std::unique_ptr<AppLoader> GetLoader(FileSys::VirtualFile file);
200 200
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index f7752e0e3..c66561bf4 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -55,13 +55,15 @@ AppLoader_NSO::AppLoader_NSO(FileSys::VirtualFile file) : AppLoader(std::move(fi
55 55
56FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& file) { 56FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& file) {
57 u32 magic = 0; 57 u32 magic = 0;
58 file->ReadObject(&magic); 58 if (file->ReadObject(&magic) != sizeof(magic)) {
59 return FileType::Error;
60 }
59 61
60 if (Common::MakeMagic('N', 'S', 'O', '0') == magic) { 62 if (Common::MakeMagic('N', 'S', 'O', '0') != magic) {
61 return FileType::NSO; 63 return FileType::Error;
62 } 64 }
63 65
64 return FileType::Error; 66 return FileType::NSO;
65} 67}
66 68
67static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data, 69static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data,