imLinguin / nile

Unofficial Amazon Games client
GNU General Public License v3.0
291 stars 15 forks source link

Game move functionality #43

Open buswedg opened 10 months ago

buswedg commented 10 months ago

Would be great to have a command which allows installed games to be moved across different locations, with manifests updated accordingly for the Amazon Games Launcher to remain synced to what is installed (no matter location).

This would be similar to the move functionality offered in legendary. But would be particularly helpful, as I've always had problems installing games to network locations via the actual Amazon Games launcher, which tends to complain about 'restricted install locations'.

buswedg commented 10 months ago

I've spent a little time looking at nile and legendary. Seems like Epic store manifest data in flat (*item) files, which are relatively straight forward to update based on a shift in game location. AG however, use sqlite files to store library data. The below seems to be the target file to update. I could probably make a PR to add this functionality if there is interest. If not, I'll just write something quick and dirty for my own needs.

%localappdata%\Amazon Games\Data\Games\Sql\GameInstallInfo.sqlite
imLinguin commented 10 months ago

This functionality is simple, just make nile move the game directory to desired location and update metadata in installed.json

buswedg commented 10 months ago

So, my focus was a little more around keeping AG launcher updated with the current install location, rather than nile (which might be out of scope for what you're doing here).

It's still straightforward, and I wrote + tested something last night which achieves my need by offering a pretty simple cli to select installed games, move them to a different location, and update Amazons sqlite stored info accordingly. See example drop of code below. But perhaps a better way to handle this would be to just update nile's installed.json, and focus on developing out some kind of resync functionality between nile and AG launcher? Similar to what legendary offers. What would you prefer?

DATABASE_PATH = os.path.expanduser(os.path.join("~", "AppData", "Local", "Amazon Games", "Data", "Games", "Sql", "GameInstallInfo.sqlite"))
conn = sqlite3.connect(DATABASE_PATH)
cursor = conn.cursor()
cursor.execute("UPDATE DbSet SET InstallDirectory = ? WHERE ProductAsin = ?", (new_install_game_dir, game_id))
conn.commit()
conn.close()
imLinguin commented 10 months ago

It feels best to have it as separate sync feature like legendary