1
0
mirror of synced 2024-11-16 15:33:50 +00:00

Release build for LogiJoystickDLL, directly exporting the LogiJoystick.lib functions

Note: LogiJoystick.pas has not been updated yet!
G940LEDControl intermediate check-in before XE conversion due to weird Delphi 2007 linker errors
This commit is contained in:
Mark van Renswoude 2012-01-08 14:34:04 +00:00
parent ce216f3022
commit 2af968faef
22 changed files with 546 additions and 371 deletions

View File

@ -14,8 +14,8 @@ object MainForm: TMainForm
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
OnDestroy = FormDestroy
PixelsPerInch = 96
TextHeight = 13
object pcConnections: TPageControl
@ -670,9 +670,4 @@ object MainForm: TMainForm
OnClick = btnRetryClick
end
end
object tmrG940Init: TTimer
Interval = 250
Left = 268
Top = 24
end
end

View File

@ -51,21 +51,15 @@ type
btnFSXConnect: TButton;
btnFSXDisconnect: TButton;
lblFSXLocal: TLabel;
tmrG940Init: TTimer;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure btnRetryClick(Sender: TObject);
procedure btnFSXConnectClick(Sender: TObject);
procedure btnFSXDisconnectClick(Sender: TObject);
// procedure tmrG940InitTimer(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
FEventMonitor: TOmniEventMonitor;
FStateConsumerTask: IOmniTaskControl;
// FInitCounter: Integer;
// FInitRedState: Byte;
// FInitGreenState: Byte;
protected
procedure SetDeviceState(const AMessage: string; AFound: Boolean);
@ -76,6 +70,8 @@ type
procedure UpdateMappingFSX;
procedure EventMonitorMessage(const task: IOmniTaskControl; const msg: TOmniMessage);
procedure EventMonitorTerminated(const task: IOmniTaskControl);
procedure HandleDeviceStateMessage(ATask: IOmniTaskControl; AMessage: TOmniMessage);
procedure HandleRunInMainThreadMessage(ATask: IOmniTaskControl; AMessage: TOmniMessage);
@ -90,6 +86,7 @@ uses
SysUtils,
Windows,
OtlCommon,
OtlTask,
FSXLEDStateProvider,
@ -125,17 +122,18 @@ begin
// ToDo handle OnTerminate, check exit code for initialization errors
EventMonitor.OnTaskMessage := EventMonitorMessage;
EventMonitor.OnTaskTerminated := EventMonitorTerminated;
StateConsumerTask.Run;
end;
procedure TMainForm.FormDestroy(Sender: TObject);
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
FinalizeStateProvider;
StateConsumerTask.Terminate;
StateConsumerTask.WaitFor(INFINITE);
FStateConsumerTask := nil;
if Assigned(StateConsumerTask) then
begin
StateConsumerTask.Terminate;
CanClose := False;
end;
end;
@ -227,6 +225,8 @@ begin
TLEDStateConsumer.SetFunction(StateConsumerTask, 2, FUNCTION_FSX_LANDINGLIGHTS);
TLEDStateConsumer.SetFunction(StateConsumerTask, 3, FUNCTION_FSX_GEAR);
TLEDStateConsumer.SetFunction(StateConsumerTask, 6, FUNCTION_FSX_INSTRUMENTLIGHTS);
TLEDStateConsumer.SetFunction(StateConsumerTask, 7, FUNCTION_OFF);
end;
@ -239,6 +239,16 @@ begin
end;
procedure TMainForm.EventMonitorTerminated(const task: IOmniTaskControl);
begin
if task = StateConsumerTask then
begin
FStateConsumerTask := nil;
Close;
end;
end;
procedure TMainForm.HandleDeviceStateMessage(ATask: IOmniTaskControl; AMessage: TOmniMessage);
begin
case AMessage.MsgData.AsInteger of
@ -258,8 +268,16 @@ end;
procedure TMainForm.HandleRunInMainThreadMessage(ATask: IOmniTaskControl; AMessage: TOmniMessage);
var
waitableObject: TObject;
waitableValue: TOmniWaitableValue;
begin
(AMessage.MsgData.AsInterface as IRunInMainThread).Execute;
waitableObject := ATask.Param[0].AsObject;
waitableValue := (waitableObject as TOmniWaitableValue);
// (waitableValue.Value.AsInterface as IRunInMainThread).Execute;
// waitableValue.Signal;
end;

