Skip to content

Problems with gameinfo search path parsing #461

@long0900

Description

@long0900

For context, this is the current FileSystem KV in CS2 gameinfo.gi:

FileSystem
{
	SearchPaths
	{
		Game_LowViolence	csgo_lv // Perfect World content override

		Game	csgo
		Game	csgo_imported
		Game	csgo_core
		Game	core

		Mod		csgo
		Mod		csgo_imported
		Mod		csgo_core

		AddonRoot			csgo_addons
		OfficialAddonRoot	csgo_community_addons

		LayeredGameRoot		"../game_otherplatforms/etc" [$MOBILE || $ETC_TEXTURES] //Some platforms do not support DXT compression. ETC is a well-supported alternative.
		LayeredGameRoot		"../game_otherplatforms/low_bitrate" [$MOBILE]
	}

	"UserSettingsPathID"	"USRLOCAL"
	"UserSettingsFileEx"	"cs2_"
}

I noticed some problems in Source2GameInfoProvider initialization:

  1. It doesn't always follow top-down order. Due to the KV parsing trying to group multiple values from multiple KVs with a same name into a list, the search order is only correct if the search_path_type are sorted like above. Otherwise, it will be wrong if the KV names have a mixed order.

  2. The iterable self.filesystem.get("searchpaths", {}).items() here doesn't always yield a list of search_paths, it will yield a single search_path if there's only 1 KV of that search_path_type. This will turn iterating over a list into character iterating, which is wrong.

  3. These problems seem to also exist in Source1GameInfoProvider.

  4. Additionally, there are 2 new search path types (Game_LowViolence, OfficialAddonRoot) that need support as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions