• Welcome to SC4 Devotion Forum Archives.

SC4 Folder and File Loading Order

Started by RippleJet, April 05, 2010, 01:05:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RippleJet

This very brief information was posted elsewhere,
in a thread which isn't too easy to find, if file loading order is what you're looking for.

Thus, in order to bring this to a place where it's easier to find, here it is: :)





  • 1. \Program Files\Maxis\SimCity 4
        - This is where e.g. the SimCity_x.dat files are loaded


  • 2. \Program Files\Maxis\SimCity 4\Language subfolder
        - the subfolder is based on the "Language" setting in the Registry
        - all subfolders are recursively loaded first
        - this is where SimCityLocal.dat (and an occasional splash screen) is loaded


  • 3. \Program Files\Maxis\SimCity 4\Sku_Data
        - all subfolders are recursively loaded first


  • 4. \Program Files\Maxis\SimCity 4\Plugins
        - all subfolders are recursively loaded first
        - this is the plugins folder for Maxis' official landmarks


  • 5. \My Documents\SimCity 4\Plugins
        - all subfolders are recursively loaded first
        - this is the plugins folder for custom content

Within each folder and subfolder, files are loaded alphabetically,
first all files not having a dat extension, and last all *.dat files.

cogeo

#1
Interesting! Didn't know about Sku_Data, nor that the file extension does make a difference!

Quote from: RippleJet on April 05, 2010, 01:05:53 PM
    - all subfolders are recursively loaded first
I guess you mean last. Within each folder, dat (and other) files are loaded first, and then the subfolders (in alphabetical order). RTMT is actually based on this, to implement the prop selection mechanism.

Quote from: RippleJet on April 05, 2010, 01:05:53 PM
Within each folder and subfolder, files are loaded alphabetically,
It's also worth to add, that the underscore (_) character, unlike in almost any character set, is collated after all letters, digits and symbols, eg _ABC.dat will be loaded after ZABC.dat (if both are placed in the same folder).


RippleJet

Quote from: cogeo on April 05, 2010, 01:57:38 PM
I guess you mean last. Within each folder, dat (and other) files are loaded first, and then the subfolders (in alphabetical order). RTMT is actually based on this, to implement the prop selection mechanism.

Interesting! (again...) :)

That would indicate that the subfolder loading order would be, e.g. for the plugins folder
(which I've tested, together with the SKU_data and the language folder):


\plugins\asubfolder\*.*
\plugins\asubfolder\*.dat

\plugins\asubfolder\asubsub\*.*
\plugins\asubfolder\asubsub\*.dat

\plugins\asubfolder\bsubsub\*.*
\plugins\asubfolder\bsubsub\*.dat

\plugins\bsubfolder\*.*
\plugins\bsubfolder\*.dat

\plugins\*.*
\plugins\*.dat


Especially note the last two lines above...
Namely, the files in the root of the plugins are loaded after all subfolders,
and the same applies for the root of SKU_data and the language subfolder.

What I haven't tested, but which you, Cogeo, obviously have tested,
is whether the above loading order maybe could be, but obviously isn't:


\plugins\asubfolder\*.*
\plugins\asubfolder\asubsub\*.*
\plugins\asubfolder\bsubsub\*.*
\plugins\bsubfolder\*.*
\plugins\*.*

\plugins\asubfolder\*.dat
\plugins\asubfolder\asubsub\*.dat
\plugins\asubfolder\bsubsub\*.dat
\plugins\bsubfolder\*.dat
\plugins\*.dat


In all cases above *.* refers to all files, except *.dat. ;)



Quote from: cogeo on April 05, 2010, 01:57:38 PM
It's also worth to add, that the underscore (_) character, unlike in almost any character set, is collated after all letters, digits and symbols, eg _ABC.dat will be loaded after ZABC.dat (if both are placed in the same folder).

Yes, it's alphabetical according to ASCII, not according to Windows (however, regardless of capitalization, I think).
E.g. folders starting with characters like á, å and ä would also load very late, and not together with subfolders starting with a.

CasperVg

#3
QuoteYes, it's alphabetical according to ASCII, not according to Windows (however, regardless of capitalization, I think).

