Compare commits

...

13 Commits

Author SHA1 Message Date
Andrew Eikum
85241acc84 update wine 2021-05-12 08:59:31 -05:00
Paul Gofman
a2c20ea0fb steam_helper: Create libraryfolders.vdf file.
For 2K Launcher.

CW-Bug-Id: 18912
2021-05-11 17:08:11 -05:00
Paul Gofman
a0b330a1ca steam_helper: Create Valve_SteamIPC_Class event.
For 2K Launcher.

CW-Bug-Id: 18912
2021-05-11 17:08:09 -05:00
Paul Gofman
d682b43282 steam_helper: Forward steam:// protocol requests to winebrowser.
CW-Bug-Id: 18912
2021-05-11 17:08:01 -05:00
Jacek Caban
9bd6cc487b proton: Add runinprefix verb for running a program in a running session
CW-Bug-Id: 16785
2021-05-11 17:07:50 -05:00
Andrew Eikum
5e11a15953 update dxvk 2021-05-07 15:22:16 -05:00
Andrew Eikum
ef9a311ddb update wine 2021-05-07 14:06:39 -05:00
Andrew Eikum
9a9b2872ec update vkd3d-proton to v2.3.1-8-g8734589e 2021-05-06 12:51:56 -05:00
Andrew Eikum
6e19066e41 update wine 2021-05-06 12:51:29 -05:00
Paul Gofman
139ee36b3b build: Fixup PE section headers.
For FH4.
2021-05-03 09:20:02 -05:00
Andrew Eikum
2fa3a438fd Handle steampipe quirks in deploy builds 2021-05-03 09:19:41 -05:00
Andrew Eikum
ef5afec1eb Don't ship filenames with colons in them 2021-05-03 09:19:41 -05:00
Andrew Eikum
db04c9cda6 Don't ship proton dist files in a tarball anymore 2021-05-03 09:19:40 -05:00
12 changed files with 388 additions and 60 deletions

View File

