2015-03-28 00:51:54 +01:00
|
|
|
// 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 {
|
|
|
|
|
2015-04-28 04:01:48 +02:00
|
|
|
static Kernel::SharedPtr<Kernel::Event> handle_event;
|
|
|
|
static Kernel::SharedPtr<Kernel::SharedMemory> shared_memory;
|
2015-03-28 00:51:54 +01:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2015-05-11 00:47:07 +02:00
|
|
|
using Kernel::MemoryPermission;
|
|
|
|
shared_memory = SharedMemory::Create(0x1000, Kernel::MemoryPermission::ReadWrite,
|
|
|
|
Kernel::MemoryPermission::ReadWrite, "IR:SharedMemory");
|
2015-03-28 00:51:54 +01:00
|
|
|
|
|
|
|
// Create event handle(s)
|
|
|
|
handle_event = Event::Create(RESETTYPE_ONESHOT, "IR:HandleEvent");
|
|
|
|
}
|
|
|
|
|
|
|
|
void Shutdown() {
|
2015-04-28 04:01:48 +02:00
|
|
|
shared_memory = nullptr;
|
|
|
|
handle_event = nullptr;
|
2015-03-28 00:51:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace IR
|
|
|
|
|
|
|
|
} // namespace Service
|