mirror of
				https://git.suyu.dev/suyu/suyu.git
				synced 2025-11-04 12:34:39 +08:00 
			
		
		
		
	service: hid: Fix handle validation
This commit is contained in:
		
							parent
							
								
									756f013d8a
								
							
						
					
					
						commit
						d2ae39bf4b
					
				@ -70,7 +70,6 @@ Result Controller_NPad::VerifyValidSixAxisSensorHandle(
 | 
			
		||||
    const Core::HID::SixAxisSensorHandle& device_handle) {
 | 
			
		||||
    const auto npad_id = IsNpadIdValid(static_cast<Core::HID::NpadIdType>(device_handle.npad_id));
 | 
			
		||||
    const bool device_index = device_handle.device_index < Core::HID::DeviceIndex::MaxDeviceIndex;
 | 
			
		||||
    const bool npad_type = device_handle.npad_type < Core::HID::NpadStyleIndex::MaxNpadType;
 | 
			
		||||
 | 
			
		||||
    if (!npad_id) {
 | 
			
		||||
        return InvalidNpadId;
 | 
			
		||||
@ -78,10 +77,6 @@ Result Controller_NPad::VerifyValidSixAxisSensorHandle(
 | 
			
		||||
    if (!device_index) {
 | 
			
		||||
        return NpadDeviceIndexOutOfRange;
 | 
			
		||||
    }
 | 
			
		||||
    // This doesn't get validated on nnsdk
 | 
			
		||||
    if (!npad_type) {
 | 
			
		||||
        return NpadInvalidHandle;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return ResultSuccess;
 | 
			
		||||
}
 | 
			
		||||
@ -1131,6 +1126,7 @@ Result Controller_NPad::DisconnectNpad(Core::HID::NpadIdType npad_id) {
 | 
			
		||||
    WriteEmptyEntry(shared_memory);
 | 
			
		||||
    return ResultSuccess;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Result Controller_NPad::SetGyroscopeZeroDriftMode(
 | 
			
		||||
    const Core::HID::SixAxisSensorHandle& sixaxis_handle,
 | 
			
		||||
    Core::HID::GyroscopeZeroDriftMode drift_mode) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user