Jump to content

BSA load from plugin INI files


Recommended Posts

I know it is possible to load a BSA from the Skyrim.ini although those fields are fairly packed full at this point.

I remember reading something somewhere that you could use an INI file with the same name as the plugin to add options that are normally relegated to skyrim.ini or skyrimprefs.ini.

Is it possible to load BSA files from mod INI files?  If so, what is the syntax? Will it just append a value to what is extant in Skyrim.ini or will it overwrite the value? 

I have a sinking feeling this isn't possible anymore but I wanted to check. I have a MASSIVE mod that I need to break out into probably four BSA files to keep them all under 2GB each.

Thanks in advance.

Link to post
Share on other sites

Have you tried simply naming them the same way Skyrim names its texture files? "ModName - Textures0", "ModName - Textures1" etc? The same kind of naming exists for meshes too.

To answer the question though, no, you can't use an ini fragment to load your BSAs from because you'd need to override the one in the main ini to do that.

Link to post
Share on other sites
11 hours ago, Arthmoor said:

Have you tried simply naming them the same way Skyrim names its texture files? "ModName - Textures0", "ModName - Textures1" etc? The same kind of naming exists for meshes too.

To answer the question though, no, you can't use an ini fragment to load your BSAs from because you'd need to override the one in the main ini to do that.

Thank you @Arthmoor Yes, I did a few experiments with naming conventions and even tried using "sResourceArchiveListBeta" as a bit of a last resort.  :P

What got me thinking along the INI file lines was an old post by @zilav over on the STEP forums about xEdit's BSA loading rules.  That gave me a faint glimmer of hope so I started googling to try to figure out how to do it to no success. I probably just misunderstood what he meant.

I end up learning a couple of things during this process that may be useful:

1. SSE seems to be OK with uncompressed archives well over 2GB, but I haven't gone over 3GB for a single archive or 4GB for a BSA pair.  The big BSA was all FUZ files. I don't want to push my luck too hard so I try to stay below 2GB as a general practice.

2. Dummy ESL files can save the day. Since they don't have any records in them they don't really count against the FormId ceiling.

For example:

parentmod.esp ->  parentmod.bsa & parentmod - textures.bsa

parentmod_texturepack1.esl -> parentmod_texturepack1.bsa (compressed)

parentmod_texturepack2.esl -> parentmod_texturepack2.bsa (compressed)

parentmod_voicepack1.esl -> parentmod_voicepack1.bsa (uncompressed)

For general use I've pretty much replaced every dummy ESP file I had with dummy ESL files to save plugin slots in cases where the assets being loaded weren't terribly load order sensitive. Think UI mods and hand-combined texture mods.  I've been doing this since ESL files were a thing in SSE/FO4 and it works great by all indication.

Link to post
Share on other sites
  • 5 weeks later...

Hey guys, happy new year!

I have the same doubt. I actually have a mod that uses this archive registering thing which is optimized vanilla textures.

If you're using wrye bash or manually installing you need to run a script named textures_install.vbs which reads the following:

' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' |Installer VBScript for Optimized Vanilla Textures|
' |-------------------------------------------------|
' |          by SkyrimTuner and Ghostifish          |
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Option Explicit
 
const ForReading=1
 
dim objNetwork, currentuser, fs, string, substring, rFile, wFile, filename, filetoadd, destfile
dim oldname, newname, myArray(), x, i, usage, inserttext, searchtext, perm
dim skyriminipath, editorinipath, sysdrive, wshell, oShell
 
