[WIP] SoaSE Mod Auto-Installer

It seems one of the most complicated things to using Sins mods is simply installing them.  If you're not a power user, it involves following one of two arcanely-long directory paths, learning to create a folder, and making sure the mod is dumped into the location correctly.  Repeat for each new installation.  And patches require even a little more know-how.

So, I've decided to write a SoaSE Mod Auto-Installer program that looks at a mod's archive, the Sins installation on the computer, the OS version, and automatically extracts said mod into the right place. 

EDIT: Here's a mock-up of what I'm going for:

(Note: My Windows colors are white on black background.  The above windows would use your normal Windows color scheme.)

Roadmap

Rel 0.1
- Mod installation & uninstallation

Rel 0.2
- Version & game checks
- Automatic patch-detection

Rel 0.3
- Mod activation, deactivation, and re-ordering

Rel 0.4
- ?Mod incompatibility detection?
- ?Mod merging?
- ?New .SOASEMOD file format?
- ?Other grandiose ideas?
:P

15,153 views 20 replies
Reply #1 Top

there was one on the Sins filefront site, don't know if it is compatible with 1.181/1.041 though.

Reply #2 Top

Whiskey, just viewed that application.  Seems to be geared more towards mod distributors.  While that's one angle -- and not a bad one by any means -- I'm speaking more of giving users an application that will auto-install ANY mod.  (See mock-up screenshots I added above.)

Reply #4 Top

Moguta- I had not known the specific purpose of the previous installer. From the information you have provided (and the excellent GUI pic you've given)- I think I would even use this (especially as my Vista-x64 doesn't have the "move to folder" command, and drag&drop can be a bit uncooperative at times).

Reply #5 Top

As the creator of a mod myself I'd love to see this come in to play as alot of people have issues installing mods at times due to the folders being "hidden" for security issues.

Quite annoying really but if something like this existed it would really help alot of users out there installing the many many mods there are.

Reply #6 Top

Not that this auto-install will help me in anyway but sure it probably could help those people who are always baffled of where to install the mod

Nice going there, Nacey

Reply #7 Top

I also think that this could help the novice mod players. the main reason I had not attempted to write such is that I do not have the information on extracting from the various archive formats, also the mod might be for an older version and could crash the game if it is not in the correct version folder and then updated.

harpo

 

Reply #8 Top

harpo-

you could just assume that the mod was extracted properly. Then have the user  select the version that the mod is for.

Of course, you could also assume that the mod used knew what he was doing, and had the right version. Which wouldn't be that bad of an assumption....Becouse if the assumption is wrong, than the user wouldn't know what version the mod is for in the first place.

You'd also have to have the use select thier operating system, for the obvious reason that the mod path changes.

It would actully probably be simpler than your other apps.

Reply #9 Top

Thanks for all your inputs!  Consensus seems to be: Yes, Bob, I'd like to buy a vowel!  :grin:
Consider this application under development.

Quoting harpo99999, reply 7
the main reason I had not attempted to write such is that I do not have the information on extracting from the various archive formats, also the mod might be for an older version and could crash the game if it is not in the correct version folder and then updated.

I think that the open-source 7ZIP library should extract ZIP, RAR, and 7Z (by far the most common archive formats).

The version problem is more challenging.  I was thinking of, at minimum, performing a check to see if recently-added/-removed parameters were present in certain files.  Wouldn't be a foolproof check, but it should prevent crashes.

Quoting EvilTesla-RG, reply 8
Then have the user  select the version that the mod is for.

Of course, you could also assume that the mod used knew what he was doing, and had the right version. Which wouldn't be that bad of an assumption....Becouse if the assumption is wrong, than the user wouldn't know what version the mod is for in the first place.

You'd also have to have the use select thier operating system, for the obvious reason that the mod path changes

In the Options, I'd envisioned a drop-down selection box to install the mods to a different version of the game/expansion.  Here, I wouldn't consider it worthwhile to attempt a versioning check... the user should know what they're doing if they go that far, and the number of versions is just too great.

Also, I'll have to do some research, but I imagine it's quite trivial for the application to detect what OS it's running in.

 

Reply #10 Top

eviltesla-rg, the os variable %localapps% points to the folder below the  ironclad games folder that houses the mods, galaxyforge,settings, mapdesigner, autorecord, autosave, cache, debug, record, & save folders, and is what ALL of my utilities use as it is language independent AND OS independent (since win2k I believe, definately winxp,vista and win7 32 & 64bit compatible).

the actual vb6 code i use to determine the path to the mods folders is

home = getlocalapps()
If Not (test) Then pathlist(1) = home + "\Ironclad Games\Sins of a Solar Empire"

and the array pathlist() points to the locations for files

and for me the big preventer is the operation of extracting the mod from the archive, although the archive manager should be able to handle this, but I do not have the information on parameter passing to the archive managers for the extraction to the correct location from the correct archive.

harpo

 

Reply #11 Top

