syntax = "proto2";

import "nanopb.proto";
import "enums.proto";

message GamepadOptions
{
	optional InputMode inputMode = 1;
	optional DpadMode dpadMode = 2;
	optional SOCDMode socdMode = 3;
	optional bool invertXAxis = 4;
	optional bool invertYAxis = 5;
	optional bool switchTpShareForDs4 = 6;
	optional bool lockHotkeys = 7;
	optional bool fourWayMode = 8;
	optional uint32 profileNumber = 9;
}

message KeyboardMapping
{
	optional uint32 keyDpadUp = 1;
	optional uint32 keyDpadDown = 2;
	optional uint32 keyDpadLeft = 3;
	optional uint32 keyDpadRight = 4;
	optional uint32 keyButtonB1 = 5;
	optional uint32 keyButtonB2 = 6;
	optional uint32 keyButtonB3 = 7;
	optional uint32 keyButtonB4 = 8;
	optional uint32 keyButtonL1 = 9;
	optional uint32 keyButtonR1 = 10;
	optional uint32 keyButtonL2 = 11;
	optional uint32 keyButtonR2 = 12;
	optional uint32 keyButtonS1 = 13;
	optional uint32 keyButtonS2 = 14;
	optional uint32 keyButtonL3 = 15;
	optional uint32 keyButtonR3 = 16;
	optional uint32 keyButtonA1 = 17;
	optional uint32 keyButtonA2 = 18;
}

message HotkeyEntry
{
	optional uint32 dpadMask = 1;
	optional GamepadHotkey action = 2;
	optional uint32 buttonsMask = 3;
	optional uint32 auxMask = 4;
}

message HotkeyOptions
{
	optional HotkeyEntry hotkey01 = 1;
	optional HotkeyEntry hotkey02 = 2;
	optional HotkeyEntry hotkey03 = 3;
	optional HotkeyEntry hotkey04 = 4;
	optional HotkeyEntry hotkey05 = 5;
	optional HotkeyEntry hotkey06 = 6;
	optional HotkeyEntry hotkey07 = 7;
	optional HotkeyEntry hotkey08 = 8;
	optional HotkeyEntry hotkey09 = 9;
	optional HotkeyEntry hotkey10 = 10;
	optional HotkeyEntry hotkey11 = 11;
	optional HotkeyEntry hotkey12 = 12;
}

message ForcedSetupOptions
{
	optional ForcedSetupMode mode = 1;
};

message ButtonLayoutParamsCommon
{
	optional int32 startX = 1;
	optional int32 startY = 2;
	optional int32 buttonRadius = 3;
	optional int32 buttonPadding = 4;
}

message ButtonLayoutParamsLeft
{
	optional ButtonLayout layout = 1;
	optional ButtonLayoutParamsCommon common = 2;
}

message ButtonLayoutParamsRight
{
	optional ButtonLayoutRight layout = 1;
	optional ButtonLayoutParamsCommon common = 2;
}

message ButtonLayoutCustomOptions
{
	optional ButtonLayoutParamsLeft paramsLeft = 1;
	optional ButtonLayoutParamsRight paramsRight = 2;
}

message PinMappings
{
	optional int32 pinDpadUp = 1;
	optional int32 pinDpadDown = 2;
	optional int32 pinDpadLeft = 3;
	optional int32 pinDpadRight = 4;
	optional int32 pinButtonB1 = 5;
	optional int32 pinButtonB2 = 6;
	optional int32 pinButtonB3 = 7;
	optional int32 pinButtonB4 = 8;
	optional int32 pinButtonL1 = 9;
	optional int32 pinButtonR1 = 10;
	optional int32 pinButtonL2 = 11;
	optional int32 pinButtonR2 = 12;
	optional int32 pinButtonS1 = 13;
	optional int32 pinButtonS2 = 14;
	optional int32 pinButtonL3 = 15;
	optional int32 pinButtonR3 = 16;
	optional int32 pinButtonA1 = 17;
	optional int32 pinButtonA2 = 18;
	optional int32 pinButtonFn = 19;
}


