Skip to content

Help code a platform

Wesley Pyburn (TechNobo) edited this page Feb 2, 2022 · 5 revisions

Want to help with the account switcher and have some tech knowledge? Great! Even if you have little experience coding, but a good hold understanding of Windows and filesystems, you can help!

And, good news! With version 5.0 (2022-01-30_00) adding platforms has become a LOT easier!

See this in video form: Below is a guide that covers the basics of adding a platform, as well as diving DEEP into extra features and possibilities. This will be missing features and more as it won't be updated as often as the Wiki page.

Website

What is required?

The account switcher works by swapping registry keys and files out for files it has previously saved. The ability to add a new platform is finding what files/registry keys are edited, and then building the "swapper". Finding out what files are edited is half the battle. This is where most people can help, especially when a platform is acting up or unreliable is being switched.

After collecting info, create an issue with your info so I or another contributor can begin work.

Collecting info on a platform

Think you can help collect file names and locations for a switcher? Awesome! There are multiple methods I've used:

1. Compare snapshots

This is a simpler method, but you need to be somewhat tech-savvy to understand where the program is hiding files. Effectively you make a 'snapshot' by copying a folder, then after logging in with another account: You compare the snapshot to the live folder.

Compare copies of folders

Most of the time, tokens and login usernames/info are stored in files. Where do you find these files? Usually in %AppData%, %LocalAppData% or Documents. Most programs are installed into %ProgramFiles%, but are usually not modified there due to permission levels. For this, I suggest you use WinMerge.

  1. Sign in with an account.
  2. Copy all of the program's folders you've found either by intuition or a search to a folder. For example I'll copy: %LocalAppData%\Spotify to a folder called Spotify\Local and %AppData%\Spotify to Spotify\AppData.
  3. Sign out of the platform, and then sign in with a different/new account.
  4. Open WinMerge and drag the live folder in (This sets the path in the 1st File or Folder spot). Example: %AppData%\Spotify.
  5. Drag and drop the snapshot folder into the 2nd File or Folder textbox. Example: Spotify\AppData.
  6. Click Compare and wait for it to complete. Files that are different are highlighted. Missing files on either side are shown as Left only or Right only - See the top of the screen for which folder is in what direction.

You can now delete the backups/copies of your folders to save disk space.

Compare registry snapshots

Some programs store tokens and required info in the Registry. This is easier to comb through, but not always required. The program I use for this is RegistryChangesView by Nirsoft (Download)

  1. Sign in with an account.
  2. Open RegistryChangesView and select Saved Registry Snapshot under Registry Data Source 1.
  3. Click Create Registry Snapshot to backup the current registry. Tick everything but ...\SAM and ...\Security, then click Create Snapshot.
  4. Sign out of the platform, and then sign in with a different/new account.
  5. Select Current Registry under Registry Data Source 2.
  6. Click OK
  7. You can now comb through the list of changed registry files by looking at the Registry Key column, and looking for the name of the program/developer/code-name for the program. You're looking for anything that points to an account, token or username - these are important. Anything else may likely not have anything to do with swapping accounts.

You can now delete the backups/copies of your registry to save disk space.

2. Monitor file changes live

This method has a ton of extra info to dig through, as it logs EVERYTHING going on in your computer. Every file and registry change appears on a list. You can filter, but there's a ton going on. For this, I suggest you use Process Monitor from SysInternals (Microsoft) to collect file names/registry keys that processes interact with. You will need to look up a guide for this, but to put it simply: Filter captured file changes by adding the following rules:

  1. Process Name is steam.exe then Include < This makes sure that only changes made by certain processes are monitored, for example; Steam.
  2. If it has multiple processes, add them all, so add say: Process Name is steamservice.exe then Include
  3. If you see a lot of other info we don't need, then don't be afraid to exclude it. For example: Operation is TCP Recieve then Exclude < to hide all incoming TCP network traffic. Exclude TCP Send and TCPCopy as well, for example.

You will be looking for files such as configuration/storage files like .cfg, .json, .yaml, .yml. .vdf and any changes in Steam's config directory for example. For the registry, look out for anything in the platform's 'subfolder', including the platform's name or odd keys it interacts with. You will need to log in and out 2-3 times to collect reliable info on what files it edits. When you're certain a file is or is not related, don't be afraid to exclude it to make searching easier using the filters.

Testing your file list