Wow, you mean all this time we could've been telling everyone to look for their mod folder in "%appdata%\Ironclad Games\Sins of a Solar Empire", rather than those two long, messy, OS-specific paths?  Will definitely take note.  And that makes it all the easier, as my program won't even have to perform an OS check. 
Thanks!  :D

EDIT: Evidently it's %appdata% instead of %localapps%.

EDIT2: Nevermind.  Turns out it is %localapps%, but this is not a variable in WinXP -- only Windows Vista & newer.

Reply #12 Top

Funnily enough %appdata% if thrown in to explorer on Windows 7 works and %localapps% doesnt. However %appdata% goes to:

C:\Users\USERNAME\AppData\Roaming

Rather than:

C:\Documents and Settings\USERNAME\Local Settings\
or
C:\Users\USERNAME\AppData\Local\

(The containing folder on Windows 7 being: C:\Documents and Settings\USERNAME\Local Settings\Application Data\Ironclad Games
or
C:\Users\USERNAME\AppData\Local\Ironclad Games\Sins of a Solar Empire)

Reply #13 Top

moguta, the vb6 code snipet is working on winxp and later using a function that reads the registy to get the localapps, i found the code on the internet an dthis is the actual function to read the localapps registy entry into vb6



'Registry Function
'Registry types (pass in string as it is below)
'String = REG_SZ, Binary = REG_BINARY, Dword = REG_DWORD, Expand String = REG_EXPAND_SZ
'
Private Function registryAction(sActionToPerform As String, sKey As String, sValue As String, sType As String)
Dim WshShell
    Set WshShell = CreateObject("WScript.Shell")
   
    On Error GoTo RegError
    If LCase$(sActionToPerform) = "write" Then WshShell.RegWrite sKey, sValue, sType
    If LCase$(sActionToPerform) = "read" Then registryAction = WshShell.RegRead(sKey)
    If LCase$(sActionToPerform) = "delete" Then WshShell.RegDelete sKey

RegError:
End Function
Private Function getlocalapps() As String
Dim sPath As String
Dim RetVal As Long

' Fill our string buffer
sPath = String(MAX_PATH, 0)

RetVal = SHGetFolderPath(0, CSIDL_LOCAL_APPDATA Or CSIDL_FLAG_CREATE, 0, SHGFP_TYPE_CURRENT, sPath)

Select Case RetVal
    Case S_OK
        ' We retrieved the folder successfully
       
        ' All C strings are null terminated
        ' So we need to return the string upto the first null character
        sPath = Left(sPath, InStr(1, sPath, Chr(0)) - 1)
        getlocalapps = sPath
    Case S_FALSE
        ' The CSIDL in nFolder is valid, but the folder does not exist.
        ' Use CSIDL_FLAG_CREATE to have it created automatically
        MsgBox "The folder does not exist"
    Case E_INVALIDARG
        ' nFolder is invalid
        MsgBox "An invalid folder ID was specified"
   
End Select
End Function

hope this helps

harpo

 

Reply #14 Top

ooooh, code *drools*

Reply #15 Top

%localappdata%

I made a mod installer over a year ago, but never got any feedback: https://forums.sinsofasolarempire.com/302726

It's probably outdated now. But I think it was pretty open ended with how you wanted to configure your mod. But what you're posting seems more of a mod manager, not stand-alone installer.

http://img211.imageshack.us/img211/4441/screenshotet9.png

Reply #16 Top

Well, gee willikers.  Didn't expect to see the mod installer's developer posting here.   :omg: Hello ThrakaAndy!

It's a shame that mods don't seem to use your application to install.  Perhaps it hasn't been updated for Entrenchment?  Or was there never much uptake anyway?  And you're right.  My program-to-be (hopefully) isn't something that the mod creators would choose to distribute with their mod, but something each mod-user would have to install any of their mods.

I say "hopefully" because I can't seem to find any libraries for reading and extracting common archive formats.  I was expecting to find some sort of framework where I could just call functions like:

OpenArchive(fileName,archivePtr);
ReadArchiveFileTree(fileTreePtr);
ReadArchiveFile(internalPath);
ExtractArchiveTruncated(path,numLevelsToTruncate);

But I'm becoming less & less confident that anything like this actually exists.  If it comes down to it, I may require that mod users extract the archives before using my program.  I'd really rather not add that additional step, however.
:(

Reply #17 Top

where is the link ?? please

Reply #18 Top

moguta, from what I remember from the distant days of win3 programming (1992,3,4) there were librarys/modules available for the function of backing up/extracting/restoring files into zip archives.

which language are you using to create the mod installer so that I can help you find the relevant code?

harpo

 

Reply #19 Top

Sorry, thalatos, no actual program yet.  It's mostly a concept at this point.

Harpo, what I'm looking for is a library that can decompress not only ZIP, but RAR, 7z, and anything else Sins modders tend to pack their mods into.

As far as language, I'm using C++.

Reply #20 Top

moguta the only formats I have seen mods in ARE the three you listed, and I think that the 7zip source is also c++ and is OPENSOURCE so you could add it to your utility and they do have a SDK at this link and they claim to have source files available on the download page of the www.7-zip.org web site

hope this helps

harpo