From 7d5dedc0b98c6ba43a5ebebd91c8cf1aacd2189d Mon Sep 17 00:00:00 2001 From: Jose Falanga Date: Fri, 7 Aug 2026 22:19:51 -0300 Subject: [PATCH] Hide games with no platform info while the platform filter is on (v0.1.10) --- core/library_itch.gd | 19 ++++++++++++------- plugin.json | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/core/library_itch.gd b/core/library_itch.gd index 2d2a28f..e74df03 100644 --- a/core/library_itch.gd +++ b/core/library_itch.gd @@ -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) diff --git a/plugin.json b/plugin.json index 3bf4d0e..0edf180 100644 --- a/plugin.json +++ b/plugin.json @@ -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",