Skip to content

Commit 01991cc

Browse files
committed
Change implementation to only work with Textures.big and TexturesZH.big
1 parent 84cda98 commit 01991cc

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DFileSystem.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
#include "W3DDevice/GameClient/W3DFileSystem.h"
5151

5252
#include <io.h>
53-
#include <Utility/stdio_adapter.h>
5453

5554
// DEFINES ////////////////////////////////////////////////////////////////////////////////////////
5655

@@ -437,7 +436,7 @@ W3DFileSystem::W3DFileSystem(void)
437436
{
438437
_TheFileFactory = this; // override the w3d file factory.
439438

440-
#if PRIORITIZE_TEXTURES_BY_SIZE
439+
#if RTS_ZEROHOUR && PRIORITIZE_TEXTURES_BY_SIZE
441440
reprioritizeTexturesBySize();
442441
#endif
443442
}
@@ -471,18 +470,10 @@ void W3DFileSystem::Return_File( FileClass *file )
471470
//-------------------------------------------------------------------------------------------------
472471
void W3DFileSystem::reprioritizeTexturesBySize()
473472
{
473+
ArchivedDirectoryInfo* dirInfo = TheArchiveFileSystem->friend_getArchivedDirectoryInfo(TGA_DIR_PATH);
474+
if (dirInfo != NULL)
474475
{
475-
ArchivedDirectoryInfo* dirInfo = TheArchiveFileSystem->friend_getArchivedDirectoryInfo(TGA_DIR_PATH);
476-
if (dirInfo != NULL)
477-
reprioritizeTexturesBySize(*dirInfo);
478-
}
479-
480-
{
481-
char path[_MAX_PATH];
482-
snprintf(path, ARRAY_SIZE(path), "Data/%s/Art/Textures/", GetRegistryLanguage().str());
483-
ArchivedDirectoryInfo* dirInfo = TheArchiveFileSystem->friend_getArchivedDirectoryInfo(path);
484-
if (dirInfo != NULL)
485-
reprioritizeTexturesBySize(*dirInfo);
476+
reprioritizeTexturesBySize(*dirInfo);
486477
}
487478
}
488479

@@ -492,9 +483,15 @@ void W3DFileSystem::reprioritizeTexturesBySize()
492483
// what we currently need:
493484
// Before: A(256kb) B(128kb) C(512kb)
494485
// After: C(512kb) B(128kb) A(256kb)
486+
//
487+
// Catered to specific game archives only. This ensures that non user created archives are not
488+
// affected by the re-prioritization.
495489
//-------------------------------------------------------------------------------------------------
496490
void W3DFileSystem::reprioritizeTexturesBySize(ArchivedDirectoryInfo& dirInfo)
497491
{
492+
const char* const superiorArchive = "Textures.big";
493+
const char* const inferiorArchive = "TexturesZH.big";
494+
498495
ArchivedFileLocationMap::iterator it0;
499496
ArchivedFileLocationMap::iterator it1 = dirInfo.m_files.begin();
500497
ArchivedFileLocationMap::iterator end = dirInfo.m_files.end();
@@ -524,7 +521,9 @@ void W3DFileSystem::reprioritizeTexturesBySize(ArchivedDirectoryInfo& dirInfo)
524521

525522
if (archive0->getFileInfo(filepath, &info0) && archive1->getFileInfo(filepath, &info1))
526523
{
527-
if (info0.size() < info1.size())
524+
if (info0.size() < info1.size()
525+
&& archive0->getName().endsWithNoCase(inferiorArchive)
526+
&& archive1->getName().endsWithNoCase(superiorArchive))
528527
{
529528
std::swap(it0->second, it1->second);
530529

0 commit comments

Comments
 (0)