00010295 980.02227783 [5976] FindFirstFileA[01a94338]. lpFileName: DATA\*.esp. Found: Acquisitive Soul Gems.esp00010296 980.03222656 [5976] FindNextFileA[01a94338]. cFileName: dd - realistic ragdoll force - realistic.esp, ftLastWriteTime: ef6eba6c00010297 980.03247070 [5976] FindNextFileA[01a94338]. cFileName: hideout.esp, ftLastWriteTime: b545fc0000010298 980.04028320 [5976] FindNextFileA[01a94338]. cFileName: HighResTexturePack01.esp, ftLastWriteTime: 49fc2a0000010299 980.04064941 [5976] FindNextFileA[01a94338]. cFileName: HighResTexturePack02.esp, ftLastWriteTime: 6dbf700000010300 980.04095459 [5976] FindNextFileA[01a94338]. cFileName: portal2mod.esp, ftLastWriteTime: e25f2f0700010301 980.04119873 [5976] FindNextFileA[01a94338]. cFileName: smakit_house_markers.esp, ftLastWriteTime: 7b6078c500010302 980.04144287 [5976] FindNextFileA[01a94338]. Finish.00010303 980.04150391 [5976] FindClose. HANDLE: 01a94338
as you can see esp files are loaded in alphabetic order (case insensitive) as OP pointed out. I believe we can hack this process
by ordering by ftLastWriteTime quite easily.
I tried but was unable to write a plugin for skse and wrote my own loader.
QUESTION to skse people. How do I write a plugin to Hook to a Windows API?
QUESTION for non-english people: I noticed that Skyrim uses FindFirstFileA instead of FindFirstFileW, so Skyrim might not support japanese/chinese/cyrillic (not ANSI) file names. Do you confirm?
FindFirstFileA/FindNextFileA is not guaranteed to return the files in alphabetical order. It usually does for ntfs partitions but with fat32 it will return the files in the order they were written to disc. IF bsas are loaded in the order that FIndFirstFile/FindNextFile returns them there is no predictable order at all!
Regarding non-english versions: Afaik skyrim should support non-latin characters in file names, Oblivion did. The encoding doesn't really matter as the filename in this case is only used as an array of bytes that will probably be passed into CreateFileA unmodified. There it will be "transformed" back into the correct filename.
Besides, Windows does also support multi-byte charactersets in the ...A variants of functions. They may not be unicode but they still support non-latin characters like Kanji.
Edit: Btw, in case anyone cares: the skyrim launcher DOES use unicode, only the game doesn't.