View File

@ -7,16 +7,17 @@ uses
Classes,
SyncObjs,
LEDFunctionMap,
LEDStateConsumer,
LEDStateProvider,
SimConnect;
const
FUNCTION_FSX_GEAR = 1;
FUNCTION_FSX_LANDINGLIGHTS = 2;
FUNCTION_FSX_INSTRUMENTLIGHTS = 3;
FUNCTION_FSX_PARKINGBRAKE = 4;
FUNCTION_FSX_GEAR = FUNCTION_PROVIDER_OFFSET + 1;
FUNCTION_FSX_LANDINGLIGHTS = FUNCTION_PROVIDER_OFFSET + 2;
FUNCTION_FSX_INSTRUMENTLIGHTS = FUNCTION_PROVIDER_OFFSET + 3;
FUNCTION_FSX_PARKINGBRAKE = FUNCTION_PROVIDER_OFFSET + 4;
EXIT_ERROR_INITSIMCONNECT = 1;
EXIT_ERROR_CONNECT = 2;
@ -26,19 +27,24 @@ type
TFSXLEDStateProvider = class(TLEDStateProvider)
private
FSimConnectHandle: THandle;
FUseFunctionGear: Boolean;
FDefinitions: TList;
protected
function GetProcessMessagesInterval: Integer; override;
procedure SetInitialState;
procedure UpdateMap;
procedure HandleDispatch(AData: PSimConnectRecv);
procedure AddDefinition(ADefinition: Cardinal);
procedure ClearDefinitions;
function GetDataBoolean(var AData: Cardinal): Boolean;
function GetDataDouble(var AData: Cardinal): Double;
property SimConnectHandle: THandle read FSimConnectHandle;
public
constructor Create(AConsumer: ILEDStateConsumer); override;
destructor Destroy; override;
procedure Initialize; override;
procedure Finalize; override;
procedure ProcessMessages; override;
@ -48,9 +54,7 @@ type
implementation
uses
ComObj,
SysUtils,
LEDFunctionMap;
SysUtils;
const
@ -76,6 +80,22 @@ const
{ TFSXLEDStateProvider }
constructor TFSXLEDStateProvider.Create(AConsumer: ILEDStateConsumer);
begin
inherited;
FDefinitions := TList.Create;
end;
destructor TFSXLEDStateProvider.Destroy;
begin
FreeAndNil(FDefinitions);
inherited;
end;
procedure TFSXLEDStateProvider.Initialize;
begin
if not InitSimConnect then
@ -85,7 +105,6 @@ begin
raise EInitializeError.Create('Connection to Flight Simulator could not be established', EXIT_ERROR_CONNECT);
UpdateMap;
SetInitialState;
end;
@ -93,6 +112,8 @@ procedure TFSXLEDStateProvider.Finalize;
begin
inherited;
ClearDefinitions;
if SimConnectHandle <> 0 then
begin
SimConnect_Close(SimConnectHandle);
@ -114,26 +135,11 @@ begin
end;
procedure TFSXLEDStateProvider.SetInitialState;
begin
// if FUseFunctionGear then
// begin
// SimConnect_RequestDataOnSimObject(SimConnectHandle, REQUEST_GEAR,
// DEFINITION_GEAR,
// SIMCONNECT_OBJECT_ID_USER,
// SIMCONNECT_PERIOD_ONCE,
// SIMCONNECT_DATA_REQUEST_FLAG_DEFAULT);
// end;
end;
procedure TFSXLEDStateProvider.UpdateMap;
begin
if FUseFunctionGear then
SimConnect_ClearDataDefinition(SimConnectHandle, DEFINITION_GEAR);
FUseFunctionGear := Consumer.FunctionMap.HasFunction(FUNCTION_FSX_GEAR);
if FUseFunctionGear then
ClearDefinitions;
if Consumer.FunctionMap.HasFunction(FUNCTION_FSX_GEAR) then
begin
SimConnect_AddToDataDefinition(SimConnectHandle, DEFINITION_GEAR,
FSX_VARIABLE_GEARTOTALPCTEXTENDED,
@ -143,11 +149,9 @@ begin
SIMCONNECT_OBJECT_ID_USER,
SIMCONNECT_PERIOD_SIM_FRAME,
SIMCONNECT_DATA_REQUEST_FLAG_CHANGED);
end;
// ToDo for other vars too!
// if FUseFunctionGear then
// SimConnect_ClearDataDefinition(SimConnectHandle, DEFINITION_GEAR);
AddDefinition(DEFINITION_GEAR);
end;
if Consumer.FunctionMap.HasFunction(FUNCTION_FSX_LANDINGLIGHTS) or
Consumer.FunctionMap.HasFunction(FUNCTION_FSX_INSTRUMENTLIGHTS) then
@ -161,6 +165,8 @@ begin
SIMCONNECT_OBJECT_ID_USER,
SIMCONNECT_PERIOD_SIM_FRAME,
SIMCONNECT_DATA_REQUEST_FLAG_CHANGED);
AddDefinition(DEFINITION_LIGHTS);
end;
if Consumer.FunctionMap.HasFunction(FUNCTION_FSX_PARKINGBRAKE) then
@ -174,6 +180,8 @@ begin
SIMCONNECT_OBJECT_ID_USER,
SIMCONNECT_PERIOD_SIM_FRAME,
SIMCONNECT_DATA_REQUEST_FLAG_CHANGED);
AddDefinition(DEFINITION_PARKINGBRAKE);
end;
end;
@ -227,6 +235,27 @@ begin
end;
procedure TFSXLEDStateProvider.AddDefinition(ADefinition: Cardinal);
begin
FDefinitions.Add(Pointer(ADefinition));
end;
procedure TFSXLEDStateProvider.ClearDefinitions;
var
definition: Pointer;
begin
if SimConnectHandle <> 0 then
begin
for definition in FDefinitions do
SimConnect_ClearDataDefinition(SimConnectHandle, Cardinal(definition));
end;
FDefinitions.Clear;
end;
function TFSXLEDStateProvider.GetDataBoolean(var AData: Cardinal): Boolean;
begin
Result := (AData <> 0);

