My framework code does this. You store everything into an XML file and on loading it it sets up allegro for you (if you wish). It also has an auto save function so that if you change a settings, e.g. 'ScreenCaps.BufferType=TRIPLE', 'MyCustom->SetFloat("gravity",-9.8)', when you exit the system, they are saved back to the file without you having to code anything.
After changing any of the major graphics settings (like width/height/buffering/depth) you just call Framework->Restart() and it reinitialises everything.
Obviously you have to use my classes, which probably isn't what you wanted, but it does animations and graphics handling as well and you can get the framework to run in a timer based loop to control the whole game for you if you wish (you just pass in function pointers and it does the rest).
It'll be finished in a few days.
Or if you just wanted code for all the settings and custom values like high-scores and don't mind c++ then download the stuff from my sig and it is all in the one file (Configurator), complete with help file, just ignore the bit about animations and graphics.