From: H.G. Muller Date: Sun, 6 Nov 2011 16:20:01 +0000 (+0100) Subject: Add feature-override options X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=0c082fce711802c67feae5dd1ddadad022a48147 Add feature-override options A few (dangerous) options are added to allow a user to override engine features, or change their defaults, by supplying a string with feature commands (e.g. "sigint=0") which tricks XBoard into thinking the engine sent that. There is a -featureDefaults which is processed before the engine features, and -first/secondFeatures which is parsed just before engine initialization. This goes horribly wrong when the user wouldtry silly things like including 'option' or 'done' features! --- diff --git a/args.h b/args.h index d7a77a2..92f05af 100644 --- a/args.h +++ b/args.h @@ -617,6 +617,9 @@ ArgDescriptor argDescriptors[] = { { "autoLogo", ArgBoolean, (void *) &appData.autoLogo, TRUE, INVALID }, { "firstOptions", ArgString, (void *) &appData.firstOptions, FALSE, (ArgIniType) "" }, { "secondOptions", ArgString, (void *) &appData.secondOptions, FALSE, (ArgIniType) "" }, + { "firstFeatures", ArgString, (void *) &appData.features[0], FALSE, (ArgIniType) "" }, + { "secondFeatures", ArgString, (void *) &appData.features[1], FALSE, (ArgIniType) "" }, + { "featureDefaults", ArgString, (void *) &appData.featureDefaults, TRUE, (ArgIniType) "" }, { "firstNeedsNoncompliantFEN", ArgString, (void *) &appData.fenOverride1, FALSE, (ArgIniType) NULL }, { "secondNeedsNoncompliantFEN", ArgString, (void *) &appData.fenOverride2, FALSE, (ArgIniType) NULL }, { "keepAlive", ArgInt, (void *) &appData.keepAlive, FALSE, INVALID }, diff --git a/backend.c b/backend.c index 9c96909..ca3e342 100644 --- a/backend.c +++ b/backend.c @@ -834,6 +834,7 @@ InitEngine(ChessProgramState *cps, int n) } InitEngineUCI( installDir, cps ); // [HGM] moved here from winboard.c, to make available in xboard + ParseFeatures(appData.featureDefaults, cps); } ChessProgramState *savCps; @@ -9539,6 +9540,7 @@ InitChessProgram(cps, setup) hintRequested = FALSE; bookRequested = FALSE; + ParseFeatures(appData.features[cps == &second], cps); // [HGM] allow user to overrule features /* [HGM] some new WB protocol commands to configure engine are sent now, if engine supports them */ /* moved to before sending initstring in 4.3.15, so Polyglot can delay UCI 'isready' to recepton of 'new' */ if(cps->memSize) { /* [HGM] memory */ diff --git a/common.h b/common.h index 5dc5287..e76320c 100644 --- a/common.h +++ b/common.h @@ -649,6 +649,8 @@ typedef struct { Boolean noGUI; /* [HGM] fast: suppress all display updates */ char *engOptions[ENGINES]; /* [HGM] options */ char *fenOverride[ENGINES]; + char *features[ENGINES]; + char *featureDefaults; Boolean keepAlive; /* [HGM] alive */ Boolean forceIllegal;/*[HGM] illegal */ Boolean noJoin; /* [HGM] join */