mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-11-03 23:28:48 +00:00 
			
		
		
		
	Kernel: pass Kernel ref in Event
This commit is contained in:
		
							parent
							
								
									734be98966
								
							
						
					
					
						commit
						eec11a94cb
					
				
					 33 changed files with 104 additions and 80 deletions
				
			
		| 
						 | 
				
			
			@ -16,10 +16,10 @@ void InstallInterfaces(Core::System& system) {
 | 
			
		|||
    auto& service_manager = system.ServiceManager();
 | 
			
		||||
    std::make_shared<IR_U>()->InstallAsService(service_manager);
 | 
			
		||||
 | 
			
		||||
    auto ir_user = std::make_shared<IR_USER>();
 | 
			
		||||
    auto ir_user = std::make_shared<IR_USER>(system);
 | 
			
		||||
    ir_user->InstallAsService(service_manager);
 | 
			
		||||
 | 
			
		||||
    auto ir_rst = std::make_shared<IR_RST>();
 | 
			
		||||
    auto ir_rst = std::make_shared<IR_RST>(system);
 | 
			
		||||
    ir_rst->InstallAsService(service_manager);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@
 | 
			
		|||
// Licensed under GPLv2 or any later version
 | 
			
		||||
// Refer to the license.txt file included.
 | 
			
		||||
 | 
			
		||||
#include "core/core.h"
 | 
			
		||||
#include "core/core_timing.h"
 | 
			
		||||
#include "core/hle/ipc_helpers.h"
 | 
			
		||||
#include "core/hle/kernel/event.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -144,14 +145,14 @@ void IR_RST::Shutdown(Kernel::HLERequestContext& ctx) {
 | 
			
		|||
    LOG_DEBUG(Service_IR, "called");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
IR_RST::IR_RST() : ServiceFramework("ir:rst", 1) {
 | 
			
		||||
IR_RST::IR_RST(Core::System& system) : ServiceFramework("ir:rst", 1) {
 | 
			
		||||
    using namespace Kernel;
 | 
			
		||||
    // Note: these two kernel objects are even available before Initialize service function is
 | 
			
		||||
    // called.
 | 
			
		||||
    shared_memory =
 | 
			
		||||
        SharedMemory::Create(nullptr, 0x1000, MemoryPermission::ReadWrite, MemoryPermission::Read,
 | 
			
		||||
                             0, MemoryRegion::BASE, "IRRST:SharedMemory");
 | 
			
		||||
    update_event = Event::Create(ResetType::OneShot, "IRRST:UpdateEvent");
 | 
			
		||||
    update_event = system.Kernel().CreateEvent(ResetType::OneShot, "IRRST:UpdateEvent");
 | 
			
		||||
 | 
			
		||||
    update_callback_id =
 | 
			
		||||
        CoreTiming::RegisterEvent("IRRST:UpdateCallBack", [this](u64 userdata, s64 cycles_late) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,7 +39,7 @@ union PadState {
 | 
			
		|||
/// Interface to "ir:rst" service
 | 
			
		||||
class IR_RST final : public ServiceFramework<IR_RST> {
 | 
			
		||||
public:
 | 
			
		||||
    IR_RST();
 | 
			
		||||
    explicit IR_RST(Core::System& system);
 | 
			
		||||
    ~IR_RST();
 | 
			
		||||
    void ReloadInputDevices();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@
 | 
			
		|||
#include <boost/crc.hpp>
 | 
			
		||||
#include "common/string_util.h"
 | 
			
		||||
#include "common/swap.h"
 | 
			
		||||
#include "core/core.h"
 | 
			
		||||
#include "core/hle/ipc_helpers.h"
 | 
			
		||||
#include "core/hle/kernel/event.h"
 | 
			
		||||
#include "core/hle/kernel/shared_memory.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -380,7 +381,7 @@ void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) {
 | 
			
		|||
    LOG_TRACE(Service_IR, "called, count={}", count);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
IR_USER::IR_USER() : ServiceFramework("ir:USER", 1) {
 | 
			
		||||
IR_USER::IR_USER(Core::System& system) : ServiceFramework("ir:USER", 1) {
 | 
			
		||||
    const FunctionInfo functions[] = {
 | 
			
		||||
        {0x00010182, nullptr, "InitializeIrNop"},
 | 
			
		||||
        {0x00020000, &IR_USER::FinalizeIrNop, "FinalizeIrNop"},
 | 
			
		||||
| 
						 | 
				
			
			@ -413,9 +414,9 @@ IR_USER::IR_USER() : ServiceFramework("ir:USER", 1) {
 | 
			
		|||
 | 
			
		||||
    using namespace Kernel;
 | 
			
		||||
 | 
			
		||||
    conn_status_event = Event::Create(ResetType::OneShot, "IR:ConnectionStatusEvent");
 | 
			
		||||
    send_event = Event::Create(ResetType::OneShot, "IR:SendEvent");
 | 
			
		||||
    receive_event = Event::Create(ResetType::OneShot, "IR:ReceiveEvent");
 | 
			
		||||
    conn_status_event = system.Kernel().CreateEvent(ResetType::OneShot, "IR:ConnectionStatusEvent");
 | 
			
		||||
    send_event = system.Kernel().CreateEvent(ResetType::OneShot, "IR:SendEvent");
 | 
			
		||||
    receive_event = system.Kernel().CreateEvent(ResetType::OneShot, "IR:ReceiveEvent");
 | 
			
		||||
 | 
			
		||||
    extra_hid =
 | 
			
		||||
        std::make_unique<ExtraHID>([this](const std::vector<u8>& data) { PutToReceive(data); });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ private:
 | 
			
		|||
/// Interface to "ir:USER" service
 | 
			
		||||
class IR_USER final : public ServiceFramework<IR_USER> {
 | 
			
		||||
public:
 | 
			
		||||
    IR_USER();
 | 
			
		||||
    explicit IR_USER(Core::System& system);
 | 
			
		||||
    ~IR_USER();
 | 
			
		||||
 | 
			
		||||
    void ReloadInputDevices();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue