private bool UpdatePadState() { NpadStyle handheldStyle = Npad.GetStyleSet(NpadId.Handheld); NpadState handheldState = new NpadState(); if (handheldStyle != NpadStyle.None) { Npad.GetState(ref handheldState, NpadId.Handheld, handheldStyle); if (handheldState.buttons != NpadButton.None) { if ((npadId != NpadId.Handheld) || (npadStyle != handheldStyle)) { this.GetSixAxisSensor(NpadId.Handheld, handheldStyle); } npadId = NpadId.Handheld; npadStyle = handheldStyle; npadState = handheldState; return(true); } } NpadStyle no1Style = Npad.GetStyleSet(NpadId.No1); NpadState no1State = new NpadState(); if (no1Style != NpadStyle.None) { Npad.GetState(ref no1State, NpadId.No1, no1Style); if (no1State.buttons != NpadButton.None) { if ((npadId != NpadId.No1) || (npadStyle != no1Style)) { this.GetSixAxisSensor(NpadId.No1, no1Style); } npadId = NpadId.No1; npadStyle = no1Style; npadState = no1State; return(true); } } if ((npadId == NpadId.Handheld) && (handheldStyle != NpadStyle.None)) { npadId = NpadId.Handheld; npadStyle = handheldStyle; npadState = handheldState; } else if ((npadId == NpadId.No1) && (no1Style != NpadStyle.None)) { npadId = NpadId.No1; npadStyle = no1Style; npadState = no1State; } else { npadId = NpadId.Invalid; npadStyle = NpadStyle.Invalid; npadState.Clear(); return(false); } return(true); }
public static SharedMemory Create() { SharedMemory result = new SharedMemory { DebugPad = RingLifo <DebugPadState> .Create(), TouchScreen = RingLifo <TouchScreenState> .Create(), Mouse = RingLifo <MouseState> .Create(), Keyboard = RingLifo <KeyboardState> .Create(), }; for (int i = 0; i < result.Npads.Length; i++) { result.Npads[i] = NpadState.Create(); } return(result); }
} // 0x008F5480-0x008F5580 private static bool UpdatePadState(ref NpadId npadId, ref NpadStyle npadStyle, ref NpadState npadState) => default; // 0x008F5580-0x008F56D0
private bool UpdatePadState() { nn.hid.NpadStyle handheldStyle = Npad.GetStyleSet(nn.hid.NpadId.Handheld); NpadState handheldState = new NpadState(); nn.hid.NpadStyle no1Style = Npad.GetStyleSet(nn.hid.NpadId.No1); NpadState no1State = new NpadState(); if (playerID == 0) { if (handheldStyle != nn.hid.NpadStyle.None) { Npad.GetState(ref handheldState, nn.hid.NpadId.Handheld, handheldStyle); if (handheldState.buttons != nn.hid.NpadButton.None) { if ((npadId != nn.hid.NpadId.Handheld) || (npadStyle != handheldStyle)) { this.GetVibrationDevice(nn.hid.NpadId.Handheld, handheldStyle); } npadId = nn.hid.NpadId.Handheld; npadStyle = handheldStyle; npadState = handheldState; return(true); } } if (no1Style != nn.hid.NpadStyle.None) { Npad.GetState(ref no1State, nn.hid.NpadId.No1, no1Style); if (no1State.buttons != nn.hid.NpadButton.None) { if ((npadId != nn.hid.NpadId.No1) || (npadStyle != no1Style)) { this.GetVibrationDevice(nn.hid.NpadId.No1, no1Style); } npadId = nn.hid.NpadId.No1; npadStyle = no1Style; npadState = no1State; return(true); } } } nn.hid.NpadStyle no2Style = Npad.GetStyleSet(nn.hid.NpadId.No2); NpadState no2State = new NpadState(); if (playerID == 1) { if (no2Style != nn.hid.NpadStyle.None) { Npad.GetState(ref no2State, nn.hid.NpadId.No2, no2Style); if (no2State.buttons != nn.hid.NpadButton.None) { if ((npadId != nn.hid.NpadId.No2) || (npadStyle != no2Style)) { this.GetVibrationDevice(nn.hid.NpadId.No2, no2Style); } npadId = nn.hid.NpadId.No2; npadStyle = no2Style; npadState = no2State; return(true); } } } nn.hid.NpadStyle no3Style = Npad.GetStyleSet(nn.hid.NpadId.No3); NpadState no3State = new NpadState(); if (playerID == 2) { if (no3Style != nn.hid.NpadStyle.None) { Npad.GetState(ref no3State, nn.hid.NpadId.No3, no3Style); if (no3State.buttons != nn.hid.NpadButton.None) { if ((npadId != nn.hid.NpadId.No3) || (npadStyle != no3Style)) { this.GetVibrationDevice(nn.hid.NpadId.No3, no3Style); } npadId = nn.hid.NpadId.No3; npadStyle = no3Style; npadState = no3State; return(true); } } } nn.hid.NpadStyle no4Style = Npad.GetStyleSet(nn.hid.NpadId.No4); NpadState no4State = new NpadState(); if (playerID == 3) { if (no4Style != nn.hid.NpadStyle.None) { Npad.GetState(ref no4State, nn.hid.NpadId.No4, no4Style); if (no4State.buttons != nn.hid.NpadButton.None) { if ((npadId != nn.hid.NpadId.No4) || (npadStyle != no4Style)) { this.GetVibrationDevice(nn.hid.NpadId.No4, no4Style); } npadId = nn.hid.NpadId.No4; npadStyle = no4Style; npadState = no4State; return(true); } } } if (playerID == 0 && (npadId == nn.hid.NpadId.Handheld) && (handheldStyle != nn.hid.NpadStyle.None)) { npadId = nn.hid.NpadId.Handheld; npadStyle = handheldStyle; npadState = handheldState; } else if (playerID == 0 && (npadId == nn.hid.NpadId.No1) && (no1Style != nn.hid.NpadStyle.None)) { npadId = nn.hid.NpadId.No1; npadStyle = no1Style; npadState = no1State; } else if (playerID == 1 && (npadId == nn.hid.NpadId.No2) && (no2Style != nn.hid.NpadStyle.None)) { npadId = nn.hid.NpadId.No2; npadStyle = no2Style; npadState = no2State; } else if (playerID == 2 && (npadId == nn.hid.NpadId.No3) && (no3Style != nn.hid.NpadStyle.None)) { npadId = nn.hid.NpadId.No3; npadStyle = no3Style; npadState = no3State; } else if (playerID == 3 && (npadId == nn.hid.NpadId.No4) && (no4Style != nn.hid.NpadStyle.None)) { npadId = nn.hid.NpadId.No4; npadStyle = no4Style; npadState = no4State; } else { npadId = nn.hid.NpadId.Invalid; npadStyle = nn.hid.NpadStyle.Invalid; npadState.Clear(); return(false); } return(true); }