mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 01:02:34 +00:00
Removed usages of eager_load, probably fixed application launching weirdness
This commit is contained in:
@@ -8,7 +8,7 @@ class W3DHub
|
||||
#! === W3D Hub API === !#
|
||||
|
||||
ENDPOINT = "https://secure.w3dhub.com"
|
||||
W3DHUB_API_CONNECTION = Excon.new(ENDPOINT, persistent: true, connect_timeout: 15)
|
||||
W3DHUB_API_CONNECTION = Excon.new(ENDPOINT, persistent: true, connect_timeout: 15, tcp_nodelay: true)
|
||||
# Method: POST
|
||||
# FORMAT: JSON
|
||||
|
||||
@@ -171,7 +171,7 @@ class W3DHub
|
||||
#! === Server List API === !#
|
||||
|
||||
SERVER_LIST_ENDPOINT = "https://gsh.w3dhub.com"
|
||||
SERVER_LIST_CONNECTION = Excon.new(SERVER_LIST_ENDPOINT, persistent: true, connect_timeout: 15)
|
||||
SERVER_LIST_CONNECTION = Excon.new(SERVER_LIST_ENDPOINT, persistent: true, connect_timeout: 15, tcp_nodelay: true)
|
||||
# Method: GET
|
||||
# FORMAT: JSON
|
||||
|
||||
|
||||
@@ -143,7 +143,9 @@ class W3DHub
|
||||
|
||||
def run(app_id, channel, *args)
|
||||
if (app_data = installed?(app_id, channel))
|
||||
pid = Process.spawn("#{wine_command(app_id, channel)}#{app_data[:install_path]}", *args)
|
||||
application_exe = W3DHub.unix? ? "\"#{app_data[:install_path]}\"" : app_data[:install_path]
|
||||
|
||||
pid = Process.spawn("#{wine_command(app_id, channel)}#{application_exe} #{args.join(' ')}")
|
||||
Process.detach(pid)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -525,7 +525,7 @@ class W3DHub
|
||||
system("#{W3DHub.tar_command} -xf \"#{package_path}\" -C \"#{temp_path}\"")
|
||||
|
||||
puts " Loading #{temp_path}/#{manifest_file.name}.patch..."
|
||||
patch_mix = W3DHub::Mixer::Reader.new(file_path: "#{temp_path}/#{manifest_file.name}.patch", ignore_crc_mismatches: true, eager_load: true)
|
||||
patch_mix = W3DHub::Mixer::Reader.new(file_path: "#{temp_path}/#{manifest_file.name}.patch", ignore_crc_mismatches: true)
|
||||
patch_info = JSON.parse(patch_mix.package.files.find { |f| f.name == ".w3dhub.patch" || f.name == ".bhppatch" }.data, symbolize_names: true)
|
||||
|
||||
repaired_path = "#{path}/#{manifest_file.name}"
|
||||
@@ -533,7 +533,7 @@ class W3DHub
|
||||
repaired_path = "#{path}/#{manifest_file.name.sub('data', 'Data')}" unless File.exist?(repaired_path) && path
|
||||
|
||||
puts " Loading #{repaired_path}..."
|
||||
target_mix = W3DHub::Mixer::Reader.new(file_path: repaired_path, ignore_crc_mismatches: true, eager_load: true)
|
||||
target_mix = W3DHub::Mixer::Reader.new(file_path: repaired_path, ignore_crc_mismatches: true)
|
||||
|
||||
puts " Removing files..." if patch_info[:removedFiles].size.positive?
|
||||
patch_info[:removedFiles].each do |file|
|
||||
|
||||
@@ -13,7 +13,7 @@ class W3DHub
|
||||
if File.exist?(path)
|
||||
path
|
||||
else
|
||||
response = Excon.get(uri)
|
||||
response = Excon.get(uri, tcp_nodelay: true)
|
||||
|
||||
if response.status == 200
|
||||
File.open(path, "wb") do |f|
|
||||
@@ -71,6 +71,7 @@ class W3DHub
|
||||
# Create a new connection due to some weirdness somewhere in Excon
|
||||
response = Excon.post(
|
||||
"#{Api::ENDPOINT}/apis/launcher/1/get-package",
|
||||
tcp_nodelay: true,
|
||||
headers: Api::DEFAULT_HEADERS.merge(headers),
|
||||
body: "data=#{JSON.dump({ category: package.category, subcategory: package.subcategory, name: package.name, version: package.version })}",
|
||||
chunk_size: 4_000_000,
|
||||
|
||||
@@ -135,7 +135,7 @@ class W3DHub
|
||||
class Reader
|
||||
attr_reader :package
|
||||
|
||||
def initialize(file_path:, ignore_crc_mismatches: false, eager_load: false, metadata_only: false, buffer_size: 32_000_000)
|
||||
def initialize(file_path:, ignore_crc_mismatches: false, metadata_only: false, buffer_size: 32_000_000)
|
||||
@package = Package.new
|
||||
|
||||
@buffer = MemoryBuffer.new(file_path: file_path, mode: "r", buffer_size: buffer_size)
|
||||
@@ -275,7 +275,7 @@ class W3DHub
|
||||
# after that is done, replace target file with temp file
|
||||
class Patcher
|
||||
def initialize(patch_file:, target_file:, temp_file:, buffer_size: 32_000_000)
|
||||
@patch_file = Reader.new(file_path: patch_file, eager_load: true)
|
||||
@patch_file = Reader.new(file_path: patch_file)
|
||||
@target_file = File.open(target_file)
|
||||
@temp_file = File.open(temp_file, "a+b")
|
||||
@buffer_size = buffer_size
|
||||
|
||||
Reference in New Issue
Block a user