Menu

LEX File Exchange
EA Support Files
SC4 Wikipedia
Network Addon Mod
Dependencies
Chat
Welcome, Guest. Please login or register.
Did you miss your activation email?

December 01, 2021, 01:17:17 PM

Login with username, password and session length

Author Topic: SC4 Folder and File Loading Order  (Read 16003 times)

0 Members and 1 Guest are viewing this topic.

Offline RippleJet

SC4 Folder and File Loading Order
« on: April 05, 2010, 03:05:53 PM »
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.

Offline cogeo

  • NAM Team
  • Forums Parliamentarian
  • *
  • Posts: 1160
  • Total likes: 38
  • Reputation: 18
  • CL:
    SC4 Station Master
Re: SC4 Folder and File Loading Order
« Reply #1 on: April 05, 2010, 03:57:38 PM »
Interesting! Didn't know about Sku_Data, nor that the file extension does make a difference!

    - 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.

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).

« Last Edit: April 05, 2010, 04:02:46 PM by cogeo »

Offline RippleJet

Re: SC4 Folder and File Loading Order
« Reply #2 on: April 05, 2010, 06:46:59 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. ;)



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.

Offline CasperVg

  • Administrator
  • Forums Guru
  • *
  • Posts: 2890
  • Total likes: 444
  • Reputation: 47
  • CL:
    The Go-To Guy!!
Re: SC4 Folder and File Loading Order
« Reply #3 on: April 12, 2010, 01:39:42 PM »
Quote
Yes, 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.
« Last Edit: April 12, 2010, 01:49:52 PM by caspervg »
Follow my SimCity 4 Let's play on YouTube

Offline RippleJet

Re: SC4 Folder and File Loading Order
« Reply #4 on: April 13, 2010, 12:33:32 PM »
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...
« Last Edit: April 13, 2010, 12:43:18 PM by RippleJet »

Offline jondor

  • NAM Team
  • Forums Senator
  • *
  • Posts: 911
  • Total likes: 3
  • Reputation: 17
  • Kitty loves Cities: Skylines!
    • The Boys and Girls from the Dwarf
  • CL: Don't Cross Me
Re: SC4 Folder and File Loading Order
« Reply #5 on: February 20, 2012, 02:34:19 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.
« Last Edit: February 20, 2012, 06:58:57 PM by jondor »
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.