diff options
| author | purpasmart96 <kanzoconfigz@hotmail.com> | 2015-03-27 16:51:54 -0700 | 
|---|---|---|
| committer | purpasmart96 <kanzoconfigz@hotmail.com> | 2015-04-03 19:36:03 -0700 | 
| commit | d6c9af600fba67de7efaa1128b000a06c3b6f230 (patch) | |
| tree | 77c8716aa0332664e9d156cbaf95231861110f4f /src/core | |
| parent | 3fd2cc566b38d34c587140ce3dbc580f85e34717 (diff) | |
IR: Move The IR services to their own folder and implement "GetHandles"
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/CMakeLists.txt | 12 | ||||
| -rw-r--r-- | src/core/hle/service/ir/ir.cpp | 48 | ||||
| -rw-r--r-- | src/core/hle/service/ir/ir.h | 30 | ||||
| -rw-r--r-- | src/core/hle/service/ir/ir_rst.cpp | 24 | ||||
| -rw-r--r-- | src/core/hle/service/ir/ir_rst.h (renamed from src/core/hle/service/ir_rst.h) | 13 | ||||
| -rw-r--r-- | src/core/hle/service/ir/ir_u.cpp (renamed from src/core/hle/service/ir_u.cpp) | 17 | ||||
| -rw-r--r-- | src/core/hle/service/ir/ir_u.h (renamed from src/core/hle/service/ir_u.h) | 13 | ||||
| -rw-r--r-- | src/core/hle/service/ir/ir_user.cpp | 34 | ||||
| -rw-r--r-- | src/core/hle/service/ir/ir_user.h | 22 | ||||
| -rw-r--r-- | src/core/hle/service/ir_rst.cpp | 27 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 7 | 
11 files changed, 188 insertions, 59 deletions
| diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index bdf4b6212..0528175ba 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -61,8 +61,10 @@ set(SRCS              hle/service/hid/hid_spvr.cpp              hle/service/gsp_lcd.cpp              hle/service/http_c.cpp -            hle/service/ir_rst.cpp -            hle/service/ir_u.cpp +            hle/service/ir/ir.cpp +            hle/service/ir/ir_rst.cpp +            hle/service/ir/ir_u.cpp +            hle/service/ir/ir_user.cpp              hle/service/ldr_ro.cpp              hle/service/mic_u.cpp              hle/service/ndm_u.cpp @@ -170,8 +172,10 @@ set(HEADERS              hle/service/hid/hid_user.h              hle/service/gsp_lcd.h              hle/service/http_c.h -            hle/service/ir_rst.h -            hle/service/ir_u.h +            hle/service/ir/ir.h +            hle/service/ir/ir_rst.h +            hle/service/ir/ir_u.h +            hle/service/ir/ir_user.h              hle/service/ldr_ro.h              hle/service/mic_u.h              hle/service/ndm_u.h diff --git a/src/core/hle/service/ir/ir.cpp b/src/core/hle/service/ir/ir.cpp new file mode 100644 index 000000000..58dfd8e1a --- /dev/null +++ b/src/core/hle/service/ir/ir.cpp @@ -0,0 +1,48 @@ +// Copyright 2015 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/service/service.h" +#include "core/hle/service/ir/ir.h" +#include "core/hle/service/ir/ir_rst.h" +#include "core/hle/service/ir/ir_u.h" +#include "core/hle/service/ir/ir_user.h" + +#include "core/hle/hle.h" +#include "core/hle/kernel/event.h" +#include "core/hle/kernel/shared_memory.h" + +namespace Service { +namespace IR { + +static Kernel::SharedPtr<Kernel::Event> handle_event = nullptr; +static Kernel::SharedPtr<Kernel::SharedMemory> shared_memory = nullptr; + +void GetHandles(Service::Interface* self) { +    u32* cmd_buff = Kernel::GetCommandBuffer(); + +    cmd_buff[1] = RESULT_SUCCESS.raw; +    cmd_buff[2] = 0x4000000; +    cmd_buff[3] = Kernel::g_handle_table.Create(Service::IR::shared_memory).MoveFrom(); +    cmd_buff[4] = Kernel::g_handle_table.Create(Service::IR::handle_event).MoveFrom(); +} + +void Init() { +    using namespace Kernel; + +    AddService(new IR_RST_Interface); +    AddService(new IR_U_Interface); +    AddService(new IR_User_Interface); + +    shared_memory = SharedMemory::Create("IR:SharedMemory"); + +    // Create event handle(s) +    handle_event  = Event::Create(RESETTYPE_ONESHOT, "IR:HandleEvent"); +} + +void Shutdown() { +} + +} // namespace IR + +} // namespace Service diff --git a/src/core/hle/service/ir/ir.h b/src/core/hle/service/ir/ir.h new file mode 100644 index 000000000..c16d963e7 --- /dev/null +++ b/src/core/hle/service/ir/ir.h @@ -0,0 +1,30 @@ +// Copyright 2015 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/kernel/kernel.h" +#include "core/hle/service/service.h" + +namespace Service { +namespace IR { + +/** + * IR::GetHandles service function + *  Outputs: + *      1 : Result of function, 0 on success, otherwise error code + *      2 : Translate header, used by the ARM11-kernel + *      3 : Shared memory handle + *      4 : Event handle + */ +void GetHandles(Interface* self); + +/// Initialize IR service +void Init(); + +/// Shutdown IR service +void Shutdown(); + +} // namespace IR +} // namespace Service diff --git a/src/core/hle/service/ir/ir_rst.cpp b/src/core/hle/service/ir/ir_rst.cpp new file mode 100644 index 000000000..96ae63420 --- /dev/null +++ b/src/core/hle/service/ir/ir_rst.cpp @@ -0,0 +1,24 @@ +// Copyright 2015 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/hle.h" +#include "core/hle/service/ir/ir.h" +#include "core/hle/service/ir/ir_rst.h" + +namespace Service { +namespace IR { + +const Interface::FunctionInfo FunctionTable[] = { +    {0x00010000, GetHandles,              "GetHandles"}, +    {0x00020080, nullptr,                 "Initialize"}, +    {0x00030000, nullptr,                 "Shutdown"}, +    {0x00090000, nullptr,                 "WriteToTwoFields"}, +}; + +IR_RST_Interface::IR_RST_Interface() { +    Register(FunctionTable); +} + +} // namespace IR +} // namespace Service diff --git a/src/core/hle/service/ir_rst.h b/src/core/hle/service/ir/ir_rst.h index deef701c5..a492e15c9 100644 --- a/src/core/hle/service/ir_rst.h +++ b/src/core/hle/service/ir/ir_rst.h @@ -6,18 +6,17 @@  #include "core/hle/service/service.h" -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Namespace IR_RST  +namespace Service { +namespace IR { -namespace IR_RST { - -class Interface : public Service::Interface { +class IR_RST_Interface : public Service::Interface {  public: -    Interface(); +    IR_RST_Interface();      std::string GetPortName() const override {          return "ir:rst";      }  }; -} // namespace +} // namespace IR +} // namespace Service diff --git a/src/core/hle/service/ir_u.cpp b/src/core/hle/service/ir/ir_u.cpp index 608ed3c06..1b1e3078b 100644 --- a/src/core/hle/service/ir_u.cpp +++ b/src/core/hle/service/ir/ir_u.cpp @@ -3,12 +3,11 @@  // Refer to the license.txt file included.  #include "core/hle/hle.h" -#include "core/hle/service/ir_u.h" +#include "core/hle/service/ir/ir.h" +#include "core/hle/service/ir/ir_u.h" -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Namespace IR_U - -namespace IR_U { +namespace Service { +namespace IR {  const Interface::FunctionInfo FunctionTable[] = {      {0x00010000, nullptr,                 "Initialize"}, @@ -31,11 +30,9 @@ const Interface::FunctionInfo FunctionTable[] = {      {0x00120040, nullptr,                 "SetSleepModeState"},  }; -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Interface class - -Interface::Interface() { +IR_U_Interface::IR_U_Interface() {      Register(FunctionTable);  } -} // namespace +} // namespace IR +} // namespace Service diff --git a/src/core/hle/service/ir_u.h b/src/core/hle/service/ir/ir_u.h index ec47a1524..056d2ce1a 100644 --- a/src/core/hle/service/ir_u.h +++ b/src/core/hle/service/ir/ir_u.h @@ -6,18 +6,17 @@  #include "core/hle/service/service.h" -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Namespace IR_U +namespace Service { +namespace IR { -namespace IR_U { - -class Interface : public Service::Interface { +class IR_U_Interface : public Service::Interface {  public: -    Interface(); +    IR_U_Interface();      std::string GetPortName() const override {          return "ir:u";      }  }; -} // namespace +} // namespace IR +} // namespace Service diff --git a/src/core/hle/service/ir/ir_user.cpp b/src/core/hle/service/ir/ir_user.cpp new file mode 100644 index 000000000..8e3ff140f --- /dev/null +++ b/src/core/hle/service/ir/ir_user.cpp @@ -0,0 +1,34 @@ +// Copyright 2015 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/hle/hle.h" +#include "core/hle/service/ir/ir.h" +#include "core/hle/service/ir/ir_user.h" + +namespace Service { +namespace IR { + +const Interface::FunctionInfo FunctionTable[] = { +    {0x00010182, nullptr,                 "InitializeIrNop"}, +    {0x00020000, nullptr,                 "FinalizeIrNop"}, +    {0x00030000, nullptr,                 "ClearReceiveBuffer"}, +    {0x00040000, nullptr,                 "ClearSendBuffer"}, +    {0x00060040, nullptr,                 "RequireConnection"}, +    {0x00090000, nullptr,                 "Disconnect"}, +    {0x000A0000, nullptr,                 "GetReceiveEvent"}, +    {0x000B0000, nullptr,                 "GetSendEvent"}, +    {0x000C0000, nullptr,                 "GetConnectionStatusEvent"}, +    {0x000D0042, nullptr,                 "SendIrNop"}, +    {0x000E0042, nullptr,                 "SendIrNopLarge"}, +    {0x00180182, nullptr,                 "InitializeIrNopShared"}, +    {0x00190040, nullptr,                 "ReleaseReceivedData"}, +    {0x001A0040, nullptr,                 "SetOwnMachineId"}, +}; + +IR_User_Interface::IR_User_Interface() { +    Register(FunctionTable); +} + +} // namespace IR +} // namespace Service diff --git a/src/core/hle/service/ir/ir_user.h b/src/core/hle/service/ir/ir_user.h new file mode 100644 index 000000000..71c932ffa --- /dev/null +++ b/src/core/hle/service/ir/ir_user.h @@ -0,0 +1,22 @@ +// Copyright 2015 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +namespace Service { +namespace IR { + +class IR_User_Interface : public Service::Interface { +public: +    IR_User_Interface(); + +    std::string GetPortName() const override { +        return "ir:USER"; +    } +}; + +} // namespace IR +} // namespace Service diff --git a/src/core/hle/service/ir_rst.cpp b/src/core/hle/service/ir_rst.cpp deleted file mode 100644 index 4c26c2f03..000000000 --- a/src/core/hle/service/ir_rst.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include "core/hle/hle.h" -#include "core/hle/service/ir_rst.h" - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Namespace IR_RST - -namespace IR_RST { - -const Interface::FunctionInfo FunctionTable[] = { -    {0x00010000, nullptr,                 "GetHandles"}, -    {0x00020080, nullptr,                 "Initialize"}, -    {0x00030000, nullptr,                 "Shutdown"}, -    {0x00090000, nullptr,                 "WriteToTwoFields"}, -}; - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Interface class - -Interface::Interface() { -    Register(FunctionTable); -} - -} // namespace diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index eeb404659..134ff1740 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -24,8 +24,6 @@  #include "core/hle/service/gsp_gpu.h"  #include "core/hle/service/gsp_lcd.h"  #include "core/hle/service/http_c.h" -#include "core/hle/service/ir_rst.h" -#include "core/hle/service/ir_u.h"  #include "core/hle/service/ldr_ro.h"  #include "core/hle/service/mic_u.h"  #include "core/hle/service/ndm_u.h" @@ -45,6 +43,7 @@  #include "core/hle/service/fs/archive.h"  #include "core/hle/service/cfg/cfg.h"  #include "core/hle/service/hid/hid.h" +#include "core/hle/service/ir/ir.h"  #include "core/hle/service/ptm/ptm.h"  namespace Service { @@ -73,6 +72,7 @@ void Init() {      Service::APT::Init();      Service::PTM::Init();      Service::HID::Init(); +    Service::IR::Init();      AddService(new AC_U::Interface);      AddService(new ACT_U::Interface); @@ -91,8 +91,6 @@ void Init() {      AddService(new GSP_GPU::Interface);      AddService(new GSP_LCD::Interface);      AddService(new HTTP_C::Interface); -    AddService(new IR_RST::Interface); -    AddService(new IR_U::Interface);      AddService(new LDR_RO::Interface);      AddService(new MIC_U::Interface);      AddService(new NDM_U::Interface); @@ -112,6 +110,7 @@ void Init() {  /// Shutdown ServiceManager  void Shutdown() { +    Service::IR::Shutdown();      Service::HID::Shutdown();      Service::PTM::Shutdown();      Service::APT::Shutdown(); | 