message AlternativePinMappings
{
	optional int32 pinButtonB1 = 1;
	optional int32 pinButtonB2 = 2;
	optional int32 pinButtonB3 = 3;
	optional int32 pinButtonB4 = 4;
	optional int32 pinButtonL1 = 5;
	optional int32 pinButtonR1 = 6;
	optional int32 pinButtonL2 = 7;
	optional int32 pinButtonR2 = 8;
}


message ProfileOptions
{
	repeated AlternativePinMappings alternativePinMappings = 1 [(nanopb).max_count = 3];
}

message DisplayOptions
{
	optional bool enabled = 1;
	
	optional int32 i2cBlock = 2;
	optional int32 i2cSDAPin = 3;
	optional int32 i2cSCLPin = 4;
	optional int32 i2cAddress = 5;
	optional int32 i2cSpeed = 6;
	
	optional ButtonLayout buttonLayout = 7;
	optional ButtonLayoutRight buttonLayoutRight = 8;
	optional ButtonLayoutCustomOptions buttonLayoutCustomOptions = 9;
	
	optional SplashMode splashMode = 10;
	optional SplashChoice splashChoice = 11;
	optional int32 splashDuration = 12;
	optional bytes splashImage = 13 [(nanopb).max_size = 1024];
	
	optional int32 size = 14;
	optional int32 flip = 15;
	optional bool invert = 16;
	
	optional int32 displaySaverTimeout = 17;
}

message LEDOptions
{
	optional int32 dataPin = 1;
	optional LEDFormat_Proto ledFormat = 2;
	optional ButtonLayout ledLayout = 3;
	optional uint32 ledsPerButton = 4;
	optional uint32 brightnessMaximum = 5;
	optional uint32 brightnessSteps = 6;
	
	optional int32 indexUp = 7;
	optional int32 indexDown = 8;
	optional int32 indexLeft = 9;
	optional int32 indexRight = 10;
	optional int32 indexB1 = 11;
	optional int32 indexB2 = 12;
	optional int32 indexB3 = 13;
	optional int32 indexB4 = 14;
	optional int32 indexL1 = 15;
	optional int32 indexR1 = 16;
	optional int32 indexL2 = 17;
	optional int32 indexR2 = 18;
	optional int32 indexS1 = 19;
	optional int32 indexS2 = 20;
	optional int32 indexL3 = 21;
	optional int32 indexR3 = 22;
	optional int32 indexA1 = 23;
	optional int32 indexA2 = 24;
	
	optional PLEDType pledType = 25;
	optional int32 pledPin1 = 26;
	optional int32 pledPin2 = 27;
	optional int32 pledPin3 = 28;
	optional int32 pledPin4 = 29;
	optional uint32 pledColor = 30;
};

// This has to be kept in sync with AnimationOptions in AnimationStation.hpp
message AnimationOptions_Proto
{
	optional uint32 baseAnimationIndex = 1;
	optional uint32 brightness = 2;
	optional uint32 staticColorIndex = 3;
	optional uint32 buttonColorIndex = 4;
	optional int32 chaseCycleTime = 5;
	optional int32 rainbowCycleTime = 6;
	optional uint32 themeIndex = 7;
	
	optional bool hasCustomTheme = 8;
	optional uint32 customThemeUp = 9;
	optional uint32 customThemeDown = 10;
	optional uint32 customThemeLeft = 11;
	optional uint32 customThemeRight = 12;
	optional uint32 customThemeB1 = 13;
	optional uint32 customThemeB2 = 14;
	optional uint32 customThemeB3 = 15;
	optional uint32 customThemeB4 = 16;
	optional uint32 customThemeL1 = 17;
	optional uint32 customThemeR1 = 18;
	optional uint32 customThemeL2 = 19;
	optional uint32 customThemeR2 = 20;
	optional uint32 customThemeS1 = 21;
	optional uint32 customThemeS2 = 22;
	optional uint32 customThemeL3 = 23;
	optional uint32 customThemeR3 = 24;
	optional uint32 customThemeA1 = 25;
	optional uint32 customThemeA2 = 26;
	optional uint32 customThemeUpPressed = 27;
	optional uint32 customThemeDownPressed = 28;
	optional uint32 customThemeLeftPressed = 29;
	optional uint32 customThemeRightPressed = 30;
	optional uint32 customThemeB1Pressed = 31;
	optional uint32 customThemeB2Pressed = 32;
	optional uint32 customThemeB3Pressed = 33;
	optional uint32 customThemeB4Pressed = 34;
	optional uint32 customThemeL1Pressed = 35;
	optional uint32 customThemeR1Pressed = 36;
	optional uint32 customThemeL2Pressed = 37;
	optional uint32 customThemeR2Pressed = 38;
	optional uint32 customThemeS1Pressed = 39;
	optional uint32 customThemeS2Pressed = 40;
	optional uint32 customThemeL3Pressed = 41;
	optional uint32 customThemeR3Pressed = 42;
	optional uint32 customThemeA1Pressed = 43;
	optional uint32 customThemeA2Pressed = 44;
}

