THE MASTER COW'S GAME MENU
by Jason Quattrini
(YES!  Spell checked my last name from Quattrini into Quatrain!)
Revision History

Read the versions from bottom to top.  That is, start with the earliest
version number/date/time and work your way up to the most recent version
number/date/time.  I could flip everything around so the most recent is at the
bottom, but I don't want to.

v0.99k5- 07/02/07  1:15pm
       - Re-added saving the config file if command line options are used.
           At some point, probably long long ago, it ran away.

v0.99k4- 05/28/07  6:20pm
       - Additional tweaking of the path storing.  Running the menu in DOSBox
           was breaking some things.  Hopefully all path issues are good now.
           Sooooo... should work fine in Win98, DOS, XP, and now DOSBox
           compatible!

v0.99k3- 05/25/07  2:54 pm
       - Removed a /n in the creation of the file to store the path...
           It worked fine in Win98, broke the menu in XP

v0.99k2+ 12-12-03 10:40 am
       - Re-wrote entry storing code to only put the item name into the main 
           list.  Paths and options are now read from the config file when 
           needed, thus freeing up valuable memory.  Naturally, it follows 
           that your list may contain many many many many many... HEAPGOBS 
           more items without puking.
       - As a result of leaving more info in the configuration file, I
           had to write a "new" config file to store all of the edits in,
           as C/C++ apparently doesn't like working with variable length
           strings (No, sillyhead.  Not the kind of strings you tie around
           your finger to remember stuff, or dangle in front of your cat
           just to drive him insane.)
           No, wait!  I've changed it since I wrote that!  Now changes are
           appended to the config file, at least until you quit or run a game.
           Then the config file is completely re-written.  Yes.
       - I also had to create (and properly set/use) a file indexing system so
           the menu knows where in the config file to check for stuff.
       - This slows saving down a bit when there are lots of games in the
           list, so now there is a saving dialog.  I also changed it to only
           save the config file if any changes have been made to it.  I also
           also decided very large lists slowed the menu down too much for 
           these sorts of things, so I *cough* actually tried to optimize some
           things.  And, (here's the kicker) I think it helped! :)
       - Changed sorting to a more efficient method to handle all these
           extra heapgobs of more entries supported.  Kind of.  OK, I lied.
           I actually left the sort routine the same, as I am a bad programmer.
           However, the amount of actual sorting that needs to be done has been 
           squeezed down to very little.  (mostly)Sorted linked lists!  Oooh, yeah!
       - Fixed a screen drawing flub.  The instructions on the right hand
           side of the screen were being drawn, and then shifted up a line
           to their proper spot.  This should reduce some flickering for
           those of you who like to hold the function keys for hours on end
           (myself included).
       - Also had to re-work the edit, add, copy and delete code to
           handle stuff being stored in the file all the time now.  What?
           (Somehow two hours of editing magically dissappeared, so then I 
           had to figure that stuff out all over again, even though the compiled
           executable still had the changes in it.  NOTE TO SELF: always push F2
           to save files. Borland no likey savey if run executable and then quit
           Turbo C sometimes.  Supposed to automatically save, but... maybe 
           Windows caching messes it up or something.)
       - There was a rare bug with using backspace while editing item info in
           v0.99k2 and probably earlier.  I only had it happen a few times in 
           the past two years (even made my own debug version to try to figure out
           what was going on).  When it happenes, the options for the current item
           get truncated and replaced with a "Z".  I think it's the digital version 
           of Zorro dispensing byte-wise justice upon the evil programmer's guild.
           But, luckily enough, you just re-enter the info and it's all better :)
           Unluckily enough, the sheriff isn't sure whether DigiZorro is still
           around since he converted the midwest to new v1.00, as DigiZorro has not
           committed any crimes as of late.

v0.99k2- 01-10-01 9:45 am
       - Fixed a mess up with initialization of the menu positioning, which
           were making it PageDown one too many if the list was one shy of
           the bottom of the list window.  Make sense?  No?  Good.

v0.99k - 10-19-00 5:10 pm
       - Potassium!  I made it so you can push function keys to change the
           colors if you so desire.   Also, a possible title change allowance
           may be forthcoming.

v0.99b - 3-31-00 9:42pm
       - Crazy, man, crazy.  I quit out of Turbo C and tried out my menu.
           I copied games so it had more than 80+ games, and it didn't puke.
           Got up somewhere around 150, and it *still* didn't puke.  Maybe
           I actually did something right for a change :P (compiled it with
           the small memory model again, so it's not the large one helping
           out...  most bizarre...
       - Repeat after me: "Don't highlight something that isn't there."
       - Apparently you con't have the menu residing in a Windows folder
           that has a space somewhere in its name.  It doesn't like that.
           Just put it somewhere sensible, like \gmenu or some such thing.
           Running stuff with spaces is OK, as long as you put quotes around
           the part that has spaces.  Otherwise, use the 8+3 filename if you
           don't want to be bothered.
           Master Cow over and out.
       - So maybe it was compiled with large mode.  Small broke it again.
       - Added a little "Sorting..." popup, acause I use a bubble sort, and
           if you have many games, it'll take a second to sort them, during
           which you might be tempted to pound the Enter button a few times
           trying to figure out what the heck is going on.
       - Ran a spell checker on this and on readme.txt.  Only a few minor
           misspellings.  Never caught them the tons of times I scanned 
           through with my eyes.

v0.97? - 3-31-00
v0.99! - Editing has been re-established.  I forgot I had to turn the cursor
           back on so you could see what you were editing, but it's good now.
       - Oh... have to put the command line options back in too, but I
           shouldn't have to change that at all...
       - I thin I gots the search all ironed out.  It was a bit trickier than
           I had anticipated.  There still seems to be a glitch with
           deleting, but only when the whole list is being pulled downward
           because of deleting up to the point where the bottom of the list
           hits the bottom of the screen.
       - Good and bad news.  I figured out my problems. (with the menu, not
           me) My list indices were not being set properly with both copying
           and deleting games.  Their mess ups were cancelling each out
           mostly, but not always.  Good old printf.  It's my friend.
           The BAD news is that compiling with a different memory model
           didn't solve my lack of memory problem.  However, you are able to
           use up to about 86 or so games before it will die now, mainly from
           re-writing everything and not using so much allocation of stuff
           overall.  But what to do about that dang limitation... I don't
           even want to think about a DOS extender.
       - Fixed another bug, this time with the edit option.  It would edit,
           but if you were on the last item, it would just vanish.  Now with
           100 percent more Vitamin Works!
       - Reinstituted everything.  Had to change the config writing a little,
           and now it's done.
       - Still to come: I made this v0.99 because I still want to be able to
           have more things in the list.  Plus I haven't tested it
           *extensively*, but probably enough to find all of the buggies.

v0.97? - 3-30-00 9:27 pm (end of March.  Was going to give up, but decided to
                           keep on going.  The actual date is from several
                           days before the 30th up to the 30th)
       - Still a workin', and a tryin' to a fixin'.
       - After much fidoodling, my sort is working again.  Because of the
           new linked lists, I couldn't just swap the things like I did last
           time.  This time I had to actually delete and re-insert the items
           to sort them, which was problematic because I had to create a
           doubly linked list from a singly linked list example, and couldn't
           figure out if my problems were caused by my delete routine, or by
           my sort routine.
       - Might I add that people who write programming books have no idea
           what the hell they're doing when they are trying to make something
           understandable.  And it's even worse when you look at their
           examples, and know they messed up.  The linked list example I
           worked from this time around never actually deleted something.
           It just moved the linked list pointers around to no longer access
           the "deleted" item.  Can you say "Memory Leak!"?  I bet you can!
       - I also found a bug in the way the scrolling was set up with my old
           (and new) menu, where if you deleted an item from within the list
           and the last item was no longer at the bottom of the list window,
           and the top item in the list window wasn't the first list item,
           it would still treat the list as being the full length of the
           window and mess up any page down and or end's after that.
           Hopefully I've gotten it all sorted out.  Get it?  SORTed?  Bah.
       - 'Twould appear that I have repaired the deleting bug.  With a really
           convoluted hack.  If my brain would just cooperate with itself, I
           might be able to organize it better.  Seems rather odd how I did
           it.  It works though... maybe if I had a printout...
       - I now know that Windows long file names can have 255 characters (or
           250, depending which portion of Window Help you consult :P) so my
           guess was a pretty good one.
       - I also may have a solution to the "I'm gonna puke if you try to put
           more than 67 games in me!" problem that I discovered.  My friend
           suggested compiling the program using a "large" memory model
           instead of a "small" one, which should give me much more breathing
           room.  I have yet to try it out.
       - English teachers would be angry now, because I am using "I" too much
           and started more than two sentences with "I".
       - You may now once again copy a game using INSERT and add a game.  A
           few simple steps and you should be able to edit again.  Then I
           just have to re-goodify the search, put the delete confirmation
           window back in, ... umm... turn the cursor on when you are
           editing, make it write the configuration file (saving this for
           last) again, oh, and run the game (temporarily disabled so as to
           not make Turbo C angry) and I think that's it.  We'll find out soon
           enough, won't we?

v0.97? - 2-??-00 ??:?? ?m (mid Feb?)
       - Something just twere't right.  I was allocating too much memory I
           think.  Why else would a list of only 67 or so games make it puke?
       - Awww, yeah!  Complete re-write of the linked list!  Which means
           a nice re-write of almost everything else.  Some minor changes,
           some major.
       - The cursor is now invisible when it's not needed.  Really simple to
           do when you know how :P
       - Had to re-figure out *all* of the menu scrolling.  UP, DOWN working.
           HOME is good.  PAGE DOWN needed a swift kick in the... well, it
           took three days to get it to work.  Once I figured out what I was
           doing it was a bit easier.  Piece... by... piece...
           Speaking of pieces, END is good now.
       - Or not.  Something's screwed up still.  If the list is short, the
           PAGE DOWN and END don't work right.  SHIZNITZ!
           What a dipnut I am.  I HATE off by one errors, especially when
           a symbolic index is going too far.  Grrr.  See the progress.
           I *think* all is good now.  And so is PAGE UP.

v0.96b - 7-02-99 11:01 am
       - Added the use of Home and End when scrolling in the names list.
       - Removed an unnecessary screen redraw when copying a game item.
       - Made a bitmap you can use as an icon.

v0.96  - 7-01-99 11:00 am
       - Ahhhh... fixed a little annoyance.  Several times I've wanted to
           copy a game so I could just change the options for it, and had to
           either edit gmenu.cfg or re-type all of the game information.
           Annoying.  So, now you may press "insert" and the game/item will
           be duplicated.
       - Temporary files created upon execution of the menu will now be
           removed when you use the command line help.  It used to just leave
           them there.

v0.95  - 6-02-99 1:00 pm
       - Cleaning up the main function some.  All argument processing was
           plopped into it's own function (all 184 lines worth *plucked*
           from the main function, giving it some much needed breathing
           room.)
       - Added five colors schemes, invokable with the -cs option.  I like
           the first three.  The fourth is pretty nasty. The fifth is medium
           OK.
       - Added support for super long directory, executable, and option
           names.  Should handle most Win9x long filenames.  255 characters
           just to be consistent with everything else in the world.

v0.94e - 4-27-99  1:51 pm
       - The only changes were a tidying up of the source code, and removal
           of unused functions/variables.  And comments (ADDING, not
           removing.  Geez, Do I have to spell EVERYTHING out??)
       - Won't be a release version, as the executable is still the same.
           Unless I split up the huge "main" file that is.

v0.94d - 4-25-99  3:11 pm
       - Ahh, the first "public release".  Will anyone actually use it?
       - Changed the name from "Game Menu" to "The Master Cow's Game Menu",
           because I looked at other people's universal front-ends, and it
           would seem that the name "Game Menu" has been used multiple times
           already for game menu programs.  Imagine that.  I need to think
           of a really catchy name.  For now you're stuck with that.

v0.94c - 4-24-99  2:10 pm
       - In the process of adding command line arguments to change colors.
           Colors may be set for the main window, the list window (including
           the highlight bar), and the information windows.  Colors saved
           into the beginning of the cfg file... Going to need some error
           checking for this stuff, and probably an option to display all
           valid options.
       - There is also a command line help, which displays available command
           line options.  Not the prettiest in the world, but good enough
           for now.

v0.94b - 4-18-99  6:08 pm
       - More color fiddling.  Changed the main background from blue to red,
           the text for the list of names from light green to light grey, and
           the highlight bar from red to magenta.  Probably change more
           colors as I see fit.
       - Compiled without debugging info, so the executable file is much 
           smaller.

v0.94  - 4-12-99  4:05 pm
       - Search scrolling fixed, so now it works how one would tend to
           expect (that one being me...).
       - The search is now case-insensitive.
       - The directory length has been extended by two characters, and the
           option length has increased by 36, for a total of 75 characters,
           which seems to be much better.  Seven down, *maybe* one to go.
       - I added highlighting of the current item being edited/added.
       - The instruction window when adding or editing has been enlarged.
       - Fiddled with some other colors, mainly in the delete window.
       - Unnhh, it seems to be just about done, mmmkay?  Any other changes
           will be very minor, mmkay?  Unnnh, that is, unless I change the
           way a program is run, mmmkay?

v0.93  - 4-09-99  2:35 pm
       - You may now press the first character of a name and it will be
           found.  Six down, but this one needs a little tweaking.  It's
           case sensitive right now and if the item is towards the beginning
           of the list, the whole list tends to scroll.

v0.92  - 4-08-99  2:40 pm
       - Ahhhhhh.  Much better.  Deleting now moves the selection to where
           it should be, instead of to the previous game in the list, which,
           if I haven't mentioned already, was very irritating.  Four down,
           three (or four) to go...
       - Deleting an item now brings up a window before the deletion is done
           so you can confirm you desire to delete.  Five down.

v0.91b - 4-07-99  2:34 pm
       - Fixed the dying if the config file is empty

v0.91  - 4-07-99  11:40 am
       - Redrew those windows I was talking about with v0.90 (hey, it's a
           modem standard!)
       - You can now use HOME, END, UP and DOWN to scroll within the text
           while adding or editing a game.
       - The menu won't barf now if there is no configuration file.  It'll
           make one when you add a game and run it, or when you quit.  As
           far as I can tell, it is implemented properly.  Time will tell.
       - Oops.  Have to fix it so if there's a config file, but it's empty,
           the program won't lock up the computer.  Nice, huh?

v0.90  - 4-06-99  11:32 am
       - Well, one function took care of almost all of the rest of the
           problems.  Only because I'm smooth, mind you.
       - Game items can now be edited.
       - Bounds checking is done on the input and output of all names and
           text for games (I hope).
       - Games added and edited allow scrolling within names and the use
           of backspace/delete.
       - All of the above done using that new function mentioned above.
       - Minor things left to do:
           - Fix the placement when an item is deleted.
           - Redraw a couple of windows when editing and when the game list
               is empty.
           - *Possibly* change the way games are run, *IF* I can figure out
               how to do it with execv.  Seems to work fine the way it is
               though.
           - Fine tune the lengths of a game's name, directory name, and
               option list.  Currently, I think the name length is pretty
               good (39, should have been 40.  Off by one :P), but the
               directory length seems a bit lengthy (79) and the option
               list length is way too short (a mere 39).  When these are
               adjusted, window placement will have to be modified just a
               bit. Until then, it is as it stands.
           - Doh!  Forgot this, too (see the next next NEXT item.  No, forget
               it.  I keep remembering stuff, and this is getting way too
               ridiculous)...
               I have to put a confirm window for deleting a game, so you
               don't accidently nuke everything.
           - Dang, another one.  Pressing a letter while in the main list
               should eventually bring you to the next game with the letter
               as the first letter.
           - Grrr, remembered this many times, but keep forgetting to put it:
               allow use of HOME and END keys while editing.
           - Now I grr because there was something else I remembered a minute
               ago that I have since forgotten.  I think it had something to
               do with the word "directory"...  Oh well.  If I remember
               again I'll put it here: [ Ahhh, not "directory", but
               "configuration"... If there is no config file, I have to make
               it still work.  Currently, it quits. ].
           All of this stuff is cake compared to everything that's now
           working.  As I'm my own BETA tester, and none of these versions are
           officially labelled BETA, I will report to myself any other 
           problems I find so I can fix them.
       - Almost forgot... set the next character in any of the game fields
           to NULL as it's being read in from the cfg file.  I think this
           was only a problem when the item took up all of it's allotted
           space, or was longer than what I wanted it to be.  Was getting
           a bunch of gobbledegook with long directory names when the other
           items were full length as well.
       - The last line listed for v0.51 is a lie.

