diff options
| author | Lioncash <mathew1800@gmail.com> | 2018-07-31 07:20:42 -0400 | 
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2018-07-31 08:01:19 -0400 | 
| commit | 268eeeb4065559ace6d4671a364210336006cd21 (patch) | |
| tree | 686ddce37955e95b599d351fccb631b1aff8ada4 | |
| parent | bf9c62bc76a2296c1a81cfc1b83aaf4028578901 (diff) | |
service: Add fgm services
Adds the basic skeleton for the fgm services based off the information
provided by Switch Brew.
| -rw-r--r-- | src/common/logging/backend.cpp | 1 | ||||
| -rw-r--r-- | src/common/logging/log.h | 1 | ||||
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/hle/service/fgm/fgm.cpp | 75 | ||||
| -rw-r--r-- | src/core/hle/service/fgm/fgm.h | 15 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 2 | 
6 files changed, 96 insertions, 0 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 55de535c0..01dd052c4 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -171,6 +171,7 @@ void FileBackend::Write(const Entry& entry) {      SUB(Service, BCAT)                                                                             \      SUB(Service, BTM)                                                                              \      SUB(Service, Fatal)                                                                            \ +    SUB(Service, FGM)                                                                              \      SUB(Service, Friend)                                                                           \      SUB(Service, FS)                                                                               \      SUB(Service, HID)                                                                              \ diff --git a/src/common/logging/log.h b/src/common/logging/log.h index e8d98de99..475493dd2 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h @@ -58,6 +58,7 @@ enum class Class : ClassType {      Service_BCAT,      ///< The BCAT service      Service_BTM,       ///< The BTM service      Service_Fatal,     ///< The Fatal service +    Service_FGM,       ///< The FGM service      Service_Friend,    ///< The friend service      Service_FS,        ///< The FS (Filesystem) service      Service_HID,       ///< The HID (Human interface device) service diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 3386c2231..69371d080 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -160,6 +160,8 @@ add_library(core STATIC      hle/service/filesystem/filesystem.h      hle/service/filesystem/fsp_srv.cpp      hle/service/filesystem/fsp_srv.h +    hle/service/fgm/fgm.cpp +    hle/service/fgm/fgm.h      hle/service/friend/friend.cpp      hle/service/friend/friend.h      hle/service/friend/interface.cpp diff --git a/src/core/hle/service/fgm/fgm.cpp b/src/core/hle/service/fgm/fgm.cpp new file mode 100644 index 000000000..566fbf924 --- /dev/null +++ b/src/core/hle/service/fgm/fgm.cpp @@ -0,0 +1,75 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include <memory> + +#include "core/hle/ipc_helpers.h" +#include "core/hle/kernel/hle_ipc.h" +#include "core/hle/service/fgm/fgm.h" +#include "core/hle/service/service.h" +#include "core/hle/service/sm/sm.h" + +namespace Service::FGM { + +class IRequest final : public ServiceFramework<IRequest> { +public: +    explicit IRequest() : ServiceFramework{"IRequest"} { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "Initialize"}, +            {1, nullptr, "Set"}, +            {2, nullptr, "Get"}, +            {3, nullptr, "Cancel"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; + +class FGM final : public ServiceFramework<FGM> { +public: +    explicit FGM(const char* name) : ServiceFramework{name} { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, &FGM::Initialize, "Initialize"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } + +private: +    void Initialize(Kernel::HLERequestContext& ctx) { +        IPC::ResponseBuilder rb{ctx, 2, 0, 1}; +        rb.Push(RESULT_SUCCESS); +        rb.PushIpcInterface<IRequest>(); + +        LOG_DEBUG(Service_FGM, "called"); +    } +}; + +class FGM_DBG final : public ServiceFramework<FGM_DBG> { +public: +    explicit FGM_DBG() : ServiceFramework{"fgm:dbg"} { +        // clang-format off +        static const FunctionInfo functions[] = { +            {0, nullptr, "Initialize"}, +            {1, nullptr, "Read"}, +            {2, nullptr, "Cancel"}, +        }; +        // clang-format on + +        RegisterHandlers(functions); +    } +}; + +void InstallInterfaces(SM::ServiceManager& sm) { +    std::make_shared<FGM>("fgm")->InstallAsService(sm); +    std::make_shared<FGM>("fgm:0")->InstallAsService(sm); +    std::make_shared<FGM>("fgm:9")->InstallAsService(sm); +    std::make_shared<FGM_DBG>()->InstallAsService(sm); +} + +} // namespace Service::FGM diff --git a/src/core/hle/service/fgm/fgm.h b/src/core/hle/service/fgm/fgm.h new file mode 100644 index 000000000..e59691264 --- /dev/null +++ b/src/core/hle/service/fgm/fgm.h @@ -0,0 +1,15 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +namespace Service::SM { +class ServiceManager; +} + +namespace Service::FGM { + +void InstallInterfaces(SM::ServiceManager& sm); + +} // namespace Service::FGM diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 3cad64837..d6ebfaac5 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -27,6 +27,7 @@  #include "core/hle/service/es/es.h"  #include "core/hle/service/eupld/eupld.h"  #include "core/hle/service/fatal/fatal.h" +#include "core/hle/service/fgm/fgm.h"  #include "core/hle/service/filesystem/filesystem.h"  #include "core/hle/service/friend/friend.h"  #include "core/hle/service/grc/grc.h" @@ -208,6 +209,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) {      ES::InstallInterfaces(*sm);      EUPLD::InstallInterfaces(*sm);      Fatal::InstallInterfaces(*sm); +    FGM::InstallInterfaces(*sm);      FileSystem::InstallInterfaces(*sm);      Friend::InstallInterfaces(*sm);      GRC::InstallInterfaces(*sm);  | 
