00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 using namespace std;
00034
00035 #include <iostream>
00036
00037 #include <cstring>
00038 #include "mmsconfig/mmsrcparser.h"
00039 #include "mmstools/tools.h"
00040 #include "diskoversion.h"
00041
00042 #define WRONG_VALUE(parname, parvalue, validvals, addmsg) throw MMSRcParserError(1, "wrong value '" + string(parvalue) + "' for parameter '" + string((const char *)parname) + "'\n valid value(s): " + validvals + "\n " + addmsg);
00043
00044
00045 MMSRcParser::MMSRcParser() {
00046 this->configdb.database = "/tmp/mmsconfigdb";
00047 this->datadb.database = "/tmp/mmsdatadb";
00048 }
00049
00050 MMSRcParser::~MMSRcParser() {
00051
00052 }
00053
00054 void MMSRcParser::parseFile(string filename) {
00055
00056 try {
00057 xmlDoc *parser = NULL;
00058
00059 LIBXML_TEST_VERSION
00060
00061 #ifdef __ENABLE_LOG__
00062 parser = xmlReadFile((char *)filename.c_str(), NULL, XML_PARSE_NOBLANKS | XML_PARSE_NONET);
00063 #else
00064 parser = xmlReadFile((char *)filename.c_str(), NULL, XML_PARSE_NOBLANKS | XML_PARSE_NONET | XML_PARSE_NOERROR | XML_PARSE_NOWARNING);
00065 #endif
00066
00067 if(parser == NULL) {
00068 throw MMSRcParserError(1,"Could not parse file:" + filename);
00069 }
00070
00071 if(parser) {
00072
00073 xmlNode* pNode = xmlDocGetRootElement(parser);
00074 if(xmlStrcmp(pNode->name, (const xmlChar *) "mmsrc")) {
00075 if(xmlStrcmp(pNode->name, (const xmlChar *) "diskorc")) {
00076 std::cout << "invalid configuration file (" << filename << ") - does not contain mmsrc root node" << std::endl;
00077 throw MMSRcParserError(1, "invalid file");
00078 }
00079 }
00080 this->throughFile(pNode);
00081
00082 if (this->graphics.vrect.w <= 0)
00083 this->graphics.vrect.w = this->graphics.graphicslayer.rect.w;
00084 if (this->graphics.vrect.h <= 0)
00085 this->graphics.vrect.h = this->graphics.graphicslayer.rect.h;
00086 if ((this->graphics.vrect.x < 0)||(this->graphics.vrect.x > this->graphics.graphicslayer.rect.w))
00087 this->graphics.vrect.x = 0;
00088 if ((this->graphics.vrect.y < 0)||(this->graphics.vrect.y > this->graphics.graphicslayer.rect.h))
00089 this->graphics.vrect.y = 0;
00090 if (this->graphics.vrect.w - this->graphics.vrect.x > this->graphics.graphicslayer.rect.w)
00091 this->graphics.vrect.w = this->graphics.graphicslayer.rect.w - this->graphics.vrect.x;
00092 if (this->graphics.vrect.h - this->graphics.vrect.y > this->graphics.graphicslayer.rect.h)
00093 this->graphics.vrect.h = this->graphics.graphicslayer.rect.h - this->graphics.vrect.y;
00094
00095
00096
00097 xmlFreeDoc(parser);
00098 }
00099 }
00100 catch(MMSError &error)
00101 {
00102 std::cout << "RcParser exception: " << error.getMessage() << std::endl;
00103 throw MMSRcParserError(1, error.getMessage());
00104 }
00105
00106 }
00107
00108 void MMSRcParser::getMMSRc(MMSConfigDataGlobal **global,
00109 MMSConfigDataDB **configdb,
00110 MMSConfigDataDB **datadb,
00111 MMSConfigDataGraphics **graphics,
00112 MMSConfigDataLanguage **language) {
00113 if (global) *global = &this->global;
00114 if (configdb) *configdb = &this->configdb;
00115 if (datadb) *datadb = &this->datadb;
00116 if (graphics) *graphics = &this->graphics;
00117 if (language) *language = &this->language;
00118 }
00119
00120 void MMSRcParser::getMMSRc(MMSConfigDataGlobal *global,
00121 MMSConfigDataDB *configdb,
00122 MMSConfigDataDB *datadb,
00123 MMSConfigDataGraphics *graphics,
00124 MMSConfigDataLanguage *language) {
00125 if (global) *global = this->global;
00126 if (configdb) *configdb = this->configdb;
00127 if (datadb) *datadb = this->datadb;
00128 if (graphics) *graphics = this->graphics;
00129 if (language) *language = this->language;
00130 }
00131
00132
00133
00134
00135
00136
00137
00138
00139 void MMSRcParser::checkVersion(xmlNode* node) {
00140
00141 xmlChar *version;
00142
00143 version = xmlGetProp(node, (const xmlChar*)"version");
00144
00145 if(!version) {
00146 std::cout << "Configuration file misses version entity!" << std::endl;
00147 throw MMSRcParserError(1, "missing version");
00148 }
00149
00150
00151 version[1]=0;
00152 version[3]=0;
00153 int mav = atoi((char*)&version[0]);
00154 int miv = atoi((char*)&version[2]);
00155
00156
00157 if ((mav > DISKO_MAJOR_VERSION )||(miv > DISKO_MINOR_VERSION)) {
00158 std::cout << "Version of configuration file does not match!" << std::endl;
00159 xmlFree(version);
00160 throw MMSRcParserError(1, "version mismatch");
00161 }
00162
00163 xmlFree(version);
00164 }
00165
00166 void MMSRcParser::throughGlobal(xmlNode* node) {
00167 xmlNode *cur_node = NULL;
00168 xmlChar *parname;
00169 xmlChar *parvalue;
00170
00171 node = node->xmlChildrenNode;
00172
00173 for (cur_node = node; cur_node; cur_node = cur_node->next) {
00174 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "text")) continue;
00175 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "comment")) continue;
00176 if(xmlStrcmp(cur_node->name, (const xmlChar *) "parameter")) {
00177 printf("RcParser: ignoring tag <%s/>\n", cur_node->name);
00178 continue;
00179 }
00180
00181 parname = xmlGetProp(cur_node, (const xmlChar*)"name");
00182 parvalue = xmlGetProp(cur_node, (const xmlChar*)"value");
00183
00184 if(parname == NULL && parvalue == NULL)
00185 continue;
00186
00187 if(!xmlStrcmp(parname, (const xmlChar *) "logfile"))
00188 this->global.logfile = string((const char *)parvalue);
00189 else if(!xmlStrcmp(parname, (const xmlChar *) "inputmap"))
00190 this->global.inputmap = string((const char *)parvalue);
00191 else if(!xmlStrcmp(parname, (const xmlChar *) "prefix"))
00192 this->global.prefix = string((const char *)parvalue);
00193 else if(!xmlStrcmp(parname, (const xmlChar *) "theme"))
00194 this->global.theme = string((const char *)parvalue);
00195 else if(!xmlStrcmp(parname, (const xmlChar *) "sysconfig"))
00196 this->global.sysconfig = string((const char *)parvalue);
00197 else if(!xmlStrcmp(parname, (const xmlChar *) "data"))
00198 this->global.data = string((const char *)parvalue);
00199 else if(!xmlStrcmp(parname, (const xmlChar *) "inputinterval"))
00200 this->global.inputinterval = strToInt(string((const char *)parvalue));
00201 else if(!xmlStrcmp(parname, (const xmlChar *) "firstplugin"))
00202 this->global.firstplugin = string((const char *)parvalue);
00203 else if(!xmlStrcmp(parname, (const xmlChar *) "shutdown"))
00204 this->global.shutdown = strToBool(string((const char *)parvalue));
00205 else if(!xmlStrcmp(parname, (const xmlChar *) "shutdowncmd"))
00206 this->global.shutdowncmd = string((const char *)parvalue);
00207 else if(!xmlStrcmp(parname, (const xmlChar *) "inputmode"))
00208 this->global.inputmode = string((const char *)parvalue);
00209 else if(!xmlStrcmp(parname, (const xmlChar *) "actmonaddress"))
00210 this->global.actmonaddress = string((const char *)parvalue);
00211 else if(!xmlStrcmp(parname, (const xmlChar *) "actmonport"))
00212 this->global.actmonport = atoi((const char*)parvalue);
00213 else
00214 printf("RcParser: ignoring parameter '%s' in tag <global/>\n", parname);
00215
00216 xmlFree(parname);
00217 xmlFree(parvalue);
00218 }
00219 }
00220
00221 void MMSRcParser::throughLanguage(xmlNode* node) {
00222 xmlNode *cur_node = NULL;
00223 xmlChar *parname;
00224 xmlChar *parvalue;
00225
00226 node = node->xmlChildrenNode;
00227
00228 for (cur_node = node; cur_node; cur_node = cur_node->next) {
00229 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "text")) continue;
00230 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "comment")) continue;
00231 if(xmlStrcmp(cur_node->name, (const xmlChar *) "parameter")) {
00232 printf("RcParser: ignoring tag <%s/>\n", cur_node->name);
00233 continue;
00234 }
00235
00236 parname = xmlGetProp(cur_node, (const xmlChar*)"name");
00237 parvalue = xmlGetProp(cur_node, (const xmlChar*)"value");
00238
00239 if(parname == NULL && parvalue == NULL)
00240 continue;
00241
00242 if(!xmlStrcmp(parname, (const xmlChar *) "sourcelang"))
00243 this->language.sourcelang = getMMSLanguageFromString((const char *)parvalue);
00244 else if(!xmlStrcmp(parname, (const xmlChar *) "defaultdestlang"))
00245 this->language.defaulttargetlang = getMMSLanguageFromString((const char *)parvalue);
00246 else if(!xmlStrcmp(parname, (const xmlChar *) "addtranslations"))
00247 this->language.addtranslations = strToBool(string((const char *)parvalue));
00248 else if(!xmlStrcmp(parname, (const xmlChar *) "languagefiledir"))
00249 this->language.languagefiledir = string((const char *)parvalue);
00250 else
00251 printf("RcParser: ignoring parameter '%s' in tag <global/>\n", parname);
00252
00253 xmlFree(parname);
00254 xmlFree(parvalue);
00255 }
00256 }
00257
00258 void MMSRcParser::throughDBSettings(xmlNode* node) {
00259 MMSConfigDataDB *db;
00260 xmlChar *type;
00261
00262 type = xmlGetProp(node, (const xmlChar*)"type");
00263
00264 if(!xmlStrcmp(type, (const xmlChar *) "config")) {
00265 db = &this->configdb;
00266 }
00267 else if(!xmlStrcmp(type, (const xmlChar *) "data")) {
00268 db = &this->datadb;
00269 }
00270 else {
00271 throw MMSRcParserError(1, "unknown database type (" + string((const char*)type) + ")");
00272 }
00273
00274 xmlFree(type);
00275
00276 xmlNode *cur_node = NULL;
00277 xmlChar *parname;
00278 xmlChar *parvalue;
00279
00280 for (cur_node = node->xmlChildrenNode; cur_node; cur_node = cur_node->next) {
00281 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "text")) continue;
00282 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "comment")) continue;
00283 if(xmlStrcmp(cur_node->name, (const xmlChar *) "parameter")) {
00284 printf("RcParser: ignoring tag <%s/>\n", cur_node->name);
00285 continue;
00286 }
00287
00288 parname = xmlGetProp(cur_node, (const xmlChar*)"name");
00289 parvalue = xmlGetProp(cur_node, (const xmlChar*)"value");
00290
00291 if(!xmlStrcmp(parname, (const xmlChar *) "dbms"))
00292 db->dbms = string((const char *)parvalue);
00293 else if(!xmlStrcmp(parname, (const xmlChar *) "address"))
00294 db->address = string((const char *)parvalue);
00295 else if(!xmlStrcmp(parname, (const xmlChar *) "port"))
00296 db->port = atoi((const char*)parvalue);
00297 else if(!xmlStrcmp(parname, (const xmlChar *) "user"))
00298 db->user = string((const char *)parvalue);
00299 else if(!xmlStrcmp(parname, (const xmlChar *) "password"))
00300 db->password = string((const char *)parvalue);
00301 else if(!xmlStrcmp(parname, (const xmlChar *) "database"))
00302 db->database = string((const char *)parvalue);
00303 else
00304 printf("RcParser: ignoring parameter '%s' in tag <dbsettings/>\n", parname);
00305
00306 xmlFree(parname);
00307 xmlFree(parvalue);
00308 }
00309 }
00310
00311
00312
00313 void MMSRcParser::check_outputtype(MMSFBOutputType outputtype, xmlChar *parname, xmlChar *parvalue) {
00314 string val = string((const char *)parvalue);
00315
00316
00317 if (this->graphics.backend == MMSFB_BE_DFB) {
00318 switch (outputtype) {
00319 case MMSFB_OT_STDFB:
00320 case MMSFB_OT_MATROXFB:
00321 case MMSFB_OT_VIAFB:
00322 case MMSFB_OT_X11:
00323 case MMSFB_OT_DAVINCIFB:
00324 case MMSFB_OT_OMAPFB:
00325
00326 break;
00327 default:
00328 WRONG_VALUE(parname, val, MMSFB_OT_VALID_VALUES_BE_DFB, "-> this depends on backend=\"DFB\"");
00329 break;
00330 }
00331 }
00332 else
00333 if (this->graphics.backend == MMSFB_BE_X11) {
00334 switch (outputtype) {
00335 case MMSFB_OT_X11:
00336 case MMSFB_OT_XSHM:
00337 case MMSFB_OT_XVSHM:
00338 case MMSFB_OT_OGL:
00339
00340 break;
00341 default:
00342 WRONG_VALUE(parname, val, MMSFB_OT_VALID_VALUES_BE_X11, "-> this depends on backend=\"X11\"");
00343 break;
00344 }
00345 }
00346 else
00347 if (this->graphics.backend == MMSFB_BE_FBDEV) {
00348 switch (outputtype) {
00349 case MMSFB_OT_STDFB:
00350 case MMSFB_OT_MATROXFB:
00351 case MMSFB_OT_DAVINCIFB:
00352 case MMSFB_OT_OMAPFB:
00353 case MMSFB_OT_OGL:
00354
00355 break;
00356 default:
00357 WRONG_VALUE(parname, val, MMSFB_OT_VALID_VALUES_BE_FBDEV, "-> this depends on backend=\"FBDEV\"");
00358 break;
00359 }
00360 }
00361 }
00362
00363
00364 void MMSRcParser::get_outputtype(THROUGH_GRAPHICS_MODE mode, xmlChar *parname, xmlChar *parvalue) {
00365 string val = string((const char *)parvalue);
00366
00367
00368 switch (mode) {
00369 case THROUGH_GRAPHICS_MODE_NORMAL:
00370 this->graphics.videolayer.outputtype = this->graphics.graphicslayer.outputtype = getMMSFBOutputTypeFromString(strToUpr(val));
00371 if (this->graphics.videolayer.outputtype == MMSFB_OT_NONE)
00372 WRONG_VALUE(parname, val, MMSFB_OT_VALID_VALUES, "");
00373 check_outputtype(this->graphics.graphicslayer.outputtype, parname, parvalue);
00374 break;
00375 case THROUGH_GRAPHICS_MODE_VIDEOLAYER:
00376 this->graphics.videolayer.outputtype = getMMSFBOutputTypeFromString(strToUpr(val));
00377 if (this->graphics.videolayer.outputtype == MMSFB_OT_NONE)
00378 WRONG_VALUE(parname, val, MMSFB_OT_VALID_VALUES, "");
00379 check_outputtype(this->graphics.videolayer.outputtype, parname, parvalue);
00380 break;
00381 case THROUGH_GRAPHICS_MODE_GRAPHICSLAYER:
00382 this->graphics.graphicslayer.outputtype = getMMSFBOutputTypeFromString(strToUpr(val));
00383 if (this->graphics.graphicslayer.outputtype == MMSFB_OT_NONE)
00384 WRONG_VALUE(parname, val, MMSFB_OT_VALID_VALUES, "");
00385 check_outputtype(this->graphics.graphicslayer.outputtype, parname, parvalue);
00386 break;
00387 }
00388 }
00389
00390 void MMSRcParser::get_xres(THROUGH_GRAPHICS_MODE mode, xmlChar *parvalue) {
00391 switch (mode) {
00392 case THROUGH_GRAPHICS_MODE_NORMAL:
00393 this->graphics.videolayer.rect.w = this->graphics.graphicslayer.rect.w = strToInt(string((const char *)parvalue));
00394 break;
00395 case THROUGH_GRAPHICS_MODE_VIDEOLAYER:
00396 this->graphics.videolayer.rect.w = strToInt(string((const char *)parvalue));
00397 break;
00398 case THROUGH_GRAPHICS_MODE_GRAPHICSLAYER:
00399 this->graphics.graphicslayer.rect.w = strToInt(string((const char *)parvalue));
00400 break;
00401 }
00402 }
00403
00404
00405 void MMSRcParser::get_yres(THROUGH_GRAPHICS_MODE mode, xmlChar *parvalue) {
00406 switch (mode) {
00407 case THROUGH_GRAPHICS_MODE_NORMAL:
00408 this->graphics.videolayer.rect.h = this->graphics.graphicslayer.rect.h = strToInt(string((const char *)parvalue));
00409 break;
00410 case THROUGH_GRAPHICS_MODE_VIDEOLAYER:
00411 this->graphics.videolayer.rect.h = strToInt(string((const char *)parvalue));
00412 break;
00413 case THROUGH_GRAPHICS_MODE_GRAPHICSLAYER:
00414 this->graphics.graphicslayer.rect.h = strToInt(string((const char *)parvalue));
00415 break;
00416 }
00417 }
00418
00419
00420 void MMSRcParser::get_xpos(THROUGH_GRAPHICS_MODE mode, xmlChar *parvalue) {
00421 switch (mode) {
00422 case THROUGH_GRAPHICS_MODE_NORMAL:
00423 this->graphics.videolayer.rect.x = this->graphics.graphicslayer.rect.x = strToInt(string((const char *)parvalue));
00424 break;
00425 case THROUGH_GRAPHICS_MODE_VIDEOLAYER:
00426 this->graphics.videolayer.rect.x = strToInt(string((const char *)parvalue));
00427 break;
00428 case THROUGH_GRAPHICS_MODE_GRAPHICSLAYER:
00429 this->graphics.graphicslayer.rect.x = strToInt(string((const char *)parvalue));
00430 break;
00431 }
00432 }
00433
00434
00435 void MMSRcParser::get_ypos(THROUGH_GRAPHICS_MODE mode, xmlChar *parvalue) {
00436 switch (mode) {
00437 case THROUGH_GRAPHICS_MODE_NORMAL:
00438 this->graphics.videolayer.rect.y = this->graphics.graphicslayer.rect.y = strToInt(string((const char *)parvalue));
00439 break;
00440 case THROUGH_GRAPHICS_MODE_VIDEOLAYER:
00441 this->graphics.videolayer.rect.y = strToInt(string((const char *)parvalue));
00442 break;
00443 case THROUGH_GRAPHICS_MODE_GRAPHICSLAYER:
00444 this->graphics.graphicslayer.rect.y = strToInt(string((const char *)parvalue));
00445 break;
00446 }
00447 }
00448
00449
00450 void MMSRcParser::throughGraphics(xmlNode* node, THROUGH_GRAPHICS_MODE mode) {
00451 xmlNode *cur_node = NULL;
00452 xmlChar *parname;
00453 xmlChar *parvalue;
00454 MMSConfigDataLayer vl, gl;
00455
00456 if (mode == THROUGH_GRAPHICS_MODE_NORMAL) {
00457
00458 vl = this->graphics.videolayer;
00459 gl = this->graphics.graphicslayer;
00460 this->graphics.videolayer.id = -1;
00461 this->graphics.graphicslayer.id = -1;
00462 }
00463
00464 node = node->xmlChildrenNode;
00465
00466 for (cur_node = node; cur_node; cur_node = cur_node->next) {
00467 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "text")) continue;
00468 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "comment")) continue;
00469 if(xmlStrcmp(cur_node->name, (const xmlChar *) "parameter")) {
00470 if (mode == THROUGH_GRAPHICS_MODE_NORMAL) {
00471 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "videolayer")) {
00472
00473 throughGraphics(cur_node, THROUGH_GRAPHICS_MODE_VIDEOLAYER);
00474 continue;
00475 }
00476 else
00477 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "graphicslayer")) {
00478
00479 throughGraphics(cur_node, THROUGH_GRAPHICS_MODE_GRAPHICSLAYER);
00480 continue;
00481 }
00482 }
00483 printf("RcParser: ignoring tag <%s/>\n", cur_node->name);
00484 continue;
00485 }
00486
00487
00488 parname = xmlGetProp(cur_node, (const xmlChar*)"name");
00489 parvalue = xmlGetProp(cur_node, (const xmlChar*)"value");
00490
00491
00492 if(!xmlStrcmp(parname, (const xmlChar *) "outputtype")) {
00493
00494 get_outputtype(mode, parname, parvalue);
00495 }
00496 else if(!xmlStrcmp(parname, (const xmlChar *) "xres")) {
00497
00498 get_xres(mode, parvalue);
00499 }
00500 else if(!xmlStrcmp(parname, (const xmlChar *) "yres")) {
00501
00502 get_yres(mode, parvalue);
00503 }
00504 else if(!xmlStrcmp(parname, (const xmlChar *) "xpos")) {
00505
00506 get_xpos(mode, parvalue);
00507 }
00508 else if(!xmlStrcmp(parname, (const xmlChar *) "ypos")) {
00509
00510 get_ypos(mode, parvalue);
00511 } else if(!xmlStrcmp(parname, (const xmlChar *) "graphicslayerid")) {
00512 this->graphics.graphicslayer.id = atoi((const char *)parvalue);
00513 }
00514 else if(!xmlStrcmp(parname, (const xmlChar *) "graphicslayerpixelformat")) {
00515 string val = string((const char *)parvalue);
00516 if ((this->graphics.graphicslayer.pixelformat = getMMSFBPixelFormatFromString(strToUpr(val))) == MMSFB_PF_NONE)
00517 WRONG_VALUE(parname, val, MMSFB_PF_VALID_VALUES_LAYER, "");
00518 }
00519 else if(!xmlStrcmp(parname, (const xmlChar *) "graphicslayeroptions")) {
00520 this->graphics.graphicslayer.options = strToUpr(string((const char *)parvalue));
00521 }
00522 else if(!xmlStrcmp(parname, (const xmlChar *) "graphicslayerbuffermode")) {
00523 if((this->graphics.graphicslayer.outputtype == MMSFB_OT_X11) &&
00524 xmlStrEqual(parvalue, (const xmlChar *) "FRONTONLY")) {
00525 WRONG_VALUE(parname, string((const char *)parvalue), MMSFB_PF_VALID_BUFFERMODES_X11, "-> this depends on graphicslayer.outputtype=\"X11\"");
00526 } else if((xmlStrcasecmp(parvalue, (const xmlChar *) "BACKSYSTEM") != 0) &&
00527 (xmlStrcasecmp(parvalue, (const xmlChar *) "BACKVIDEO") != 0) &&
00528 (xmlStrcasecmp(parvalue, (const xmlChar *) "FRONTONLY") != 0) &&
00529 (xmlStrcasecmp(parvalue, (const xmlChar *) "TRIPLE") != 0) &&
00530 (xmlStrcasecmp(parvalue, (const xmlChar *) "WINDOWS") != 0)) {
00531 WRONG_VALUE(parname, string((const char *)parvalue), MMSFB_PF_VALID_BUFFERMODES, "");
00532 } else {
00533 this->graphics.graphicslayer.buffermode = strToUpr((const char *)parvalue);
00534 }
00535 }
00536 else if(!xmlStrcmp(parname, (const xmlChar *) "videolayerid")) {
00537 this->graphics.videolayer.id = atoi((const char *)parvalue);
00538 }
00539 else if(!xmlStrcmp(parname, (const xmlChar *) "videolayerpixelformat")) {
00540 string val = string((const char *)parvalue);
00541 if ((this->graphics.videolayer.pixelformat = getMMSFBPixelFormatFromString(strToUpr(val))) == MMSFB_PF_NONE)
00542 WRONG_VALUE(parname, val, MMSFB_PF_VALID_VALUES_LAYER, "");
00543 }
00544 else if(!xmlStrcmp(parname, (const xmlChar *) "videolayeroptions")) {
00545 this->graphics.videolayer.options = strToUpr(string((const char *)parvalue));
00546 }
00547 else if(!xmlStrcmp(parname, (const xmlChar *) "videolayerbuffermode")) {
00548 if((this->graphics.videolayer.outputtype == MMSFB_OT_X11) &&
00549 xmlStrEqual(parvalue, (const xmlChar *) "FRONTONLY")) {
00550 WRONG_VALUE(parname, string((const char *)parvalue), MMSFB_PF_VALID_BUFFERMODES_X11, "-> this depends on videolayer.outputtype=\"X11\"");
00551 } else if((xmlStrcasecmp(parvalue, (const xmlChar *) "BACKSYSTEM") != 0) &&
00552 (xmlStrcasecmp(parvalue, (const xmlChar *) "BACKVIDEO") != 0) &&
00553 (xmlStrcasecmp(parvalue, (const xmlChar *) "FRONTONLY") != 0) &&
00554 (xmlStrcasecmp(parvalue, (const xmlChar *) "TRIPLE") != 0) &&
00555 (xmlStrcasecmp(parvalue, (const xmlChar *) "WINDOWS") != 0)) {
00556 WRONG_VALUE(parname, string((const char *)parvalue), MMSFB_PF_VALID_BUFFERMODES, "");
00557 } else {
00558 this->graphics.videolayer.buffermode = strToUpr((const char *)parvalue);
00559 }
00560 } else if (mode == THROUGH_GRAPHICS_MODE_NORMAL) {
00561
00562 if(!xmlStrcmp(parname, (const xmlChar *) "backend")) {
00563 string val = string((const char *)parvalue);
00564
00565 if ((this->graphics.backend = getMMSFBBackendFromString(strToUpr(val))) == MMSFB_BE_NONE)
00566 WRONG_VALUE(parname, val, MMSFB_BE_VALID_VALUES, "");
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656 }
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715 else if(!xmlStrcmp(parname, (const xmlChar *) "vrect.x")) {
00716 this->graphics.vrect.x = strToInt(string((const char *)parvalue));
00717 }
00718 else if(!xmlStrcmp(parname, (const xmlChar *) "vrect.y")) {
00719 this->graphics.vrect.y = strToInt(string((const char *)parvalue));
00720 }
00721 else if(!xmlStrcmp(parname, (const xmlChar *) "vrect.w")) {
00722 this->graphics.vrect.w = strToInt(string((const char *)parvalue));
00723 }
00724 else if(!xmlStrcmp(parname, (const xmlChar *) "vrect.h")) {
00725 this->graphics.vrect.h = strToInt(string((const char *)parvalue));
00726 }
00727 else if(!xmlStrcmp(parname, (const xmlChar *) "touchrect.x")) {
00728 this->graphics.touchrect.x = strToInt(string((const char *)parvalue));
00729 }
00730 else if(!xmlStrcmp(parname, (const xmlChar *) "touchrect.y")) {
00731 this->graphics.touchrect.y = strToInt(string((const char *)parvalue));
00732 }
00733 else if(!xmlStrcmp(parname, (const xmlChar *) "touchrect.w")) {
00734 this->graphics.touchrect.w = strToInt(string((const char *)parvalue));
00735 }
00736 else if(!xmlStrcmp(parname, (const xmlChar *) "touchrect.h")) {
00737 this->graphics.touchrect.h = strToInt(string((const char *)parvalue));
00738 }
00739 else if(!xmlStrcmp(parname, (const xmlChar *) "pointer")) {
00740 string val = string((const char *)parvalue);
00741 if ((this->graphics.pointer = getMMSFBPointerModeFromString(strToUpr(val))) == MMSFB_PM_NONE)
00742 WRONG_VALUE(parname, val, MMSFB_PM_VALID_VALUES, "");
00743 }
00744 else if(!xmlStrcmp(parname, (const xmlChar *) "graphicswindowpixelformat")) {
00745 string val = string((const char *)parvalue);
00746 if ((this->graphics.graphicswindowpixelformat = getMMSFBPixelFormatFromString(strToUpr(val))) == MMSFB_PF_NONE) {
00747 string val2 = strToUpr(val);
00748 if ((val2 != "") && (val2 != "AUTODETECT") && (val2 != "AUTO"))
00749 WRONG_VALUE(parname, val, MMSFB_PF_VALID_VALUES_WINDOWS, "");
00750 }
00751 }
00752 else if(!xmlStrcmp(parname, (const xmlChar *) "graphicssurfacepixelformat")) {
00753 string val = string((const char *)parvalue);
00754 if ((this->graphics.graphicssurfacepixelformat = getMMSFBPixelFormatFromString(strToUpr(val))) == MMSFB_PF_NONE) {
00755 string val2 = strToUpr(val);
00756 if ((val2 != "") && (val2 != "AUTODETECT") && (val2 != "AUTO"))
00757 WRONG_VALUE(parname, val, MMSFB_PF_VALID_VALUES_SURFACES, "");
00758 }
00759 }
00760 else if(!xmlStrcmp(parname, (const xmlChar *) "extendedaccel"))
00761 this->graphics.extendedaccel = strToBool(string((const char *)parvalue));
00762 else if(!xmlStrcmp(parname, (const xmlChar *) "allocmethod"))
00763 this->graphics.allocmethod = strToUpr(string((const char *)parvalue));
00764 else if(!xmlStrcmp(parname, (const xmlChar *) "fullscreen")) {
00765 string val = string((const char *)parvalue);
00766 if ((this->graphics.fullscreen = getMMSFBFullScreenModeFromString(strToUpr(val))) == MMSFB_FSM_NONE)
00767 WRONG_VALUE(parname, val, MMSFB_FSM_VALID_VALUES, "");
00768 } else if(!xmlStrcmp(parname, (const xmlChar *) "rotatescreen")) {
00769 string val = string((const char *)parvalue);
00770 this->graphics.rotatescreen = strToInt(val);
00771 if (this->graphics.rotatescreen != 0 && this->graphics.rotatescreen != 180)
00772 WRONG_VALUE(parname, val, "0, 180", "");
00773 } else if(!xmlStrcmp(parname, (const xmlChar *) "hideapplication")) {
00774 this->graphics.hideapplication = strToBool(string((const char *)parvalue));
00775 } else if(!xmlStrcmp(parname, (const xmlChar *) "initialload")) {
00776 this->graphics.initialload = strToBool(string((const char *)parvalue));
00777 } else if(!xmlStrcmp(parname, (const xmlChar *) "debugframes")) {
00778 this->graphics.debugframes = strToBool(string((const char *)parvalue));
00779 } else if(!xmlStrcmp(parname, (const xmlChar *) "touchSwapX")) {
00780 this->graphics.touchSwapX = strToBool(string((const char *)parvalue));
00781 } else if(!xmlStrcmp(parname, (const xmlChar *) "touchSwapY")) {
00782 this->graphics.touchSwapY = strToBool(string((const char *)parvalue));
00783 } else if(!xmlStrcmp(parname, (const xmlChar *) "touchSwapXY")) {
00784 this->graphics.touchSwapXY = strToBool(string((const char *)parvalue));
00785 }
00786 else
00787 printf("RcParser: ignoring parameter '%s' in tag <graphics/>\n", parname);
00788 }
00789 else {
00790 if (mode == THROUGH_GRAPHICS_MODE_GRAPHICSLAYER) {
00791
00792 if(!xmlStrcmp(parname, (const xmlChar *) "id")) {
00793 this->graphics.graphicslayer.id = atoi((const char *)parvalue);
00794 }
00795 else if(!xmlStrcmp(parname, (const xmlChar *) "pixelformat")) {
00796 string val = string((const char *)parvalue);
00797 if ((this->graphics.graphicslayer.pixelformat = getMMSFBPixelFormatFromString(strToUpr(val))) == MMSFB_PF_NONE)
00798 WRONG_VALUE(parname, val, MMSFB_PF_VALID_VALUES_LAYER, "");
00799 }
00800 else if(!xmlStrcmp(parname, (const xmlChar *) "options")) {
00801 this->graphics.graphicslayer.options = strToUpr(string((const char *)parvalue));
00802 }
00803 else if(!xmlStrcmp(parname, (const xmlChar *) "buffermode")) {
00804 this->graphics.graphicslayer.buffermode = strToUpr(string((const char *)parvalue));
00805 }
00806 else {
00807 printf("RcParser: ignoring parameter '%s' in tag <graphicslayer/>\n", parname);
00808 }
00809 }
00810 else if (mode == THROUGH_GRAPHICS_MODE_VIDEOLAYER) {
00811
00812 if(!xmlStrcmp(parname, (const xmlChar *) "id")) {
00813 this->graphics.videolayer.id = atoi((const char *)parvalue);
00814 }
00815 else if(!xmlStrcmp(parname, (const xmlChar *) "pixelformat")) {
00816 string val = string((const char *)parvalue);
00817 if ((this->graphics.videolayer.pixelformat = getMMSFBPixelFormatFromString(strToUpr(val))) == MMSFB_PF_NONE)
00818 WRONG_VALUE(parname, val, MMSFB_PF_VALID_VALUES_LAYER, "");
00819 }
00820 else if(!xmlStrcmp(parname, (const xmlChar *) "options")) {
00821 this->graphics.videolayer.options = strToUpr(string((const char *)parvalue));
00822 }
00823 else if(!xmlStrcmp(parname, (const xmlChar *) "buffermode")) {
00824 this->graphics.videolayer.buffermode = strToUpr(string((const char *)parvalue));
00825 }
00826 else {
00827 printf("RcParser: ignoring parameter '%s' in tag <videolayer/>\n", parname);
00828 }
00829 }
00830 else {
00831 printf("RcParser: ignoring parameter '%s' in tag <.../>\n", parname);
00832 }
00833 }
00834
00835 xmlFree(parname);
00836 xmlFree(parvalue);
00837
00838 }
00839
00840
00841 if (mode != THROUGH_GRAPHICS_MODE_NORMAL)
00842 return;
00843
00844
00845
00846 if (this->graphics.videolayer.id < 0) {
00847
00848 if (this->graphics.graphicslayer.id < 0) {
00849
00850 this->graphics.videolayer = vl;
00851 this->graphics.graphicslayer = gl;
00852 printf("RcParser: video and graphics layer not correctly set, using defaults\n");
00853 }
00854 else {
00855
00856 this->graphics.videolayer = this->graphics.graphicslayer;
00857 printf("RcParser: video layer not correctly set, using graphics layer settings for both\n");
00858 }
00859 }
00860 else {
00861 if (this->graphics.graphicslayer.id < 0) {
00862
00863 this->graphics.graphicslayer = this->graphics.videolayer;
00864 printf("RcParser: graphics layer not correctly set, using video layer settings for both\n");
00865 }
00866 else {
00867 if (this->graphics.videolayer.id == this->graphics.graphicslayer.id) {
00868 if (this->graphics.videolayer.rect.w != this->graphics.graphicslayer.rect.w
00869 ||this->graphics.videolayer.rect.h != this->graphics.graphicslayer.rect.h
00870 ||this->graphics.videolayer.rect.x != this->graphics.graphicslayer.rect.x
00871 ||this->graphics.videolayer.rect.y != this->graphics.graphicslayer.rect.y
00872 ||this->graphics.videolayer.outputtype != this->graphics.graphicslayer.outputtype
00873 ||this->graphics.videolayer.pixelformat != this->graphics.graphicslayer.pixelformat
00874 ||this->graphics.videolayer.options != this->graphics.graphicslayer.options
00875 ||this->graphics.videolayer.buffermode != this->graphics.graphicslayer.buffermode) {
00876
00877 this->graphics.videolayer = this->graphics.graphicslayer;
00878 printf("RcParser: video and graphics layer are the same, but definitions are not consistent, using graphics layer settings for both\n");
00879 }
00880 }
00881 }
00882 }
00883
00884
00885 if (this->graphics.backend == MMSFB_BE_X11) {
00886 if (this->graphics.videolayer.id != 0 && this->graphics.videolayer.id != 1) {
00887 WRONG_VALUE("videolayer.id", iToStr(this->graphics.videolayer.id), "0, 1", "-> this depends on backend=\"X11\", outputtype=\"X11/XVSHM\"");
00888 }
00889 if ((this->graphics.videolayer.id == 1) && (this->graphics.videolayer.outputtype != MMSFB_OT_XVSHM)) {
00890 WRONG_VALUE("videolayer.outputtype", getMMSFBOutputTypeString(this->graphics.videolayer.outputtype), "XVSHM", "-> this depends on backend=\"X11\", videolayer.id=\"1\"");
00891 }
00892 if (this->graphics.graphicslayer.id != 0) {
00893 WRONG_VALUE("graphicslayer.id", iToStr(this->graphics.graphicslayer.id), "0", "-> this depends on backend=\"X11\", outputtype=\"X11/XSHM/XVSHM/OGL\"");
00894 }
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913 }
00914 else
00915 if (this->graphics.backend == MMSFB_BE_FBDEV) {
00916 switch (this->graphics.graphicslayer.outputtype) {
00917 case MMSFB_OT_DAVINCIFB:
00918 if (this->graphics.videolayer.id != this->graphics.graphicslayer.id) {
00919 if ((this->graphics.videolayer.id != 1)&&(this->graphics.videolayer.id != 2))
00920 WRONG_VALUE("videolayerid", iToStr(this->graphics.videolayer.id), "1, 2", "-> this depends on backend=\"FBDEV\", outputtype=\"DAVINCIFB\"");
00921 if (this->graphics.graphicslayer.id != 0)
00922 WRONG_VALUE("graphicslayerid", iToStr(this->graphics.graphicslayer.id), "0", "-> this depends on backend=\"FBDEV\", outputtype=\"DAVINCIFB\"");
00923 }
00924 break;
00925
00926
00927
00928
00929
00930
00931
00932
00933 default:
00934 break;
00935 }
00936 }
00937
00938
00939 if (this->graphics.backend == MMSFB_BE_X11) {
00940 switch (this->graphics.graphicslayer.outputtype) {
00941 case MMSFB_OT_X11:
00942 case MMSFB_OT_XVSHM:
00943 case MMSFB_OT_XSHM:
00944 if (this->graphics.graphicslayer.pixelformat != MMSFB_PF_YV12 && this->graphics.graphicslayer.pixelformat != MMSFB_PF_RGB32 && this->graphics.graphicslayer.pixelformat != MMSFB_PF_RGB24 && this->graphics.graphicslayer.pixelformat != MMSFB_PF_ARGB)
00945 WRONG_VALUE("graphicslayer.pixelformat", getMMSFBPixelFormatString(this->graphics.graphicslayer.pixelformat), MMSFB_PF_VALID_VALUES_BE_X11_OT_XSHM, "-> this depends on backend=\"X11\", outputtype=\"XSHM\"");
00946 break;
00947 case MMSFB_OT_OGL:
00948 if (this->graphics.graphicslayer.pixelformat != MMSFB_PF_RGB32 && this->graphics.graphicslayer.pixelformat != MMSFB_PF_ARGB
00949 && this->graphics.graphicslayer.pixelformat != MMSFB_PF_ABGR)
00950 WRONG_VALUE("graphicslayer.pixelformat", getMMSFBPixelFormatString(this->graphics.graphicslayer.pixelformat), MMSFB_PF_VALID_VALUES_BE_FBDEV_OT_OGL, "-> this depends on backend=\"FBDEV\", outputtype=\"OGL\"");
00951 break;
00952 default:
00953 break;
00954 }
00955 if (this->graphics.graphicslayer.id != this->graphics.videolayer.id) {
00956 switch (this->graphics.videolayer.outputtype) {
00957 case MMSFB_OT_X11:
00958 case MMSFB_OT_XVSHM:
00959 case MMSFB_OT_XSHM:
00960 if (this->graphics.videolayer.pixelformat != MMSFB_PF_YV12 && this->graphics.videolayer.pixelformat != MMSFB_PF_RGB32 && this->graphics.videolayer.pixelformat != MMSFB_PF_ARGB)
00961 WRONG_VALUE("videolayer.pixelformat", getMMSFBPixelFormatString(this->graphics.videolayer.pixelformat), MMSFB_PF_VALID_VALUES_BE_X11_OT_XVSHM, "-> this depends on backend=\"X11\", outputtype=\"X11/XVSHM\"");
00962 break;
00963 default:
00964 break;
00965 }
00966 }
00967 }
00968 else
00969 if (this->graphics.backend == MMSFB_BE_FBDEV) {
00970 switch (this->graphics.graphicslayer.outputtype) {
00971 case MMSFB_OT_DAVINCIFB:
00972 if (this->graphics.videolayer.pixelformat != MMSFB_PF_YUY2)
00973 WRONG_VALUE("videolayer.pixelformat", getMMSFBPixelFormatString(this->graphics.videolayer.pixelformat), MMSFB_PF_VALID_VALUES_BE_FBDEV_OT_DAVINCIFB_LAYER_1, "-> this depends on backend=\"FBDEV\", outputtype=\"DAVINCIFB\"");
00974 if ((this->graphics.graphicslayer.pixelformat != MMSFB_PF_ARGB3565)
00975 &&(this->graphics.graphicslayer.pixelformat != MMSFB_PF_RGB16))
00976 WRONG_VALUE("graphicslayer.pixelformat", getMMSFBPixelFormatString(this->graphics.graphicslayer.pixelformat), MMSFB_PF_VALID_VALUES_BE_FBDEV_OT_DAVINCIFB_LAYER_0, "-> this depends on backend=\"FBDEV\", outputtype=\"DAVINCIFB\"");
00977 break;
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988 case MMSFB_OT_OGL:
00989 if (this->graphics.graphicslayer.pixelformat != MMSFB_PF_RGB32 && this->graphics.graphicslayer.pixelformat != MMSFB_PF_ARGB
00990 && this->graphics.graphicslayer.pixelformat != MMSFB_PF_ABGR)
00991 WRONG_VALUE("graphicslayer.pixelformat", getMMSFBPixelFormatString(this->graphics.graphicslayer.pixelformat), MMSFB_PF_VALID_VALUES_BE_FBDEV_OT_OGL, "-> this depends on backend=\"FBDEV\", outputtype=\"OGL\"");
00992 break;
00993
00994 default:
00995 break;
00996 }
00997
00998 if (this->graphics.graphicslayer.id != this->graphics.videolayer.id) {
00999
01000 switch (this->graphics.videolayer.outputtype) {
01001 default:
01002 break;
01003 }
01004 }
01005 }
01006
01007 if ((this->graphics.backend == MMSFB_BE_X11)||(this->graphics.backend == MMSFB_BE_FBDEV)) {
01008
01009 this->graphics.extendedaccel = true;
01010 this->graphics.allocmethod = "MALLOC";
01011
01012 if (this->graphics.graphicslayer.outputtype == MMSFB_OT_OGL) {
01013
01014 this->graphics.extendedaccel = false;
01015 this->graphics.allocmethod = "OGL";
01016 }
01017 }
01018 }
01019
01020 void MMSRcParser::throughFile(xmlNode* node) {
01021
01022 xmlNode *cur_node = NULL;
01023
01024 if(node==NULL)
01025 return;
01026
01027 if(!xmlStrcmp(node->name, (const xmlChar *) "mmsrc") || !xmlStrcmp(node->name, (const xmlChar *) "diskorc")) {
01028 checkVersion(node);
01029
01030 node = node->xmlChildrenNode;
01031 }
01032 else {
01033 this->throughFile(node->next);
01034 return;
01035 }
01036
01037 for (cur_node = node; cur_node; cur_node = cur_node->next) {
01038
01039 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "text")) continue;
01040 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "comment")) continue;
01041
01042 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "global")) {
01043 throughGlobal(cur_node);
01044 }
01045 else if(!xmlStrcmp(cur_node->name, (const xmlChar *) "dbsettings")) {
01046 throughDBSettings(cur_node);
01047 }
01048 else if((!xmlStrcmp(cur_node->name, (const xmlChar *) "dfbsettings"))
01049 ||(!xmlStrcmp(cur_node->name, (const xmlChar *) "graphics"))) {
01050 throughGraphics(cur_node);
01051 }
01052 else if(!xmlStrcmp(cur_node->name, (const xmlChar *) "language")) {
01053 throughLanguage(cur_node);
01054 }
01055 else {
01056 printf("RcParser: ignoring tag <%s/>\n", cur_node->name);
01057 }
01058 }
01059 }
01060
01061
01062 void MMSRcParser::updateConfigParms(MMSConfigData *config, char *ap) {
01063
01064 #define MMSRC_CPP_GET_PARAMETER(str,len) if(memcmp(ap,str,len)==0){char *val=ap+len;while(*val&&*val==' ')val++;char *vb=valbuf;*vb=0;while(*val&&*val!=' '){*vb=*val;vb++;*vb=0;val++;}val=valbuf;
01065 #define MMSRC_CPP_PROCESS_PIXELFORMAT_PARAMETER(str,len,setter) MMSRC_CPP_GET_PARAMETER(str,len)MMSFBSurfacePixelFormat pf=getMMSFBPixelFormatFromString(strToUpr(val));if(pf!=MMSFB_PF_NONE)setter else printf("DISKO: Parameter --disko:%s must be a valid pixelformat!\n",str);}
01066 #define MMSRC_CPP_PROCESS_BOOL_PARAMETER(str,len,truecall,falsecall) MMSRC_CPP_GET_PARAMETER(str,len)if((!strcmp(val,"true"))||(!strcmp(val,"TRUE")))truecall else if((!strcmp(val,"false"))||(!strcmp(val,"FALSE")))falsecall else printf("DISKO: Parameter --disko:%s must be true or false!\n",str);}
01067
01068
01069 #define MMSRC_CCP_GRAPHICS_VIDEOLAYER_PIXELFORMAT_STR "graphics.videolayer.pixelformat="
01070 #define MMSRC_CCP_GRAPHICS_VIDEOLAYER_PIXELFORMAT_LEN 32
01071 #define MMSRC_CCP_GRAPHICS_GRAPHICSLAYER_PIXELFORMAT_STR "graphics.graphicslayer.pixelformat="
01072 #define MMSRC_CCP_GRAPHICS_GRAPHICSLAYER_PIXELFORMAT_LEN 35
01073 #define MMSRC_CCP_GRAPHICS_FULLSCREEN_STR "graphics.fullscreen="
01074 #define MMSRC_CCP_GRAPHICS_FULLSCREEN_LEN 20
01075 #define MMSRC_CCP_GRAPHICS_HIDEAPPLICATION_STR "graphics.hideapplication="
01076 #define MMSRC_CCP_GRAPHICS_HIDEAPPLICATION_LEN 25
01077
01078
01079 char valbuf[256];
01080
01081
01082 MMSRC_CPP_PROCESS_PIXELFORMAT_PARAMETER(MMSRC_CCP_GRAPHICS_VIDEOLAYER_PIXELFORMAT_STR, MMSRC_CCP_GRAPHICS_VIDEOLAYER_PIXELFORMAT_LEN,
01083 {MMSConfigDataLayer l=config->getVideoLayer();l.pixelformat=pf;config->setVideoLayer(l);})
01084 else
01085 MMSRC_CPP_PROCESS_PIXELFORMAT_PARAMETER(MMSRC_CCP_GRAPHICS_GRAPHICSLAYER_PIXELFORMAT_STR, MMSRC_CCP_GRAPHICS_GRAPHICSLAYER_PIXELFORMAT_LEN,
01086 {MMSConfigDataLayer l=config->getGraphicsLayer();l.pixelformat=pf;config->setGraphicsLayer(l);})
01087 else
01088 MMSRC_CPP_GET_PARAMETER(MMSRC_CCP_GRAPHICS_FULLSCREEN_STR, MMSRC_CCP_GRAPHICS_FULLSCREEN_LEN) {
01089 MMSFBFullScreenMode fsm = getMMSFBFullScreenModeFromString(strToUpr(val));
01090 if (fsm != MMSFB_FSM_NONE)
01091 config->setFullScreen(fsm);
01092 else
01093 printf("DISKO: Parameter --disko:%s must be a valid fullscreen mode (%s)!\n",
01094 MMSRC_CCP_GRAPHICS_FULLSCREEN_STR, MMSFB_FSM_VALID_VALUES);
01095 }}
01096 else
01097 MMSRC_CPP_PROCESS_BOOL_PARAMETER(MMSRC_CCP_GRAPHICS_HIDEAPPLICATION_STR, MMSRC_CCP_GRAPHICS_HIDEAPPLICATION_LEN,
01098 {config->setHideApplication(true);},{config->setHideApplication(false);});
01099 }
01100
01101 void MMSRcParser::updateConfig(MMSConfigData *config, string args, int argc, char *argv[]) {
01102
01103 if (!config) return;
01104
01105
01106 char *ap = (char*)args.c_str();
01107 while (*ap) {
01108
01109 if (!(ap = strstr(ap, "--disko:"))) break;
01110 ap+= 8;
01111
01112
01113 updateConfigParms(config, ap);
01114
01115
01116 if (!(ap = strstr(ap, " "))) break;
01117 ap++;
01118 }
01119
01120
01121 for (int i = 1; i < argc; i++) {
01122
01123 char *ap= argv[i];
01124 if (memcmp(ap, "--disko:", 8)) continue;
01125 ap+= 8;
01126
01127
01128 updateConfigParms(config, ap);
01129 }
01130 }
01131