protected override void ControllerAxisMoved(ControllerAxisEventArgs e) { if (e.Axis == ControllerAxis.LeftStickX || e.Axis == ControllerAxis.LeftStickY) { short x = Controller.GetAxisValue(e.Controller.PlayerIndex, ControllerAxis.LeftStickX); short y = Controller.GetAxisValue(e.Controller.PlayerIndex, ControllerAxis.LeftStickY); if (x > 10000) { InputBits &= 0b11111110; if ((Gameboy.Memory.RAM[0xFF00] & 0b10000) == 0) { Gameboy.Memory[0xFFFF] |= 0b10000; } } else if (x < -10000) { InputBits &= 0b11111101; if ((Gameboy.Memory.RAM[0xFF00] & 0b10000) == 0) { Gameboy.Memory[0xFFFF] |= 0b10000; } } else { InputBits |= 0b00000001; InputBits |= 0b00000010; } if (y > 10000) { InputBits &= 0b11110111; if ((Gameboy.Memory.RAM[0xFF00] & 0b10000) == 0) { Gameboy.Memory[0xFFFF] |= 0b10000; } } else if (y < -10000) { InputBits &= 0b11111011; if ((Gameboy.Memory.RAM[0xFF00] & 0b10000) == 0) { Gameboy.Memory[0xFFFF] |= 0b10000; } } else { InputBits |= 0b00000100; InputBits |= 0b00001000; } } }
protected override void ControllerAxisMoved(ControllerAxisEventArgs e) { if (e.Axis == ControllerAxis.LeftStickX) { if ((Controller.DeviceCount > 1 && e.Controller.PlayerIndex == 0) || Controller.DeviceCount == 1) { if (e.Value < -10000) { Machine.InputPort1 |= 0b100000; } else { Machine.InputPort1 &= 0b11011111; } if (e.Value > 10000) { Machine.InputPort1 |= 0b1000000; } else { Machine.InputPort1 &= 0b10111111; } } if ((Controller.DeviceCount > 1 && e.Controller.PlayerIndex == 1) || Controller.DeviceCount == 1) { if (e.Value < -10000) { Machine.InputPort2 |= 0b100000; } else { Machine.InputPort2 &= 0b11011111; } if (e.Value > 10000) { Machine.InputPort2 |= 0b1000000; } else { Machine.InputPort2 &= 0b10111111; } } } }
protected virtual void ControllerAxisMoved(ControllerAxisEventArgs e) { }
internal void OnControllerAxisMoved(ControllerAxisEventArgs e) => ControllerAxisMoved(e);
protected override void ControllerAxisMoved(ControllerAxisEventArgs e) { _log.Info($"Controller axis '{e.Axis}' moved."); }