When I play fullscreen games, some of them occasionally crash. When they do so, they leave my screen in a weird video mode, so that, for instance, I'm scrolling a 1280x1024 desktop on an 800x600 screen. In order to restore a saner video mode, I've been restarting X. Is there a better way to restore the default video mode, that I could, for instance, put in a script? Thanks!

UPDATE: I've been doing some research, and the only thing I've found has been the GUI xvidtune program, which doesn't accomplish quite what I want. I'm going to get some sleep, and then try to put together a C program based on it to restore the video mode correctly. Of particular interest is /usr/X11R6/include/X11/extensions/xf86vmode.h, which contains the functions for doing what I want.