2009年6月14日 星期日

How to move mods, maps, and other content out of the \Local Settings\Application Data folders.

How to move mods, maps, and other content out of the \Local Settings\Application Data folders. Last update on 3/13.

I would like to thank Ironclad/Stardock for their support and for creating Sins. I would also like to thank forum users Damicatz and Radtoo for helping point me in the right direction.

The working solution I've found is to use the NTFS feature of junction points, which now seem to work like symbolic links in other operating systems (mainly Linux). This has been tested by myself on my main computer's Windows XP Pro SP2 and ran flawlessly with slightly increased loading times when a mod is loaded (2 to 5 second increase). This is not guaranteed to work for you or on any other operating system such as Vista or Windows 2000. However, it should work on Windows XP Home or Pro, both SP2. In the early days of Windows XP, these features of NTFS were dodgy at best. It seems Microsoft has come a long way since then and either SP1 or SP2 polished up the junction point feature. Make sure you are an advanced user before attempting what's below because you do so at your own risk.

A junction point or symbolic link lets you define a file, folder, or drive to be like a pointer that goes somewhere else on your system. When you browse to that pointer you're seamlessly redirected to some other place on your system be it a different file, folder, or drive. It's all redirection, pure and simple.

To start, you'll need to download a program called Junction. You can get it from these locations:

http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx

http://www.microsoft.com/technet/sysinternals/FileAndDisk/Junction.mspx

Once you download this program, you'll want to extract its exe file and place the junction.exe program into the C:\Windows directory. The EULA you can do whatever you want with. By placing it in the windows directory this will simplify accessing the junction commands. To use junction, do the following:

1) Use windows explorer to create a new folder where you want your mods to go. I placed mine in E:\Program Files\Stardock Games\Sins of a Solar Empire\ModsRedirect on my external E drive. If you place the folder in one of the game data directories, install directories, or in the My Games folder, be sure to give the folder you're creating a name that Ironclad probably won't choose should they change the game's file structure. In my example, I created the ModsRedirect folder just incase Ironclad were to create a Mods or ModsAlternate in the game install directory. You'll want to move your mods there now and clear out the old directory you're about to turn into a pointer.

2) Go to Start > Run > and type CMD . This will bring up a command prompt. Now type cd c:\ to get to your C drive and out of the Documents and Settings folder. There's a bunch of ways of doing this, but as long as you see C:\> now you're just fine.

3) Type junction. You can also type junction.exe but windows will recognize junction to be junction.exe and automatically run the appropriate program. You will get a license agreement screen and some text output describing how to use this program. It will not display this text output a second time. If you don't remember the original text, then here it is. You'll want to reference this because it tells you how to create junctions and delete them too:

Junction v1.05 - Windows junction creator and reparse point viewer
Copyright (C) 2000-2007 Mark Russinovich
Systems Internals - http://www.sysinternals.com

The first usage is for displaying reparse point information, and the
second usage is for creating or deleting a NTFS junction point:

usage: junction [-s] [-q]
-q Don't print error messages (quiet)

-s Recurse subdirectories

usage: junction [-d] []
-d Delete the specified junction
example: junction d:\link c:\winnt

4) Now the fun part. You're going to create the actual junction point. The command is:

junction

In the case of the mods folder mine would be at "C:\Documents and Settings\ZJBDragon\Local Settings\Application Data\Ironclad Games\Sins of a Solar Empire\Mods" (you must use quotes because there are spaces in the path). That's my junction directory because I want to send it somewhere else on my system. Did you remember to clean out that directory like I did? Take is contents out and send them over to the new target folder. The target is where I want to store the mods at on my external drive. It's path is "E:\Program Files\Stardock Games\Sins of a Solar Empire\ModsRedirect" (you must use quotes again). In my particular scenerio, the following command produces a creation success message:

C:\>junction "C:\Documents and Settings\ZJBDragon\Local Settings\Application Data\Ironclad Games\Sins of a Solar Empire\Mods" "E:\Program Files\Stardock Games\Sins of a Solar Empire\ModsRedirect"

If for some reason you decide to no longer have this junction point, you can use the same command but insert the -d flag for deletion:

C:\>junction -d "C:\Documents and Settings\ZJBDragon\Local Settings\Application Data\Ironclad Games\Sins of a Solar Empire\Mods" "E:\Program Files\Stardock Games\Sins of a Solar Empire\ModsRedirect"

DO NOT FORGET THE QUOTES! Also, if you are viewing either of the affected directories in windows explorer you must close out of them or you'll get an error about the folders being in use. This will prevent the junction from being created. Simply close out of those windows and hit the up key on your keyboard to recall the last command and retry.

I have so far tested both Uzii's planetary mod and Bailknight's visuals and gameplay tweaks under Sins version 1.03. I will confirm that both mods are working for me after I performed the steps above. I have no instability issues and everything seems to run much smoother than I was originally expecting. This is a very exciting working addition to windows since the same above method can be applied to other games that store their larger content files in the my documents or user profile. Sim City 4 also stored mods in the My Games folder which quickly balooned to several gigs of data that I don't have space for on my C drive. This use of junction points can easily turn that folder into a pointer too and be used on other games that don't give you a way to specify where data gets saved.

If you have mods to add in the future, you may either add them at the original location for mods or your newly created folder. Because the original junction directory is now a pointer, it points at the same place your target directory is so data loaded in either place winds up with the same physical address. In other words, both the junction directory and target are identical because they both point to the same place. Windows will seamlessly handle placing data where it belongs regardless of if you browse to the local settings mod path or to the install directory mod path, in my particular example.



Remember though, this will produce completely unpredictable results when a limited user on Windows XP or Windows Vista comes into play. Limited users may have trouble running Sins if the local settings folders are moved due to permissions. There are ways to alter the permissions on a particular folder, but that's something for another tutorial and is available via Google searching too.

沒有留言:

張貼留言