Adapt Android mobile controls and native client UI
This commit is contained in:
@@ -33,6 +33,32 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#if !defined(_WIN32)
|
||||
#include <dirent.h> // PORT: resolve separately cased .eix/.epk names on case-sensitive mobile filesystems
|
||||
#include <strings.h> // PORT: strcasecmp for the on-disk pack name lookup
|
||||
|
||||
// PORT: 40250 ships pairs such as ETC.eix and Etc.epk. Windows opens both through the
|
||||
// same stem; Android must locate each file using its actual on-disk spelling.
|
||||
static std::string ResolvePackFileName(const std::string& requested)
|
||||
{
|
||||
const std::string::size_type slash = requested.find_last_of('/');
|
||||
const std::string folder = slash == std::string::npos ? "." : requested.substr(0, slash);
|
||||
const std::string name = requested.substr(slash == std::string::npos ? 0 : slash + 1);
|
||||
DIR* dir = opendir(folder.c_str());
|
||||
if (!dir) return requested;
|
||||
std::string result = requested;
|
||||
while (dirent* entry = readdir(dir))
|
||||
{
|
||||
if (strcasecmp(entry->d_name, name.c_str()) == 0)
|
||||
{
|
||||
result = folder + "/" + entry->d_name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CMakePackLog::SetFileName(const char* c_szFileName)
|
||||
{
|
||||
@@ -257,6 +283,18 @@ bool CEterPack::Create(CEterFileDict& rkFileDict, const char * dbname, const cha
|
||||
|
||||
m_stDataFileName = dbname;
|
||||
m_stDataFileName += ".epk";
|
||||
// PORT: the two extensions may have different capitalization in the original Client/pack.
|
||||
#if !defined(_WIN32)
|
||||
if (bReadOnly)
|
||||
{
|
||||
const std::string indexName = ResolvePackFileName(m_indexFileName);
|
||||
if (indexName.size() < sizeof(m_indexFileName))
|
||||
{
|
||||
strcpy(m_indexFileName, indexName.c_str());
|
||||
}
|
||||
m_stDataFileName = ResolvePackFileName(m_stDataFileName);
|
||||
}
|
||||
#endif
|
||||
|
||||
m_bReadOnly = bReadOnly;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user