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