Another solution for long loading times

I wrote a small VB6 program which dis(en)ables MODS inside the community-folder without copying them to another directory.
Just run the program before starting MSFS, select your MODS (also setups can be saved).

Can’t upload the code so you can copy/past it,change to your own community-folder and compile it with VB6.


CODE
Project1.vbp
Type=Exe
Form=Form1.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\Windows\SysWOW64\stdole2.tlb#OLE Automation
Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX
IconForm=“Form1”
Startup=“Form1”
HelpFile=“”
Title=“Mod-enabler”
ExeName32=“ModEnabler.exe”
Path32=“....\Test”
Command32=“”
Name=“ModEnabler”
HelpContextID=“0”
CompatibleMode=“0”
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
CompilationType=0
OptimizationType=0
FavorPentiumPro™=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
DebugStartupOption=0

Form1.frm
VERSION 5.00
Object = “{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0”; “COMDLG32.OCX”
Begin VB.Form Form1
Caption = “Mod-enabler”
ClientHeight = 4815
ClientLeft = 120
ClientTop = 465
ClientWidth = 6285
Icon = “Form1.frx”:0000
LinkTopic = “Form1”
ScaleHeight = 4815
ScaleWidth = 6285
StartUpPosition = 3 'Windows Default
Begin MSComDlg.CommonDialog CommonDialog1
Left = 2160
Top = 0
_ExtentX = 847
_ExtentY = 847
_Version = 393216
DefaultExt = “set”
Filter = “*.set”
End
Begin VB.CommandButton Command5
Caption = “Exit”
Height = 375
Left = 120
TabIndex = 9
Top = 4320
Width = 6015
End
Begin VB.CommandButton Command4
Caption = “Load setup”
Height = 375
Left = 3240
TabIndex = 8
Top = 3840
Width = 2895
End
Begin VB.CommandButton Command3
Caption = “Save setup”
Height = 375
Left = 120
TabIndex = 7
Top = 3840
Width = 2895
End
Begin VB.CommandButton Command2
Caption = “<- Enable mod”
Height = 375
Left = 3240
TabIndex = 6
Top = 3360
Width = 2895
End
Begin VB.CommandButton Command1
Caption = “Disable mod ->”
Height = 375
Left = 120
TabIndex = 5
Top = 3360
Width = 2895
End
Begin VB.ListBox List2
Height = 2790
Left = 3240
TabIndex = 2
Top = 480
Width = 2895
End
Begin VB.ListBox List1
Height = 2790
Left = 120
TabIndex = 1
Top = 480
Width = 2895
End
Begin VB.DirListBox Dir1
Height = 2565
Left = 1560
TabIndex = 0
Top = 600
Visible = 0 'False
Width = 3255
End
Begin VB.Label Label2
Caption = “Disabled mods”
Height = 255
Left = 3240
TabIndex = 4
Top = 120
Width = 1335
End
Begin VB.Label Label1
Caption = “Enabled mods”
Height = 255
Left = 120
TabIndex = 3
Top = 120
Width = 975
End
End
Attribute VB_Name = “Form1”
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private strModName() As String
Private strFilePath As String

Private Sub Command1_Click()
If List1.ListIndex < 0 Then
Exit Sub
End If
FileCopy "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community" + Trim$(List1.List(List1.ListIndex)) + “\layout.json”, "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community" + Trim$(List1.List(List1.ListIndex)) + “\bak-layout.json”
Kill "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community" + Trim$(List1.List(List1.ListIndex)) + “\layout.json”

List1.Clear
List2.Clear

intModCount = Dir1.ListCount - 1

For intCounter = 0 To intModCount
If Dir(Dir1.List(intCounter) + “\layout.json”, vbDirectory) <> “” Then
List1.AddItem Replace(Dir1.List(intCounter), "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community", “”)
ElseIf Dir(Dir1.List(intCounter) + “\bak-layout.json”, vbDirectory) <> “” Then
List2.AddItem Replace(Dir1.List(intCounter), "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community", “”)
End If
Next
End Sub

Private Sub Command2_Click()
If List2.ListIndex < 0 Then
Exit Sub
End If
FileCopy "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community" + Trim$(List2.List(List2.ListIndex)) + “\bak-layout.json”, "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community" + Trim$(List2.List(List2.ListIndex)) + “\layout.json”
Kill "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community" + Trim$(List2.List(List2.ListIndex)) + “\bak-layout.json”

List1.Clear
List2.Clear

intModCount = Dir1.ListCount - 1

For intCounter = 0 To intModCount
If Dir(Dir1.List(intCounter) + “\layout.json”, vbDirectory) <> “” Then
List1.AddItem Replace(Dir1.List(intCounter), "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community", “”)
ElseIf Dir(Dir1.List(intCounter) + “\bak-layout.json”, vbDirectory) <> “” Then
List2.AddItem Replace(Dir1.List(intCounter), "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community", “”)
End If
Next
End Sub

Private Sub Command3_Click()
CommonDialog1.InitDir = strFilePath
CommonDialog1.ShowSave
strFilename = CommonDialog1.FileName
If Right$(strFilename, 4) <> “.set” Then
Exit Sub
End If
Open strFilename For Output As #1
For intCounter = 0 To List1.ListCount - 1
Print #1, List1.List(intCounter)
Next
Close #1
MsgBox “Setup saved”, vbOKOnly, “Mod-enabler”
End Sub

Private Sub Command4_Click()
List1.ListIndex = -1
List1.ListIndex = -1
CommonDialog1.InitDir = strFilePath
CommonDialog1.ShowOpen

strFilename = CommonDialog1.FileName
If Right$(strFilename, 4) <> “.set” Then
Exit Sub
End If
ReDim strModName(1000)
Open strFilename For Input As #1
intCounter = 0

While Not EOF(1)
    Input #1, StrMod
    strModName(intCounter) = StrMod
    intCounter = intCounter + 1
Wend

Close #1
ReDim Preserve strModName(intCounter - 1)
intTotal = intCounter - 1

Rem van rechts naar links
For intCounter = 0 To intTotal
blnFound = False
For intCounter2 = 0 To List2.ListCount - 1
If Trim$(strModName(intCounter)) = Trim$(List2.List(intCounter2)) Then
blnFound = True
Exit For
End If
Next
If blnFound = False Then
Rem staat al goed
Else
FileCopy "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community" + Trim$(strModName(intCounter)) + “\bak-layout.json”, "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community" + Trim$(strModName(intCounter)) + “\layout.json”
Kill "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community" + Trim$(strModName(intCounter)) + “\bak-layout.json”
End If
Next
Rem van links naar rechts
For intCounter = 0 To List1.ListCount - 1
blnFound = False
For intCounter2 = 0 To intTotal
If Trim$(strModName(intCounter2)) = Trim$(List1.List(intCounter)) Then
blnFound = True
Exit For
End If
Next
If blnFound = True Then
Rem staat al goed
Else
FileCopy "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community" + Trim$(List1.List(intCounter)) + “\layout.json”, "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community" + Trim$(List1.List(intCounter)) + “\bak-layout.json”
Kill "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community" + Trim$(List1.List(intCounter)) + “\layout.json”
End If
Next

List1.Clear
List2.Clear
intModCount = Dir1.ListCount - 1

For intCounter = 0 To intModCount
If Dir(Dir1.List(intCounter) + “\layout.json”, vbDirectory) <> “” Then
List1.AddItem Replace(Dir1.List(intCounter), "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community", “”)
ElseIf Dir(Dir1.List(intCounter) + “\bak-layout.json”, vbDirectory) <> “” Then
List2.AddItem Replace(Dir1.List(intCounter), "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community", “”)
End If
Next
End Sub

Private Sub Command5_Click()
End
End Sub

Private Sub Form_Load()
Rem strFilepath = mypath + "\Files"

strFilePath = "D:\Program Files\ModEnabler\Files"
Open strFilePath + “pos.bes” For Input As #1
Input #1, intxPos, intyPos
Close #1
Form1.Top = intyPos
Form1.Left = intxPos
Dir1.Path = “C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community”
Dir1.Refresh
intModCount = Dir1.ListCount - 1

For intCounter = 0 To intModCount
If Dir(Dir1.List(intCounter) + “\layout.json”, vbDirectory) <> “” Then
List1.AddItem Replace(Dir1.List(intCounter), "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community", “”)
ElseIf Dir(Dir1.List(intCounter) + “\bak-layout.json”, vbDirectory) <> “” Then
List2.AddItem Replace(Dir1.List(intCounter), "C:\Users\Stallen\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\Packages\Community", “”)
End If
Next
End Sub

Private Sub Form_Unload(Cancel As Integer)
Open strFilePath + “pos.bes” For Output As #1
Print #1, Form1.Left, Form1.Top
Close #1
End Sub

@ElvisStallen this looks very interesting. Unfortunately, I got rid of VB6 years ago. Could you compile it and zip up the .exe file and post it for download?

There is an existing free addon that lets you do the same thing:
MSFS Addons Linker • Flight Simulator 2020

2 Likes

Mod note: I have moved this topic to #community:general-discussion-feedback as it didn’t really belong in the #Bugs-and-Issues:Bugs-and-Issues-PerformanceGraphics section as it isn’t really a bug.

If the OP would prefer it in #self-service:pc-hardware then feel free to move it there by editing the topic title and selecting the new location.

Regards

Agree - this tool is great and allows you to store your add ons in any folder structure or organisation you like

I think this works well for people with the PC username: “Stallen”.
Besides the username then my files are at a different location.

That’s why you’ve to re-compile it with your own community-folder.
If people are interrested in this program, I can make a preference option, where you can save your own community-folder.

For users of the MSFS Addons Linker.
Like I stated in the title : another solution.

This is a 52Kb program that only changes the name of the layout.json in the sub-folders of your community folder. I seems that that does the job. No more long loading times and very simple to use. Done in a few seconds. Loading time for a preset less than a second. And it never fails, you can delete and put in new add-ons in your folder without any problem.

1 Like

Just a suggestion, save to Git / Github :wink:

There are other tools that do similar things, but nice work! I would recommend making all the paths variables where possible, they now reference to your pc (stallen). And also doesn’t easily allow switching between steam and ms store version.

Done.

All directories are custom now. Now to find a way to post the executable here.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.