For the record I am in fact not old enough to get that reference. The reference to the folder junction what’s your function not to the Captain America meme specifically because that what’s-your-function thing..is..from…a..70s…forget it.
I’ve been planning to have my own emulation setup for a long time now. Actually made quite a lot of progress a few times but is but one more project still unfinished.
I still read about emulation setups on places like reddit though. I often see extensive descriptions of how emulators and ROMs are carefully organized in file systems. And all I think is man, that would so much easier with symbolic links.
This would be obvious to about any regular Linux desktop user (at least I hope so). But I don’t think this concept is actually that common among Windows users or perhaps non-enthusiast users/users who don’t use computers for their livelihoods.
If you find yourself with an elaborate folder structure consisting of many multiple gigabytes of ROMs, Emulators, large image/movie files, MP3s etc you may in fact be ready to graduate to the next level of “power user” by utilizing this old but hardly known feature of Windows.
Since versions can vary and I’m still a noob when it comes to PowerShell we’ll be using the CMD shell for purposes of this entry.
More generically I’ll cover the use of symbolic links, more specifically “soft linking” of folders called folder junctions.
A folder junction is kind of link a shortcut only your essentially creating…I don’t know a mirage or dopleganger of the folder rather than an entirely new folder.
Imagine creating an exact copy of a beloved object on the holodeck of Star Trek: the real object is back in your quarters but here’s this duplicate made of light that can only exist on the holodeck. Okay that’s not a perfect analogy.
A more specific example would be if you had lets a secondary hard drive called D: with MAME and a bunch of arcade game ROM files. But lets say for whatever reason a frontend or some other program seems to really want to find C:\MAME.
Your options are to copy or move your MAME and ROM folders on your C: drive or maybe just try and change all the references in the config files to point to D: and hope you remembered to write all that down for the next time you have to make a change or re-set the whole thing up again.
But what if you could leave your MAME folder and all the ROMs on the D: drive but still manage to have the C:\MAME folder exist? This is where a folder junction comes in.
This can be accomplished with the handy built-in command mklink, in the following form:
mklink /j <link> <target>
To remember what that means and the right order, I think of the above as
mklink /j <imaginary> <real>
And by this I mean I’m issuing the command of mklink /j then giving it the thing I want to create followed by the thing that is there.
Or more specific to the above example:
mklink /j c:\mame d:\mame
The above will make what appears to be a mame folder show up at C:\ but with a little arrow over the icon, like a shortcut.
And if you double click c:\mame in Windows Explorer? The path indicator will show your location as c:\mame. In other words any programs that want a literal c:\mame and will complain it’s missing if it can’t find it will be satisfied and happy e.g. not complaining that the path is not found. Meanwhile your actual folders/files are still on D:.
I’m going to assume that made some kind of sense and move on to an even more specific way the above example could be used.
At least back when I used to try out mame a lot – and it’s been a few years and mame versions now – it really, really wanted a ROMS folder in the root of that mame folder. No matter where that mame folder was actually in the file system, by default it always looked to the ROMS folder for ROM files. I mean you could specify a different location in a config file but it seems like that didn’t work reliably for me.
And I happen to have a rather large set of MAME ROMS too. Multiple sets in fact I had manually separated into different categories varying wildly in actual disk space used.
Rather than make many copies of what was already anywhere between 200 Megabytes and 20 Gigabytes…I simply made a folder junction of a partiuclar grouping of ROMs to the MAME folder, such as the following:
mklink /j P:\Emulators\MAME\roms P:\ROMs\mame-keepers
Remember the first one is the one we’re creating, the P:\Emulators\MAME\roms folder, while second folder location is the thing that is there and exists and will continue to exist with or without a folder junction (P:\ROMs\mame-keepers).
This way Mame.exe is happy because it as its ROMS folder with roms in it and I didn’t have to make a copy of all those ROMs in the mame-keepers folder.
I could also create a symbolic link for mame from that emulators folder to the root of what is in this case my P: drive but having it in an emulators folder seems good enough.
Speaking of which, another use: if you have multiple versions of an emulator like mame for some reason – maybe you want to test a particular ROM in one version of MAME versus another version – you could extract the archive to p:\extract\mame169 along side p:\extract\mame172 (as an example) and symbolic link each folder in turn back to P:\emulators\mame.
Well one at a time obviously.
The point is this allows for enormous flexibility: test different emulators from one source, test different sets of ROMs without the need of making copies of files and leave things like emulators that might in archives that include a version number with that folder that has the version number in it and just symbolic link it over. Then when the next version comes delete the link and symbolically link the that version over.
Note: I actually wrote this around April of 2019 but put off finishing and refining it for my not-so-great 100 days of code adventure. I am publishing what I have now with plans to re-visit the subject in further detail later.