mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-27 07:58:49 +01:00
Toward a palm build whose only comms mode is relay (no IR, which was
always default.) Plays half a robot-robot game via relay as client -- that is, debugging remains.
This commit is contained in:
parent
d5cede0150
commit
ae0b8211fe
7 changed files with 67 additions and 63 deletions
|
@ -111,16 +111,23 @@ MYDEFS_COMMON += -DXWFEATURE_SEARCHLIMIT
|
||||||
|
|
||||||
#MYDEFS_COMMON += -DXWFEATURE_HINT_CONFIG
|
#MYDEFS_COMMON += -DXWFEATURE_HINT_CONFIG
|
||||||
|
|
||||||
|
ifdef XWFEATURE_STANDALONE_ONLY
|
||||||
|
MYDEFS_COMMON += -DXWFEATURE_STANDALONE_ONLY
|
||||||
|
else
|
||||||
# Turn on network play over IP via cellular modem. Very much
|
# Turn on network play over IP via cellular modem. Very much
|
||||||
# experimental at this point!
|
# experimental at this point!
|
||||||
MYDEFS_COMMON += -DXWFEATURE_RELAY
|
MYDEFS_COMMON += -DXWFEATURE_RELAY -DRELAY_NAME_DEFAULT="\"localhost\""
|
||||||
|
|
||||||
# turn on bluetooth comms option for 68K and ARM
|
# turn on bluetooth comms option for 68K and ARM
|
||||||
BLUETOOTH = -DXWFEATURE_BLUETOOTH -DBT_USE_L2CAP
|
#BLUETOOTH = -DXWFEATURE_BLUETOOTH -DBT_USE_L2CAP
|
||||||
# -DCOMMS_HEARTBEAT
|
# -DCOMMS_HEARTBEAT
|
||||||
#BLUETOOTH = -DXWFEATURE_BLUETOOTH -DBT_USE_RFCOMM
|
#BLUETOOTH = -DXWFEATURE_BLUETOOTH -DBT_USE_RFCOMM
|
||||||
MYDEFS_COMMON += $(BLUETOOTH)
|
MYDEFS_COMMON += $(BLUETOOTH)
|
||||||
|
|
||||||
|
#MYDEFS_COMMON += -DXWFEATURE_IR
|
||||||
|
|
||||||
|
endif # ifdef XWFEATURE_STANDALONE_ONLY
|
||||||
|
|
||||||
# Add menu allowing to choose to run 68K or ARM
|
# Add menu allowing to choose to run 68K or ARM
|
||||||
ifeq ($(ARCH),COMBINED)
|
ifeq ($(ARCH),COMBINED)
|
||||||
MYDEFS_COMMON += -DFEATURE_DUALCHOOSE
|
MYDEFS_COMMON += -DFEATURE_DUALCHOOSE
|
||||||
|
@ -139,12 +146,6 @@ MYDEFS_COMMON += -DNODE_CAN_4
|
||||||
|
|
||||||
MYDEFS_COMMON += -DSVN_REV=\"$(shell svnversion -n .)\"
|
MYDEFS_COMMON += -DSVN_REV=\"$(shell svnversion -n .)\"
|
||||||
|
|
||||||
ifdef XWFEATURE_STANDALONE_ONLY
|
|
||||||
MYDEFS_COMMON += -DXWFEATURE_STANDALONE_ONLY
|
|
||||||
else
|
|
||||||
MYDEFS_COMMON += -DXWFEATURE_IR
|
|
||||||
endif
|
|
||||||
|
|
||||||
MYDEFS_ARM = -D__LITTLE_ENDIAN -DXW_TARGET_PNO $(MYDEFS_COMMON)
|
MYDEFS_ARM = -D__LITTLE_ENDIAN -DXW_TARGET_PNO $(MYDEFS_COMMON)
|
||||||
MYDEFS_68K = -DPLATFORM_PALM -D__BIG_ENDIAN $(MYDEFS_COMMON) \
|
MYDEFS_68K = -DPLATFORM_PALM -D__BIG_ENDIAN $(MYDEFS_COMMON) \
|
||||||
-DAPPNAME=\"$(APPNAME)\" \
|
-DAPPNAME=\"$(APPNAME)\" \
|
||||||
|
|
|
@ -55,7 +55,9 @@ typedef struct ConnsDlgState {
|
||||||
CommsConnType conType;
|
CommsConnType conType;
|
||||||
CommsAddrRec* addr;
|
CommsAddrRec* addr;
|
||||||
XP_BtAddr btAddr; /* since there's no field, save it here */
|
XP_BtAddr btAddr; /* since there's no field, save it here */
|
||||||
|
#ifdef XWFEATURE_BLUETOOTH
|
||||||
char hostName[PALM_BT_NAME_LEN];
|
char hostName[PALM_BT_NAME_LEN];
|
||||||
|
#endif
|
||||||
} ConnsDlgState;
|
} ConnsDlgState;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -247,31 +249,30 @@ setupXportList( PalmAppGlobals* globals )
|
||||||
{
|
{
|
||||||
ConnsDlgState* state = globals->connState;
|
ConnsDlgState* state = globals->connState;
|
||||||
ListData* sLd = &state->sLd;
|
ListData* sLd = &state->sLd;
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
XP_S16 selSel = -1;
|
XP_S16 selSel = -1;
|
||||||
const XP_UCHAR* selName = NULL;
|
const XP_UCHAR* selName = NULL;
|
||||||
|
|
||||||
if ( state->nXports >= 2 ) {
|
XP_ASSERT( state->nXports >= 1 );
|
||||||
state->connTypesList = getActiveObjectPtr( XW_CONNS_TYPE_LIST_ID );
|
state->connTypesList = getActiveObjectPtr( XW_CONNS_TYPE_LIST_ID );
|
||||||
|
|
||||||
initListData( MPPARM(globals->mpool) sLd, state->nXports );
|
initListData( MPPARM(globals->mpool) sLd, state->nXports );
|
||||||
for ( i = 0; i < state->nXports; ++i ) {
|
for ( ii = 0; ii < state->nXports; ++ii ) {
|
||||||
XportEntry* xports = &state->xports[i];
|
XportEntry* xports = &state->xports[ii];
|
||||||
const XP_UCHAR* xname = getResString( globals, xports->resID );
|
const XP_UCHAR* xname = getResString( globals, xports->resID );
|
||||||
addListTextItem( MPPARM(globals->mpool) sLd, xname );
|
addListTextItem( MPPARM(globals->mpool) sLd, xname );
|
||||||
if ( state->conType == xports->conType ) {
|
if ( state->conType == xports->conType ) {
|
||||||
selName = xname;
|
selName = xname;
|
||||||
selSel = i;
|
selSel = ii;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_ASSERT( !!selName );
|
|
||||||
setListSelection( sLd, selName );
|
|
||||||
setListChoices( sLd, state->connTypesList, NULL );
|
|
||||||
|
|
||||||
setSelectorFromList( XW_CONNS_TYPE_TRIGGER_ID, state->connTypesList,
|
|
||||||
selSel );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XP_ASSERT( !!selName );
|
||||||
|
setListSelection( sLd, selName );
|
||||||
|
setListChoices( sLd, state->connTypesList, NULL );
|
||||||
|
|
||||||
|
setSelectorFromList( XW_CONNS_TYPE_TRIGGER_ID, state->connTypesList,
|
||||||
|
selSel );
|
||||||
} /* setupXportList */
|
} /* setupXportList */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -296,7 +297,6 @@ buildXportData( ConnsDlgState* state )
|
||||||
++xports;
|
++xports;
|
||||||
#endif
|
#endif
|
||||||
state->nXports = xports - state->xports;
|
state->nXports = xports - state->xports;
|
||||||
XP_ASSERT( state->nXports >= 2 ); /* no need for dropdown otherwise!! */
|
|
||||||
} /* buildXportData */
|
} /* buildXportData */
|
||||||
|
|
||||||
Boolean
|
Boolean
|
||||||
|
|
|
@ -466,7 +466,9 @@ NAVIGATIONMAP
|
||||||
#ifdef FEATURE_TRAY_EDIT
|
#ifdef FEATURE_TRAY_EDIT
|
||||||
ROW XW_PREFS_PICKTILES_CHECKBOX_ID
|
ROW XW_PREFS_PICKTILES_CHECKBOX_ID
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef XWFEATURE_BLUETOOTH
|
||||||
ROW XW_PREFS_BTCONFIRM_CHECKBOX_ID
|
ROW XW_PREFS_BTCONFIRM_CHECKBOX_ID
|
||||||
|
#endif
|
||||||
|
|
||||||
/* cmd buttons */
|
/* cmd buttons */
|
||||||
ROW XW_PREFS_CANCEL_BUTTON_ID
|
ROW XW_PREFS_CANCEL_BUTTON_ID
|
||||||
|
|
|
@ -372,7 +372,7 @@ changeGadgetHilite( PalmAppGlobals* globals, UInt16 hiliteID )
|
||||||
#if defined XWFEATURE_BLUETOOTH || defined XWFEATURE_RELAY
|
#if defined XWFEATURE_BLUETOOTH || defined XWFEATURE_RELAY
|
||||||
/* Even if it didn't change, pop the connections form. It's only
|
/* Even if it didn't change, pop the connections form. It's only
|
||||||
informational in the non-new-game case; nothing can be changed. */
|
informational in the non-new-game case; nothing can be changed. */
|
||||||
if ( (hiliteID != SERVER_STANDALONE) && (state->nXPorts > 1) ) {
|
if ( hiliteID != SERVER_STANDALONE ) {
|
||||||
if ( isNewGame || (hiliteID==globals->newGameState.curServerHilite) ) {
|
if ( isNewGame || (hiliteID==globals->newGameState.curServerHilite) ) {
|
||||||
PopupConnsForm( globals, hiliteID, &state->addr );
|
PopupConnsForm( globals, hiliteID, &state->addr );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
/* -*-mode: C; fill-column: 77; c-basic-offset: 4; -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright 2001-2005 by Eric House (xwords@eehouse.org). All rights reserved.
|
* Copyright 2001-2009 by Eric House (xwords@eehouse.org). All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -219,10 +219,10 @@ sendLoop( PalmAppGlobals* globals, const XP_U8* buf, XP_U16 len )
|
||||||
|
|
||||||
if ( thisSent == 0 ) {
|
if ( thisSent == 0 ) {
|
||||||
globals->nlStuff.socket = -1; /* mark socket closed */
|
globals->nlStuff.socket = -1; /* mark socket closed */
|
||||||
return XP_FALSE;
|
break;
|
||||||
} else if ( thisSent < 0 ) {
|
} else if ( thisSent < 0 ) {
|
||||||
XP_LOGF( "NetLibSend => %d", err );
|
XP_LOGF( "NetLibSend => %d", err );
|
||||||
return XP_FALSE;
|
break;
|
||||||
} else {
|
} else {
|
||||||
totalSent += thisSent;
|
totalSent += thisSent;
|
||||||
if ( totalSent < len ) {
|
if ( totalSent < len ) {
|
||||||
|
@ -232,8 +232,7 @@ sendLoop( PalmAppGlobals* globals, const XP_U8* buf, XP_U16 len )
|
||||||
}
|
}
|
||||||
} while ( totalSent < len );
|
} while ( totalSent < len );
|
||||||
|
|
||||||
XP_LOGF( "sendLoop sent %d bytes", len );
|
return totalSent == len;
|
||||||
return XP_TRUE;
|
|
||||||
} /* sendLoop */
|
} /* sendLoop */
|
||||||
|
|
||||||
XP_S16
|
XP_S16
|
||||||
|
@ -242,10 +241,9 @@ palm_ip_send( const XP_U8* buf, XP_U16 len, const CommsAddrRec* addrp,
|
||||||
{
|
{
|
||||||
CommsAddrRec localRec;
|
CommsAddrRec localRec;
|
||||||
CommsAddrRec* addr = &localRec;
|
CommsAddrRec* addr = &localRec;
|
||||||
XP_S16 nSent = 0;
|
XP_S16 nSent = -1;
|
||||||
XP_Bool resolved = XP_FALSE;
|
|
||||||
|
|
||||||
XP_LOGF( "palm_ip_send: len=%d", len );
|
XP_LOGF( "%s: len=%d", __func__, len );
|
||||||
XP_ASSERT( len < MAX_MSG_LEN );
|
XP_ASSERT( len < MAX_MSG_LEN );
|
||||||
|
|
||||||
if ( !!addrp ) {
|
if ( !!addrp ) {
|
||||||
|
@ -255,6 +253,7 @@ palm_ip_send( const XP_U8* buf, XP_U16 len, const CommsAddrRec* addrp,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( openNetLibIfNot( globals ) ) {
|
if ( openNetLibIfNot( globals ) ) {
|
||||||
|
XP_Bool resolved = XP_FALSE;
|
||||||
if ( resolveAddressIfNot( globals, addr, &resolved ) ) {
|
if ( resolveAddressIfNot( globals, addr, &resolved ) ) {
|
||||||
if ( resolved ) {
|
if ( resolved ) {
|
||||||
comms_setAddr( globals->game.comms, addr );
|
comms_setAddr( globals->game.comms, addr );
|
||||||
|
@ -270,8 +269,11 @@ palm_ip_send( const XP_U8* buf, XP_U16 len, const CommsAddrRec* addrp,
|
||||||
nSent = len;
|
nSent = len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
XP_LOGF( "%s: dropping because resolveAddressIfNot failed", __func__ );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
LOG_RETURNF( "%d", nSent );
|
||||||
return nSent;
|
return nSent;
|
||||||
} /* palm_ip_send */
|
} /* palm_ip_send */
|
||||||
|
|
||||||
|
@ -282,34 +284,30 @@ recvLoop( PalmAppGlobals* globals, XP_U8* buf, XP_U16 lenSought )
|
||||||
{
|
{
|
||||||
XP_U32 timeout = TimGetSeconds() + 5;
|
XP_U32 timeout = TimGetSeconds() + 5;
|
||||||
XP_U16 totalRead = 0;
|
XP_U16 totalRead = 0;
|
||||||
NetSocketAddrINType fromAddr;
|
/* NetSocketAddrINType fromAddr; */
|
||||||
void* fromAddrP;
|
/* void* fromAddrP; */
|
||||||
UInt16 fromLen;
|
/* UInt16 fromLen; */
|
||||||
|
|
||||||
if ( globals->romVersion >= 50 ) {
|
/* fromAddrP = NULL; */
|
||||||
fromAddrP = NULL;
|
/* fromLen = 0; */
|
||||||
fromLen = 0;
|
|
||||||
} else {
|
|
||||||
fromAddrP = (void*)&fromAddr;
|
|
||||||
fromLen = sizeof( fromAddr );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Be sure there's a way to timeout quickly here!!! */
|
/* Be sure there's a way to timeout quickly here!!! */
|
||||||
while ( totalRead < lenSought && TimGetSeconds() < timeout ) {
|
while ( (totalRead < lenSought) && (TimGetSeconds() < timeout) ) {
|
||||||
Err err;
|
Err err;
|
||||||
Int16 nRead = NetLibReceive( globals->nlStuff.netLibRef,
|
Int16 nRead = NetLibReceive( globals->nlStuff.netLibRef,
|
||||||
globals->nlStuff.socket,
|
globals->nlStuff.socket,
|
||||||
buf, lenSought, 0, /* flags */
|
buf+totalRead, lenSought-totalRead,
|
||||||
fromAddrP, &fromLen,
|
0, /* flags */
|
||||||
|
NULL, NULL,//&fromLen,
|
||||||
NETLIB_TIMEOUT, &err );
|
NETLIB_TIMEOUT, &err );
|
||||||
|
|
||||||
if ( (nRead < 0) && (err != netErrTimeout) ) {
|
if ( (nRead < 0) && (err != netErrTimeout) ) {
|
||||||
XP_LOGF( "NetLibReceive => %d", err );
|
XP_LOGF( "NetLibReceive => %x", err );
|
||||||
return XP_FALSE;
|
break;
|
||||||
} else if ( nRead == 0 ) {
|
} else if ( nRead == 0 ) {
|
||||||
XP_LOGF( "NetLibReceive; socket close" );
|
XP_LOGF( "NetLibReceive; socket close" );
|
||||||
globals->nlStuff.socket = -1;
|
globals->nlStuff.socket = -1;
|
||||||
return XP_FALSE;
|
break;
|
||||||
} else {
|
} else {
|
||||||
totalRead += nRead;
|
totalRead += nRead;
|
||||||
}
|
}
|
||||||
|
@ -332,7 +330,7 @@ packetToStream( PalmAppGlobals* globals )
|
||||||
if ( recvLoop( globals, buf, netlen ) ) {
|
if ( recvLoop( globals, buf, netlen ) ) {
|
||||||
|
|
||||||
result = mem_stream_make( MEMPOOL globals->vtMgr,
|
result = mem_stream_make( MEMPOOL globals->vtMgr,
|
||||||
globals, 0, NULL);
|
globals, 0, NULL );
|
||||||
stream_open( result );
|
stream_open( result );
|
||||||
stream_putBytes( result, buf, netlen );
|
stream_putBytes( result, buf, netlen );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1074,7 +1074,9 @@ startApplication( PalmAppGlobals** globalsP )
|
||||||
Boolean leftyFlag;
|
Boolean leftyFlag;
|
||||||
Int16 vers;
|
Int16 vers;
|
||||||
UInt32 ignore;
|
UInt32 ignore;
|
||||||
|
#if defined XWFEATURE_BLUETOOTH
|
||||||
Err err;
|
Err err;
|
||||||
|
#endif
|
||||||
MPSLOT;
|
MPSLOT;
|
||||||
|
|
||||||
#if defined FOR_GREMLINS
|
#if defined FOR_GREMLINS
|
||||||
|
@ -2019,7 +2021,7 @@ initAndStartBoard( PalmAppGlobals* globals, XP_Bool newGame )
|
||||||
game_reset( MEMPOOL &globals->game, &globals->gameInfo,
|
game_reset( MEMPOOL &globals->game, &globals->gameInfo,
|
||||||
&globals->util, newGameID, &globals->gState.cp,
|
&globals->util, newGameID, &globals->gState.cp,
|
||||||
palm_send, IF_CH(palm_reset) globals );
|
palm_send, IF_CH(palm_reset) globals );
|
||||||
#if defined XWFEATURE_BLUETOOTH || defined XWFEATURE_RELAY || defined XWFEATURE_IR
|
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||||
if ( !!globals->game.comms ) {
|
if ( !!globals->game.comms ) {
|
||||||
comms_setAddr( globals->game.comms,
|
comms_setAddr( globals->game.comms,
|
||||||
&globals->newGameState.addr );
|
&globals->newGameState.addr );
|
||||||
|
@ -2033,7 +2035,11 @@ initAndStartBoard( PalmAppGlobals* globals, XP_Bool newGame )
|
||||||
getSizes( globals );
|
getSizes( globals );
|
||||||
(void)positionBoard( globals );
|
(void)positionBoard( globals );
|
||||||
|
|
||||||
#ifdef XWFEATURE_IR
|
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||||
|
if ( !!globals->game.comms ) {
|
||||||
|
comms_start( globals->game.comms );
|
||||||
|
}
|
||||||
|
|
||||||
if ( newGame && globals->gameInfo.serverRole == SERVER_ISCLIENT ) {
|
if ( newGame && globals->gameInfo.serverRole == SERVER_ISCLIENT ) {
|
||||||
XWStreamCtxt* stream;
|
XWStreamCtxt* stream;
|
||||||
XP_ASSERT( !!globals->game.comms );
|
XP_ASSERT( !!globals->game.comms );
|
||||||
|
@ -2041,11 +2047,6 @@ initAndStartBoard( PalmAppGlobals* globals, XP_Bool newGame )
|
||||||
server_initClientConnection( globals->game.server, stream );
|
server_initClientConnection( globals->game.server, stream );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( !!globals->game.comms ) {
|
|
||||||
comms_start( globals->game.comms );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Used to call server_do here, but if it's a robot's turn it'll run
|
/* Used to call server_do here, but if it's a robot's turn it'll run
|
||||||
without drawing the board first. This allows work to get done almost
|
without drawing the board first. This allows work to get done almost
|
||||||
as quickly. If the board starts flashing on launch this is why;
|
as quickly. If the board starts flashing on launch this is why;
|
||||||
|
|
|
@ -293,8 +293,12 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* May be overridden below */
|
||||||
|
#define XW_PREFS_LAST_PERGAME_ID XW_PREFS_PICKTILES_CHECKBOX_ID
|
||||||
|
|
||||||
#ifdef XWFEATURE_BLUETOOTH
|
#ifdef XWFEATURE_BLUETOOTH
|
||||||
# define XW_PREFS_BTCONFIRM_CHECKBOX_ID 2725
|
# define XW_PREFS_BTCONFIRM_CHECKBOX_ID 2725
|
||||||
|
# define XW_PREFS_LAST_PERGAME_ID XW_PREFS_BTCONFIRM_CHECKBOX_ID
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XWFEATURE_FIVEWAY
|
#ifdef XWFEATURE_FIVEWAY
|
||||||
|
@ -323,8 +327,6 @@
|
||||||
/* # define XW_PREFS_LAST_PERGAME_ID XW_PREFS_TIMER_FIELD_ID */
|
/* # define XW_PREFS_LAST_PERGAME_ID XW_PREFS_TIMER_FIELD_ID */
|
||||||
/* #endif */
|
/* #endif */
|
||||||
|
|
||||||
#define XW_PREFS_LAST_PERGAME_ID XW_PREFS_BTCONFIRM_CHECKBOX_ID
|
|
||||||
|
|
||||||
#define XW_PREFS_CANCEL_BUTTON_ID 2726
|
#define XW_PREFS_CANCEL_BUTTON_ID 2726
|
||||||
#define XW_PREFS_OK_BUTTON_ID 2727
|
#define XW_PREFS_OK_BUTTON_ID 2727
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue