mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
Use new XP_TriEnable type; begin work to support bluetooth by tracking
connType and adding choice how to connect. Bt connect dialog is invoked, but the fields won't be populated. Pass conn type into socket constructor, assuming socket code doesn't change much to use BT rather than TCP.
This commit is contained in:
parent
a735cfab03
commit
f1def437c3
10 changed files with 211 additions and 62 deletions
|
@ -28,12 +28,14 @@ MINGW_INC_PATH ?= /usr/i586-mingw32msvc/include
|
||||||
HAVE_COMMCTRL = 1
|
HAVE_COMMCTRL = 1
|
||||||
|
|
||||||
ifeq ($(TARGET_OS),wince)
|
ifeq ($(TARGET_OS),wince)
|
||||||
|
BLUETOOTH = -DXWFEATURE_BLUETOOTH
|
||||||
|
RELAY = -DXWFEATURE_RELAY
|
||||||
CC = arm-wince-pe-gcc
|
CC = arm-wince-pe-gcc
|
||||||
WINDRES = arm-wince-pe-windres
|
WINDRES = arm-wince-pe-windres
|
||||||
STRIP = arm-wince-pe-strip
|
STRIP = arm-wince-pe-strip
|
||||||
CELIBS = -L/usr/arm-wince-pe/lib
|
CELIBS = -L/usr/arm-wince-pe/lib
|
||||||
TARGET_OS_DEF = -DTARGET_OS_WINCE
|
TARGET_OS_DEF = -DTARGET_OS_WINCE
|
||||||
STANDALONE = -DXWFEATURE_STANDALONE_ONLY
|
#STANDALONE = -DXWFEATURE_STANDALONE_ONLY
|
||||||
CFLAGS += -D_WIN32_WCE=400 -DUNDER_CE -DMY_COLOR_SEL \
|
CFLAGS += -D_WIN32_WCE=400 -DUNDER_CE -DMY_COLOR_SEL \
|
||||||
$(STANDALONE) -DDRAW_LINK_DIRECT \
|
$(STANDALONE) -DDRAW_LINK_DIRECT \
|
||||||
-fdollars-in-identifiers -D__W32API_USE_DLLIMPORT__
|
-fdollars-in-identifiers -D__W32API_USE_DLLIMPORT__
|
||||||
|
@ -42,16 +44,18 @@ LFLAGS += -Wl,--major-subsystem-version,4,--minor-subsystem-version,20
|
||||||
ifdef HAVE_COMMCTRL
|
ifdef HAVE_COMMCTRL
|
||||||
CELIBS += -lcommctrl -laygshell
|
CELIBS += -lcommctrl -laygshell
|
||||||
else
|
else
|
||||||
CFLAGS += -DCANT_DO_CMDBAR -DXWFEATURE_RELAY
|
CFLAGS += -DCANT_DO_CMDBAR
|
||||||
endif
|
endif
|
||||||
else # ifeq ($(TARGET_OS),wince)
|
else # ifeq ($(TARGET_OS),wince)
|
||||||
ifeq ($(TARGET_OS),win32)
|
ifeq ($(TARGET_OS),win32)
|
||||||
|
BLUETOOTH = -DXWFEATURE_BLUETOOTH
|
||||||
|
RELAY = -DXWFEATURE_RELAY
|
||||||
CC = i586-mingw32msvc-gcc
|
CC = i586-mingw32msvc-gcc
|
||||||
WINDRES = i586-mingw32msvc-windres
|
WINDRES = i586-mingw32msvc-windres
|
||||||
STRIP = i586-mingw32msvc-strip
|
STRIP = i586-mingw32msvc-strip
|
||||||
TARGET_OS_DEF = -DTARGET_OS_WIN32
|
TARGET_OS_DEF = -DTARGET_OS_WIN32
|
||||||
CELIBS += -lws2_32
|
CELIBS += -lws2_32
|
||||||
CFLAGS += -DCANT_DO_CMDBAR -DXWFEATURE_RELAY -DDRAW_LINK_DIRECT
|
CFLAGS += -DCANT_DO_CMDBAR -DDRAW_LINK_DIRECT
|
||||||
#CFLAGS += -DFORCE_HEIGHT=240 -DFORCE_WIDTH=320
|
#CFLAGS += -DFORCE_HEIGHT=240 -DFORCE_WIDTH=320
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -60,6 +64,8 @@ CFLAGS += -DARM -I$(MINGW_INC_PATH) -I./ -I../common -I../relay
|
||||||
|
|
||||||
CFLAGS += -Wall -Wunused-parameter
|
CFLAGS += -Wall -Wunused-parameter
|
||||||
|
|
||||||
|
CFLAGS += $(BLUETOOTH) $(RELAY)
|
||||||
|
|
||||||
SVNDEF = -DSVN_REV='\"$(SVNREV)\"'
|
SVNDEF = -DSVN_REV='\"$(SVNREV)\"'
|
||||||
CFLAGS += $(SVNDEF)
|
CFLAGS += $(SVNDEF)
|
||||||
RESFLAGS += $(SVNDEF)
|
RESFLAGS += $(SVNDEF)
|
||||||
|
@ -121,7 +127,7 @@ XW_BOTH_DEFINES = \
|
||||||
$(DEBUG_FLAG) $(MEM_DEBUG_FLAG) \
|
$(DEBUG_FLAG) $(MEM_DEBUG_FLAG) \
|
||||||
|
|
||||||
CFLAGS += $(XW_BOTH_DEFINES) -DARM
|
CFLAGS += $(XW_BOTH_DEFINES) -DARM
|
||||||
RESFLAGS += $(XW_BOTH_DEFINES) $(STANDALONE) \
|
RESFLAGS += $(XW_BOTH_DEFINES) $(STANDALONE) $(BLUETOOTH) $(RELAY) \
|
||||||
-D_WIN32 -D_WIN32_IE=0x0400
|
-D_WIN32 -D_WIN32_IE=0x0400
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
|
|
||||||
#include "cecondlg.h"
|
#include "cecondlg.h"
|
||||||
#include "ceutil.h"
|
#include "ceutil.h"
|
||||||
|
@ -28,39 +28,137 @@ ceControlsToAddrRec( HWND hDlg, CeConnDlgState* cState )
|
||||||
{
|
{
|
||||||
XP_U16 len;
|
XP_U16 len;
|
||||||
|
|
||||||
len = sizeof(cState->addrRec.u.ip_relay.hostName);
|
if ( cState->addrRec.conType == COMMS_CONN_RELAY ) {
|
||||||
ceGetDlgItemText( hDlg, RELAYNAME_EDIT,
|
#ifdef XWFEATURE_RELAY
|
||||||
cState->addrRec.u.ip_relay.hostName, &len );
|
len = sizeof(cState->addrRec.u.ip_relay.hostName);
|
||||||
cState->addrRec.u.ip_relay.port =
|
ceGetDlgItemText( hDlg, RELAYNAME_EDIT,
|
||||||
(XP_U16)ceGetDlgItemNum( hDlg, RELAYPORT_EDIT );
|
cState->addrRec.u.ip_relay.hostName, &len );
|
||||||
len = sizeof(cState->addrRec.u.ip_relay.cookie);
|
cState->addrRec.u.ip_relay.port =
|
||||||
ceGetDlgItemText( hDlg, COOKIE_EDIT, cState->addrRec.u.ip_relay.cookie,
|
(XP_U16)ceGetDlgItemNum( hDlg, RELAYPORT_EDIT );
|
||||||
&len );
|
len = sizeof(cState->addrRec.u.ip_relay.cookie);
|
||||||
|
ceGetDlgItemText( hDlg, COOKIE_EDIT, cState->addrRec.u.ip_relay.cookie,
|
||||||
|
&len );
|
||||||
|
#endif
|
||||||
|
} else if ( cState->addrRec.conType == COMMS_CONN_BT ) {
|
||||||
|
#ifdef XWFEATURE_BLUETOOTH
|
||||||
|
if ( cState->role == SERVER_ISCLIENT ) {
|
||||||
|
len = sizeof(cState->addrRec.u.bt.hostName);
|
||||||
|
ceGetDlgItemText( hDlg, IDC_BLUET_ADDR_EDIT,
|
||||||
|
cState->addrRec.u.bt.hostName, &len );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
XP_ASSERT(0);
|
||||||
|
}
|
||||||
|
} /* ceControlsToAddrRec */
|
||||||
|
|
||||||
|
static void
|
||||||
|
adjustForConnType( HWND hDlg, const CeConnDlgState* cState )
|
||||||
|
{
|
||||||
|
XP_U16 relayIds[] = {
|
||||||
|
IDC_COOKIE_LAB,
|
||||||
|
#ifdef XWFEATURE_RELAY
|
||||||
|
COOKIE_EDIT,IDC_CRELAYHINT_LAB,IDC_CRELAYNAME_LAB,RELAYNAME_EDIT,
|
||||||
|
IDC_CRELAYPORT_LAB, RELAYPORT_EDIT,
|
||||||
|
#endif
|
||||||
|
0 };
|
||||||
|
XP_U16 btIds[] = {
|
||||||
|
IDC_BLUET_ADDR_LAB,
|
||||||
|
#ifdef XWFEATURE_BLUETOOTH
|
||||||
|
IDC_BLUET_ADDR_EDIT, IDC_BLUET_ADDR_BROWSE,
|
||||||
|
#endif
|
||||||
|
0 };
|
||||||
|
XP_U16* allIDs[] = { relayIds, btIds };
|
||||||
|
XP_U16* on = NULL;
|
||||||
|
XP_U16 i;
|
||||||
|
|
||||||
|
if ( cState->addrRec.conType == COMMS_CONN_RELAY ) {
|
||||||
|
on = relayIds;
|
||||||
|
} else if ( cState->addrRec.conType == COMMS_CONN_BT ) {
|
||||||
|
on =
|
||||||
|
#ifdef XWFEATURE_BLUETOOTH
|
||||||
|
cState->role != SERVER_ISCLIENT ? NULL:
|
||||||
|
#endif
|
||||||
|
btIds; /* we want the "disabled" message */
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( i = 0; i < sizeof(allIDs)/sizeof(allIDs[0]); ++i ) {
|
||||||
|
XP_U16* ids = allIDs[i];
|
||||||
|
XP_Bool enable = ids == on;
|
||||||
|
while ( *ids != 0 ) {
|
||||||
|
ceShowOrHide( hDlg, *(ids++), enable );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* adjustForConnType */
|
||||||
|
|
||||||
|
static XP_U16
|
||||||
|
conTypeToIndex( CommsConnType conType )
|
||||||
|
{
|
||||||
|
XP_U16 index = 0;
|
||||||
|
switch( conType ) {
|
||||||
|
case COMMS_CONN_RELAY:
|
||||||
|
index = 1;
|
||||||
|
break;
|
||||||
|
case COMMS_CONN_BT:
|
||||||
|
index = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
XP_ASSERT(0);
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
static CommsConnType
|
||||||
|
indexToConType( XP_U16 index )
|
||||||
|
{
|
||||||
|
CommsConnType conType = COMMS_CONN_UNUSED;
|
||||||
|
switch( index ) {
|
||||||
|
case 0:
|
||||||
|
conType = COMMS_CONN_BT; break;
|
||||||
|
case 1:
|
||||||
|
conType = COMMS_CONN_RELAY; break;
|
||||||
|
default:
|
||||||
|
XP_ASSERT(0);
|
||||||
|
}
|
||||||
|
return conType;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ceControlsFromAddrRec( HWND hDlg, const CeConnDlgState* cState )
|
ceControlsFromAddrRec( HWND hDlg, const CeConnDlgState* cState )
|
||||||
{
|
{
|
||||||
XP_U16 i;
|
XP_U16 i;
|
||||||
wchar_t* strs[] = { L"WiFi/Cellular data"
|
wchar_t* strs[] = {
|
||||||
#ifdef XWFEATURE_BLUETOOTH
|
L"Bluetooth"
|
||||||
, L"Bluetooth"
|
, L"WiFi/Cellular data"
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for ( i = 0; i < sizeof(strs)/sizeof(strs[0]); ++i ) {
|
for ( i = 0; i < sizeof(strs)/sizeof(strs[0]); ++i ) {
|
||||||
SendDlgItemMessage( hDlg, IDC_CONNECTCOMBO, CB_ADDSTRING,
|
SendDlgItemMessage( hDlg, IDC_CONNECTCOMBO, CB_ADDSTRING,
|
||||||
0, (LPARAM)strs[i] );
|
0, (LPARAM)strs[i] );
|
||||||
}
|
}
|
||||||
XP_ASSERT( cState->addrRec.conType == COMMS_CONN_RELAY
|
|
||||||
|| cState->addrRec.conType == COMMS_CONN_BT );
|
|
||||||
SendDlgItemMessage( hDlg, IDC_CONNECTCOMBO, CB_SETCURSEL,
|
|
||||||
cState->addrRec.conType - COMMS_CONN_RELAY, 0L );
|
|
||||||
|
|
||||||
ceSetDlgItemText( hDlg, RELAYNAME_EDIT, cState->addrRec.u.ip_relay.hostName );
|
SendDlgItemMessage( hDlg, IDC_CONNECTCOMBO, CB_SETCURSEL,
|
||||||
ceSetDlgItemNum( hDlg, RELAYPORT_EDIT, cState->addrRec.u.ip_relay.port );
|
conTypeToIndex(cState->addrRec.conType), 0L );
|
||||||
ceSetDlgItemText( hDlg, COOKIE_EDIT, cState->addrRec.u.ip_relay.cookie );
|
|
||||||
|
if ( cState->addrRec.conType == COMMS_CONN_RELAY ) {
|
||||||
|
#ifdef XWFEATURE_RELAY
|
||||||
|
ceSetDlgItemText( hDlg, RELAYNAME_EDIT,
|
||||||
|
cState->addrRec.u.ip_relay.hostName );
|
||||||
|
ceSetDlgItemNum( hDlg, RELAYPORT_EDIT,
|
||||||
|
cState->addrRec.u.ip_relay.port );
|
||||||
|
ceSetDlgItemText( hDlg, COOKIE_EDIT,
|
||||||
|
cState->addrRec.u.ip_relay.cookie );
|
||||||
|
#endif
|
||||||
|
} else if ( cState->addrRec.conType == COMMS_CONN_BT ) {
|
||||||
|
#ifdef XWFEATURE_BLUETOOTH
|
||||||
|
if ( cState->role == SERVER_ISCLIENT ) {
|
||||||
|
ceSetDlgItemText( hDlg, IDC_BLUET_ADDR_EDIT,
|
||||||
|
cState->addrRec.u.bt.hostName );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
XP_ASSERT(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static LRESULT CALLBACK
|
static LRESULT CALLBACK
|
||||||
|
@ -76,6 +174,8 @@ ConnsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
cState = (CeConnDlgState*)lParam;
|
cState = (CeConnDlgState*)lParam;
|
||||||
globals = cState->globals;
|
globals = cState->globals;
|
||||||
|
|
||||||
|
adjustForConnType( hDlg, cState );
|
||||||
|
|
||||||
ceControlsFromAddrRec( hDlg, cState );
|
ceControlsFromAddrRec( hDlg, cState );
|
||||||
|
|
||||||
ceStackButtonsRight( globals, hDlg );
|
ceStackButtonsRight( globals, hDlg );
|
||||||
|
@ -90,6 +190,18 @@ ConnsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
XP_U16 id = LOWORD(wParam);
|
XP_U16 id = LOWORD(wParam);
|
||||||
|
|
||||||
switch( id ) {
|
switch( id ) {
|
||||||
|
|
||||||
|
case IDC_CONNECTCOMBO:
|
||||||
|
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
|
||||||
|
XP_S16 sel;
|
||||||
|
sel = SendDlgItemMessage( hDlg, IDC_CONNECTCOMBO,
|
||||||
|
CB_GETCURSEL, 0, 0L );
|
||||||
|
cState->addrRec.conType = indexToConType( sel );
|
||||||
|
adjustForConnType( hDlg, cState );
|
||||||
|
result = TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case IDOK:
|
case IDOK:
|
||||||
ceControlsToAddrRec( hDlg, cState );
|
ceControlsToAddrRec( hDlg, cState );
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
|
@ -106,19 +218,17 @@ ConnsDlg( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
|
|
||||||
XP_Bool
|
XP_Bool
|
||||||
WrapConnsDlg( HWND hDlg, CEAppGlobals* globals, const CommsAddrRec* addrRec,
|
WrapConnsDlg( HWND hDlg, CEAppGlobals* globals, const CommsAddrRec* addrRec,
|
||||||
CeConnDlgState* state )
|
Connectedness role, CeConnDlgState* state )
|
||||||
{
|
{
|
||||||
XP_Bool result;
|
XP_Bool result;
|
||||||
XP_MEMSET( state, 0, sizeof( *state ) );
|
XP_MEMSET( state, 0, sizeof( *state ) );
|
||||||
|
|
||||||
XP_LOGF( "WrapConnsDlg" );
|
|
||||||
|
|
||||||
state->globals = globals;
|
state->globals = globals;
|
||||||
|
state->role = role;
|
||||||
XP_MEMCPY( &state->addrRec, addrRec, sizeof(state->addrRec) );
|
XP_MEMCPY( &state->addrRec, addrRec, sizeof(state->addrRec) );
|
||||||
|
|
||||||
DialogBoxParam( globals->hInst, (LPCTSTR)IDD_CONNSSDLG, hDlg,
|
DialogBoxParam( globals->hInst, (LPCTSTR)IDD_CONNSSDLG, hDlg,
|
||||||
(DLGPROC)ConnsDlg, (long)state );
|
(DLGPROC)ConnsDlg, (long)state );
|
||||||
|
|
||||||
result = !state->userCancelled;
|
result = !state->userCancelled;
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -25,11 +25,13 @@
|
||||||
|
|
||||||
typedef struct CeConnDlgState {
|
typedef struct CeConnDlgState {
|
||||||
CommsAddrRec addrRec;
|
CommsAddrRec addrRec;
|
||||||
|
Connectedness role;
|
||||||
CEAppGlobals* globals;
|
CEAppGlobals* globals;
|
||||||
XP_Bool userCancelled;
|
XP_Bool userCancelled;
|
||||||
} CeConnDlgState;
|
} CeConnDlgState;
|
||||||
|
|
||||||
XP_Bool WrapConnsDlg( HWND hDlg, CEAppGlobals* globals,
|
XP_Bool WrapConnsDlg( HWND hDlg, CEAppGlobals* globals,
|
||||||
const CommsAddrRec* addrRec, CeConnDlgState* state );
|
const CommsAddrRec* addrRec,
|
||||||
|
Connectedness role, CeConnDlgState* state );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -156,7 +156,7 @@ loadFromGameInfo( HWND hDlg, CEAppGlobals* globals, GameInfoState* giState )
|
||||||
XP_U16 i;
|
XP_U16 i;
|
||||||
CurGameInfo* gi = &globals->gameInfo;
|
CurGameInfo* gi = &globals->gameInfo;
|
||||||
|
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
wchar_t* roles[] = { L"Standalone", L"Host", L"Guest" };
|
wchar_t* roles[] = { L"Standalone", L"Host", L"Guest" };
|
||||||
for ( i = 0; i < (sizeof(roles)/sizeof(roles[0])); ++i ) {
|
for ( i = 0; i < (sizeof(roles)/sizeof(roles[0])); ++i ) {
|
||||||
SendDlgItemMessage( hDlg, IDC_ROLECOMBO, CB_ADDSTRING, 0,
|
SendDlgItemMessage( hDlg, IDC_ROLECOMBO, CB_ADDSTRING, 0,
|
||||||
|
@ -258,15 +258,15 @@ handlePrefsButton( HWND hDlg, CEAppGlobals* globals, GameInfoState* giState )
|
||||||
}
|
}
|
||||||
} /* handlePrefsButton */
|
} /* handlePrefsButton */
|
||||||
|
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
static void
|
static void
|
||||||
handleConnOptionsButton( HWND hDlg, CEAppGlobals* globals,
|
handleConnOptionsButton( HWND hDlg, CEAppGlobals* globals,
|
||||||
GameInfoState* giState )
|
Connectedness role, GameInfoState* giState )
|
||||||
{
|
{
|
||||||
CeConnDlgState state;
|
CeConnDlgState state;
|
||||||
|
|
||||||
if ( WrapConnsDlg( hDlg, globals, &giState->prefsPrefs.addrRec,
|
if ( WrapConnsDlg( hDlg, globals, &giState->prefsPrefs.addrRec,
|
||||||
&state ) ) {
|
role, &state ) ) {
|
||||||
XP_MEMCPY( &giState->prefsPrefs.addrRec, &state.addrRec,
|
XP_MEMCPY( &giState->prefsPrefs.addrRec, &state.addrRec,
|
||||||
sizeof(giState->prefsPrefs.addrRec) );
|
sizeof(giState->prefsPrefs.addrRec) );
|
||||||
giState->addrChanged = XP_TRUE;
|
giState->addrChanged = XP_TRUE;
|
||||||
|
@ -306,7 +306,7 @@ resIDForAttr( NewGameAttr attr )
|
||||||
case NG_ATTR_NPLAYERS:
|
case NG_ATTR_NPLAYERS:
|
||||||
resID = IDC_NPLAYERSCOMBO;
|
resID = IDC_NPLAYERSCOMBO;
|
||||||
break;
|
break;
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
case NG_ATTR_ROLE:
|
case NG_ATTR_ROLE:
|
||||||
resID = IDC_ROLECOMBO;
|
resID = IDC_ROLECOMBO;
|
||||||
break;
|
break;
|
||||||
|
@ -320,24 +320,26 @@ resIDForAttr( NewGameAttr attr )
|
||||||
case NG_ATTR_CANJUGGLE:
|
case NG_ATTR_CANJUGGLE:
|
||||||
resID = GIJUGGLE_BUTTON;
|
resID = GIJUGGLE_BUTTON;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
XP_ASSERT( resID != 0 );
|
XP_ASSERT( resID != 0 );
|
||||||
return resID;
|
return resID;
|
||||||
} /* resIDForAttr */
|
} /* resIDForAttr */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
doForNWEnable( HWND hDlg, XP_U16 resID, NewGameEnable enable )
|
doForNWEnable( HWND hDlg, XP_U16 resID, XP_TriEnable enable )
|
||||||
{
|
{
|
||||||
XP_Bool makeVisible = enable != NGEnableHidden;
|
XP_Bool makeVisible = enable != TRI_ENAB_HIDDEN;
|
||||||
ceShowOrHide( hDlg, resID, makeVisible );
|
ceShowOrHide( hDlg, resID, makeVisible );
|
||||||
if ( makeVisible ) {
|
if ( makeVisible ) {
|
||||||
ceEnOrDisable( hDlg, resID, enable == NGEnableEnabled );
|
ceEnOrDisable( hDlg, resID, enable == TRI_ENAB_ENABLED );
|
||||||
}
|
}
|
||||||
} /* doForNWEnable */
|
} /* doForNWEnable */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ceEnableColProc( void* closure, XP_U16 player, NewGameColumn col,
|
ceEnableColProc( void* closure, XP_U16 player, NewGameColumn col,
|
||||||
NewGameEnable enable )
|
XP_TriEnable enable )
|
||||||
{
|
{
|
||||||
GameInfoState* giState = (GameInfoState*)closure;
|
GameInfoState* giState = (GameInfoState*)closure;
|
||||||
XP_U16 resID = resIDForCol( player, col );
|
XP_U16 resID = resIDForCol( player, col );
|
||||||
|
@ -345,7 +347,7 @@ ceEnableColProc( void* closure, XP_U16 player, NewGameColumn col,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ceEnableAttrProc( void* closure, NewGameAttr attr, NewGameEnable enable )
|
ceEnableAttrProc( void* closure, NewGameAttr attr, XP_TriEnable enable )
|
||||||
{
|
{
|
||||||
GameInfoState* giState = (GameInfoState*)closure;
|
GameInfoState* giState = (GameInfoState*)closure;
|
||||||
XP_U16 resID = resIDForAttr( attr );
|
XP_U16 resID = resIDForAttr( attr );
|
||||||
|
@ -565,7 +567,7 @@ GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
case IDC_ROLECOMBO:
|
case IDC_ROLECOMBO:
|
||||||
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
|
if ( HIWORD(wParam) == CBN_SELCHANGE ) {
|
||||||
if ( giState->isNewGame ) { /* ignore if in info
|
if ( giState->isNewGame ) { /* ignore if in info
|
||||||
|
@ -582,6 +584,7 @@ GameInfo(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
connecting */
|
connecting */
|
||||||
if ( value.ng_role != SERVER_STANDALONE ) {
|
if ( value.ng_role != SERVER_STANDALONE ) {
|
||||||
handleConnOptionsButton( hDlg, globals,
|
handleConnOptionsButton( hDlg, globals,
|
||||||
|
value.ng_role,
|
||||||
giState );
|
giState );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ typedef struct FileWriteState {
|
||||||
} FileWriteState;
|
} FileWriteState;
|
||||||
|
|
||||||
/* forward util function decls */
|
/* forward util function decls */
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
static XP_S16 ce_send_proc( const XP_U8* buf, XP_U16 len,
|
static XP_S16 ce_send_proc( const XP_U8* buf, XP_U16 len,
|
||||||
const CommsAddrRec* addr,
|
const CommsAddrRec* addr,
|
||||||
void* closure );
|
void* closure );
|
||||||
|
@ -111,7 +111,7 @@ static void ce_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why, XP_U16 when,
|
||||||
static void ce_util_requestTime( XW_UtilCtxt* uc );
|
static void ce_util_requestTime( XW_UtilCtxt* uc );
|
||||||
static XP_U32 ce_util_getCurSeconds( XW_UtilCtxt* uc );
|
static XP_U32 ce_util_getCurSeconds( XW_UtilCtxt* uc );
|
||||||
static DictionaryCtxt* ce_util_makeEmptyDict( XW_UtilCtxt* uc );
|
static DictionaryCtxt* ce_util_makeEmptyDict( XW_UtilCtxt* uc );
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#ifdef XWFEATURE_RELAY
|
||||||
static XWStreamCtxt* ce_util_makeStreamFromAddr( XW_UtilCtxt* uc,
|
static XWStreamCtxt* ce_util_makeStreamFromAddr( XW_UtilCtxt* uc,
|
||||||
XP_U16 channelNo );
|
XP_U16 channelNo );
|
||||||
#endif
|
#endif
|
||||||
|
@ -733,7 +733,7 @@ ceInitAndStartBoard( CEAppGlobals* globals, XP_Bool newGame, CeGamePrefs* gp,
|
||||||
globals->gameInfo.robotSmartness = gp->robotSmartness;
|
globals->gameInfo.robotSmartness = gp->robotSmartness;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
if ( !!addr ) {
|
if ( !!addr ) {
|
||||||
XP_ASSERT( globals->game.comms != NULL );
|
XP_ASSERT( globals->game.comms != NULL );
|
||||||
comms_setAddr( globals->game.comms, addr );
|
comms_setAddr( globals->game.comms, addr );
|
||||||
|
@ -1383,7 +1383,7 @@ ceDoNewGame( CEAppGlobals* globals )
|
||||||
updateForColors( globals );
|
updateForColors( globals );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
if ( giState.addrChanged ) {
|
if ( giState.addrChanged ) {
|
||||||
addr = &giState.prefsPrefs.addrRec;
|
addr = &giState.prefsPrefs.addrRec;
|
||||||
}
|
}
|
||||||
|
@ -2363,7 +2363,7 @@ wince_snprintf( XP_UCHAR* buf, XP_U16 len, XP_UCHAR* format, ... )
|
||||||
return strlen(buf);
|
return strlen(buf);
|
||||||
} /* wince_snprintf */
|
} /* wince_snprintf */
|
||||||
|
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#ifdef XWFEATURE_RELAY
|
||||||
static void
|
static void
|
||||||
got_data_proc( XP_U8* data, XP_U16 len, void* closure )
|
got_data_proc( XP_U8* data, XP_U16 len, void* closure )
|
||||||
{
|
{
|
||||||
|
@ -2380,7 +2380,9 @@ got_data_proc( XP_U8* data, XP_U16 len, void* closure )
|
||||||
0, (DWORD)stream );
|
0, (DWORD)stream );
|
||||||
XP_ASSERT( posted );
|
XP_ASSERT( posted );
|
||||||
} /* got_data_proc */
|
} /* got_data_proc */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
static XP_S16
|
static XP_S16
|
||||||
ce_send_proc( const XP_U8* buf, XP_U16 len, const CommsAddrRec* addr,
|
ce_send_proc( const XP_U8* buf, XP_U16 len, const CommsAddrRec* addr,
|
||||||
void* closure )
|
void* closure )
|
||||||
|
@ -2390,6 +2392,7 @@ ce_send_proc( const XP_U8* buf, XP_U16 len, const CommsAddrRec* addr,
|
||||||
|
|
||||||
if ( !globals->socketWrap ) {
|
if ( !globals->socketWrap ) {
|
||||||
globals->socketWrap = ce_sockwrap_new( MPPARM(globals->mpool)
|
globals->socketWrap = ce_sockwrap_new( MPPARM(globals->mpool)
|
||||||
|
addr->conType,
|
||||||
got_data_proc, globals );
|
got_data_proc, globals );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2404,7 +2407,6 @@ ce_send_on_close( XWStreamCtxt* stream, void* closure )
|
||||||
XP_ASSERT( !!globals->game.comms );
|
XP_ASSERT( !!globals->game.comms );
|
||||||
comms_send( globals->game.comms, stream );
|
comms_send( globals->game.comms, stream );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static VTableMgr*
|
static VTableMgr*
|
||||||
|
@ -2639,7 +2641,8 @@ ce_util_engineProgressCallback( XW_UtilCtxt* XP_UNUSED(uc) )
|
||||||
} /* ce_util_engineProgressCallback */
|
} /* ce_util_engineProgressCallback */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ce_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why, XP_U16 when,
|
ce_util_setTimer( XW_UtilCtxt* uc, XWTimerReason why,
|
||||||
|
XP_U16 XP_UNUSED_RELAY(when),
|
||||||
TimerProc proc, void* closure)
|
TimerProc proc, void* closure)
|
||||||
{
|
{
|
||||||
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
|
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
|
||||||
|
@ -2824,7 +2827,7 @@ ce_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi,
|
||||||
return isOk;
|
return isOk;
|
||||||
} /* ce_util_warnIllegalWord */
|
} /* ce_util_warnIllegalWord */
|
||||||
|
|
||||||
#ifdef XWFEATURE_RELAY
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
static void
|
static void
|
||||||
ce_util_addrChange( XW_UtilCtxt* XP_UNUSED(uc),
|
ce_util_addrChange( XW_UtilCtxt* XP_UNUSED(uc),
|
||||||
const CommsAddrRec* XP_UNUSED(oldAddr),
|
const CommsAddrRec* XP_UNUSED(oldAddr),
|
||||||
|
|
|
@ -130,7 +130,7 @@ loadStateFromCurPrefs( CEAppGlobals* globals, const CEAppPrefs* appPrefs,
|
||||||
XP_MEMCPY( &prefsPrefs->colors, &appPrefs->colors,
|
XP_MEMCPY( &prefsPrefs->colors, &appPrefs->colors,
|
||||||
sizeof(prefsPrefs->colors) );
|
sizeof(prefsPrefs->colors) );
|
||||||
|
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
if ( globals->game.comms != NULL ) {
|
if ( globals->game.comms != NULL ) {
|
||||||
comms_getAddr( globals->game.comms, &prefsPrefs->addrRec );
|
comms_getAddr( globals->game.comms, &prefsPrefs->addrRec );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -361,7 +361,8 @@ ReaderThreadProc( LPVOID lpParameter )
|
||||||
|
|
||||||
|
|
||||||
CeSocketWrapper*
|
CeSocketWrapper*
|
||||||
ce_sockwrap_new( MPFORMAL DataRecvProc proc, void* closure )
|
ce_sockwrap_new( MPFORMAL CommsConnType conType, DataRecvProc proc,
|
||||||
|
void* closure )
|
||||||
{
|
{
|
||||||
CeSocketWrapper* self = XP_MALLOC( mpool, sizeof(*self) );
|
CeSocketWrapper* self = XP_MALLOC( mpool, sizeof(*self) );
|
||||||
XP_MEMSET( self, 0, sizeof(*self) );
|
XP_MEMSET( self, 0, sizeof(*self) );
|
||||||
|
|
|
@ -27,7 +27,7 @@ typedef struct CeSocketWrapper CeSocketWrapper; /* forward */
|
||||||
typedef void (*DataRecvProc)( XP_U8* data, XP_U16 len, void* closure );
|
typedef void (*DataRecvProc)( XP_U8* data, XP_U16 len, void* closure );
|
||||||
|
|
||||||
|
|
||||||
CeSocketWrapper* ce_sockwrap_new( MPFORMAL DataRecvProc proc, void* closure );
|
CeSocketWrapper* ce_sockwrap_new( MPFORMAL CommsConnType conType, DataRecvProc proc, void* closure );
|
||||||
void ce_sockwrap_delete( CeSocketWrapper* self );
|
void ce_sockwrap_delete( CeSocketWrapper* self );
|
||||||
|
|
||||||
XP_U16 ce_sockwrap_send( CeSocketWrapper* self, const XP_U8* buf, XP_U16 len,
|
XP_U16 ce_sockwrap_send( CeSocketWrapper* self, const XP_U8* buf, XP_U16 len,
|
||||||
|
|
|
@ -134,19 +134,26 @@
|
||||||
#define HC_MIN_COMBO 1087
|
#define HC_MIN_COMBO 1087
|
||||||
#define HC_MAX_COMBO 1088
|
#define HC_MAX_COMBO 1088
|
||||||
|
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#define IDC_CCONVIA_LAB 1089
|
||||||
# define IDC_CCONVIA_LAB 1089
|
|
||||||
# define IDC_CRELAYNAME_LAB 1090
|
#define IDC_COOKIE_LAB 1090
|
||||||
# define IDC_CRELAYPORT_LAB 1091
|
#ifdef XWFEATURE_RELAY
|
||||||
# define IDC_COOKIE_LAB 1092
|
# define IDC_CRELAYNAME_LAB 1091
|
||||||
|
# define IDC_CRELAYPORT_LAB 1092
|
||||||
# define IDC_CRELAYHINT_LAB 1093
|
# define IDC_CRELAYHINT_LAB 1093
|
||||||
|
|
||||||
# define IDC_CONNECTCOMBO 1094
|
# define IDC_CONNECTCOMBO 1094
|
||||||
# define RELAYNAME_EDIT 1095
|
# define RELAYNAME_EDIT 1095
|
||||||
# define RELAYPORT_EDIT 1096
|
# define RELAYPORT_EDIT 1096
|
||||||
# define COOKIE_EDIT 1097
|
# define COOKIE_EDIT 1097
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define IDC_BLUET_ADDR_LAB 1100
|
||||||
|
#ifdef XWFEATURE_BLUETOOTH
|
||||||
|
# define IDC_BLUET_ADDR_EDIT 1101
|
||||||
|
# define IDC_BLUET_ADDR_BROWSE 1102
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ BEGIN
|
||||||
MENUITEM "Game info", ID_GAME_GAMEINFO
|
MENUITEM "Game info", ID_GAME_GAMEINFO
|
||||||
MENUITEM "History", ID_GAME_HISTORY
|
MENUITEM "History", ID_GAME_HISTORY
|
||||||
MENUITEM "Final scores", ID_GAME_FINALSCORES
|
MENUITEM "Final scores", ID_GAME_FINALSCORES
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Resend messages", ID_GAME_RESENDMSGS
|
MENUITEM "Resend messages", ID_GAME_RESENDMSGS
|
||||||
#endif
|
#endif
|
||||||
|
@ -224,7 +224,7 @@ BEGIN
|
||||||
LABELS_ROW,19,8,SS_NOPREFIX
|
LABELS_ROW,19,8,SS_NOPREFIX
|
||||||
LTEXT "Robot",IDC_STATIC,GAME_ROBOTLABEL_LEFT,LABELS_ROW,20,8
|
LTEXT "Robot",IDC_STATIC,GAME_ROBOTLABEL_LEFT,LABELS_ROW,20,8
|
||||||
LTEXT "Pwd",IDC_STATIC,GAME_PWDLABEL_LEFT,LABELS_ROW,16,8
|
LTEXT "Pwd",IDC_STATIC,GAME_PWDLABEL_LEFT,LABELS_ROW,16,8
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
LTEXT "Remote",IDC_REMOTE_LABEL,LEFT_COL,LABELS_ROW,25,8,SS_NOPREFIX
|
LTEXT "Remote",IDC_REMOTE_LABEL,LEFT_COL,LABELS_ROW,25,8,SS_NOPREFIX
|
||||||
CONTROL "",REMOTE_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
CONTROL "",REMOTE_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||||
GAME_REMOTE_LEFT, PLAYER_ROW_1,CHECK_WIDTH,ROW_HEIGHT
|
GAME_REMOTE_LEFT, PLAYER_ROW_1,CHECK_WIDTH,ROW_HEIGHT
|
||||||
|
@ -397,7 +397,7 @@ BEGIN
|
||||||
REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT
|
REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT
|
||||||
END
|
END
|
||||||
|
|
||||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
#if defined XWFEATURE_RELAY || defined XWFEATURE_BLUETOOTH
|
||||||
|
|
||||||
# define LAB_COL 8
|
# define LAB_COL 8
|
||||||
# define LAB_COL_WIDTH 40
|
# define LAB_COL_WIDTH 40
|
||||||
|
@ -419,7 +419,8 @@ BEGIN
|
||||||
LTEXT "Connect via",IDC_CCONVIA_LAB,LAB_COL,CONN_ROW_1,40,12
|
LTEXT "Connect via",IDC_CCONVIA_LAB,LAB_COL,CONN_ROW_1,40,12
|
||||||
COMBOBOX IDC_CONNECTCOMBO,CTRL_COL,CONN_ROW_1,CTRL_COL_WIDTH,58,CBS_DROPDOWNLIST |
|
COMBOBOX IDC_CONNECTCOMBO,CTRL_COL,CONN_ROW_1,CTRL_COL_WIDTH,58,CBS_DROPDOWNLIST |
|
||||||
WS_VSCROLL | WS_TABSTOP
|
WS_VSCROLL | WS_TABSTOP
|
||||||
|
|
||||||
|
#ifdef XWFEATURE_RELAY
|
||||||
LTEXT "Cookie",IDC_COOKIE_LAB,LAB_COL,CONN_ROW_2,40,12
|
LTEXT "Cookie",IDC_COOKIE_LAB,LAB_COL,CONN_ROW_2,40,12
|
||||||
EDITTEXT COOKIE_EDIT,CTRL_COL,CONN_ROW_2,CTRL_COL_WIDTH,12,
|
EDITTEXT COOKIE_EDIT,CTRL_COL,CONN_ROW_2,CTRL_COL_WIDTH,12,
|
||||||
ES_AUTOHSCROLL
|
ES_AUTOHSCROLL
|
||||||
|
@ -432,6 +433,22 @@ BEGIN
|
||||||
LTEXT "Relay port",IDC_CRELAYPORT_LAB,LAB_COL,CONN_ROW_4,40,12
|
LTEXT "Relay port",IDC_CRELAYPORT_LAB,LAB_COL,CONN_ROW_4,40,12
|
||||||
EDITTEXT RELAYPORT_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH,12,
|
EDITTEXT RELAYPORT_EDIT,CTRL_COL,CONN_ROW_4,CTRL_COL_WIDTH,12,
|
||||||
ES_AUTOHSCROLL | ES_NUMBER
|
ES_AUTOHSCROLL | ES_NUMBER
|
||||||
|
#else
|
||||||
|
LTEXT "Relay connection not supported.",IDC_COOKIE_LAB,LAB_COL,CONN_ROW_2,40,12
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef XWFEATURE_BLUETOOTH
|
||||||
|
LTEXT "Host name:",
|
||||||
|
IDC_BLUET_ADDR_LAB,LAB_COL,CONN_ROW_2,40,36
|
||||||
|
EDITTEXT IDC_BLUET_ADDR_EDIT,CTRL_COL,CONN_ROW_2,CTRL_COL_WIDTH,12,
|
||||||
|
ES_AUTOHSCROLL
|
||||||
|
PUSHBUTTON "Browse",IDC_BLUET_ADDR_BROWSE,CTRL_COL,CONN_ROW_HINT,
|
||||||
|
REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT
|
||||||
|
|
||||||
|
#else
|
||||||
|
LTEXT "Bluetooth not supported.",
|
||||||
|
IDC_BLUET_ADDR_LAB,LAB_COL,CONN_ROW_2,40,12
|
||||||
|
#endif
|
||||||
|
|
||||||
PUSHBUTTON "OK",IDOK,9,BUTTON_ROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT
|
PUSHBUTTON "OK",IDOK,9,BUTTON_ROW,REPOS_BUTTON_WIDTH,REPOS_BUTTON_HT
|
||||||
DEFPUSHBUTTON "Cancel",IDCANCEL,70,BUTTON_ROW,
|
DEFPUSHBUTTON "Cancel",IDCANCEL,70,BUTTON_ROW,
|
||||||
|
|
Loading…
Add table
Reference in a new issue