Oh I see...
function [color=red]optGraphicsResolutionMenu[/color]::init(%this, %device, %fullScreen)
{
// Slight modification to allow a whole batch more aspect ratios than standard ones.
// Notes
// Torque uses the first two words for setting the resolution via this, so I can add
// the ratio at the end.
//
// We need to use default 4:3 resolutions, because if we don't, we'll make 4:3 resolutions
// from say, 3:2 resolutions. This wasn't a problem until I added the aspect ratio at the
// end of the add() call, but it doubles as a failsafe.
//
// Generating formula borrowed from 'http://andrew.hedges.name/experiments/aspect_ratio/'.
// Common aspect ratios borrowed from 'http://en.wikipedia.org/wiki/Aspect_ratio_(image)'.
// Cheers, Jookia.
%this.clear(); // Clear the menu.
%aspList = "4 3\t3 2\t16 9\t1.85 1\t2.39 1"; // Our list of aspect ratios.
%resList = getResolutionList(%device); // The list of standard resolutions for this device.
%deskRes = getDesktopResolution(); // Our resolution.
%count = -1; // Ignore this, it's for the menu.
for(%a = 0; %a < getFieldCount(%resList); %a++)
{
// Check if this res IS a default 4:3 res, if not, NEXT.
%resX = getWord(getField(%resList, %a), 0);
%res = %resX SPC mFloor((%resX * 3) / 4);
if(%res !$= getWords(getField(%resList, %a), 0, 1))
continue;
for(%b = 0; %b < getFieldCount(%aspList); %b++)
{
// For every standard resolution, we'll stretch it to our aspect ratios.
%aspX = getWord(getField(%aspList, %b), 0); // The X of the aspect, '4' for '4:3'.
%aspY = getWord(getField(%aspList, %b), 1); // The Y of the aspect, '3' for '4:3'.
%resX = getWord(getField(%resList, %a), 0); // The X of our standard resolution.
%resY = mFloor((%resX * %aspY) / %aspX); // Generate the resolution.
%res = %resX SPC %resY; // Our final resolution.
if(%fullScreen == false && (%resX >= getWord(%deskRes, 0) || %resY >= getWord(%deskRes, 1)))
continue; // Can't have it higher then our desktop screen resolution.
if(%resX < 640 || %resY < 480)
continue; // Can't have it below Torque's default screen limits.
%aspSuffix = "[" @ %aspX @ ":" @ %aspY @ "]"; // We'd like to know which aspect this is.
if(%this.findText(%res SPC %aspSuffix) == -1)
%this.add(%res SPC %aspSuffix, %count++); // It's not on the list, add it to the menu!
}
}
}