Skip to content

Conversation

xezon
Copy link

@xezon xezon commented Aug 23, 2025

This change implements access to shadowed files inside archives.

The Archive File System already kept track of all archives regardless of the shadowing, but made shadowed files inaccessible. This is now changed, which allows for some special uses cases we will run into when dealing with shadowed files of any kind. Shadowing is especially prevalent in Zero Hour, because that shadows a large amount of Generals files.

The review is quite a bit intricate given the complexity of the matter, the convuluted EA code and use of the uncommon multimap.

What is a shadowed file?

Consider the following files:

C:\GeneralsZH\art\textures\house.dds
C:\GeneralsZH\TexturesZH.big         -> contains art\textures\house.dds
C:\Generals\Textures.big             -> contains art\textures\house.dds

C:\GeneralsZH\art\textures\house.dds shadows art\textures\house.dds in C:\GeneralsZH\TexturesZH.big

art\textures\house.dds in C:\GeneralsZH\TexturesZH.big shadows art\textures\house.dds in C:\Generals\Textures.big

What is changed?

File instances can now be accessed by their instance index:

Instance 0 : C:\GeneralsZH\art\textures\house.dds
Instance 1 : C:\GeneralsZH\TexturesZH.big         -> contains art\textures\house.dds
Instance 2 : C:\Generals\Textures.big             -> contains art\textures\house.dds

@xezon xezon added Enhancement Is new feature or request Major Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour System Is Systems related labels Aug 23, 2025
@xezon xezon force-pushed the xezon/impl-file-instancing branch from 836fa3b to bd69bc2 Compare August 23, 2025 16:23
virtual Bool doesFileExist(const Char *filename) const; ///< return true if that file exists in an archive file somewhere.
virtual File* openFile( const Char *filename, Int access = 0, UnsignedInt instance = 0); ///< Search Archive files for specified file name and open it if found
virtual void closeAllFiles( void ) = 0; ///< Close all files associated with Archive files
virtual Bool doesFileExist(const Char *filename, UnsignedInt instance = 0) const; ///< return true if that file exists in an archive file somewhere.

void getFileListInDirectory(const AsciiString& currentDirectory, const AsciiString& originalDirectory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const; ///< search the given directory for files matching the searchName (egs. *.ini, *.rep). Possibly search subdirectories. Scans each Archive file.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not adding instance access to this function. I think it opens a potential rabbit hole and increase the complexity of this change.

}

if ( (TheArchiveFileSystem != NULL) && (file == NULL) )
{
file = TheArchiveFileSystem->openFile( filename );
// TheSuperHacker @todo Pass 'access' here?
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something worthwhile to investigate. I did not intent to fix it in this change because the potential side effects are unknown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Is new feature or request Gen Relates to Generals Major Severity: Minor < Major < Critical < Blocker System Is Systems related ZH Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant