131 #include "utils/perfstat.h"
134 #include "utils/timer.h"
150 PRAGMA48(GCC diagnostic ignored
"-Wshadow")
151 #include <SDL_syswm.h>
153 #include "fs/specialfolder.h"
160 PRAGMA48(GCC diagnostic ignored
"-Wshadow")
161 #include <SDL_screenkeyboard.h>
167 #include <sys/stat.h>
174 PRAGMA48(GCC diagnostic ignored
"-Wshadow")
178 #include <SDL_framerate.h>
263 mConfigAutoSaved(false)
307 #ifndef ENABLE_COMMANDLINEPASSWORD
311 logger->
log(
"Command line password parameter disabled.");
366 + std::string(
"/logs/"));
386 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
396 SDL_EnableUNICODE(1);
414 #if defined(USE_OPENGL)
415 #if !defined(ANDROID) && !defined(__APPLE__)
416 #if !defined(__native_client__) && !defined(__SWITCH__) && !defined(UNITTESTS)
454 #ifdef ENABLE_CUSTOMNLS
455 TranslationManager::loadGettextLang();
557 mumbleManager =
new MumbleManager;
564 if (
mSkin !=
nullptr)
609 catch (
const char *
const err)
751 config.enableKeyLogging();
768 #ifdef DEBUG_OPENGL_LEAKS
793 return launcher.exec();
801 #define ADDBUTTON(var, object) var = object; \
802 x -= var->getWidth() + mButtonSpacing; \
803 var->setPosition(x, mButtonPadding); \
852 "enableRemoteCommands", 1) != 0);
993 if (
mGame !=
nullptr)
995 else if (
gui !=
nullptr)
1014 if (
mGame !=
nullptr)
1109 BLOCK_START(
"Client::gameExec STATE_CHOOSE_SERVER")
1118 settings.options.serverPort == 0 &&
1138 BLOCK_END(
"Client::gameExec STATE_CHOOSE_SERVER")
1148 _("Connecting to server"),
1165 theme->setMinimumOpacity(0.8F);
1173 logger->
log(
"Preconfigured packet version: %d",
1199 BLOCK_END(
"Client::gameExec State::LOGIN")
1222 BLOCK_END(
"Client::gameExec State::WORLD_SELECT")
1232 else if (worlds.size() == 1)
1249 BLOCK_END(
"Client::gameExec State::WORLD_SELECT")
1257 _("Entering game world"),
1271 Dirs::initUpdatesDir();
1299 BLOCK_END(
"Client::gameExec State::UPDATE")
1318 _("Requesting characters"),
1330 theme->setMinimumOpacity(0.8F);
1340 ->selectByName(
settings.options.character,
1354 BLOCK_END(
"Client::gameExec State::CHAR_SELECT")
1362 _("Connecting to the game server"),
1374 _("Changing game servers"),
1385 logger->
log(
"Memorizing selected character %s",
1424 BLOCK_END(
"Client::gameExec State::GAME")
1470 _("Requesting registration details"),
1508 BLOCK_END(
"Client::gameExec State::CHANGEPASSWORD_ATTEMPT")
1519 _("Password changed successfully!"),
1554 _("Email changed successfully!"),
1586 BLOCK_END(
"Client::gameExec State::SWITCH_SERVER")
1606 BLOCK_END(
"Client::gameExec State::SWITCH_LOGIN")
1650 #ifdef SAVE_PASSWORD
1670 BLOCK_END(
"Client::gameExec State::ERROR")
1717 if (name ==
"fpslimit")
1723 else if (name ==
"guialpha" ||
1724 name ==
"enableGuiOpacity")
1731 else if (name ==
"gamma" ||
1732 name ==
"enableGamma")
1736 else if (name ==
"particleEmitterSkip")
1741 else if (name ==
"vsync")
1745 else if (name ==
"repeateInterval" ||
1746 name ==
"repeateDelay")
1755 const std::string &eventId =
event.getId();
1757 if (eventId ==
"close")
1762 if (eventId ==
"Setup")
1766 else if (eventId ==
"help")
1771 else if (eventId ==
"about")
1776 else if (eventId ==
"Video")
1780 else if (eventId ==
"Themes")
1784 else if (eventId ==
"Perfomance")
1825 "playerNameOffset");
1827 "playerBadgeAtRightOffset");
1834 const std::string tradeListName =
1837 std::ofstream tradeFile;
1838 struct stat statbuf;
1840 if ((stat(tradeListName.c_str(), &statbuf) != 0) ||
1841 !S_ISREG(statbuf.st_mode))
1843 tradeFile.open(tradeListName.c_str(),
1845 if (tradeFile.is_open())
1847 tradeFile <<
": sell" << std::endl;
1848 tradeFile <<
": buy" << std::endl;
1849 tradeFile <<
": trade" << std::endl;
1850 tradeFile <<
"i sell" << std::endl;
1851 tradeFile <<
"i buy" << std::endl;
1852 tradeFile <<
"i trade" << std::endl;
1853 tradeFile <<
"i trading" << std::endl;
1854 tradeFile <<
"i am buy" << std::endl;
1855 tradeFile <<
"i am sell" << std::endl;
1856 tradeFile <<
"i am trade" << std::endl;
1857 tradeFile <<
"i am trading" << std::endl;
1858 tradeFile <<
"i'm buy" << std::endl;
1859 tradeFile <<
"i'm sell" << std::endl;
1860 tradeFile <<
"i'm trade" << std::endl;
1861 tradeFile <<
"i'm trading" << std::endl;
1866 tradeListName.c_str())
1875 if (name ==
"server.themanaworld.org" ||
1876 name ==
"themanaworld.org" ||
1877 name ==
"167.114.129.72")
1936 if (dialog !=
nullptr)
1943 logger->
log(
"APPDIR: %s", getenv(
"APPDIR"));
1944 logger->
log(
"DATADIR2: %s", getSdStoragePath().c_str());
void SDL_initFramerate(FPSmanager *manager)
Initialize the framerate manager.
Uint32 SDL_framerateDelay(FPSmanager *manager)
Delay execution to maintain a constant framerate and calculate fps.
AssertListener * assertListener
#define fromBool(val, name)
Net::CharServerHandler * charServerHandler
Net::ChatHandler * chatHandler
#define reportAlways(...)
static BeingInfo * unknown
const std::string & getName() const
void setServerName(const std::string &serverName)
void setBaseLogDir(const std::string &logDir)
void runValidate() __attribute__((noreturn))
void setState(const StateT state)
void action(const ActionEvent &event)
static void initFeatures()
void initConfigListeners()
static void stateConnectGame1()
Button * mPerfomanceButton
void windowRemoved(const Window *const window)
void moveButtons(const int width)
static void initGraphics()
static void initTradeFilter()
void stateConnectServer1()
void optionChanged(const std::string &name)
ServerInfo mCurrentServer
static void initServerConfig(const std::string &serverName)
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
std::string getStringValue(const std::string &key) const
float getFloatValue(const std::string &key) const
void addListener(const std::string &key, ConfigListener *const listener)
const std::string & getConfigPath() const
void setValue(const std::string &key, const std::string &value)
void incValue(const std::string &key)
void removeListeners(ConfigListener *const listener)
void init(const std::string &filename, const UseVirtFs useResManager, const SkipError skipError)
int getIntValue(const std::string &key) const
static Window * openErrorDialog(const std::string &header, const std::string &message, const Modal modal)
static void initRootDir()
static void initTempDir()
static void initConfigDir()
static void initHomeDir()
static void initLocalDataDir()
static void initUsersDir()
static void initScreenshotDir()
static void extractDataDir()
static void mountDataDir()
static void updateDataPath()
static void initFunctions()
static void prepareSlotNames()
bool handleEvents() const
static void clearInstance()
static void deleteRenderers()
void detectVideoSettings()
virtual void updateScreen()=0
void postInit(Graphics *const graphics)
static void clearGuilds()
static void setEnableAlpha(const bool n)
void log(const char *const log_text,...)
void log1(const char *const log_text)
void safeError(const std::string &error_text) __attribute__((noreturn))
void setReportUnimplemented(const bool n)
void error(const std::string &error_text) __attribute__((noreturn))
void setDebugLog(const bool n)
void setLogFile(const std::string &logFilename)
static std::string savedPassword
virtual void clear() const =0
virtual void ping() const =0
virtual void clear() const =0
static unsigned long adlerBuffer(const char *const buffer, int size)
virtual void disconnect() const =0
virtual bool isConnected() const =0
virtual void clear() const =0
virtual bool mustPing() const =0
virtual void reloadPartially() const =0
virtual void flushSend() const =0
virtual void clear() const =0
virtual void clear() const =0
virtual void chooseServer(unsigned int server, const bool persistentIp) const =0
virtual void logout() const =0
virtual void updatePacketVersion() const =0
virtual void connect() const =0
virtual void disconnect() const =0
virtual void clearWorlds() const =0
virtual void ping() const =0
virtual bool isConnected() const =0
virtual const Worlds & getWorlds() const =0
virtual void changePassword(const std::string &oldPassword, const std::string &newPassword) const =0
virtual void clear() const =0
static void clearDialogs()
static void clearParties()
std::vector< std::string > updateMirrors
std::string onlineListUrl
static ServerTypeT parseType(const std::string &serverType)
std::string onlineListUrl
unsigned int overweightPercent
std::string gmCharCommandSymbol
bool enableRemoteCommands
std::string linkCommandSymbol
std::string gmCommandSymbol
int playerBadgeAtRightOffset
std::vector< std::string > updateMirrors
bool unknownSkillsAutoTab
unsigned int fixedInventorySize
std::string serverConfigDir
void setVisible(Visible visible)
void activateTab(const std::string &name)
int getOption(const std::string &name) const
void playMusic(const std::string &fileName, const SkipError skipError)
void fadeOutMusic(const int ms)
void setSfxVolume(const int volume)
void setMusicVolume(const int volume)
int exec(const bool testAudio=true)
static std::string getThemePath()
Skin * load(const std::string &filename, const std::string &filename2, const bool full, const std::string &defaultPath)
void setMinimumOpacity(const float minimumOpacity)
static void loadCurrentLang()
static void loadDictionaryLang()
static void loadLocalUpdates(const std::string &dir)
static void loadDirMods(const std::string &dir)
static void unloadUpdates(const std::string &dir)
static void unloadMods(const std::string &dir)
bool isWindowVisible() const
virtual void scheduleDelete()
Configuration serverConfig
const unsigned int SHORTCUT_TABS
static const uint16_t DEFAULT_PORT
void setFeaturesDefaults(Configuration &cfg)
void setPathsDefaults(Configuration &cfg)
void setConfigDefaults2(Configuration &cfg)
void setBrandingDefaults(Configuration &cfg)
DialogsManager * dialogsManager
DropShortcut * dropShortcut
unsigned int tmwServerVersion
volatile bool runCounters
unsigned long mSearchHash
EmoteShortcut * emoteShortcut
ErrorListener errorListener
EventsManager eventsManager
Net::GameHandler * gameHandler
Net::GeneralHandler * generalHandler
const Image *restrict const top
GraphicsManager graphicsManager
Net::GuildHandler * guildHandler
ImageHelper * imageHelper
Net::InventoryHandler * inventoryHandler
ItemShortcut * itemShortcut[SHORTCUT_TABS]
#define A_DELETE_COPY(func)
LocalPlayer * localPlayer
Net::LoginHandler * loginHandler
volatile bool isTerminate
#define ADDBUTTON(var, object)
bool disconnect(InputEvent &event)
void connectToServer(const ServerInfo &server)
void stateChange(const StateT state)
bool cleanOrphans(const bool always)
void setLogLevel(const int level)
void allowScreenSaver(const bool allow)
int64_t write(File *const file, const void *const buffer, const uint32_t objSize, const uint32_t objCount)
bool unmountDirSilent(std::string oldDir)
void searchAndAddArchives(const std::string &path, const std::string &ext, const Append append)
bool setWriteDir(const std::string &newDir)
bool mountDir(std::string newDir, const Append append)
void searchAndRemoveArchives(const std::string &path, const std::string &ext)
void setFramerate(const unsigned int fpsLimit)
void deleteValidateWindows()
void updateScreenKeyboard(const int height)
void createValidateWindows()
anonymous_namespace{client.cpp}::AccountListener accountListener
anonymous_namespace{client.cpp}::LoginListener loginListener
Net::PartyHandler * partyHandler
#define BLOCK_START(name)
PincodeManager pincodeManager
PlayerRelationsManager playerRelations
SetupWindow * setupWindow
const bool ShowCenter_true
const bool SkipError_false
const bool SkipError_true
SoundManager soundManager
SpellManager * spellManager
SpellShortcut * spellShortcut
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.
static SpriteReference * Empty
int get_elapsed_time1(const int startTime)
TouchManager touchManager
UpdateType ::T UpdateTypeT
const bool UseVirtFs_false
const bool UseVirtFs_true
WindowContainer * windowContainer
std::vector< WorldInfo * > Worlds