Hide games with no platform info while the platform filter is on (v0.1.10)

This commit is contained in:
Jose Falanga 2026-08-07 22:19:51 -03:00
parent b0183b7c20
commit 7d5dedc0b9
2 changed files with 13 additions and 8 deletions

View file

@ -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)

View file

@ -1,7 +1,7 @@
{
"plugin.id": "itch",
"plugin.name": "itch.io",
"plugin.version": "0.1.9",
"plugin.version": "0.1.10",
"plugin.min-api-version": "1.1.0",
"plugin.link": "https://forge.thergic.ar/jose/itchio-opengamepadui-plugin",
"plugin.source": "https://forge.thergic.ar/jose/itchio-opengamepadui-plugin",