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