mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-15 08:42:34 +00:00
Store game colour and uses_engine_cfg to settings config, use wwconfig when game doesn't use engine.cfg
This commit is contained in:
@@ -36,6 +36,13 @@ class W3DHub
|
||||
color = @data[:"extended-data"].find { |h| h[:name] == "colour" }[:value].sub("#", "")
|
||||
|
||||
@color = "ff#{color}".to_i(16)
|
||||
|
||||
cfg = @data[:"extended-data"].find { |h| h[:name] == "usesEngineCfg" }
|
||||
@uses_engine_cfg = (cfg && cfg[:value].downcase.strip == "true") == true # explicit truthy compare to prevent return `nil`
|
||||
end
|
||||
|
||||
def uses_engine_cfg?
|
||||
@uses_engine_cfg
|
||||
end
|
||||
|
||||
class Channel
|
||||
|
||||
@@ -189,7 +189,13 @@ class W3DHub
|
||||
button get_image("#{GAME_ROOT_PATH}/media/ui_icons/gear.png"), tip: I18n.t(:"games.game_options"), image_height: 32, margin_left: 0 do |btn|
|
||||
items = []
|
||||
|
||||
items << { label: I18n.t(:"games.game_settings"), block: proc { push_state(States::GameSettingsDialog, app_id: game.id, channel: channel.id) } } #, block: proc { Store.application_manager.wwconfig(game.id, channel.id) } }
|
||||
items << { label: I18n.t(:"games.game_settings"), block: proc do
|
||||
if game.uses_engine_cfg?
|
||||
push_state(States::GameSettingsDialog, app_id: game.id, channel: channel.id)
|
||||
else
|
||||
Store.application_manager.wwconfig(game.id, channel.id)
|
||||
end
|
||||
end}
|
||||
# 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.game_modifications"), block: proc { populate_game_modifications(game, channel) } } unless Store.offline_mode
|
||||
|
||||
@@ -56,6 +56,22 @@ class W3DHub
|
||||
|
||||
if @offline_mode || (@progressbar.value >= 1.0 && @task_index == @tasks.size)
|
||||
pop_state
|
||||
|
||||
# --- Repair/Upgrade settings schema/data
|
||||
Store.settings[:favorites] ||= {}
|
||||
# add game colo[u]r and uses_engine_cfg to application data
|
||||
unless @offline_mode
|
||||
Store.settings[:games].each do |key, game|
|
||||
application = Store.applications.games.find { |g| g.id == key.to_s.split("_", 2).first }
|
||||
next unless application
|
||||
|
||||
game[:colour] = application.color
|
||||
game[:uses_engine_cfg] = application.uses_engine_cfg?
|
||||
end
|
||||
end
|
||||
|
||||
Store.settings.save_settings
|
||||
|
||||
push_state(States::Interface)
|
||||
end
|
||||
|
||||
@@ -228,7 +244,10 @@ class W3DHub
|
||||
"studio-id": "",
|
||||
channels: [],
|
||||
"web-links": [],
|
||||
"extended-data": [{ name: "colour", value: "#353535" }]
|
||||
"extended-data": [
|
||||
{ name: "colour", value: game[:colour] },
|
||||
{ name: "usesEngineCfg", value: game[:uses_engine_cfg] },
|
||||
]
|
||||
}
|
||||
|
||||
channel = {
|
||||
|
||||
@@ -10,11 +10,6 @@ class W3DHub
|
||||
|
||||
Store[:main_thread_queue] = []
|
||||
|
||||
# Repair/Upgrade schema
|
||||
Store.settings[:favorites] ||= {}
|
||||
|
||||
Store.settings.save_settings
|
||||
|
||||
begin
|
||||
I18n.locale = Store.settings[:language]
|
||||
rescue I18n::InvalidLocale
|
||||
|
||||
Reference in New Issue
Block a user