From 1dc3d51ce238b884270abb0527252e50ebeb49fe Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 11 Oct 2018 15:24:03 +0300 Subject: [PATCH 1/5] Added: save_ui action handler to save keys and icfg files --HG-- branch : develop --- .../client/src/interface_v3/group_map.cpp | 14 +--- .../src/interface_v3/interface_manager.cpp | 70 +++++++++++++++---- .../src/interface_v3/interface_manager.h | 4 ++ 3 files changed, 61 insertions(+), 27 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index 37a0a8a57..e6cfcf824 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -2665,18 +2665,8 @@ CCtrlButton *CGroupMap::addUserLandMark(const NLMISC::CVector2f &pos, const ucst addLandMark(_UserLM, pos, title, getUserLandMarkOptions((uint32)_CurContinent->UserLandMarks.size() - 1)); // Save the config file each time a user landmark is created - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - uint8 currMode = pIM->getMode(); - std::string filename = "save/interface_" + PlayerSelectedFileName + ".icfg"; - if (!CFile::fileExists(filename) && CFile::fileExists("save/shared_interface.icfg")) - { - filename = "save/shared_interface.icfg"; - } - pIM->saveConfig (filename); - if (currMode != pIM->getMode()) - { - pIM->setMode(currMode); - } + CInterfaceManager::getInstance()->saveConfig(); + return _UserLM.back(); } diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 6ec32a34d..debe0b9ab 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1270,32 +1270,19 @@ void CInterfaceManager::loadInterfaceConfig() // ------------------------------------------------------------------------------------------------ void CInterfaceManager::uninitInGame0 () { - // Autosave of the keys if (_KeysLoaded) { - if (!ClientCfg.R2EDEnabled) - { - string filename = "save/keys_" + PlayerSelectedFileName + ".xml"; - if (!CFile::fileExists(filename) && CFile::fileExists("save/shared_keys.xml")) - filename = "save/shared_keys.xml"; + saveKeys(); - saveKeys(filename); - } _KeysLoaded = false; } // Autosave of the interface in interface.cfg if (_ConfigLoaded) { - if (!ClientCfg.R2EDEnabled) - { - string filename = "save/interface_" + PlayerSelectedFileName + ".icfg"; - if (!CFile::fileExists(filename) && CFile::fileExists("save/shared_interface.icfg")) - filename = "save/shared_interface.icfg"; + saveConfig(); - saveConfig(filename); - } _ConfigLoaded = false; } } @@ -1884,6 +1871,29 @@ public: } }; +// ------------------------------------------------------------------------------------------------ +// +bool CInterfaceManager::saveConfig (bool verbose) +{ + bool ret = true; + + if (!ClientCfg.R2EDEnabled) + { + uint8 currMode = getMode(); + + string filename = "save/interface_" + PlayerSelectedFileName + ".icfg"; + if (!CFile::fileExists(filename) && CFile::fileExists("save/shared_interface.icfg")) + filename = "save/shared_interface.icfg"; + + if (verbose) CInterfaceManager::getInstance()->displaySystemInfo("Saving " + filename); + ret = saveConfig(filename); + + if (currMode != getMode()) + setMode(currMode); + } + + return ret; +} // ------------------------------------------------------------------------------------------------ bool CInterfaceManager::saveConfig (const string &filename) @@ -2722,7 +2732,25 @@ void writeMacros (xmlNodePtr node) } // *************************************************************************** +bool CInterfaceManager::saveKeys(bool verbose) +{ + bool ret = true; + + if (!ClientCfg.R2EDEnabled) + { + string filename = "save/keys_" + PlayerSelectedFileName + ".xml"; + if (!CFile::fileExists(filename) && CFile::fileExists("save/shared_keys.xml")) + filename = "save/shared_keys.xml"; + + if (verbose) CInterfaceManager::getInstance()->displaySystemInfo("Saving " + filename); + + ret = saveKeys(filename); + } + + return ret; +} +// *************************************************************************** bool CInterfaceManager::saveKeys(const std::string &filename) { bool ret = false; @@ -2924,6 +2952,18 @@ void CInterfaceManager::displayWebWindow(const string & name, const string & url CAHManager::getInstance()->runActionHandler("browse", NULL, "name="+name+":content:html|url="+url); } + +// *************************************************************************** +class CAHSaveUI : public IActionHandler +{ + virtual void execute (CCtrlBase *pCaller, const string &Params) + { + CInterfaceManager::getInstance()->saveKeys(true); + CInterfaceManager::getInstance()->saveConfig(true); + } +}; +REGISTER_ACTION_HANDLER (CAHSaveUI, "save_ui"); + /* // *************************************************************************** class CHandlerDispWebOnQuit : public IActionHandler diff --git a/code/ryzom/client/src/interface_v3/interface_manager.h b/code/ryzom/client/src/interface_v3/interface_manager.h index 93089a826..e83192a3d 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.h +++ b/code/ryzom/client/src/interface_v3/interface_manager.h @@ -205,10 +205,14 @@ public: // Load/Save position, size, etc.. of windows bool loadConfig (const std::string &filename); + // Save config to default location, if verbose is true, display message in game sysinfo + bool saveConfig (bool verbose = false); bool saveConfig (const std::string &filename); // delete the user config (give the player ident fileName) bool deletePlayerConfig (const std::string &playerFileIdent); + // Save keys to default location, if verbose is true, display message in game sysinfo + bool saveKeys (bool verbose = false); // Save the keys config file bool saveKeys (const std::string &filename); // delete the user Keysconfig (give the player ident fileName) From 2e7d025109d19035151a8549c0d4edeb595c416b Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sat, 17 Mar 2018 13:59:42 +0200 Subject: [PATCH 2/5] Changed: Use user requested resolution for both char select and ingame --HG-- branch : develop --- code/ryzom/client/src/connection.cpp | 36 ++++------------------------ 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index 3d8fbc75c..7fd707354 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -253,41 +253,13 @@ REGISTER_ACTION_HANDLER (CAHOnReloadTestPage, "on_reload_test_page"); // ------------------------------------------------------------------------------------------------ void setOutGameFullScreen() { - // Setup full screen (special 1024x768 for outgame) if we have to. - // NB: don't setup fullscreen if player wants to play in window if (!ClientCfg.Local && ClientCfg.SelectCharacter == -1) { if (StereoDisplayAttached) StereoDisplay->detachFromDisplay(); StereoDisplayAttached = false; - UDriver::CMode currMode; - Driver->getCurrentScreenMode(currMode); - UDriver::CMode wantedMode; - wantedMode.Windowed = true; - wantedMode.Width = 1024; - wantedMode.Height = 768; - wantedMode.Depth = uint8(ClientCfg.Depth); - wantedMode.Frequency = ClientCfg.Frequency; - - // change mode only if necessary - if ((wantedMode.Windowed != currMode.Windowed) || - (wantedMode.Width != currMode.Width) || - (wantedMode.Height != currMode.Height)) - { - setVideoMode(wantedMode); - } - InitMouseWithCursor(ClientCfg.HardwareCursor && !StereoDisplayAttached); - /* - InitMouseWithCursor (true); - Driver->showCursor(false); - Driver->showCursor(true); - Driver->clearBuffers(CRGBA::Black); - Driver->swapBuffers(); - Driver->showCursor(false); - Driver->showCursor(true); - */ } } @@ -307,8 +279,8 @@ bool connection (const string &cookie, const string &fsaddr) game_exit = false; - // Setup full screen (special 1024x768 for outgame) if we have to. - setOutGameFullScreen(); + // set resolution from cfg after login + connectionRestoreVideoMode (); // Preload continents { @@ -342,13 +314,14 @@ bool connection (const string &cookie, const string &fsaddr) // init the string manager cache. STRING_MANAGER::CStringManagerClient::instance()->initCache("", ClientCfg.LanguageCode); // VOIR BORIS #endif - connectionRestoreVideoMode (); return true; } ProgressBar.setFontFactor(1.0f); // Init out game + setOutGameFullScreen(); + ucstring nmsg("Initializing outgame..."); ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) ); pIM->initOutGame(); @@ -484,7 +457,6 @@ bool reconnection() game_exit = false; - // Setup full screen (special 1024x768 for outgame) if we have to. setOutGameFullScreen(); // Preload continents From ace1684f5c66a6318ad9bec17b661bb0fdb5e3f5 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 11 Oct 2018 21:51:00 +0300 Subject: [PATCH 3/5] Fixed: Ingame UI restored wrongly if window resized in char select mode --HG-- branch : develop --- code/ryzom/client/src/connection.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index 7fd707354..ec9f3dee8 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -1241,6 +1241,16 @@ TInterfaceState globalMenu() // Restore video mode if (ClientCfg.SelectCharacter == -1) { + if (ClientCfg.Windowed) + { + // if used changed window resolution in char select + // if we don't update ClientCfg, then UI from icfg is restored wrong + uint32 width, height; + Driver->getWindowSize(width, height); + ClientCfg.Width = width; + ClientCfg.Height = height; + } + connectionRestoreVideoMode (); } From 94861ac7090e2602fa3e708bb67f8a6ae99b9326 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 11 Oct 2018 21:54:02 +0300 Subject: [PATCH 4/5] Changed: Make sure char select window resolution is at least 1024x768 --HG-- branch : develop --- code/ryzom/client/src/connection.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index ec9f3dee8..ef1a491ab 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -201,9 +201,9 @@ void connectionRestoreVideoMode () mode.Height = height; } - // don't allow sizes smaller than 800x600 - if (ClientCfg.Width < 800) ClientCfg.Width = 800; - if (ClientCfg.Height < 600) ClientCfg.Height = 600; + // don't allow sizes smaller than 1024x768 + if (ClientCfg.Width < 1024) ClientCfg.Width = 1024; + if (ClientCfg.Height < 768) ClientCfg.Height = 768; if (StereoDisplay) StereoDisplayAttached = StereoDisplay->attachToDisplay(); From f4ef386ec9a86d6227a5ed3d3fab89ffb566aca7 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 11 Oct 2018 23:30:37 +0300 Subject: [PATCH 5/5] Changed: Limit fullscreen resolutions to 1024x768 or higher --HG-- branch : develop --- code/ryzom/client/src/misc.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/ryzom/client/src/misc.cpp b/code/ryzom/client/src/misc.cpp index 0f87b8037..97aaea128 100644 --- a/code/ryzom/client/src/misc.cpp +++ b/code/ryzom/client/src/misc.cpp @@ -1404,13 +1404,12 @@ bool getRyzomModes(std::vector &videoModes, std::vectorgetModes(videoModes); - // Remove modes under 800x600 and get the unique strings + // Remove modes under 1024x768 (outgame ui limitation) and get the unique strings sint i, j; for (i = 0; i < (sint)videoModes.size(); ++i) { - if ((videoModes[i].Width < 800) || (videoModes[i].Height < 600)) + if ((videoModes[i].Width < 1024) || (videoModes[i].Height < 768)) { - // discard modes under 800x600 videoModes.erase(videoModes.begin()+i); --i; }