Skip to content

armgit / soju

Public Imported from GitHub
0

Play Windows games on Apple Silicon Macs. Free, open-source app that installs the official Battle.net, Steam, Epic and GOG launchers and lists your games in one library.

Epic: games stay in the library after Epic's EOSH move; Epic's own parts stay out (#189)

Mikekc8495d75b32e
diff --git a/scripts/game-library.py b/scripts/game-library.py
index d116f45cff7..c266d2e8c19 100644
--- a/scripts/game-library.py
+++ b/scripts/game-library.py
@@ -261,11 +261,33 @@ class Library:
def epic(self):
prefix = self.base / self.folders['epic']
manifests = prefix / 'drive_c/ProgramData/Epic/EpicGamesLauncher/Data/Manifests'
- for f in sorted(manifests.glob('*.item')):
+ # Epic's launcher moved installs to its EOSH service in 2026-11 and, on that first start, dropped the
+ # record of games it did not find there ("EOSH reconciliation: removing installation not reported by
+ # EOSH"); the game's files stay. Soju keeps a copy of each game record it has seen, so such a game stays
+ # in the library while its folder is there; Play then makes Epic find it again ("Install" into the same
+ # folder: Epic checks the files and downloads nothing). A record Epic is rebuilding sits in Pending.
+ known = self.base / 'epic-known'
+ seen = {}
+ for f in sorted(manifests.glob('*.item')) + sorted((manifests / 'Pending').glob('*.item')):
+ try: seen.setdefault(read_json(f)['AppName'], (f, f.parent.name == 'Pending'))
+ except (OSError, ValueError, KeyError, TypeError, AttributeError):
+ self.warn('epic', 'An installation record could not be read. Refresh after Epic finishes updating.')
+ for f in sorted(known.glob('*.item')) if known.is_dir() else []:
+ try: seen.setdefault(read_json(f)['AppName'], (f, 'known'))
+ except (OSError, ValueError, KeyError, TypeError): pass
+ for uid, (f, origin) in sorted(seen.items()):
try:
item = read_json(f)
uid = item['AppName']
if item.get('MainGameAppName') not in (None, '', uid): continue # DLC
+ # Epic's own parts (EOSH, its overlay) have records too: only games go in the library.
+ if 'games' not in (item.get('AppCategories') or ['games']): continue
+ if origin == 'known' and not (windows_path(prefix, item['InstallLocation']) / '.egstore').is_dir(): continue
+ if origin is False and re.fullmatch(r'[0-9a-f]{32}', uid):
+ try:
+ known.mkdir(parents=True, exist_ok=True)
+ (known / (uid + '.item')).write_text(f.read_text(encoding='utf-8-sig'), encoding='utf-8')
+ except OSError: pass
location = windows_path(prefix, item['InstallLocation'])
namespace, catalog = item.get('CatalogNamespace'), item.get('CatalogItemId')
parts = [namespace, catalog, uid] if namespace and catalog else [uid]
@@ -273,7 +295,7 @@ class Library:
uri = 'com.epicgames.launcher://apps/' + quote(':'.join(parts), safe='')
uri += '?action=launch&silent=true'
art = first_file(sorted(location.glob('*.ico')))
- ready = not item.get('bIsIncompleteInstall', False)
+ ready = not item.get('bIsIncompleteInstall', False) or origin == 'known'
executable = item.get('LaunchExecutable')
if executable:
relative = PureWindowsPath(executable)
diff --git a/tests/test_library.py b/tests/test_library.py
index 79a36e8c95b..0ff1b545b9d 100644
--- a/tests/test_library.py
+++ b/tests/test_library.py
@@ -105,6 +105,25 @@ class LibraryTests(unittest.TestCase):
self.assertEqual(len(result['games']), 3)
self.assertEqual(len(result['warnings']), 2)
+ def test_epic_games_stay_when_epic_drops_their_record_and_its_own_parts_stay_out(self):
+ manifests = self.base / 'epic-bottle/drive_c/ProgramData/Epic/EpicGamesLauncher/Data/Manifests'
+ self.epic(uid='fa4240e57a3c46b39f169041b7811293') # Epic's app ids are 32 hex characters
+ self.put(self.base / 'epic-bottle/drive_c/Games/Epic/.egstore/x.manifest', '')
+ self.put(manifests / 'eosh.item', json.dumps(dict(AppName='c9e2eb9993a1496c99dc529b49a07339', DisplayName='EOSH Application',
+ InstallLocation='C:\\Program Files (x86)\\Epic Games\\Epic Online Services', AppCategories=['application'])))
+ ids = [g['id'] for g in self.lib.scan()['games'] if g['platform'] == 'epic']
+ self.assertEqual(len(ids), 1) # the game, not Epic's own service
+ uid = ids[0]
+ # Epic's launcher drops the game's record (its EOSH move, 2026-11): the game stays, and Play reaches Epic.
+ for f in manifests.glob('*.item'): f.unlink()
+ lib = library.Library(self.base)
+ games = [g for g in lib.scan()['games'] if g['platform'] == 'epic']
+ self.assertEqual([g['id'] for g in games], [uid])
+ self.assertIsNone(games[0]['issue'])
+ # The folder is gone as well: then the game is gone.
+ import shutil; shutil.rmtree(self.base / 'epic-bottle/drive_c/Games/Epic')
+ self.assertEqual([g for g in library.Library(self.base).scan()['games'] if g['platform'] == 'epic'], [])
+
def test_launch_rescans_deleted_installation(self):
_, game = self.steam()
self.lib.scan(); game.rmdir()