Skip to content

Instantly share code, notes, and snippets.

@valeth
Last active October 25, 2017 22:38
Show Gist options
  • Save valeth/4b4f6752ca886c212984e408a9f2adc5 to your computer and use it in GitHub Desktop.
Save valeth/4b4f6752ca886c212984e408a9f2adc5 to your computer and use it in GitHub Desktop.
Wine Rakefile
default:
neptunia1:
world_of_warcraft:
arch: win64
# frozen_string_literal: true
prefix :neptunia1 do
procedure :setup do
sh "winetricks setup sandbox"
sh "winetricks devenum"
ln_sf File.join(__dir__, "setup"), drive_c
wine drive_c("setup/setup_hyperdimension_neptunia_rebirth1_2.0.0.1.exe")
wine drive_c("setup/setup_hyperdimension_neptunia_rebirth1_dlc_pack_2.0.0.1.exe")
end
procedure :run do
wine drive_c("GOG Games/Hyperdimension Neptunia ReBirth1/NeptuniaReBirth1.exe")
end
end
# frozen_string_literal: true
require "yaml"
require "shellwords"
# NOTE: put app tasks into rakelib
ENV.update(
"WINEPREFIX" => File.join(__dir__, "containers", "default"),
"WINEARCH" => "win32",
"WINEDEBUG" => "fixme-all"
)
CONFIG =
if File.exist?("config.yml")
YAML.safe_load(File.read("config.yml"))
else
{}
end
def set_prefix(prefix)
prefix = prefix.to_s
puts "Setting prefix configuration for #{prefix}"
ENV.update(
"WINEPREFIX" => File.join(__dir__, "containers", prefix),
"WINEARCH" => CONFIG.dig(prefix, "arch") || "win32"
)
end
def drive_c(path = "")
File.join("#{ENV["WINEPREFIX"]}/drive_c", path)
end
def info
puts "WINEPREFIX: #{ENV["WINEPREFIX"]}"
puts "WINEARCH: #{ENV["WINEARCH"]}"
end
def wine(cmd)
sh "wine", cmd
end
def wine64(cmd)
sh "wine64", cmd
end
def prefix(name)
namespace name do
task :init do
set_prefix(name)
info
end
yield
end
end
def procedure(name)
task name => :init do
yield
end
end
# core tasks
namespace :wine do
task :info, [:prefix] do |_task, args|
prefix = args[:prefix] || "default"
set_prefix(prefix)
info
end
task :config do
info
sh "winecfg"
end
task :tricks do
info
sh "winetricks"
end
end
task :default => "wine:info"
# frozen_string_literal: true
prefix :world_of_warcraft do
desc "Create an environment for World of Warcraft"
procedure :setup do
sh "wineboot --init"
sh "winetricks settings sandbox"
sh "winetricks settings win10"
sh "winetricks vcrun2015"
sh "winetricks corefonts"
ln_sf File.join(__dir__, "setup"), drive_c
wine64 drive_c("setup/World-of-Warcraft-Setup.exe")
end
desc "Start 32bit version of World of Warcraft."
procedure :run32 do
wine drive_c("Program Files (x86)/World of Warcraft/Wow.exe")
end
desc "Start 64bit version of World of Warcraft."
procedure :run64 do
wine64 drive_c("Program Files (x86)/World of Warcraft/Wow-64.exe")
end
task :run => :run64
desc "Start the blizzard app in 32bit mode."
procedure :blizzard_app32 do
wine drive_c("Program Files (x86)/Blizzard App/Battle.net.exe")
end
desc "Start the blizzard app in 64bit mode."
procedure :blizzard_app64 do
ENV.update({
"__GL_THRADED_OPTIMIZATIONS" => "1",
"STAGING_SHARED_MEMORY" => "1",
"STAGING_RT_PRIORITY_SERVER" => "90"
})
wine64 drive_c("Program Files (x86)/Blizzard App/Battle.net.exe")
end
task :blizzard_app => :blizzard_app64
end
task :world_of_warcraft => "world_of_warcraft:blizzard_app"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment