steam_helper: Place BattlEye runtime path into PROTON_BATTLEYE_RUNTIME.

CW-Bug-Id: #16650
This commit is contained in:
Derek Lesho 2021-03-24 14:55:33 -04:00 committed by Arkadiusz Hiler
parent 856c5e422e
commit cfaf65d982
2 changed files with 44 additions and 8 deletions

2
proton
View file

@ -864,6 +864,8 @@ class Session:
self.dlloverrides = { self.dlloverrides = {
"steam.exe": "b", #always use our special built-in steam.exe "steam.exe": "b", #always use our special built-in steam.exe
"dotnetfx35.exe": "b", #replace the broken installer, as does Windows "dotnetfx35.exe": "b", #replace the broken installer, as does Windows
"beclient.dll": "b,n",
"beclient_x64.dll": "b,n",
} }
self.compat_config = set() self.compat_config = set()

View file

@ -100,6 +100,7 @@ static DWORD WINAPI create_steam_window(void *arg)
return 0; return 0;
} }
/* requires steam API to be initialized */
static void setup_steam_registry(void) static void setup_steam_registry(void)
{ {
const char *ui_lang; const char *ui_lang;
@ -108,12 +109,6 @@ static void setup_steam_registry(void)
HKEY key; HKEY key;
LSTATUS status; LSTATUS status;
if (!SteamAPI_Init())
{
WINE_ERR("SteamAPI_Init failed\n");
return;
}
ui_lang = SteamUtils()->GetSteamUILanguage(); ui_lang = SteamUtils()->GetSteamUILanguage();
WINE_TRACE("UI language: %s\n", wine_dbgstr_a(ui_lang)); WINE_TRACE("UI language: %s\n", wine_dbgstr_a(ui_lang));
RegSetKeyValueA(HKEY_CURRENT_USER, "Software\\Valve\\Steam", "language", RegSetKeyValueA(HKEY_CURRENT_USER, "Software\\Valve\\Steam", "language",
@ -134,8 +129,35 @@ static void setup_steam_registry(void)
RegCloseKey(key); RegCloseKey(key);
} }
else WINE_ERR("Could not create key: %u\n", status); else WINE_ERR("Could not create key: %u\n", status);
}
SteamAPI_Shutdown(); 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;
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) 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); CreateThread(NULL, 0, create_steam_window, NULL, 0, NULL);
set_active_process_pid(); 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(); setup_steam_files();
if (env_nonzero("PROTON_WAIT_ATTACH")) if (env_nonzero("PROTON_WAIT_ATTACH"))
@ -1344,6 +1376,8 @@ int main(int argc, char *argv[])
} }
} }
SteamAPI_Shutdown();
wait_handle = __wine_make_process_system(); wait_handle = __wine_make_process_system();
game_process = TRUE; game_process = TRUE;
} }