View File

@ -21,11 +21,16 @@ type
private
FDirectInput: IDirectInput8;
FThrottleDevice: IDirectInputDevice8;
FRed: Byte;
FGreen: Byte;
protected
procedure MsgFindThrottleDevice(var msg: TOmniMessage); message MSG_FINDTHROTTLEDEVICE;
protected
function Initialize: Boolean; override;
procedure ResetLEDState; override;
procedure LEDStateChanged(ALEDIndex: Integer; AState: TLEDState); override;
procedure Changed; override;
procedure FindThrottleDevice;
procedure FoundThrottleDevice(ADeviceGUID: TGUID);
@ -54,16 +59,17 @@ uses
LogiJoystickDLL;
type
TRunInMainThreadSetButtonColor = class(TInterfacedObject, IRunInMainThread)
TRunInMainThreadSetLEDs = class(TInterfacedObject, IRunInMainThread)
private
FDevice: IDirectInputDevice8;
FButton: TLogiPanelButton;
FColor: TLogiColor;
FRed: Byte;
FGreen: Byte;
protected
procedure Execute;
public
constructor Create(device: IDirectInputDevice8; button: TLogiPanelButton; color: TLogiColor);
constructor Create(ADevice: IDirectInputDevice8; ARed, AGreen: Byte);
end;
@ -103,9 +109,6 @@ begin
exit;
end;
// btnRetry.Visible := False;
// SetState(STATE_SEARCHING, False);
if DirectInput8Create(SysInit.HInstance, DIRECTINPUT_VERSION, IDirectInput8, FDirectInput, nil) <> S_OK then
begin
Task.SetExitStatus(EXIT_ERROR_DIRECTINPUT, 'Failed to initialize DirectInput');
@ -117,31 +120,68 @@ begin
end;
procedure TG940LEDStateConsumer.ResetLEDState;
begin
FRed := 0;
FGreen := $FF;
inherited;
end;
procedure TG940LEDStateConsumer.LEDStateChanged(ALEDIndex: Integer; AState: TLEDState);
procedure SetBit(var AMask: Byte; ABit: Integer; ASet: Boolean); inline;
begin
if ASet then
AMask := AMask or (1 shl ABit)
else
AMask := AMask and not (1 shl ABit);
end;
var
color: TLogiColor;
// msg: TMsg;
red: Boolean;
green: Boolean;
begin
// ToDo SetLEDs gebruiken (vereist override van SetStateByFunction om te groeperen)
if Assigned(ThrottleDevice) then
begin
color := LOGI_GREEN;
red := False;
green := False;
case AState of
lsOff: color := LOGI_OFF;
lsGreen: color := LOGI_GREEN;
lsAmber: color := LOGI_AMBER;
lsRed: color := LOGI_RED;
case AState of
lsGreen:
green := True;
// ToDo timers voor warning / error
lsWarning: color := LOGI_RED;
lsError: color := LOGI_RED;
end;
lsAmber:
begin
red := True;
green := True;
end;
{ Logitech SDK will not change the color outside of the main thread }
RunInMainThread(TRunInMainThreadSetButtonColor.Create(ThrottleDevice, TLogiPanelButton(ALEDIndex), color));
lsRed:
red := True;
// ToDo timers voor warning / error
lsWarning:
red := True;
lsError:
red := True;
end;
SetBit(FRed, ALEDIndex, red);
SetBit(FGreen, ALEDIndex, green);
inherited;
end;
procedure TG940LEDStateConsumer.Changed;
begin
inherited;
if Assigned(ThrottleDevice) then
{ Logitech SDK will not change the color outside of the main thread }
RunInMainThread(TRunInMainThreadSetLEDs.Create(ThrottleDevice, FRed, FGreen));
end;
@ -154,7 +194,9 @@ begin
DIEDFL_ATTACHEDONLY);
if not Assigned(ThrottleDevice) then
SetDeviceState(DEVICESTATE_NOTFOUND);
SetDeviceState(DEVICESTATE_NOTFOUND)
else
Changed;
end;
@ -177,43 +219,20 @@ begin
end;
//procedure TCustomLEDStateProvider.SetStateByFunction(AFunction: Integer; AState: TLEDState);
//var
// functionMap: TLEDFunctionMap;
// ledIndex: Integer;
//
//begin
// functionMap := LockFunctionMap;
// try
// for ledIndex := 0 to Pred(functionMap.Count) do
// if functionMap.GetFunction(ledIndex) = AFunction then
// begin
// if AState <> FState[ledIndex] then
// begin
// FState[ledIndex] := AState;
// ConsumerChannel.Send(MSG_STATECHANGED, [ledIndex, Ord(AState)]);
// end;
// end;
// finally
// UnlockFunctionMap;
// end;
//end;
{ TRunInMainThreadSetButtonColor }
constructor TRunInMainThreadSetButtonColor.Create(device: IDirectInputDevice8; button: TLogiPanelButton; color: TLogiColor);
{ TRunInMainThreadSetLEDs }
constructor TRunInMainThreadSetLEDs.Create(ADevice: IDirectInputDevice8; ARed, AGreen: Byte);
begin
inherited Create;
FDevice := device;
FButton := button;
FColor := color;
FDevice := ADevice;
FRed := ARed;
FGreen := AGreen;
end;
procedure TRunInMainThreadSetButtonColor.Execute;
procedure TRunInMainThreadSetLEDs.Execute;
begin
SetButtonColor(FDevice, FButton, FColor);
SetLEDs(FDevice, FRed, FGreen);
end;
end.

