mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-11-03 23:28:48 +00:00 
			
		
		
		
	Port yuzu-emu/yuzu#4437: "core_timing: Make use of uintptr_t to represent user_data" (#5499)
Co-authored-by: LC <lioncash@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									7801907288
								
							
						
					
					
						commit
						3201943423
					
				
					 16 changed files with 62 additions and 58 deletions
				
			
		| 
						 | 
				
			
			@ -1118,11 +1118,12 @@ Module::Module(Core::System& system) : system(system) {
 | 
			
		|||
            system.Kernel().CreateEvent(ResetType::OneShot, "CAM::vsync_interrupt_event");
 | 
			
		||||
    }
 | 
			
		||||
    completion_event_callback = system.CoreTiming().RegisterEvent(
 | 
			
		||||
        "CAM::CompletionEventCallBack",
 | 
			
		||||
        [this](u64 userdata, s64 cycles_late) { CompletionEventCallBack(userdata, cycles_late); });
 | 
			
		||||
        "CAM::CompletionEventCallBack", [this](std::uintptr_t user_data, s64 cycles_late) {
 | 
			
		||||
            CompletionEventCallBack(user_data, cycles_late);
 | 
			
		||||
        });
 | 
			
		||||
    vsync_interrupt_event_callback = system.CoreTiming().RegisterEvent(
 | 
			
		||||
        "CAM::VsyncInterruptEventCallBack", [this](u64 userdata, s64 cycles_late) {
 | 
			
		||||
            VsyncInterruptEventCallBack(userdata, cycles_late);
 | 
			
		||||
        "CAM::VsyncInterruptEventCallBack", [this](std::uintptr_t user_data, s64 cycles_late) {
 | 
			
		||||
            VsyncInterruptEventCallBack(user_data, cycles_late);
 | 
			
		||||
        });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -105,7 +105,7 @@ void Module::LoadInputDevices() {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Module::UpdatePadCallback(u64 userdata, s64 cycles_late) {
 | 
			
		||||
void Module::UpdatePadCallback(std::uintptr_t user_data, s64 cycles_late) {
 | 
			
		||||
    SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
 | 
			
		||||
 | 
			
		||||
    if (is_device_reload_pending.exchange(false))
 | 
			
		||||
| 
						 | 
				
			
			@ -225,7 +225,7 @@ void Module::UpdatePadCallback(u64 userdata, s64 cycles_late) {
 | 
			
		|||
    system.CoreTiming().ScheduleEvent(pad_update_ticks - cycles_late, pad_update_event);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Module::UpdateAccelerometerCallback(u64 userdata, s64 cycles_late) {
 | 
			
		||||
void Module::UpdateAccelerometerCallback(std::uintptr_t user_data, s64 cycles_late) {
 | 
			
		||||
    SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
 | 
			
		||||
 | 
			
		||||
    mem->accelerometer.index = next_accelerometer_index;
 | 
			
		||||
| 
						 | 
				
			
			@ -270,7 +270,7 @@ void Module::UpdateAccelerometerCallback(u64 userdata, s64 cycles_late) {
 | 
			
		|||
                                      accelerometer_update_event);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Module::UpdateGyroscopeCallback(u64 userdata, s64 cycles_late) {
 | 
			
		||||
void Module::UpdateGyroscopeCallback(std::uintptr_t user_data, s64 cycles_late) {
 | 
			
		||||
    SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
 | 
			
		||||
 | 
			
		||||
    mem->gyroscope.index = next_gyroscope_index;
 | 
			
		||||
| 
						 | 
				
			
			@ -438,17 +438,17 @@ Module::Module(Core::System& system) : system(system) {
 | 
			
		|||
 | 
			
		||||
    // Register update callbacks
 | 
			
		||||
    Core::Timing& timing = system.CoreTiming();
 | 
			
		||||
    pad_update_event =
 | 
			
		||||
        timing.RegisterEvent("HID::UpdatePadCallback", [this](u64 userdata, s64 cycles_late) {
 | 
			
		||||
            UpdatePadCallback(userdata, cycles_late);
 | 
			
		||||
        });
 | 
			
		||||
    pad_update_event = timing.RegisterEvent("HID::UpdatePadCallback",
 | 
			
		||||
                                            [this](std::uintptr_t user_data, s64 cycles_late) {
 | 
			
		||||
                                                UpdatePadCallback(user_data, cycles_late);
 | 
			
		||||
                                            });
 | 
			
		||||
    accelerometer_update_event = timing.RegisterEvent(
 | 
			
		||||
        "HID::UpdateAccelerometerCallback", [this](u64 userdata, s64 cycles_late) {
 | 
			
		||||
            UpdateAccelerometerCallback(userdata, cycles_late);
 | 
			
		||||
        "HID::UpdateAccelerometerCallback", [this](std::uintptr_t user_data, s64 cycles_late) {
 | 
			
		||||
            UpdateAccelerometerCallback(user_data, cycles_late);
 | 
			
		||||
        });
 | 
			
		||||
    gyroscope_update_event =
 | 
			
		||||
        timing.RegisterEvent("HID::UpdateGyroscopeCallback", [this](u64 userdata, s64 cycles_late) {
 | 
			
		||||
            UpdateGyroscopeCallback(userdata, cycles_late);
 | 
			
		||||
    gyroscope_update_event = timing.RegisterEvent(
 | 
			
		||||
        "HID::UpdateGyroscopeCallback", [this](std::uintptr_t user_data, s64 cycles_late) {
 | 
			
		||||
            UpdateGyroscopeCallback(user_data, cycles_late);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    timing.ScheduleEvent(pad_update_ticks, pad_update_event);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -307,9 +307,9 @@ public:
 | 
			
		|||
 | 
			
		||||
private:
 | 
			
		||||
    void LoadInputDevices();
 | 
			
		||||
    void UpdatePadCallback(u64 userdata, s64 cycles_late);
 | 
			
		||||
    void UpdateAccelerometerCallback(u64 userdata, s64 cycles_late);
 | 
			
		||||
    void UpdateGyroscopeCallback(u64 userdata, s64 cycles_late);
 | 
			
		||||
    void UpdatePadCallback(std::uintptr_t user_data, s64 cycles_late);
 | 
			
		||||
    void UpdateAccelerometerCallback(std::uintptr_t user_data, s64 cycles_late);
 | 
			
		||||
    void UpdateGyroscopeCallback(std::uintptr_t user_data, s64 cycles_late);
 | 
			
		||||
 | 
			
		||||
    Core::System& system;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -66,7 +66,7 @@ void IR_RST::UnloadInputDevices() {
 | 
			
		|||
    c_stick = nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void IR_RST::UpdateCallback(u64 userdata, s64 cycles_late) {
 | 
			
		||||
void IR_RST::UpdateCallback(std::uintptr_t user_data, s64 cycles_late) {
 | 
			
		||||
    SharedMem* mem = reinterpret_cast<SharedMem*>(shared_memory->GetPointer());
 | 
			
		||||
 | 
			
		||||
    if (is_device_reload_pending.exchange(false))
 | 
			
		||||
| 
						 | 
				
			
			@ -175,8 +175,9 @@ IR_RST::IR_RST(Core::System& system) : ServiceFramework("ir:rst", 1), system(sys
 | 
			
		|||
    update_event = system.Kernel().CreateEvent(ResetType::OneShot, "IRRST:UpdateEvent");
 | 
			
		||||
 | 
			
		||||
    update_callback_id = system.CoreTiming().RegisterEvent(
 | 
			
		||||
        "IRRST:UpdateCallBack",
 | 
			
		||||
        [this](u64 userdata, s64 cycles_late) { UpdateCallback(userdata, cycles_late); });
 | 
			
		||||
        "IRRST:UpdateCallBack", [this](std::uintptr_t user_data, s64 cycles_late) {
 | 
			
		||||
            UpdateCallback(user_data, cycles_late);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    static const FunctionInfo functions[] = {
 | 
			
		||||
        {0x00010000, &IR_RST::GetHandles, "GetHandles"},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -74,7 +74,7 @@ private:
 | 
			
		|||
 | 
			
		||||
    void LoadInputDevices();
 | 
			
		||||
    void UnloadInputDevices();
 | 
			
		||||
    void UpdateCallback(u64 userdata, s64 cycles_late);
 | 
			
		||||
    void UpdateCallback(std::uintptr_t user_data, s64 cycles_late);
 | 
			
		||||
 | 
			
		||||
    Core::System& system;
 | 
			
		||||
    std::shared_ptr<Kernel::Event> update_event;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -126,9 +126,9 @@ struct MIC_U::Impl {
 | 
			
		|||
    explicit Impl(Core::System& system) : timing(system.CoreTiming()) {
 | 
			
		||||
        buffer_full_event =
 | 
			
		||||
            system.Kernel().CreateEvent(Kernel::ResetType::OneShot, "MIC_U::buffer_full_event");
 | 
			
		||||
        buffer_write_event =
 | 
			
		||||
            timing.RegisterEvent("MIC_U::UpdateBuffer", [this](u64 userdata, s64 cycles_late) {
 | 
			
		||||
                UpdateSharedMemBuffer(userdata, cycles_late);
 | 
			
		||||
        buffer_write_event = timing.RegisterEvent(
 | 
			
		||||
            "MIC_U::UpdateBuffer", [this](std::uintptr_t user_data, s64 cycles_late) {
 | 
			
		||||
                UpdateSharedMemBuffer(user_data, cycles_late);
 | 
			
		||||
            });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -158,7 +158,7 @@ struct MIC_U::Impl {
 | 
			
		|||
        LOG_TRACE(Service_MIC, "called");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void UpdateSharedMemBuffer(u64 userdata, s64 cycles_late) {
 | 
			
		||||
    void UpdateSharedMemBuffer(std::uintptr_t user_data, s64 cycles_late) {
 | 
			
		||||
        if (change_mic_impl_requested.exchange(false)) {
 | 
			
		||||
            CreateMic();
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1443,7 +1443,7 @@ void NWM_UDS::DecryptBeaconData(Kernel::HLERequestContext& ctx) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
// Sends a 802.11 beacon frame with information about the current network.
 | 
			
		||||
void NWM_UDS::BeaconBroadcastCallback(u64 userdata, s64 cycles_late) {
 | 
			
		||||
void NWM_UDS::BeaconBroadcastCallback(std::uintptr_t user_data, s64 cycles_late) {
 | 
			
		||||
    // Don't do anything if we're not actually hosting a network
 | 
			
		||||
    if (connection_status.status != static_cast<u32>(NetworkStatus::ConnectedAsHost))
 | 
			
		||||
        return;
 | 
			
		||||
| 
						 | 
				
			
			@ -1503,8 +1503,9 @@ NWM_UDS::NWM_UDS(Core::System& system) : ServiceFramework("nwm::UDS"), system(sy
 | 
			
		|||
    RegisterHandlers(functions);
 | 
			
		||||
 | 
			
		||||
    beacon_broadcast_event = system.CoreTiming().RegisterEvent(
 | 
			
		||||
        "UDS::BeaconBroadcastCallback",
 | 
			
		||||
        [this](u64 userdata, s64 cycles_late) { BeaconBroadcastCallback(userdata, cycles_late); });
 | 
			
		||||
        "UDS::BeaconBroadcastCallback", [this](std::uintptr_t user_data, s64 cycles_late) {
 | 
			
		||||
            BeaconBroadcastCallback(user_data, cycles_late);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    CryptoPP::AutoSeededRandomPool rng;
 | 
			
		||||
    auto mac = SharedPage::DefaultMac;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -459,7 +459,7 @@ private:
 | 
			
		|||
                          const u8* network_info_buffer, std::size_t network_info_size,
 | 
			
		||||
                          u8 connection_type, std::vector<u8> passphrase);
 | 
			
		||||
 | 
			
		||||
    void BeaconBroadcastCallback(u64 userdata, s64 cycles_late);
 | 
			
		||||
    void BeaconBroadcastCallback(std::uintptr_t user_data, s64 cycles_late);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns a list of received 802.11 beacon frames from the specified sender since the last
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue