mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 17:22:35 +00:00
Updated gems, implemented game settings (works best with scripts 5.1 games)
This commit is contained in:
20
Gemfile.lock
20
Gemfile.lock
@@ -2,27 +2,27 @@ GEM
|
|||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
concurrent-ruby (1.2.2)
|
concurrent-ruby (1.2.2)
|
||||||
cyberarm_engine (0.23.0)
|
cyberarm_engine (0.24.0)
|
||||||
excon (~> 0.88)
|
excon (~> 0.88)
|
||||||
gosu (~> 1.1)
|
gosu (~> 1.1)
|
||||||
gosu_more_drawables (~> 0.3)
|
gosu_more_drawables (~> 0.3)
|
||||||
digest-crc (0.6.4)
|
digest-crc (0.6.5)
|
||||||
rake (>= 12.0.0, < 14.0.0)
|
rake (>= 12.0.0, < 14.0.0)
|
||||||
event_emitter (0.2.6)
|
event_emitter (0.2.6)
|
||||||
excon (0.99.0)
|
excon (0.104.0)
|
||||||
ffi (1.15.5)
|
ffi (1.16.3)
|
||||||
ffi-win32-extensions (1.0.4)
|
ffi-win32-extensions (1.0.4)
|
||||||
ffi
|
ffi
|
||||||
gosu (1.4.6)
|
gosu (1.4.6)
|
||||||
gosu_more_drawables (0.3.1)
|
gosu_more_drawables (0.3.1)
|
||||||
i18n (1.13.0)
|
i18n (1.14.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
ircparser (1.0.0)
|
ircparser (1.0.0)
|
||||||
rake (13.0.6)
|
rake (13.1.0)
|
||||||
rexml (3.2.5)
|
rexml (3.2.6)
|
||||||
rubyzip (2.3.2)
|
rubyzip (2.3.2)
|
||||||
websocket (1.2.9)
|
websocket (1.2.10)
|
||||||
websocket-client-simple (0.6.1)
|
websocket-client-simple (0.8.0)
|
||||||
event_emitter
|
event_emitter
|
||||||
websocket
|
websocket
|
||||||
win32-process (0.10.0)
|
win32-process (0.10.0)
|
||||||
@@ -48,4 +48,4 @@ DEPENDENCIES
|
|||||||
win32-security
|
win32-security
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.4.13
|
2.4.14
|
||||||
|
|||||||
@@ -448,6 +448,14 @@ class W3DHub
|
|||||||
Store.settings.save_settings
|
Store.settings.save_settings
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def color(app_id)
|
||||||
|
Store.applications.games.detect { |g| g.id == app_id }&.color
|
||||||
|
end
|
||||||
|
|
||||||
|
def name(app_id)
|
||||||
|
Store.applications.games.detect { |g| g.id == app_id }&.name
|
||||||
|
end
|
||||||
|
|
||||||
# No application tasks are being done
|
# No application tasks are being done
|
||||||
def idle?
|
def idle?
|
||||||
!busy?
|
!busy?
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class W3DHub
|
|||||||
|
|
||||||
path = Cache.install_path(@application, @channel)
|
path = Cache.install_path(@application, @channel)
|
||||||
|
|
||||||
log path
|
logger.info(LOG_TAG) { path }
|
||||||
# TODO: Do some sanity checking, i.e. DO NOT start launcher if `whoami` returns root, path makes sense,
|
# TODO: Do some sanity checking, i.e. DO NOT start launcher if `whoami` returns root, path makes sense,
|
||||||
# we're not on Windows trying to uninstall a game likely installed by the official launcher
|
# we're not on Windows trying to uninstall a game likely installed by the official launcher
|
||||||
FileUtils.remove_dir(path)
|
FileUtils.remove_dir(path)
|
||||||
@@ -55,7 +55,7 @@ class W3DHub
|
|||||||
|
|
||||||
@status.step = :mark_application_uninstalled
|
@status.step = :mark_application_uninstalled
|
||||||
|
|
||||||
log "#{@app_id} has been uninstalled."
|
logger.info(LOG_TAG) { "#{@app_id} has been uninstalled." }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
271
lib/game_settings.rb
Normal file
271
lib/game_settings.rb
Normal file
@@ -0,0 +1,271 @@
|
|||||||
|
class W3DHub
|
||||||
|
class GameSettings
|
||||||
|
TYPE_LIBCONFIG = 0
|
||||||
|
TYPE_REGISTRY = 1
|
||||||
|
|
||||||
|
Setting = Struct.new(:group, :name, :label, :type, :key, :value, :options, :indexed)
|
||||||
|
|
||||||
|
def initialize(app_id, channel)
|
||||||
|
@app_id = app_id
|
||||||
|
@channel = channel
|
||||||
|
|
||||||
|
# Minimium width/height to show in options
|
||||||
|
@min_width = 1280
|
||||||
|
@min_height = 720
|
||||||
|
|
||||||
|
@win32_registry_base = "SOFTWARE\\W3D Hub\\games\\#{app_id}-#{channel}".freeze
|
||||||
|
@engine_cfg_path = "#{Dir.home}/Documents/W3D Hub/games/#{app_id}-#{channel}/engine.cfg".freeze
|
||||||
|
|
||||||
|
@hardware_data = HardwareSurvey.new.data
|
||||||
|
@cfg = File.exist?(@engine_cfg_path) ? File.read(@engine_cfg_path) : nil
|
||||||
|
@cfg_hash = {}
|
||||||
|
|
||||||
|
resolutions = @hardware_data[:displays].map { |display| display[:resolutions] }.flatten.each_slice(2).select do |pair|
|
||||||
|
width = pair[0]
|
||||||
|
height = pair[1]
|
||||||
|
|
||||||
|
width >= @min_width && height >= @min_height && width > height
|
||||||
|
end
|
||||||
|
|
||||||
|
refresh_rates = ([300, 240, 165, 144, 120, 75, 60, 59, 50, 40] + @hardware_data[:displays].map do |display|
|
||||||
|
display[:refresh_rates]
|
||||||
|
end).flatten.uniq.sort.reverse.map { |r| [r, r] }
|
||||||
|
|
||||||
|
@settings = {}
|
||||||
|
|
||||||
|
# General
|
||||||
|
@settings[:default_to_first_person] = Setting.new(:general, :default_to_first_person, "Default to First Person", TYPE_REGISTRY, "Options\\DefaultToFirstPerson", true)
|
||||||
|
@settings[:background_downloads] = Setting.new(:general, :background_downloads, "Background Downloads", TYPE_REGISTRY, "BackgroundDownloadingEnabled", true)
|
||||||
|
@settings[:hints_enabled] = Setting.new(:general, :hints_enabled, "Enable Hints", TYPE_REGISTRY, "HintsEnabled", true)
|
||||||
|
@settings[:chat_log] = Setting.new(:general, :chat_log, "Enable Chat Log", TYPE_REGISTRY, "ClientChatLog", true)
|
||||||
|
@settings[:show_fps] = Setting.new(:general, :show_fps, "Show FPS", TYPE_REGISTRY, "Networking\\Debug\\ShowFps", true)
|
||||||
|
@settings[:show_velocity] = Setting.new(:general, :show_velocity, "Show Velocity", TYPE_REGISTRY, "ShowVelocity", true)
|
||||||
|
@settings[:show_damage_numbers] = Setting.new(:general, :show_damage_numbers, "Show Damage Numbers", TYPE_REGISTRY, "Options\\HitDamageOnScreen", true)
|
||||||
|
|
||||||
|
# Audio
|
||||||
|
@settings[:master_volume] = Setting.new(:audio, :master_volume, "Master Volume", TYPE_REGISTRY, "Sound\\master volume", 1.0)
|
||||||
|
@settings[:master_enabled] = Setting.new(:audio, :master_enabled, "Master Volume Enabled", TYPE_REGISTRY, "Sound\\master enabled", true)
|
||||||
|
@settings[:sound_effects_volume] = Setting.new(:audio, :sound_effects_volume, "Sound Effects", TYPE_REGISTRY, "Sound\\sound volume", 0.40)
|
||||||
|
@settings[:sound_effects_enabled] = Setting.new(:audio, :sound_effects_enabled, "Sound Effects Enabled", TYPE_REGISTRY, "Sound\\sound enabled", true)
|
||||||
|
@settings[:sound_dialog_volume] = Setting.new(:audio, :sound_dialog_volume, "Dialog", TYPE_REGISTRY, "Sound\\dialog volume", 0.75)
|
||||||
|
@settings[:sound_dialog_enabled] = Setting.new(:audio, :sound_dialog_enabled, "Dialog Enabled", TYPE_REGISTRY, "Sound\\dialog enabled", true)
|
||||||
|
@settings[:sound_music_volume] = Setting.new(:audio, :sound_music_volume, "Music", TYPE_REGISTRY, "Sound\\music volume", 0.75)
|
||||||
|
@settings[:sound_music_enabled] = Setting.new(:audio, :sound_music_enabled, "Music Enabled", TYPE_REGISTRY, "Sound\\music enabled", true)
|
||||||
|
@settings[:sound_cinematic_volume] = Setting.new(:audio, :sound_cinematic_volume, "Cinematic", TYPE_REGISTRY, "Sound\\cinematic volume", 0.75)
|
||||||
|
@settings[:sound_cinematic_enabled] = Setting.new(:audio, :sound_cinematic_enabled, "Cinematic Enabled", TYPE_REGISTRY, "Sound\\cinematic enabled", true)
|
||||||
|
|
||||||
|
@settings[:sound_in_background] = Setting.new(:audio, :sound_in_background, "Play Sound with Game in Background", TYPE_REGISTRY, "Sound\\mute in background", false)
|
||||||
|
|
||||||
|
# Video
|
||||||
|
@settings[:resolution_width] = Setting.new(:video, :resolution_width, "Resolution", TYPE_LIBCONFIG, "Render:Width", resolutions.first[0], resolutions.map { |a| [a[0], a[0]] })
|
||||||
|
@settings[:resolution_height] = Setting.new(:video, :resolution_height, "Resolution", TYPE_LIBCONFIG, "Render:Height", resolutions.first[1], resolutions.map { |a| [a[1], a[1]] })
|
||||||
|
@settings[:windowed_mode] = Setting.new(:video, :windowed_mode, "Windowed Mode", TYPE_LIBCONFIG, "Render:FullscreenMode", 2, [["Windowed", 0], ["Fullscreen", 1], ["Borderless", 2]], true)
|
||||||
|
@settings[:vsync] = Setting.new(:video, :vsync, "Enable VSync", TYPE_LIBCONFIG, "Render:DisableVSync", true)
|
||||||
|
@settings[:fps] = Setting.new(:video, :fps, "FPS Limit", TYPE_LIBCONFIG, "Render:MaxFPS", refresh_rates.first[1], refresh_rates)
|
||||||
|
@settings[:anti_aliasing] = Setting.new(:video, :anti_aliasing, "Anti-aliasing", TYPE_REGISTRY, "System Settings\\Antialiasing_Mode", 0x80000001, [["None", 0], ["2x", 0x80000000], ["4x", 0x80000001], ["8x", 0x80000002]], true)
|
||||||
|
|
||||||
|
# Performance
|
||||||
|
@settings[:texture_detail] = Setting.new(:performance, :texture_detail, "Texture Detail", TYPE_REGISTRY, "System Settings\\Texture_Resolution", 0, [["High",0], ["Medium", 1], ["Low", 2]], true)
|
||||||
|
@settings[:texture_filtering] = Setting.new(:performance, :texture_filtering, "Texture Filtering", TYPE_REGISTRY, "System Settings\\Texture_Filter_Mode", 3, [["Bilinear", 0], ["Trilinear", 1], ["Anisotropic 2x", 2], ["Anisotropic 4x", 3], ["Anisotropic 8x", 4], ["Anisotropic 16x", 5]], true)
|
||||||
|
@settings[:shadow_resolution] = Setting.new(:performance, :shadow_resolution, "Shadow Resolution", TYPE_REGISTRY, "System Settings\\Dynamic_Shadow_Resolution", 512, [["128", 128], ["256", 256], ["512", 512], ["1024", 1024], ["2048*", 2048], ["4096*", 4096]], true)
|
||||||
|
@settings[:high_quality_shadows] = Setting.new(:general, :high_quality_shadows, "High Quality Shadows", TYPE_REGISTRY, "HighQualityShadows", true)
|
||||||
|
|
||||||
|
load_settings
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(key)
|
||||||
|
@settings[key]
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_value(key)
|
||||||
|
setting = get(key)
|
||||||
|
|
||||||
|
if setting.options.is_a?(Array) && setting.indexed
|
||||||
|
setting.options[setting.options.map(&:last).index(setting.value)][0]
|
||||||
|
else
|
||||||
|
setting.value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_value(key, value)
|
||||||
|
setting = get(key)
|
||||||
|
|
||||||
|
if setting.options.is_a?(Array)
|
||||||
|
setting.value = setting.options.find { |v| v[0] == value }[1]
|
||||||
|
elsif setting.options.is_a?(Hash)
|
||||||
|
setting.value = value.clamp(setting.options[:min], setting.options[:max])
|
||||||
|
else
|
||||||
|
setting.value = value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_settings
|
||||||
|
load_from_registry
|
||||||
|
load_from_cfg
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_from_registry
|
||||||
|
@settings.each do |_key, setting|
|
||||||
|
next unless setting.type == TYPE_REGISTRY
|
||||||
|
|
||||||
|
data = nil
|
||||||
|
begin
|
||||||
|
data = read_reg(setting.key)
|
||||||
|
rescue Win32::Registry::Error
|
||||||
|
end
|
||||||
|
next unless data
|
||||||
|
|
||||||
|
if setting.value.is_a?(TrueClass) || setting.value.is_a?(FalseClass)
|
||||||
|
setting.value = data == 1
|
||||||
|
elsif setting.value.is_a?(Float)
|
||||||
|
if setting.group == :audio
|
||||||
|
setting.value = data.to_f / 100.0
|
||||||
|
else
|
||||||
|
setting.value = data
|
||||||
|
end
|
||||||
|
elsif setting.value.is_a?(Integer)
|
||||||
|
setting.value = data
|
||||||
|
else
|
||||||
|
raise "UNKNOWN VALUE TYPE: #{setting.value.class}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_from_cfg
|
||||||
|
@cfg_hash = {}
|
||||||
|
|
||||||
|
if @cfg
|
||||||
|
in_hash = false
|
||||||
|
@cfg.lines.each do |line|
|
||||||
|
line = line.strip
|
||||||
|
break if line.start_with?("}")
|
||||||
|
|
||||||
|
if line.start_with?("{")
|
||||||
|
in_hash = true
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
|
next unless in_hash
|
||||||
|
|
||||||
|
parts = line.split("=").map { |l| l.strip.sub(";", "")}
|
||||||
|
@cfg_hash[parts.first] = parts.last
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@cfg_hash.each do |key, value|
|
||||||
|
next if value.start_with?("\"")
|
||||||
|
|
||||||
|
begin
|
||||||
|
@cfg_hash[key] = Integer(value)
|
||||||
|
rescue ArgumentError # Not an int
|
||||||
|
@cfg_hash[key] = value == "true" ? true : false if value == "true" || value == "false"
|
||||||
|
@cfg_hash[key] = !@cfg_hash[key] if key == "DisableVSync" # UI shows enable vsync, cfg stores disable vsync
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@settings.each do |key, setting|
|
||||||
|
next unless setting.type == TYPE_LIBCONFIG
|
||||||
|
|
||||||
|
cfg_key = setting.key.split(":").last
|
||||||
|
|
||||||
|
v = @cfg_hash[cfg_key]
|
||||||
|
if v != nil
|
||||||
|
if v.is_a?(TrueClass) || v.is_a?(FalseClass)
|
||||||
|
setting.value = v
|
||||||
|
elsif v.is_a?(Integer)
|
||||||
|
i = setting.options.map(&:last).index(v) || 0
|
||||||
|
if ["Width", "Height"].include?(cfg_key)
|
||||||
|
set_value(key, setting.options[i][0])
|
||||||
|
elsif cfg_key == "MaxFPS"
|
||||||
|
setting.value = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@cfg_hash[cfg_key] = setting.value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def save_settings!
|
||||||
|
save_to_registry!
|
||||||
|
save_to_cfg!
|
||||||
|
end
|
||||||
|
|
||||||
|
def save_to_registry!
|
||||||
|
@settings.each do |_key, setting|
|
||||||
|
next unless setting.type == TYPE_REGISTRY
|
||||||
|
|
||||||
|
if setting.value.is_a?(TrueClass) || setting.value.is_a?(FalseClass)
|
||||||
|
write_reg(setting.key, setting.value ? 1 : 0)
|
||||||
|
elsif setting.value.is_a?(Float)
|
||||||
|
if setting.group == :audio
|
||||||
|
write_reg(setting.key, (setting.value * 100.0).round.clamp(0, 100))
|
||||||
|
else
|
||||||
|
write_reg(setting.key, setting.value)
|
||||||
|
end
|
||||||
|
elsif setting.value.is_a?(Integer)
|
||||||
|
write_reg(setting.key, setting.value)
|
||||||
|
else
|
||||||
|
raise "UNKNOWN VALUE TYPE: #{setting.value.class}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def save_to_cfg!
|
||||||
|
@settings.each do |key, setting|
|
||||||
|
next unless setting.type == TYPE_LIBCONFIG
|
||||||
|
|
||||||
|
cfg_key = setting.key.split(":").last
|
||||||
|
|
||||||
|
v = @cfg_hash[cfg_key]
|
||||||
|
if v
|
||||||
|
# UI shows enable vsync, cfg stores disable vsync
|
||||||
|
@cfg_hash[cfg_key] = cfg_key == "DisableVSync" ? !setting.value : setting.value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
string = "Render : \n{\n"
|
||||||
|
|
||||||
|
@cfg_hash.each do |key, value|
|
||||||
|
string += " #{key} = #{value.to_s};\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
string += "};\n"
|
||||||
|
|
||||||
|
FileUtils.mkdir_p(File.dirname(@engine_cfg_path)) unless Dir.exist?(File.dirname(@engine_cfg_path))
|
||||||
|
File.write(@engine_cfg_path, string)
|
||||||
|
end
|
||||||
|
|
||||||
|
def read_reg(key)
|
||||||
|
keys = key.split("\\")
|
||||||
|
sub_key = keys.size > 1 ? keys[0..(keys.size - 2)].join("\\") : ""
|
||||||
|
target_key = keys.last
|
||||||
|
reg_key = "#{@win32_registry_base}\\#{sub_key}".freeze
|
||||||
|
|
||||||
|
value = nil
|
||||||
|
|
||||||
|
Win32::Registry::HKEY_CURRENT_USER.open(reg_key) do |reg|
|
||||||
|
value = reg[target_key]
|
||||||
|
end
|
||||||
|
|
||||||
|
value
|
||||||
|
end
|
||||||
|
|
||||||
|
def write_reg(key, value)
|
||||||
|
keys = key.split("\\")
|
||||||
|
sub_key = keys.size > 1 ? keys[0..(keys.size - 2)].join("\\") : ""
|
||||||
|
target_key = keys.last
|
||||||
|
reg_key = "#{@win32_registry_base}#{sub_key.empty? ? '' : "\\#{sub_key}"}".freeze
|
||||||
|
|
||||||
|
begin
|
||||||
|
Win32::Registry::HKEY_CURRENT_USER.open(reg_key, Win32::Registry::KEY_WRITE) do |reg|
|
||||||
|
reg[target_key] = value
|
||||||
|
end
|
||||||
|
rescue Win32::Registry::Error
|
||||||
|
result = Win32::Registry::HKEY_CURRENT_USER.create(reg_key)
|
||||||
|
|
||||||
|
result.write_i(target_key, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
169
lib/hardware_survey.rb
Normal file
169
lib/hardware_survey.rb
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
class W3DHub
|
||||||
|
class HardwareSurvey
|
||||||
|
attr_reader :data
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
@data = {
|
||||||
|
displays: [],
|
||||||
|
system: {
|
||||||
|
motherboard: {},
|
||||||
|
operating_system: {},
|
||||||
|
cpus: [],
|
||||||
|
cpu_instruction_sets: {},
|
||||||
|
ram: 0,
|
||||||
|
gpus: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Hardware survey only works on Windows atm
|
||||||
|
return unless RbConfig::CONFIG["host_os"] =~ /mswin|msys|mingw|cygwin/
|
||||||
|
|
||||||
|
lib_dir = File.dirname($LOADED_FEATURES.find { |file| file.include?("gosu.so") })
|
||||||
|
SDL.load_lib("#{lib_dir}64/SDL2.dll")
|
||||||
|
# Gosu already handles this
|
||||||
|
# SDL.VideoInit(nil)
|
||||||
|
|
||||||
|
query_displays
|
||||||
|
query_motherboard
|
||||||
|
query_operating_system
|
||||||
|
query_cpus
|
||||||
|
query_ram
|
||||||
|
query_gpus
|
||||||
|
|
||||||
|
@data.freeze
|
||||||
|
end
|
||||||
|
|
||||||
|
def query_displays
|
||||||
|
SDL.GetNumVideoDisplays.times do |d|
|
||||||
|
modes = []
|
||||||
|
refresh_rates = []
|
||||||
|
|
||||||
|
SDL.GetNumDisplayModes(d).times do |m|
|
||||||
|
mode = SDL::DisplayMode.new
|
||||||
|
SDL.GetDisplayMode(d, m, mode)
|
||||||
|
|
||||||
|
refresh_rates << mode[:refresh_rate]
|
||||||
|
|
||||||
|
modes << [mode[:w], mode[:h]]
|
||||||
|
end
|
||||||
|
|
||||||
|
@data[:displays] << {
|
||||||
|
name: SDL.GetDisplayName(d).read_string,
|
||||||
|
refresh_rates: refresh_rates.uniq.sort.reverse,
|
||||||
|
resolutions: modes.uniq.sort.reverse
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def query_motherboard
|
||||||
|
Win32::Registry::HKEY_LOCAL_MACHINE.open("HARDWARE\\DESCRIPTION\\System\\BIOS", Win32::Registry::KEY_READ) do |reg|
|
||||||
|
@data[:system][:motherboard][:manufacturer] = safe_reg(reg, "SystemManufacturer")
|
||||||
|
@data[:system][:motherboard][:model] = safe_reg(reg, "SystemProductName")
|
||||||
|
@data[:system][:motherboard][:bios_vendor] = safe_reg(reg, "BIOSVendor")
|
||||||
|
@data[:system][:motherboard][:bios_release_date] = safe_reg(reg, "BIOSReleaseDate")
|
||||||
|
@data[:system][:motherboard][:bios_version] = safe_reg(reg, "BIOSVersion")
|
||||||
|
end
|
||||||
|
rescue Win32::Registry::Error
|
||||||
|
@data[:system][:motherboard][:manufacturer] = "Unknown"
|
||||||
|
@data[:system][:motherboard][:model] = "Unknown"
|
||||||
|
@data[:system][:motherboard][:bios_vendor] = "Unknown"
|
||||||
|
@data[:system][:motherboard][:bios_release_date] = "Unknown"
|
||||||
|
@data[:system][:motherboard][:bios_version] = "Unknown"
|
||||||
|
end
|
||||||
|
|
||||||
|
def query_operating_system
|
||||||
|
Win32::Registry::HKEY_LOCAL_MACHINE.open("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", Win32::Registry::KEY_READ) do |reg|
|
||||||
|
@data[:system][:operating_system][:name] = safe_reg(reg, "ProductName")
|
||||||
|
@data[:system][:operating_system][:build] = safe_reg(reg, "CurrentBuild")
|
||||||
|
@data[:system][:operating_system][:version] = safe_reg(reg, "DisplayVersion")
|
||||||
|
@data[:system][:operating_system][:edition] = safe_reg(reg, "EditionID")
|
||||||
|
end
|
||||||
|
rescue Win32::Registry::Error
|
||||||
|
@data[:system][:operating_system][:name] = "Unknown"
|
||||||
|
@data[:system][:operating_system][:build] = "Unknown"
|
||||||
|
@data[:system][:operating_system][:version] = "Unknown"
|
||||||
|
@data[:system][:operating_system][:edition] = "Unknown"
|
||||||
|
end
|
||||||
|
|
||||||
|
def query_cpus
|
||||||
|
begin
|
||||||
|
Win32::Registry::HKEY_LOCAL_MACHINE.open("HARDWARE\\DESCRIPTION\\System\\CentralProcessor", Win32::Registry::KEY_READ) do |reg|
|
||||||
|
i = 0
|
||||||
|
|
||||||
|
reg.each_key do |key|
|
||||||
|
reg.open(key) do |cpu|
|
||||||
|
@data[:system][:cpus] << {
|
||||||
|
manufacturer: safe_reg(cpu, "VendorIdentifier", "Unknown"),
|
||||||
|
model: safe_reg(cpu, "ProcessorNameString").strip,
|
||||||
|
mhz: safe_reg(cpu, "~MHz"),
|
||||||
|
family: safe_reg(cpu, "Identifier")
|
||||||
|
}
|
||||||
|
|
||||||
|
i += 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
rescue Win32::Registry::Error
|
||||||
|
end
|
||||||
|
|
||||||
|
instruction_sets = %w[ HasRDTSC HasAltiVec HasMMX Has3DNow HasSSE HasSSE2 HasSSE3 HasSSE41 HasSSE42 HasAVX HasAVX2 HasAVX512F HasARMSIMD HasNEON ] # HasLSX HasLASX # These cause a crash atm
|
||||||
|
list = []
|
||||||
|
instruction_sets.each do |i|
|
||||||
|
if SDL.send(i).positive?
|
||||||
|
list << i.sub("Has", "")
|
||||||
|
end
|
||||||
|
|
||||||
|
@data[:system][:cpu_instruction_sets][:"#{i.sub("Has", "").downcase}"] = SDL.send(i).positive?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def query_ram
|
||||||
|
@data[:system][:ram] = SDL.GetSystemRAM
|
||||||
|
end
|
||||||
|
|
||||||
|
def query_gpus
|
||||||
|
Win32::Registry::HKEY_LOCAL_MACHINE.open("SYSTEM\\ControlSet001\\Control\\Class\\{4d36e968-e325-11ce-bfc1-08002be10318}", Win32::Registry::KEY_READ) do |reg|
|
||||||
|
i = 0
|
||||||
|
|
||||||
|
reg.each_key do |key, _|
|
||||||
|
next unless key.start_with?("0")
|
||||||
|
|
||||||
|
reg.open(key) do |device|
|
||||||
|
vram = -1
|
||||||
|
|
||||||
|
begin
|
||||||
|
vram = device["HardwareInformation.qwMemorySize"].to_i
|
||||||
|
rescue Win32::Registry::Error, TypeError
|
||||||
|
begin
|
||||||
|
vram = device["HardwareInformation.MemorySize"].to_i
|
||||||
|
rescue Win32::Registry::Error, TypeError
|
||||||
|
vram = -1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
next if vram.negative?
|
||||||
|
|
||||||
|
vram = vram / 1024.0 / 1024.0
|
||||||
|
|
||||||
|
@data[:system][:gpus] << {
|
||||||
|
manufacturer: safe_reg(device, "ProviderName"),
|
||||||
|
model: safe_reg(device, "DriverDesc"),
|
||||||
|
vram: vram.round,
|
||||||
|
driver_date: safe_reg(device, "DriverDate"),
|
||||||
|
driver_version: safe_reg(device, "DriverVersion")
|
||||||
|
}
|
||||||
|
|
||||||
|
i += 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
rescue Win32::Registry::Error
|
||||||
|
end
|
||||||
|
|
||||||
|
def safe_reg(reg, key, default_value = "Unknown")
|
||||||
|
reg[key]
|
||||||
|
rescue Win32::Registry::Error
|
||||||
|
default_value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -184,7 +184,7 @@ 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|
|
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 = []
|
||||||
|
|
||||||
items << { label: I18n.t(:"games.game_settings"), block: proc { Store.application_manager.wwconfig(game.id, channel.id) } }
|
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 { 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) } } unless Store.offline_mode
|
items << { label: I18n.t(:"games.game_modifications"), block: proc { populate_game_modifications(game, channel) } } unless Store.offline_mode
|
||||||
|
|||||||
@@ -147,6 +147,9 @@ class W3DHub
|
|||||||
else
|
else
|
||||||
# FIXME: Failed to retreive!
|
# FIXME: Failed to retreive!
|
||||||
BackgroundWorker.foreground_job(-> {}, ->(_){ @status_label.value = "FAILED TO RETREIVE APPS LIST" })
|
BackgroundWorker.foreground_job(-> {}, ->(_){ @status_label.value = "FAILED TO RETREIVE APPS LIST" })
|
||||||
|
|
||||||
|
@offline_mode = true
|
||||||
|
Store.offline_mode = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -160,6 +163,8 @@ class W3DHub
|
|||||||
end
|
end
|
||||||
|
|
||||||
Api.on_thread(:package_details, packages) do |package_details|
|
Api.on_thread(:package_details, packages) do |package_details|
|
||||||
|
package_details ||= nil
|
||||||
|
|
||||||
package_details&.each do |package|
|
package_details&.each do |package|
|
||||||
path = Cache.package_path(package.category, package.subcategory, package.name, package.version)
|
path = Cache.package_path(package.category, package.subcategory, package.name, package.version)
|
||||||
generated_icon_path = "#{GAME_ROOT_PATH}/media/icons/#{package.subcategory}.png"
|
generated_icon_path = "#{GAME_ROOT_PATH}/media/icons/#{package.subcategory}.png"
|
||||||
|
|||||||
26
lib/states/dialog.rb
Normal file
26
lib/states/dialog.rb
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
class W3DHub
|
||||||
|
class States
|
||||||
|
class Dialog < CyberarmEngine::GuiState
|
||||||
|
def draw
|
||||||
|
previous_state&.draw
|
||||||
|
|
||||||
|
Gosu.flush
|
||||||
|
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
super
|
||||||
|
|
||||||
|
return unless window.current_state == self
|
||||||
|
|
||||||
|
window.states.reverse.each do |state|
|
||||||
|
# Don't update ourselves, forever
|
||||||
|
next if state == self && state.is_a?(CyberarmEngine::GuiState)
|
||||||
|
|
||||||
|
state.update
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
263
lib/states/dialogs/game_settings_dialog.rb
Normal file
263
lib/states/dialogs/game_settings_dialog.rb
Normal file
@@ -0,0 +1,263 @@
|
|||||||
|
class W3DHub
|
||||||
|
class States
|
||||||
|
class GameSettingsDialog < Dialog
|
||||||
|
BUTTON_STYLE = { text_size: 18, padding_top: 3, padding_bottom: 3, padding_left: 3, padding_right: 3 }
|
||||||
|
|
||||||
|
def setup
|
||||||
|
window.show_cursor = true
|
||||||
|
|
||||||
|
theme(THEME)
|
||||||
|
|
||||||
|
@app_id = @options[:app_id]
|
||||||
|
@channel = @options[:channel]
|
||||||
|
|
||||||
|
@game_settings = GameSettings.new(@app_id, @channel)
|
||||||
|
|
||||||
|
background 0xee_444444
|
||||||
|
|
||||||
|
stack(width: 1.0, max_width: 720, height: 1.0, max_height: 680, v_align: :center, h_align: :center, background: 0xee_222222, border_thickness: 2, border_color: 0xff_444444, padding: 10) do
|
||||||
|
flow(width: 1.0, height: 0.1, padding: 8) do
|
||||||
|
background Store.application_manager.color(@app_id)
|
||||||
|
|
||||||
|
title @options[:title] || Store.application_manager.name(@app_id) || "Game Settings", fill: true, text_align: :center
|
||||||
|
end
|
||||||
|
|
||||||
|
stack(width: 1.0, fill: true, padding: 16, margin_top: 10) do
|
||||||
|
flow(width: 1.0, fill: true) do
|
||||||
|
stack(width: 0.5, height: 1.0, margin_right: 8) do
|
||||||
|
tagline "General"
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Default to First Person", fill: true
|
||||||
|
toggle_button tip: "Default to First Person", checked: @game_settings.get_value(:default_to_first_person), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:default_to_first_person, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Background Downloads", fill: true
|
||||||
|
toggle_button tip: "Background Downloads", checked: @game_settings.get_value(:background_downloads), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:background_downloads, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Enable Hints", fill: true
|
||||||
|
toggle_button tip: "Enable Hints", checked: @game_settings.get_value(:hints_enabled), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:hints_enabled, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Enable Chat Log", fill: true
|
||||||
|
toggle_button tip: "Enable Chat Log", checked: @game_settings.get_value(:chat_log), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:chat_log, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Show FPS", fill: true
|
||||||
|
toggle_button tip: "Show FPS", checked: @game_settings.get_value(:show_fps), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:show_fps, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Show Velocity", fill: true
|
||||||
|
toggle_button tip: "Show Velocity", checked: @game_settings.get_value(:show_velocity), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:show_velocity, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Show Damage Numbers", fill: true
|
||||||
|
toggle_button tip: "Show Damage Numbers", checked: @game_settings.get_value(:show_damage_numbers), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:show_damage_numbers, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
stack(width: 0.5, height: 1.0, margin_left: 8) do
|
||||||
|
tagline "Video"
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
res_options = @game_settings.get(:resolution_width).options.each_with_index.map do |w, i|
|
||||||
|
"#{w[0]}x#{@game_settings.get(:resolution_height).options[i][0]}"
|
||||||
|
end
|
||||||
|
|
||||||
|
current_res = "#{@game_settings.get_value(:resolution_width)}x#{@game_settings.get_value(:resolution_height)}"
|
||||||
|
|
||||||
|
para "Resolution", fill: true
|
||||||
|
list_box items: res_options, choose: current_res, width: 172, **BUTTON_STYLE do |value|
|
||||||
|
w, h = value.split("x", 2)
|
||||||
|
|
||||||
|
@game_settings.set_value(:resolution_width, w.to_i)
|
||||||
|
@game_settings.set_value(:resolution_height, h.to_i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Windowed Mode", fill: true
|
||||||
|
list_box items: @game_settings.get(:windowed_mode).options.map { |v| v[0] }, choose: @game_settings.get_value(:windowed_mode), width: 172, **BUTTON_STYLE do |value|
|
||||||
|
@game_settings.set_value(:windowed_mode, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Enable VSync", fill: true
|
||||||
|
toggle_button tip: "Enable VSync", checked: @game_settings.get_value(:vsync), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:vsync, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Anti-aliasing", fill: true
|
||||||
|
list_box items: @game_settings.get(:anti_aliasing).options.map { |v| v[0] }, choose: @game_settings.get_value(:anti_aliasing), width: 72, **BUTTON_STYLE do |value|
|
||||||
|
@game_settings.set_value(:anti_aliasing, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, fill: true, margin_top: 16) do
|
||||||
|
stack(width: 0.5, height: 1.0, margin_right: 8) do
|
||||||
|
tagline "Audio"
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Master Volume", fill: true
|
||||||
|
slider(height: 1.0, width: 172, value: @game_settings.get_value(:master_volume), margin_right: 8).subscribe(:changed) do |slider|
|
||||||
|
@game_settings.set_value(:master_volume, slider.value)
|
||||||
|
end
|
||||||
|
|
||||||
|
toggle_button tip: "Sound Effects", checked: @game_settings.get(:master_enabled), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:master_enabled, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Sound Effects", fill: true
|
||||||
|
slider(height: 1.0, width: 172, value: @game_settings.get_value(:sound_effects_volume), margin_right: 8).subscribe(:changed) do |slider|
|
||||||
|
@game_settings.set_value(:sound_effects_volume, slider.value)
|
||||||
|
end
|
||||||
|
|
||||||
|
toggle_button tip: "Sound Effects", checked: @game_settings.get(:sound_effects_enabled), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:sound_effects_enabled, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Dialogue", fill: true
|
||||||
|
slider(height: 1.0, width: 172, value: @game_settings.get_value(:sound_dialog_volume), margin_right: 8).subscribe(:changed) do |slider|
|
||||||
|
@game_settings.set_value(:sound_dialog_volume, slider.value)
|
||||||
|
end
|
||||||
|
|
||||||
|
toggle_button tip: "Dialogue", checked: @game_settings.get_value(:sound_dialog_enabled), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:sound_dialog_enabled, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Music", fill: true
|
||||||
|
slider(height: 1.0, width: 172, value: @game_settings.get_value(:sound_music_volume), margin_right: 8).subscribe(:changed) do |slider|
|
||||||
|
@game_settings.set_value(:sound_music_volume, slider.value)
|
||||||
|
end
|
||||||
|
|
||||||
|
toggle_button tip: "Music", checked: @game_settings.get_value(:sound_music_enabled), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:sound_music_enabled, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Cinematic", fill: true
|
||||||
|
slider(height: 1.0, width: 172, value: @game_settings.get_value(:sound_cinematic_volume), margin_right: 8).subscribe(:changed) do |slider|
|
||||||
|
@game_settings.set_value(:sound_cinematic_volume, slider.value)
|
||||||
|
end
|
||||||
|
|
||||||
|
toggle_button tip: "Cinematic", checked: @game_settings.get_value(:sound_cinematic_enabled), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:sound_cinematic_enabled, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Play Sound with Game in Background", fill: true
|
||||||
|
toggle_button tip: "Play Sound with Game in Background", checked: @game_settings.get_value(:sound_in_background), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:sound_in_background, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
stack(width: 0.5, height: 1.0, margin_left: 8) do
|
||||||
|
tagline "Performance"
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Texture Detail", fill: true
|
||||||
|
list_box items: @game_settings.get(:texture_detail).options.map { |v| v[0] }, choose: @game_settings.get_value(:texture_detail), width: 172, **BUTTON_STYLE do |value|
|
||||||
|
@game_settings.set_value(:texture_detail, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Texture Filtering", fill: true
|
||||||
|
list_box items: @game_settings.get(:texture_filtering).options.map { |v| v[0] }, choose: @game_settings.get_value(:texture_filtering), width: 172, **BUTTON_STYLE do |value|
|
||||||
|
@game_settings.set_value(:texture_filtering, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
# para "Shader Detail", fill: true
|
||||||
|
# list_box items: @game_settings.get(:texture_filtering).options.map { |v| v[0] }, choose: @game_settings.get_value(:texture_filtering), width: 172, **BUTTON_STYLE do |value|
|
||||||
|
# @game_settings.set_value(:texture_filtering, value)
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
# flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
# para "Post Processing Detail", fill: true
|
||||||
|
# list_box items: @game_settings.get(:texture_filtering).options.map { |v| v[0] }, choose: @game_settings.get_value(:texture_filtering), width: 172, **BUTTON_STYLE do |value|
|
||||||
|
# @game_settings.set_value(:texture_filtering, value)
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "Shadow Resolution", fill: true
|
||||||
|
list_box items: @game_settings.get(:shadow_resolution).options.map { |v| v[0] }, choose: @game_settings.get_value(:shadow_resolution), width: 172, **BUTTON_STYLE do |value|
|
||||||
|
@game_settings.set_value(:shadow_resolution, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "High Quality Shadows", fill: true
|
||||||
|
toggle_button tip: "High Quality Shadows", checked: @game_settings.get_value(:background_downloads), **BUTTON_STYLE do |btn|
|
||||||
|
@game_settings.set_value(:background_downloads, btn.value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 24, margin: 4, margin_left: 10) do
|
||||||
|
para "FPS Limit", fill: true
|
||||||
|
list_box items: @game_settings.get(:fps).options.map { |v| v[0] }, choose: @game_settings.get_value(:fps), width: 172, **BUTTON_STYLE do |value|
|
||||||
|
@game_settings.set_value(:fps, value.to_i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(width: 1.0, height: 0.1, padding: 8) do
|
||||||
|
button "Cancel", width: 0.25 do
|
||||||
|
pop_state
|
||||||
|
@options[:cancel_callback]&.call
|
||||||
|
end
|
||||||
|
|
||||||
|
flow(fill: true)
|
||||||
|
|
||||||
|
button "Save", width: 0.25 do
|
||||||
|
pop_state
|
||||||
|
@game_settings.save_settings!
|
||||||
|
|
||||||
|
@options[:accept_callback]&.call
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -70,6 +70,7 @@ end
|
|||||||
require "i18n"
|
require "i18n"
|
||||||
require "websocket-client-simple"
|
require "websocket-client-simple"
|
||||||
require "English"
|
require "English"
|
||||||
|
require "sdl2"
|
||||||
|
|
||||||
I18n.load_path << Dir["#{W3DHub::GAME_ROOT_PATH}/locales/*.yml"]
|
I18n.load_path << Dir["#{W3DHub::GAME_ROOT_PATH}/locales/*.yml"]
|
||||||
I18n.default_locale = :en
|
I18n.default_locale = :en
|
||||||
@@ -87,6 +88,8 @@ require_relative "lib/settings"
|
|||||||
require_relative "lib/mixer"
|
require_relative "lib/mixer"
|
||||||
require_relative "lib/ico"
|
require_relative "lib/ico"
|
||||||
require_relative "lib/multicast_server"
|
require_relative "lib/multicast_server"
|
||||||
|
require_relative "lib/hardware_survey"
|
||||||
|
require_relative "lib/game_settings"
|
||||||
require_relative "lib/background_worker"
|
require_relative "lib/background_worker"
|
||||||
require_relative "lib/application_manager"
|
require_relative "lib/application_manager"
|
||||||
require_relative "lib/application_manager/manifest"
|
require_relative "lib/application_manager/manifest"
|
||||||
@@ -103,11 +106,13 @@ require_relative "lib/states/boot"
|
|||||||
# require_relative "lib/states/interface"
|
# require_relative "lib/states/interface"
|
||||||
require_relative "lib/states/interface_redesign"
|
require_relative "lib/states/interface_redesign"
|
||||||
require_relative "lib/states/welcome"
|
require_relative "lib/states/welcome"
|
||||||
|
require_relative "lib/states/dialog"
|
||||||
require_relative "lib/states/message_dialog"
|
require_relative "lib/states/message_dialog"
|
||||||
require_relative "lib/states/prompt_dialog"
|
require_relative "lib/states/prompt_dialog"
|
||||||
require_relative "lib/states/confirm_dialog"
|
require_relative "lib/states/confirm_dialog"
|
||||||
require_relative "lib/states/direct_connect_dialog"
|
require_relative "lib/states/direct_connect_dialog"
|
||||||
require_relative "lib/states/game_settings_dialog"
|
# require_relative "lib/states/game_settings_dialog"
|
||||||
|
require_relative "lib/states/dialogs/game_settings_dialog"
|
||||||
|
|
||||||
require_relative "lib/api"
|
require_relative "lib/api"
|
||||||
require_relative "lib/api/service_status"
|
require_relative "lib/api/service_status"
|
||||||
|
|||||||
Reference in New Issue
Block a user