Once you have a list of files, you can take an extra step: Testing whether a switcher would work. Odds are, it would. As long as you don't click "Log out" those 'saved tokens' should be active until they expire. Swapping them in allows you to 'switch accounts'. You can copy all of these files you have collected into a new folder, and make a simple text file for all the registry keys (if any) and their values.

Once you have a backup, deleting the files is usually enough to "log out" (without actually clicking log out). After logging into another account, backup these new files again. Kill (end the process) through Task Manager completely, swap the files and registry keys, then start it again to see if you have successfully switched accounts. Oftentimes platforms will modify the files on each new start and need to be backed up again. Without these small changes being saved again, the 'backup' won't work.

If you can, take the extra step and see which files are REQUIRED to be changed, and which are optional (or just "storing info" rather than "storing info for immediate use" - such as a cache vs a database, for example).

To test registry changes, you'll need to use Regedit (Type that into the Start Menu) to manually edit values. This is safe, as long as you're not messing with Windows registry keys. It's not as scary as some believe.

Taking the extra step - Finding a username in files

If files need to be saved each time an account is switched, a unique ID or username found in one of the files is important to save the file without the user needing to save it manually while swapping accounts. Usually, a unique ID or username is stored in a file and can be read. Look in each of the modified files for a "last logged into", "unique ID", or something of the sort. Good software to use would be Notepad++ for text files and HxD for binary files. The latter is usually much more difficult to use, but if you notice a username in a bunch of 'nonsense' then do make sure to take note of it and its location. Absolutely do include this info in your issue.

Help updating a broken platform

Sometimes platforms change file names or the ways they store things, breaking the account switcher. For example, Ubisoft changed their Ubisoft Connect filesystem for accounts and broke the account switcher temporarily. Usernames could no longer be grabbed from a log file using an accounts ID, collected from one of the files. the user.dat folder was changed to users.dat in an update, and annoyingly the contents are encrypted as well, stopping the user ID collection as well. This small file change broke the switcher for a short while, as it was difficult to find the culprit. Other account switchers may become unreliable as new files are used, and if they're not swapped it won't work 100% of the time.

Check the platform's Wiki (on this project's Wiki) to see what files it interacts with, and start by making sure those still exist (exact file names). Then, a good start is the above monitoring system: Check for file changes and see what files are edited while logging into an account. The more info you can find, the better. After doing so, create an issue.

Submitting your lists

After you have a solid list of what needs to be done to swap an account on X platform or have information on a platform that is not switching reliably or has updated, create a new issue HERE.

  • Make sure to include a clear title like Filesystem changes for Steam, or New platform request: GOG.
  • Make sure to be clear in describing what needs to be added or changed. If you're fixing an issue, let me know what files are being used that aren't listed, renamed files etc. This is usually more difficult unless you have the expertise to look into the code and see how it works from the inside.
  • Make sure to list files and registry entries you swapped to successfully swap accounts, and which are REQUIRED.
  • If you dug a little deeper and found a username saved, or other identifiable data using something like Notepad++ or HxD, include it here.
  • Include any other information you feel important to make swapping accounts on this platform possible.

Take an extra step and add it yourself

Since version 5.0 (2022-01-30_00) adding platforms has become a LOT easier! You can simply edit a text file and add the info yourself. See the program's install directory for Platforms.json. If you have basic knowledge of JSON you should be able to add a platform very easily. Simply copy/paste an existing platform and edit the files and names to match your new platform. If you're looking for more advanced features or would like to learn things work, see the incredibly descriptive Templated platform guide

Once you add to Platforms.json, please for this repo, apply your changes and submit a pull request. It's super simple to add platforms and merge in new ones with this new system, so please do take advantage! If you find ways to improve this Wiki, please do let me know, or make changes yourself.

Icons are a little more difficult. They must:

  • Be placed in the icons directory with the same name as the platform's full name, in SVG format.
  • Must consist of 1 path. No outlines are currently supported. Use the "Expand stroke" option to expand outlines that you work with into solid objects, then combine them all into one path.
  • The single object must have id="FG".
  • Remove the fill="..." and any other objects in the <path>
  • Try and keep the viewBox to 0 0 500 500. In other words: Create a transparant image with 500x500px size.
  • Optional, but recommended: Run the file through a SVG minifier.

Why no outlines? Simply put: less effort. CSS only needs to define a color for a fill, making life SO much easier when it's applied evenly across multiple platform icons.

Finally, if you do go through with this much effort and information collection take a personal thank you from me, as this is something that takes time to complete and understand.