View File

@ -48,6 +48,12 @@ type
const
FUNCTION_NONE = 0;
FUNCTION_OFF = 1;
FUNCTION_RED = 2;
FUNCTION_AMBER = 3;
FUNCTION_GREEN = 4;
FUNCTION_PROVIDER_OFFSET = FUNCTION_GREEN;
implementation

View File

@ -15,8 +15,9 @@ const
MSG_INITIALIZE_PROVIDER = 3;
MSG_FINALIZE_PROVIDER = 4;
MSG_PROCESS_MESSAGES = 5;
MSG_FINALIZE = 6;
MSG_RUN_IN_MAINTHREAD = 6;
MSG_RUN_IN_MAINTHREAD = 7;
MSG_CONSUMER_OFFSET = MSG_RUN_IN_MAINTHREAD;
@ -37,18 +38,26 @@ type
FStateMap: TLEDStateMap;
FProvider: TLEDStateProvider;
FTimerSet: Boolean;
FChanged: Boolean;
FUpdateCount: Integer;
protected
procedure MsgClearFunctions(var msg: TOmniMessage); message MSG_CLEAR_FUNCTIONS;
procedure MsgSetFunction(var msg: TOmniMessage); message MSG_SET_FUNCTION;
procedure MsgInitializeProvider(var msg: TOmniMessage); message MSG_INITIALIZE_PROVIDER;
procedure MsgFinalizeProvider(var msg: TOmniMessage); message MSG_FINALIZE_PROVIDER;
procedure MsgProcessMessages(var msg: TOmniMessage); message MSG_PROCESS_MESSAGES;
procedure MsgFinalize(var msg: TOmniMessage); message MSG_FINALIZE;
procedure Cleanup; override;
procedure InitializeProvider(AProviderClass: TLEDStateProviderClass);
procedure FinalizeProvider;
procedure RunInMainThread(AExecutor: IRunInMainThread);
procedure InitializeLEDState; virtual;
procedure ResetLEDState; virtual;
procedure LEDStateChanged(ALEDIndex: Integer; AState: TLEDState); virtual;
procedure Changed; virtual;
{ ILEDStateConsumer }
function GetFunctionMap: TLEDFunctionMap;
@ -57,14 +66,18 @@ type
property FunctionMap: TLEDFunctionMap read GetFunctionMap;
property StateMap: TLEDStateMap read FStateMap;
property Provider: TLEDStateProvider read FProvider;
property UpdateCount: Integer read FUpdateCount write FUpdateCount;
public
constructor Create;
destructor Destroy; override;
procedure BeginUpdate;
procedure EndUpdate;
class procedure ClearFunctions(AConsumer: IOmniTaskControl);
class procedure SetFunction(AConsumer: IOmniTaskControl; ALEDIndex, AFunction: Integer);
class procedure InitializeStateProvider(AConsumer: IOmniTaskControl; AProviderClass: TLEDStateProviderClass);
class procedure FinalizeStateProvider(AConsumer: IOmniTaskControl);
class procedure Finalize(AConsumer: IOmniTaskControl);
end;
@ -77,6 +90,10 @@ uses
OtlCommon;
const
G940_LED_COUNT = 8;
{ TLEDStateConsumer }
constructor TLEDStateConsumer.Create;
begin
@ -84,17 +101,38 @@ begin
FFunctionMap := TLEDFunctionMap.Create;
FStateMap := TLEDStateMap.Create;
InitializeLEDState;
end;
destructor TLEDStateConsumer.Destroy;
procedure TLEDStateConsumer.Cleanup;
begin
FinalizeProvider;
inherited;
FreeAndNil(FStateMap);
FreeAndNil(FFunctionMap);
end;
inherited;
procedure TLEDStateConsumer.BeginUpdate;
begin
if FUpdateCount = 0 then
FChanged := False;
Inc(FUpdateCount);
end;
procedure TLEDStateConsumer.EndUpdate;
begin
if FUpdateCount > 0 then
Dec(FUpdateCount);
if (FUpdateCount = 0) and FChanged then
Changed;
end;
@ -148,7 +186,18 @@ end;
procedure TLEDStateConsumer.MsgProcessMessages(var msg: TOmniMessage);
begin
Provider.ProcessMessages;
BeginUpdate;
try
Provider.ProcessMessages;
finally
EndUpdate;
end;
end;
procedure TLEDStateConsumer.MsgFinalize(var msg: TOmniMessage);
begin
FinalizeProvider;
end;
@ -165,6 +214,8 @@ begin
Task.SetTimer(TIMER_PROCESSMESSAGES, Provider.ProcessMessagesInterval, MSG_PROCESS_MESSAGES);
FTimerSet := True;
end;
InitializeLEDState;
end;
@ -181,18 +232,83 @@ begin
Provider.Terminate;
Provider.Finalize;
FreeAndNil(FProvider);
StateMap.Clear;
ResetLEDState;
end;
end;
procedure TLEDStateConsumer.RunInMainThread(AExecutor: IRunInMainThread);
var
value: TOmniWaitableValue;
begin
Task.Comm.Send(MSG_RUN_IN_MAINTHREAD, AExecutor);
value := TOmniWaitableValue.Create;
try
value.Value.AsInterface := AExecutor;
Task.Comm.Send(MSG_RUN_IN_MAINTHREAD, value);
value.WaitFor(INFINITE);
finally
FreeAndNil(value);
end;
end;
procedure TLEDStateConsumer.InitializeLEDState;
var
ledIndex: Integer;
state: TLEDState;
newState: TLEDState;
begin
BeginUpdate;
try
ResetLEDState;
for ledIndex := 0 to Pred(G940_LED_COUNT) do
begin
state := StateMap.GetState(ledIndex, lsGreen);
newState := state;
case FunctionMap.GetFunction(ledIndex) of
FUNCTION_OFF: newState := lsOff;
FUNCTION_RED: newState := lsRed;
FUNCTION_AMBER: newState := lsAmber;
FUNCTION_GREEN: newState := lsGreen;
end;
if state <> newState then
LEDStateChanged(ledIndex, newState);
end;
finally
EndUpdate;
end;
end;
procedure TLEDStateConsumer.ResetLEDState;
begin
if UpdateCount = 0 then
Changed
else
FChanged := True;
end;
procedure TLEDStateConsumer.LEDStateChanged(ALEDIndex: Integer; AState: TLEDState);
begin
if UpdateCount = 0 then
Changed
else
FChanged := True;
end;
procedure TLEDStateConsumer.Changed;
begin
FChanged := False;
end;
@ -219,4 +335,10 @@ begin
AConsumer.Comm.Send(MSG_FINALIZE_PROVIDER);
end;
class procedure TLEDStateConsumer.Finalize(AConsumer: IOmniTaskControl);
begin
AConsumer.Comm.Send(MSG_FINALIZE);
end;
end.

