找到 Steam 游戏文件夹 [英] Find steam games folder

查看:41
本文介绍了找到 Steam 游戏文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不进行硬编码的情况下访问 Steam 游戏文件夹?

How can I get to a Steam game folder without hardcoding it?

代替硬编码 C:\Steam\steamapps\common\<game_folder>\GameData 在我的代码中,我可以使用涉及游戏的 steamappid 的东西来获取自动获取这些信息?

Instead of hardcoding C:\Steam\steamapps\common\<game_folder>\GameData in my code can I use something involving the steamappid of a game to obtain this information automatically?

推荐答案

要获得 Steam 游戏文件夹,您必须按照以下步骤操作:

In order to obtain a Steam games folder you have to follow this steps:

  1. 找到 Steam 安装文件夹
  2. 检查 Steam acf 文件和 libraryfolders.vdf

您可以在 windows 注册表中找到 Steam InstallPath:

You can find Steam InstallPath in windows registry:

  • 32 位:HKEY_LOCAL_MACHINE\SOFTWARE\Valve\Steam
  • 64 位:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Valve\Steam

您可以使用此代码从注册表项读取值:

Dim strSteamInstallPath as String = My.Computer.Registry.GetValue(
    "HKEY_LOCAL_MACHINE\SOFTWARE\Valve\Steam", "InstallPath", Nothing)

MsgBox("The install path is " & strSteamInstallPath)

一旦您拥有 Steam 主文件夹(包含 steam.exe 的文件夹),您就可以从 中包含的 appmanifest_<steamappid>.acf 文件中读取游戏安装文件夹\steamapps 子文件夹.

Once you have Steam main folder (the one containing steam.exe) you can read games installation folder from appmanifest_<steamappid>.acf files contained in \steamapps subfolder.

例如,appmanifest_2280.acf 包含有关Ultimate Doom 的信息.

For example, appmanifest_2280.acf contains informations about Ultimate Doom.

您可以搜索特定的 steamappid 或分析每个文件并从 name 键中获取游戏名称.

You can search for a particular steamappid or analyze every files and get game name from name key.

同时检查 \steamapps 子文件夹中的 libraryfolders.vdf 其他游戏安装文件夹.

Also check libraryfolders.vdf in \steamapps subfolder for other game installation folders.

例如,我在 D:\mygames 中有一些游戏,所以我的 libraryfolders.vdf 是:

For example I have some games in D:\mygames so my libraryfolders.vdf is:

"LibraryFolders"
{
    "TimeNextStatsReport"   "xxxxxxxxxxx"
    "ContentStatsID"        "xxxxxxxxxxx"
    "1"                     "D:\\mygames"
}

拥有此备用文件夹后,请检查 \steamapps 子文件夹中包含的 acm 文件.

Once you have this alternative folder, check for acm files contained in \steamapps subfolder.

这篇关于找到 Steam 游戏文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