diff options
author | Derek Lesho <dlesho@codeweavers.com> | 2021-03-24 21:55:33 +0300 |
---|---|---|
committer | Arkadiusz Hiler <ahiler@codeweavers.com> | 2021-11-19 19:35:48 +0300 |
commit | cfaf65d9820f358d56b88b566524ae753246a1c8 (patch) | |
tree | 0e05523dfd39baa3e7d96cf990296933fd824e0d /steam_helper | |
parent | 856c5e422edb9e5c92a9c7756753dd2c9fdfa6e5 (diff) |
steam_helper: Place BattlEye runtime path into PROTON_BATTLEYE_RUNTIME.
CW-Bug-Id: #16650
Diffstat (limited to 'steam_helper')
-rw-r--r-- | steam_helper/steam.cpp | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/steam_helper/steam.cpp b/steam_helper/steam.cpp index abf72c28..89e949af 100644 --- a/steam_helper/steam.cpp +++ b/steam_helper/steam.cpp @@ -100,6 +100,7 @@ static DWORD WINAPI create_steam_window(void *arg) return 0; } +/* requires steam API to be initialized */ static void setup_steam_registry(void) { const char *ui_lang; @@ -108,12 +109,6 @@ static void setup_steam_registry(void) HKEY key; LSTATUS status; - if (!SteamAPI_Init()) - { - WINE_ERR("SteamAPI_Init failed\n"); - return; - } - ui_lang = SteamUtils()->GetSteamUILanguage(); WINE_TRACE("UI language: %s\n", wine_dbgstr_a(ui_lang)); RegSetKeyValueA(HKEY_CURRENT_USER, "Software\\Valve\\Steam", "language", @@ -134,8 +129,35 @@ static void setup_steam_registry(void) RegCloseKey(key); } else WINE_ERR("Could not create key: %u\n", status); +} + +static void copy_to_win(const char *unix_path, const WCHAR *win_path) +{ + WCHAR *src_path = wine_get_dos_file_name(unix_path); + if (!src_path) + return; + + CopyFileW(src_path, win_path, FALSE); + + HeapFree(GetProcessHeap(), 0, src_path); +} + +/* requires steam API to be initialized */ +static void setup_battleye_bridge(void) +{ + const unsigned int be_runtime_appid = 1161040; + char path[2048]; + char *path_end; - SteamAPI_Shutdown(); + if (!SteamApps()->BIsAppInstalled(be_runtime_appid)) + return; + + if (!SteamApps()->GetAppInstallDir(be_runtime_appid, path, sizeof(path))) + return; + + WINE_TRACE("Found battleye runtime at %s\n", path); + + setenv("PROTON_BATTLEYE_RUNTIME", path, 1); } static std::string get_linux_vr_path(void) @@ -1325,7 +1347,17 @@ int main(int argc, char *argv[]) CreateThread(NULL, 0, create_steam_window, NULL, 0, NULL); set_active_process_pid(); - setup_steam_registry(); + + if (SteamAPI_Init()) + { + setup_steam_registry(); + setup_battleye_bridge(); + } + else + { + WINE_ERR("SteamAPI_Init failed\n"); + } + setup_steam_files(); if (env_nonzero("PROTON_WAIT_ATTACH")) @@ -1344,6 +1376,8 @@ int main(int argc, char *argv[]) } } + SteamAPI_Shutdown(); + wait_handle = __wine_make_process_system(); game_process = TRUE; } |