diff --git a/Gemfile.lock b/Gemfile.lock index 228bc23..4ccc712 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,16 +1,16 @@ GEM remote: https://gem.coop/ specs: - async (2.45.1) + async (2.46.0) console (~> 1.29) fiber-annotation io-event (~> 1.21) - async-http (0.104.0) + async-http (0.105.0) async (>= 2.35.1) async-pool (~> 0.12) io-endpoint (~> 0.18) io-stream (~> 0.14) - protocol-http (~> 0.66) + protocol-http (~> 0.72) protocol-http1 (~> 0.41) protocol-http2 (~> 0.28) protocol-url (~> 0.2) @@ -23,7 +23,7 @@ GEM protocol-websocket (~> 0.17) base64 (0.3.0) chunky_png (1.4.0) - console (1.37.0) + console (1.38.0) fiber-annotation fiber-local (~> 1.1) json @@ -48,7 +48,7 @@ GEM logger (1.7.0) openssl (4.0.2) protocol-hpack (1.5.1) - protocol-http (0.71.0) + protocol-http (0.72.0) protocol-http1 (0.41.0) protocol-http (~> 0.68) protocol-http2 (0.28.0) @@ -89,13 +89,13 @@ DEPENDENCIES sdl3-bindings CHECKSUMS - async (2.45.1) sha256=95849f7432eca535146c69f3078dab3c7228d0075ed71f48733f3e585dd7c267 - async-http (0.104.0) sha256=c5f436fe7778cee07031770b232d9feb412f1d80287a0b5dcbd1f6335a52ce6f + async (2.46.0) sha256=34f984733dbf63a997376346451ec995e858cacc3105e86ccfeaf8877b4f490b + async-http (0.105.0) sha256=55191969d5cf61be5fbc2e0aadd51d77085318ba192a5ff5e12e3aba0826906a async-pool (0.12.0) sha256=5580493dc024bd704dab2ed0bf1307100722e49cbb825c7965f8501194f58506 async-websocket (0.30.1) sha256=54bb8a8f184e4aa64434c7a78ecc55850a67a3d1dcd02e3ae787376e2c673936 base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b chunky_png (1.4.0) sha256=89d5b31b55c0cf4da3cf89a2b4ebc3178d8abe8cbaf116a1dba95668502fdcfe - console (1.37.0) sha256=8093b286c2595a063849c098594fee5155ecc7967d36f3aa8cbe7569c8f3efd7 + console (1.38.0) sha256=35b82f59130e95e9be6b832d9e539c8b3988fc192e4a8e9a86ab4922f44ad5de cyberarm_engine (0.25.1) sha256=6f851a2ed0a32bdd25fc619172b546a8e26eefeb13a62c509f226337170d0efe digest-crc (0.7.0) sha256=64adc23a26a241044cbe6732477ca1b3c281d79e2240bcff275a37a5a0d78c07 ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d @@ -111,7 +111,7 @@ CHECKSUMS logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203 openssl (4.0.2) sha256=1037ad2868ae58df9ad917891c0c0f9815a1172f6846d4bcdd508e4c2ee747c2 protocol-hpack (1.5.1) sha256=6feca238b8078da1cd295677d6f306c6001af92d75fe0643d33e6956cbc3ad91 - protocol-http (0.71.0) sha256=38577bf3df0bf0c3f7ee7e21b43fcb4bd7624e36f697dbe9c3eea344f14bd9ba + protocol-http (0.72.0) sha256=b153474785979495b9f2df78f0fdc2e02edc7e92c1f7ea00425eed73bd02194c protocol-http1 (0.41.0) sha256=9863874a1228948a896c3e7ea16d13a680c8f3ed50706007c78b7033018b0ea3 protocol-http2 (0.28.0) sha256=b7c6195dcfa80ec2484670e9fd8fc21024cc654a391aa0792433aff1188c1691 protocol-rack (0.23.0) sha256=63eec3341b20565b3dd155345fd1426ecbbed322cdc8a6accc993905388c03d7 diff --git a/lib/application_helper.rb b/lib/application_helper.rb index 00508fe..1150c27 100644 --- a/lib/application_helper.rb +++ b/lib/application_helper.rb @@ -24,11 +24,23 @@ module W3DHubLauncher env, "#{wine_command(app)}#{exe_path} -launcher #{args.join(' ')}" ) + Process.detach(pid) end - def self.join_server(app, server, password: nil, token: nil) + def self.join_server(app, server, password: nil, token: nil, multi: false) + parameters = [] + parameters << format("+connect %s:%s", server.address, server.port) + parameters << format("+netplayername \"%s\"", "cyberarm") + parameters << format("+password \"%s\"", password) if password + parameters << format("+userkey \"%s\"", token) if token + parameters << "+multi" if multi + + run( + app, + parameters.join(" ") + ) end end end diff --git a/lib/pages/server_browser.rb b/lib/pages/server_browser.rb index 61647ab..67ce4ac 100644 --- a/lib/pages/server_browser.rb +++ b/lib/pages/server_browser.rb @@ -16,15 +16,16 @@ module W3DHubLauncher w.subscribe(:clicked_left_mouse_button) do @games_filter.clear + @app_filters_container.children.each { |c| c.enabled = true } populate_server_list end end - flow(fill: true, height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY, margin_left: PADDING) do + @app_filters_container = flow(fill: true, height: 1.0, background_nine_slice: NINE_SLICE_ROUNDED, background_nine_slice_from_edge: NINE_SLICE_EDGE, background_nine_slice_color: ALPHA_GRAY, margin_left: PADDING) do MemCache[:applications].each do |app| next unless app.game? - button(safe_get_image("#{CACHE_PATH}/icon_#{app.id}.png"), style_class: [:app_icon_button], tip: app.name) do |btn| + button(safe_get_image("#{CACHE_PATH}/icon_#{app.id}.png"), style_class: [:app_icon_button], tag: :"app_filter_#{app.id}", tip: app.name) do |btn| if shift_down? @games_filter << app.id @games_filter.uniq! @@ -33,6 +34,10 @@ module W3DHubLauncher @games_filter << app.id end + buttons = btn.parent.children + filters = @games_filter.map { |f| :"app_filter_#{f}" } + buttons.each { |e| e.enabled = !filters.include?(e.style.tag) } + btn.enabled = false populate_server_list diff --git a/lib/states/interface.rb b/lib/states/interface.rb index f07f752..0b581ce 100644 --- a/lib/states/interface.rb +++ b/lib/states/interface.rb @@ -159,14 +159,16 @@ module W3DHubLauncher def populate_server_information(server) return unless @server_details_container.visible? + application = MemCache[:settings].applications.find { |app| app.id == server.game && app.channel == server.channel } + @server_details_container.clear do tagline server.name, width: 1.0, text_wrap: :none, tip: server.name - image safe_get_image("#{ROOT_PATH}/media/default_map_preview.png"), width: 1.0, tip: server.current_map, margin_bottom: PADDING + image safe_get_image("#{ROOT_PATH}/media/default_map_preview.png"), width: 1.0, aspect_ratio: 16 / 9.0, tip: server.current_map, margin_bottom: PADDING flow(width: 1.0) do - stack(fill: true) - button "JOIN SERVER", **CTA_BUTTON_THEME, width: 1.0, enabled: false, tip: "Game not installed I guess..." - stack(fill: true) + button "JOIN SERVER", **CTA_BUTTON_THEME, width: 1.0, enabled: !application.nil?, tip: application.nil? ? "Application not installed" : "" do + ApplicationHelper.join_server(application, server) + end end stack(width: 1.0, fill: true, scroll: true, margin_top: PADDING) do