mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
deal with older app prefs version
This commit is contained in:
parent
429bd5a4f3
commit
82927d7169
1 changed files with 27 additions and 17 deletions
|
@ -1036,6 +1036,22 @@ uninitHighResGlobals( PalmAppGlobals* globals )
|
||||||
# define uninitHighResGlobals(g)
|
# define uninitHighResGlobals(g)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static XP_Bool
|
||||||
|
canConvertPrefs( XWords4PreferenceType* prefs, UInt16 prefSize, XP_S16 vers )
|
||||||
|
{
|
||||||
|
XP_Bool success = XP_FALSE;
|
||||||
|
|
||||||
|
if ( vers == VERSION_NUM_405 ) {
|
||||||
|
if ( prefSize < sizeof(XWords4PreferenceType) ) {
|
||||||
|
XP_U8* newRgn = ((XP_U8*)prefs) + prefSize;
|
||||||
|
XP_MEMSET( newRgn, 0, sizeof(XWords4PreferenceType) - prefSize );
|
||||||
|
}
|
||||||
|
success = XP_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
} /* canConvertPrefs */
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -1047,6 +1063,7 @@ startApplication( PalmAppGlobals** globalsP )
|
||||||
XWords4PreferenceType prefs;
|
XWords4PreferenceType prefs;
|
||||||
PalmAppGlobals* globals;
|
PalmAppGlobals* globals;
|
||||||
Boolean leftyFlag;
|
Boolean leftyFlag;
|
||||||
|
Int16 vers;
|
||||||
MPSLOT;
|
MPSLOT;
|
||||||
|
|
||||||
#if defined FOR_GREMLINS
|
#if defined FOR_GREMLINS
|
||||||
|
@ -1108,28 +1125,21 @@ startApplication( PalmAppGlobals** globalsP )
|
||||||
}
|
}
|
||||||
|
|
||||||
prefSize = sizeof( prefs );
|
prefSize = sizeof( prefs );
|
||||||
prefsFound = PrefGetAppPreferences( AppType, PrefID, &prefs, &prefSize,
|
vers = PrefGetAppPreferences( AppType, PrefID, &prefs, &prefSize, true);
|
||||||
true) == VERSION_NUM;
|
if ( vers == VERSION_NUM ) {
|
||||||
if ( prefsFound ) {
|
prefsFound = XP_TRUE;
|
||||||
|
} else if ( vers != noPreferenceFound ) {
|
||||||
prefs.versionNum = XP_NTOHS( prefs.versionNum );
|
prefsFound = canConvertPrefs( &prefs, prefSize, vers );
|
||||||
prefs.curGameIndex = XP_NTOHS( prefs.curGameIndex );
|
|
||||||
|
|
||||||
if ( (prefSize == sizeof(prefs))
|
|
||||||
&& (prefs.versionNum == CUR_PREFS_VERS) ) {
|
|
||||||
/* all's well */
|
|
||||||
} else if ( prefs.versionNum < CUR_PREFS_VERS ) {
|
|
||||||
/* Init the new guys. Later this may get more complex!! */
|
|
||||||
prefs.cp.showBoardArrow = XP_TRUE;
|
|
||||||
prefs.cp.showRobotScores = XP_FALSE;
|
|
||||||
} else {
|
} else {
|
||||||
prefsFound = XP_FALSE;
|
prefsFound = XP_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( prefsFound ) {
|
if ( prefsFound ) {
|
||||||
|
prefs.versionNum = XP_NTOHS( prefs.versionNum );
|
||||||
|
prefs.curGameIndex = XP_NTOHS( prefs.curGameIndex );
|
||||||
|
|
||||||
MemMove( &globals->gState, &prefs, sizeof(prefs) );
|
MemMove( &globals->gState, &prefs, sizeof(prefs) );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
globals->draw = palm_drawctxt_make( MPPARM(globals->mpool)
|
globals->draw = palm_drawctxt_make( MPPARM(globals->mpool)
|
||||||
globals->able,
|
globals->able,
|
||||||
|
|
Loading…
Reference in a new issue