mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
- Merged Source Code from MP branch Revision 3021
. clip surface coordinates before blitting . track surface data pointer, to identify the surface's clip rectangle . editor : test if item index is smaller than the number of items . other minor updates . update png loader to work with new appdata.xml structure . VFS updates . fix radar maps : write to <userprofile>\RADARMAPS * New Map Editor Release (Build: 3023) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3023 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include "vfs_memory_file.h"
|
||||
#include "vfs_file_raii.h"
|
||||
#include "../vfs_file_raii.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define _VFS_7Z_LIBRARY_H_
|
||||
|
||||
#include "vfs_uncompressed_lib_base.h"
|
||||
#include "File/vfs_lib_file.h"
|
||||
#include "../File/vfs_lib_file.h"
|
||||
|
||||
namespace vfs
|
||||
{
|
||||
|
||||
@@ -269,6 +269,9 @@ CTransferRules::EAction CTransferRules::ApplyRule(utf8string const& sStr)
|
||||
|
||||
/*************************************************************************************/
|
||||
/*************************************************************************************/
|
||||
|
||||
#ifdef USE_CODE_PAGE
|
||||
|
||||
typedef vfs::UInt16 UINT16;
|
||||
extern UINT16 gsKeyTranslationTable[1024];
|
||||
|
||||
@@ -469,5 +472,7 @@ void charSet::InitializeCharSets()
|
||||
charSet::AddToCharSet(charSet::CS_SPECIAL_NON_CHAR, L"~*+-_.,:;'´`#°^!\"§$%&/()=?\\{}[]");
|
||||
}
|
||||
|
||||
#endif // USE_CODE_PAGE
|
||||
|
||||
/*************************************************************************************/
|
||||
/*************************************************************************************/
|
||||
|
||||
@@ -77,8 +77,9 @@ private:
|
||||
/**************************************************************/
|
||||
/**************************************************************/
|
||||
|
||||
#define USE_CODE_PAGE
|
||||
//#define USE_CODE_PAGE
|
||||
|
||||
#ifdef USE_CODE_PAGE
|
||||
class CodePageReader
|
||||
{
|
||||
public:
|
||||
@@ -117,6 +118,7 @@ namespace charSet
|
||||
|
||||
void InitializeCharSets();
|
||||
};
|
||||
#endif // USE_CODE_PAGE
|
||||
|
||||
#endif // _PARSER_TOOLS_H_
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// This class reads the contents of a directory file-by-file
|
||||
//
|
||||
#include "iteratedir.h"
|
||||
#include "VFS/vfs_debug.h"
|
||||
#include "vfs_debug.h"
|
||||
#include <sstream>
|
||||
|
||||
#include "utf8string.h"
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#include "utf8.h"
|
||||
#include <vector>
|
||||
|
||||
#include <vfs_debug.h>
|
||||
#include "vfs_debug.h"
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace _StrCmp
|
||||
|
||||
+5
-5
@@ -551,15 +551,15 @@ bool vfs::CVirtualFileSystem::CreateNewFile(vfs::Path const& sFileName)
|
||||
}
|
||||
// see if the closest match is exclusive
|
||||
// if yes, then the the new path is a subdirectory and has to be exclusive too
|
||||
vfs::CVirtualLocation *pVLoc = this->GetVirtualLocation(sLeft);
|
||||
vfs::CVirtualLocation *pVLoc = this->GetVirtualLocation(sLeft,true);
|
||||
if(pVLoc)
|
||||
{
|
||||
bIsExclusive = pVLoc->GetIsExclusive();
|
||||
}
|
||||
else
|
||||
{
|
||||
THROWEXCEPTION(L"location (closest match) should exist");
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// THROWEXCEPTION(L"location (closest match) should exist");
|
||||
//}
|
||||
bNewLocation = true;
|
||||
}
|
||||
if(pProfLoc && pProfLoc->IsWriteable())
|
||||
|
||||
@@ -93,7 +93,7 @@ vfs::COpenWriteFile::COpenWriteFile(vfs::tWriteableFile *pFile)
|
||||
{
|
||||
m_pFile = pFile;
|
||||
THROWIFFALSE(m_pFile, L"no file");
|
||||
THROWIFFALSE(m_pFile->OpenWrite(true,false), L"not open");
|
||||
THROWIFFALSE(m_pFile->OpenWrite(true,false), (L"File not open : " + m_pFile->GetFullPath()().c_wcs()).c_str());
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
{
|
||||
|
||||
+37
-28
@@ -10,6 +10,12 @@
|
||||
#include "PropertyContainer.h"
|
||||
#include "Tools/Log.h"
|
||||
|
||||
//#define LOG_VFS_INITIALIZATION
|
||||
#ifdef LOG_VFS_INITIALIZATION
|
||||
#define LOG(x) (x)
|
||||
#else
|
||||
#define LOG(x)
|
||||
#endif
|
||||
/********************************************************************/
|
||||
/********************************************************************/
|
||||
|
||||
@@ -27,61 +33,64 @@ bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list)
|
||||
{
|
||||
oVFSProps.InitFromIniFile(*clit);
|
||||
}
|
||||
|
||||
CLog _LOG(vfs::Path(L"vfs_init.log"));
|
||||
return InitVirtualFileSystem(oVFSProps);
|
||||
}
|
||||
bool InitVirtualFileSystem(CPropertyContainer& oVFSProps)
|
||||
{
|
||||
LOG(CLog _LOG(vfs::Path(L"vfs_init.log")));
|
||||
|
||||
vfs::CVirtualFileSystem *pVirtFileSys = GetVFS();
|
||||
|
||||
_LOG << "Initializing Virtual File System";
|
||||
_LOG.Endl();
|
||||
LOG(_LOG << "Initializing Virtual File System");
|
||||
LOG(_LOG.Endl());
|
||||
|
||||
_LOG.Endl() << "reading profiles .. ";
|
||||
LOG(_LOG.Endl() << "reading profiles .. ");
|
||||
std::list<utf8string> lProfiles, lLocSections;
|
||||
oVFSProps.GetStringListProperty(L"vfs_config",L"PROFILES",lProfiles,L"");
|
||||
if(lProfiles.empty())
|
||||
{
|
||||
_LOG << " ERROR";
|
||||
LOG(_LOG << " ERROR");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_LOG << " OK";
|
||||
LOG(_LOG << " OK");
|
||||
}
|
||||
_LOG.Endl() << " profiles to read : ";
|
||||
LOG(_LOG.Endl() << " profiles to read : ");
|
||||
std::list<utf8string>::const_iterator cit_profiles = lProfiles.begin();
|
||||
for(; cit_profiles != lProfiles.end(); ++cit_profiles)
|
||||
{
|
||||
_LOG << (*cit_profiles) << ", ";
|
||||
LOG(_LOG << (*cit_profiles) << ", ");
|
||||
}
|
||||
_LOG.Endl();
|
||||
LOG(_LOG.Endl());
|
||||
|
||||
std::list<utf8string>::const_iterator prof_cit = lProfiles.begin();
|
||||
for(; prof_cit != lProfiles.end(); ++prof_cit)
|
||||
{
|
||||
_LOG.Endl() << " reading profile [";
|
||||
LOG(_LOG.Endl() << " reading profile [");
|
||||
utf8string sProfSection = utf8string("PROFILE_") + utf8string(*prof_cit);
|
||||
utf8string sProfName = oVFSProps.GetStringProperty(sProfSection,L"NAME",L"");
|
||||
_LOG << sProfName << "] .. ";
|
||||
LOG(_LOG << sProfName << "] .. ");
|
||||
|
||||
vfs::Path profileRoot = oVFSProps.GetStringProperty(sProfSection,L"PROFILE_ROOT",L"");
|
||||
|
||||
lLocSections.clear();
|
||||
oVFSProps.GetStringListProperty(sProfSection,L"LOCATIONS",lLocSections,L"");
|
||||
|
||||
_LOG << "OK";
|
||||
_LOG.Endl() << " locations to read : ";
|
||||
LOG(_LOG << "OK");
|
||||
LOG(_LOG.Endl() << " locations to read : ");
|
||||
std::list<utf8string>::const_iterator cit_locations = lLocSections.begin();
|
||||
for(; cit_locations != lLocSections.end(); ++cit_locations)
|
||||
{
|
||||
_LOG << (*cit_locations) << ", ";
|
||||
LOG(_LOG << (*cit_locations) << ", ");
|
||||
}
|
||||
_LOG.Endl().Endl();
|
||||
LOG(_LOG.Endl().Endl());
|
||||
|
||||
std::list<utf8string>::iterator loc_it = lLocSections.begin();
|
||||
bool bIsWriteable = oVFSProps.GetBoolProperty(sProfSection,L"WRITE",false);
|
||||
for(; loc_it != lLocSections.end(); ++loc_it)
|
||||
{
|
||||
_LOG << " reading location [ ";
|
||||
LOG(_LOG << " reading location [ ");
|
||||
utf8string sLocSection = utf8string("LOC_") + utf8string(*loc_it);
|
||||
vfs::Path sLocPath, sLocMountPoint;
|
||||
utf8string sLocType;
|
||||
@@ -92,7 +101,7 @@ bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list)
|
||||
bool bOptional = oVFSProps.GetBoolProperty(sLocSection,L"OPTIONAL",false);
|
||||
if(StrCmp::Equal(sLocType,L"LIBRARY"))
|
||||
{
|
||||
_LOG << sLocType << " | " << (*loc_it) << " ] .. ";
|
||||
LOG(_LOG << sLocType << " | " << (*loc_it) << " ] .. ");
|
||||
vfs::tReadableFile *pLibFile = NULL;
|
||||
bool bOwnFile = false;
|
||||
if(!sLocPath.empty())
|
||||
@@ -123,7 +132,7 @@ bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list)
|
||||
}
|
||||
else
|
||||
{
|
||||
_LOG << "ERROR" << CLog::endl;
|
||||
LOG(_LOG << "ERROR" << CLog::endl);
|
||||
utf8string::str_t s = L"File [" + utf8string(sLocPath()).c_wcs() + L"] in not an SLF or 7z library";
|
||||
THROWEXCEPTION(s.c_str());
|
||||
return false;
|
||||
@@ -132,7 +141,7 @@ bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list)
|
||||
{
|
||||
if(!bOptional)
|
||||
{
|
||||
_LOG << "ERROR" << CLog::endl;
|
||||
LOG(_LOG << "ERROR" << CLog::endl);
|
||||
//std::cout << "ERROR : library initialization failed [ " << full_str << " ]" << std::endl;
|
||||
std::wstring s = L"Could not initialize library [ " + sLocPath().c_wcs()
|
||||
+ L" ] in : profile [ " + utf8string(sProfName).c_wcs()
|
||||
@@ -141,27 +150,27 @@ bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list)
|
||||
THROWEXCEPTION(s.c_str());
|
||||
return false;
|
||||
}
|
||||
_LOG << "optional library ignored" << CLog::endl;
|
||||
LOG(_LOG << "optional library ignored" << CLog::endl);
|
||||
}
|
||||
else
|
||||
{
|
||||
_LOG << "OK" << CLog::endl;
|
||||
LOG(_LOG << "OK" << CLog::endl);
|
||||
}
|
||||
pVirtFileSys->AddLocation(vfs::tReadLocation::Cast(pLib), sProfName, bIsWriteable);
|
||||
}
|
||||
else
|
||||
{
|
||||
_LOG << "ERROR" << CLog::endl;
|
||||
LOG(_LOG << "ERROR" << CLog::endl);
|
||||
THROWEXCEPTION(L"File not found");
|
||||
}
|
||||
}
|
||||
else if(StrCmp::Equal(sLocType,L"DIRECTORY"))
|
||||
{
|
||||
_LOG << sLocType << " | " << (*loc_it) << " ] .. ";
|
||||
LOG(_LOG << sLocType << " | " << (*loc_it) << " ] .. ");
|
||||
vfs::CDirectoryTree *pDirTree = new vfs::CDirectoryTree(sLocMountPoint,profileRoot + sLocPath);
|
||||
if(!pDirTree->Init())
|
||||
{
|
||||
_LOG << "ERROR" << CLog::endl;
|
||||
LOG(_LOG << "ERROR" << CLog::endl);
|
||||
std::wstring s = L"Could not initialize directory [\"" + sLocPath().c_wcs()
|
||||
+ L"\"] in : profile [\"" + utf8string(sProfName).c_wcs()
|
||||
+ L"\"], location [\"" + (*loc_it).c_wcs()
|
||||
@@ -170,11 +179,11 @@ bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list)
|
||||
return false;
|
||||
}
|
||||
pVirtFileSys->AddLocation(vfs::tReadLocation::Cast(pDirTree),sProfName,bIsWriteable);
|
||||
_LOG << "OK" << CLog::endl;
|
||||
LOG(_LOG << "OK" << CLog::endl);
|
||||
}
|
||||
else
|
||||
{
|
||||
_LOG << "]" << CLog::endl;
|
||||
LOG(_LOG << "]" << CLog::endl);
|
||||
}
|
||||
//else if( sLocType == "NOT_FOUND")
|
||||
//{
|
||||
@@ -201,7 +210,7 @@ bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list)
|
||||
InitWriteProfile(*pProf, profileRoot);
|
||||
}
|
||||
}
|
||||
_LOG.Endl() << "VFS successfully initialized" << CLog::endl;
|
||||
LOG(_LOG.Endl() << "VFS successfully initialized" << CLog::endl);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
|
||||
#include "vfs_types.h"
|
||||
#include "vfs_profile.h"
|
||||
#include "PropertyContainer.h"
|
||||
|
||||
bool InitWriteProfile(vfs::CVirtualProfile &rProf, vfs::Path const& profileRoot);
|
||||
bool InitVirtualFileSystem(vfs::Path const& vfs_ini);
|
||||
bool InitVirtualFileSystem(std::list<vfs::Path> const& vfs_ini_list);
|
||||
bool InitVirtualFileSystem(CPropertyContainer& props);
|
||||
|
||||
#endif // _VFS_INIT_H_
|
||||
|
||||
Reference in New Issue
Block a user