淘先锋技术网

首页 1 2 3 4 5 6 7

由于hlmv即起源1模型查看器,启动时需要引导文件gameinfo.txt,来设置其资源管理根目录(也因为hlmv并不是一个单独的软件,它的启动需要配套的dll文件,因此才需要引导文件。)

下面是gameinfo的示例

下列代码来自SourceFilmmaker\game\usermod中的gameinfo.txt文件

"GameInfo"
{
	game	"Source Filmmaker [Beta]"
	gamelogo 1
	type multiplayer_only
	nomodels 1
	nohimodel 1
	nocrosshair 0
	hidden_maps
	{
		"test_speakers"		1
		"test_hardware"		1
	}
	nodegraph 0
	SupportsDX8     0


	FileSystem
	{
		SteamAppId				1840		// This will mount all the GCFs we need (240=CS:S, 220=HL2).
		ToolsAppId				1840		// Tools will load this (ie: source SDK caches) to get things like materials\debug, materials\editor, etc.
		
		//
		// The code that loads this file automatically does a few things here:
		//
		// 1. For each "Game" search path, it adds a "GameBin" path, in <dir>\bin
		// 2. For each "Game" search path, it adds another "Game" path in front of it with _<langage> at the end.
		//    For example: c:\hl2\cstrike on a french machine would get a c:\hl2\cstrike_french path added to it.
		// 3. For the first "Game" search path, it adds a search path called "MOD".
		// 4. For the first "Game" search path, it adds a search path called "DEFAULT_WRITE_PATH".
		//

		//
		// Search paths are relative to the base directory, which is where hl2.exe is found.
		//
		// |gameinfo_path| points at the directory where gameinfo.txt is.
		// We always want to mount that directory relative to gameinfo.txt

		SearchPaths
		{
			Game				|gameinfo_path|.
			Game				tf_movies
			Game				tf
			Game				left4dead2_movies
			Game				hl2
			Game				workshop
		}
	}

	ToolsEnvironment
	{
		"Engine"	"SFM"
		"ToolsDir"	"../sdktools"	// Default Tools path. NOTE: This is relative to the mod path.
	}
}

您可以看到在最末的SearchPaths属性组中,每一列的属性都是Game,其值代表:

1、|gameinfo_path| 意为引导文件自身路径,但只写这一个是不行的,后面说原因。

2、例如 <tf_movies> 等 指代了引导文件上级目录中的文件夹路径

hlmv运行原理:

1、启动hlmv.exe
2、通过命令行参数(或者通过crowbar工具设置set up game项中的Gameinfo路径启动)寻找gameinfo.txtSearchPaths属性组,将引导路径加入准使用路径。
3、在准使用路径中搜寻script文件夹,并依次开启其中的dll库文件,将库中的资源载入内存中。
4、载入库过程中,如果遭遇dll文件缺失(这就是为什么不能只写|gameinfo_path|,有可能引导文件自身目录内不包含需要的所有dll),则报错并闪退,如果全部载入成功,则显示图形化界面,进入可操作模式,此后则可以加载全电脑中任意目录下的模型。

(一般情况下是可以加载任意地方的的模型,但仍有几率会加载失败,因此保险起见,还是请将您的模型放入SearchPaths属性组所包含的路径下在进行查看)

遇到如下报错解决办法

Unable to find gameinfo.txt

Unable to find gameinfo.txt 是指在运行原理步骤2中未指定正确的gameinfo.txt文件所致,需要重新指定为usermod文件夹中的gameinfo.txt文件即可解决。