@ -124,17 +124,20 @@ proton: configure
install: configure
vagrant ssh -c 'make -C $(BUILD_DIR)/ $(UNSTRIPPED) $(CCACHE_FLAG) STEAM_DIR=/vagrant/ install'
mkdir -p $(STEAM_DIR)/compatibilitytools.d/
rm -rf $(STEAM_DIR)/compatibilitytools.d/$(_build_name)/files/ #remove proton's internal files, but preserve user_settings etc from top-level
cp -Rf --no-dereference --preserve=mode,links vagrant_share/compatibilitytools.d/$(_build_name) $(STEAM_DIR)/compatibilitytools.d/
echo "Proton installed to your local Steam installation"
redist: configure
mkdir -p vagrant_share/$(DEPLOY_DIR)
vagrant ssh -c 'make -C $(BUILD_DIR)/ $(UNSTRIPPED) $(CCACHE_FLAG) redist && cp $(BUILD_DIR)/redist/* /vagrant/$(DEPLOY_DIR)'
rm -rf vagrant_share/$(DEPLOY_DIR)/*
vagrant ssh -c 'make -C $(BUILD_DIR)/ $(UNSTRIPPED) $(CCACHE_FLAG) redist && cp -Rf $(BUILD_DIR)/redist/* /vagrant/$(DEPLOY_DIR)'
echo "Proton build available at vagrant_share/$(DEPLOY_DIR)"
deploy: configure
mkdir -p vagrant_share/$(DEPLOY_DIR)-deploy
vagrant ssh -c 'make -C $(BUILD_DIR)/ $(UNSTRIPPED) $(CCACHE_FLAG) deploy && cp $(BUILD_DIR)/deploy/* /vagrant/$(DEPLOY_DIR)-deploy'
rm -rf vagrant_share/$(DEPLOY_DIR)-deploy/*
vagrant ssh -c 'make -C $(BUILD_DIR)/ $(UNSTRIPPED) $(CCACHE_FLAG) deploy && cp -Rf $(BUILD_DIR)/deploy/* /vagrant/$(DEPLOY_DIR)-deploy'
echo "Proton deployed to vagrant_share/$(DEPLOY_DIR)-deploy"
module: configure
@ -142,6 +145,7 @@ module: configure
vagrant ssh -c 'make -C $(BUILD_DIR)/ $(UNSTRIPPED) $(CCACHE_FLAG) module=$(module) module && \
cp -f $(BUILD_DIR)/obj-wine32/dlls/$(module)/$(module)$(MODULE_SFX)* /vagrant/$(module)/lib/wine/ && \
cp -f $(BUILD_DIR)/obj-wine64/dlls/$(module)/$(module)$(MODULE_SFX)* /vagrant/$(module)/lib64/wine/ && \
find /vagrant/$(module)/ -type f -name "*.dll" -printf "%p\0" | xargs --verbose -0 -r -P8 -n3 proton/make/pefixup.py && \
if [ -e $(BUILD_DIR)/obj-wine64/dlls/$(module)/$(module).so ]; then \
cp -f $(BUILD_DIR)/obj-wine32/dlls/$(module)/$(module).so /vagrant/$(module)/lib/wine/ && \
cp -f $(BUILD_DIR)/obj-wine64/dlls/$(module)/$(module).so /vagrant/$(module)/lib64/wine/; \
@ -152,31 +156,33 @@ dxvk: configure
mkdir -p vagrant_share/dxvk/lib/wine/dxvk/
mkdir -p vagrant_share/dxvk/lib64/wine/dxvk/
vagrant ssh -c 'make -C $(BUILD_DIR)/ $(UNSTRIPPED) $(CCACHE_FLAG) dxvk && \
cp -f $(BUILD_DIR)/dist/dist/lib/wine/dxvk/*.dll /vagrant/dxvk/lib/wine/dxvk/ && \
cp -f $(BUILD_DIR)/dist/dist/lib64/wine/dxvk/*.dll /vagrant/dxvk/lib64/wine/dxvk/'
cp -f $(BUILD_DIR)/dist/files/lib/wine/dxvk/*.dll /vagrant/dxvk/lib/wine/dxvk/ && \
cp -f $(BUILD_DIR)/dist/files/lib64/wine/dxvk/*.dll /vagrant/dxvk/lib64/wine/dxvk/ && \
find /vagrant/dxvk/ -type f -name "*.dll" -printf "%p\0" | xargs --verbose -0 -r -P8 -n3 proton/make/pefixup.py'
vkd3d-proton: configure
mkdir -p vagrant_share/vkd3d-proton/lib/wine/vkd3d-proton/
mkdir -p vagrant_share/vkd3d-proton/lib64/wine/vkd3d-proton/
vagrant ssh -c 'make -C $(BUILD_DIR)/ $(UNSTRIPPED) $(CCACHE_FLAG) vkd3d-proton && \
cp -f $(BUILD_DIR)/dist/dist/lib/wine/vkd3d-proton/*.dll /vagrant/vkd3d-proton/lib/wine/vkd3d-proton/ && \
cp -f $(BUILD_DIR)/dist/dist/lib64/wine/vkd3d-proton/*.dll /vagrant/vkd3d-proton/lib64/wine/vkd3d-proton/'
cp -f $(BUILD_DIR)/dist/files/lib/wine/vkd3d-proton/*.dll /vagrant/vkd3d-proton/lib/wine/vkd3d-proton/ && \
cp -f $(BUILD_DIR)/dist/files/lib64/wine/vkd3d-proton/*.dll /vagrant/vkd3d-proton/lib64/wine/vkd3d-proton/ && \
find /vagrant/vkd3d-proton/ -type f -name "*.dll" -printf "%p\0" | xargs --verbose -0 -r -P8 -n3 proton/make/pefixup.py'
lsteamclient: configure
mkdir -p vagrant_share/lsteamclient/lib/wine
mkdir -p vagrant_share/lsteamclient/lib64/wine
vagrant ssh -c 'make -C $(BUILD_DIR)/ $(UNSTRIPPED) $(CCACHE_FLAG) lsteamclient && \
cp -f $(BUILD_DIR)/dist/dist/lib/wine/lsteamclient.dll.so /vagrant/lsteamclient/lib/wine && \
cp -f $(BUILD_DIR)/dist/dist/lib64/wine/lsteamclient.dll.so /vagrant/lsteamclient/lib64/wine'
cp -f $(BUILD_DIR)/dist/files/lib/wine/lsteamclient.dll.so /vagrant/lsteamclient/lib/wine && \
cp -f $(BUILD_DIR)/dist/files/lib64/wine/lsteamclient.dll.so /vagrant/lsteamclient/lib64/wine'
vrclient: configure
mkdir -p vagrant_share/vrclient/lib/wine
mkdir -p vagrant_share/vrclient/lib64/wine
vagrant ssh -c 'make -C $(BUILD_DIR)/ $(UNSTRIPPED) $(CCACHE_FLAG) vrclient && \
cp -f $(BUILD_DIR)/dist/dist/lib/wine/vrclient.dll.so /vagrant/vrclient/lib/wine && \
cp -f $(BUILD_DIR)/dist/dist/lib64/wine/vrclient_x64.dll.so /vagrant/vrclient/lib64/wine'
cp -f $(BUILD_DIR)/dist/files/lib/wine/vrclient.dll.so /vagrant/vrclient/lib/wine && \
cp -f $(BUILD_DIR)/dist/files/lib64/wine/vrclient_x64.dll.so /vagrant/vrclient/lib64/wine'
wineopenxr: configure
mkdir -p vagrant_share/wineopenxr/lib64/wine
vagrant ssh -c 'make -C $(BUILD_DIR)/ $(UNSTRIPPED) $(CCACHE_FLAG) wineopenxr && \
cp -f $(BUILD_DIR)/dist/dist/lib64/wine/wineopenxr.dll.so /vagrant/wineopenxr/lib64/wine'
cp -f $(BUILD_DIR)/dist/files/lib64/wine/wineopenxr.dll.so /vagrant/wineopenxr/lib64/wine'

2
Vagrantfile vendored
View File

@ -77,7 +77,7 @@ Vagrant.configure(2) do |config|
#install host build-time dependencies
apt-get update
apt-get install -y ccache texinfo gpgv2 gnupg2 git docker-ce docker-ce-cli containerd.io \
fontforge-nox python-debian python-pip
fontforge-nox python-debian python-pip python3-pefile
#install adobe font devkit to build source san hans
pip install afdko

View File

@ -113,7 +113,7 @@ endif
##
DST_BASE := $(OBJ)/dist
DST_DIR := $(DST_BASE)/dist
DST_DIR := $(DST_BASE)/files
DST_LIBDIR32 := $(DST_DIR)/lib
DST_LIBDIR64 := $(DST_DIR)/lib64
DEPLOY_DIR := ./deploy
@ -155,6 +155,7 @@ CARGO_BUILD_ARG := --release
COMPAT_MANIFEST_TEMPLATE := $(SRCDIR)/compatibilitytool.vdf.template
LICENSE := $(SRCDIR)/dist.LICENSE
OFL_LICENSE := $(SRCDIR)/fonts/liberation-fonts/LICENSE
STEAMPIPE_FIXUPS_PY := $(SRCDIR)/steampipe_fixups.py
GECKO_VER := 2.47.2
GECKO32_TARBALL := wine-gecko-$(GECKO_VER)-x86.tar.xz
@ -241,8 +242,9 @@ DIST_TARGETS := $(DIST_COPY_TARGETS) $(DIST_OVR32) $(DIST_OVR64) \
$(DIST_GECKO32) $(DIST_GECKO64) $(DIST_WINEMONO) \
$(DIST_COMPAT_MANIFEST) $(DIST_LICENSE) $(DIST_TOOLMANIFEST) $(DIST_OFL_LICENSE) $(DIST_FONTS)
DEPLOY_COPY_TARGETS := $(DIST_COPY_TARGETS) $(DIST_VERSION) $(DIST_LICENSE) $(DIST_TOOLMANIFEST) $(DIST_OFL_LICENSE)
REDIST_COPY_TARGETS := $(DEPLOY_COPY_TARGETS) $(DIST_COMPAT_MANIFEST)
BASE_COPY_TARGETS := $(DIST_COPY_TARGETS) $(DIST_VERSION) $(DIST_LICENSE) $(DIST_TOOLMANIFEST) $(DIST_OFL_LICENSE) $(DST_DIR)
DEPLOY_COPY_TARGETS := $(BASE_COPY_TARGETS) $(STEAMPIPE_FIXUPS_PY)
REDIST_COPY_TARGETS := $(BASE_COPY_TARGETS) $(DIST_COMPAT_MANIFEST)
$(DIST_LICENSE): $(LICENSE)
cp -a $< $@
@ -331,24 +333,20 @@ dist: $(DIST_TARGETS) all-dist dist_wineopenxr | $(DST_DIR)
echo `date '+%s'` `GIT_DIR=$(abspath $(SRCDIR)/.git) git describe --tags` > $(DIST_VERSION)
deploy: dist | $(filter-out dist deploy install redist,$(MAKECMDGOALS))
mkdir -p $(DEPLOY_DIR) && \
cp -a $(DEPLOY_COPY_TARGETS) $(DEPLOY_DIR) && \
tar -C $(DST_DIR) -c . > $(DEPLOY_DIR)/proton_dist.tar
@echo "Created deployment archive at "$(DEPLOY_DIR)"/proton_dist.tar"
mkdir -p $(DEPLOY_DIR)
cp -af --no-dereference --preserve=mode,links $(DEPLOY_COPY_TARGETS) $(DEPLOY_DIR)
python3 $(STEAMPIPE_FIXUPS_PY) process $(DEPLOY_DIR)
install: dist | $(filter-out dist deploy install redist,$(MAKECMDGOALS))
if [ ! -d $(STEAM_DIR) ]; then echo >&2 "!! "$(STEAM_DIR)" does not exist, cannot install"; return 1; fi
mkdir -p $(STEAM_DIR)/compatibilitytools.d/$(BUILD_NAME)
cp -rf --no-dereference --preserve=mode,links $(DST_BASE)/* $(STEAM_DIR)/compatibilitytools.d/$(BUILD_NAME)
cp -f $(DIST_VERSION) $(STEAM_DIR)/compatibilitytools.d/$(BUILD_NAME)/dist/
cp -af --no-dereference --preserve=mode,links $(DST_BASE)/* $(STEAM_DIR)/compatibilitytools.d/$(BUILD_NAME)
@echo "Installed Proton to "$(STEAM_DIR)/compatibilitytools.d/$(BUILD_NAME)
@echo "You may need to restart Steam to select this tool"
redist: dist | $(filter-out dist deploy install redist,$(MAKECMDGOALS))
mkdir -p $(REDIST_DIR)
cp -a $(REDIST_COPY_TARGETS) $(REDIST_DIR)
tar -C $(DST_DIR) -c . | gzip -c -1 > $(REDIST_DIR)/proton_dist.tar.gz
@echo "Created redistribution tarball at "$(REDIST_DIR)"/proton_dist.tar.gz"
cp -af --no-dereference --preserve=mode,links $(REDIST_COPY_TARGETS) $(REDIST_DIR)
.PHONY: module32 module64 module

View File

@ -73,6 +73,14 @@ def setup_dll_symlinks(default_pfx_dir, dist_dir):
os.unlink(filename)
make_relative_symlink(target, filename)
#steampipe can't handle filenames with colons, so we remove them here
#and restore them in the proton script
def fixup_drive_links(default_pfx_dir):
for walk_dir, dirs, files in os.walk(os.path.join(default_pfx_dir, "dosdevices")):
for dir_ in dirs:
if ":" in dir_:
os.remove(os.path.join(walk_dir, dir_))
def make_default_pfx(default_pfx_dir, dist_dir, runtime):
local_env = dict(os.environ)
@ -96,6 +104,7 @@ def make_default_pfx(default_pfx_dir, dist_dir, runtime):
env=local_env, check=True)
setup_dll_symlinks(default_pfx_dir, dist_dir)
fixup_drive_links(default_pfx_dir)
if __name__ == '__main__':
import sys

2
dxvk

@ -1 +1 @@
Subproject commit f8a4ca555a6e5d89f5162a042bbae550902f4e49
Subproject commit da2c351df5504f605999c4b4dea69b94ab1a755b

27
make/pefixup.py Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env python3
import sys
import os
import stat
import pefile
for path in sys.argv[1:]:
pe = pefile.PE(path)
for section in pe.sections:
if section.Name.decode("utf-8")[0:5] == ".text":
section.Characteristics &= ~pefile.SECTION_CHARACTERISTICS['IMAGE_SCN_CNT_INITIALIZED_DATA']
section.Characteristics &= ~pefile.SECTION_CHARACTERISTICS['IMAGE_SCN_ALIGN_MASK']
pe.OPTIONAL_HEADER.CheckSum = pe.generate_checksum()
perm = stat.S_IMODE(os.stat(path).st_mode)
if (perm & stat.S_IWUSR) == 0:
os.chmod(path, perm | stat.S_IWUSR)
pe.write(path)
if (perm & stat.S_IWUSR) == 0:
os.chmod(path, perm)
print("Fixed up PE: ", path)

View File

@ -82,6 +82,14 @@ endif
$(1)-dist$(3): $$(OBJ)/.$(1)-dist$(3)
.INTERMEDIATE: $(1)-dist$(3)
ifeq ($(CONTAINER),)
$(1)-dist$(3): $$(OBJ)/.$(1)-fixup$(3)
$$(OBJ)/.$(1)-fixup$(3): $$(OBJ)/.$(1)-dist$(3)
cd $$($(2)_LIBDIR$(3)) && find -type f -name '*.dll' -printf '$$(DST_LIBDIR$(3))/%p\0' | xargs --verbose -0 -r -P8 -n3 $$(SRC)/make/pefixup.py
touch $$@
endif
all-dist$(3) $(1)-dist: $(1)-dist$(3)
.PHONY: all-dist$(3) $(1)-dist

78
proton
View File

@ -149,14 +149,14 @@ def set_dir_casefold_bit(dir_path):
class Proton:
def __init__(self, base_dir):
self.base_dir = base_dir + "/"
self.dist_dir = self.path("dist/")
self.bin_dir = self.path("dist/bin/")
self.lib_dir = self.path("dist/lib/")
self.lib64_dir = self.path("dist/lib64/")
self.fonts_dir = self.path("dist/share/fonts/")
self.wine_fonts_dir = self.path("dist/share/wine/fonts/")
self.dist_dir = self.path("files/")
self.bin_dir = self.path("files/bin/")
self.lib_dir = self.path("files/lib/")
self.lib64_dir = self.path("files/lib64/")
self.fonts_dir = self.path("files/share/fonts/")
self.wine_fonts_dir = self.path("files/share/wine/fonts/")
self.version_file = self.path("version")
self.default_pfx_dir = self.path("dist/share/default_pfx/")
self.default_pfx_dir = self.path("files/share/default_pfx/")
self.user_settings_file = self.path("user_settings.py")
self.wine_bin = self.bin_dir + "wine"
self.wineserver_bin = self.bin_dir + "wineserver"
@ -165,28 +165,34 @@ class Proton:
def path(self, d):
return self.base_dir + d
def need_tarball_extraction(self):
'''Checks if the proton_dist tarball archive must be extracted. Returns true if extraction is needed, false otherwise'''
return not os.path.exists(self.dist_dir) or \
not os.path.exists(self.path("dist/version")) or \
not filecmp.cmp(self.version_file, self.path("dist/version"))
def cleanup_legacy_dist(self):
old_dist_dir = self.path("dist/")
if os.path.exists(old_dist_dir):
with self.dist_lock:
if os.path.exists(old_dist_dir):
shutil.rmtree(old_dist_dir)
def extract_tarball(self):
with self.dist_lock:
if self.need_tarball_extraction():
if os.path.exists(self.dist_dir):
shutil.rmtree(self.dist_dir)
tar = None
for sf in ["", ".xz", ".bz2", ".gz"]:
if os.path.exists(self.path("proton_dist.tar" + sf)):
tar = tarfile.open(self.path("proton_dist.tar" + sf), mode="r:*")
break
if not tar:
log("No proton_dist tarball??")
sys.exit(1)
tar.extractall(path=self.dist_dir)
tar.close()
try_copy(self.version_file, self.dist_dir)
def do_steampipe_fixups(self):
fixups_json = self.path("steampipe_fixups.json")
fixups_mtime = self.path("files/steampipe_fixups_mtime")
if os.path.exists(fixups_json):
with self.dist_lock:
import steampipe_fixups
current_fixup_mtime = None
if os.path.exists(fixups_mtime):
with open(fixups_mtime, "r") as f:
current_fixup_mtime = f.readline().strip()
new_fixup_mtime = getmtimestr(fixups_json)
if current_fixup_mtime != new_fixup_mtime:
result_code = steampipe_fixups.do_restore(self.base_dir, fixups_json)
if result_code == 0:
with open(fixups_mtime, "w") as f:
f.write(new_fixup_mtime + "\n")
def missing_default_prefix(self):
'''Check if the default prefix dir is missing. Returns true if missing, false if present'''
@ -432,6 +438,12 @@ class CompatData:
if not os.path.exists(self.prefix_dir + "/user.reg"):
self.copy_pfx()
if not os.path.lexists(self.prefix_dir + "/dosdevices/c:"):
os.symlink("../drive_c", self.prefix_dir + "/dosdevices/c:")
if not os.path.lexists(self.prefix_dir + "/dosdevices/z:"):
os.symlink("/", self.prefix_dir + "/dosdevices/z:")
# collect configuration info
if "STEAM_COMPAT_CLIENT_INSTALL_PATH" in os.environ:
#modern steam client sets this
@ -812,8 +824,6 @@ class Session:
else:
self.env["WINEDEBUG"] = "-all"
g_compatdata.setup_prefix()
if "nod3d11" in self.compat_config:
self.dlloverrides["d3d11"] = ""
if "dxgi" in self.dlloverrides:
@ -971,8 +981,8 @@ if __name__ == "__main__":
g_proton = Proton(os.path.dirname(sys.argv[0]))
if g_proton.need_tarball_extraction():
g_proton.extract_tarball()
g_proton.cleanup_legacy_dist()
g_proton.do_steampipe_fixups()
g_compatdata = CompatData(os.environ["STEAM_COMPAT_DATA_PATH"])
@ -984,6 +994,8 @@ if __name__ == "__main__":
g_proton.make_default_prefix()
g_session.init_session()
if sys.argv[1] != "runinprefix":
g_compatdata.setup_prefix()
#determine mode
if sys.argv[1] == "run":
@ -994,6 +1006,8 @@ if __name__ == "__main__":
g_session.run_proc([g_proton.wineserver_bin, "-w"])
#then run
g_session.run()
elif sys.argv[1] == "runinprefix":
g_session.run_proc([g_proton.wine_bin] + sys.argv[2:])
elif sys.argv[1] == "getcompatpath":
#linux -> windows path
path = subprocess.check_output([g_proton.wine_bin, "winepath", "-w", sys.argv[2]], env=g_session.env, stderr=g_session.log_file)

View File

@ -1011,23 +1011,172 @@ run:
}
}
static BOOL steam_protocol_handler(int argc, char *argv[])
{
const char *steam_prefix = "steam://";
STARTUPINFOA si = { sizeof(si) };
PROCESS_INFORMATION pi;
char cmd[1024];
int size;
int i;
for (i = 1; i < argc; ++i)
if (!strcmp(argv[i], "--"))
break;
if (i >= argc - 1)
return FALSE;
++i;
if (strlen(argv[i]) < ARRAY_SIZE(steam_prefix))
return FALSE;
if (strncasecmp(argv[i], steam_prefix, ARRAY_SIZE(steam_prefix) - 1))
return FALSE;
size = snprintf(cmd, sizeof(cmd), "winebrowser \"%s\"", argv[i]);
if (size >= sizeof(cmd))
{
WINE_ERR("Argument is too large, argv[%d] %s.\n", i, wine_dbgstr_a(argv[i]));
return TRUE;
}
WINE_TRACE("Executing %s.\n", wine_dbgstr_a(cmd));
if (!CreateProcessA(NULL, cmd, NULL, NULL, FALSE, CREATE_UNICODE_ENVIRONMENT, NULL, NULL, &si, &pi))
{
WINE_ERR("Failed to create process %s, error %u.\n", wine_dbgstr_a(cmd), GetLastError());
return TRUE;
}
FreeConsole();
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
return TRUE;
}
static void setup_steam_files(void)
{
static const WCHAR libraryfolders_nameW[] = L"C:\\Program Files (x86)\\Steam\\steamapps\\libraryfolders.vdf";
static const WCHAR steamapps_pathW[] = L"C:\\Program Files (x86)\\Steam\\steamapps";
const char *steam_install_path = getenv("STEAM_COMPAT_CLIENT_INSTALL_PATH");
const char *steam_library_paths = getenv("STEAM_COMPAT_LIBRARY_PATHS");
const char *start, *end, *next;
unsigned int i, index = 1;
std::string contents;
char idx_str[10];
if (!CreateDirectoryW(steamapps_pathW, NULL) && GetLastError() != ERROR_ALREADY_EXISTS)
{
WINE_ERR("Failed to create steamapps directory, GetLastError() %u.\n", GetLastError());
return;
}
contents += "\"LibraryFolders\"\n{\n";
WINE_TRACE("steam_install_path %s.\n", wine_dbgstr_a(steam_install_path));
if (steam_install_path)
{
std::string s = steam_install_path;
if (convert_path_to_win(s))
{
sprintf(idx_str, "%u", index);
++index;
for (i = 0; i < s.length(); ++i)
{
if (s[i] == '\\')
{
s.insert(i, 1, '\\');
++i;
}
}
contents += std::string("\t\"") + idx_str + "\" \t\"" + s + "\"\n";
}
else
{
WINE_ERR("Could not convert %s to win path.\n", wine_dbgstr_a(s.c_str()));
}
}
WINE_TRACE("steam_library_paths %s.\n", wine_dbgstr_a(steam_library_paths));
start = steam_library_paths;
while (start && *start)
{
std::string s;
if (!(next = strchr(start, ':')))
next = start + strlen(start);
end = next;
if (end != start && end[-1] == '/')
--end;
while (end != start && end[-1] != '/' )
--end;
if (end != start)
--end;
s.append(start, end - start);
if (convert_path_to_win(s))
{
sprintf(idx_str, "%u", index);
++index;
for (i = 0; i < s.length(); ++i)
{
if (s[i] == '\\')
{
s.insert(i, 1, '\\');
++i;
}
}
contents += std::string("\t\"") + idx_str + "\" \t\"" + s + "\"\n";
}
else
{
WINE_ERR("Could not convert %s to win path.\n", wine_dbgstr_a(s.c_str()));
}
if (*next == ':')
++next;
start = next;
}
contents += "}\n";
if (!write_string_to_file(libraryfolders_nameW, contents))
WINE_ERR("Could not write %s.\n", wine_dbgstr_w(libraryfolders_nameW));
}
int main(int argc, char *argv[])
{
HANDLE wait_handle = INVALID_HANDLE_VALUE;
HANDLE event2 = INVALID_HANDLE_VALUE;
HANDLE event = INVALID_HANDLE_VALUE;
BOOL game_process = FALSE;
WINE_TRACE("\n");
if (steam_protocol_handler(argc, argv))
return 0;
if (getenv("SteamGameId"))
{
/* do setup only for game process */
event = CreateEventA(NULL, FALSE, FALSE, "Steam3Master_SharedMemLock");
/* For 2K Launcher. */
event2 = CreateEventA(NULL, FALSE, FALSE, "Global\\Valve_SteamIPC_Class");
CreateThread(NULL, 0, create_steam_window, NULL, 0, NULL);
set_active_process_pid();
setup_steam_registry();
setup_steam_files();
wait_handle = __wine_make_process_system();
game_process = TRUE;
@ -1065,6 +1214,7 @@ int main(int argc, char *argv[])
if (event != INVALID_HANDLE_VALUE)
CloseHandle(event);
if (event2 != INVALID_HANDLE_VALUE)
CloseHandle(event2);
return 0;
}

