]> git.lizzy.rs Git - minetest.git/blob - src/client/clientlauncher.cpp
Snake case for screen options in minetest.conf (#5792)
[minetest.git] / src / client / clientlauncher.cpp
1 /*
2 Minetest
3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include "mainmenumanager.h"
21 #include "debug.h"
22 #include "clouds.h"
23 #include "server.h"
24 #include "filesys.h"
25 #include "guiMainMenu.h"
26 #include "game.h"
27 #include "chat.h"
28 #include "gettext.h"
29 #include "profiler.h"
30 #include "log.h"
31 #include "serverlist.h"
32 #include "guiEngine.h"
33 #include "player.h"
34 #include "fontengine.h"
35 #include "joystick_controller.h"
36 #include "clientlauncher.h"
37 #include "version.h"
38
39 /* mainmenumanager.h
40  */
41 gui::IGUIEnvironment *guienv = NULL;
42 gui::IGUIStaticText *guiroot = NULL;
43 MainMenuManager g_menumgr;
44
45 bool isMenuActive()
46 {
47         return g_menumgr.menuCount() != 0;
48 }
49
50 // Passed to menus to allow disconnecting and exiting
51 MainGameCallback *g_gamecallback = NULL;
52
53
54 ClientLauncher::~ClientLauncher()
55 {
56         if (receiver)
57                 delete receiver;
58
59         if (input)
60                 delete input;
61
62         if (g_fontengine)
63                 delete g_fontengine;
64
65         if (device)
66                 device->drop();
67 }
68
69
70 bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
71 {
72         init_args(game_params, cmd_args);
73
74         // List video modes if requested
75         if (list_video_modes)
76                 return print_video_modes();
77
78         if (!init_engine()) {
79                 errorstream << "Could not initialize game engine." << std::endl;
80                 return false;
81         }
82
83         // Speed tests (done after irrlicht is loaded to get timer)
84         if (cmd_args.getFlag("speedtests")) {
85                 dstream << "Running speed tests" << std::endl;
86                 speed_tests();
87                 return true;
88         }
89
90         video::IVideoDriver *video_driver = device->getVideoDriver();
91         if (video_driver == NULL) {
92                 errorstream << "Could not initialize video driver." << std::endl;
93                 return false;
94         }
95
96         porting::setXorgClassHint(video_driver->getExposedVideoData(), PROJECT_NAME_C);
97
98         porting::setWindowIcon(device);
99
100         /*
101                 This changes the minimum allowed number of vertices in a VBO.
102                 Default is 500.
103         */
104         //driver->setMinHardwareBufferVertexCount(50);
105
106         // Create game callback for menus
107         g_gamecallback = new MainGameCallback(device);
108
109         device->setResizable(true);
110
111         init_input();
112
113         smgr = device->getSceneManager();
114         smgr->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true);
115
116         guienv = device->getGUIEnvironment();
117         skin = guienv->getSkin();
118         skin->setColor(gui::EGDC_BUTTON_TEXT, video::SColor(255, 255, 255, 255));
119         skin->setColor(gui::EGDC_3D_LIGHT, video::SColor(0, 0, 0, 0));
120         skin->setColor(gui::EGDC_3D_HIGH_LIGHT, video::SColor(255, 30, 30, 30));
121         skin->setColor(gui::EGDC_3D_SHADOW, video::SColor(255, 0, 0, 0));
122         skin->setColor(gui::EGDC_HIGH_LIGHT, video::SColor(255, 70, 120, 50));
123         skin->setColor(gui::EGDC_HIGH_LIGHT_TEXT, video::SColor(255, 255, 255, 255));
124
125         g_fontengine = new FontEngine(g_settings, guienv);
126         FATAL_ERROR_IF(g_fontengine == NULL, "Font engine creation failed.");
127
128 #if (IRRLICHT_VERSION_MAJOR >= 1 && IRRLICHT_VERSION_MINOR >= 8) || IRRLICHT_VERSION_MAJOR >= 2
129         // Irrlicht 1.8 input colours
130         skin->setColor(gui::EGDC_EDITABLE, video::SColor(255, 128, 128, 128));
131         skin->setColor(gui::EGDC_FOCUSED_EDITABLE, video::SColor(255, 96, 134, 49));
132 #endif
133
134         // Create the menu clouds
135         if (!g_menucloudsmgr)
136                 g_menucloudsmgr = smgr->createNewSceneManager();
137         if (!g_menuclouds)
138                 g_menuclouds = new Clouds(g_menucloudsmgr->getRootSceneNode(),
139                                 g_menucloudsmgr, -1, rand(), 100);
140         g_menuclouds->update(v2f(0, 0), video::SColor(255, 200, 200, 255));
141         scene::ICameraSceneNode* camera;
142         camera = g_menucloudsmgr->addCameraSceneNode(0,
143                                 v3f(0, 0, 0), v3f(0, 60, 100));
144         camera->setFarValue(10000);
145
146         /*
147                 GUI stuff
148         */
149
150         ChatBackend chat_backend;
151
152         // If an error occurs, this is set to something by menu().
153         // It is then displayed before the menu shows on the next call to menu()
154         std::string error_message;
155         bool reconnect_requested = false;
156
157         bool first_loop = true;
158
159         /*
160                 Menu-game loop
161         */
162         bool retval = true;
163         bool *kill = porting::signal_handler_killstatus();
164
165         while (device->run() && !*kill && !g_gamecallback->shutdown_requested)
166         {
167                 // Set the window caption
168                 const wchar_t *text = wgettext("Main Menu");
169                 device->setWindowCaption((utf8_to_wide(PROJECT_NAME_C) +
170                         L" " + utf8_to_wide(g_version_hash) +
171                         L" [" + text + L"]").c_str());
172                 delete[] text;
173
174                 try {   // This is used for catching disconnects
175
176                         guienv->clear();
177
178                         /*
179                                 We need some kind of a root node to be able to add
180                                 custom gui elements directly on the screen.
181                                 Otherwise they won't be automatically drawn.
182                         */
183                         guiroot = guienv->addStaticText(L"", core::rect<s32>(0, 0, 10000, 10000));
184
185                         bool game_has_run = launch_game(error_message, reconnect_requested,
186                                 game_params, cmd_args);
187
188                         // Reset the reconnect_requested flag
189                         reconnect_requested = false;
190
191                         // If skip_main_menu, we only want to startup once
192                         if (skip_main_menu && !first_loop)
193                                 break;
194
195                         first_loop = false;
196
197                         if (!game_has_run) {
198                                 if (skip_main_menu)
199                                         break;
200                                 else
201                                         continue;
202                         }
203
204                         // Break out of menu-game loop to shut down cleanly
205                         if (!device->run() || *kill) {
206                                 if (g_settings_path != "")
207                                         g_settings->updateConfigFile(g_settings_path.c_str());
208                                 break;
209                         }
210
211                         if (current_playername.length() > PLAYERNAME_SIZE-1) {
212                                 error_message = gettext("Player name too long.");
213                                 playername = current_playername.substr(0, PLAYERNAME_SIZE-1);
214                                 g_settings->set("name", playername);
215                                 continue;
216                         }
217
218                         device->getVideoDriver()->setTextureCreationFlag(
219                                         video::ETCF_CREATE_MIP_MAPS, g_settings->getBool("mip_map"));
220
221 #ifdef HAVE_TOUCHSCREENGUI
222                         receiver->m_touchscreengui = new TouchScreenGUI(device, receiver);
223                         g_touchscreengui = receiver->m_touchscreengui;
224 #endif
225
226                         the_game(
227                                 kill,
228                                 random_input,
229                                 input,
230                                 device,
231                                 worldspec.path,
232                                 current_playername,
233                                 current_password,
234                                 current_address,
235                                 current_port,
236                                 error_message,
237                                 chat_backend,
238                                 &reconnect_requested,
239                                 gamespec,
240                                 simple_singleplayer_mode
241                         );
242                         smgr->clear();
243
244 #ifdef HAVE_TOUCHSCREENGUI
245                         delete g_touchscreengui;
246                         g_touchscreengui = NULL;
247                         receiver->m_touchscreengui = NULL;
248 #endif
249
250                 } //try
251                 catch (con::PeerNotFoundException &e) {
252                         error_message = gettext("Connection error (timed out?)");
253                         errorstream << error_message << std::endl;
254                 }
255
256 #ifdef NDEBUG
257                 catch (std::exception &e) {
258                         std::string error_message = "Some exception: \"";
259                         error_message += e.what();
260                         error_message += "\"";
261                         errorstream << error_message << std::endl;
262                 }
263 #endif
264
265                 // If no main menu, show error and exit
266                 if (skip_main_menu) {
267                         if (!error_message.empty()) {
268                                 verbosestream << "error_message = "
269                                               << error_message << std::endl;
270                                 retval = false;
271                         }
272                         break;
273                 }
274         } // Menu-game loop
275
276         g_menuclouds->drop();
277         g_menucloudsmgr->drop();
278
279         return retval;
280 }
281
282 void ClientLauncher::init_args(GameParams &game_params, const Settings &cmd_args)
283 {
284
285         skip_main_menu = cmd_args.getFlag("go");
286
287         // FIXME: This is confusing (but correct)
288
289         /* If world_path is set then override it unless skipping the main menu using
290          * the --go command line param. Else, give preference to the address
291          * supplied on the command line
292          */
293         address = g_settings->get("address");
294         if (game_params.world_path != "" && !skip_main_menu)
295                 address = "";
296         else if (cmd_args.exists("address"))
297                 address = cmd_args.get("address");
298
299         playername = g_settings->get("name");
300         if (cmd_args.exists("name"))
301                 playername = cmd_args.get("name");
302
303         list_video_modes = cmd_args.getFlag("videomodes");
304
305         use_freetype = g_settings->getBool("freetype");
306
307         random_input = g_settings->getBool("random_input")
308                         || cmd_args.getFlag("random-input");
309 }
310
311 bool ClientLauncher::init_engine()
312 {
313         receiver = new MyEventReceiver();
314         create_engine_device();
315         return device != NULL;
316 }
317
318 void ClientLauncher::init_input()
319 {
320         if (random_input)
321                 input = new RandomInputHandler();
322         else
323                 input = new RealInputHandler(device, receiver);
324
325         if (g_settings->getBool("enable_joysticks")) {
326                 irr::core::array<irr::SJoystickInfo> infos;
327                 std::vector<irr::SJoystickInfo> joystick_infos;
328
329                 // Make sure this is called maximum once per
330                 // irrlicht device, otherwise it will give you
331                 // multiple events for the same joystick.
332                 if (device->activateJoysticks(infos)) {
333                         infostream << "Joystick support enabled" << std::endl;
334                         joystick_infos.reserve(infos.size());
335                         for (u32 i = 0; i < infos.size(); i++) {
336                                 joystick_infos.push_back(infos[i]);
337                         }
338                         input->joystick.onJoystickConnect(joystick_infos);
339                 } else {
340                         errorstream << "Could not activate joystick support." << std::endl;
341                 }
342         }
343 }
344
345 bool ClientLauncher::launch_game(std::string &error_message,
346                 bool reconnect_requested, GameParams &game_params,
347                 const Settings &cmd_args)
348 {
349         // Initialize menu data
350         MainMenuData menudata;
351         menudata.address                         = address;
352         menudata.name                            = playername;
353         menudata.password                        = password;
354         menudata.port                            = itos(game_params.socket_port);
355         menudata.script_data.errormessage        = error_message;
356         menudata.script_data.reconnect_requested = reconnect_requested;
357
358         error_message.clear();
359
360         if (cmd_args.exists("password"))
361                 menudata.password = cmd_args.get("password");
362
363         menudata.enable_public = g_settings->getBool("server_announce");
364
365         // If a world was commanded, append and select it
366         if (game_params.world_path != "") {
367                 worldspec.gameid = getWorldGameId(game_params.world_path, true);
368                 worldspec.name = _("[--world parameter]");
369
370                 if (worldspec.gameid == "") {   // Create new
371                         worldspec.gameid = g_settings->get("default_game");
372                         worldspec.name += " [new]";
373                 }
374                 worldspec.path = game_params.world_path;
375         }
376
377         /* Show the GUI menu
378          */
379         if (!skip_main_menu) {
380                 main_menu(&menudata);
381
382                 // Skip further loading if there was an exit signal.
383                 if (*porting::signal_handler_killstatus())
384                         return false;
385
386                 address = menudata.address;
387                 int newport = stoi(menudata.port);
388                 if (newport != 0)
389                         game_params.socket_port = newport;
390
391                 simple_singleplayer_mode = menudata.simple_singleplayer_mode;
392
393                 std::vector<WorldSpec> worldspecs = getAvailableWorlds();
394
395                 if (menudata.selected_world >= 0
396                                 && menudata.selected_world < (int)worldspecs.size()) {
397                         g_settings->set("selected_world_path",
398                                         worldspecs[menudata.selected_world].path);
399                         worldspec = worldspecs[menudata.selected_world];
400                 }
401         }
402
403         if (!menudata.script_data.errormessage.empty()) {
404                 /* The calling function will pass this back into this function upon the
405                  * next iteration (if any) causing it to be displayed by the GUI
406                  */
407                 error_message = menudata.script_data.errormessage;
408                 return false;
409         }
410
411         if (menudata.name == "" && !simple_singleplayer_mode) {
412                 error_message = gettext("Please choose a name!");
413                 return false;
414         }
415
416         playername = menudata.name;
417         password = menudata.password;
418
419         current_playername = playername;
420         current_password   = password;
421         current_address    = address;
422         current_port       = game_params.socket_port;
423
424         // If using simple singleplayer mode, override
425         if (simple_singleplayer_mode) {
426                 assert(skip_main_menu == false);
427                 current_playername = "singleplayer";
428                 current_password = "";
429                 current_address = "";
430                 current_port = myrand_range(49152, 65535);
431         } else {
432                 g_settings->set("name", playername);
433                 if (address != "") {
434                         ServerListSpec server;
435                         server["name"] = menudata.servername;
436                         server["address"] = menudata.address;
437                         server["port"] = menudata.port;
438                         server["description"] = menudata.serverdescription;
439                         ServerList::insert(server);
440                 }
441         }
442
443         infostream << "Selected world: " << worldspec.name
444                    << " [" << worldspec.path << "]" << std::endl;
445
446         if (current_address == "") { // If local game
447                 if (worldspec.path == "") {
448                         error_message = gettext("No world selected and no address "
449                                         "provided. Nothing to do.");
450                         errorstream << error_message << std::endl;
451                         return false;
452                 }
453
454                 if (!fs::PathExists(worldspec.path)) {
455                         error_message = gettext("Provided world path doesn't exist: ")
456                                         + worldspec.path;
457                         errorstream << error_message << std::endl;
458                         return false;
459                 }
460
461                 // Load gamespec for required game
462                 gamespec = findWorldSubgame(worldspec.path);
463                 if (!gamespec.isValid() && !game_params.game_spec.isValid()) {
464                         error_message = gettext("Could not find or load game \"")
465                                         + worldspec.gameid + "\"";
466                         errorstream << error_message << std::endl;
467                         return false;
468                 }
469
470                 if (porting::signal_handler_killstatus())
471                         return true;
472
473                 if (game_params.game_spec.isValid() &&
474                                 game_params.game_spec.id != worldspec.gameid) {
475                         warningstream << "Overriding gamespec from \""
476                                     << worldspec.gameid << "\" to \""
477                                     << game_params.game_spec.id << "\"" << std::endl;
478                         gamespec = game_params.game_spec;
479                 }
480
481                 if (!gamespec.isValid()) {
482                         error_message = gettext("Invalid gamespec.");
483                         error_message += " (world.gameid=" + worldspec.gameid + ")";
484                         errorstream << error_message << std::endl;
485                         return false;
486                 }
487         }
488
489         return true;
490 }
491
492 void ClientLauncher::main_menu(MainMenuData *menudata)
493 {
494         bool *kill = porting::signal_handler_killstatus();
495         video::IVideoDriver *driver = device->getVideoDriver();
496
497         infostream << "Waiting for other menus" << std::endl;
498         while (device->run() && *kill == false) {
499                 if (!isMenuActive())
500                         break;
501                 driver->beginScene(true, true, video::SColor(255, 128, 128, 128));
502                 guienv->drawAll();
503                 driver->endScene();
504                 // On some computers framerate doesn't seem to be automatically limited
505                 sleep_ms(25);
506         }
507         infostream << "Waited for other menus" << std::endl;
508
509         // Cursor can be non-visible when coming from the game
510 #ifndef ANDROID
511         device->getCursorControl()->setVisible(true);
512 #endif
513
514         /* show main menu */
515         GUIEngine mymenu(device, &input->joystick, guiroot,
516                 &g_menumgr, smgr, menudata, *kill);
517
518         smgr->clear();  /* leave scene manager in a clean state */
519 }
520
521 bool ClientLauncher::create_engine_device()
522 {
523         // Resolution selection
524         bool fullscreen = g_settings->getBool("fullscreen");
525         u16 screen_w = g_settings->getU16("screen_w");
526         u16 screen_h = g_settings->getU16("screen_h");
527
528         // bpp, fsaa, vsync
529         bool vsync = g_settings->getBool("vsync");
530         u16 bits = g_settings->getU16("fullscreen_bpp");
531         u16 fsaa = g_settings->getU16("fsaa");
532
533         // stereo buffer required for pageflip stereo
534         bool stereo_buffer = g_settings->get("3d_mode") == "pageflip";
535
536         // Determine driver
537         video::E_DRIVER_TYPE driverType = video::EDT_OPENGL;
538         const std::string &driverstring = g_settings->get("video_driver");
539         std::vector<video::E_DRIVER_TYPE> drivers
540                 = porting::getSupportedVideoDrivers();
541         u32 i;
542         for (i = 0; i != drivers.size(); i++) {
543                 if (!strcasecmp(driverstring.c_str(),
544                         porting::getVideoDriverName(drivers[i]))) {
545                         driverType = drivers[i];
546                         break;
547                 }
548         }
549         if (i == drivers.size()) {
550                 errorstream << "Invalid video_driver specified; "
551                         "defaulting to opengl" << std::endl;
552         }
553
554         SIrrlichtCreationParameters params = SIrrlichtCreationParameters();
555         params.DriverType    = driverType;
556         params.WindowSize    = core::dimension2d<u32>(screen_w, screen_h);
557         params.Bits          = bits;
558         params.AntiAlias     = fsaa;
559         params.Fullscreen    = fullscreen;
560         params.Stencilbuffer = false;
561         params.Stereobuffer  = stereo_buffer;
562         params.Vsync         = vsync;
563         params.EventReceiver = receiver;
564         params.HighPrecisionFPU = g_settings->getBool("high_precision_fpu");
565         params.ZBufferBits   = 24;
566 #ifdef __ANDROID__
567         params.PrivateData = porting::app_global;
568         params.OGLES2ShaderPath = std::string(porting::path_user + DIR_DELIM +
569                         "media" + DIR_DELIM + "Shaders" + DIR_DELIM).c_str();
570 #endif
571
572         device = createDeviceEx(params);
573
574         if (device)
575                 porting::initIrrlicht(device);
576
577         return device != NULL;
578 }
579
580 void ClientLauncher::speed_tests()
581 {
582         // volatile to avoid some potential compiler optimisations
583         volatile static s16 temp16;
584         volatile static f32 tempf;
585         static v3f tempv3f1;
586         static v3f tempv3f2;
587         static std::string tempstring;
588         static std::string tempstring2;
589
590         tempv3f1 = v3f();
591         tempv3f2 = v3f();
592         tempstring = std::string();
593         tempstring2 = std::string();
594
595         {
596                 infostream << "The following test should take around 20ms." << std::endl;
597                 TimeTaker timer("Testing std::string speed");
598                 const u32 jj = 10000;
599                 for (u32 j = 0; j < jj; j++) {
600                         tempstring = "";
601                         tempstring2 = "";
602                         const u32 ii = 10;
603                         for (u32 i = 0; i < ii; i++) {
604                                 tempstring2 += "asd";
605                         }
606                         for (u32 i = 0; i < ii+1; i++) {
607                                 tempstring += "asd";
608                                 if (tempstring == tempstring2)
609                                         break;
610                         }
611                 }
612         }
613
614         infostream << "All of the following tests should take around 100ms each."
615                    << std::endl;
616
617         {
618                 TimeTaker timer("Testing floating-point conversion speed");
619                 tempf = 0.001;
620                 for (u32 i = 0; i < 4000000; i++) {
621                         temp16 += tempf;
622                         tempf += 0.001;
623                 }
624         }
625
626         {
627                 TimeTaker timer("Testing floating-point vector speed");
628
629                 tempv3f1 = v3f(1, 2, 3);
630                 tempv3f2 = v3f(4, 5, 6);
631                 for (u32 i = 0; i < 10000000; i++) {
632                         tempf += tempv3f1.dotProduct(tempv3f2);
633                         tempv3f2 += v3f(7, 8, 9);
634                 }
635         }
636
637         {
638                 TimeTaker timer("Testing std::map speed");
639
640                 std::map<v2s16, f32> map1;
641                 tempf = -324;
642                 const s16 ii = 300;
643                 for (s16 y = 0; y < ii; y++) {
644                         for (s16 x = 0; x < ii; x++) {
645                                 map1[v2s16(x, y)] =  tempf;
646                                 tempf += 1;
647                         }
648                 }
649                 for (s16 y = ii - 1; y >= 0; y--) {
650                         for (s16 x = 0; x < ii; x++) {
651                                 tempf = map1[v2s16(x, y)];
652                         }
653                 }
654         }
655
656         {
657                 infostream << "Around 5000/ms should do well here." << std::endl;
658                 TimeTaker timer("Testing mutex speed");
659
660                 Mutex m;
661                 u32 n = 0;
662                 u32 i = 0;
663                 do {
664                         n += 10000;
665                         for (; i < n; i++) {
666                                 m.lock();
667                                 m.unlock();
668                         }
669                 }
670                 // Do at least 10ms
671                 while(timer.getTimerTime() < 10);
672
673                 u32 dtime = timer.stop();
674                 u32 per_ms = n / dtime;
675                 infostream << "Done. " << dtime << "ms, " << per_ms << "/ms" << std::endl;
676         }
677 }
678
679 bool ClientLauncher::print_video_modes()
680 {
681         IrrlichtDevice *nulldevice;
682
683         bool vsync = g_settings->getBool("vsync");
684         u16 fsaa = g_settings->getU16("fsaa");
685         MyEventReceiver* receiver = new MyEventReceiver();
686
687         SIrrlichtCreationParameters params = SIrrlichtCreationParameters();
688         params.DriverType    = video::EDT_NULL;
689         params.WindowSize    = core::dimension2d<u32>(640, 480);
690         params.Bits          = 24;
691         params.AntiAlias     = fsaa;
692         params.Fullscreen    = false;
693         params.Stencilbuffer = false;
694         params.Vsync         = vsync;
695         params.EventReceiver = receiver;
696         params.HighPrecisionFPU = g_settings->getBool("high_precision_fpu");
697
698         nulldevice = createDeviceEx(params);
699
700         if (nulldevice == NULL) {
701                 delete receiver;
702                 return false;
703         }
704
705         std::cout << _("Available video modes (WxHxD):") << std::endl;
706
707         video::IVideoModeList *videomode_list = nulldevice->getVideoModeList();
708
709         if (videomode_list != NULL) {
710                 s32 videomode_count = videomode_list->getVideoModeCount();
711                 core::dimension2d<u32> videomode_res;
712                 s32 videomode_depth;
713                 for (s32 i = 0; i < videomode_count; ++i) {
714                         videomode_res = videomode_list->getVideoModeResolution(i);
715                         videomode_depth = videomode_list->getVideoModeDepth(i);
716                         std::cout << videomode_res.Width << "x" << videomode_res.Height
717                                 << "x" << videomode_depth << std::endl;
718                 }
719
720                 std::cout << _("Active video mode (WxHxD):") << std::endl;
721                 videomode_res = videomode_list->getDesktopResolution();
722                 videomode_depth = videomode_list->getDesktopDepth();
723                 std::cout << videomode_res.Width << "x" << videomode_res.Height
724                         << "x" << videomode_depth << std::endl;
725
726         }
727
728         nulldevice->drop();
729         delete receiver;
730
731         return videomode_list != NULL;
732 }