hle/service: Default constructors and destructors in the cpp file where applicable

When a destructor isn't defaulted into a cpp file, it can cause the use
of forward declarations to seemingly fail to compile for non-obvious
reasons. It also allows inlining of the construction/destruction logic
all over the place where a constructor or destructor is invoked, which
can lead to code bloat. This isn't so much a worry here, given the
services won't be created and destroyed frequently.

The cause of the above mentioned non-obvious errors can be demonstrated
as follows:

------- Demonstrative example, if you know how the described error happens, skip forwards -------

Assume we have the following in the header, which we'll call "thing.h":

\#include <memory>

// Forward declaration. For example purposes, assume the definition
// of Object is in some header named "object.h"
class Object;

class Thing {
public:
    // assume no constructors or destructors are specified here,
    // or the constructors/destructors are defined as:
    //
    // Thing() = default;
    // ~Thing() = default;
    //

    // ... Some interface member functions would be defined here

private:
    std::shared_ptr<Object> obj;
};

If this header is included in a cpp file, (which we'll call "main.cpp"),
this will result in a compilation error, because even though no
destructor is specified, the destructor will still need to be generated by
the compiler because std::shared_ptr's destructor is *not* trivial (in
other words, it does something other than nothing), as std::shared_ptr's
destructor needs to do two things:

1. Decrement the shared reference count of the object being pointed to,
   and if the reference count decrements to zero,

2. Free the Object instance's memory (aka deallocate the memory it's
   pointing to).

And so the compiler generates the code for the destructor doing this inside main.cpp.

Now, keep in mind, the Object forward declaration is not a complete type. All it
does is tell the compiler "a type named Object exists" and allows us to
use the name in certain situations to avoid a header dependency. So the
compiler needs to generate destruction code for Object, but the compiler
doesn't know *how* to destruct it. A forward declaration doesn't tell
the compiler anything about Object's constructor or destructor. So, the
compiler will issue an error in this case because it's undefined
behavior to try and deallocate (or construct) an incomplete type and
std::shared_ptr and std::unique_ptr make sure this isn't the case
internally.

Now, if we had defaulted the destructor in "thing.cpp", where we also
include "object.h", this would never be an issue, as the destructor
would only have its code generated in one place, and it would be in a
place where the full class definition of Object would be visible to the
compiler.

---------------------- End example ----------------------------

Given these service classes are more than certainly going to change in
the future, this defaults the constructors and destructors into the
relevant cpp files to make the construction and destruction of all of
the services consistent and unlikely to run into cases where forward
declarations are indirectly causing compilation errors. It also has the
plus of avoiding the need to rebuild several services if destruction
logic changes, since it would only be necessary to recompile the single
cpp file.
This commit is contained in:
Lioncash 2018-09-10 21:20:52 -04:00
parent 3bac3051fc
commit 6ac955a0b4
148 changed files with 291 additions and 45 deletions

View file

@ -18,4 +18,6 @@ ACC_AA::ACC_AA(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
RegisterHandlers(functions);
}
ACC_AA::~ACC_AA() = default;
} // namespace Service::Account

View file

@ -12,6 +12,7 @@ class ACC_AA final : public Module::Interface {
public:
explicit ACC_AA(std::shared_ptr<Module> module,
std::shared_ptr<ProfileManager> profile_manager);
~ACC_AA() override;
};
} // namespace Service::Account

View file

@ -51,4 +51,6 @@ ACC_SU::ACC_SU(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
RegisterHandlers(functions);
}
ACC_SU::~ACC_SU() = default;
} // namespace Service::Account

View file

@ -13,6 +13,7 @@ class ACC_SU final : public Module::Interface {
public:
explicit ACC_SU(std::shared_ptr<Module> module,
std::shared_ptr<ProfileManager> profile_manager);
~ACC_SU() override;
};
} // namespace Account

View file

@ -31,4 +31,6 @@ ACC_U0::ACC_U0(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
RegisterHandlers(functions);
}
ACC_U0::~ACC_U0() = default;
} // namespace Service::Account

View file

@ -12,6 +12,7 @@ class ACC_U0 final : public Module::Interface {
public:
explicit ACC_U0(std::shared_ptr<Module> module,
std::shared_ptr<ProfileManager> profile_manager);
~ACC_U0() override;
};
} // namespace Service::Account

View file

@ -38,4 +38,6 @@ ACC_U1::ACC_U1(std::shared_ptr<Module> module, std::shared_ptr<ProfileManager> p
RegisterHandlers(functions);
}
ACC_U1::~ACC_U1() = default;
} // namespace Service::Account

View file