116
steampipe_fixups.py Executable file
View File

@ -0,0 +1,116 @@
#!/usr/bin/env python3
#Steampipe doesn't support certain unix-y things which may be required by
#native Linux applications. This file will process a directory of Linux files
#and store the file properties into a manifest file. After a round trip through
#Steampipe, the original file properties can be restored using this same
#script.
import json
import os
import secrets
import stat
DEFAULT_MANIFEST_NAME = "steampipe_fixups.json"
def usage():
print("Usage:")
print("\t" + sys.argv[0] + "\tprepare\t<path to directory to process>\t[manifest output file]")
print("\t\tProcess the given path and output the manifest file to the given path, or <path/" + DEFAULT_MANIFEST_NAME + "> if unspecified.")
print("")
print("\t" + sys.argv[0] + "\trestore\t<path to directory to process>\t[manifest file]")
print("\t\tRestore the given path using the manifest file, or <path/" + DEFAULT_MANIFEST_NAME + "> if unspecified.")
empty_dirs = []
no_write_paths = []
def canonicalize(path, prefix):
return path.replace(prefix, "", 1).lstrip('/')
def process_dir(path):
for root, subdirs, files in os.walk(path):
if len(subdirs) == 0 and len(files) == 0:
empty_dirs.append(canonicalize(root, path))
for file_ in files:
this_file = os.path.join(root, file_)
stat_result = os.lstat(this_file)
if (stat_result.st_mode & stat.S_IWUSR) == 0:
no_write_paths.append(canonicalize(this_file, path))
return 0
def write_manifest(manifest):
out = open(manifest, "w")
json.dump(
{
"id": str(secrets.randbits(32)), #we need steampipe to update this file for every build
"empty_dirs": empty_dirs,
"no_write_paths": no_write_paths,
},
out,
indent = 4,
sort_keys = True
)
return 0
def do_process(path, manifest):
if os.path.exists(manifest):
os.remove(manifest)
ret = process_dir(path)
if ret != 0:
return ret
#output should be deterministic
empty_dirs.sort()
no_write_paths.sort()
ret = write_manifest(manifest)
if ret != 0:
return ret
return 0
def do_restore(path, manifest):
loaded = json.load(open(manifest, "r"))
empty_dirs = loaded["empty_dirs"]
no_write_paths = loaded["no_write_paths"]
for empty_dir in empty_dirs:
try:
os.makedirs(os.path.join(path, empty_dir))
except OSError:
#already exists
pass
for file_ in no_write_paths:
this_file = os.path.join(path, file_)
stat_result = os.lstat(this_file)
os.chmod(this_file,
stat_result.st_mode & ~(stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH))
return 0
if __name__ == '__main__':
import sys
if len(sys.argv) < 3 or len(sys.argv) > 4:
usage()
sys.exit(1)
verb = sys.argv[1]
path = sys.argv[2]
if len(sys.argv) >= 4:
manifest = sys.argv[3]
else:
manifest = os.path.join(path, DEFAULT_MANIFEST_NAME)
if verb == "process":
sys.exit(do_process(path, manifest))
if verb == "restore":
sys.exit(do_restore(path, manifest))
usage()
sys.exit(1)

@ -1 +1 @@
Subproject commit 3ed3526332f53d7d35cf1b685fa8096b01f26ff0
Subproject commit 8734589e921ba03730ca68fb06d36682b7aa46af

2
wine

@ -1 +1 @@
Subproject commit 1f1b83506e0b896e9cd9b01a152ec2b72b7b73cb
Subproject commit 164d2b8b3ae2cf65693eed01bd696f791db5d5cc