using XInput, is it possible to get an image of the controller? - directx

In my simple mind, it seems useful to ship a nice image of your joystick with an index of the button and axis locations on the image. Can such a thing be queried through the XInput or DirectInput APIs? Would it be driver-specific, and if so which drivers support this?
In particular, I want to support Logitech wheels and XBOX 360 controllers. The Logitech Profiler seems to come with this information (or pull it from the driver). Is it accessible in my code as well?
I see the image of the joystick show up in the game controller properties, but I assume that entire property page is reported from the driver?

XInput does not supply this and it is not supposed to, XInput is an interface for accessing the state of the controller and the capabilities of the controller. This is something that you would detect manually in your code, finding the correct device id and I believe this is what the Logitech Profiler does as well (since it is a custom application for Logitech), it simply has the images as resources in the program itself.
What is commonly done is that you contact Microsoft, Sony, Nintendo or Logitech and they will have high quality images of their controllers that are approved for use in games. Specifically for images of the controller in console games there are certain requirements that you need to follow. The same requirements do not follow for games for windows and other operating systems but you should still be able to retrieve this information from Microsoft and Logitech.
By retrieving the resources yourself you can also convert them to a format that suits the interface where you are presenting them.

Since the Windows XInput API was created specifically for the XBox 360 controller, it's possible to make a great deal of assumptions about the controller layout. Even now, after the release of official drivers for the XBOne gamepad, the official API documents go out of their way to explicitly limit discussion to the 360 pads.

Related

Is there a programmatic way to see what graphics API a game is using?

For games like DOTA 2 which can be run with different graphics API's such as DX9, DX11, Vulkan, I have not been able to come up with a viable solution to checking which of the API's its currently using. I want to do this to correctly inject a dll in order to display images over the game.
I have looked into manually checking what dll's the games have loaded,
this tool for example: https://learn.microsoft.com/en-us/sysinternals/downloads/listdlls
however, in the case of DOTA, it loads in both d3d9.dll and d3d11.dll libraries if none is specified in launch options on steam. Anyone have any other ideas as to how to determine the correct graphics API used?
In Vulkan, a clean way would be to implement a Vulkan Layer doing the overlay. It is slightly cleaner than outright injecting dlls. And it could work on multiple platforms.
In DirectX, screencap software typically does this. Some software adds FPS counter and such overlays. There seems to be open source with similar goals e.g. here: https://github.com/GPUOpen-Tools/OCAT. I believe conventionally the method is to intercept (i.e. "hook" in win32 api terminology) all the appropriate API calls.
As for simple detection, if it calls D3D12CreateDevice then it likely is Direct3D 12. But then again the app could create devices for all the APIs too and proceed not to use them. But I think the API detection is not particularly important for you if you only want to make an overlay; as long as you just intercept all the present calls and draw your stuff on top of it.

How to synchronize Basler camera, robot controller (ABB) and Visual Studio?

I wrote a C++ program in Visual Studio for anomaly detection using OpenCV. I'm now able to capture images with Basler Ace camera and process the captured image in visual studio. Camera is connected to computer directly with USB 3.0.
My next step is to synchronize image capturing and processing with robot movement. I have IRB1440 ABB robot.
What are the possible solutions for this? Should I buy expensive Siemens PLCs ? Can the solution be found in any other way? What type of communication should I use?
This is a very specific question on a commercial product. I suggest you contact ABBs support and read the robot controllers manual. There you will find information on how to interface it in a safe manner.
It is not the robot you want to talk to, it is its controller!
According to the info I found on IRB 1440 (seem to be a sub-model of IRB1400) the controller is a S4Cplus.
The way we usually do it is a Windows PC based image processing system that is hooked up to a PLC (Siemens, Mitsubishi,...) which forwards our coordinates, angles and whatnot to the robot controller.
Of course the PLC can be omitted if your PC is the "boss" of the entire system.
S4Cplus Product Specifications
This controller comes with various interfacing options including RS232, RS422, Ethernet as well as a whole bunch of industry standards.
Having a separate PLC is not necessary as the controller may serve as a PLC itself, although you might have to upgrade the controller using so called I/O nodes.
But as I said, refer to the manuals and ABB support.
Obviously any non-realtime solution like a Windows PC is not an option for any safety features.

Direct2D versus Direct3D for digital video rendering