By ASCII alphabetical order, do you mean this?



I can confirm that %LotName.sc4Lot does indeed load before ALotName.sc4Lot, so it seems possible.
Follow my SimCity 4 Let's play on YouTube

RippleJet

#4
Quote from: caspervg on April 12, 2010, 11:39:42 AM
By ASCII alphabetical order, do you mean this?

Yes, or more accurately, the 256 character extended ASCII:



And I'm pretty sure small letters are first converted into capital letters.
Otherwise the underscore _ (character 95) wouldn't load after all letters...

jondor

#5
Quote from: RippleJet on April 05, 2010, 04:46:59 PM
That would indicate that the subfolder loading order would be, e.g. for the plugins folder
(which I've tested, together with the SKU_data and the language folder):


\plugins\asubfolder\*.*
\plugins\asubfolder\*.dat

\plugins\asubfolder\asubsub\*.*
\plugins\asubfolder\asubsub\*.dat

\plugins\asubfolder\bsubsub\*.*
\plugins\asubfolder\bsubsub\*.dat

\plugins\bsubfolder\*.*
\plugins\bsubfolder\*.dat

\plugins\*.*
\plugins\*.dat


Especially note the last two lines above...
Namely, the files in the root of the plugins are loaded after all subfolders,
and the same applies for the root of SKU_data and the language subfolder.

I hate to disagree with this last point, but as part of a project I'm working on that involves scanning SC4 plugins (and doing so in the same order that SC4 itself does for consistency sake), I've recently done some extensive testing on this point myself.

The root of the plugins folder does not load last after the sub-folders, but rather first as with the rest of the sub-folder roots. ie:

\plugins\*.*
\plugins\*.dat

\plugins\asubfolder\*.*
\plugins\asubfolder\*.dat

\plugins\asubfolder\asubsub\*.*
\plugins\asubfolder\asubsub\*.dat

\plugins\asubfolder\bsubsub\*.*
\plugins\asubfolder\bsubsub\*.dat

\plugins\bsubfolder\*.*
\plugins\bsubfolder\*.dat

I confirmed this with two test files, each containing a 128x128 pixel FSH @ 0x1ABE787D, 0x00000104 (The zoom 5 road stub) one solid red, one solid blue.  No other plugin on my system overrides that particular IID, so it made it quick and easy to test which loaded last, red or blue.  Blue.dat (placed in the plugin directory root) never appeared if Red.dat was anywhere in the plugin folder hierarchy, including the root itself since it is alphabetically later in sequence. (Files attached for anyone wishing to confirm).

Also: on the upper/lower case thing, it's entirely possible that has to do with Windows itself which makes no distinction between upper and lower case in file names.  This may be different in the Mac version if OSX does make the distinction, in which case lowercase letters would load after underscores which load after uppercase letters.

Edit: A little more testing later, it becomes clear that the file loading order is quite complex, but is in fact closer to this:

\plugins\*.*
\plugins\asubfolder\*.*
\plugins\asubfolder\asubsub\*.*
\plugins\asubfolder\bsubsub\*.*
\plugins\bsubfolder\*.*

\plugins\*.dat
\plugins\asubfolder\*.dat
\plugins\asubfolder\asubsub\*.dat
\plugins\asubfolder\bsubsub\*.dat
\plugins\bsubfolder\*.dat


For instance: \plugins\bsubfolder\Red.SC4Lot will load before \plugins\asubfolder\Blue.dat resulting in a blue square in my above test (where Red.SC4Lot is a renamed Red.dat)

However, \plugins\bsubfolder\Red.SC4Lot will load after \plugins\asubfolder\Blue.SC4Desc resulting in a blue square.

".dat" seems to be the only special extension, giving two passes through the directory tree, one for everything except *.dat and a second for all the *.dat files.
All new animated railroad crossing props for networks of all sizes! (Phase 1 complete)--> http://sc4devotion.com/forums/index.php?topic=13209

Mostly writing pony stories on FimFiction.net, but Cities: Skylines is my new best friend.  Anything and everything I made for SimCity 4 is fair game for use and distribution.