DirectInput - ArgumentException?

CaNaDiAn BaCoN

Newcomer
Joined
Mar 3, 2003
Messages
11
Location
Vancouver, Canada
I'm working on my RPG Engine, ArrowRPG (I posted about it a while ago, here is the thread).

I'm having trouble getting DirectInput to load devices. It gives me an ArgumentException saying that "Value does not fall within the expected range". Here is my code
Code:
'Importing: Microsoft.DirectX.DirectInput, Microsoft.DirectX, System.Threading, System.Collections.Specialized
Public Sub New(ByVal actionMapPath As String)
            Dim dlDevices As DeviceList
            afActionFormat = New ActionFormat() 'Note: Protected Member of the Class that this constructs
            afActionFormat.ActionMap = Starter.Game.AboutData.Title 'This provides the title of the ArrowRPG Game
            afActionFormat.ActionMapGuid = Starter.Game.ID 'This provides the GUID of the ArrowRPG Game
            afActionFormat.AxisMin = -99
            afActionFormat.AxisMax = 99
            afActionFormat.BufferSize = 16
            Dim asStates As ActionStateCollection = XMLActionMapLoader.Load(Starter.Game.Paths.Settings + "\actions.amx", afActionFormat.Actions) 
            'This loads an XML File to create an ActionMap (Note: Collection is filled properly)
            Try
                'Exception occurs on line below
                dlDevices = Manager.GetDevices(afActionFormat, EnumDevicesBySemanticsFlags.Valid)
                Dim instance As SemanticsInstance
                For Each instance In dlDevices
                    SetupDevice(instance.Device, asStates)
                Next
            Catch iex As InputException
                Throw New InvalidFileException("Unable to initialize Input Devices, invalid ActionMap", iex)
            End Try
            thInput = New Thread(AddressOf InputLoop)
            thInput.IsBackground = True
            thInput.Name = "Input Thread"
            thInput.Start()
        End Sub
I've been working off of the "ActionBasic" sample from the DX9SDK, and I've almost copied the ActionFormat creation code, but it still doesn't work (Note: ActionBasic runs fine). What am I doing wrong?
I realize that this is a DirectX Graphics Thread, but I couldn't find anywhere better to put this
 
Back
Top