Hier die "API Dokumentation":__blackjack__ hat geschrieben: ↑Montag 2. Juli 2018, 21:39 @xXSkyWalkerXx1: Was meinst Du mit ”öffnen”? Da ist Maschinensprache drin die Dein Prozessor ausführen kann, und eventuell auch Daten. Wobei es heutzutage auch möglich wäre das .NET-Bytecode für die .NET-VM enthalten ist. Dann könnte man den Code *vielleicht* auch auf einem Raspi verwenden. Auf jeden Fall bräuchte man eine API-Beschreibung, denn an den exportierten Symbolen alleine wird man wohl nur in seltenen/einfachen Fällen raten können wie man die API benutzt.
Werkzeug für native DLLs wäre beispielsweise Dependency Walker. Für .NET gibt's sicher auch irgendwas was da ein wenig Reflection betreibt.
Code: Alles auswählen
Classes:
OutputBuffer:
public readonly int[] Outputs; - an array holding the 36 output values (index 0 - 29 are controller outputs and 30 - 35 are TRACE_1 - TRACE_6)
public int Output00; - A property that directly gets you the value of index 0 from the above array
public int Output01; - A property that directly gets you the value of index 1 from the above array
... all the way to Output29
public int Trace1; - A Property that directly gets you the TRACE_1 value from the above array
public int Trace2; - A Property that directly gets you the TRACE_2 value from the above array
... all the way to Trace6
This class is used to hold the Output & Trace values for I/O Status
InputBuffer:
public readonly int[] Inputs; - Similar to Outputs in OutputBuffer except for Inputs...
public int Input00; - A property that directly gets you the value of index 0 from the above array
public int Input01; - A property that directly gets you the value of index 1 from the above array
... all the way to Input29
This class is used to hold the Input values for I/O Status
CmCommand:
Same as OutputBuffer, just used slightly differently internally
This class is used to send controller output to the CM through the API Mode (it ONLY effects the controller output, nothing else)
CmCommandEx:
Same as CmCommand with the addition of controlling various other things:
public bool ResetLeds; - A variable used to determine if you wish to reset the leds to their default values (as defined by the console)
public bool TurnOffController; - A variable used to determine if you wish to turn off the controller
public bool ResetRumble; - A property used to determine if you wish to reset the rumble to their default state (and thus disable blocking rumble)
public int RumbleA; - A property used to determine how much RUMBLE_A should be set to - Range: 0 - 100
public int RumbleB; - A property used to determine how much RUMBLE_B should be set to - Range: 0 - 100
public int RumbleLT; - A property used to determine how much RUMBLE_LT should be set to - Range: 0 - 100
public int RumbleRT; - A property used to determine how much RUMBLE_RT should be set to - Range: 0 - 100
public bool BlockRumble; - A Property used to determine if you wish to block the rumble packet completely
public IOStatus.LedState Led1; - A Property used to determine the state of LED_1
public IOStatus.LedState Led2; - A Property used to determine the state of LED_2
public IOStatus.LedState Led3; - A Property used to determine the state of LED_3
public IOStatus.LedState Led4; - A Property used to determine the state of LED_4
public CmCommandEx CreateCoppy(); - A Function that generates a copy to retain settings without sending flags that things changed (use this if you already have a instance of this class, otherwise create a new instance)
IOStatus:
public enum ConsoleType {
None = 0x00, // No Console connected
Ps3 = 0x01, // Connected to a PS3
Xb360 = 0x02, // Connected to a Xbox 360
Ps4 = 0x03, // Connected to a PS4
Xb1 = 0x04, // Connected to a Xbox One
Wheel = 0x08, // Wheel Edition outputs as a Wheel, this bit is set for that
Ps3Wheel = Ps3 | Wheel, // A Combination flag for PS3/Wheel (Not used)
Xb360Wheel = Xb360 | Wheel, // A Combination flag for Xbox 360/Wheel (Not used)
Ps4Wheel = Ps4 | Wheel, // A Combination flag for PS4/Wheel - Used with Wheel Edition (Outputting as a G29)
Xb1Wheel = Xb1 | Wheel // A Combination flag for Xbox 1/Wheel (Not used)
}
public enum ControllerType {
None = 0x00, // No Controller connected
Ps3 = 0x10, // A Dualshock 3 Controller connected
Xb360 = 0x20, // A Xbox 360 Controller connected
Wii = 0x30, // A Wiimote Controller connected
WiiN = 0x31, // A Wiimote Controller with a Nunchuck connected
WiiPro = 0x32, // A Wii Classic Pro controller connected
Ps4 = 0x40, // A Dualshock 4 Controller connected
Xb1 = 0x50, // A Xbox One Controller connected
G25 = 0x69, // A Logitech G25 Wheel connected (Wheel Edition Only)
G27 = 0x6B // A Logitech G27 Wheel connected (Wheel Edition Only)
}
public enum LedState {
Off = 0, // Led# is Off
On = 1, // Led# is On
Blink = 2, // Led# is Blinking
BlinkSlow = 3 // Led# is Blinking Slowly
}
public readonly InputBuffer InputStatus; - A Variable holding the current Input Values
public readonly OutputBuffer OutputStatus; - A Variable holding the current Output & Trace Values
public string Console; - A Readonly Property that is a text representation of the currently connected console
public ConsoleType ConnectedConsole; - A Readonly Property that holds a flag telling you what console the CM is connected to
public string Controller; - A Readonly Property that is a text representation of the currently connected controller
public ControllerType ConnectedController; - A Readonly Property that holds a flag telling you what controller is connected to the CM
public DateTime Timestamp; - A Readonly Property that is a timestamp for when this I/O Status was generated
public string Slot; - A Readonly Property that is a text representation of the currently used slot
public int SlotValue; - A Readonly Property that holds the value of the current slot, range: 0 - 10 (10 is when you have loaded a script rather then using an actual slot on the CM)
public string Battery; - A Readonly Property that is a text representation of the current state of the battery, 0 - 100% or "Charging"
public int BatteryValue; - A Readonly Property that holds the value of the battery Range: 0 - 100 (normal) anything above 100 means it's charging... the stepping is 10
public string Cpuload; - A Readonly Property that is a text representation of the current Cpuload of the CM
public int CpuloadValue; - A Readonly Property that holds the current value of the current Cpuload of the CmCommand
public string Led1; - A Readonly Property that is a text representation of the current state of LED_1
public LedState LedState1; - A Readonly Property that holds the current state of LED_1
public string Led2; - A Readonly Property that is a text representation of the current state of LED_2
public LedState LedState2; - A Readonly Property that holds the current state of LED_2
public string Led3; - A Readonly Property that is a text representation of the current state of LED_3
public LedState LedState3; - A Readonly Property that holds the current state of LED_3
public string Led4; - A Readonly Property that is a text representation of the current state of LED_4
public LedState LedState4; - A Readonly Property that holds the current state of LED_4
public string RumbleA; - A Readonly Property that is a text representation of the current state of RUMBLE_A
public int RumbleA; - A Readonly Property that holds the value of the current state of RUMBLE_A, Range: 0 - 100
public string RumbleB; - A Readonly Property that is a text representation of the current state of RUMBLE_B
public int RumbleB; - A Readonly Property that holds the value of the current state of RUMBLE_B, Range: 0 - 100
public string RumbleLt; - A Readonly Property that is a text representation of the current state of RUMBLE_LT
public int RumbleLt; - A Readonly Property that holds the value of the current state of RUMBLE_LT, Range: 0 - 100
public string RumbleRt; - A Readonly Property that is a text representation of the current state of RUMBLE_RT
public int RumbleRt; - A Readonly Property that holds the value of the current state of RUMBLE_RT, Range: 0 - 100
This class is used to tell you what the current state of the CM is in (Everything you can see in Device Monitor)
IOLabels:
public static string[] GetLabels(IOStatus.ControllerType controller); - A Function that returns an array of 30 strings representing the fields of the controller passed to the function, where there is no name a null value is set
public static string[] GetLabels(IOStatus.ConsoleType console); - A Function that returns an array of 30 strings representing the fields of the console passed to the function, where there is no name a null value is set
This static class is used to get the labels for the various buttons
DeviceSettings:
public enum BackLightValues {
Disabled = 0x00, // CM Backlight Disabled
Blue = 0x01, // CM Backlight Custom - Blue
Green = 0x02, // CM Backlight Custom - Green
Cyan = 0x03, // CM Backlight Custom - Cyan
Red = 0x04, // CM Backlight Custom - Red
Magenta = 0x05, // CM Backlight Custom - Magenta
Yellow = 0x06, // CM Backlight Custom - Yellow
White = 0x07, // CM Backlight Custom - White
Custom = Blue | Green | Cyan | Red | Magenta | Yellow | White, // CM Backlight Custom - This value should NOT be set, it's a flag you can use to check if it's custom or not
StrictControllerPlayerLeds = 0x40, // CM Backlight Strict Controller Player Leds (It ignores GPC changes)
MimicControllerPlayerLeds = 0x80 // CM Backlight Mimic Controller Player Leds (It follows whatever GPC says)
}
public enum BtRumbles {
Fullspeed = 0x00, // Full Speed - No limitations
FlowControl = 0x01, // Flow Control - Some limitations
FlowControlPlus = 0x02, // Flow Control+ - Less limitations then above
Disabled = 0x03 // Disabled - Completely disabled
}
public enum Consoles {
Automatic = 0x00, // Automatic Output Protocol
Ps3 = 0x01, // Force PS3 Output Protocol
Xb360 = 0x02, // Force Xbox 360 Output Protocol
Ps4 = 0x03, // Force PS4 Output Protocol
Xb1 = 0x04 // Force Xbox One Output Protocol
}
public enum TimeoutValues {
Disabled = 0, // Don't turn off the controller due to inactivity
Minutes5 = 5, // Wait 5 minutes before turning off the controller
Minutes10 = 10, // Wait 10 minutes before turning off the controller
Minutes15 = 15, // Wait 15 minutes before turning off the controller
Minutes20 = 20, // Wait 20 minutes before turning off the controller
Minutes30 = 30, // Wait 30 minutes before turning off the controller
Minutes60 = 60 // Wait 60 minutes before turning off the controller
}
public BtRumbles BtRumble;
public bool BtSearching;
public bool Ds3AutoPair;
public byte Ds4LightbarBrightness;
public TimeoutValues IdleTimeout;
public Consoles OutputProtocol;
public bool PartialDs4CrossOver;
public bool RemoteControlSlot;
public bool RemoteControlSlotG8;
public bool SlotRecall;
public bool InFrameOut;
public bool InFrameIn;
public bool OneMsResponse;
public bool Ds4BtBoost;
This class is used to determine what settings the current CM has along with saving new settings
DeviceInformation:
public enum OperationalModes {
Unknown, // The operational mode of this CM isn't supported/known
Standard, // It's the Standard Edition firmware...
TournamentEdition, // It's the Tournament Edition firmware...
WheelEdition // It's the PS4 Wheel Edition firmware...
}
public enum States {
Disconnected, // There is no supported CM connected/detected/found
Connected, // There is a supported CM connected in it's standard mode, and it's ready for communication
ApiMode, // There is a supported CM connected in it's API mode, and it's ready for API commands
Updating // There is a supported CM connected, and we are attempting to get information about it (Operational Mode, Firmware Version etc.)
}
public States State; - A readonly property telling you what state the CM is currently in
public Version Fw; - A readonly property telling you what firmware the currently connected CM has (null if unknown [only happening while "updating"])
public OperationalModes OperationalMode; - A readonly property telling you what operational mode the current CM is in
public bool IsHubCompatible; - A readonly property telling you whether or not the currently connected CM is "Hub Compatible" (1.21+ only)
This class i used to determine what state the current CM is in, along with giving you some basic information about it...
CommandFailedEventArgs:
public enum Commands {
RequestIoStatus,
LoadScript,
ApiModeBuffer,
RequestDeviceSettings,
SaveDeviceSettings,
EnterApiMode,
ExitApiMode,
UnloadGpc,
ChangeSlot,
TurnOffController,
GetDeviceInfo
}
public enum FailureReasons {
DeviceNotConnected,
FailedToSendCommand,
FailedToReadResult,
NeedApiMode
}
public Commands Command; - The command that failed
public FailureReasons Reason; - The reason it failed (DeviceNotConnected means it was disconnected, or you didn't have a CM connected before sending a request, NeedApiMode means you're currently not in API Mode which you need to be to use that particular command...)
SingleDevice:
public EventHandler<DeviceInformation> DeviceInformationChanged; - A EventHandler that you can register to in order to be notified of when the information/status of the connected CM changes
public EventHandler<DeviceSettings> DeviceSettingsChanged; - A EventHandler that you can register to in order to be notified of when the settings changed (when a request for the device settings has been completed)
public EventHandler<IOStatus> IOStatusChanged; - A EventHandler that you can register to in order to be notified of when the I/O Status changes (as a response to your request for an IO Status update, or an API mode output call)
public EventHandler<CommandFailedEventArgs> CommandFailed; - A Eventhandler that you can register to in order to be notified if/when a command failed, this is primarily for debugging purposes and/or so you can tell when the CM is malfunctioning for whatever reason
public void StartWorkerThreads(); - A function you must call in order for the API to actually work (this is what makes the API actually function, it's got it's own threads for the communication with the CM)
public void StopWorkerThreads(); - A function you can call to stop the API's worker threads, use this when you close your application, otherwise it may prevent your app from exiting
public DeviceInformation GetLastDeviceInfo(); - A function you can call to get the last DeviceInformation/State (current info/state)
public DeviceSettings GetLastDeviceSettings(); - A function you can call to get the last DeviceSettings (current settings, NOTE: this function only returns the last settings as per your last request's response from the CM) NOTE: this function will return null if there has been no request made, otherwise it'll return whatever is cached in memory since last completed request
public void RequestSettings(); - A function you can call to request the current settings of the currently connected CM, NOTE: this function cannot be used while in API mode
public void SaveSettings(DeviceSettings settings); - A function you can call to save the settings you pass to it to the currently connected CM, NOTE: this function cannot be used while in API mode
public void EnterApiMode(); - A function you must call before you can start sending out API output packets, NOTE: this function cannot be used while in API mode
public void ExitApiMode(); - A function you can call to return to "normal" state if/when you want to stop sending API output packets, NOTE: This function can only be used while in API mode
public void RequestIoStatus(); - A function you can call to request the current I/O status, NOTE: this function cannot be used while in API mode
public void UnloadGpc(); - A function you can call to unload the current GPC script from memory, NOTE: this function cannot be used while in API mode
public void LoadGpc(byte[] bytecode); - A function you can call to send a compiled GPC script (bytecode) to the CM, NOTE: this function cannot be used while in API mode
public void LoadGpc(string filename); - Same as above, except it takes a filename and will load whatever is in the file as bytecode, NOTE: this function cannot be used while in API mode
public void ChangeSlot(); - A function you can call to switch slot on the CM, NOTE: this function cannot be used while in API mode
public void TurnOffController(); - A function you can call to turn off the currently connected controller, NOTE: this function cannot be used while in API mode
public bool SendApiModeData(CmCommand buffer); - A function you can call to send controller output, see CmCommand for more information about the buffer, it will return true if the buffer was actually sent, otherwise false, NOTE: This function can only be used while in API Mode
public bool SendApiModeData(CmCommandEx buffer); - A function you can call to send controller output along with Leds, Rumbles etc. see CmCommandEx for more information about the buffer, it will return true if the buffer was actually sent, otherwise false, NOTE: This function can only be used while in API Mode