ManaPlus
client.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2018 The ManaPlus Developers
6  *
7  * This file is part of The ManaPlus Client.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #include "progs/dyecmd/client.h"
24 
25 #include "configmanager.h"
26 #include "dirs.h"
27 #include "eventsmanager.h"
28 #include "graphicsmanager.h"
29 #include "main.h"
30 #include "settings.h"
31 #include "soundmanager.h"
32 
33 #include "fs/virtfs/fs.h"
34 #include "fs/virtfs/tools.h"
35 
36 #include "gui/dialogsmanager.h"
37 #include "gui/gui.h"
38 #include "gui/skin.h"
39 #include "gui/popupmanager.h"
40 #include "gui/windowmanager.h"
41 
42 #include "gui/widgets/button.h"
44 #include "gui/widgets/desktop.h"
45 #include "gui/widgets/window.h"
47 
48 #include "input/inputmanager.h"
49 #include "input/joystick.h"
50 #include "input/keyboardconfig.h"
51 
53 
54 #include "resources/imagehelper.h"
55 
57 
59 
60 #include "utils/cpu.h"
61 #include "utils/delete2.h"
62 #include "utils/env.h"
63 #include "utils/fuzzer.h"
64 #include "utils/gettext.h"
65 #include "utils/gettexthelper.h"
66 #include "utils/mrand.h"
67 #ifdef ANDROID
68 #include "fs/paths.h"
69 #endif // ANDROID
70 #include "utils/sdlcheckutils.h"
71 #include "utils/sdlhelper.h"
72 #include "utils/timer.h"
73 
75 
76 #include "configuration.h"
77 
78 #include "net/ipc.h"
79 
80 #ifdef WIN32
81 PRAGMA48(GCC diagnostic push)
82 PRAGMA48(GCC diagnostic ignored "-Wshadow")
83 #include <SDL_syswm.h>
84 PRAGMA48(GCC diagnostic pop)
85 #include <sys/time.h>
86 #include "fs/specialfolder.h"
87 #undef ERROR
88 #endif // WIN32
89 
90 #ifdef __clang__
91 #include <ctime>
92 #endif // __clang__
93 
94 #ifdef ANDROID
95 #ifndef USE_SDL2
96 PRAGMA48(GCC diagnostic push)
97 PRAGMA48(GCC diagnostic ignored "-Wshadow")
98 #include <SDL_screenkeyboard.h>
99 PRAGMA48(GCC diagnostic pop)
100 #include <fstream>
101 #endif // USE_SDL2
102 #endif // ANDROID
103 
104 PRAGMA48(GCC diagnostic push)
105 PRAGMA48(GCC diagnostic ignored "-Wshadow")
106 #ifdef USE_SDL2
107 #include <SDL2_framerate.h>
108 #else // USE_SDL2
109 #include <SDL_framerate.h>
110 #endif // USE_SDL2
111 PRAGMA48(GCC diagnostic pop)
112 
113 #include "debug.h"
114 
115 std::string errorMessage;
116 
117 Client *client = nullptr;
118 
119 extern FPSmanager fpsManager;
120 
121 volatile bool runCounters;
122 bool isSafeMode = false;
128 int packetsType = 0;
129 bool packets_main = true;
130 bool packets_re = false;
131 bool packets_zero = false;
132 unsigned int tmwServerVersion = 0;
133 time_t start_time;
134 unsigned int mLastHost = 0;
135 unsigned long mSearchHash = 0;
137 
139  ActionListener(),
140  mCurrentDialog(nullptr),
141  mSetupButton(nullptr),
142  mVideoButton(nullptr),
143  mHelpButton(nullptr),
144  mAboutButton(nullptr),
145  mThemesButton(nullptr),
146  mPerfomanceButton(nullptr),
147 #ifdef ANDROID
148  mCloseButton(nullptr),
149 #endif // ANDROID
150  mState(State::GAME),
151  mOldState(State::START),
152  mSkin(nullptr),
153  mButtonPadding(1),
154  mButtonSpacing(3)
155 {
157 }
158 
160 {
161 }
162 
164 {
165 }
166 
167 // +++ need remove duplicate from here
169 {
170  logger = new Logger;
171  SDL::initLogger();
172 
173  initRand();
174 
175  // Load branding information
176  if (!settings.options.brandingPath.empty())
177  {
181  }
183 
186 
187  // Configure logger
188  if (!settings.options.logFileName.empty())
189  {
191  }
192  else
193  {
195  "manaplus.log");
196  }
198 
199 #ifdef USE_FUZZER
200  Fuzzer::init();
201 #endif // USE_FUZZER
202 
203  if (settings.options.test.empty())
204  ConfigManager::backupConfig("config.xml");
206  SDL::setLogLevel(config.getIntValue("sdlLogLevel"));
208  initPaths();
209  logger->log("init 4");
210  logger->setDebugLog(config.getBoolValue("debugLog"));
211  logger->setReportUnimplemented(config.getBoolValue("unimplimentedLog"));
212 
213  config.incValue("runcount");
214 
215 #ifndef ANDROID
216  if (settings.options.test.empty())
218 #endif // ANDROID
219 
221  {
222  logger->error(strprintf("%s couldn't be set as home directory! "
223  "Exiting.", settings.localDataDir.c_str()));
224  }
225 
227 
228 /*
229  chatLogger = new ChatLogger;
230  if (settings.options.chatLogDir.empty())
231  {
232  chatLogger->setBaseLogDir(settings.localDataDir
233  + std::string("/logs/"));
234  }
235  else
236  {
237  chatLogger->setBaseLogDir(settings.options.chatLogDir);
238  }
239 */
240  // Log the client version
242  logger->log("Start configPath: " + config.getConfigPath());
243 
245 
246  // Initialize SDL
247  logger->log1("Initializing SDL...");
248  if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
249  {
250  logger->safeError(strprintf("Could not initialize SDL: %s",
251  SDL_GetError()));
252  }
253  atexit(SDL_Quit);
254 
255 #ifndef USE_SDL2
256  SDL_EnableUNICODE(1);
257 #endif // USE_SDL2
258 
262 
263 #ifdef WIN32
265 #endif // WIN32
266 #ifndef USE_SDL2
268 #endif // USE_SDL2
269 
271  logVars();
272  Cpu::detect();
274 #if defined(USE_OPENGL)
275 #if !defined(ANDROID) && !defined(__APPLE__) && !defined(__native_client__)
276  if (!settings.options.safeMode && settings.options.test.empty()
277  && !config.getBoolValue("videodetected"))
278  {
280  }
281 #endif // !defined(ANDROID) && !defined(__APPLE__) &&
282  // !defined(__native_client__)
283 #endif // defined(USE_OPENGL)
284 
285  updateEnv();
286  SDL::allowScreenSaver(config.getBoolValue("allowscreensaver"));
287  initGraphics();
288 
289 #ifndef WIN32
292 #endif // WIN32
293 
295 
296  // Add the main data directories to our VirtFs search path
297  if (!settings.options.dataPath.empty())
298  {
300  Append_false);
301  }
302 
303  // Add the local data directory to VirtFs search path
305  Append_false);
308 #ifdef ENABLE_CUSTOMNLS
309  TranslationManager::loadGettextLang();
310 #endif // ENABLE_CUSTOMNLS
311 
312 #ifdef USE_SDL2
314 #endif // USE_SDL2
316 
318 
319  theme = new Theme;
321  touchManager.init();
322 
323  // Initialize the item and emote shortcuts.
324 // for (size_t f = 0; f < SHORTCUT_TABS; f ++)
325 // itemShortcut[f] = new ItemShortcut(f);
326 // emoteShortcut = new EmoteShortcut;
327 // dropShortcut = new DropShortcut;
328 
329  gui = new Gui;
333 
335 
336  // Initialize keyboard
337  keyboard.init();
338  inputManager.init();
339 
340  // Initialise player relations
341  Joystick::init();
343 
344  keyboard.update();
345  if (joystick != nullptr)
346  joystick->update();
347 
348 // if (mState != State::ERROR)
349 // mState = State::CHOOSE_SERVER;
350 
351  startTimers();
352 
353  const int fpsLimit = config.getIntValue("fpslimit");
354  settings.limitFps = fpsLimit > 0;
355 
356  SDL_initFramerate(&fpsManager);
357  WindowManager::setFramerate(fpsLimit);
358 
359  start_time = time(nullptr);
360 
361 // PlayerInfo::init();
362 
363 #ifdef ANDROID
364 #ifndef USE_SDL2
365  WindowManager::updateScreenKeyboard(SDL_GetScreenKeyboardHeight(nullptr));
366 #endif // USE_SDL2
367 #endif // ANDROID
368 
369  mSkin = theme->load("windowmenu.xml",
370  "",
371  true,
373  if (mSkin != nullptr)
374  {
376  mButtonSpacing = mSkin->getOption("spacing", 3);
377  }
378 }
379 
381 {
383  gameClear();
384  else
385  testsClear();
386 }
387 
389 {
390  // Initialize sound engine
391  try
392  {
393  if (config.getBoolValue("sound"))
394  soundManager.init();
395 
398  }
399  catch (const char *const err)
400  {
402  errorMessage = err;
403  logger->log("Warning: %s", err);
404  }
406  "loginMusic",
407  "Magick - Real.ogg"),
409 }
410 
412 {
413 #ifndef USE_SDL2
415 #endif // USE_SDL2
416 
417  runCounters = config.getBoolValue("packetcounters");
418 
420 
421 #ifdef USE_SDL2
423 #endif // USE_SDL2
424 
429 
431 }
432 
434 {
435  if (logger != nullptr)
436  logger->log1("Quitting1");
437 
440  if (windowContainer != nullptr)
442 
443  stopTimers();
444 
445  delete2(ipc);
446 
447  if (logger != nullptr)
448  logger->log1("Quitting2");
449 
453  delete2(gui);
454 
455  if (logger != nullptr)
456  logger->log1("Quitting3");
457 
459 
460  if (logger != nullptr)
461  logger->log1("Quitting4");
462 
463  XML::cleanupXML();
464 
465  if (logger != nullptr)
466  logger->log1("Quitting5");
467 
469 
470  if (logger != nullptr)
471  logger->log1("Quitting6");
472 
475 
477 
478  if (logger != nullptr)
479  logger->log1("Quitting8");
480 
482 
483  if (logger != nullptr)
484  logger->log1("Quitting9");
485 
486  delete2(joystick);
487 
488  keyboard.deinit();
489 
490  if (logger != nullptr)
491  logger->log1("Quitting10");
492 
494 
495 #ifdef DEBUG_CONFIG
496  config.enableKeyLogging();
497 #endif // DEBUG_CONFIG
498 
500  config.write();
502 
503  config.clear();
505 
506  if (logger != nullptr)
507  logger->log1("Quitting11");
508 
509 #ifdef USE_PROFILER
511 #endif // USE_PROFILER
512 
513 #ifdef DEBUG_OPENGL_LEAKS
514  if (logger)
515  logger->log("textures left: %d", textures_count);
516 #endif // DEBUG_OPENGL_LEAKS
517 
519 
520  if (logger != nullptr)
521  logger->log1("Quitting12");
522 
523 // delete2(chatLogger);
525  VirtFs::deinit();
526 }
527 
528 #define ADDBUTTON(var, object) var = object; \
529  x -= var->getWidth() + mButtonSpacing; \
530  var->setPosition(x, mButtonPadding); \
531  top->add(var);
532 
534 {
535  if (gui == nullptr)
536  return;
537 
538  BasicContainer2 *const top = static_cast<BasicContainer2*>(
539  gui->getTop());
540 
541  if (top == nullptr)
542  return;
543 
544  CREATEWIDGETV(desktop, Desktop, nullptr);
545  top->add(desktop);
546  int x = top->getWidth() - mButtonPadding;
548  // TRANSLATORS: setup tab quick button
549  _("Setup"), "Setup", BUTTON_SKIN, this))
551  // TRANSLATORS: perfoamance tab quick button
552  _("Performance"), "Perfomance", BUTTON_SKIN, this))
554  // TRANSLATORS: video tab quick button
555  _("Video"), "Video", BUTTON_SKIN, this))
557  // TRANSLATORS: theme tab quick button
558  _("Theme"), "Themes", BUTTON_SKIN, this))
560  // TRANSLATORS: theme tab quick button
561  _("About"), "about", BUTTON_SKIN, this))
563  // TRANSLATORS: theme tab quick button
564  _("Help"), "help", BUTTON_SKIN, this))
565 #ifdef ANDROID
566  ADDBUTTON(mCloseButton, new Button(desktop,
567  // TRANSLATORS: close quick button
568  _("Close"), "close", BUTTON_SKIN, this))
569 #endif // ANDROID
570 
573 }
574 
576 {
577  int lastTickTime = tick_time;
578 
579  while (mState != State::EXIT)
580  {
581  PROFILER_START();
583  continue;
584 
585  BLOCK_START("Client::gameExec 4")
586  if (gui != nullptr)
587  gui->logic();
588  cur_time = time(nullptr);
589  int k = 0;
590  while (lastTickTime != tick_time && k < 40)
591  {
592 // if (mGame)
593 // mGame->logic();
594 // else
595  if (gui != nullptr)
596  gui->handleInput();
597 
598  ++lastTickTime;
599  k ++;
600  }
602 
603  logic_count += k;
604  if (gui != nullptr)
605  gui->slowLogic();
606 // if (mGame)
607 // mGame->slowLogic();
608  slowLogic();
609  BLOCK_END("Client::gameExec 4")
610 
611  // This is done because at some point tick_time will wrap.
612  lastTickTime = tick_time;
613 
614  // Update the screen when application is visible, delay otherwise.
616  {
617  frame_count++;
618  if (gui != nullptr)
619  gui->draw();
621  }
622  else
623  {
624  SDL_Delay(100);
625  }
626 
627  BLOCK_START("~Client::SDL_framerateDelay")
628  if (settings.limitFps)
629  SDL_framerateDelay(&fpsManager);
630  BLOCK_END("~Client::SDL_framerateDelay")
631 
632  BLOCK_START("Client::gameExec 6")
633 /*
634  if (mState == State::CONNECT_GAME)
635  {
636  stateConnectGame1();
637  }
638 */
639  BLOCK_END("Client::gameExec 6")
640 
641  if (mState != mOldState)
642  {
643  BLOCK_START("Client::gameExec 7")
644 
645  mOldState = mState;
646 
647  // Get rid of the dialog of the previous state
649 
650  // State has changed, while the quitDialog was active, it might
651  // not be correct anymore
652 /*
653  if (mQuitDialog)
654  {
655  mQuitDialog->scheduleDelete();
656  mQuitDialog = nullptr;
657  }
658 */
659  BLOCK_END("Client::gameExec 7")
660 
661  BLOCK_START("Client::gameExec 8")
662  PRAGMA45(GCC diagnostic push)
663  PRAGMA45(GCC diagnostic ignored "-Wswitch-enum")
664  switch (mState)
665  {
666  case State::GAME:
667  stateGame();
668  break;
669 
670  case State::LOAD_DATA:
671  {
672  BLOCK_START("Client::gameExec State::LOAD_DATA")
673  logger->log1("State: LOAD DATA");
674 
675  // If another data path has been set,
676  // we don't load any other files...
677  if (settings.options.dataPath.empty())
678  {
679  // Add customdata directory
681  "customdata/",
682  "zip",
683  Append_false);
684  }
685 
687  {
689  settings.updatesDir, "local/"),
690  "zip",
691  Append_false);
692 
696  "local/"),
697  Append_false);
698  }
699 
700  logger->log("Init paths");
701  paths.init("paths.xml",
705  initPaths();
708 
709  if (desktop != nullptr)
711 
713  BLOCK_END("Client::gameExec State::LOAD_DATA")
714  break;
715  }
716  case State::START:
717  default:
719  break;
720  }
721  PRAGMA45(GCC diagnostic pop)
722  BLOCK_END("Client::gameExec 8")
723  }
724  PROFILER_END();
725  }
726 
727  return 0;
728 }
729 
730 void Client::action(const ActionEvent &event)
731 {
732  std::string tab;
733  const std::string &eventId = event.getId();
734 
735  if (eventId == "close")
736  {
738  return;
739  }
740  if (eventId == "Setup")
741  {
742  tab.clear();
743  }
744  else if (eventId == "help")
745  {
747  return;
748  }
749  else if (eventId == "about")
750  {
752  return;
753  }
754  else if (eventId == "Video")
755  {
756  tab = "Video";
757  }
758  else if (eventId == "Themes")
759  {
760  tab = "Theme";
761  }
762  else if (eventId == "Perfomance")
763  {
764  tab = "Perfomance";
765  }
766  else
767  {
768  return;
769  }
770 }
771 
772 void Client::moveButtons(const int width)
773 {
774  if (mSetupButton != nullptr)
775  {
776  int x = width - mSetupButton->getWidth() - mButtonPadding;
778 #ifndef WIN32
781 
784 
787 
790 
793 #ifdef ANDROID
794  x -= mCloseButton->getWidth() + mButtonSpacing;
795  mCloseButton->setPosition(x, mButtonPadding);
796 #endif // ANDROID
797 #endif // WIN32
798  }
799 }
800 
801 void Client::windowRemoved(const Window *const window)
802 {
803  if (mCurrentDialog == window)
804  mCurrentDialog = nullptr;
805 }
806 
808 {
809  if (mCurrentDialog != nullptr)
810  {
812  }
813 }
814 
816 {
817 }
818 
820 {
821 #ifdef ANDROID
822  logger->log("APPDIR: %s", getenv("APPDIR"));
823  logger->log("DATADIR2: %s", getSdStoragePath().c_str());
824 #endif // ANDROID
825 }
826 
828 {
829 }
830 
832 {
833  return 0;
834 }
835 
837 {
838  const std::string &name = settings.serverName;
839  if (name == "server.themanaworld.org"
840  || name == "themanaworld.org"
841  || name == "167.114.185.71")
842  {
843  return true;
844  }
845  return false;
846 }
847 
849 {
850 }
Definition: logger.h:67
void setSize(const int width, const int height)
Definition: widget.cpp:366
void gameInit()
Definition: client.cpp:168
Configuration branding
void testsClear()
Definition: client.cpp:163
const bool UseVirtFs_false
Definition: usevirtfs.h:29
bool deinit()
Definition: fs.cpp:784
std::string test
Definition: options.h:87
static bool isTmw()
Definition: client.cpp:836
Uint32 SDL_framerateDelay(FPSmanager *manager)
Delay execution to maintain a constant framerate and calculate fps.
void slowLogic()
Definition: gui.cpp:322
#define _(s)
Definition: gettext.h:34
const bool SkipError_false
Definition: skiperror.h:29
void logic()
Definition: gui.cpp:301
int getWidth() const
Definition: widget.h:220
void log1(const char *const log_text)
Definition: logger.cpp:233
StateT mOldState
Definition: client.h:112
ImageHelper * imageHelper
Definition: imagehelper.cpp:43
std::string logFileName
Definition: options.h:82
int packetVersion
Definition: client.cpp:124
std::string updatesDir
Definition: settings.h:108
std::string serverName
Definition: settings.h:112
static void storeSafeParameters()
unsigned int tmwServerVersion
Definition: client.cpp:132
#define PROFILER_END()
Definition: perfomance.h:77
volatile bool runCounters
Definition: client.cpp:121
volatile int tick_time
Definition: timer.cpp:52
Gui * gui
Definition: gui.cpp:110
void setState(const StateT state)
Definition: client.h:65
time_t start_time
Definition: client.cpp:133
Joystick * joystick
Definition: joystick.cpp:42
static void extractDataDir()
Definition: dirs.cpp:178
WindowContainer * windowContainer
PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wunused-result") int TestLauncher
bool mountDir(std::string newDir, const Append append)
Definition: fs.cpp:392
void setBrandingDefaults(Configuration &cfg)
Definition: defaults.cpp:474
void init()
Definition: playerinfo.cpp:431
Options options
Definition: settings.h:128
static void initLang()
static void deleteRenderers()
int textures_count
Definition: client.cpp:136
static void backupConfig(const std::string &name)
int mButtonPadding
Definition: client.h:115
int packetVersionZero
Definition: client.cpp:127
volatile int frame_count
Definition: timer.cpp:55
std::string pathJoin(std::string str1, const std::string &str2)
Definition: window.h:98
bool packets_main
Definition: client.cpp:129
bool packets_zero
Definition: client.cpp:131
#define BLOCK_START(name)
Definition: perfomance.h:78
Definition: button.h:96
SoundManager soundManager
Button * mVideoButton
Definition: client.h:102
Configuration config
void clear()
Definition: playerinfo.cpp:449
static std::string getThemePath()
Definition: theme.h:66
static void updateDataPath()
Definition: dirs.cpp:160
static void initFunctions()
Definition: dyepalette.cpp:252
PopupManager * popupManager
bool limitFps
Definition: settings.h:151
Skin * load(const std::string &filename, const std::string &filename2, const bool full, const std::string &defaultPath)
Definition: theme.cpp:178
#define BLOCK_END(name)
Definition: perfomance.h:79
IPC * ipc
Definition: ipc.cpp:36
static void selectSkin()
Definition: theme.cpp:597
virtual void updateScreen()=0
int getIntValue(const std::string &key) const
std::string brandingPath
Definition: options.h:78
void draw()
Definition: gui.cpp:469
StateT mState
Definition: client.h:111
bool packets_re
Definition: client.cpp:130
Client * client
Definition: client.cpp:117
#define CREATEWIDGETV(var, type,...)
Definition: createwidget.h:24
#define delete2(var)
Definition: delete2.h:24
const Image *restrict const top
Configuration serverConfig
Definition: gui.h:115
int getWidth() const
Definition: graphics.cpp:642
int getOption(const std::string &name) const
Definition: skin.h:105
Logger * logger
Definition: logger.cpp:88
std::string localDataDir
Definition: settings.h:110
void searchAndAddArchives(const std::string &path, const std::string &ext, const Append append)
Definition: tools.cpp:40
void postInit(Graphics *const graphics)
Definition: gui.cpp:150
Button * mAboutButton
Definition: client.h:104
void testsInit()
Definition: client.cpp:159
void update()
Definition: joystick.cpp:350
std::string errorMessage
Definition: client.cpp:115
Settings settings
Definition: settings.cpp:31
int getPadding() const
Definition: skin.h:99
bool safeMode
Definition: options.h:97
const bool UseVirtFs_true
Definition: usevirtfs.h:29
bool getBoolValue(const std::string &key) const
volatile int logic_count
Definition: timer.cpp:56
FPSmanager fpsManager
bool handleInput()
Definition: gui.cpp:387
std::string logFileName
Definition: settings.h:120
virtual void beginDraw()
Definition: graphics.h:440
virtual void requestFocus()
Definition: widget.cpp:203
const std::string BUTTON_SKIN
Definition: button.h:88
const std::string & getConfigPath() const
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
void setFramerate(const unsigned int fpsLimit)
Button * mSetupButton
Definition: client.h:101
static void initRootDir()
Definition: dirs.cpp:265
void startTimers()
Definition: timer.cpp:112
void updateScreenKeyboard(const int height)
static void cleanUp()
Definition: graphics.cpp:158
void setLogLevel(const int level)
Definition: sdlhelper.cpp:190
void safeError(const std::string &error_text) __attribute__((noreturn))
Definition: logger.cpp:430
int getHeight() const
Definition: graphics.cpp:647
virtual void add(Widget *const widget)
void moveButtons(const int width)
Definition: client.cpp:772
void setDebugLog(const bool n)
Definition: logger.h:180
int gameExec()
Definition: client.cpp:575
static void loadCurrentLang()
bool skipUpdate
Definition: options.h:94
#define nullptr
Definition: localconsts.h:44
Graphics * mainGraphics
Definition: graphics.cpp:108
void setSfxVolume(const int volume)
Definition: theme.h:52
void setPosition(const int x, const int y)
Definition: widget.cpp:160
static int testsExec()
Definition: client.cpp:831
#define PRAGMA48(str)
Definition: localconsts.h:190
unsigned int mLastHost
Definition: client.cpp:134
#define PROFILER_START()
Definition: perfomance.h:76
volatile time_t cur_time
Definition: timer.cpp:57
#define FULL_VERSION
Definition: main.h:163
void initSoundManager()
Definition: client.cpp:388
Definition: client.h:48
std::string dataPath
Definition: options.h:80
void setMusicVolume(const int volume)
void slowLogic()
Definition: client.cpp:827
EventsManager eventsManager
void focusWindow()
Definition: client.cpp:807
int serverVersion
Definition: client.cpp:123
bool handleEvents() const
void initRand()
Definition: mrand.cpp:34
Structure holding the state and timing information of the framerate controller.
Configuration paths
bool isSafeMode
Definition: client.cpp:122
void playMusic(const std::string &fileName, const SkipError skipError)
const bool Append_false
Definition: append.h:29
void stateGame()
Definition: client.cpp:533
std::string getValue(const std::string &key, const std::string &deflt) const
Theme * theme
Definition: theme.cpp:61
Window * mCurrentDialog
Definition: client.h:100
Widget * getTop() const
Definition: gui.h:247
Skin * mSkin
Definition: client.h:114
bool testMode
Definition: options.h:98
bool setWriteDir(const std::string &newDir)
Definition: fs.cpp:330
int packetVersionRe
Definition: client.cpp:126
void reloadWallpaper()
Definition: desktop.cpp:121
void initLogger()
Definition: sdlhelper.cpp:186
Client()
Definition: client.cpp:138
Button * mPerfomanceButton
Definition: client.h:106
void windowRemoved(const Window *const window)
Definition: client.cpp:801
~Client()
Definition: client.cpp:380
void detect()
Definition: cpu.cpp:45
Button * mThemesButton
Definition: client.h:105
void stopTimers()
Definition: timer.cpp:120
void setLogFile(const std::string &logFilename)
Definition: logger.cpp:119
static void mountDataDir()
Definition: dirs.cpp:197
void SDL_initFramerate(FPSmanager *manager)
Initialize the framerate manager.
virtual void postInit()
Definition: graphics.h:461
#define ADDBUTTON(var, object)
Definition: client.cpp:528
void setConfigDefaults2(Configuration &cfg)
Definition: defaults.cpp:427
KeyboardConfig keyboard
static void logVars()
Definition: client.cpp:819
void gameClear()
Definition: client.cpp:433
static void initGraphics()
Definition: client.cpp:411
static void initScreenshotDir()
Definition: dirs.cpp:539
InputManager inputManager
TouchManager touchManager
void error(const std::string &error_text) __attribute__((noreturn))
Definition: logger.cpp:467
void allowScreenSaver(const bool allow)
Definition: sdlhelper.cpp:209
static void loadDictionaryLang()
Button * mHelpButton
Definition: client.h:103
void log(const char *const log_text,...)
Definition: logger.cpp:264
int packetVersionMain
Definition: client.cpp:125
const bool SkipError_true
Definition: skiperror.h:29
Desktop * desktop
Definition: desktop.cpp:48
unsigned long mSearchHash
Definition: client.cpp:135
void cleanupXML()
Definition: libxml.cpp:314
void action(const ActionEvent &event)
Definition: client.cpp:730
static void initConfiguration()
DialogsManager * dialogsManager
void updateEnv()
Definition: env.cpp:29
void incValue(const std::string &key)
void init(const std::string &filename, const UseVirtFs useResManager, const SkipError skipError)
virtual void postInit()
Definition: imagehelper.h:109
Definition: state.h:32
GraphicsManager graphicsManager
void executeAction(const InputActionT keyNum)
static void init()
Definition: joystick.cpp:72
void setReportUnimplemented(const bool n)
Definition: logger.h:183
static void initHomeDir()
Definition: dirs.cpp:329
int mButtonSpacing
Definition: client.h:116
static void checkConfigVersion()
void updatePinState()
Definition: client.cpp:815
static void initPaths()
Definition: client.cpp:848
int packetsType
Definition: client.cpp:128
void setPathsDefaults(Configuration &cfg)
Definition: defaults.cpp:534