Hide games with no platform info while the platform filter is on (v0.1.10)
This commit is contained in:
parent
b0183b7c20
commit
7d5dedc0b9
2 changed files with 13 additions and 8 deletions
|
|
@ -88,14 +88,19 @@ func _on_install_progressed(_id: String, current: int, total: int) -> void:
|
|||
|
||||
## Returns true unless the "only show games available on this platform"
|
||||
## filter is enabled and the game's platforms don't include the OS
|
||||
## OpenGamepadUI is running on. Games with no platform info at all (e.g.
|
||||
## HTML5) are kept, since there's nothing to filter on.
|
||||
func _game_available_on_current_platform(game: Dictionary) -> bool:
|
||||
## OpenGamepadUI is running on. Installed games always pass: they were
|
||||
## installed on this machine, so they're runnable regardless of what
|
||||
## platform info butlerd reported. Everything else needs an explicit
|
||||
## platform match, so games with no platform info at all (e.g. HTML5) are
|
||||
## hidden while the filter is on.
|
||||
func _game_available_on_current_platform(game: Dictionary, installed := false) -> bool:
|
||||
if not _filter_unsupported():
|
||||
return true
|
||||
if installed:
|
||||
return true
|
||||
var platforms: Dictionary = game.get("platforms", {})
|
||||
if platforms.is_empty():
|
||||
return true
|
||||
return false
|
||||
var current := "windows"
|
||||
if OS.get_name() == "Linux":
|
||||
current = "linux"
|
||||
|
|
@ -116,10 +121,10 @@ func _make_item(game: Dictionary, caves_by_game_id: Dictionary) -> Variant:
|
|||
return null
|
||||
if game.get("classification", "game") != "game":
|
||||
return null
|
||||
if not _game_available_on_current_platform(game):
|
||||
return null
|
||||
var game_id: int = game.get("id", 0)
|
||||
var cave: Dictionary = caves_by_game_id.get(game_id, {})
|
||||
if not _game_available_on_current_platform(game, not cave.is_empty()):
|
||||
return null
|
||||
|
||||
var item := LibraryLaunchItem.new()
|
||||
item.provider_app_id = cave.get("id", "")
|
||||
|
|
@ -150,7 +155,7 @@ func _load_library(caching_flags: int = Cache.FLAGS.LOAD | Cache.FLAGS.SAVE) ->
|
|||
for i in json_items:
|
||||
var item := LibraryLaunchItem.from_dict(i)
|
||||
var game: Dictionary = item.metadata.get("game", {})
|
||||
if not _game_available_on_current_platform(game):
|
||||
if not _game_available_on_current_platform(game, item.installed):
|
||||
continue
|
||||
items.append(item)
|
||||
_queue_boxart(items)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue