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 int itemIdLen = 2;
130 bool packets_main = true;
131 bool packets_re = false;
132 bool packets_zero = false;
133 unsigned int tmwServerVersion = 0;
134 time_t start_time;
135 unsigned int mLastHost = 0;
136 unsigned long mSearchHash = 0;
138 
140  ActionListener(),
141  mCurrentDialog(nullptr),
142  mSetupButton(nullptr),
143  mVideoButton(nullptr),
144  mHelpButton(nullptr),
145  mAboutButton(nullptr),
146  mThemesButton(nullptr),
147  mPerfomanceButton(nullptr),
148 #ifdef ANDROID
149  mCloseButton(nullptr),
150 #endif // ANDROID
151  mState(State::GAME),
152  mOldState(State::START),
153  mSkin(nullptr),
154  mButtonPadding(1),
155  mButtonSpacing(3)
156 {
158 }
159 
161 {
162 }
163 
165 {
166 }
167 
168 // +++ need remove duplicate from here
170 {
171  logger = new Logger;
172  SDL::initLogger();
173 
174  initRand();
175 
176  // Load branding information
177  if (!settings.options.brandingPath.empty())
178  {
182  }
184 
187 
188  // Configure logger
189  if (!settings.options.logFileName.empty())
190  {
192  }
193  else
194  {
196  "manaplus.log");
197  }
199 
200 #ifdef USE_FUZZER
201  Fuzzer::init();
202 #endif // USE_FUZZER
203 
204  if (settings.options.test.empty())
205  ConfigManager::backupConfig("config.xml");
207  SDL::setLogLevel(config.getIntValue("sdlLogLevel"));
209  initPaths();
210  logger->log("init 4");
211  logger->setDebugLog(config.getBoolValue("debugLog"));
212  logger->setReportUnimplemented(config.getBoolValue("unimplimentedLog"));
213 
214  config.incValue("runcount");
215 
216 #ifndef ANDROID
217  if (settings.options.test.empty())
219 #endif // ANDROID
220 
222  {
223  logger->error(strprintf("%s couldn't be set as home directory! "
224  "Exiting.", settings.localDataDir.c_str()));
225  }
226 
228 
229 /*
230  chatLogger = new ChatLogger;
231  if (settings.options.chatLogDir.empty())
232  {
233  chatLogger->setBaseLogDir(settings.localDataDir
234  + std::string("/logs/"));
235  }
236  else
237  {
238  chatLogger->setBaseLogDir(settings.options.chatLogDir);
239  }
240 */
241  // Log the client version
243  logger->log("Start configPath: " + config.getConfigPath());
244 
246 
247  // Initialize SDL
248  logger->log1("Initializing SDL...");
249  if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
250  {
251  logger->safeError(strprintf("Could not initialize SDL: %s",
252  SDL_GetError()));
253  }
254  atexit(SDL_Quit);
255 
256 #ifndef USE_SDL2
257  SDL_EnableUNICODE(1);
258 #endif // USE_SDL2
259 
263 
264 #ifdef WIN32
266 #endif // WIN32
267 #ifndef USE_SDL2
269 #endif // USE_SDL2
270 
272  logVars();
273  Cpu::detect();
275 #if defined(USE_OPENGL)
276 #if !defined(ANDROID) && !defined(__APPLE__) && !defined(__native_client__)
277  if (!settings.options.safeMode && settings.options.test.empty()
278  && !config.getBoolValue("videodetected"))
279  {
281  }
282 #endif // !defined(ANDROID) && !defined(__APPLE__) &&
283  // !defined(__native_client__)
284 #endif // defined(USE_OPENGL)
285 
286  updateEnv();
287  SDL::allowScreenSaver(config.getBoolValue("allowscreensaver"));
288  initGraphics();
289 
290 #ifndef WIN32
293 #endif // WIN32
294 
296 
297  // Add the main data directories to our VirtFs search path
298  if (!settings.options.dataPath.empty())
299  {
301  Append_false);
302  }
303 
304  // Add the local data directory to VirtFs search path
306  Append_false);
309 #ifdef ENABLE_CUSTOMNLS
310  TranslationManager::loadGettextLang();
311 #endif // ENABLE_CUSTOMNLS
312 
313 #ifdef USE_SDL2
315 #endif // USE_SDL2
317 
319 
320  theme = new Theme;
322  touchManager.init();
323 
324  // Initialize the item and emote shortcuts.
325 // for (size_t f = 0; f < SHORTCUT_TABS; f ++)
326 // itemShortcut[f] = new ItemShortcut(f);
327 // emoteShortcut = new EmoteShortcut;
328 // dropShortcut = new DropShortcut;
329 
330  gui = new Gui;
334 
336 
337  // Initialize keyboard
338  keyboard.init();
339  inputManager.init();
340 
341  // Initialise player relations
342  Joystick::init();
344 
345  keyboard.update();
346  if (joystick != nullptr)
347  joystick->update();
348 
349 // if (mState != State::ERROR)
350 // mState = State::CHOOSE_SERVER;
351 
352  startTimers();
353 
354  const int fpsLimit = config.getIntValue("fpslimit");
355  settings.limitFps = fpsLimit > 0;
356 
357  SDL_initFramerate(&fpsManager);
358  WindowManager::setFramerate(fpsLimit);
359 
360  start_time = time(nullptr);
361 
362 // PlayerInfo::init();
363 
364 #ifdef ANDROID
365 #ifndef USE_SDL2
366  WindowManager::updateScreenKeyboard(SDL_GetScreenKeyboardHeight(nullptr));
367 #endif // USE_SDL2
368 #endif // ANDROID
369 
370  mSkin = theme->load("windowmenu.xml",
371  "",
372  true,
374  if (mSkin != nullptr)
375  {
377  mButtonSpacing = mSkin->getOption("spacing", 3);
378  }
379 }
380 
382 {
384  gameClear();
385  else
386  testsClear();
387 }
388 
390 {
391  // Initialize sound engine
392  try
393  {
394  if (config.getBoolValue("sound"))
395  soundManager.init();
396 
399  }
400  catch (const char *const err)
401  {
403  errorMessage = err;
404  logger->log("Warning: %s", err);
405  }
407  "loginMusic",
408  "Magick - Real.ogg"),
410 }
411 
413 {
414 #ifndef USE_SDL2
416 #endif // USE_SDL2
417 
418  runCounters = config.getBoolValue("packetcounters");
419 
421 
422 #ifdef USE_SDL2
424 #endif // USE_SDL2
425 
430 
432 }
433 
435 {
436  if (logger != nullptr)
437  logger->log1("Quitting1");
438 
441  if (windowContainer != nullptr)
443 
444  stopTimers();
445 
446  delete2(ipc);
447 
448  if (logger != nullptr)
449  logger->log1("Quitting2");
450 
454  delete2(gui);
455 
456  if (logger != nullptr)
457  logger->log1("Quitting3");
458 
460 
461  if (logger != nullptr)
462  logger->log1("Quitting4");
463 
464  XML::cleanupXML();
465 
466  if (logger != nullptr)
467  logger->log1("Quitting5");
468 
470 
471  if (logger != nullptr)
472  logger->log1("Quitting6");
473 
476 
478 
479  if (logger != nullptr)
480  logger->log1("Quitting8");
481 
483 
484  if (logger != nullptr)
485  logger->log1("Quitting9");
486 
487  delete2(joystick);
488 
489  keyboard.deinit();
490 
491  if (logger != nullptr)
492  logger->log1("Quitting10");
493 
495 
496 #ifdef DEBUG_CONFIG
497  config.enableKeyLogging();
498 #endif // DEBUG_CONFIG
499 
501  config.write();
503 
504  config.clear();
506 
507  if (logger != nullptr)
508  logger->log1("Quitting11");
509 
510 #ifdef USE_PROFILER
512 #endif // USE_PROFILER
513 
514 #ifdef DEBUG_OPENGL_LEAKS
515  if (logger)
516  logger->log("textures left: %d", textures_count);
517 #endif // DEBUG_OPENGL_LEAKS
518 
520 
521  if (logger != nullptr)
522  logger->log1("Quitting12");
523 
524 // delete2(chatLogger);
526  VirtFs::deinit();
527 }
528 
529 #define ADDBUTTON(var, object) var = object; \
530  x -= var->getWidth() + mButtonSpacing; \
531  var->setPosition(x, mButtonPadding); \
532  top->add(var);
533 
535 {
536  if (gui == nullptr)
537  return;
538 
539  BasicContainer2 *const top = static_cast<BasicContainer2*>(
540  gui->getTop());
541 
542  if (top == nullptr)
543  return;
544 
545  CREATEWIDGETV(desktop, Desktop, nullptr);
546  top->add(desktop);
547  int x = top->getWidth() - mButtonPadding;
549  // TRANSLATORS: setup tab quick button
550  _("Setup"), "Setup", BUTTON_SKIN, this))
552  // TRANSLATORS: perfoamance tab quick button
553  _("Performance"), "Perfomance", BUTTON_SKIN, this))
555  // TRANSLATORS: video tab quick button
556  _("Video"), "Video", BUTTON_SKIN, this))
558  // TRANSLATORS: theme tab quick button
559  _("Theme"), "Themes", BUTTON_SKIN, this))
561  // TRANSLATORS: theme tab quick button
562  _("About"), "about", BUTTON_SKIN, this))
564  // TRANSLATORS: theme tab quick button
565  _("Help"), "help", BUTTON_SKIN, this))
566 #ifdef ANDROID
567  ADDBUTTON(mCloseButton, new Button(desktop,
568  // TRANSLATORS: close quick button
569  _("Close"), "close", BUTTON_SKIN, this))
570 #endif // ANDROID
571 
574 }
575 
577 {
578  int lastTickTime = tick_time;
579 
580  while (mState != State::EXIT)
581  {
582  PROFILER_START();
584  continue;
585 
586  BLOCK_START("Client::gameExec 4")
587  if (gui != nullptr)
588  gui->logic();
589  cur_time = time(nullptr);
590  int k = 0;
591  while (lastTickTime != tick_time && k < 40)
592  {
593 // if (mGame)
594 // mGame->logic();
595 // else
596  if (gui != nullptr)
597  gui->handleInput();
598 
599  ++lastTickTime;
600  k ++;
601  }
603 
604  logic_count += k;
605  if (gui != nullptr)
606  gui->slowLogic();
607 // if (mGame)
608 // mGame->slowLogic();
609  slowLogic();
610  BLOCK_END("Client::gameExec 4")
611 
612  // This is done because at some point tick_time will wrap.
613  lastTickTime = tick_time;
614 
615  // Update the screen when application is visible, delay otherwise.
617  {
618  frame_count++;
619  if (gui != nullptr)
620  gui->draw();
622  }
623  else
624  {
625  SDL_Delay(100);
626  }
627 
628  BLOCK_START("~Client::SDL_framerateDelay")
629  if (settings.limitFps)
630  SDL_framerateDelay(&fpsManager);
631  BLOCK_END("~Client::SDL_framerateDelay")
632 
633  BLOCK_START("Client::gameExec 6")
634 /*
635  if (mState == State::CONNECT_GAME)
636  {
637  stateConnectGame1();
638  }
639 */
640  BLOCK_END("Client::gameExec 6")
641 
642  if (mState != mOldState)
643  {
644  BLOCK_START("Client::gameExec 7")
645 
646  mOldState = mState;
647 
648  // Get rid of the dialog of the previous state
650 
651  // State has changed, while the quitDialog was active, it might
652  // not be correct anymore
653 /*
654  if (mQuitDialog)
655  {
656  mQuitDialog->scheduleDelete();
657  mQuitDialog = nullptr;
658  }
659 */
660  BLOCK_END("Client::gameExec 7")
661 
662  BLOCK_START("Client::gameExec 8")
663  PRAGMA45(GCC diagnostic push)
664  PRAGMA45(GCC diagnostic ignored "-Wswitch-enum")
665  switch (mState)
666  {
667  case State::GAME:
668  stateGame();
669  break;
670 
671  case State::LOAD_DATA:
672  {
673  BLOCK_START("Client::gameExec State::LOAD_DATA")
674  logger->log1("State: LOAD DATA");
675 
676  // If another data path has been set,
677  // we don't load any other files...
678  if (settings.options.dataPath.empty())
679  {
680  // Add customdata directory
682  "customdata/",
683  "zip",
684  Append_false);
685  }
686 
688  {
690  settings.updatesDir, "local/"),
691  "zip",
692  Append_false);
693 
697  "local/"),
698  Append_false);
699  }
700 
701  logger->log("Init paths");
702  paths.init("paths.xml",
706  initPaths();
709 
710  if (desktop != nullptr)
712 
714  BLOCK_END("Client::gameExec State::LOAD_DATA")
715  break;
716  }
717  case State::START:
718  default:
720  break;
721  }
722  PRAGMA45(GCC diagnostic pop)
723  BLOCK_END("Client::gameExec 8")
724  }
725  PROFILER_END();
726  }
727 
728  return 0;
729 }
730 
731 void Client::action(const ActionEvent &event)
732 {
733  std::string tab;
734  const std::string &eventId = event.getId();
735 
736  if (eventId == "close")
737  {
739  return;
740  }
741  if (eventId == "Setup")
742  {
743  tab.clear();
744  }
745  else if (eventId == "help")
746  {
748  return;
749  }
750  else if (eventId == "about")
751  {
753  return;
754  }
755  else if (eventId == "Video")
756  {
757  tab = "Video";
758  }
759  else if (eventId == "Themes")
760  {
761  tab = "Theme";
762  }
763  else if (eventId == "Perfomance")
764  {
765  tab = "Perfomance";
766  }
767  else
768  {
769  return;
770  }
771 }
772 
773 void Client::moveButtons(const int width)
774 {
775  if (mSetupButton != nullptr)
776  {
777  int x = width - mSetupButton->getWidth() - mButtonPadding;
779 #ifndef WIN32
782 
785 
788 
791 
794 #ifdef ANDROID
795  x -= mCloseButton->getWidth() + mButtonSpacing;
796  mCloseButton->setPosition(x, mButtonPadding);
797 #endif // ANDROID
798 #endif // WIN32
799  }
800 }
801 
802 void Client::windowRemoved(const Window *const window)
803 {
804  if (mCurrentDialog == window)
805  mCurrentDialog = nullptr;
806 }
807 
809 {
810  if (mCurrentDialog != nullptr)
811  {
813  }
814 }
815 
817 {
818 }
819 
821 {
822 #ifdef ANDROID
823  logger->log("APPDIR: %s", getenv("APPDIR"));
824  logger->log("DATADIR2: %s", getSdStoragePath().c_str());
825 #endif // ANDROID
826 }
827 
829 {
830 }
831 
833 {
834  return 0;
835 }
836 
838 {
839  const std::string &name = settings.serverName;
840  if (name == "server.themanaworld.org"
841  || name == "themanaworld.org"
842  || name == "167.114.185.71")
843  {
844  return true;
845  }
846  return false;
847 }
848 
850 {
851 }
Definition: logger.h:67
void setSize(const int width, const int height)
Definition: widget.cpp:366
void gameInit()
Definition: client.cpp:169
Configuration branding
void testsClear()
Definition: client.cpp:164
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:837
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
int itemIdLen
Definition: client.cpp:129
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:133
#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:134
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:432
Options options
Definition: settings.h:128
static void initLang()
static void deleteRenderers()
int textures_count
Definition: client.cpp:137
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:130
bool packets_zero
Definition: client.cpp:132
#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:450
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:131
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:160
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:773
void setDebugLog(const bool n)
Definition: logger.h:180
int gameExec()
Definition: client.cpp:576
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:832
#define PRAGMA48(str)
Definition: localconsts.h:198
unsigned int mLastHost
Definition: client.cpp:135
#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:389
Definition: client.h:48
std::string dataPath
Definition: options.h:80
void setMusicVolume(const int volume)
void slowLogic()
Definition: client.cpp:828
EventsManager eventsManager
void focusWindow()
Definition: client.cpp:808
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:534
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:139
Button * mPerfomanceButton
Definition: client.h:106
void windowRemoved(const Window *const window)
Definition: client.cpp:802
~Client()
Definition: client.cpp:381
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:529
void setConfigDefaults2(Configuration &cfg)
Definition: defaults.cpp:427
KeyboardConfig keyboard
static void logVars()
Definition: client.cpp:820
void gameClear()
Definition: client.cpp:434
static void initGraphics()
Definition: client.cpp:412
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:136
void cleanupXML()
Definition: libxml.cpp:314
void action(const ActionEvent &event)
Definition: client.cpp:731
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:816
static void initPaths()
Definition: client.cpp:849
int packetsType
Definition: client.cpp:128
void setPathsDefaults(Configuration &cfg)
Definition: defaults.cpp:534