Thursday, July 23, 2020

Legacy Direct 3D Frame Rate Limiter

i've been quietly captured by some nostalgia this past year.

that's OK. Maybe...

but, GPUs even old ones are now really excellent.
Playing Star Wars: Shadows of the Empire on an old NVIDIA
Quadro FX 1000 (itself an under-clocked version of the Geforce FX 5800)
is just impossible, even with VSYNC @60FPS.

even the damn intro audio to missions ends early!

normally, on a modern computer, its easy to set a frame cap
within either the NVIDIA Profile Inspector or
AMD's excellent Catalyst panel.

however, Windows 98 SE drivers have no such features,
to fix this, I decided to amend a through Direct X wrapper library
to support preventing Direct 3D's ::EndScene function
(upto DX7) from returning earlier than 33.3 ms:

the wrapper on win32 systems hooks though ddraw.dll
in the path of the game to be capped at @30fps, but in
Windows 9x, you'll have to hex edit the game exe to replace
DDRAW.dll references with 30CAP.dll as it loads the
C:\windows\system32\ddraw.dll always!

if anyone knows how to override the linker in Windows 9x
properly please do leave a comment or drop me an email!

anyway, none of this nostalgia matters, we can never return.

Saturday, August 02, 2014

VMWare & Windows 8.1's Modern UI with Retina Display

Windows 8.1 features automatic scaling based on the physical dimensions your display.
However, in a virtual machine it is typical for device not to report any EDID information at all.

This results in the automatic scaling producing tiny ~96dpi results, even when 200% scaling is turned on for traditional Windows content. Indeed, setting the 'Larger' option for metro still suffers from being too small relative to other content.

Luckily, it is still possible to provide Windows with an EDID override in the registry.
The EDID information of any Retina Class display will work just fine.

1. Dump the raw EDID file, from Mac OS X :
ioreg -l | grep IODisplayEDID | awk '{print $9}' | sed 's/[^0-9a-f]//g' | perl -ne 's/([0-9a-f]{2})/print chr hex $1/gie' > ~/edid.dat
2. Install MonInfo to your Windows VM:
3. Open edid.dat in MonInfo (File -> Open).

This will display summary information about the device.
4. Create an .inf in MonInfo (File -> Create .Inf)

5. Boot Windows 8.1 in 'Disable Driver Signing Enforcement' mode
  1. Win-C to bring up Charms Bar.
  2. Click (Settings -> Change PC Settings)
  3. Click (Update & Recovery -> Recovery -> Advanced Setup -> Restart Now)
  4. Click (Troubleshoot -> Startup Settings -> Restart)
  5. Press 7 (Disable Driver Signing Enforcement) 

6. Change from 'non-pnp monitor' to monitor.inf edid override.
  1. Right Click on the 'Start Menu' button 
  2. Click on the 'Device Manager'
  3. Click on 'Monitors'
  4. Right Click on 'non-php monitor'
  5. Click 'Update Driver Software...'
  6. Click 'Browse My Computer for Driver Software'
  7. Click 'Let my pick from a list of device drivers on my computer'
  8. Click 'Have disk'
  9. Navigate to the monitor.inf
  10. Click 'OK' and 'Next' and 'Install this driver software anyway'
  11. Reboot
Please enjoy Modern UI scaled correctly for a retina display!

P.S. Hey VMWare why not include EDID info in your virtual display drivers?
Take a stand, fight back against the tedium of the above instructions!

Sunday, June 16, 2013

Raspberry Pi Wifi Access Point (L2 Bridge Mode)

A recent guide to using the Raspberry Pi as a Wifi Access Point focused on providing a routed network from the Pi itself. In most home network settings, this introduces a Double-NAT which is highly undesirable.

However, a WiFi access point is usually a layer 2 bridge. Thankfully, the built-in drivers for the RaLink RT5370 usb dongle supports bridging with the following command:
iw phy phy0 interface add moni0 type managed 4addr on 
After running this command, all normal brctl commands work with the wlan0 device, and a Pi can be configured as a real layer 2 bridging access point!

The following is an example configuration suitable for Rasbian. HostAP should be configured as per the eLinux guide. No DHCP or Firewall configuration is required.
apt-get install bridge-utils hostapd 
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual 
pre-up ifconfig $IFACE up
post-down ifconfig $IFACE down
auto br0 
iface br0 inet dhcp 
bridge_ports eth0 
auto wlan0
iface wlan0 inet manual     
    pre-up ifconfig $IFACE up && iw phy phy0 interface add moni0 type managed 4addr on
    post-up (sleep 60 && brctl addif br0 wlan0) &
Note, the command highlighted in red is delaying adding wlan0 to the bridge until it is ready.
wpa_pairwise=TKIP CCMP
rsn_pairwise=TKIP CCMP
Add to /etc/sysctl.conf
* Updated to enable 802.11n mode.

Thursday, December 09, 2010

It's not Christmas until...

... the Pudding has been made!

Below is a recipe given to me by my Grandmother for truly amazing Christmas Pudding. The units are converted from UK Imperial for authentic 1950s charm. Quantities may be multiplied for additional puddings, and remember it is an art not a science.

I recommend eating generous portions microwaved with Brandy Butter or a 50/50 mix of Ben & Jerry's Chocolate Fudge Brownie & Cherry Garcia.

284g Breadcrumbs (10oz)
113g Flour (4oz)
227g Butter (8oz)
907g "Fruit" (a mix of Rasins and Sultana) (2lb)
57g Orange Peel (2oz)
57g Cherrys (2oz)
227g Brown Sugar (8oz)
1 Teaspoon of "Mixed Spice"
1 Teaspoon of grated nutmeg (careful now!)
1 Teaspoon of Cinnamon
1 Tablespoon of Treacle
1 Teaspoon of Salt
4 Eggs
1 Bottle of Stout (For my money a bottle of Guinness Foreign Extra Stout @ 7.5% ABV, but it must be old style bottled stout and not draught style cans with widgets!)
1 Teaspoon of Brandy
1 Teaspoon of Whiskey
1 (Flat) Teaspoon of Bread soda
100ml of Milk

Grate Bread into a large bowl. Mix in Butter then add Spice, Cinnamon and Sugar.
Then clean the "Fruit" and cut cherries into quarters. Mix "Fruit", Cherries and Orange Peel together into a separate bowl. Add flour to this bowl, then introduce the Stout, Whiskey, Brandy and freshly beaten Eggs. Stir the mixture and when the consistency of fruit is even introduce mix to the large bowl, stirring vigorously.

Leave over night in a cool place.

The next day, add bread soda disolved in milk. Place mix in a greased bowl to 2/3s of its capacity.
Make the bowl watertight with folded grease proof paper, or use a bowl with a sealed lid.

There are two different cooking methods:
Fill an oven tray, 2/3 with water, and place bowl on it, seal completely with tin foil. The goal is to allow steam to cook the pudding. Cook for 6 to 8 hours at a low heat, checking periodically if the water needs to be topped up as the pudding must never be roasted or baked.

Fill a deep saucepan to 1/4 with water. Place a small (side) plate upside down on the base of the saucepan's interior. Then place the bowl on top of the plate, carefully ensuring that the bowl clears the waterline. Tightly fit lid as the goal is to allow steam to cook the pudding. Cook for 6 hours on a simmer or light boil.

Is my pudding cooked?
Gently pierce the pudding with a kitchen knife, and withdraw, if the knife is clean the pudding is cooked. Failing that, cook for a further hour and recheck.

Allow it to cool before eating! 

Store airtight in a cool dark place, and enjoy for up to a month. 

Ho! Ho! Ho! and a Barrel of Rum!