diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index 3d8fbc75c..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(); @@ -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 @@ -1269,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 (); } diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index cc7902c29..b4b1296c9 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -2779,18 +2779,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 8ca6ab59c..51c4c189d 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) @@ -2723,7 +2733,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; @@ -2925,6 +2953,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 5b71b7965..7e9c37f26 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) 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; }