KeyPressConditional.cs 908 B

1234567891011121314151617181920212223242526
  1. using Ryujinx.HLE.HOS.Tamper.Conditions;
  2. namespace Ryujinx.HLE.HOS.Tamper.CodeEmitters
  3. {
  4. /// <summary>
  5. /// Code type 8 enters or skips a conditional block based on whether a key combination is pressed.
  6. /// </summary>
  7. class KeyPressConditional
  8. {
  9. private const int InputMaskIndex = 1;
  10. private const int InputMaskSize = 7;
  11. public static ICondition Emit(byte[] instruction, CompilationContext context)
  12. {
  13. // 8kkkkkkk
  14. // k: Keypad mask to check against, see below.
  15. // Note that for multiple button combinations, the bitmasks should be ORd together.
  16. // The Keypad Values are the direct output of hidKeysDown().
  17. ulong inputMask = InstructionHelper.GetImmediate(instruction, InputMaskIndex, InputMaskSize);
  18. return new InputMask((long)inputMask, context.PressedKeys);
  19. }
  20. }
  21. }