v0.51  - 4-05-99  1:00 pm
       - I don't like the way deleting a game moves you to the previous
           game. Gonna have to fix thet.
       - Changed execution of files.  Instead of using a call from within
           the program to run the files, a batch file system has been set up
           which seems to work wonderfully, and even solves my problem of
           not being able to use the command line arguments properly.
           Thanks to some guy on the internet who suggested this.
       - Cleaned up just a little bit of output.  Screen is cleared to red
           and white when running a program.  Quit message returns to the
           beginning of the line now so the command prompt isn't out in the
           middle of East Japipi.
       - Gets the current directory using "cd" so the configuration file is
           written in the proper directory, and so the menu exits in the
           same directory that it started in (in which it started for you 
           English majors.) I wracked my brain trying to figure out how to
           get the current directory, when all I had to do was use "cd".
           (writing this as I remember more and more stuff for version 0.90)
       - Figured out that an option length of 40 is just too dang small.
           The next version will have plenty more room for options.

v0.50  - 4-02-99  8:15 pm
       - Made pretty instructions on what buttons to use to do stuff

v0.49  - 4-01-99  6:30 pm
       - *FINALLY* got adding and deleting working swell.  Can now add or
           delete a game from anywhere in the menu and it won't break. It
           is a little funky if the item you add won't actually be on the
           screen when the list is sorted, but it works nonetheless.

