diff options
Diffstat (limited to '')
33 files changed, 63 insertions, 67 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) { for (u32 core = 0; core < Core::NUM_CPU_CORES; core++) { const auto& threads = Core::System::GetInstance().Scheduler(core)->GetThreadList(); for (auto& thread : threads) { - if (thread->GetThreadId() == id) { + if (thread->GetThreadId() == static_cast<u32>(id)) { current_core = core; return thread.get(); } @@ -214,7 +214,7 @@ static Kernel::Thread* FindThreadById(int id) { return nullptr; } -static u64 RegRead(int id, Kernel::Thread* thread = nullptr) { +static u64 RegRead(std::size_t id, Kernel::Thread* thread = nullptr) { if (!thread) { return 0; } @@ -234,7 +234,7 @@ static u64 RegRead(int id, Kernel::Thread* thread = nullptr) { } } -static void RegWrite(int id, u64 val, Kernel::Thread* thread = nullptr) { +static void RegWrite(std::size_t id, u64 val, Kernel::Thread* thread = nullptr) { if (!thread) { return; } @@ -744,7 +744,7 @@ static bool IsDataAvailable() { fd_set fd_socket; FD_ZERO(&fd_socket); - FD_SET(gdbserver_socket, &fd_socket); + FD_SET(static_cast<u32>(gdbserver_socket), &fd_socket); struct timeval t; t.tv_sec = 0; @@ -793,7 +793,7 @@ static void ReadRegisters() { u8* bufptr = buffer; - for (int reg = 0; reg <= SP_REGISTER; reg++) { + for (u32 reg = 0; reg <= SP_REGISTER; reg++) { LongToGdbHex(bufptr + reg * 16, RegRead(reg, current_thread)); } @@ -807,7 +807,7 @@ static void ReadRegisters() { bufptr += 8; - for (int reg = UC_ARM64_REG_Q0; reg <= UC_ARM64_REG_Q0 + 31; reg++) { + for (u32 reg = UC_ARM64_REG_Q0; reg <= UC_ARM64_REG_Q0 + 31; reg++) { LongToGdbHex(bufptr + reg * 16, RegRead(reg, current_thread)); } @@ -858,7 +858,7 @@ static void WriteRegisters() { if (command_buffer[0] != 'G') return SendReply("E01"); - for (int i = 0, reg = 0; reg <= FPSCR_REGISTER; i++, reg++) { + for (u32 i = 0, reg = 0; reg <= FPSCR_REGISTER; i++, reg++) { if (reg <= SP_REGISTER) { RegWrite(reg, GdbHexToLong(buffer_ptr + i * 16), current_thread); } 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) { return ERR_INVALID_HANDLE; } - if (core == THREADPROCESSORID_DEFAULT) { - ASSERT(thread->owner_process->ideal_processor != THREADPROCESSORID_DEFAULT); + if (core == static_cast<u32>(THREADPROCESSORID_DEFAULT)) { + ASSERT(thread->owner_process->ideal_processor != + static_cast<u8>(THREADPROCESSORID_DEFAULT)); // Set the target CPU to the one specified in the process' exheader. core = thread->owner_process->ideal_processor; mask = 1ull << core; @@ -811,7 +812,7 @@ static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) { if (core == OnlyChangeMask) { core = thread->ideal_core; - } else if (core >= Core::NUM_CPU_CORES && core != -1) { + } else if (core >= Core::NUM_CPU_CORES && core != static_cast<u32>(-1)) { return ResultCode(ErrorModule::Kernel, ErrCodes::InvalidProcessorId); } diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 1a32faf0f..8ee39b54c 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -102,16 +102,18 @@ void Module::Interface::GetUserExistence(Kernel::HLERequestContext& ctx) { void Module::Interface::ListAllUsers(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_ACC, "(STUBBED) called"); - constexpr std::array<u128, 10> user_ids{DEFAULT_USER_ID}; - ctx.WriteBuffer(user_ids.data(), user_ids.size()); + // TODO(Subv): There is only one user for now. + const std::vector<u128> user_ids = {DEFAULT_USER_ID}; + ctx.WriteBuffer(user_ids.data(), user_ids.size() * sizeof(u128)); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } void Module::Interface::ListOpenUsers(Kernel::HLERequestContext& ctx) { LOG_WARNING(Service_ACC, "(STUBBED) called"); - constexpr std::array<u128, 10> user_ids{DEFAULT_USER_ID}; - ctx.WriteBuffer(user_ids.data(), user_ids.size()); + // TODO(Subv): There is only one user for now. + const std::vector<u128> user_ids = {DEFAULT_USER_ID}; + ctx.WriteBuffer(user_ids.data(), user_ids.size() * sizeof(u128)); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); } 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 { public: class Interface : public ServiceFramework<Interface> { public: - Interface(std::shared_ptr<Module> module, const char* name); + explicit Interface(std::shared_ptr<Module> module, const char* name); void GetUserExistence(Kernel::HLERequestContext& ctx); 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: class ISelfController final : public ServiceFramework<ISelfController> { public: - ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger); + explicit ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger); private: 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 { class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> { public: - ILibraryAppletProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger) + explicit ILibraryAppletProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger) : ServiceFramework("ILibraryAppletProxy"), nvflinger(std::move(nvflinger)) { static const FunctionInfo functions[] = { {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 { class AppletAE final : public ServiceFramework<AppletAE> { public: - AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger); + explicit AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger); ~AppletAE() = default; private: 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 { class IApplicationProxy final : public ServiceFramework<IApplicationProxy> { public: - IApplicationProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger) + explicit IApplicationProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger) : ServiceFramework("IApplicationProxy"), nvflinger(std::move(nvflinger)) { static const FunctionInfo functions[] = { {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 { class AppletOE final : public ServiceFramework<AppletOE> { public: - AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger); + explicit AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger); ~AppletOE() = default; private: 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 { class APM final : public ServiceFramework<APM> { public: - APM(std::shared_ptr<Module> apm, const char* name); + explicit APM(std::shared_ptr<Module> apm, const char* name); ~APM() = default; private: 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)}; class IAudioRenderer final : public ServiceFramework<IAudioRenderer> { public: - IAudioRenderer(AudioRendererParameter audren_params) + explicit IAudioRenderer(AudioRendererParameter audren_params) : ServiceFramework("IAudioRenderer"), worker_params(audren_params) { static const FunctionInfo functions[] = { {0, nullptr, "GetAudioRendererSampleRate"}, @@ -176,7 +176,7 @@ private: struct UpdateDataHeader { UpdateDataHeader() {} - UpdateDataHeader(const AudioRendererParameter& config) { + explicit UpdateDataHeader(const AudioRendererParameter& config) { revision = Common::MakeMagic('R', 'E', 'V', '4'); // 5.1.0 Revision behavior_size = 0xb0; 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 { public: class Interface : public ServiceFramework<Interface> { public: - Interface(std::shared_ptr<Module> module, const char* name); + explicit Interface(std::shared_ptr<Module> module, const char* name); void CreateBcatService(Kernel::HLERequestContext& ctx); 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 { public: class Interface : public ServiceFramework<Interface> { public: - Interface(std::shared_ptr<Module> module, const char* name); + explicit Interface(std::shared_ptr<Module> module, const char* name); void ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx); void ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx); 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 { public: class Interface : public ServiceFramework<Interface> { public: - Interface(std::shared_ptr<Module> module, const char* name); + explicit Interface(std::shared_ptr<Module> module, const char* name); void CreateFriendService(Kernel::HLERequestContext& ctx); 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: controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE; for (size_t controller = 0; controller < mem.controllers.size(); controller++) { - for (int index = 0; index < HID_NUM_LAYOUTS; index++) { - ControllerLayout& layout = mem.controllers[controller].layouts[index]; + for (auto& layout : mem.controllers[controller].layouts) { layout.header.num_entries = HID_NUM_ENTRIES; layout.header.max_entry_index = HID_NUM_ENTRIES - 1; @@ -213,8 +212,7 @@ private: keyboard.entries[curr_keyboard_entry].timestamp_2 = keyboard_sample_counter; // TODO(shinyquagsire23): Figure out what any of these are - for (size_t i = 0; i < mem.unk_input_1.size(); i++) { - UnkInput1& input = mem.unk_input_1[i]; + for (auto& input : mem.unk_input_1) { const u64 last_input_entry = input.header.latest_entry; const u64 curr_input_entry = (input.header.latest_entry + 1) % input.entries.size(); const u64 input_sample_counter = input.entries[last_input_entry].timestamp + 1; @@ -228,9 +226,7 @@ private: input.entries[curr_input_entry].timestamp_2 = input_sample_counter; } - for (size_t i = 0; i < mem.unk_input_2.size(); i++) { - UnkInput2& input = mem.unk_input_2[i]; - + for (auto& input : mem.unk_input_2) { input.header.timestamp_ticks = timestamp; input.header.num_entries = 17; 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, struct Controller { ControllerHeader header; - std::array<ControllerLayout, 7> layouts; + std::array<ControllerLayout, HID_NUM_LAYOUTS> layouts; std::array<u8, 0x2a70> unk_1; ControllerMAC mac_left; 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 { public: class Interface : public ServiceFramework<Interface> { public: - Interface(std::shared_ptr<Module> module, const char* name); + explicit Interface(std::shared_ptr<Module> module, const char* name); void CreateUserInterface(Kernel::HLERequestContext& ctx); 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 { public: class Interface : public ServiceFramework<Interface> { public: - Interface(std::shared_ptr<Module> module, const char* name); + explicit Interface(std::shared_ptr<Module> module, const char* name); void CreateGeneralServiceOld(Kernel::HLERequestContext& ctx); 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 d6a12ede5..addf1087c 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) { void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 language_code{rp.Pop<u64>()}; // TODO(ogniK): Find out what this is used for - LOG_DEBUG(Service_NS, "called, language_code=%lx", language_code); + LOG_DEBUG(Service_NS, "called, language_code={:X}", language_code); IPC::ResponseBuilder rb{ctx, 4}; std::vector<u32> font_codes; 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; class nvdisp_disp0 final : public nvdevice { public: - nvdisp_disp0(std::shared_ptr<nvmap> nvmap_dev) : nvdevice(), nvmap_dev(std::move(nvmap_dev)) {} + explicit nvdisp_disp0(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} ~nvdisp_disp0() = default; 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; class nvhost_as_gpu final : public nvdevice { public: - nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} + explicit nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} ~nvhost_as_gpu() override = default; 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); class nvhost_gpu final : public nvdevice { public: - nvhost_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} + explicit nvhost_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {} ~nvhost_gpu() override = default; 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: /// Returns a pointer to one of the available devices, identified by its name. template <typename T> - std::shared_ptr<T> GetDevice(std::string name) { + std::shared_ptr<T> GetDevice(const std::string& name) { auto itr = devices.find(name); if (itr == devices.end()) 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 NVFlinger::NVFlinger() { // Add the different displays to the list of displays. - Display default_{0, "Default"}; - Display external{1, "External"}; - Display edid{2, "Edid"}; - Display internal{3, "Internal"}; - - displays.emplace_back(default_); - displays.emplace_back(external); - displays.emplace_back(edid); - displays.emplace_back(internal); + displays.emplace_back(0, "Default"); + displays.emplace_back(1, "External"); + displays.emplace_back(2, "Edid"); + displays.emplace_back(3, "Internal"); // Schedule the screen composition events 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 { public: class Interface : public ServiceFramework<Interface> { public: - Interface(std::shared_ptr<Module> module, const char* name); + explicit Interface(std::shared_ptr<Module> module, const char* name); void CreateService(Kernel::HLERequestContext& ctx); 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 { /// Interface to "sm:" service class SM final : public ServiceFramework<SM> { public: - SM(std::shared_ptr<ServiceManager> service_manager); + explicit SM(std::shared_ptr<ServiceManager> service_manager); ~SM() override; private: 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 { public: class Interface : public ServiceFramework<Interface> { public: - Interface(std::shared_ptr<Module> module, const char* name); + explicit Interface(std::shared_ptr<Module> module, const char* name); void GetRandomBytes(Kernel::HLERequestContext& ctx); 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 { public: class Interface : public ServiceFramework<Interface> { public: - Interface(std::shared_ptr<Module> time, const char* name); + explicit Interface(std::shared_ptr<Module> time, const char* name); void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx); 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: class ISystemDisplayService final : public ServiceFramework<ISystemDisplayService> { public: - ISystemDisplayService() : ServiceFramework("ISystemDisplayService") { + explicit ISystemDisplayService() : ServiceFramework("ISystemDisplayService") { static const FunctionInfo functions[] = { {1200, nullptr, "GetZOrderCountMin"}, {1202, nullptr, "GetZOrderCountMax"}, @@ -777,7 +777,7 @@ private: class IApplicationDisplayService final : public ServiceFramework<IApplicationDisplayService> { public: - IApplicationDisplayService(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger); + explicit IApplicationDisplayService(std::shared_ptr<NVFlinger::NVFlinger> nv_flinger); ~IApplicationDisplayService() = default; private: 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 { public: class Interface : public ServiceFramework<Interface> { public: - Interface(std::shared_ptr<Module> module, const char* name, - std::shared_ptr<NVFlinger::NVFlinger> nv_flinger); + explicit Interface(std::shared_ptr<Module> module, const char* name, + std::shared_ptr<NVFlinger::NVFlinger> nv_flinger); void GetDisplayService(Kernel::HLERequestContext& ctx); 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) { * Get a loader for a file with a specific type * @param file The file to load * @param type The type of the file - * @param filename the file name (without path) - * @param filepath the file full path (with name) + * @param file the file to retrieve the loader for + * @param type the file type * @return std::unique_ptr<AppLoader> a pointer to a loader object; nullptr for unsupported type */ static 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: /** * Get the RomFS of the application * Since the RomFS can be huge, we return a file reference instead of copying to a buffer - * @param file The file containing the RomFS + * @param dir The directory containing the RomFS * @return ResultStatus result of function */ virtual ResultStatus ReadRomFS(FileSys::VirtualFile& dir) { @@ -193,8 +193,8 @@ extern const std::initializer_list<Kernel::AddressMapping> default_address_mappi /** * Identifies a bootable file and return a suitable loader - * @param filename String filename of bootable file - * @return best loader for this file + * @param file The bootable file + * @return the best loader for this file */ std::unique_ptr<AppLoader> GetLoader(FileSys::VirtualFile file); 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 FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& file) { u32 magic = 0; - file->ReadObject(&magic); + if (file->ReadObject(&magic) != sizeof(magic)) { + return FileType::Error; + } - if (Common::MakeMagic('N', 'S', 'O', '0') == magic) { - return FileType::NSO; + if (Common::MakeMagic('N', 'S', 'O', '0') != magic) { + return FileType::Error; } - return FileType::Error; + return FileType::NSO; } static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data, |