diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index da70a25f..b59678ec 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -122,6 +122,10 @@ jobs: make -s compatsvc-check make -s prefixstate-check make -s defaults-check + make -s verdict-check + make -s game-check + make -s badge-check + make -s catalog-check make -s compatpage-check make -s defaults-drift make -s shortcutcheck diff --git a/Makefile b/Makefile index 14db835f..193856e6 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,10 @@ SRCS := \ dylib/feats/defaults.c \ dylib/feats/compatpage.c \ dylib/feats/prefixstate.c \ + dylib/feats/verdict.c \ + dylib/feats/game.c \ + dylib/feats/badge.c \ + dylib/feats/catalog.c \ dylib/feats/usershortcuts.c \ dylib/feats/conf.c \ dylib/feats/webpatch.c \ @@ -78,7 +82,7 @@ DEPS := $(OBJS:.o=.d) tests-list overlay-shim overlay-shim-install overlay-shim-tests \ overlay-shim-bench iconmaker icon \ appinfo helpers-install ntdll-resolve bridge runcheck compatcheck envpasscheck \ - compatsvc-check prefixstate-check defaults-check compatpage-check defaults-drift shortcutcheck scriptcheck envcheck buildcheck settingscheck routecheck bridgecheck gamedrivecheck launchercheck bundlecheck launch-shell activatecheck FORCE + compatsvc-check prefixstate-check defaults-check verdict-check game-check badge-check catalog-check compatpage-check defaults-drift shortcutcheck scriptcheck envcheck buildcheck settingscheck routecheck bridgecheck gamedrivecheck launchercheck bundlecheck launch-shell activatecheck FORCE APP_PAYLOAD := app/Sources/NotProtonApp/Resources/payload @@ -194,7 +198,7 @@ PREFIXSTATE_CHECK := $(OUT_DIR)/prefixstate-check prefixstate-check: @if [ ! -f dylib/tests/prefixstate-check.c ]; then $(call SKIP,prefixstate-check,dylib/tests/prefixstate-check.c); exit 0; fi; \ mkdir -p $(OUT_DIR) && \ - $(TEST_CC) -o $(PREFIXSTATE_CHECK) dylib/tests/prefixstate-check.c && \ + $(TEST_CC) -o $(PREFIXSTATE_CHECK) dylib/tests/prefixstate-check.c dylib/feats/verdict.c && \ $(PREFIXSTATE_CHECK) COMPATSVC_CHECK := $(OUT_DIR)/compatsvc-check @@ -215,6 +219,45 @@ $(DEFAULTS_CHECK): dylib/tests/defaults-check.c dylib/feats/defaults.c dylib/fea defaults-check: $(DEFAULTS_CHECK) @$(DEFAULTS_CHECK) +CATALOG_CHECK := $(OUT_DIR)/catalog-check + +$(CATALOG_CHECK): dylib/tests/catalog-check.c dylib/feats/catalog.c dylib/feats/catalog.h \ + dylib/feats/badge.c dylib/feats/game.c dylib/feats/verdict.c dylib/util/file.c + @mkdir -p $(dir $@) + $(TEST_CC) -o $@ dylib/tests/catalog-check.c dylib/feats/badge.c dylib/feats/game.c \ + dylib/feats/verdict.c dylib/util/file.c dylib/util/log.c + +catalog-check: $(CATALOG_CHECK) + @$(CATALOG_CHECK) + +GAME_CHECK := $(OUT_DIR)/game-check + +$(GAME_CHECK): dylib/tests/game-check.c dylib/feats/game.c dylib/feats/game.h + @mkdir -p $(dir $@) + $(TEST_CC) -o $@ dylib/tests/game-check.c + +BADGE_CHECK := $(OUT_DIR)/badge-check + +$(BADGE_CHECK): dylib/tests/badge-check.c dylib/feats/badge.c dylib/feats/badge.h \ + dylib/feats/game.c dylib/feats/verdict.c + @mkdir -p $(dir $@) + $(TEST_CC) -o $@ dylib/tests/badge-check.c dylib/feats/game.c dylib/feats/verdict.c + +badge-check: $(BADGE_CHECK) + @$(BADGE_CHECK) + +game-check: $(GAME_CHECK) + @$(GAME_CHECK) + +VERDICT_CHECK := $(OUT_DIR)/verdict-check + +$(VERDICT_CHECK): dylib/tests/verdict-check.c dylib/feats/verdict.c dylib/feats/verdict.h + @mkdir -p $(dir $@) + $(TEST_CC) -o $@ dylib/tests/verdict-check.c + +verdict-check: $(VERDICT_CHECK) + @$(VERDICT_CHECK) + COMPATPAGE_CHECK := $(OUT_DIR)/compatpage-check compatpage-check: @@ -500,6 +543,7 @@ panel-behavior: node $(PANEL_TESTS)/behavior.js $(OUT_DIR)/panel-emit && \ node $(PANEL_TESTS)/switching.js $(OUT_DIR)/panel-emit && \ node $(PANEL_TESTS)/launch-options.js $(OUT_DIR)/panel-emit && \ + node $(PANEL_TESTS)/badge.js $(OUT_DIR)/panel-emit && \ node $(PANEL_TESTS)/shell.js $(OUT_DIR)/panel-emit && \ node $(PANEL_TESTS)/migration.js $(OUT_DIR)/panel-emit && \ node $(PANEL_TESTS)/localization.js $(OUT_DIR)/panel-emit && \ diff --git a/README.md b/README.md index 4f5ec728..1bef1780 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,14 @@ I would have done things differently had I been aware of that. Thanks to everyone who has positively contributed to macOS gaming. +Mac compatibility: + +Each installed game gets an Apple badge in the corner of its library tile and a MAC stat on its +page: green if it has run well on this Mac, yellow if a launcher is in the way or it has crashed +here, red if it carries an anti-cheat or has only ever crashed, and a dashed ring if it has not run +here yet. It is all worked out from this Mac. Turn it off under Steam → Preferences → Compatibility. +See ```docs/mac-compatibility.md```. + Developer Notes: As far as the source structure goes, the macOS app itself is located in the ```app``` folder. The core logic is in ```dylib```. diff --git a/docs/mac-compatibility.md b/docs/mac-compatibility.md new file mode 100644 index 00000000..66e8261b --- /dev/null +++ b/docs/mac-compatibility.md @@ -0,0 +1,67 @@ +# Mac compatibility badges + +An Apple badge on each installed game, in the corner of its library tile where Steam +puts the Steam Deck badge, and a `MAC` stat on the game's page next to Play Time. Hover +either one for the reason. + +Everything comes from this Mac. Nothing is fetched, nothing is applied to a game, and +no Steam Deck data is used. + +## The badges + +| Badge | Label | When | +|---|---|---| +| Green | Verified | It has run here at least twice, for 20 minutes or more, without crashing. Or it ships a native macOS build. | +| Yellow | Playable | It starts through a third-party launcher (EA app, Ubisoft Connect, Epic, Rockstar), or some of its sessions here crashed. | +| Red | Unsupported | Its folder carries an anti-cheat (Easy Anti-Cheat, BattlEye, Vanguard), or every session here crashed. | +| Dashed ring | Unknown | It has not run here yet. | + +An anti-cheat outranks any history. + +## Where it comes from + +- **Sessions.** At the end of each launch, the run script already decides whether the + session was healthy, failed, or neither (`session_health`). It now also keeps a running + count beside the prefix in `notproton-sessions`. +- **The game's folder.** A walk of the install (5 levels, 20,000 entries at most) for + anti-cheat and launcher files and a macOS app bundle. File names only. The result is + kept in `notproton-scan` beside the prefix and redone when the game updates. + +The Compatibility page's rebuild row also shows the verdict with its numbers: runs, +crashes, time played, the CrossOver build and backend of the last session. + +## Turning it off + +Steam → Preferences → Compatibility → **Show Mac compatibility badges**. It takes effect +at once. Or create an empty `no-mac-badges` in `~/Library/Application Support/notproton/`. + +## Files + +| File | Does | +|---|---| +| `dylib/feats/compat_run.sh` | `record_history` keeps the session counts. | +| `dylib/feats/verdict.c` | Session counts → a tier. | +| `dylib/feats/game.c` | Install folder → anti-cheat, launcher, native build. | +| `dylib/feats/badge.c` | Game + history → badge and reason. | +| `dylib/feats/catalog.c` | One pass over the installed games, on a thread. Writes `badges` in the support folder and hands the map to the library. | +| `dylib/feats/webpatch.c` | Tile badge, game page stat, Preferences switch. | +| `dylib/feats/prefixstate.c` | Adds the verdict to the Compatibility page's state. | + +## Notes for changing the UI + +- Steam runs its JavaScript in a hidden `SharedJSContext` and draws into a separate + window, so a `