Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members

Device.cpp

Go to the documentation of this file.
00001 /*********************************************************************************
00002  *
00003  * Razor! Engine - A modular C++ presentation engine
00004  *
00005  * $Id$
00006  *
00007  * Copyright (c) 2000 Tilo Christ. All Rights Reserved.
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022  *
00023  **********************************************************************************/
00024 
00025 
00026 #include "Device.h"
00027 #include "../Rsc/StarterRsc.h"    // Needed for ROM incompatible alert
00028 
00029 
00030 
00031 UInt32  Device::romVersion;
00032 Boolean Device::supports30;
00033 Boolean Device::supports31;
00034 Boolean Device::supports35;
00035 
00036 
00037 void Device::panic(Err /* error */, Char* message)
00038 {
00039     SysFatalAlert(message);
00040     SysReset();
00041 }
00042 
00043 
00044 void Device::init()
00045 {
00046     FtrGet(sysFtrCreator, sysFtrNumROMVersion, &Device::romVersion);
00047     if (romVersion >= RomVersion30)
00048         supports30 = true;
00049     if (romVersion >= RomVersion31)
00050         supports31 = true;
00051     if (romVersion >= RomVersion35)
00052         supports35 = true;
00053 }
00054 
00055 
00056 Err Device::romVersionCompatible(UInt32 requiredVersion, UInt16 launchFlags)
00057 {
00058     // See if the device contains the minimum required version of the ROM or later.
00059     if (Device::romVersion < requiredVersion)
00060     {
00061         if ((launchFlags & (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) ==
00062             (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp))
00063         {
00064             FrmAlert (RomIncompatibleAlert);
00065         
00066             // Palm OS 1.0 will continuously relaunch this app unless we switch to 
00067             // another safe one.
00068             if (sysGetROMVerMajor(Device::romVersion) == 1)
00069             {
00070                 AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL);
00071             }
00072         }
00073         
00074         return sysErrRomIncompatible;
00075     }
00076 
00077     return errNone;
00078 }
00079 

Razor! Engine Developer's Guide. Copyright © by Tilo Christ. All Rights Reserved. Last updated: 4 Nov 2000