View File

@ -39,7 +39,7 @@ type
property Consumer: ILEDStateConsumer read FConsumer;
public
constructor Create(AConsumer: ILEDStateConsumer);
constructor Create(AConsumer: ILEDStateConsumer); virtual;
destructor Destroy; override;
procedure Initialize; virtual;

Binary file not shown.

View File

@ -1,17 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LogiJoystickDLL", "LogiJoystickDLL\LogiJoystickDLL.vcxproj", "{CEC7BCB7-FB0A-4454-B345-1DE883F8FD4F}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LogiJoystickDLL", "LogiJoystickDLL\LogiJoystickDLL.vcxproj", "{62FA1486-30C0-4289-9557-6F5206977593}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CEC7BCB7-FB0A-4454-B345-1DE883F8FD4F}.Debug|Win32.ActiveCfg = Debug|Win32
{CEC7BCB7-FB0A-4454-B345-1DE883F8FD4F}.Debug|Win32.Build.0 = Debug|Win32
{CEC7BCB7-FB0A-4454-B345-1DE883F8FD4F}.Release|Win32.ActiveCfg = Release|Win32
{62FA1486-30C0-4289-9557-6F5206977593}.Release|Win32.ActiveCfg = Release|Win32
{62FA1486-30C0-4289-9557-6F5206977593}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Binary file not shown.

