mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 07:36:16 +00:00
Merge with develop
--HG-- branch : compatibility-develop
This commit is contained in:
commit
ddff1b4e5e
8 changed files with 86 additions and 39 deletions
|
@ -230,7 +230,7 @@ public:
|
|||
/** Get application directory.
|
||||
* \return directory where applications should write files.
|
||||
*/
|
||||
std::string getApplicationDirectory(const std::string &appName = "");
|
||||
std::string getApplicationDirectory(const std::string &appName = "", bool local = false);
|
||||
|
||||
/** Get a temporary directory.
|
||||
* \return temporary directory where applications should write files.
|
||||
|
@ -540,7 +540,7 @@ public:
|
|||
/** Get application directory.
|
||||
* \return directory where applications should write files.
|
||||
*/
|
||||
static std::string getApplicationDirectory(const std::string &appName = "");
|
||||
static std::string getApplicationDirectory(const std::string &appName = "", bool local = false);
|
||||
|
||||
/** Get a temporary directory.
|
||||
* \return temporary directory where applications should write files.
|
||||
|
|
|
@ -715,7 +715,7 @@ SOURCE_GROUP(Stereo FILES
|
|||
|
||||
NL_TARGET_LIB(nel3d ${HEADERS} ${SRC})
|
||||
|
||||
INCLUDE_DIRECTORIES(BEFORE ${FREETYPE_INCLUDE_DIRS})
|
||||
INCLUDE_DIRECTORIES(${FREETYPE_INCLUDE_DIRS})
|
||||
INCLUDE_DIRECTORIES(${LIBVR_INCLUDE_DIR})
|
||||
|
||||
TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARIES} ${LIBOVR_LIBRARIES} ${LIBVR_LIBRARY})
|
||||
|
|
|
@ -1777,19 +1777,29 @@ std::string CFileContainer::getWindowsDirectory()
|
|||
#endif
|
||||
}
|
||||
|
||||
std::string CPath::getApplicationDirectory(const std::string &appName)
|
||||
std::string CPath::getApplicationDirectory(const std::string &appName, bool local)
|
||||
{
|
||||
return getInstance()->_FileContainer.getApplicationDirectory(appName);
|
||||
return getInstance()->_FileContainer.getApplicationDirectory(appName, local);
|
||||
}
|
||||
|
||||
std::string CFileContainer::getApplicationDirectory(const std::string &appName)
|
||||
std::string CFileContainer::getApplicationDirectory(const std::string &appName, bool local)
|
||||
{
|
||||
static std::string appPath;
|
||||
static std::string appPaths[2];
|
||||
std::string &appPath = appPaths[local ? 1 : 0];
|
||||
if (appPath.empty())
|
||||
{
|
||||
#ifdef NL_OS_WINDOWS
|
||||
wchar_t buffer[MAX_PATH];
|
||||
#ifdef CSIDL_LOCAL_APPDATA
|
||||
if (local)
|
||||
{
|
||||
SHGetSpecialFolderPathW(NULL, buffer, CSIDL_LOCAL_APPDATA, TRUE);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
SHGetSpecialFolderPathW(NULL, buffer, CSIDL_APPDATA, TRUE);
|
||||
}
|
||||
appPath = CPath::standardizePath(ucstring((ucchar*)buffer).toUtf8());
|
||||
#elif defined(NL_OS_MAC)
|
||||
appPath = CPath::standardizePath(getenv("HOME"));
|
||||
|
|
|
@ -16,6 +16,7 @@ ADD_EXECUTABLE(ryzom_client_patcher ${SRC})
|
|||
INCLUDE_DIRECTORIES(
|
||||
${LIBXML2_INCLUDE_DIR}
|
||||
${CURL_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/ryzom/client/src
|
||||
)
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ uint32 LoginShardId = 0xFFFFFFFF;
|
|||
|
||||
CCmdArgs Args;
|
||||
|
||||
bool useUtf8 = false;
|
||||
bool useEsc = false;
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
@ -44,9 +43,6 @@ sint attributes = 0;
|
|||
|
||||
std::string convert(const ucstring &str)
|
||||
{
|
||||
if (useUtf8)
|
||||
return str.toUtf8();
|
||||
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
|
@ -97,29 +93,13 @@ void printDownload(const std::string &str)
|
|||
// temporary modified string
|
||||
std::string nstr = str;
|
||||
|
||||
uint length = 0;
|
||||
uint length = (uint)nstr.length();
|
||||
|
||||
if (useUtf8)
|
||||
{
|
||||
ucstring ucstr;
|
||||
ucstr.fromUtf8(nstr);
|
||||
length = (uint)ucstr.length();
|
||||
if (length > maxLength)
|
||||
{
|
||||
ucstr = ucstr.luabind_substr(length - maxLength + 3);
|
||||
nstr = std::string("...") + ucstr.toUtf8();
|
||||
length = maxLength;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
length = (uint)nstr.length();
|
||||
if (length > maxLength)
|
||||
{
|
||||
nstr = std::string("...") + nstr.substr(length - maxLength + 3);
|
||||
length = maxLength;
|
||||
}
|
||||
}
|
||||
|
||||
// add padding with spaces
|
||||
memset(spaces, ' ', maxLength);
|
||||
|
@ -148,6 +128,54 @@ void printDownload(const std::string &str)
|
|||
fflush(stdout);
|
||||
}
|
||||
|
||||
// hardcoded english translations to not depends on external files
|
||||
struct CClientPatcherTranslations : public NLMISC::CI18N::ILoadProxy
|
||||
{
|
||||
virtual void loadStringFile(const std::string &filename, ucstring &text)
|
||||
{
|
||||
text.fromUtf8(
|
||||
"TheSagaOfRyzom [Ryzom]\n"
|
||||
"uiErrPatchApply [Error: Patch process ended but the patch has not been successfully applied.]\n"
|
||||
"uiErrChecking [Error: Patch files failed - checking.]\n"
|
||||
"uiKb [KiB]\n"
|
||||
"uiMb [MiB]\n"
|
||||
"uiLoginGetFile [Getting File:]\n"
|
||||
"uiDLWithCurl [Downloading File With Curl:]\n"
|
||||
"uiDecompressing [Decompressing File:]\n"
|
||||
"uiCheckInt [Checking Integrity:]\n"
|
||||
"uiNoVersionFound [No Version Found]\n"
|
||||
"uiVersionFound [Version Found:]\n"
|
||||
"uiApplyingDelta [Applying Delta:]\n"
|
||||
"uiClientVersion [Client Version]\n"
|
||||
"uiServerVersion [Server Version]\n"
|
||||
"uiCheckingFile [Checking File]\n"
|
||||
"uiNeededPatches [Required Patches:]\n"
|
||||
"uiCheckInBNP [Checking inside BNP:]\n"
|
||||
"uiSHA1Diff [Force BNP Unpacking: checksums do not correspond:]\n"
|
||||
"uiCheckEndNoErr [Checking file ended with no errors]\n"
|
||||
"uiCheckEndWithErr [Checking file ended with errors:]\n"
|
||||
"uiPatchEndNoErr [Patching file ended with no errors]\n"
|
||||
"uiPatchEndWithErr [Patch failed!]\n"
|
||||
"uiPatchDiskFull [Disk full!]\n"
|
||||
"uiPatchWriteError [Disk write error! (disk full?)]\n"
|
||||
"uiProcessing [Processing file:]\n"
|
||||
"uiUnpack [BNP Unpacking:]\n"
|
||||
"uiUnpackErrHead [Cannot read bnp header:]\n"
|
||||
"uiChangeDate [Changing the mod date:]\n"
|
||||
"uiChgDateErr [Cannot change file time:]\n"
|
||||
"uiNowDate [Now the date is:]\n"
|
||||
"uiSetAttrib [Set file attributes:]\n"
|
||||
"uiAttribErr [Cannot have read/write access:]\n"
|
||||
"uiDelFile [Delete file:]\n"
|
||||
"uiDelErr [Cannot delete file:]\n"
|
||||
"uiDelNoFile [Delete file (no file)]\n"
|
||||
"uiRenameFile [Rename File:]\n"
|
||||
"uiRenameErr [Cannot rename file:]\n"
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// init the Nel context
|
||||
|
@ -189,11 +217,6 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
// check if console supports utf-8
|
||||
std::string lang = toLower(std::string(setlocale(LC_CTYPE, "")));
|
||||
useUtf8 = (lang.find("utf8") != string::npos || lang.find("utf-8") != string::npos);
|
||||
lang = lang.substr(0, 2);
|
||||
|
||||
// check if console supports colors
|
||||
std::string term = toLower(std::string(getenv("TERM") ? getenv("TERM"):""));
|
||||
useEsc = (term.find("xterm") != string::npos || term.find("linux") != string::npos);
|
||||
|
@ -221,8 +244,17 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
// load translation
|
||||
CI18N::load(lang);
|
||||
// allocate translations proxy
|
||||
CClientPatcherTranslations *trans = new CClientPatcherTranslations();
|
||||
|
||||
// use proxy
|
||||
CI18N::setLoadProxy(trans);
|
||||
|
||||
// load english translations
|
||||
CI18N::load("en");
|
||||
|
||||
// now translations are read, we don't need it anymore
|
||||
delete trans;
|
||||
|
||||
printf("Checking %s files to patch...\n", convert(CI18N::get("TheSagaOfRyzom")).c_str());
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ FILE(GLOB SRC *.cpp *.h)
|
|||
ADD_LIBRARY(georges_dll SHARED ${SRC} georges_edit.rc)
|
||||
|
||||
INCLUDE_DIRECTORIES(${NEL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
TARGET_LINK_LIBRARIES(georges_dll nelmisc nelgeorges)
|
||||
NL_DEFAULT_PROPS(georges_dll "Ryzom, Tools, Georges: Georges Dll")
|
||||
|
|
|
@ -8,6 +8,8 @@ SET(CMAKE_MFC_FLAG 2)
|
|||
|
||||
ADD_EXECUTABLE(world_editor WIN32 ${SRC} world_editor.rc)
|
||||
|
||||
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
|
||||
|
||||
SOURCE_GROUP(Resources FILES world_editor.rc)
|
||||
|
||||
TARGET_LINK_LIBRARIES(world_editor
|
||||
|
|
|
@ -110,6 +110,7 @@
|
|||
|
||||
extern bool DontUse3D;
|
||||
|
||||
#include <libxml/parser.h>
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
|
Loading…
Reference in a new issue