mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
cleanup; replace a bunch of EvtAddEventToQueue calls with
postEmptyEvent; pass transport type with incoming packets so they can be rejected if not on expected channel (to stop IR, which is always on, from injecting into a BT game); do BT work and fire timers even when menu is down; don't let robot run until after board is drawn for the first time; on startup, don't let robot run until after board is drawn once. Up version to b3.
This commit is contained in:
parent
8dfff86cff
commit
a07a5f2822
15 changed files with 78 additions and 82 deletions
|
@ -307,7 +307,6 @@ addrFromStream( CommsAddrRec* addrP, XWStreamCtxt* stream )
|
||||||
|
|
||||||
switch( addr.conType ) {
|
switch( addr.conType ) {
|
||||||
case COMMS_CONN_NONE:
|
case COMMS_CONN_NONE:
|
||||||
/* XP_ASSERT( 0 ); */
|
|
||||||
break;
|
break;
|
||||||
case COMMS_CONN_BT:
|
case COMMS_CONN_BT:
|
||||||
stringFromStreamHere( stream, addr.u.bt.hostName,
|
stringFromStreamHere( stream, addr.u.bt.hostName,
|
||||||
|
@ -481,12 +480,9 @@ addrToStream( XWStreamCtxt* stream, const CommsAddrRec* addrP )
|
||||||
stream_putU8( stream, addr.conType );
|
stream_putU8( stream, addr.conType );
|
||||||
|
|
||||||
switch( addr.conType ) {
|
switch( addr.conType ) {
|
||||||
#ifdef DEBUG
|
|
||||||
case COMMS_CONN_NONE:
|
case COMMS_CONN_NONE:
|
||||||
case LAST_____FOO:
|
/* nothing to write */
|
||||||
/* XP_ASSERT( 0 ); */
|
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case COMMS_CONN_BT:
|
case COMMS_CONN_BT:
|
||||||
stringToStream( stream, addr.u.bt.hostName );
|
stringToStream( stream, addr.u.bt.hostName );
|
||||||
/* sizeof(.bits) below defeats ARM's padding. */
|
/* sizeof(.bits) below defeats ARM's padding. */
|
||||||
|
@ -618,6 +614,7 @@ comms_getInitialAddr( CommsAddrRec* addr )
|
||||||
CommsConnType
|
CommsConnType
|
||||||
comms_getConType( const CommsCtxt* comms )
|
comms_getConType( const CommsCtxt* comms )
|
||||||
{
|
{
|
||||||
|
XP_ASSERT( !!comms ); /* or: return COMMS_CONN_NONE */
|
||||||
return comms->addr.conType;
|
return comms->addr.conType;
|
||||||
} /* comms_getConType */
|
} /* comms_getConType */
|
||||||
|
|
||||||
|
|
|
@ -33,13 +33,11 @@ typedef XP_U32 MsgID; /* this is too big!!! PENDING */
|
||||||
typedef XP_U8 XWHostID;
|
typedef XP_U8 XWHostID;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
COMMS_CONN_NONE, /* I want errors on uninited case */
|
COMMS_CONN_NONE /* I want errors on uninited case */
|
||||||
COMMS_CONN_IR,
|
,COMMS_CONN_IR
|
||||||
COMMS_CONN_IP_DIRECT,
|
,COMMS_CONN_IP_DIRECT
|
||||||
COMMS_CONN_RELAY,
|
,COMMS_CONN_RELAY
|
||||||
COMMS_CONN_BT,
|
,COMMS_CONN_BT
|
||||||
|
|
||||||
LAST_____FOO
|
|
||||||
} CommsConnType;
|
} CommsConnType;
|
||||||
|
|
||||||
/* WHAT SHOULD THIS BE? Copied from Whiteboard.... PENDING */
|
/* WHAT SHOULD THIS BE? Copied from Whiteboard.... PENDING */
|
||||||
|
|
|
@ -336,9 +336,8 @@ ConnsFormHandleEvent( EventPtr event )
|
||||||
if ( !state->isNewGame ) {
|
if ( !state->isNewGame ) {
|
||||||
/* do nothing; same as cancel */
|
/* do nothing; same as cancel */
|
||||||
} else {
|
} else {
|
||||||
EventType eventToPost = { .eType = connsSettingChgEvent };
|
|
||||||
stateFromCtls( state );
|
stateFromCtls( state );
|
||||||
EvtAddEventToQueue( &eventToPost );
|
postEmptyEvent( connsSettingChgEvent );
|
||||||
}
|
}
|
||||||
/* FALLTHRU */
|
/* FALLTHRU */
|
||||||
case XW_CONNS_CANCEL_BUTTON_ID:
|
case XW_CONNS_CANCEL_BUTTON_ID:
|
||||||
|
|
|
@ -297,7 +297,7 @@ BEGIN
|
||||||
|
|
||||||
#ifdef XWFEATURE_BLUETOOTH
|
#ifdef XWFEATURE_BLUETOOTH
|
||||||
LABEL "Host name:" XW_CONNS_BT_HOSTNAME_LABEL_ID
|
LABEL "Host name:" XW_CONNS_BT_HOSTNAME_LABEL_ID
|
||||||
AT ( LEFTCOL LOCALIP_TOP ) NONUSABLE
|
AT ( LEFTCOL LOCALIP_TOP+5 ) NONUSABLE
|
||||||
SELECTORTRIGGER "Find host..." XW_CONNS_BT_HOSTTRIGGER_ID \
|
SELECTORTRIGGER "Find host..." XW_CONNS_BT_HOSTTRIGGER_ID \
|
||||||
AT (CONNS_FIELD_LEFT PREVTOP 70 AUTO) NONUSABLE LEFTANCHOR
|
AT (CONNS_FIELD_LEFT PREVTOP 70 AUTO) NONUSABLE LEFTANCHOR
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -83,7 +83,6 @@ Boolean
|
||||||
newGameHandleEvent( EventPtr event )
|
newGameHandleEvent( EventPtr event )
|
||||||
{
|
{
|
||||||
Boolean result = false;
|
Boolean result = false;
|
||||||
EventType eventToPost; /* used only with OK button */
|
|
||||||
PalmAppGlobals* globals;
|
PalmAppGlobals* globals;
|
||||||
FormPtr form;
|
FormPtr form;
|
||||||
CurGameInfo* gi;
|
CurGameInfo* gi;
|
||||||
|
@ -219,15 +218,13 @@ newGameHandleEvent( EventPtr event )
|
||||||
needs to arrive before the newGame event so any changes will
|
needs to arrive before the newGame event so any changes will
|
||||||
be incorporated. */
|
be incorporated. */
|
||||||
if ( state->forwardChange ) {
|
if ( state->forwardChange ) {
|
||||||
eventToPost.eType = prefsChangedEvent;
|
postEmptyEvent( prefsChangedEvent );
|
||||||
EvtAddEventToQueue( &eventToPost );
|
|
||||||
state->forwardChange = false;
|
state->forwardChange = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePlayerInfo( globals );
|
updatePlayerInfo( globals );
|
||||||
if ( globals->isNewGame ) {
|
if ( globals->isNewGame ) {
|
||||||
eventToPost.eType = newGameOkEvent;
|
postEmptyEvent( newGameOkEvent );
|
||||||
EvtAddEventToQueue( &eventToPost );
|
|
||||||
globals->postponeDraw = true;
|
globals->postponeDraw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,8 +235,7 @@ newGameHandleEvent( EventPtr event )
|
||||||
|
|
||||||
case XW_CANCEL_BUTTON_ID:
|
case XW_CANCEL_BUTTON_ID:
|
||||||
unloadNewGameState( globals );
|
unloadNewGameState( globals );
|
||||||
eventToPost.eType = newGameCancelEvent;
|
postEmptyEvent( newGameCancelEvent );
|
||||||
EvtAddEventToQueue( &eventToPost );
|
|
||||||
FrmReturnToForm( 0 );
|
FrmReturnToForm( 0 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "xptypes.h"
|
#include "xptypes.h"
|
||||||
#include "palmbt.h"
|
#include "palmbt.h"
|
||||||
#include "strutils.h"
|
#include "strutils.h"
|
||||||
|
#include "palmutil.h"
|
||||||
|
|
||||||
# include <BtLib.h>
|
# include <BtLib.h>
|
||||||
# include <BtLibTypes.h>
|
# include <BtLibTypes.h>
|
||||||
|
@ -148,7 +149,7 @@ static const BtLibSdpUuidType XWORDS_UUID = {
|
||||||
|
|
||||||
static PalmBTStuff* pbt_checkInit( PalmAppGlobals* globals,
|
static PalmBTStuff* pbt_checkInit( PalmAppGlobals* globals,
|
||||||
XP_Bool* userCancelled );
|
XP_Bool* userCancelled );
|
||||||
static Err bpd_discover( PalmBTStuff* btStuff, BtLibDeviceAddressType* addr );
|
static Err pbd_discover( PalmBTStuff* btStuff, BtLibDeviceAddressType* addr );
|
||||||
static void pbt_setup_slave( PalmBTStuff* btStuff, const CommsAddrRec* addr );
|
static void pbt_setup_slave( PalmBTStuff* btStuff, const CommsAddrRec* addr );
|
||||||
static void pbt_takedown_slave( PalmBTStuff* btStuff );
|
static void pbt_takedown_slave( PalmBTStuff* btStuff );
|
||||||
static void pbt_setup_master( PalmBTStuff* btStuff );
|
static void pbt_setup_master( PalmBTStuff* btStuff );
|
||||||
|
@ -337,7 +338,7 @@ palm_bt_browse_device( PalmAppGlobals* globals, XP_BtAddr* btAddr,
|
||||||
btStuff = pbt_checkInit( globals, NULL );
|
btStuff = pbt_checkInit( globals, NULL );
|
||||||
if ( NULL != btStuff ) {
|
if ( NULL != btStuff ) {
|
||||||
BtLibDeviceAddressType addr;
|
BtLibDeviceAddressType addr;
|
||||||
Err err = bpd_discover( btStuff, &addr );
|
Err err = pbd_discover( btStuff, &addr );
|
||||||
|
|
||||||
if ( errNone == err ) {
|
if ( errNone == err ) {
|
||||||
UInt8 name[PALM_BT_NAME_LEN];
|
UInt8 name[PALM_BT_NAME_LEN];
|
||||||
|
@ -351,6 +352,7 @@ palm_bt_browse_device( PalmAppGlobals* globals, XP_BtAddr* btAddr,
|
||||||
|
|
||||||
CALL_ERR( err, BtLibGetRemoteDeviceName, btStuff->btLibRefNum,
|
CALL_ERR( err, BtLibGetRemoteDeviceName, btStuff->btLibRefNum,
|
||||||
&addr, &nameType, btLibCachedThenRemote );
|
&addr, &nameType, btLibCachedThenRemote );
|
||||||
|
XP_ASSERT( errNone == err ); /* deal with btLibErrPending */
|
||||||
XP_LOGF( "%s: got name %s", __func__, nameType.name );
|
XP_LOGF( "%s: got name %s", __func__, nameType.name );
|
||||||
|
|
||||||
XP_ASSERT( len >= nameType.nameLength );
|
XP_ASSERT( len >= nameType.nameLength );
|
||||||
|
@ -736,7 +738,7 @@ pbt_do_work( PalmBTStuff* btStuff, BtCbEvtProc proc )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PBT_ACT_CONNECT_DATA:
|
case PBT_ACT_CONNECT_DATA:
|
||||||
/* XP_ASSERT( btStuff->picoRole == PBT_SLAVE ); */
|
XP_ASSERT( btStuff->picoRole == PBT_SLAVE );
|
||||||
if ( GET_STATE(btStuff) == PBTST_SDP_QUERIED ) {
|
if ( GET_STATE(btStuff) == PBTST_SDP_QUERIED ) {
|
||||||
pbt_close_datasocket( btStuff );
|
pbt_close_datasocket( btStuff );
|
||||||
CALL_ERR( err, BtLibSocketCreate, btLibRefNum,
|
CALL_ERR( err, BtLibSocketCreate, btLibRefNum,
|
||||||
|
@ -805,9 +807,7 @@ pbt_do_work( PalmBTStuff* btStuff, BtCbEvtProc proc )
|
||||||
static void
|
static void
|
||||||
pbt_postpone( PalmBTStuff* btStuff, PBT_ACTION act )
|
pbt_postpone( PalmBTStuff* btStuff, PBT_ACTION act )
|
||||||
{
|
{
|
||||||
EventType eventToPost;
|
postEmptyEvent( noopEvent );
|
||||||
eventToPost.eType = noopEvent;
|
|
||||||
EvtAddEventToQueue( &eventToPost );
|
|
||||||
|
|
||||||
XP_LOGF( "%s(%s)", __func__, actToStr(act) );
|
XP_LOGF( "%s(%s)", __func__, actToStr(act) );
|
||||||
|
|
||||||
|
@ -951,7 +951,7 @@ waitACL( PalmBTStuff* btStuff )
|
||||||
}
|
}
|
||||||
|
|
||||||
static Err
|
static Err
|
||||||
bpd_discover( PalmBTStuff* btStuff, BtLibDeviceAddressType* addr )
|
pbd_discover( PalmBTStuff* btStuff, BtLibDeviceAddressType* addr )
|
||||||
{
|
{
|
||||||
Err err;
|
Err err;
|
||||||
const BtLibClassOfDeviceType deviceFilter
|
const BtLibClassOfDeviceType deviceFilter
|
||||||
|
@ -963,7 +963,7 @@ bpd_discover( PalmBTStuff* btStuff, BtLibDeviceAddressType* addr )
|
||||||
"Crosswords host", (BtLibClassOfDeviceType*)&deviceFilter, 1,
|
"Crosswords host", (BtLibClassOfDeviceType*)&deviceFilter, 1,
|
||||||
addr, false, false );
|
addr, false, false );
|
||||||
return err;
|
return err;
|
||||||
} /* bpd_discover */
|
} /* pbd_discover */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pbt_setup_slave( PalmBTStuff* btStuff, const CommsAddrRec* addr )
|
pbt_setup_slave( PalmBTStuff* btStuff, const CommsAddrRec* addr )
|
||||||
|
|
|
@ -371,7 +371,7 @@ checkHandleNetEvents( PalmAppGlobals* globals )
|
||||||
|
|
||||||
XWStreamCtxt* instream = packetToStream( globals );
|
XWStreamCtxt* instream = packetToStream( globals );
|
||||||
if ( !!instream ) {
|
if ( !!instream ) {
|
||||||
checkAndDeliver( globals, NULL, instream );
|
checkAndDeliver( globals, NULL, instream, COMMS_CONN_RELAY );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ palm_ir_receiveMove( PalmAppGlobals* globals, ExgSocketPtr socket )
|
||||||
(void)ExgDisconnect( socket, err );
|
(void)ExgDisconnect( socket, err );
|
||||||
|
|
||||||
if ( nBytesReceived == 0 ) { /* successful loop exit */
|
if ( nBytesReceived == 0 ) { /* successful loop exit */
|
||||||
checkAndDeliver( globals, NULL, instream );
|
checkAndDeliver( globals, NULL, instream, COMMS_CONN_IR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* palm_ir_receiveMove */
|
} /* palm_ir_receiveMove */
|
||||||
|
|
|
@ -873,10 +873,6 @@ getResString( PalmAppGlobals* globals, XP_U16 strID )
|
||||||
static Err
|
static Err
|
||||||
volChangeEventProc( SysNotifyParamType* XP_UNUSED_SILK(notifyParamsP) )
|
volChangeEventProc( SysNotifyParamType* XP_UNUSED_SILK(notifyParamsP) )
|
||||||
{
|
{
|
||||||
#ifndef REALLY_HANDLE_MEDIA
|
|
||||||
EventType eventToPost;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if ( notifyParamsP->notifyType == sysNotifyVolumeUnmountedEvent ) {
|
if ( notifyParamsP->notifyType == sysNotifyVolumeUnmountedEvent ) {
|
||||||
|
|
||||||
|
@ -894,8 +890,7 @@ volChangeEventProc( SysNotifyParamType* XP_UNUSED_SILK(notifyParamsP) )
|
||||||
|
|
||||||
#ifdef FEATURE_SILK
|
#ifdef FEATURE_SILK
|
||||||
if ( notifyParamsP->notifyType == sysNotifyDisplayChangeEvent ) {
|
if ( notifyParamsP->notifyType == sysNotifyDisplayChangeEvent ) {
|
||||||
eventToPost.eType = doResizeWinEvent;
|
postEmptyEvent( doResizeWinEvent );
|
||||||
EvtAddEventToQueue( &eventToPost );
|
|
||||||
return errNone;
|
return errNone;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -903,8 +898,7 @@ volChangeEventProc( SysNotifyParamType* XP_UNUSED_SILK(notifyParamsP) )
|
||||||
datastructures when it's relaunched. This is a hack but I like
|
datastructures when it's relaunched. This is a hack but I like
|
||||||
it. :-) */
|
it. :-) */
|
||||||
#ifndef REALLY_HANDLE_MEDIA
|
#ifndef REALLY_HANDLE_MEDIA
|
||||||
eventToPost.eType = appStopEvent;
|
postEmptyEvent( appStopEvent );
|
||||||
EvtAddEventToQueue( &eventToPost );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return errNone;
|
return errNone;
|
||||||
|
@ -1105,6 +1099,10 @@ startApplication( PalmAppGlobals** globalsP )
|
||||||
} else {
|
} else {
|
||||||
XP_LOGF( "no sysFileCBtLib via FtrGet: OS too old?" );
|
XP_LOGF( "no sysFileCBtLib via FtrGet: OS too old?" );
|
||||||
}
|
}
|
||||||
|
/* Make the UI elements easier to test */
|
||||||
|
if ( globals->runningOnPOSE ) {
|
||||||
|
globals->hasBTLib = XP_TRUE;
|
||||||
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1190,10 +1188,7 @@ startApplication( PalmAppGlobals** globalsP )
|
||||||
|
|
||||||
if ( prefsFound && loadCurrentGame( globals, globals->gState.curGameIndex,
|
if ( prefsFound && loadCurrentGame( globals, globals->gState.curGameIndex,
|
||||||
&globals->game, &globals->gameInfo) ) {
|
&globals->game, &globals->gameInfo) ) {
|
||||||
EventType eventToPost;
|
postEmptyEvent( loadGameEvent );
|
||||||
eventToPost.eType = loadGameEvent;
|
|
||||||
EvtAddEventToQueue( &eventToPost );
|
|
||||||
|
|
||||||
globals->isFirstLaunch = false;
|
globals->isFirstLaunch = false;
|
||||||
} else {
|
} else {
|
||||||
DictListEntry* dlep;
|
DictListEntry* dlep;
|
||||||
|
@ -1629,7 +1624,8 @@ btEvtHandler( PalmAppGlobals* globals, const BtCbEvtInfo* evt )
|
||||||
XWStreamCtxt* instream;
|
XWStreamCtxt* instream;
|
||||||
instream = makeSimpleStream( globals, NULL );
|
instream = makeSimpleStream( globals, NULL );
|
||||||
stream_putBytes( instream, evt->u.data.data, evt->u.data.len );
|
stream_putBytes( instream, evt->u.data.data, evt->u.data.len );
|
||||||
checkAndDeliver( globals, evt->u.data.fromAddr, instream );
|
checkAndDeliver( globals, evt->u.data.fromAddr,
|
||||||
|
instream, COMMS_CONN_BT );
|
||||||
} else {
|
} else {
|
||||||
/* If we're no longer using BT (meaning somebody loaded a new game
|
/* If we're no longer using BT (meaning somebody loaded a new game
|
||||||
that doesn't use it), close it down. We don't want to do it as
|
that doesn't use it), close it down. We don't want to do it as
|
||||||
|
@ -1637,9 +1633,7 @@ btEvtHandler( PalmAppGlobals* globals, const BtCbEvtInfo* evt )
|
||||||
BT and the new game will probably use the same connection. But if
|
BT and the new game will probably use the same connection. But if
|
||||||
we get here, a non-bt game's been loaded and we should shut
|
we get here, a non-bt game's been loaded and we should shut
|
||||||
down.*/
|
down.*/
|
||||||
EventType eventToPost;
|
postEmptyEvent( closeBtLibEvent );
|
||||||
eventToPost.eType = closeBtLibEvent;
|
|
||||||
EvtAddEventToQueue( &eventToPost );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BTCBEVT_HOSTFAIL: {
|
case BTCBEVT_HOSTFAIL: {
|
||||||
|
@ -1670,20 +1664,22 @@ handleNilEvent( PalmAppGlobals* globals )
|
||||||
XP_U32 when;
|
XP_U32 when;
|
||||||
XWTimerReason why;
|
XWTimerReason why;
|
||||||
|
|
||||||
if ( globals->menuIsDown ) {
|
if ( 0 ) {
|
||||||
/* do nothing */
|
|
||||||
} else if ( globals->hintPending ) {
|
|
||||||
handled = handleHintRequest( globals );
|
|
||||||
} else if ( timeForTimer( globals, &why, &when )
|
|
||||||
&& (when <= TimGetTicks()) ) {
|
|
||||||
palmFireTimer( globals, why );
|
|
||||||
#ifdef XWFEATURE_BLUETOOTH
|
#ifdef XWFEATURE_BLUETOOTH
|
||||||
} else if ( (handled = (!globals->suspendBT)
|
} else if ( (handled = (!globals->suspendBT)
|
||||||
&& palm_bt_doWork( globals, btEvtHandler,
|
&& palm_bt_doWork( globals, btEvtHandler,
|
||||||
&globals->btUIState ) ),
|
&globals->btUIState ) )
|
||||||
showConnState( globals ), handled ) {
|
,showConnState( globals )
|
||||||
|
,handled ) {
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
#endif
|
#endif
|
||||||
|
} else if ( timeForTimer( globals, &why, &when )
|
||||||
|
&& (when <= TimGetTicks()) ) {
|
||||||
|
palmFireTimer( globals, why );
|
||||||
|
} else if ( globals->menuIsDown ) {
|
||||||
|
/* do nothing */
|
||||||
|
} else if ( globals->hintPending ) {
|
||||||
|
handled = handleHintRequest( globals );
|
||||||
} else if ( globals->timeRequested ) {
|
} else if ( globals->timeRequested ) {
|
||||||
globals->timeRequested = false;
|
globals->timeRequested = false;
|
||||||
if ( globals->msgReceivedDraw ) {
|
if ( globals->msgReceivedDraw ) {
|
||||||
|
@ -2047,9 +2043,11 @@ initAndStartBoard( PalmAppGlobals* globals, XP_Bool newGame )
|
||||||
comms_start( globals->game.comms );
|
comms_start( globals->game.comms );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do this before drawing the board. If it assigns tiles, for example,
|
/* Used to call server_do here, but if it's a robot's turn it'll run
|
||||||
that'll make a difference on the screen. */
|
without drawing the board first. This allows work to get done almost
|
||||||
(void)server_do( globals->game.server );
|
as quickly. If the board starts flashing on launch this is why;
|
||||||
|
server_do might need to take a bool param skip-robot */
|
||||||
|
palm_util_requestTime( &globals->util );
|
||||||
|
|
||||||
board_invalAll( globals->game.board );
|
board_invalAll( globals->game.board );
|
||||||
board_draw( globals->game.board );
|
board_draw( globals->game.board );
|
||||||
|
@ -2546,9 +2544,7 @@ mainViewHandleEvent( EventPtr event )
|
||||||
quit. It's easier than dealing with everything that can go wrong
|
quit. It's easier than dealing with everything that can go wrong
|
||||||
in this state. */
|
in this state. */
|
||||||
if ( globals->isFirstLaunch ) {
|
if ( globals->isFirstLaunch ) {
|
||||||
EventType eventToPost;
|
postEmptyEvent( appStopEvent );
|
||||||
eventToPost.eType = appStopEvent;
|
|
||||||
EvtAddEventToQueue( &eventToPost );
|
|
||||||
}
|
}
|
||||||
globals->isNewGame = false;
|
globals->isNewGame = false;
|
||||||
break;
|
break;
|
||||||
|
@ -2900,9 +2896,7 @@ mainViewHandleEvent( EventPtr event )
|
||||||
break;
|
break;
|
||||||
# if 0
|
# if 0
|
||||||
case XW_RESET_PULLDOWN_ID: {
|
case XW_RESET_PULLDOWN_ID: {
|
||||||
EventType eventToPost;
|
postEmptyEvent( appStopEvent );
|
||||||
eventToPost.eType = appStopEvent;
|
|
||||||
EvtAddEventToQueue( &eventToPost );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
globals->resetGame = true;
|
globals->resetGame = true;
|
||||||
|
@ -3844,7 +3838,6 @@ palm_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why,
|
||||||
{
|
{
|
||||||
PalmAppGlobals* globals = (PalmAppGlobals*)uc->closure;
|
PalmAppGlobals* globals = (PalmAppGlobals*)uc->closure;
|
||||||
XP_U32 now = TimGetTicks();
|
XP_U32 now = TimGetTicks();
|
||||||
EventType eventToPost;
|
|
||||||
|
|
||||||
if ( why == TIMER_PENDOWN ) {
|
if ( why == TIMER_PENDOWN ) {
|
||||||
now += PALM_TIMER_DELAY;
|
now += PALM_TIMER_DELAY;
|
||||||
|
@ -3869,8 +3862,7 @@ palm_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why,
|
||||||
|
|
||||||
/* Post an event to force us back out of EvtGetEvent. Required if this
|
/* Post an event to force us back out of EvtGetEvent. Required if this
|
||||||
* is called from inside some BT callback. */
|
* is called from inside some BT callback. */
|
||||||
eventToPost.eType = noopEvent;
|
postEmptyEvent( noopEvent );
|
||||||
EvtAddEventToQueue( &eventToPost );
|
|
||||||
} /* palm_util_setTimer */
|
} /* palm_util_setTimer */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -3992,15 +3984,21 @@ palm_reset( void* closure )
|
||||||
|
|
||||||
void
|
void
|
||||||
checkAndDeliver( PalmAppGlobals* globals, const CommsAddrRec* addr,
|
checkAndDeliver( PalmAppGlobals* globals, const CommsAddrRec* addr,
|
||||||
XWStreamCtxt* instream )
|
XWStreamCtxt* instream, CommsConnType conType )
|
||||||
{
|
{
|
||||||
if ( comms_checkIncomingStream( globals->game.comms,
|
/* For now we'll just drop incoming packets on transports not the same as
|
||||||
instream, addr ) ) {
|
the current game's. We *could* however alert the user, or even
|
||||||
(void)server_receiveMessage( globals->game.server, instream );
|
volunteer to switch e.g. from BT to IR as two passengers board a
|
||||||
globals->msgReceivedDraw = true;
|
plane. That'd require significant changes. */
|
||||||
|
CommsCtxt* comms = globals->game.comms;
|
||||||
|
if ( !!comms && (conType == comms_getConType( comms )) ) {
|
||||||
|
if ( comms_checkIncomingStream( comms, instream, addr ) ) {
|
||||||
|
(void)server_receiveMessage( globals->game.server, instream );
|
||||||
|
globals->msgReceivedDraw = true;
|
||||||
|
}
|
||||||
|
palm_util_requestTime( &globals->util );
|
||||||
}
|
}
|
||||||
stream_destroy( instream );
|
stream_destroy( instream );
|
||||||
palm_util_requestTime( &globals->util );
|
|
||||||
} /* checkAndDeliver */
|
} /* checkAndDeliver */
|
||||||
|
|
||||||
static const XP_UCHAR*
|
static const XP_UCHAR*
|
||||||
|
|
|
@ -428,7 +428,7 @@ const XP_UCHAR* getResString( PalmAppGlobals* globals, XP_U16 strID );
|
||||||
XP_Bool palmask( PalmAppGlobals* globals, const XP_UCHAR* str,
|
XP_Bool palmask( PalmAppGlobals* globals, const XP_UCHAR* str,
|
||||||
const XP_UCHAR* altButton, XP_S16 titleID );
|
const XP_UCHAR* altButton, XP_S16 titleID );
|
||||||
void checkAndDeliver( PalmAppGlobals* globals, const CommsAddrRec* addr,
|
void checkAndDeliver( PalmAppGlobals* globals, const CommsAddrRec* addr,
|
||||||
XWStreamCtxt* instream );
|
XWStreamCtxt* instream, CommsConnType conType );
|
||||||
|
|
||||||
#ifdef XW_TARGET_PNO
|
#ifdef XW_TARGET_PNO
|
||||||
# define READ_UNALIGNED16(n) read_unaligned16((unsigned char*)(n))
|
# define READ_UNALIGNED16(n) read_unaligned16((unsigned char*)(n))
|
||||||
|
|
|
@ -48,7 +48,6 @@ savedGamesHandleEvent( EventPtr event )
|
||||||
Boolean result;
|
Boolean result;
|
||||||
PalmAppGlobals* globals;
|
PalmAppGlobals* globals;
|
||||||
SavedGamesState* state;
|
SavedGamesState* state;
|
||||||
EventType eventToPost;
|
|
||||||
XP_S16 newGameIndex;
|
XP_S16 newGameIndex;
|
||||||
Int16* curGameIndexP;
|
Int16* curGameIndexP;
|
||||||
char* newName;
|
char* newName;
|
||||||
|
@ -153,7 +152,7 @@ savedGamesHandleEvent( EventPtr event )
|
||||||
case XW_SAVEDGAMES_OPEN_BUTTON: /* open the selected db if not already
|
case XW_SAVEDGAMES_OPEN_BUTTON: /* open the selected db if not already
|
||||||
open. */
|
open. */
|
||||||
if ( *curGameIndexP != state->displayGameIndex ) {
|
if ( *curGameIndexP != state->displayGameIndex ) {
|
||||||
eventToPost.eType = openSavedGameEvent;
|
EventType eventToPost = { .eType = openSavedGameEvent };
|
||||||
((OpenSavedGameData*)&eventToPost.data.generic)->newGameIndex
|
((OpenSavedGameData*)&eventToPost.data.generic)->newGameIndex
|
||||||
= state->displayGameIndex;
|
= state->displayGameIndex;
|
||||||
EvtAddEventToQueue( &eventToPost );
|
EvtAddEventToQueue( &eventToPost );
|
||||||
|
|
|
@ -108,6 +108,14 @@ setFieldEditable( UInt16 objectID, Boolean editable )
|
||||||
}
|
}
|
||||||
} /* setFieldEditable */
|
} /* setFieldEditable */
|
||||||
|
|
||||||
|
void
|
||||||
|
postEmptyEvent( eventsEnum typ )
|
||||||
|
{
|
||||||
|
EventType eventToPost;
|
||||||
|
eventToPost.eType = typ;
|
||||||
|
EvtAddEventToQueue( &eventToPost );
|
||||||
|
} /* postEmptyEvent */
|
||||||
|
|
||||||
void
|
void
|
||||||
disOrEnable( FormPtr form, UInt16 id, Boolean enable )
|
disOrEnable( FormPtr form, UInt16 id, Boolean enable )
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,6 +60,8 @@ void getFieldStr( XP_U16 id, XP_UCHAR* buf, XP_U16 max );
|
||||||
#endif
|
#endif
|
||||||
void setFieldEditable( UInt16 objectID, Boolean editable );
|
void setFieldEditable( UInt16 objectID, Boolean editable );
|
||||||
|
|
||||||
|
void postEmptyEvent( eventsEnum typ );
|
||||||
|
|
||||||
/* list item stuff */
|
/* list item stuff */
|
||||||
void initListData( MPFORMAL ListData* ld, XP_U16 nItems );
|
void initListData( MPFORMAL ListData* ld, XP_U16 nItems );
|
||||||
void addListTextItem( MPFORMAL ListData* ld, const XP_UCHAR* txt );
|
void addListTextItem( MPFORMAL ListData* ld, const XP_UCHAR* txt );
|
||||||
|
|
|
@ -42,7 +42,6 @@ PrefsFormHandleEvent( EventPtr event )
|
||||||
PalmAppGlobals* globals;
|
PalmAppGlobals* globals;
|
||||||
PrefsDlgState* state;
|
PrefsDlgState* state;
|
||||||
FormPtr form;
|
FormPtr form;
|
||||||
EventType eventToPost;
|
|
||||||
Int16 chosen;
|
Int16 chosen;
|
||||||
XP_S16 selGadget;
|
XP_S16 selGadget;
|
||||||
|
|
||||||
|
@ -145,8 +144,7 @@ PrefsFormHandleEvent( EventPtr event )
|
||||||
|
|
||||||
case XW_PREFS_OK_BUTTON_ID:
|
case XW_PREFS_OK_BUTTON_ID:
|
||||||
controlsToLocalPrefs( state );
|
controlsToLocalPrefs( state );
|
||||||
eventToPost.eType = prefsChangedEvent;
|
postEmptyEvent( connsSettingChgEvent );
|
||||||
EvtAddEventToQueue( &eventToPost );
|
|
||||||
globals->postponeDraw = true;
|
globals->postponeDraw = true;
|
||||||
|
|
||||||
case XW_PREFS_CANCEL_BUTTON_ID:
|
case XW_PREFS_CANCEL_BUTTON_ID:
|
||||||
|
|
|
@ -433,8 +433,9 @@
|
||||||
|
|
||||||
/* versioning stuff */
|
/* versioning stuff */
|
||||||
#ifdef XWFEATURE_BLUETOOTH
|
#ifdef XWFEATURE_BLUETOOTH
|
||||||
# define XW_PALM_VERSION_STRING "4.3b2"
|
# define XW_PALM_VERSION_STRING "4.3b3"
|
||||||
#else
|
#else
|
||||||
|
/* There's a separate branch for 2.4 releases now. */
|
||||||
# define XW_PALM_VERSION_STRING "4.2.1"
|
# define XW_PALM_VERSION_STRING "4.2.1"
|
||||||
#endif
|
#endif
|
||||||
#define CUR_PREFS_VERS 0x0405
|
#define CUR_PREFS_VERS 0x0405
|
||||||
|
|
Loading…
Reference in a new issue