Tuesday 16 July 2013

If you want something done...

I had to head home early from work today due to what feels like heat exhaustion. As I was resting, I had mad fever dreams about how best to fix the flickering from UltraMon.

After some heavy research, It seems to be a symptom of DirectX - after all, I'm trying to capture hardware overlays. I decided that I'm using a lot of system resource, and an imperfect solution to resolve this issue. In response, I've developed my own little solution.

I've posted the Source Code below. Though the interval on the timer should be 50, not 25. It seems quite simple, but it's the result of a few hours of research and coding. I began with BitBlt calls from GDI, but ultimately settled on Graphics.CopyFromScreen() (basically the same thing, but a lot easier to code).

I added in some command-line parameters to override the hard-coded screen coordinates if needed.

Finally, the application presented the same problems that Ultramon did, in that the display flickered every few frames. As a workaround, I recorded the pixel values of random locations for every frame. This allowed me to identify which frames were blank. As I'm now using my own code, it was simple to ignore these blank frames.

The end result is a constant output with far less flickering, and far less impact on system performance. The frame rate is sporadic, only updating approx 2/3rds of the output desired, and there is no hardware overlay. However, the dimensions of the output are now almost perfect, and it's a lot better than a constantly flickering device. As a nice bonus, I can now "activate" the display by launching a single application - currently it's in the Windows Startup folder!

I've been looking into Direct X Hooks to capture the true 3d output. This would be the best result, and tests with SlimDX on my desktop were very promising, however there seems to be some comparability issues on the gaming rig, so for now, this will have to do.



Monday 15 July 2013

Itsy Bitsy Teeny Weeny.. (Oh Yeah!)

Since my last post, I've spent a few pennies on eBay to get the project moving, but have hit yet more snags.

Firstly, I wanted to  fix the missing bracket on the video card. I also had an idea of where I'd be going with the targeting computer, so I opted to replace the card entirely, thus swapping the S-Video for an RCA port. There's not much between the options, but as the card (which, by design was another GeForce 7200 GS) was listing at less than £3, I didn't see any harm.

At the same time, I was hoping some extra Memory would alleviate some video issues, so replacing the 256MB module with a 1GB was an easy choice.

The odd thing is, the card needed new (older) drivers to function correctly,
despite the only difference being the presence of the RCA port instead of S-Video.




Now that I had some of the annoyances cleared up, I located my Projector, an old (but still good) Epson EMP S1H. I haven't tested this yet, but I was able to ascertain the maximum resolution is 1024*768. As I intend to use this as the main display device, I've had to drop the in-game resolution from 1920*1080 accordingly. The main issue here, besides the massive drop in display quality, is that the projector has a pretty long throw, so I need to check out the room dimensions to see if this will work as intended.

Last used to throw Pirates of the Caribbean onto a sheet in the Garden!  
















Finally, I took the (admittedly cheap) plunge and got myself a 4.3" TFT monitor. At £15 including postage, this little beauty arrived in less than 2 weeks. I have to say, I'm actually really impressed with this. It supports both PAL and NTSC right out of the box, has two RCA video inputs, and automatically turns off with no signal. It's light and at first doesn't feel like it'd last a week, but it's surprisingly well made. It tends to have a bit of a fit every time the resolution changes, but it's not really built for what I'm doing, and I don't have to adjust ANYTHING, it just gets right on with the task.

The Sun Visor, thankfully, just popped right off.

 The monitor is built for use in-car, and as such, the supplied power adapter isn't of any immediate use to me. However, as the device uses a simple DC-12v supply, I was about to jury-rig the cable onto the 12V Rail of a spare MOLEX adapter. As it turned out, whilst looking for an RCA cable, I stumbled upon a spare 10.9v adapter. This does the job just fine.


It's taken me about 4 hours this evening to get everything up again. Every time I change hardware, or system settings, It seems I have to change the display settings, reconfigure the joysticks, and generally piss about. I hope it's worth it.


4.3" TFT cloning the in-game target display.
The two other issues I've hit now, are that the aspect ratio is a little off, and the monitor has a serious flickering issue in-flight. The Ratio I can deal with, the flicker is a deal-breaker at the moment. Cloning works fine until the in-flight engine kicks-in. I will try and work around this for now, the next thing I can try is to upgrade the CPU to a dual core. The worst case scenario here is that I abandon this approach, and mount a second monitor into the dashboard. This way I can use the Geforce screen cloning (which works flawlessly) and just cover any parts of the screen I don't need.
On the plus side, this would give me a screen for my Raspberry Pi :)