mirror of
				https://github.com/Ryujinx/Ryujinx.git
				synced 2025-10-24 18:20:31 -07:00 
			
		
		
		
	* hid: Initial Keyboard Support This adds basic hid keyboard support. Because of OpenTK.Input limitations, some specials keys aren't mapped. * Fix code style * Fix for loops code style * Make hid keyboard feature toggleable * Address comments * Fix 2 other nits * Apply jd's suggestion
		
			
				
	
	
		
			64 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			64 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| namespace Ryujinx.HLE.Input
 | |
| {
 | |
|     public partial class Hid
 | |
|     {
 | |
|         /*
 | |
|          * Reference:
 | |
|          * https://github.com/reswitched/libtransistor/blob/development/lib/hid.c
 | |
|          * https://github.com/reswitched/libtransistor/blob/development/include/libtransistor/hid.h
 | |
|          * https://github.com/switchbrew/libnx/blob/master/nx/source/services/hid.c
 | |
|          * https://github.com/switchbrew/libnx/blob/master/nx/include/switch/services/hid.h
 | |
|          */
 | |
| 
 | |
|         internal const int HidHeaderSize            = 0x400;
 | |
|         internal const int HidTouchScreenSize       = 0x3000;
 | |
|         internal const int HidMouseSize             = 0x400;
 | |
|         internal const int HidKeyboardSize          = 0x400;
 | |
|         internal const int HidUnkSection1Size       = 0x400;
 | |
|         internal const int HidUnkSection2Size       = 0x400;
 | |
|         internal const int HidUnkSection3Size       = 0x400;
 | |
|         internal const int HidUnkSection4Size       = 0x400;
 | |
|         internal const int HidUnkSection5Size       = 0x200;
 | |
|         internal const int HidUnkSection6Size       = 0x200;
 | |
|         internal const int HidUnkSection7Size       = 0x200;
 | |
|         internal const int HidUnkSection8Size       = 0x800;
 | |
|         internal const int HidControllerSerialsSize = 0x4000;
 | |
|         internal const int HidControllersSize       = 0x32000;
 | |
|         internal const int HidUnkSection9Size       = 0x800;
 | |
| 
 | |
|         internal const int HidKeyboardHeaderSize = 0x20;
 | |
|         internal const int HidKeyboardEntrySize  = 0x38;
 | |
| 
 | |
|         internal const int HidTouchHeaderSize = 0x28;
 | |
|         internal const int HidTouchEntrySize  = 0x298;
 | |
| 
 | |
|         internal const int HidTouchEntryHeaderSize = 0x10;
 | |
|         internal const int HidTouchEntryTouchSize  = 0x28;
 | |
| 
 | |
|         internal const int HidControllerSize        = 0x5000;
 | |
|         internal const int HidControllerHeaderSize  = 0x28;
 | |
|         internal const int HidControllerLayoutsSize = 0x350;
 | |
| 
 | |
|         internal const int HidControllersLayoutHeaderSize = 0x20;
 | |
|         internal const int HidControllersInputEntrySize   = 0x30;
 | |
| 
 | |
|         internal const int HidHeaderOffset            = 0;
 | |
|         internal const int HidTouchScreenOffset       = HidHeaderOffset            + HidHeaderSize;
 | |
|         internal const int HidMouseOffset             = HidTouchScreenOffset       + HidTouchScreenSize;
 | |
|         internal const int HidKeyboardOffset          = HidMouseOffset             + HidMouseSize;
 | |
|         internal const int HidUnkSection1Offset       = HidKeyboardOffset          + HidKeyboardSize;
 | |
|         internal const int HidUnkSection2Offset       = HidUnkSection1Offset       + HidUnkSection1Size;
 | |
|         internal const int HidUnkSection3Offset       = HidUnkSection2Offset       + HidUnkSection2Size;
 | |
|         internal const int HidUnkSection4Offset       = HidUnkSection3Offset       + HidUnkSection3Size;
 | |
|         internal const int HidUnkSection5Offset       = HidUnkSection4Offset       + HidUnkSection4Size;
 | |
|         internal const int HidUnkSection6Offset       = HidUnkSection5Offset       + HidUnkSection5Size;
 | |
|         internal const int HidUnkSection7Offset       = HidUnkSection6Offset       + HidUnkSection6Size;
 | |
|         internal const int HidUnkSection8Offset       = HidUnkSection7Offset       + HidUnkSection7Size;
 | |
|         internal const int HidControllerSerialsOffset = HidUnkSection8Offset       + HidUnkSection8Size;
 | |
|         internal const int HidControllersOffset       = HidControllerSerialsOffset + HidControllerSerialsSize;
 | |
|         internal const int HidUnkSection9Offset       = HidControllersOffset       + HidControllersSize;
 | |
| 
 | |
|         internal const int HidEntryCount = 17;
 | |
|     }
 | |
| }
 |