Pad prefs struct so ARM and 68K versions are using same addresses

(fixes crash opening game in ARM version that was saved in 68K);
renumber resource IDs so can be logged via a switch.
This commit is contained in:
ehouse 2007-03-17 15:37:15 +00:00
parent 9e345c317f
commit 7997258163
3 changed files with 71 additions and 21 deletions

View file

@ -288,6 +288,23 @@ eType_2str( eventsEnum eType )
CASESTR( prefsChangedEvent);
CASESTR( openSavedGameEvent);
CASESTR( updateAfterFocusEvent);
CASESTR( DOWN_ARROW_RESID );
CASESTR( RIGHT_ARROW_RESID );
CASESTR( FLIP_BUTTON_BMP_RES_ID );
CASESTR( VALUE_BUTTON_BMP_RES_ID );
CASESTR( HINT_BUTTON_BMP_RES_ID );
CASESTR( TRAY_BUTTONS_BMP_RES_ID );
CASESTR( SHOWTRAY_BUTTON_BMP_RES_ID );
CASESTR( STAR_BMP_RES_ID );
#ifdef XWFEATURE_BLUETOOTH
CASESTR( BTSTATUS_NONE_RES_ID );
CASESTR( BTSTATUS_LISTENING_RES_ID );
CASESTR( BTSTATUS_SEEKING_RES_ID );
CASESTR( BTSTATUS_CONNECTED_RES_ID );
#endif
#if defined XWFEATURE_BLUETOOTH || defined XWFEATURE_RELAY
CASESTR( connsSettingChgEvent);
#endif

View file

@ -176,11 +176,17 @@ PM2(PilotMain)( UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
{
PalmAppGlobals* globals;
if ( cmd == sysAppLaunchCmdNormalLaunch ) {
if ( ((launchFlags & sysAppLaunchFlagNewGlobals) != 0)
&& startApplication( &globals ) ) {
XP_ASSERT( (launchFlags & sysAppLaunchFlagNewGlobals) != 0 );
// Initialize the application's global variables and database.
eventLoop( globals );
if ( (launchFlags & sysAppLaunchFlagNewGlobals) != 0) {
#ifdef XW_TARGET_PNO
XP_LOGF( "%s: arch=ARM", __func__ );
#else
XP_LOGF( "%s: arch=68K", __func__ );
#endif
if ( startApplication( &globals ) ) {
XP_ASSERT( (launchFlags & sysAppLaunchFlagNewGlobals) != 0 );
// Initialize the application's global variables and database.
eventLoop( globals );
}
}
stopApplication( globals );
@ -1030,6 +1036,31 @@ canConvertPrefs( XWords4PreferenceType* prefs, UInt16 prefSize, XP_S16 vers )
return success;
} /* canConvertPrefs */
#ifdef MEM_DEBUG
# if 0
# define LOG_OFFSET( s, f ) \
{ s _s; \
XP_LOGF( "offset of " #f " in " #s \
": %d (size: %ld)", OFFSET_OF( s, f ), \
sizeof(_s.f) ); \
}
static void
printOffsets( void )
{
LOG_OFFSET( XWords4PreferenceType, versionNum );
LOG_OFFSET( XWords4PreferenceType, curGameIndex );
LOG_OFFSET( XWords4PreferenceType, showProgress );
LOG_OFFSET( XWords4PreferenceType, showGrid );
LOG_OFFSET( XWords4PreferenceType, showColors );
LOG_OFFSET( XWords4PreferenceType, cp );
LOG_OFFSET( XWords4PreferenceType, focusItem );
} /* printOffsets */
# undef LOG_OFFSET
# endif
#endif
/*****************************************************************************
*
****************************************************************************/
@ -1136,9 +1167,9 @@ startApplication( PalmAppGlobals** globalsP )
&globals->drawingPrefs );
#ifdef XWFEATURE_BLUETOOTH
if ( !globals->gState.reserved1 ) {
if ( !globals->gState.oneTimeShown ) {
palmaskFromStrId( globals, STR_ABOUT_CONTENT, STR_ABOUT_TITLE );
globals->gState.reserved1 = XP_TRUE;
globals->gState.oneTimeShown = XP_TRUE;
}
#endif
@ -1744,10 +1775,12 @@ static void
drawBitmapButton( PalmAppGlobals* globals, UInt16 ctrlID, UInt16 resID,
XP_Bool eraseIfDisabled )
{
FormPtr form = FrmGetActiveForm();
UInt16 index = FrmGetObjectIndex( form, ctrlID );
FormPtr form;
UInt16 index;
RectangleType bounds;
form = FrmGetActiveForm();
index = FrmGetObjectIndex( form, ctrlID );
FrmGetObjectBounds( form, index, &bounds );
if ( buttonIsUsable( getActiveObjectPtr( ctrlID ) ) ) {

View file

@ -400,20 +400,20 @@
/* resource IDs */
#define DOWN_ARROW_RESID 1001
#define RIGHT_ARROW_RESID 1002
#define FLIP_BUTTON_BMP_RES_ID 1003
#define VALUE_BUTTON_BMP_RES_ID 1004
#define HINT_BUTTON_BMP_RES_ID 1005
#define TRAY_BUTTONS_BMP_RES_ID 1007
#define SHOWTRAY_BUTTON_BMP_RES_ID 1008
#define STAR_BMP_RES_ID 1009
#define DOWN_ARROW_RESID 2001
#define RIGHT_ARROW_RESID 2002
#define FLIP_BUTTON_BMP_RES_ID 2003
#define VALUE_BUTTON_BMP_RES_ID 2004
#define HINT_BUTTON_BMP_RES_ID 2005
#define TRAY_BUTTONS_BMP_RES_ID 2007
#define SHOWTRAY_BUTTON_BMP_RES_ID 2008
#define STAR_BMP_RES_ID 2009
#ifdef XWFEATURE_BLUETOOTH
# define BTSTATUS_NONE_RES_ID 1010
# define BTSTATUS_LISTENING_RES_ID 1011
# define BTSTATUS_SEEKING_RES_ID 1012
# define BTSTATUS_CONNECTED_RES_ID 1013
# define BTSTATUS_NONE_RES_ID 2010
# define BTSTATUS_LISTENING_RES_ID 2011
# define BTSTATUS_SEEKING_RES_ID 2012
# define BTSTATUS_CONNECTED_RES_ID 2013
#endif
#define STRL_RES_TYPE 'StrL'