'-------------------------------------------------------- Elevate to admin
If WScript.Arguments.Named.Exists("elevated") = False Then
	CreateObject("Shell.Application").ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """ /elevated", "", "runas", 1
	WScript.Quit
	Else
	Set oShell = CreateObject("WScript.Shell")
	oShell.CurrentDirectory = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)
End If

Set fs = WScript.CreateObject("Scripting.filesystemObject")
Set objNetwork = CreateObject("Wscript.Network")
Set wshell = CreateObject("WScript.Shell")

sysdrive=wshell.ExpandEnvironmentStrings("%HOMEDRIVE%\%HOMEPATH%")
skyriminipath=sysdrive & "\My Documents\My Games\Skyrim\Skyrim.ini"
editorinipath=CreateObject("Scripting.FileSystemObject").GetParentFolderName(oShell.CurrentDirectory) & "\SkyrimEditor.ini"

'-------------------------------------------------------- Load optimized textures in sResrouceArchiveList and reset sResrouceArchiveList2
If fs.FileExists(skyriminipath) Then
	addstringAlt "Skyrim - HD01.bsa, Skyrim - HD02.bsa", "sResourceArchiveList=", skyriminipath, 0
	addstring "Skyrim - Voices.bsa", "sResourceArchiveList2=", skyriminipath, 0
End if
If fs.FileExists("Update.ini") Then
	addstringAlt "Skyrim - HD01.bsa, Skyrim - HD02.bsa", "sResourceArchiveList=", "Update.ini", 0
	addstring "Skyrim - Voices.bsa", "sResourceArchiveList2=", "Update.ini", 0
End if
If fs.FileExists("Dawnguard.ini") Then
	addstringAlt "Skyrim - HD01.bsa, Skyrim - HD02.bsa", "sResourceArchiveList=", "Dawnguard.ini", 0
	addstring "Skyrim - Voices.bsa", "sResourceArchiveList2=", "Dawnguard.ini", 0
End if
If fs.FileExists("HearthFires.ini") Then
	addstringAlt "Skyrim - HD01.bsa, Skyrim - HD02.bsa", "sResourceArchiveList=", "HearthFires.ini", 0
	addstring "Skyrim - Voices.bsa", "sResourceArchiveList2=", "HearthFires.ini", 0
End if
If fs.FileExists("Dragonborn.ini") Then
	addstringAlt "Skyrim - HD01.bsa, Skyrim - HD02.bsa", "sResourceArchiveList=", "Dragonborn.ini", 0
	addstring "Skyrim - Voices.bsa", "sResourceArchiveList2=", "Dragonborn.ini", 0
End If
If fs.FileExists(editorinipath) Then
	addstringAlt3 "Skyrim - Shaders.bsa, Update.bsa", "sResourceArchiveList2=", editorinipath, 0
End if
'-------------------------------------------------------- Load Skyrim - VoicesExtra.bsa if it exists
If fs.FileExists("Skyrim - VoicesExtra.bsa") Then
	string=", Skyrim - VoicesExtra.bsa"
	If fs.FileExists(skyriminipath) Then
		addstring string, "sResourceArchiveList2=", skyriminipath, 1
	End if
		If fs.FileExists("Update.ini") Then
		addstring string, "sResourceArchiveList2=", "Update.ini", 1
	End if
	If fs.FileExists("Dawnguard.ini") Then
		addstring string, "sResourceArchiveList2=", "Dawnguard.ini", 1
	End if
	If fs.FileExists("HearthFires.ini") Then
		addstring string, "sResourceArchiveList2=", "HearthFires.ini", 1
	End if
	If fs.FileExists("Dragonborn.ini") Then
		addstring string, "sResourceArchiveList2=", "Dragonborn.ini", 1
	End If
	If fs.FileExists(editorinipath) Then
		addstringAlt2 ", Skyrim - VoicesExtra.bsa, Skyrim - Shaders.bsa, Update.bsa", "SArchiveList=", editorinipath, 0
	End If
Else
	If fs.FileExists(editorinipath) Then
		addstringAlt2 ", Skyrim - Shaders.bsa, Update.bsa", "SArchiveList=", editorinipath, 0
	End If
End if
'-------------------------------------------------------- Rename DLC BSA files and add to inis
If fs.FileExists("Dawnguard.ini") Then
	renameBSA "Dawnguard.bsa","Dawnguard - Original.bsa"
	string=", Dawnguard - Original.bsa, Dawnguard - HD.bsa"
	check string
	If fs.FileExists(editorinipath) Then
		addstringAlt2 ", Dawnguard - Original.bsa", "SArchiveList=", editorinipath, 1
		addstringAlt3 ", Dawnguard - Original.bsa", "sResourceArchiveList2=", editorinipath, 1
	End If
End If
If fs.FileExists("HearthFires.ini") Then
	renameBSA "HearthFires.bsa","HearthFires - Original.bsa"
	string=", HearthFires - Original.bsa, HearthFires - HD.bsa"
	check string
	If fs.FileExists(editorinipath) Then
		addstringAlt2 ", HearthFires - Original.bsa", "SArchiveList=", editorinipath, 1
		addstringAlt3 ", HearthFires - Original.bsa", "sResourceArchiveList2=", editorinipath, 1
	End If
End If
If fs.FileExists("Dragonborn.ini") Then
	renameBSA "Dragonborn.bsa","Dragonborn - Original.bsa"
	string=", Dragonborn - Original.bsa, Dragonborn - HD.bsa"
	check string
	If fs.FileExists(editorinipath) Then
		addstringAlt2 ", Dragonborn - Original.bsa", "SArchiveList=", editorinipath, 1
		addstringAlt3 ", Dragonborn - Original.bsa", "sResourceArchiveList2=", editorinipath, 1
	End If
End If
MsgBox "Success! Don't forget to run me again if you validate your game cache integrity with Steam."
'-------------------------------------------------------- Sub for renaming BSA files
Sub renameBSA(oldname,newname)
	if fs.FileExists(oldname) Then
		if fs.FileExists(newname) Then
			fs.DeleteFile(newname)
		End If
		Set filename = fs.GetFile(oldname)
		filename.Name=newname
	End If
End Sub
'-------------------------------------------------------- Sub for appending and renewing the sResourceArchiveList line
Sub addstringAlt(inserttext,searchtext,filetoadd,usage)
	Set rFile = fs.OpenTextFile(filetoadd, ForReading)
	x = 0
	Do While rFile.AtEndOfStream <> True
		x = x+1
		ReDim Preserve myArray(x)
		myArray(x) = rFile.Readline        
		if instr(UCase(myArray(x)),UCase(searchtext)) <> 0 then
			if usage = 0 then
				myArray(x)=searchtext & "Skyrim - Misc.bsa, Skyrim - Shaders.bsa, " & inserttext & ", Skyrim - Interface.bsa, Skyrim - Animations.bsa, Skyrim - Meshes.bsa, Skyrim - Sounds.bsa"
				else
				myArray(x)=myArray(x) & inserttext
			end if
		end if
	Loop
	rFile.close
	perm=fs.GetFile(filetoadd).Attributes
	If perm And 1 Then    
		fs.GetFile(filetoadd).Attributes = fs.GetFile(filetoadd).Attributes - 1
	End If
	Set wFile = fs.CreateTextFile(filetoadd, True)
	for i = 1 to x
		wFile.WriteLine myArray(i)
	next
	wFile.close
	fs.GetFile(filetoadd).Attributes = perm
End Sub
'-------------------------------------------------------- Sub for appending and renewing the sResourceArchiveList2 line
Sub addstring(inserttext,searchtext,filetoadd,usage)
	Set rFile = fs.OpenTextFile(filetoadd, ForReading)
	x = 0
	Do While rFile.AtEndOfStream <> True
		x = x+1
		ReDim Preserve myArray(x)
		myArray(x) = rFile.Readline        
		if instr(UCase(myArray(x)),UCase(searchtext)) <> 0 then
			if usage = 0 then
				myArray(x)=searchtext & inserttext
				else
				myArray(x)=myArray(x) & inserttext
			end if
		end if
	Loop
	rFile.close
	perm=fs.GetFile(filetoadd).Attributes
	If perm And 1 Then    
		fs.GetFile(filetoadd).Attributes = fs.GetFile(filetoadd).Attributes - 1
	End If
	Set wFile = fs.CreateTextFile(filetoadd, True)
	for i = 1 to x
		wFile.WriteLine myArray(i)
	next
	wFile.close
	fs.GetFile(filetoadd).Attributes = perm
End Sub
'-------------------------------------------------------- Sub for appending and renewing the SArchiveList line in SkyrimEditor.ini
Sub addstringAlt2(inserttext,searchtext,filetoadd,usage)
	Set rFile = fs.OpenTextFile(filetoadd, ForReading)
	x = 0
	Do While rFile.AtEndOfStream <> True
		x = x+1
		ReDim Preserve myArray(x)
		myArray(x) = rFile.Readline        
		if instr(UCase(myArray(x)),UCase(searchtext)) <> 0 then
			if usage = 0 then
				myArray(x)=searchtext & "Skyrim - Textures.bsa, Skyrim - Meshes.bsa, Skyrim - Animations.bsa, Skyrim - Voices.bsa, Skyrim - Interface.bsa, Skyrim - Misc.bsa, Skyrim - Sounds.bsa" & inserttext
				else
				myArray(x)=myArray(x) & inserttext
			end if
		end if
	Loop
	rFile.close
	perm=fs.GetFile(filetoadd).Attributes
	If perm And 1 Then    
		fs.GetFile(filetoadd).Attributes = fs.GetFile(filetoadd).Attributes - 1
	End If
	Set wFile = fs.CreateTextFile(filetoadd, True)
	for i = 1 to x
		wFile.WriteLine myArray(i)
	next
	wFile.close
	fs.GetFile(filetoadd).Attributes = perm
End Sub
'-------------------------------------------------------- Sub for appending and renewing the SArchiveList line in SkyrimEditor.ini
Sub addstringAlt3(inserttext,searchtext,filetoadd,usage)
	Set rFile = fs.OpenTextFile(filetoadd, ForReading)
	x = 0
	Do While rFile.AtEndOfStream <> True
		x = x+1
		ReDim Preserve myArray(x)
		myArray(x) = rFile.Readline        
		if instr(UCase(myArray(x)),UCase(searchtext)) <> 0 then
			if usage = 0 then
				myArray(x)=searchtext & inserttext
				else
				myArray(x)=myArray(x) & inserttext
			end if
		end if
	Loop
	rFile.close
	perm=fs.GetFile(filetoadd).Attributes
	If perm And 1 Then    
		fs.GetFile(filetoadd).Attributes = fs.GetFile(filetoadd).Attributes - 1
	End If
	Set wFile = fs.CreateTextFile(filetoadd, True)
	for i = 1 to x
		wFile.WriteLine myArray(i)
	next
	wFile.close
	fs.GetFile(filetoadd).Attributes = perm
End Sub
'-------------------------------------------------------- Sub to check if each ini-file exists and add string 'sResourceArchiveList2'
Sub check(substring)
	If fs.FileExists(skyriminipath) Then
		addstring substring, "sResourceArchiveList2=", skyriminipath, 1
	End if
	If fs.FileExists("Update.ini") Then
		addstring substring, "sResourceArchiveList2=", "Update.ini", 1
	End if
	If fs.FileExists("Dawnguard.ini") Then
		addstring substring, "sResourceArchiveList2=", "Dawnguard.ini", 1
	End if
	If fs.FileExists("HearthFires.ini") Then
		addstring substring, "sResourceArchiveList2=", "HearthFires.ini", 1
	End if
	If fs.FileExists("Dragonborn.ini") Then
		addstring substring, "sResourceArchiveList2=", "Dragonborn.ini", 1
	End if
End Sub

Sounds like a lot of work. But in the end I have four new config files in my data folder, update.ini, dawnguard.ini, hearthfires.ini and dragonborn.ini and they all read exactly the same!

[Archive]
sResourceArchiveList=Skyrim - Misc.bsa, Skyrim - Shaders.bsa, Skyrim - HD01.bsa, Skyrim - HD02.bsa, Skyrim - Interface.bsa, Skyrim - Animations.bsa, Skyrim - Meshes.bsa, Skyrim - Sounds.bsa
sResourceArchiveList2=Skyrim - Voices.bsa, Skyrim - VoicesExtra.bsa, Dawnguard - Original.bsa, Dawnguard - HD.bsa, HearthFires - Original.bsa, HearthFires - HD.bsa, Dragonborn - Original.bsa, Dragonborn - HD.bsa

So I suppose that replaces the variables 'sResourceArchiveList' and 'sResourceArchiveList2' contained in skyrim.ini? If that's the case, no doubts there. But why four .ini archives, isn't that redundant?

Now I also have a question: how do I add more archives to register? Specifically, I want to run BS:Bruma and its resource archives apparently are meant to be loaded by mod organizer. Wrye Bash users have to add dummy esp's to make them load, and I don't want to do that, so is it possible to add more archives to the sResourceArchiveList parameters? If I simply add another config file to the data folder, how will it overwrite/be overwritten by the others already present? How do I manage which one gets carried? Could I simply replace all these config files by one that contains all the resource archives I want to load? Isn't all this mess as simple as adding more archives to those parameters in skyrim.ini? If so, why the complicated script? Why (several) ini files in the data folder?

Thanks!

Link to post
Share on other sites

There is a 255 character limit per sResourceArchiveList line of text

From The BSAs and You topic :

Quote


Registered BSAs
First the game reads your Skyrim.ini file. There's a section that tells the game which BSAs to load. It looks like this for most people:
[Archive]
sResourceArchiveList=Skyrim - Misc.bsa, Skyrim - Shaders.bsa, Skyrim - Textures.bsa, Skyrim - Interface.bsa, Skyrim - Animations.bsa, Skyrim - Meshes.bsa, Skyrim -Sounds.bsa
sResourceArchiveList2=Skyrim - Voices.bsa, Skyrim - VoicesExtra.bsa

 

The game will load the BSAs in order as listed, BSAs in sResourceArchiveList first, and sResourceArchiveList2 second. So if you manually register a texture replacer BSA (like the HD Texture packs), but put it at the beginning of the list - they won't load! Because the Skyrim - Textures.bsa will override them of course. If you put it after, or at the end of the list, or in the second entry, then they will load.

Easy enough, but there is one drawback: There's a 255 character limit on each of these entries. This is because the game internally uses a 256 byte character buffer to receive the value when reading it. One byte is reserved for the NULL terminator (a byte with a value of 0, indicating the end of the data), so that leaves 255 characters for file names. If you want to get around this limitation, you'll need to use Nitpick.

 

To maximise use of these lists limited to 255 characters, you could rename all of your BSAs (say in alphabetical order of loading, because just like a load order where there are conflicts of resources in BSAs the last loaded conflict will win) .. So sResourceArchiveList=A.bsa, B.bsa, C.bsa, D.bsa, etc etc

But keep a backup note of which is which :)

And there is ShadeMes NitPick

Link to post
Share on other sites
5 hours ago, alt3rn1ty said:

...There is a 255 character limit per sResourceArchiveList line of text...

I do not think so.

SSE in "sResourceArchiveList2" hawe 259 characters

	Skyrim - Voices_en0.bsa, Skyrim - Textures0.bsa, Skyrim - Textures1.bsa, Skyrim - Textures2.bsa, Skyrim - Textures3.bsa, Skyrim - Textures4.bsa, Skyrim - Textures5.bsa, Skyrim - Textures6.bsa, Skyrim - Textures7.bsa, Skyrim - Textures8.bsa, Skyrim - Patch.bsa
	

Link to post
Share on other sites
  • 5 months later...
On 1/2/2018 at 12:03 PM, InsanePlumber said:

I do not think so.

SSE in "sResourceArchiveList2" hawe 259 characters

 

  Hide contents

 

 



	Skyrim - Voices_en0.bsa, Skyrim - Textures0.bsa, Skyrim - Textures1.bsa, Skyrim - Textures2.bsa, Skyrim - Textures3.bsa, Skyrim - Textures4.bsa, Skyrim - Textures5.bsa, Skyrim - Textures6.bsa, Skyrim - Textures7.bsa, Skyrim - Textures8.bsa, Skyrim - Patch.bsa
	

 

 

 

So, since SSE's sResourceArchiveList2 already contains 259 characters, does that mean it is no longer limited to the 255 character limit of Oldrim?  I only ask as I'm wondering if I can still add  TerrainLodRedone.bsa, to the list and hide the esp as was suggested by the author.  Also, would you recommend that if we CAN exceed that 255 character limit (as it already does by default), then could I add other "empty" loading plugin .esps such as DustEffectsSSE.bsa,  and SkyHUD.bsa, or instead should I just extract the BSA's into loose files?  Thoughts / Recommendations?

Link to post
Share on other sites
  • 7 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...