View File

@ -1,30 +0,0 @@
#include <LogiJoystick.h>
#include <dinput.h>
extern "C"
{
__declspec(dllexport) DWORD LJ_SetButtonColor(LPDIRECTINPUTDEVICE8 device, LogiPanelButton button, LogiColor color)
{
return SetButtonColor(device, button, color);
}
__declspec(dllexport) DWORD LJ_SetAllButtonsColor(LPDIRECTINPUTDEVICE8 device, LogiColor color)
{
return SetAllButtonsColor(device, color);
}
__declspec(dllexport) BOOL LJ_IsButtonColor(LPDIRECTINPUTDEVICE8 device, LogiPanelButton button, LogiColor color)
{
return IsButtonColor(device, button, color);
}
__declspec(dllexport) DWORD LJ_SetLEDs(LPDIRECTINPUTDEVICE8 device, BYTE redLEDs, BYTE greenLEDs)
{
return SetLEDs(device, redLEDs, greenLEDs);
}
__declspec(dllexport) DWORD LJ_GetLEDs(LPDIRECTINPUTDEVICE8 device, BYTE& redLEDs, BYTE& greenLEDs)
{
return GetLEDs(device, redLEDs, greenLEDs);
}
}

View File

@ -1,19 +0,0 @@
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the LOGIJOYSTICKDLL_EXPORTS
// symbol defined on the command line. This symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// LOGIJOYSTICKDLL_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef LOGIJOYSTICKDLL_EXPORTS
#define LOGIJOYSTICKDLL_API
#else
#define LOGIJOYSTICKDLL_API __declspec(dllimport)
#endif
LOGIJOYSTICKDLL_API DWORD LJ_SetButtonColor(LPDIRECTINPUTDEVICE8 device, LogiPanelButton button, LogiColor color);
LOGIJOYSTICKDLL_API DWORD LJ_SetAllButtonsColor(LPDIRECTINPUTDEVICE8 device, LogiColor color);
LOGIJOYSTICKDLL_API BOOL LJ_IsButtonColor(LPDIRECTINPUTDEVICE8 device, LogiPanelButton button, LogiColor color);
LOGIJOYSTICKDLL_API DWORD LJ_SetLEDs(LPDIRECTINPUTDEVICE8 device, BYTE redLEDs, BYTE greenLEDs);
LOGIJOYSTICKDLL_API DWORD LJ_GetLEDs(LPDIRECTINPUTDEVICE8 device, BYTE& redLEDs, BYTE& greenLEDs);

