1 /****************************************************************************
3 * SciTech OS Portability Manager Library
5 * ========================================================================
7 * The contents of this file are subject to the SciTech MGL Public
8 * License Version 1.0 (the "License"); you may not use this file
9 * except in compliance with the License. You may obtain a copy of
10 * the License at http://www.scitechsoft.com/mgl-license.txt
12 * Software distributed under the License is distributed on an
13 * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14 * implied. See the License for the specific language governing
15 * rights and limitations under the License.
17 * The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
19 * The Initial Developer of the Original Code is SciTech Software, Inc.
20 * All Rights Reserved.
22 * ========================================================================
25 * Environment: Linux/QNX
27 * Description: Program to restore the console state state from a previously
28 * saved state if the program crashed while the console
29 * was in graphics mode.
31 ****************************************************************************/
37 void setVideoMode(int mode)
42 PM_int86(0x10, &r, &r);
52 /* Write the saved console state buffer to disk */
53 if ((f = fopen("/etc/pmsave.dat","rb")) == NULL) {
54 printf("Unable to open /etc/pmsave.dat for reading!\n");
57 fread(&stateSize,1,sizeof(stateSize),f);
58 if (stateSize != PM_getConsoleStateSize()) {
59 printf("Size mismatch in /etc/pmsave.dat!\n");
62 if ((stateBuf = PM_malloc(stateSize)) == NULL) {
63 printf("Unable to allocate console state buffer!\n");
66 fread(stateBuf,1,stateSize,f);
69 /* Open the console */
70 hwndConsole = PM_openConsole(0,0,0,0,0,true);
72 /* Forcibly set 80x25 text mode using the BIOS */
75 /* Restore the previous console state */
76 PM_restoreConsoleState(stateBuf,0);
77 PM_closeConsole(hwndConsole);
79 printf("Console state successfully restored from /etc/pmsave.dat\n");