message BootselButtonOptions
{
	optional bool enabled = 1;
	optional uint32 buttonMap = 2;
}

message OnBoardLedOptions
{
	optional OnBoardLedMode mode = 1;
	optional bool enabled = 2;
}

message AnalogOptions
{
	optional bool enabled = 1;
	
	optional int32 analogAdcPinX = 2;
	optional int32 analogAdcPinY = 3;
	optional bool forced_circularity = 4;
	optional uint32 analog_deadzone = 5;
}

message TurboOptions
{
	optional bool enabled = 1;
	
	optional int32 buttonPin = 2;
	optional int32 ledPin = 3;
	optional uint32 shotCount = 4;
	optional int32 shmupDialPin = 5;
	
	optional bool shmupModeEnabled = 6;
	optional uint32 shmupAlwaysOn1 = 7;
	optional uint32 shmupAlwaysOn2 = 8;
	optional uint32 shmupAlwaysOn3 = 9;
	optional uint32 shmupAlwaysOn4 = 10;
	optional int32 shmupBtn1Pin = 11;
	optional int32 shmupBtn2Pin = 12;
	optional int32 shmupBtn3Pin = 13;
	optional int32 shmupBtn4Pin = 14;
	optional uint32 shmupBtnMask1 = 15;
	optional uint32 shmupBtnMask2 = 16;
	optional uint32 shmupBtnMask3 = 17;
	optional uint32 shmupBtnMask4 = 18;
	optional ShmupMixMode shmupMixMode = 19;
}

message SliderOptions
{
	optional bool enabled = 1;
	
	optional int32 pinLS = 2;
	optional int32 pinRS = 3;
}

message SOCDSliderOptions
{
	optional bool enabled = 1;
	
	optional int32 pinOne = 2;
	optional int32 pinTwo = 3;
	
	optional SOCDMode modeDefault = 4;
	optional SOCDMode modeOne = 5;
	optional SOCDMode modeTwo = 6;
}

message ReverseOptions
{
	optional bool enabled = 1;
	
	optional int32 buttonPin = 2;
	optional int32 ledPin = 3;
	
	optional uint32 actionUp = 4;
	optional uint32 actionDown = 5;
	optional uint32 actionLeft = 6;
	optional uint32 actionRight = 7;
}

message AnalogADS1219Options
{
	optional bool enabled = 1;
	
	optional int32 i2cBlock = 2;
	optional int32 i2cSDAPin = 3;
	optional int32 i2cSCLPin = 4;
	optional int32 i2cAddress = 5;
	optional int32 i2cSpeed = 6;
}

message DualDirectionalOptions
{
	optional bool enabled = 1;
	
	optional int32 upPin = 2;
	optional int32 downPin = 3;
	optional int32 leftPin = 4;
	optional int32 rightPin = 5;
	
	optional DpadMode dpadMode = 6;
	optional uint32 combineMode = 7;
	optional bool fourWayMode = 8;
}

message TiltOptions
{
	optional bool enabled = 1;

	optional int32 tilt1Pin = 2;
	optional int32 tilt2Pin = 3;
	optional int32 tiltFunctionPin = 4;
	optional int32 tiltLeftAnalogUpPin = 5;
	optional int32 tiltLeftAnalogDownPin = 6;
	optional int32 tiltLeftAnalogLeftPin = 7;
	optional int32 tiltLeftAnalogRightPin = 8;
	optional int32 tiltRightAnalogUpPin = 9;
	optional int32 tiltRightAnalogDownPin = 10;
	optional int32 tiltRightAnalogLeftPin = 11;
	optional int32 tiltRightAnalogRightPin = 12;

	optional SOCDMode tiltSOCDMode = 13;
}