View File

@ -0,0 +1,227 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="LogiJoystickDLL"
ProjectGUID="{62FA1486-30C0-4289-9557-6F5206977593}"
RootNamespace="LogiJoystickDLL"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="F:\Development\G940\LogitechSDK\Joystick\Include;&quot;D:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include&quot;"
PreprocessorDefinitions="WIN32;_DEBUG"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="LogiJoystick.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib $(NOINHERIT)"
LinkIncremental="0"
AdditionalLibraryDirectories="F:\Development\G940\LogitechSDK\Joystick\Lib\x86;&quot;D:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib&quot;"
IgnoreAllDefaultLibraries="false"
ModuleDefinitionFile="exports.def"
GenerateDebugInformation="true"
SubSystem="2"
LinkTimeCodeGeneration="1"
EntryPointSymbol="DLLMain"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="F:\Development\G940\LogitechSDK\Joystick\Include;&quot;D:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include&quot;"
PreprocessorDefinitions="WIN32;NDEBUG"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/VERBOSE:LIB"
AdditionalDependencies="LogiJoystick.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib $(NOINHERIT)"
LinkIncremental="1"
AdditionalLibraryDirectories="F:\Development\G940\LogitechSDK\Joystick\Lib\x86;&quot;D:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib&quot;"
IgnoreAllDefaultLibraries="true"
ModuleDefinitionFile="exports.def"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
EntryPointSymbol=""
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\dllmain.cpp"
>
</File>
<File
RelativePath=".\exports.def"
>
</File>
<File
RelativePath=".\stdafx.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,103 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{CEC7BCB7-FB0A-4454-B345-1DE883F8FD4F}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>LogiJoystickDLL</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LOGIJOYSTICKDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CallingConvention>Cdecl</CallingConvention>
<AdditionalIncludeDirectories>F:\Development\G940\Logitech_SDK_For_PC_1.00.002\Joystick\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>LogiJoystick.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>F:\Development\G940\Logitech_SDK_For_PC_1.00.002\Joystick\Lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LOGIJOYSTICKDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CallingConvention>Cdecl</CallingConvention>
<AdditionalIncludeDirectories>F:\Development\G940\Logitech_SDK_For_PC_1.00.002\Joystick\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>LogiJoystick.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>F:\Development\G940\Logitech_SDK_For_PC_1.00.002\Joystick\Lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="LogiJoystickDLL.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="LogiJoystickDLL.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View File

@ -1,40 +0,0 @@
========================================================================
DYNAMIC LINK LIBRARY : LogiJoystickDLL Project Overview
========================================================================
AppWizard has created this LogiJoystickDLL DLL for you.
This file contains a summary of what you will find in each of the files that
make up your LogiJoystickDLL application.
LogiJoystickDLL.vcxproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
LogiJoystickDLL.vcxproj.filters
This is the filters file for VC++ projects generated using an Application Wizard.
It contains information about the association between the files in your project
and the filters. This association is used in the IDE to show grouping of files with
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
"Source Files" filter).
LogiJoystickDLL.cpp
This is the main DLL source file.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named LogiJoystickDLL.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////

View File

@ -1,7 +1,8 @@
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include "windows.h"
BOOL APIENTRY DllMain( HMODULE hModule,
BOOL APIENTRY DLLMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)

View File

@ -0,0 +1,7 @@
LIBRARY LogiJoystickDLL
EXPORTS
SetButtonColor @1
SetAllButtonsColor @2
IsButtonColor @3
SetLEDs @4
GetLEDs @5

View File

@ -1,16 +1,5 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
// TODO: reference additional headers your program requires here
#include "LogiJoystick.h"

View File

@ -1,8 +0,0 @@
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>