v0.48  - 3-29-99  7:00 am
       - Submenu was repaired earlier (yesterday sometime)
       - Adding a game is now possible from within the program
       - All that is left to do is allow editing of games, deletion of
           games, *proper* running (currently everything is run with
           "system".  Need to use either exec or spawn) of games, and
           possibly some error checking.  Doh!  OK, so I have to tidy
           some stuff up too, and make it return to the current directory
           before quitting, so cfg files aren't spewed all over the place.

v0.35  - 3-28-99  4:30 am
       - Added submenu when Enter is pushed and game selected
           Currently, RUN and CANCEL work.  ADD NEW and EDIT nonfunctional
           F***ING WH**EBAG ERASED ALL THE F***ING WORK I JUST DID.
           F***ING STUPID PIECE OF S**T.

v0.34  - 3-27-99  9:50 pm
       - Writes cfg file when done.  Will have to add option to tell it
           current directory so it doesn't get written all over the place.
           Ummmm....  it does not work right.  Dammit.  Have to tweak it.
           OK, fixed.

v0.33  - 3-24-99  5:45 am
       - Added windows for path name, executable name, and option list
       - Played around with colors.  Icky.

v0.31  - 3-24-99  2:52 am
       - "Enter" now runs the game if all of the stuff is valid... well,
           runs it, but doesn't swap out the program to give the game full
           access to the memory

v0.30  - 3-24-99  2:35 am
       - Game list menu is now fully scrollable with arrow keys and page
           up/down keys
       - Quit messages added

v0.23  - 3-22-99  9:50 pm
       - Changed keys to arrow keys and escape using Borland's TCalc stuff
       - Set screen to black & white bg & text when quitting

V0.22    3-22-99  5:28 am
       - Changed game array to a linked list, and it worked!
       - Also allows sorting of games

v0.??  - 3-20-99
       - Implemented graphic list of games read in from config file
       - "K" key for up, "M" key for down, "Q" key for quit until I can
          figure out how to use arrows and escape

v0.??  - 3-19-99
       - Starting from scratch
       - Figured out file input routines
       - Figured out how to run things from within a program

    Source: geocities.com/quattj/menu

               ( geocities.com/quattj)