I need to render video from multiple IP cameras into several controls within the client application.
On top of the video, I should be able to add some OSD such as timestamp and camera name.
What I'm trying to do has nothing to do with 3D since we're talking about digital video with some text on it.
Which API is more suitable for this purpose? Direct3D or Direct2D?
Performance should also be a consideration here.
It used to be that Direct2D was a poor choice for Windows Phone (if you care about that system) because it wasn't supported, but Win Phone 8.1 has it now, so less of an issue.
My experience with D2D was that it offered fast, high quality 2D rendering, and I would say it is a good choice.
You might want to take a look at this article on Code Project. That looks appropriate for your purposes.
If you are certain you only need MS system support, then you're all set.
Another way to go would be a cross platform system like nanovg, which offers nice 2D rendering and would work on a Mac. Of course, you'd need to figure out how to do the video part on non windows systems.
Regarding D3D, you could certainly do it that way, but my guess would be it would make some things trickier to do. Don't forget you can combine the two as well...

What Actionscript features do not work on iOS?

There seems to be a lot of conflicting information out there. It might be that support has increased recently, or changes to adobe.com/air have made some information difficult to find - but I can't track down a definitive list of things to avoid.
I know that actionscript won't run in loaded SWFs, I know that some people say that filters and blendmodes and halo components won't work. I've also read many posts saying they will (at least that blendmodes will, and that halo will run, but slowly so still use spark)
I have a large amount of AS3 code to plan for upgrading to work on iOS, but at the moment I have no idea what things will break (or what things will break when those things have been fixed!)
Is there a list of unsupported APIs, or iOS dos and don'ts?
Thanks
:S
First, yes. Externally loaded SWF's will not run. You can however embed SWF's/SWC's into your project and include them inside of your package.
As far as Flex components, stay away from Halo. You should use Flex 4.6 and stick to components with mobile skins. I recommend downloading Tour de Flex http://www.adobe.com/devnet/flex/tourdeflex.html to get an idea of whats available.
As far as blend modes go, I'm not really sure. I haven't used them in mobile yet. However filters are supported but they are expensive. For drop shadows on rectangles there is something called RectangularDropShadow. This is actually a component and therefor less expensive. However it can only be used on rectangular groups.
You should have access all of the AIR API's. You will however be restricted when using some of File related classes since I don't believe you can leave your Appliaction Storage Directory.
One big performance tip I can give is to use AS3 over MXML whenever possible, ESPECIALLY when creating item renderers. Use BitmapImage over Image whenever possible, again especially in item renderers. Use cacheAsBitmap whenever you have images that don't change often. And stay away from any Flex component that doesn't have a mobile skin.
You may also want to read up on View and destruction policies.
http://www.adobe.com/devnet/flex/articles/flex-mobile-development-tips-tricks-pt1.html
This link also has some more performance tips
http://www.adobe.com/devnet/flex/articles/flex-mobile-performance-checklist.html

DMX software to control lights with programmable interface

I find myself in the need of a software to control lights with a programmable interface. Basically what I want to do is to automatically control the lights using some criteria that I programmed inside a program. My program will then control the lights passing through the software I'm searching for, of course this would need a programmable interface to which I should pass the commands to control the lights.
I've been searching for a software like that in the last couple of days without success, what I found are only softwares with GUIs for users, but no specification whatsoever about programming the light behavior instead of manipulating it by hand.
There's some really good information & code samples (including a working class that I wrote) here: Lighting USB OpenDMX FTD2XX DMXking
Ultimately, you end up setting byte values (between 0 and 255[FF] (brightest) in a byte array.
It's fairly trivial to implement simple effects such as fades or chases.
If you haven't got that far yet (e.g. up to the code) you'll need to get ahold of a USB DMX controller.
There are a number of them out there, but the thread above has sample code for two different flavours.
I also wanted an environment where I could quickly write code that would create interesting effects for my DMX effect lights and lasers, and ended up creating it myself. I just announced the first public release of Afterglow, my free, open-source live-coding environment for light shows. You can find it at https://github.com/brunchboy/afterglow
I needed precise control of individual mutli-channel (RGBAW) DMX512 lights and wanted to write code in C++ for Windows. I adapted the C# example from Enttec's website for OpenUSB and released the code:
https://github.com/chloelle/DMX_CPP

Resources