message BuzzerOptions
{
	optional bool enabled = 1;
	
	optional int32 pin = 2;
	optional uint32 volume = 3;
}

message ExtraButtonOptions
{
	optional bool enabled = 1;
	
	optional int32 pin = 2;
	optional uint32 buttonMap = 3;
}

message PlayerNumberOptions
{
	optional bool enabled = 1;
	optional uint32 number = 2;
}

message PS4Options
{
	optional bool enabled = 1;
	optional bytes serial = 2 [(nanopb).max_size = 16];
	optional bytes signature = 3 [(nanopb).max_size = 256];
	optional bytes rsaN = 4 [(nanopb).max_size = 256];
	optional bytes rsaE = 5 [(nanopb).max_size = 4];
	optional bytes rsaD = 6 [(nanopb).max_size = 256];
	optional bytes rsaP = 7 [(nanopb).max_size = 128];
	optional bytes rsaQ = 8 [(nanopb).max_size = 128];
	optional bytes rsaDP = 9 [(nanopb).max_size = 128];
	optional bytes rsaDQ = 10 [(nanopb).max_size = 128];
	optional bytes rsaQP = 11 [(nanopb).max_size = 128];
	optional bytes rsaRN = 12 [(nanopb).max_size = 256];
}

message WiiOptions
{
	optional bool enabled = 1;
	optional int32 i2cBlock = 2;
	optional int32 i2cSDAPin = 3;
	optional int32 i2cSCLPin = 4;
	optional int32 i2cSpeed = 5;
}

message SNESOptions
{
	optional bool enabled = 1;
	optional int32 clockPin = 2;
	optional int32 latchPin = 3;
	optional int32 dataPin = 4;
}

message KeyboardHostOptions
{
	optional bool enabled = 1;
	optional int32 pinDplus = 2;
	optional KeyboardMapping mapping = 3;
}

message FocusModeOptions
{
	optional bool enabled = 1;
	optional int32 pin = 2;
	optional int32 buttonLockMask = 3;
	optional bool oledLockEnabled = 4;
	optional bool rgbLockEnabled = 5;
	optional bool buttonLockEnabled = 6;
}

message AddonOptions
{
	optional BootselButtonOptions bootselButtonOptions = 1;
	optional OnBoardLedOptions onBoardLedOptions = 2;
	optional AnalogOptions analogOptions = 3;
	optional TurboOptions turboOptions = 4;
	optional SliderOptions sliderOptions = 5;
	optional ReverseOptions reverseOptions = 6;
	optional AnalogADS1219Options analogADS1219Options = 7;
	optional DualDirectionalOptions dualDirectionalOptions = 8;
	optional BuzzerOptions buzzerOptions = 9;
	optional ExtraButtonOptions extraButtonOptions = 10;
	optional PlayerNumberOptions playerNumberOptions = 11;
	optional PS4Options ps4Options = 12 [(nanopb).disallow_export = true];
	optional WiiOptions wiiOptions = 13;
	optional SOCDSliderOptions socdSliderOptions = 14;
	optional SNESOptions snesOptions = 15;
	optional FocusModeOptions focusModeOptions = 16;
	optional KeyboardHostOptions keyboardHostOptions = 17;
	optional TiltOptions tiltOptions = 18;
}

message Config
{
	optional string boardVersion = 1 [(nanopb).max_length = 31];
	
	optional GamepadOptions gamepadOptions = 2;
	optional HotkeyOptions hotkeyOptions = 3;
	optional PinMappings pinMappings = 4;
	optional KeyboardMapping keyboardMapping = 5;
	optional DisplayOptions displayOptions = 6;
	optional LEDOptions ledOptions = 7;
	optional AnimationOptions_Proto animationOptions = 8;
	optional AddonOptions addonOptions = 9;
	optional ForcedSetupOptions forcedSetupOptions = 10;
	optional ProfileOptions profileOptions = 11;
}
