ok. all below is only from my practice. I may mistake somewhere, but you can correct my assertion any time.
at first, what I would explain, what I means by a some words:
- client: actually game "World of Warcraft" (exactly client part of it).
- root folder: topmost folder for some files (for sample, if your client located in "C:\Programm files\World of Warcraft\", for "wow.exe" it would be root folder.).
root folders and client vision of it.
basically, client root folder is folder where located your "wow.exe". but for client root folder is like virtual, and is a result of a combining of a three root folders:
- main-root: where located "wow.exe";
- data-root: "\\Data\" (where physically located main archives and patches);
- locale-root: for sample "\\Data\enGB\" this folder located in data-root folder, have four-lettered abbreviated name ("deDE", "enGB", "esES", "frFR" and "ruRU" for EU clients). this folders contain files only for appropriate localization and that's folders can be used only one of it at once (i.e. if you use "enGB" localization, client never see files from any other).
for client, all of three root folders virtually as one. for sample, if you have same structure:
Code:
\\wow\
|-Folder1\
| '-Folder2\
|-Data\
| |-Folder3\
| |-enGB\
| | '-Folder4\
| | '-Folder5\
| '-ruRU\
| '-Folder6\
'-Folder7\
for enGB client, this structure as:
Code:
\\wow\
|-Folder1\
| '-Folder2\
|-Folder3\
|-Folder4\
| '-Folder5\
'-Folder7\
here are full root folderlist for client vision:
Code:
Cameras\
Character\
CREATURE\
DBFilesClient\
DUNGEONS\
ENVIRONMENTS\
Fonts\
Interface\
ITEM\
PARTICLES\
shaders\
SOUND\
SPELLS\
spell\
TEST\
Textures\
TILESET\
TrialLists\
World\
WTF\
XTEXTURES\
root folder also contain some files, but about part of it some late.
if you browse folders in your client folder, you can see some of this, but most part of folders are packed in MPQ archives.
n.b. If different root folders contain identical files, client use only latest loaded. you can test sequence of loading, by placing of different files as identical named in different root folders (I test it by putting "\\GlueXML\GlueStrings.lua" with different 525 string "LOGIN = 'Login';" (it's text on "Login" button) in all "root\Interface\" folders). my tests give me this sequence: data-root, locale-root, main-root. i.e. files from data root are loaded at first, and if same named file exist in locale-root, client would be use file from locale-root, but if identical file would be exist in main-root too, client would be use file from main-root folder. this rule must work for all files include archives.
file structure of archives.
as I already said, most folders packed in archives. different archives, may contain full folders and part of folders. i.e. one folder or part of it may exist in different archives. for sample, folder "Sound\" exist in "\\Data\sound.MPQ\" and in "\\Data\enGB\speech-enGB.MPQ" this archives contain different files, but together they are form full folder "Sound\".
archives besides root-folder "last loaded" rule, have same rule self. I don't know full sequence of archives loading, but at first load main archives ("art.MPQ", "sound.MPQ", "world.MPQ", "locale-enGB.MPQ", "speech-enGB.MPQ"), then load expansion archives with they numbers sequence ("expansion1.MPQ", "expansion1-locale-enGB.MPQ", "expansion1-speech-enGB.MPQ", "expansion2.MPQ", "expansion2-locale-enGB.MPQ", "expansion2-speech-enGB.MPQ" and "expansion3.MPQ", "expansion3-locale-enGB.MPQ", "expansion3-speech-enGB.MPQ"). then load patch archives with they numbers sequence (I think example already not need).
besides basic archives, new patch archives have simple different structure (before 4.x it had identical structure with basic). basic archives begin already from root folder, but patch archives contain list of root-folders at firs. i.e. "basic" as "\\Data\" folder, and four-letter named locale-root folders. I test sequence of loading in one patch - base folder (data-root) are wins. i.e. besides of non packed files, for packed at one archive, locale files load at first.
files of patch archives.
also patch archives differ from basic archives that patch archives primary contain only patch-data for already existed files. also it may contain full files, especially if a files not exist before. you can detect patch-data by specific header inside a file - it's a "PTCH". just try to view file "as text" and if you see "PTCH" as first letters - it's patch-data (not a full file).
You must not allow loading of a patch-data after your files, or you can get any corrupt results.
Patches & Cache.
before 4.x your client updating looks as:
- download patch (contain only patch-data and new files) in temporary folder
- patch client files (extracting latest files for patching by patch-data, then pack it back in new patch archives, or may be full repack latest patch with updated files).
- after, you could delete downloaded patcher.
as result, you had client what contain only full files (old and new)
now we have different patch system:
- download patch (contain only patch-data and new files) in "\\Data\" folder
- ... actually that's all
launcher may prepare files in "\\Data\Cache\" folder for client, by repacking and patching files what it have in data and locale folders. or you may skip this procedure.
I have no idea when client use cached files and when it would "recache" it. in this reason I never interesting in this folder [* I must correct this assertion. I'm not interesting in locate my files in this folder, but cache greatly useful for extracting latest version of files.].
caching looks simple easy:
on demand of any file, client extract it. if this file exist in next loaded archive, client use latest loaded. then client check patch archives step by step. if patch contain patch-data for this file, file would be patched, if patch contain full file, client would be use this file from patch. this repeat until latest patch, equal client version. then prepared file would be pack in cache folder.
I think, basically it's all, but if you have a questions, I can try to answer.