[Windows Mobile Development and Hacking General] ugumba:
For some time, I've been using WVGAFIX3 on my Blackstone to run older games supporting only 320x240 (QVGA) or 640x480 (VGA) resolutions.

As excellent as WVGAFIX3 is, running WVGAFIX3 "by hand" has always been annoying, especially if I forget it the first time, and copying and editing the typical Mortscript for each new game is a hassle:

RunWait("\Windows\WVGAFIX3APP.exe", "-640")
Sleep(500) # pause suggested by mr_deimos, to allow the dust to settle
RunWait("\path\to\game.EXE)
Run("\Windows\WVGAFIX3APP.exe", "-800")

These scripts have to be stored somewhere, and icons can't be assigned to them, so they're not a good alternative to the plain shortcut.

My next step was to generalize the script (called RunVGA.mscr):

RunWait("\Windows\WVGAFIX3APP.exe", "-640")
Sleep(500)
RunWait(arg1)
Run("\Windows\WVGAFIX3APP.exe", "-800")

Now, arg1 can be given at the command line in the shortcut - this example is Shift.lnk (for this free, excellent little time waster):

132#"\Windows\Mortscript.exe" "\bin\RunVGA.mscr" arg1="\Program Files\Shift\Shift.exe" ?\Program Files\Shift\Shift.exe,

(The Shift game can really mess up the Blacstone's display if WVGAFIX3 is not used - I've had to soft reset a couple of times when I forgot!)

This shortcut will look like the original, as the icon is preserved (by repeating the EXE path between "?" and ",", and providing no icon ID after ",", thus using the default ID). When launched, RunVGA script above will do its thing.

Now, the next improvement would be to simplify the shortcut (at the cost of launching an extra process). I have modified RunMscr.exe found here. When renamed to yourscript.exe, the original executes

Mortscript.exe yourscript.mscr argument1 argument2 ...

My patched version (attached) executes

Mortscript.exe yourscript.mscr arg1=argument1 arg2=argument2 ...

Notice that RunMscr.exe implicitly names the arguments, something which should have been done by Mortscript a long time ago, in my opinion. Thus, I can copy RunMscr.exe to RunVGA.exe, and modify the shortcut above to

132#"\bin\RunVGA.exe" "\Program Files\Shift\Shift.exe" ?\Program Files\Shift\Shift.exe,

(Notice that I keep all scripts and manually copied executables in \bin - adjust accordingly in the scripts provided!)

Having RunVGA.exe with my method of passing arguments, means that you can also launch an executable in VGA mode directly from Resco Explorer by using tap and hold, "Open With...", and browsing to RunVGA.exe.

Now, I was pretty happy with this, but wanted a lazy man's solution for creating these shortcuts (and reverting to the original). The following describes how to toggle a shortcut between its original version and its RunVGA version, again using "Open with..." in Resco Explorer.

First create ToggleVGAfix.mscr:

line=ReadLine(arg1)
Split(line,"#",1,length,shortcut)
Split(shortcut,"?",1,shortcut,icon)

If (Find(shortcut, "RunVGA") = 0)
# This is a normal shortcut, convert to RunVGA shortcut
If (icon eq "")
icon = shortcut
# Strip quotes from icon string
While (CharAt(icon, Length(icon)) eq """")
icon = SubStr(icon, 1, Length(icon)-1)
EndWhile
While (CharAt(icon,0) eq """")
icon = SubStr(icon, 2)
EndWhile
icon = icon & ","
EndIf
line = length & "#" & """\bin\RunVGA.exe"" " & shortcut & " ?" & icon
Else
# This is a RunVGA shortcut, revert to original
Split(shortcut,"RunVGA.exe"" ",1,dummy,target)
line = length & "#" & target
EndIf

# Uncommment if you want to keep the original
#Rename(arg1, arg1 & ".bak", TRUE)
WriteFile(arg1, line)

Next, copy RunMscr.exe to ToggleVGAfix.exe (next to the ToggleVGAfix.mscr script above).

In Resco Explorer, navigate to a shortcut you want to test this on, tap and hold, select Open With, and browse to ToggleVGAfix.exe. Then try launching the shortcut itself - if all goes well, the program will run in VGA mode, and revert back to WVGA when ended.

With all this behind us, we've accomplished this: The next time you install a QVGA/VGA game, navigate to the \Windows\Start Menu\Programs\Games (according to your locale) folder, tap and hold the shortcut, select ToggleVGAfix, and you should be good to go from your normal Games menu.

A small caveat: I've noticed that WVGAFIX3 occasionally doesn't kick into effect in time for the "wrapped" exe. I may look into this if it proves to be enough of a problem. Edit: added a Sleep which fixed this problem for mr_deimos.