@ -12,6 +12,7 @@ class ACC_U1 final : public Module::Interface {
public:
explicit ACC_U1(std::shared_ptr<Module> module,
std::shared_ptr<ProfileManager> profile_manager);
~ACC_U1() override;
};
} // namespace Service::Account

View file

@ -29,6 +29,8 @@ ProfileManager::ProfileManager() {
OpenUser(user_uuid);
}
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) {

View file

@ -82,6 +82,8 @@ static_assert(sizeof(ProfileBase) == 0x38, "ProfileBase is an invalid size");
class ProfileManager {
public:
ProfileManager(); // TODO(ogniK): Load from system save
~ProfileManager();
ResultCode AddUser(const ProfileInfo& user);
ResultCode CreateNewUser(UUID uuid, const ProfileUsername& username);
ResultCode CreateNewUser(UUID uuid, const std::string& username);

View file

@ -35,6 +35,8 @@ IWindowController::IWindowController() : ServiceFramework("IWindowController") {
RegisterHandlers(functions);
}
IWindowController::~IWindowController() = default;
void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 4};
@ -61,6 +63,8 @@ IAudioController::IAudioController() : ServiceFramework("IAudioController") {
RegisterHandlers(functions);
}
IAudioController::~IAudioController() = default;
void IAudioController::SetExpectedMasterVolume(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_AM, "(STUBBED) called");
IPC::ResponseBuilder rb{ctx, 2};
@ -116,7 +120,10 @@ IDisplayController::IDisplayController() : ServiceFramework("IDisplayController"
RegisterHandlers(functions);
}
IDisplayController::~IDisplayController() = default;
IDebugFunctions::IDebugFunctions() : ServiceFramework("IDebugFunctions") {}
IDebugFunctions::~IDebugFunctions() = default;
ISelfController::ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
: ServiceFramework("ISelfController"), nvflinger(std::move(nvflinger)) {
@ -165,6 +172,8 @@ ISelfController::ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger
Kernel::Event::Create(kernel, Kernel::ResetType::Sticky, "ISelfController:LaunchableEvent");
}
ISelfController::~ISelfController() = default;
void ISelfController::SetFocusHandlingMode(Kernel::HLERequestContext& ctx) {
// Takes 3 input u8s with each field located immediately after the previous u8, these are
// bool flags. No output.
@ -337,6 +346,8 @@ ICommonStateGetter::ICommonStateGetter() : ServiceFramework("ICommonStateGetter"
event = Kernel::Event::Create(kernel, Kernel::ResetType::OneShot, "ICommonStateGetter:Event");
}
ICommonStateGetter::~ICommonStateGetter() = default;
void ICommonStateGetter::GetBootMode(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
@ -573,6 +584,8 @@ ILibraryAppletCreator::ILibraryAppletCreator() : ServiceFramework("ILibraryApple
RegisterHandlers(functions);
}
ILibraryAppletCreator::~ILibraryAppletCreator() = default;
void ILibraryAppletCreator::CreateLibraryApplet(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@ -638,6 +651,8 @@ IApplicationFunctions::IApplicationFunctions() : ServiceFramework("IApplicationF
RegisterHandlers(functions);
}
IApplicationFunctions::~IApplicationFunctions() = default;
void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
constexpr std::array<u8, 0x88> data{{
0xca, 0x97, 0x94, 0xc7, // Magic
@ -760,6 +775,8 @@ IHomeMenuFunctions::IHomeMenuFunctions() : ServiceFramework("IHomeMenuFunctions"
RegisterHandlers(functions);
}
IHomeMenuFunctions::~IHomeMenuFunctions() = default;
void IHomeMenuFunctions::RequestToGetForeground(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);
@ -783,6 +800,8 @@ IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStat
RegisterHandlers(functions);
}
IGlobalStateController::~IGlobalStateController() = default;
IApplicationCreator::IApplicationCreator() : ServiceFramework("IApplicationCreator") {
static const FunctionInfo functions[] = {
{0, nullptr, "CreateApplication"},
@ -793,6 +812,8 @@ IApplicationCreator::IApplicationCreator() : ServiceFramework("IApplicationCreat
RegisterHandlers(functions);
}
IApplicationCreator::~IApplicationCreator() = default;
IProcessWindingController::IProcessWindingController()
: ServiceFramework("IProcessWindingController") {
static const FunctionInfo functions[] = {
@ -807,4 +828,6 @@ IProcessWindingController::IProcessWindingController()
};
RegisterHandlers(functions);
}
IProcessWindingController::~IProcessWindingController() = default;
} // namespace Service::AM

View file

@ -42,6 +42,7 @@ enum SystemLanguage {
class IWindowController final : public ServiceFramework<IWindowController> {
public:
IWindowController();
~IWindowController() override;
private:
void GetAppletResourceUserId(Kernel::HLERequestContext& ctx);
@ -51,6 +52,7 @@ private:
class IAudioController final : public ServiceFramework<IAudioController> {
public:
IAudioController();
~IAudioController() override;
private:
void SetExpectedMasterVolume(Kernel::HLERequestContext& ctx);
@ -63,16 +65,19 @@ private:
class IDisplayController final : public ServiceFramework<IDisplayController> {
public:
IDisplayController();
~IDisplayController() override;
};
class IDebugFunctions final : public ServiceFramework<IDebugFunctions> {
public:
IDebugFunctions();
~IDebugFunctions() override;
};
class ISelfController final : public ServiceFramework<ISelfController> {
public:
explicit ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger);
~ISelfController() override;
private:
void SetFocusHandlingMode(Kernel::HLERequestContext& ctx);
@ -98,6 +103,7 @@ private:
class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> {
public:
ICommonStateGetter();
~ICommonStateGetter() override;
private:
enum class FocusState : u8 {
@ -124,6 +130,7 @@ private:
class ILibraryAppletCreator final : public ServiceFramework<ILibraryAppletCreator> {
public:
ILibraryAppletCreator();
~ILibraryAppletCreator() override;
private:
void CreateLibraryApplet(Kernel::HLERequestContext& ctx);
@ -133,6 +140,7 @@ private:
class IApplicationFunctions final : public ServiceFramework<IApplicationFunctions> {
public:
IApplicationFunctions();
~IApplicationFunctions() override;
private:
void PopLaunchParameter(Kernel::HLERequestContext& ctx);
@ -150,6 +158,7 @@ private:
class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> {
public:
IHomeMenuFunctions();
~IHomeMenuFunctions() override;
private:
void RequestToGetForeground(Kernel::HLERequestContext& ctx);
@ -158,16 +167,19 @@ private:
class IGlobalStateController final : public ServiceFramework<IGlobalStateController> {
public:
IGlobalStateController();
~IGlobalStateController() override;
};
class IApplicationCreator final : public ServiceFramework<IApplicationCreator> {
public:
IApplicationCreator();
~IApplicationCreator() override;
};
class IProcessWindingController final : public ServiceFramework<IProcessWindingController> {
public:
IProcessWindingController();
~IProcessWindingController() override;
};
/// Registers all AM services with the specified service manager.

View file

@ -222,4 +222,6 @@ AppletAE::AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
RegisterHandlers(functions);
}
AppletAE::~AppletAE() = default;
} // namespace Service::AM

View file

@ -18,7 +18,7 @@ namespace AM {
class AppletAE final : public ServiceFramework<AppletAE> {
public:
explicit AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger);
~AppletAE() = default;
~AppletAE() override;
private:
void OpenSystemAppletProxy(Kernel::HLERequestContext& ctx);

View file

@ -103,4 +103,6 @@ AppletOE::AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
RegisterHandlers(functions);
}
AppletOE::~AppletOE() = default;
} // namespace Service::AM

View file

@ -18,7 +18,7 @@ namespace AM {
class AppletOE final : public ServiceFramework<AppletOE> {
public:
explicit AppletOE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger);
~AppletOE() = default;
~AppletOE() override;
private:
void OpenApplicationProxy(Kernel::HLERequestContext& ctx);

View file

@ -21,4 +21,6 @@ IdleSys::IdleSys() : ServiceFramework{"idle:sys"} {
RegisterHandlers(functions);
}
IdleSys::~IdleSys() = default;
} // namespace Service::AM

View file

@ -11,6 +11,7 @@ namespace Service::AM {
class IdleSys final : public ServiceFramework<IdleSys> {
public:
explicit IdleSys();
~IdleSys() override;
};
} // namespace Service::AM

View file

@ -39,4 +39,6 @@ OMM::OMM() : ServiceFramework{"omm"} {
RegisterHandlers(functions);
}
OMM::~OMM() = default;
} // namespace Service::AM

View file

@ -11,6 +11,7 @@ namespace Service::AM {
class OMM final : public ServiceFramework<OMM> {
public:
explicit OMM();
~OMM() override;
};
} // namespace Service::AM

View file

@ -27,4 +27,6 @@ SPSM::SPSM() : ServiceFramework{"spsm"} {
RegisterHandlers(functions);
}
SPSM::~SPSM() = default;
} // namespace Service::AM

View file

@ -11,6 +11,7 @@ namespace Service::AM {
class SPSM final : public ServiceFramework<SPSM> {
public:
explicit SPSM();
~SPSM() override;
};
} // namespace Service::AM

View file

@ -23,6 +23,8 @@ AOC_U::AOC_U() : ServiceFramework("aoc:u") {
RegisterHandlers(functions);
}
AOC_U::~AOC_U() = default;
void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS);

View file

@ -11,7 +11,7 @@ namespace Service::AOC {
class AOC_U final : public ServiceFramework<AOC_U> {
public:
AOC_U();
~AOC_U() = default;
~AOC_U() override;
private:
void CountAddOnContent(Kernel::HLERequestContext& ctx);

View file

@ -9,6 +9,9 @@
namespace Service::APM {
Module::Module() = default;
Module::~Module() = default;
void InstallInterfaces(SM::ServiceManager& service_manager) {
auto module_ = std::make_shared<Module>();
std::make_shared<APM>(module_, "apm")->InstallAsService(service_manager);

View file

@ -15,8 +15,8 @@ enum class PerformanceMode : u8 {
class Module final {
public:
Module() = default;
~Module() = default;
Module();
~Module();
};
/// Registers all AM services with the specified service manager.

View file

@ -70,6 +70,8 @@ APM::APM(std::shared_ptr<Module> apm, const char* name)
RegisterHandlers(functions);
}
APM::~APM() = default;
void APM::OpenSession(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);
@ -93,6 +95,8 @@ APM_Sys::APM_Sys() : ServiceFramework{"apm:sys"} {
RegisterHandlers(functions);
}
APM_Sys::~APM_Sys() = default;
void APM_Sys::GetPerformanceEvent(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS);

View file

@ -11,7 +11,7 @@ namespace Service::APM {
class APM final : public ServiceFramework<APM> {
public:
explicit APM(std::shared_ptr<Module> apm, const char* name);
~APM() = default;
~APM() override;
private:
void OpenSession(Kernel::HLERequestContext& ctx);
@ -22,6 +22,7 @@ private:
class APM_Sys final : public ServiceFramework<APM_Sys> {
public:
explicit APM_Sys();
~APM_Sys() override;
private:
void GetPerformanceEvent(Kernel::HLERequestContext& ctx);

View file

@ -42,4 +42,6 @@ AudCtl::AudCtl() : ServiceFramework{"audctl"} {
RegisterHandlers(functions);
}
AudCtl::~AudCtl() = default;
} // namespace Service::Audio

View file

@ -11,6 +11,7 @@ namespace Service::Audio {
class AudCtl final : public ServiceFramework<AudCtl> {
public:
explicit AudCtl();
~AudCtl() override;
};
} // namespace Service::Audio

View file

@ -17,4 +17,6 @@ AudDbg::AudDbg(const char* name) : ServiceFramework{name} {
RegisterHandlers(functions);
}
AudDbg::~AudDbg() = default;
} // namespace Service::Audio

View file

@ -11,6 +11,7 @@ namespace Service::Audio {
class AudDbg final : public ServiceFramework<AudDbg> {
public:
explicit AudDbg(const char* name);
~AudDbg() override;
};
} // namespace Service::Audio

View file

@ -19,4 +19,6 @@ AudInA::AudInA() : ServiceFramework{"audin:a"} {
RegisterHandlers(functions);
}
AudInA::~AudInA() = default;
} // namespace Service::Audio

View file

@ -11,6 +11,7 @@ namespace Service::Audio {
class AudInA final : public ServiceFramework<AudInA> {
public:
explicit AudInA();
~AudInA() override;
};
} // namespace Service::Audio

View file

@ -41,4 +41,6 @@ AudInU::AudInU() : ServiceFramework("audin:u") {
RegisterHandlers(functions);
}
AudInU::~AudInU() = default;
} // namespace Service::Audio

View file

@ -15,7 +15,7 @@ namespace Service::Audio {
class AudInU final : public ServiceFramework<AudInU> {
public:
explicit AudInU();
~AudInU() = default;
~AudInU() override;
};
} // namespace Service::Audio

View file

@ -21,4 +21,6 @@ AudOutA::AudOutA() : ServiceFramework{"audout:a"} {
RegisterHandlers(functions);
}
AudOutA::~AudOutA() = default;
} // namespace Service::Audio

View file

@ -11,6 +11,7 @@ namespace Service::Audio {
class AudOutA final : public ServiceFramework<AudOutA> {
public:
explicit AudOutA();
~AudOutA() override;
};
} // namespace Service::Audio

View file

@ -218,4 +218,6 @@ AudOutU::AudOutU() : ServiceFramework("audout:u") {
audio_core = std::make_unique<AudioCore::AudioOut>();
}
AudOutU::~AudOutU() = default;
} // namespace Service::Audio

View file

@ -30,7 +30,7 @@ class IAudioOut;
class AudOutU final : public ServiceFramework<AudOutU> {
public:
AudOutU();
~AudOutU() = default;
~AudOutU() override;
private:
std::shared_ptr<IAudioOut> audio_out_interface;

View file

@ -17,4 +17,6 @@ AudRecA::AudRecA() : ServiceFramework{"audrec:a"} {
RegisterHandlers(functions);
}
AudRecA::~AudRecA() = default;
} // namespace Service::Audio

View file

@ -11,6 +11,7 @@ namespace Service::Audio {
class AudRecA final : public ServiceFramework<AudRecA> {
public:
explicit AudRecA();
~AudRecA() override;
};
} // namespace Service::Audio

View file

@ -36,4 +36,6 @@ AudRecU::AudRecU() : ServiceFramework("audrec:u") {
RegisterHandlers(functions);
}
AudRecU::~AudRecU() = default;
} // namespace Service::Audio

View file

@ -15,7 +15,7 @@ namespace Service::Audio {
class AudRecU final : public ServiceFramework<AudRecU> {
public:
explicit AudRecU();
~AudRecU() = default;
~AudRecU() override;
};
} // namespace Service::Audio

View file

@ -23,4 +23,6 @@ AudRenA::AudRenA() : ServiceFramework{"audren:a"} {
RegisterHandlers(functions);
}
AudRenA::~AudRenA() = default;
} // namespace Service::Audio

View file

@ -11,6 +11,7 @@ namespace Service::Audio {
class AudRenA final : public ServiceFramework<AudRenA> {
public:
explicit AudRenA();
~AudRenA() override;
};
} // namespace Service::Audio

View file

@ -198,6 +198,8 @@ AudRenU::AudRenU() : ServiceFramework("audren:u") {
RegisterHandlers(functions);
}
AudRenU::~AudRenU() = default;
void AudRenU::OpenAudioRenderer(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
auto params = rp.PopRaw<AudioCore::AudioRendererParameter>();

View file

@ -16,7 +16,7 @@ namespace Service::Audio {
class AudRenU final : public ServiceFramework<AudRenU> {
public:
explicit AudRenU();
~AudRenU() = default;
~AudRenU() override;
private:
void OpenAudioRenderer(Kernel::HLERequestContext& ctx);

View file

@ -28,4 +28,6 @@ CodecCtl::CodecCtl() : ServiceFramework("codecctl") {
RegisterHandlers(functions);
}
CodecCtl::~CodecCtl() = default;
} // namespace Service::Audio

View file

@ -15,7 +15,7 @@ namespace Service::Audio {
class CodecCtl final : public ServiceFramework<CodecCtl> {
public:
explicit CodecCtl();
~CodecCtl() = default;
~CodecCtl() override;
};
} // namespace Service::Audio

View file

@ -151,4 +151,6 @@ HwOpus::HwOpus() : ServiceFramework("hwopus") {
RegisterHandlers(functions);
}
HwOpus::~HwOpus() = default;
} // namespace Service::Audio

View file

@ -11,7 +11,7 @@ namespace Service::Audio {
class HwOpus final : public ServiceFramework<HwOpus> {
public:
explicit HwOpus();
~HwOpus() = default;
~HwOpus() override;
private:
void OpenOpusDecoder(Kernel::HLERequestContext& ctx);

View file

@ -13,4 +13,6 @@ BCAT::BCAT(std::shared_ptr<Module> module, const char* name)
};
RegisterHandlers(functions);
}
BCAT::~BCAT() = default;
} // namespace Service::BCAT

View file

@ -11,6 +11,7 @@ namespace Service::BCAT {
class BCAT final : public Module::Interface {
public:
explicit BCAT(std::shared_ptr<Module> module, const char* name);
~BCAT() override;
};
} // namespace Service::BCAT

View file

@ -42,6 +42,8 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) {
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
: ServiceFramework(name), module(std::move(module)) {}
Module::Interface::~Interface() = default;
void InstallInterfaces(SM::ServiceManager& service_manager) {
auto module = std::make_shared<Module>();
std::make_shared<BCAT>(module, "bcat:a")->InstallAsService(service_manager);

View file

@ -13,6 +13,7 @@ public:
class Interface : public ServiceFramework<Interface> {
public:
explicit Interface(std::shared_ptr<Module> module, const char* name);
~Interface() override;
void CreateBcatService(Kernel::HLERequestContext& ctx);

View file

@ -13,6 +13,8 @@ namespace Service::Fatal {
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
: ServiceFramework(name), module(std::move(module)) {}
Module::Interface::~Interface() = default;
void Module::Interface::ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx);
u32 error_code = rp.Pop<u32>();

View file

@ -13,6 +13,7 @@ public:
class Interface : public ServiceFramework<Interface> {
public:
explicit Interface(std::shared_ptr<Module> module, const char* name);
~Interface() override;
void ThrowFatalWithPolicy(Kernel::HLERequestContext& ctx);
void ThrowFatalWithCpuContext(Kernel::HLERequestContext& ctx);

View file

@ -9,4 +9,6 @@ namespace Service::Fatal {
Fatal_P::Fatal_P(std::shared_ptr<Module> module)
: Module::Interface(std::move(module), "fatal:p") {}
Fatal_P::~Fatal_P() = default;
} // namespace Service::Fatal

View file

@ -11,6 +11,7 @@ namespace Service::Fatal {
class Fatal_P final : public Module::Interface {
public:
explicit Fatal_P(std::shared_ptr<Module> module);
~Fatal_P() override;
};
} // namespace Service::Fatal

View file

@ -15,4 +15,6 @@ Fatal_U::Fatal_U(std::shared_ptr<Module> module) : Module::Interface(std::move(m
RegisterHandlers(functions);
}
Fatal_U::~Fatal_U() = default;
} // namespace Service::Fatal

View file

@ -11,6 +11,7 @@ namespace Service::Fatal {
class Fatal_U final : public Module::Interface {
public:
explicit Fatal_U(std::shared_ptr<Module> module);
~Fatal_U() override;
};
} // namespace Service::Fatal

View file

@ -40,6 +40,8 @@ static FileSys::VirtualDir GetDirectoryRelativeWrapped(FileSys::VirtualDir base,
VfsDirectoryServiceWrapper::VfsDirectoryServiceWrapper(FileSys::VirtualDir backing_)
: backing(std::move(backing_)) {}
VfsDirectoryServiceWrapper::~VfsDirectoryServiceWrapper() = default;
std::string VfsDirectoryServiceWrapper::GetName() const {
return backing->GetName();
}

View file

@ -64,6 +64,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager, const FileSys::Virtu
class VfsDirectoryServiceWrapper {
public:
explicit VfsDirectoryServiceWrapper(FileSys::VirtualDir backing);
~VfsDirectoryServiceWrapper();
/**
* Get a descriptive name for the archive (e.g. "RomFS", "SaveData", etc.)

View file

@ -19,4 +19,6 @@ FSP_LDR::FSP_LDR() : ServiceFramework{"fsp:ldr"} {
RegisterHandlers(functions);
}
FSP_LDR::~FSP_LDR() = default;
} // namespace Service::FileSystem

View file

@ -11,6 +11,7 @@ namespace Service::FileSystem {
class FSP_LDR final : public ServiceFramework<FSP_LDR> {
public:
explicit FSP_LDR();
~FSP_LDR() override;
};
} // namespace Service::FileSystem

View file

@ -20,4 +20,6 @@ FSP_PR::FSP_PR() : ServiceFramework{"fsp:pr"} {
RegisterHandlers(functions);
}
FSP_PR::~FSP_PR() = default;
} // namespace Service::FileSystem

View file

@ -11,6 +11,7 @@ namespace Service::FileSystem {
class FSP_PR final : public ServiceFramework<FSP_PR> {
public:
explicit FSP_PR();
~FSP_PR() override;
};
} // namespace Service::FileSystem

View file

@ -520,6 +520,8 @@ FSP_SRV::FSP_SRV() : ServiceFramework("fsp-srv") {
RegisterHandlers(functions);
}
FSP_SRV::~FSP_SRV() = default;
void FSP_SRV::Initialize(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_FS, "(STUBBED) called");

View file

@ -16,7 +16,7 @@ namespace Service::FileSystem {
class FSP_SRV final : public ServiceFramework<FSP_SRV> {
public:
explicit FSP_SRV();
~FSP_SRV() = default;
~FSP_SRV() override;
private:
void Initialize(Kernel::HLERequestContext& ctx);

View file

@ -118,6 +118,8 @@ void Module::Interface::CreateFriendService(Kernel::HLERequestContext& ctx) {
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
: ServiceFramework(name), module(std::move(module)) {}
Module::Interface::~Interface() = default;
void InstallInterfaces(SM::ServiceManager& service_manager) {
auto module = std::make_shared<Module>();
std::make_shared<Friend>(module, "friend:a")->InstallAsService(service_manager);

View file

@ -13,6 +13,7 @@ public:
class Interface : public ServiceFramework<Interface> {
public:
explicit Interface(std::shared_ptr<Module> module, const char* name);
~Interface() override;
void CreateFriendService(Kernel::HLERequestContext& ctx);

View file

@ -16,4 +16,6 @@ Friend::Friend(std::shared_ptr<Module> module, const char* name)
RegisterHandlers(functions);
}
Friend::~Friend() = default;
} // namespace Service::Friend

View file

@ -11,6 +11,7 @@ namespace Service::Friend {
class Friend final : public Module::Interface {
public:
explicit Friend(std::shared_ptr<Module> module, const char* name);
~Friend() override;
};
} // namespace Service::Friend

View file

@ -33,6 +33,8 @@ IRS::IRS() : ServiceFramework{"irs"} {
RegisterHandlers(functions);
}
IRS::~IRS() = default;
IRS_SYS::IRS_SYS() : ServiceFramework{"irs:sys"} {
// clang-format off
static const FunctionInfo functions[] = {
@ -46,4 +48,6 @@ IRS_SYS::IRS_SYS() : ServiceFramework{"irs:sys"} {
RegisterHandlers(functions);
}
IRS_SYS::~IRS_SYS() = default;
} // namespace Service::HID

View file

@ -11,11 +11,13 @@ namespace Service::HID {
class IRS final : public ServiceFramework<IRS> {
public:
explicit IRS();
~IRS() override;
};
class IRS_SYS final : public ServiceFramework<IRS_SYS> {
public:
explicit IRS_SYS();
~IRS_SYS() override;
};
} // namespace Service::HID

View file

@ -34,4 +34,6 @@ XCD_SYS::XCD_SYS() : ServiceFramework{"xcd:sys"} {
RegisterHandlers(functions);
}
XCD_SYS::~XCD_SYS() = default;
} // namespace Service::HID

View file

@ -11,6 +11,7 @@ namespace Service::HID {
class XCD_SYS final : public ServiceFramework<XCD_SYS> {
public:
explicit XCD_SYS();
~XCD_SYS() override;
};
} // namespace Service::HID

View file

@ -14,6 +14,8 @@ namespace Service::NFP {
Module::Interface::Interface(std::shared_ptr<Module> module, const char* name)
: ServiceFramework(name), module(std::move(module)) {}
Module::Interface::~Interface() = default;
class IUser final : public ServiceFramework<IUser> {
public:
IUser() : ServiceFramework("IUser") {

View file

@ -13,6 +13,7 @@ public:
class Interface : public ServiceFramework<Interface> {
public:
explicit Interface(std::shared_ptr<Module> module, const char* name);
~Interface() override;
void CreateUserInterface(Kernel::HLERequestContext& ctx);

View file

@ -14,4 +14,6 @@ NFP_User::NFP_User(std::shared_ptr<Module> module)
RegisterHandlers(functions);
}
NFP_User::~NFP_User() = default;
} // namespace Service::NFP

View file

@ -11,6 +11,7 @@ namespace Service::NFP {
class NFP_User final : public Module::Interface {
public:
explicit NFP_User(std::shared_ptr<Module> module);
~NFP_User() override;
};
} // namespace Service::NFP

View file

@ -247,6 +247,8 @@ PL_U::PL_U() : ServiceFramework("pl:u") {
}
}
PL_U::~PL_U() = default;
void PL_U::RequestLoad(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u32 shared_font_type{rp.Pop<u32>()};

View file

@ -13,7 +13,7 @@ namespace Service::NS {
class PL_U final : public ServiceFramework<PL_U> {
public:
PL_U();
~PL_U() = default;
~PL_U() override;
private:
void RequestLoad(Kernel::HLERequestContext& ctx);

View file

@ -13,6 +13,9 @@
namespace Service::Nvidia::Devices {
nvdisp_disp0::nvdisp_disp0(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {}
nvdisp_disp0 ::~nvdisp_disp0() = default;
u32 nvdisp_disp0::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
UNIMPLEMENTED_MSG("Unimplemented ioctl");
return 0;

View file

@ -17,8 +17,8 @@ class nvmap;
class nvdisp_disp0 final : public nvdevice {
public:
explicit nvdisp_disp0(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {}
~nvdisp_disp0() = default;
explicit nvdisp_disp0(std::shared_ptr<nvmap> nvmap_dev);
~nvdisp_disp0();
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -3,6 +3,8 @@
// Refer to the license.txt file included.
#include <cstring>
#include <utility>
#include "common/assert.h"
#include "common/logging/log.h"
#include "core/core.h"
@ -14,6 +16,9 @@
namespace Service::Nvidia::Devices {
nvhost_as_gpu::nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {}
nvhost_as_gpu::~nvhost_as_gpu() = default;
u32 nvhost_as_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}",
command.raw, input.size(), output.size());

View file

@ -6,7 +6,6 @@
#include <memory>
#include <unordered_map>
#include <utility>
#include <vector>
#include "common/common_types.h"
#include "common/swap.h"
@ -18,8 +17,8 @@ class nvmap;
class nvhost_as_gpu final : public nvdevice {
public:
explicit nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {}
~nvhost_as_gpu() override = default;
explicit nvhost_as_gpu(std::shared_ptr<nvmap> nvmap_dev);
~nvhost_as_gpu() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -11,6 +11,9 @@
namespace Service::Nvidia::Devices {
nvhost_ctrl::nvhost_ctrl() = default;
nvhost_ctrl::~nvhost_ctrl() = default;
u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}",
command.raw, input.size(), output.size());

View file

@ -13,8 +13,8 @@ namespace Service::Nvidia::Devices {
class nvhost_ctrl final : public nvdevice {
public:
nvhost_ctrl() = default;
~nvhost_ctrl() override = default;
nvhost_ctrl();
~nvhost_ctrl() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -9,6 +9,9 @@
namespace Service::Nvidia::Devices {
nvhost_ctrl_gpu::nvhost_ctrl_gpu() = default;
nvhost_ctrl_gpu::~nvhost_ctrl_gpu() = default;
u32 nvhost_ctrl_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}",
command.raw, input.size(), output.size());

View file

@ -13,8 +13,8 @@ namespace Service::Nvidia::Devices {
class nvhost_ctrl_gpu final : public nvdevice {
public:
nvhost_ctrl_gpu() = default;
~nvhost_ctrl_gpu() override = default;
nvhost_ctrl_gpu();
~nvhost_ctrl_gpu() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -14,6 +14,9 @@
namespace Service::Nvidia::Devices {
nvhost_gpu::nvhost_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {}
nvhost_gpu::~nvhost_gpu() = default;
u32 nvhost_gpu::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}",
command.raw, input.size(), output.size());

View file

@ -20,8 +20,8 @@ constexpr u32 NVGPU_IOCTL_CHANNEL_KICKOFF_PB(0x1b);
class nvhost_gpu final : public nvdevice {
public:
explicit nvhost_gpu(std::shared_ptr<nvmap> nvmap_dev) : nvmap_dev(std::move(nvmap_dev)) {}
~nvhost_gpu() override = default;
explicit nvhost_gpu(std::shared_ptr<nvmap> nvmap_dev);
~nvhost_gpu() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -10,6 +10,9 @@
namespace Service::Nvidia::Devices {
nvhost_nvdec::nvhost_nvdec() = default;
nvhost_nvdec::~nvhost_nvdec() = default;
u32 nvhost_nvdec::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}",
command.raw, input.size(), output.size());

View file

@ -13,8 +13,8 @@ namespace Service::Nvidia::Devices {
class nvhost_nvdec final : public nvdevice {
public:
nvhost_nvdec() = default;
~nvhost_nvdec() override = default;
nvhost_nvdec();
~nvhost_nvdec() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -10,6 +10,9 @@
namespace Service::Nvidia::Devices {
nvhost_nvjpg::nvhost_nvjpg() = default;
nvhost_nvjpg::~nvhost_nvjpg() = default;
u32 nvhost_nvjpg::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}",
command.raw, input.size(), output.size());

View file

@ -13,8 +13,8 @@ namespace Service::Nvidia::Devices {
class nvhost_nvjpg final : public nvdevice {
public:
nvhost_nvjpg() = default;
~nvhost_nvjpg() override = default;
nvhost_nvjpg();
~nvhost_nvjpg() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

View file

@ -10,6 +10,9 @@
namespace Service::Nvidia::Devices {
nvhost_vic::nvhost_vic() = default;
nvhost_vic::~nvhost_vic() = default;
u32 nvhost_vic::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) {
LOG_DEBUG(Service_NVDRV, "called, command=0x{:08X}, input_size=0x{:X}, output_size=0x{:X}",
command.raw, input.size(), output.size());

View file

@ -13,8 +13,8 @@ namespace Service::Nvidia::Devices {
class nvhost_vic final : public nvdevice {
public:
nvhost_vic() = default;
~nvhost_vic() override = default;
nvhost_vic();
~nvhost_vic() override;
u32 ioctl(Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) override;

Some files were not shown because too many files have changed in this diff Show more