Adjust naming conventions for Ryujinx and ChocolArm64 projects (#484)

* Change naming convention for Ryujinx project

* Change naming convention for ChocolArm64 project

* Fix NaN

* Remove unneeded this. from Ryujinx project

* Adjust naming from new PRs

* Name changes based on feedback

* How did this get removed?

* Rebasing fix

* Change FP enum case

* Remove prefix from ChocolArm64 classes - Part 1

* Remove prefix from ChocolArm64 classes - Part 2

* Fix alignment from last commit's renaming

* Rename namespaces

* Rename stragglers

* Fix alignment

* Rename OpCode class

* Missed a few

* Adjust alignment
This commit is contained in:
Alex Barney 2018-10-30 19:43:02 -06:00 committed by gdkchan
parent 5a87e58183
commit 9cb57fb4bb
314 changed files with 19456 additions and 19456 deletions

View file

@ -5,7 +5,7 @@ using System;
namespace Ryujinx.UI.Input
{
public enum ControllerInputID
public enum ControllerInputId
{
Invalid,
@ -34,28 +34,28 @@ namespace Ryujinx.UI.Input
public struct JoyConControllerLeft
{
public ControllerInputID Stick;
public ControllerInputID StickButton;
public ControllerInputID DPadUp;
public ControllerInputID DPadDown;
public ControllerInputID DPadLeft;
public ControllerInputID DPadRight;
public ControllerInputID ButtonMinus;
public ControllerInputID ButtonL;
public ControllerInputID ButtonZL;
public ControllerInputId Stick;
public ControllerInputId StickButton;
public ControllerInputId DPadUp;
public ControllerInputId DPadDown;
public ControllerInputId DPadLeft;
public ControllerInputId DPadRight;
public ControllerInputId ButtonMinus;
public ControllerInputId ButtonL;
public ControllerInputId ButtonZl;
}
public struct JoyConControllerRight
{
public ControllerInputID Stick;
public ControllerInputID StickButton;
public ControllerInputID ButtonA;
public ControllerInputID ButtonB;
public ControllerInputID ButtonX;
public ControllerInputID ButtonY;
public ControllerInputID ButtonPlus;
public ControllerInputID ButtonR;
public ControllerInputID ButtonZR;
public ControllerInputId Stick;
public ControllerInputId StickButton;
public ControllerInputId ButtonA;
public ControllerInputId ButtonB;
public ControllerInputId ButtonX;
public ControllerInputId ButtonY;
public ControllerInputId ButtonPlus;
public ControllerInputId ButtonR;
public ControllerInputId ButtonZr;
}
public class JoyConController
@ -69,24 +69,24 @@ namespace Ryujinx.UI.Input
public JoyConControllerRight Right { private set; get; }
public JoyConController(
bool Enabled,
int Index,
float Deadzone,
float TriggerThreshold,
JoyConControllerLeft Left,
JoyConControllerRight Right)
bool enabled,
int index,
float deadzone,
float triggerThreshold,
JoyConControllerLeft left,
JoyConControllerRight right)
{
this.Enabled = Enabled;
this.Index = Index;
this.Deadzone = Deadzone;
this.TriggerThreshold = TriggerThreshold;
this.Left = Left;
this.Right = Right;
Enabled = enabled;
Index = index;
Deadzone = deadzone;
TriggerThreshold = triggerThreshold;
Left = left;
Right = right;
//Unmapped controllers are problematic, skip them
if (GamePad.GetName(Index) == "Unmapped Controller")
if (GamePad.GetName(index) == "Unmapped Controller")
{
this.Enabled = false;
Enabled = false;
}
}
@ -97,29 +97,29 @@ namespace Ryujinx.UI.Input
return 0;
}
GamePadState GpState = GamePad.GetState(Index);
GamePadState gpState = GamePad.GetState(Index);
HidControllerButtons Buttons = 0;
HidControllerButtons buttons = 0;
if (IsPressed(GpState, Left.DPadUp)) Buttons |= HidControllerButtons.KEY_DUP;
if (IsPressed(GpState, Left.DPadDown)) Buttons |= HidControllerButtons.KEY_DDOWN;
if (IsPressed(GpState, Left.DPadLeft)) Buttons |= HidControllerButtons.KEY_DLEFT;
if (IsPressed(GpState, Left.DPadRight)) Buttons |= HidControllerButtons.KEY_DRIGHT;
if (IsPressed(GpState, Left.StickButton)) Buttons |= HidControllerButtons.KEY_LSTICK;
if (IsPressed(GpState, Left.ButtonMinus)) Buttons |= HidControllerButtons.KEY_MINUS;
if (IsPressed(GpState, Left.ButtonL)) Buttons |= HidControllerButtons.KEY_L;
if (IsPressed(GpState, Left.ButtonZL)) Buttons |= HidControllerButtons.KEY_ZL;
if (IsPressed(gpState, Left.DPadUp)) buttons |= HidControllerButtons.KEY_DUP;
if (IsPressed(gpState, Left.DPadDown)) buttons |= HidControllerButtons.KEY_DDOWN;
if (IsPressed(gpState, Left.DPadLeft)) buttons |= HidControllerButtons.KEY_DLEFT;
if (IsPressed(gpState, Left.DPadRight)) buttons |= HidControllerButtons.KEY_DRIGHT;
if (IsPressed(gpState, Left.StickButton)) buttons |= HidControllerButtons.KEY_LSTICK;
if (IsPressed(gpState, Left.ButtonMinus)) buttons |= HidControllerButtons.KEY_MINUS;
if (IsPressed(gpState, Left.ButtonL)) buttons |= HidControllerButtons.KEY_L;
if (IsPressed(gpState, Left.ButtonZl)) buttons |= HidControllerButtons.KEY_ZL;
if (IsPressed(GpState, Right.ButtonA)) Buttons |= HidControllerButtons.KEY_A;
if (IsPressed(GpState, Right.ButtonB)) Buttons |= HidControllerButtons.KEY_B;
if (IsPressed(GpState, Right.ButtonX)) Buttons |= HidControllerButtons.KEY_X;
if (IsPressed(GpState, Right.ButtonY)) Buttons |= HidControllerButtons.KEY_Y;
if (IsPressed(GpState, Right.StickButton)) Buttons |= HidControllerButtons.KEY_RSTICK;
if (IsPressed(GpState, Right.ButtonPlus)) Buttons |= HidControllerButtons.KEY_PLUS;
if (IsPressed(GpState, Right.ButtonR)) Buttons |= HidControllerButtons.KEY_R;
if (IsPressed(GpState, Right.ButtonZR)) Buttons |= HidControllerButtons.KEY_ZR;
if (IsPressed(gpState, Right.ButtonA)) buttons |= HidControllerButtons.KEY_A;
if (IsPressed(gpState, Right.ButtonB)) buttons |= HidControllerButtons.KEY_B;
if (IsPressed(gpState, Right.ButtonX)) buttons |= HidControllerButtons.KEY_X;
if (IsPressed(gpState, Right.ButtonY)) buttons |= HidControllerButtons.KEY_Y;
if (IsPressed(gpState, Right.StickButton)) buttons |= HidControllerButtons.KEY_RSTICK;
if (IsPressed(gpState, Right.ButtonPlus)) buttons |= HidControllerButtons.KEY_PLUS;
if (IsPressed(gpState, Right.ButtonR)) buttons |= HidControllerButtons.KEY_R;
if (IsPressed(gpState, Right.ButtonZr)) buttons |= HidControllerButtons.KEY_ZR;
return Buttons;
return buttons;
}
public (short, short) GetLeftStick()
@ -142,71 +142,71 @@ namespace Ryujinx.UI.Input
return GetStick(Right.Stick);
}
private (short, short) GetStick(ControllerInputID Joystick)
private (short, short) GetStick(ControllerInputId joystick)
{
GamePadState GpState = GamePad.GetState(Index);
GamePadState gpState = GamePad.GetState(Index);
switch (Joystick)
switch (joystick)
{
case ControllerInputID.LJoystick:
return ApplyDeadzone(GpState.ThumbSticks.Left);
case ControllerInputId.LJoystick:
return ApplyDeadzone(gpState.ThumbSticks.Left);
case ControllerInputID.RJoystick:
return ApplyDeadzone(GpState.ThumbSticks.Right);
case ControllerInputId.RJoystick:
return ApplyDeadzone(gpState.ThumbSticks.Right);
default:
return (0, 0);
}
}
private (short, short) ApplyDeadzone(Vector2 Axis)
private (short, short) ApplyDeadzone(Vector2 axis)
{
return (ClampAxis(MathF.Abs(Axis.X) > Deadzone ? Axis.X : 0f),
ClampAxis(MathF.Abs(Axis.Y) > Deadzone ? Axis.Y : 0f));
return (ClampAxis(MathF.Abs(axis.X) > Deadzone ? axis.X : 0f),
ClampAxis(MathF.Abs(axis.Y) > Deadzone ? axis.Y : 0f));
}
private static short ClampAxis(float Value)
private static short ClampAxis(float value)
{
if (Value <= -short.MaxValue)
if (value <= -short.MaxValue)
{
return -short.MaxValue;
}
else
{
return (short)(Value * short.MaxValue);
return (short)(value * short.MaxValue);
}
}
private bool IsPressed(GamePadState GpState, ControllerInputID Button)
private bool IsPressed(GamePadState gpState, ControllerInputId button)
{
switch (Button)
switch (button)
{
case ControllerInputID.A: return GpState.Buttons.A == ButtonState.Pressed;
case ControllerInputID.B: return GpState.Buttons.B == ButtonState.Pressed;
case ControllerInputID.X: return GpState.Buttons.X == ButtonState.Pressed;
case ControllerInputID.Y: return GpState.Buttons.Y == ButtonState.Pressed;
case ControllerInputID.LStick: return GpState.Buttons.LeftStick == ButtonState.Pressed;
case ControllerInputID.RStick: return GpState.Buttons.RightStick == ButtonState.Pressed;
case ControllerInputID.LShoulder: return GpState.Buttons.LeftShoulder == ButtonState.Pressed;
case ControllerInputID.RShoulder: return GpState.Buttons.RightShoulder == ButtonState.Pressed;
case ControllerInputID.DPadUp: return GpState.DPad.Up == ButtonState.Pressed;
case ControllerInputID.DPadDown: return GpState.DPad.Down == ButtonState.Pressed;
case ControllerInputID.DPadLeft: return GpState.DPad.Left == ButtonState.Pressed;
case ControllerInputID.DPadRight: return GpState.DPad.Right == ButtonState.Pressed;
case ControllerInputID.Start: return GpState.Buttons.Start == ButtonState.Pressed;
case ControllerInputID.Back: return GpState.Buttons.Back == ButtonState.Pressed;
case ControllerInputId.A: return gpState.Buttons.A == ButtonState.Pressed;
case ControllerInputId.B: return gpState.Buttons.B == ButtonState.Pressed;
case ControllerInputId.X: return gpState.Buttons.X == ButtonState.Pressed;
case ControllerInputId.Y: return gpState.Buttons.Y == ButtonState.Pressed;
case ControllerInputId.LStick: return gpState.Buttons.LeftStick == ButtonState.Pressed;
case ControllerInputId.RStick: return gpState.Buttons.RightStick == ButtonState.Pressed;
case ControllerInputId.LShoulder: return gpState.Buttons.LeftShoulder == ButtonState.Pressed;
case ControllerInputId.RShoulder: return gpState.Buttons.RightShoulder == ButtonState.Pressed;
case ControllerInputId.DPadUp: return gpState.DPad.Up == ButtonState.Pressed;
case ControllerInputId.DPadDown: return gpState.DPad.Down == ButtonState.Pressed;
case ControllerInputId.DPadLeft: return gpState.DPad.Left == ButtonState.Pressed;
case ControllerInputId.DPadRight: return gpState.DPad.Right == ButtonState.Pressed;
case ControllerInputId.Start: return gpState.Buttons.Start == ButtonState.Pressed;
case ControllerInputId.Back: return gpState.Buttons.Back == ButtonState.Pressed;
case ControllerInputID.LTrigger: return GpState.Triggers.Left >= TriggerThreshold;
case ControllerInputID.RTrigger: return GpState.Triggers.Right >= TriggerThreshold;
case ControllerInputId.LTrigger: return gpState.Triggers.Left >= TriggerThreshold;
case ControllerInputId.RTrigger: return gpState.Triggers.Right >= TriggerThreshold;
//Using thumbsticks as buttons is not common, but it would be nice not to ignore them
case ControllerInputID.LJoystick:
return GpState.ThumbSticks.Left.X >= Deadzone ||
GpState.ThumbSticks.Left.Y >= Deadzone;
case ControllerInputId.LJoystick:
return gpState.ThumbSticks.Left.X >= Deadzone ||
gpState.ThumbSticks.Left.Y >= Deadzone;
case ControllerInputID.RJoystick:
return GpState.ThumbSticks.Right.X >= Deadzone ||
GpState.ThumbSticks.Right.Y >= Deadzone;
case ControllerInputId.RJoystick:
return gpState.ThumbSticks.Right.X >= Deadzone ||
gpState.ThumbSticks.Right.Y >= Deadzone;
default:
return false;