mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2026-03-22 12:16:15 +00:00
Compare commits
2 Commits
7e305cdec1
...
5fc42a3ce9
| Author | SHA1 | Date | |
|---|---|---|---|
| 5fc42a3ce9 | |||
| 8d0c27d6fc |
@@ -229,17 +229,19 @@ class W3DHub
|
|||||||
Store.applications.games.each do |game|
|
Store.applications.games.each do |game|
|
||||||
game.channels.each do |channel|
|
game.channels.each do |channel|
|
||||||
if game.id == "ren" && channel.id == "release"
|
if game.id == "ren" && channel.id == "release"
|
||||||
auto_import_win32_registry(game.id, channel.id, 'SOFTWARE\Westwood\Renegade')
|
auto_import_win32_registry(game, channel.id, 'SOFTWARE\Westwood\Renegade')
|
||||||
else
|
else
|
||||||
auto_import_win32_registry(game.id, channel.id)
|
auto_import_win32_registry(game, channel.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def auto_import_win32_registry(app_id, channel_id, registry_path = nil)
|
def auto_import_win32_registry(game, channel_id, registry_path = nil)
|
||||||
return unless W3DHub.windows?
|
return unless W3DHub.windows?
|
||||||
|
|
||||||
|
app_id = game.id
|
||||||
|
|
||||||
logger.info(LOG_TAG) { "Importing: #{app_id}-#{channel_id}" }
|
logger.info(LOG_TAG) { "Importing: #{app_id}-#{channel_id}" }
|
||||||
|
|
||||||
require "win32/registry"
|
require "win32/registry"
|
||||||
@@ -252,13 +254,15 @@ class W3DHub
|
|||||||
begin
|
begin
|
||||||
reg_constant.open(registry_path, reg_type) do |reg|
|
reg_constant.open(registry_path, reg_type) do |reg|
|
||||||
if (install_path = reg["InstallDir"])
|
if (install_path = reg["InstallDir"])
|
||||||
|
install_path.gsub!("\\", "/")
|
||||||
|
|
||||||
exe_path = app_id == "ecw" ? "#{install_path}/game750.exe" : "#{install_path}/game.exe"
|
exe_path = app_id == "ecw" ? "#{install_path}/game750.exe" : "#{install_path}/game.exe"
|
||||||
|
|
||||||
if File.exist?(exe_path)
|
if File.exist?(exe_path)
|
||||||
install_path.gsub!("\\", "/")
|
|
||||||
installed_version = reg["InstalledVersion"] unless app_id == "ren"
|
installed_version = reg["InstalledVersion"] unless app_id == "ren"
|
||||||
|
|
||||||
application_data = {
|
application_data = {
|
||||||
|
name: game.name,
|
||||||
install_directory: install_path,
|
install_directory: install_path,
|
||||||
installed_version: app_id == "ren" ? "1.0.0.0" : installed_version,
|
installed_version: app_id == "ren" ? "1.0.0.0" : installed_version,
|
||||||
install_path: exe_path,
|
install_path: exe_path,
|
||||||
@@ -286,6 +290,7 @@ class W3DHub
|
|||||||
|
|
||||||
def imported!(task, exe_path)
|
def imported!(task, exe_path)
|
||||||
application_data = {
|
application_data = {
|
||||||
|
name: task.application.name,
|
||||||
install_directory: File.dirname(exe_path),
|
install_directory: File.dirname(exe_path),
|
||||||
installed_version: task.channel.current_version,
|
installed_version: task.channel.current_version,
|
||||||
install_path: exe_path,
|
install_path: exe_path,
|
||||||
@@ -305,6 +310,7 @@ class W3DHub
|
|||||||
|
|
||||||
install_directory = Cache.install_path(task.application, task.channel)
|
install_directory = Cache.install_path(task.application, task.channel)
|
||||||
application_data = {
|
application_data = {
|
||||||
|
name: task.application.name,
|
||||||
install_directory: install_directory,
|
install_directory: install_directory,
|
||||||
installed_version: task.target_version,
|
installed_version: task.target_version,
|
||||||
install_path: "#{install_directory}/game.exe",
|
install_path: "#{install_directory}/game.exe",
|
||||||
|
|||||||
@@ -5,12 +5,10 @@ class W3DHub
|
|||||||
@game_news ||= {}
|
@game_news ||= {}
|
||||||
@game_events ||= {}
|
@game_events ||= {}
|
||||||
|
|
||||||
# unless Store.offline_mode
|
|
||||||
@focused_game ||= Store.applications.games.find { |g| g.id == Store.settings[:last_selected_app] }
|
@focused_game ||= Store.applications.games.find { |g| g.id == Store.settings[:last_selected_app] }
|
||||||
@focused_game ||= Store.applications.games.find { |g| g.id == "ren" }
|
@focused_game ||= Store.applications.games.find { |g| g.id == "ren" }
|
||||||
@focused_channel ||= @focused_game.channels.find { |c| c.id == Store.settings[:last_selected_channel] }
|
@focused_channel ||= @focused_game.channels.find { |c| c.id == Store.settings[:last_selected_channel] }
|
||||||
@focused_channel ||= @focused_game.channels.first
|
@focused_channel ||= @focused_game.channels.first
|
||||||
# end
|
|
||||||
|
|
||||||
body.clear do
|
body.clear do
|
||||||
stack(width: 1.0, height: 1.0) do
|
stack(width: 1.0, height: 1.0) do
|
||||||
@@ -174,10 +172,10 @@ class W3DHub
|
|||||||
|
|
||||||
items << { label: I18n.t(:"games.game_settings"), block: proc { Store.application_manager.settings(game.id, channel.id) } }
|
items << { label: I18n.t(:"games.game_settings"), block: proc { Store.application_manager.settings(game.id, channel.id) } }
|
||||||
items << { label: I18n.t(:"games.wine_configuration"), block: proc { Store.application_manager.wine_configuration(game.id, channel.id) } } if W3DHub.unix?
|
items << { label: I18n.t(:"games.wine_configuration"), block: proc { Store.application_manager.wine_configuration(game.id, channel.id) } } if W3DHub.unix?
|
||||||
items << { label: I18n.t(:"games.game_modifications"), block: proc { populate_game_modifications(game, channel) } }
|
items << { label: I18n.t(:"games.game_modifications"), block: proc { populate_game_modifications(game, channel) } } unless Store.offline_mode
|
||||||
if game.id != "ren"
|
if game.id != "ren"
|
||||||
items << { label: I18n.t(:"games.repair_installation"), block: proc { Store.application_manager.repair(game.id, channel.id) } }
|
items << { label: I18n.t(:"games.repair_installation"), block: proc { Store.application_manager.repair(game.id, channel.id) } } unless Store.offline_mode
|
||||||
items << { label: I18n.t(:"games.uninstall_game"), block: proc { Store.application_manager.uninstall(game.id, channel.id) } }
|
items << { label: I18n.t(:"games.uninstall_game"), block: proc { Store.application_manager.uninstall(game.id, channel.id) } } unless Store.offline_mode
|
||||||
end
|
end
|
||||||
|
|
||||||
# From gui_state_ext.rb
|
# From gui_state_ext.rb
|
||||||
@@ -225,6 +223,8 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return if Store.offline_mode
|
||||||
|
|
||||||
unless Cache.net_lock?("game_news_#{game.id}")
|
unless Cache.net_lock?("game_news_#{game.id}")
|
||||||
if @game_events[game.id]
|
if @game_events[game.id]
|
||||||
populate_game_events(game)
|
populate_game_events(game)
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ class W3DHub
|
|||||||
|
|
||||||
@progressbar.value = @fraction
|
@progressbar.value = @fraction
|
||||||
|
|
||||||
|
load_offline_applications_list if @offline_mode
|
||||||
|
|
||||||
push_state(States::Interface) if @offline_mode || (@progressbar.value >= 1.0 && @task_index == @tasks.size)
|
push_state(States::Interface) if @offline_mode || (@progressbar.value >= 1.0 && @task_index == @tasks.size)
|
||||||
|
|
||||||
return if @offline_mode
|
return if @offline_mode
|
||||||
@@ -188,6 +190,42 @@ class W3DHub
|
|||||||
@tasks[:server_list][:complete] = true
|
@tasks[:server_list][:complete] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def load_offline_applications_list
|
||||||
|
hash = {
|
||||||
|
applications: []
|
||||||
|
}
|
||||||
|
|
||||||
|
Store.settings[:games].each do |key, game|
|
||||||
|
app_id, channel_id = key.to_s.split("_")
|
||||||
|
|
||||||
|
app = hash[:applications].find { |a| a[:id] == app_id }
|
||||||
|
app_in_array = !app.nil?
|
||||||
|
app ||= {
|
||||||
|
id: app_id,
|
||||||
|
name: game[:name],
|
||||||
|
type: "",
|
||||||
|
category: "games",
|
||||||
|
"studio-id": "",
|
||||||
|
channels: [],
|
||||||
|
"web-links": [],
|
||||||
|
"extended-data": [{ name: "colour", value: "#353535" }]
|
||||||
|
}
|
||||||
|
|
||||||
|
channel = {
|
||||||
|
id: channel_id,
|
||||||
|
name: channel_id,
|
||||||
|
"user-level": "",
|
||||||
|
"current-version": game[:installed_version]
|
||||||
|
}
|
||||||
|
|
||||||
|
app[:channels] << channel
|
||||||
|
|
||||||
|
hash[:applications] << app unless app_in_array
|
||||||
|
end
|
||||||
|
|
||||||
|
Store.applications = Api::Applications.new(hash.to_json)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -76,6 +76,15 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
@account_container = flow(width: 256, height: 1.0) do
|
@account_container = flow(width: 256, height: 1.0) do
|
||||||
|
if Store.offline_mode
|
||||||
|
stack(width: 1.0, height: 1.0) do
|
||||||
|
flow(fill: true)
|
||||||
|
|
||||||
|
title "<b>OFFLINE</b>", text_wrap: :none, width: 1.0, text_align: :center
|
||||||
|
|
||||||
|
flow(fill: true)
|
||||||
|
end
|
||||||
|
else
|
||||||
stack(width: 1.0, height: 1.0) do
|
stack(width: 1.0, height: 1.0) do
|
||||||
tagline "<b>#{I18n.t(:"interface.not_logged_in")}</b>", text_wrap: :none
|
tagline "<b>#{I18n.t(:"interface.not_logged_in")}</b>", text_wrap: :none
|
||||||
|
|
||||||
@@ -88,6 +97,7 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@content_container = flow(width: 1.0, fill: true) do
|
@content_container = flow(width: 1.0, fill: true) do
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user