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 #include <iostream>
00034
00035 using namespace std;
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 else
00362 if (this->graphics.backend == MMSFB_BE_KMS) {
00363 switch (outputtype) {
00364 case MMSFB_OT_OGL:
00365 case MMSFB_OT_OMAPFB:
00366
00367 break;
00368 default:
00369 WRONG_VALUE(parname, val, MMSFB_OT_VALID_VALUES_BE_KMS, "-> this depends on backend=\"KMS\"");
00370 break;
00371 }
00372 }
00373 }
00374
00375
00376 void MMSRcParser::get_outputtype(THROUGH_GRAPHICS_MODE mode, xmlChar *parname, xmlChar *parvalue) {
00377 string val = string((const char *)parvalue);
00378
00379
00380 switch (mode) {
00381 case THROUGH_GRAPHICS_MODE_NORMAL:
00382 this->graphics.videolayer.outputtype = this->graphics.graphicslayer.outputtype = getMMSFBOutputTypeFromString(strToUpr(val));
00383 if (this->graphics.videolayer.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 case THROUGH_GRAPHICS_MODE_VIDEOLAYER:
00388 this->graphics.videolayer.outputtype = getMMSFBOutputTypeFromString(strToUpr(val));
00389 if (this->graphics.videolayer.outputtype == MMSFB_OT_NONE)
00390 WRONG_VALUE(parname, val, MMSFB_OT_VALID_VALUES, "");
00391 check_outputtype(this->graphics.videolayer.outputtype, parname, parvalue);
00392 break;
00393 case THROUGH_GRAPHICS_MODE_GRAPHICSLAYER:
00394 this->graphics.graphicslayer.outputtype = getMMSFBOutputTypeFromString(strToUpr(val));
00395 if (this->graphics.graphicslayer.outputtype == MMSFB_OT_NONE)
00396 WRONG_VALUE(parname, val, MMSFB_OT_VALID_VALUES, "");
00397 check_outputtype(this->graphics.graphicslayer.outputtype, parname, parvalue);
00398 break;
00399 }
00400 }
00401
00402 void MMSRcParser::get_xres(THROUGH_GRAPHICS_MODE mode, xmlChar *parvalue) {
00403 switch (mode) {
00404 case THROUGH_GRAPHICS_MODE_NORMAL:
00405 this->graphics.videolayer.rect.w = this->graphics.graphicslayer.rect.w = strToInt(string((const char *)parvalue));
00406 break;
00407 case THROUGH_GRAPHICS_MODE_VIDEOLAYER:
00408 this->graphics.videolayer.rect.w = strToInt(string((const char *)parvalue));
00409 break;
00410 case THROUGH_GRAPHICS_MODE_GRAPHICSLAYER:
00411 this->graphics.graphicslayer.rect.w = strToInt(string((const char *)parvalue));
00412 break;
00413 }
00414 }
00415
00416
00417 void MMSRcParser::get_yres(THROUGH_GRAPHICS_MODE mode, xmlChar *parvalue) {
00418 switch (mode) {
00419 case THROUGH_GRAPHICS_MODE_NORMAL:
00420 this->graphics.videolayer.rect.h = this->graphics.graphicslayer.rect.h = strToInt(string((const char *)parvalue));
00421 break;
00422 case THROUGH_GRAPHICS_MODE_VIDEOLAYER:
00423 this->graphics.videolayer.rect.h = strToInt(string((const char *)parvalue));
00424 break;
00425 case THROUGH_GRAPHICS_MODE_GRAPHICSLAYER:
00426 this->graphics.graphicslayer.rect.h = strToInt(string((const char *)parvalue));
00427 break;
00428 }
00429 }
00430
00431
00432 void MMSRcParser::get_xpos(THROUGH_GRAPHICS_MODE mode, xmlChar *parvalue) {
00433 switch (mode) {
00434 case THROUGH_GRAPHICS_MODE_NORMAL:
00435 this->graphics.videolayer.rect.x = this->graphics.graphicslayer.rect.x = strToInt(string((const char *)parvalue));
00436 break;
00437 case THROUGH_GRAPHICS_MODE_VIDEOLAYER:
00438 this->graphics.videolayer.rect.x = strToInt(string((const char *)parvalue));
00439 break;
00440 case THROUGH_GRAPHICS_MODE_GRAPHICSLAYER:
00441 this->graphics.graphicslayer.rect.x = strToInt(string((const char *)parvalue));
00442 break;
00443 }
00444 }
00445
00446
00447 void MMSRcParser::get_ypos(THROUGH_GRAPHICS_MODE mode, xmlChar *parvalue) {
00448 switch (mode) {
00449 case THROUGH_GRAPHICS_MODE_NORMAL:
00450 this->graphics.videolayer.rect.y = this->graphics.graphicslayer.rect.y = strToInt(string((const char *)parvalue));
00451 break;
00452 case THROUGH_GRAPHICS_MODE_VIDEOLAYER:
00453 this->graphics.videolayer.rect.y = strToInt(string((const char *)parvalue));
00454 break;
00455 case THROUGH_GRAPHICS_MODE_GRAPHICSLAYER:
00456 this->graphics.graphicslayer.rect.y = strToInt(string((const char *)parvalue));
00457 break;
00458 }
00459 }
00460
00461
00462 void MMSRcParser::throughGraphics(xmlNode* node, THROUGH_GRAPHICS_MODE mode) {
00463 xmlNode *cur_node = NULL;
00464 xmlChar *parname;
00465 xmlChar *parvalue;
00466 MMSConfigDataLayer vl, gl;
00467
00468 if (mode == THROUGH_GRAPHICS_MODE_NORMAL) {
00469
00470 vl = this->graphics.videolayer;
00471 gl = this->graphics.graphicslayer;
00472 this->graphics.videolayer.id = -1;
00473 this->graphics.graphicslayer.id = -1;
00474 }
00475
00476 node = node->xmlChildrenNode;
00477
00478 for (cur_node = node; cur_node; cur_node = cur_node->next) {
00479 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "text")) continue;
00480 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "comment")) continue;
00481 if(xmlStrcmp(cur_node->name, (const xmlChar *) "parameter")) {
00482 if (mode == THROUGH_GRAPHICS_MODE_NORMAL) {
00483 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "videolayer")) {
00484
00485 throughGraphics(cur_node, THROUGH_GRAPHICS_MODE_VIDEOLAYER);
00486 continue;
00487 }
00488 else
00489 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "graphicslayer")) {
00490
00491 throughGraphics(cur_node, THROUGH_GRAPHICS_MODE_GRAPHICSLAYER);
00492 continue;
00493 }
00494 }
00495 printf("RcParser: ignoring tag <%s/>\n", cur_node->name);
00496 continue;
00497 }
00498
00499
00500 parname = xmlGetProp(cur_node, (const xmlChar*)"name");
00501 parvalue = xmlGetProp(cur_node, (const xmlChar*)"value");
00502
00503
00504 if(!xmlStrcmp(parname, (const xmlChar *) "outputtype")) {
00505
00506 get_outputtype(mode, parname, parvalue);
00507 }
00508 else if(!xmlStrcmp(parname, (const xmlChar *) "xres")) {
00509
00510 get_xres(mode, parvalue);
00511 }
00512 else if(!xmlStrcmp(parname, (const xmlChar *) "yres")) {
00513
00514 get_yres(mode, parvalue);
00515 }
00516 else if(!xmlStrcmp(parname, (const xmlChar *) "xpos")) {
00517
00518 get_xpos(mode, parvalue);
00519 }
00520 else if(!xmlStrcmp(parname, (const xmlChar *) "ypos")) {
00521
00522 get_ypos(mode, parvalue);
00523 } else if(!xmlStrcmp(parname, (const xmlChar *) "graphicslayerid")) {
00524 this->graphics.graphicslayer.id = atoi((const char *)parvalue);
00525 }
00526 else if(!xmlStrcmp(parname, (const xmlChar *) "graphicslayerpixelformat")) {
00527 string val = string((const char *)parvalue);
00528 if ((this->graphics.graphicslayer.pixelformat = getMMSFBPixelFormatFromString(strToUpr(val))) == MMSFB_PF_NONE)
00529 WRONG_VALUE(parname, val, MMSFB_PF_VALID_VALUES_LAYER, "");
00530 }
00531 else if(!xmlStrcmp(parname, (const xmlChar *) "graphicslayeroptions")) {
00532 this->graphics.graphicslayer.options = strToUpr(string((const char *)parvalue));
00533 }
00534 else if(!xmlStrcmp(parname, (const xmlChar *) "graphicslayerbuffermode")) {
00535 if((this->graphics.graphicslayer.outputtype == MMSFB_OT_X11) &&
00536 xmlStrEqual(parvalue, (const xmlChar *) "FRONTONLY")) {
00537 WRONG_VALUE(parname, string((const char *)parvalue), MMSFB_PF_VALID_BUFFERMODES_X11, "-> this depends on graphicslayer.outputtype=\"X11\"");
00538 } else if((xmlStrcasecmp(parvalue, (const xmlChar *) "BACKSYSTEM") != 0) &&
00539 (xmlStrcasecmp(parvalue, (const xmlChar *) "BACKVIDEO") != 0) &&
00540 (xmlStrcasecmp(parvalue, (const xmlChar *) "FRONTONLY") != 0) &&
00541 (xmlStrcasecmp(parvalue, (const xmlChar *) "TRIPLE") != 0) &&
00542 (xmlStrcasecmp(parvalue, (const xmlChar *) "WINDOWS") != 0)) {
00543 WRONG_VALUE(parname, string((const char *)parvalue), MMSFB_PF_VALID_BUFFERMODES, "");
00544 } else {
00545 this->graphics.graphicslayer.buffermode = strToUpr((const char *)parvalue);
00546 }
00547 }
00548 else if(!xmlStrcmp(parname, (const xmlChar *) "videolayerid")) {
00549 this->graphics.videolayer.id = atoi((const char *)parvalue);
00550 }
00551 else if(!xmlStrcmp(parname, (const xmlChar *) "videolayerpixelformat")) {
00552 string val = string((const char *)parvalue);
00553 if ((this->graphics.videolayer.pixelformat = getMMSFBPixelFormatFromString(strToUpr(val))) == MMSFB_PF_NONE)
00554 WRONG_VALUE(parname, val, MMSFB_PF_VALID_VALUES_LAYER, "");
00555 }
00556 else if(!xmlStrcmp(parname, (const xmlChar *) "videolayeroptions")) {
00557 this->graphics.videolayer.options = strToUpr(string((const char *)parvalue));
00558 }
00559 else if(!xmlStrcmp(parname, (const xmlChar *) "videolayerbuffermode")) {
00560 if((this->graphics.videolayer.outputtype == MMSFB_OT_X11) &&
00561 xmlStrEqual(parvalue, (const xmlChar *) "FRONTONLY")) {
00562 WRONG_VALUE(parname, string((const char *)parvalue), MMSFB_PF_VALID_BUFFERMODES_X11, "-> this depends on videolayer.outputtype=\"X11\"");
00563 } else if((xmlStrcasecmp(parvalue, (const xmlChar *) "BACKSYSTEM") != 0) &&
00564 (xmlStrcasecmp(parvalue, (const xmlChar *) "BACKVIDEO") != 0) &&
00565 (xmlStrcasecmp(parvalue, (const xmlChar *) "FRONTONLY") != 0) &&
00566 (xmlStrcasecmp(parvalue, (const xmlChar *) "TRIPLE") != 0) &&
00567 (xmlStrcasecmp(parvalue, (const xmlChar *) "WINDOWS") != 0)) {
00568 WRONG_VALUE(parname, string((const char *)parvalue), MMSFB_PF_VALID_BUFFERMODES, "");
00569 } else {
00570 this->graphics.videolayer.buffermode = strToUpr((const char *)parvalue);
00571 }
00572 } else if (mode == THROUGH_GRAPHICS_MODE_NORMAL) {
00573
00574 if(!xmlStrcmp(parname, (const xmlChar *) "backend")) {
00575 string val = string((const char *)parvalue);
00576
00577 if ((this->graphics.backend = getMMSFBBackendFromString(strToUpr(val))) == MMSFB_BE_NONE)
00578 WRONG_VALUE(parname, val, MMSFB_BE_VALID_VALUES, "");
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
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727 else if(!xmlStrcmp(parname, (const xmlChar *) "vrect.x")) {
00728 this->graphics.vrect.x = strToInt(string((const char *)parvalue));
00729 }
00730 else if(!xmlStrcmp(parname, (const xmlChar *) "vrect.y")) {
00731 this->graphics.vrect.y = strToInt(string((const char *)parvalue));
00732 }
00733 else if(!xmlStrcmp(parname, (const xmlChar *) "vrect.w")) {
00734 this->graphics.vrect.w = strToInt(string((const char *)parvalue));
00735 }
00736 else if(!xmlStrcmp(parname, (const xmlChar *) "vrect.h")) {
00737 this->graphics.vrect.h = strToInt(string((const char *)parvalue));
00738 }
00739 else if(!xmlStrcmp(parname, (const xmlChar *) "touchrect.x")) {
00740 this->graphics.touchrect.x = strToInt(string((const char *)parvalue));
00741 }
00742 else if(!xmlStrcmp(parname, (const xmlChar *) "touchrect.y")) {
00743 this->graphics.touchrect.y = strToInt(string((const char *)parvalue));
00744 }
00745 else if(!xmlStrcmp(parname, (const xmlChar *) "touchrect.w")) {
00746 this->graphics.touchrect.w = strToInt(string((const char *)parvalue));
00747 }
00748 else if(!xmlStrcmp(parname, (const xmlChar *) "touchrect.h")) {
00749 this->graphics.touchrect.h = strToInt(string((const char *)parvalue));
00750 }
00751 else if(!xmlStrcmp(parname, (const xmlChar *) "pointer")) {
00752 string val = string((const char *)parvalue);
00753 if ((this->graphics.pointer = getMMSFBPointerModeFromString(strToUpr(val))) == MMSFB_PM_NONE)
00754 WRONG_VALUE(parname, val, MMSFB_PM_VALID_VALUES, "");
00755 }
00756 else if(!xmlStrcmp(parname, (const xmlChar *) "graphicswindowpixelformat")) {
00757 string val = string((const char *)parvalue);
00758 if ((this->graphics.graphicswindowpixelformat = getMMSFBPixelFormatFromString(strToUpr(val))) == MMSFB_PF_NONE) {
00759 string val2 = strToUpr(val);
00760 if ((val2 != "") && (val2 != "AUTODETECT") && (val2 != "AUTO"))
00761 WRONG_VALUE(parname, val, MMSFB_PF_VALID_VALUES_WINDOWS, "");
00762 }
00763 }
00764 else if(!xmlStrcmp(parname, (const xmlChar *) "graphicssurfacepixelformat")) {
00765 string val = string((const char *)parvalue);
00766 if ((this->graphics.graphicssurfacepixelformat = getMMSFBPixelFormatFromString(strToUpr(val))) == MMSFB_PF_NONE) {
00767 string val2 = strToUpr(val);
00768 if ((val2 != "") && (val2 != "AUTODETECT") && (val2 != "AUTO"))
00769 WRONG_VALUE(parname, val, MMSFB_PF_VALID_VALUES_SURFACES, "");
00770 }
00771 }
00772 else if(!xmlStrcmp(parname, (const xmlChar *) "extendedaccel"))
00773 this->graphics.extendedaccel = strToBool(string((const char *)parvalue));
00774 else if(!xmlStrcmp(parname, (const xmlChar *) "allocmethod"))
00775 this->graphics.allocmethod = strToUpr(string((const char *)parvalue));
00776 else if(!xmlStrcmp(parname, (const xmlChar *) "fullscreen")) {
00777 string val = string((const char *)parvalue);
00778 if ((this->graphics.fullscreen = getMMSFBFullScreenModeFromString(strToUpr(val))) == MMSFB_FSM_NONE)
00779 WRONG_VALUE(parname, val, MMSFB_FSM_VALID_VALUES, "");
00780 } else if(!xmlStrcmp(parname, (const xmlChar *) "rotatescreen")) {
00781 string val = string((const char *)parvalue);
00782 this->graphics.rotatescreen = strToInt(val);
00783 if (this->graphics.rotatescreen != 0 && this->graphics.rotatescreen != 180)
00784 WRONG_VALUE(parname, val, "0, 180", "");
00785 } else if(!xmlStrcmp(parname, (const xmlChar *) "hideapplication")) {
00786 this->graphics.hideapplication = strToBool(string((const char *)parvalue));
00787 } else if(!xmlStrcmp(parname, (const xmlChar *) "initialload")) {
00788 this->graphics.initialload = strToBool(string((const char *)parvalue));
00789 } else if(!xmlStrcmp(parname, (const xmlChar *) "debugframes")) {
00790 this->graphics.debugframes = strToBool(string((const char *)parvalue));
00791 } else if(!xmlStrcmp(parname, (const xmlChar *) "touchSwapX")) {
00792 this->graphics.touchSwapX = strToBool(string((const char *)parvalue));
00793 } else if(!xmlStrcmp(parname, (const xmlChar *) "touchSwapY")) {
00794 this->graphics.touchSwapY = strToBool(string((const char *)parvalue));
00795 } else if(!xmlStrcmp(parname, (const xmlChar *) "touchSwapXY")) {
00796 this->graphics.touchSwapXY = strToBool(string((const char *)parvalue));
00797 }
00798 else
00799 printf("RcParser: ignoring parameter '%s' in tag <graphics/>\n", parname);
00800 }
00801 else {
00802 if (mode == THROUGH_GRAPHICS_MODE_GRAPHICSLAYER) {
00803
00804 if(!xmlStrcmp(parname, (const xmlChar *) "id")) {
00805 this->graphics.graphicslayer.id = atoi((const char *)parvalue);
00806 }
00807 else if(!xmlStrcmp(parname, (const xmlChar *) "pixelformat")) {
00808 string val = string((const char *)parvalue);
00809 if ((this->graphics.graphicslayer.pixelformat = getMMSFBPixelFormatFromString(strToUpr(val))) == MMSFB_PF_NONE)
00810 WRONG_VALUE(parname, val, MMSFB_PF_VALID_VALUES_LAYER, "");
00811 }
00812 else if(!xmlStrcmp(parname, (const xmlChar *) "options")) {
00813 this->graphics.graphicslayer.options = strToUpr(string((const char *)parvalue));
00814 }
00815 else if(!xmlStrcmp(parname, (const xmlChar *) "buffermode")) {
00816 this->graphics.graphicslayer.buffermode = strToUpr(string((const char *)parvalue));
00817 }
00818 else {
00819 printf("RcParser: ignoring parameter '%s' in tag <graphicslayer/>\n", parname);
00820 }
00821 }
00822 else if (mode == THROUGH_GRAPHICS_MODE_VIDEOLAYER) {
00823
00824 if(!xmlStrcmp(parname, (const xmlChar *) "id")) {
00825 this->graphics.videolayer.id = atoi((const char *)parvalue);
00826 }
00827 else if(!xmlStrcmp(parname, (const xmlChar *) "pixelformat")) {
00828 string val = string((const char *)parvalue);
00829 if ((this->graphics.videolayer.pixelformat = getMMSFBPixelFormatFromString(strToUpr(val))) == MMSFB_PF_NONE)
00830 WRONG_VALUE(parname, val, MMSFB_PF_VALID_VALUES_LAYER, "");
00831 }
00832 else if(!xmlStrcmp(parname, (const xmlChar *) "options")) {
00833 this->graphics.videolayer.options = strToUpr(string((const char *)parvalue));
00834 }
00835 else if(!xmlStrcmp(parname, (const xmlChar *) "buffermode")) {
00836 this->graphics.videolayer.buffermode = strToUpr(string((const char *)parvalue));
00837 }
00838 else {
00839 printf("RcParser: ignoring parameter '%s' in tag <videolayer/>\n", parname);
00840 }
00841 }
00842 else {
00843 printf("RcParser: ignoring parameter '%s' in tag <.../>\n", parname);
00844 }
00845 }
00846
00847 xmlFree(parname);
00848 xmlFree(parvalue);
00849
00850 }
00851
00852
00853 if (mode != THROUGH_GRAPHICS_MODE_NORMAL)
00854 return;
00855
00856
00857
00858 if (this->graphics.videolayer.id < 0) {
00859
00860 if (this->graphics.graphicslayer.id < 0) {
00861
00862 this->graphics.videolayer = vl;
00863 this->graphics.graphicslayer = gl;
00864 printf("RcParser: video and graphics layer not correctly set, using defaults\n");
00865 }
00866 else {
00867
00868 this->graphics.videolayer = this->graphics.graphicslayer;
00869 printf("RcParser: video layer not correctly set, using graphics layer settings for both\n");
00870 }
00871 }
00872 else {
00873 if (this->graphics.graphicslayer.id < 0) {
00874
00875 this->graphics.graphicslayer = this->graphics.videolayer;
00876 printf("RcParser: graphics layer not correctly set, using video layer settings for both\n");
00877 }
00878 else {
00879 if (this->graphics.videolayer.id == this->graphics.graphicslayer.id) {
00880 if (this->graphics.videolayer.rect.w != this->graphics.graphicslayer.rect.w
00881 ||this->graphics.videolayer.rect.h != this->graphics.graphicslayer.rect.h
00882 ||this->graphics.videolayer.rect.x != this->graphics.graphicslayer.rect.x
00883 ||this->graphics.videolayer.rect.y != this->graphics.graphicslayer.rect.y
00884 ||this->graphics.videolayer.outputtype != this->graphics.graphicslayer.outputtype
00885 ||this->graphics.videolayer.pixelformat != this->graphics.graphicslayer.pixelformat
00886 ||this->graphics.videolayer.options != this->graphics.graphicslayer.options
00887 ||this->graphics.videolayer.buffermode != this->graphics.graphicslayer.buffermode) {
00888
00889 this->graphics.videolayer = this->graphics.graphicslayer;
00890 printf("RcParser: video and graphics layer are the same, but definitions are not consistent, using graphics layer settings for both\n");
00891 }
00892 }
00893 }
00894 }
00895
00896
00897 if (this->graphics.backend == MMSFB_BE_X11) {
00898 if (this->graphics.videolayer.id != 0 && this->graphics.videolayer.id != 1) {
00899 WRONG_VALUE("videolayer.id", iToStr(this->graphics.videolayer.id), "0, 1", "-> this depends on backend=\"X11\", outputtype=\"X11/XVSHM\"");
00900 }
00901 if ((this->graphics.videolayer.id == 1) && (this->graphics.videolayer.outputtype != MMSFB_OT_XVSHM)) {
00902 WRONG_VALUE("videolayer.outputtype", getMMSFBOutputTypeString(this->graphics.videolayer.outputtype), "XVSHM", "-> this depends on backend=\"X11\", videolayer.id=\"1\"");
00903 }
00904 if (this->graphics.graphicslayer.id != 0) {
00905 WRONG_VALUE("graphicslayer.id", iToStr(this->graphics.graphicslayer.id), "0", "-> this depends on backend=\"X11\", outputtype=\"X11/XSHM/XVSHM/OGL\"");
00906 }
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925 }
00926 else
00927 if (this->graphics.backend == MMSFB_BE_FBDEV) {
00928 switch (this->graphics.graphicslayer.outputtype) {
00929 case MMSFB_OT_DAVINCIFB:
00930 if (this->graphics.videolayer.id != this->graphics.graphicslayer.id) {
00931 if ((this->graphics.videolayer.id != 1)&&(this->graphics.videolayer.id != 2))
00932 WRONG_VALUE("videolayerid", iToStr(this->graphics.videolayer.id), "1, 2", "-> this depends on backend=\"FBDEV\", outputtype=\"DAVINCIFB\"");
00933 if (this->graphics.graphicslayer.id != 0)
00934 WRONG_VALUE("graphicslayerid", iToStr(this->graphics.graphicslayer.id), "0", "-> this depends on backend=\"FBDEV\", outputtype=\"DAVINCIFB\"");
00935 }
00936 break;
00937
00938
00939
00940
00941
00942
00943
00944
00945 default:
00946 break;
00947 }
00948 }
00949
00950
00951 if (this->graphics.backend == MMSFB_BE_X11) {
00952 switch (this->graphics.graphicslayer.outputtype) {
00953 case MMSFB_OT_X11:
00954 case MMSFB_OT_XVSHM:
00955 case MMSFB_OT_XSHM:
00956 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)
00957 WRONG_VALUE("graphicslayer.pixelformat", getMMSFBPixelFormatString(this->graphics.graphicslayer.pixelformat), MMSFB_PF_VALID_VALUES_BE_X11_OT_XSHM, "-> this depends on backend=\"X11\", outputtype=\"XSHM\"");
00958 break;
00959 case MMSFB_OT_OGL:
00960 if (this->graphics.graphicslayer.pixelformat != MMSFB_PF_RGB32 && this->graphics.graphicslayer.pixelformat != MMSFB_PF_ARGB
00961 && this->graphics.graphicslayer.pixelformat != MMSFB_PF_ABGR)
00962 WRONG_VALUE("graphicslayer.pixelformat", getMMSFBPixelFormatString(this->graphics.graphicslayer.pixelformat), MMSFB_PF_VALID_VALUES_BE_FBDEV_OT_OGL, "-> this depends on backend=\"FBDEV\", outputtype=\"OGL\"");
00963 break;
00964 default:
00965 break;
00966 }
00967 if (this->graphics.graphicslayer.id != this->graphics.videolayer.id) {
00968 switch (this->graphics.videolayer.outputtype) {
00969 case MMSFB_OT_X11:
00970 case MMSFB_OT_XVSHM:
00971 case MMSFB_OT_XSHM:
00972 if (this->graphics.videolayer.pixelformat != MMSFB_PF_YV12 && this->graphics.videolayer.pixelformat != MMSFB_PF_RGB32 && this->graphics.videolayer.pixelformat != MMSFB_PF_ARGB)
00973 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\"");
00974 break;
00975 default:
00976 break;
00977 }
00978 }
00979 }
00980 else
00981 if (this->graphics.backend == MMSFB_BE_FBDEV) {
00982 switch (this->graphics.graphicslayer.outputtype) {
00983 case MMSFB_OT_DAVINCIFB:
00984 if (this->graphics.videolayer.pixelformat != MMSFB_PF_YUY2)
00985 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\"");
00986 if ((this->graphics.graphicslayer.pixelformat != MMSFB_PF_ARGB3565)
00987 &&(this->graphics.graphicslayer.pixelformat != MMSFB_PF_RGB16))
00988 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\"");
00989 break;
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000 case MMSFB_OT_OGL:
01001 if (this->graphics.graphicslayer.pixelformat != MMSFB_PF_RGB32 && this->graphics.graphicslayer.pixelformat != MMSFB_PF_ARGB
01002 && this->graphics.graphicslayer.pixelformat != MMSFB_PF_ABGR)
01003 WRONG_VALUE("graphicslayer.pixelformat", getMMSFBPixelFormatString(this->graphics.graphicslayer.pixelformat), MMSFB_PF_VALID_VALUES_BE_FBDEV_OT_OGL, "-> this depends on backend=\"FBDEV\", outputtype=\"OGL\"");
01004 break;
01005
01006 default:
01007 break;
01008 }
01009
01010 if (this->graphics.graphicslayer.id != this->graphics.videolayer.id) {
01011
01012 switch (this->graphics.videolayer.outputtype) {
01013 default:
01014 break;
01015 }
01016 }
01017 }
01018 else
01019 if (this->graphics.backend == MMSFB_BE_KMS) {
01020 switch (this->graphics.graphicslayer.outputtype) {
01021 case MMSFB_OT_OGL:
01022 if (this->graphics.graphicslayer.pixelformat != MMSFB_PF_RGB32 && this->graphics.graphicslayer.pixelformat != MMSFB_PF_ARGB
01023 && this->graphics.graphicslayer.pixelformat != MMSFB_PF_ABGR)
01024 WRONG_VALUE("graphicslayer.pixelformat", getMMSFBPixelFormatString(this->graphics.graphicslayer.pixelformat), MMSFB_PF_VALID_VALUES_BE_FBDEV_OT_OGL, "-> this depends on backend=\"FBDEV\", outputtype=\"OGL\"");
01025 break;
01026
01027 default:
01028 break;
01029 }
01030 }
01031
01032 if ((this->graphics.backend == MMSFB_BE_X11)||(this->graphics.backend == MMSFB_BE_FBDEV)||(this->graphics.backend == MMSFB_BE_KMS)) {
01033
01034 this->graphics.extendedaccel = true;
01035 this->graphics.allocmethod = "MALLOC";
01036
01037 if (this->graphics.graphicslayer.outputtype == MMSFB_OT_OGL) {
01038
01039 this->graphics.extendedaccel = false;
01040 this->graphics.allocmethod = "OGL";
01041 }
01042 }
01043 }
01044
01045 void MMSRcParser::throughFile(xmlNode* node) {
01046
01047 xmlNode *cur_node = NULL;
01048
01049 if(node==NULL)
01050 return;
01051
01052 if(!xmlStrcmp(node->name, (const xmlChar *) "mmsrc") || !xmlStrcmp(node->name, (const xmlChar *) "diskorc")) {
01053 checkVersion(node);
01054
01055 node = node->xmlChildrenNode;
01056 }
01057 else {
01058 this->throughFile(node->next);
01059 return;
01060 }
01061
01062 for (cur_node = node; cur_node; cur_node = cur_node->next) {
01063
01064 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "text")) continue;
01065 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "comment")) continue;
01066
01067 if(!xmlStrcmp(cur_node->name, (const xmlChar *) "global")) {
01068 throughGlobal(cur_node);
01069 }
01070 else if(!xmlStrcmp(cur_node->name, (const xmlChar *) "dbsettings")) {
01071 throughDBSettings(cur_node);
01072 }
01073 else if((!xmlStrcmp(cur_node->name, (const xmlChar *) "dfbsettings"))
01074 ||(!xmlStrcmp(cur_node->name, (const xmlChar *) "graphics"))) {
01075 throughGraphics(cur_node);
01076 }
01077 else if(!xmlStrcmp(cur_node->name, (const xmlChar *) "language")) {
01078 throughLanguage(cur_node);
01079 }
01080 else {
01081 printf("RcParser: ignoring tag <%s/>\n", cur_node->name);
01082 }
01083 }
01084 }
01085
01086
01087 void MMSRcParser::updateConfigParms(MMSConfigData *config, char *ap) {
01088
01089 #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;
01090 #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);}
01091 #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);}
01092
01093
01094 #define MMSRC_CCP_GRAPHICS_VIDEOLAYER_PIXELFORMAT_STR "graphics.videolayer.pixelformat="
01095 #define MMSRC_CCP_GRAPHICS_VIDEOLAYER_PIXELFORMAT_LEN 32
01096 #define MMSRC_CCP_GRAPHICS_GRAPHICSLAYER_PIXELFORMAT_STR "graphics.graphicslayer.pixelformat="
01097 #define MMSRC_CCP_GRAPHICS_GRAPHICSLAYER_PIXELFORMAT_LEN 35
01098 #define MMSRC_CCP_GRAPHICS_FULLSCREEN_STR "graphics.fullscreen="
01099 #define MMSRC_CCP_GRAPHICS_FULLSCREEN_LEN 20
01100 #define MMSRC_CCP_GRAPHICS_HIDEAPPLICATION_STR "graphics.hideapplication="
01101 #define MMSRC_CCP_GRAPHICS_HIDEAPPLICATION_LEN 25
01102
01103
01104 char valbuf[256];
01105
01106
01107 MMSRC_CPP_PROCESS_PIXELFORMAT_PARAMETER(MMSRC_CCP_GRAPHICS_VIDEOLAYER_PIXELFORMAT_STR, MMSRC_CCP_GRAPHICS_VIDEOLAYER_PIXELFORMAT_LEN,
01108 {MMSConfigDataLayer l=config->getVideoLayer();l.pixelformat=pf;config->setVideoLayer(l);})
01109 else
01110 MMSRC_CPP_PROCESS_PIXELFORMAT_PARAMETER(MMSRC_CCP_GRAPHICS_GRAPHICSLAYER_PIXELFORMAT_STR, MMSRC_CCP_GRAPHICS_GRAPHICSLAYER_PIXELFORMAT_LEN,
01111 {MMSConfigDataLayer l=config->getGraphicsLayer();l.pixelformat=pf;config->setGraphicsLayer(l);})
01112 else
01113 MMSRC_CPP_GET_PARAMETER(MMSRC_CCP_GRAPHICS_FULLSCREEN_STR, MMSRC_CCP_GRAPHICS_FULLSCREEN_LEN) {
01114 MMSFBFullScreenMode fsm = getMMSFBFullScreenModeFromString(strToUpr(val));
01115 if (fsm != MMSFB_FSM_NONE)
01116 config->setFullScreen(fsm);
01117 else
01118 printf("DISKO: Parameter --disko:%s must be a valid fullscreen mode (%s)!\n",
01119 MMSRC_CCP_GRAPHICS_FULLSCREEN_STR, MMSFB_FSM_VALID_VALUES);
01120 }}
01121 else
01122 MMSRC_CPP_PROCESS_BOOL_PARAMETER(MMSRC_CCP_GRAPHICS_HIDEAPPLICATION_STR, MMSRC_CCP_GRAPHICS_HIDEAPPLICATION_LEN,
01123 {config->setHideApplication(true);},{config->setHideApplication(false);});
01124 }
01125
01126 void MMSRcParser::updateConfig(MMSConfigData *config, string args, int argc, char *argv[]) {
01127
01128 if (!config) return;
01129
01130
01131 char *ap = (char*)args.c_str();
01132 while (*ap) {
01133
01134 if (!(ap = strstr(ap, "--disko:"))) break;
01135 ap+= 8;
01136
01137
01138 updateConfigParms(config, ap);
01139
01140
01141 if (!(ap = strstr(ap, " "))) break;
01142 ap++;
01143 }
01144
01145
01146 for (int i = 1; i < argc; i++) {
01147
01148 char *ap= argv[i];
01149 if (memcmp(ap, "--disko:", 8)) continue;
01150 ap+= 8;
01151
01152
01153 updateConfigParms(config, ap);
01154 }
01155 }
01156