From 3ffbc2892c1a7569d0c35889f9b9ac17906989ec Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Sat, 12 Feb 2022 20:05:34 -0600 Subject: [PATCH] Auto import any game installed by the official launcher at start up, should also pick up updated version strings now that it is run for 'installed' games. --- lib/application_manager.rb | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/lib/application_manager.rb b/lib/application_manager.rb index 84bd369..76e2909 100644 --- a/lib/application_manager.rb +++ b/lib/application_manager.rb @@ -189,25 +189,19 @@ class W3DHub def auto_import return unless W3DHub.windows? - # Renegade - auto_import_win32_registry("ren", "release", 'SOFTWARE\Westwood\Renegade') - - # Red Alert: A Path Beyond - auto_import_win32_registry("apb", "release") - - # Expansive Civilian Warfare - auto_import_win32_registry("ecw", "release") - - # Interim Apex - auto_import_win32_registry("ia", "release") - - # Tiberian Sun: Reborn - auto_import_win32_registry("tsr", "release") + Store.applications.games.each do |game| + game.channels.each do |channel| + if game.id == "ren" && channel.id == "release" + auto_import_win32_registry(game.id, channel.id, 'SOFTWARE\Westwood\Renegade') + else + auto_import_win32_registry(game.id, channel.id) + end + end + end end def auto_import_win32_registry(app_id, channel_id, registry_path = nil) return unless W3DHub.windows? - return if installed?(app_id, channel_id) puts "Importing: #{app_id}-#{channel_id}" @@ -239,7 +233,8 @@ class W3DHub end end rescue => e - puts e.message, e.backtrace + # puts e.class, e.message, e.backtrace + puts " Failed to import #{app_id}-#{channel_id}" if e.is_a?(Win32::Registry::Error) false end