Merge pull request #676 from purpasmart96/ir_service_refc
IR: Move The IR services to their own folder and implement "GetHandles"
This commit is contained in:
commit
e630fd2a95
|
@ -61,8 +61,10 @@ set(SRCS
|
||||||
hle/service/hid/hid_spvr.cpp
|
hle/service/hid/hid_spvr.cpp
|
||||||
hle/service/gsp_lcd.cpp
|
hle/service/gsp_lcd.cpp
|
||||||
hle/service/http_c.cpp
|
hle/service/http_c.cpp
|
||||||
hle/service/ir_rst.cpp
|
hle/service/ir/ir.cpp
|
||||||
hle/service/ir_u.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/ldr_ro.cpp
|
||||||
hle/service/mic_u.cpp
|
hle/service/mic_u.cpp
|
||||||
hle/service/ndm_u.cpp
|
hle/service/ndm_u.cpp
|
||||||
|
@ -170,8 +172,10 @@ set(HEADERS
|
||||||
hle/service/hid/hid_user.h
|
hle/service/hid/hid_user.h
|
||||||
hle/service/gsp_lcd.h
|
hle/service/gsp_lcd.h
|
||||||
hle/service/http_c.h
|
hle/service/http_c.h
|
||||||
hle/service/ir_rst.h
|
hle/service/ir/ir.h
|
||||||
hle/service/ir_u.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/ldr_ro.h
|
||||||
hle/service/mic_u.h
|
hle/service/mic_u.h
|
||||||
hle/service/ndm_u.h
|
hle/service/ndm_u.h
|
||||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -6,18 +6,17 @@
|
||||||
|
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
namespace Service {
|
||||||
// Namespace IR_RST
|
namespace IR {
|
||||||
|
|
||||||
namespace IR_RST {
|
class IR_RST_Interface : public Service::Interface {
|
||||||
|
|
||||||
class Interface : public Service::Interface {
|
|
||||||
public:
|
public:
|
||||||
Interface();
|
IR_RST_Interface();
|
||||||
|
|
||||||
std::string GetPortName() const override {
|
std::string GetPortName() const override {
|
||||||
return "ir:rst";
|
return "ir:rst";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace IR
|
||||||
|
} // namespace Service
|
|
@ -3,12 +3,11 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include "core/hle/hle.h"
|
#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 Service {
|
||||||
// Namespace IR_U
|
namespace IR {
|
||||||
|
|
||||||
namespace IR_U {
|
|
||||||
|
|
||||||
const Interface::FunctionInfo FunctionTable[] = {
|
const Interface::FunctionInfo FunctionTable[] = {
|
||||||
{0x00010000, nullptr, "Initialize"},
|
{0x00010000, nullptr, "Initialize"},
|
||||||
|
@ -31,11 +30,9 @@ const Interface::FunctionInfo FunctionTable[] = {
|
||||||
{0x00120040, nullptr, "SetSleepModeState"},
|
{0x00120040, nullptr, "SetSleepModeState"},
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
IR_U_Interface::IR_U_Interface() {
|
||||||
// Interface class
|
|
||||||
|
|
||||||
Interface::Interface() {
|
|
||||||
Register(FunctionTable);
|
Register(FunctionTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace IR
|
||||||
|
} // namespace Service
|
|
@ -6,18 +6,17 @@
|
||||||
|
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
namespace Service {
|
||||||
// Namespace IR_U
|
namespace IR {
|
||||||
|
|
||||||
namespace IR_U {
|
class IR_U_Interface : public Service::Interface {
|
||||||
|
|
||||||
class Interface : public Service::Interface {
|
|
||||||
public:
|
public:
|
||||||
Interface();
|
IR_U_Interface();
|
||||||
|
|
||||||
std::string GetPortName() const override {
|
std::string GetPortName() const override {
|
||||||
return "ir:u";
|
return "ir:u";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace IR
|
||||||
|
} // namespace Service
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
|
@ -24,8 +24,6 @@
|
||||||
#include "core/hle/service/gsp_gpu.h"
|
#include "core/hle/service/gsp_gpu.h"
|
||||||
#include "core/hle/service/gsp_lcd.h"
|
#include "core/hle/service/gsp_lcd.h"
|
||||||
#include "core/hle/service/http_c.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/ldr_ro.h"
|
||||||
#include "core/hle/service/mic_u.h"
|
#include "core/hle/service/mic_u.h"
|
||||||
#include "core/hle/service/ndm_u.h"
|
#include "core/hle/service/ndm_u.h"
|
||||||
|
@ -45,6 +43,7 @@
|
||||||
#include "core/hle/service/fs/archive.h"
|
#include "core/hle/service/fs/archive.h"
|
||||||
#include "core/hle/service/cfg/cfg.h"
|
#include "core/hle/service/cfg/cfg.h"
|
||||||
#include "core/hle/service/hid/hid.h"
|
#include "core/hle/service/hid/hid.h"
|
||||||
|
#include "core/hle/service/ir/ir.h"
|
||||||
#include "core/hle/service/ptm/ptm.h"
|
#include "core/hle/service/ptm/ptm.h"
|
||||||
|
|
||||||
namespace Service {
|
namespace Service {
|
||||||
|
@ -73,6 +72,7 @@ void Init() {
|
||||||
Service::APT::Init();
|
Service::APT::Init();
|
||||||
Service::PTM::Init();
|
Service::PTM::Init();
|
||||||
Service::HID::Init();
|
Service::HID::Init();
|
||||||
|
Service::IR::Init();
|
||||||
|
|
||||||
AddService(new AC_U::Interface);
|
AddService(new AC_U::Interface);
|
||||||
AddService(new ACT_U::Interface);
|
AddService(new ACT_U::Interface);
|
||||||
|
@ -91,8 +91,6 @@ void Init() {
|
||||||
AddService(new GSP_GPU::Interface);
|
AddService(new GSP_GPU::Interface);
|
||||||
AddService(new GSP_LCD::Interface);
|
AddService(new GSP_LCD::Interface);
|
||||||
AddService(new HTTP_C::Interface);
|
AddService(new HTTP_C::Interface);
|
||||||
AddService(new IR_RST::Interface);
|
|
||||||
AddService(new IR_U::Interface);
|
|
||||||
AddService(new LDR_RO::Interface);
|
AddService(new LDR_RO::Interface);
|
||||||
AddService(new MIC_U::Interface);
|
AddService(new MIC_U::Interface);
|
||||||
AddService(new NDM_U::Interface);
|
AddService(new NDM_U::Interface);
|
||||||
|
@ -112,6 +110,7 @@ void Init() {
|
||||||
|
|
||||||
/// Shutdown ServiceManager
|
/// Shutdown ServiceManager
|
||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
|
Service::IR::Shutdown();
|
||||||
Service::HID::Shutdown();
|
Service::HID::Shutdown();
|
||||||
Service::PTM::Shutdown();
|
Service::PTM::Shutdown();
|
||||||
Service::APT::Shutdown();
|
Service::APT::Shutdown();
|
||||||
|
|
Loading…
Reference in New Issue