From c7cd7c18e65d0d4b6a6b1d42976a051ac6ce3ea4 Mon Sep 17 00:00:00 2001 From: Hay Li bi <49456938+haylibi@users.noreply.github.com> Date: Wed, 2 Dec 2026 21:47:36 +0200 Subject: [PATCH] fix(ea): the game's own Origin session gets the profile and GetSettings (#3578) EA games open two LSX sessions: the activation layer's, which holds the launch, and the game SDK's, which claims the same game but is never trusted. GetProfile then sent it an empty UserId/PersonaId, which the SDK parses as integers, and Lost in Random quit on the FormatException. Sessions that claimed the prepared game now get the profile ids (tokens, codes, licences and entitlements stay with the trusted session), and GetSettings is answered with the SDK's GetSettingsResponse instead of ErrorSuccess. --- .../com/droiddeck/launcher/stores/ea/EaLsx.kt | 14 ++++--- .../droiddeck/launcher/stores/ea/EaTest.kt | 39 +++++++++++++++++++ 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/stores/ea/EaLsx.kt b/app/src/main/java/com/droiddeck/launcher/stores/ea/EaLsx.kt index f9e6b286a0..35e9bdb343 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/ea/EaLsx.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/ea/EaLsx.kt @@ -67,7 +67,7 @@ object EaLsx { } @Volatile var game: Game? = null - @Volatile private var account: Account? = null + @Volatile internal var account: Account? = null /** The one session of the current launch that may act for the account. */ /** Bumped whenever the launch changes; a connection accepted under an older one is not admitted. */ @Volatile internal var generation = 0 @@ -333,10 +333,11 @@ object EaLsx { private fun now() = LocalDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")) - private fun answer(session: Session, m: Message): String? { + internal fun answer(session: Session, m: Message): String? { val g = game val who = account val person = who?.takeIf { session.trusted } + val profile = who?.takeIf { session.trusted || session.claimed } val locale = g?.locale ?: "en_US" return when (m.name) { "ChallengeResponse" -> { @@ -355,15 +356,16 @@ object EaLsx { "GetConfig" -> tag("GetConfigResponse", body = SERVICES.joinToString("") { tag("Service", "Name" to it.first, "Facility" to it.second) }) "GetProfile" -> tag( "GetProfileResponse", - "Persona" to person?.persona.orEmpty(), "SubscriberLevel" to 0, "CommerceCurrency" to "USD", "IsTrialSubscriber" to false, - "Country" to "US", "UserId" to person?.userId.orEmpty(), "GeoCountry" to "US", "AvatarId" to "", "IsSubscriber" to false, - "IsSteamSubscriber" to false, "PersonaId" to person?.personaId.orEmpty(), "IsUnderAge" to false, "UserIndex" to 0, + "Persona" to profile?.persona.orEmpty(), "SubscriberLevel" to 0, "CommerceCurrency" to "USD", "IsTrialSubscriber" to false, + "Country" to "US", "UserId" to profile?.userId.orEmpty(), "GeoCountry" to "US", "AvatarId" to "", "IsSubscriber" to false, + "IsSteamSubscriber" to false, "PersonaId" to profile?.personaId.orEmpty(), "IsUnderAge" to false, "UserIndex" to 0, ) "GetSetting" -> tag("GetSettingResponse", "Setting" to when (m.attrs["SettingId"]) { "ENVIRONMENT" -> "production" "LANGUAGE" -> locale else -> "false" }) + "GetSettings" -> tag("GetSettingsResponse", "IsIGOAvailable" to false, "IsIGOEnabled" to false, "IsTelemetryEnabled" to false, "IsManualOffline" to false) "GetGameInfo" -> tag("GetGameInfoResponse", "GameInfo" to when (m.attrs["GameInfoId"]) { "FREETRIAL" -> "false" "LANGUAGES" -> LANGUAGES @@ -403,7 +405,7 @@ object EaLsx { ) }) } - "GetPresence" -> tag("GetPresenceResponse", "UserId" to person?.userId.orEmpty(), "Presence" to "INGAME") + "GetPresence" -> tag("GetPresenceResponse", "UserId" to profile?.userId.orEmpty(), "Presence" to "INGAME") "QueryPresence" -> tag("QueryPresenceResponse", body = "") "QueryFriends" -> tag("QueryFriendsResponse", body = "") "GetBlockList" -> tag("GetBlockListResponse", "Return" to "Success", body = "") diff --git a/app/src/test/java/com/droiddeck/launcher/stores/ea/EaTest.kt b/app/src/test/java/com/droiddeck/launcher/stores/ea/EaTest.kt index 84500376ca..5cafddc391 100644 --- a/app/src/test/java/com/droiddeck/launcher/stores/ea/EaTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/stores/ea/EaTest.kt @@ -132,6 +132,45 @@ class EaTest { dir.deleteRecursively() } + private object LsxAccount : EaLsx.Account { + override val userId = "1000000000042" + override val personaId = "1000000000043" + override val persona = "Player" + override fun authCode(clientId: String, scope: String?) = "code" + override fun license(contentId: String, requestTicket: String, ticketEngine: String) = "licence" + override fun entitlements(group: String) = emptyList>() + override fun token() = "token" + } + + private fun lsx(body: String) = EaLsx.parse("$body")!! + + @Test fun theGamesSecondSessionGetsTheProfileButNoSecrets() { + EaLsx.account = LsxAccount + try { + val sdk = EaLsx.Session(java.net.Socket(), java.io.ByteArrayOutputStream(), false, unverifiable = true).apply { claimed = true } + val profile = EaLsx.answer(sdk, lsx(""))!! + assertTrue(profile, profile.contains("UserId=\"1000000000042\"")) + assertTrue(profile, profile.contains("PersonaId=\"1000000000043\"")) + assertTrue(profile, profile.contains("Persona=\"Player\"")) + assertTrue(EaLsx.answer(sdk, lsx(""))!!.contains("UserId=\"1000000000042\"")) + assertEquals("", EaLsx.answer(sdk, lsx(""))) + assertEquals("", EaLsx.answer(sdk, lsx(""))) + + val stranger = EaLsx.Session(java.net.Socket(), java.io.ByteArrayOutputStream(), false, unverifiable = true) + assertTrue(EaLsx.answer(stranger, lsx(""))!!.contains("UserId=\"\"")) + } finally { + EaLsx.account = null + } + } + + @Test fun getSettingsAnswersWithTheSdksSettingsType() { + val session = EaLsx.Session(java.net.Socket(), java.io.ByteArrayOutputStream(), false) + assertEquals( + "", + EaLsx.answer(session, lsx("")), + ) + } + @Test fun lsxRequestsAreParsed() { val m = EaLsx.parse("")!! assertEquals("GetSetting", m.name)