diff --git a/meson.build b/meson.build index 99178284..05334403 100644 --- a/meson.build +++ b/meson.build @@ -165,11 +165,16 @@ if steamworks == true if build_static == true la = '-static-libgcc -static-libstdc++' endif + shim_args = ['-DGAME_LAUNCH_NAME="' + exe_name + '"'] + if get_option('steam_appid') != '' + shim_args += '-DSTEAM_APPID=' + get_option('steam_appid') + endif + executable(meson.project_name(), sources: files('steamshim/steamshim_parent.cpp'), dependencies: steamlib, include_directories: (steamworks_path + '/public'), - cpp_args: '-DGAME_LAUNCH_NAME="' + exe_name + '"', + cpp_args: shim_args, link_args: la.split(), install: (host_system != 'windows')) endif diff --git a/steamshim/steamshim_parent.cpp b/steamshim/steamshim_parent.cpp index ef9a8f03..5b0b624f 100644 --- a/steamshim/steamshim_parent.cpp +++ b/steamshim/steamshim_parent.cpp @@ -593,11 +593,15 @@ static bool setEnvironmentVars(PipeType pipeChildRead, PipeType pipeChildWrite) static bool initSteamworks(PipeType fd) { +#ifndef STEAM_APPID // this can fail for many reasons: // - you forgot a steam_appid.txt in the current working directory. // - you don't have Steam running // - you don't own the game listed in steam_appid.txt if (!SteamAPI_Init()) +#else + if (SteamAPI_RestartAppIfNecessary(STEAM_APPID)) +#endif return 0; GSteamStats = SteamUserStats();