Compare commits

...
Author SHA1 Message Date
The412Banner 32783bfe59 fix(ea): list games bought on Epic that the EA app installs 2026-11-25 20:44:25 +00:00
2 changed files with 17 additions and 8 deletions

No files matched your search

@@ -117,19 +117,20 @@ object EaApi {
return list to next
}
internal fun ownedVariables(next: String): JSONObject = JSONObject()
.put("isMac", false)
.put("limit", 100)
.put("next", next)
.put("type", JSONArray().put("DIGITAL_FULL_GAME").put("PACKAGED_FULL_GAME"))
.put("storefronts", JSONArray().put("EA").put("EPIC"))
.put("platforms", JSONArray().put("PC"))
fun owned(token: String): List<OwnedProduct> {
val out = ArrayList<OwnedProduct>()
var next: String? = "0"
var guard = 0
while (next != null && guard++ < 50) {
val variables = JSONObject()
.put("isMac", false)
.put("limit", 100)
.put("next", next)
.put("type", JSONArray().put("DIGITAL_FULL_GAME").put("PACKAGED_FULL_GAME"))
.put("storefronts", JSONArray().put("EA"))
.put("platforms", JSONArray().put("PC"))
val (items, after) = parseOwned(call(token, "getPreloadedOwnedGames", variables))
val (items, after) = parseOwned(call(token, "getPreloadedOwnedGames", ownedVariables(next)))
out += items
next = after?.takeIf { it != next && items.isNotEmpty() }
}
@@ -298,6 +298,14 @@ class EaTest {
assertNotNull(EaApi.query("getPreloadedOwnedGames"))
}
@Test fun ownedGamesIncludeEpicCopiesTheEaAppInstallsButNotSteamCopies() {
val variables = EaApi.ownedVariables("0")
val storefronts = variables.getJSONArray("storefronts").let { a -> (0 until a.length()).map { a.getString(it) } }
assertEquals(listOf("EA", "EPIC"), storefronts)
assertEquals("0", variables.getString("next"))
assertEquals("PC", variables.getJSONArray("platforms").getString(0))
}
@Test fun launcherReadsTheSessionFileOnce() {
val text = StoreLaunch.launcherText(StoreGameSidecar(Store.EA, "Origin.OFR.1", "Game", exe = "bin/Game.exe", args = listOf("-dx12")))
assertTrue(text.contains("for /f \"usebackq tokens=1,* delims==\" %%a in (\"%~dp0.droiddeck-ea-env\") do set \"%%a=%%b\""))